Quote:Right, well...
I pick New Image, and specify 256-color bitmap. I draw my picture with the valid 8-bit colors. Then I save it, and then use it (with Allegro's load_bmp() function) into a 320x200 resolution environment. The colors are messed up.
This is not PSP fault. It is your fault
I'll explain:
1.- If you are using a 8 bit (paletted) screen mode (like SCREEN 13), you have to specify it before you call to set_gfx_mode:
Also you have to activate the palette. If you load the BMP with:
Code:
BITMAP *my_picture;
PALETTE my_palette;
my_picture = load_bmp ("PICTURE.BMP", my_palette);
You need to do this in order to activate the palette:
Quote:void set_palette(const PALETTE p);
Sets the entire palette of 256 colors. You should provide an array of 256 RGB structures. Unlike set_color(), there is no need to call vsync() before this function
Code:
set_palette (my_palette);
Otherwise your colours will be messed up. Load_bmp loads the picture but doesn't set the palette for you.
2.- If you are using a hi colour or truecolour (15, 16, 24 or 32 bits) you have to specify it, like before:
Code:
set_color_depth(16); // or whatever
Then you have to tell allegro that if it loads a paletted image it should convert it to true/hi colour. In true/hi colour modes there is no palette. Each pixel has its own colour info, so no need for palettes. If you call this function:
Code:
set_color_conversion (COLORCONV_TOTAL);
at the beginning of your program, whenever allegro loads a picture from disk it will convert it to the actual pixel format before writing it to your bitmap. Don't forget it and you won't need to care about palettes. Just plug a hi/true colour mode, set the colour conversion and load your pictures. Palettes are history!