The basic object that represents an image.
| Name | Type | Description |
|---|---|---|
width |
number |
The width of the bitmap. |
height |
number |
The height of the bitmap. |
Members
-
The base texture that holds the image.
-
The bitmap canvas.
-
The 2d context of the bitmap canvas.
-
Whether the font is bold.
-
The face name of the font.
-
Whether the font is italic.
-
The size of the font in pixels.
-
The height of the bitmap.
-
The bitmap image.
-
The color of the outline of the text in CSS format.
-
The width of the outline of the text.
-
The opacity of the drawing object in the range (0, 255).
-
rect Rectangle readonly
-
The rectangle of the bitmap.
-
Whether the smooth scaling is applied.
-
The color of the text in CSS format.
-
The url of the image file.
-
The width of the bitmap.
Methods
-
Bitmap.load (url)Bitmap static
-
Loads a image file.
Name Type Description urlstring The image url of the texture.
Returns:
Type Description Bitmap The new bitmap object. -
Bitmap.snap (stage)Bitmap static
-
Takes a snapshot of the game screen.
Name Type Description stageStage The stage object.
Returns:
Type Description Bitmap The new bitmap object. -
Adds a callback function that will be called when the bitmap is loaded.
Name Type Description listnerfunction The callback function.
-
Performs a block transfer.
Name Type Default Description sourceBitmap The bitmap to draw.
sxnumber The x coordinate in the source.
synumber The y coordinate in the source.
swnumber The width of the source image.
shnumber The height of the source image.
dxnumber The x coordinate in the destination.
dynumber The y coordinate in the destination.
dwnumber sw optional The width to draw the image in the destination.
dhnumber sh optional The height to draw the image in the destination.
-
Clears the entire bitmap.
-
Clears the specified rectangle.
Name Type Description xnumber The x coordinate for the upper-left corner.
ynumber The y coordinate for the upper-left corner.
widthnumber The width of the rectangle to clear.
heightnumber The height of the rectangle to clear.
-
Destroys the bitmap.
-
Draws a bitmap in the shape of a circle.
Name Type Description xnumber The x coordinate based on the circle center.
ynumber The y coordinate based on the circle center.
radiusnumber The radius of the circle.
colorstring The color of the circle in CSS format.
-
Draws the outline text to the bitmap.
Name Type Description textstring The text that will be drawn.
xnumber The x coordinate for the left of the text.
ynumber The y coordinate for the top of the text.
maxWidthnumber The maximum allowed width of the text.
lineHeightnumber The height of the text line.
alignstring The alignment of the text.
-
Fills the entire bitmap.
Name Type Description colorstring The color of the rectangle in CSS format.
-
Fills the specified rectangle.
Name Type Description xnumber The x coordinate for the upper-left corner.
ynumber The y coordinate for the upper-left corner.
widthnumber The width of the rectangle to fill.
heightnumber The height of the rectangle to fill.
colorstring The color of the rectangle in CSS format.
-
Returns alpha pixel value at the specified point.
Name Type Description xnumber The x coordinate of the pixel in the bitmap.
ynumber The y coordinate of the pixel in the bitmap.
Returns:
Type Description string The alpha value. -
Returns pixel color at the specified point.
Name Type Description xnumber The x coordinate of the pixel in the bitmap.
ynumber The y coordinate of the pixel in the bitmap.
Returns:
Type Description string The pixel color (hex format). -
Draws the rectangle with a gradation.
Name Type Description xnumber The x coordinate for the upper-left corner.
ynumber The y coordinate for the upper-left corner.
widthnumber The width of the rectangle to fill.
heightnumber The height of the rectangle to fill.
color1string The gradient starting color.
color2string The gradient ending color.
verticalboolean Whether the gradient should be draw as vertical or not.
-
Checks whether a loading error has occurred.
Returns:
Type Description boolean True if a loading error has occurred. -
Checks whether the bitmap is ready to render.
Returns:
Type Description boolean True if the bitmap is ready to render. -
Returns the width of the specified text.
Name Type Description textstring The text to be measured.
Returns:
Type Description number The width of the text in pixels. -
Resizes the bitmap.
Name Type Description widthnumber The new width of the bitmap.
heightnumber The new height of the bitmap.
-
Tries to load the image again.
-
Draws the specified rectangular frame.
Name Type Description xnumber The x coordinate for the upper-left corner.
ynumber The y coordinate for the upper-left corner.
widthnumber The width of the rectangle to fill.
heightnumber The height of the rectangle to fill.
colorstring The color of the rectangle in CSS format.