Lazarus

Programming => Packages and Libraries => KOL => Topic started by: JoniDS on March 27, 2009, 02:00:12 am

Title: GradientFill
Post by: JoniDS on March 27, 2009, 02:00:12 am
Hi,
I'm trying to implement the gradientfill function in a KOL project.
Altough it successfully calls the function is displays everything black.


Can anyone tell me what's wrong? %)

GradientFill implementation

Code: [Select]
TTriVertex = packed record
x: Longint;
y: Longint;
Red: Word;
Green: Word;
Blue: Word;
Alpha: Word;
end;

TGRADIENTRECT = record
            UpperLeft : Cardinal;
            LowerRight : cardinal;
             end;   

function GradientFill(DC: dword {HDC}; Verteces: Pointer; NumVerteces: DWORD;
Meshes: Pointer; NumMeshes: DWORD; Mode: DWORD): DWORD; stdcall; external 'coredll.dll';   

const
       GRADIENT_FILL_RECT_H = $00000000;
       GRADIENT_FILL_RECT_V = $00000001;
       GRADIENT_FILL_TRIANGLE = $00000002;
       GRADIENT_FILL_OP_FLAG = $000000ff;

Gradientfill call
Code: [Select]
var
  Verteces: array[0..1] of TTriVertex;
GradientRect: TGradientRect;
begin
  Verteces[0].x := rect.left;
Verteces[0].y := rect.top;

Verteces[0].Red := $0000;
Verteces[0].Green := $0034;
Verteces[0].Blue := $0034;
Verteces[0].Alpha := $0000;

Verteces[1].x := rect.right;
Verteces[1].y := rect.bottom;
Verteces[1].Red := $0000;
Verteces[1].Green := $0045;
Verteces[1].Blue := $0067;
Verteces[1].Alpha := $0000;

GradientRect.UpperLeft := 0;
GradientRect.LowerRight := 1;
 
  GradientFill(dc, @Verteces[0], 2, @GradientRect, 1, GRADIENT_FILL_RECT_H);                                 
TinyPortal © 2005-2018