Click to See Complete Forum and Search --> : Opacity for shapes


resander
April 26th, 2004, 03:47 AM
I need to output shapes (rectange,ellipse,polygon) with opacity.
There is an AlphaBlend API function, but I don't know how to
use it (the MSDN documentation did not help).
Would be grateful for advice how to handle the following
simple test case:

void testopacity ( HDC hdc )
{
HBRUSH hb1 = CreateSolidBrush ( RGB(255,0,0) ) ; // for rect r1
HBRUSH hb2 = CreateSolidBrush ( RGB(0,255,0) ) ; // for rect r2
RECT r1 = { 0 , 0 , 100 , 100 } ; // has opacity 1 (opaque)
RECT r2 = { 50 , 50 , 150 , 150 } ;// has opacity 0,5 (overlaps r1)

FillRect ( hdc , &r1 , hb1 ) ; // output first opaque rect

// what should go in here for the second rect with opacity 0.5?
// (using the AlphaBlend API function)
}