[fpc-pascal] interactively draw an ellipse
duilio foschi
duiliofoschi at euplan.com
Wed Jan 23 11:27:31 CET 2013
Hi!
this code
procedure TForm1.DrawBtnClick(Sender: TObject);
{Draw some ellipses on the canvas - random size and color}
var
i:integer;
cx,cy:integer;
begin
with image1, canvas do
begin
for i:= 1 to 10 do
begin
cx:=random(width);
cy:=random(height);
brush.color:=random(256*256*256);
ellipse(cx,cy,cx+random(100), cy+random(100));
end;
end;
end;
will draw 10 ellipses on Image1.
However, I want to do it interactively, like it is done in Photo-Paint.
The ellipse should be contained in a rectangle R whose upper-left
corner is given by the original position of the mouse on screen.
And the bottom-right corner of R will be the final position of the mouse.
During dragging, a temporary ellipse should be shown on screen and the
mouse will be cross-shaped.
Any idea re how to do it ?
An unexpensive well debugged 3th-party library would be the ideal
solution (as I don't plan to work in graphics in the future).
Thank you
Duilio
More information about the fpc-pascal
mailing list