-
Notifications
You must be signed in to change notification settings - Fork 3
/
gif.h
33 lines (27 loc) · 1.13 KB
/
gif.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef TASBOT_EYES_GIF_H
#define TASBOT_EYES_GIF_H
#include <gif_lib.h>
#include <stdbool.h>
#include "led.h"
#include "utils.h"
#define MIN_DELAY_TIME 35 //Smallest delay time that is possible due to hardware limitations (1000ms/30fps=33.3'ms)
#define DEFAULT_DELAY_TIME 100
typedef struct AnimationFrame {
GifColorType* color[LED_WIDTH][LED_HEIGHT];
unsigned short int delayTime;
unsigned short int x;
unsigned short int y;
unsigned short int width;
unsigned short int height;
} AnimationFrame;
typedef struct Animation {
AnimationFrame** frames; //pointer to a pointer, that's an array of frames.
int frameCount;
bool monochrome;
GifFileType* image; //needed for very dirty trick to get around weird behavior, where DGifCloseFile() manipulates the animation data for some reason
} Animation;
bool checkIfImageHasRightSize(GifFileType* _image);
bool isGrayScale(GifColorType* _color);
AnimationFrame* readFramePixels(const SavedImage* frame, ColorMapObject* _globalMap, bool* _monochrome, int tc);
Animation* readAnimation(char* _filePath);
#endif //TASBOT_EYES_GIF_H