GIF in PROS

Is it possible to display a GIF from an SD card onto the V5 Brain Screen in PROS, and if so, how would I do it?

Read the LVGL tutorials https://github.com/littlevgl/lv_examples/tree/master/lv_tutorial

If you figure it out do this one
image

I was planning on animating a team logo.

yeah just write your own gif decoder and displayer

1 Like

You do realize I have no clue how to do that, right?

Theres GIF documentation online. And yes, I do know that you have no idea how to do it. I too, dont really know how to do it, but it can be done.

3 Likes

GIF demo, just port it over to PROS

2 Likes

I don’t think LVGL (or at least the version supported by PROS) supports GIFs.

You could use LVGL animations to animate your logo, without needing to create a gif.
It can animate things such as color, brightness, size, opacity, etc.
You could also switch between a few separate images, that might be good enough.

I believe LVGL 6 (which PROS does not support yet) supports rotating images, combining images together in a canvas, etc, which might allow you in the future to dynamically animate something.

Last I tried, I had a bit of trouble loading images from the SD card, the working method is currently to load from an image embedded in the code.

2 Likes

It can be done, but you need to use the old converter and ignore the LVGL tutorial code.

1 Like

I tried running that code in VEXcode, and I get errors in gifdec.c. Did something change?

Also, how would I port it to PROS?

builds ok here.

[info]: Project Path: /Users/james/Downloads/gifdemo
[info]: Saving Project ...
[info]: Project saved!
unix build for platform vexv5
CXX src/main.cpp
CC  src/gifdec.c
LINK build/gifdemo.elf
   text	   data	    bss	    dec	    hex	filename
  13716	   2128	8403832	8419676	 80795c	build/gifdemo.elf
[info]: build completed!

Yes the linter is showing errors if you open gifdec.c, you will just have to ignore those, we discussed how picky linters can be before and it’s quite common with library code pulled from the internet ( which gifdec.c was, it came from here GitHub - lecram/gifdec: small C GIF decoder ). It’s mostly just complaining about assigning pointers without typecasting them.

Wait, did you build that from VEXcode? Or did you use the command prompt?

[info]: Saving Project ...
[info]: Project saved!
windows build for platform vexv5
mkdir: cannot create directory 'build/src': No such file or directory
make: [vex/mkrules.mk:12: build/src/main.o] Error 1 (ignored)
CXX src/main.cpp
error: unable to open output file 'build/src/main.o': 'no such file or directory'
1 error generated.
make: *** [vex/mkrules.mk:14: build/src/main.o] Error 1
[error]: make process closed with exit code : 2

ĀÆ_(惄)_/ĀÆ

Why does windows always have so many issues.

we used to have problems if you had things like Cygwin Installed on your PC, we updated the makefiles to solve that, here’s the same project with the latest makefile, I just copied the source into a new project. Try this.

v5code-project-gifdemo_1.zip (840.5 KB)

1 Like

Main.cpp is just the template, and gifdec.c is blank.

I copied over main.cpp and gifdec.c from the first version and it works, except the GIF doesn’t display. It says ā€œrenderā€ and counts up, but it does not display a GIF.

EDIT: The gif I downloaded from you wasn’t working at all, and mine was too big. It works now, thanks @jpearman. How would I go about porting it to PROS?

@jpearman I tried copying the files to PROS and I got these errors in the header files

Compiling src/comp_controlled_code/opcontrol.cpp [WARNINGS]
In file included from src/comp_controlled_code/opcontrol.cpp:11:0:
./include/gifclass.h: In static member function 'static int vex::Gif::render(void*)':
./include/gifclass.h:33:29: error: 'vexSystemTimeGet' was not declared in this scope
               int32_t now = vexSystemTimeGet();
                             ^~~~~~~~~~~~~~~~
./include/gifclass.h:42:15: error: 'vexDisplayCopyRect' was not declared in this scope
               vexDisplayCopyRect( instance->_sx, instance->_sy, ex, ey, (uint32_t *)instance->_buffer, gif->width);
               ^~~~~~~~~~~~~~~~~~
./include/gifclass.h:49:17: error: 'this_thread' has not been declared
                 this_thread::sleep_for(delay);
                 ^~~~~~~~~~~

Is there any way to fix this @theol0403 ?

so it is, must be a bug in VEXcode export

v5code-project-gifdemo_1 (1).zip (853.2 KB)