[Mono-list] Re: IStream implementation on Win32 for System.Drawing.Image.InitFromStream

Kornél Pál kornelpal@hotmail.com
Tue, 10 May 2005 10:21:50 +0200


Hi,

> Could you post the code to the mailing list, so we can comment on it?

I have tried to send the source code several times in the last few day but
it seems to be imposible to send it:

I sent a previous version to Sanjay Gupta and he sent and reply to the list
then I answered it but none of these messages arrived yet, they are waitng
for moderation...

Then I sent a single ZIP file containing the source, it never appeared on
the list.
Finally I sent a message with all the source files attached separately as
plain text but it did not appeared.

Could you tell me what are the moderation and attachment rules of this list?

Previously I have tried to forward at the end of this message my discussion
with Sanjay Gupta but I think this may cause my message to be filtered out.

I uploaded the source code to
http://www1.kornelpal.hu/files/GdiPlusStream.zip
It will be available at least for a week.

Note that as this is Win32 specific (GDI+ and IStream, the code itself not)
you have to run it under Windows.

Comments are welcome.

There is a question about debugging under Mono. If someone has better
solution please let me know.

ComIStreamWrapper.cs is a Stream to IStream wrapper. This is compatible with
.NET Framework COM interop without custom marshaling.
ComIStreamMarshaler.cs is a custom marshaler for UCOMIStream. It implements
CCW and RCW as well. When COM interface marshaling will be available in Mono
this is no longer required and if Mono will provide proper marshaling
support ComIStreamWrapper will be able to be used without
ComIStreamMarshaler.

These classes are based on only documented functionality.

Form1.cs is a demonstration form, it is full of hack as image creation form
a GDI+ handle is not supported using public methods.

RCW implementation is not supported on Mono as it does not implement
function pointer to delegate marshaling.
There are other limitations in Mono marshaling that could to be worked
around.

I filed the following bug reports:
http://bugzilla.ximian.com/show_bug.cgi?id=74882
http://bugzilla.ximian.com/show_bug.cgi?id=74875

Sincerely,
Kornél