head 1.2; access; symbols pkgsrc-2013Q2:1.2.0.10 pkgsrc-2013Q2-base:1.2 pkgsrc-2012Q4:1.2.0.8 pkgsrc-2012Q4-base:1.2 pkgsrc-2011Q4:1.2.0.6 pkgsrc-2011Q4-base:1.2 pkgsrc-2011Q2:1.2.0.4 pkgsrc-2011Q2-base:1.2 pkgsrc-2009Q4:1.2.0.2 pkgsrc-2009Q4-base:1.2 pkgsrc-2009Q2:1.1.0.4 pkgsrc-2009Q2-base:1.1 pkgsrc-2009Q1:1.1.0.2 pkgsrc-2009Q1-base:1.1; locks; strict; comment @# @; 1.2 date 2009.09.09.19.57.05; author drochner; state dead; branches; next 1.1; 1.1 date 2009.02.12.20.55.07; author drochner; state Exp; branches; next ; desc @@ 1.2 log @update to 0.12.0 This is a major update, switches to the 0.12 release branch. Most notable change is that the color management stuff which we had as patches in pkgsrc is official now. Otherwise - many fixes and enhancements. (while this is a .0 release I've been tracking the 0.11.x snapshots and release candidate for a while so I don't expect big problems) @ text @$NetBSD: patch-cb,v 1.1 2009/02/12 20:55:07 drochner Exp $ --- poppler/GfxState.h.orig 2009-01-20 16:54:29.000000000 +0100 +++ poppler/GfxState.h @@@@ -32,6 +32,9 @@@@ #include "goo/gtypes.h" #include "Object.h" #include "Function.h" +#ifdef USE_CMS +#include "lcms.h" +#endif class Array; class GfxFont; @@@@ -151,6 +154,37 @@@@ enum GfxColorSpaceMode { csPattern }; +#ifdef USE_CMS + +#define COLOR_PROFILE_DIR "/ColorProfiles/" +#define GLOBAL_COLOR_PROFILE_DIR POPPLER_DATADIR COLOR_PROFILE_DIR + +// wrapper of cmsHTRANSFORM to copy +class GfxColorTransform { +public: + void doTransform(void *in, void *out, unsigned int size) { + cmsDoTransform(transform, in, out, size); + } + GfxColorTransform(cmsHTRANSFORM transformA) { + transform = transformA; + refCount = 1; + } + ~GfxColorTransform() { + cmsDeleteTransform(transform); + } + void ref() { + refCount++; + } + unsigned int unref() { + return --refCount; + } +private: + GfxColorTransform() {} + cmsHTRANSFORM transform; + unsigned int refCount; +}; +#endif + class GfxColorSpace { public: @@@@ -191,6 +225,32 @@@@ public: static char *getColorSpaceModeName(int idx); private: +#ifdef USE_CMS +protected: + static cmsHPROFILE RGBProfile; + static GooString *displayProfileName; // display profile file Name + static cmsHPROFILE displayProfile; // display profile + static unsigned int displayPixelType; + static GfxColorTransform *XYZ2DisplayTransform; + // convert color space signature to cmsColor type + static unsigned int getCMSColorSpaceType(icColorSpaceSignature cs); + static unsigned int getCMSNChannels(icColorSpaceSignature cs); + static cmsHPROFILE loadColorProfile(const char *fileName); +public: + static int setupColorProfiles(); + static void setDisplayProfile(cmsHPROFILE displayProfileA) { + displayProfile = displayProfileA; + } + static void setDisplayProfileName(GooString *name) { + displayProfileName = name->copy(); + } + static cmsHPROFILE getRGBProfile() { + return RGBProfile; + } + static cmsHPROFILE getDisplayProfile() { + return displayProfile; + } +#endif }; //------------------------------------------------------------------------ @@@@ -235,8 +295,6 @@@@ public: virtual void getGray(GfxColor *color, GfxGray *gray); virtual void getRGB(GfxColor *color, GfxRGB *rgb); virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk); - virtual void getGrayLine(Guchar *in, Guchar *out, int length); - virtual void getRGBLine(Guchar *in, unsigned int *out, int length); virtual int getNComps() { return 1; } virtual void getDefaultColor(GfxColor *color); @@@@ -255,6 +313,8 @@@@ private: double whiteX, whiteY, whiteZ; // white point double blackX, blackY, blackZ; // black point double gamma; // gamma value + double kr, kg, kb; // gamut mapping mulitpliers + void getXYZ(GfxColor *color, double *pX, double *pY, double *pZ); }; //------------------------------------------------------------------------ @@@@ -299,8 +359,6 @@@@ public: virtual void getGray(GfxColor *color, GfxGray *gray); virtual void getRGB(GfxColor *color, GfxRGB *rgb); virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk); - virtual void getGrayLine(Guchar *in, Guchar *out, int length); - virtual void getRGBLine(Guchar *in, unsigned int *out, int length); virtual int getNComps() { return 3; } virtual void getDefaultColor(GfxColor *color); @@@@ -323,6 +381,8 @@@@ private: double blackX, blackY, blackZ; // black point double gammaR, gammaG, gammaB; // gamma values double mat[9]; // ABC -> XYZ transform matrix + double kr, kg, kb; // gamut mapping mulitpliers + void getXYZ(GfxColor *color, double *pX, double *pY, double *pZ); }; //------------------------------------------------------------------------ @@@@ -390,6 +450,7 @@@@ private: double blackX, blackY, blackZ; // black point double aMin, aMax, bMin, bMax; // range for the a and b components double kr, kg, kb; // gamut mapping mulitpliers + void getXYZ(GfxColor *color, double *pX, double *pY, double *pZ); }; //------------------------------------------------------------------------ @@@@ -429,7 +490,26 @@@@ private: double rangeMin[4]; // min values for each component double rangeMax[4]; // max values for each component Ref iccProfileStream; // the ICC profile +#ifdef USE_CMS + GfxColorTransform *transform; + GfxColorTransform *lineTransform; // color transform for line +#endif +}; + +#ifdef USE_CMS +#define GFX_ICCBASED_CACHE_SIZE 5 +class GfxICCBasedCache { +public: + static GfxICCBasedColorSpace *lookup(int numA, int genA); + static void put(int numA, int genA, GfxICCBasedColorSpace *cs); +private: + GfxICCBasedCache(); + int num; + int gen; + GfxICCBasedColorSpace *colorSpace; + static GfxICCBasedCache cache[GFX_ICCBASED_CACHE_SIZE]; }; +#endif //------------------------------------------------------------------------ // GfxIndexedColorSpace @ 1.1 log @update to 0.10.4 changes: -fixed some crashes and a memory leak -fixed pdfimages to work for jpeg pkgsrc change: pulled in color management support from the development branch (but tested by me for many weeks), as an option which is on per default @ text @d1 1 a1 1 $NetBSD$ @