java.lang.Object | |
↳ | com.pdftron.pdf.Rect |
Rect is a utility class used to manipulate PDF rectangle objects (refer to section 3.8.3 of the PDF Reference Manual). Rect can be associated with a SDF/Cos rectangle array using Rect(Obj*) constructor or later using Rect::Attach(Obj*) or Rect::Update(Obj*) methods. Rect keeps a local cache for rectangle points so it is necessary to call Rect::Update() method if the changes to the Rect should be saved in the attached Cos/SDF array.
Note: - Although rectangles are conventionally specified by their lower-left and upperright corners, it is acceptable to specify any two diagonally opposite corners.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Rect()
Instantiate Rect with size 0.
| |||||||||||
Rect(Obj rect)
Create a Rect and initialize it using given Cos/SDF rectangle Array
object.
| |||||||||||
Rect(double x1, double y1, double x2, double y2)
Create a Rect and initialize it using specified parameters.
| |||||||||||
Rect(Rectangle2D.Double r)
Instantiates a new rect from java Rectangle object
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static Rect | __Create(long impl) | ||||||||||
long | __GetHandle() | ||||||||||
void |
attach(Obj rect)
Attach the Cos/SDF object to the Rect.
| ||||||||||
void |
close()
Frees the native memory of the object.
| ||||||||||
boolean |
contains(double x, double y)
Determines if the specified point is contained within the rectangular
region defined by this Rectangle.
| ||||||||||
void |
destroy()
Frees the native memory of the object.
| ||||||||||
boolean | equals(Object other) | ||||||||||
double[] |
get()
Get the rectangle coordinates
| ||||||||||
double |
getHeight()
Get the height of rectangle
| ||||||||||
Rectangle2D.Double |
getRectangle()
Converts the rectangle to java.awt.geom.Rectangle2D
| ||||||||||
double |
getWidth()
Get the width of rectangle
| ||||||||||
double |
getX1()
Get the x coordinate of the lower-left point
| ||||||||||
double |
getX2()
Get the x coordinate of the upper-right point
| ||||||||||
double |
getY1()
Get the y coordinate of the lower-left point
| ||||||||||
double |
getY2()
Get the y coordinate of the upper-right point
| ||||||||||
int | hashCode() | ||||||||||
void |
inflate(double amount)
Expands the rectangle by the specified amount, in all directions.
| ||||||||||
void |
inflate(double x, double y)
Expands the rectangle by the specified amount in specifed direction
| ||||||||||
boolean |
intersectRect(Rect rect1, Rect rect2)
check if two rectangles intersect
Note: The intersection is the largest rectangle contained in both existing rectangles. | ||||||||||
void |
normalize()
Normalizes the rectagle to the one with lower-left and upper-right
corners.
| ||||||||||
void |
set(Rectangle2D.Double r)
Set the coordinates of the rectangle from jave Rectangle2D object
| ||||||||||
void |
set(double x1, double y1, double x2, double y2)
Set the coordinates of the rectangle.
| ||||||||||
void |
setX1(double x1)
Set the x coordinate of the lower-left point
| ||||||||||
void |
setX2(double x2)
Set the x coordinate of the upper-right point
| ||||||||||
void |
setY1(double y1)
Set the y coordinate of the lower-left point
| ||||||||||
void |
setY2(double y2)
Set the y coordinate of the upper-right point`
| ||||||||||
boolean |
update(Obj rect)
Saves changes made to the Rect object in the attached (or specified)
SDF/Cos rectangle.
| ||||||||||
boolean |
update()
Saves changes made to the Rect object in the attached (or specified)
SDF/Cos rectangle.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.lang.AutoCloseable
|
Create a Rect and initialize it using given Cos/SDF rectangle Array object. The rect is attached to this object.
rect | the rect |
---|
PDFNetException |
---|
Create a Rect and initialize it using specified parameters. The rect is not attached to any Cos/SDF object.
x1 | x coordinate of the lower-left point |
---|---|
y1 | y coordinate of the lower-left point |
x2 | x coordinate of the upper-right point |
y2 | y coordinate of the upper-right point |
PDFNetException |
---|
Instantiates a new rect from java Rectangle object
r | the rectangle object |
---|
PDFNetException |
---|
Attach the Cos/SDF object to the Rect.
rect | - underlying Cos/SDF object. Must be an SDF::Array with four SDF::Number elements. |
---|
PDFNetException |
---|
Frees the native memory of the object. This can be explicity called to control the deallocation of native memory and avoid situations where the garbage collector does not free the object in a timely manner.
PDFNetException |
---|
Determines if the specified point is contained within the rectangular region defined by this Rectangle.
x | x coordinate of the point |
---|---|
y | y coordinate of the point |
PDFNetException |
---|
Frees the native memory of the object. This can be explicitly called to control the deallocation of native memory and avoid situations where the garbage collector does not free the object in a timely manner.
Get the rectangle coordinates
PDFNetException |
---|
Converts the rectangle to java.awt.geom.Rectangle2D
PDFNetException |
---|
Get the x coordinate of the lower-left point
PDFNetException |
---|
Get the x coordinate of the upper-right point
PDFNetException |
---|
Get the y coordinate of the lower-left point
PDFNetException |
---|
Get the y coordinate of the upper-right point
PDFNetException |
---|
Expands the rectangle by the specified amount, in all directions.
amount | the amount to expand |
---|
Expands the rectangle by the specified amount in specifed direction
x | Specifies the amount to increase the rectangle's Left (x1) and Right (x2) properties. |
---|---|
y | Specifies the amount to increase the rectangle's Top (y1) and Bottom (y1) properties. |
check if two rectangles intersect
Note: The intersection is the largest rectangle contained in both existing rectangles.
rect1 | - A Rect object that contains a source rectangle. |
---|---|
rect2 | - A Rect object that contains a source rectangle. |
PDFNetException |
---|
Normalizes the rectagle to the one with lower-left and upper-right corners.
Note: Although rectangles are conventionally specified by their lower-left and upper-right corners, it is acceptable to specify any two diagonally opposite corners.
PDFNetException |
---|
Set the coordinates of the rectangle from jave Rectangle2D object
r | the rectangle object |
---|
PDFNetException |
---|
Set the coordinates of the rectangle.
x1 | x coordinate of the lower-left point |
---|---|
y1 | y coordinate of the lower-left point |
x2 | x coordinate of the upper-right point |
y2 | y coordinate of the upper-right point |
PDFNetException |
---|
Set the x coordinate of the lower-left point
x1 | x coordinate of the lower-left point |
---|
PDFNetException |
---|
Set the x coordinate of the upper-right point
x2 | x coordinate of the upper-right point |
---|
PDFNetException |
---|
Set the y coordinate of the lower-left point
y1 | y coordinate of the lower-left point |
---|
PDFNetException |
---|
Set the y coordinate of the upper-right point`
y2 | y coordinate of the upper-right point` |
---|
PDFNetException |
---|
Saves changes made to the Rect object in the attached (or specified) SDF/Cos rectangle.
rect | - an SDF array that should be updated and attached to this Rect. If parameter rect is NULL or is omitted, update is performed on previously attached Cos/SDF rectangle. |
---|
PDFNetException |
---|
Saves changes made to the Rect object in the attached (or specified) SDF/Cos rectangle.
PDFNetException |
---|