Class PageRect

  • All Implemented Interfaces:
    java.lang.Comparable

    
    public class PageRect
     implements Comparable<T>
                        

    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 must be called to apply change to the drawable rect.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
      PageRect() Intended for internal usage only
      PageRect(float left, float top, float right, float bottom) Creates a page rectangle representation.
      PageRect(RectF rect) Creates a page rectangle representation.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      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.
      void updateScreenRect(@NonNull() Matrix pageToScreenMatrix) Updates screen rect to reflect position according to passed in matrices.
      void updatePageRect(@NonNull() Matrix pageToScreenMatrix) Updates page rect from screen rect.
      void set(@NonNull() RectF rect) Sets new page rect.
      void set(@NonNull() PageRect pageRect) Sets another page rect.
      void set(float left, float top, float right, float bottom) Sets new page rect.
      void inset(float dx, float dy) Inset the page rectangle by (dx,dy).
      int hashCode()
      boolean equals(@Nullable() Object o)
      String toString()
      int compareTo(@NonNull() PageRect another)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PageRect

        PageRect()
        Intended for internal usage only
      • PageRect

        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.
      • PageRect

        PageRect(RectF rect)
        Creates a page rectangle representation.
        Parameters:
        rect - Rectangle to be set as new page rect.
    • Method Detail

      • getPageRect

        @NonNull() 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

      • getScreenRect

        @NonNull() 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.

      • updateScreenRect

         void updateScreenRect(@NonNull() Matrix pageToScreenMatrix)

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

        Parameters:
        pageToScreenMatrix - Page-to-screen transformation matrix.
      • updatePageRect

         void updatePageRect(@NonNull() Matrix pageToScreenMatrix)

        Updates page rect from screen rect.

        Parameters:
        pageToScreenMatrix - Page-to-screen transformation matrix.
      • set

         void set(@NonNull() PageRect pageRect)

        Sets another page rect. Call updateScreenRect to update screen rect.

        Parameters:
        pageRect - Page rect to be set as a page rect.
      • set

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

        Sets new page rect. Call updateScreenRect 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.
      • inset

         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.