KHtml

SVGFEComponentTransfer.h
1 /*
2  Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <[email protected]>
3  2004, 2005 Rob Buis <[email protected]>
4  2005 Eric Seidel <[email protected]>
5 
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.
10 
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.
15 
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.
20 */
21 
22 #ifndef SVGFEComponentTransfer_h
23 #define SVGFEComponentTransfer_h
24 
25 #if ENABLE(SVG) && ENABLE(SVG_FILTERS)
26 #include <wtf/Vector.h>
27 
28 #include "SVGFilterEffect.h"
29 #include "SVGFEDisplacementMap.h"
30 
31 #if PLATFORM(CI)
32 #ifdef __OBJC__
33 @class CIImage;
34 @class CIFilter;
35 #else
36 class CIImage;
37 class CIFilter;
38 #endif
39 #endif
40 
41 namespace WebCore
42 {
43 
44 enum SVGComponentTransferType {
45  SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN = 0,
46  SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY = 1,
47  SVG_FECOMPONENTTRANSFER_TYPE_TABLE = 2,
48  SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE = 3,
49  SVG_FECOMPONENTTRANSFER_TYPE_LINEAR = 4,
50  SVG_FECOMPONENTTRANSFER_TYPE_GAMMA = 5
51 };
52 
53 struct SVGComponentTransferFunction {
54  SVGComponentTransferFunction()
55  : type(SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN)
56  , slope(0.0f)
57  , intercept(0.0f)
58  , amplitude(0.0f)
59  , exponent(0.0f)
60  , offset(0.0f)
61  {
62  }
63 
64  SVGComponentTransferType type;
65 
66  float slope;
67  float intercept;
68  float amplitude;
69  float exponent;
70  float offset;
71 
72  Vector<float> tableValues;
73 };
74 
75 class SVGFEComponentTransfer : public SVGFilterEffect
76 {
77 public:
78  SVGFEComponentTransfer(SVGResourceFilter *);
79 
80  SVGComponentTransferFunction redFunction() const;
81  void setRedFunction(const SVGComponentTransferFunction &);
82 
83  SVGComponentTransferFunction greenFunction() const;
84  void setGreenFunction(const SVGComponentTransferFunction &);
85 
86  SVGComponentTransferFunction blueFunction() const;
87  void setBlueFunction(const SVGComponentTransferFunction &);
88 
89  SVGComponentTransferFunction alphaFunction() const;
90  void setAlphaFunction(const SVGComponentTransferFunction &);
91 
92  virtual TextStream &externalRepresentation(TextStream &) const;
93 
94 #if PLATFORM(CI)
95  virtual CIFilter *getCIFilter(const FloatRect &bbox) const;
96 
97 private:
98  CIFilter *getFunctionFilter(SVGChannelSelectorType, CIImage *inputImage) const;
99 #endif
100 
101 private:
102  SVGComponentTransferFunction m_redFunc;
103  SVGComponentTransferFunction m_greenFunc;
104  SVGComponentTransferFunction m_blueFunc;
105  SVGComponentTransferFunction m_alphaFunc;
106 };
107 
108 } // namespace WebCore
109 
110 #endif // ENABLE(SVG) && ENABLE(SVG_FILTERS)
111 
112 #endif // SVGFEComponentTransfer_h
Type type(const QSqlDatabase &db)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Oct 25 2021 22:48:22 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.