class GraphicsExtension
package kha.graphics2
Static extension functions for Graphics2. Usage: "using kha.graphics2.GraphicsExtension;"
Static methods
staticdrawAlignedCharacters(g2:Graphics, text:Array<Int>, start:Int, length:Int, x:Float, y:Float, horAlign:HorTextAlignment, verAlign:VerTextAlignment):Void
staticdrawAlignedString(g2:Graphics, text:String, x:Float, y:Float, horAlign:HorTextAlignment, verAlign:VerTextAlignment):Void
staticdrawArc(g2:Graphics, cx:Float, cy:Float, radius:Float, sAngle:Float, eAngle:Float, strength:Float = 1, ccw:Bool = false, segments:Int = 0):Void
Draws a arc.
Parameters:
ccw | (optional) Specifies whether the drawing should be counterclockwise. |
---|---|
segments | (optional) The amount of lines that should be used to draw the arc. |
staticdrawCircle(g2:Graphics, cx:Float, cy:Float, radius:Float, strength:Float = 1, segments:Int = 0):Void
Draws a circle.
Parameters:
segments | (optional) The amount of lines that should be used to draw the circle. |
---|
staticdrawCubicBezier(g2:Graphics, x:Array<Float>, y:Array<Float>, segments:Int = 20, strength:Float = 1.0):Void
Draws a cubic bezier using 4 pairs of points. If the x and y arrays have a length bigger then 4, the additional points will be ignored. With a length smaller of 4 a error will occur, there is no check for this. You can construct the curves visually in Inkscape with a path using default nodes. Provide x and y in the following order: startPoint, controlPoint1, controlPoint2, endPoint Reference: http://devmag.org.za/2011/04/05/bzier-curves-a-tutorial/
staticdrawCubicBezierPath(g2:Graphics, x:Array<Float>, y:Array<Float>, segments:Int = 20, strength:Float = 1.0):Void
Draws multiple cubic beziers joined by the end point. The minimum size is 4 pairs of points (a single curve).
staticdrawPolygon(g2:Graphics, x:Float, y:Float, vertices:Array<Vector2>, strength:Float = 1):Void
Draws a convex polygon.
staticfillArc(g2:Graphics, cx:Float, cy:Float, radius:Float, sAngle:Float, eAngle:Float, ccw:Bool = false, segments:Int = 0):Void
Draws a filled arc.
Parameters:
ccw | (optional) Specifies whether the drawing should be counterclockwise. |
---|---|
segments | (optional) The amount of lines that should be used to draw the arc. |
staticfillCircle(g2:Graphics, cx:Float, cy:Float, radius:Float, segments:Int = 0):Void
Draws a filled circle.
Parameters:
segments | (optional) The amount of lines that should be used to draw the circle. |
---|
staticfillPolygon(g2:Graphics, x:Float, y:Float, vertices:Array<Vector2>):Void
Draws a filled convex polygon.