public class

PageRect

extends Object
implements Comparable<T>
java.lang.Object
   ↳ com.pspdfkit.utils.PageRect

Class Overview

This is a rect representing a page object drawn on screen. It's specialty that is has two rects - one to represent this in Page coordinates and one to represent it in screen coordinates transformed with current draw matrix.

Note that all operations modify the page rect and updateScreenRect(Matrix) must be called to apply change to the drawable rect.

Summary

Public Constructors
PageRect(float left, float top, float right, float bottom)
Creates a page rectangle representation.
PageRect(RectF rect)
Creates a page rectangle representation.
Public Methods
int compareTo(PageRect another)
boolean equals(Object o)
RectF getPageRect()
Returns the rect representing the position of the object on screen.
RectF getScreenRect()
Returns the rect representing the current draw position of the object on the screen transformed with current page scroll, zoom or other transformations.
int hashCode()
void inset(float dx, float dy)
Inset the page rectangle by (dx,dy).
void set(RectF rect)
Set new page rect.
void set(float left, float top, float right, float bottom)
Set new page rect.
String toString()
void updatePageRect(Matrix pageToScreenMatrix)
Updates page rect from screen rect.
void updateScreenRect(Matrix pageToScreenMatrix)
Updates screen rect to reflect position according to passed in matrices.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.lang.Comparable

Public Constructors

public PageRect (float left, float top, float right, float bottom)

Creates a page rectangle representation.

Parameters
left Left border coordinate in PDF points.
top Top border coordinate in PDF points.
right Right border coordinate in PDF points.
bottom Bottom border coordinate in PDF points.

public PageRect (RectF rect)

Creates a page rectangle representation.

Parameters
rect Rectangle to be set as new page rect.

Public Methods

public int compareTo (PageRect another)

public boolean equals (Object o)

public RectF getPageRect ()

Returns the rect representing the position of the object on screen. This is in PDF coordinates - (0,0) starts on bottom left of the page and bottom < top. This is the rect you use if you want to find out PDF-stored position of the object on the page.

Returns
  • Rect of object on page in PDF coordinates

public RectF getScreenRect ()

Returns the rect representing the current draw position of the object on the screen transformed with current page scroll, zoom or other transformations. This is the rect to use if you want to find out where on the page the object is drawn right now.

Returns
  • Rect of object in page view in screen coordinates.

public int hashCode ()

public void inset (float dx, float dy)

Inset the page rectangle by (dx,dy). If dx is positive, then the sides are moved inwards, making the rectangle narrower. If dx is negative, then the sides are moved outwards, making the rectangle wider. The same holds true for dy and the top and bottom.

Parameters
dx Horizontal inset in PDF points.
dy Vertical inset in PDF points.

public void set (RectF rect)

Set new page rect. Call updateScreenRect(Matrix) to update screen rect.

Parameters
rect Rect to be set as a page rect.

public void set (float left, float top, float right, float bottom)

Set new page rect. Call updateScreenRect(Matrix) to update screen rect.

Parameters
left Left border coordinate in PDF points.
top Top border coordinate in PDF points.
right Right border coordinate in PDF points.
bottom Bottom border coordinate in PDF points.

public String toString ()

public void updatePageRect (Matrix pageToScreenMatrix)

Updates page rect from screen rect.

Parameters
pageToScreenMatrix Page-to-screen transformation matrix.

public void updateScreenRect (Matrix pageToScreenMatrix)

Updates screen rect to reflect position according to passed in matrices.

Parameters
pageToScreenMatrix Page-to-screen transformation matrix.