KHTML
SVGFEComponentTransfer.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 SVGFEComponentTransfer_h 00023 #define SVGFEComponentTransfer_h 00024 00025 #if ENABLE(SVG) && ENABLE(SVG_FILTERS) 00026 #include <wtf/Vector.h> 00027 00028 #include "SVGFilterEffect.h" 00029 #include "SVGFEDisplacementMap.h" 00030 00031 #if PLATFORM(CI) 00032 #ifdef __OBJC__ 00033 @class CIImage; 00034 @class CIFilter; 00035 #else 00036 class CIImage; 00037 class CIFilter; 00038 #endif 00039 #endif 00040 00041 namespace WebCore { 00042 00043 enum SVGComponentTransferType { 00044 SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN = 0, 00045 SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY = 1, 00046 SVG_FECOMPONENTTRANSFER_TYPE_TABLE = 2, 00047 SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE = 3, 00048 SVG_FECOMPONENTTRANSFER_TYPE_LINEAR = 4, 00049 SVG_FECOMPONENTTRANSFER_TYPE_GAMMA = 5 00050 }; 00051 00052 struct SVGComponentTransferFunction { 00053 SVGComponentTransferFunction() 00054 : type(SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN) 00055 , slope(0.0f) 00056 , intercept(0.0f) 00057 , amplitude(0.0f) 00058 , exponent(0.0f) 00059 , offset(0.0f) 00060 { 00061 } 00062 00063 SVGComponentTransferType type; 00064 00065 float slope; 00066 float intercept; 00067 float amplitude; 00068 float exponent; 00069 float offset; 00070 00071 Vector<float> tableValues; 00072 }; 00073 00074 class SVGFEComponentTransfer : public SVGFilterEffect { 00075 public: 00076 SVGFEComponentTransfer(SVGResourceFilter*); 00077 00078 SVGComponentTransferFunction redFunction() const; 00079 void setRedFunction(const SVGComponentTransferFunction&); 00080 00081 SVGComponentTransferFunction greenFunction() const; 00082 void setGreenFunction(const SVGComponentTransferFunction&); 00083 00084 SVGComponentTransferFunction blueFunction() const; 00085 void setBlueFunction(const SVGComponentTransferFunction&); 00086 00087 SVGComponentTransferFunction alphaFunction() const; 00088 void setAlphaFunction(const SVGComponentTransferFunction&); 00089 00090 virtual TextStream& externalRepresentation(TextStream&) const; 00091 00092 #if PLATFORM(CI) 00093 virtual CIFilter* getCIFilter(const FloatRect& bbox) const; 00094 00095 private: 00096 CIFilter* getFunctionFilter(SVGChannelSelectorType, CIImage* inputImage) const; 00097 #endif 00098 00099 private: 00100 SVGComponentTransferFunction m_redFunc; 00101 SVGComponentTransferFunction m_greenFunc; 00102 SVGComponentTransferFunction m_blueFunc; 00103 SVGComponentTransferFunction m_alphaFunc; 00104 }; 00105 00106 } // namespace WebCore 00107 00108 #endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) 00109 00110 #endif // SVGFEComponentTransfer_h
KDE 4.6 API Reference