|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.flagstone.transform.FSTransformObject
com.flagstone.transform.FSBounds
public class FSBounds
The FSBounds class is used to define 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.
Attributes | |
---|---|
minX | The x-coordinate of the upper left corner of the rectangle. |
minY | The y-coordinate of the upper left corner of the rectangle. |
maxX | The x-coordinate of the lower right corner of the rectangle. |
maxY | The y-coordinate of the lower right corner of the 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 when the bounding rectangle is defined for an FSMovie object then this defines the size of the Flash Player screen and shapes drawn outside of the bounding rectangle will not be displayed.
To create an FSBounds object simply specify the coordinates of the corners of the rectangle in the following order: top left x, top left y, bottom right x, bottom right y.
FSBounds bounds = new FSBounds(0, 0, 100, 200);
Creates a bounding rectangle for an object which is 100 twips wide and 200 twips high. The coordinate range for the object is from 0..100 along the x-axis and 0..200 along the y-axis. The origin (0,0) will be at the top left corner of the object as it is displayed on the screen.
FSBounds bounds = new FSBounds(-100, -200, 100, 200);
Creates a bounding rectangle for an object which is 200 twips wide and 400 twips high. The coordinate range for the object is from -100..100 along the x-axis and -200..200 along the y-axis. The origin (0,0) will be in the middle of the object as it is displayed on the screen.
The FSBounds class corresponds to the RECT data type, in the Macromedia Flash (SWF) File Format Specification. It was introduced in Flash 1.
Constructor Summary | |
---|---|
FSBounds(FSBounds obj)
Construct an FSBounds object and initialise it with value from another FSBounds object. |
|
FSBounds(FSCoder coder)
Construct an FSBounds object an initialise it with values decoded from a binary encoded FSBounds object. |
|
FSBounds(int xl,
int yl,
int xr,
int yr)
Constructs an FSBounds object representing a rectangle with the top left corner at (xl,yl) and bottom right corner at (xr,yr). |
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. |
void |
decode(FSCoder coder)
|
void |
encode(FSCoder coder)
|
boolean |
equals(java.lang.Object anObject)
Returns true if anObject is equal to this one. |
int |
getHeight()
Gets the height of the rectangle. |
int |
getMaxX()
Gets the x-coordinate of the bottom right corner of the bounding rectangle. |
int |
getMaxY()
Gets the y-coordinate of the bottom right corner of the bounding rectangle. |
int |
getMinX()
Gets the x-coordinate of the top left corner of the bounding rectangle. |
int |
getMinY()
Gets the y-coordinate of the top left corner of the bounding rectangle. |
int |
getWidth()
Gets the width of the rectangle. |
int |
length(FSCoder coder)
|
void |
setMax(int xr,
int yr)
Sets the x and y coordinates of the upper corner. |
void |
setMaxX(int aNumber)
Sets the x-coordinate of the bottom right corner of the bounding rectangle. |
void |
setMaxY(int aNumber)
Sets the y-coordinate of the bottom right corner of the bounding rectangle. |
void |
setMin(int xl,
int yl)
Sets the x and y coordinates of the lower corner. |
void |
setMinX(int aNumber)
Sets the x-coordinate of the top left corner of the bounding rectangle. |
void |
setMinY(int aNumber)
Sets the y-coordinate of the upper left corner of the bounding rectangle. |
void |
setPoints(int xl,
int yl,
int xr,
int yr)
Sets the x and y coordinates of the lower and upper corner point. |
Methods inherited from class com.flagstone.transform.FSTransformObject |
---|
clone, name, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FSBounds(FSCoder coder)
coder
- an FSCoder object containing an FSBounds encoded as binary
data.public FSBounds(int xl, int yl, int xr, int yr)
xl
- x-coordinate of the top left corner.yl
- y-coordinate of the top left corner.xr
- x-coordinate of bottom right corner.yr
- y-coordinate of bottom right corner.public FSBounds(FSBounds obj)
obj
- an FSBounds object.Method Detail |
---|
public int getMinX()
public int getMaxX()
public int getMinY()
public int getMaxY()
public void setMinX(int aNumber)
aNumber
- x-coordinate of the lower left corner of the bounding
rectangle.public void setMaxX(int aNumber)
aNumber
- x-coordinate of the bottom right corner of the bounding
rectangle.public void setMinY(int aNumber)
aNumber
- y-coordinate of the lower left corner of the bounding
rectangle.public void setMaxY(int aNumber)
aNumber
- x-coordinate of the bottom right corner of the bounding
rectangle.public int getWidth()
public int getHeight()
public void setMin(int xl, int yl)
xl
- the x-coordinate of the top left corner point.yl
- the y-coordinate of the top left corner point.public void setMax(int xr, int yr)
xr
- the x-coordinate of the bottom right corner point.yr
- the y-coordinate of the bottom right corner point.public void setPoints(int xl, int yl, int xr, int yr)
xl
- the x-coordinate of the top left corner point.yl
- the y-coordinate of the top left corner point.xr
- the x-coordinate of the bottom right corner point.yr
- the y-coordinate of the bottom right corner point.public boolean equals(java.lang.Object anObject)
equals
in class FSTransformObject
anObject
- the reference object with which to compare.
public void appendDescription(java.lang.StringBuffer buffer, int depth)
FSTransformObject
appendDescription
in class FSTransformObject
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.public int length(FSCoder coder)
length
in class FSTransformObject
public void encode(FSCoder coder)
encode
in class FSTransformObject
public void decode(FSCoder coder)
decode
in class FSTransformObject
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |