KHTML
SVGFEComponentTransfer.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 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 }
00107
00108 #endif // ENABLE(SVG) && ENABLE(SVG_FILTERS)
00109
00110 #endif // SVGFEComponentTransfer_h