| Package | com.rubenswieringa.drawing |
| Class | public class DrawingTool |
See also
| Method | Defined by | ||
|---|---|---|---|
|
clearLineStyle(graphics:Graphics):void
[static]
Sets the lineStyle of a Graphics instance to none.
| DrawingTool | ||
|
[static]
Draws lines between the Point instances in the area Array onto graphics with the drawing API.
| DrawingTool | ||
|
drawLine(graphics:Graphics, point1:Point, point2:Point, lineStyle:LineStyle = null, moveTo:Boolean = true):void
[static]
Draws a line from one Point to another.
| DrawingTool | ||
|
drawMarker(graphics:Graphics, point:*, size:Number = 10, shape:String, lineStyle:LineStyle = null):void
[static]
Draws a cross shaped marker on the specified coordinate(s).
| DrawingTool | ||
|
[static]
Draws lines between the four corners of a Rectangle.
| DrawingTool | ||
| Constant | Defined by | ||
|---|---|---|---|
| CIRCLE : String = "circle" [static]
| DrawingTool | ||
| CROSS : String = "cross" [static]
| DrawingTool | ||
| clearLineStyle | () | method |
public static function clearLineStyle(graphics:Graphics):voidSets the lineStyle of a Graphics instance to none.
Parametersgraphics:Graphics — Graphics instance of which to clear the lineStyle.
|
| draw | () | method |
public static function draw(graphics:Graphics, area:Array, connect:Boolean = true, lineStyle:LineStyle = null):voidDraws lines between the Point instances in the area Array onto graphics with the drawing API. This method its main functionality is that it executes the lineTo() method, so (for example) when aiming to draw a filled shape, beginFill() must be called first. For drawing lines, either the lineStyle() method of the Graphics class must be executed, or a LineStyle instance must be used as a parameter value for this method (DrawingTool.draw()). Also see the example below.
Parametersgraphics:Graphics — Graphics instance on which the lines should be drawn
|
|
area:Array — Array with coordinates (Point instances)
|
|
connect:Boolean (default = true) — Boolean indicating whether or not to connect the last Point in area with the last Point in area. Defaults to true.
|
|
lineStyle:LineStyle (default = null) — LineStyle instance carrying the styles for the lines of the shape to be drawn.
|
See also
var shape:Array = [new Point(0,0), new Point(100,0), new Point(0,100)];
myGraphics.beginFill(0xFF0000);
DrawingTool.draw(myGraphics, shape);
myGraphics.endFill();
var shape:Array = [new Point(0,0), new Point(100,0), new Point(0,100)];
myGraphics.lineStyle(1, 0x00FF00);
DrawingTool.draw(myGraphics, shape);
var shape:Array = [new Point(0,0), new Point(100,0), new Point(0,100)];
var lineStyle:LineStyle = new LineStyle(1, 0x00FF00);
lineStyle.dash = 4;
DrawingTool.draw(myGraphics, shape);
| drawLine | () | method |
public static function drawLine(graphics:Graphics, point1:Point, point2:Point, lineStyle:LineStyle = null, moveTo:Boolean = true):voidDraws a line from one Point to another. This method its main functionality is that it executes the lineTo() method, so (for example) when aiming to draw a filled shape, beginFill() must be called first. For drawing lines, either the lineStyle() method of the Graphics class must be executed, or a LineStyle instance must be used as a parameter value for this method.
Parametersgraphics:Graphics — Graphics instance on which to draw the line.
|
|
point1:Point — First Point.
|
|
point2:Point — second Point.
|
|
lineStyle:LineStyle (default = null) — LineStyle instance storing the properties of the line to be drawn.
|
|
moveTo:Boolean (default = true) — Whether or not to execute the Graphics class its moveTo() method before running the rest of the method.
|
See also
| drawMarker | () | method |
public static function drawMarker(graphics:Graphics, point:*, size:Number = 10, shape:String, lineStyle:LineStyle = null):voidDraws a cross shaped marker on the specified coordinate(s). This method its main functionality is that it executes the lineTo() method, so (for example) when aiming to draw a filled shape, beginFill() must be called first. For drawing lines, either the lineStyle() method of the Graphics class must be executed, or a LineStyle instance must be used as a parameter value for this method.
Parametersgraphics:Graphics — Graphics instance on which to draw the shape.
|
|
point:* — Array or Point specifying one or more Point instances. If the point parameter value is neither a Point nor an Array then the function will silently fail.
|
|
size:Number (default = 10) — Size of the marker.
|
|
shape:String — Shape of the marker, either DrawingTool.CROSS or DrawingTool.CIRCLE. Defaults to DrawingTool.CROSS.
|
|
lineStyle:LineStyle (default = null) — LineStyle instance carrying the styles for the lines of the marker to be drawn.
|
See also
| drawRect | () | method |
public static function drawRect(graphics:Graphics, rect:Rectangle, lineStyle:LineStyle = null):voidDraws lines between the four corners of a Rectangle. Note that this method is not the same as the method with the same name in the Graphics class, which takes the parameters of the Rectangle constructor as parameters, instead of a Rectangle instance, as does this method. This method its main functionality is that it executes the lineTo() method, so (for example) when aiming to draw a filled shape, beginFill() must be called first. For drawing lines, either the lineStyle() method of the Graphics class must be executed, or a LineStyle instance must be used as a parameter value for this method. Also see the example included in the documentation for the draw() method.
Parametersgraphics:Graphics — Graphics instance on which the lines should be drawn
|
|
rect:Rectangle — Rectangle
|
|
lineStyle:LineStyle (default = null) — LineStyle instance carrying the styles for the lines of the Rectangle to be drawn.
|
See also
| CIRCLE | constant |
public static const CIRCLE:String = "circle"
| CROSS | constant |
public static const CROSS:String = "cross"