335306fe2a9a5a259ea93ef0a751d998f06cfb1a
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / platform / graphics / filters / FETurbulence.h
1 /*
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) 2009 Dirk Schulze <krit@webkit.org>
6  * Copyright (C) 2010 Renata Hodovan <reni@inf.u-szeged.hu>
7  * Copyright (C) 2013 Google Inc. All rights reserved.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library General Public License
20  * along with this library; see the file COPYING.LIB.  If not, write to
21  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  * Boston, MA 02110-1301, USA.
23  */
24
25 #ifndef FETurbulence_h
26 #define FETurbulence_h
27
28 #include "platform/graphics/filters/FilterEffect.h"
29
30 class SkShader;
31
32 namespace blink {
33
34 enum TurbulenceType {
35     FETURBULENCE_TYPE_UNKNOWN = 0,
36     FETURBULENCE_TYPE_FRACTALNOISE = 1,
37     FETURBULENCE_TYPE_TURBULENCE = 2
38 };
39
40 class PLATFORM_EXPORT FETurbulence : public FilterEffect {
41 public:
42     static PassRefPtr<FETurbulence> create(Filter*, TurbulenceType, float, float, int, float, bool);
43
44     TurbulenceType type() const;
45     bool setType(TurbulenceType);
46
47     float baseFrequencyY() const;
48     bool setBaseFrequencyY(float);
49
50     float baseFrequencyX() const;
51     bool setBaseFrequencyX(float);
52
53     float seed() const;
54     bool setSeed(float);
55
56     int numOctaves() const;
57     bool setNumOctaves(int);
58
59     bool stitchTiles() const;
60     bool setStitchTiles(bool);
61
62     static void fillRegionWorker(void*);
63
64     virtual TextStream& externalRepresentation(TextStream&, int indention) const override;
65
66 private:
67     FETurbulence(Filter*, TurbulenceType, float, float, int, float, bool);
68
69     virtual PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*) override;
70     SkShader* createShader();
71
72     TurbulenceType m_type;
73     float m_baseFrequencyX;
74     float m_baseFrequencyY;
75     int m_numOctaves;
76     float m_seed;
77     bool m_stitchTiles;
78 };
79
80 } // namespace blink
81
82 #endif // FETurbulence_h