Author: spouliot
Date: 2007-04-26 11:41:22 -0400 (Thu, 26 Apr 2007)
New Revision: 76342

Modified:
   trunk/libgdiplus/src/ChangeLog
   trunk/libgdiplus/src/metafile.c
   trunk/libgdiplus/src/metafile.h
Log:
2007-04-26  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * metafile.c|h: Add delegate-based GdipRecordMetafile... functions 
        to replace the IStream COM based functions outside of Windows.



Modified: trunk/libgdiplus/src/ChangeLog
===================================================================
--- trunk/libgdiplus/src/ChangeLog      2007-04-26 15:39:41 UTC (rev 76341)
+++ trunk/libgdiplus/src/ChangeLog      2007-04-26 15:41:22 UTC (rev 76342)
@@ -1,3 +1,8 @@
+2007-04-26  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * metafile.c|h: Add delegate-based GdipRecordMetafile... functions 
+       to replace the IStream COM based functions outside of Windows.
+
 2007-04-26  Sebastien Pouliot  <[EMAIL PROTECTED]> 
 
        * gifcodec.c: Add image.h so we can build (stubs) without libgif

Modified: trunk/libgdiplus/src/metafile.c
===================================================================
--- trunk/libgdiplus/src/metafile.c     2007-04-26 15:39:41 UTC (rev 76341)
+++ trunk/libgdiplus/src/metafile.c     2007-04-26 15:41:22 UTC (rev 76342)
@@ -1707,20 +1707,60 @@
        return GdipRecordMetafileFileName (fileName, referenceHdc, type, 
(GDIPCONST GpRectF*) &rect, frameUnit, description, metafile);
 }
 
+/*
+ * GdipRecordMetafileStream and GdipRecordMetafileStreamI will never be 
implemented, as 'stream' is a COM IStream ...
+ */
 GpStatus
 GdipRecordMetafileStream (void /* IStream */ *stream, HDC referenceHdc, 
EmfType type, GDIPCONST GpRectF *frameRect, 
        MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile 
**metafile)
 {
-       /* note: we do not support the COM-based IStream functions */
        return NotImplemented;
-       /* TODO: add delegate-based function */
 }
 
 GpStatus
 GdipRecordMetafileStreamI (void /* IStream */ *stream, HDC referenceHdc, 
EmfType type, GDIPCONST GpRect *frameRect, 
        MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile 
**metafile)
 {
-       /* note: we do not support the COM-based IStream functions */
        return NotImplemented;
-       /* TODO: add delegate-based function */
 }
+/*
+ * instead we'll use delegates to create the metafile header with these 
functions
+ */
+GpStatus 
+GdipRecordMetafileFromDelegate_linux (GetHeaderDelegate getHeaderFunc, 
GetBytesDelegate getBytesFunc,
+       PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate 
closeFunc, SizeDelegate sizeFunc, 
+       HDC referenceHdc, EmfType type, GDIPCONST GpRectF *frameRect, 
+       MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile 
**metafile)
+{
+       GpStatus status;
+
+       if (!putBytesFunc)
+               return InvalidParameter;
+
+       status = GdipRecordMetafile (referenceHdc, type, frameRect, frameUnit, 
description, metafile);
+       if (status != Ok)
+               return status;
+
+       /* TODO - keep delegates around to write stuff */
+
+       return Ok;
+}
+
+GpStatus 
+GdipRecordMetafileFromDelegateI_linux (GetHeaderDelegate getHeaderFunc, 
GetBytesDelegate getBytesFunc,
+       PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate 
closeFunc, SizeDelegate sizeFunc, 
+       HDC referenceHdc, EmfType type, GDIPCONST GpRect *frameRect, 
+       MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile 
**metafile)
+{
+       GpRectF rect;
+
+       if (!frameRect)
+               return InvalidParameter;
+
+       rect.X = frameRect->X;
+       rect.Y = frameRect->Y;
+       rect.Width = frameRect->Width;
+       rect.Height = frameRect->Height;
+       return GdipRecordMetafileFromDelegate_linux (getHeaderFunc, 
getBytesFunc, putBytesFunc, seekFunc, closeFunc, sizeFunc,
+               referenceHdc, type, (GDIPCONST GpRectF*) &rect, frameUnit, 
description, metafile);
+}

Modified: trunk/libgdiplus/src/metafile.h
===================================================================
--- trunk/libgdiplus/src/metafile.h     2007-04-26 15:39:41 UTC (rev 76341)
+++ trunk/libgdiplus/src/metafile.h     2007-04-26 15:41:22 UTC (rev 76342)
@@ -106,4 +106,15 @@
 GpStatus GdipRecordMetafileStreamI (void /* IStream */ *stream, HDC 
referenceHdc, EmfType type, GDIPCONST GpRect *frameRect,
        MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile 
**metafile);
 
+/* extra public (exported) functions in libgdiplus to replace the IStream 
(COM-based) ones available on Windows */
+
+GpStatus GdipRecordMetafileFromDelegate_linux (GetHeaderDelegate 
getHeaderFunc, GetBytesDelegate getBytesFunc,
+       PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate 
closeFunc, SizeDelegate sizeFunc, HDC referenceHdc, 
+       EmfType type, GDIPCONST GpRectF *frameRect, MetafileFrameUnit 
frameUnit, GDIPCONST WCHAR *description, 
+       GpMetafile **metafile);
+GpStatus GdipRecordMetafileFromDelegateI_linux (GetHeaderDelegate 
getHeaderFunc, GetBytesDelegate getBytesFunc,
+       PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate 
closeFunc, SizeDelegate sizeFunc, HDC referenceHdc, 
+       EmfType type, GDIPCONST GpRect *frameRect, MetafileFrameUnit frameUnit, 
GDIPCONST WCHAR *description, 
+       GpMetafile **metafile);
+
 #endif

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to