openfl / svg

Provides SVG parsing and rendering for OpenFL and Haxe
MIT License
68 stars 30 forks source link

without openfl #67

Open cancerberoSgx opened 5 years ago

cancerberoSgx commented 5 years ago

Is it possible to use it without openfl since it's huge dependency for those using it in command line applications ? Can't it render to a RGBA 8-bit depth or similar image bitmap (in a type like Bytes) for example ? User is responsible to convert it to any image format he needs. This way the library get's agnostic from output format too which is more flexible, even for openfl users. Thanks

jgranick commented 5 years ago

I'd be happy to include a pull request that makes the dependency optional.

The easy way to do it is to wrap specific code sections with #if openfl ... #end in order to make them active only if the OpenFL library is included

EliteMasterEric commented 2 years ago

The the part of outputting the image to a bitmap, that appears to be done here:

https://github.com/openfl/svg/blob/5842f1c636c848e31ef9f72b5962bf78a6611b21/format/svg/SVGRenderer.hx#L66

Adding a public method to the main Svg class that merely returns the result of this rather than outputting to a Graphics object would be convenient.