java.lang.Object | |
↳ | android.graphics.pdf.PdfRenderer.Page |
This class represents a PDF document page for rendering.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | RENDER_MODE_FOR_DISPLAY | Mode to render the content for display on a screen. | |||||||||
int | RENDER_MODE_FOR_PRINT | Mode to render the content for printing. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Closes this page.
| |||||||||||
Gets the page height in points (1/72").
| |||||||||||
Gets the page index.
| |||||||||||
Gets the page width in points (1/72").
| |||||||||||
Renders a page to a bitmap.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.lang.AutoCloseable
|
Mode to render the content for display on a screen.
Mode to render the content for printing.
Gets the page height in points (1/72").
Gets the page width in points (1/72").
Renders a page to a bitmap.
You may optionally specify a rectangular clip in the bitmap bounds. No rendering outside the clip will be performed, hence it is your responsibility to initialize the bitmap outside the clip.
You may optionally specify a matrix to transform the content from page coordinates which are in points (1/72") to bitmap coordinates which are in pixels. If this matrix is not provided this method will apply a transformation that will fit the whole page to the destination clip if provided or the destination bitmap if no clip is provided.
The clip and transformation are useful for implementing tile rendering where the destination bitmap contains a portion of the image, for example when zooming. Another useful application is for printing where the size of the bitmap holding the page is too large and a client can render the page in stripes.
Note: The destination bitmap format must be
ARGB
.
Note: The optional transformation matrix must be affine as per
Matrix.isAffine()
. Hence, you can specify
rotation, scaling, translation but not a perspective transformation.
destination | Destination bitmap to which to render. |
---|---|
destClip | Optional clip in the bitmap bounds. |
transform | Optional transformation to apply when rendering. |
renderMode | The render mode. |
Invoked when the garbage collector has detected that this instance is no longer reachable. The default implementation does nothing, but this method can be overridden to free resources.
Note that objects that override finalize
are significantly more expensive than
objects that don't. Finalizers may be run a long time after the object is no longer
reachable, depending on memory pressure, so it's a bad idea to rely on them for cleanup.
Note also that finalizers are run on a single VM-wide finalizer thread,
so doing blocking work in a finalizer is a bad idea. A finalizer is usually only necessary
for a class that has a native peer and needs to call a native method to destroy that peer.
Even then, it's better to provide an explicit close
method (and implement
Closeable
), and insist that callers manually dispose of instances. This
works well for something like files, but less well for something like a BigInteger
where typical calling code would have to deal with lots of temporaries. Unfortunately,
code that creates lots of temporaries is the worst kind of code from the point of view of
the single finalizer thread.
If you must use finalizers, consider at least providing your own
ReferenceQueue
and having your own thread process that queue.
Unlike constructors, finalizers are not automatically chained. You are responsible for
calling super.finalize()
yourself.
Uncaught exceptions thrown by finalizers are ignored and do not terminate the finalizer thread. See Effective Java Item 7, "Avoid finalizers" for more.
Throwable |
---|