Page 1 of 1
Position of frames in animated gif
Posted: Tue Mar 21, 2006 6:04 pm
by Alessandro
Hi,
I thought I had solved my problems during the loading of animated gif files, instead lately I've found a file which I couldn't load properly.
Looks like some of the frames are smaller than frame 0 and I dunno where to place them inside the canvas because I don't find offset values in GFL_BITMAP or in other structures.
Right now I can only place them on top-left of canvas but of course the animation doesn't look good.
Thanks in advance for your reply.
Posted: Thu Apr 20, 2006 5:21 pm
by Alessandro
Hi,
to position the frames inside the canvas I used a code like follows:
Code: Select all
int LeftOfNewFrame=(gflBmp->Origin & GFL_RIGHT)!=0 ? WidthOfFirstFrame- WidthOfNewFrame: 0;
int TopOfNewFrame=(gflBmp->Origin & GFL_BOTTOM)!=0 ? HeightOfFirstFrame-HeightOfNewFrame : 0;
but I still don't obtain the correct positions
I've also found out where the framerate is stored:
Code: Select all
typedef struct { // 6 bytes
unsigned char iBlockSize; // Must be 4
unsigned char iTransparentColorFlag : 1;
unsigned char iUserInputFlag : 1;
unsigned char iDisposalMethod : 3;
unsigned char iReserved : 3;
unsigned short iDelayTime;
unsigned char iTransparentColorIndex;
unsigned char iBlockTerminator; // Must be 0
} GIF_GRAPHIC_CONTROL_EXTENSION;
yet the positon of this tructure changes so I dunno how to find the offset from the start of the file....
Can you help me?
Please, at least say "I don't know"...if that's the case
Thanks.
Re: Position of frames in animated gif
Posted: Tue May 02, 2006 7:48 am
by xnview
Alessandro wrote:Hi,
I thought I had solved my problems during the loading of animated gif files, instead lately I've found a file which I couldn't load properly.
Looks like some of the frames are smaller than frame 0 and I dunno where to place them inside the canvas because I don't find offset values in GFL_BITMAP or in other structures.
Right now I can only place them on top-left of canvas but of course the animation doesn't look good.
Currently there is no way to retrieve frame position...
Posted: Fri May 05, 2006 11:33 am
by Alessandro
Weird, xnview can show animated gif files properly...
Posted: Fri May 05, 2006 5:11 pm
by xnview
Alessandro wrote:Weird, xnview can show animated gif files properly...
Yes, but xnview doesn't use GFL (or internal library) to show animated gif
Posted: Fri May 05, 2006 5:50 pm
by Alessandro
Do you plan to add the needed fields sooner or later or should I start to write a workaround myself (if I can find enough info of course)?
Posted: Mon May 08, 2006 8:29 am
by xnview
Alessandro wrote:Do you plan to add the needed fields sooner or later or should I start to write a workaround myself (if I can find enough info of course)?
But perhaps better for you will be to load the merged frame?
Because in GIF, you have not only the offset, but the copy method, palette change, ...
Posted: Tue May 09, 2006 5:27 pm
by Alessandro
Change of palette doesn't really matter since I convert frames to rgb32, anyway I read thoroughly the help file and I can't recall a way to load merged frames excluding frame 0 which is only one frame (and not enough then to show animations), but if such an option is available of course it IS be better to me to use it, so... how can I do it?
Posted: Wed May 10, 2006 8:08 am
by xnview
Alessandro wrote:Change of palette doesn't really matter since I convert frames to rgb32, anyway I read thoroughly the help file and I can't recall a way to load merged frames excluding frame 0 which is only one frame (and not enough then to show animations), but if such an option is available of course it IS be better to me to use it, so... how can I do it?
You want only show animation?
Posted: Wed May 10, 2006 4:04 pm
by Alessandro
yes, and I'd like to show it properly
Posted: Wed May 10, 2006 4:37 pm
by xnview
Alessandro wrote:yes, and I'd like to show it properly
Ok, i'll such feature
Posted: Thu May 11, 2006 4:04 pm
by Alessandro
what can I say, I'm speechless... THANKS!!!