com.flagstone.transform.shape
Class ShapeStyle2

java.lang.Object
  extended by com.flagstone.transform.shape.ShapeStyle2
All Implemented Interfaces:
Copyable<ShapeRecord>, SWFEncodeable, ShapeRecord

public final class ShapeStyle2
extends Object
implements ShapeRecord

ShapeStyle2 extends the functionality of ShapeStyle by supporting lines drawn with the LineStyle2 object.


Constructor Summary
ShapeStyle2()
          Creates an uninitialised ShapeStyle object.
ShapeStyle2(int flags, SWFDecoder coder, Context context)
          Creates and initialises a ShapeStyle object using values encoded in the Flash binary format.
ShapeStyle2(ShapeStyle2 object)
          Creates and initialises a ShapeStyle object using the values copied from another ShapeStyle object.
 
Method Summary
 ShapeStyle2 add(FillStyle style)
          Add the fill style object to the list of fill styles.
 ShapeStyle2 add(LineStyle2 style)
          Add a LineStyle object to the list of line styles.
 ShapeStyle2 copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 Integer getAltFillStyle()
          Get the index of the fill style that will be applied to any overlapping area filled.
 Integer getFillStyle()
          Get the index of the fill style that will be applied to any area filled.
 List<FillStyle> getFillStyles()
          Returns the list of new fill styles.
 Integer getLineStyle()
          Get the index of the line style that will be applied to any line drawn.
 List<LineStyle2> getLineStyles()
          Get the list of new line styles.
 Integer getMoveX()
          Get the x-coordinate of any relative move or null if no move is specified.
 Integer getMoveY()
          Get the y-coordinate of any relative move or null if no move is specified.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 ShapeStyle2 setAltFillStyle(Integer anIndex)
          Sets the index of the fill style that will be applied to any overlapping area filled.
 ShapeStyle2 setFillStyle(Integer anIndex)
          Sets the index of the fill style that will be applied to any area filled.
 ShapeStyle2 setFillStyles(List<FillStyle> list)
          Sets the list of new fill styles.
 ShapeStyle2 setLineStyle(Integer anIndex)
          Sets the index of the line style that will be applied to any line drawn.
 ShapeStyle2 setLineStyles(List<LineStyle2> list)
          Sets the list of new line styles.
 ShapeStyle2 setMove(Integer xCoord, Integer yCoord)
          Sets the coordinates of any relative move.
 ShapeStyle2 setMoveX(Integer coord)
          Sets the x-coordinate of any relative move.
 ShapeStyle2 setMoveY(Integer coord)
          Sets the x-coordinate of any relative move.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ShapeStyle2

public ShapeStyle2(int flags,
                   SWFDecoder coder,
                   Context context)
            throws IOException
Creates and initialises a ShapeStyle object using values encoded in the Flash binary format.

Parameters:
flags - contains fields identifying which fields are optionally encoded in the data - decoded by parent object.
coder - an SWFDecoder object that contains the encoded Flash data.
context - a Context object used to manage the decoders for different type of object and to pass information on how objects are decoded.
Throws:
IOException - if an error occurs while decoding the data.

ShapeStyle2

public ShapeStyle2()
Creates an uninitialised ShapeStyle object.


ShapeStyle2

public ShapeStyle2(ShapeStyle2 object)
Creates and initialises a ShapeStyle object using the values copied from another ShapeStyle object.

Parameters:
object - a ShapeStyle object from which the values will be copied.
Method Detail

add

public ShapeStyle2 add(LineStyle2 style)
Add a LineStyle object to the list of line styles.

Parameters:
style - and LineStyle object. Must not be null.
Returns:
this object.

add

public ShapeStyle2 add(FillStyle style)
Add the fill style object to the list of fill styles.

Parameters:
style - and FillStyle object. Must not be null.
Returns:
this object.

getMoveX

public Integer getMoveX()
Get the x-coordinate of any relative move or null if no move is specified.

Returns:
the relative move in the x direction.

getMoveY

public Integer getMoveY()
Get the y-coordinate of any relative move or null if no move is specified.

Returns:
the relative move in the y direction.

getLineStyle

public Integer getLineStyle()
Get the index of the line style that will be applied to any line drawn. Returns null if no line style is defined.

Returns:
the selected line style.

getFillStyle

public Integer getFillStyle()
Get the index of the fill style that will be applied to any area filled. Returns null if no fill style is defined.

Returns:
the selected fill style.

getAltFillStyle

public Integer getAltFillStyle()
Get the index of the fill style that will be applied to any overlapping area filled. Returns null if no alternate fill style is defined.

Returns:
the selected alternate fill style.

getLineStyles

public List<LineStyle2> getLineStyles()
Get the list of new line styles.

Returns:
the list of line styles.

getFillStyles

public List<FillStyle> getFillStyles()
Returns the list of new fill styles.

Returns:
the list of fill styles.

setMoveX

public ShapeStyle2 setMoveX(Integer coord)
Sets the x-coordinate of any relative move.

Parameters:
coord - move the current point by aNumber in the x direction. Must be in the range -65535..65535.
Returns:
this object.

setMoveY

public ShapeStyle2 setMoveY(Integer coord)
Sets the x-coordinate of any relative move.

Parameters:
coord - move the current point by aNumber in the x direction. Must be in the range -65535..65535.
Returns:
this object.

setMove

public ShapeStyle2 setMove(Integer xCoord,
                           Integer yCoord)
Sets the coordinates of any relative move.

Parameters:
xCoord - move the current point by aNumber in the x direction. Must be in the range -65535..65535.
yCoord - move the current point by aNumber in the y direction. Must be in the range -65535..65535.
Returns:
this object.

setFillStyle

public ShapeStyle2 setFillStyle(Integer anIndex)
Sets the index of the fill style that will be applied to any area filled. May be set to zero if no style is selected or null if the line style remains unchanged.

Parameters:
anIndex - selects the fill style at anIndex in the fill styles list of the parent Shape object.
Returns:
this object.

setAltFillStyle

public ShapeStyle2 setAltFillStyle(Integer anIndex)
Sets the index of the fill style that will be applied to any overlapping area filled. May be set to zero if no style is selected or null if the ~ line style remains unchanged.

Parameters:
anIndex - selects the alternate fill style at anIndex in the fill styles list of the parent Shape object.
Returns:
this object.

setLineStyle

public ShapeStyle2 setLineStyle(Integer anIndex)
Sets the index of the line style that will be applied to any line drawn. May be set to zero if no style is selected or null if the line style remains unchanged.

Parameters:
anIndex - selects the line style at anIndex in the line styles list of the parent Shape object.
Returns:
this object.

setLineStyles

public ShapeStyle2 setLineStyles(List<LineStyle2> list)
Sets the list of new line styles. May be set to null if no styles are being defined.

Parameters:
list - a list of LineStyle objects. Must not be null.
Returns:
this object.

setFillStyles

public ShapeStyle2 setFillStyles(List<FillStyle> list)
Sets the list of new fill styles. May be set to null if no styles are being defined.

Parameters:
list - a list of fill style objects. Must not be null.
Returns:
this object.

copy

public ShapeStyle2 copy()
Creates a complete copy of this object.

Specified by:
copy in interface Copyable<ShapeRecord>
Returns:
a deep-copy of this object. New instances of mutable objects are copied and immutable instances are shared.

toString

public String toString()
Overrides:
toString in class Object

prepareToEncode

public int prepareToEncode(Context context)
Prepare an object for encoding, returning the expected size of an object when it is encoded. This method also used to initialise variables, such as offsets and flags that will be used when the object is encoded. Generally the method returns the size in bytes, however when called on objects that use bit fields such as shapes the methods will return the size in bits.

Specified by:
prepareToEncode in interface SWFEncodeable
Parameters:
context - an Context that allows information to be passed between objects to control how they are initialised for encoding.
Returns:
the size of the object when it is encoded.

encode

public void encode(SWFEncoder coder,
                   Context context)
            throws IOException
Encode an object to the Flash binary format.

Specified by:
encode in interface SWFEncodeable
Parameters:
coder - an SWFEncoder object.
context - an Context that allows information to be passed between objects to control how they are initialised for encoding.
Throws:
IOException - if an error occurs while encoding the object.


Copyright © 2002-2010 Flagstone Software Ltd.. All Rights Reserved.