ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

ungif.h
Go to the documentation of this file.
00001 /*
00002  * Gif extracting routines - derived from libungif
00003  *
00004  * Portions Copyright 2006 Mike McCormack
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00019  */
00020 
00021 /*
00022  * Original copyright notice:
00023  *
00024  * The GIFLIB distribution is Copyright (c) 1997  Eric S. Raymond
00025  *
00026  * Permission is hereby granted, free of charge, to any person obtaining a copy
00027  * of this software and associated documentation files (the "Software"), to deal
00028  * in the Software without restriction, including without limitation the rights
00029  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00030  * copies of the Software, and to permit persons to whom the Software is
00031  * furnished to do so, subject to the following conditions:
00032  *
00033  * The above copyright notice and this permission notice shall be included in
00034  * all copies or substantial portions of the Software.
00035  */
00036 
00037 /******************************************************************************
00038  * In order to make life a little bit easier when using the GIF file format,
00039  * this library was written, and which does all the dirty work...
00040  *
00041  *                                        Written by Gershon Elber,  Jun. 1989
00042  *                                        Hacks by Eric S. Raymond,  Sep. 1992
00043  ******************************************************************************
00044  * History:
00045  * 14 Jun 89 - Version 1.0 by Gershon Elber.
00046  *  3 Sep 90 - Version 1.1 by Gershon Elber (Support for Gif89, Unique names)
00047  * 15 Sep 90 - Version 2.0 by Eric S. Raymond (Changes to support GIF slurp)
00048  * 26 Jun 96 - Version 3.0 by Eric S. Raymond (Full GIF89 support)
00049  * 17 Dec 98 - Version 4.0 by Toshio Kuratomi (Fix extension writing code)
00050  *****************************************************************************/
00051 
00052 #ifndef _UNGIF_H_
00053 #define _UNGIF_H_ 1
00054 
00055 #define GIF_ERROR   0
00056 #define GIF_OK      1
00057 
00058 #ifndef TRUE
00059 #define TRUE        1
00060 #endif /* TRUE */
00061 #ifndef FALSE
00062 #define FALSE       0
00063 #endif /* FALSE */
00064 
00065 #ifndef NULL
00066 #define NULL        0
00067 #endif /* NULL */
00068 
00069 #define GIF_STAMP "GIFVER"          /* First chars in file - GIF stamp.  */
00070 #define GIF_STAMP_LEN sizeof(GIF_STAMP) - 1
00071 #define GIF_VERSION_POS 3           /* Version first character in stamp. */
00072 #define GIF87_STAMP "GIF87a"        /* First chars in file - GIF stamp.  */
00073 #define GIF89_STAMP "GIF89a"        /* First chars in file - GIF stamp.  */
00074 
00075 #define GIF_FILE_BUFFER_SIZE 16384  /* Files uses bigger buffers than usual. */
00076 
00077 typedef int GifBooleanType;
00078 typedef unsigned char GifPixelType;
00079 typedef unsigned char *GifRowType;
00080 typedef unsigned char GifByteType;
00081 typedef unsigned int GifPrefixType;
00082 typedef int GifWord;
00083 
00084 typedef struct GifColorType {
00085     GifByteType Red, Green, Blue;
00086 } GifColorType;
00087 
00088 typedef struct ColorMapObject {
00089     int ColorCount;
00090     int BitsPerPixel;
00091     GifColorType *Colors;
00092 } ColorMapObject;
00093 
00094 typedef struct GifImageDesc {
00095     GifWord Left, Top, Width, Height,   /* Current image dimensions. */
00096       Interlace;                    /* Sequential/Interlaced lines. */
00097     ColorMapObject *ColorMap;       /* The local color map */
00098 } GifImageDesc;
00099 
00100 typedef struct GifFileType {
00101     GifWord SWidth, SHeight,        /* Screen dimensions. */
00102       SColorResolution,         /* How many colors can we generate? */
00103       SBackGroundColor;         /* I hope you understand this one... */
00104     ColorMapObject *SColorMap;  /* NULL if not exists. */
00105     int ImageCount;             /* Number of current image */
00106     GifImageDesc Image;         /* Block describing current image */
00107     struct SavedImage *SavedImages; /* Use this to accumulate file state */
00108     void *UserData;             /* hook to attach user data (TVT) */
00109     void *Private;              /* Don't mess with this! */
00110 } GifFileType;
00111 
00112 typedef enum {
00113     UNDEFINED_RECORD_TYPE,
00114     SCREEN_DESC_RECORD_TYPE,
00115     IMAGE_DESC_RECORD_TYPE, /* Begin with ',' */
00116     EXTENSION_RECORD_TYPE,  /* Begin with '!' */
00117     TERMINATE_RECORD_TYPE   /* Begin with ';' */
00118 } GifRecordType;
00119 
00120 /* func type to read gif data from arbitrary sources (TVT) */
00121 typedef int (*InputFunc) (GifFileType *, GifByteType *, int);
00122 
00123 /*  GIF89 extension function codes */
00124 
00125 #define COMMENT_EXT_FUNC_CODE     0xfe    /* comment */
00126 #define GRAPHICS_EXT_FUNC_CODE    0xf9    /* graphics control */
00127 #define PLAINTEXT_EXT_FUNC_CODE   0x01    /* plaintext */
00128 #define APPLICATION_EXT_FUNC_CODE 0xff    /* application block */
00129 
00130 /* public interface to ungif.c */
00131 int DGifSlurp(GifFileType * GifFile);
00132 GifFileType *DGifOpen(void *userPtr, InputFunc readFunc);
00133 int DGifCloseFile(GifFileType * GifFile);
00134 
00135 #define D_GIF_ERR_OPEN_FAILED    101    /* And DGif possible errors. */
00136 #define D_GIF_ERR_READ_FAILED    102
00137 #define D_GIF_ERR_NOT_GIF_FILE   103
00138 #define D_GIF_ERR_NO_SCRN_DSCR   104
00139 #define D_GIF_ERR_NO_IMAG_DSCR   105
00140 #define D_GIF_ERR_NO_COLOR_MAP   106
00141 #define D_GIF_ERR_WRONG_RECORD   107
00142 #define D_GIF_ERR_DATA_TOO_BIG   108
00143 #define D_GIF_ERR_NOT_ENOUGH_MEM 109
00144 #define D_GIF_ERR_CLOSE_FAILED   110
00145 #define D_GIF_ERR_NOT_READABLE   111
00146 #define D_GIF_ERR_IMAGE_DEFECT   112
00147 #define D_GIF_ERR_EOF_TOO_SOON   113
00148 
00149 /******************************************************************************
00150  * Support for the in-core structures allocation (slurp mode).
00151  *****************************************************************************/
00152 
00153 /* This is the in-core version of an extension record */
00154 typedef struct {
00155     int ByteCount;
00156     char *Bytes;
00157     int Function;   /* Holds the type of the Extension block. */
00158 } ExtensionBlock;
00159 
00160 /* This holds an image header, its unpacked raster bits, and extensions */
00161 typedef struct SavedImage {
00162     GifImageDesc ImageDesc;
00163     unsigned char *RasterBits;
00164     int Function;   /* DEPRECATED: Use ExtensionBlocks[x].Function instead */
00165     int ExtensionBlockCount;
00166     ExtensionBlock *ExtensionBlocks;
00167 } SavedImage;
00168 
00169 #endif /* _UNGIF_H_ */

Generated on Sun May 27 2012 04:25:47 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.