Hola RSC9421, bienvenido a
Club Delphi
Como es costumbre con los que se inician, te invitamos a leer nuestra
guía de estilo.
Si no interpreté mal tu consulta, una opción puede ser:
Código Delphi
[-]
function GetRectCoord(const Img: TImage; const x,y: Integer): TPoint;
begin
Result.X:= (Img.Width - Img.Canvas.Pen.Width) div 2;
Result.Y:= (Img.Height - Img.Canvas.Pen.Width) div 2;
if x < Result.X then
Inc(Result.X, x)
else
Dec(Result.X, x);
if y < Result.Y then
Dec(Result.Y, y)
else
Inc(Result.Y, y);
end;
Ejemplo de uso:
Código Delphi
[-]
var
P1,P2: TPoint;
begin
P1:= GetRectCoord(Image1,-60,-60);
P2:= GetRectCoord(Image1,25,25);
Image1.Canvas.MoveTo(P1.X, P1.Y);
Image1.Canvas.LineTo(P2.X, P2.Y);
...
Saludos