[Poppler-bugs] [Bug 27482] Colorizing text and masks in pattern colorspace

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Apr 16 10:31:54 PDT 2010


https://bugs.freedesktop.org/show_bug.cgi?id=27482

--- Comment #11 from thomasf <Thomas.Freitag at alfa.de> 2010-04-16 10:31:54 PDT ---
(In reply to comment #10)
> Created an attachment (id=35100)
 --> (https://bugs.freedesktop.org/attachment.cgi?id=35100)
> Sample PDF where this new patch will cause new regression

Unfortunately, even running through the regression test, a part of the patch
will produce new regressions, see attached PDF. But I found the problem in
Gfx::opSetFillColorSpace, and implement it now in the same way I did it in the
other fill routines, so I think, it's a little bit more understandable. The
only difference to the other fill routines are coming from the different
commands. Here the new implementation:

void Gfx::opSetFillColorSpace(Object args[], int numArgs) {
  Object obj;
  GfxColorSpace *colorSpace;
  GfxColor color;

  res->lookupColorSpace(args[0].getName(), &obj);
  if (obj.isNull()) {
    colorSpace = GfxColorSpace::parse(&args[0]);
  } else {
    colorSpace = GfxColorSpace::parse(&obj);
  }
  obj.free();
  if (colorSpace) {
      if (textHaveCSPattern) {
          GBool needFill = out->deviceHasTextClip(state);
          out->endTextObject(state);
          if (needFill) {
              doPatternFill(gTrue);
          }
          out->restoreState(state);
      }
      state->setFillPattern(NULL);
      state->setFillColorSpace(colorSpace);
      out->updateFillColorSpace(state);
      colorSpace->getDefaultColor(&color);
      state->setFillColor(&color);
      out->updateFillColor(state);
      if (textHaveCSPattern) {
          out->beginTextObject(state);
          out->updateRender(state);
          out->updateTextMat(state);
          out->updateTextPos(state);
          textHaveCSPattern = colorSpace->getMode() == csPattern;
      } else if (drawText && out->supportTextCSPattern(state)) {
          out->beginTextObject(state);
          textHaveCSPattern = gTrue;
      }
  } else {
    error(getPos(), "Bad color space (fill)");
  }
}

With this change now all my samples are working, and the new one, too.

@Albert: Do You think this piece of code is sufficient, or should I make once
again a new patch?

Sorry again for changes and changes, but as I discussed it already with Carlos:
The xpdf and therefore also poppler was not made for colorizing text in pattern
colorspace, and only the trick with text clipping and filling it later seems to
work, but that means that we must be very careful with former states and
changing a state.
But hopefully (as I thought a lot of times in the past :-) ), this is the
really last change for this feature!

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Poppler-bugs mailing list