| Package | de.popforge.imageprocessing.filters.noise |
| Class | public final class PerlinNoise |
| Implements | IFilter |
In addition to the native function this filter caches the result. To force the re-creation of
the noise for one execution you may use perlinNoise.cache = false;.
Supported formats:
var filter: PerlinNoise = new PerlinNoise( 25, 25, 10 ); var video: WebCam = new WebCam( 160, 120 ); var image: Image = new Image( 160, 120, ImageFormat.RGB ); image.loadBitmapData( video.getCurrentFrame(), true ); filter.apply( image );
See also
| Property | Defined by | ||
|---|---|---|---|
| baseX : int
Frequency to use in the x direction.
| PerlinNoise | ||
| baseY : int
Frequency to use in the y direction.
| PerlinNoise | ||
| cache : Boolean
Setting
cache to false forces the filter to generate a new noise on next execution. | PerlinNoise | ||
| channelOptions : int
A number that can be a combination of any of the color channel values (
PerlinNoise.CHANNEL_GRAY, PerlinNoise.CHANNEL_RED, PerlinNoise.CHANNEL_GREEN, PerlinNoise.CHANNEL_BLUE, PerlinNoise.CHANNEL_ALPHA). | PerlinNoise | ||
| fractalNoise : Boolean
If the value is
true, the method generates fractal noise; otherwise, it generates turbulence. | PerlinNoise | ||
| numOctaves : int
Number of octaves or individual noise functions to combine to create this noise.
| PerlinNoise | ||
| offsets : Array
An array of points that correspond to x and y offsets for each octave.
| PerlinNoise | ||
| randomSeed : int
The random seed number to use.
| PerlinNoise | ||
| stitch : Boolean
If the value is
true, the method attempts to smooth the transition edges of the image to create seamless textures for tiling as a bitmap fill. | PerlinNoise | ||
| Method | Defined by | ||
|---|---|---|---|
|
PerlinNoise(baseX:int = 0, baseY:int = 0, numOctaves:uint = 1, randomSeed:int = -1, stitch:Boolean = false, fractalNoise:Boolean = false, channelOptions:int = 1, offsets:Array = null)
Creates a new PerlinNoise object.
| PerlinNoise | ||
|
Applies the filter to the given Image object.
| PerlinNoise | ||
|
toString():String
Builds and returns a string containing the name of the class.
| PerlinNoise | ||
| Constant | Defined by | ||
|---|---|---|---|
| CHANNEL_ALPHA : int = 8 [static]
Alpha channel constant for the Perlin noise.
| PerlinNoise | ||
| CHANNEL_BLUE : int = 4 [static]
Blue channel constant for the Perlin noise.
| PerlinNoise | ||
| CHANNEL_GRAY : int = 1 [static]
Gray channel constant for the Perlin noise.
| PerlinNoise | ||
| CHANNEL_GREEN : int = 2 [static]
Green channel constant for the Perlin noise.
| PerlinNoise | ||
| CHANNEL_RED : int = 1 [static]
Red channel constant for the Perlin noise.
| PerlinNoise | ||
| baseX | property |
baseX:int [read-write]
Frequency to use in the x direction. For example, to generate a noise that is sized for a 64 x 128 image, pass 64 for the baseX value.
public function get baseX():int
public function set baseX(value:int):void
| baseY | property |
baseY:int [read-write]
Frequency to use in the y direction. For example, to generate a noise that is sized for a 64 x 128 image, pass 128 for the baseY value
public function get baseY():int
public function set baseY(value:int):void
| cache | property |
cache:Boolean [read-write]
Setting cache to false forces the filter to generate a new noise on next execution.
public function get cache():Boolean
public function set cache(value:Boolean):void
| channelOptions | property |
channelOptions:int [read-write]
A number that can be a combination of any of the color channel values (PerlinNoise.CHANNEL_GRAY, PerlinNoise.CHANNEL_RED, PerlinNoise.CHANNEL_GREEN, PerlinNoise.CHANNEL_BLUE, PerlinNoise.CHANNEL_ALPHA). You can use the logical OR operator (|) to combine channel values.
public function get channelOptions():int
public function set channelOptions(value:int):void
| fractalNoise | property |
fractalNoise:Boolean [read-write]
If the value is true, the method generates fractal noise; otherwise, it generates turbulence. An image with turbulence has visible discontinuities in the gradient that can make it better approximate sharper visual effects like flames and ocean waves.
public function get fractalNoise():Boolean
public function set fractalNoise(value:Boolean):void
| numOctaves | property |
numOctaves:int [read-write]Number of octaves or individual noise functions to combine to create this noise. Larger numbers of octaves create images with greater detail. Larger numbers of octaves also require more processing time.
Implementation public function get numOctaves():int
public function set numOctaves(value:int):void
| offsets | property |
offsets:Array [read-write]An array of points that correspond to x and y offsets for each octave. By manipulating the offset values you can smoothly scroll the layers of a perlinNoise image. Each point in the offset array affects a specific octave noise function.
Implementation public function get offsets():Array
public function set offsets(value:Array):void
| randomSeed | property |
randomSeed:int [read-write]The random seed number to use. If you keep all other parameters the same, you can generate different pseudo-random results by varying the random seed value. The Perlin noise function is a mapping function, not a true random-number generation function, so it creates the same results each time from the same random seed.
Implementation public function get randomSeed():int
public function set randomSeed(value:int):void
| stitch | property |
stitch:Boolean [read-write]
If the value is true, the method attempts to smooth the transition edges of the image to create seamless textures for tiling as a bitmap fill.
public function get stitch():Boolean
public function set stitch(value:Boolean):void
| PerlinNoise | () | constructor |
public function PerlinNoise(baseX:int = 0, baseY:int = 0, numOctaves:uint = 1, randomSeed:int = -1, stitch:Boolean = false, fractalNoise:Boolean = false, channelOptions:int = 1, offsets:Array = null)Creates a new PerlinNoise object.
ParametersbaseX:int (default = 0) — Frequency to use in the x direction. For example, to generate a noise that is sized for a 64 x 128 image, pass 64 for the baseX value.
|
|
baseY:int (default = 0) — Frequency to use in the y direction. For example, to generate a noise that is sized for a 64 x 128 image, pass 128 for the baseY value
|
|
numOctaves:uint (default = 1) — Number of octaves or individual noise functions to combine to create this noise. Larger numbers of octaves create images with greater detail. Larger numbers of octaves also require more processing time.
|
|
randomSeed:int (default = -1) — The random seed number to use. If you keep all other parameters the same, you can generate different pseudo-random results by varying the random seed value. The Perlin noise function is a mapping function, not a true random-number generation function, so it creates the same results each time from the same random seed.
|
|
stitch:Boolean (default = false) — A Boolean value. If the value is true, the method attempts to smooth the transition edges of the image to create seamless textures for tiling as a bitmap fill.
|
|
fractalNoise:Boolean (default = false) — A Boolean value. If the value is true, the method generates fractal noise; otherwise, it generates turbulence. An image with turbulence has visible discontinuities in the gradient that can make it better approximate sharper visual effects like flames and ocean waves.
|
|
channelOptions:int (default = 1) — A number that can be a combination of any of the color channel values (PerlinNoise.CHANNEL_GRAY, PerlinNoise.CHANNEL_RED, PerlinNoise.CHANNEL_GREEN, PerlinNoise.CHANNEL_BLUE, PerlinNoise.CHANNEL_ALPHA). You can use the logical OR operator (|) to combine channel values.
|
|
offsets:Array (default = null) — An array of points that correspond to x and y offsets for each octave. By manipulating the offset values you can smoothly scroll the layers of a perlinNoise image. Each point in the offset array affects a specific octave noise function.
|
| apply | () | method |
public function apply(image:Image):voidApplies the filter to the given Image object.
Parametersimage:Image — The image that will be manipulated.
|
| toString | () | method |
public function toString():StringBuilds and returns a string containing the name of the class.
ReturnsString — A string containing the name of the class.
|
| CHANNEL_ALPHA | constant |
public static const CHANNEL_ALPHA:int = 8Alpha channel constant for the Perlin noise.
| CHANNEL_BLUE | constant |
public static const CHANNEL_BLUE:int = 4Blue channel constant for the Perlin noise.
| CHANNEL_GRAY | constant |
public static const CHANNEL_GRAY:int = 1Gray channel constant for the Perlin noise.
| CHANNEL_GREEN | constant |
public static const CHANNEL_GREEN:int = 2Green channel constant for the Perlin noise.
| CHANNEL_RED | constant |
public static const CHANNEL_RED:int = 1Red channel constant for the Perlin noise.