Help! Blitting problem with DirectDraw

Started by
3 comments, last by dlanicek 24 years, 5 months ago
Indeed it is a palette problem. See, the palette of one picture should be the same as the palette of another picture. If you, for example, load image a into memory, and use THAT palette. All the colors are indexed.
So, 40 might be the color green. But from another picture you load (image b) you have the color blue at place 40. If you use both of these bitmaps, and the palette of one picture. You will see the other picture with the palette of the former picture.

Hope that explains it.

------------------
Dance with me......

Advertisement
So how do I check the palettes of both pictures? Or more importantly, how do I make sure the two images are using the exact same palette? I'm using Paint Shop Pro to create the images.
You can use PSP to export a palette, and then load it into another bitmap. (I don't remember which menu it's on, but it shouldn't be hard to find the right command). Doing this is probably going to screw up your colors though. You'll have to mess around with them a bit to get them fixed.
I'm creating a game with 8 bit color. I can get the background image to show up fine but when I try to blit an image onto the background, it looks all wrong. There are "random" colors where the image should be. If you look hard, you can kinda see the image thru the random colors. What am I missing? Is this a palette issue?

If it helps, I'm following examples from LaMothe's Tricks of the Windows Game Programming Gurus. The exact same problem shows up when I try to run his Prog7_13 on the CD-ROM.

Thanks for the help,
Dan

okay, here's how to do it well:

1. Create a big enough file in PSP to hold all your imagery - players, backgrounds, etc, with 24 bit colour.

2. Load all your game images one at a tim., Select all (ctrl a) then copy (ctrl c) the selection into the Big canvas (use Ctrl-E).

3. Reduce the big canvas to 8 bit colour (colour, reduce colour depth).

4. Save the palette. (colours, save palette)

5. Load the palette (colours, load palette) into all your seperate images.

Beware that you still only get 256 colours, so plan your imagery wisely.

--- wise guy ---

This topic is closed to new replies.

Advertisement