L
lmcui
Unregistered / Unconfirmed
GUEST, unregistred user!
不是24位真彩色了,大家帮忙看看,切割的代码片断如下,
procedure TMainForm.SplitImage(RBx,RBy,REx,REy: Integer; ImgName: string);
//切割的图象为ImgSrc,是一个TImage
//RBx,RBy: 图象片断的起始坐标
//REX,REy: 结束坐标
//ImgName: 目标文件名
var
SrcRec,DstRec: TRect;
tmpImage : TImage;
begin
tmpImage := TImage.Create(Application);
tmpImage.Stretch := False;
tmpImage.AutoSize := False;
tmpImage.Width := REx - RBx;
tmpImage.Height := REy - RBy;
SrcRec := Rect(RBx,RBy,REx,REy);
DstRec := Rect(0,0,REx-RBx,REy-RBy);
tmpImage.Canvas.CopyRect(DstRec,ImgSrc.Canvas,SrcRec);
tmpImage.Center := True;
tmpImage.AutoSize := True;
tmpImage.Picture.SaveToFile(ImgName);
FreeAndNil(tmpImage);
end;
procedure TMainForm.SplitImage(RBx,RBy,REx,REy: Integer; ImgName: string);
//切割的图象为ImgSrc,是一个TImage
//RBx,RBy: 图象片断的起始坐标
//REX,REy: 结束坐标
//ImgName: 目标文件名
var
SrcRec,DstRec: TRect;
tmpImage : TImage;
begin
tmpImage := TImage.Create(Application);
tmpImage.Stretch := False;
tmpImage.AutoSize := False;
tmpImage.Width := REx - RBx;
tmpImage.Height := REy - RBy;
SrcRec := Rect(RBx,RBy,REx,REy);
DstRec := Rect(0,0,REx-RBx,REy-RBy);
tmpImage.Canvas.CopyRect(DstRec,ImgSrc.Canvas,SrcRec);
tmpImage.Center := True;
tmpImage.AutoSize := True;
tmpImage.Picture.SaveToFile(ImgName);
FreeAndNil(tmpImage);
end;