| Package | de.popforge.imageprocessing.core |
| Class | public class LayerManager |
| Implements | IImage |
This class is only a container of Image objects. Therefore a filter can not be applied to a LayerManager but it is possible to execute a filter on all the children of the LayerManager. The LayerManager can produced a merged output. Therefore it is an image (IImage) and can also return an encoded output (e.g. JPEG). Every LayerManager has at least one background layer. This layer has always the opacity of 100% and can not be removed.
See also
| Property | Defined by | ||
|---|---|---|---|
| backgroundImage : Image
[read-only]
The backgroundImage of the LayerManager.
| LayerManager | ||
| bitmapData : BitmapData [read-only]
The merged version of the image.
| LayerManager | ||
| format : int [read-only]
The format of the image.
| LayerManager | ||
| height : int [read-only]
The height of the image in pixels.
| LayerManager | ||
| layers : Array
An array of Layer objects.
| LayerManager | ||
| rect : Rectangle [read-only]
The rectangle that defines the size of the image.
| LayerManager | ||
| width : int [read-only]
The width of the image in pixels.
| LayerManager | ||
| Method | Defined by | ||
|---|---|---|---|
|
LayerManager(width:int, height:int, format:int, backgroundImage:Image)
Creates a new LayerManager object.
| LayerManager | ||
|
Adds a layer to the top.
| LayerManager | ||
|
applyFilterToAll(filter:IFilter):void
Executes a filter on all layers.
| LayerManager | ||
|
fromBitmapData(bitmap:BitmapData, format:int, convertToGrayscale:Boolean = false):LayerManager
[static]
This function creates a new LayaerManager object from a given BitmapData object.
| LayerManager | ||
|
[static]
Creates a new LayerManager object using the given image as the background layer.
| LayerManager | ||
|
Returns 24-BIT pixel in
0xRRGGBB order. | LayerManager | ||
|
Same as getPixel() but returns a 32-BIT integer in 0xAARRGGBB order.
| LayerManager | ||
|
This function loads the information a BitmapData provides.
| LayerManager | ||
|
merge():void
Merges all layers to the background layer.
| LayerManager | ||
|
render(target:BitmapData):void
Renders the image merged on a given BitmapData object.
| LayerManager | ||
|
Builds and returns a JPEG file of the merged image.
| LayerManager | ||
|
Builds and returns a PNG file of the Image object.
| LayerManager | ||
|
toString():String
Builds and returns a string that lists the properties of the Image object.
| LayerManager | ||
| backgroundImage | property |
backgroundImage:Image [read-only]The backgroundImage of the LayerManager.
Implementation public function get backgroundImage():Image
| bitmapData | property |
bitmapData:BitmapData [read-only]The merged version of the image. Never forget to free the memory you used since this propertie always returns a new BitmapData object.
Implementation public function get bitmapData():BitmapData
| format | property |
format:int [read-only]The format of the image.
Implementation public function get format():int
| height | property |
height:int [read-only]The height of the image in pixels.
Implementation public function get height():int
| layers | property |
public var layers:ArrayAn array of Layer objects.
| rect | property |
rect:Rectangle [read-only]The rectangle that defines the size of the image.
Implementation public function get rect():Rectangle
| width | property |
width:int [read-only]The width of the image in pixels.
Implementation public function get width():int
| LayerManager | () | constructor |
public function LayerManager(width:int, height:int, format:int, backgroundImage:Image)Creates a new LayerManager object.
Parameterswidth:int — Width of image in pixel.
|
|
height:int — Height of image in pixel.
|
|
format:int — May be any kind of de.popforge.imageprocessing.core.ImageFormat
|
|
backgroundImage:Image — The Image object used for the background layer.
|
| addLayer | () | method |
public function addLayer(layer:Layer):voidAdds a layer to the top.
Parameterslayer:Layer — The layer that should be added.
|
| applyFilterToAll | () | method |
public function applyFilterToAll(filter:IFilter):voidExecutes a filter on all layers.
Parametersfilter:IFilter — Any filter that should be executed.
|
| fromBitmapData | () | method |
public static function fromBitmapData(bitmap:BitmapData, format:int, convertToGrayscale:Boolean = false):LayerManagerThis function creates a new LayaerManager object from a given BitmapData object. The BitmapData is taken and a new image will be created with respect to the size of the BitmapData object.
Parametersbitmap:BitmapData — BitmapData object which will be used as the background layer for the new LayerManager object.
|
|
format:int — The image format which may be any kind of ImageFormat.
|
|
convertToGrayscale:Boolean (default = false) — If your BitmapData source is not already a grayscale image you can convert it by setting convertToGrayscale to true..
|
LayerManager —
A new LayerManager object with information from given BitmapData.
|
LayerManager.fromBitmapData( bitmap, ImageFormat.RGB, false );
| fromImage | () | method |
public static function fromImage(image:Image):LayerManagerCreates a new LayerManager object using the given image as the background layer.
Parametersimage:Image — The background layer of the new LayerManager object.
|
LayerManager —
A LayerManager object based on the given Image object.
|
| getPixel | () | method |
public function getPixel(x:int, y:int):int
Returns 24-BIT pixel in 0xRRGGBB order.
Optional x is 0 <= x < image.width and y with 0 <= y < image.height.
Remember that a binary pixel will be converted from {0;1} to {0x000000;0xffffff}
x:int — The x coordinate of the pixel in cartesian format.
|
|
y:int — The y coordinate of the pixel in cartesian format.
|
int — 24-BIT integer with the color information of given (x|y) coordinates
|
| getPixel32 | () | method |
public function getPixel32(x:int, y:int):intSame as getPixel() but returns a 32-BIT integer in 0xAARRGGBB order. If the ImageFormat does not support an alpha channel the alpha value will be set to 0xff.
Parametersx:int — The x coordinate of the pixel in cartesian format.
|
|
y:int — The y coordinate of the pixel in cartesian format.
|
int — 32-BIT integer with the color information of given (x|y) coordinates
|
| loadBitmapData | () | method |
public function loadBitmapData(bitmap:BitmapData, convertToGrayscale:Boolean = false):voidThis function loads the information a BitmapData provides. The BitmapData has to be in the same dimension as the Image.
Parametersbitmap:BitmapData — BitmapData object that will be loaded.
|
|
convertToGrayscale:Boolean (default = false) — This indicates if BitmapData the BitmapData is already grayscale or not.
|
| merge | () | method |
public function merge():voidMerges all layers to the background layer.
| render | () | method |
public function render(target:BitmapData):voidRenders the image merged on a given BitmapData object. Since the Image class should not be used to visualize the information an image provides we use a BitmapData object to do the job. A binary image will be converted from the {0x00;0x01} palette to {0x00;0xff}.
Parameterstarget:BitmapData — BitmapData object which is used to render the Image object.
|
| toJPEG | () | method |
public function toJPEG(quality:int = 80):ByteArrayBuilds and returns a JPEG file of the merged image.
Parametersquality:int (default = 80) |
ByteArray — A ByteArray containing the JPEG file.
|
| toPNG | () | method |
public function toPNG(alpha:Boolean = true):ByteArrayBuilds and returns a PNG file of the Image object.
Parametersalpha:Boolean (default = true) |
ByteArray — A ByteArray containing the PNG file.
|
| toString | () | method |
public function toString():StringBuilds and returns a string that lists the properties of the Image object.
ReturnsString — A string listing the value of each of the following properties of the Image object: width, height, format
|