GdipCreateBitmapFromScan0 - how to make it own the raw pixel data ?
From
R.Wieser@21:1/5 to
All on Mon Nov 27 12:44:21 2023
Hello all,
I was using GdipCreateBitmapFromScan0 feeding it raw RGBA data, and deleted
the fed data afterward. Than I saved the resulting bitmap to a file.
To my surprise the file was fully empty (and no error!) ...
It looks like that, when I use the above call, I need to keep the raw RGBA
data available - which is quite different as, for example, GdipCreateBitmapFromFile works.
Is there a way to tell GdipCreateBitmapFromScan0 to become owner of the raw RGBA data, so that it, when GdiPDisposeImage is called, /all/ the image data
is discarded (and I do not need to discard the raw RGBA data myself) ?
Remark:
I've found some github sourcecode(?) for the GdipCreateBitmapFromScan0 function, which clarifies the above behaviour. I /could/ hack something together to store (a ptr to) a GdipAlloc-ed block of memory (loaded with the raw pixel data) into the GpBitmap structure, but I would rather not...
Regards,
Rudy Wieser
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)