Better ILBM support for SDL_Image

Hi all,

Here’s a patch for SDL_Image improving support for ILBM files. I send a
previous version of this a couple months ago, but it seems it went
unnoticed… Time to try again!

The patch includes the following changes:

  • fixed reading of colorkeyed images (they were previously assumed to
    have a stencil bitplane, but since the body didn’t have it, the decoding
    failed)

  • fixed colormap for images with a stencil (mask) bitplane. Those images
    can have say 7+1 bitplanes but only 128 colors defined. In that case,
    the end of the SDL_Image colormap was uninitialized, resulting in
    garbled surfaces.

  • fixed colormap for EHB (“Extra Half Brite”) Amiga images (these have 6
    bitplanes, but the colormap only contains 32 colors. The second half of
    the colormap has to be a copy of the first one, with brightness divided
    by 2)

  • adds support for HAM (“Hold And Modify”) and HAM8 files. These special
    formats were used frequently on Amiga machines. They have only 6 (or 8)
    bitplanes, but really use 2^12 (or 2^24) colors. The patch convert
    these images to 24bits surface.

  • for 24 bits (and HAM) images, create the surface in R,G,B byte order
    whatever the machine endianness. Then the check for the host endianness
    doesn’t have to be done for each pixel, which also speeds up decoding.

This patch cleanly apply to SDL_Image 1.2.3

Finally, I have a question: is it legal for a 8bits surface to have a
1-bit alpha channel? If it is, I could improve support for "stenciled"
images some more (the transparency information is currently lost).

Cheers,
David
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: sdlimage-ilbm-fixes.diff
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20040203/c544d4cb/attachment.txt

Here’s a patch for SDL_Image improving support for ILBM files. I send a
previous version of this a couple months ago, but it seems it went
unnoticed… Time to try again!

Some improved ILBM support was already added to CVS. Could you check
it out and send an updated patch?
http://www.libsdl.org/cvs/SDL_image-1.2.4.tar.gz

Thanks!
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Some improved ILBM support was already added to CVS. Could you check
it out and send an updated patch?
http://www.libsdl.org/cvs/SDL_image-1.2.4.tar.gz

Thanks!

Indeed, HAM and EHB image support is already there.
Ok, new version of the patch attached :

  • fixed reading of colorkeyed images (they were previously assumed to
    have a stencil bitplane, but since the body didn’t have it, the decoding
    failed). Added a missing call to SDL_SetColorKey() too.

  • fixed colormap for images with a stencil (mask) bitplane. Those images
    can have say 7+1 bitplanes but only 128 colors defined. In that case,
    the end of the SDL_Image colormap was uninitialized, resulting in
    garbled surfaces.

Bye!

david
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: sdlimage1.4-ilbm-fixes.diff
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20040207/9a92a18b/attachment.txtOn Thu, 05 Feb 2004 11:42:35 -0800 Sam Lantinga wrote:

Indeed, HAM and EHB image support is already there.
Ok, new version of the patch attached :

Thanks! Your patch has been added to CVS.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment