Helper class for working with bitmap data.

Variables

height:Int

The height of the bitmap.

width:Int

The width of the bitmap.

Methods

inline clone ():Bitmap

Makes a deep copy of the bitmap data.

Returns:

The deep copy of the bitmap data.

inline fill (color:Rgba):Void

Fills the bitmap with the given color.

Parameters:

color

The color to fill the bitmap with.

inline getBytes ():Bytes

Gets the raw bitmap data bytes.

Returns:

The bitmap data.

inline getPixel (x:Int, y:Int):Rgba

Gets a pixel at the given coordinate.

Parameters:

x

The x-coordinate.

y

The y-coordinate.

Returns:

The pixel color value.

inline setPixel (x:Int, y:Int, color:Rgba):Void

Sets a pixel at the given coordinate.

Parameters:

x

The x-coordinate.

y

The y-coordinate.

color

The color value to set at the given coordinate.

Static methods

staticinline create (w:Int, h:Int, color:Rgba):Bitmap

Creates a new bitmap, filled with the given color.

Parameters:

w

The width of the bitmap.

h

The height of the bitmap.

color

The starting background color of the bitmap.

Returns:

The new bitmap.

staticinline createFromByteArray (w:Int, h:Int, bytes:Array<Int>):Bitmap

Creates a new bitmap from the supplied array of bytes. Useful for target language consumers that don't have direct access to the Bytes Haxe standard library class.

Parameters:

w

The width of the bitmap.

h

The height of the bitmap.

bytes

The byte data to fill the bitmap with, must be width * height * depth long.

Returns:

The new bitmap.

staticinline createFromBytes (w:Int, h:Int, bytes:Bytes):Bitmap

Creates a new bitmap from the supplied byte data.

Parameters:

w

The width of the bitmap.

h

The height of the bitmap.

bytes

The byte data to fill the bitmap with, must be width * height * depth long.

Returns:

The new bitmap.