[poppler]
poppler/qt4/src: poppler-page.cc, 1.12, 1.13 poppler-qt4.h,
1.21, 1.22
Albert Astals Cid
aacid at freedesktop.org
Thu Jan 5 05:54:00 PST 2006
Update of /cvs/poppler/poppler/qt4/src
In directory gabe:/tmp/cvs-serv8069/qt4/src
Modified Files:
poppler-page.cc poppler-qt4.h
Log Message:
Introduce variants of renderTo that return a QImage and do not use a QPixmap so threading is possible.
Index: poppler-page.cc
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-page.cc,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- poppler-page.cc 1 Jan 2006 22:35:48 -0000 1.12
+++ poppler-page.cc 5 Jan 2006 13:53:58 -0000 1.13
@@ -55,7 +55,7 @@
delete m_page;
}
-QPixmap *Page::splashRenderToPixmap(double xres, double yres, int x, int y, int w, int h) const
+QImage Page::splashRenderToImage(double xres, double yres, int x, int y, int w, int h) const
{
SplashOutputDev *output_dev = m_page->parentDoc->m_doc->getSplashOutputDev();
@@ -86,6 +86,13 @@
}
delete[] pixel;
+ return img;
+}
+
+QPixmap *Page::splashRenderToPixmap(double xres, double yres, int x, int y, int w, int h) const
+{
+ QImage img = splashRenderToImage(xres, yres, x, y, w, h);
+
// Turn the QImage into a QPixmap
QPixmap* out = new QPixmap(QPixmap::fromImage(img));
Index: poppler-qt4.h
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-qt4.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- poppler-qt4.h 30 Dec 2005 22:31:32 -0000 1.21
+++ poppler-qt4.h 5 Jan 2006 13:53:58 -0000 1.22
@@ -153,31 +153,14 @@
public:
~Page();
- /**
- Render the page to a QPixmap using the Splash renderer
-
+ /**
+ Render the page to a QImage using the Splash renderer
+
This method can be used to render the page to a QPixmap. It
- uses the "Splash" rendering engine that is included in the
- Poppler distribution. This method is reasonably well-tested
- and has produced good output so far. This method is used as
- follows.
-
- at code
-Poppler::Page* pdfPage;
-
-// Generate a QPixmap of the rendered page
-QPixmap* pixmap = pdfPage->splashRenderToPixmap(0, 0, 0, 0, xres, yres );
-if (pixmap == 0) {
- ... error message ...
- return;
-}
-
-... use pixmap ...
-
-delete pixmap;
- at endcode
-
- If x=y=w=h=-1, the method will automatically compute the
+ uses the "Splash" rendering engine. This method is reasonably
+ well-tested and has produced good output so far.
+
+ If x=y=w=h=-1, the method will automatically compute the
size of the pixmap from the horizontal and vertical
resolutions specified in xres and yres. Otherwise, the
method renders only a part of the page, specified by the
@@ -205,11 +188,33 @@
well-tested. Unusual or meaningless parameters may lead to
rather unexpected results.
- \returns pointer to a QPixmap, or NULL on failure. The
- pixmap returned must be deleted.
+ \returns a QImage of the page, or a null image on failure.
+ */
+ QImage splashRenderToImage(double xres=72.0, double yres=72.0, int x=-1, int y=-1, int w=-1, int h=-1) const;
+
+ /**
+ Render the page to a QPixmap using the Splash renderer
+
+ This member function is provided for convenience. It behaves essentially like the above function.
+ It is used as follows.
+
+ at code
+Poppler::Page* pdfPage;
+
+// Generate a QPixmap of the rendered page
+QPixmap* pixmap = pdfPage->splashRenderToPixmap(0, 0, 0, 0, xres, yres );
+if (pixmap == 0) {
+ ... error message ...
+ return;
+}
+
+... use pixmap ...
+
+delete pixmap;
+ at endcode
*/
QPixmap *splashRenderToPixmap(double xres=72.0, double yres=72.0, int x=-1, int y=-1, int w=-1, int h=-1) const;
-
+
/**
Render the page to a pixmap using the Arthur (Qt4) renderer
More information about the poppler
mailing list