[cairo] Details of revised rendering equation

Carl Worth cworth at redhat.com
Fri Aug 5 13:32:54 PDT 2005


On Fri, 05 Aug 2005 14:07:12 -0400, Owen Taylor wrote:
> In preparation for implementing the clipping TODO item, I went
> back through the details in written things up in a lot of detail here
> with the thought of being able to adapt this for documentation.

Thanks, Owen!

This was clearly a lot of work, and should provide some good text for
the documentation.

> The main interesting thing in this beyond what was discussed before
> is the discussion of SATURATE. I make the the case below that we
> want to use:
> 
>  dest' = (source IN clip) SATURATE dest
> 
> even though that *does not* exactly match the revised clipping 
> equation:
> 
>  dest' = ((source OP dest) IN clip) ADD (dest OUT clip)

This will make the equation somewhat of a bear to document. Hopefully
most people will be happy with the hand-waving:

	dest' = (source IN clip) OP dest
	inside the clip, and dest is unaffected outside the clip

and then we'll have all the math in the appendix.

I'll jump to your arguments now:

>  - It almost matches; we only get minor deviations with half-occupied
>    pixels at the edge of the clipping shape.

Right. It satisfies my hand-waving version of the equation for clip
alpha==1.0 and clip alpha==0.0 and this is certainly a prerequisite for
consideration.

>  - Performance; most of the other operations where we have to
>    fall back to full complex equation are unusual; SATURATE is
>    intended to be used as a base rendering mode.

Hmm.... not so compelling in and of itself to me.

>  - User expectations; the typical reason to use SATURATE is to 
>    avoid seams between antialiased shapes. It seems unexpected
>    to not get seams between shapes coming from cairo_stroke()
>    or cairo_fill() but to get seams when the shapes come from
>    cairo_clip().

This is the big one I think. The SATURATE operator is a very special
operator, and even without going through all the math it's quite clear
that the simple equation:

	dest' = (source IN clip) SATURATE dest

is saturating something into the destination, while the complex
equation:

	dest' = ((source SATURATE dest) IN clip) ADD (dest OUT clip)

is doing something else.

And with all your math it's plain that "something else" is not
equivalent to saturating into the destination.

I think I would be less happy about making an exception for the
behavior of SATURATE here if the behavior of SATURATE weren't already
so exceptional.

I'm looking forward to the implementation.

Thanks again,

-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/20050805/0db67e16/attachment.pgp


More information about the cairo mailing list