Drawing a Shaded Triangle

To draw a shaded triangle from [0,0] to [100,32], define a TRIVERTEX structure with three elements and a single GRADIENT_TRIANGLE structure. The following example shows a GRADIENT_FILL_TRIANGLE call.

TRIVERTEX        vert [4] ;
GRADIENT_TRIANGLE    gTri;
vert [0] .x       =  0;
vert [0] .y       =  0;
vert [0] .Red     =  0x0000;
vert [0] .Green   =  0x0000;
vert [0] .Blue    =  0x0000;
vert [0] .Alpha   =  0x0000;

vert [1] .x       =  100;
vert [1] .y       =  0;
vert [1] .Red     =  0x0000;
vert [1] .Green   =  0x0000;
vert [1] .Blue    =  0xff00;
vert [1] .Alpha   =  0x0000;

vert [2] .x       =  100;
vert [2] .y       =  32; 
vert [2] .Red     =  0x0000;
vert [2] .Green   =  0x0000;
vert [2] .Blue    =  0xff00;
vert [2] .Alpha   =  0x0000;

vert [3] .x       =  0;
vert [3] .y       =  32;
vert [3] .Red     =  0xff00;
vert [3] .Green   =  0xff00;
vert [3] .Blue    =  0xff00;
vert [3] .Alpha   =  0x0000;

gTRi[0].Vertex1   = 0
gTRi[0].Vertex2   = 1
gTRi[0].Vertex3   = 2

gTRi[1].Vertex1   = 0
gTRi[1].Vertex2   = 2
gTRi[1].Vertex3   = 3
GradientFill(hdc,vert,4,&gTRI,1,GRADIENT_FILL_TRIANGLE);