2 Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 2004, 2005 Rob Buis <buis@kde.org>
4 2005 Eric Seidel <eric@webkit.org>
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public License
17 aint with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
22 #ifndef SVGResourceFilter_h
23 #define SVGResourceFilter_h
25 #if ENABLE(SVG) && ENABLE(SVG_FILTERS)
26 #include "SVGResource.h"
27 #include "SVGFilterEffect.h"
29 #include "FloatRect.h"
31 #include <wtf/OwnPtr.h>
35 class GraphicsContext
;
36 class SVGFilterEffect
;
38 class SVGResourceFilterPlatformData
{
40 virtual ~SVGResourceFilterPlatformData() {}
43 class SVGResourceFilter
: public SVGResource
{
47 virtual SVGResourceType
resourceType() const { return FilterResourceType
; }
49 bool filterBoundingBoxMode() const { return m_filterBBoxMode
; }
50 void setFilterBoundingBoxMode(bool bboxMode
) { m_filterBBoxMode
= bboxMode
; }
52 bool effectBoundingBoxMode() const { return m_effectBBoxMode
; }
53 void setEffectBoundingBoxMode(bool bboxMode
) { m_effectBBoxMode
= bboxMode
; }
55 bool xBoundingBoxMode() const { return m_xBBoxMode
; }
56 void setXBoundingBoxMode(bool bboxMode
) { m_xBBoxMode
= bboxMode
; }
58 bool yBoundingBoxMode() const { return m_yBBoxMode
; }
59 void setYBoundingBoxMode(bool bboxMode
) { m_yBBoxMode
= bboxMode
; }
61 FloatRect
filterRect() const { return m_filterRect
; }
62 void setFilterRect(const FloatRect
& rect
) { m_filterRect
= rect
; }
64 FloatRect
filterBBoxForItemBBox(const FloatRect
& itemBBox
) const;
67 void addFilterEffect(SVGFilterEffect
*);
69 virtual TextStream
& externalRepresentation(TextStream
&) const;
71 // To be implemented in platform specific code.
72 void prepareFilter(GraphicsContext
*&, const FloatRect
& bbox
);
73 void applyFilter(GraphicsContext
*&, const FloatRect
& bbox
);
75 SVGResourceFilterPlatformData
* platformData() { return m_platformData
.get(); }
76 const Vector
<SVGFilterEffect
*>& effects() { return m_effects
; }
79 SVGResourceFilterPlatformData
* createPlatformData();
81 OwnPtr
<SVGResourceFilterPlatformData
> m_platformData
;
83 bool m_filterBBoxMode
: 1;
84 bool m_effectBBoxMode
: 1;
89 FloatRect m_filterRect
;
90 Vector
<SVGFilterEffect
*> m_effects
;
93 SVGResourceFilter
* getFilterById(Document
*, const AtomicString
&);
95 } // namespace WebCore
99 #endif // SVGResourceFilter_h