memononen / nanosvg

Simple stupid SVG parser
zlib License
1.69k stars 360 forks source link

Pixel format #79

Open sebopop opened 7 years ago

sebopop commented 7 years ago

Hi!

First, thanks for sharing!

I'd like to use nanosvg for a hobby OS, and tried it on a linux framebuffer, which happens to use a BGRA format. Could you add, if not a runtime option, at least a compile time option? Or should i make a pull request?

I also noticed some svg being misrendered in a framebuffer but rendered fine a png, does that makes sense to you?

Thanks!

Cultrarius commented 7 years ago

I think you can redefine the color code at compile time here: https://github.com/memononen/nanosvg/blob/master/src/nanosvg.h#L196

So it should work if you use #define NSVG_RGB(r, g, b) (((unsigned int)b) | ((unsigned int)g << 8) | ((unsigned int)r << 16))

SergeySlice commented 6 years ago

+1