Mail Archives: djgpp/1998/02/05/01:02:38
>Could someone help me out, I would like to know how to select one color
>form a pallete and make it transparent for bitmaps.
>(So I could enter a second bitmap on part of a previously drawn one).
>I need this because certain tiles in my game must overlap each other.
>I would appreciate some examples of some code.
>
>THANKS
>e-mail address is maciek AT compmore DOT net
>
>
>
>
You didn't say what color/video mode you're working in...
but the standard 256 color solution to that is the simple "make 0 the
transparency color.... and then for every pixel you MIGHT draw - check to make
sure it's not 0 first"
This won't effect your other blit.... you can still use... say BLACK - without
making a double of it in the palette....
but in your transparent blit function... instead of say... using a memcpy....
going line by line... in bytes, or words, or doublewords.. - you'll be going
through pixel-by-pixel....
Some folks have used a "run-length-encoded" sort of idea.... so they can avoid
checking every pixel....
Good luck
Jim the loiterer
aloiterer AT juno DOT com
http://members.xoom.com/JimMcCue/index.htm
- Raw text -