[cairo] Gradient Transformation Problems

Carl Worth cworth at cworth.org
Tue Dec 11 13:26:51 PST 2007


On Tue, 11 Dec 2007 12:52:31 -0800, Me Myself wrote:
> The problem I am seeing is that if I take these two shapes and scale
> them (by 0.25, 0.5 in my test) I see a different result than if I
> manually calculate the points to the correct scaled values, without
> using cairo_scale().

That's expected.

> Does anyone have any idea why this is happening?

You can manually adjust the points, yes, like you did. But you also
need to understand that the interpolation of the gradient colors is
also affected by the transformation, and your "manual" case can't
account for this.

Look at your two results and look at the angle of lines of uniform
color in each gradient. In both cases these lines are normal to the
line you used in cairo_pattern_create_linear, but the computation of
"normal" is within user-space, so it is transformed differently in
both cases.

Does that make sense?

-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.cairographics.org/archives/cairo/attachments/20071211/69af15a5/attachment.pgp 


More information about the cairo mailing list