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.
-
-
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 givenpageIndex
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 givenpageIndex
.abstract void
toViewRect(@NonNull() RectF rect, @IntRange(from = 0) int pageIndex)
Converts the PDF coordinates stored in rect
(of the givenpageIndex
) 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. -
-
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 givenpageIndex
. This method modifiespoint
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 givenpageIndex
to the view coordinate space (i.e. screen pixels). This method modifiespoint
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 givenpageIndex
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 givenpageIndex
. This method modifiesrect
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 givenpageIndex
) to view coordinates. This method modifiesrect
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 throwIllegalStateException
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 at0
).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 throwIllegalStateException
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 at0
).reuse
- A matrix object to reuse for calculation.- Returns:
Transformation matrix for converting page coordinates to view coordinates.
-
-
-
-