Packagede.popforge.imageprocessing.filters.render
Classpublic final class CellGenerator
ImplementsIFilter

The CellGenerator class is a filter that fills an image with a pattern based on seed and rule value.

The method behind this filter that can generate a nearly unlimited amount of patterns is very simple. The first row will be filled with random values (on / off) and then for each row there is binary comparison based on the rule.

This filter is based on a technique from toxie^ainc..

Supported formats:


Example
  
  var filter: CellGenerator = new CellGenerator();
  
  var image: Image = new Image( 160, 120, ImageFormat.BINARY );
  
  filter.apply( image );
  

See also

apocalypse inc.


Public Methods
 MethodDefined by
  
CellGenerator(randomSeed:int = 0x123, rule:int = 0x81)
Creates a new CellGenerator object.
CellGenerator
  
apply(image:Image):void
Applies the filter to the given Image object.
CellGenerator
  
toString():String
Builds and returns a string containing the name of the class.
CellGenerator
Constructor detail
CellGenerator()constructor
public function CellGenerator(randomSeed:int = 0x123, rule:int = 0x81)

Creates a new CellGenerator object.

Parameters
randomSeed:int (default = 0x123) — 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 CellGenerator 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.
 
rule:int (default = 0x81) — Can be any value greater zero. A different rule will result in a different pattern even if the randomSeed is the same.
Method detail
apply()method
public function apply(image:Image):void

Applies the filter to the given Image object.

Parameters
image:Image — The image that will be manipulated.
toString()method 
public function toString():String

Builds and returns a string containing the name of the class.

Returns
String — A string containing the name of the class.