Packagenet.flashpunk.graphics
Classpublic class Image
InheritanceImage Inheritance Graphic Inheritance Object
Subclasses PreRotation, Spritemap, Text, TiledImage

Performance-optimized non-animated image. Can be drawn to the screen with transformations.



Public Properties
 PropertyDefined By
 Inheritedactive : Boolean = false
If the graphic should update.
Graphic
  alpha : Number
Change the opacity of the Image, a value from 0 to 1.
Image
  angle : Number = 0
Rotation of the image, in degrees.
Image
  blend : String
Optional blend mode to use when drawing this image.
Image
  clipRect : Rectangle
[read-only] Clipping rectangle for the image.
Image
  color : uint
The tinted color of the Image.
Image
  drawMask : BitmapData
Set the transparency mask of the Image.
Image
  flipped : Boolean
If you want to draw the Image horizontally flipped.
Image
  height : uint
[read-only] Height of the image.
Image
  locked : Boolean
[read-only] True if the image is locked.
Image
  originX : Number = 0
X origin of the image, determines transformation point.
Image
  originY : Number = 0
Y origin of the image, determines transformation point.
Image
 Inheritedrelative : Boolean = true
If the graphic should render at its position relative to its parent Entity's position.
Graphic
  scale : Number = 1
Scale of the image, affects both x and y scale.
Image
  scaledHeight : Number
The scaled height of the image.
Image
  scaledWidth : Number
The scaled width of the image.
Image
  scaleX : Number = 1
X scale of the image.
Image
  scaleY : Number = 1
Y scale of the image.
Image
 InheritedscrollX : Number = 1
X scrollfactor, effects how much the camera offsets the drawn graphic.
Graphic
 InheritedscrollY : Number = 1
Y scrollfactor, effects how much the camera offsets the drawn graphic.
Graphic
  smooth : Boolean
If the image should be drawn transformed with pixel smoothing.
Image
  tinting : Number
The amount the image will be tinted, suggested values from 0 to 1.
Image
  tintMode : Number
The tint mode - multiply or colorize.
Image
 Inheritedvisible : Boolean = true
If the graphic should render.
Graphic
  width : uint
[read-only] Width of the image.
Image
 Inheritedx : Number = 0
X offset.
Graphic
 Inheritedy : Number = 0
Y offset.
Graphic
Protected Properties
 PropertyDefined By
  _alpha : Number = 1
Image
 Inheritedassign : Function
Graphic
  _class : String
Image
  _color : uint = 0x00FFFFFF
Image
  _colorTransform : ColorTransform
Image
  _drawMask : BitmapData
Image
  _flip : BitmapData
Image
  _flipped : Boolean
Image
  _flips : Object
[static]
Image
  _matrix : Matrix
Image
  source : BitmapData
[read-only]
Image
  _tint : ColorTransform
Image
  _tintFactor : Number = 1.0
Image
  _tintMode : Number = 0.0
Image
Public Methods
 MethodDefined By
  
Image(source:*, clipRect:Rectangle = null)
Constructor.
Image
  
centerOO():void
Centers the Image's originX/Y to its center.
Image
  
Centers the Image's originX/Y to its center.
Image
  
clear():void
Clears the image buffer.
Image
  
createCircle(radius:uint, color:uint = 0xFFFFFF, alpha:Number = 1):Image
[static] Creates a new circle Image.
Image
  
createGradient(width:uint, height:uint, fromX:Number, fromY:Number, toX:Number, toY:Number, fromColor:uint, toColor:uint, fromAlpha:Number = 1, toAlpha:Number = 1):Image
[static] Creates a new gradient Image.
Image
  
createRect(width:uint, height:uint, color:uint = 0xFFFFFF, alpha:Number = 1):Image
[static] Creates a new rectangle Image.
Image
  
lock():void
Lock the image, preventing updateBuffer() from being run until unlock() is called, for performance.
Image
 Inherited
render(target:BitmapData, point:Point, camera:Point):void
Renders the graphic to the screen buffer.
Graphic
  
unlock():void
Unlock the image.
Image
 Inherited
update():void
Updates the graphic.
Graphic
  
updateBuffer(clearBefore:Boolean = false):void
Updates the image buffer.
Image
Protected Methods
 MethodDefined By
  
Updates the color transform
Image
Public Constants
 ConstantDefined By
  TINTING_COLORIZE : Number = 1.0
[static] tintMode value to tint in colorize mode.
Image
  TINTING_MULTIPLY : Number = 0.0
[static] tintMode value to tint in multiply mode.
Image
Property Detail
_alphaproperty
protected var _alpha:Number = 1

_classproperty 
protected var _class:String

_colorproperty 
protected var _color:uint = 0x00FFFFFF

_colorTransformproperty 
protected var _colorTransform:ColorTransform

_drawMaskproperty 
protected var _drawMask:BitmapData

_flipproperty 
protected var _flip:BitmapData

_flippedproperty 
protected var _flipped:Boolean

_flipsproperty 
protected static var _flips:Object

_matrixproperty 
protected var _matrix:Matrix

_tintproperty 
protected var _tint:ColorTransform

_tintFactorproperty 
protected var _tintFactor:Number = 1.0

_tintModeproperty 
protected var _tintMode:Number = 0.0

alphaproperty 
alpha:Number

Change the opacity of the Image, a value from 0 to 1.


Implementation
    public function get alpha():Number
    public function set alpha(value:Number):void
angleproperty 
public var angle:Number = 0

Rotation of the image, in degrees.

blendproperty 
public var blend:String

Optional blend mode to use when drawing this image. Use constants from the flash.display.BlendMode class.

clipRectproperty 
clipRect:Rectangle  [read-only]

Clipping rectangle for the image.


Implementation
    public function get clipRect():Rectangle
colorproperty 
color:uint

The tinted color of the Image. Use 0xFFFFFF to draw the Image normally with the default blending mode. Default: 0xFFFFFF.


Implementation
    public function get color():uint
    public function set color(value:uint):void
drawMaskproperty 
drawMask:BitmapData

Set the transparency mask of the Image.


Implementation
    public function get drawMask():BitmapData
    public function set drawMask(value:BitmapData):void
flippedproperty 
flipped:Boolean

If you want to draw the Image horizontally flipped. This is faster than setting scaleX to -1 if your image isn't transformed.


Implementation
    public function get flipped():Boolean
    public function set flipped(value:Boolean):void
heightproperty 
height:uint  [read-only]

Height of the image.


Implementation
    public function get height():uint
lockedproperty 
locked:Boolean  [read-only]

True if the image is locked.


Implementation
    public function get locked():Boolean
originXproperty 
public var originX:Number = 0

X origin of the image, determines transformation point. Defaults to top-left corner.

originYproperty 
public var originY:Number = 0

Y origin of the image, determines transformation point. Defaults to top-left corner.

scaleproperty 
public var scale:Number = 1

Scale of the image, affects both x and y scale.

scaledHeightproperty 
scaledHeight:Number

The scaled height of the image.


Implementation
    public function get scaledHeight():Number
    public function set scaledHeight(value:Number):void
scaledWidthproperty 
scaledWidth:Number

The scaled width of the image.


Implementation
    public function get scaledWidth():Number
    public function set scaledWidth(value:Number):void
scaleXproperty 
public var scaleX:Number = 1

X scale of the image.

scaleYproperty 
public var scaleY:Number = 1

Y scale of the image.

smoothproperty 
public var smooth:Boolean

If the image should be drawn transformed with pixel smoothing. This will affect drawing performance, but look less pixelly. Defaults to not smoothed.

sourceproperty 
source:BitmapData  [read-only]


Implementation
    protected function get source():BitmapData
tintingproperty 
tinting:Number

The amount the image will be tinted, suggested values from 0 to 1. 0 Means no change, 1 is full color tint. Default: 1.


Implementation
    public function get tinting():Number
    public function set tinting(value:Number):void
tintModeproperty 
tintMode:Number

The tint mode - multiply or colorize. Default: multiply. See Image.TINTING_MULTIPLY and Image.TINTING_COLORIZE.


Implementation
    public function get tintMode():Number
    public function set tintMode(value:Number):void
widthproperty 
width:uint  [read-only]

Width of the image.


Implementation
    public function get width():uint
Constructor Detail
Image()Constructor
public function Image(source:*, clipRect:Rectangle = null)

Constructor.

Parameters
source:* — Source image.
 
clipRect:Rectangle (default = null) — Optional rectangle defining area of the source image to draw.
Method Detail
centerOO()method
public function centerOO():void

Centers the Image's originX/Y to its center.

centerOrigin()method 
public function centerOrigin():void

Centers the Image's originX/Y to its center.

clear()method 
public function clear():void

Clears the image buffer.

createCircle()method 
public static function createCircle(radius:uint, color:uint = 0xFFFFFF, alpha:Number = 1):Image

Creates a new circle Image.

Parameters

radius:uint — Radius of the circle.
 
color:uint (default = 0xFFFFFF) — Color of the circle.
 
alpha:Number (default = 1) — Alpha of the circle.

Returns
Image — A new Image object.
createGradient()method 
public static function createGradient(width:uint, height:uint, fromX:Number, fromY:Number, toX:Number, toY:Number, fromColor:uint, toColor:uint, fromAlpha:Number = 1, toAlpha:Number = 1):Image

Creates a new gradient Image.

Parameters

width:uint — Width of the image.
 
height:uint — Height of the image.
 
fromX:Number — X coordinate to start gradient at.
 
fromY:Number — Y coordinate to start gradient at.
 
toX:Number — X coordinate to end gradient at.
 
toY:Number — X coordinate to end gradient at.
 
fromColor:uint — Color at start of gradient.
 
toColor:uint — Color at end of gradient.
 
fromAlpha:Number (default = 1) — Alpha at start of gradient.
 
toAlpha:Number (default = 1) — Alpha at end of gradient.

Returns
Image — A new Image object.
createRect()method 
public static function createRect(width:uint, height:uint, color:uint = 0xFFFFFF, alpha:Number = 1):Image

Creates a new rectangle Image.

Parameters

width:uint — Width of the rectangle.
 
height:uint — Height of the rectangle.
 
color:uint (default = 0xFFFFFF) — Color of the rectangle.
 
alpha:Number (default = 1)

Returns
Image — A new Image object.
lock()method 
public function lock():void

Lock the image, preventing updateBuffer() from being run until unlock() is called, for performance.

unlock()method 
public function unlock():void

Unlock the image. Any pending updates will be applied immediately.

updateBuffer()method 
public function updateBuffer(clearBefore:Boolean = false):void

Updates the image buffer.

Parameters

clearBefore:Boolean (default = false)

updateColorTransform()method 
protected function updateColorTransform():void

Updates the color transform

Constant Detail
TINTING_COLORIZEConstant
public static const TINTING_COLORIZE:Number = 1.0

tintMode value to tint in colorize mode.

TINTING_MULTIPLYConstant 
public static const TINTING_MULTIPLY:Number = 0.0

tintMode value to tint in multiply mode.