Skip to content
Browse files

2007-04-26 Sebastien Pouliot <sebastien@ximian.com>

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


svn path=/trunk/libgdiplus/; revision=76342
  • Loading branch information...
1 parent f778698 commit 210fbf8cb254abea3801ea5358f296c1d41c5805 Sebastien Pouliot committed
Showing with 60 additions and 4 deletions.
  1. +5 −0 src/ChangeLog
  2. +44 −4 src/metafile.c
  3. +11 −0 src/metafile.h
View
5 src/ChangeLog
@@ -1,3 +1,8 @@
+2007-04-26 Sebastien Pouliot <sebastien@ximian.com>
+
+ * metafile.c|h: Add delegate-based GdipRecordMetafile... functions
+ to replace the IStream COM based functions outside of Windows.
+
2007-04-26 Sebastien Pouliot <sebastien@ximian.com>
* gifcodec.c: Add image.h so we can build (stubs) without libgif
View
48 src/metafile.c
@@ -1707,20 +1707,60 @@ GdipRecordMetafileFileNameI (GDIPCONST WCHAR *fileName, HDC referenceHdc, EmfTyp
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);
}
View
11 src/metafile.h
@@ -106,4 +106,15 @@ GpStatus GdipRecordMetafileStream (void /* IStream */ *stream, HDC referenceHdc,
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

0 comments on commit 210fbf8

Please sign in to comment.
Something went wrong with that request. Please try again.