I've noticed that when you display a bitmap with bitblt() and the last parameter of bitblt() is 'SCRAND', the white colored parts of the bitmap become transparent. Is there a way to change what color to be transparent instead of white?
change it to, for example, cyan -a least color used in
bitmaps.
- clip
yes it is possible. i'm gonna write a tutorial about that. you'll find a source code on my website that demonstrates how to create sprites with bitmaps. if you've any questions to it, just e-mail me or post it here.....
cya
clip,
If you use:
invoke TransparentBlt, hDCWin, 0, 0, 284, 277, hDCMem, 0, 0,284, 277, 0ccbbcch
instead of:
bitblt
then the last parameter is the transparent color.
Windows NT: Requires version 5.0 or later.
Windows: Requires Windows 98 or later.
Please, Safcon, post a message on the board when it will be available :).
I'm also very interested in this thing...
Now, i have a little question...
Imagine that i have a bitmap on my window as background... now i want to display an other bitmap (button or something) with transparency...
Would i see the background bitmap under my "button bitmap"'s transparency ?
Maybe i'm not very clear... but...
Thank you :).
I appreciate your replies alot :) thanks
Safcon:
Cool program :). But the technique though is what I'm
currently using, using two images with different raster
operation code to cover-up each others colors that arent ment to
be transparent. In my similar technique I used SRCAND for white
background but SRCPAINT for the black background (SRCINVERT
makes the colors appear darker in my pc). With this technique
though, it needs 2 bitmaps, if it's a big bitmap it would
consume at max 2x the space. If you've seen the bitmaps on ICQ, for
example, the transparent parts are colored cyan and their are no
counterpart bitmaps needed to patch them up. There is something
definitely more 'proper' code than this, don't you agree?
forge:
I can't seem to find this api.
readiosys:
I know it's possible (just like in ICQ's buttons), maybe the same technique of using cover-up bitmaps? not really sure :)
This message was edited by clip, on 5/24/2001 10:33:28 PM
clip,
You have to include this two lines in your code:
include \masm32\include\msimg32.inc
includelib \masm32\lib\msimg32.lib
It is not in win32.hlp file and as said
it is Windows 98 or later.
If you want to look how is used this TransparentBlt
let me know and I mail you this file.
"trabitblt.rar"
It is small demo with source.
forge
This message was edited by forge, on 5/25/2001 8:00:32 AM
oh I see, I thought safcon was pertaining to the system requirements for his program. sorry.
Your source is what I've been looking for, thanks alot!
- clip
Readiosys:
Please, Safcon, post a message on the board when it will be available
what do you mean with that? did you have problems with downloading it?
i think i understood your question. yes, you'll see the background bitmap. it doesn't matter what's under your transparent bitmap, you'll always see it.
clip:
sorry, i didn't know that you actually used the same technique, and i even don't know another possibility that runs under all windows versions (win9x).
forge:
i just saw three images on the link you gave us. no rar file.
could you please send me the file if this is possible?
byeThanks for your answer, Safcon...
what do you mean with that? did you have problems with downloading it?
In fact, i was talking about the tutorial... not the source :).
I downloaded it and it's great... even if using two bitmaps make grow the exe...
If anyone has a solution to use only one bitmap, please tell us :).
Thanks a lot.