Interface ViewProjection

  • All Implemented Interfaces:

    
    public interface ViewProjection
    
                        

    Projection between the view coordinate space and the PDF coordinate space. To retrieve an instance of this, use getViewProjection. For more information on coordinate spaces and coordinate conversions, please refer to our Coordinate Space Conversion online guide.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract void toPdfPoint(@NonNull() PointF point, @IntRange(from = 0) int pageIndex) Converts the coordinates stored within point from the view coordinate space (i.e.
      abstract void toViewPoint(@NonNull() PointF point, @IntRange(from = 0) int pageIndex) Converts the coordinates stored within point from the PDF coordinate space of the given pageIndex to the view coordinate space (i.e.
      abstract void toPdfRect(@NonNull() RectF rect, @IntRange(from = 0) int pageIndex) Converts the view coordinates stored in rect to PDF coordinates on the given pageIndex.
      abstract void toViewRect(@NonNull() RectF rect, @IntRange(from = 0) int pageIndex) Converts the PDF coordinates stored in rect (of the given pageIndex) to view coordinates.
      abstract Matrix getPageToViewTransformation(@IntRange(from = 0) int pageIndex, @Nullable() Matrix reuse) Returns a Matrix for transforming PDF coordinates to view coordinates.
      abstract Matrix getViewToPageTransformation(@IntRange(from = 0) int pageIndex, @Nullable() Matrix reuse) Returns a Matrix for transforming view coordinates to PDF coordinates.
      • Methods inherited from class java.lang.Object

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

    • Method Detail

      • toPdfPoint

         abstract void toPdfPoint(@NonNull() PointF point, @IntRange(from = 0) int pageIndex)

        Converts the coordinates stored within point from the view coordinate space (i.e. screen pixels) to PDF coordinate space of the given pageIndex. This method modifies point in place.

        This method throws an exception if called before the document has been laid out, or if a conversion for the given pageIndex is not possible (e.g. requested page number is invalid). See onDocumentLoaded which is called after the document has been loaded, and the document view has been laid out.

        Parameters:
        point - Point containing view coordinates (pixels) that should be converted to PDF coordinates.
        pageIndex - Target page for the conversion (0 denotes the first page).
      • toViewPoint

         abstract void toViewPoint(@NonNull() PointF point, @IntRange(from = 0) int pageIndex)

        Converts the coordinates stored within point from the PDF coordinate space of the given pageIndex to the view coordinate space (i.e. screen pixels). This method modifies point in place.

        This method throws an exception if called before the document has been laid out, or if a conversion for the given pageIndex is not possible (e.g. requested page number is invalid). See onDocumentLoaded which is called after the document has been loaded, and the document view has been laid out.

        Parameters:
        point - PDF coordinates on the given pageIndex that should be converted to coordinates of the document view (pixels).
        pageIndex - Target page for the conversion (0 denotes the first page).
      • toPdfRect

         abstract void toPdfRect(@NonNull() RectF rect, @IntRange(from = 0) int pageIndex)

        Converts the view coordinates stored in rect to PDF coordinates on the given pageIndex. This method modifies rect in place.

        This method throws an exception if called before the document has been laid out, or if a conversion for the given pageIndex is not possible (e.g. requested page number is invalid). See onDocumentLoaded which is called after the document has been loaded, and the document view has been laid out.

        Parameters:
        rect - View coordinates.
        pageIndex - Target page for the conversion (0 denotes the first page).
      • toViewRect

         abstract void toViewRect(@NonNull() RectF rect, @IntRange(from = 0) int pageIndex)

        Converts the PDF coordinates stored in rect (of the given pageIndex) to view coordinates. This method modifies rect in place.

        This method throws an exception if called before the document has been laid out, or if a conversion for the given pageIndex is not possible (e.g. requested page number is invalid). See onDocumentLoaded which is called after the document has been loaded, and the document view has been laid out.

        Parameters:
        rect - PDF coordinates.
        pageIndex - Target page of the coordinates (0 denotes the first page).
      • getPageToViewTransformation

        @NonNull() abstract Matrix getPageToViewTransformation(@IntRange(from = 0) int pageIndex, @Nullable() Matrix reuse)

        Returns a Matrix for transforming PDF coordinates to view coordinates. The matrix can be used to map coordinates on the PDF page at pageIndex to view coordinates on the fragment. Note that this method may throw IllegalStateException if no document has been loaded yet, or if the requested page is not yet part of the fragment's view hierarchy.

        Parameters:
        pageIndex - Number of the page for which to retrieve the transformation (starting at 0).
        reuse - A matrix object to reuse for calculation.
        Returns:

        Transformation matrix for converting page coordinates to view coordinates.

      • getViewToPageTransformation

        @NonNull() abstract Matrix getViewToPageTransformation(@IntRange(from = 0) int pageIndex, @Nullable() Matrix reuse)

        Returns a Matrix for transforming view coordinates to PDF coordinates. The matrix can be used to map view coordinates on the fragment to coordinates on the PDF page at pageIndex. Note that this method may throw IllegalStateException if no document has been loaded yet, or if the requested page is not yet part of the fragment's view hierarchy.

        Parameters:
        pageIndex - Number of the page for which to retrieve the transformation (starting at 0).
        reuse - A matrix object to reuse for calculation.
        Returns:

        Transformation matrix for converting page coordinates to view coordinates.