Base class for all frame types

Variables

angle:FlxFrameAngle

Rotation angle of this frame. Required for packed atlas images.

frame:FlxRect

Region of the image to render.

read onlyoffset:FlxPoint

Frame offset from top left corner of original image.

read onlysourceSize:FlxPoint

Original (uncropped) image size.

type:FlxFrameType

The type of this frame.

uv:FlxRect

UV coordinates for this frame. WARNING: For optimization purposes, width and height of this rect contain right and bottom coordinates (x + width and y + height).

Methods

clipTo(clip:FlxRect, ?clippedFrame:FlxFrame):FlxFrame

Frame clipping

Parameters:

clip

Clipping rectangle to apply on frame

clippedFrame

The frame which will contain result of original frame clipping. If null, a new frame will be created.

Returns:

Result of applying frame clipping

copyTo(?clone:FlxFrame):FlxFrame

Copies data from this frame into specified frame.

Parameters:

clone

Frame to fill data with. If null, a new frame will be created.

Returns:

Frame with data of this frame.

paint(?bmd:BitmapData, ?point:Point, mergeAlpha:Bool = false, disposeIfNotEqual:Bool = false):BitmapData

Draws frame on specified BitmapData object.

Parameters:

bmd

BitmapData object to draw this frame on. If bmd is null then new a BitmapData is created.

point

Where to draw this frame on the specified BitmapData object.

mergeAlpha

Whether to merge alphas or not. (works like with BitmapData's copyPixels() method).

disposeIfNotEqual

Whether dispose passed bmd or not if its size isn't equal to frame's original size (sourceSize)

Returns:

Modified or newly created BitmapData with frame image on it.

paintRotatedAndFlipped(?bmd:BitmapData, ?point:Point, rotation:FlxFrameAngle = FlxFrameAngle.ANGLE_0, flipX:Bool = false, flipY:Bool = false, mergeAlpha:Bool = false, disposeIfNotEqual:Bool = false):BitmapData

Draws rotated and flipped frame on specified BitmapData object.

Parameters:

bmd

BitmapData object to draw this frame on. If bmd is null then new BitmapData created.

point

Where to draw this frame on the specified BitmapData object

rotation

How much rotate the frame.

flipX

Do we need to flip frame horizontally.

flipY

Do we need to flip frame vertically.

mergeAlpha

Whether to merge alphas or not (works like with BitmapData's copyPixels() method).

disposeIfNotEqual

Whether dispose passed bmd or not if its size isn't equal to frame's original size (sourceSize)

Returns:

Modified or newly created BitmapData with frame image on it.

prepareMatrix(mat:FlxMatrix, rotation:FlxFrameAngle = FlxFrameAngle.ANGLE_0, flipX:Bool = false, flipY:Bool = false):FlxMatrix

Prepares matrix for frame tile/triangles rendering.

Parameters:

mat

Matrix to transform/prepare

rotation

Rotation to apply to specified matrix.

flipX

Do we need to flip frame horizontally

flipY

Do we need to flip frame vertically

Returns:

Transformed matrix which can be used for frame drawing.

setBorderTo(border:FlxPoint, ?frameToFill:FlxFrame):FlxFrame

Just a helper method for some frame adjusting. Try to not use it, since it may cause memory leaks.

Parameters:

border

Amount to clip from frame

Returns:

Clipped frame

subFrameTo(rect:FlxRect, ?frameToFill:FlxFrame):FlxFrame

Generates frame with specified subregion of this frame.

Parameters:

rect

Frame region to generate frame for.

frameToFill

Frame to fill with data. If null then a new frame will be created.

Returns:

Specified frameToFill object but filled with data.

Static methods

staticsort(frames:Array<FlxFrame>, prefixLength:Int, postfixLength:Int):Void

Sorts an array of FlxFrame objects by their name, e.g. ["tiles-001.png", "tiles-003.png", "tiles-002.png"] with "tiles-".length == prefixLength and ".png".length == postfixLength.

staticsortByName(frame1:FlxFrame, frame2:FlxFrame, prefixLength:Int, postfixLength:Int):Int