Am 24.01.2011 14:17, schrieb Carlos Garcia Campos:
Cairo 1.11.2 has a new mesh pattern that can be used to implement 6/7
type gradients. Adrian has an updated poppler branch that implements
mesh gradients in cairo backend:

http://cgit.freedesktop.org/~ajohnson/poppler/log/?h=mesh

I've tried it and it works great, it fixes bugs #28836 and #32791 (and
maybe others). I haven't pushed the patch yet becuase it contains
minimal changes in Gfx.cc. If nobody objects I'll push it to master
branch only.
I had a quick look at what Adrian has done in Gfc.cc, and think, that is a little bit misusing of out->gouraudTriangleShadedFill( state, shading) and out->patchMeshShadedFill( state, shading):

When these functions returns gTrue, this indicates that all work has already be done in the output device. How Adrian implements it is very special to Cairo. But it is quite ease to change it:
Just move the lines

+ double xMin, yMin, xMax, yMax;
+
+ // get the clip region bbox
+ state->getUserClipBBox(&xMin, &yMin, &xMax, &yMax);
+ state->moveTo(xMin, yMin);
+ state->lineTo(xMin, yMax);
+ state->lineTo(xMax, yMax);
+ state->lineTo(xMax, yMin);
+ state->closePath();
+ if (!contentIsHidden())
+ out->fill(state);
+ state->clearPath();

to CairoOutputDev::gouraudTriangleShadedFill respectively to CairoOutputDev::patchMeshShadedFill, i.e. if the actual implementation of gouraudTriangleShadedFill in CairoUtputDev would be renamed to formerGouraudTriangleShadedFill then do it like

GBool CairoOutputDev::gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) {
        if (formerGouraudTriangleShadedFill(state, shading)) {
            double xMin, yMin, xMax, yMax;

             // get the clip region bbox
             state->getUserClipBBox(&xMin, &yMin, &xMax, &yMax);
             state->moveTo(xMin, yMin);
             state->lineTo(xMin, yMax);
             state->lineTo(xMax, yMax);
             state->lineTo(xMax, yMin);
             state->closePath();
             fill(state);
             state->clearPath();
             return gTrue;
        } else
            return gFalse;
}

patchMeshShadedFill simular. Then You don't need to change Gfx, and it fits to the other shading routines.


Thomas


Regards,



_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to