mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-29 09:40:20 +02:00
SetSize with output dimensions depending on orientation
This commit is contained in:
parent
6d03a2582e
commit
1eff5ae28a
@ -447,22 +447,18 @@ var
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TranslateSize(AWidth, AHeight: Integer): TSize;
|
function TranslateSize(out ASize: TSize): TSize;
|
||||||
|
var
|
||||||
|
iInt: Integer;
|
||||||
begin
|
begin
|
||||||
// image dimension depending on orientation
|
// returning image dimension depending on orientation
|
||||||
case FOrientation of
|
if FOrientation in [eoMirrorHorRot270, eoRotate90, eoMirrorHorRot90, eoRotate270] then
|
||||||
eoUnknown, eoNormal, eoMirrorHor, eoRotate180, eoMirrorVert:
|
begin
|
||||||
begin
|
iInt := ASize.Width;
|
||||||
Result.Width := AWidth;
|
ASize.Width := ASize.Height;
|
||||||
Result.Height := AHeight;
|
ASize.Height := iInt;
|
||||||
end;
|
|
||||||
eoMirrorHorRot270, eoRotate90, eoMirrorHorRot90, eoRotate270:
|
|
||||||
begin
|
|
||||||
Result.Width := AHeight;
|
|
||||||
Result.Height := AWidth;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
InitReadingPixels;
|
InitReadingPixels;
|
||||||
@ -473,7 +469,8 @@ begin
|
|||||||
|
|
||||||
jpeg_start_decompress(@FInfo);
|
jpeg_start_decompress(@FInfo);
|
||||||
|
|
||||||
LOutputSize := TranslateSize(FInfo.output_width, FInfo.output_height);
|
LOutputSize := Size(FInfo.output_width, FInfo.output_height);
|
||||||
|
TranslateSize(LOutputSize);
|
||||||
FWidth := LOutputSize.Width;
|
FWidth := LOutputSize.Width;
|
||||||
FHeight := LOutputSize.Height;
|
FHeight := LOutputSize.Height;
|
||||||
Img.SetSize(FWidth, FHeight);
|
Img.SetSize(FWidth, FHeight);
|
||||||
|
Loading…
Reference in New Issue
Block a user