|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.flagstone.transform.fillstyle.BitmapFill
public final class BitmapFill
BitmapFill is used to display an image inside a shape. An image cannot be displayed directly, it must be displayed inside of a shape using this style. The style controls how the image is displayed inside the shape. Images may be clipped if they are too large to fit or tiled across the available area if they are too small. A coordinate transform can also be used to change its size, location relative to the origin of the shape, orientation, etc., when it is displayed. Four types of bitmap fill are supported:
The most common use of the coordinate transform is to scale an image so it displayed at the correct resolution. 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) using the CoordTransform object will restore it to its original size.
The coordinate transform is also used to control the image registration. An image is drawn with the top left corner placed at the origin (0, 0) of the shape being filled. The transform can be used to apply different translations to the image so its position can be adjusted relative to the origin of the enclosing shape.
Constructor Summary | |
---|---|
BitmapFill(BitmapFill object)
Creates and initialises a BitmapFill fill style using the values copied from another BitmapFill object. |
|
BitmapFill(boolean tiled,
boolean smoothed,
int uid,
CoordTransform position)
Creates a BitmapFill object, setting the fill type, the unique identifier for the image and the coordinate transform used to set the scale and registration of the image. |
|
BitmapFill(int fillType,
SWFDecoder coder)
Creates and initialises a BitmapFill fill style using values encoded in the Flash binary format. |
Method Summary | |
---|---|
BitmapFill |
copy()
Creates a complete copy of this object. |
void |
encode(SWFEncoder coder,
Context context)
Encode an object to the Flash binary format. |
int |
getIdentifier()
Get the unique identifier of the object containing the image to be displayed. |
CoordTransform |
getTransform()
Get the coordinate transform that will be applied to the image when it is displayed. |
boolean |
isSmoothed()
Is the image smoothed to increase quality. |
boolean |
isTiled()
Is the image tiled across the area defined in the shape. |
int |
prepareToEncode(Context context)
Prepare an object for encoding, returning the expected size of an object when it is encoded. |
void |
setIdentifier(int uid)
Sets the unique identifier of the object containing the image to be displayed. |
void |
setSmoothed(boolean smoothed)
Sets whether the image smoothed when it is displayed. |
void |
setTiled(boolean tiled)
Sets whether the image tiled across the area defined in the shape. |
void |
setTransform(CoordTransform matrix)
Sets the coordinate transform applied to the image to display it inside the shape. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BitmapFill(int fillType, SWFDecoder coder) throws IOException
fillType
- the value used to identify the fill style when it is
encoded.coder
- an SWFDecoder object that contains the encoded Flash data.
IOException
- if an error occurs while decoding the data.public BitmapFill(boolean tiled, boolean smoothed, int uid, CoordTransform position)
tiled
- whether the image will be repeated if it smaller than the area
to be filled.smoothed
- whether the image will be smoothed to improve display quality.uid
- the unique identifier of the object containing the image to be
displayed. Must be in the range 1..65535.position
- a CoordTransform object that typically changes the size and
location and position of the image inside the parent shape.public BitmapFill(BitmapFill object)
object
- a BitmapFill fill style from which the values will be
copied.Method Detail |
---|
public boolean isTiled()
public void setTiled(boolean tiled)
tiled
- true if the image should be tiled, false if it is clipped.public boolean isSmoothed()
public void setSmoothed(boolean smoothed)
smoothed
- true if the image should be smoothed, false if no
smoothing will be applied.public int getIdentifier()
public void setIdentifier(int uid)
uid
- the unique identifier of the object containing the image to be
displayed which must be in the range 1..65535.public CoordTransform getTransform()
public void setTransform(CoordTransform matrix)
matrix
- a CoordTransform object that changes the appearance and
location of the image inside the shape. Must not be null.public BitmapFill copy()
copy
in interface Copyable<FillStyle>
public String toString()
toString
in class Object
public int prepareToEncode(Context context)
prepareToEncode
in interface SWFEncodeable
context
- an Context that allows information to be passed between
objects to control how they are initialised for encoding.
public void encode(SWFEncoder coder, Context context) throws IOException
encode
in interface SWFEncodeable
coder
- an SWFEncoder object.context
- an Context that allows information to be passed between
objects to control how they are initialised for encoding.
IOException
- if an error occurs while encoding the object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |