| Package | de.popforge.imageprocessing.utils |
| Class | public final class Drawing |
The most speed can be achieved drawing lines without anti-aliasing and 100%
alpha.
Line with anti-aliasing:
Line without anti-aliasing:
| Method | Defined by | ||
|---|---|---|---|
|
drawAALineG(image:Image, color:int, x0:int, y0:int, x1:int, y1:int):void
[static]
Draws an anti-aliased line on grayscale images using Xiaolin Wu's algorithm.
| Drawing | ||
|
drawAALineRGB(image:Image, color:int, x0:int, y0:int, x1:int, y1:int):void
[static]
Draws an anti-aliased line on RGB images using Xiaolin Wu's algorithm.
| Drawing | ||
|
[static]
Draws a line on an Image object choosing automatically the correct format.
| Drawing | ||
|
[static]
Draws a line on grayscale images using Bresenham's algorithm (without anti-aliasing).
| Drawing | ||
|
drawLineRGB(image:Image, color:int, x0:int, y0:int, x1:int, y1:int):void
[static]
Draws a line on RGB images using Bresenham's algorithm (without anti-aliasing).
| Drawing | ||
|
[static]
Draws a rectangle on an Image object.
| Drawing | ||
|
drawText(image:Image, color:int, x:int, y:int, text:String, fontName:String = "arial", fontSize:int = 12, bold:Boolean = false):void
[static]
Draws a text on an Image object.
| Drawing | ||
|
[static]
Draws and fills a rectangle on an Image object.
| Drawing | ||
| drawAALineG | () | method |
public static function drawAALineG(image:Image, color:int, x0:int, y0:int, x1:int, y1:int):voidDraws an anti-aliased line on grayscale images using Xiaolin Wu's algorithm.
Supported formats:
image:Image — The Image on which you want to draw.
|
|
color:int — A color in the format 0xAAYY.
|
|
x0:int — The x start position in pixel.
|
|
y0:int — The y start position in pixel.
|
|
x1:int — The x end position in pixel.
|
|
y1:int — The y end position in pixel.
|
| drawAALineRGB | () | method |
public static function drawAALineRGB(image:Image, color:int, x0:int, y0:int, x1:int, y1:int):voidDraws an anti-aliased line on RGB images using Xiaolin Wu's algorithm.
Supported formats:
image:Image — The Image on which you want to draw.
|
|
color:int — A color in the format 0xAARRGGBB.
|
|
x0:int — The x start position in pixel.
|
|
y0:int — The y start position in pixel.
|
|
x1:int — The x end position in pixel.
|
|
y1:int — The y end position in pixel.
|
| drawLine | () | method |
public static function drawLine(image:Image, color:int, x0:int, y0:int, x1:int, y1:int, antiAliasing:Boolean = false):voidDraws a line on an Image object choosing automatically the correct format.
Be careful with the color. The color for a grayscale image is 0xAAYY. This means if you
want to draw a white line with full alpha on a grayscale image your color should be 0xffff.
For 50% alpha you would use 0x80ff.
The same on an rgb image looks different since you have three channels plus the alpha value.
Therefore a white line with 100% alpha needs 0xffffffff. 50% alpha would be 0x80ffffff.
The algorithms for non anti-aliased lines are optimized to work with 100% alpha very quick.
Supported formats:
image:Image — The Image on which you want to draw.
|
|
color:int — The color value either in 0xAARRGGBB for ImageFormat.RGB and ImageFormat.RGBA or 0xAAYY for ImageFormat.GRAYSCALE.
|
|
x0:int — The x start position in pixel.
|
|
y0:int — The y start position in pixel.
|
|
x1:int — The x end position in pixel.
|
|
y1:int — The y end position in pixel.
|
|
antiAliasing:Boolean (default = false) — true if you want to use anti-aliased lines.
|
| drawLineG | () | method |
public static function drawLineG(image:Image, color:int, x0:int, y0:int, x1:int, y1:int):voidDraws a line on grayscale images using Bresenham's algorithm (without anti-aliasing).
Using 100% alpha results in faster execution.
Supported formats:
image:Image — The Image on which you want to draw.
|
|
color:int — A color in the format 0xAAYY.
|
|
x0:int — The x start position in pixel.
|
|
y0:int — The y start position in pixel.
|
|
x1:int — The x end position in pixel.
|
|
y1:int — The y end position in pixel.
|
| drawLineRGB | () | method |
public static function drawLineRGB(image:Image, color:int, x0:int, y0:int, x1:int, y1:int):voidDraws a line on RGB images using Bresenham's algorithm (without anti-aliasing).
Using 100% alpha results in faster execution.
Supported formats:
image:Image — The Image on which you want to draw.
|
|
color:int — A color in the format 0xAARRGGBB.
|
|
x0:int — The x start position in pixel.
|
|
y0:int — The y start position in pixel.
|
|
x1:int — The x end position in pixel.
|
|
y1:int — The y end position in pixel.
|
| drawRect | () | method |
public static function drawRect(image:Image, color:int, x:int, y:int, width:int, height:int):voidDraws a rectangle on an Image object.
Supported formats:
image:Image — The Image on which you want to draw.
|
|
color:int — The color value either in 0xAARRGGBB for ImageFormat.RGB and ImageFormat.RGBA or 0xAAYY for ImageFormat.GRAYSCALE.
|
|
x:int — Top-left x position of the rectangle in pixels.
|
|
y:int — Top-left y position of the rectangle in pixels.
|
|
width:int — Width of the rectangle in pixels.
|
|
height:int — Height of the rectangle in pixels.
|
| drawText | () | method |
public static function drawText(image:Image, color:int, x:int, y:int, text:String, fontName:String = "arial", fontSize:int = 12, bold:Boolean = false):voidDraws a text on an Image object.
Parametersimage:Image — The Image on which you want to draw.
|
|
color:int — The color value either in 0xAARRGGBB for ImageFormat.RGB and ImageFormat.RGBA or 0xAAYY for ImageFormat.GRAYSCALE.
|
|
x:int — The x position of the text.
|
|
y:int — The y position of the text.
|
|
text:String — The text you want do draw.
|
|
fontName:String (default = "arial") — The name of the font.
|
|
fontSize:int (default = 12) — The size of the font.
|
|
bold:Boolean (default = false) — true |
| fillRect | () | method |
public static function fillRect(image:Image, color:int, x:int, y:int, width:int, height:int):voidDraws and fills a rectangle on an Image object.
Supported formats:
image:Image — The Image on which you want to draw.
|
|
color:int — The color value either in 0xAARRGGBB for ImageFormat.RGB and ImageFormat.RGBA or 0xAAYY for ImageFormat.GRAYSCALE.
|
|
x:int — Top-left x position of the rectangle in pixels.
|
|
y:int — Top-left y position of the rectangle in pixels.
|
|
width:int — Width of the rectangle in pixels.
|
|
height:int — Height of the rectangle in pixels.
|