© Efflare Systems
website : e-mail

index | examples | api | language
Bitmap
Probably the most important class in ImageFlare, the bitmap represents a grid of pixels, in effect, an image. Bitmaps primarily draw things on themselves. They are also used to load and save a variety of image formats.

Constructors
Bitmap( )
» initializes a 1x1 pixel image

Bitmap( absolutepath:string )
» additionally opens absolutepath into Bitmap

Bitmap( width:number, height:number )
» additionally sets width and height

Properties
width:number
» get and set width

height:number
» get and set height

background:Color
» get and set the background color, used for default fill, and as the 'undefined color' on width/height changes, border function, offset function, etc

Methods
open( absolutepath:string )
» open image from absolute path, detects gif/jpg regardless of extension ( SEE : Image Format Support )

save( absolutepath:string )
» save image to absolute path, detects format by extension ( SEE : Image Format Support )

size( width:number, height:number)
» the same as setting width and height, always faster, sometimes more convenient

resize( width:number=0, height:number=0, filter:number=1 )
» if width or height is 0, the other is calculated proportionately, if both are 0, the old height is used ( SEE : Resampling Filters )

crop( left:number, top:number, right:number, bottom:number )
» crop the image down to the rectangle specified

border( size:number=1, color:Color=self.background )
» creates a matte or border around an image

offset( dx:number, dy:number, fill:boolean=false, fillcolor:Color=self.background )
» offsets the image by dx,dy filling dead areas with fillcolor when fill is true

copy( left:number=0, top:number=0, right:number=self.width, bottom:number=self.height) : Bitmap
» returns the subsection of the Bitmap as specified by the rectangle x1,y1 to x2,y2

paste( source:Bitmap, x:number=0, y:number=0, alpha:number=255, blendmode:number=1)
» paste source Bitmap at x,y with alpha and specified blendmode ( SEE : Blending Modes )

getpixel( x:integer, y:integer ) : Color
» gets the pixel value at x,y

setpixel( x:integer, y:integer, color:Color )
» sets the pixel at x,y to color

fill( color=self.background, left=0, top=0, right=self.width, bottom=self.width )
» fills the rectangle specified with color

line( x1:number, y1:number, x2:number, y2:number, color:Color=Color("white"), width:number=1 )
» draws a line from x1,y1 to x2,y2 with color and width, a width < 0 draws the line without antialiasing and 0 uses a thinner antialiasing algorithm

rect( left:number=0, top:number=0, right:number=self.width, bottom:number=self.height,
           fillColor:Color=Color(0,0,0,0), bordercolor:Color=Color('white'), bordersize:number=1 )

» draws specified rectangle with fill color, border color and border size

text( text:string, x:number, y:number, font:Font, color:Color=Color("white") )
» draws text at x,y in font and color where x,y represents the lower-left corner of text's bounding box

text( text:string, left:number, top:number, right:number, bottom:number, font:Font, color:Color=Color("white") )
» draws text in specified rectangle, supports alignment and multiple lines with font's properties

shape( shape:Shape, fillcolor:Color=Color(0,0,0,0), bordercolor:Color=Color('white'), bordersize:number=1 )
» draws shape with specified colors and border size

invert( )
» invert rgb channels

invertalpha( )
» invert alpha channel

rotate( )
» rotate in 90 degree increments

fliph( )
» flip horizontally

flipv( )
» flip vertically

blur( )
» gaussian blur filter

sharpen( )
» sharpen filter

softer( )
» weak soften filter

soften( )
» strong soften filter

kuwahara( )
» kuwahara effect, similar to oil-paint