From ec4d810db18537d3cf9a5be624f0b7ebebdd0e1a Mon Sep 17 00:00:00 2001 From: kramm Date: Thu, 24 Apr 2008 22:13:25 +0000 Subject: [PATCH] support for multiple softmasks on the same level --- lib/pdf/GFXOutputDev.cc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/pdf/GFXOutputDev.cc b/lib/pdf/GFXOutputDev.cc index 13c81e4..881236c 100644 --- a/lib/pdf/GFXOutputDev.cc +++ b/lib/pdf/GFXOutputDev.cc @@ -1739,7 +1739,7 @@ void GFXOutputDev::processLink(Link *link, Catalog *catalog) } void GFXOutputDev::saveState(GfxState *state) { - dbg("saveState");dbgindent+=2; + dbg("saveState"); dbgindent+=2; msg(" saveState"); updateAll(state); @@ -2561,11 +2561,11 @@ void GFXOutputDev::beginTransparencyGroup(GfxState *state, double *bbox, GBool forSoftMask) { const char*colormodename = ""; - + if(blendingColorSpace) { colormodename = GfxColorSpace::getColorSpaceModeName(blendingColorSpace->getMode()); } - dbg("beginTransparencyGroup %.1f/%.1f/%.1f/%.1f %s isolated=%d knockout=%d forsoftmask=%d", bbox[0],bbox[1],bbox[2],bbox[3], colormodename, isolated, knockout, forSoftMask); + dbg("beginTransparencyGroup device=%08x %.1f/%.1f/%.1f/%.1f %s isolated=%d knockout=%d forsoftmask=%d", device, bbox[0],bbox[1],bbox[2],bbox[3], colormodename, isolated, knockout, forSoftMask); msg(" beginTransparencyGroup %.1f/%.1f/%.1f/%.1f %s isolated=%d knockout=%d forsoftmask=%d", bbox[0],bbox[1],bbox[2],bbox[3], colormodename, isolated, knockout, forSoftMask); //states[statepos].createsoftmask |= forSoftMask; @@ -2643,8 +2643,14 @@ void GFXOutputDev::paintTransparencyGroup(GfxState *state, double *bbox) void GFXOutputDev::setSoftMask(GfxState *state, double *bbox, GBool alpha, Function *transferFunc, GfxColor *rgb) { + if(states[statepos].softmask) { + /* shouldn't happen, but *does* happen */ + clearSoftMask(state); + } + /* alpha = 1: retrieve mask values from alpha layer alpha = 0: retrieve mask values from luminance */ + dbg("setSoftMask %.1f/%.1f/%.1f/%.1f alpha=%d backdrop=%02x%02x%02x", bbox[0], bbox[1], bbox[2], bbox[3], alpha, colToByte(rgb->c[0]), colToByte(rgb->c[1]), colToByte(rgb->c[2])); msg(" setSoftMask %.1f/%.1f/%.1f/%.1f alpha=%d backdrop=%02x%02x%02x", @@ -2658,7 +2664,7 @@ void GFXOutputDev::setSoftMask(GfxState *state, double *bbox, GBool alpha, Funct this->device = (gfxdevice_t*)rfx_calloc(sizeof(gfxdevice_t)); gfxdevice_record_init(this->device); - dbg("softmaskrecording is %08x at statepos %d\n", states[statepos].softmaskrecording, statepos); + dbg("softmaskrecording is %08x (dev=%08x) at statepos %d\n", states[statepos].softmaskrecording, this->device, statepos); states[statepos].softmask = 1; states[statepos].softmask_alpha = alpha; @@ -2681,7 +2687,7 @@ void GFXOutputDev::clearSoftMask(GfxState *state) return; states[statepos].softmask = 0; dbg("clearSoftMask statepos=%d", statepos); - msg(" clearSoftMask"); + msg(" clearSoftMask statepos=%d", statepos); if(!states[statepos].softmaskrecording || strcmp(this->device->name, "record")) { msg(" Error in softmask/tgroup ordering"); -- 1.7.10.4