Skip to content

Commit

Permalink
2007-04-26 Sebastien Pouliot <sebastien@ximian.com>
Browse files Browse the repository at this point in the history
	* 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
Sebastien Pouliot committed Apr 26, 2007
1 parent f778698 commit 210fbf8
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 4 deletions.
5 changes: 5 additions & 0 deletions 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
Expand Down
48 changes: 44 additions & 4 deletions src/metafile.c
Expand Up @@ -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);
}
11 changes: 11 additions & 0 deletions src/metafile.h
Expand Up @@ -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.