mikael@vall.dsv.su.se (Mikael Kindborg) (08/23/89)
except when the source is white. That is I want to use white as a transparent color. Which raster operation should I use? Do I need to do more than one bitblt, using different raster ops in combination? As far as I have understood transparency is not supported in Windows. This is unfortunate since transparency is useful in many cases.
mikael@vall.dsv.su.se (Mikael Kindborg) (08/24/89)
Arrrgh! The first line of my message was somehow deleted by our mailing software. The article should have read as follows: I want the source bitmap to replace the destination except when the source is white. That is I want to use white as a transparent color. Which raster operation should I use? Do I need to do more than one bitblt, using different raster ops in combination? As far as I have understood transparency is not supported in Windows. This is unfortunate since transparency is useful in many cases. Mikael Kindborg, Dept of Comp. Science, Univ. of Stockholm Mail: mikael@vall.dsv.su.se
bturner@hpcvlx.HP.COM (Bill Turner) (08/24/89)
> except when the source is white. That is I want to > use white as a transparent color. Which raster > operation should I use? Do I need to do more than > one bitblt, using different raster ops in combination? Your message got mangled, but I think I can try and help. If you need to do something tricky with raster ops, what you need to do is write out a truth table of the operands and the desired results. The section of the Programmer's Reference dealing with raster ops (sometimes called ROPs or ternary raster ops) should help. If you lay it out in the form P S D Result with Pattern, Source, and Destination, then read the result as an 8-bit number with the last value as the MSB, this is an index into the table of raster ops. E.g., if you want to copy source when black but use white as transparent, you would do something like: (black = 0) P S D Result 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 == 88h. It turns out this ROP has a name, SRCAND, but if it didn't have a name you'd have to specify the 32-bit Hex ROP when you called BitBlt. [Another possibility is what Microsoft did for icons. They do two blt's, the first is SRCAND, the other is SRCINVERT. If the AND bit is black, the result is the INVERT bit (black or white) -- if the AND bit is white, the result is transparent (INVERT == black) or inverted background (INVERT == white).] --Bill Turner (bturner@hp-pcd.hp.com) HP Corvallis Information Systems