com.flagstone.transform.linestyle
Class MorphLineStyle

java.lang.Object
  extended by com.flagstone.transform.linestyle.MorphLineStyle
All Implemented Interfaces:
Copyable<LineStyle>, SWFEncodeable, LineStyle

public final class MorphLineStyle
extends Object
implements LineStyle

MorphLineStyle defines the width and colour of a line drawn for a shape is it is morphed.

MorphLineStyle specifies the width and colour of the line at the start and end of the morphing process. The transparency value for the colour should also be specified. The Flash Player performs the interpolation as the shape is morphed.


Constructor Summary
MorphLineStyle(int initialWidth, int finalWidth, Color initialColor, Color finalColor)
          Creates a MorphLineStyle object specifying the starting and ending widths and colours.
MorphLineStyle(MorphLineStyle object)
          Creates and initialises a MorphLineStyle object using the values copied from another MorphLineStyle object.
MorphLineStyle(SWFDecoder coder, Context context)
          Creates and initialises a MorphLineStyle object using values encoded in the Flash binary format.
 
Method Summary
 MorphLineStyle copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 Color getEndColor()
          Returns the colour of the line at the end of the morphing process.
 int getEndWidth()
          Get the width of the line at the end of the morphing process.
 Color getStartColor()
          Get the colour of the line at the start of the morphing process.
 int getStartWidth()
          Get the width of the line at the start of the morphing process.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 void setEndColor(Color aColor)
          Sets the colour of the line at the end of the morphing process.
 void setEndWidth(int aNumber)
          Sets the width of the line at the end of the morphing process.
 void setStartColor(Color aColor)
          Returns the colour of the line at the start of the morphing process.
 void setStartWidth(int aNumber)
          Sets the width of the line at the start of the morphing process.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MorphLineStyle

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

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

MorphLineStyle

public MorphLineStyle(int initialWidth,
                      int finalWidth,
                      Color initialColor,
                      Color finalColor)
Creates a MorphLineStyle object specifying the starting and ending widths and colours.

Parameters:
initialWidth - the width of the line at the start of the morphing process.
finalWidth - the width of the line at the end of the morphing process.
initialColor - the colour of the line at the start of the morphing process.
finalColor - the colour of the line at the end of the morphing process.

MorphLineStyle

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

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

getStartWidth

public int getStartWidth()
Get the width of the line at the start of the morphing process.

Returns:
the starting stroke width.

getEndWidth

public int getEndWidth()
Get the width of the line at the end of the morphing process.

Returns:
the final stroke width.

getStartColor

public Color getStartColor()
Get the colour of the line at the start of the morphing process.

Returns:
the starting stroke colour.

getEndColor

public Color getEndColor()
Returns the colour of the line at the end of the morphing process.

Returns:
the final stroke colour.

setStartWidth

public void setStartWidth(int aNumber)
Sets the width of the line at the start of the morphing process.

Parameters:
aNumber - the starting width of the line. Must be in the range 0..65535.

setEndWidth

public void setEndWidth(int aNumber)
Sets the width of the line at the end of the morphing process.

Parameters:
aNumber - the ending width of the line. Must be in the range 0..65535.

setStartColor

public void setStartColor(Color aColor)
Returns the colour of the line at the start of the morphing process.

Parameters:
aColor - the starting colour of the line. Must not be null.

setEndColor

public void setEndColor(Color aColor)
Sets the colour of the line at the end of the morphing process.

Parameters:
aColor - the ending colour of the line. Must not be null.

copy

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

Specified by:
copy in interface Copyable<LineStyle>
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.