Hi,
When testing BGRABitmap.PutImageAngle I noticed a peculiarity that
seem to be related to colorvalues that are multiples of 256.
To make a real test I made 2 images, both with only 2 colorvalues.
One with colorvalues 200 and 300 and the other with colorvalues 300 and 400.
Attached are
the original images(img_200_300.png and img_300_400.img),
the corresponding rotated images(img_200_300_rotated.png and img_300_400_rotated.png),
the rotated images in 3D(img3D_200_300.png and img3D_300_400.png) and
profiles over a part of the rotated images(profile_200_300.png and profile_300_400.png).
Code used as follows:
procedure TfrmRotateModel.btnVridBildClick(Sender: TObject);
var
bmp, bmprotate : TBGRABitmap;
temp : string;
begin
if not OpenPictureDialog1.Execute then Exit;
bmp := TBGRABitmap.Create(OpenPictureDialog1.FileName);
bmprotate := TBGRABitmap.Create(4 * bmp.Width, 4 * bmp.Height, clWhite);
try
bmprotate.PutImageAngle(0.75 * bmp.Width, 1.5 * bmp.Height, bmp,
0, bmp.Width div 2, bmp.Height div 2);
bmprotate.InvalidateBitmap;
temp := OpenPictureDialog1.FileName;
temp := ChangeFileExt(temp, '');
bmprotate.SaveToFile(temp + '_rotated.png');
finally
FreeAndNil(bmp);
FreeAndNil(bmprotate);
end;
end;
As seen from the code, rotation angle is zero, but PutImageAngle is executing
some code that gives the strange result at colorvalue 256.
In image: img3D_200_300.png one can see some extrem values when colors
change from 200 to 300. That is also seen in profile: profile_200_300.png.
That behavior is not seen in img3D_300_400.png and the corresponding profile.
Can someone explain what is going on and how to get rid of these odds?
Maybe I'm using PutImageAngle in a wrong way, please tell me if you find
any mistake on my part.
/stab
Windows 10 64 bit
Lazarus version: 1.8.4
FPC version: 3.0.4
SVN Rev: 57972