ImageBitmap

An image bitmap with pixel data.

Constructor

new ImageBitmap(x, y, width, height, data_width, data_height, data)

Creates a new ImageBitmap with the given x, y, width, height, and pixel data.

Parameters:
NameTypeDescription
xnumber

The x coordinate of the bitmap.

ynumber

The y coordinate of the bitmap.

widthnumber

The width of the bitmap.

heightnumber

The height of the bitmap.

data_widthnumber

Number of pixels in a row of the bitmap.

data_heightnumber

Number of pixels in a column of the bitmap.

dataUint8Array

The pixel data of the bitmap.

Classes

ImageBitmap

Members

base64

Gets the data as base64 encoded string.

data

Gets the pixel data of the bitmap.

data_height

Number of pixels in a column of the bitmap.

data_height

Number of pixels in a column of the bitmap.

data_width

Number of pixels in a row of the bitmap.

data_width

Number of pixels in a row of the bitmap.

height

The height of the bitmap.

height

The height of the bitmap.

width

The width of the bitmap.

width

The width of the bitmap.

x

The x coordinate of the bitmap.

x

The x coordinate of the bitmap.

y

The y coordinate of the bitmap.

y

The y coordinate of the bitmap.

Methods

get_pixel(p) → {Color}

Gets the color of a Point2D in the bitmap.

Parameters:
NameTypeDescription
pPoint2D

The point to get the pixel color at.

Returns:

The color of the pixel.

Type: 
Color

set_data(data_width, data_height, data)

Sets the pixel data of the bitmap.

Parameters:
NameTypeDescription
data_widthnumber

The number of pixels in a row of the bitmap.

data_heightnumber

The number of pixels in a column of the bitmap.

dataUint8Array

The pixel data of the bitmap.

set_pixel(p, color)

Sets a pixel color at a Point2D in the bitmap.

Parameters:
NameTypeDescription
pPoint2D

The point to set the pixel color at.

colorColor

The color of the pixel.

(static) default_image_bitmap() → {ImageBitmap}

Returns the default ImageBitmap, which is an empty bitmap.

Returns:

The default image bitmap.

Type: 
ImageBitmap

(static) fill(x, y, width, height, data_width, data_height, color) → {ImageBitmap}

Gets a bitmap that is filled with a color.

Parameters:
NameTypeDescription
xnumber

The x coordinate of the bitmap.

ynumber

The y coordinate of the bitmap.

widthnumber

The width of the bitmap.

heightnumber

The height of the bitmap.

data_widthnumber

Number of pixels in a row of the bitmap.

data_heightnumber

Number of pixels in a column of the bitmap.

colorColor

The color to fill the bitmap with.

Returns:

The filled image bitmap.

Type: 
ImageBitmap

(static) fill_linear_gradient(x, y, width, height, data_width, data_height, gradient) → {ImageBitmap}

Gets a bitmap that is filled with a linear gradient.

Parameters:
NameTypeDescription
xnumber

The x coordinate of the bitmap.

ynumber

The y coordinate of the bitmap.

widthnumber

The width of the bitmap.

heightnumber

The height of the bitmap.

data_widthnumber

Number of pixels in a row of the bitmap.

data_heightnumber

Number of pixels in a column of the bitmap.

gradientLinearGradient

The linear gradient to fill the bitmap with.

Returns:

The filled image bitmap.

Type: 
ImageBitmap

(static) fill_radial_gradient(x, y, width, height, data_width, data_height, gradient) → {ImageBitmap}

Gets a bitmap that is filled with a radial gradient.

Parameters:
NameTypeDescription
xnumber

The x coordinate of the bitmap.

ynumber

The y coordinate of the bitmap.

widthnumber

The width of the bitmap.

heightnumber

The height of the bitmap.

data_widthnumber

Number of pixels in a row of the bitmap.

data_heightnumber

Number of pixels in a column of the bitmap.

gradientRadialGradient

The radial gradient to fill the bitmap with.

Returns:

The filled image bitmap.

Type: 
ImageBitmap

(static) lerp(bitmap1, bitmap2, t) → {ImageBitmap}

Linearly interpolates between two ImageBitmaps given a progress value.

Parameters:
NameTypeDescription
bitmap1ImageBitmap

The first image bitmap.

bitmap2ImageBitmap

The second image bitmap.

tnumber

The progress value.

Returns:

The interpolated image bitmap.

Type: 
ImageBitmap