sammycage / lunasvg

SVG rendering and manipulation library in C++
MIT License
866 stars 124 forks source link

Local transformations and high-level function capable of simplifying some tasks #163

Open rossanoparis opened 6 months ago

rossanoparis commented 6 months ago

I noticed a commit [ Add getBBox and getLocalTransform ]

Which mentions local and absolute transformations, transformations stand for rotation scale and so on? How it works?

Another inquiry I'd like to address pertains to the attached object, which serves as an example of what I mean. Could you suggest an easy method, or perhaps implement a feature in your library capable of changing the primary color to another?

For instance, the main color of the attached object is currently green. However, if I wish to change it to red, the process becomes complex, requiring digging into the SVG structure to locate and modify relevant IDs. While this is not necessarily a problem, it would be advantageous to have a high-level function capable of simplifying this task

attached object glossy-green-button.zip

sammycage commented 6 months ago

After examining the attached file, I found out that the "main color" is not a solid color; rather, it is a gradient consisting of multiple stops across multiple elements. Similarly, the transform matrix is complex and will be very difficult to change with just one line of code. If you wish to manipulate SVG, it is essential to study the file carefully. It would be better if the file were made by hand.

sammycage commented 5 months ago

@rossanoparis https://github.com/sammycage/lunasvg/issues/98#issuecomment-2050589919