com.flagstone.transform
Class FSLine

java.lang.Object
  extended by com.flagstone.transform.FSTransformObject
      extended by com.flagstone.transform.FSLine
All Implemented Interfaces:
java.lang.Cloneable

public class FSLine
extends FSTransformObject

FSLine defines a straight line. The line is drawn from the current drawing point to the end point specified in the FSLine object which is specified relative to the current drawing point. Once the line is drawn, the end of the line is now the current drawing point.

Attributes
x The x-coordinate of the end point of the line, relative to the current drawing point.
y The y-coordinate of the end point of the line, relative to the current drawing point.

The relative coordinates are specified in twips (where 20 twips = 1 pixel) and must be in the range -65536..65535.

Lines are drawn with rounded corners and line ends. Different join and line end styles can be created by drawing line segments as a sequence of filled shapes. With 1 twip equal to 1/20th of a pixel this technique can easily be used to draw the narrowest of visible lines.

History

The FSLine class represents the StraightEdge record from the Macromedia Flash (SWF) File Format Specification. It was introduced in Flash 1.


Constructor Summary
FSLine(FSCoder coder)
          Construct an FSLine object and initialise it with the values decoded from an encoded line.
FSLine(FSLine obj)
          Construct an FSCoordTransform object by copying an existing object.
FSLine(int xValue, int yValue)
          Constructs an FSLine with the specified relative coordinates.
 
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 getX()
          Gets the relative x-coordinate.
 int getY()
          Gets the relative y-coordinate.
 int length(FSCoder coder)
           
 void setPoint(int xValue, int yValue)
          Sets the relative x and y coordinates.
 void setX(int aNumber)
          Sets the relative x-coordinate.
 void setY(int aNumber)
          Sets the relative y-coordinate.
 
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

FSLine

public FSLine(FSCoder coder)
Construct an FSLine object and initialise it with the values decoded from an encoded line.

Parameters:
coder - an FSCoder object containing the encoded colour transform.

FSLine

public FSLine(int xValue,
              int yValue)
Constructs an FSLine with the specified relative coordinates.

Parameters:
xValue - the x-coordinate of the end point, specified relative to the current drawing point.
yValue - the y-coordinate of the end point, specified relative to the current drawing point.

FSLine

public FSLine(FSLine obj)
Construct an FSCoordTransform object by copying an existing object.

Method Detail

getX

public int getX()
Gets the relative x-coordinate.

Returns:
the x-coordinate of the end point.

getY

public int getY()
Gets the relative y-coordinate.

Returns:
the y-coordinate of the end point.

setX

public void setX(int aNumber)
Sets the relative x-coordinate.

Parameters:
aNumber - the x-coordinate of the end point.

setY

public void setY(int aNumber)
Sets the relative y-coordinate.

Parameters:
aNumber - the y-coordinate of the end point.

setPoint

public void setPoint(int xValue,
                     int yValue)
Sets the relative x and y coordinates.

Parameters:
xValue - the x-coordinate of the end point.
yValue - the y-coordinate of the end 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