Please try the following code that takes SVG vector file then saves it as PNG file with alpha.
+==================================================+
L_INT nRet;
LVectorBase Vector;
RECT VecRect;
VecRect.left = 0;
VecRect.top = 0;
VecRect.right = 400;
VecRect.bottom = 400;
nRet = Vector.Load(L"C:\\BrightIdea.svg");
if(nRet != SUCCESS)
{
AfxMessageBox(L"Failed to Load SVG Image");
}
nRet = Vector.AttachToWindow(m_hWnd);
nRet = Vector.SetViewport(&VecRect);
nRet = Vector.GetViewport(&VecRect);
LBitmapBase TempBitmap( 400 , 400, 24, ORDER_BGR, NULL, TOP_LEFT,RGB(255,105,180));
HDC TempDC = TempBitmap.CreateLeadDC();
nRet = Vector.Paint(TempDC,FALSE);
TempBitmap.DeleteLeadDC(TempDC);
LBitmapBase MainBitmap(400 , 400, 24, ORDER_BGR, NULL, TOP_LEFT,RGB(255,105,180));
nRet = MainBitmap.Copy(TempBitmap);
LBitmapRgn Region(&TempBitmap);
nRet =Region.SetRgnColor(RGB(0,0,0));
TempBitmap.Fill(RGB(255,255,255));
Region.Free();
nRet =Region.SetRgnColor(RGB(255,105,180));
TempBitmap.Fill(RGB(0,0,0));
Region.Free();
nRet = TempBitmap.GrayScale(8);
nRet = MainBitmap.ColorRes(32);
nRet = MainBitmap.SetAlpha(TempBitmap);
nRet = MainBitmap.Save(L"c:\\FinalRes.png",FILE_PNG,32,2,0,NULL);
+==================================================+
Mohamed Abedallah
Developer Support Engineer
LEAD Technologies, Inc.