Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

converting a Gdiplus::Bitmap to DIB

542 views
Skip to first unread message

louis hendrix

unread,
Apr 9, 2003, 11:41:59 PM4/9/03
to
How do you get to BITMAP::bmBits from a GDI+ Bitmap object ?

Tried the following (pseudo code, but you get the idea):

Gdiplus::Bitmap* image = Bitmap::FromStream(aPNGStream);
image->LockBits(...)
result bitmapData->Scan0, looked like it was intialized to green 0x00
0x00 0xff 0x00. (argb)

Then tried something like :

using namespace Gdiplus;
HBITMAP bm = NULL;
Color bgc;
Bitmap* image = Bitmap::FromStream(aPNGStream);
image->GetHBITMAP(bgc, &bm);

DIBSECTION dibSec;
memset(&dibSec, 0, sizeof(DIBSECTION));
GetObject(bm, sizeof(DIBSECTION), &dibSec);

and got same result.
is there any way to convert a Gdiplus::Bitmap to a DIB ?

John Hornick [MSFT]

unread,
Apr 10, 2003, 11:03:18 AM4/10/03
to
Hi,


LockBits() will get you the DIB format bits, then you just add
a BITMAPINFO and you'll have a DIB.

Thanks,
- John
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
Visit http://www.microsoft.com/security for current information on security.

0 new messages