Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4680 right-hear 1
 
2
 *
3
 * Copyright (c) 1998-2011 Glenn Randers-Pehrson
4
 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
5
 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
6
 *
7
 * Last changed in libpng 1.5.0 [January 6, 2011]
8
 *
9
 * This code is released under the libpng license.
10
 * For conditions of distribution and use, see the disclaimer
11
 * and license in png.h
12
 */
13
14
 
15
 * The only people who need to care about what is inside of this are the
16
 * people who will be modifying the library for their own special needs.
17
 * It should NOT be accessed directly by an application.
18
 */
19
20
 
21
#define PNGSTRUCT_H
22
/* zlib.h defines the structure z_stream, an instance of which is included
23
 * in this structure and is required for decompressing the LZ compressed
24
 * data in PNG files.
25
 */
26
#include "zlib.h"
27
28
 
29
{
30
#ifdef PNG_SETJMP_SUPPORTED
31
   jmp_buf png_jmpbuf;            /* used in png_error */
32
   png_longjmp_ptr longjmp_fn;/* setjmp non-local goto function. */
33
#endif
34
   png_error_ptr error_fn;    /* function for printing errors and aborting */
35
   png_error_ptr warning_fn;  /* function for printing warnings */
36
   png_voidp error_ptr;       /* user supplied struct for error functions */
37
   png_rw_ptr write_data_fn;  /* function for writing output data */
38
   png_rw_ptr read_data_fn;   /* function for reading input data */
39
   png_voidp io_ptr;          /* ptr to application struct for I/O functions */
40
41
 
42
   png_user_transform_ptr read_user_transform_fn; /* user read transform */
43
#endif
44
45
 
46
   png_user_transform_ptr write_user_transform_fn; /* user write transform */
47
#endif
48
49
 
50
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
51
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
52
    defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
53
   png_voidp user_transform_ptr; /* user supplied struct for user transform */
54
   png_byte user_transform_depth;    /* bit depth of user transformed pixels */
55
   png_byte user_transform_channels; /* channels in user transformed pixels */
56
#endif
57
#endif
58
59
 
60
   png_uint_32 flags;         /* flags indicating various things to libpng */
61
   png_uint_32 transformations; /* which transformations to perform */
62
63
 
64
   png_bytep zbuf;            /* buffer for zlib */
65
   uInt zbuf_size;            /* size of zbuf (typically 65536) */
66
   int zlib_level;            /* holds zlib compression level */
67
   int zlib_method;           /* holds zlib compression method */
68
   int zlib_window_bits;      /* holds zlib compression window bits */
69
   int zlib_mem_level;        /* holds zlib compression memory level */
70
   int zlib_strategy;         /* holds zlib compression strategy */
71
72
 
73
   png_uint_32 height;        /* height of image in pixels */
74
   png_uint_32 num_rows;      /* number of rows in current pass */
75
   png_uint_32 usr_width;     /* width of row at start of write */
76
   png_size_t rowbytes;       /* size of row in bytes */
77
   png_uint_32 iwidth;        /* width of current interlaced row in pixels */
78
   png_uint_32 row_number;    /* current row in interlace pass */
79
   png_bytep prev_row;        /* buffer to save previous (unfiltered) row */
80
   png_bytep row_buf;         /* buffer to save current (unfiltered) row */
81
   png_bytep sub_row;         /* buffer to save "sub" row when filtering */
82
   png_bytep up_row;          /* buffer to save "up" row when filtering */
83
   png_bytep avg_row;         /* buffer to save "avg" row when filtering */
84
   png_bytep paeth_row;       /* buffer to save "Paeth" row when filtering */
85
   png_row_info row_info;     /* used for transformation routines */
86
87
 
88
   png_uint_32 crc;           /* current chunk CRC value */
89
   png_colorp palette;        /* palette from the input file */
90
   png_uint_16 num_palette;   /* number of color entries in palette */
91
   png_uint_16 num_trans;     /* number of transparency values */
92
   png_byte chunk_name[5];    /* null-terminated name of current chunk */
93
   png_byte compression;      /* file compression type (always 0) */
94
   png_byte filter;           /* file filter type (always 0) */
95
   png_byte interlaced;       /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
96
   png_byte pass;             /* current interlace pass (0 - 6) */
97
   png_byte do_filter;        /* row filter flags (see PNG_FILTER_ below ) */
98
   png_byte color_type;       /* color type of file */
99
   png_byte bit_depth;        /* bit depth of file */
100
   png_byte usr_bit_depth;    /* bit depth of users row */
101
   png_byte pixel_depth;      /* number of bits per pixel */
102
   png_byte channels;         /* number of channels in file */
103
   png_byte usr_channels;     /* channels at start of write */
104
   png_byte sig_bytes;        /* magic bytes read/written from start of file */
105
106
 
107
   png_uint_16 filler;           /* filler bytes for pixel expansion */
108
#endif
109
110
 
111
   png_byte background_gamma_type;
112
   png_fixed_point background_gamma;
113
   png_color_16 background;   /* background color in screen gamma space */
114
#ifdef PNG_READ_GAMMA_SUPPORTED
115
   png_color_16 background_1; /* background normalized to gamma 1.0 */
116
#endif
117
#endif /* PNG_bKGD_SUPPORTED */
118
119
 
120
   png_flush_ptr output_flush_fn; /* Function for flushing output */
121
   png_uint_32 flush_dist;    /* how many rows apart to flush, 0 - no flush */
122
   png_uint_32 flush_rows;    /* number of rows written since last flush */
123
#endif
124
125
 
126
   int gamma_shift;      /* number of "insignificant" bits in 16-bit gamma */
127
   png_fixed_point gamma;        /* file gamma value */
128
   png_fixed_point screen_gamma; /* screen gamma value (display_exponent) */
129
#endif
130
131
 
132
   png_bytep gamma_table;     /* gamma table for 8-bit depth files */
133
   png_bytep gamma_from_1;    /* converts from 1.0 to screen */
134
   png_bytep gamma_to_1;      /* converts from file to 1.0 */
135
   png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
136
   png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
137
   png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
138
#endif
139
140
 
141
   png_color_8 sig_bit;       /* significant bits in each available channel */
142
#endif
143
144
 
145
   png_color_8 shift;         /* shift for significant bit tranformation */
146
#endif
147
148
 
149
 || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
150
   png_bytep trans_alpha;           /* alpha values for paletted files */
151
   png_color_16 trans_color;  /* transparent color for non-paletted files */
152
#endif
153
154
 
155
   png_write_status_ptr write_row_fn; /* called after each row is encoded */
156
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
157
   png_progressive_info_ptr info_fn; /* called after header data fully read */
158
   png_progressive_row_ptr row_fn;   /* called after a prog. row is decoded */
159
   png_progressive_end_ptr end_fn;   /* called after image is complete */
160
   png_bytep save_buffer_ptr;        /* current location in save_buffer */
161
   png_bytep save_buffer;            /* buffer for previously read data */
162
   png_bytep current_buffer_ptr;     /* current location in current_buffer */
163
   png_bytep current_buffer;         /* buffer for recently used data */
164
   png_uint_32 push_length;          /* size of current input chunk */
165
   png_uint_32 skip_length;          /* bytes to skip in input data */
166
   png_size_t save_buffer_size;      /* amount of data now in save_buffer */
167
   png_size_t save_buffer_max;       /* total size of save_buffer */
168
   png_size_t buffer_size;           /* total amount of available input data */
169
   png_size_t current_buffer_size;   /* amount of data now in current_buffer */
170
   int process_mode;                 /* what push library is currently doing */
171
   int cur_palette;                  /* current push library palette index */
172
173
 
174
     png_size_t current_text_size;   /* current size of text input data */
175
     png_size_t current_text_left;   /* how much text left to read in input */
176
     png_charp current_text;         /* current text chunk buffer */
177
     png_charp current_text_ptr;     /* current location in current_text */
178
#  endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */
179
180
 
181
182
 
183
/* For the Borland special 64K segment handler */
184
   png_bytepp offset_table_ptr;
185
   png_bytep offset_table;
186
   png_uint_16 offset_table_number;
187
   png_uint_16 offset_table_count;
188
   png_uint_16 offset_table_count_free;
189
#endif
190
191
 
192
   png_bytep palette_lookup; /* lookup table for quantizing */
193
   png_bytep quantize_index; /* index translation for palette files */
194
#endif
195
196
 
197
   png_uint_16p hist;                /* histogram */
198
#endif
199
200
 
201
   png_byte heuristic_method;        /* heuristic for row filter selection */
202
   png_byte num_prev_filters;        /* number of weights for previous rows */
203
   png_bytep prev_filters;           /* filter type(s) of previous row(s) */
204
   png_uint_16p filter_weights;      /* weight(s) for previous line(s) */
205
   png_uint_16p inv_filter_weights;  /* 1/weight(s) for previous line(s) */
206
   png_uint_16p filter_costs;        /* relative filter calculation cost */
207
   png_uint_16p inv_filter_costs;    /* 1/relative filter calculation cost */
208
#endif
209
210
 
211
   png_charp time_buffer; /* String to hold RFC 1123 time text */
212
#endif
213
214
 
215
216
 
217
218
 
219
   png_voidp user_chunk_ptr;
220
   png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
221
#endif
222
223
 
224
   int num_chunk_list;
225
   png_bytep chunk_list;
226
#endif
227
228
 
229
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
230
   png_byte rgb_to_gray_status;
231
   /* These were changed from png_byte in libpng-1.0.6 */
232
   png_uint_16 rgb_to_gray_red_coeff;
233
   png_uint_16 rgb_to_gray_green_coeff;
234
   png_uint_16 rgb_to_gray_blue_coeff;
235
#endif
236
237
 
238
#if defined(PNG_MNG_FEATURES_SUPPORTED) || \
239
    defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
240
    defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
241
/* Changed from png_byte to png_uint_32 at version 1.2.0 */
242
   png_uint_32 mng_features_permitted;
243
#endif
244
245
 
246
#ifdef PNG_MNG_FEATURES_SUPPORTED
247
   png_byte filter_type;
248
#endif
249
250
 
251
252
 
253
#ifdef PNG_USER_MEM_SUPPORTED
254
   png_voidp mem_ptr;             /* user supplied struct for mem functions */
255
   png_malloc_ptr malloc_fn;      /* function for allocating memory */
256
   png_free_ptr free_fn;          /* function for freeing memory */
257
#endif
258
259
 
260
   png_bytep big_row_buf;         /* buffer to save current (unfiltered) row */
261
262
 
263
/* The following three members were added at version 1.0.14 and 1.2.4 */
264
   png_bytep quantize_sort;          /* working sort array */
265
   png_bytep index_to_palette;       /* where the original index currently is
266
                                        in the palette */
267
   png_bytep palette_to_index;       /* which original index points to this
268
                                         palette color */
269
#endif
270
271
 
272
   png_byte compression_type;
273
274
 
275
   png_uint_32 user_width_max;
276
   png_uint_32 user_height_max;
277
278
 
279
    * chunks that can be stored (0 means unlimited).
280
    */
281
   png_uint_32 user_chunk_cache_max;
282
283
 
284
    * can occupy when decompressed.  0 means unlimited.
285
    */
286
   png_alloc_size_t user_chunk_malloc_max;
287
#endif
288
289
 
290
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
291
   /* Storage for unknown chunk that the library doesn't recognize. */
292
   png_unknown_chunk unknown_chunk;
293
#endif
294
295
 
296
  png_size_t old_big_row_buf_size;
297
  png_size_t old_prev_row_size;
298
299
 
300
  png_charp chunkdata;  /* buffer for reading chunk data */
301
302
 
303
/* New member added in libpng-1.4.0 */
304
   png_uint_32 io_state;
305
#endif
306
};
307
#endif /* PNGSTRUCT_H */
308