procedure TFSectorVisualizar.asignarImagen(inY, finY : Integer);
var
x,y, x1, y1, xIni, yIni : Integer;
BitMap : TBitMap;
P : PByteArray;
lColor : TColor;
rectanOrigen : TRect;
begin
try
x1 := 0;
y1 := 0;
xIni := ImagenOrigen.Width;
yIni := ImagenOrigen.Height;
Bitmap := TBitmap.Create;
Bitmap.Width:= ImagenOrigen.Width;
Bitmap.Height:= ImagenOrigen.Height;
Bitmap.Canvas.Draw(0,0,ImagenOrigen.Picture.Graphic);
for y := inY to FinY do
begin
for x := 0 to BitMap.Width -1 do
begin
if BitMap.Canvas.Pixels[x,y] = clblack then
begin
if x > x1 then
x1 := x;
if y > y1 then
y1 := y;
if x < xIni then
xIni := x;
if y < yIni then
yIni := y;
end;
end;
end;
imDestino.Width := x1 - xIni;
imDestino.Height := y1 - yIni;
xIni := ImagenOrigen.Left + xIni;
yIni := ImagenOrigen.Top + yIni;
rectanOrigen := rect(xIni, yIni, x1, y1);
if (x1 > xIni) and (y1 > YIni) then
Copiar(Canvas.Handle,imPaciente.Canvas.Handle,rectanOrigen,1)
finally
end;
end;
procedure TFSectorVisualizar.Copiar(SrcDC, DestDc: HDC; SrcRect: TRect; Zoom: Integer);
begin
StretchBlt(DestDC, 0,0, SrcRect.Right, SrcRect.Bottom, SrcDC, SrcRect.Left,
SrcRect.Top, SrcRect.Right, SrcRect.Bottom, SRCCOPY);
end;