PeachDrawing
PeachDrawing.Filters
Turbulence Class
Perlin noise exactly as the SVG specification’s reference implementation defines it (Filter Effects 1, feTurbulence),
so a given seed, frequency and octave count yields the same picture every conforming renderer draws.
public sealed class Turbulence
Inheritance System.Object → Turbulence
Remarks
This class is a C# transliteration of the reference implementation published in the W3C Filter Effects Module Level 1 (https://www.w3.org/TR/filter-effects-1/): its constants, seeding, lattice and gradient set-up, noise function and stitching logic are the specification’s. Specification text copyright (c) 2018 W3C (MIT, ERCIM, Keio, Beihang), used under the W3C permissive document license (https://www.w3.org/copyright/). See THIRD-PARTY-LICENSES.md.
| Constructors | |
|---|---|
| Turbulence(long) | Creates a generator seeded per the SVG reference algorithm. |
| Methods | |
|---|---|
| Render(RasterSurface, double, double, double, double, int, bool, bool, double, double, double, double) | Fills surface with the noise, sampling each pixel’s centre in user space (pixelsPerUserX pixels per user unit) and premultiplying the result, which the reference algorithm defines as straight colour. |
| Sample(int, double, double, double, double, int, bool, bool, double, double, double, double) | The noise value of one colour channel at a point of the filter’s user space. |