24 #ifndef CONTINUE_EXT_FUNC_CODE 25 #define CONTINUE_EXT_FUNC_CODE 0 28 #ifndef DISPOSAL_UNSPECIFIED 29 #define DISPOSAL_UNSPECIFIED 0 32 #ifndef DISPOSE_DO_NOT 33 #define DISPOSE_DO_NOT 1 36 #ifndef DISPOSE_BACKGROUND 37 #define DISPOSE_BACKGROUND 2 40 #ifndef DISPOSE_PREVIOUS 41 #define DISPOSE_PREVIOUS 3 66 std::vector<uint8_t> m_pImage;
67 unsigned int m_delay = 0;
70 unsigned int m_top = 0;
71 unsigned int m_left = 0;
72 unsigned int m_disposal = 0;
73 unsigned int m_height = 0;
74 unsigned int m_width = 0;
75 std::vector<GifColor> m_palette;
84 typedef std::shared_ptr<GifFrame> FramePtr;
90 bool LoadGif(
const std::string& file);
92 std::vector<FramePtr>& GetFrames() {
return m_frames; }
93 unsigned int GetPitch()
const {
return m_pitch; }
94 unsigned int GetNumLoops()
const {
return m_loops; }
95 unsigned int GetWidth()
const {
return m_width; }
96 unsigned int GetHeight()
const {
return m_height; }
99 std::vector<FramePtr> m_frames;
100 unsigned int m_imageSize = 0;
101 unsigned int m_pitch = 0;
102 unsigned int m_loops = 0;
103 unsigned int m_numFrames = 0;
105 std::string m_filename;
106 GifFileType* m_gif =
nullptr;
107 std::vector<GifColor> m_globalPalette;
108 std::vector<uint8_t> m_pTemplate;
111 unsigned int m_width;
112 unsigned int m_height;
114 bool Open(GifFileType *& gif,
void * dataPtr, InputFunc readFunc);
115 void Close(GifFileType * gif);
117 const char* Reason(
int reason);
119 bool LoadGifMetaData(
const std::string& file);
120 bool Slurp(GifFileType* gif);
121 void InitTemplateAndColormap();
122 bool LoadGifMetaData(GifFileType* gif);
123 static void ConvertColorTable(std::vector<GifColor> &dest, ColorMapObject* src,
unsigned int size);
124 bool GcbToFrame(
GifFrame &frame,
unsigned int imgIdx);
125 int ExtractFrames(
unsigned int count);
126 void ClearFrameAreaToTransparency(
unsigned char* dest,
const GifFrame &frame);
127 void ConstructFrame(
GifFrame &frame,
const unsigned char* src)
const;
128 bool PrepareTemplate(
GifFrame &frame);
131 #if GIFLIB_MAJOR != 5 135 const char* GifErrorString(
int ErrorCode)
140 case E_GIF_ERR_OPEN_FAILED:
141 Err =
"Failed to open given file";
143 case E_GIF_ERR_WRITE_FAILED:
144 Err =
"Failed to write to given file";
146 case E_GIF_ERR_HAS_SCRN_DSCR:
147 Err =
"Screen descriptor has already been set";
149 case E_GIF_ERR_HAS_IMAG_DSCR:
150 Err =
"Image descriptor is still active";
152 case E_GIF_ERR_NO_COLOR_MAP:
153 Err =
"Neither global nor local color map";
155 case E_GIF_ERR_DATA_TOO_BIG:
156 Err =
"Number of pixels bigger than width * height";
158 case E_GIF_ERR_NOT_ENOUGH_MEM:
159 Err =
"Failed to allocate required memory";
161 case E_GIF_ERR_DISK_IS_FULL:
162 Err =
"Write failed (disk full?)";
164 case E_GIF_ERR_CLOSE_FAILED:
165 Err =
"Failed to close given file";
167 case E_GIF_ERR_NOT_WRITEABLE:
168 Err =
"Given file was not opened for write";
170 case D_GIF_ERR_OPEN_FAILED:
171 Err =
"Failed to open given file";
173 case D_GIF_ERR_READ_FAILED:
174 Err =
"Failed to read from given file";
176 case D_GIF_ERR_NOT_GIF_FILE:
177 Err =
"Data is not in GIF format";
179 case D_GIF_ERR_NO_SCRN_DSCR:
180 Err =
"No screen descriptor detected";
182 case D_GIF_ERR_NO_IMAG_DSCR:
183 Err =
"No Image Descriptor detected";
185 case D_GIF_ERR_NO_COLOR_MAP:
186 Err =
"Neither global nor local color map";
188 case D_GIF_ERR_WRONG_RECORD:
189 Err =
"Wrong record type detected";
191 case D_GIF_ERR_DATA_TOO_BIG:
192 Err =
"Number of pixels bigger than width * height";
194 case D_GIF_ERR_NOT_ENOUGH_MEM:
195 Err =
"Failed to allocate required memory";
197 case D_GIF_ERR_CLOSE_FAILED:
198 Err =
"Failed to close given file";
200 case D_GIF_ERR_NOT_READABLE:
201 Err =
"Given file was not opened for read";
203 case D_GIF_ERR_IMAGE_DEFECT:
204 Err =
"Image is defective, decoding aborted";
206 case D_GIF_ERR_EOF_TOO_SOON:
207 Err =
"Image EOF detected before image complete";
Definition: GifHelper.h:58
Definition: SimpleFS.h:27
Definition: GifHelper.h:50
Definition: GifHelper.h:80