|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.flagstone.transform.FSTransformObject
com.flagstone.transform.FSCurve
public class FSCurve
FSCurve is used to define a curve. Curved lines are constructed using a Quadratic Bezier curve.
The curve is specified using two points relative to the current drawing position, an off-curve control point and an on-curve anchor point which defines the end-point of the curve.
To define a curve the points are defined as pairs of relative coordinates. The control point is specified relative to the current drawing point and the anchor point is specified relative to the control point. Once the line is drawn, the anchor point becomes the current drawing point.
Attributes | |
---|---|
controlX | The x-coordinate of the control point relative to the current drawing point. |
controlY | The y-coordinate of the control point relative to the current drawing point. |
anchorX | The x-coordinate of the anchor point relative to the control point. |
anchorY | The y-coordinate of the anchor point relative to the control point. |
The relative coordinates are specified in twips (where 20 twips = 1 pixel) and must be in the range -65536..65535.
Flash does not directly support Cubic Bezier curves. Converting a Cubic Bezier curve to a Quadratic curve is a non trivial process, however the FSShapeConstructor class in the Transform Utilities framework contains an algorithm to perform the conversion simplifying the create of Shape outlines in Flash from other graphics formats.
The FSCurve class represents the CurvedEdge record from the Macromedia Flash (SWF) File Format Specification. It was introduced in Flash 1.
Constructor Summary | |
---|---|
FSCurve(FSCoder coder)
Construct an FSCurve object, initalizing it with values decoded from an encoded object. |
|
FSCurve(FSCurve obj)
Constructs an FSCurve object by copying values from an existing object. |
|
FSCurve(int cx,
int cy,
int ax,
int ay)
Constructs an FSCurve object specifying the anchor and control point coordinates - specified in twips. |
Method Summary | |
---|---|
void |
appendDescription(java.lang.StringBuffer buffer,
int depth)
AppendDescription is used to present a string description of the object including all nested objects up to a specified depth. |
void |
decode(FSCoder coder)
|
void |
encode(FSCoder coder)
|
boolean |
equals(java.lang.Object anObject)
Returns true if anObject is equal to this one. |
int |
getAnchorX()
Gets the x-coordinate of the anchor point relative to the control point. |
int |
getAnchorY()
Gets the y-coordinate of the anchor point relative to the control point. |
int |
getControlX()
Gets the x-coordinate of the control point relative to the current drawing point. |
int |
getControlY()
Gets the y-coordinate of the control point relative to the current drawing point. |
int |
length(FSCoder coder)
|
void |
setAnchor(int ax,
int ay)
Sets the x and y coordinates of anchor point relative to the control point. |
void |
setAnchorX(int ax)
Sets the x-coordinate of the anchor point relative to the control point. |
void |
setAnchorY(int ay)
Sets the y-coordinate of the anchor point relative to the control point. |
void |
setControl(int cx,
int cy)
Sets the x and y coordinates of control point, relative to the current drawing point. |
void |
setControlX(int cx)
Sets the x-coordinate of the control point relative to the current drawing point. |
void |
setControlY(int cy)
Sets the y-coordinate of the control point relative to the current drawing point. |
void |
setPoints(int cx,
int cy,
int ax,
int ay)
Sets the x and y coordinates of the control and anchor points. |
Methods inherited from class com.flagstone.transform.FSTransformObject |
---|
clone, name, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FSCurve(FSCoder coder)
coder
- an FSCoder containing the binary data.public FSCurve(int cx, int cy, int ax, int ay)
cx
- the x-coordinate of the control point, specified relative to
the current drawing point.cy
- the y-coordinate of the control point, specified relative to
the current drawing point.ax
- the x-coordinate of the anchor point, specified relative to
the control point.ay
- the y-coordinate of the anchor point, specified relative to
the control point.public FSCurve(FSCurve obj)
obj
- an FSCurve object.Method Detail |
---|
public int getControlX()
public int getControlY()
public int getAnchorX()
public int getAnchorY()
public void setControlX(int cx)
cx
- the x-coordinate of the control point.public void setControlY(int cy)
cy
- the y-coordinate of the control point.public void setAnchorX(int ax)
ax
- the x-coordinate of the anchor point.public void setAnchorY(int ay)
ay
- the y-coordinate of the anchor point.public void setControl(int cx, int cy)
cx
- the x-coordinate of the control point.cy
- the y-coordinate of the control point.public void setAnchor(int ax, int ay)
ax
- the x-coordinate of the anchor point.ay
- the y-coordinate of the anchor point.public void setPoints(int cx, int cy, int ax, int ay)
cx
- the x-coordinate of the control point.cy
- the y-coordinate of the control point.ax
- the x-coordinate of the anchor point.ay
- the y-coordinate of the anchor point.public boolean equals(java.lang.Object anObject)
equals
in class FSTransformObject
public void appendDescription(java.lang.StringBuffer buffer, int depth)
FSTransformObject
appendDescription
in class FSTransformObject
buffer
- a StringBuffer to which the description of each object is
appended.depth
- the maximum level of nesting up to which objects will be
displayed.public int length(FSCoder coder)
length
in class FSTransformObject
public void encode(FSCoder coder)
encode
in class FSTransformObject
public void decode(FSCoder coder)
decode
in class FSTransformObject
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |