The Path class is a filled graphic element that draws a series of path segments.
In vector graphics, a path is a series of points connected by straight or curved line segments.
Together the lines form an image. In Flex, you use the Path class to define a complex vector shape
constructed from a set of line segments.

Typically, the first element of a path definition is a Move segment to specify the starting pen
position of the graphic. You then use the Line, CubicBezier and QuadraticBezier segments to
draw the lines of the graphic. When using these classes, you only specify the x and y coordinates
of the end point of the line; the x and y coordinate of the starting point is defined by the current
pen position.

After drawing a line segment, the current pen position becomes the x and y coordinates of the end
point of the line. You can use multiple Move segments in the path definition to
reposition the pen.

The syntax used by the Path class to define the shape is the same as the SVG path syntax,
which makes it easy to convert SVG paths to Flex paths.

Defines how the mask is applied to the GraphicElement.
The possible values are MaskType.CLIP, MaskType.ALPHA, and
MaskType.LUMINOSITY.
Clip Masking
When masking in clip mode, a clipping masks is reduced to 1-bit.

A utility method to update the rotation, scale, and translation of the
transform while keeping a particular point, specified in the component's
own coordinate space, fixed in the parent's coordinate space.

data

A string containing a compact represention of the path segments. This is an alternate
way of setting the segments property. Setting this property overrides any values
stored in the segments array property.

The value is a space-delimited string describing each path segment. Each
segment entry has a single character which denotes the segment type and
two or more segment parameters.

If the segment command is upper-case, the parameters are absolute values.
If the segment command is lower-case, the parameters are relative values.

The following table shows the syntax for the segments:

Segment Type

Command

Parameters

Example

Move

M/m

x y

M 10 20 - Move line to 10, 20.

Line

L/l

x y

L 50 30 - Line to 50, 30.

Horizontal line

H/h

x

H 40 = Horizontal line to 40.

Vertical line

V/v

y

V 100 - Vertical line to 100.

QuadraticBezier

Q/q

controlX controlY x y

Q 110 45 90 30 - Curve to 90, 30 with the control point at 110, 45.

CubicBezier

C/c

control1X control1Y control2X control2Y x y

C 45 50 20 30 10 20 - Curve to 10, 20 with the first control point at 45, 50 and the second control point at 20, 30.

Close path

Z/z

n/a

Closes off the path.

The default value is null.

Implementation public function get data():String public function set data(value:String):void

draw

Draw the element. This is the second of three steps taken during the drawing
process. Override this method to implement your drawing. The stroke
(and fill, if applicable) have been set in the beginDraw() method.
Your override should only contain calls to drawing methods such as
moveTo(), curveTo(), and drawRect().

Returns the y coordinate of the element's bounds at the specified element size.
This method is typically used by layouts during a call to
the measure() to predict what
the element position will be, if the element is resized to particular dimensions.

Parameters

width:Number — The element's bounds width, or NaN to use the preferred width.

height:Number — The element's bounds height, or NaN to use the preferred height.

postLayoutTransform:Boolean (default = true) — When postLayoutTransform is true, the method returns
the y coordinate of the element's bounding box top-left corner.
The bounding box is in element's parent coordinate space and is calculated
from the specified bounds size, layout position and layout transform matrix.

Returns

Number — The y coordinate of the element's bounds at the specified element size.

measure

Calculates the default size of the element. This is an advanced
method that you might override when creating a subclass of GraphicElement.

You do not call this method directly. Flex calls the
measure() method when the element is added to an
IGraphicElementContainer container such as Group
using the addElement() method, and when the element's
invalidateSize() method is called.

By default you set both explicit height and explicit width of an element,
Flex does not call the measure() method,
even if you explicitly call the invalidateSize() method.
To override this behavior, override skipMeasure() method.

In your override of this method, you must set the
measuredWidth and measuredHeight properties
to define the default size.
You can optionally set the measuredX and
measuredY properties to define the default measured bounds
top-left corner relative to the origin of the element.

The conceptual point of measure() is for the element to
provide its own natural or intrinsic bounds as a default. Therefore, the
measuredWidth and measuredHeight properties
should be determined by factors such as:

The amount of text the component needs to display.

The size of a JPEG image that the component displays.

In some cases, there is no intrinsic way to determine default values.
For example, a simple GreenCircle element might simply set
measuredWidth = 100 and measuredHeight = 100 in its measure() method to
provide a reasonable default size. In other cases, such as a TextArea,
an appropriate computation (such as finding the right width and height
that would just display all the text and have the aspect ratio of a Golden Rectangle)
might be too time-consuming to be worthwhile.

The default implementation of measure()
sets the values of the measuredWidth, measuredHeight,
measuredX, and measuredY properties
to 0.