Mail Archives: djgpp/1998/02/17/08:53:40
Keith Bonawitz <aule AT geocities DOT com> wrote...
> either 24-bit. How can I convert these 24-bit images to 256 color
> images? I understand that an palette has to be created that matches
> most of the colors reasonably well, but how would I go about doing
> this? I would appreciate either ready-to-use allegro extensions or a
> reference to an algorithm that could be used.
Allegro 3.0 can convert 24-bit images to 256-color palette images
automatically when you load them. Just do this at the start of your program
after allegro_init ():
set_color_depth (8); // 256 color palette
set_color_conversion (COLORCONV_TOTAL); // Convert everything to current
color-depth
Then when you load your bitmaps, using the load_* functions, allegro will
create an optimized palette for you, and convert the bitmaps to 256 color.
/ Daniel Nilsson
- Raw text -