Fork me on GitHub
View source

package haxepunk.graphics.atlas

class AtlasRegion


implements IAtlasRegion

Constructor

View source

new (parent : AtlasData, rect : Rectangle) : Void

Creates a new AtlasRegion


Parameters:
parent   

The AtlasData parent to use for rendering

rect   

Rectangle to set for width/height

Variables

read only height : Int

Height of this region

rotated : Bool

If the region is rotated by 90 degress (used for sprite packing)

read only width : Int

Width of this region

read only x : Float

read only y : Float

Functions

View source

clip (clipRect : Rectangle, center : Vector2) : AtlasRegion

Clips an atlas region


Parameters:
clipRect   

A clip rectangle with coordinates local to the region

center   

The new center point


Returns:

A new atlas region with the clipped coordinates

View source

draw (x : Float, y : Float, scaleX : Float = 1, scaleY : Float = 1, angle : Float = 0, color : Color = Color.White, alpha : Float = 1, shader : Shader, smooth : Bool, blend : BlendMode, clipRect : Rectangle, flexibleLayer : Bool = false) : Void

Prepares tile data for rendering


Parameters:
x   

The x-axis location to draw the tile

y   

The y-axis location to draw the tile

shader   

The shader to use for drawing

scaleX   

The scale value for the x-axis

scaleY   

The scale value for the y-axis

angle   

An angle to rotate the tile in degrees

red   

A red tint value

green   

A green tint value

blue   

A blue tint value

alpha   

The tile's opacity

smooth   

Whether to draw with antialiasing

blend   

Blend mode

clipRect   

Clipping rectangle

View source

drawMatrix (tx : Float, ty : Float, a : Float, b : Float, c : Float, d : Float, color : Color = Color.White, alpha : Float = 1, shader : Shader, smooth : Bool, blend : BlendMode, clipRect : Rectangle, flexibleLayer : Bool = false) : Void

Prepares tile data for rendering using a matrix


Parameters:
tx   

X-Axis translation

ty   

Y-Axis translation

a   

Top-left

b   

Top-right

c   

Bottom-left

d   

Bottom-right

shader   

The shader to use for drawing

red   

Red color value

green   

Green color value

blue   

Blue color value

alpha   

The tile's opacity

smooth   

Whether to draw with antialiasing

blend   

Blend mode

clipRect   

Clipping rectangle

View source

toString () : String

Prints the region as a string


Returns:

String version of the object.