Mail Archives: djgpp/1998/05/22/14:31:22
david c. yang wrote in message <35613fc6 DOT 90806242 AT news DOT dnai DOT com>...
>hi, i am new to allegro and thus the following questions are very
>basic, but i would be very appreciative if someone would lend me a
>hand:
>
>after drawing an 8 bit sprite in photoshop, i save it as a pcx and
>read it in grabber, grabbing both an rle_sprite and a 8 bit palette
>from the file. i use the palette and sprite in my program, and it
>displays fine, however, when i grab a new 8 bit rle_sprite, that
>although not using any colors not in the palette (obtained from the
>first bitmap), it displays with messed up colors.
>
>i guess i need to know how to make all the sprites use the same
>palette, and not just the same colors... and also, my sprites
>currently display as an entire box - the docs (yes, i've read them
>:-)) indicate that masked areas are to be of color 0 in the index.
>does this mean that i should put some random color i never intend to
>use in my program into the 0 position, and color in the masked areas
>with it?
>
>obvious i have little idea what i am talking about, but i'd like to
>think that that's because i just started fooling around with allegro a
>few days ago. :-) i suspect i'm doing this whole palette/sprite
>editing thing the wrong way, so if someone can tell me a better way to
>do it, i'd really appreciate it. thanks!
I do it the following way:
first, i just always grab 24bit images.
in allegro,
1) i first switch to 8bit grafix mode
2) and load my favorite 256color-palette
3) then, i set color 0 to pink:
RGB c={255,0,255};
set_color(0,c)
4) then, i load all the 24 bit bitmaps
5) now, if you want, restore color 0
this way, i have 8bit images, and all use the
right palette;
transparent is everything that had
color {255,0,255} in 24bit
i'm sure there's a better way however...
hth,
Elias Pschernig
- Raw text -