[poppler] 3 commits - qt4/src qt/poppler-page.cc

Pino Toscano pino at kemper.freedesktop.org
Sat Aug 1 11:12:58 PDT 2009


 qt/poppler-page.cc          |   12 +---------
 qt4/src/poppler-document.cc |   52 ++++++++++++++++++++++++++++++++++++++++++++
 qt4/src/poppler-qt4.h       |   52 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 106 insertions(+), 10 deletions(-)

New commits:
commit ed5918e16dafebc9ecf6db8ce0186f407ecbf7d5
Author: Pino Toscano <pino at kde.org>
Date:   Sat Aug 1 20:00:22 2009 +0200

    [Qt4 apidox] make example for FontIterator... not leak ;)

diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h
index 7f60494..776ef63 100644
--- a/qt4/src/poppler-qt4.h
+++ b/qt4/src/poppler-qt4.h
@@ -233,6 +233,8 @@ while (it->hasNext()) {
   QList<Poppler::FontInfo> fonts = it->next();
   // do something with the fonts
 }
+// after doing the job, the iterator must be freed
+delete it;
        \endcode
 
        \since 0.12
commit f3b36d9c992491e614e88dbf1a84b5433a7647f4
Author: Pino Toscano <pino at kde.org>
Date:   Sat Aug 1 19:54:52 2009 +0200

    [Qt4] Add color management API.
    
    Add few wrapper functions to get/set color profiles.
    Add a function to know whether the color management functions actually do anything (ie support compiled or not).
    Add few basic API docs for the new functions.
    Based on an initial patch by Hal V. Engel <hvengel at astound.net>, heavily reindented, polished and massaged in its API by me.

diff --git a/qt4/src/poppler-document.cc b/qt4/src/poppler-document.cc
index 877db52..4eb1aba 100644
--- a/qt4/src/poppler-document.cc
+++ b/qt4/src/poppler-document.cc
@@ -29,6 +29,7 @@
 #include <Stream.h>
 #include <Catalog.h>
 #include <DateInfo.h>
+#include <GfxState.h>
 
 #include <QtCore/QDebug>
 #include <QtCore/QFile>
@@ -36,6 +37,10 @@
 
 #include "poppler-private.h"
 
+#if defined(USE_CMS)
+#include <lcms.h>
+#endif
+
 namespace Poppler {
 
   int DocumentData::count = 0;
@@ -424,6 +429,44 @@ namespace Poppler {
         m_doc->setPaperColor(color);
     }
     
+    void Document::setColorDisplayProfile(void* outputProfileA)
+    {
+#if defined(USE_CMS)
+        GfxColorSpace::setDisplayProfile((cmsHPROFILE)outputProfileA);
+#else
+        Q_UNUSED(outputProfileA);
+#endif
+    }
+
+    void Document::setColorDisplayProfileName(const QString &name)
+    {
+#if defined(USE_CMS)
+        GooString *profileName = QStringToGooString( name );
+        GfxColorSpace::setDisplayProfileName(profileName);
+        delete profileName;
+#else
+        Q_UNUSED(name);
+#endif
+    }
+
+    void* Document::colorRgbProfile() const
+    {
+#if defined(USE_CMS)
+        return (void*)GfxColorSpace::getRGBProfile();
+#else
+        return NULL;
+#endif
+    }
+
+    void* Document::colorDisplayProfile() const
+    {
+#if defined(USE_CMS)
+       return (void*)GfxColorSpace::getDisplayProfile();
+#else
+       return NULL;
+#endif
+    }
+
     QColor Document::paperColor() const
     {
     	return m_doc->paperColor;
@@ -556,4 +599,13 @@ namespace Poppler {
         return QDateTime();
     }
 
+    bool isCmsAvailable()
+    {
+#if defined(USE_CMS)
+        return true;
+#else
+        return false;
+#endif
+    }
+
 }
diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h
index fd384f5..7f60494 100644
--- a/qt4/src/poppler-qt4.h
+++ b/qt4/src/poppler-qt4.h
@@ -612,6 +612,16 @@ while (it->hasNext()) {
    The current rendering backend can be changed using setRenderBackend().
    Please note that setting a backend not listed in the available ones
    will always result in null QImage's.
+
+   \section document-cms Color management support
+
+   %Poppler, if compiled with this support, provides functions to handle color
+   profiles.
+
+   To know whether the %Poppler version you are using has support for color
+   management, you can query Poppler::isCmsAvailable(). In case it is not
+   avilable, all the color management-related functions will either do nothing
+   or return null.
 */
     class POPPLER_QT4_EXPORT Document {
 	friend class Page;
@@ -665,6 +675,39 @@ while (it->hasNext()) {
 	Q_DECLARE_FLAGS( RenderHints, RenderHint )
 
 	/**
+	  Set a color display profile for the current document.
+
+	  \param outputProfileA is a \c cmsHPROFILE of the LCMS library.
+
+	   \since 0.12
+	*/
+	void setColorDisplayProfile(void *outputProfileA);
+	/**
+	  Set a color display profile for the current document.
+
+	  \param name is the name of the display profile to set.
+
+	   \since 0.12
+	*/
+	void setColorDisplayProfileName(const QString &name);
+	/**
+	  Return the current RGB profile.
+
+	  \return a \c cmsHPROFILE of the LCMS library.
+
+	   \since 0.12
+	*/
+	void* colorRgbProfile() const;
+	/**
+	  Return the current display profile.
+
+	  \return a \c cmsHPROFILE of the LCMS library.
+
+	   \since 0.12
+	*/
+	void *colorDisplayProfile() const;
+
+	/**
 	   Load the document from a file on disk
 
 	   \param filePath the name (and path, if required) of the file to load
@@ -1341,6 +1384,13 @@ height = dummy.height();
     */
     POPPLER_QT4_EXPORT QDateTime convertDate( char *dateString );
 
+    /**
+       Whether the color management functions are available.
+
+       \since 0.12
+    */
+    POPPLER_QT4_EXPORT bool isCmsAvailable();
+
     class SoundData;
     /**
        Container class for a sound file in a PDF document.
commit 78a1969d040018c0c2bb74c94f5507f786e4666e
Author: Pino Toscano <pino at kde.org>
Date:   Sat Aug 1 18:00:06 2009 +0200

    [Qt] add unhandled cases and remove unused code

diff --git a/qt/poppler-page.cc b/qt/poppler-page.cc
index 9c7e4f2..50c28aa 100644
--- a/qt/poppler-page.cc
+++ b/qt/poppler-page.cc
@@ -336,17 +336,9 @@ QValueList<Link*> Page::links() const
         break;
 
         case actionMovie:
-/*      TODO this (Movie link)
-          m_type = Movie;
-          LinkMovie * m = (LinkMovie *) a;
-          // copy Movie parameters (2 IDs and a const char *)
-          Ref * r = m->getAnnotRef();
-          m_refNum = r->num;
-          m_refGen = r->gen;
-          copyString( m_uri, m->getTitle()->getCString() );
-*/      break;
         case actionSound:
-        /* TODO: write me */
+        case actionRendition:
+        case actionJavaScript:
         break;
 
         case actionUnknown:


More information about the poppler mailing list