From 8726f5ad2dfd68d385ecf2bc69513fe8d295073d Mon Sep 17 00:00:00 2001 From: Evan Stade Date: Tue, 7 Aug 2007 18:42:04 -0700 Subject: [PATCH] gdiplus: Added GdipCreateBitmapFromFile. --- dlls/gdiplus/gdiplus.spec | 2 +- dlls/gdiplus/image.c | 22 ++++++++++++++++++++++ include/gdiplusflat.h | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index 218990d8cb2..c49a3953fa4 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -71,7 +71,7 @@ @ stub GdipConvertToEmfPlusToStream @ stub GdipCreateAdjustableArrowCap @ stub GdipCreateBitmapFromDirectDrawSurface -@ stub GdipCreateBitmapFromFile +@ stdcall GdipCreateBitmapFromFile(wstr ptr) @ stub GdipCreateBitmapFromFileICM @ stub GdipCreateBitmapFromGdiDib @ stub GdipCreateBitmapFromGraphics diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 59690c59078..da816b85a7b 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -229,6 +229,28 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap, return Ok; } +GpStatus WINGDIPAPI GdipCreateBitmapFromFile(GDIPCONST WCHAR* filename, + GpBitmap **bitmap) +{ + GpStatus stat; + IStream *stream; + + if(!filename || !bitmap) + return InvalidParameter; + + stat = GdipCreateStreamOnFile(filename, GENERIC_READ, &stream); + + if(stat != Ok) + return stat; + + stat = GdipCreateBitmapFromStream(stream, bitmap); + + if(!stat) + IStream_Release(stream); + + return stat; +} + GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, PixelFormat format, BYTE* scan0, GpBitmap** bitmap) { diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 17684191da8..aba71ed287e 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -167,6 +167,7 @@ GpStatus WINGDIPAPI GdipDeleteCustomLineCap(GpCustomLineCap*); GpStatus WINGDIPAPI GdipBitmapGetPixel(GpBitmap*,INT,INT,ARGB*); GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap*,GDIPCONST GpRect*,UINT, PixelFormat,BitmapData*); +GpStatus WINGDIPAPI GdipCreateBitmapFromFile(GDIPCONST WCHAR*,GpBitmap**); GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT,INT,INT,PixelFormat,BYTE*, GpBitmap**); GpStatus WINGDIPAPI GdipCreateBitmapFromStream(IStream*,GpBitmap**);