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)
rectRectanglereadonly
- The rectangle of the bitmap
- Whether smooth scaling is applied.
- The color of the text in CSS format.
- The url of the image file
- The width of the bitmap
Methods
- Adds a callback function that will be called when the bitmap is done loading
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 to start transfer from synumber The y coordinate in the source to start transfer from swnumber The width to use from the source image shnumber The height to use from the source image dxnumber The x coordinate in the destination dynumber The y coordinate in the destination dwnumber sw optionalThe width to draw the image in the destination dhnumber sh optionalThe 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 circle on the bitmap
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 given 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 the alpha value of the pixel at the given x/y coordinates
Name Type Description xnumber The x coordinate of the pixel ynumber The y coordinate of the pixel Returns:
Type Description string The alpha value - Returns the color in hex format of the pixel at the given x/y coordinates
Name Type Description xnumber The x coordinate of the pixel ynumber The y coordinate of the pixel Returns:
Type Description string The pixel color (hex format) - Draws the rectangle with a gradient color fill
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 heightnumber The height of the rectangle color1string The gradient starting color color2string The gradient ending color verticalboolean Whether the gradient should be drawn as vertical or not - Initializes the bitmap object
Name Type Description widthnumber The width of the bitmap heightnumber The height of the bitmap - 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 (it is done loading)
Returns:
Type Description boolean True if the bitmap is ready to render - Gets the width of the given 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 Bitmap.load(url)Bitmapstatic
- Loads an image file from the given url
Name Type Description urlstring The file path of the image file Returns:
Type Description Bitmap The created bitmap object Bitmap.snap(stage)Bitmapstatic
- Takes a snapshot of the game screen
Name Type Description stageStage The stage object Returns:
Type Description Bitmap The created bitmap object