[cairo] Gradient Transformation Problems

MenTaLguY mental at rydia.net
Wed Dec 12 16:27:00 PST 2007


On Wed, 12 Dec 2007 14:24:55 -0800, Me Myself <radracer59 at inbox.com> wrote:
> The user will be able to directly edit the points of the path, so it would
> not make sense to present the user with untransformed points.

In Inkscape, we store the untransformed points, but transform the points
before passing them to the user, and reverse the transformation when
processing user input.
 
> Although, I don't think I understand exactly why it isn't possible to do
> this (but I'm no math guru). Given the slope of a linear gradient, and a X
> and Y scale factor, shouldn't I be able to replicate the same slope with
> scaled points?

More or less, but when you try to represent those things as two gradient
points, you end up throwing some of that information away.  The affine
transformations you're having trouble with are the ones that change the
angle between the line joining the two points and the lines which mark
each limit of the gradient.  After a transformation they may no longer
be at 90 degree angles:

    /
  A/
  /\ 
 /  \ 
     \  /
      \/
      /B
     /

-mental



More information about the cairo mailing list