A Bitmap represents an Image, Canvas, or Video in the display list.
Constructor
Bitmap
(
image
)
- Parameters:
-
image
<Image | HTMLCanvasElement | HTMLVideoElement>
The Image, Canvas, or Video to render to the display list.
Properties
image
- Image | HTMLCanvasElement | HTMLVideoElement
The image to render. This can be an Image, a Canvas, or a Video.
Whether or not the Bitmap should be draw to the canvas at whole pixel coordinates.
Default Value: true
Properties inherited from DisplayObject:
_activeContext,
_cacheDraw,
_cacheOffsetX,
_cacheOffsetY,
_restoreContext,
_revertAlpha,
_revertShadow,
_revertX,
_revertY,
alpha,
cacheCanvas,
compositeOperation,
id,
mouseEnabled,
name,
parent,
regX,
regY,
rotation,
scaleX,
scaleY,
shadow,
skewX,
skewY,
snapToPixel,
visible,
x,
y
Methods
void
cache
(
)
Because the content of a Bitmap is already in a simple format, cache is unnecessary for Bitmap instances.
You should not cache Bitmap instances as it can degrade performance.
Bitmap
clone
(
)
Returns a clone of the Bitmap instance.
- Returns:
Bitmap
- a clone of the Bitmap instance.
void
draw
(
ctx
,
ignoreCache
)
Draws the display object into the specified context ignoring it's visible, alpha, shadow, and transform.
Returns true if the draw was handled (useful for overriding functionality).
NOTE: This method is mainly for internal use, though it may be useful for advanced uses.
- Parameters:
-
ctx
<CanvasRenderingContext2D>
The canvas 2D context object to draw into.
-
ignoreCache
<Boolean>
Indicates whether the draw operation should ignore any current cache.
For example, used for drawing the cache (to prevent it from simply drawing an existing cache back
into itself).
- Returns:
void
protected
void
initialize
(
)
Initialization method.
Boolean
isVisible
(
)
Returns true or false indicating whether the display object would be visible if drawn to a canvas.
This does not account for whether it would be visible within the boundaries of the stage.
NOTE: This method is mainly for internal use, though it may be useful for advanced uses.
- Returns:
Boolean
- Boolean indicating whether the display object would be visible if drawn to a canvas
String
toString
(
)
Returns a string representation of this object.
- Returns:
String
- a string representation of the instance.
void
uncache
(
)
Because the content of a Bitmap is already in a simple format, cache is unnecessary for Bitmap instances.
You should not cache Bitmap instances as it can degrade performance.
void
updateCache
(
)
Because the content of a Bitmap is already in a simple format, cache is unnecessary for Bitmap instances.
You should not cache Bitmap instances as it can degrade performance.
_testHit,
applyShadow,
cache,
clone,
cloneProps,
draw,
getConcatenatedMatrix,
getStage,
globalToLocal,
hitTest,
initialize,
isVisible,
localToGlobal,
localToLocal,
toString,
uncache,
updateCache