c# - MonoMac System.Drawing.Image.GetPropertyItem(0x5100) -


recently, trying answer so question loading frames (bitmap , duration) of animated gifs. code can found on pastenbin.

while doing additional tests on code before moving dev library, noticed there problem line of code:

//get times stored in gif //propertytagframedelay ((propid) 0x5100) comes 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 on windows .net using (example gif), array of same size amount of frames in animated gif , filled durations of frames. in case byte[20] converts (bitconverter.toint32()) 5 durations:

[75,0,0,0,125,0,0,0,125,0,0,0,125,0,0,0,250,0,0,0] 

on monomac however, line of code same example gif returns byte[4] converts 1 duration (the first):

[75,0,0,0] 

i tested 10 different gif's , result same. on windows durations in byte[], while monomac lists first duration:

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

looking @ mono system.drawing.image source code, length seem set in method, gdi wrapper:

status = gdiplus.gdipgetpropertyitemsize (nativeobject, propid,out propsize); 

however, don't see problems, not source implementation. missing or bug?

if look libgdiplus see properties read active bitmap:

if (gdip_bitmapdata_property_find_id(image->active_bitmap, propid, &index) != ok) { 

you can set active bitmap calling image.selectactiveframe , mono return correct durations, 1 one. since incompatibility windows, i'd call mono bug. simple workaround, can of course check array length , handle both cases. better check mono, because if mono gets fixed continue work.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -