• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 

Post reply

Other options

Shortcuts: ALT+S save/post or ALT+P preview

Topic summary

Posted by Galfar
 - 10 August 2018, 01:49:35
Hi,

I've just tested your sample (0->360 degrees) and I've had no crashes
(Lazarus 1.8.4 on Win10, Imaging latest rev. from May 2018, just empty new LCL app).

What versions exactly did you use? Maybe some compiler settings are affecting this?
Posted by JernejL
 -  9 August 2018, 12:06:51
I'm trying to rotate an image for 309 degrees, and it results in a strange crash:

Quote
#0 SYSTEM_$$_WAITFREE_VAR$PMEMCHUNK_VAR at :0
#1 SYSTEM_$$_SYSFREEMEM_VAR$PFREELISTS$PMEMCHUNK_VAR$$LONGWORD at :0
#2 ?? at :0
#3 FREEMEMNIL(<error reading variable: Attempt to dereference a generic pointer.>) at J:\\Top Down City\EDITORS\Imaging\Source\ImagingUtility.pas:325
#4 FREEIMAGE({WIDTH = 256, HEIGHT = 256, FORMAT = IFA8R8G8B8, SIZE = 262144, BITS = 0x13450070, PALETTE = 0x0}) at J:\\Top Down City\EDITORS\Imaging\Source\Imaging.pas:792
#5 ROTATE45({WIDTH = 256, HEIGHT = 256, FORMAT = IFA8R8G8B8, SIZE = 262144, BITS = 0x13450070, PALETTE = 0x0}, 22, 0x16af720) at J:\\Top Down City\EDITORS\Imaging\Source\Imaging.pas:1970
#6 ROTATEIMAGE({WIDTH = 256, HEIGHT = 256, FORMAT = IFA8R8G8B8, SIZE = 262144, BITS = 0x13450070, PALETTE = 0x0}, 22) at J:\\Top Down City\EDITORS\Imaging\Source\Imaging.pas:2104
#7 MAKEADOOR(292, 0x16afa44) at u_cared.pas:2195
#8 TWND_CAREDITOR__BTN_GENERATEDOORSCLICK(0x17f4c48, <error reading variable>) at u_cared.pas:2348



The crash seems to be depending on which angle i set to rotate about, other angles (343, 326) work well, but 309 degrees seems to be causing an issue.

Image is in this format:

img_door_builder_temp =

record TIMAGEDATA {
  WIDTH = 256,
  HEIGHT = 256,
  FORMAT = IFA8R8G8B8,
  SIZE = 262144,
  BITS = $13450060,
  PALETTE = $0}

Reproducing this is rather easy:

Quote
procedure Twnd_careditor.BitBtn2Click(Sender: TObject);
var
    imgtest: TImageData;
begin

    InitImage(imgtest);

    NewImage(256, 256, IFA8R8G8B8, imgtest);

    RotateImage(imgtest, 309);

    FreeImage(imgtest);

end;


This example seems to show the crash starting at angles 46 and up, but not all ranges seem affected equally:

Quote
procedure Twnd_careditor.BitBtn2Click(Sender: TObject);
var
    imgtest: TImageData;
   i: Integer;
begin

   for i:= 0 to 360 - 1 do begin

      InitImage(imgtest);
       NewImage(256, 256, IFA8R8G8B8, imgtest);
        OutputDebugString(pchar(format('angle %d', [ i ])));
       RotateImage(imgtest, round(i));
       FreeImage(imgtest);

   end;

end;


I think an older imaging version rotated well, maybe i can figure out which one i used in past.
SMF spam blocked by CleanTalk