Tuesday, August 22nd 2017, 1:00pm UTC+2

You are not logged in.

  • Login
  • Register

Reply

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Message information
Message
Settings
Automatically converts internet addresses into links by adding [url] and [/url] around them.
Smiley code in your message such as :) is automatically displayed as image.
You can use BBCode to format your message, if this option is enabled.
Security measure

Please enter the letters that are shown in the picture below (without spaces, and upper or lower case can be used).

The last 7 posts

Thursday, June 22nd 2017, 6:32am

by HWMSTR

Hello Sven,
Thank you very much, you've been very helpful.

Have a nice day
Ayman

Wednesday, June 21st 2017, 3:15pm

by SEGGER - Schoenen

Hi,

In my sample I converted the GIF into an c-array which contains the same information as the original GIF. To convert the GIF into a c-file you can use the tool linked below. If a GIF gets opened by the Bitmap Converter it shows and converts only the first image.

Bin2C converting tool:
https://www.segger.com/downloads/emwin/Bin2C

Also the function IMAGE_SetBitmap() supports only static images.

But with the Bitmap Converter it is also possible to create a c-file with animation. To do this follow this steps:

1. Open Bitmap Converter
2. Click File -> Create animated sprite from GIF
3. Choose the GIF file you want to convert
4. Give it a name and save it

Now this animation can be displayed by using the Sprite API.

It is also possible to draw a single image of this sprite with e.g GUI_DrawBitmap(). This way it is possible to create an animation without the Sprite API.

Please keep in mind that this file can get pretty big, depending on the number of different images and its size in x and y.

Regards,
Sven

Wednesday, June 21st 2017, 8:11am

by HWMSTR

Hello Sven,
Thank you very much for your suggestion. Indeed I was not providing any timebase to GUI_X_GetTime(void) in GUI_X.c, and now the gif works as expected!


Another question in regards to the gif function, I converted a gif file to C code using the bitmap converter, and modified the example you provided me. I replaced IMAGE_SetGIF(hItem, pData, FileSize) with IMAGE_SetBitmap(hItem, &bmsimple_gif), and I saw a still image with no animation. does IMAGE_SetBitmap() function support gif?


Thanks,
Ayman

Tuesday, June 20th 2017, 2:52pm

by SEGGER - Schoenen

Hi,

On my end it is animated. Do you provide emWin a proper time base?

Take a look into GUI_X.c (or GUI_X_embOS.c, GUI_X_FreeRTOS.c, etc.) There are some functions which are getting called by emWin if any timerelated gets called.

I have attached the files. You can 'feed' those routines by a timebase provided by an RTOS or you set up a hardware timer on you own.

Regards,
Sven
SEGGER - Schoenen has attached the following file:
  • GUI_X.zip (4.58 kB - 24 times downloaded - Last download: Aug 18th 2017, 11:53am)

Monday, June 19th 2017, 5:12pm

by HWMSTR

Hello Sven,
Thank you for the example. I got the example you provided me to run ;however, I did not see the gif image go through sequence of frames. Basically the image was still, and I was expecting to see some animation.
I appreciate your time.
Ayman


Monday, June 19th 2017, 2:27pm

by SEGGER - Schoenen

Hi,

Attached is an example which uses an IMAGE widget to draw an animated GIF. The IMAGE widget is part of a dialog. The dialog draws a bitmap into the background.

The GIF is converted into a c-array and added into the code.

Regards,
Sven
SEGGER - Schoenen has attached the following file:

Monday, June 19th 2017, 8:24am

by HWMSTR

Drawing Gif in a Window or a dialog

Hello,
Can you please provide me with a simple example using GIF inside a window or a dialog (preferably using image widget)? I can get the GIF to work properly if there is no window; however, once I add a window with an image in the background, I can't get the gif to display.
Best Regards.