Blitting Semi-Transparent
How do i blit a bitmap semi-transparently?
We are here just like this,It really doesn't matter why.The world is here like it is,'We could laugh we could cry.Is it good or is it bad,Wright or maybe wrong?There's no use of being sad,Without a purpose within a song.
I'm not sure if DD 8.0 supports it, but do a search for translucency or alpha-blending. You can do it manually too.. just take each pixel and do something like this:
ForegroundPixel + BackgroundPixel /2 = NewPixel
(obviously doing that for the RG&B components seperately)
The above will give you 50% tranlucency. I had the formula for variable translucency somewhere, but I lost it when formated one of my hard drives. From what I remember, you take each color value and multiply it by a %. 1.0 for opaque, 0.0 for invisible, 0.5 for half-way, etc..
Edited by - A. Buza on October 3, 2000 7:13:24 PM
ForegroundPixel + BackgroundPixel /2 = NewPixel
(obviously doing that for the RG&B components seperately)
The above will give you 50% tranlucency. I had the formula for variable translucency somewhere, but I lost it when formated one of my hard drives. From what I remember, you take each color value and multiply it by a %. 1.0 for opaque, 0.0 for invisible, 0.5 for half-way, etc..
Edited by - A. Buza on October 3, 2000 7:13:24 PM
Hi there,
I use the following
Hope it helps.
Edited by - MButchers on October 4, 2000 6:35:16 AM
I use the following
#define BLEND(src,dest,alpha) (((alpha*(src-dest))>>8)+dest)#define BLEND50(src,dest,alpha) ((src+dest)*0.5)
Hope it helps.
Edited by - MButchers on October 4, 2000 6:35:16 AM
So each frame, i''d have to get the dest. r,g,b and do the blend with the source r,g,b colors individually? doesn''t this eat up alot of time?
We are here just like this,It really doesn't matter why.The world is here like it is,'We could laugh we could cry.Is it good or is it bad,Wright or maybe wrong?There's no use of being sad,Without a purpose within a song.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement