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>
5 * Copyright (C) 2010 Zoltan Herczeg <zherczeg@webkit.org>
6 * Copyright (C) 2013 Google Inc. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
24 #ifndef FEConvolveMatrix_h
25 #define FEConvolveMatrix_h
27 #include "platform/geometry/FloatPoint.h"
28 #include "platform/geometry/FloatSize.h"
29 #include "platform/graphics/filters/Filter.h"
30 #include "platform/graphics/filters/FilterEffect.h"
31 #include "wtf/Vector.h"
37 EDGEMODE_DUPLICATE = 1,
42 class PLATFORM_EXPORT FEConvolveMatrix : public FilterEffect {
44 static PassRefPtr<FEConvolveMatrix> create(Filter*, const IntSize&,
45 float, float, const IntPoint&, EdgeModeType, const FloatPoint&,
46 bool, const Vector<float>&);
48 IntSize kernelSize() const;
49 void setKernelSize(const IntSize&);
51 const Vector<float>& kernel() const;
52 void setKernel(const Vector<float>&);
54 float divisor() const;
55 bool setDivisor(float);
60 IntPoint targetOffset() const;
61 bool setTargetOffset(const IntPoint&);
63 EdgeModeType edgeMode() const;
64 bool setEdgeMode(EdgeModeType);
66 FloatPoint kernelUnitLength() const;
67 bool setKernelUnitLength(const FloatPoint&);
69 bool preserveAlpha() const;
70 bool setPreserveAlpha(bool);
72 virtual PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*) override;
74 virtual FloatRect mapPaintRect(const FloatRect&, bool forward = true) override final;
76 virtual TextStream& externalRepresentation(TextStream&, int indention) const override;
80 FEConvolveMatrix(Filter*, const IntSize&, float, float,
81 const IntPoint&, EdgeModeType, const FloatPoint&, bool, const Vector<float>&);
86 IntPoint m_targetOffset;
87 EdgeModeType m_edgeMode;
88 FloatPoint m_kernelUnitLength;
90 Vector<float> m_kernelMatrix;
95 #endif // FEConvolveMatrix_h