www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/05/01:02:38

From: qballlives AT aol DOT com (QBallLives)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Transparent BITMAPS???
Date: 5 Feb 1998 01:40:07 GMT
Lines: 34
Message-ID: <19980205014001.UAA06547@ladder03.news.aol.com>
NNTP-Posting-Host: ladder03.news.aol.com
Organization: AOL http://www.aol.com
References: <01bd3067$9f110760$5d51dece AT stachowiak>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

>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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019