ajstarks / openvg

Tools for exploring OpenVG
Other
414 stars 85 forks source link

Move scaling origin point ? #58

Closed natinusala closed 6 years ago

natinusala commented 7 years ago

When I scale a shape by using Scale(scale_factor, scale_factor);, it also moves the shape from its initial position. It looks like the scale origin point is (0,0).

How can I put the scale origin point to the shape's center without doing heavy computations ? I've found that I can Translate(-scale_factor*shape_width, -scale_factor*shape_height); but I don't find it very elegant.

Thanks :)

dir-ableton commented 7 years ago

This is the way to do it. OpenVG as well as OpenVG require you to think in different coordinate systems, and require you to apply rotations/translations in chained ways.