memononen / nanosvg

Simple stupid SVG parser
zlib License
1.71k stars 363 forks source link

outlines don’t draw properly #226

Closed ColleagueRiley closed 2 years ago

ColleagueRiley commented 2 years ago

I have a simple SVG file (included), that draws a transparent rect with a red stroke, making a rectangle outline. For some reason when I load it it draws the outline on a gray rect.

image = nsvgParseFromFile("rect.svg", "px", 96);

rast = nsvgCreateRasterizer(); // create rasterzing object for "flattening"

unsigned char* img = (unsigned char*)malloc(rect.w*rect.h*4); // make data with room for the image

nsvgRasterize(rast, image, 0,0,1, img, w, h, w*4); // load the flattened image into 

rect Screenshot_2022-09-12_22-28-11

ColleagueRiley commented 2 years ago

Changing fill="transparent" to fill-opacity="0"

fixes the problem