A Shape allows you to display vector art in the display list. It composites a Graphics instance which exposes all of the vector
drawing methods. The Graphics instance can be shared between multiple Shape instances to display the same vector graphics with different
positions or transforms. If the vector art will not change between draws, you may want to use the cache() method to reduce the rendering cost.
Properties
The graphics instance to display.
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
clone
(
recursive
)
Returns a clone of this Shape. Some properties that are specific to this instance's current context are reverted to
their defaults (for example .parent).
- Parameters:
-
recursive
<Boolean>
If true, this Shape's Graphics instance will also be cloned. If false, the Graphics instance
will be shared with the new Shape.
- Returns:
void
void
draw
(
ctx
,
ignoreCache
)
Draws the Shape 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
param {Graphics} graphics
(
)
Initialization method.
Boolean
isVisible
(
)
Returns true or false indicating whether the Shape 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 Shape 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.
_testHit,
applyShadow,
cache,
clone,
cloneProps,
draw,
getConcatenatedMatrix,
getStage,
globalToLocal,
hitTest,
initialize,
isVisible,
localToGlobal,
localToLocal,
toString,
uncache,
updateCache