Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[b]procedure[/b] ResizeBitmap(Bitmap: TBitmap; Width, Height: Integer; Background: TColor);
[b]var[/b]
R: TRect;
B: TBitmap;
X, Y: Integer;
[b]begin[/b]
[b]if[/b] assigned(Bitmap) [b]then[/b] [b]begin[/b]
B:= TBitmap.Create;
[b]try[/b]
[b]if[/b] Bitmap.Width > Bitmap.Height [b]then[/b] [b]begin[/b]
R.Right:= Width;
R.Bottom:= ((Width * Bitmap.Height) [b]div[/b] Bitmap.Width);
X:= [navy]0[/navy];
Y:= (Height [b]div[/b] [navy]2[/navy]) - (R.Bottom [b]div[/b] [navy]2[/navy]);
[b]end[/b] [b]else[/b] [b]begin[/b]
R.Right:= ((Height * Bitmap.Width) [b]div[/b] Bitmap.Height);
R.Bottom:= Height;
X:= (Width [b]div[/b] [navy]2[/navy]) - (R.Right [b]div[/b] [navy]2[/navy]);
Y:= [navy]0[/navy];
[b]end[/b];
R.Left:= [navy]0[/navy];
R.Top:= [navy]0[/navy];
B.PixelFormat:= Bitmap.PixelFormat;
B.Width:= Width;
B.Height:= Height;
B.Canvas.Brush.Color:= Background;
B.Canvas.FillRect(B.Canvas.ClipRect);
B.Canvas.StretchDraw(R, Bitmap);
Bitmap.Width:= Width;
Bitmap.Height:= Height;
Bitmap.Canvas.Brush.Color:= Background;
Bitmap.Canvas.FillRect(Bitmap.Canvas.ClipRect);
Bitmap.Canvas.Draw(X, Y, B);
[b]finally[/b]
B.Free;
[b]end[/b];
[b]end[/b];
[b]end[/b];