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
Post
by ber » Tue Dec 02, 2008 8:39 am
Hi tranparent code
I have error message
Code: Select all
i: integer;
filename1, filename: string;
finfo,fgh : TGFL_FILE_INFORMATION;
lp: TGFL_LOAD_PARAMS;
sp: TGFL_SAVE_PARAMS;
gfl_bmp,logo : PGFL_BITMAP;
e, f,g,c: GFL_ERROR;
format: string;
rect: PGFL_RECT;
color: PGFL_COLOR ;
begin
OpenDialog.Filter := GflFilterString;
if not OpenDialog.Execute then
exit;
filename := OpenDialog.Filename;
if FileName <> '' then
begin
color.Red:=255;
color.Blue:=0;
color.Green:=0;
color.Alpha:=0;
gfl_bmp:= gflAllockBitmap(GFL_RGB,60,60,4,color);
color.Red:=0;
color.Blue:=255;
color.Green:=0;
color.Alpha:=255;
logo := gflAllockBitmap(GFL_RGBA,120,120,4,color);
gflGetDefaultLoadParams(lp);
lp.Flags := GFL_LOAD_ORIGINAL_COLORMODEL;
e := gflLoadBitmap(Pchar(filename), gfl_bmp, lp, finfo);
if (e <> gfl_no_error) then begin
MessageDlg('File not readable: ' + string(gflGetErrorString(e)), mtError, [mbOK], 0);
exit;
end;
g:= gflLoadBitmap(Pchar(filename), logo , lp, fgh);
if (g <> gfl_no_error) then begin
MessageDlg('File not readable: ' + string(gflGetErrorString(e)), mtError, [mbOK], 0);
exit;
end;
rect.x:=0;
rect.y:=0;
rect.w:=fgh.Width;
rect.h:=fgh.Height;
c:= gflBitblt( logo, rect, gfl_bmp , 0, 0);//error message? [DCC Error] Incompatible types: 'PPGFL_BITMAP' and 'PGFL_BITMAP'???
dominique
Posts: 72 Joined: Thu Nov 08, 2007 9:22 am
Post
by dominique » Tue Dec 02, 2008 9:37 am
Types mismatch in the function call
from the include pas file :
Code: Select all
function gflBitblt(src: PGFL_BITMAP; rect: PGFL_RECT;
dst: PPGFL_BITMAP; x_dest, y_dest: GFL_INT32): GFL_ERROR; stdcall;
the third argument is a PPGFL_BITMAP and in your code you put gfl_bmp witch is a PGFL_BITMAP
I'm not shure but I think you should not use gflAllockBitmap for gfl_bmp and logo, gflLoadBitmap will do memory allocation for you.
Dom
dominique
Posts: 72 Joined: Thu Nov 08, 2007 9:22 am
Post
by dominique » Tue Dec 02, 2008 3:30 pm
Functions 'signatures seem to be different in C++ and Delphi.
I look on google and it tells me that if you want to use a pointer you should add the ^ character befor the var name.
Perhaps Delphi users can help. If I were you, I try to write this code :
Code: Select all
c:= gflBitblt( logo, rect, @gfl_bmp , 0, 0);
I was wrong sorry
@ is the address of the var
^ declare a pointer of a given type
Last edited by dominique on Wed Dec 03, 2008 10:44 am, edited 1 time in total.
Dom
ber
Posts: 6 Joined: Wed Nov 26, 2008 1:32 pm
Post
by ber » Wed Dec 03, 2008 9:07 am
Thank you but code not working.
Code: Select all
finfo,fgh : TGFL_FILE_INFORMATION;
lp: TGFL_LOAD_PARAMS;
sp: TGFL_SAVE_PARAMS;
gfl_bmp,logo : PGFL_BITMAP;
cc:PPGFL_BITMAP;
e, f,g: GFL_ERROR;
format: string;
rect: PGFL_RECT;
color: PGFL_COLOR ;
begin
gflGetDefaultLoadParams(lp);
lp.Flags := GFL_LOAD_ORIGINAL_COLORMODEL;
e := gflLoadBitmap(Pchar('main.jpg'), gfl_bmp, lp, finfo);
if (e <> gfl_no_error) then begin
MessageDlg('File not readable: ' + string(gflGetErrorString(e)), mtError, [mbOK], 0);
exit;
end;
g:= gflLoadBitmap(Pchar('logo.jpg'), logo , lp, fgh);
if (g <> gfl_no_error) then begin
MessageDlg('File not readable: ' + string(gflGetErrorString(e)), mtError, [mbOK], 0);
exit;
end;
rect.x:=0;
rect.y:=0;
rect.w:=finfo.Width;
rect.h:=finfo.Height;
cc:=@gfl_bmp;
gflBitblt( logo, rect, cc , 0, 0);
dominique
Posts: 72 Joined: Thu Nov 08, 2007 9:22 am
Post
by dominique » Wed Dec 03, 2008 11:08 am
Can't help more, sorry.
Did you try to use simple images like 8bits gray scale images, with a logo smaller than the main image?
Dom
ber
Posts: 6 Joined: Wed Nov 26, 2008 1:32 pm
Post
by ber » Wed Dec 03, 2008 2:15 pm
Thanks,
No error message but don't working... I don't understand.
Do you help me please...
Code: Select all
var
i,a: integer;
finfo,fgh : TGFL_FILE_INFORMATION;
lp: TGFL_LOAD_PARAMS;
sp: TGFL_SAVE_PARAMS;
gfl_bmp,logo : PGFL_BITMAP;
e, f, g: GFL_ERROR;
rect: TGFL_RECT;
color: PGFL_COLOR ;
begin
gflGetDefaultLoadParams(lp);
lp.Flags := GFL_LOAD_ORIGINAL_COLORMODEL;
e := gflLoadBitmap(Pchar('main.jpg'), gfl_bmp, lp, finfo);
if (e <> gfl_no_error) then begin
MessageDlg('File not readable: ' + string(gflGetErrorString(e)), mtError, [mbOK], 0);
exit;
end;
g:= gflLoadBitmap(Pchar('logo.jpg'), logo , lp, fgh);
if (g <> gfl_no_error) then begin
MessageDlg('File not readable: ' + string(gflGetErrorString(e)), mtError, [mbOK], 0);
exit;
end;
rect.x:=0;
rect.y:=0;
rect.w:=fgh.Width;
rect.h:=fgh.Height;
a:=gflBitblt(logo, @rect, @gfl_bmp , 0, 0);
ShowMessage(IntToStr(a));// message 0???
xnview
Author of XnView
Posts: 44325 Joined: Mon Oct 13, 2003 7:31 am
Location: France
Post
by xnview » Wed Dec 03, 2008 2:37 pm
ber wrote: No error message but don't working... I don't understand.
Do you help me please...
Sorry i can't help, i don't know delphi
Pierre.