Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 01-24-2009, 01:20 AM
Mini-Programer Mini-Programer is offline
Senior Member
 
Join Date: Jun 2008
Posts: 508
Default How to stretch Bitmap ?

Hi

I have tested this function but the quality is very bad
and if I give the original size again in edit1 and edit2 so I can not get the original quality too !!!
[DELPHI]
function TForm1.ResizeBmp(bitmp: TBitmap; wid, hei: Integer): Boolean;
var
TmpBmp: TBitmap;
ARect: TRect;
begin
Result := False;
try
TmpBmp := TBitmap.Create;
try
TmpBmp.Width := wid;
TmpBmp.Height := hei;
ARect := Rect(0,0, wid, hei);
TmpBmp.Canvas.StretchDraw(ARect, Bitmp);
bitmp.Assign(TmpBmp);
finally
TmpBmp.Free;
end;
Result := True;
except
Result := False;
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
ResizeBmp(Image1.Picture.Bitmap ,StrToInt(Edit1.Text) , StrToInt(Edit2.Text));
end;

[/DELPHI]

I just want to stretch the image without Bitmap. Because I do not need to save the Result as Bitmap

any Idea ?
Reply With Quote
  #2  
Old 01-24-2009, 01:29 AM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 4,832
Default RE: How to stretch Bitmap ?

Are you trying to stretch the TImage component without stretching the picture insid? If yes, then:

1- Set The "Stretch" and "AutoSize" properties of the TImage component to FASLE:

[DELPHI]Image1.AutoSize := False;
Image1.Stretch := False;[/DELPHI]
2- Change the Hieght and Width of the TImage component to any size you want:

[DELPHI]Image1.Height := StrToInt(Edit1.Text);
Image1.Width := StrToInt(Edit2.Text);[/DELPHI]

Regards,
Abdulaziz Jasser
Reply With Quote
  #3  
Old 01-24-2009, 01:51 AM
Mini-Programer Mini-Programer is offline
Senior Member
 
Join Date: Jun 2008
Posts: 508
Default RE: How to stretch Bitmap ?

Hi

no, I want to resize the Bitmap inside to
But just Stretch the Bitmap. because I want to rest the stretch too with the code what you have written

I need this only as preview and I do not need to save the bitmap
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 12:21 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.