Fork me on GitHub
View source

package com.haxepunk.graphics

class Image


extends Graphic
extended by PreRotation, Spritemap, Text, TiledImage

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

Static variables

View source

static read only TINTING_COLORIZE : Float

tintMode value to tint in colorize mode.

View source

static read only TINTING_MULTIPLY : Float

tintMode value to tint in multiply mode.

Static functions

View source

static createCircle (radius : Int, color : Int = 0xFFFFFF, alpha : Float = 1) : Image

Creates a new circle Image.


Parameters:
radius   

Radius of the circle.

color   

Color of the circle.

alpha   

Alpha of the circle.


Returns:

A new Image object of a circle.

View source

static createPolygon (polygon : Polygon, color : Int = 0xFFFFFF, alpha : Float = 1, fill : Bool = true, thick : Int = 1) : Image

Creates a new polygon Image from an array of points.


Parameters:
polygon   

A Polygon object to create the Image from.

color   

Color of the polygon.

alpha   

Alpha of the polygon.

fill   

If the polygon should be filled with the color (true) or just an outline (false).

thick   

How thick the outline should be (only applicable when fill = false).


Returns:

A new Image object.


Available since:

2.5.3

View source

static createRect (width : Int, height : Int, color : Int = 0xFFFFFF, alpha : Float = 1) : Image

Creates a new rectangle Image.


Parameters:
width   

Width of the rectangle.

height   

Height of the rectangle.

color   

Color of the rectangle.

alpha   

Alpha of the rectangle.


Returns:

A new Image object of a rectangle.

Constructor

View source

new (source : ImageType, clipRect : Rectangle) : Void

Constructor.


Parameters:
source   

Source image.

clipRect   

Optional rectangle defining area of the source image to draw.

Variables

alpha : Float

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

angle : Float

Rotation of the image, in degrees.

blend : BlendMode

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

read only clipRect : Rectangle

Clipping rectangle for the image.

color : Int

The tinted color of the Image. Use 0xFFFFFF to draw the Image normally.

flipped : Bool

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

read only height : Int

Height of the image.

originX : Float

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

originY : Float

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

scale : Float

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

scaleX : Float

X scale of the image.

scaleY : Float

Y scale of the image.

scaledHeight : Float

The scaled height of the image.

scaledWidth : Float

The scaled width of the image.

smooth : Bool

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

Default value: false if HXP.stage.quality is LOW, true otherwise.

tintMode : Float

The tint mode - multiply or colorize.

Only works with blit mode.

You can get cool, weird effects if this value is not either 0 or 1.

default value

Image.TINTING_MULTIPLY

tinting : Float

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

Only works with blit mode.

You can get cool, weird effects if setting this value outside the 0-1 value range.

default value

1.

read only width : Int

Width of the image.

Functions

View source

centerOO () : Void

Centers the Image's originX/Y to its center, and negates the offset by the same amount.

View source

centerOrigin () : Void

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

View source

clear () : Void

Clears the image buffer.