我有一个Image, 里面放一张图. 图片很大但是我把strech 设置成true800*600的图 在400*400 的Image 框里显示现在我在IMAGE里任意拉一个框rect .想把rect拖出的内容保存起来.(注意,你在缩略图上拉的图片坐标和实际坐标是有不同的.)
如你拉个100,100,300,200 这个范围,实际图片这个区域要比在缩略图上的坐标更大.不知叙述的各位看明白没?谢谢啊.顶的也有分...现在这块困扰我很久 bitblt,strechblt,copyrect 都不能很好解决.
如你拉个100,100,300,200 这个范围,实际图片这个区域要比在缩略图上的坐标更大.不知叙述的各位看明白没?谢谢啊.顶的也有分...现在这块困扰我很久 bitblt,strechblt,copyrect 都不能很好解决.
框在原图中的座标:
Left=缩略图上的Left*2 //因为原图width800,缩略图width400
Right=Width-(缩略图的width-缩略图上的Right)*2
Top=缩略图上的Top*1.5
Bottom=Height-(缩略图的Height-缩略图上的Bottom)*1.5
var
rect,newrect:Trect;begin rect.Left:=10;
rect.Right:=100;
rect.Top:=20;
rect.Bottom:=200;
newrect.Left:=(image1.Picture.Width div image1.Width)*rect.Left;
newrect.right:=(image1.Picture.Width div image1.Width)*rect.Right;
newrect.top:=(image1.Picture.Height div image1.Height)*rect.top;
newrect.bottom:=(image1.Picture.Height div image1.Height)*rect.bottom;
//image1.Canvas.CopyRect(newrect,..);
end;
newrect.Left:=round((image1.Picture.Width / image1.Width)*rect.Left);