How to convert graphics to bitmap? in GDI+?
If I comment the line with GdipCreateBitmapFromGraphics, it will save the pucture.
If I use the command GdipCreateBitmapFromGraphics, the image is black, no picture there.
Why the GdipCreateBitmapFromGraphics command does not do what I expect to do?
In every line the result is 0 when debugging.
always creates blank image
Code:
GpGraphics * pG; // pBitmap already contains image/picture
result = Gdiplus::DllExports::GdipGetImageGraphicsContext(pBitmap, &pG);
CLSID pngClsid;
GetEncoderClsid(L"image/png", &pngClsid);
GpBitmap* pBitmap2;
result = Gdiplus::DllExports::GdipCreateBitmapFromGraphics(60, 60, pG, &pBitmap2);
result = Gdiplus::DllExports::GdipSaveImageToFile(pBitmap2, L"justest.png", &pngClsid, NULL); // last voluntary? GDIPCONST EncoderParameters* encoderParams
If I use the command GdipCreateBitmapFromGraphics, the image is black, no picture there.
Why the GdipCreateBitmapFromGraphics command does not do what I expect to do?
In every line the result is 0 when debugging.
Code:
result = Gdiplus::DllExports::GdipCreateBitmapFromGraphics(60, 60, pG, &pBitmap2);
Last edited: