[cairo] Adding cairo_shear and family

Paolo Bonzini bonzini at gnu.org
Mon Jan 12 00:14:15 PST 2009

Bill Spitzak wrote:
> It might make more sense to make the call do the composite operation 
> that preserves area:
> [1+sx*sy sx]
> [sy 1+sx*sy]
> Note that if either sx or sy are zero then it is the same as the 
> proposed call.

I like this.  But the composite operation that preserves area is

[sqrt(1+sx*sy)   sx
 sy              sqrt(1+sx*sy]

whose determinant is 1.  Your matrix has determinant sx^2 sy^2+sx sy+1.

For example, with this matrix

  cairo_shear (cr, sin(a), -sin(a));

would be the same as cairo_rotate (cr, a) for angle between -90 and 90:

[sqrt(1-sin^2 a)  sin a                   [cos a    sin a
 -sin a           sqrt(1-sin^2 a)]   =     -sin a   cos a]


More information about the cairo mailing list