A bug in the GradientFill(…) function under WinMe?
In my application I need to draw a gradient in the window non-client area. I pass a window device context to the GradientFill(…) Win32 API function. However, under WinMe gradient is drawn incorrectly, it somehow clipped. Everything is OK under Win2000 and WinXP.
I developed a dummy dialog-based example program where this bug is reproducible and attached it to this message. The following are 2 functions of interest:
// offset from screen to window coordinates
rect.OffsetRect(-rect.left, -rect.top);
// get window device context
HDC hDC = ::GetWindowDC(m_hWnd);
// draw gradient
DrawGradient(hDC, rect);
// clean up
::ReleaseDC(m_hWnd, hDC);
}
void CTestDlg:rawGradient(HDC hDC, const CRect& rect)
{
// This code is borrowed from MSDN
// article "Drawing a Shaded Rectangle"
TRIVERTEX vert[2] ;
GRADIENT_RECT gRect;
vert [0] .x = rect.left;
vert [0] .y = rect.top;
vert [0] .Red = 0x0000;
vert [0] .Green = 0x0000;
vert [0] .Blue = 0x0000;
vert [0] .Alpha = 0x0000;
vert [1] .x = rect.right;
vert [1] .y = rect.bottom;
vert [1] .Red = 0x0000;
vert [1] .Green = 0x0000;
vert [1] .Blue = 0xff00;
vert [1] .Alpha = 0x0000;
For comparison I have included to the example program a call to FillRect(…) with the same device context. Everything draws correctly both under WinMe and other systems!
Could graphics experts somehow comment on this issue? Is it a bug in the Microsoft’s implementation of the GradientFill(…) function under WinMe?
My environment:
WinMe/WinXP, Visual C++ 6.0, SP5, Platform SDK August 2001
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.