Модератор: Модераторы
procedure ScaleBitmap(aBitmap: TBitmap;Scale: Single);
var
tmp: TBitmap;
begin
tmp := TBitmap.Create;
try
tmp.Width := Round(aBitmap.Width * Scale);
tmp.Height := Round(aBitmap.Height * Scale);
tmp.Canvas.StretchDraw(Bounds(0,0,tmp.Width,tmp.Height), aBitmap);
aBitmap.Assign(tmp);
finally
tmp.Free;
end;
end;
iskander писал(а):Можно так:
- Код: Выделить всё
procedure ScaleBitmap(aBitmap: TBitmap;Scale: Single);
var
tmp: TBitmap;
begin
tmp := TBitmap.Create;
try
tmp.Width := Round(aBitmap.Width * Scale);
tmp.Height := Round(aBitmap.Height * Scale);
tmp.Canvas.StretchDraw(Bounds(0,0,tmp.Width,tmp.Height), aBitmap);
aBitmap.Assign(tmp);
finally
tmp.Free;
end;
end;
function ScaleBitmap(aBitmap:TBitmap;Scale:Single):TBitmap;
begin
if (aBitmap.Width<>0)and(aBitmap.Height<>0) then
begin
result:=TBitmap.Create;
result.Width:=Round(aBitmap.Width*Scale);
result.Height:=Round(aBitmap.Height*Scale);
result.Canvas.StretchDraw(Bounds(0,0,result.Width,result.Height),aBitmap);
end else result:=nil;
end;
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 234