KHTML
SVGResourceFilter.h
Go to the documentation of this file.
00001 /* 00002 Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 00003 2004, 2005 Rob Buis <buis@kde.org> 00004 2005 Eric Seidel <eric@webkit.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 aint with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 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 // To be implemented in platform specific code. 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 } // namespace WebCore 00096 00097 #endif // ENABLE(SVG) 00098 00099 #endif // SVGResourceFilter_h
KDE 4.6 API Reference