Date: Sun, 2 Jan 2000 02:38:52 +0100 (CET) From: Wilmer van der Gaast To: djgpp AT delorie DOT com Subject: Re: transparent bitmaps In-Reply-To: <84nsgt$p1r$1@planja.arnes.si> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Sun, 2 Jan 2000, Matej wrote: > Hi! > Thank you for your reply, but you didn't understand the problem (well, it > was my fault not to explain well as I'm not an English-speaking person). Me too. I'm Dutch. > Let's say I draw a red circle with black background in a program like Paint > and I save it to be a .bmp file (or .pcx, but not gif!). Then, I write a > program with a colorful background and want my program to display only that > red circle without the black background. So, how to write that routine to > show only the red circle? > Hope I explained well. > Thanks, > Matej I suppose you know how to load a bmp/pcx file, if you don't, just tell me, or go to http://www.programmersheaven.com . There are some nice docs about these file formats there, and because the files are uncompressed, it's very easy to understand, also for non-english people. Well, if you've written the bmp/pcx-loader by yourself, you know it looks like this: while(...) { read pixel from file; put pixel on screen; } and you convert it to something like this: while(...) { read pixel from file; if( pixel != 255 ) put pixel on screen; } So your program just checks if the current pixel has the value 255 (your bmp files have to be indexed, 256 colors ) and if it hasn't, the pixel will be drawn on screen, if it is 255, the program doesn't draw this pixel, so the background will remain visible there. The value 255 can be anything you want, but 255 is IMHO a good one. If this is still not clear, just tell me... Greetings, --------- Wilmer van der Gaast (lintux AT dds DOT nl) ICQ 55707076