[poppler] poppler/GfxState.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Wed Dec 2 13:16:55 PST 2015
poppler/GfxState.cc | 64 +++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 48 insertions(+), 16 deletions(-)
New commits:
commit 37840827c4073dedfd37915a74eb8fe0c44843c3
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date: Wed Dec 2 22:15:33 2015 +0100
Ignore the alternateSpace and tintTransform
As a reasonable compromise in my eyes this new patch
now also checks the alternate colorspace, and if this
is DeviceGray in case of a separation colorspace with
name black this patch treats is as if it is really a
DeviceGray and so ignore tintTransform and alternate
colorspace just in this case when using getGray() and getRGB().
Bug #92381
diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index ab796f7..7fb84f4 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -18,7 +18,7 @@
// Copyright (C) 2006, 2010 Carlos Garcia Campos <carlosgc at gnome.org>
// Copyright (C) 2006-2015 Albert Astals Cid <aacid at kde.org>
// Copyright (C) 2009, 2012 Koji Otani <sho at bbr.jp>
-// Copyright (C) 2009, 2011-2014 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2009, 2011-2015 Thomas Freitag <Thomas.Freitag at alfa.de>
// Copyright (C) 2009 Christian Persch <chpe at gnome.org>
// Copyright (C) 2010 Paweł Wiejacha <pawel.wiejacha at gmail.com>
// Copyright (C) 2010 Christian Feuersänger <cfeuersaenger at googlemail.com>
@@ -2864,12 +2864,16 @@ void GfxSeparationColorSpace::getGray(GfxColor *color, GfxGray *gray) {
GfxColor color2;
int i;
- x = colToDbl(color->c[0]);
- func->transform(&x, c);
- for (i = 0; i < alt->getNComps(); ++i) {
- color2.c[i] = dblToCol(c[i]);
+ if (alt->getMode() == csDeviceGray && name->cmp("Black") == 0) {
+ *gray = clip01(gfxColorComp1 - color->c[0]);
+ } else {
+ x = colToDbl(color->c[0]);
+ func->transform(&x, c);
+ for (i = 0; i < alt->getNComps(); ++i) {
+ color2.c[i] = dblToCol(c[i]);
+ }
+ alt->getGray(&color2, gray);
}
- alt->getGray(&color2, gray);
}
void GfxSeparationColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
@@ -2878,12 +2882,18 @@ void GfxSeparationColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
GfxColor color2;
int i;
- x = colToDbl(color->c[0]);
- func->transform(&x, c);
- for (i = 0; i < alt->getNComps(); ++i) {
- color2.c[i] = dblToCol(c[i]);
+ if (alt->getMode() == csDeviceGray && name->cmp("Black") == 0) {
+ rgb->r = clip01(gfxColorComp1 - color->c[0]);
+ rgb->g = clip01(gfxColorComp1 - color->c[0]);
+ rgb->b = clip01(gfxColorComp1 - color->c[0]);
+ } else {
+ x = colToDbl(color->c[0]);
+ func->transform(&x, c);
+ for (i = 0; i < alt->getNComps(); ++i) {
+ color2.c[i] = dblToCol(c[i]);
+ }
+ alt->getRGB(&color2, rgb);
}
- alt->getRGB(&color2, rgb);
}
void GfxSeparationColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
@@ -2892,12 +2902,34 @@ void GfxSeparationColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
GfxColor color2;
int i;
- x = colToDbl(color->c[0]);
- func->transform(&x, c);
- for (i = 0; i < alt->getNComps(); ++i) {
- color2.c[i] = dblToCol(c[i]);
+ if (name->cmp("Black") == 0) {
+ cmyk->c = 0;
+ cmyk->m = 0;
+ cmyk->y = 0;
+ cmyk->k = color->c[0];
+ } else if (name->cmp("Cyan") == 0) {
+ cmyk->c = color->c[0];
+ cmyk->m = 0;
+ cmyk->y = 0;
+ cmyk->k = 0;
+ } else if (name->cmp("Magenta") == 0) {
+ cmyk->c = 0;
+ cmyk->m = color->c[0];
+ cmyk->y = 0;
+ cmyk->k = 0;
+ } else if (name->cmp("Yellow") == 0) {
+ cmyk->c = 0;
+ cmyk->m = 0;
+ cmyk->y = color->c[0];
+ cmyk->k = 0;
+ } else {
+ x = colToDbl(color->c[0]);
+ func->transform(&x, c);
+ for (i = 0; i < alt->getNComps(); ++i) {
+ color2.c[i] = dblToCol(c[i]);
+ }
+ alt->getCMYK(&color2, cmyk);
}
- alt->getCMYK(&color2, cmyk);
}
void GfxSeparationColorSpace::getDeviceN(GfxColor *color, GfxColor *deviceN) {
More information about the poppler
mailing list