Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.flagstone.transform
Class FSCurve

    java.lang.Object
      com.flagstone.transform.FSTransformObject
          com.flagstone.transform.FSCurve

All Implemented Interfaces:
  java.lang.Cloneable

    public class FSCurve

extends FSTransformObject

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.

# History

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

### FSCurve

    public FSCurve(FSCoder coder)

  Construct an FSCurve object, initalizing it with values decoded from an encoded object.

  Parameters:
    `coder` - an FSCoder containing the binary data.

### FSCurve

    public FSCurve(int cx,
                   int cy,
                   int ax,
                   int ay)

  Constructs an FSCurve object specifying the anchor and control point coordinates - specified in twips.

  Parameters:
    `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.

### FSCurve

    public FSCurve(FSCurve obj)

  Constructs an FSCurve object by copying values from an existing object.

  Parameters:
    `obj` - an FSCurve object.

Method Detail

### getControlX

    public int getControlX()

  Gets the x-coordinate of the control point relative to the current drawing point.

  Returns:
    the x-coordinate of the control point.

### getControlY

    public int getControlY()

  Gets the y-coordinate of the control point relative to the current drawing point.

  Returns:
    the y-coordinate of the control point.

### getAnchorX

    public int getAnchorX()

  Gets the x-coordinate of the anchor point relative to the control point.

  Returns:
    the x-coordinate of the anchor point.

### getAnchorY

    public int getAnchorY()

  Gets the y-coordinate of the anchor point relative to the control point.

  Returns:
    the y-coordinate of the anchor point.

### setControlX

    public void setControlX(int cx)

  Sets the x-coordinate of the control point relative to the current drawing point.

  Parameters:
    `cx` - the x-coordinate of the control point.

### setControlY

    public void setControlY(int cy)

  Sets the y-coordinate of the control point relative to the current drawing point.

  Parameters:
    `cy` - the y-coordinate of the control point.

### setAnchorX

    public void setAnchorX(int ax)

  Sets the x-coordinate of the anchor point relative to the control point.

  Parameters:
    `ax` - the x-coordinate of the anchor point.

### setAnchorY

    public void setAnchorY(int ay)

  Sets the y-coordinate of the anchor point relative to the control point.

  Parameters:
    `ay` - the y-coordinate of the anchor point.

### setControl

    public void setControl(int cx,
                           int cy)

  Sets the x and y coordinates of control point, relative to the current drawing point.

  Parameters:
    `cx` - the x-coordinate of the control point.
    `cy` - the y-coordinate of the control point.

### setAnchor

    public void setAnchor(int ax,
                          int ay)

  Sets the x and y coordinates of anchor point relative to the control point.

  Parameters:
    `ax` - the x-coordinate of the anchor point.
    `ay` - the y-coordinate of the anchor point.

### setPoints

    public void setPoints(int cx,
                          int cy,
                          int ax,
                          int ay)

  Sets the x and y coordinates of the control and anchor points.

  Parameters:
    `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.

### equals

    public boolean equals(java.lang.Object anObject)

  Returns true if anObject is equal to this one. Objects are considered equal if they would generate identical binary data when they are encoded to a Flash file.

  Overrides:
    `equals` in class `FSTransformObject`
  Returns:
    true if this object would be identical to anObject when encoded.

### appendDescription

    public void appendDescription(java.lang.StringBuffer buffer,
                                  int depth)

  Description copied from class: `FSTransformObject`
  AppendDescription is used to present a string description of the object including all nested objects up to a specified depth. This method provide a more controlled way of creating a string representation of an object since large objects such as font or shape definitions can contain dozens of nested objects. The representation of the object is appended to the StringBuffer, showing the name of the class and values of the attributes it contains. If the object contains any attributes that are objects then the object graph will be traversed up to the specified depth. If objects are nested at a level less than specified depth then the full string representation of the object is displayed. For objects at the specified depth only the name of the class is displayed. Any objects below this depth are not displayed.

  Specified by:
    `appendDescription` in class `FSTransformObject`
  Parameters:
    `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.

### length

    public int length(FSCoder coder)

  Specified by:
    `length` in class `FSTransformObject`

### encode

    public void encode(FSCoder coder)

  Specified by:
    `encode` in class `FSTransformObject`

### decode

    public void decode(FSCoder coder)

  Specified by:
    `decode` in class `FSTransformObject`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD