|
intarsys PDF library API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.intarsys.pdf.cos.COSBasedObject
de.intarsys.pdf.cds.CDSBase
de.intarsys.pdf.cds.CDSRectangle
public class CDSRectangle
The implementation of the pdf rectangle data type.
The specification of the data type is found in [PDF} chapter 3.8.3.
A rectangle is defined by [llx, lly, urx, ury ] where llx = lower left x coordinate lly = lower left y coordinate urx = upper right x coordinate ury = upper right y coordinate urx | v +-----+ <-ury | | lly -> +-----+ ˆ | llxAn application should be prepared to get any two diagonally opposite corners in the rectangle specification. Use "normalize()" to ensure a rectangle that conforms to the above picture.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class de.intarsys.pdf.cos.COSBasedObject |
---|
COSBasedObject.MetaClass |
Field Summary | |
---|---|
static float[] |
SIZE_A4
|
Fields inherited from class de.intarsys.pdf.cos.COSBasedObject |
---|
META |
Constructor Summary | |
---|---|
CDSRectangle()
CDTRectangle constructor comment. |
|
CDSRectangle(float[] rectArray)
CDTRectangle constructor. |
|
CDSRectangle(float llx,
float lly,
float urx,
float ury)
CDTRectangle constructor. |
|
CDSRectangle(Rectangle2D rect)
|
Method Summary | |
---|---|
boolean |
contains(double x,
double y)
true if x/y lies within this. |
boolean |
contains(double x,
double y,
double epsilon)
true if x/y lies within this, with a "uncertainty" of
epsilon. |
CDSRectangle |
copy()
Create a copy of the receiver |
static CDSRectangle |
createFromCOS(COSArray array)
Create a CDSRectangle from an array holding the
rectangle coordinates. |
float |
getHeight()
Return the height (an absolute value) of the rectangle. |
float |
getLowerLeftX()
The lower left x coordinate. |
float |
getLowerLeftY()
The lower left y coordinate. |
float |
getUpperRightX()
The upper right x coordinate. |
float |
getUpperRightY()
The upper rigth y coordinate. |
float |
getWidth()
Get the width (an absolute value) of the rectangle. |
void |
invalidateCaches()
Invalidate all local caches as the base object may have changed. |
void |
move(float dx,
float dy)
Move the rectangle by a relative offset. |
CDSRectangle |
moveTo(float x,
float y)
Move the rectangle to a new absolute position. |
CDSRectangle |
normalize()
Adjust the corner coordinates so that lower left is really in the lower left (this means returns the smallest coordinate values). |
void |
resize(float dx,
float dy)
Resize the rectangle by moving the upper right corner. |
void |
resizeTo(float width,
float height)
Resize the rectangle to a new width and heigth. |
void |
setCorners(float llx,
float lly,
float urx,
float ury)
Set the corners of this. |
void |
setHeight(float height)
Set the height of this. |
void |
setLowerLeftX(float num)
Set the lower left x coordinate. |
void |
setLowerLeftY(float num)
Set the lower left y coordinate. |
void |
setUpperRightX(float num)
Set the upper right x coordinate. |
void |
setUpperRightY(float num)
Set the upper right y coordinate. |
void |
setWidth(float width)
Set the width of this. |
Rectangle2D |
toNormalizedRectangle()
Construct a Rectangle2D object from the receiver. |
Rectangle2D |
toRectangle()
Construct a Rectangle2D object from the receiver. |
Methods inherited from class de.intarsys.pdf.cos.COSBasedObject |
---|
changed, cosGetArray, cosGetDict, cosGetDoc, cosGetField, cosGetObject, cosGetStream, cosHasField, cosRemoveField, cosSetField, getAttribute, getFieldBoolean, getFieldDate, getFieldFixed, getFieldFixedArray, getFieldInt, getFieldMLString, getFieldString, removeAttribute, setAttribute, setFieldBoolean, setFieldFixed, setFieldInt, setFieldMLString, setFieldName, setFieldObject, setFieldString, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final float[] SIZE_A4
Constructor Detail |
---|
public CDSRectangle()
public CDSRectangle(float llx, float lly, float urx, float ury)
llx
- the lower left xlly
- the lower left yurx
- the upper right xury
- the upper right ypublic CDSRectangle(float[] rectArray)
rectArray
- A four dimensional array defining llx,lly, urx, ury.CDSRectangle(float llx, float lly, float urx, float
ury)
public CDSRectangle(Rectangle2D rect)
Method Detail |
---|
public static CDSRectangle createFromCOS(COSArray array)
CDSRectangle
from an array
holding the
rectangle coordinates.
array
- The base COSArray
CDSRectangle
from array
public boolean contains(double x, double y)
true
if x/y lies within this.
x
- x coordinate to be checked.y
- y coordinate to be checked.
true
if x/y lies within this.public boolean contains(double x, double y, double epsilon)
true
if x/y lies within this, with a "uncertainty" of
epsilon.
x
- x coordinate to be checked.y
- y coordinate to be checked.epsilon
- The allowed range of uncertainty
true
if x/y lies within this.public CDSRectangle copy()
public float getHeight()
public float getLowerLeftX()
public float getLowerLeftY()
public float getUpperRightX()
public float getUpperRightY()
public float getWidth()
public void invalidateCaches()
COSBasedObject
invalidateCaches
in class COSBasedObject
public void move(float dx, float dy)
dx
- The offset by wich we move in x direction.dy
- The offset by wich we move in y direction.public CDSRectangle moveTo(float x, float y)
x
- The new x position of the lower left corner.y
- The new y position of the lower left corner.
this
public CDSRectangle normalize()
This method changes this
in place!
this
public void resize(float dx, float dy)
dx
- The distance we move the upper right x coordinate.dy
- The distance we move the upper right y coordinate.public void resizeTo(float width, float height)
width
- The new width of the rectangle.height
- The new height of the rectangle.public void setCorners(float llx, float lly, float urx, float ury)
llx
- The lower left x coordinatelly
- The lower left y coordinateurx
- The upper right x coordinateury
- The upper right y coordinatepublic void setHeight(float height)
height
- THe new heightpublic void setLowerLeftX(float num)
num
- The lower left x coordinate.public void setLowerLeftY(float num)
num
- The lower left y coordinate.public void setUpperRightX(float num)
num
- The upper right x coordinate.public void setUpperRightY(float num)
num
- The upper right y coordinate.public void setWidth(float width)
width
- The new width.public Rectangle2D toNormalizedRectangle()
Rectangle2D
object from the receiver. The rectangle
will be normalized before construction.
public Rectangle2D toRectangle()
Rectangle2D
object from the receiver. The resulting
rectangle is not normalized, that means it may return a negative width or
height.
|
intarsys PDF library API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |