androidsvg icon indicating copy to clipboard operation
androidsvg copied to clipboard

Feature pull request: Mutable SVG object in runtime

Open wonson opened this issue 10 years ago • 4 comments

I modify your code to make the SVG mutable, Including:

  • public your svg tag classes and value type class (user may new and modify from outside)
  • add saveSVGState and restoreSVGState (like push and pop), restoreOriginalSVGState (Like openGL load identity) etc.

Please take a look.

I followed you from GoogleCode. You said you will parse it to DOM-tree, I dunno if it is still on. But may be you can accept this first and let people do these things first. After you finish the DOM-tree implementation, you can level up your version to 2.x.x

wonson avatar Oct 13 '15 17:10 wonson

Hi. Thanks for posting this. This is an interesting patch. I'm curious how you are using these changes yourself. What is it enabling you to do that you couldn't do before?

BigBadaboom avatar Oct 14 '15 06:10 BigBadaboom

I have 2 major usage:

  • Change color in runtime
  • Draw only specified group with "display" attribute (so that I can draw sprite with common in different frame. Imagine that how u make a gif animation by enabling various layers in different frame)

After the change is set, I render the SVG object into picture, then restore original SVG state and the another change, and so on.

wonson avatar Oct 14 '15 06:10 wonson

But the code is not thoroughly tested. I only use it with some tags I've used. You'd better test the code more with your own test case. :P

wonson avatar Oct 14 '15 06:10 wonson

This is definitely stale, but it would still be a useful feature. CSS customization is an option, but a very limited one. Mutable SVG objects could potentially provide much more flexibiltiy, along with a more natural programmatic way of doing so (as opposed to css strings).

ultimate-deej avatar Jun 03 '20 17:06 ultimate-deej