GFLRotate

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, helmut, xnview

ber
Posts: 6
Joined: Wed Nov 26, 2008 1:32 pm

GFLRotate

Post by ber »

Hi,
I am using Delphi . I have a problem with GFLRotate.

Code: Select all

procedure TImageViewForm.vb1Click(Sender: TObject);
var
  InformationFichier: TGFL_File_Information;
  LoadParam          : TGFL_Load_Params;
//  spr                : TGFL_SAVE_PARAMS;
  Erreur                 : GFL_Error;
  GFLImage           : PGFL_Bitmap;
  gfl_bmp_dst: PPGFL_BITMAP;
  Rotation :integer;
  filename: string;
  Pgfl_colorRotar: TGFL_COLOR;
begin
  OpenDialog.Filter := GflFilterString;
  if not OpenDialog.Execute then
    exit;
  filename := OpenDialog.Filename;
  Pgfl_colorRotar.Red := 0;
  Pgfl_colorRotar.Green := 0;
  Pgfl_colorRotar.Blue := 0;
  Pgfl_ColorRotar.Alpha := 0;
  Rotation := Rotation +90;
  if Rotation > 270 then Rotation := 0;
  gflGetDefaultLoadParams(LoadParam);
  LoadParam.Flags := GFL_LOAD_METADATA;
  Erreur := gflLoadBitmap(PChar(filename), GFLImage, LoadParam, InformationFichier);
  GFLRotate(GFLImage,nil, 180 ,Pgfl_colorRotar);
//  f := gflSaveBitmap(PChar(filename),GFLImage, LoadParam );
end;
User avatar
dominique
Posts: 72
Joined: Thu Nov 08, 2007 9:22 am

Post by dominique »

I use it with c++builder whitout problem perhaps you should first test the variable Erreur after gflLoadBitmap to be shure that the bitmap is well loaded. It must be equal to 0 (GFL_NO_ERROR).
It's better if you precise the type of error too to help debugging
Dom
ber
Posts: 6
Joined: Wed Nov 26, 2008 1:32 pm

Post by ber »

No error message but don't working...

Code: Select all

procedure TImageViewForm.vb1Click(Sender: TObject);
var
  InformationFichier: TGFL_File_Information;
  LoadParam          : TGFL_Load_Params;
  spr                : TGFL_SAVE_PARAMS;
  Erreur ,f                : GFL_Error;
  GFLImage          : PGFL_Bitmap;
  gfl_bmp_dst: PPGFL_BITMAP;
  Rotation :integer;
  filename: string;
  Pgfl_colorRotar: TGFL_COLOR;
begin
  OpenDialog.Filter := GflFilterString;
  if not OpenDialog.Execute then
    exit;
  filename := OpenDialog.Filename;
  Pgfl_colorRotar.Red := 255;
  Pgfl_colorRotar.Green := 255;
  Pgfl_colorRotar.Blue := 255;
  Pgfl_ColorRotar.Alpha := 0;
  Rotation := 90;
  if Rotation > 270 then Rotation := 0;
  gflGetDefaultLoadParams(LoadParam);
  LoadParam.Flags := GFL_LOAD_METADATA;
  Erreur := gflLoadBitmap(PChar(filename), GFLImage, LoadParam, InformationFichier);
  ShowMessage(IntToStr(Erreur));  //  0 No error
  GFLRotate(GFLImage,nil,  Rotation ,Pgfl_colorRotar);
  gflGetDefaultSaveParams(spr);
  spr.Flags:=GFL_SAVE_REPLACE_EXTENSION;
  spr.FormatIndex:=gflGetFormatIndexByName('jpg');
  spr.Compression:=GFL_LZW;
  spr.CompressionLevel:=7;
  spr.Quality:=75;
  f := gflSaveBitmap(PChar(filename),GFLImage , spr );
end;
User avatar
dominique
Posts: 72
Joined: Thu Nov 08, 2007 9:22 am

Post by dominique »

In I use gflRotateFine but I test gflRotate without problem in C++Builder. Perhaps someone else can test with Delphi to help ber?
Dom