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.
Name | Type | Description |
---|---|---|
x | number | The x coordinate of the bitmap. |
y | number | The y coordinate of the bitmap. |
width | number | The width of the bitmap. |
height | number | The height of the bitmap. |
data_width | number | Number of pixels in a row of the bitmap. |
data_height | number | Number of pixels in a column of the bitmap. |
data | Uint8Array | The pixel data of the bitmap. |
- Source
Classes
Members
base64
Gets the data as base64 encoded string.
- Source
data
Gets the pixel data of the bitmap.
- Source
data_height
Number of pixels in a column of the bitmap.
- Source
data_height
Number of pixels in a column of the bitmap.
- Source
data_width
Number of pixels in a row of the bitmap.
- Source
data_width
Number of pixels in a row of the bitmap.
- Source
height
The height of the bitmap.
- Source
height
The height of the bitmap.
- Source
width
The width of the bitmap.
- Source
width
The width of the bitmap.
- Source
x
The x coordinate of the bitmap.
- Source
x
The x coordinate of the bitmap.
- Source
y
The y coordinate of the bitmap.
- Source
y
The y coordinate of the bitmap.
- Source
Methods
get_pixel(p) → {Color}
Gets the color of a Point2D in the bitmap.
Name | Type | Description |
---|---|---|
p | Point2D | The point to get the pixel color at. |
- Source
The color of the pixel.
- Type:
- Color
set_data(data_width, data_height, data)
Sets the pixel data of the bitmap.
Name | Type | Description |
---|---|---|
data_width | number | The number of pixels in a row of the bitmap. |
data_height | number | The number of pixels in a column of the bitmap. |
data | Uint8Array | The pixel data of the bitmap. |
- Source
set_pixel(p, color)
Sets a pixel color at a Point2D in the bitmap.
Name | Type | Description |
---|---|---|
p | Point2D | The point to set the pixel color at. |
color | Color | The color of the pixel. |
- Source
(static) default_image_bitmap() → {ImageBitmap}
Returns the default ImageBitmap, which is an empty bitmap.
- Source
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.
Name | Type | Description |
---|---|---|
x | number | The x coordinate of the bitmap. |
y | number | The y coordinate of the bitmap. |
width | number | The width of the bitmap. |
height | number | The height of the bitmap. |
data_width | number | Number of pixels in a row of the bitmap. |
data_height | number | Number of pixels in a column of the bitmap. |
color | Color | The color to fill the bitmap with. |
- Source
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.
Name | Type | Description |
---|---|---|
x | number | The x coordinate of the bitmap. |
y | number | The y coordinate of the bitmap. |
width | number | The width of the bitmap. |
height | number | The height of the bitmap. |
data_width | number | Number of pixels in a row of the bitmap. |
data_height | number | Number of pixels in a column of the bitmap. |
gradient | LinearGradient | The linear gradient to fill the bitmap with. |
- Source
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.
Name | Type | Description |
---|---|---|
x | number | The x coordinate of the bitmap. |
y | number | The y coordinate of the bitmap. |
width | number | The width of the bitmap. |
height | number | The height of the bitmap. |
data_width | number | Number of pixels in a row of the bitmap. |
data_height | number | Number of pixels in a column of the bitmap. |
gradient | RadialGradient | The radial gradient to fill the bitmap with. |
- Source
The filled image bitmap.
- Type:
- ImageBitmap
(static) lerp(bitmap1, bitmap2, t) → {ImageBitmap}
Linearly interpolates between two ImageBitmaps given a progress value.
Name | Type | Description |
---|---|---|
bitmap1 | ImageBitmap | The first image bitmap. |
bitmap2 | ImageBitmap | The second image bitmap. |
t | number | The progress value. |
- Source
The interpolated image bitmap.
- Type:
- ImageBitmap