<div dir="ltr">your correct, translating fixes it. Thanks.<br><div><div><div><div><br>...<br>cairo_matrix_init(<br> &matrix,<br> 1.0, 0.0,<br> skewx, 1.0,<br> <span style="color:rgb(0,0,255)">10.0, 10.0</span>);<br>cairo_transform(cr, &matrix);<br>cairo_rectangle(cr, <span style="color:rgb(0,0,255)">0., 0.</span>, 50., 50.);<br>cairo_translate(cr, -10., -10.);<br>...<br><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 10, 2016 at 10:45 PM, Lawrence D'Oliveiro <span dir="ltr"><<a href="mailto:ldo@geek-central.gen.nz" target="_blank">ldo@geek-central.gen.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, 10 Feb 2016 21:38:30 -0700, Mark Olesen wrote:<br>
<br>
> When skewing in the x direction, top x seems to move to the right a<br>
> bit.<br>
</span><span class="">> /*<br>
> <a href="http://cairographics.org/cookbook/matrix_transform/http://cairographics.org/cookbook/matrix_transform/" rel="noreferrer" target="_blank">http://cairographics.org/cookbook/matrix_transform/http://cairographics.org/cookbook/matrix_transform/</a><br>
> Lets take that C = math.cos(A), S = math.sin(A), T = math.tan(A)<br>
> X-skew by A -- mtrx = cairo.Matrix(1,0,T,1,0,0)<br>
> Y-skew by A -- mtrx = cairo.Matrix(1,T,0,1,0,0)<br>
> */<br>
<br>
</span>These skew formulas apply about the origin. Therefore for skew along<br>
X, only points on the line through Y = 0 remain unaffected, while for<br>
skew along Y, only the line through X = 0 remains unaffected.<br>
<span class=""><br>
> cairo_matrix_init(<br>
> &matrix,<br>
> 1.0, 0.0,<br>
> skewx, 1.0,<br>
> 0.0, 0.0);<br>
> cairo_transform(cr, &matrix);<br>
> cairo_rectangle(cr, 10., 10., 50., 50.);<br>
<br>
</span>Your rectangle is offset from Y = 0, which is why the whole thing gets<br>
skewed.<br>
<br>
If you want a more general skew formula with a stationary line somewhere<br>
other than at the origin, you can compose it out of the basic skew<br>
formula combined with additional translations as described here<br>
<<a href="http://cairographics.org/cookbook/transform_about_point/" rel="noreferrer" target="_blank">http://cairographics.org/cookbook/transform_about_point/</a>>.<br>
<span class="HOEnZb"><font color="#888888">--<br>
cairo mailing list<br>
<a href="mailto:cairo@cairographics.org">cairo@cairographics.org</a><br>
<a href="https://lists.cairographics.org/mailman/listinfo/cairo" rel="noreferrer" target="_blank">https://lists.cairographics.org/mailman/listinfo/cairo</a></font></span></blockquote></div><br></div>