Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, December 2, 2008 1:16:27 AM(UTC)
David Laabs

Groups: Registered
Posts: 8


I Converted from V14.5 to V16 and have this code fragment: (I Loaded a JPG File into pBuffer with nLength)

...
LBuffer b( (L_VOID*)(void*)pBuffer, (DWORD)nLength );

FILEINFO fi;
fi.Flags = 0;
fi.uStructSize = sizeof(FILEINFO);

LMemoryFile f;
f.SetBitmap( this );
nRet = f.Load( b, 32, ORDER_BGR, NULL, &fi );
...

Problem is, that LMemoryFile.Load allways returns 0. The code worked fine in V14.5 ("LoadBitmap") with my test file.

Please help me...
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Tuesday, December 2, 2008 7:10:35 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)

Is this issue specific to certain files, or all files?
Try initializing the FILEINFO structure before passing it to see if this is what causing the problem.
 
#3 Posted : Wednesday, December 3, 2008 3:42:44 AM(UTC)
David Laabs

Groups: Registered
Posts: 8


Code 0 comes with all images I tried...

The only reason for giving the FILEINFO-structure as parameter is that I wanted to have some image infos back... What should I put in there as initialisation?

In the help of the load-function my implementation of the FILEINFO-structure parameter is explicitly mentioned as valid...
 
#4 Posted : Wednesday, December 3, 2008 4:43:03 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)

David,
The API help topic state that you need to initialize this structure before using it. I notified our documentation team to include this piece of information in our C++ Class Library help file.
You should always initialize structures before using them to insure that you don't have invalid values in them. Try defining the FILEINFO structure as follows:
FILEINFO fi={0};
 
#5 Posted : Thursday, December 4, 2008 4:48:53 AM(UTC)
David Laabs

Groups: Registered
Posts: 8


OK. I changed the parameters of LMemoryFile.Load and don't give it the pointer to the FILEINFO structure any longer... (NULL instead)
That works.

But I really want the Information that the V14.5 hat put in the FILEINFO structure (fi.SizeDisk, fi.Compression, fi.ColorSpace, ...). So i wrote this: (b is the LBuffer and f the LMemoryFile as before)

...
FILEINFO fi;
fi.Flags = 0;
fi.uStructSize = sizeof(FILEINFO);
L_INT nRet = f.GetInfo( b, &fi, sizeof(FILEINFO) );
...

Again i get the Code 0 with all Images I testet. Please tell me what i have to initialize in the FILEINFO structure in order to get the desired information... It worked fine in V14.5.
 
#6 Posted : Thursday, December 4, 2008 5:05:35 AM(UTC)
David Laabs

Groups: Registered
Posts: 8


... I resolved the problem.
It really was that simple:

...
memset( &fi, 0, sizeof(FILEINFO) );
...

... and everything's fine, even my first code. So the V16 is more correct in checking parameter values :-)

Thanks for your help!
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.152 seconds.