-#include <wx/wx.h>
-
-#include <wx/image.h>
-#include <wx/wfstream.h>
-#include <wx/module.h>
-
-#include <wx/imaggif.h>
-
-/*
-
-FOLLOWING CODE IS BY G.R.G. :
-(except wxInputStream stuff)
-
-*/
-
-/************************************************************************
- READGIF.H - Leer un archivo GIF de 8 bits
- ------------------------------------------------------------------------
- Tratamiento Digital de la Imagen
- ------------------------------------------------------------------------
- Guillermo Rodriguez Garcia
- <guille@iies.es>
-
- Version: 2.0
-*************************************************************************/
-
-typedef struct
-{
- int w; /* width */
- int h; /* height */
- unsigned char *p; /* bitmap */
- unsigned char *pal; /* palette */
-} IMAGEN;
-
-
-/************************************************************************
- READGIF.C - Lee un archivo GIF de 256 colores
- ------------------------------------------------------------------------
- Tratamiento Digital de la Imagen
- ------------------------------------------------------------------------
- Guillermo Rodriguez Garcia
- <guille@iies.es>
-
- Version: 2.0
-*************************************************************************/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-/* error codes */
-#define E_OK 0 /* everything was OK */
-#define E_ARCHIVO -1 /* error opening file */
-#define E_FORMATO -2 /* error in gif header */
-#define E_MEMORIA -3 /* error allocating memory */
-
-
-/* This class binding is by VS, so all bugs in it are mine ;-) */
-
-class gifDecoder
-{
- private:
- /* globals */
- int restbits; /* remaining valid bits */
- unsigned int restbyte; /* remaining bytes in this block */
- unsigned int lastbyte; /* last byte read */
-
- unsigned char* file; /* input file in memory */
- unsigned int file_pos, file_size; /* position & size in it */
-
- int fgetc();
- void fread(void *ptr, size_t size, size_t nmemb);
- void fseekcur(int rel_pos);
-
- public:
- gifDecoder(unsigned char* mem, int sz) {file = mem; file_pos = 0; file_size = sz;}
- int getcode(int bits);
- int dgif(IMAGEN *img, int interl, int bits);
- int readgif(IMAGEN *img);
-};
-
-
-int gifDecoder::fgetc()
-{
- if (file_pos < file_size) return file[file_pos++];
- else return EOF;
-}
-
-void gifDecoder::fread(void *ptr, size_t size, size_t nmemb)
-{
- int todo = size * nmemb;
- if (todo + file_pos > file_size) todo = file_size - file_pos;
- memcpy(ptr, file + file_pos, todo);
- file_pos += todo;
-}
-
-void gifDecoder::fseekcur(int rel_pos)
-{
- file_pos += rel_pos;
-}
-
-/* getcode:
- * Reads the next code from the file, with size 'bits'
- * v2.0 - changed to support 'bits' values < 8
- */
-int gifDecoder::getcode(int bits)
-{
- unsigned int mask; /* bit mask */
- unsigned int code; /* code (result) */
-
-
- /* get remaining bits from last byte read */
- mask = (1 << bits) - 1;
- code = (lastbyte >> (8 - restbits)) & mask;