[cairo] PS/PDF Gradients

Carl Worth cworth at cworth.org
Fri Mar 2 04:48:53 PST 2007


On Mon, 29 Jan 2007 00:27:27 +1030, Adrian Johnson wrote:
> I have been testing Miklós' PDF gradient patch from
> http://lists.freedesktop.org/archives/cairo/2006-August/007648.html

Thanks for keeping this alive, Adrian! 

I know that the inkscape developers, (among others), are very anxious
to see cairo generate PDF files with native gradients rather than
falling back to rasterization---since other than this issue, cairo is
providing very good PDF export capability.

> Looking at the patch the only obvious deficiency I could see is lack of
> support for the different cairo_extend_t options. The patch has the PDF
> /Extend value set to [true true] which is equivalent CAIRO_EXTEND_PAD.
> 
> Testing linear gradients with rgb stops appears to be ok. Changing the
> PDF /Extend value set to [false false] which is equivalent
> CAIRO_EXTEND_NONE also works.

OK, well one thing we definitely need is a test case for linear
gradients with all of the extend modes, (could be much like the recent
radial case I added).

> The results of testing linear gradients with CAIRO_EXTEND_PAD and rgba
> stops are:
>   acroread    - ok but the colors seem to be too dark.
>   evince      - broken, The padded region is opaque when it should have
> some transparency.
>   ghostscript - broken. all opaque colors. no transparency.

All I looked at was the output from poppler which the test suite
uses. I'm also seeing the colors as too dark, but otherwise the
results look quite promising, (again without testing extend modes
yet). Here's the reference image (sorry it's so tiny):

http://cairographics.org/~cworth/images/linear-gradient-ref.png

and here's the rendering of the PDF output:

http://cairographics.org/~cworth/images/linear-gradient-pdf-argb32-out.png

So that just looks like one simple color scaling issue somewhere.

And once we test the extend modes, it would at least be very easy to
only turn on native gradients for known-good extend modes.

> I have not tested radial gradients.

I did now, and it's not too pretty. Here's our reference image:

http://cairographics.org/~cworth/images/radial-gradient-ref.png

and here's the rendering of the PDF output:

http://cairographics.org/~cworth/images/radial-gradient-pdf-argb32-out.png

So it looks like there's still a fair amount of work to be done there.

Anyway, if anyone wants to help out with this, it would be *greatly*
appreciated.

I took this quick look to see if there was anything here in a state
ready to make it into 1.4, but it looks like there's not.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20070302/5b850754/attachment.pgp


More information about the cairo mailing list