Hi!
As announced, here my overprint patch. It is an enhancement patch, a
merge fix and a bug fix in one: an enhancement, because it now completes
the implementation overprint mode and devicen in postscript, a merge
fix, because it fixes some bugs in the overprint implementation in
splash of xpdf 3.0.3 and has now the complete functionality (and more!)
of my implementation back again and a bug fix, because it fixes the use
of splash cmyk in postscript which never had worked.
1. Overprint implementation in postscript
To have a complete overprint implementation in the (pure) postscript
device there were just two things missing: overprint mode and the
implementation of the DeviceN colorspace in PostScript. I double checked
my implementation with the Ghent Test Suite with GhostScript (device
pdfwrite) and Acrobat X distiller, and all the tests now succeeds,
either in Acrobat X distiller or in GhostScript. As overprint is a
device dependent feature, it is up to the output device if it supports
overprint and what features of overprint are supported, and often You
have various configuration possibilities there. Nearly all PostScript
output of the Ghent tests show now the desired results if converting it
back to PDF with ghostscript pdfwrite, the implementation in ghostscript
is complete. On the other hand a few tests failed when using Acrobat X
distiller, all of them with the overprint mode switch. Funny, because
overprint mode 1 is often also called the illustrator overprint mode
because it was introduced by illustrator, but probably the destiller
only handles EPS correctly which comes from illustrator :-)
2. Overprint implementation in postscript if using splash rasterization
Of course the postscript overprint implementation will only work if
pdftops doesn't decide to use splash to rasterize it because of the use
of transparencies in the PDF. But because overprint is device dependent
I decided to spend an additional parameter "overprint" to pdftops
(simular to pdftoppm). Switching it on (only available if compiled with
SPLASH_CMYK, because overprint is only in CMYK colorspace showable) will
use the overprint implementation in splash also if rasterizing the PDF.
3. Overprint implementation in splash
The overprint implementation in splash now uses the better designed
interface of xpdf and therefore now also works in transparency groups.
Thanks to the developper team of xpdf. I just fixed a small bug in it,
where it defies the technical specification. Of course it is still in
the nature of the splash implementation that it fails if CMYK values
should overprint spot colors, because spot colors are converted
immediately in their CMYK alternates. And in the implementation of
overprinting spot colors over CMYK colors I made a small assumption to
get it running which causes undesired results if this assumption fails,
but I didn't want to implement more and more configuration switches. I
still plan to implement a DeviceN output in splash and make a complete
implementation there, but this is of course a bigger task (but doable).
The overprint switch in pdftoppm is still only available if compiled
with the SPLASH_CMYK directive.
If someone wants to know more about overprint, just contact me directly.
Then I'll send the technical papers and/or hints to specifications.
Cheers,
Thomas
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index ad12964..83a0c8d 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -161,6 +161,8 @@ static const char *prolog[] = {
" /pdfStroke [0] def",
" /pdfFillOP false def",
" /pdfStrokeOP false def",
+ "~3sn",
+ " /pdfOPM false def",
"~123sn",
" /pdfLastFill false def",
" /pdfLastStroke false def",
@@ -253,6 +255,9 @@ static const char *prolog[] = {
" /pdfLastStroke true def /pdfLastFill false def",
" } if",
"} def",
+ "~3n",
+ "/opm { dup /pdfOPM exch def",
+ " setoverprintmode } def",
"~23n",
"/cs { /pdfFillXform exch def dup /pdfFillCS exch def",
" setcolorspace } def",
@@ -284,6 +289,9 @@ static const char *prolog[] = {
" /pdfLastStroke true def /pdfLastFill false def",
" } if",
"} def",
+ "~3s",
+ "/opm { dup /pdfOPM exch def",
+ " setoverprintmode } def",
"~23s",
"/k { 4 copy 4 array astore /pdfFill exch def setcmykcolor",
" /pdfLastFill true def /pdfLastStroke false def } def",
@@ -378,6 +386,12 @@ static const char *prolog[] = {
" pdfStrokeOP setoverprint",
" } ifelse",
" } if",
+ "~3sn",
+ " /pdfOPM where {",
+ " pop",
+ " pdfOPM setoverprintmode",
+ " } if",
+ "~23sn",
"} def",
"~123sn",
"/cm { concat } def",
@@ -3054,6 +3068,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
double m0, m1, m2, m3, m4, m5;
int nStripes, stripeH, stripeY;
int c, w, h, x, y, comp, i;
+ int numComps;
#endif
if (globalParams->getPSAlwaysRasterize()) {
@@ -3089,13 +3104,13 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
delete state;
// set up the SplashOutputDev
- if (mono || level == psLevel1) {
+ if (mono) {
paperColor[0] = 0xff;
splashOut = new SplashOutputDev(splashModeMono8, 1, gFalse,
paperColor, gFalse,
globalParams->getAntialiasPrinting());
#if SPLASH_CMYK
- } else if (level == psLevel1Sep) {
+ } else if (level == psLevel1Sep || globalParams->getOverprintPreview()) {
paperColor[0] = paperColor[1] = paperColor[2] = paperColor[3] = 0;
splashOut = new SplashOutputDev(splashModeCMYK8, 1, gFalse,
paperColor, gFalse,
@@ -3210,6 +3225,10 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
case psLevel3Sep:
if (mono) {
writePS("/DeviceGray setcolorspace\n");
+#if SPLASH_CMYK
+ } else if (globalParams->getOverprintPreview()) {
+ writePS("/DeviceCMYK setcolorspace\n");
+#endif
} else {
writePS("/DeviceRGB setcolorspace\n");
}
@@ -3220,8 +3239,15 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
writePS(" /BitsPerComponent 8\n");
if (mono) {
writePS(" /Decode [0 1]\n");
+ numComps = 1;
+#if SPLASH_CMYK
+ } else if (globalParams->getOverprintPreview()) {
+ writePS(" /Decode [0 1 0 1 0 1 0 1]\n");
+ numComps = 4;
+#endif
} else {
writePS(" /Decode [0 1 0 1 0 1]\n");
+ numComps = 3;
}
writePS(" /DataSource currentfile\n");
if (globalParams->getPSASCIIHex()) {
@@ -3234,7 +3260,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
writePS("image\n");
obj.initNull();
p = bitmap->getDataPtr() + (h - 1) * bitmap->getRowSize();
- str0 = new MemStream((char *)p, 0, w * h * (mono ? 1 : 3), &obj);
+ str0 = new MemStream((char *)p, 0, w * h * numComps, &obj);
str = new RunLengthEncoder(str0);
if (globalParams->getPSASCIIHex()) {
str = new ASCIIHexEncoder(str);
@@ -3811,6 +3837,12 @@ void PSOutputDev::updateStrokeOverprint(GfxState *state) {
}
}
+void PSOutputDev::updateOverprintMode(GfxState *state) {
+ if (level >= psLevel3) {
+ writePSFmt("{0:s} opm\n", state->getOverprintMode() ? "true" : "false");
+ }
+}
+
void PSOutputDev::updateTransfer(GfxState *state) {
Function **funcs;
int i;
@@ -6211,7 +6243,7 @@ void PSOutputDev::dumpColorSpaceL2(GfxColorSpace *colorSpace,
numComps = baseCS->getNComps();
lookup = indexedCS->getLookup();
writePSFmt(" {0:d} <\n", n);
- if (baseCS->getMode() == csDeviceN) {
+ if (baseCS->getMode() == csDeviceN && level != psLevel3 && level != psLevel3Sep) {
func = ((GfxDeviceNColorSpace *)baseCS)->getTintTransformFunc();
baseCS->getDefaultRanges(low, range, indexedCS->getIndexHigh());
if (((GfxDeviceNColorSpace *)baseCS)->getAlt()->getMode() == csLab) {
@@ -6294,12 +6326,29 @@ void PSOutputDev::dumpColorSpaceL2(GfxColorSpace *colorSpace,
break;
case csDeviceN:
- // DeviceN color spaces are a Level 3 PostScript feature.
deviceNCS = (GfxDeviceNColorSpace *)colorSpace;
- dumpColorSpaceL2(deviceNCS->getAlt(), gFalse, updateColors, map01);
- if (genXform) {
- writePS(" ");
+ if (level == psLevel3 || level == psLevel3Sep) {
+ writePS("[/DeviceN\n");
+ writePS(" [ ");
+ for (i = 0; i < deviceNCS->getNComps(); i++) {
+ writePSString(deviceNCS->getColorantName(i));
+ writePS(" ");
+ }
+ writePS("]\n");
+ dumpColorSpaceL2(deviceNCS->getAlt(), gFalse, updateColors, map01);
+ writePS("\n");
cvtFunction(deviceNCS->getTintTransformFunc());
+ writePS("]\n");
+ if (genXform) {
+ writePS(" {}");
+ }
+ } else {
+ // DeviceN color spaces are a Level 3 PostScript feature.
+ dumpColorSpaceL2(deviceNCS->getAlt(), gFalse, updateColors, map01);
+ if (genXform) {
+ writePS(" ");
+ cvtFunction(deviceNCS->getTintTransformFunc());
+ }
}
break;
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index b2bd028..9b58e98 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -203,6 +203,7 @@ public:
virtual void updateStrokeColor(GfxState *state);
virtual void updateFillOverprint(GfxState *state);
virtual void updateStrokeOverprint(GfxState *state);
+ virtual void updateOverprintMode(GfxState *state);
virtual void updateTransfer(GfxState *state);
//----- update text state
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 246a37d..23ea7cb 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -1549,7 +1549,6 @@ SplashPattern *SplashOutputDev::getColor(GfxCMYK *cmyk) {
color[1] = colToByte(cmyk->m);
color[2] = colToByte(cmyk->y);
color[3] = colToByte(cmyk->k);
- // return createOverprintPattern(colorSpace, color, gFalse);
return new SplashSolidColor(color);
}
#endif
@@ -1557,17 +1556,26 @@ SplashPattern *SplashOutputDev::getColor(GfxCMYK *cmyk) {
void SplashOutputDev::setOverprintMask(GfxColorSpace *colorSpace,
GBool overprintFlag,
int overprintMode,
- GfxColor *singleColor) {
+ GfxColor *singleColor,
+ GBool grayIndexed) {
#if SPLASH_CMYK
Guint mask;
GfxCMYK cmyk;
+ GBool additive = gFalse;
+ int i;
+ if (colorSpace->getMode() == csIndexed) {
+ setOverprintMask(((GfxIndexedColorSpace *)colorSpace)->getBase(),
+ overprintFlag,
+ overprintMode,
+ singleColor,
+ grayIndexed);
+ return;
+ }
if (overprintFlag && globalParams->getOverprintPreview()) {
mask = colorSpace->getOverprintMask();
if (singleColor && overprintMode &&
- (colorSpace->getMode() == csDeviceCMYK ||
- (colorSpace->getMode() == csICCBased &&
- colorSpace->getNComps() == 4))) {
+ colorSpace->getMode() == csDeviceCMYK) {
colorSpace->getCMYK(singleColor, &cmyk);
if (cmyk.c == 0) {
mask &= ~1;
@@ -1582,10 +1590,30 @@ void SplashOutputDev::setOverprintMask(GfxColorSpace *colorSpace,
mask &= ~8;
}
}
+ if (grayIndexed) {
+ mask &= ~7;
+ } else if (colorSpace->getMode() == csSeparation) {
+ GfxSeparationColorSpace *deviceSep = (GfxSeparationColorSpace *)colorSpace;
+ additive = deviceSep->getName()->cmp("All") != 0 && mask == 0x0f && !deviceSep->isNonMarking();
+ } else if (colorSpace->getMode() == csDeviceN) {
+ GfxDeviceNColorSpace *deviceNCS = (GfxDeviceNColorSpace *)colorSpace;
+ additive = mask == 0x0f && !deviceNCS->isNonMarking();
+ for (i = 0; i < deviceNCS->getNComps() && additive; i++) {
+ if (deviceNCS->getColorantName(i)->cmp("Cyan") == 0) {
+ additive = gFalse;
+ } else if (deviceNCS->getColorantName(i)->cmp("Magenta") == 0) {
+ additive = gFalse;
+ } else if (deviceNCS->getColorantName(i)->cmp("Yellow") == 0) {
+ additive = gFalse;
+ } else if (deviceNCS->getColorantName(i)->cmp("Black") == 0) {
+ additive = gFalse;
+ }
+ }
+ }
} else {
mask = 0xffffffff;
}
- splash->setOverprintMask(mask);
+ splash->setOverprintMask(mask, additive);
#endif
}
@@ -2950,13 +2978,11 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
GfxRGB rgb;
#if SPLASH_CMYK
GfxCMYK cmyk;
+ GBool grayIndexed = gFalse;
#endif
Guchar pix;
int n, i;
- setOverprintMask(colorMap->getColorSpace(), state->getFillOverprint(),
- state->getOverprintMode(), NULL);
-
ctm = state->getCTM();
for (i = 0; i < 6; ++i) {
if (!isfinite(ctm[i])) return;
@@ -3018,10 +3044,14 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
break;
#if SPLASH_CMYK
case splashModeCMYK8:
+ grayIndexed = colorMap->getColorSpace()->getMode() != csDeviceGray;
imgData.lookup = (SplashColorPtr)gmallocn(n, 4);
for (i = 0; i < n; ++i) {
pix = (Guchar)i;
colorMap->getCMYK(&pix, &cmyk);
+ if (cmyk.c != 0 || cmyk.m != 0 || cmyk.y != 0) {
+ grayIndexed = gFalse;
+ }
imgData.lookup[4*i] = colToByte(cmyk.c);
imgData.lookup[4*i+1] = colToByte(cmyk.m);
imgData.lookup[4*i+2] = colToByte(cmyk.y);
@@ -3032,6 +3062,14 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
}
}
+#if SPLASH_CMYK
+ setOverprintMask(colorMap->getColorSpace(), state->getFillOverprint(),
+ state->getOverprintMode(), NULL, grayIndexed);
+#else
+ setOverprintMask(colorMap->getColorSpace(), state->getFillOverprint(),
+ state->getOverprintMode(), NULL);
+#endif
+
if (colorMode == splashModeMono1) {
srcMode = splashModeMono8;
} else {
@@ -3638,7 +3676,7 @@ void SplashOutputDev::paintTransparencyGroup(GfxState *state, double *bbox) {
// paint the transparency group onto the parent bitmap
// - the clip path was set in the parent's state)
if (tx < bitmap->getWidth() && ty < bitmap->getHeight()) {
- splash->setOverprintMask(0xffffffff);
+ splash->setOverprintMask(0xffffffff, gFalse);
splash->composite(tBitmap, 0, 0, tx, ty,
tBitmap->getWidth(), tBitmap->getHeight(),
gFalse, !isolated);
@@ -4076,6 +4114,8 @@ GBool SplashOutputDev::univariateShadedFill(GfxState *state, SplashUnivariatePat
state->closePath();
path = convertPath(state, state->getPath(), gTrue);
+ setOverprintMask(pattern->getShading()->getColorSpace(), state->getFillOverprint(),
+ state->getOverprintMode(), state->getFillColor());
retVal = (splash->shadedFill(path, pattern->getShading()->getHasBBox(), pattern) == splashOk);
state->clearPath();
setVectorAntialias(vaa);
diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h
index 230e751..84b1973 100644
--- a/poppler/SplashOutputDev.h
+++ b/poppler/SplashOutputDev.h
@@ -359,7 +359,7 @@ private:
SplashPattern *getColor(GfxCMYK *cmyk);
#endif
void setOverprintMask(GfxColorSpace *colorSpace, GBool overprintFlag,
- int overprintMode, GfxColor *singleColor);
+ int overprintMode, GfxColor *singleColor, GBool grayIndexed = gFalse);
SplashPath *convertPath(GfxState *state, GfxPath *path,
GBool dropEmptySubpaths);
void doUpdateFont(GfxState *state);
diff --git a/splash/Splash.cc b/splash/Splash.cc
index fcab28c..413a285 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -48,6 +48,7 @@
#include "SplashFont.h"
#include "SplashGlyphBitmap.h"
#include "Splash.h"
+#include <algorithm>
//------------------------------------------------------------------------
@@ -383,16 +384,24 @@ void Splash::pipeRun(SplashPipe *pipe) {
#if SPLASH_CMYK
case splashModeCMYK8:
if (state->overprintMask & 1) {
- pipe->destColorPtr[0] = state->cmykTransferC[pipe->cSrc[0]];
+ pipe->destColorPtr[0] = (state->overprintAdditive) ?
+ std::min<int>(pipe->destColorPtr[0] + state->cmykTransferC[pipe->cSrc[0]], 255) :
+ state->cmykTransferC[pipe->cSrc[0]];
}
if (state->overprintMask & 2) {
- pipe->destColorPtr[1] = state->cmykTransferM[pipe->cSrc[1]];
+ pipe->destColorPtr[1] = (state->overprintAdditive) ?
+ std::min<int>(pipe->destColorPtr[1] + state->cmykTransferM[pipe->cSrc[1]], 255) :
+ state->cmykTransferC[pipe->cSrc[1]];
}
if (state->overprintMask & 4) {
- pipe->destColorPtr[2] = state->cmykTransferY[pipe->cSrc[2]];
+ pipe->destColorPtr[2] = (state->overprintAdditive) ?
+ std::min<int>(pipe->destColorPtr[2] + state->cmykTransferY[pipe->cSrc[2]], 255) :
+ state->cmykTransferC[pipe->cSrc[2]];
}
if (state->overprintMask & 8) {
- pipe->destColorPtr[3] = state->cmykTransferK[pipe->cSrc[3]];
+ pipe->destColorPtr[3] = (state->overprintAdditive) ?
+ std::min<int>(pipe->destColorPtr[3] + state->cmykTransferK[pipe->cSrc[3]], 255) :
+ state->cmykTransferC[pipe->cSrc[3]];
}
pipe->destColorPtr += 4;
break;
@@ -708,16 +717,24 @@ void Splash::pipeRun(SplashPipe *pipe) {
#if SPLASH_CMYK
case splashModeCMYK8:
if (state->overprintMask & 1) {
- pipe->destColorPtr[0] = cResult0;
+ pipe->destColorPtr[0] = (state->overprintAdditive) ?
+ std::min<int>(pipe->destColorPtr[0] + cResult0, 255) :
+ cResult0;
}
if (state->overprintMask & 2) {
- pipe->destColorPtr[1] = cResult1;
+ pipe->destColorPtr[1] = (state->overprintAdditive) ?
+ std::min<int>(pipe->destColorPtr[1] + cResult1, 255) :
+ cResult1;
}
if (state->overprintMask & 4) {
- pipe->destColorPtr[2] = cResult2;
+ pipe->destColorPtr[2] = (state->overprintAdditive) ?
+ std::min<int>(pipe->destColorPtr[2] + cResult2, 255) :
+ cResult2;
}
if (state->overprintMask & 8) {
- pipe->destColorPtr[3] = cResult3;
+ pipe->destColorPtr[3] = (state->overprintAdditive) ?
+ std::min<int>(pipe->destColorPtr[3] + cResult3, 255) :
+ cResult3;
}
pipe->destColorPtr += 4;
break;
@@ -811,16 +828,24 @@ void Splash::pipeRunSimpleBGR8(SplashPipe *pipe) {
void Splash::pipeRunSimpleCMYK8(SplashPipe *pipe) {
//----- write destination pixel
if (state->overprintMask & 1) {
- pipe->destColorPtr[0] = state->cmykTransferC[pipe->cSrc[0]];
+ pipe->destColorPtr[0] = (state->overprintAdditive) ?
+ std::min<int>(pipe->destColorPtr[0] + state->cmykTransferC[pipe->cSrc[0]], 255) :
+ state->cmykTransferC[pipe->cSrc[0]];
}
if (state->overprintMask & 2) {
- pipe->destColorPtr[1] = state->cmykTransferM[pipe->cSrc[1]];
+ pipe->destColorPtr[1] = (state->overprintAdditive) ?
+ std::min<int>(pipe->destColorPtr[1] + state->cmykTransferM[pipe->cSrc[1]], 255) :
+ state->cmykTransferC[pipe->cSrc[1]];
}
if (state->overprintMask & 4) {
- pipe->destColorPtr[2] = state->cmykTransferY[pipe->cSrc[2]];
+ pipe->destColorPtr[2] = (state->overprintAdditive) ?
+ std::min<int>(pipe->destColorPtr[2] + state->cmykTransferY[pipe->cSrc[2]], 255) :
+ state->cmykTransferC[pipe->cSrc[2]];
}
if (state->overprintMask & 8) {
- pipe->destColorPtr[3] = state->cmykTransferK[pipe->cSrc[3]];
+ pipe->destColorPtr[3] = (state->overprintAdditive) ?
+ std::min<int>(pipe->destColorPtr[3] + state->cmykTransferK[pipe->cSrc[3]], 255) :
+ state->cmykTransferC[pipe->cSrc[3]];
}
pipe->destColorPtr += 4;
*pipe->destAlphaPtr++ = 255;
@@ -1084,16 +1109,24 @@ void Splash::pipeRunAACMYK8(SplashPipe *pipe) {
//----- write destination pixel
if (state->overprintMask & 1) {
- pipe->destColorPtr[0] = cResult0;
+ pipe->destColorPtr[0] = (state->overprintAdditive && pipe->shape != 0) ?
+ std::min<int>(pipe->destColorPtr[0] + cResult0, 255) :
+ cResult0;
}
if (state->overprintMask & 2) {
- pipe->destColorPtr[1] = cResult1;
+ pipe->destColorPtr[1] = (state->overprintAdditive && pipe->shape != 0) ?
+ std::min<int>(pipe->destColorPtr[1] + cResult1, 255) :
+ cResult1;
}
if (state->overprintMask & 4) {
- pipe->destColorPtr[2] = cResult2;
+ pipe->destColorPtr[2] = (state->overprintAdditive && pipe->shape != 0) ?
+ std::min<int>(pipe->destColorPtr[2] + cResult2, 255) :
+ cResult2;
}
if (state->overprintMask & 8) {
- pipe->destColorPtr[3] = cResult3;
+ pipe->destColorPtr[3] = (state->overprintAdditive && pipe->shape != 0) ?
+ std::min<int>(pipe->destColorPtr[3] + cResult3, 255) :
+ cResult3;
}
pipe->destColorPtr += 4;
*pipe->destAlphaPtr++ = aResult;
@@ -1606,8 +1639,9 @@ void Splash::setTransfer(Guchar *red, Guchar *green, Guchar *blue,
state->setTransfer(red, green, blue, gray);
}
-void Splash::setOverprintMask(Guint overprintMask) {
+void Splash::setOverprintMask(Guint overprintMask, GBool additive) {
state->overprintMask = overprintMask;
+ state->overprintAdditive = additive;
}
//------------------------------------------------------------------------
diff --git a/splash/Splash.h b/splash/Splash.h
index 3c2bf9f..7d0bf7f 100644
--- a/splash/Splash.h
+++ b/splash/Splash.h
@@ -146,7 +146,7 @@ public:
void setInNonIsolatedGroup(SplashBitmap *alpha0BitmapA,
int alpha0XA, int alpha0YA);
void setTransfer(Guchar *red, Guchar *green, Guchar *blue, Guchar *gray);
- void setOverprintMask(Guint overprintMask);
+ void setOverprintMask(Guint overprintMask, GBool additive);
//----- state save/restore
diff --git a/splash/SplashState.cc b/splash/SplashState.cc
index 7b632b8..0f0a1f7 100644
--- a/splash/SplashState.cc
+++ b/splash/SplashState.cc
@@ -86,6 +86,7 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias,
cmykTransferK[i] = (Guchar)i;
}
overprintMask = 0xffffffff;
+ overprintAdditive = gFalse;
next = NULL;
}
@@ -131,6 +132,7 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias,
cmykTransferK[i] = (Guchar)i;
}
overprintMask = 0xffffffff;
+ overprintAdditive = gFalse;
next = NULL;
}
@@ -173,6 +175,7 @@ SplashState::SplashState(SplashState *state) {
memcpy(cmykTransferY, state->cmykTransferY, 256);
memcpy(cmykTransferK, state->cmykTransferK, 256);
overprintMask = state->overprintMask;
+ overprintAdditive = state->overprintAdditive;
next = NULL;
}
diff --git a/splash/SplashState.h b/splash/SplashState.h
index 214bffa..2c8c406 100644
--- a/splash/SplashState.h
+++ b/splash/SplashState.h
@@ -87,9 +87,9 @@ public:
void setStrokeOverprint(GBool strokeOverprintA) { strokeOverprint = strokeOverprintA; }
void setOverprintMode(int overprintModeA) { overprintMode = overprintModeA; }
- // Set the transfer function.
- void setTransfer(Guchar *red, Guchar *green, Guchar *blue, Guchar *gray);
-
+ // Set the transfer function.
+ void setTransfer(Guchar *red, Guchar *green, Guchar *blue, Guchar *gray);
+
private:
SplashState(SplashState *state);
@@ -117,15 +117,16 @@ private:
GBool fillOverprint;
GBool strokeOverprint;
int overprintMode;
- Guchar rgbTransferR[256],
- rgbTransferG[256],
- rgbTransferB[256];
- Guchar grayTransfer[256];
- Guchar cmykTransferC[256],
- cmykTransferM[256],
- cmykTransferY[256],
- cmykTransferK[256];
- Guint overprintMask;
+ Guchar rgbTransferR[256],
+ rgbTransferG[256],
+ rgbTransferB[256];
+ Guchar grayTransfer[256];
+ Guchar cmykTransferC[256],
+ cmykTransferM[256],
+ cmykTransferY[256],
+ cmykTransferK[256];
+ Guint overprintMask;
+ GBool overprintAdditive;
SplashState *next; // used by Splash class
diff --git a/utils/pdftops.cc b/utils/pdftops.cc
index 542838b..57a1792 100644
--- a/utils/pdftops.cc
+++ b/utils/pdftops.cc
@@ -106,6 +106,9 @@ static char userPassword[33] = "\001";
static GBool quiet = gFalse;
static GBool printVersion = gFalse;
static GBool printHelp = gFalse;
+#if SPLASH_CMYK
+static GBool overprint = gFalse;
+#endif
static const ArgDesc argDesc[] = {
{"-f", argInt, &firstPage, 0,
@@ -170,6 +173,10 @@ static const ArgDesc argDesc[] = {
"owner password (for encrypted files)"},
{"-upw", argString, userPassword, sizeof(userPassword),
"user password (for encrypted files)"},
+#if SPLASH_CMYK
+ {"-overprint",argFlag, &overprint, 0,
+ "enable overprint"},
+#endif
{"-q", argFlag, &quiet, 0,
"don't print any messages or errors"},
{"-v", argFlag, &printVersion, 0,
@@ -260,6 +267,11 @@ int main(int argc, char *argv[]) {
goto err0;
}
}
+#if SPLASH_CMYK
+ if (overprint) {
+ globalParams->setOverprintPreview(gTrue);
+ }
+#endif
if (expand) {
globalParams->setPSExpandSmaller(gTrue);
}
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler