我用到过,这个是我BMP类的一个缩小方法,缩小时不失真的
FGraphic就是TBitMap实例对象。
function TMyBmpEditer.Zoom(nWidth, nHeight: integer; IsScale,
IsInFrame: Boolean): Boolean;
begin
try
if IsScale then
GetScaleSize(FGraphic.Height, FGraphic.Width
, nHeight, nWidth, IsInFrame); //按比例计算新图大小
//缩小不失真的函数,设置图片扫描模式。
SetStretchBltMode(TBitmap(FGraphic).Canvas.Handle, HALFTONE);
TBitmap(FGraphic).Width := nWidth;
TBitmap(FGraphic).Height := nHeight;
TBitmap(FGraphic).Canvas.StretchDraw(TBitmap(FGraphic).Canvas.ClipRect
, FGraphic);
Result := true;
except
Result := false;
end;
end;