GradientFill found in 'msimg32.dll'

来源:互联网 发布:淘宝客服是真的吗 编辑:程序博客网 时间:2024/04/29 06:49

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.

原创粉丝点击