Packagegraphics.display
Classpublic class PerlinNoiseBitmapData
InheritancePerlinNoiseBitmapData Inheritance flash.display.BitmapData

This BitmapData is an helper to creates perlin noise effects.

The Perlin noise generation algorithm interpolates and combines individual random noise functions (called octaves) into a single function that generates more natural-seeming random noise. Like musical octaves, each octave function is twice the frequency of the one before it. Perlin noise has been described as a "fractal sum of noise" because it combines multiple sets of noise data with different levels of detail.



Public Properties
 PropertyDefined By
  baseX : Number
Frequency to use in the x direction.
PerlinNoiseBitmapData
  baseY : Number
Frequency to use in the y direction.
PerlinNoiseBitmapData
  channels : uint = 7
A number that can be a combination of any of the four color channel values ( BitmapDataChannel.RED , BitmapDataChannel.BLUE , BitmapDataChannel.GREEN , and BitmapDataChannel.ALPHA ).
PerlinNoiseBitmapData
  density : Number
Set the density of the frequency to use in the x and y direction.
PerlinNoiseBitmapData
  fractal : Boolean = true
A Boolean value.
PerlinNoiseBitmapData
  greyScale : Boolean
A Boolean value.
PerlinNoiseBitmapData
  octaves : uint
Number of octaves or individual noise functions to combine to create this noise.
PerlinNoiseBitmapData
  seed : int
The random seed number to use.
PerlinNoiseBitmapData
  stitch : Boolean
A Boolean value.
PerlinNoiseBitmapData
Public Methods
 MethodDefined By
  
PerlinNoiseBitmapData(width:int, height:int, transparent:Boolean = true, fillColor:uint = 0xFFFFFFFF)
Creates a new PerlinNoiseBitmapData instance.
PerlinNoiseBitmapData
  
move(x:Number, y:Number, octave:int = -1):void
Move the frequency of all octaves.
PerlinNoiseBitmapData
  
render():void
Render the perlin noise effect.
PerlinNoiseBitmapData
Property Detail
baseXproperty
public var baseX:Number

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.

baseYproperty 
public var baseY:Number

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.

channelsproperty 
public var channels:uint = 7

A number that can be a combination of any of the four color channel values ( BitmapDataChannel.RED , BitmapDataChannel.BLUE , BitmapDataChannel.GREEN , and BitmapDataChannel.ALPHA ). You can use the logical OR operator ( | ) to combine channel values.

densityproperty 
density:Number

Set the density of the frequency to use in the x and y direction.


Implementation
    public function get density():Number
    public function set density(value:Number):void
fractalproperty 
public var fractal:Boolean = true

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.

greyScaleproperty 
public var greyScale:Boolean

A Boolean value. If the value is true, a grayscale image is created by setting each of the red, green, and blue color channels to identical values. The alpha channel value is not affected if this value is set to true .

octavesproperty 
octaves:uint

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 octaves():uint
    public function set octaves(value:uint):void
seedproperty 
public var seed:int

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.

stitchproperty 
public var stitch:Boolean

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.

Constructor Detail
PerlinNoiseBitmapData()Constructor
public function PerlinNoiseBitmapData(width:int, height:int, transparent:Boolean = true, fillColor:uint = 0xFFFFFFFF)

Creates a new PerlinNoiseBitmapData instance.

Parameters
width:int — The width of the bitmap image in pixels.
 
height:int — The height of the bitmap image in pixels.
 
transparent:Boolean (default = true) — Specifies whether the bitmap image supports per-pixel transparency. The default value is true (transparent). To create a fully transparent bitmap, set the value of the transparent parameter to true and the value of the fillColor parameter to 0x00000000 (or to 0). Setting the transparent property to false can result in minor improvements in rendering performance.
 
fillColor:uint (default = 0xFFFFFFFF) — A 32-bit ARGB color value that you use to fill the bitmap image area. The default value is 0xFFFFFFFF (solid white).

Throws
ArgumentError — width and/or height exceed the maximum dimensions.
Method Detail
move()method
public function move(x:Number, y:Number, octave:int = -1):void

Move the frequency of all octaves.

Parameters

x:Number
 
y:Number
 
octave:int (default = -1)

render()method 
public function render():void

Render the perlin noise effect.