1 /**
  2  * @class shape2d
  3  * @extends component
  4  * @description
  5  * Component that can express basic 2D shapes and polygons.
  6  * 
  7  */ 
  8 function shape2d() {
  9 
 10     /**
 11      * Forms the shape into a rectangle.
 12      *
 13      * The top-left corner of the rectangle is the origin. 
 14      * Width and height are expressed in pixels.
 15      * @param {Number} width The width of the rectangle in pixels.
 16      * @param {Number} height The height of the rectangle in pixels.
 17      */
 18     this.formRectangle = function(){};
 19 
 20     /**
 21      *
 22      Forms the shape into a visual of an image.
 23      *
 24      * If the image has multiple frames, the image is drawn as
 25      * an animation.
 26      * @param {asset} image The image to display as the aspect. If image does not refer to
 27      * a valid Image, no action is taken. If the Image has multiple frames, the subsequent frame
 28      * is drawn upon next draw() of the shape2d.
 29      * @param {Number} forcedWidth Optional forced width 
 30      * @param {Number} forcedHeight Optional forced height
 31      */
 32     this.formImage = function(){};
 33 
 34     /**
 35      * Forms the aspect into a frame of an image.
 36      *
 37      * Behaves like formImage(), but a specific frame index is
 38      * specified to draw rather than the image as an animation.
 39      * @param {asset} image The image to form as the aspect. If image does not refer to
 40      * a valid image asset, no action is taken
 41      * @param {Number} frame The frame of the image to use, starting at 0. If the
 42      * frame is negative, the aspect is drawn as if formImage() had been called.
 43      * @param {Number} forcedWidth Optional forced width 
 44      * @param {Number} forcedHeight Optional forced height
 45      */
 46     this.formImageFrame = function(){};
 47 
 48     /**
 49      * Forms the shape into an estimated circle made of triangles.
 50      *
 51      * @param {Number} radius The radius of the circle. Measured in pixels.
 52      * @param {Number} numIterations Number of sides that the circle
 53      * should have. The more iterations, the smoother the
 54      * circle will become, but the more resource-intensive
 55      * the shape becomes as well.
 56      */
 57     this.formCircle = function(){};
 58 
 59     /**
 60      * Forms the shape into a collection of triangle primitives.
 61      *
 62      * The points are interpreted as pixels and are expected to be in groups of 3.
 63      * If a non-multiple-of-three number of points is given,
 64      * the remainder points are ignored.
 65      * @param {Array} pts The points of the triangles as individual components, that is, pairs of X-Y values.
 66      */
 67     this.formTriangles = function(){};
 68 
 69     /**
 70      * Forms a collection of line segments.
 71      *
 72      * Every two points form a line segment. If an odd number of points are given, the last point is ignored.
 73      * @param {Array} pts The points of the lines as individual components, that is, pairs of X-Y values.
 74      */
 75     this.formLines = function(){};
 76 
 77 
 78 
 79 
 80 
 81     /**
 82      * Color of the shape.
 83      * @type {color}
 84      */
 85     this.color = {};
 86 
 87     /**
 88      * Whether the shape should be drawn using the absolute positions 
 89      * of its geometry. If absolute, node information is ignored.
 90      * @type {Boolean}
 91      */
 92     this.absolute = false;
 93 
 94     /**
 95      * The transform of the shape component.
 96      * @type {transform}
 97      */
 98     this.node = {};
 99     
100     /** 
101      * The rendering mode. See {@link sandboxe.render2d.renderMode}
102      * @type {Number} 
103      */
104      this.mode = 0;
105 
106 
107 
108 
109     return this;
110 }
111