Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void GradientTriangle( HDC MemDC,
- LONG x1, LONG y1,
- LONG x2, LONG y2,
- LONG x3, LONG y3,
- COLORREF top, COLORREF bottom )
- {
- TRIVERTEX vertex[3];
- vertex[0].x = x1;
- vertex[0].y = y1;
- vertex[0].Red = GetRValue(bottom) << 8;
- vertex[0].Green = GetGValue(bottom) << 8;
- vertex[0].Blue = GetBValue(bottom) << 8;
- vertex[0].Alpha = 0x0000;
- vertex[1].x = x3;
- vertex[1].y = y3;
- vertex[1].Red = GetRValue(bottom) << 8;
- vertex[1].Green = GetGValue(bottom) << 8;
- vertex[1].Blue = GetBValue(bottom) << 8;
- vertex[1].Alpha = 0x0000;
- vertex[2].x = x2;
- vertex[2].y = y2;
- vertex[2].Red = GetRValue(top) << 8;
- vertex[2].Green = GetGValue(top) << 8;
- vertex[2].Blue = GetBValue(top) << 8;
- vertex[2].Alpha = 0x0000;
- // Create a GRADIENT_TRIANGLE structure that
- // references the TRIVERTEX vertices.
- GRADIENT_TRIANGLE gTriangle;
- gTriangle.Vertex1 = 0;
- gTriangle.Vertex2 = 1;
- gTriangle.Vertex3 = 2;
- // Draw a shaded triangle.
- GradientFill( MemDC, vertex, 3, &gTriangle, 1, GRADIENT_FILL_TRIANGLE);
- }
- // bottom triangle --> need help with this one!!
- GradientTriangle( (HDC)wParam,
- r.left, r.top,
- r.left, r.bottom - r.top,
- r.right, r.bottom - r.top,
- RGB( 0x0, 0x0, 0xFF ), RGB( 0xFF, 0xFF, 0x0 ) );
- // top triangle --> this one is fine !
- GradientTriangle( (HDC)wParam,
- r.right, r.bottom - r.top,
- r.right, r.top,
- r.left, r.top,
- RGB( 0xFF, 0x0, 0x0 ), RGB( 0x0, 0xFF, 0x0 ) );
- }
- return 1L;
- // I have modified parametters for bottom triangle
- GradientTriangle( (HDC)wParam,
- r.left, r.top,
- r.right, r.bottom - r.top, // switched places
- r.left, r.bottom - r.top, // of these two coordinates
- RGB( 0x0, 0x0, 0xFF ), RGB( 0xFF, 0xFF, 0x0 ) ); // but color has changed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement