Vincent Povirk <[email protected]> writes: > @@ -2264,6 +2266,41 @@ GpStatus WINGDIPAPI GdipCreateFromHDC2(HDC hdc, HANDLE > hDevice, GpGraphics **gra > if(graphics == NULL) > return InvalidParameter; > > + hbm = GetCurrentObject(hdc, OBJ_BITMAP); > + if (hbm && GetObjectW(hbm, sizeof(dib), &dib) && dib.dsBm.bmBitsPixel == > 32) > + { > + /* Make a bitmap object so we can use the alpha channel */ > + GpBitmap *bitmap; > + DWORD height, stride; > + BYTE *bits; > + > + height = abs(dib.dsBmih.biHeight); > + stride = dib.dsBmih.biWidth * 4; > + > + if(dib.dsBmih.biHeight > 0) /* bottom-up */ > + { > + bits = (BYTE*)dib.dsBm.bmBits + (height - 1) * stride; > + stride = -dib.dsBmih.biWidth * 4; > + } > + else > + bits = dib.dsBm.bmBits; > + > + retval = GdipCreateBitmapFromScan0(dib.dsBmih.biWidth, height, > stride, > + PixelFormat32bppPARGB, bits, > &bitmap);
This won't work, you won't get a negative height with GetObject, and you won't get DIB info at all for DDBs. Also not all DIBs are in PARGB format. -- Alexandre Julliard [email protected]
