[4/8] gdiplus: semistub implementation of GdipGetimageFormat (for bug 13267)

Nikolay Sivov bunglehead at gmail.com
Mon Jun 23 16:57:02 CDT 2008


Changelog:
    - Implemented GdipGetImageRawFormat

---
 dlls/gdiplus/image.c     |   38 ++++++++++++++++++++++++++++++++++----
 include/gdiplusimaging.h |   14 +++++++++++++-
 2 files changed, 47 insertions(+), 5 deletions(-)

diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index 330e54b..8bf3fe3 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -28,6 +28,7 @@
 #include "olectl.h"
 #include "ole2.h"
 
+#include "initguid.h"
 #include "gdiplus.h"
 #include "gdiplus_private.h"
 #include "wine/debug.h"
@@ -585,17 +586,46 @@ GpStatus WINGDIPAPI GdipGetImagePixelFormat(GpImage *image, PixelFormat *format)
     return Ok;
 }
 
+/* FIXME: partial stub - GIF, JPEG, EXIF, TIFF, PNG, MemoryDMP not detected */
 GpStatus WINGDIPAPI GdipGetImageRawFormat(GpImage *image, GUID *format)
 {
-    static int calls;
+    short type;
+    GUID fmt;
+
+    FIXME("(%p %p) - patial stub\n",image,format);
 
     if(!image || !format)
         return InvalidParameter;
+    
+    if(!(image->picture))
+        return InvalidParameter;
 
-    if(!(calls++))
-        FIXME("not implemented\n");
+    if(IPicture_get_Type(image->picture, &type) == S_OK){
+        switch (type) {
+        case PICTYPE_UNINITIALIZED:
+        case PICTYPE_NONE:
+                fmt = ImageFormatUndefined;
+                break;
+        case PICTYPE_BITMAP:
+                fmt = ImageFormatBMP;
+                break;
+        case PICTYPE_METAFILE:
+                fmt = ImageFormatWMF;
+                break;
+        case PICTYPE_ICON:
+                fmt = ImageFormatIcon;
+                break;
+        case PICTYPE_ENHMETAFILE:
+                fmt = ImageFormatEMF;
+                break;
+        }/* switch */
+
+        *format = fmt;
 
-    return NotImplemented;
+        return Ok;
+    }
+    else
+        return InvalidParameter;
 }
 
 GpStatus WINGDIPAPI GdipGetImageType(GpImage *image, ImageType *type)
diff --git a/include/gdiplusimaging.h b/include/gdiplusimaging.h
index 00ed3d1..227ba91 100644
--- a/include/gdiplusimaging.h
+++ b/include/gdiplusimaging.h
@@ -15,10 +15,22 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
-
 #ifndef _GDIPLUSIMAGING_H
 #define _GDIPLUSIMAGING_H
 
+/* Image type GUIDs */
+DEFINE_GUID(ImageFormatUndefined, 0xb96b3ca9,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
+DEFINE_GUID(ImageFormatMemoryBMP, 0xb96b3caa,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
+DEFINE_GUID(ImageFormatBMP, 0xb96b3cab,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
+DEFINE_GUID(ImageFormatEMF, 0xb96b3cac,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
+DEFINE_GUID(ImageFormatWMF, 0xb96b3cad,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
+DEFINE_GUID(ImageFormatJPEG, 0xb96b3cae,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
+DEFINE_GUID(ImageFormatPNG, 0xb96b3caf,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
+DEFINE_GUID(ImageFormatGIF, 0xb96b3cb0,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
+DEFINE_GUID(ImageFormatTIFF, 0xb96b3cb1,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
+DEFINE_GUID(ImageFormatEXIF, 0xb96b3cb2,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
+DEFINE_GUID(ImageFormatIcon, 0xb96b3cb5,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
+
 enum ImageLockMode
 {
     ImageLockModeRead           = 1,
-- 
1.4.4.4






More information about the wine-patches mailing list