Denis Sergeev Posted June 11, 2018 Report Share Posted June 11, 2018 I am using such construction to display GIF image: while (1) { gdispImageCache(&myImage); gdispImageDraw(&myImage, 0, 0, myImage.width, myImage.height, 0, 0) delay = gdispImageNext(&myImage); gfxSleepMilliseconds(delay); } I want to reset image, so that it will start displaying from the first frame. I haven't fount any function, which could perform such action. Can anybody suggest the solution? Link to comment Share on other sites More sharing options...
inmarket Posted June 12, 2018 Report Share Posted June 12, 2018 If it is a non-cycling multi-family GIF image the last frame will return TIME_INFINITE. If you want to start at the beginning again just call gdispImageNext again. So to turn a non-cycling GIF image into a cycling image just replace a TIME_INFINITE delay period with a set period that you want the last frame displayed for before restarting. Link to comment Share on other sites More sharing options...
Denis Sergeev Posted June 18, 2018 Author Report Share Posted June 18, 2018 On 12/06/2018 at 06:25, inmarket said: If it is a non-cycling multi-family GIF image the last frame will return TIME_INFINITE. If you want to start at the beginning again just call gdispImageNext again. So to turn a non-cycling GIF image into a cycling image just replace a TIME_INFINITE delay period with a set period that you want the last frame displayed for before restarting. I'm sorry that I was not clear enough. But I want to restart any animated gif image from any position. I have written such function in gdisp_image_gif.c: void gdispImageReset_GIF(gdispImage *img) { gdispImagePrivate_GIF * priv = (gdispImagePrivate_GIF *)img->priv; gfileSetPos(img->f, priv->frame0pos); initFrameGif(img); } It seems to be working as I expect. What do you think about it? If it works well, you may add it to your repository. Or you can even implement generalized function, which may move file position to any specified frame at any time. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now