Nikolay Sivov : gdiplus: Implemented GdipCreateBitmapFromResource.

Alexandre Julliard julliard at winehq.org
Thu Jul 17 06:37:45 CDT 2008


Module: wine
Branch: master
Commit: d8a25fc26c3eb3abdebbf9fbf8d0f0cbfe036e35
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d8a25fc26c3eb3abdebbf9fbf8d0f0cbfe036e35

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Sat Jul 12 00:43:50 2008 +0400

gdiplus: Implemented GdipCreateBitmapFromResource.

---

 dlls/gdiplus/gdiplus.spec |    2 +-
 dlls/gdiplus/image.c      |   20 ++++++++++++++++++++
 include/gdiplusflat.h     |    1 +
 3 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index 6b794a1..07bd6ed 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -77,7 +77,7 @@
 @ stdcall GdipCreateBitmapFromGraphics(long long ptr ptr)
 @ stdcall GdipCreateBitmapFromHBITMAP(long long ptr)
 @ stub GdipCreateBitmapFromHICON
-@ stub GdipCreateBitmapFromResource
+@ stdcall GdipCreateBitmapFromResource(long wstr ptr)
 @ stdcall GdipCreateBitmapFromScan0(long long long long ptr ptr)
 @ stdcall GdipCreateBitmapFromStream(ptr ptr)
 @ stdcall GdipCreateBitmapFromStreamICM(ptr ptr)
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index d2ce074..25a5c4d 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -318,6 +318,26 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromFileICM(GDIPCONST WCHAR* filename,
     return GdipCreateBitmapFromFile(filename, bitmap);
 }
 
+GpStatus WINGDIPAPI GdipCreateBitmapFromResource(HINSTANCE hInstance,
+    GDIPCONST WCHAR* lpBitmapName, GpBitmap** bitmap)
+{
+    HBITMAP hbm;
+    GpStatus stat = InvalidParameter;
+
+    if(!lpBitmapName || !bitmap)
+        return InvalidParameter;
+
+    /* load DIB */
+    hbm = (HBITMAP)LoadImageW(hInstance,lpBitmapName,IMAGE_BITMAP,0,0,LR_CREATEDIBSECTION);
+
+    if(hbm){
+        stat = GdipCreateBitmapFromHBITMAP(hbm, NULL, bitmap);
+        DeleteObject(hbm);
+    }
+
+    return stat;
+}
+
 GpStatus WINGDIPAPI GdipCreateHBITMAPFromBitmap(GpBitmap* bitmap,
     HBITMAP* hbmReturn, ARGB background)
 {
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index ef65b05..b2ca34b 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -336,6 +336,7 @@ 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 GdipCreateBitmapFromResource(HINSTANCE,GDIPCONST WCHAR*,GpBitmap**);
 GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT,INT,INT,PixelFormat,BYTE*,
     GpBitmap**);
 GpStatus WINGDIPAPI GdipCreateBitmapFromStream(IStream*,GpBitmap**);




More information about the wine-cvs mailing list