LoadFromStream/SaveToStream (Delphi)

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

Moderators: XnTriq, helmut, xnview

Adem

LoadFromStream/SaveToStream (Delphi)

Post by Adem »

I am trying to create a class based on TGraphic but I need a little more info.

Is there a way to emulate LoadFromStream and SaveToStream methods in the SDK?

gflLoadBitmapFromHandle() looks as if it can handle that sort of thing, but I am not sure --nor do I know what each parameter means in real life. Especially the 'handle: GFL_HANDLE'.

Cheers,
Adem
Matthias

Re: LoadFromStream/SaveToStream

Post by Matthias »

I went around this by simply saving the stream to a temp file and then have libgfl load/save the file.

Matthias
Matthias

Re: TGraphic

Post by Matthias »

Do you think about releasing your TGraphic descendant? I would be interested in replacing my own with a better one :)

Matthias
Adem

Post by Adem »

Second question first: Yes, of course I will/would publish it. I dont see any reason why I should keep it private.

Now, the first: I hate using disk for that sort operation. It defeats the whole idea of being a fast lib --all we end up with is a cludge.

Once I get some answer to this loadstream/savestream issue, my next target will be using TSharedImage since TGraphic uses it quite cleverly to speed up Assign().

Cheers,
Adem
User avatar
xnview
Author of XnView
Posts: 45066
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: LoadFromStream/SaveToStream [Delphi]

Post by xnview »

Hello,
Adem wrote:Is there a way to emulate LoadFromStream and SaveToStream methods in the SDK?
gflLoadBitmapFromHandle() looks as if it can handle that sort of thing, but I am not sure --nor do I know what each parameter means in real life. Especially the 'handle: GFL_HANDLE'.
Yes, you must use gflLoadBitmapFromHandle. GFL_HANDLE is a pointer of your data. If you know C/C++, there is an example.
Regards. Pierre.
Philips10
Posts: 7
Joined: Wed Feb 09, 2005 9:36 am

gflLoadBitmapFromHandle with Delphi..a few lines of code ple

Post by Philips10 »

Hi Pierre

Could you please give us Delphi-programmers a few lines of code that shows us how to use gflLoadBitmapFromHandle

I got

Code: Select all

 ms := tmmorystream.creat
 try
   ........
   image1.picture.bitmap.savetostream(ms);
   e := gflLoadBitmapFromHandle( ?? , gfl_bmp, lp, fInfo);
    .........
 finally
   ms.free;
 end;
If this is right so far, what to add for the two questionmarks ??

If not at all, please a few lines that shows the use of gflLoadBitmapFromHandle

Thanks and kind Regards

Jansen