| Package | de.popforge.imageprocessing.core |
| Interface | public interface IImage |
| Implementors | Image, LayerManager |
It is important to see the difference between multi-layered and simple images. Simple images consist of one layer and are always merged because they only have one layer.
Images consiting of more than one layer can not have methods like setPixel()
for instance because you can only set a pixel on a specified layer.
| Property | Defined by | ||
|---|---|---|---|
| bitmapData : BitmapData [read-only]
The merged version of the image.
| IImage | ||
| format : int [read-only]
The format of the image.
| IImage | ||
| height : int [read-only]
The height of the image in pixels.
| IImage | ||
| rect : Rectangle [read-only]
The rectangle that defines the size of the image.
| IImage | ||
| width : int [read-only]
The width of the image in pixels.
| IImage | ||
| Method | Defined by | ||
|---|---|---|---|
|
getPixel(x:int, y:int):int
Returns 24-BIT pixel in
0xRRGGBB order. | IImage | ||
|
getPixel32(x:int, y:int):int
Same as getPixel() but returns a 32-BIT integer in 0xAARRGGBB order.
| IImage | ||
|
loadBitmapData(bitmap:BitmapData, convertToGrayscale:Boolean = false):void
This function loads the information a BitmapData provides.
| IImage | ||
|
render(target:BitmapData):void
Renders the image merged on a given BitmapData object.
| IImage | ||
|
toJPEG(quality:int = 80):ByteArray
Builds and returns a JPEG file of the merged image.
| IImage | ||
|
toPNG(alpha:Boolean = true):ByteArray
Builds and returns a PNG file of the Image object.
| IImage | ||
|
toString():String
Builds and returns a string that lists the properties of the Image object.
| IImage | ||
| 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
See also
| format | property |
format:int [read-only]The format of the image.
Implementation public function get format():int
See also
| height | property |
height:int [read-only]The height of the image in pixels.
Implementation public function get height():int
| 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
| 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
|
See also
| 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.
|
UnequalDimensionsError — Dimension of BitmapData and Image are not equal.
|
var image: Image = new Image( bitmapData.width, bitmapData.height, ImageFormat.GRAYSCALE );
image.loadBitmapData( bitmapData, true );
| 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.
|
var bitmap: BitmapData = new BitmapData( image.width, image.height, false, 0 );
image.render( bitmap );
addChild( new Bitmap( bitmap ) );
| 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
|