Open BusFactor1Inc opened 6 years ago
Do you have any questions about what I'm trying to accomplish with this program?
You need to somehow hack in the fill and style. They are stored in the current attribute. This might work, you need to call it before addShape():
NSVGattrib* attr = nsvg__getAttr(parser);
attr->strokeColor = NSVG_RGB(255,0,0);
attr->strokeOpacity = 1.0f;
attr-> strokeWidth = 1.0f;
attr->hasStroke = 1;
Take a look at what gets set when a style is parsed: https://github.com/memononen/nanosvg/blob/master/src/nanosvg.h#L1710
and default values are set here (i.e. default render style is black fill): https://github.com/memononen/nanosvg/blob/master/src/nanosvg.h#L624
:+1: thanks. I'll give it a try.
Still can't get anything in the image after filling those and a few more attrs (visibility, opacity).
Nothing seems to be working.
I cannot think of anything else on top of my head without spending some time in debugger and test app (sorry, don't have that time to spare right now). A kludge would be to make your program output an SVG in a string (yeah, I know!) and parse that and pass the results to the rasterizer.
I have thought about adding html canvas like API to the rendering backend, but I just have not had the time to do that.
:+1: If anything a simple test program that just drew an X on the image would suffice. I know I"m just missing something simple. Thanks for your help so far.
Because in nsvg__appPath
if (p->npts < 4)
return;
You have two points.
I'm trying to programmatically render some images using the lower level functions, but I'm to seeing anything in the resulting image. I can't seem to find explicit 'stroke' or 'fill' functions; is there something I'm missing to get something to actually show on the image?
The included 'graphics' file is:
This is the resulting image: