Home > Back-end >  Small white consult! The circle is drawn on the rectangle in the picture!
Small white consult! The circle is drawn on the rectangle in the picture!

Time:11-09

On rectangular images to the same point (rectangle diagonal intersection of) is a circle, draw more identical radius of concentric circles! How to programming,

CodePudding user response:

TImage can be used as a canvas, put a TImage on the form controls, set the Image as the rectangle,
Drawing code is as follows:
 

Procedure TFmMain. BtnDrawClick (Sender: TObject);
Var
I, r: integer;
The begin
//draw a rectangle
ImgCanvas. Canvas. Pen. Color:=clBlack;
ImgCanvas. Canvas. MoveTo (0, 0);
ImgCanvas. Canvas. LineTo (imgCanvas. Width - 1, 0);
ImgCanvas. Canvas. LineTo (imgCanvas. Width - 1, imgCanvas Height - 1);
ImgCanvas. Canvas. LineTo (0, imgCanvas. Height - 1);
ImgCanvas. Canvas. LineTo (0, 0);
//draw round
R:=imgCanvas Height div 2-2;
For I:=10 downto 1 do
The begin
//USES random color circle
ImgCanvas. Canvas. Pen. Color:=the Random ($FFFFFF);
ImgCanvas. Canvas. The Ellipse (imgCanvas Width div 2 - r,
ImgCanvas. Height div 2 - r,
ImgCanvas. Width div 2 + r,
ImgCanvas. Height div 2 + r);
R:=r - 10;
end;
end;

Put the drawing code in the timer implementation, there will be animation

CodePudding user response:

reference 1st floor day return reply:
TImage can be used as a canvas, put a TImage on the form controls, set the Image to rectangular,
Drawing code is as follows:
 

Procedure TFmMain. BtnDrawClick (Sender: TObject);
Var
I, r: integer;
The begin
//draw a rectangle
ImgCanvas. Canvas. Pen. Color:=clBlack;
ImgCanvas. Canvas. MoveTo (0, 0);
ImgCanvas. Canvas. LineTo (imgCanvas. Width - 1, 0);
ImgCanvas. Canvas. LineTo (imgCanvas. Width - 1, imgCanvas Height - 1);
ImgCanvas. Canvas. LineTo (0, imgCanvas. Height - 1);
ImgCanvas. Canvas. LineTo (0, 0);
//draw round
R:=imgCanvas Height div 2-2;
For I:=10 downto 1 do
The begin
//USES random color circle
ImgCanvas. Canvas. Pen. Color:=the Random ($FFFFFF);
ImgCanvas. Canvas. The Ellipse (imgCanvas Width div 2 - r,
ImgCanvas. Height div 2 - r,
ImgCanvas. Width div 2 + r,
ImgCanvas. Height div 2 + r);
R:=r - 10;
end;
end;

Put the drawing code in the timer implementation, there will be animation
great god, this is can be realized on a given rectangle photo?

CodePudding user response:

refer to the second floor weixin_45453416 response:
Quote: refer to 1st floor day return reply:
TImage can be used as a canvas, put a TImage on the form controls, set the Image to rectangular,
Drawing code is as follows:
 

Procedure TFmMain. BtnDrawClick (Sender: TObject);
Var
I, r: integer;
The begin
//draw a rectangle
ImgCanvas. Canvas. Pen. Color:=clBlack;
ImgCanvas. Canvas. MoveTo (0, 0);
ImgCanvas. Canvas. LineTo (imgCanvas. Width - 1, 0);
ImgCanvas. Canvas. LineTo (imgCanvas. Width - 1, imgCanvas Height - 1);
ImgCanvas. Canvas. LineTo (0, imgCanvas. Height - 1);
ImgCanvas. Canvas. LineTo (0, 0);
//draw round
R:=imgCanvas Height div 2-2;
For I:=10 downto 1 do
The begin
//USES random color circle
ImgCanvas. Canvas. Pen. Color:=the Random ($FFFFFF);
ImgCanvas. Canvas. The Ellipse (imgCanvas Width div 2 - r,
ImgCanvas. Height div 2 - r,
ImgCanvas. Width div 2 + r,
ImgCanvas. Height div 2 + r);
R:=r - 10;
end;
end;

Put the drawing code in the timer implementation, there will be animation
great god, this is can be realized on a given rectangle photo?

Estimates that you didn't finish see I write program, the program has been done in the rectangle, you need to how much the rectangle, you can modify the relevant parameters,

CodePudding user response:

Sorry ah great god I mean it takes on a piece of my own import have color photo circle in the picture is not for program generates a rectangle

CodePudding user response:

The above code gives out
The building Lord even Ctrl + C and Ctrl + V is too lazy to do?
Go to the CV, run directly see the effect

CodePudding user response:

reference 4 floor weixin_45453416 response:
sorry ah great god I mean it takes on a piece of my own import have color photo circle in the picture is not for program to generate a rectangular


Put a TImage, assumes that the name is Image1:
Image1. Picture. LoadFromFile (' XXX ');
Image1. Canvas. The Ellipse (... );
  • Related