Class PDFNet.Rect
PDFNet.Rect
Constructor Attributes | Constructor Name and Description |
---|---|
PDFNet.Rect(x1, y1, x2, y2, mp_rect)
Rect is a struct used to manipulate PDF rectangle objects
|
Method Attributes | Method Name and Description |
---|---|
assign(right)
Copy Constructor
|
|
attach(obj)
attach the Cos/SDF object to the Rect.
|
|
contains(x, y)
Determines if the specified point is contained within the rectangular region
defined by this Rectangle
|
|
get()
Get the coordinates of the rectangle
|
|
height()
|
|
inflate1(amount)
Expands the rectangle by the specified size, in all directions.
|
|
inflate2(x, y)
Expands the rectangle by the specified size, in all directions.
|
|
<static> |
PDFNet.Rect.init(x1, y1, x2, y2)
Create a Rect and initialize it using specified parameters.
|
intersectRect(rect1, rect2)
Makes a Rect equal to the intersection of two existing rectangles.
|
|
Arrange the points in the rectangle so that the first point is the lower-left
corner and the second point is the upper-right corner of the rectangle.
|
|
set(x1, y1, x2, y2)
Set the coordinates of the rectangle
|
|
update(obj)
Saves changes made to the Rect object in the attached (or specified) SDF/Cos rectangle.
|
|
width()
|
Class Detail
PDFNet.Rect(x1, y1, x2, y2, mp_rect)
Rect is a struct used to manipulate PDF rectangle objects
- Parameters:
- x1
- y1
- x2
- y2
- mp_rect
Method Detail
assign(right)
Copy Constructor
- Parameters:
- {rect} right
- (generated documentation)
attach(obj)
attach the Cos/SDF object to the Rect.
- Parameters:
- {Obj} obj
- underlying Cos/SDF object. Must be an SDF::Array with four SDF::Number elements.
{boolean}
contains(x, y)
Determines if the specified point is contained within the rectangular region
defined by this Rectangle
- Parameters:
- {number} x
- horizontal x value of the point to check
- {number} y
- vertical y value of the point to check
- Returns:
- {boolean} A promise that resolves to true is the point is in the rectangle, false otherwise.
get()
Get the coordinates of the rectangle
{number}
height()
- Returns:
- {number} A promise that resolves to rectangle's height
inflate1(amount)
Expands the rectangle by the specified size, in all directions.
- Parameters:
- {number} amount
- Specifies the amount to increase the rectangle in all directions.
inflate2(x, y)
Expands the rectangle by the specified size, in all directions.
- Parameters:
- {number} x
- Specifies the amount to increase the rectangle's Left (x1) and Right (x2) properties.
- {number} y
- Specifies the amount to increase the rectangle's Top (y1) and Bottom (y2) properties.
<static>
{rect}
PDFNet.Rect.init(x1, y1, x2, y2)
Create a Rect and initialize it using specified parameters.
- Parameters:
- {number} x1
- The left-most position of the rect.
- {number} y1
- The bottom-most position of the rect.
- {number} x2
- The right-most position of the rect.
- {number} y2
- The top-most position of the rect.
- Returns:
- {rect} A promise that resolves to a Rect (rectangle) object The rect is not attached to any Cos/SDF object.
{boolean}
intersectRect(rect1, rect2)
Makes a Rect equal to the intersection of two existing rectangles.
- Parameters:
- {rect} rect1
- A Rect object that contains a source rectangle.
- {rect} rect2
- A Rect object that contains a source rectangle.
- Returns:
- {boolean} A promise that resolves to true if the intersection is not empty; 0 if the intersection is empty.
normalize()
Arrange the points in the rectangle so that the first point is the lower-left
corner and the second point is the upper-right corner of the rectangle.
set(x1, y1, x2, y2)
Set the coordinates of the rectangle
- Parameters:
- {number} x1
- The left-most position of the rect.
- {number} y1
- The bottom-most position of the rect.
- {number} x2
- The right-most position of the rect.
- {number} y2
- The top-most position of the rect. The rect is not attached to any Cos/SDF object.
{boolean}
update(obj)
Saves changes made to the Rect object in the attached (or specified) SDF/Cos rectangle.
- Parameters:
- {Obj} obj
- an optional parameter indicating a 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.
- Returns:
- {boolean} A promise that resolves to true if the attached Cos/SDF rectangle array was successfully updated, false otherwise.
{number}
width()
- Returns:
- {number} A promise that resolves to rectangle's width