Mail Archives: djgpp/1999/02/15/07:48:06
Chris writes:
> I have a 16 bit background on which I want to move around some 8 bit
> colour sprites. I would also like some parts of these sprites to be
> transparent so the background is visible through them.
>
> There is an allegro function masked_blit to do this, but it doesn't
> seem to work.....any points of colour 0 on my sprites simply show up
> as black on my background, NOT transparent.
Read the sections titled "loading image files" and "converting between
color formats" in allegro.txt. To summarise, your 8 bit graphics are
probably being converted into 16 bit format when you load them: you
should call set_color_conversion(COLORCONV_NONE) to disable this. Once
you've got them in an 8 bit format, you can't use masked_blit() at
all, because it doesn't support mixing images of different formats.
As a special case, the draw_sprite() function will handle this for
you, but please do read the relevant section of the docs: Allegro is
not generally designed to draw graphics of one format onto surfaces
of another, and this will cause you a lot of trouble unless you
understand exactly what (very limited) set of routines will correctly
support this situation.
Shawn Hargreaves.
- Raw text -