com.flagstone.transform
Class FSDefineShape3

java.lang.Object
  extended by com.flagstone.transform.FSTransformObject
      extended by com.flagstone.transform.FSMovieObject
          extended by com.flagstone.transform.FSDefineObject
              extended by com.flagstone.transform.FSDefineShape3
All Implemented Interfaces:
java.lang.Cloneable

public class FSDefineShape3
extends FSDefineObject

FSDefineShape3 defines a transparent shape to be displayed.

It extends the functionality of the FSDefineShape2 class by supporting transparent colours.

Attributes
type Identifies the data structure when it is encoded. Read-only.
identifier An unique identifier for this object, in the range 1..65535.
bounds The bounding area inside which the shape is drawn.
fillStyles An array of fill styles used to fill the area enclosed by the shape.
lineStyles An array of line styles used to draw the outline of the shape.
shape An FSShape object containing the shape records (FSLine, FSCurve and FSShapeStyle objects) that describe how the shape is drawn and filled shape.

The shape defines a path containing a mix of straight and curved edges and pen move actions. A path need not be contiguous. When the shape is drawn the FSShapeStyle object selects the line and fill styles, from the respective array, to be used. FSShapeStyle objects can be defined in the shape at any time to change the styles being used. The fill style used can either be an area of pure colour, a bitmap image or a gradient. The line style specifies the colour and thickness of the line drawn around the shape outline. For both line and fill styles the selected style may be undefined, allowing the shape to be drawn without an outline or left unfilled.

Examples

This example creates a simple rectangle, 200 twips wide and 100 twips high, drawing using a black outline 1 twip wide and filled with a transparent red colour. The origin of the shape is at the bottom left corner of the rectangle.

 // Create the bounding rectangle for the shape. The values also specify
 // the coordinate range of the shape.
 
 FSBounds bounds = new FSBounds(0, 0, 200, 100);
 
 // Define the styles for the shape.
 
 ArrayList fillStyles = new ArrayList();
 ArrayList lineStyles = new ArrayList();
 
 fillStyles.add(new FSSolidFill(new FSColor(255, 0, 0, 128)));
 
 lineStyles.add(new FSSolidLine(1, new FSColor(0, 0, 0, 128)));
 
 // Draw the shape.
 
 FSShape shape = new FSShape();
 
 // Define the line, fill styles and move to the shape's origin.
 
 shape.add(new FSShapeStyle(1, 1, 0, 0, 0));
 shape.add(new FSLine(200, 0));
 shape.add(new FSLine(0, 100));
 shape.add(new FSLine(-200, 0));
 shape.add(new FSLine(0, -100));
 
 FSDefineShape3 shape = new FSDefineShape3(movie.newIdentifier(), bounds,
                                fillStyles, lineStyles, shape);
 

History

The FSDefineShape3 class represents the DefineShape3 tag from the Macromedia Flash (SWF) File Format Specification. It was introduced in Flash 3.


Field Summary
 
Fields inherited from class com.flagstone.transform.FSDefineObject
identifier
 
Fields inherited from class com.flagstone.transform.FSMovieObject
ButtonColorTransform, ButtonSound, DefineBitsPtr, DefineButton, DefineButton2, DefineFont, DefineFont2, DefineImage, DefineImage2, DefineJPEGImage, DefineJPEGImage2, DefineJPEGImage3, DefineMorphShape, DefineMovieClip, DefineShape, DefineShape2, DefineShape3, DefineSound, DefineText, DefineText2, DefineTextField, DefineVideo, DoAction, EnableDebugger, EnableDebugger2, Export, extendLength, FontInfo, FontInfo2, FrameLabel, Free, Import, Initialize, JPEGTables, length, LimitScript, PathsArePostscript, PlaceObject, PlaceObject2, Protect, QuicktimeMovie, RemoveObject, RemoveObject2, SerialNumber, SetBackgroundColor, ShowFrame, SoundStreamBlock, SoundStreamHead, SoundStreamHead2, StartSound, TabOrder, type, VideoFrame
 
Constructor Summary
FSDefineShape3(FSCoder coder)
          Construct an FSDefineShape3 object, initialising it with values decoded from an encoded object.
FSDefineShape3(FSDefineShape3 obj)
          Constructs an FSDefineShape object by copying values from an existing object.
FSDefineShape3(int anIdentifier, FSBounds aBounds, java.util.ArrayList fillStyleArray, java.util.ArrayList lineStyleArray, FSShape aShape)
          Constructs an FSDefineShape3 object.
 
Method Summary
 void add(FSFillStyle aFillStyle)
          Add the fill style object to the array of fill styles.
 void add(FSLineStyle aLineStyle)
          Add a FSSolidLine object to the array of line styles.
 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.
 java.lang.Object clone()
          Creates a deep copy of the entire object.
 void decode(FSCoder coder)
           
 void encode(FSCoder coder)
           
 boolean equals(java.lang.Object anObject)
          Returns true if anObject is equal to this one.
 FSBounds getBounds()
          Gets the bounding rectangle for the shape.
 java.util.ArrayList getFillStyles()
          Gets the array fill styles.
 java.util.ArrayList getLineStyles()
          Gets the array line styles.
 FSShape getShape()
          Gets the shape.
 int length(FSCoder coder)
           
 void setBounds(FSBounds aBounds)
          Sets the bounding rectangle.
 void setFillStyles(java.util.ArrayList anArray)
          Sets the fill styles.
 void setLineStyles(java.util.ArrayList anArray)
          Sets the line styles.
 void setShape(FSShape aShape)
          Sets the shape.
 
Methods inherited from class com.flagstone.transform.FSDefineObject
getIdentifier, setIdentifier
 
Methods inherited from class com.flagstone.transform.FSMovieObject
getType
 
Methods inherited from class com.flagstone.transform.FSTransformObject
name, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FSDefineShape3

public FSDefineShape3(FSCoder coder)
Construct an FSDefineShape3 object, initialising it with values decoded from an encoded object.

Parameters:
coder - an FSCoder containing the binary data.

FSDefineShape3

public FSDefineShape3(int anIdentifier,
                      FSBounds aBounds,
                      java.util.ArrayList fillStyleArray,
                      java.util.ArrayList lineStyleArray,
                      FSShape aShape)
Constructs an FSDefineShape3 object.

Parameters:
anIdentifier - the unique identifier for the shape.
aBounds - the bounding rectangle for the shape.
fillStyleArray - the array of fill styles used in the shape.
lineStyleArray - the array of line styles used in the shape.
aShape - the shape to be drawn.

FSDefineShape3

public FSDefineShape3(FSDefineShape3 obj)
Constructs an FSDefineShape object by copying values from an existing object.

Parameters:
obj - an FSDefineShape object.
Method Detail

add

public void add(FSLineStyle aLineStyle)
Add a FSSolidLine object to the array of line styles.

Parameters:
aLineStyle - and FSSolidLine object.

add

public void add(FSFillStyle aFillStyle)
Add the fill style object to the array of fill styles.

Parameters:
aFillStyle - and FSFillStyle object.

getBounds

public FSBounds getBounds()
Gets the bounding rectangle for the shape.

Returns:
the bounding rectangle for the shape.

getFillStyles

public java.util.ArrayList getFillStyles()
Gets the array fill styles.

Returns:
the fill styles used in the shape.

getLineStyles

public java.util.ArrayList getLineStyles()
Gets the array line styles.

Returns:
the line styles used in the shape.

getShape

public FSShape getShape()
Gets the shape.

Returns:
the shape to be drawn.

setBounds

public void setBounds(FSBounds aBounds)
Sets the bounding rectangle.

Parameters:
aBounds - set the bounding rectangle for the shape.

setFillStyles

public void setFillStyles(java.util.ArrayList anArray)
Sets the fill styles.

Parameters:
anArray - set the fill styles for the shape.

setLineStyles

public void setLineStyles(java.util.ArrayList anArray)
Sets the line styles.

Parameters:
anArray - set the line styles for the shape.

setShape

public void setShape(FSShape aShape)
Sets the shape.

Parameters:
aShape - set the shape to be drawn.

clone

public java.lang.Object clone()
Description copied from class: FSTransformObject
Creates a deep copy of the entire object.

Overrides:
clone in class FSTransformObject
Returns:
a copy of the object.

equals

public boolean equals(java.lang.Object anObject)
Description copied from class: FSMovieObject
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 FSMovieObject
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.

Overrides:
appendDescription in class FSDefineObject
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)
Overrides:
length in class FSDefineObject

encode

public void encode(FSCoder coder)
Overrides:
encode in class FSDefineObject

decode

public void decode(FSCoder coder)
Overrides:
decode in class FSDefineObject