Fork me on GitHub
View source

package com.haxepunk.graphics.atlas

class AtlasData

Static functions

View source

static destroyAll () : Void

Removes all atlases from the display list

View source

static getAtlasDataByName (name : String, create : Bool = false) : AtlasData

Get's the atlas data for a specific texture, useful for setting rendering flags


Parameters:
name   

The name of the image file


Returns:

An AtlasData object (will create one if it doesn't already exist)

Constructor

View source

new (bd : BitmapData, name : String, flags : Int) : Void

Creates a new AtlasData class

NOTE: Only create one instance of AtlasData per name. An error will be thrown if you try to create a duplicate.


Parameters:
bd   

BitmapData image to use for rendering

name   

A reference to the image data, used with destroy and for setting rendering flags

Variables

bitmapData : BitmapData

read only height : Int

read only width : Int

Functions

View source

createRegion (rect : Rectangle, center : Point) : AtlasRegion

Creates a new AtlasRegion


Parameters:
rect   

Defines the rectangle of the tile on the tilesheet

center   

Positions the local center point to pivot on (not used)


Returns:

The new AtlasRegion object.

View source

destroy () : Void

Removes the object from memory

View source

prepareTile (rect : Rectangle, tx : Float, ty : Float, layer : Int, scaleX : Float, scaleY : Float, angle : Float, red : Float, green : Float, blue : Float, alpha : Float, smooth : Bool) : Void

Prepares a tile to be drawn


Parameters:
rect   

The source rectangle to draw

x   

The x-axis value

y   

The y-axis value

layer   

The layer to draw on

scaleX   

X-Axis scale

scaleY   

Y-Axis scale

angle   

Angle (in degrees)

red   

Red color value

green   

Green color value

blue   

Blue color value

alpha   

Alpha value

View source

prepareTileMatrix (rect : Rectangle, layer : Int, tx : Float, ty : Float, a : Float, b : Float, c : Float, d : Float, red : Float, green : Float, blue : Float, alpha : Float, smooth : Bool) : Void

Prepares a tile to be drawn using a matrix


Parameters:
rect   

The source rectangle to draw

layer   

The layer to draw on

tx   

X-Axis translation

ty   

Y-Axis translation

a   

Top-left

b   

Top-right

c   

Bottom-left

d   

Bottom-right

red   

Red color value

green   

Green color value

blue   

Blue color value

alpha   

Alpha value

View source

prepareTriangle (tx1 : Float, ty1 : Float, uvx1 : Float, uvy1 : Float, tx2 : Float, ty2 : Float, uvx2 : Float, uvy2 : Float, tx3 : Float, ty3 : Float, uvx3 : Float, uvy3 : Float, red : Float, green : Float, blue : Float, alpha : Float, smooth : Bool) : Void

View source

reload (bd : BitmapData) : Bool

Reloads the image for a particular atlas object

View source

toString () : String

String representation of AtlasData


Returns:

the name of the AtlasData