Draw filled polygon
Hi,
Im trying to draw a polygon that is filled with a bitmap
and I want to avoid Floodfill(...)
I tried the following code, but it doesnt work.
Is SelectClipRgn for the bitmap wrong?
procedure TForm1.Button1Click(Sender: TObject);
var r: Array of TPoint;
rhandle: Hrgn;
begin
SetLength(r, 4);
r[0].x := 0;
r[0].y := 0;
r[1].x := 100;
r[1].y := 50;
r[2].x := 100;
r[2].y := 100;
r[3].x := 50;
r[3].y := 100;
rHandle := CreatePolygonRgn(r[0], High(r) + 1, Winding);
SelectClipRgn(Image2.Picture.Bitmap.Canvas.Handle, rHandle);
BitBlt(Paintbox1.Canvas.Handle, 123, 123, 321, 321,
Image2.Picture.Bitmap.Canvas.Handle, 0, 0, SrcCopy);
DeleteObject(rHandle);
end;
Many thanks.