Packagede.popforge.imageprocessing.filters.color
Classpublic final class GammaCorrection
InheritanceGammaCorrection Inheritance LUTFilter

The GammaCorrection class is a filter that levels the brightness in an image. This is a look-up table based filter.

The formula of this filter is new = round( pow( old / 0xff, g ) * 0xff + 0.5 ).

Supported formats:


Example
  
  var filter: GammaCorrection = new GammaCorrection( 2.2, true );
  
  var video: WebCam = new WebCam( 160, 120 );
  var image: Image = new Image( 160, 120, ImageFormat.RGB );
  
  image.loadBitmapData( video.getCurrentFrame(), true );
  
  filter.apply( image );
  



Public Properties
 PropertyDefined by
  gamma : Number
The gamma value from 0.1 to 5.
GammaCorrection
Protected Properties
 PropertyDefined by
 Inheritedcache : Boolean
The caching value.
LUTFilter
 Inheritedtables : Array
The look-up tables stored in an array.
LUTFilter
Public Methods
 MethodDefined by
  
GammaCorrection(gamma:Number = 2.2, cache:Boolean = true)
Creates a new GammaCorrection object with given gamme value.
GammaCorrection
  
apply(image:Image):void
Applies the filter to the given Image object.
GammaCorrection
  
toString():String
Builds and returns a string containing the name of the class.
GammaCorrection
Protected Methods
 MethodDefined by
 Inherited
buildTables(image:Image):void
This function creates the amount of necessary look-up tables.
LUTFilter
 Inherited
getArray():Array
Creates a new look-up table.
LUTFilter
Property detail
gammaproperty
public var gamma:Number

The gamma value from 0.1 to 5. This value has no effect if you set cache to true.

Constructor detail
GammaCorrection()constructor
public function GammaCorrection(gamma:Number = 2.2, cache:Boolean = true)

Creates a new GammaCorrection object with given gamme value.

Parameters
gamma:Number (default = 2.2) — Set to true if you want to cache the look-up table.
 
cache:Boolean (default = true) — The gamma value (0.1 to 5).
Method detail
apply()method
public override 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 override function toString():String

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

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