|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.flagstone.transform.datatype.Bounds
public final class Bounds
The Bounds class defines the area inside which shapes, text fields and characters are drawn.
In Flash the axes are specified relative to the top left corner of the screen and the bounding area is defined by two pairs of coordinates that identify the top left and bottom right corners of a rectangle.
The coordinates for each corner also specify the coordinate range so specifying a bounding rectangle with the points (-100,-100) and (100,100) defines a rectangle 200 twips by 200 twips with the point (0,0) located in the centre. Specifying the points (0,0) and (200,200) defines a rectangle with the same size however the centre is now located at (100,100).
The bounding rectangle does not clip the object when it is drawn. Lines and curves drawn outside of the rectangle will still be displayed. However if the position of the object is changed or another object is displayed in front of it then only the pixels inside of the bounding box will be repainted.
Constructor Summary | |
---|---|
Bounds(int xmin,
int ymin,
int xmax,
int ymax)
Creates a Bounds object representing a rectangle with the corners at (xmin,ymin) and (xmax,ymax). |
|
Bounds(SWFDecoder coder)
Creates and initialises a Bounds using values encoded in the Flash binary format. |
Method Summary | |
---|---|
void |
encode(SWFEncoder coder,
Context context)
Encode an object to the Flash binary format. |
boolean |
equals(Object object)
|
int |
getHeight()
Returns the height of the rectangle, measured in twips. |
int |
getMaxX()
Returns the x-coordinate of the bottom right corner of the bounding rectangle as seen on a screen. |
int |
getMaxY()
Returns the y-coordinate of the bottom right corner of the bounding rectangle as seen on a screen. |
int |
getMinX()
Returns the x-coordinate of the top left corner of the bounding rectangle as seen on a screen. |
int |
getMinY()
Returns the y-coordinate of the top left corner of the bounding rectangle as seen on a screen. |
int |
getWidth()
Returns the width of the rectangle, measured in twips. |
int |
hashCode()
|
static Bounds |
pad(Bounds rect,
int padding)
Create a Bounds by applying a padding factor to all sides of the bounding box. |
static Bounds |
pad(Bounds rect,
int top,
int right,
int bottom,
int left)
Create a Bounds by applying a padding factor to all sides of the bounding box. |
int |
prepareToEncode(Context context)
Prepare an object for encoding, returning the expected size of an object when it is encoded. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Bounds(SWFDecoder coder) throws IOException
coder
- an SWFDecoder object that contains the encoded Flash data.
IOException
- if an error occurs while decoding the data.public Bounds(int xmin, int ymin, int xmax, int ymax)
xmin
- x-coordinate of the top left corner.ymin
- y-coordinate of the top left corner.xmax
- x-coordinate of bottom right corner.ymax
- y-coordinate of bottom right corner.Method Detail |
---|
public static Bounds pad(Bounds rect, int padding)
rect
- the Bounds to adjust.padding
- the margin to add to the coordinates of the bounds.
public static Bounds pad(Bounds rect, int top, int right, int bottom, int left)
rect
- the Bounds to adjust.top
- the to apply to the top of the bounding box.right
- the to apply to the right of the bounding box.bottom
- the to apply to the bottom of the bounding box.left
- the to apply to the left of the bounding box.
public int getMinX()
public int getMaxX()
public int getMinY()
public int getMaxY()
public int getWidth()
public int getHeight()
public String toString()
toString
in class Object
public boolean equals(Object object)
equals
in class Object
public int hashCode()
hashCode
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 |