1/*
2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB.  If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21#ifndef SVGFilter_h
22#define SVGFilter_h
23
24#if ENABLE(SVG) && ENABLE(FILTERS)
25#include "AffineTransform.h"
26#include "Filter.h"
27#include "FilterEffect.h"
28#include "FloatRect.h"
29#include "FloatSize.h"
30
31#include <wtf/PassRefPtr.h>
32#include <wtf/RefCounted.h>
33#include <wtf/RefPtr.h>
34
35namespace WebCore {
36
37class SVGFilter : public Filter {
38public:
39    static PassRefPtr<SVGFilter> create(const AffineTransform&, const FloatRect&, const FloatRect&, const FloatRect&, bool);
40
41    FloatRect filterRegionInUserSpace() const { return m_filterRegion; }
42    virtual FloatRect filterRegion() const { return m_absoluteFilterRegion; }
43
44    virtual float applyHorizontalScale(float value) const;
45    virtual float applyVerticalScale(float value) const;
46
47    virtual FloatRect sourceImageRect() const { return m_absoluteSourceDrawingRegion; }
48    FloatRect targetBoundingBox() const { return m_targetBoundingBox; }
49
50private:
51    SVGFilter(const AffineTransform& absoluteTransform, const FloatRect& absoluteSourceDrawingRegion, const FloatRect& targetBoundingBox, const FloatRect& filterRegion, bool effectBBoxMode);
52
53    FloatRect m_absoluteSourceDrawingRegion;
54    FloatRect m_targetBoundingBox;
55    FloatRect m_absoluteFilterRegion;
56    FloatRect m_filterRegion;
57    bool m_effectBBoxMode;
58};
59
60} // namespace WebCore
61
62#endif // ENABLE(SVG) && ENABLE(FILTERS)
63
64#endif // SVGFilter_h
65