Re: is skew supposed to move/shift top/left x?

Mark Olesen <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CAExh6bbnMnUOcJ=nNMufac1QQVck3gBc=dgPC6gpCYbQ8fo6-g@mail.gmail.com>
your correct, translating fixes it. Thanks.

...
cairo_matrix_init(
   &matrix,
   1.0, 0.0,
   skewx, 1.0,
   10.0, 10.0);
cairo_transform(cr, &matrix);
cairo_rectangle(cr, 0., 0., 50., 50.);
cairo_translate(cr, -10., -10.);
...


On Wed, Feb 10, 2016 at 10:45 PM, Lawrence D'Oliveiro <
[email protected]> wrote:

> On Wed, 10 Feb 2016 21:38:30 -0700, Mark Olesen wrote:
>
> > When skewing in the x direction, top x seems to move to the right a
> > bit.
> > /*
> >
> http://cairographics.org/cookbook/matrix_transform/http://cairographics.org/cookbook/matrix_transform/
> > Lets take that C = math.cos(A), S = math.sin(A), T = math.tan(A)
> > X-skew by A    --    mtrx = cairo.Matrix(1,0,T,1,0,0)
> > Y-skew by A    --    mtrx = cairo.Matrix(1,T,0,1,0,0)
> > */
>
> These skew formulas apply about the origin. Therefore for skew along
> X, only points on the line through Y = 0 remain unaffected, while for
> skew along Y, only the line through X = 0 remains unaffected.
>
> >   cairo_matrix_init(
> >       &matrix,
> >       1.0, 0.0,
> >       skewx, 1.0,
> >       0.0, 0.0);
> >   cairo_transform(cr, &matrix);
> >   cairo_rectangle(cr, 10., 10., 50., 50.);
>
> Your rectangle is offset from Y = 0, which is why the whole thing gets
> skewed.
>
> If you want a more general skew formula with a stationary line somewhere
> other than at the origin, you can compose it out of the basic skew
> formula combined with additional translations as described here
> <http://cairographics.org/cookbook/transform_about_point/>.
> --
> cairo mailing list
> [email protected]
> https://lists.cairographics.org/mailman/listinfo/cairo

-- 
cairo mailing list
[email protected]
https://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.