-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update / rewrite of the ofxSvg addon to remove dependency on libTinySvg and libxml2. #8266
base: master
Are you sure you want to change the base?
Conversation
This issue on windows might make the argument for ofxSvgEllipse instead of ofx::svg::Ellipse
|
Fantastic @NickHardeman let me know when it is ready to test and I can test with a lot of SVGs from previous projects here |
Great, will do. I can also send a test app that loads an svg from a folder, saves it and reloads the saved one. Arrow keys to change index and load again in the directory. |
@dimitre I think it's ready for some testing now that it's passed the checks. Attached is a quick app for testing loading, saving and loading the saved svgs. The svgs in the folder are from https://www.svgviewer.dev and are just for testing complex paths. |
Great I've just seen now and tested some things. I'm testing with a very crude set of svgs and will report some things. |
@dimitre thank you for trying it out. I have fixed some of the fill issues that you mentioned. |
Proposing this update to ofxSvg with the following implementation based on my ofx::svg::Parser addon (https://github.com/NickHardeman/ofxSvgParser).
This rewrite adds the following functionality:
Loading of elements with search functionality
Remove libtinysvg and libxml2 dependencies. The parsing is happening in the ofxSvg class ( it took a while getting through the spec on paths :0 and parsing/writing CSS manually ;) )
Add elements to the document
Save the document after loading or adding / removing elements.
Works with the current ofxSvg example.
Grab a group by passing in the name of the group.
auto logoGroup = svg.get("logo");
Grab nested groups by passing in the hierarchy to the group separated by colons.
auto cloudGroup = svg.get("sky:clouds");
Get all of the elements of a certain type by calling getElementsForType
vector< shared_ptr > trees = svg.getElementsForType("trees");
Currently supports the following types:
Group, Rectangle, Image, Ellipse, Circle, Path, Polygon and Line
Limited Parsing Support ( no adding or saving currently ):
Text
We have been using some version of this for parsing svg in our projects for the last several years. The adding and saving of svgs is not well tested at the moment.
TODO: