Fwd: [cairo] [PATCH] PDF: alpha-gradients; reused patterns; cairo_paint_with_alpha

Kristian Høgsberg krh at bitplanet.net
Thu Jul 27 20:02:04 PDT 2006


Oops, just realized that I'd been discussing these patches with Miklós
without cc'ing the list.  I'm forwarding our discussion in the next
couple of mails.

---------- Forwarded message ----------
From: Kristian Høgsberg <krh at bitplanet.net>
Date: Jul 24, 2006 7:45 PM
Subject: Re: [cairo] [PATCH] PDF: alpha-gradients; reused patterns;
cairo_paint_with_alpha
To: Miklós Erdélyi <erdelyim at gmail.com>


On 7/24/06, Miklós Erdélyi <erdelyim at gmail.com> wrote:
> Alpha-gradients implemented using an smask. Stroking/non-stroking
> operators are also separated.
> Patterns now are reused as a hole if possible, and in case of
> gradients just the interpolating functions and in case of image
> patterns just the image data is reused if possible. CRC32 is used for
> calculating the hashes.
> cairo_paint_with_alpha can be called on a PDF surface since masking
> with constant alpha is possible now.

From a brief look-through, this looks like good work.  I don't think
that the hashing is the best way to go, though.  We've discussed
keeping a surface serial number that is bumped by the core cairo code
everytime the contents of a surface changes.  This way you can just
remember the surface pointer and the serial number for the version
emitted in the PDF.  If you see the same surface again and the
sequence number hasn't changed, just use the previously emitted
version.  Plus it's usable by other backends who will want to do
similar things (PS and SVG at least).   The hashing is less intrusive,
of course, but the sequence counter is useful enough that it belongs
in cairo core code.

Also, is it possible to split the patch into a couple of smaller
patches?  At least the smask gradient work should be possible to
seperate from the pattern reuse code.

thanks,
Kristian


More information about the cairo mailing list