1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
Procedure TForm1.DessineCercle;
var
image, texture : TBGRABitmap;
c : TBGRAPixel;
x,y,rx,ry: integer;
imgPos : TPoint;
begin
ImgPos := Point( (ClientWidth - 100) div 2 ,(ClientHeight - 100) div 2);
image := TBGRABitmap.Create(ImgPos.X,ImgPos.Y,ColorToBGRA(ColorToRGB(clYellow)));
c := ColorToBGRA(ColorToRGB(clRed));
//coordonnées de l'ellipse
x := 300;
y := 300;
rx := 50;
ry := 50;
//charge un pinceau pour la texture. On reprend bsSolid comme auparavant
texture := image.CreateBrushTexture(bsCross,BGRAWhite,blSkyBlue) as TBGRABitmap;
image.FillEllipseAntialias(x,y,rx-1,ry-1,texture);
image.EllipseAntialias(x,y,rx,ry,c,1); //draw outline
tex.Free;
image.Draw(Canvas,x,y,True);
image.free;
end; |
Partager