com.flagstone.transform
Class FSMorphBitmapFill

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

public class FSMorphBitmapFill
extends FSFillStyle

FSMorphBitmapFill uses a bitmap image to fill an area of a morphing shape.

Two types of bitmap fill are supported:

Attributes
type The type of bitmap fill, either FSFillStyle.Tiled or FSFillStyle.Clipped.
identifier The identifier of the image that will be displayed.
start An optional FSCoordTransform object that will be applied to the image, to change its origin, orientation, etc., at the start of the morphing process.
end An optional FSCoordTransform object that will be applied to the image, to change its origin, orientation, etc., at the end of the morphing process.

The bitmap is referenced using the identifier obtains from an instance of an FSDefineJPEGImage, FSDefineJPEGImage2, FSDefineJPEGImage3, FSDefineImage or FSDefineImage2 object. Only one image can be displayed throughout the morphing process.

When an image is loaded its width and height default to twips rather than pixels. An image 300 x 200 pixels will be displayed as 300 x 200 twips (15 x 10 pixels). Scaling the image by 20 (20 twips = 1 pixel) would restore it to its original size. The FSCoordTransform attribute in the FSBitmapFill object can be used to scale the image to its original size.

The image is drawn with the top left corner at the origin of the shape being filled so the scaling transform must be composited with the translation transform that places the image at the desired location within the shape.

History

The FSMorphBitmapFill class represents the MorphFillStyle structure from the Macromedia Flash (SWF) File Format Specification. Shape morphing was introduced in Flash 3.


Field Summary
 
Fields inherited from class com.flagstone.transform.FSFillStyle
Clipped, Linear, Radial, Solid, Tiled, type, Unsmoothed_Clipped, Unsmoothed_Tiled
 
Constructor Summary
FSMorphBitmapFill(FSCoder coder)
          Construct an FSMorphBitmapFill object an initialise it with values decoded from an encoded FSMorphBitmapFill object.
FSMorphBitmapFill(FSMorphBitmapFill obj)
          Construct an FSMorphBitmapFill object by copying an existing object.
FSMorphBitmapFill(int aType, int anIdentifier, FSCoordTransform aStartTransform, FSCoordTransform anEndTransform)
          Constructs an FSMorphBitmapFill specifying the type, bitmap image and coordinated transforms for the image at the start and end of the morphing process.
 
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.
 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.
 FSCoordTransform getEndTransform()
          Gets the ending coordinate transform for the image.
 int getIdentifier()
          Gets the identifier of the bitmap image.
 FSCoordTransform getStartTransform()
          Gets the starting coordinate transform for the image.
 int length(FSCoder coder)
           
 void setEndTransform(FSCoordTransform aTransform)
          Sets the coordinate transform for the image at the end of the morphing process.
 void setIdentifier(int anIdentifier)
          Sets the identifier of the bitmap image to be used in the morphing process.
 void setStartTransform(FSCoordTransform aTransform)
          Sets the coordinate transform for the image at the start of the morphing process.
 
Methods inherited from class com.flagstone.transform.FSFillStyle
getType, setType
 
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

FSMorphBitmapFill

public FSMorphBitmapFill(FSCoder coder)
Construct an FSMorphBitmapFill object an initialise it with values decoded from an encoded FSMorphBitmapFill object.

Parameters:
coder - an FSCoder object containing an FSMorphBitmapFill encoded as binary data.

FSMorphBitmapFill

public FSMorphBitmapFill(int aType,
                         int anIdentifier,
                         FSCoordTransform aStartTransform,
                         FSCoordTransform anEndTransform)
Constructs an FSMorphBitmapFill specifying the type, bitmap image and coordinated transforms for the image at the start and end of the morphing process.

Parameters:
aType - the type of fill either FSFillStyle.Tiled or FSFillStyle.Clipped.
anIdentifier - the identifier for the bitmap image.
aStartTransform - the transform applied to the image at the start of the morphing process.
anEndTransform - the transform applied to the image at the end of the morphing process.

FSMorphBitmapFill

public FSMorphBitmapFill(FSMorphBitmapFill obj)
Construct an FSMorphBitmapFill object by copying an existing object.

Parameters:
obj - an FSMorphBitmapFill object.
Method Detail

getIdentifier

public int getIdentifier()
Gets the identifier of the bitmap image.

Returns:
the image's identifier.

getStartTransform

public FSCoordTransform getStartTransform()
Gets the starting coordinate transform for the image.

Returns:
the starting coordinate transform.

getEndTransform

public FSCoordTransform getEndTransform()
Gets the ending coordinate transform for the image.

Returns:
the ending coordinate transform.

setIdentifier

public void setIdentifier(int anIdentifier)
Sets the identifier of the bitmap image to be used in the morphing process.

Parameters:
anIdentifier - the identifier of the bitmap image.

setStartTransform

public void setStartTransform(FSCoordTransform aTransform)
Sets the coordinate transform for the image at the start of the morphing process.

Parameters:
aTransform - the starting coordinate transform.

setEndTransform

public void setEndTransform(FSCoordTransform aTransform)
Sets the coordinate transform for the image at the end of the morphing process.

Parameters:
aTransform - the ending coordinate transform.

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

encode

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

decode

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