2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
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.
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.
16 * You should have received a copy of the GNU Library General Public License
17 * along 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.
22 #ifndef FEComponentTransfer_h
23 #define FEComponentTransfer_h
26 #include "FilterEffect.h"
29 #include <wtf/Vector.h>
33 enum ComponentTransferType {
34 FECOMPONENTTRANSFER_TYPE_UNKNOWN = 0,
35 FECOMPONENTTRANSFER_TYPE_IDENTITY = 1,
36 FECOMPONENTTRANSFER_TYPE_TABLE = 2,
37 FECOMPONENTTRANSFER_TYPE_DISCRETE = 3,
38 FECOMPONENTTRANSFER_TYPE_LINEAR = 4,
39 FECOMPONENTTRANSFER_TYPE_GAMMA = 5
42 struct ComponentTransferFunction {
43 ComponentTransferFunction()
44 : type(FECOMPONENTTRANSFER_TYPE_UNKNOWN)
53 ComponentTransferType type;
61 Vector<float> tableValues;
64 class FEComponentTransfer : public FilterEffect {
66 static PassRefPtr<FEComponentTransfer> create(Filter*, const ComponentTransferFunction& redFunc, const ComponentTransferFunction& greenFunc,
67 const ComponentTransferFunction& blueFunc, const ComponentTransferFunction& alphaFunc);
69 ComponentTransferFunction redFunction() const;
70 void setRedFunction(const ComponentTransferFunction&);
72 ComponentTransferFunction greenFunction() const;
73 void setGreenFunction(const ComponentTransferFunction&);
75 ComponentTransferFunction blueFunction() const;
76 void setBlueFunction(const ComponentTransferFunction&);
78 ComponentTransferFunction alphaFunction() const;
79 void setAlphaFunction(const ComponentTransferFunction&);
81 virtual void platformApplySoftware();
84 virtual TextStream& externalRepresentation(TextStream&, int indention) const;
87 FEComponentTransfer(Filter*, const ComponentTransferFunction& redFunc, const ComponentTransferFunction& greenFunc,
88 const ComponentTransferFunction& blueFunc, const ComponentTransferFunction& alphaFunc);
90 ComponentTransferFunction m_redFunc;
91 ComponentTransferFunction m_greenFunc;
92 ComponentTransferFunction m_blueFunc;
93 ComponentTransferFunction m_alphaFunc;
96 } // namespace WebCore
98 #endif // ENABLE(FILTERS)
100 #endif // FEComponentTransfer_h