ReactOS
0.4.16-dev-746-g329a414
ungif.h
Go to the documentation of this file.
1
/*
2
* Gif extracting routines - derived from libungif
3
*
4
* Portions Copyright 2006 Mike McCormack
5
*
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2.1 of the License, or (at your option) any later version.
10
*
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this library; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19
*/
20
21
/*
22
* Original copyright notice:
23
*
24
* The GIFLIB distribution is Copyright (c) 1997 Eric S. Raymond
25
*
26
* Permission is hereby granted, free of charge, to any person obtaining a copy
27
* of this software and associated documentation files (the "Software"), to deal
28
* in the Software without restriction, including without limitation the rights
29
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
30
* copies of the Software, and to permit persons to whom the Software is
31
* furnished to do so, subject to the following conditions:
32
*
33
* The above copyright notice and this permission notice shall be included in
34
* all copies or substantial portions of the Software.
35
*/
36
37
/******************************************************************************
38
* In order to make life a little bit easier when using the GIF file format,
39
* this library was written, and which does all the dirty work...
40
*
41
* Written by Gershon Elber, Jun. 1989
42
* Hacks by Eric S. Raymond, Sep. 1992
43
******************************************************************************
44
* History:
45
* 14 Jun 89 - Version 1.0 by Gershon Elber.
46
* 3 Sep 90 - Version 1.1 by Gershon Elber (Support for Gif89, Unique names)
47
* 15 Sep 90 - Version 2.0 by Eric S. Raymond (Changes to support GIF slurp)
48
* 26 Jun 96 - Version 3.0 by Eric S. Raymond (Full GIF89 support)
49
* 17 Dec 98 - Version 4.0 by Toshio Kuratomi (Fix extension writing code)
50
*****************************************************************************/
51
52
#ifndef _UNGIF_H_
53
#define _UNGIF_H_ 1
54
55
#define GIF_ERROR 0
56
#define GIF_OK 1
57
58
#ifndef TRUE
59
#define TRUE 1
60
#endif
/* TRUE */
61
#ifndef FALSE
62
#define FALSE 0
63
#endif
/* FALSE */
64
65
#ifndef NULL
66
#define NULL 0
67
#endif
/* NULL */
68
69
#define GIF_STAMP "GIFVER"
/* First chars in file - GIF stamp. */
70
#define GIF_STAMP_LEN sizeof(GIF_STAMP) - 1
71
#define GIF_VERSION_POS 3
/* Version first character in stamp. */
72
#define GIF87_STAMP "GIF87a"
/* First chars in file - GIF stamp. */
73
#define GIF89_STAMP "GIF89a"
/* First chars in file - GIF stamp. */
74
75
#define GIF_FILE_BUFFER_SIZE 16384
/* Files uses bigger buffers than usual. */
76
77
typedef
int
GifBooleanType
;
78
typedef
unsigned
char
GifPixelType
;
79
typedef
unsigned
char
*
GifRowType
;
80
typedef
unsigned
char
GifByteType
;
81
typedef
unsigned
int
GifPrefixType
;
82
typedef
int
GifWord
;
83
84
typedef
struct
GifColorType
{
85
GifByteType
Red
,
Green
,
Blue
;
86
}
GifColorType
;
87
88
typedef
struct
ColorMapObject
{
89
int
ColorCount
;
90
int
BitsPerPixel
;
91
int
SortFlag
;
92
GifColorType
*
Colors
;
93
}
ColorMapObject
;
94
95
typedef
struct
GifImageDesc
{
96
GifWord
Left
,
Top
,
Width
,
Height
,
/* Current image dimensions. */
97
Interlace
;
/* Sequential/Interlaced lines. */
98
ColorMapObject
*
ColorMap
;
/* The local color map */
99
}
GifImageDesc
;
100
101
/* This is the in-core version of an extension record */
102
typedef
struct
{
103
int
Function
;
/* Holds the type of the Extension block. */
104
int
ByteCount
;
105
char
*
Bytes
;
106
}
ExtensionBlock
;
107
108
typedef
struct
{
109
int
Function
;
/* DEPRECATED: Use ExtensionBlocks[x].Function instead */
110
int
ExtensionBlockCount
;
111
ExtensionBlock
*
ExtensionBlocks
;
112
}
Extensions
;
113
114
typedef
struct
GifFileType
{
115
GifWord
SWidth
,
SHeight
,
/* Screen dimensions. */
116
SColorResolution
,
/* How many colors can we generate? */
117
SColorTableSize
,
/* Calculated color table size, even if not present */
118
SBackGroundColor
,
/* I hope you understand this one... */
119
SAspectRatio
;
/* Pixel aspect ratio, in 1/64 units, starting at 1:4. */
120
ColorMapObject
*
SColorMap
;
/* NULL if not exists. */
121
Extensions
Extensions
;
122
int
ImageCount
;
/* Number of current image */
123
GifImageDesc
Image
;
/* Block describing current image */
124
struct
SavedImage
*
SavedImages
;
/* Use this to accumulate file state */
125
void
*
UserData
;
/* hook to attach user data (TVT) */
126
void
*
Private
;
/* Don't mess with this! */
127
}
GifFileType
;
128
129
typedef
enum
{
130
UNDEFINED_RECORD_TYPE
,
131
SCREEN_DESC_RECORD_TYPE
,
132
IMAGE_DESC_RECORD_TYPE
,
/* Begin with ',' */
133
EXTENSION_RECORD_TYPE
,
/* Begin with '!' */
134
TERMINATE_RECORD_TYPE
/* Begin with ';' */
135
}
GifRecordType
;
136
137
/* func type to read gif data from arbitrary sources (TVT) */
138
typedef
int
(*
InputFunc
) (
GifFileType
*,
GifByteType
*,
int
);
139
140
/* GIF89 extension function codes */
141
142
#define COMMENT_EXT_FUNC_CODE 0xfe
/* comment */
143
#define GRAPHICS_EXT_FUNC_CODE 0xf9
/* graphics control */
144
#define PLAINTEXT_EXT_FUNC_CODE 0x01
/* plaintext */
145
#define APPLICATION_EXT_FUNC_CODE 0xff
/* application block */
146
147
/* public interface to ungif.c */
148
int
DGifSlurp
(
GifFileType
* GifFile);
149
GifFileType
*
DGifOpen
(
void
*userPtr,
InputFunc
readFunc);
150
int
DGifCloseFile
(
GifFileType
* GifFile);
151
152
#define D_GIF_ERR_OPEN_FAILED 101
/* And DGif possible errors. */
153
#define D_GIF_ERR_READ_FAILED 102
154
#define D_GIF_ERR_NOT_GIF_FILE 103
155
#define D_GIF_ERR_NO_SCRN_DSCR 104
156
#define D_GIF_ERR_NO_IMAG_DSCR 105
157
#define D_GIF_ERR_NO_COLOR_MAP 106
158
#define D_GIF_ERR_WRONG_RECORD 107
159
#define D_GIF_ERR_DATA_TOO_BIG 108
160
#define D_GIF_ERR_NOT_ENOUGH_MEM 109
161
#define D_GIF_ERR_CLOSE_FAILED 110
162
#define D_GIF_ERR_NOT_READABLE 111
163
#define D_GIF_ERR_IMAGE_DEFECT 112
164
#define D_GIF_ERR_EOF_TOO_SOON 113
165
166
/******************************************************************************
167
* Support for the in-core structures allocation (slurp mode).
168
*****************************************************************************/
169
170
/* This holds an image header, its unpacked raster bits, and extensions */
171
typedef
struct
SavedImage
{
172
GifImageDesc
ImageDesc
;
173
unsigned
char
*
RasterBits
;
174
Extensions
Extensions
;
175
}
SavedImage
;
176
177
#endif
/* _UNGIF_H_ */
int
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition:
typeof.h:31
ColorMapObject
Definition:
ungif.h:88
ColorMapObject::Colors
GifColorType * Colors
Definition:
ungif.h:92
ColorMapObject::SortFlag
int SortFlag
Definition:
ungif.h:91
ColorMapObject::BitsPerPixel
int BitsPerPixel
Definition:
ungif.h:90
ColorMapObject::ColorCount
int ColorCount
Definition:
ungif.h:89
ExtensionBlock
Definition:
ungif.h:102
ExtensionBlock::Bytes
char * Bytes
Definition:
ungif.h:105
ExtensionBlock::ByteCount
int ByteCount
Definition:
ungif.h:104
ExtensionBlock::Function
int Function
Definition:
ungif.h:103
Extensions
Definition:
ungif.h:108
Extensions::Function
int Function
Definition:
ungif.h:109
Extensions::ExtensionBlocks
ExtensionBlock * ExtensionBlocks
Definition:
ungif.h:111
Extensions::ExtensionBlockCount
int ExtensionBlockCount
Definition:
ungif.h:110
GifColorType
Definition:
ungif.h:84
GifColorType::Blue
GifByteType Blue
Definition:
ungif.h:85
GifColorType::Green
GifByteType Green
Definition:
ungif.h:85
GifColorType::Red
GifByteType Red
Definition:
ungif.h:85
GifFileType
Definition:
ungif.h:114
GifFileType::SAspectRatio
GifWord SAspectRatio
Definition:
ungif.h:119
GifFileType::Extensions
Extensions Extensions
Definition:
ungif.h:121
GifFileType::SWidth
GifWord SWidth
Definition:
ungif.h:115
GifFileType::Image
GifImageDesc Image
Definition:
ungif.h:123
GifFileType::SavedImages
struct SavedImage * SavedImages
Definition:
ungif.h:124
GifFileType::SColorResolution
GifWord SColorResolution
Definition:
ungif.h:116
GifFileType::SColorMap
ColorMapObject * SColorMap
Definition:
ungif.h:120
GifFileType::Private
void * Private
Definition:
ungif.h:126
GifFileType::SBackGroundColor
GifWord SBackGroundColor
Definition:
ungif.h:118
GifFileType::SColorTableSize
GifWord SColorTableSize
Definition:
ungif.h:117
GifFileType::SHeight
GifWord SHeight
Definition:
ungif.h:115
GifFileType::ImageCount
int ImageCount
Definition:
ungif.h:122
GifFileType::UserData
void * UserData
Definition:
ungif.h:125
GifImageDesc
Definition:
ungif.h:95
GifImageDesc::ColorMap
ColorMapObject * ColorMap
Definition:
ungif.h:98
GifImageDesc::Interlace
GifWord Interlace
Definition:
ungif.h:97
GifImageDesc::Top
GifWord Top
Definition:
ungif.h:96
GifImageDesc::Left
GifWord Left
Definition:
ungif.h:96
GifImageDesc::Width
GifWord Width
Definition:
ungif.h:96
GifImageDesc::Height
GifWord Height
Definition:
ungif.h:96
SavedImage
Definition:
ungif.h:171
SavedImage::RasterBits
unsigned char * RasterBits
Definition:
ungif.h:173
SavedImage::ImageDesc
GifImageDesc ImageDesc
Definition:
ungif.h:172
SavedImage::Extensions
Extensions Extensions
Definition:
ungif.h:174
GifPrefixType
unsigned int GifPrefixType
Definition:
ungif.h:81
GifPixelType
unsigned char GifPixelType
Definition:
ungif.h:78
DGifCloseFile
int DGifCloseFile(GifFileType *GifFile)
Definition:
ungif.c:1018
GifByteType
unsigned char GifByteType
Definition:
ungif.h:80
DGifSlurp
int DGifSlurp(GifFileType *GifFile)
Definition:
ungif.c:847
GifRecordType
GifRecordType
Definition:
ungif.h:129
EXTENSION_RECORD_TYPE
@ EXTENSION_RECORD_TYPE
Definition:
ungif.h:133
UNDEFINED_RECORD_TYPE
@ UNDEFINED_RECORD_TYPE
Definition:
ungif.h:130
IMAGE_DESC_RECORD_TYPE
@ IMAGE_DESC_RECORD_TYPE
Definition:
ungif.h:132
TERMINATE_RECORD_TYPE
@ TERMINATE_RECORD_TYPE
Definition:
ungif.h:134
SCREEN_DESC_RECORD_TYPE
@ SCREEN_DESC_RECORD_TYPE
Definition:
ungif.h:131
GifBooleanType
int GifBooleanType
Definition:
ungif.h:77
InputFunc
int(* InputFunc)(GifFileType *, GifByteType *, int)
Definition:
ungif.h:138
GifWord
int GifWord
Definition:
ungif.h:82
GifRowType
unsigned char * GifRowType
Definition:
ungif.h:79
DGifOpen
GifFileType * DGifOpen(void *userPtr, InputFunc readFunc)
Definition:
ungif.c:964
dll
win32
windowscodecs
ungif.h
Generated on Thu Feb 13 2025 06:05:16 for ReactOS by
1.9.6