TBitmap gets smaller on rotation in delphi xe8 firemonkey multi device project


I have an TImage component with a bitmap. The image component size properties are singles and TBitmap size properties are integers. The bitmap needs to be the same size as the component and I’ve made a resize method that gets called every time the screen rotates.

So I’ve tried to trunc the component size in order to set the size and tried to round it, but every time the bitmap gets smaller.

I also tried to cast the sizes of the image component to integer so it doesn’t have to round the size for the bitmap. But this has no effect.

Is there a solution for this problem?

Code below is resize method of my Image component:

procedure TImage64.ResizeBitmap;
self.Bitmap.Resize(integer(trunc(Self.Size.Width*fScaleBy)), integer(trunc(Self.Size.Height*fScaleBy)));

Code below is how I have tried to set the image to integer size:

image64.Align := TAlignLayout.none;
image64.Width := integer(trunc(layoutImage.Width));
image64.Height:= integer(trunc(layoutImage.Height));
image64.Parent := layoutImage;

Comments are closed.