Class cc.DrawingPrimitive
Extends
cc.Class.
Defined in: CCDrawingPrimitives.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Drawing primitives Utility Class. |
Method Attributes | Method Name and Description |
---|---|
ctor(renderContext)
Constructor
|
|
drawCardinalSpline(config, tension, segments)
draw a cardinal spline path
|
|
drawCatmullRom(points, segments)
draw a catmull rom line
|
|
drawCircle(center, radius, angle, segments, drawLineToCenter)
draws a circle given the center, radius and number of segments.
|
|
drawCubicBezier(origin, control1, control2, destination, segments)
draws a cubic bezier path
|
|
drawLine(origin, destination)
draws a line given the origin and destination point measured in points
|
|
drawPoint(point)
draws a point given x and y coordinate measured in points
|
|
drawPoints(points, numberOfPoints)
draws an array of points.
|
|
drawPoly(vertices, numOfVertices, closePolygon, fill)
draws a poligon given a pointer to cc.Point coordiantes and the number of vertices measured in points.
|
|
drawQuadBezier(origin, control, destination, segments)
draws a quad bezier path
|
|
returns render context of drawing primitive
|
|
setRenderContext(context)
set render context of drawing primitive
|
Class Detail
cc.DrawingPrimitive()
Drawing primitives Utility Class. this class is base class, it contain some render type version: Canvas, WebGL, DOM.
this class contain some primitive Drawing Method:
- drawPoint
- drawLine
- drawPoly
- drawCircle
- drawQuadBezier
- drawCubicBezier
You can change the color, width and other property by calling these WebGL API:
glColor4ub(), glLineWidth(), glPointSize().
Method Detail
ctor(renderContext)
Constructor
- Parameters:
- {CanvasContext} renderContext
drawCardinalSpline(config, tension, segments)
draw a cardinal spline path
- Parameters:
- {cc.PointArray} config
- {Number} tension
- {Number} segments
drawCatmullRom(points, segments)
draw a catmull rom line
- Parameters:
- {cc.PointArray} points
- {Number} segments
drawCircle(center, radius, angle, segments, drawLineToCenter)
draws a circle given the center, radius and number of segments.
- Parameters:
- {cc.Point} center
- center of circle
- {Number} radius
- {Number} angle
- angle in radians
- {Number} segments
- {Boolean} drawLineToCenter
drawCubicBezier(origin, control1, control2, destination, segments)
draws a cubic bezier path
- Parameters:
- {cc.Point} origin
- {cc.Point} control1
- {cc.Point} control2
- {cc.Point} destination
- {Number} segments
drawLine(origin, destination)
draws a line given the origin and destination point measured in points
drawPoint(point)
draws a point given x and y coordinate measured in points
- Parameters:
- {cc.Point} point
drawPoints(points, numberOfPoints)
draws an array of points.
- Parameters:
- {Array} points
- point of array
- {Number} numberOfPoints
drawPoly(vertices, numOfVertices, closePolygon, fill)
draws a poligon given a pointer to cc.Point coordiantes and the number of vertices measured in points.
- Parameters:
- {Array} vertices
- a pointer to cc.Point coordiantes
- {Number} numOfVertices
- the number of vertices measured in points
- {Boolean} closePolygon
- The polygon can be closed or open
- {Boolean} fill
- The polygon can be closed or open and optionally filled with current color
drawQuadBezier(origin, control, destination, segments)
draws a quad bezier path
{CanvasContext}
getRenderContext()
returns render context of drawing primitive
- Returns:
- {CanvasContext}
setRenderContext(context)
set render context of drawing primitive
- Parameters:
- context