小智 9
通过使用HALFTONE StretchBltMode,您将获得比正常stretchdraw更平滑的结果.这只适用于Windows 2000及更高版本
procedure SmoothResize();
var pt:TPoint;
h: HDC;
begin
h := imgMainPicture.Canvas.Handle;
// Previous call to StretchDraw
// imgMainPicture.Canvas.StretchDraw(Rect(0, 0, imgMainPicture.Width - 1,
// imgMainPicture.Height - 1), curPicture.AnnotatedBitmap);
// Normal StretchDraw uses STRETCH_DELETESCANS as StretchBltMode , HALFTONE should give better results
GetBrushOrgEx(h, pt);
SetStretchBltMode(h, HALFTONE);
SetBrushOrgEx(h, pt.x, pt.y, @pt);
StretchBlt(h, 0, 0, imgMainPicture.Width - 1,
imgMainPicture.Height - 1, curPicture.AnnotatedBitmap.Canvas.Handle,
0, 0, curPicture.Width,curPicture.Height,SRCCOPY);
end;
Run Code Online (Sandbox Code Playgroud)
我想你的意思是在TImage上的Stretched = True,而不是在TBitmap上.
不幸的是,在调整图像大小时,TImage没有内置的重新采样器.我的建议是使用Graphics32,因为它支持各种重采样器(有些更适合增加其他尺寸以减小尺寸)
归档时间: |
|
查看次数: |
5204 次 |
最近记录: |