Enable Qt5 frontend to render a single annotation in an extra pass
Currently we can only render annotations along with their parent pages. But sometimes we're interested solely in one particular annotation. Then the current approach is needless expensive, and clumsy because a client has to know the exact position of the annotation on page in advance. Once ready, this MR will add Annotation::renderToImage()
and friends, to support rendering annotations independently from their parent pages.
This shall support following use cases:
- show realistic preview of popplers built-in popup icons
- WYSIWYG editing of free text annotations, e.g. typewriter
- paint annotations while dragging them around (rendering the whole page is too expensive)
- extract single annotations from PDF with a command line tool
- enable composition of annotations in readers; quite tricky, due to blend mode, z-order and the ilk
Example usage:
/* Generate image where annotation #0 is painted at offset (0,0) on transparent background. _/
Poppler::Annotation_ annot = pdfPage->annotations()[0];
QImage img = annot->renderToImage(myDpiX, myDpiY);
Some older patch history is in #563. There's a related story targeting glib in #401.
Edited by Tobias Deiminger