PageRenderTime 46ms CodeModel.GetById 18ms app.highlight 22ms RepoModel.GetById 1ms app.codeStats 1ms

/src/FreeImage/Source/LibMNG/libmng_chunk_io.h

https://bitbucket.org/cabalistic/ogredeps/
C++ Header | 415 lines | 329 code | 23 blank | 63 comment | 1 complexity | 53f70292383e19ba67a34513852dc1cc MD5 | raw file
  1/* ************************************************************************** */
  2/* *             For conditions of distribution and use,                    * */
  3/* *                see copyright notice in libmng.h                        * */
  4/* ************************************************************************** */
  5/* *                                                                        * */
  6/* * project   : libmng                                                     * */
  7/* * file      : libmng_chunk_io.h         copyright (c) 2000-2007 G.Juyn   * */
  8/* * version   : 1.0.109                                                      * */
  9/* *                                                                        * */
 10/* * purpose   : Chunk I/O routines (definition)                            * */
 11/* *                                                                        * */
 12/* * author    : G.Juyn                                                     * */
 13/* *                                                                        * */
 14/* * comment   : Definition of the chunk input/output routines              * */
 15/* *                                                                        * */
 16/* * changes   : 0.5.1 - 05/04/2000 - G.Juyn                                * */
 17/* *             - changed CRC initialization to use dynamic structure      * */
 18/* *               (wasn't thread-safe the old way !)                       * */
 19/* *             0.5.1 - 05/08/2000 - G.Juyn                                * */
 20/* *             - changed write routines definition                        * */
 21/* *             - changed strict-ANSI stuff                                * */
 22/* *                                                                        * */
 23/* *             0.9.2 - 08/05/2000 - G.Juyn                                * */
 24/* *             - changed file-prefixes                                    * */
 25/* *                                                                        * */
 26/* *             0.9.3 - 08/26/2000 - G.Juyn                                * */
 27/* *             - added MAGN chunk                                         * */
 28/* *             0.9.3 - 10/16/2000 - G.Juyn                                * */
 29/* *             - added support for JDAA                                   * */
 30/* *                                                                        * */
 31/* *             1.0.5 - 08/19/2002 - G.Juyn                                * */
 32/* *             - B597134 - libmng pollutes the linker namespace           * */
 33/* *             1.0.5 - 09/14/2002 - G.Juyn                                * */
 34/* *             - added event handling for dynamic MNG                     * */
 35/* *                                                                        * */
 36/* *             1.0.6 - 07/07/2003 - G.R-P                                 * */
 37/* *             - added SKIP_CHUNK and NO_DELTA_PNG support                * */
 38/* *             1.0.6 - 07/29/2003 - G.R-P                                 * */
 39/* *             - added conditionals around PAST chunk support             * */
 40/* *                                                                        * */
 41/* *             1.0.7 - 03/24/2004 - G.R-P                                 * */
 42/* *             - fixed SKIPCHUNK_itXT and SKIPCHUNK_ztXT typos            * */
 43/* *                                                                        * */
 44/* *             1.0.9 - 12/07/2004 - G.Juyn                                * */
 45/* *             - added conditional MNG_OPTIMIZE_CHUNKREADER               * */
 46/* *                                                                        * */
 47/* *             1.0.10 - 04/08/2007 - G.Juyn                               * */
 48/* *             - added support for mPNG proposal                          * */
 49/* *             1.0.10 - 04/12/2007 - G.Juyn                               * */
 50/* *             - added support for ANG proposal                           * */
 51/* *                                                                        * */
 52/* ************************************************************************** */
 53
 54#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
 55#pragma option -A                      /* force ANSI-C */
 56#endif
 57
 58#ifndef _libmng_chunk_io_h_
 59#define _libmng_chunk_io_h_
 60
 61/* ************************************************************************** */
 62
 63mng_uint32 mng_crc (mng_datap  pData,
 64                    mng_uint8p buf,
 65                    mng_int32  len);
 66
 67/* ************************************************************************** */
 68
 69#ifdef MNG_INCLUDE_READ_PROCS
 70
 71/* ************************************************************************** */
 72
 73mng_retcode mng_inflate_buffer (mng_datap  pData,
 74                                mng_uint8p pInbuf,
 75                                mng_uint32 iInsize,
 76                                mng_uint8p *pOutbuf,
 77                                mng_uint32 *iOutsize,
 78                                mng_uint32 *iRealsize);
 79
 80/* ************************************************************************** */
 81
 82#define READ_CHUNK(n) mng_retcode n (mng_datap   pData,    \
 83                                     mng_chunkp  pHeader,  \
 84                                     mng_uint32  iRawlen,  \
 85                                     mng_uint8p  pRawdata, \
 86                                     mng_chunkp* ppChunk)
 87
 88#ifdef MNG_OPTIMIZE_CHUNKREADER
 89READ_CHUNK (mng_read_general) ;
 90#endif
 91
 92READ_CHUNK (mng_read_ihdr) ;
 93READ_CHUNK (mng_read_plte) ;
 94READ_CHUNK (mng_read_idat) ;
 95READ_CHUNK (mng_read_iend) ;
 96READ_CHUNK (mng_read_trns) ;
 97READ_CHUNK (mng_read_gama) ;
 98READ_CHUNK (mng_read_chrm) ;
 99READ_CHUNK (mng_read_srgb) ;
100#ifndef MNG_SKIPCHUNK_iCCP
101READ_CHUNK (mng_read_iccp) ;
102#endif
103#ifndef MNG_SKIPCHUNK_tEXt
104READ_CHUNK (mng_read_text) ;
105#endif
106#ifndef MNG_SKIPCHUNK_zTXt
107READ_CHUNK (mng_read_ztxt) ;
108#endif
109#ifndef MNG_SKIPCHUNK_iTXt
110READ_CHUNK (mng_read_itxt) ;
111#endif
112#ifndef MNG_SKIPCHUNK_bKGD
113READ_CHUNK (mng_read_bkgd) ;
114#endif
115#ifndef MNG_SKIPCHUNK_pHYs
116READ_CHUNK (mng_read_phys) ;
117#endif
118#ifndef MNG_SKIPCHUNK_sBIT
119READ_CHUNK (mng_read_sbit) ;
120#endif
121#ifndef MNG_SKIPCHUNK_sPLT
122READ_CHUNK (mng_read_splt) ;
123#endif
124#ifndef MNG_SKIPCHUNK_hIST
125READ_CHUNK (mng_read_hist) ;
126#endif
127#ifndef MNG_SKIPCHUNK_tIME
128READ_CHUNK (mng_read_time) ;
129#endif
130READ_CHUNK (mng_read_mhdr) ;
131READ_CHUNK (mng_read_mend) ;
132READ_CHUNK (mng_read_loop) ;
133READ_CHUNK (mng_read_endl) ;
134READ_CHUNK (mng_read_defi) ;
135READ_CHUNK (mng_read_basi) ;
136READ_CHUNK (mng_read_clon) ;
137#ifndef MNG_SKIPCHUNK_PAST
138READ_CHUNK (mng_read_past) ;
139#endif
140READ_CHUNK (mng_read_disc) ;
141READ_CHUNK (mng_read_back) ;
142READ_CHUNK (mng_read_fram) ;
143READ_CHUNK (mng_read_move) ;
144READ_CHUNK (mng_read_clip) ;
145READ_CHUNK (mng_read_show) ;
146READ_CHUNK (mng_read_term) ;
147READ_CHUNK (mng_read_save) ;
148READ_CHUNK (mng_read_seek) ;
149#ifndef MNG_SKIPCHUNK_eXPI
150READ_CHUNK (mng_read_expi) ;
151#endif
152#ifndef MNG_SKIPCHUNK_fPRI
153READ_CHUNK (mng_read_fpri) ;
154#endif
155#ifndef MNG_SKIPCHUNK_pHYg
156READ_CHUNK (mng_read_phyg) ;
157#endif
158#ifdef MNG_INCLUDE_JNG
159READ_CHUNK (mng_read_jhdr) ;
160READ_CHUNK (mng_read_jdaa) ;
161READ_CHUNK (mng_read_jdat) ;
162READ_CHUNK (mng_read_jsep) ;
163#endif
164#ifndef MNG_NO_DELTA_PNG
165READ_CHUNK (mng_read_dhdr) ;
166READ_CHUNK (mng_read_prom) ;
167READ_CHUNK (mng_read_ipng) ;
168READ_CHUNK (mng_read_pplt) ;
169#ifdef MNG_INCLUDE_JNG
170READ_CHUNK (mng_read_ijng) ;
171#endif
172READ_CHUNK (mng_read_drop) ;
173READ_CHUNK (mng_read_dbyk) ;
174READ_CHUNK (mng_read_ordr) ;
175#endif
176READ_CHUNK (mng_read_magn) ;
177#ifndef MNG_SKIPCHUNK_nEED
178READ_CHUNK (mng_read_need) ;
179#endif
180#ifdef MNG_INCLUDE_MPNG_PROPOSAL
181READ_CHUNK (mng_read_mpng) ;
182#endif
183#ifndef MNG_SKIPCHUNK_evNT
184READ_CHUNK (mng_read_evnt) ;
185#endif
186READ_CHUNK (mng_read_unknown) ;
187
188/* ************************************************************************** */
189
190#else /* MNG_INCLUDE_READ_PROCS */
191#define mng_read_ihdr 0
192#define mng_read_plte 0
193#define mng_read_idat 0
194#define mng_read_iend 0
195#define mng_read_trns 0
196#define mng_read_gama 0
197#define mng_read_chrm 0
198#define mng_read_srgb 0
199#define mng_read_iccp 0
200#define mng_read_text 0
201#define mng_read_ztxt 0
202#define mng_read_itxt 0
203#define mng_read_bkgd 0
204#define mng_read_phys 0
205#define mng_read_sbit 0
206#define mng_read_splt 0
207#define mng_read_hist 0
208#define mng_read_time 0
209#define mng_read_mhdr 0
210#define mng_read_mend 0
211#define mng_read_loop 0
212#define mng_read_endl 0
213#define mng_read_defi 0
214#define mng_read_basi 0
215#define mng_read_clon 0
216#ifndef MNG_SKIPCHUNK_PAST
217#define mng_read_past 0
218#endif
219#define mng_read_disc 0
220#define mng_read_back 0
221#define mng_read_fram 0
222#define mng_read_move 0
223#define mng_read_clip 0
224#define mng_read_show 0
225#define mng_read_term 0
226#define mng_read_save 0
227#define mng_read_seek 0
228#define mng_read_expi 0
229#define mng_read_fpri 0
230#define mng_read_phyg 0
231#ifdef MNG_INCLUDE_JNG
232#define mng_read_jhdr 0
233#define mng_read_jdaa 0
234#define mng_read_jdat 0
235#define mng_read_jsep 0
236#endif
237#ifndef MNG_NO_DELTA_PNG
238#define mng_read_dhdr 0
239#define mng_read_prom 0
240#define mng_read_ipng 0
241#define mng_read_pplt 0
242#ifdef MNG_INCLUDE_JNG
243#define mng_read_ijng 0
244#endif
245#define mng_read_drop 0
246#define mng_read_dbyk 0
247#define mng_read_ordr 0
248#endif
249#define mng_read_magn 0
250#define mng_read_need 0
251#ifdef MNG_INCLUDE_MPNG_PROPOSAL
252#define mng_read_mpng 0
253#endif
254#define mng_read_evnt 0
255#define mng_read_unknown 0
256#endif /* MNG_INCLUDE_READ_PROCS */
257
258/* ************************************************************************** */
259
260#ifdef MNG_INCLUDE_WRITE_PROCS
261
262#define WRITE_CHUNK(n) mng_retcode n (mng_datap  pData,   \
263                                      mng_chunkp pChunk)
264
265WRITE_CHUNK (mng_write_ihdr) ;
266WRITE_CHUNK (mng_write_plte) ;
267WRITE_CHUNK (mng_write_idat) ;
268WRITE_CHUNK (mng_write_iend) ;
269WRITE_CHUNK (mng_write_trns) ;
270WRITE_CHUNK (mng_write_gama) ;
271WRITE_CHUNK (mng_write_chrm) ;
272WRITE_CHUNK (mng_write_srgb) ;
273WRITE_CHUNK (mng_write_iccp) ;
274WRITE_CHUNK (mng_write_text) ;
275WRITE_CHUNK (mng_write_ztxt) ;
276WRITE_CHUNK (mng_write_itxt) ;
277WRITE_CHUNK (mng_write_bkgd) ;
278WRITE_CHUNK (mng_write_phys) ;
279WRITE_CHUNK (mng_write_sbit) ;
280WRITE_CHUNK (mng_write_splt) ;
281WRITE_CHUNK (mng_write_hist) ;
282WRITE_CHUNK (mng_write_time) ;
283WRITE_CHUNK (mng_write_mhdr) ;
284WRITE_CHUNK (mng_write_mend) ;
285WRITE_CHUNK (mng_write_loop) ;
286WRITE_CHUNK (mng_write_endl) ;
287WRITE_CHUNK (mng_write_defi) ;
288WRITE_CHUNK (mng_write_basi) ;
289WRITE_CHUNK (mng_write_clon) ;
290#ifndef MNG_SKIPCHUNK_PAST
291WRITE_CHUNK (mng_write_past) ;
292#endif
293WRITE_CHUNK (mng_write_disc) ;
294WRITE_CHUNK (mng_write_back) ;
295WRITE_CHUNK (mng_write_fram) ;
296WRITE_CHUNK (mng_write_move) ;
297WRITE_CHUNK (mng_write_clip) ;
298WRITE_CHUNK (mng_write_show) ;
299WRITE_CHUNK (mng_write_term) ;
300WRITE_CHUNK (mng_write_save) ;
301WRITE_CHUNK (mng_write_seek) ;
302WRITE_CHUNK (mng_write_expi) ;
303WRITE_CHUNK (mng_write_fpri) ;
304WRITE_CHUNK (mng_write_phyg) ;
305#ifdef MNG_INCLUDE_JNG
306WRITE_CHUNK (mng_write_jhdr) ;
307WRITE_CHUNK (mng_write_jdaa) ;
308WRITE_CHUNK (mng_write_jdat) ;
309WRITE_CHUNK (mng_write_jsep) ;
310#endif
311#ifndef MNG_NO_DELTA_PNG
312WRITE_CHUNK (mng_write_dhdr) ;
313WRITE_CHUNK (mng_write_prom) ;
314WRITE_CHUNK (mng_write_ipng) ;
315WRITE_CHUNK (mng_write_pplt) ;
316#ifdef MNG_INCLUDE_JNG
317WRITE_CHUNK (mng_write_ijng) ;
318#endif
319WRITE_CHUNK (mng_write_drop) ;
320WRITE_CHUNK (mng_write_dbyk) ;
321WRITE_CHUNK (mng_write_ordr) ;
322#endif
323WRITE_CHUNK (mng_write_magn) ;
324WRITE_CHUNK (mng_write_need) ;
325#ifdef MNG_INCLUDE_MPNG_PROPOSAL
326WRITE_CHUNK (mng_write_mpng) ;
327#endif
328#ifdef MNG_INCLUDE_ANG_PROPOSAL
329WRITE_CHUNK (mng_write_ahdr) ;
330WRITE_CHUNK (mng_write_adat) ;
331#endif
332WRITE_CHUNK (mng_write_evnt) ;
333WRITE_CHUNK (mng_write_unknown) ;
334
335/* ************************************************************************** */
336
337#else /* MNG_INCLUDE_WRITE_PROCS */
338#define mng_write_ihdr 0
339#define mng_write_plte 0
340#define mng_write_idat 0
341#define mng_write_iend 0
342#define mng_write_trns 0
343#define mng_write_gama 0
344#define mng_write_chrm 0
345#define mng_write_srgb 0
346#define mng_write_iccp 0
347#define mng_write_text 0
348#define mng_write_ztxt 0
349#define mng_write_itxt 0
350#define mng_write_bkgd 0
351#define mng_write_phys 0
352#define mng_write_sbit 0
353#define mng_write_splt 0
354#define mng_write_hist 0
355#define mng_write_time 0
356#define mng_write_mhdr 0
357#define mng_write_mend 0
358#define mng_write_loop 0
359#define mng_write_endl 0
360#define mng_write_defi 0
361#define mng_write_basi 0
362#define mng_write_clon 0
363#ifndef MNG_SKIPCHUNK_PAST
364#define mng_write_past 0
365#endif
366#define mng_write_disc 0
367#define mng_write_back 0
368#define mng_write_fram 0
369#define mng_write_move 0
370#define mng_write_clip 0
371#define mng_write_show 0
372#define mng_write_term 0
373#define mng_write_save 0
374#define mng_write_seek 0
375#define mng_write_expi 0
376#define mng_write_fpri 0
377#define mng_write_phyg 0
378#ifdef MNG_INCLUDE_JNG
379#define mng_write_jhdr 0
380#define mng_write_jdaa 0
381#define mng_write_jdat 0
382#define mng_write_jsep 0
383#endif
384#ifndef MNG_NO_DELTA_PNG
385#define mng_write_dhdr 0
386#define mng_write_prom 0
387#define mng_write_ipng 0
388#define mng_write_pplt 0
389#ifdef MNG_INCLUDE_JNG
390#define mng_write_ijng 0
391#endif
392#define mng_write_drop 0
393#define mng_write_dbyk 0
394#define mng_write_ordr 0
395#endif
396#define mng_write_magn 0
397#define mng_write_need 0
398#ifdef MNG_INCLUDE_MPNG_PROPOSAL
399#define mng_write_mpng 0
400#endif
401#ifdef MNG_INCLUDE_ANG_PROPOSAL
402#define mng_write_adat 0
403#define mng_write_ahdr 0
404#endif
405#define mng_write_evnt 0
406#define mng_write_unknown 0
407#endif /* MNG_INCLUDE_WRITE_PROCS */
408
409/* ************************************************************************** */
410
411#endif /* _libmng_chunk_io_h_ */
412
413/* ************************************************************************** */
414/* * end of file                                                            * */
415/* ************************************************************************** */