I tried converting SVG to HBITMAP using NanoSVG. Everything works fine but the color of the Bitamp or saved png is different then the original svg. Please help me to fix this
I tried below code
// Load the SVG file
NSVGimage* image = nsvgParseFromFile(filename, "px", 96);
// Create a bitmap with the same dimensions as the SVG image
BITMAPINFO bmpinfo = { 0 };
bmpinfo.bmiHeader.biSize = sizeof(bmpinfo.bmiHeader);
bmpinfo.bmiHeader.biWidth = static_cast<LONG>(image->width);
bmpinfo.bmiHeader.biHeight = -static_cast<LONG>(image->height);
bmpinfo.bmiHeader.biPlanes = 1;
bmpinfo.bmiHeader.biBitCount = 32;
bmpinfo.bmiHeader.biCompression = BI_RGB;
void* bits = nullptr;
HBITMAP hbitmap = CreateDIBSection(NULL, &bmpinfo, DIB_RGB_COLORS, &bits, nullptr, 0);
// Render the SVG image to the bitmap
NSVGrasterizer* rast = nsvgCreateRasterizer();
nsvgRasterize(rast, image, 0, 0, 1, (unsigned char*)bits, static_cast<int>(image->width), static_cast<int>(image->height), static_cast<int>(image->width * 4));
nsvgDeleteRasterizer(rast);
// Clean up
nsvgDelete(image);