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 doublebottom()booleancontains(ASRectangle rect)Returns true if the supplied PDFRectangle is contained in the current PDFRectangle.double[]getValues()Get the coordinate values of the rectangle's cornersbooleanhasNonZeroDimensions()booleanhasNonZeroDimensions(double epsilon)doubleheight()doubleleft()ASCoordinatell()ASCoordinatelr()ASRectanglenormalized()Creates a new ASRectangle with normalized coordinates.doubleright()doubletop()java.lang.StringtoString()ASRectangletransform(ASMatrix ctm)ASCoordinateul()ASCoordinateur()doublewidth()voidwrite(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
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
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:
writein 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:
PDFSecurityExceptionPDFIOExceptionPDFInvalidDocumentException
-
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:
PDFInvalidDocumentExceptionPDFIOExceptionPDFSecurityException
-
-