new BitmapData(game, key, width, height, skipPool)
A BitmapData object contains a Canvas element to which you can draw anything you like via normal Canvas context operations.
A single BitmapData can be used as the texture for one or many Images / Sprites.
So if you need to dynamically create a Sprite texture then they are a good choice.
Important note: Every BitmapData creates its own Canvas element. Because BitmapData's are now Game Objects themselves, and don't
live on the display list, they are NOT automatically cleared when you change State. Therefore you must call BitmapData.destroy
in your State's shutdown method if you wish to free-up the resources the BitmapData used, it will not happen for you.
Parameters
Name | Type | Argument | Default | Description |
---|---|---|---|---|
game | Phaser.Game | A reference to the currently running game. | ||
key | string | Internal Phaser reference key for the BitmapData. | ||
width | number | <optional> | 256 | The width of the BitmapData in pixels. If undefined or zero it's set to a default value. |
height | number | <optional> | 256 | The height of the BitmapData in pixels. If undefined or zero it's set to a default value. |
skipPool | boolean | <optional> | false | When this BitmapData generates its internal canvas to use for rendering, it will get the canvas from the CanvasPool if false, or create its own if true. |
- Source code: gameobjects/BitmapData.js (Line 24)
Please login to continue.