Packagenet.guttershark.util
Classpublic final class BitmapUtils

The BitmapUtils class has utility methods for easy access to common Bitmap operations.

See also

Utilities class.


Public Methods
 MethodDefined by
  
aaCircle(bmp:BitmapData, px:Number, py:Number, r:int, c:Number):void
Draw an anti-aliased circle into a bitmap data.
BitmapUtils
  
aaLine(bmp:BitmapData, x1:int, y1:int, x2:int, y2:int, c:Number):void
Draw an anti-aliased line into a bitmap data.
BitmapUtils
  
circle(bmp:BitmapData, px:int, py:int, r:int, c:Number):void
Draw a circle into a bitmap data.
BitmapUtils
  
copyBitmap(bitmapToCopy:Bitmap):Bitmap
Copy a Bitmap.
BitmapUtils
  
cubicBezier(bmp:BitmapData, x0:int, y0:int, x1:int, y1:int, x2:int, y2:int, x3:int, y3:int, c:Number, resolution:int = 5):void
Draws a Cubic Bezier Curve into a bitmap data.
BitmapUtils
  
filledTri(bmp:BitmapData, x0:int, y0:int, x1:int, y1:int, x2:int, y2:int, c:Number):void
Draw a filled triangle into a bitmap data.
BitmapUtils
  
[static] Singleton access.
BitmapUtils
  
line(bmp:BitmapData, x0:int, y0:int, x1:int, y1:int, c:Number):void
Draw a line into a bitmap data.
BitmapUtils
  
quadBezier(bmp:BitmapData, x0:int, y0:int, x1:int, y1:int, x2:int, y2:int, c:Number, resolution:int = 3):void
Draws a Quadratic Bezier Curve (equivalent to a DisplayObject's graphics#curveTo).
BitmapUtils
  
triangle(bmp:BitmapData, x0:int, y0:int, x1:int, y1:int, x2:int, y2:int, c:Number):void
Draw a triangle into a bitmap data.
BitmapUtils
Method detail
aaCircle()method
public function aaCircle(bmp:BitmapData, px:Number, py:Number, r:int, c:Number):void

Draw an anti-aliased circle into a bitmap data.

Parameters
bmp:BitmapData — Bitmap to draw (alpha=true).
 
px:Number — First point x coord.
 
py:Number — First point y coord.
 
r:int — Radius.
 
c:Number — Color (0xaarrggbb).
aaLine()method 
public function aaLine(bmp:BitmapData, x1:int, y1:int, x2:int, y2:int, c:Number):void

Draw an anti-aliased line into a bitmap data.

Parameters
bmp:BitmapData — Bitmap to draw (alpha=true).
 
x1:int — First point x coord.
 
y1:int — First point y coord.
 
x2:int — Second point x coord.
 
y2:int — Second point y coord.
 
c:Number — Color (0xaarrggbb).
circle()method 
public function circle(bmp:BitmapData, px:int, py:int, r:int, c:Number):void

Draw a circle into a bitmap data.

Parameters
bmp:BitmapData — Bitmap to draw (alpha=true).
 
px:int — First point x coord.
 
py:int — First point y coord.
 
r:int — Radius.
 
c:Number — Color (0xaarrvvbb).
copyBitmap()method 
public function copyBitmap(bitmapToCopy:Bitmap):Bitmap

Copy a Bitmap.

Parameters
bitmapToCopy:Bitmap — The bitmap to copy.

Returns
Bitmap

Example
Copying a bitmap.
 
   import net.guttershark.util.BitmapUtils;
   var bmd:BitmapData = new BitmapData(50,50,false,0xFF0066);
   var bitmap1:Bitmap = new Bitmap(bmd);
   addChild(bitmap1);
   var bitmap2:Bitmap = BitmapUtils.CopyBitmap(bitmap1);
   bitmap2.x = 100;
   bitmap2.y = 100;
   addChild(bitmap2);
   

cubicBezier()method 
public function cubicBezier(bmp:BitmapData, x0:int, y0:int, x1:int, y1:int, x2:int, y2:int, x3:int, y3:int, c:Number, resolution:int = 5):void

Draws a Cubic Bezier Curve into a bitmap data.

Parameters
bmp:BitmapData — BitmapData to draw on (alpha set to true).
 
x0:int — x position of first anchor.
 
y0:int — y position of first anchor.
 
x1:int — x position of control point.
 
y1:int — y position of control point.
 
x2:int — x position of second control point.
 
y2:int — y position of second control point.
 
x3:int — x position of second anchor.
 
y3:int — y position of second anchor.
 
c:Number — color.
 
resolution:int (default = 5) — determines the accuracy of the curve's length (higher number = greater accuracy = longer process)
filledTri()method 
public function filledTri(bmp:BitmapData, x0:int, y0:int, x1:int, y1:int, x2:int, y2:int, c:Number):void

Draw a filled triangle into a bitmap data.

Parameters
bmp:BitmapData — Bitmap to draw.
 
x0:int — First point x coord.
 
y0:int — First point y coord.
 
x1:int — Second point x coord.
 
y1:int — Second point y coord.
 
x2:int — Third point x coord.
 
y2:int — Third point y coord.
 
c:Number — Color (0xaarrggbb)
gi()method 
public static function gi():BitmapUtils

Singleton access.

Returns
BitmapUtils
line()method 
public function line(bmp:BitmapData, x0:int, y0:int, x1:int, y1:int, c:Number):void

Draw a line into a bitmap data.

Parameters
bmp:BitmapData — bitmap to draw (alpha=true).
 
x0:int — first point x coord.
 
y0:int — first point y coord.
 
x1:int — second point x coord.
 
y1:int — second point y coord.
 
c:Number — color (0xaarrggbb).
quadBezier()method 
public function quadBezier(bmp:BitmapData, x0:int, y0:int, x1:int, y1:int, x2:int, y2:int, c:Number, resolution:int = 3):void

Draws a Quadratic Bezier Curve (equivalent to a DisplayObject's graphics#curveTo).

Parameters
bmp:BitmapData — BimtapData to draw on (alpha set to true).
 
x0:int — x position of first anchor.
 
y0:int — y position of first anchor.
 
x1:int — x position of control point.
 
y1:int — y position of control point.
 
x2:int — x position of second anchor.
 
y2:int — y position of second anchor.
 
c:Number — color
 
resolution:int (default = 3) — determines the accuracy of the curve's length (higher number = greater accuracy = longer process)
triangle()method 
public function triangle(bmp:BitmapData, x0:int, y0:int, x1:int, y1:int, x2:int, y2:int, c:Number):void

Draw a triangle into a bitmap data.

Parameters
bmp:BitmapData — Bitmap to draw into.
 
x0:int — First point x coord.
 
y0:int — First point y coord.
 
x1:int — Second point x coord.
 
y1:int — Second point y coord.
 
x2:int — Third point x coord.
 
y2:int — Third point y coord.
 
c:Number — Color (0xaarrggbb).