小弟我对一个函数不明白,请高手指教。
void GradientFillRect(HDC hDC, CRect &rcFill, BOOL bVertical, COLORREF crLeftTop, COLORREF crRightBottom)
{
ULONG nMode = GRADIENT_FILL_RECT_H;
if (bVertical)
nMode = GRADIENT_FILL_RECT_V;
COLOR16 r = (COLOR16) ((crLeftTop & 0x000000FF)<<8);
COLOR16 g = (COLOR16) (crLeftTop & 0x0000FF00);
COLOR16 b = (COLOR16) ((crLeftTop & 0x00FF0000)>>8);
TRIVERTEX vert[2] ;
GRADIENT_RECT gRect;
vert [0] .x = rcFill.left;
vert [0] .y = rcFill.top;
vert [0] .Red = r;
vert [0] .Green = g;
vert [0] .Blue = b;
vert [0] .Alpha = 0x0000;
r = (COLOR16) ((crRightBottom & 0x000000FF)<<8);
g = (COLOR16) (crRightBottom & 0x0000FF00);
b = (COLOR16) ((crRightBottom & 0x00FF0000)>>8);
vert [1] .x = rcFill.right;
vert [1] .y = rcFill.bottom;
vert [1] .Red = r;
vert [1] .Green = g;
vert [1] .Blue = b;
vert [1] .Alpha = 0x0000;
gRect.UpperLeft = 0;
gRect.LowerRight = 1;
GradientFill(hDC, vert, 2, &gRect,1, nMode);
}
看了相关的帮助,还是有点不明白,在此发贴。
有两点:
1:GRADIENT_FILL_RECT_H GRADIENT_FILL_RECT_V; 分别是什么意思,各起的是什么作用?
2: TRIVERTEX结构中的 Alpha起什么作用,看msdn里写的是指明x,y的信息,它在这里赋的值是0x0000,它又代表什么意思?