Class cc.DrawingPrimitiveCanvas

Class Summary
Constructor Attributes Constructor Name and Description
 
cc.DrawingPrimitiveCanvas(renderContext)
Canvas of DrawingPrimitive implement version use for canvasMode

Method Summary

Class Detail

cc.DrawingPrimitiveCanvas(renderContext)
Canvas of DrawingPrimitive implement version use for canvasMode
Parameters:
{CanvasRenderingContext2D} renderContext

Method Detail

  • ctor(renderContext)
    Constructor of cc.DrawingPrimitiveCanvas
    Parameters:
    {cc.CanvasContextWrapper} renderContext
  • drawCardinalSpline(config, tension, segments)
    draw a cardinal spline path
    Parameters:
    {Array} config
    {Number} tension
    {Number} segments
  • drawCatmullRom(points, segments)
    draw a CatmullRom curve
    Parameters:
    {Array} 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 Optional
  • drawColorBall(ctx, radius, color)
    draw a color ball
    Parameters:
    {cc.CanvasContextWrapper} ctx
    canvas context
    {Number} radius
    {cc.Color} color
  • 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
  • drawImage(image, sourcePoint, sourceSize, destPoint, destSize)
    draw an image
    Parameters:
    {HTMLImageElement|HTMLCanvasElement} image
    {cc.Point} sourcePoint
    {cc.Size} sourceSize
    {cc.Point} destPoint
    {cc.Size} destSize
  • drawLine(origin, destination)
    draws a line given the origin and destination point measured in points
    Parameters:
    {cc.Point} origin
    {cc.Point} destination
  • drawPoint(point, size)
    draws a point given x and y coordinate measured in points
    Parameters:
    {cc.Point} point
    {Number} size
  • drawPoints(points, numberOfPoints, size)
    draws an array of points.
    Parameters:
    {Array} points
    point of array
    {Number} numberOfPoints
    {Number} size
  • drawPoly(vertices, numOfVertices, closePolygon, fill)
    draws a polygon given a pointer to cc.Point coordinates and the number of vertices measured in points.
    Parameters:
    {Array} vertices
    a pointer to cc.Point coordinates
    {Number} numOfVertices
    the number of vertices measured in points
    {Boolean} closePolygon
    The polygon can be closed or open
    {Boolean} fill Optional
    The polygon can be closed or open and optionally filled with current color
  • drawQuadBezier(origin, control, destination, segments)
    draws a quad bezier path
    Parameters:
    {cc.Point} origin
    {cc.Point} control
    {cc.Point} destination
    {Number} segments
  • drawRect(origin, destination)
    draws a rectangle given the origin and destination point measured in points.
    Parameters:
    {cc.Point} origin
    {cc.Point} destination
  • drawSolidPoly(polygons, numberOfPoints, color)
    draws a solid polygon given a pointer to CGPoint coordinates, the number of vertices measured in points, and a color.
    Parameters:
    {Array} polygons
    {Number} numberOfPoints
    {cc.Color} color
  • drawSolidRect(origin, destination, color)
    draws a solid rectangle given the origin and destination point measured in points.
    Parameters:
    {cc.Point} origin
    {cc.Point} destination
    {cc.Color} color
  • drawStar(ctx, radius, color)
    draw a star
    Parameters:
    {cc.CanvasContextWrapper} ctx
    canvas context
    {Number} radius
    {cc.Color} color
  • fillText(strText, x, y)
    fill text
    Parameters:
    {String} strText
    {Number} x
    {Number} y
  • setDrawColor(r, g, b, a)
    set the drawing color with 4 unsigned bytes
    Parameters:
    {Number} r
    red value (0 to 255)
    {Number} g
    green value (0 to 255)
    {Number} b
    blue value (0 to 255)
    {Number} a
    Alpha value (0 to 255)
  • setLineWidth(width)
    set the line width. Default 1.
    Parameters:
    {Number} width
  • setPointSize(pointSize)
    set the point size in points. Default 1.
    Parameters:
    {Number} pointSize