[Mono-winforms-list] libgdiplus/System.Drawing patch: native support for indexed Bitmaps

kangaroo grompf@sublimeintervention.com
Wed, 16 Mar 2005 17:35:42 -0500


This patch still does not work on PPC.

Please see:
http://tuxppc.rz.uni-augsburg.de/

or

http://www.egr.up.edu:8080/

For free PPC accounts (you will need to probably write C test files; 
but it will let you test)

-kangaroo

On 11-Mar-05, at 1:22 PM, Jonathan Gilbert wrote:

> At 02:12 AM 05/03/2005 -0500, I wrote:
>> Please find attached the following files:
>>
>> * libgdiplus.diff (patch -p0 in ./libgdiplus)
>> * System.Drawing.diff (patch -p0 in ./mcs/class/System.Drawing)
>> * lockbits.tgz (tar zvfx in ./)
>
> Updated diffs and some extra testing code: testgif.tgz (DOES NOT 
> contain a
> subdirectory; untar directly within the intended destination)
>
> Changes from the previous patch:
> * Fixed the call to gdip_is_an_indexed_pixelformat that did not 
> actually
> call the function because it was missing the argument list.
> * Added indexed loading & saving support to gifcodec.c.
> * Updated Image.Palette to behave like Microsoft's implementation. I
> discovered its bizarre behaviour when I tried to write a program for 
> the
> Microsoft framework to save an indexed 8-bit Bitmap with a custom 
> palette.
> It does not actually behave like a property, and should really have 
> been
> engineered as two separate functions, since there is no persistence
> involved. Reading from the property creates a new instance of
> System.Drawing.Imaging.ColorPalette and fills it from the underlying 
> GDI+
> GpImage object. However, the underlying GpImage's palette is only 
> updated
> if you assign to the property. Since you are not allowed to create
> instances of ColorPalette directly, you end up having to write code 
> like this:
>
> ColorPalette palette = my_bitmap.Palette;
>
> for (int i=0; i < palette.Entries.Length; i++)
>   palette.Entries[i] = Color.FromArgb(ar, gu, ments);
>
> my_bitmap.Palette = palette; /* assign the same instance back! if this 
> is
> skipped, the image file will display and save with the old palette */
>
> This is not documented in MSDN! But whatever the case, mono now 
> behaves the
> same way.
>
> Oh, and one other thing: This time I actually verified that the diffs 
> apply
> cleanly :-)
>
> Jonathan Gilbert
>
>
> !DSPAM:42376ae512631323642109!
> <testgif.tgz><libgdiplus.diff><System.Drawing.diff>