com.pspdfkit.projection.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.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract Matrix |
getPageToViewTransformation(int pageIndex, Matrix reuse)
Returns a
Matrix for transforming PDF coordinates to view coordinates. | ||||||||||
abstract Matrix |
getViewToPageTransformation(int pageIndex, Matrix reuse)
Returns a
Matrix for transforming view coordinates to PDF coordinates. | ||||||||||
abstract void |
toPdfPoint(PointF point, int pageIndex)
Converts the coordinates stored within
point from the view coordinate space (i.e. | ||||||||||
abstract void |
toPdfRect(RectF rect, int pageIndex)
Converts the view coordinates stored in
rect to PDF coordinates on the given pageIndex . | ||||||||||
abstract void |
toViewPoint(PointF point, 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 |
toViewRect(RectF rect, int pageIndex)
Converts the PDF coordinates stored in
rect (of the given pageIndex ) to view
coordinates. |
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.
pageIndex | Number of the page for which to retrieve the transformation (starting at
0 ). |
---|---|
reuse | A matrix object to reuse for calculation. May be null if a new matrix
should be created. |
IllegalStateException | if there is no transformation for the given page (e.g.
the document is not yet loaded, or the specified page doesn't exist).
|
---|
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.
pageIndex | Number of the page for which to retrieve the transformation (starting at
0 ). |
---|---|
reuse | A matrix object to reuse for calculation. May be null if a new matrix
should be created. |
IllegalStateException | if there is no transformation for the given page (e.g.
the document is not yet loaded, or the specified page doesn't exist).
|
---|
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(PdfDocument)
which is called after
the document has been loaded, and the document view has been laid out.
point | Point containing view coordinates (pixels) that should be converted to PDF coordinates. |
---|---|
pageIndex | Target page for the conversion (0 denotes the first page).
|
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(PdfDocument)
which is called after
the document has been loaded, and the document view has been laid out.
rect | View coordinates. |
---|---|
pageIndex | Target page for the conversion (0 denotes the first page).
|
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(PdfDocument)
which is called after
the document has been loaded, and the document view has been laid out.
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).
|
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(PdfDocument)
which is called after
the document has been loaded, and the document view has been laid out.
rect | PDF coordinates. |
---|---|
pageIndex | Target page of the coordinates (0 denotes the first page).
|