GradientFill found in 'msimg32.dll'
This Delphi source code shows how the GradientFill function can be used to add smooth shading to a triangle or rectangle. For a triangle call the GradientFill function with the three triangle endpoints. GDI will linearly interpolate and fill the triangle.
To add smooth shading to a rectangle, call GradientFill with the upper-left and lower-right coordinates of the rectangle. There are two shading modes used when drawing a rectangle. In horizontal mode, the rectangle is shaded from left-to-right. In vertical mode, the rectangle is shaded from top-to-bottom. First, you need the GradientFill function declaration (Windows.pas contains wrong dectaration of GradientFill function):
type
TRIVERTEX = packed record
X, Y : DWORD;
Red, Green, Blue, Alpha : Word;
end;
function GradientFill(DC : hDC; pVertex : Pointer; dwNumVertex : DWORD;
pMesh : Pointer; dwNumMesh, dwMode: DWORD) : DWord; stdcall;
external 'msimg32.dll';
The following example shows a horizontal rectangle call.
本文介绍如何使用GradientFill函数为矩形或三角形添加平滑渐变填充效果。通过调用此函数并设置不同的顶点颜色及填充模式,可以实现水平或垂直方向上的渐变填充。文章提供了具体的Delphi代码示例。
3249

被折叠的 条评论
为什么被折叠?



