mobile-graphic-easel-src-easeljs-display-Shape.js / js
A Shape allows you to display vector art in the display list. It composites a {{#crossLink "Graphics"}}{{/crossLink}} 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 {{#crossLink "DisplayObject/cache"}}{{/crossLink}} method to reduce the rendering cost. <h4>Example</h4> var graphics = new createjs.Graphics().beginFill("#ff0000").drawRect(0, 0, 100, 100); var shape = new createjs.Shape(graphics); //Alternatively use can also use the graphics property of the Shape class to renderer the same as above. var shape = new createjs.Shape(); shape.graphics.beginFill("#ff0000").drawRect(0, 0, 100, 100); @class Shape @extends DisplayObject @constructor
parameter: {Graphics} graphics Optional. The graphics instance to display. If null, a new Graphics instance will be created.
The graphics instance to display. @property graphics @type Graphics
@property DisplayObject_initialize @private @type Function
Initialization method. @method initialize
parameter: {Graphics} graphics @protected
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. @method isVisible
returns: {Boolean} Boolean indicating whether the Shape would be visible if drawn to a canvas
@property DisplayObject_draw @private @type Function
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). <i>NOTE: This method is mainly for internal use, though it may be useful for advanced uses.</i> @method draw
parameter: {CanvasRenderingContext2D} ctx The canvas 2D context object to draw into.
parameter: {Boolean} ignoreCache 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 a clone of this Shape. Some properties that are specific to this instance's current context are reverted to their defaults (for example .parent). @method clone
parameter: {Boolean} recursive If true, this Shape's {{#crossLink "Graphics"}}{{/crossLink}} instance will also be cloned. If false, the Graphics instance will be shared with the new Shape.
Returns a string representation of this object. @method toString
returns: {String} a string representation of the instance.
(C) Æliens 04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.