Archived

This topic is now archived and is closed to further replies.

jimothygu

transparent graphics?

Recommended Posts

Hey, I''m currently making a game that uses a number of BMP files, but I was wondering two things. First, how do you split up a series of images that are in one bmp file and use them (like all of the animations of a sprite, or all of the characters for a font). My other question relates to how you can extract an image from a BMP file and have all of the space around it not be used. I''ve seen a couple of BMP''s that have neon green or purple around the actual image, and the game ignores that. Just curious. Thanks! Jim

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I think you''re talking about colorkeying. Colorkeying can be acheived though alpha-blending. If you want to use 32-bit and enable alpha-blending you could just set the alpha values of each pixel you want to ignore to zero. I find that colorkeying and alpha-blending are easier to acheie using a class setup. Let''s say like you have a CImage class and each CImage object in your app is an image.

If you just want colorkeying, create a data member of the CImage class called "ignorable" or something; this value represents the color index (or color triplet) you want to ignore. A display() function in the CImage class will then only plot pixels that do not match the ignorable member. I''m sure you''ll want to double-buffer. In this case, you''d have to add something like a stack() function where you can stack an image onto another image and then display only the the resulting image or the function can plot an image onto a memory DC.

Hope this makes sense.

Share this post


Link to post
Share on other sites