OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2010 Zoltan Herczeg <zherczeg@webkit.org> | 5 * Copyright (C) 2010 Zoltan Herczeg <zherczeg@webkit.org> |
6 * Copyright (C) 2013 Google Inc. All rights reserved. | 6 * Copyright (C) 2013 Google Inc. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
12 * | 12 * |
13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
17 * | 17 * |
18 * You should have received a copy of the GNU Library General Public License | 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 | 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, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
22 */ | 22 */ |
23 | 23 |
24 #ifndef FEConvolveMatrix_h | 24 #ifndef FEConvolveMatrix_h |
25 #define FEConvolveMatrix_h | 25 #define FEConvolveMatrix_h |
26 | 26 |
27 #include "platform/geometry/FloatPoint.h" | 27 #include "platform/geometry/IntPoint.h" |
28 #include "platform/geometry/FloatSize.h" | 28 #include "platform/geometry/IntSize.h" |
29 #include "platform/graphics/filters/Filter.h" | 29 #include "platform/graphics/filters/Filter.h" |
30 #include "platform/graphics/filters/FilterEffect.h" | 30 #include "platform/graphics/filters/FilterEffect.h" |
31 #include "wtf/Vector.h" | 31 #include "wtf/Vector.h" |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 enum EdgeModeType { | 35 enum EdgeModeType { |
36 EDGEMODE_UNKNOWN = 0, | 36 EDGEMODE_UNKNOWN = 0, |
37 EDGEMODE_DUPLICATE = 1, | 37 EDGEMODE_DUPLICATE = 1, |
38 EDGEMODE_WRAP = 2, | 38 EDGEMODE_WRAP = 2, |
39 EDGEMODE_NONE = 3 | 39 EDGEMODE_NONE = 3 |
40 }; | 40 }; |
41 | 41 |
42 class PLATFORM_EXPORT FEConvolveMatrix : public FilterEffect { | 42 class PLATFORM_EXPORT FEConvolveMatrix : public FilterEffect { |
43 public: | 43 public: |
44 static PassRefPtrWillBeRawPtr<FEConvolveMatrix> create(Filter*, const IntSiz
e&, | 44 static PassRefPtrWillBeRawPtr<FEConvolveMatrix> create(Filter*, const IntSiz
e&, |
45 float, float, const IntPoint&, EdgeModeType, const FloatPoint&, | 45 float, float, const IntPoint&, EdgeModeType, bool, const Vector<float>&)
; |
46 bool, const Vector<float>&); | |
47 | 46 |
48 IntSize kernelSize() const; | 47 IntSize kernelSize() const; |
49 void setKernelSize(const IntSize&); | 48 void setKernelSize(const IntSize&); |
50 | 49 |
51 const Vector<float>& kernel() const; | 50 const Vector<float>& kernel() const; |
52 void setKernel(const Vector<float>&); | 51 void setKernel(const Vector<float>&); |
53 | 52 |
54 float divisor() const; | 53 float divisor() const; |
55 bool setDivisor(float); | 54 bool setDivisor(float); |
56 | 55 |
57 float bias() const; | 56 float bias() const; |
58 bool setBias(float); | 57 bool setBias(float); |
59 | 58 |
60 IntPoint targetOffset() const; | 59 IntPoint targetOffset() const; |
61 bool setTargetOffset(const IntPoint&); | 60 bool setTargetOffset(const IntPoint&); |
62 | 61 |
63 EdgeModeType edgeMode() const; | 62 EdgeModeType edgeMode() const; |
64 bool setEdgeMode(EdgeModeType); | 63 bool setEdgeMode(EdgeModeType); |
65 | 64 |
66 FloatPoint kernelUnitLength() const; | |
67 bool setKernelUnitLength(const FloatPoint&); | |
68 | |
69 bool preserveAlpha() const; | 65 bool preserveAlpha() const; |
70 bool setPreserveAlpha(bool); | 66 bool setPreserveAlpha(bool); |
71 | 67 |
72 PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*) overrid
e; | 68 PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*) overrid
e; |
73 | 69 |
74 FloatRect mapPaintRect(const FloatRect&, bool forward = true) final; | 70 FloatRect mapPaintRect(const FloatRect&, bool forward = true) final; |
75 | 71 |
76 TextStream& externalRepresentation(TextStream&, int indention) const overrid
e; | 72 TextStream& externalRepresentation(TextStream&, int indention) const overrid
e; |
77 | 73 |
78 private: | 74 private: |
79 | |
80 FEConvolveMatrix(Filter*, const IntSize&, float, float, | 75 FEConvolveMatrix(Filter*, const IntSize&, float, float, |
81 const IntPoint&, EdgeModeType, const FloatPoint&, bool, const Vector
<float>&); | 76 const IntPoint&, EdgeModeType, bool, const Vector<float>&); |
82 | 77 |
83 IntSize m_kernelSize; | 78 IntSize m_kernelSize; |
84 float m_divisor; | 79 float m_divisor; |
85 float m_bias; | 80 float m_bias; |
86 IntPoint m_targetOffset; | 81 IntPoint m_targetOffset; |
87 EdgeModeType m_edgeMode; | 82 EdgeModeType m_edgeMode; |
88 FloatPoint m_kernelUnitLength; | |
89 bool m_preserveAlpha; | 83 bool m_preserveAlpha; |
90 Vector<float> m_kernelMatrix; | 84 Vector<float> m_kernelMatrix; |
91 }; | 85 }; |
92 | 86 |
93 } // namespace blink | 87 } // namespace blink |
94 | 88 |
95 #endif // FEConvolveMatrix_h | 89 #endif // FEConvolveMatrix_h |
OLD | NEW |