Hi,
i have ported my (Delphi) pet project Cheez to Gfl SDK 2.01.
Everything works fine (and i use most functions in Gfl SDK) except gflRotate() and gflRotateFine().
I get an access violation when using these two functions. The image gets rotated but it seems there is some kind of memory corruption because my program crashes shortly after the rotate (and i can see in the debugger that after the call to gflRotate some objects are destroyed/invalid).
If i replace the one line containing gflRotate() with ANY other function (gflFlipVertical, gflFlipHorizontal, gflBlur, gflBrightness etc) there is no problem, even under extensive testing.
I have tried both modes of calling the function (with and without a destination surface) but both crash... e.g.
e := gflRotate(gfl_bmp, nil, Angle);
or
e := gflRotate(gfl_bmp, gfl_bmp_dst, Angle);
e returns gfl_no_error (so everything seems normal)
Does anyone have any idea what might be causing this?
Thanks,
Dimitris
gflRotate access violation (Delphi)
Moderators: helmut, XnTriq, xnview
Hello,
I use the function in my project and i don't have problem.
(sorry for my english...)
I use the function in my project and i don't have problem.
Code: Select all
var
InformationFichier: TGFL_File_Information;
LoadParam : TGFL_Load_Params;
Erreur : GFL_Error;
GFLImage : PGFL_Bitmap;
begin
Rotation := Rotation + 90;
if Rotation > 270 then Rotation := 0;
gflGetDefaultLoadParams(LoadParam);
LoadParam.Flags := GFL_LOAD_METADATA;
Erreur := gflLoadBitmap(NomFichier, GFLImage, LoadParam, InformationFichier);
GFLRotate(GFLImage, nil, Rotation);
end;
Re: gflRotate access violation (Delphi)
In some case, gflRotate can cause an exception. I'll put soon a new release.daremon wrote:Everything works fine (and i use most functions in Gfl SDK) except gflRotate() and gflRotateFine().
Pierre.
PPGFL_BITMAP
Great news! Thanks!
Also something else you may want to do:
In libgfl.pas, lines 138-140:
138: PGFL_BITMAP = ^TGFL_BITMAP;
139: PPGFL_BITMAP = PGFL_BITMAP;
140: TGFL_BITMAP = record
PGFL_BITMAP is a pointer used by all functions' src parameter. PPGFL_BITMAP is a pointer to a pointer to a TGFL_BITMAP and is used by all functions' dst parameter. If my assumptions are correct, line 139 should be
139: PPGFL_BITMAP = ^PGFL_BITMAP;
(there is a ^ missing)
As it is right now PGFL_BITMAP and PPGFL_BITMAP are the same thing and Delphi accepts and compiles this:
when the correct syntax should be
With PPGFL_BITMAP = ^PGFL_BITMAP;
Delphi would only accept
Dimitris
Also something else you may want to do:
In libgfl.pas, lines 138-140:
138: PGFL_BITMAP = ^TGFL_BITMAP;
139: PPGFL_BITMAP = PGFL_BITMAP;
140: TGFL_BITMAP = record
PGFL_BITMAP is a pointer used by all functions' src parameter. PPGFL_BITMAP is a pointer to a pointer to a TGFL_BITMAP and is used by all functions' dst parameter. If my assumptions are correct, line 139 should be
139: PPGFL_BITMAP = ^PGFL_BITMAP;
(there is a ^ missing)
As it is right now PGFL_BITMAP and PPGFL_BITMAP are the same thing and Delphi accepts and compiles this:
Code: Select all
var
gfl_bmp_src, gfl_bmp_dst: PGFL_BITMAP;
begin
gflRotate(gfl_bmp_src, gfl_bmp_dst, 90);
when the correct syntax should be
Code: Select all
gflRotate(gfl_bmp_src, @gfl_bmp_dst, 90);
Delphi would only accept
Code: Select all
var
gfl_bmp_src: PGFL_BITMAP;
gfl_bmp_dst: PPGFL_BITMAP;
begin
gflRotate(gfl_bmp_src, gfl_bmp_dst, 90);
Dimitris