| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkPerlinNoiseShader_DEFINED | 8 #ifndef SkPerlinNoiseShader_DEFINED |
| 9 #define SkPerlinNoiseShader_DEFINED | 9 #define SkPerlinNoiseShader_DEFINED |
| 10 | 10 |
| 11 #include "SkShader.h" | 11 #include "SkShader.h" |
| 12 | 12 |
| 13 /** \class SkPerlinNoiseShader | 13 /** \class SkPerlinNoiseShader |
| 14 | 14 |
| 15 SkPerlinNoiseShader creates an image using the Perlin turbulence function. | 15 SkPerlinNoiseShader creates an image using the Perlin turbulence function. |
| 16 | 16 |
| 17 It can produce tileable noise if asked to stitch tiles and provided a tile s
ize. | 17 It can produce tileable noise if asked to stitch tiles and provided a tile s
ize. |
| 18 In order to fill a large area with repeating noise, set the stitchTiles flag
to | 18 In order to fill a large area with repeating noise, set the stitchTiles flag
to |
| 19 true, and render exactly a single tile of noise. Without this flag, the resu
lt | 19 true, and render exactly a single tile of noise. Without this flag, the resu
lt |
| 20 will contain visible seams between tiles. | 20 will contain visible seams between tiles. |
| 21 | 21 |
| 22 The algorithm used is described here : | 22 The algorithm used is described here : |
| 23 http://www.w3.org/TR/SVG/filters.html#feTurbulenceElement | 23 http://www.w3.org/TR/SVG/filters.html#feTurbulenceElement |
| 24 */ | 24 */ |
| 25 class SkPerlinNoiseShader : public SkShader { | 25 class SK_API SkPerlinNoiseShader : public SkShader { |
| 26 struct PaintingData; | 26 struct PaintingData; |
| 27 public: | 27 public: |
| 28 struct StitchData; | 28 struct StitchData; |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * About the noise types : the difference between the 2 is just minor tweak
s to the algorithm, | 31 * About the noise types : the difference between the 2 is just minor tweak
s to the algorithm, |
| 32 * they're not 2 entirely different noises. The output looks different, but
once the noise is | 32 * they're not 2 entirely different noises. The output looks different, but
once the noise is |
| 33 * generated in the [1, -1] range, the output is brought back in the [0, 1]
range by doing : | 33 * generated in the [1, -1] range, the output is brought back in the [0, 1]
range by doing : |
| 34 * kFractalNoise_Type : noise * 0.5 + 0.5 | 34 * kFractalNoise_Type : noise * 0.5 + 0.5 |
| 35 * kTurbulence_Type : abs(noise) | 35 * kTurbulence_Type : abs(noise) |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 SkISize fTileSize; | 102 SkISize fTileSize; |
| 103 bool fStitchTiles; | 103 bool fStitchTiles; |
| 104 SkMatrix fMatrix; | 104 SkMatrix fMatrix; |
| 105 | 105 |
| 106 PaintingData* fPaintingData; | 106 PaintingData* fPaintingData; |
| 107 | 107 |
| 108 typedef SkShader INHERITED; | 108 typedef SkShader INHERITED; |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 #endif | 111 #endif |
| OLD | NEW |