gdiplus: Partial implementation of GdipCreateBitmapFromGdiDib.

This commit is contained in:
Huw Davies 2008-07-10 15:39:29 +01:00 committed by Alexandre Julliard
parent fc1a1f66ee
commit b2ebf709ff
3 changed files with 43 additions and 1 deletions

View File

@ -73,7 +73,7 @@
@ stub GdipCreateBitmapFromDirectDrawSurface
@ stdcall GdipCreateBitmapFromFile(wstr ptr)
@ stdcall GdipCreateBitmapFromFileICM(wstr ptr)
@ stub GdipCreateBitmapFromGdiDib
@ stdcall GdipCreateBitmapFromGdiDib(ptr ptr ptr)
@ stdcall GdipCreateBitmapFromGraphics(long long ptr ptr)
@ stdcall GdipCreateBitmapFromHBITMAP(long long ptr)
@ stub GdipCreateBitmapFromHICON

View File

@ -270,6 +270,47 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromFile(GDIPCONST WCHAR* filename,
return stat;
}
GpStatus WINGDIPAPI GdipCreateBitmapFromGdiDib(GDIPCONST BITMAPINFO* info,
VOID *bits, GpBitmap **bitmap)
{
DWORD height, stride;
PixelFormat format;
FIXME("(%p, %p, %p) - partially implemented\n", info, bits, bitmap);
height = abs(info->bmiHeader.biHeight);
stride = ((info->bmiHeader.biWidth * info->bmiHeader.biBitCount + 31) >> 3) & ~3;
if(info->bmiHeader.biHeight > 0) /* bottom-up */
{
bits = (BYTE*)bits + (height - 1) * stride;
stride = -stride;
}
switch(info->bmiHeader.biBitCount) {
case 1:
format = PixelFormat1bppIndexed;
break;
case 4:
format = PixelFormat4bppIndexed;
break;
case 8:
format = PixelFormat8bppIndexed;
break;
case 24:
format = PixelFormat24bppRGB;
break;
default:
FIXME("don't know how to handle %d bpp\n", info->bmiHeader.biBitCount);
*bitmap = NULL;
return InvalidParameter;
}
return GdipCreateBitmapFromScan0(info->bmiHeader.biWidth, height, stride, format,
bits, bitmap);
}
/* FIXME: no icm */
GpStatus WINGDIPAPI GdipCreateBitmapFromFileICM(GDIPCONST WCHAR* filename,
GpBitmap **bitmap)

View File

@ -332,6 +332,7 @@ GpStatus WINGDIPAPI GdipConvertToEmfPlusToFile(const GpGraphics*,GpMetafile*,INT
GpStatus WINGDIPAPI GdipConvertToEmfPlusToStream(const GpGraphics*,GpMetafile*,INT*,IStream*,EmfType,const WCHAR*,GpMetafile**);
GpStatus WINGDIPAPI GdipCreateBitmapFromFile(GDIPCONST WCHAR*,GpBitmap**);
GpStatus WINGDIPAPI GdipCreateBitmapFromFileICM(GDIPCONST WCHAR*,GpBitmap**);
GpStatus WINGDIPAPI GdipCreateBitmapFromGdiDib(GDIPCONST BITMAPINFO*,VOID*,GpBitmap**);
GpStatus WINGDIPAPI GdipCreateBitmapFromGraphics(INT,INT,GpGraphics*,GpBitmap**);
GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT,INT,INT,PixelFormat,BYTE*,
GpBitmap**);