KHTML
SVGResourceFilter.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef SVGResourceFilter_h
00023 #define SVGResourceFilter_h
00024
00025 #if ENABLE(SVG) && ENABLE(SVG_FILTERS)
00026 #include "SVGResource.h"
00027 #include "SVGFilterEffect.h"
00028
00029 #include "FloatRect.h"
00030
00031 #include <wtf/OwnPtr.h>
00032
00033 namespace WebCore {
00034
00035 class GraphicsContext;
00036 class SVGFilterEffect;
00037
00038 class SVGResourceFilterPlatformData {
00039 public:
00040 virtual ~SVGResourceFilterPlatformData() {}
00041 };
00042
00043 class SVGResourceFilter : public SVGResource {
00044 public:
00045 SVGResourceFilter();
00046
00047 virtual SVGResourceType resourceType() const { return FilterResourceType; }
00048
00049 bool filterBoundingBoxMode() const { return m_filterBBoxMode; }
00050 void setFilterBoundingBoxMode(bool bboxMode) { m_filterBBoxMode = bboxMode; }
00051
00052 bool effectBoundingBoxMode() const { return m_effectBBoxMode; }
00053 void setEffectBoundingBoxMode(bool bboxMode) { m_effectBBoxMode = bboxMode; }
00054
00055 bool xBoundingBoxMode() const { return m_xBBoxMode; }
00056 void setXBoundingBoxMode(bool bboxMode) { m_xBBoxMode = bboxMode; }
00057
00058 bool yBoundingBoxMode() const { return m_yBBoxMode; }
00059 void setYBoundingBoxMode(bool bboxMode) { m_yBBoxMode = bboxMode; }
00060
00061 FloatRect filterRect() const { return m_filterRect; }
00062 void setFilterRect(const FloatRect& rect) { m_filterRect = rect; }
00063
00064 FloatRect filterBBoxForItemBBox(const FloatRect& itemBBox) const;
00065
00066 void clearEffects();
00067 void addFilterEffect(SVGFilterEffect*);
00068
00069 virtual TextStream& externalRepresentation(TextStream&) const;
00070
00071
00072 void prepareFilter(GraphicsContext*&, const FloatRect& bbox);
00073 void applyFilter(GraphicsContext*&, const FloatRect& bbox);
00074
00075 SVGResourceFilterPlatformData* platformData() { return m_platformData.get(); }
00076 const Vector<SVGFilterEffect*>& effects() { return m_effects; }
00077
00078 private:
00079 SVGResourceFilterPlatformData* createPlatformData();
00080
00081 OwnPtr<SVGResourceFilterPlatformData> m_platformData;
00082
00083 bool m_filterBBoxMode : 1;
00084 bool m_effectBBoxMode : 1;
00085
00086 bool m_xBBoxMode : 1;
00087 bool m_yBBoxMode : 1;
00088
00089 FloatRect m_filterRect;
00090 Vector<SVGFilterEffect*> m_effects;
00091 };
00092
00093 SVGResourceFilter* getFilterById(Document*, const AtomicString&);
00094
00095 }
00096
00097 #endif // ENABLE(SVG)
00098
00099 #endif // SVGResourceFilter_h