This represents a rectangle in a PDF document.
Method from org.apache.pdfbox.pdmodel.common.PDRectangle Detail: |
public boolean contains(float x,
float y) {
float llx = getLowerLeftX();
float urx = getUpperRightX();
float lly = getLowerLeftY();
float ury = getUpperRightY();
return x >= llx && x < = urx &&
y >= lly && y < = ury;
}
Method to determine if the x/y point is inside this rectangle. |
public Dimension createDimension() {
return new Dimension( (int)getWidth(), (int)getHeight() );
}
A convenience method to create a dimension object for AWT operations. |
public PDRectangle createRetranslatedRectangle() {
PDRectangle retval = new PDRectangle();
retval.setUpperRightX( getWidth() );
retval.setUpperRightY( getHeight() );
return retval;
}
This will create a translated rectangle based off of this rectangle, such
that the new rectangle retains the same dimensions(height/width), but the
lower left x,y values are zero.
100, 100, 400, 400 (llx, lly, urx, ury )
will be translated to 0,0,300,300 |
public COSArray getCOSArray() {
return rectArray;
}
This will get the underlying array for this rectangle. |
public COSBase getCOSObject() {
return rectArray;
}
Convert this standard java object to a COS object. |
public float getHeight() {
return getUpperRightY() - getLowerLeftY();
}
This will get the height of this rectangle as calculated by
upperRightY - lowerLeftY. |
public float getLowerLeftX() {
return ((COSNumber)rectArray.get(0)).floatValue();
}
This will get the lower left x coordinate. |
public float getLowerLeftY() {
return ((COSNumber)rectArray.get(1)).floatValue();
}
This will get the lower left y coordinate. |
public float getUpperRightX() {
return ((COSNumber)rectArray.get(2)).floatValue();
}
This will get the upper right x coordinate. |
public float getUpperRightY() {
return ((COSNumber)rectArray.get(3)).floatValue();
}
This will get the upper right y coordinate. |
public float getWidth() {
return getUpperRightX() - getLowerLeftX();
}
This will get the width of this rectangle as calculated by
upperRightX - lowerLeftX. |
public void move(float horizontalAmount,
float verticalAmount) {
setUpperRightX(getUpperRightX() + horizontalAmount);
setLowerLeftX(getLowerLeftX() + horizontalAmount);
setUpperRightY(getUpperRightY() + verticalAmount);
setLowerLeftY(getLowerLeftY() + verticalAmount);
}
This will move the rectangle the given relative amount. |
public void setLowerLeftX(float value) {
rectArray.set(0, new COSFloat( value ) );
}
This will set the lower left x coordinate. |
public void setLowerLeftY(float value) {
rectArray.set(1, new COSFloat( value ) );
}
This will set the lower left y coordinate. |
public void setUpperRightX(float value) {
rectArray.set(2, new COSFloat( value ) );
}
This will set the upper right x coordinate. |
public void setUpperRightY(float value) {
rectArray.set(3, new COSFloat( value ) );
}
This will set the upper right y coordinate. |
public String toString() {
return "[" + getLowerLeftX() + "," + getLowerLeftY() + "," +
getUpperRightX() + "," + getUpperRightY() +"]";
}
This will return a string representation of this rectangle. |