- Tanner Helland (dot) Com - http://www.tannerhelland.com -
Real-Time Image Blending/Transparency (VB6)
Posted By Tanner On January 25, 2009 @ 9:26 pm In Graphics Code,Programming | Comments Disabled
Real-time transparency has become so commonplace in modern games and PC applications that it’s almost taken for granted. However, the specific formula that performs this now-ubiquitous effect is worth understanding.
Transparency is simply a weighted average between the color values of two pixels. As an example, consider the following two colors:
Pure red, or RGB(255, 0, 0)
Pure blue, or RGB(0, 0, 255)
At 50% transparency – or a pure blending between these two colors – we would simply add the individual color amounts together and divide by two. This gives us a new color -
Purple, or RGB(127, 0, 127)
Not entirely surprising, eh?
The effect is certainly more impressive when applied pixel-by-pixel across an entire image, as the downloadable project demonstrates.
Squall and Rinoa meet a large flower (insert Garden joke of your choice :)
Article printed from Tanner Helland (dot) Com: http://www.tannerhelland.com
URL to article: http://www.tannerhelland.com/490/image-blending-transparency/
Click here to print.
All text copyright © 2008 Tanner Helland. To reduce paper and ink usage, all comments, images, and videos have been suppressed on this printing.