1 /* OpenCP Module Player
2  * copyright (c) '94-'05 Niklas Beisert <nbeisert@physik.tu-muenchen.de>
3  *
4  * GIF picture loader
5  *
6  * revision history: (please note changes here)
7  * -doj980930  Dirk Jagdmann <doj@cubic.org>
8  *   -initialial release of this file
9  */
10 
11 #ifndef GIF__H
12 #define GIF__H
13 
14 /*************************************************************************
15  * routine GIF87read(...)
16  * ---------------------
17  * this routine will load a gif file which is either
18  * uncompressed or rle compressed. The routine will try to read as much
19  * data out of the file as possible without any error. If this routine
20  * returns with an error value, the array *pic and *pal could already
21  * contain some data, which could be read until the error occured.
22  *
23  * call parameters:
24  * -----------------
25  * char *filename : a null terminated string, which contains the file to
26  *                  load. This string is directly passed to the standard
27  *                  open(...) routine of your compiler environment, so you
28  *                  can supply every feature open(...) supports.
29  * unsigned char *pic: the array which will contain the uncompressed color
30  *                     mapped picture. Note that this array already has to
31  *                     be allocated when calling GIF87read(...) with at least
32  *                     picWidth*picHeight bytes !!!
33  * unsigned char *pal: an array which will contain the RGB palette of the
34  *                     picture.  This array must be allocated before calling
35  *                     GIF87read(). GIF87read(...) will not read any palettes
36  *                     containing more than 256 colors, so a size of 768
37  *                     bytes should be safe.
38  * int picWidth : the desired width of the image. If the image has a
39  *                different width GIF87read(...) will return an error value.
40  * int picHeight: the desired height of the image. If the image contains less
41  *                scanlines, the rest of the array *pic will remain unchanged.
42  *                If the image contains more scanlines, not more than
43  *                picHeight scanlines will be read.
44  *
45  * return values:
46  * --------------
47  *  0 upon success
48  * -1 if an error occured
49  *  a positive value indicating the number of bad code blocks from the lzw
50  *  decompression. This means that an error occurred that was not fatal, but
51  *  the picture could not be uncompressed completely.
52  *
53  ************************************************************************/
54 int GIF87read(unsigned char *filedata,
55               int filesize,
56               unsigned char *pic,
57               unsigned char *pal,
58               const int picWidth,
59               const int picHeight);
60 
61 int GIF87_try_open_indexed(uint16_t *GIFimageWidth,
62                            uint16_t *GIFimageHeight,
63                            uint8_t **data_indexed,
64                            uint8_t *pal_768,
65                            const uint8_t *src,
66                            int srclen);
67 
68 int GIF87_try_open_bgra(uint16_t *GIFimageWidth,
69                         uint16_t *GIFimageHeight,
70                         uint8_t **data_bgra,
71                         const uint8_t *src,
72                         int srclen);
73 
74 
75 #endif
76