com.flagstone.transform.shape
Class DefineShape4

java.lang.Object
  extended by com.flagstone.transform.shape.DefineShape4
All Implemented Interfaces:
Copyable<MovieTag>, SWFEncodeable, DefineTag, MovieTag, ShapeTag

public final class DefineShape4
extends Object
implements ShapeTag

DefineShape4 extends DefienShape3 by specifying the bounding box for the edges of the shape (the outline without taking the stroke thickness into account) as well as hints for improving the way shapes are drawn.


Constructor Summary
DefineShape4(DefineShape4 object)
          Creates and initialises a DefineShape4 object using the values copied from another DefineShape4 object.
DefineShape4(int uid, Bounds rect, Bounds edges, List<FillStyle> fills, List<LineStyle> lines, Shape aShape)
          Creates a DefineShape3 object.
DefineShape4(SWFDecoder coder, Context context)
          Creates and initialises a DefineShape4 object using values encoded in the Flash binary format.
 
Method Summary
 DefineShape4 add(FillStyle style)
          Add the fill style to the list of fill styles.
 DefineShape4 add(LineStyle style)
          Add a LineStyle to the list of line styles.
 DefineShape4 copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 Bounds getBounds()
          Get the bounding rectangle that completely enclosed the shape.
 Bounds getEdgeBounds()
          Get the bounding rectangle that covers the outline of the shape.
 List<FillStyle> getFillStyles()
          Get the list fill styles.
 int getIdentifier()
          Get the unique identifier assigned to this object.
 List<LineStyle> getLineStyles()
          Get the list line styles.
 Shape getShape()
          Get the shape.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 void setBounds(Bounds rect)
          Sets the bounding rectangle that encloses the shape.
 void setEdgeBounds(Bounds rect)
          Sets the bounding rectangle that encloses the outline of the shape, excluding the width of any lines drawn.
 void setFillStyles(List<FillStyle> list)
          Sets the list fill styles that will be used to draw the shape.
 void setIdentifier(int uid)
          Sets the unique identifier for an object within a given Movie.
 void setLineStyles(List<LineStyle> list)
          Sets the list of styles that will be used to draw the outline of the shape.
 void setShape(Shape aShape)
          Sets the shape.
 void setWinding(boolean use)
          Indicates whether the shape uses fill winding.
 String toString()
           
 boolean useWinding()
          Does the shape use fill winding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefineShape4

public DefineShape4(SWFDecoder coder,
                    Context context)
             throws IOException
Creates and initialises a DefineShape4 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.

DefineShape4

public DefineShape4(int uid,
                    Bounds rect,
                    Bounds edges,
                    List<FillStyle> fills,
                    List<LineStyle> lines,
                    Shape aShape)
Creates a DefineShape3 object.

Parameters:
uid - the unique identifier for the shape in the range 1..65535.
rect - the bounding rectangle for the shape including the width of the border lines. Must not be null.
edges - the bounding rectangle for the shape excluding the line used to draw the border. Must not be null.
fills - the list of fill styles used in the shape. Must not be null.
lines - the list of line styles used in the shape. Must not be null.
aShape - the shape to be drawn. Must not be null.

DefineShape4

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

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

getIdentifier

public int getIdentifier()
Get the unique identifier assigned to this object.

Specified by:
getIdentifier in interface DefineTag
Returns:
the unique identifier used by the Flash Player to reference this definition.

setIdentifier

public void setIdentifier(int uid)
Sets the unique identifier for an object within a given Movie.

Specified by:
setIdentifier in interface DefineTag
Parameters:
uid - a unique identifier for the object. Must be in the range 1..65535.

getBounds

public Bounds getBounds()
Get the bounding rectangle that completely enclosed the shape.

Specified by:
getBounds in interface ShapeTag
Returns:
the Bounds that encloses the shape

setBounds

public void setBounds(Bounds rect)
Sets the bounding rectangle that encloses the shape.

Specified by:
setBounds in interface ShapeTag
Parameters:
rect - set the bounding rectangle for the shape. Must not be null.

getEdgeBounds

public Bounds getEdgeBounds()
Get the bounding rectangle that covers the outline of the shape.

Returns:
the Bounds that encloses the shape outline, excluding any lines drawn.

setEdgeBounds

public void setEdgeBounds(Bounds rect)
Sets the bounding rectangle that encloses the outline of the shape, excluding the width of any lines drawn.

Parameters:
rect - set the bounding rectangle for the shape. Must not be null.

add

public DefineShape4 add(LineStyle style)
Add a LineStyle to the list of line styles.

Specified by:
add in interface ShapeTag
Parameters:
style - a LineStyle2 object. Must not be null or an instance of LineStyle1.
Returns:
this object.

add

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

Specified by:
add in interface ShapeTag
Parameters:
style - and FillStyle object. Must not be null.
Returns:
this object.

getFillStyles

public List<FillStyle> getFillStyles()
Get the list fill styles.

Specified by:
getFillStyles in interface ShapeTag
Returns:
the list of fill styles used in the shape.

getLineStyles

public List<LineStyle> getLineStyles()
Get the list line styles.

Specified by:
getLineStyles in interface ShapeTag
Returns:
the list of line styles used in the shape.

getShape

public Shape getShape()
Get the shape.

Specified by:
getShape in interface ShapeTag
Returns:
the shape.

setFillStyles

public void setFillStyles(List<FillStyle> list)
Sets the list fill styles that will be used to draw the shape.

Specified by:
setFillStyles in interface ShapeTag
Parameters:
list - set the fill styles for the shape. Must not be null.

setLineStyles

public void setLineStyles(List<LineStyle> list)
Sets the list of styles that will be used to draw the outline of the shape.

Specified by:
setLineStyles in interface ShapeTag
Parameters:
list - set the line styles for the shape. Must not be null.

setShape

public void setShape(Shape aShape)
Sets the shape.

Specified by:
setShape in interface ShapeTag
Parameters:
aShape - set the shape to be drawn. Must not be null.

useWinding

public boolean useWinding()
Does the shape use fill winding.

Returns:
true if fill winding is used, false otherwise.

setWinding

public void setWinding(boolean use)
Indicates whether the shape uses fill winding.

Parameters:
use - true if fill winding is used, false otherwise.

copy

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

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