| Package | de.popforge.imageprocessing.core |
| Class | public final class Image |
| Implements | IImage |
m x n Matrix P with P = p(ij) where i in 0..m and j in 0..n.
p can be defined like the following:
| Image format | Elements |
|---|---|
| ImageFormat.BINARY | p(ij) in {0;1} |
| ImageFormat.GRAYSCALE | p(ij) in {0;...;0xff} |
| ImageFormat.RGB | p(ij) = (r(ij);g(ij);b(ij)) with r(ij), g(ij) and b(ij) in {0;...;0xff} |
| ImageFormat.RGBA | Analog to ImageFormat.RGB with alpha-channel a(ij) in {0;...;0xff} |
This class should be appreciated as a data-holder and nothing else.
See also
| Property | Defined by | ||
|---|---|---|---|
| bitmapData : BitmapData [read-only]
The merged version of the image.
| Image | ||
| channels : Array
The channels property is an Array that contains a BitmapData object for each channel of the image.
| Image | ||
| format : int [read-only]
The format of the image.
| Image | ||
| grayscale : IFilter
[static]
The filter used to convert to grayscale images.
| Image | ||
| height : int [read-only]
The height of the image in pixels.
| Image | ||
| histogram : Histogram
The histogram of the image.
| Image | ||
| numChannels : int [read-only]
The number of channels the image uses.
| Image | ||
| rect : Rectangle [read-only]
The rectangle that defines the size of the image.
| Image | ||
| threshold : IFilter
[static]
The filter used to convert to binary images.
| Image | ||
| width : int [read-only]
The width of the image in pixels.
| Image | ||
| Method | Defined by | ||
|---|---|---|---|
|
Image(width:int, height:int, format:int)
Creates a new Image object.
| Image | ||
|
Returns a new Image object that is a clone of the original instance with an exact copy of the contained information.
| Image | ||
|
dispose():void
Frees memory that is used to store the Image object.
| Image | ||
|
fromBitmapData(bitmap:BitmapData, format:int, convertToGrayscale:Boolean = false):Image
[static]
This function creates a new Image object from a given BitmapData object.
| Image | ||
|
getMeanValue(channel:int):Number
Calculates the mean value of a channel.
| Image | ||
|
Returns 24-BIT pixel in
0xRRGGBB order. | Image | ||
|
Same as getPixel() but returns a 32-BIT integer in 0xAARRGGBB order.
| Image | ||
|
This function loads the information a BitmapData provides.
| Image | ||
|
render(target:BitmapData):void
Renders the image merged on a given BitmapData object.
| Image | ||
|
Builds and returns a JPEG file of the merged image.
| Image | ||
|
Builds and returns a PNG file of the Image object.
| Image | ||
|
toString():String
Builds and returns a string that lists the properties of the Image object.
| Image | ||
|
updateHistogram():void
Updates the histogram of the Image.
| 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
| channels | property |
public var channels:ArrayThe channels property is an Array that contains a BitmapData object for each channel of the image.
| format | property |
format:int [read-only]The format of the image.
Implementation public function get format():int
| grayscale | property |
public static var grayscale:IFilterThe filter used to convert to grayscale images.
The default value is GrayscaleBT709.
See also
| height | property |
height:int [read-only]The height of the image in pixels.
Implementation public function get height():int
| histogram | property |
| numChannels | property |
numChannels:int [read-only]The number of channels the image uses.
Implementation public function get numChannels():int
| rect | property |
rect:Rectangle [read-only]The rectangle that defines the size of the image.
Implementation public function get rect():Rectangle
| threshold | property |
public static var threshold:IFilterThe filter used to convert to binary images.
The default value is Threshold.
See also
| width | property |
width:int [read-only]The width of the image in pixels.
Implementation public function get width():int
| Image | () | constructor |
public function Image(width:int, height:int, format:int)Creates a new Image object. Calling the constructor will result in a black image. Most internal write-protected variables will be set here.
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
|
| clone | () | method |
public function clone():ImageReturns a new Image object that is a clone of the original instance with an exact copy of the contained information.
ReturnsImage —
A new Image object that is identical to the original.
|
| dispose | () | method |
public function dispose():voidFrees memory that is used to store the Image object.
| fromBitmapData | () | method |
public static function fromBitmapData(bitmap:BitmapData, format:int, convertToGrayscale:Boolean = false):ImageThis function creates a new Image 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. After that loadBitmapData gets called to copy all channels.
Parametersbitmap:BitmapData — BitmapData object which will be used for the new Image 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..
|
Image —
A new Image object with information from given BitmapData.
|
See also
Image.fromBitmapData( bitmap, ImageFormat.RGB, false );
| getMeanValue | () | method |
public function getMeanValue(channel:int):NumberCalculates the mean value of a channel.
Parameterschannel:int — Any kind of ImageChannel.
|
Number — The mean value of given channel.
|
See also
| 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.
|
| 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
|
| updateHistogram | () | method |
public function updateHistogram():voidUpdates the histogram of the Image.