lib-flex-book-com-rubenswieringa-drawing-DrawingTool.ax (swf ) [ flash ] flex
Provides basic functionality for drawing with the Drawing API. @author Ruben Swieringa ruben.swieringa@gmail.com www.rubenswieringa.com www.rubenswieringa.com/blog @version 1.0.0 @see LineStyle edit 1 Before modifying and/or redistributing this class, please contact Ruben Swieringa (ruben.swieringa@gmail.com). View code documentation at: http://www.rubenswieringa.com/code/as3/flex/@file/docs/ *
Constructor. @private
Draws 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. @param graphics Graphics instance on which to draw the shape. @param 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. @param size Size of the marker. @param shape Shape of the marker, either @ax-lib-flex-book-com-rubenswieringa-drawing-DrawingTool.CROSS or @ax-lib-flex-book-com-rubenswieringa-drawing-DrawingTool.CIRCLE. Defaults to @ax-lib-flex-book-com-rubenswieringa-drawing-DrawingTool.CROSS. @param lineStyle LineStyle instance carrying the styles for the lines of the marker to be drawn. @see LineStyle @see @ax-lib-flex-book-com-rubenswieringa-drawing-DrawingTool#CROSS @see @ax-lib-flex-book-com-rubenswieringa-drawing-DrawingTool#CIRCLE
Draws 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 (@ax-lib-flex-book-com-rubenswieringa-drawing-DrawingTool.draw()). Also see the example below. @param graphics Graphics instance on which the lines should be drawn @param area Array with coordinates (Point instances) @param connect Boolean indicating whether or not to connect the last Point in area with the last Point in area. Defaults to true. @param lineStyle LineStyle instance carrying the styles for the lines of the shape to be drawn. @example Drawing a filled shape: <listing version="3.0"> var shape:Array = [new Point(0,0), new Point(100,0), new Point(0,100)]; myGraphics.beginFill(0xFF0000); @ax-lib-flex-book-com-rubenswieringa-drawing-DrawingTool.draw(myGraphics, shape); myGraphics.endFill(); </listing> @example Drawing a shape with outline: <listing version="3.0"> var shape:Array = [new Point(0,0), new Point(100,0), new Point(0,100)]; myGraphics.lineStyle(1, 0x00FF00); @ax-lib-flex-book-com-rubenswieringa-drawing-DrawingTool.draw(myGraphics, shape); </listing> @example Drawing a shape with dashed outline using the LineStyle class: <listing version="3.0"> 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; @ax-lib-flex-book-com-rubenswieringa-drawing-DrawingTool.draw(myGraphics, shape); </listing> @see LineStyle
Draws 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. @param graphics Graphics instance on which the lines should be drawn @param rect Rectangle @param lineStyle LineStyle instance carrying the styles for the lines of the Rectangle to be drawn. @see LineStyle @see @ax-lib-flex-book-com-rubenswieringa-drawing-DrawingTool#draw()
Draws 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. @param graphics Graphics instance on which to draw the line. @param point1 First Point. @param point2 second Point. @param lineStyle LineStyle instance storing the properties of the line to be drawn. @param moveTo Whether or not to execute the Graphics class its moveTo() method before running the rest of the method. @see LineStyle
Sets the lineStyle of a Graphics instance to none. @param graphics Graphics instance of which to clear the lineStyle.
(C) Æliens 18/6/2009
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.