Graphics
Description
Draw GPU accelerated vector graphics. Used in conjunction with the Shape class.
Draw calls are buffered and drawn every frame until you call clear().
API overview
Constructor
Graphics
()
Functions
Public functions
| arcTo ( controlX: Number , controlY: Number , anchorX: Number , anchorY: Number , radius: Number ): Void |
native Adds an arc segment at the corner defined by the last path point, and two specified points |
| beginFill ( color: Number = 0x00000000 , alpha: Number = 1 ): Void |
native Indicate we are beginning a filled shape |
| beginTextureFill ( texture: Texture , matrix: Matrix = null , repeat: Boolean = true , smooth: Boolean = true ): Void |
Begin a textured fill with an existing Texture |
| clear (): Void |
native Clear all draw commands and return to a clean state |
| clearBounds (): Void |
native Resets the bounds to their default state |
| cubicCurveTo ( controlX1: Number , controlY1: Number , controlX2: Number , controlY2: Number , anchorX: Number , anchorY: Number ): Void |
native Adds cubic bezier segment from last point in the path via two control points to the specified point |
| curveTo ( controlX: Number , controlY: Number , anchorX: Number , anchorY: Number ): Void |
native Adds quadratic bezier segment from last point in the path via a control point to the specified point |
| drawArc ( x: Number , y: Number , radius: Number , angleFrom: Number , angleTo: Number , direction: Number ): Void |
native Creates new circle arc shaped sub-path |
| drawCircle ( x: Number , y: Number , radius: Number ): Void |
native Creates new circle shaped sub-path |
| drawEllipse ( x: Number , y: Number , width: Number , height: Number ): Void |
native Creates new ellipse shaped sub-path |
| drawRect ( x: Number , y: Number , width: Number , height: Number ): Void |
native Creates new rectangle shaped sub-path |
| drawRoundRect ( x: Number , y: Number , width: Number , height: Number , ellipseWidth: Number , ellipseHeight: Number ): Void |
native Creates new rounded rectangle shaped sub-path |
| drawRoundRectComplex ( x: Number , y: Number , width: Number , height: Number , topLeftRadius: Number , topRightRadius: Number , bottomLeftRadius: Number , bottomRightRadius: Number ): Void |
native Creates new rounded rectangle shaped sub-path with individually controllable corner radiuses |
| drawSVG ( svg: SVG , x: Number = 0 , y: Number = 0 , scale: Number = 1 , lineThickness: Number = 1 ): Void |
native Draw an SVG at the provided position with the provided scale and line thickness multiplier |
| drawTextBox ( x: Number , y: Number , width: Number , text: String ): Void |
native Draw text in a box using the current format |
| drawTextLine ( x: Number , y: Number , text: String ): Void |
native Draw a line of text using the current format |
| endFill (): Void |
native End drawing of a filled shape |
| getBounds (): Rectangle |
native Get the current bounds of the graphics drawn by this instance |
| lineStyle ( thickness: Number = , color: Number = 0x00000000 , alpha: Number = 1 , pixelHinting: Boolean = false , scaleMode: String = , caps: String = round , joints: String = round , miterLimit: Number = 0 ): Void |
native Specify the style used for lines |
| lineTo ( x: Number , y: Number ): Void |
native Adds line segment from the last point in the path to the specified point |
| moveTo ( x: Number , y: Number ): Void |
native Starts new sub-path with specified point as first point |
| textBoxBounds ( format: TextFormat , x: Number , y: Number , width: Number , text: String ): Rectangle |
native Determine the bounds of a text box drawn with the provided position, line width and format |
| textFormat ( format: TextFormat ): Void |
native Indicate the format used to display text |
| textLineAdvance ( format: TextFormat , x: Number , y: Number , text: String ): Number |
native Determine the logical width of the passed strings |
| textLineBounds ( format: TextFormat , x: Number , y: Number , text: String ): Rectangle |
native Get the bounds of a given string as it would be drawn with specified format |
Protected functions
Constructor
Graphics ()
Functions
arcTo ( controlX: Number , controlY: Number , anchorX: Number , anchorY: Number , radius: Number ): Void
native
Adds an arc segment at the corner defined by the last path point, and two specified points.
Parameters
| controlX: Number | |
| controlY: Number | |
| anchorX: Number | |
| anchorY: Number | |
| radius: Number |
beginFill ( color: Number = 0x00000000 , alpha: Number = 1 ): Void
native
Indicate we are beginning a filled shape.
Parameters
| color: Number = 0x00000000 | |
| alpha: Number = 1 |
beginTextureFill ( texture: Texture , matrix: Matrix = null , repeat: Boolean = true , smooth: Boolean = true ): Void
Begin a textured fill with an existing Texture. Use the matrix parameter to control
the texture transformation matrix within the fill and repeat and smooth to control
how the texture gets rendered on a per-fill basis.
Parameters
| texture: Texture | The Texture to fill the shape with. |
| matrix: Matrix = null | Transformation matrix of the texture within the fill. |
| repeat: Boolean = true | Repeat the texture in all directions within the fill. |
| smooth: Boolean = true | Switch between the smooth (bilinear) and non-smooth (nearest) texture smoothing. |
cubicCurveTo ( controlX1: Number , controlY1: Number , controlX2: Number , controlY2: Number , anchorX: Number , anchorY: Number ): Void
native
Adds cubic bezier segment from last point in the path via two control points to the specified point.
Parameters
| controlX1: Number | |
| controlY1: Number | |
| controlX2: Number | |
| controlY2: Number | |
| anchorX: Number | |
| anchorY: Number |
curveTo ( controlX: Number , controlY: Number , anchorX: Number , anchorY: Number ): Void
native
Adds quadratic bezier segment from last point in the path via a control point to the specified point.
Parameters
| controlX: Number | |
| controlY: Number | |
| anchorX: Number | |
| anchorY: Number |
drawArc ( x: Number , y: Number , radius: Number , angleFrom: Number , angleTo: Number , direction: Number ): Void
native
Creates new circle arc shaped sub-path. The arc center is at x,y, the arc radius is radius, and the arc is drawn from angle angleFrom to angleTo, and swept in direction dir (NVG_CCW, or NVG_CW). Angles are specified in radians.
Parameters
| x: Number | |
| y: Number | |
| radius: Number | |
| angleFrom: Number | |
| angleTo: Number | |
| direction: Number |
drawCircle ( x: Number , y: Number , radius: Number ): Void
native
Creates new circle shaped sub-path.
Parameters
| x: Number | |
| y: Number | |
| radius: Number |
drawEllipse ( x: Number , y: Number , width: Number , height: Number ): Void
native
Creates new ellipse shaped sub-path.
Parameters
| x: Number | |
| y: Number | |
| width: Number | |
| height: Number |
drawRect ( x: Number , y: Number , width: Number , height: Number ): Void
native
Creates new rectangle shaped sub-path.
Parameters
| x: Number | |
| y: Number | |
| width: Number | |
| height: Number |
drawRoundRect ( x: Number , y: Number , width: Number , height: Number , ellipseWidth: Number , ellipseHeight: Number ): Void
native
Creates new rounded rectangle shaped sub-path.
Parameters
| x: Number | |
| y: Number | |
| width: Number | |
| height: Number | |
| ellipseWidth: Number | |
| ellipseHeight: Number |
drawRoundRectComplex ( x: Number , y: Number , width: Number , height: Number , topLeftRadius: Number , topRightRadius: Number , bottomLeftRadius: Number , bottomRightRadius: Number ): Void
native
Creates new rounded rectangle shaped sub-path with individually controllable corner radiuses.
Parameters
| x: Number | |
| y: Number | |
| width: Number | |
| height: Number | |
| topLeftRadius: Number | |
| topRightRadius: Number | |
| bottomLeftRadius: Number | |
| bottomRightRadius: Number |
drawSVG ( svg: SVG , x: Number = 0 , y: Number = 0 , scale: Number = 1 , lineThickness: Number = 1 ): Void
native
Draw an SVG at the provided position with the provided scale and line thickness multiplier. The SVG is drawn with the top left corner placed at the provided position and then scaled according to the provided scale.
For example, setting this to 2 will double the width of all the drawn lines.
Parameters
| svg: SVG | The SVG to draw. |
| x: Number = 0 | The x position coordinate. |
| y: Number = 0 | |
| scale: Number = 1 | The scale multiplier of the SVG image. |
| lineThickness: Number = 1 | A multiplier for the stroke thickness of the drawn lines. |
drawTextBox ( x: Number , y: Number , width: Number , text: String ): Void
native
Draw text in a box using the current format. Note that text alignment is provided by the currently used TextFormat and text alignment is calculated based on the first line of text. If you want to align text based on the last line of text, see textBoxBounds().
Parameters
| x: Number | |
| y: Number | |
| width: Number | |
| text: String |
drawTextLine ( x: Number , y: Number , text: String ): Void
native
Draw a line of text using the current format. Note that text alignment is provided by the currently used TextFormat.
Parameters
| x: Number | |
| y: Number | |
| text: String |
getFullTypeName
(): String
Inherited from Object
native
Gets the fully qualified type name of the Object. The fully qualified type name includes the package of the type.
Returns
| String | fully qualified type name of the Object. |
getType
(): Type
Inherited from Object
native
Gets the Type that describes the Object.
Returns
| Type | The Type that describes the object. |
getTypeName
(): String
Inherited from Object
native
Gets the type name of the Object.
Returns
| String | type name of the Object. |
lineStyle ( thickness: Number = , color: Number = 0x00000000 , alpha: Number = 1 , pixelHinting: Boolean = false , scaleMode: String = , caps: String = round , joints: String = round , miterLimit: Number = 0 ): Void
native
Specify the style used for lines.
Parameters
| thickness: Number = | |
| color: Number = 0x00000000 | |
| alpha: Number = 1 | |
| pixelHinting: Boolean = false | |
| scaleMode: String = | |
| caps: String = round | |
| joints: String = round | |
| miterLimit: Number = 0 |
lineTo ( x: Number , y: Number ): Void
native
Adds line segment from the last point in the path to the specified point.
Parameters
| x: Number | |
| y: Number |
moveTo ( x: Number , y: Number ): Void
native
Starts new sub-path with specified point as first point.
Parameters
| x: Number | |
| y: Number |
textBoxBounds ( format: TextFormat , x: Number , y: Number , width: Number , text: String ): Rectangle
native
Determine the bounds of a text box drawn with the provided position, line width and format.
Parameters
| format: TextFormat | |
| x: Number | |
| y: Number | |
| width: Number | |
| text: String |
textFormat ( format: TextFormat ): Void
native
Indicate the format used to display text.
Parameters
| format: TextFormat |
textLineAdvance ( format: TextFormat , x: Number , y: Number , text: String ): Number
native
Determine the logical width of the passed strings. This can vary from bounds and is usually used for positioning text.
Parameters
| format: TextFormat | |
| x: Number | |
| y: Number | |
| text: String |
textLineBounds ( format: TextFormat , x: Number , y: Number , text: String ): Rectangle
native
Get the bounds of a given string as it would be drawn with specified format.
Parameters
| format: TextFormat | |
| x: Number | |
| y: Number | |
| text: String |