Class ASRectangle
- java.lang.Object
-
- com.adobe.internal.pdftoolkit.core.types.ASObject
-
- com.adobe.internal.pdftoolkit.core.types.ASRectangle
-
public class ASRectangle extends ASObject
ASRectangle represents an non-COS PDF rectangle.
-
-
Constructor Summary
Constructors Constructor Description ASRectangle(double[] coords)
ASRectangle(double left, double bottom, double right, double top)
ASRectangle(ASCoordinate ll, ASCoordinate ur)
ASRectangle(ASRectangle rect)
Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
bottom()
boolean
contains(ASRectangle rect)
Returns true if the supplied PDFRectangle is contained in the current PDFRectangle.double[]
getValues()
Get the coordinate values of the rectangle's cornersboolean
hasNonZeroDimensions()
boolean
hasNonZeroDimensions(double epsilon)
double
height()
double
left()
ASCoordinate
ll()
ASCoordinate
lr()
ASRectangle
normalized()
Creates a new ASRectangle with normalized coordinates.double
right()
double
top()
String
toString()
ASRectangle
transform(ASMatrix ctm)
ASCoordinate
ul()
ASCoordinate
ur()
double
width()
void
write(OutputByteStream outputByteStream)
Writes the ASRectangle in to the given OutputStream in the format expected by the PDF Spec.
-
-
-
Constructor Detail
-
ASRectangle
public ASRectangle(ASCoordinate ll, ASCoordinate ur)
- Parameters:
ll
- lower-left corner of the rectangleur
- upper-right corner of the rectangle
-
ASRectangle
public ASRectangle(double left, double bottom, double right, double top)
- Parameters:
left
- x coordinate of the left side of the rectanglebottom
- y coordinate of the bottom side of the rectangleright
- x coordinate of the right side of the rectangletop
- y coordinate of the top side of the rectangle
-
ASRectangle
public ASRectangle(double[] coords) throws PDFInvalidParameterException
- Parameters:
coords
- an array of the coordinates in the form [left, bottom, right, top]- Throws:
PDFInvalidParameterException
-
ASRectangle
public ASRectangle(ASRectangle rect)
Copy constructor.- Parameters:
rect
-
-
-
Method Detail
-
write
public void write(OutputByteStream outputByteStream) throws PDFIOException
Writes the ASRectangle in to the given OutputStream in the format expected by the PDF Spec.- Specified by:
write
in classASObject
- Parameters:
outputByteStream
- OutputByteStream to write to.- Throws:
PDFIOException
- exception from OutputStream
-
getValues
public double[] getValues()
Get the coordinate values of the rectangle's corners- Returns:
- an array of the format [left, bottom, right, top]
-
ll
public ASCoordinate ll()
-
lr
public ASCoordinate lr()
-
ur
public ASCoordinate ur()
-
ul
public ASCoordinate ul()
-
left
public double left()
-
bottom
public double bottom()
-
right
public double right()
-
top
public double top()
-
width
public double width()
-
height
public double height()
-
transform
public ASRectangle transform(ASMatrix ctm)
-
hasNonZeroDimensions
public boolean hasNonZeroDimensions()
-
hasNonZeroDimensions
public boolean hasNonZeroDimensions(double epsilon)
-
contains
public boolean contains(ASRectangle rect) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException
Returns true if the supplied PDFRectangle is contained in the current PDFRectangle.- Parameters:
rect
-- Returns:
- boolean
- Throws:
PDFSecurityException
PDFIOException
PDFInvalidDocumentException
-
normalized
public ASRectangle normalized() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException
Creates a new ASRectangle with normalized coordinates. The new ASRectangle will have the following properties:- left <= right
- bottomw <= top
- Returns:
- a new ASRectangle with normalized coordinates
- Throws:
PDFInvalidDocumentException
PDFIOException
PDFSecurityException
-
-