TJPEGImage.Scale will not compile
I am fairly new to Lazarus and was trying to port an application from Delphi for resizing Jpeg images to various screen resolutions (such as 1400x900), but ran into a problem with TJPEGImage.Scale. It appears Scale is not supported in Lazarus' implementation of TJPEGImage. Any suggestions.
procedure TForm1.btnResizeImageClick(Sender: TObject);
var
Jpeg1, Jpeg2: TJPEGImage;
TempBitmap : TBitMap;
CanvasRect : TRect;
x, nscale : integer;
aspect, maxaspect : single;
picdisp : String;
begin
x := lbxFileListBox.ItemIndex;
picdisp := lbxFileListBox.Items
TempBitmap := TBitmap.Create;
Jpeg1 := TJPEGImage.Create;
Jpeg2 := TJPEGImage.Create;
try
Jpeg1.LoadFromFile(picdisp);
//Find the width and height which fits inside the maximum rectangle
//while preserving the aspect ratio
aspect := Jpeg1.Width /Jpeg1.Height;
maxaspect := sw / sh;
if (aspect > maxaspect) then
begin
TempBitmap.Width := sw;
TempBitmap.Height := round(sw / aspect);
end
else
begin
TempBitmap.Width := round(sh * aspect);
TempBitmap.Height := sh;
end;
//Find the scale that causes the jpg to be as small as possible while
//still larger than the destination width and height. This ensures that
//when the image is resampled it doesn't increase any dimention, only downsize
nscale :=floor(min(Jpeg1.Width / TempBitmap.Width, Jpeg1.Height /TempBitmap.Height));
case nscale of
0..1: begin
Jpeg1.Scale := jsFullSize; Error: identifier indents no member "Scale"
nscale := 1;
end;
... more code