For strongest red or/and green or/and blue or/and alpha, use ushort.MaxValue. For white color, set all R, G and B to ushort.MaxValue!
[DllImport("gdi32.dll", EntryPoint = "GdiGradientFill", ExactSpelling = true)]
public static extern bool GradientFill(
IntPtr hdc, // handle to DC
IntPtr pVertex, // array of vertices
uint dwNumVertex, // number of vertices
IntPtr pMesh, // array of gradients
uint dwNumMesh, // size of gradient array
GRADIENT_FILL dwMode); // gradient fill mode
[DllImport("gdi32.dll", EntryPoint = "GdiGradientFill", ExactSpelling = true)]
public static extern bool GradientFill(
IntPtr hdc, // handle to DC
TRIVERTEX[] pVertex, // array of vertices
uint dwNumVertex, // number of vertices
GRADIENT_RECT[] pMesh, // array of gradient rectangles, that each one keeps two indices in pVertex array, to determine its bounds
uint dwNumMesh, // number of gradient rectangles to draw
GRADIENT_FILL dwMode); // Use either GRADIENT_FILL.RECT_H or GRADIENT_FILL.RECT_V. Using the value GRADIENT_FILL.TRIANGLE is wrong in this overload!
[DllImport("gdi32.dll", EntryPoint = "GdiGradientFill", ExactSpelling = true)]
public static extern bool GradientFill(
IntPtr hdc, // handle to DC
TRIVERTEX[] pVertex, // array of vertices
uint dwNumVertex, // number of vertices
GRADIENT_TRIANGLE[] pMesh, // array of gradient triangles, that each one keeps three indices in pVertex array, to determine its bounds
uint dwNumMesh, // number of gradient triangles to draw
GRADIENT_FILL dwMode); // Use only GRADIENT_FILL.TRIANGLE. Both values GRADIENT_FILL.RECT_H and GRADIENT_FILL.RECT_V are wrong in this overload!
Declare Function GradientFill Lib "gdi32.dll" (TODO) As TODO
Do you know one? Please contribute it!
The GDI32.dll does not contain a GradientFill() function. The actual entry point is GdiGradientFill(). That's why the 'EntryPoint' attribute is present.
This method creates one entry each for rectangles and triangles. It's just a matter of convenience and error checking by the compiler.
Please add some!