[Mono-list] MonoMac System.Drawing.Image.GetPropertyItem(0x5100)

Steven Houben stvnhouben at gmail.com
Sun Jul 21 23:44:04 UTC 2013


Recently, I was trying to answer another StackOverflow question about
loading the frames (Bitmap and duration) of animated GIFs. The code can be
found on pastebin:http://pastebin.com/Y6iUGDX9.

While doing additional tests on this code before moving it into my dev
library, I noticed that there is a problem with this line of code:

//Get the times stored in the gif
//PropertyTagFrameDelay ((PROPID) 0x5100) comes from gdiplusimaging.h
//More info on
http://msdn.microsoft.com/en-us/library/windows/desktop/ms534416(v=vs.85).aspx
var times = img.GetPropertyItem(0x5100).Value;

When running this on Windows .Net, the array is of the same size as the
amount of frames in the animated GIF and filled with the durations of the
frames. On MonoMac however, this line of code always returns a byte[4] with
only the first value set. I tested this for 10 different GIF's and the
result is always:

[x,0,0,0]
E.g:

[75,0,0,0]
[50,0,0,0]
[125,0,0,0]

Looking at the Mono System.Drawing.Image source code (
https://github.com/mono/mono/blob/master/mcs/class/System.Drawing/System.Drawing/Image.cs),
the length seem to be set in this method:

status = GDIPlus.GdipGetPropertyItemSize (nativeObject, propid,out
propSize);

However, I don't really see any problems, not with the source as with my
implementation. Am I missing something or is this a bug?

I also posted this on StackOverflow (
http://stackoverflow.com/questions/17773097/monomac-system-drawing-image-getpropertyitem0x5100
)

-- 
*Steven*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20130722/ab1a11e9/attachment.html>


More information about the Mono-list mailing list