source: trunk/src/3rdparty/libmng/libmng_chunk_xs.c

Last change on this file was 2, checked in by dmik, 20 years ago

Imported xplatform parts of the official release 3.3.1 from Trolltech

  • Property svn:keywords set to Id
File size: 191.0 KB
Line 
1/* ************************************************************************** */
2/* * For conditions of distribution and use, * */
3/* * see copyright notice in libmng.h * */
4/* ************************************************************************** */
5/* * * */
6/* * project : libmng * */
7/* * file : libmng_chunk_xs.c copyright (c) 2000 G. Juyn * */
8/* * version : 1.0.0 * */
9/* * * */
10/* * purpose : chunk access functions (implementation) * */
11/* * * */
12/* * author : G.Juyn * */
13/* * web : http://www.3-t.com * */
14/* * email : mailto:info@3-t.com * */
15/* * * */
16/* * comment : implementation of the chunk access functions * */
17/* * * */
18/* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */
19/* * - changed and filled iterate-chunk function * */
20/* * 0.5.1 - 05/08/2000 - G.Juyn * */
21/* * - fixed calling convention * */
22/* * - added getchunk functions * */
23/* * - added putchunk functions * */
24/* * - changed strict-ANSI stuff * */
25/* * 0.5.1 - 05/11/2000 - G.Juyn * */
26/* * - added empty-chunk put-routines * */
27/* * 0.5.1 - 05/12/2000 - G.Juyn * */
28/* * - changed trace to macro for callback error-reporting * */
29/* * 0.5.1 - 05/15/2000 - G.Juyn * */
30/* * - added getimgdata & putimgdata functions * */
31/* * * */
32/* * 0.5.2 - 05/19/2000 - G.Juyn * */
33/* * - B004 - fixed problem with MNG_SUPPORT_WRITE not defined * */
34/* * also for MNG_SUPPORT_WRITE without MNG_INCLUDE_JNG * */
35/* * - Cleaned up some code regarding mixed support * */
36/* * * */
37/* * 0.9.1 - 07/19/2000 - G.Juyn * */
38/* * - fixed creation-code * */
39/* * * */
40/* * 0.9.2 - 08/05/2000 - G.Juyn * */
41/* * - changed file-prefixes * */
42/* * - added function to set simplicity field * */
43/* * - fixed putchunk_unknown() function * */
44/* * * */
45/* * 0.9.3 - 08/07/2000 - G.Juyn * */
46/* * - B111300 - fixup for improved portability * */
47/* * 0.9.3 - 08/26/2000 - G.Juyn * */
48/* * - added MAGN chunk * */
49/* * 0.9.3 - 10/20/2000 - G.Juyn * */
50/* * - fixed putchunk_plte() to set bEmpty parameter * */
51/* * * */
52/* * 0.9.5 - 1/25/2001 - G.Juyn * */
53/* * - fixed some small compiler warnings (thanks Nikki) * */
54/* * * */
55/* ************************************************************************** */
56
57#include "libmng.h"
58#include "libmng_data.h"
59#include "libmng_error.h"
60#include "libmng_trace.h"
61#ifdef __BORLANDC__
62#pragma hdrstop
63#endif
64#include "libmng_memory.h"
65#include "libmng_chunks.h"
66#include "libmng_chunk_prc.h"
67#include "libmng_chunk_io.h"
68
69#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
70#pragma option -A /* force ANSI-C */
71#endif
72
73/* ************************************************************************** */
74
75#ifdef MNG_ACCESS_CHUNKS
76
77/* ************************************************************************** */
78
79mng_retcode MNG_DECL mng_iterate_chunks (mng_handle hHandle,
80 mng_uint32 iChunkseq,
81 mng_iteratechunk fProc)
82{
83 mng_uint32 iSeq;
84 mng_chunkid iChunkname;
85 mng_datap pData;
86 mng_chunkp pChunk;
87 mng_bool bCont;
88
89#ifdef MNG_SUPPORT_TRACE
90 MNG_TRACE (((mng_datap)hHandle), MNG_FN_ITERATE_CHUNKS, MNG_LC_START)
91#endif
92
93 MNG_VALIDHANDLE (hHandle) /* check validity handle */
94 pData = ((mng_datap)hHandle); /* and make it addressable */
95
96 iSeq = 0;
97 bCont = MNG_TRUE;
98 pChunk = pData->pFirstchunk; /* get the first chunk */
99 /* as long as there are some more */
100 while ((pChunk) && (bCont)) /* and the app didn't signal a stop */
101 {
102 if (iSeq >= iChunkseq) /* reached the first target ? */
103 { /* then call this and next ones back in... */
104 iChunkname = ((mng_chunk_headerp)pChunk)->iChunkname;
105 bCont = fProc (hHandle, (mng_handle)pChunk, iChunkname, iSeq);
106 }
107
108 iSeq++; /* next one */
109 pChunk = ((mng_chunk_headerp)pChunk)->pNext;
110 }
111
112#ifdef MNG_SUPPORT_TRACE
113 MNG_TRACE (((mng_datap)hHandle), MNG_FN_ITERATE_CHUNKS, MNG_LC_END)
114#endif
115
116 return MNG_NOERROR;
117}
118
119/* ************************************************************************** */
120
121mng_retcode MNG_DECL mng_getchunk_ihdr (mng_handle hHandle,
122 mng_handle hChunk,
123 mng_uint32 *iWidth,
124 mng_uint32 *iHeight,
125 mng_uint8 *iBitdepth,
126 mng_uint8 *iColortype,
127 mng_uint8 *iCompression,
128 mng_uint8 *iFilter,
129 mng_uint8 *iInterlace)
130{
131 mng_datap pData;
132 mng_ihdrp pChunk;
133
134#ifdef MNG_SUPPORT_TRACE
135 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_IHDR, MNG_LC_START)
136#endif
137
138 MNG_VALIDHANDLE (hHandle) /* check validity handle */
139 pData = (mng_datap)hHandle; /* and make it addressable */
140 pChunk = (mng_ihdrp)hChunk; /* address the chunk */
141
142 if (pChunk->sHeader.iChunkname != MNG_UINT_IHDR)
143 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
144
145 *iWidth = pChunk->iWidth; /* fill the fields */
146 *iHeight = pChunk->iHeight;
147 *iBitdepth = pChunk->iBitdepth;
148 *iColortype = pChunk->iColortype;
149 *iCompression = pChunk->iCompression;
150 *iFilter = pChunk->iFilter;
151 *iInterlace = pChunk->iInterlace;
152
153#ifdef MNG_SUPPORT_TRACE
154 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_IHDR, MNG_LC_END)
155#endif
156
157 return MNG_NOERROR;
158}
159
160/* ************************************************************************** */
161
162mng_retcode MNG_DECL mng_getchunk_plte (mng_handle hHandle,
163 mng_handle hChunk,
164 mng_uint32 *iCount,
165 mng_palette8 *aPalette)
166{
167 mng_datap pData;
168 mng_pltep pChunk;
169
170#ifdef MNG_SUPPORT_TRACE
171 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PLTE, MNG_LC_START)
172#endif
173
174 MNG_VALIDHANDLE (hHandle) /* check validity handle */
175 pData = (mng_datap)hHandle; /* and make it addressable */
176 pChunk = (mng_pltep)hChunk; /* address the chunk */
177
178 if (pChunk->sHeader.iChunkname != MNG_UINT_PLTE)
179 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
180
181 *iCount = pChunk->iEntrycount; /* fill the fields */
182
183 MNG_COPY (*aPalette, pChunk->aEntries, sizeof (mng_palette8))
184
185#ifdef MNG_SUPPORT_TRACE
186 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PLTE, MNG_LC_END)
187#endif
188
189 return MNG_NOERROR;
190}
191
192/* ************************************************************************** */
193
194mng_retcode MNG_DECL mng_getchunk_idat (mng_handle hHandle,
195 mng_handle hChunk,
196 mng_uint32 *iRawlen,
197 mng_ptr *pRawdata)
198{
199 mng_datap pData;
200 mng_idatp pChunk;
201
202#ifdef MNG_SUPPORT_TRACE
203 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_IDAT, MNG_LC_START)
204#endif
205
206 MNG_VALIDHANDLE (hHandle) /* check validity handle */
207 pData = (mng_datap)hHandle; /* and make it addressable */
208 pChunk = (mng_idatp)hChunk; /* address the chunk */
209
210 if (pChunk->sHeader.iChunkname != MNG_UINT_IDAT)
211 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
212
213 *iRawlen = pChunk->iDatasize; /* fill the fields */
214 *pRawdata = pChunk->pData;
215
216#ifdef MNG_SUPPORT_TRACE
217 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_IDAT, MNG_LC_END)
218#endif
219
220 return MNG_NOERROR;
221}
222
223/* ************************************************************************** */
224
225mng_retcode MNG_DECL mng_getchunk_trns (mng_handle hHandle,
226 mng_handle hChunk,
227 mng_bool *bEmpty,
228 mng_bool *bGlobal,
229 mng_uint8 *iType,
230 mng_uint32 *iCount,
231 mng_uint8arr *aAlphas,
232 mng_uint16 *iGray,
233 mng_uint16 *iRed,
234 mng_uint16 *iGreen,
235 mng_uint16 *iBlue,
236 mng_uint32 *iRawlen,
237 mng_uint8arr *aRawdata)
238{
239 mng_datap pData;
240 mng_trnsp pChunk;
241
242#ifdef MNG_SUPPORT_TRACE
243 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TRNS, MNG_LC_START)
244#endif
245
246 MNG_VALIDHANDLE (hHandle) /* check validity handle */
247 pData = (mng_datap)hHandle; /* and make it addressable */
248 pChunk = (mng_trnsp)hChunk; /* address the chunk */
249
250 if (pChunk->sHeader.iChunkname != MNG_UINT_tRNS)
251 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
252
253 *bEmpty = pChunk->bEmpty; /* fill the fields */
254 *bGlobal = pChunk->bGlobal;
255 *iType = pChunk->iType;
256 *iCount = pChunk->iCount;
257 *iGray = pChunk->iGray;
258 *iRed = pChunk->iRed;
259 *iGreen = pChunk->iGreen;
260 *iBlue = pChunk->iBlue;
261 *iRawlen = pChunk->iRawlen;
262
263 MNG_COPY (*aAlphas, pChunk->aEntries, sizeof (mng_uint8arr))
264 MNG_COPY (*aRawdata, pChunk->aRawdata, sizeof (mng_uint8arr))
265
266#ifdef MNG_SUPPORT_TRACE
267 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TRNS, MNG_LC_END)
268#endif
269
270 return MNG_NOERROR;
271}
272
273/* ************************************************************************** */
274
275mng_retcode MNG_DECL mng_getchunk_gama (mng_handle hHandle,
276 mng_handle hChunk,
277 mng_bool *bEmpty,
278 mng_uint32 *iGamma)
279{
280 mng_datap pData;
281 mng_gamap pChunk;
282
283#ifdef MNG_SUPPORT_TRACE
284 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_GAMA, MNG_LC_START)
285#endif
286
287 MNG_VALIDHANDLE (hHandle) /* check validity handle */
288 pData = (mng_datap)hHandle; /* and make it addressable */
289 pChunk = (mng_gamap)hChunk; /* address the chunk */
290
291 if (pChunk->sHeader.iChunkname != MNG_UINT_gAMA)
292 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
293
294 *bEmpty = pChunk->bEmpty; /* fill the fields */
295 *iGamma = pChunk->iGamma;
296
297#ifdef MNG_SUPPORT_TRACE
298 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_GAMA, MNG_LC_END)
299#endif
300
301 return MNG_NOERROR;
302}
303
304/* ************************************************************************** */
305
306mng_retcode MNG_DECL mng_getchunk_chrm (mng_handle hHandle,
307 mng_handle hChunk,
308 mng_bool *bEmpty,
309 mng_uint32 *iWhitepointx,
310 mng_uint32 *iWhitepointy,
311 mng_uint32 *iRedx,
312 mng_uint32 *iRedy,
313 mng_uint32 *iGreenx,
314 mng_uint32 *iGreeny,
315 mng_uint32 *iBluex,
316 mng_uint32 *iBluey)
317{
318 mng_datap pData;
319 mng_chrmp pChunk;
320
321#ifdef MNG_SUPPORT_TRACE
322 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CHRM, MNG_LC_START)
323#endif
324
325 MNG_VALIDHANDLE (hHandle) /* check validity handle */
326 pData = (mng_datap)hHandle; /* and make it addressable */
327 pChunk = (mng_chrmp)hChunk; /* address the chunk */
328
329 if (pChunk->sHeader.iChunkname != MNG_UINT_cHRM)
330 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
331
332 *bEmpty = pChunk->bEmpty; /* fill the fields */
333 *iWhitepointx = pChunk->iWhitepointx;
334 *iWhitepointy = pChunk->iWhitepointy;
335 *iRedx = pChunk->iRedx;
336 *iRedy = pChunk->iRedy;
337 *iGreenx = pChunk->iGreenx;
338 *iGreeny = pChunk->iGreeny;
339 *iBluex = pChunk->iBluex;
340 *iBluey = pChunk->iBluey;
341
342#ifdef MNG_SUPPORT_TRACE
343 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CHRM, MNG_LC_END)
344#endif
345
346 return MNG_NOERROR;
347}
348
349/* ************************************************************************** */
350
351mng_retcode MNG_DECL mng_getchunk_srgb (mng_handle hHandle,
352 mng_handle hChunk,
353 mng_bool *bEmpty,
354 mng_uint8 *iRenderingintent)
355{
356 mng_datap pData;
357 mng_srgbp pChunk;
358
359#ifdef MNG_SUPPORT_TRACE
360 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SRGB, MNG_LC_START)
361#endif
362
363 MNG_VALIDHANDLE (hHandle) /* check validity handle */
364 pData = (mng_datap)hHandle; /* and make it addressable */
365 pChunk = (mng_srgbp)hChunk; /* address the chunk */
366
367 if (pChunk->sHeader.iChunkname != MNG_UINT_sRGB)
368 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
369
370 *bEmpty = pChunk->bEmpty; /* fill the fields */
371 *iRenderingintent = pChunk->iRenderingintent;
372
373#ifdef MNG_SUPPORT_TRACE
374 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SRGB, MNG_LC_END)
375#endif
376
377 return MNG_NOERROR;
378}
379
380/* ************************************************************************** */
381
382mng_retcode MNG_DECL mng_getchunk_iccp (mng_handle hHandle,
383 mng_handle hChunk,
384 mng_bool *bEmpty,
385 mng_uint32 *iNamesize,
386 mng_pchar *zName,
387 mng_uint8 *iCompression,
388 mng_uint32 *iProfilesize,
389 mng_ptr *pProfile)
390{
391 mng_datap pData;
392 mng_iccpp pChunk;
393
394#ifdef MNG_SUPPORT_TRACE
395 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ICCP, MNG_LC_START)
396#endif
397
398 MNG_VALIDHANDLE (hHandle) /* check validity handle */
399 pData = (mng_datap)hHandle; /* and make it addressable */
400 pChunk = (mng_iccpp)hChunk; /* address the chunk */
401
402 if (pChunk->sHeader.iChunkname != MNG_UINT_iCCP)
403 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
404
405 *bEmpty = pChunk->bEmpty; /* fill the fields */
406 *iNamesize = pChunk->iNamesize;
407 *zName = pChunk->zName;
408 *iCompression = pChunk->iCompression;
409 *iProfilesize = pChunk->iProfilesize;
410 *pProfile = pChunk->pProfile;
411
412#ifdef MNG_SUPPORT_TRACE
413 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ICCP, MNG_LC_END)
414#endif
415
416 return MNG_NOERROR;
417}
418
419/* ************************************************************************** */
420
421mng_retcode MNG_DECL mng_getchunk_text (mng_handle hHandle,
422 mng_handle hChunk,
423 mng_uint32 *iKeywordsize,
424 mng_pchar *zKeyword,
425 mng_uint32 *iTextsize,
426 mng_pchar *zText)
427{
428 mng_datap pData;
429 mng_textp pChunk;
430
431#ifdef MNG_SUPPORT_TRACE
432 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TEXT, MNG_LC_START)
433#endif
434
435 MNG_VALIDHANDLE (hHandle) /* check validity handle */
436 pData = (mng_datap)hHandle; /* and make it addressable */
437 pChunk = (mng_textp)hChunk; /* address the chunk */
438
439 if (pChunk->sHeader.iChunkname != MNG_UINT_tEXt)
440 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
441 /* fill the fields */
442 *iKeywordsize = pChunk->iKeywordsize;
443 *zKeyword = pChunk->zKeyword;
444 *iTextsize = pChunk->iTextsize;
445 *zText = pChunk->zText;
446
447#ifdef MNG_SUPPORT_TRACE
448 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TEXT, MNG_LC_END)
449#endif
450
451 return MNG_NOERROR;
452}
453
454/* ************************************************************************** */
455
456mng_retcode MNG_DECL mng_getchunk_ztxt (mng_handle hHandle,
457 mng_handle hChunk,
458 mng_uint32 *iKeywordsize,
459 mng_pchar *zKeyword,
460 mng_uint8 *iCompression,
461 mng_uint32 *iTextsize,
462 mng_pchar *zText)
463{
464 mng_datap pData;
465 mng_ztxtp pChunk;
466
467#ifdef MNG_SUPPORT_TRACE
468 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ZTXT, MNG_LC_START)
469#endif
470
471 MNG_VALIDHANDLE (hHandle) /* check validity handle */
472 pData = (mng_datap)hHandle; /* and make it addressable */
473 pChunk = (mng_ztxtp)hChunk; /* address the chunk */
474
475 if (pChunk->sHeader.iChunkname != MNG_UINT_zTXt)
476 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
477 /* fill the fields */
478 *iKeywordsize = pChunk->iKeywordsize;
479 *zKeyword = pChunk->zKeyword;
480 *iCompression = pChunk->iCompression;
481 *iTextsize = pChunk->iTextsize;
482 *zText = pChunk->zText;
483
484#ifdef MNG_SUPPORT_TRACE
485 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ZTXT, MNG_LC_END)
486#endif
487
488 return MNG_NOERROR;
489}
490
491/* ************************************************************************** */
492
493mng_retcode MNG_DECL mng_getchunk_itxt (mng_handle hHandle,
494 mng_handle hChunk,
495 mng_uint32 *iKeywordsize,
496 mng_pchar *zKeyword,
497 mng_uint8 *iCompressionflag,
498 mng_uint8 *iCompressionmethod,
499 mng_uint32 *iLanguagesize,
500 mng_pchar *zLanguage,
501 mng_uint32 *iTranslationsize,
502 mng_pchar *zTranslation,
503 mng_uint32 *iTextsize,
504 mng_pchar *zText)
505{
506 mng_datap pData;
507 mng_itxtp pChunk;
508
509#ifdef MNG_SUPPORT_TRACE
510 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ITXT, MNG_LC_START)
511#endif
512
513 MNG_VALIDHANDLE (hHandle) /* check validity handle */
514 pData = (mng_datap)hHandle; /* and make it addressable */
515 pChunk = (mng_itxtp)hChunk; /* address the chunk */
516
517 if (pChunk->sHeader.iChunkname != MNG_UINT_iTXt)
518 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
519 /* fill the fields */
520 *iKeywordsize = pChunk->iKeywordsize;
521 *zKeyword = pChunk->zKeyword;
522 *iCompressionflag = pChunk->iCompressionflag;
523 *iCompressionmethod = pChunk->iCompressionmethod;
524 *iLanguagesize = pChunk->iLanguagesize;
525 *zLanguage = pChunk->zLanguage;
526 *iTranslationsize = pChunk->iTranslationsize;
527 *zTranslation = pChunk->zTranslation;
528 *iTextsize = pChunk->iTextsize;
529 *zText = pChunk->zText;
530
531#ifdef MNG_SUPPORT_TRACE
532 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ITXT, MNG_LC_END)
533#endif
534
535 return MNG_NOERROR;
536}
537
538/* ************************************************************************** */
539
540mng_retcode MNG_DECL mng_getchunk_bkgd (mng_handle hHandle,
541 mng_handle hChunk,
542 mng_bool *bEmpty,
543 mng_uint8 *iType,
544 mng_uint8 *iIndex,
545 mng_uint16 *iGray,
546 mng_uint16 *iRed,
547 mng_uint16 *iGreen,
548 mng_uint16 *iBlue)
549{
550 mng_datap pData;
551 mng_bkgdp pChunk;
552
553#ifdef MNG_SUPPORT_TRACE
554 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BKGD, MNG_LC_START)
555#endif
556
557 MNG_VALIDHANDLE (hHandle) /* check validity handle */
558 pData = (mng_datap)hHandle; /* and make it addressable */
559 pChunk = (mng_bkgdp)hChunk; /* address the chunk */
560
561 if (pChunk->sHeader.iChunkname != MNG_UINT_bKGD)
562 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
563
564 *bEmpty = pChunk->bEmpty; /* fill the fields */
565 *iType = pChunk->iType;
566 *iIndex = pChunk->iIndex;
567 *iGray = pChunk->iGray;
568 *iRed = pChunk->iRed;
569 *iGreen = pChunk->iGreen;
570 *iBlue = pChunk->iBlue;
571
572#ifdef MNG_SUPPORT_TRACE
573 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BKGD, MNG_LC_END)
574#endif
575
576 return MNG_NOERROR;
577}
578
579/* ************************************************************************** */
580
581mng_retcode MNG_DECL mng_getchunk_phys (mng_handle hHandle,
582 mng_handle hChunk,
583 mng_bool *bEmpty,
584 mng_uint32 *iSizex,
585 mng_uint32 *iSizey,
586 mng_uint8 *iUnit)
587{
588 mng_datap pData;
589 mng_physp pChunk;
590
591#ifdef MNG_SUPPORT_TRACE
592 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PHYS, MNG_LC_START)
593#endif
594
595 MNG_VALIDHANDLE (hHandle) /* check validity handle */
596 pData = (mng_datap)hHandle; /* and make it addressable */
597 pChunk = (mng_physp)hChunk; /* address the chunk */
598
599 if (pChunk->sHeader.iChunkname != MNG_UINT_pHYs)
600 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
601
602 *bEmpty = pChunk->bEmpty; /* fill the fields */
603 *iSizex = pChunk->iSizex;
604 *iSizey = pChunk->iSizey;
605 *iUnit = pChunk->iUnit;
606
607#ifdef MNG_SUPPORT_TRACE
608 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PHYS, MNG_LC_END)
609#endif
610
611 return MNG_NOERROR;
612}
613
614/* ************************************************************************** */
615
616mng_retcode MNG_DECL mng_getchunk_sbit (mng_handle hHandle,
617 mng_handle hChunk,
618 mng_bool *bEmpty,
619 mng_uint8 *iType,
620 mng_uint8arr4 *aBits)
621{
622 mng_datap pData;
623 mng_sbitp pChunk;
624
625#ifdef MNG_SUPPORT_TRACE
626 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SBIT, MNG_LC_START)
627#endif
628
629 MNG_VALIDHANDLE (hHandle) /* check validity handle */
630 pData = (mng_datap)hHandle; /* and make it addressable */
631 pChunk = (mng_sbitp)hChunk; /* address the chunk */
632
633 if (pChunk->sHeader.iChunkname != MNG_UINT_sBIT)
634 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
635
636 *bEmpty = pChunk->bEmpty;
637 *iType = pChunk->iType;
638 (*aBits)[0] = pChunk->aBits[0];
639 (*aBits)[1] = pChunk->aBits[1];
640 (*aBits)[2] = pChunk->aBits[2];
641 (*aBits)[3] = pChunk->aBits[3];
642
643#ifdef MNG_SUPPORT_TRACE
644 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SBIT, MNG_LC_END)
645#endif
646
647 return MNG_NOERROR;
648}
649
650/* ************************************************************************** */
651
652mng_retcode MNG_DECL mng_getchunk_splt (mng_handle hHandle,
653 mng_handle hChunk,
654 mng_bool *bEmpty,
655 mng_uint32 *iNamesize,
656 mng_pchar *zName,
657 mng_uint8 *iSampledepth,
658 mng_uint32 *iEntrycount,
659 mng_ptr *pEntries)
660{
661 mng_datap pData;
662 mng_spltp pChunk;
663
664#ifdef MNG_SUPPORT_TRACE
665 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SPLT, MNG_LC_START)
666#endif
667
668 MNG_VALIDHANDLE (hHandle) /* check validity handle */
669 pData = (mng_datap)hHandle; /* and make it addressable */
670 pChunk = (mng_spltp)hChunk; /* address the chunk */
671
672 if (pChunk->sHeader.iChunkname != MNG_UINT_sPLT)
673 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
674
675 *bEmpty = pChunk->bEmpty; /* fill the fields */
676 *iNamesize = pChunk->iNamesize;
677 *zName = pChunk->zName;
678 *iSampledepth = pChunk->iSampledepth;
679 *iEntrycount = pChunk->iEntrycount;
680 *pEntries = pChunk->pEntries;
681
682#ifdef MNG_SUPPORT_TRACE
683 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SPLT, MNG_LC_END)
684#endif
685
686 return MNG_NOERROR;
687}
688
689/* ************************************************************************** */
690
691mng_retcode MNG_DECL mng_getchunk_hist (mng_handle hHandle,
692 mng_handle hChunk,
693 mng_uint32 *iEntrycount,
694 mng_uint16arr *aEntries)
695{
696 mng_datap pData;
697 mng_histp pChunk;
698
699#ifdef MNG_SUPPORT_TRACE
700 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_HIST, MNG_LC_START)
701#endif
702
703 MNG_VALIDHANDLE (hHandle) /* check validity handle */
704 pData = (mng_datap)hHandle; /* and make it addressable */
705 pChunk = (mng_histp)hChunk; /* address the chunk */
706
707 if (pChunk->sHeader.iChunkname != MNG_UINT_hIST)
708 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
709
710 *iEntrycount = pChunk->iEntrycount; /* fill the fields */
711
712 MNG_COPY (*aEntries, pChunk->aEntries, sizeof (mng_uint16arr))
713
714#ifdef MNG_SUPPORT_TRACE
715 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_HIST, MNG_LC_END)
716#endif
717
718 return MNG_NOERROR;
719}
720
721/* ************************************************************************** */
722
723mng_retcode MNG_DECL mng_getchunk_time (mng_handle hHandle,
724 mng_handle hChunk,
725 mng_uint16 *iYear,
726 mng_uint8 *iMonth,
727 mng_uint8 *iDay,
728 mng_uint8 *iHour,
729 mng_uint8 *iMinute,
730 mng_uint8 *iSecond)
731{
732 mng_datap pData;
733 mng_timep pChunk;
734
735#ifdef MNG_SUPPORT_TRACE
736 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TIME, MNG_LC_START)
737#endif
738
739 MNG_VALIDHANDLE (hHandle) /* check validity handle */
740 pData = (mng_datap)hHandle; /* and make it addressable */
741 pChunk = (mng_timep)hChunk; /* address the chunk */
742
743 if (pChunk->sHeader.iChunkname != MNG_UINT_tIME)
744 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
745
746 *iYear = pChunk->iYear; /* fill the fields */
747 *iMonth = pChunk->iMonth;
748 *iDay = pChunk->iDay;
749 *iHour = pChunk->iHour;
750 *iMinute = pChunk->iMinute;
751 *iSecond = pChunk->iSecond;
752
753#ifdef MNG_SUPPORT_TRACE
754 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TIME, MNG_LC_END)
755#endif
756
757 return MNG_NOERROR;
758}
759
760/* ************************************************************************** */
761
762mng_retcode MNG_DECL mng_getchunk_mhdr (mng_handle hHandle,
763 mng_handle hChunk,
764 mng_uint32 *iWidth,
765 mng_uint32 *iHeight,
766 mng_uint32 *iTicks,
767 mng_uint32 *iLayercount,
768 mng_uint32 *iFramecount,
769 mng_uint32 *iPlaytime,
770 mng_uint32 *iSimplicity)
771{
772 mng_datap pData;
773 mng_mhdrp pChunk;
774
775#ifdef MNG_SUPPORT_TRACE
776 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MHDR, MNG_LC_START)
777#endif
778
779 MNG_VALIDHANDLE (hHandle) /* check validity handle */
780 pData = (mng_datap)hHandle; /* and make it addressable */
781 pChunk = (mng_mhdrp)hChunk; /* address the chunk */
782
783 if (pChunk->sHeader.iChunkname != MNG_UINT_MHDR)
784 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
785
786 *iWidth = pChunk->iWidth; /* fill the fields */
787 *iHeight = pChunk->iHeight;
788 *iTicks = pChunk->iTicks;
789 *iLayercount = pChunk->iLayercount;
790 *iFramecount = pChunk->iFramecount;
791 *iPlaytime = pChunk->iPlaytime;
792 *iSimplicity = pChunk->iSimplicity;
793
794#ifdef MNG_SUPPORT_TRACE
795 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MHDR, MNG_LC_END)
796#endif
797
798 return MNG_NOERROR;
799}
800
801/* ************************************************************************** */
802
803mng_retcode MNG_DECL mng_getchunk_loop (mng_handle hHandle,
804 mng_handle hChunk,
805 mng_uint8 *iLevel,
806 mng_uint32 *iRepeat,
807 mng_uint8 *iTermination,
808 mng_uint32 *iItermin,
809 mng_uint32 *iItermax,
810 mng_uint32 *iCount,
811 mng_uint32p *pSignals)
812{
813 mng_datap pData;
814 mng_loopp pChunk;
815
816#ifdef MNG_SUPPORT_TRACE
817 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_LOOP, MNG_LC_START)
818#endif
819
820 MNG_VALIDHANDLE (hHandle) /* check validity handle */
821 pData = (mng_datap)hHandle; /* and make it addressable */
822 pChunk = (mng_loopp)hChunk; /* address the chunk */
823
824 if (pChunk->sHeader.iChunkname != MNG_UINT_LOOP)
825 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
826
827 *iLevel = pChunk->iLevel; /* fill teh fields */
828 *iRepeat = pChunk->iRepeat;
829 *iTermination = pChunk->iTermination;
830 *iItermin = pChunk->iItermin;
831 *iItermax = pChunk->iItermax;
832 *iCount = pChunk->iCount;
833 *pSignals = pChunk->pSignals;
834
835#ifdef MNG_SUPPORT_TRACE
836 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_LOOP, MNG_LC_END)
837#endif
838
839 return MNG_NOERROR;
840}
841
842/* ************************************************************************** */
843
844mng_retcode MNG_DECL mng_getchunk_endl (mng_handle hHandle,
845 mng_handle hChunk,
846 mng_uint8 *iLevel)
847{
848 mng_datap pData;
849 mng_endlp pChunk;
850
851#ifdef MNG_SUPPORT_TRACE
852 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ENDL, MNG_LC_START)
853#endif
854
855 MNG_VALIDHANDLE (hHandle) /* check validity handle */
856 pData = (mng_datap)hHandle; /* and make it addressable */
857 pChunk = (mng_endlp)hChunk; /* address the chunk */
858
859 if (pChunk->sHeader.iChunkname != MNG_UINT_ENDL)
860 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
861
862 *iLevel = pChunk->iLevel; /* fill the field */
863
864#ifdef MNG_SUPPORT_TRACE
865 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ENDL, MNG_LC_END)
866#endif
867
868 return MNG_NOERROR;
869}
870
871/* ************************************************************************** */
872
873mng_retcode MNG_DECL mng_getchunk_defi (mng_handle hHandle,
874 mng_handle hChunk,
875 mng_uint16 *iObjectid,
876 mng_uint8 *iDonotshow,
877 mng_uint8 *iConcrete,
878 mng_bool *bHasloca,
879 mng_int32 *iXlocation,
880 mng_int32 *iYlocation,
881 mng_bool *bHasclip,
882 mng_int32 *iLeftcb,
883 mng_int32 *iRightcb,
884 mng_int32 *iTopcb,
885 mng_int32 *iBottomcb)
886{
887 mng_datap pData;
888 mng_defip pChunk;
889
890#ifdef MNG_SUPPORT_TRACE
891 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DEFI, MNG_LC_START)
892#endif
893
894 MNG_VALIDHANDLE (hHandle) /* check validity handle */
895 pData = (mng_datap)hHandle; /* and make it addressable */
896 pChunk = (mng_defip)hChunk; /* address the chunk */
897
898 if (pChunk->sHeader.iChunkname != MNG_UINT_DEFI)
899 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
900
901 *iObjectid = pChunk->iObjectid; /* fill the fields */
902 *iDonotshow = pChunk->iDonotshow;
903 *iConcrete = pChunk->iConcrete;
904 *bHasloca = pChunk->bHasloca;
905 *iXlocation = pChunk->iXlocation;
906 *iYlocation = pChunk->iYlocation;
907 *bHasclip = pChunk->bHasclip;
908 *iLeftcb = pChunk->iLeftcb;
909 *iRightcb = pChunk->iRightcb;
910 *iTopcb = pChunk->iTopcb;
911 *iBottomcb = pChunk->iBottomcb;
912
913#ifdef MNG_SUPPORT_TRACE
914 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DEFI, MNG_LC_END)
915#endif
916
917 return MNG_NOERROR;
918}
919
920/* ************************************************************************** */
921
922mng_retcode MNG_DECL mng_getchunk_basi (mng_handle hHandle,
923 mng_handle hChunk,
924 mng_uint32 *iWidth,
925 mng_uint32 *iHeight,
926 mng_uint8 *iBitdepth,
927 mng_uint8 *iColortype,
928 mng_uint8 *iCompression,
929 mng_uint8 *iFilter,
930 mng_uint8 *iInterlace,
931 mng_uint16 *iRed,
932 mng_uint16 *iGreen,
933 mng_uint16 *iBlue,
934 mng_uint16 *iAlpha,
935 mng_uint8 *iViewable)
936{
937 mng_datap pData;
938 mng_basip pChunk;
939
940#ifdef MNG_SUPPORT_TRACE
941 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BASI, MNG_LC_START)
942#endif
943
944 MNG_VALIDHANDLE (hHandle) /* check validity handle */
945 pData = (mng_datap)hHandle; /* and make it addressable */
946 pChunk = (mng_basip)hChunk; /* address the chunk */
947
948 if (pChunk->sHeader.iChunkname != MNG_UINT_BASI)
949 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
950
951 *iWidth = pChunk->iWidth; /* fill the fields */
952 *iHeight = pChunk->iHeight;
953 *iBitdepth = pChunk->iBitdepth;
954 *iColortype = pChunk->iColortype;
955 *iCompression = pChunk->iCompression;
956 *iFilter = pChunk->iFilter;
957 *iInterlace = pChunk->iInterlace;
958 *iRed = pChunk->iRed;
959 *iGreen = pChunk->iGreen;
960 *iBlue = pChunk->iBlue;
961 *iAlpha = pChunk->iAlpha;
962 *iViewable = pChunk->iViewable;
963
964#ifdef MNG_SUPPORT_TRACE
965 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BASI, MNG_LC_END)
966#endif
967
968 return MNG_NOERROR;
969}
970
971/* ************************************************************************** */
972
973mng_retcode MNG_DECL mng_getchunk_clon (mng_handle hHandle,
974 mng_handle hChunk,
975 mng_uint16 *iSourceid,
976 mng_uint16 *iCloneid,
977 mng_uint8 *iClonetype,
978 mng_uint8 *iDonotshow,
979 mng_uint8 *iConcrete,
980 mng_bool *bHasloca,
981 mng_uint8 *iLocationtype,
982 mng_int32 *iLocationx,
983 mng_int32 *iLocationy)
984{
985 mng_datap pData;
986 mng_clonp pChunk;
987
988#ifdef MNG_SUPPORT_TRACE
989 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CLON, MNG_LC_START)
990#endif
991
992 MNG_VALIDHANDLE (hHandle) /* check validity handle */
993 pData = (mng_datap)hHandle; /* and make it addressable */
994 pChunk = (mng_clonp)hChunk; /* address the chunk */
995
996 if (pChunk->sHeader.iChunkname != MNG_UINT_CLON)
997 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
998
999 *iSourceid = pChunk->iSourceid; /* fill the fields */
1000 *iCloneid = pChunk->iCloneid;
1001 *iClonetype = pChunk->iClonetype;
1002 *iDonotshow = pChunk->iDonotshow;
1003 *iConcrete = pChunk->iConcrete;
1004 *bHasloca = pChunk->bHasloca;
1005 *iLocationtype = pChunk->iLocationtype;
1006 *iLocationx = pChunk->iLocationx;
1007 *iLocationy = pChunk->iLocationy;
1008
1009#ifdef MNG_SUPPORT_TRACE
1010 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CLON, MNG_LC_END)
1011#endif
1012
1013 return MNG_NOERROR;
1014}
1015
1016/* ************************************************************************** */
1017
1018mng_retcode MNG_DECL mng_getchunk_past (mng_handle hHandle,
1019 mng_handle hChunk,
1020 mng_uint16 *iDestid,
1021 mng_uint8 *iTargettype,
1022 mng_int32 *iTargetx,
1023 mng_int32 *iTargety,
1024 mng_uint32 *iCount)
1025{
1026 mng_datap pData;
1027 mng_pastp pChunk;
1028
1029#ifdef MNG_SUPPORT_TRACE
1030 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PAST, MNG_LC_START)
1031#endif
1032
1033 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1034 pData = (mng_datap)hHandle; /* and make it addressable */
1035 pChunk = (mng_pastp)hChunk; /* address the chunk */
1036
1037 if (pChunk->sHeader.iChunkname != MNG_UINT_PAST)
1038 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1039
1040 *iDestid = pChunk->iDestid; /* fill the fields */
1041 *iTargettype = pChunk->iTargettype;
1042 *iTargetx = pChunk->iTargetx;
1043 *iTargety = pChunk->iTargety;
1044 *iCount = pChunk->iCount;
1045
1046#ifdef MNG_SUPPORT_TRACE
1047 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PAST, MNG_LC_END)
1048#endif
1049
1050 return MNG_NOERROR;
1051}
1052
1053/* ************************************************************************** */
1054
1055mng_retcode MNG_DECL mng_getchunk_past_src (mng_handle hHandle,
1056 mng_handle hChunk,
1057 mng_uint32 iEntry,
1058 mng_uint16 *iSourceid,
1059 mng_uint8 *iComposition,
1060 mng_uint8 *iOrientation,
1061 mng_uint8 *iOffsettype,
1062 mng_int32 *iOffsetx,
1063 mng_int32 *iOffsety,
1064 mng_uint8 *iBoundarytype,
1065 mng_int32 *iBoundaryl,
1066 mng_int32 *iBoundaryr,
1067 mng_int32 *iBoundaryt,
1068 mng_int32 *iBoundaryb)
1069{
1070 mng_datap pData;
1071 mng_pastp pChunk;
1072 mng_past_sourcep pEntry;
1073
1074#ifdef MNG_SUPPORT_TRACE
1075 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PAST_SRC, MNG_LC_START)
1076#endif
1077
1078 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1079 pData = (mng_datap)hHandle; /* and make it addressable */
1080 pChunk = (mng_pastp)hChunk; /* address the chunk */
1081
1082 if (pChunk->sHeader.iChunkname != MNG_UINT_PAST)
1083 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1084
1085 if (iEntry >= pChunk->iCount) /* valid index ? */
1086 MNG_ERROR (pData, MNG_INVALIDENTRYIX)
1087 /* address the entry */
1088 pEntry = pChunk->pSources + iEntry;
1089
1090 *iSourceid = pEntry->iSourceid; /* fill the fields */
1091 *iComposition = pEntry->iComposition;
1092 *iOrientation = pEntry->iOrientation;
1093 *iOffsettype = pEntry->iOffsettype;
1094 *iOffsetx = pEntry->iOffsetx;
1095 *iOffsety = pEntry->iOffsety;
1096 *iBoundarytype = pEntry->iBoundarytype;
1097 *iBoundaryl = pEntry->iBoundaryl;
1098 *iBoundaryr = pEntry->iBoundaryr;
1099 *iBoundaryt = pEntry->iBoundaryt;
1100 *iBoundaryb = pEntry->iBoundaryb;
1101
1102#ifdef MNG_SUPPORT_TRACE
1103 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PAST_SRC, MNG_LC_END)
1104#endif
1105
1106 return MNG_NOERROR;
1107}
1108
1109/* ************************************************************************** */
1110
1111mng_retcode MNG_DECL mng_getchunk_disc (mng_handle hHandle,
1112 mng_handle hChunk,
1113 mng_uint32 *iCount,
1114 mng_uint16p *pObjectids)
1115{
1116 mng_datap pData;
1117 mng_discp pChunk;
1118
1119#ifdef MNG_SUPPORT_TRACE
1120 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DISC, MNG_LC_START)
1121#endif
1122
1123 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1124 pData = (mng_datap)hHandle; /* and make it addressable */
1125 pChunk = (mng_discp)hChunk; /* address the chunk */
1126
1127 if (pChunk->sHeader.iChunkname != MNG_UINT_DISC)
1128 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1129
1130 *iCount = pChunk->iCount; /* fill the fields */
1131 *pObjectids = pChunk->pObjectids;
1132
1133#ifdef MNG_SUPPORT_TRACE
1134 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DISC, MNG_LC_END)
1135#endif
1136
1137 return MNG_NOERROR;
1138}
1139
1140/* ************************************************************************** */
1141
1142mng_retcode MNG_DECL mng_getchunk_back (mng_handle hHandle,
1143 mng_handle hChunk,
1144 mng_uint16 *iRed,
1145 mng_uint16 *iGreen,
1146 mng_uint16 *iBlue,
1147 mng_uint8 *iMandatory,
1148 mng_uint16 *iImageid,
1149 mng_uint8 *iTile)
1150{
1151 mng_datap pData;
1152 mng_backp pChunk;
1153
1154#ifdef MNG_SUPPORT_TRACE
1155 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BACK, MNG_LC_START)
1156#endif
1157
1158 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1159 pData = (mng_datap)hHandle; /* and make it addressable */
1160 pChunk = (mng_backp)hChunk; /* address the chunk */
1161
1162 if (pChunk->sHeader.iChunkname != MNG_UINT_BACK)
1163 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1164
1165 *iRed = pChunk->iRed; /* fill the fields */
1166 *iGreen = pChunk->iGreen;
1167 *iBlue = pChunk->iBlue;
1168 *iMandatory = pChunk->iMandatory;
1169 *iImageid = pChunk->iImageid;
1170 *iTile = pChunk->iTile;
1171
1172#ifdef MNG_SUPPORT_TRACE
1173 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BACK, MNG_LC_END)
1174#endif
1175
1176 return MNG_NOERROR;
1177}
1178
1179/* ************************************************************************** */
1180
1181mng_retcode MNG_DECL mng_getchunk_fram (mng_handle hHandle,
1182 mng_handle hChunk,
1183 mng_bool *bEmpty,
1184 mng_uint8 *iMode,
1185 mng_uint32 *iNamesize,
1186 mng_pchar *zName,
1187 mng_uint8 *iChangedelay,
1188 mng_uint8 *iChangetimeout,
1189 mng_uint8 *iChangeclipping,
1190 mng_uint8 *iChangesyncid,
1191 mng_uint32 *iDelay,
1192 mng_uint32 *iTimeout,
1193 mng_uint8 *iBoundarytype,
1194 mng_int32 *iBoundaryl,
1195 mng_int32 *iBoundaryr,
1196 mng_int32 *iBoundaryt,
1197 mng_int32 *iBoundaryb,
1198 mng_uint32 *iCount,
1199 mng_uint32p *pSyncids)
1200{
1201 mng_datap pData;
1202 mng_framp pChunk;
1203
1204#ifdef MNG_SUPPORT_TRACE
1205 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_FRAM, MNG_LC_START)
1206#endif
1207
1208 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1209 pData = (mng_datap)hHandle; /* and make it addressable */
1210 pChunk = (mng_framp)hChunk; /* address the chunk */
1211
1212 if (pChunk->sHeader.iChunkname != MNG_UINT_FRAM)
1213 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1214
1215 *bEmpty = pChunk->bEmpty; /* fill the fields */
1216 *iMode = pChunk->iMode;
1217 *iNamesize = pChunk->iNamesize;
1218 *zName = pChunk->zName;
1219 *iChangedelay = pChunk->iChangedelay;
1220 *iChangetimeout = pChunk->iChangetimeout;
1221 *iChangeclipping = pChunk->iChangeclipping;
1222 *iChangesyncid = pChunk->iChangesyncid;
1223 *iDelay = pChunk->iDelay;
1224 *iTimeout = pChunk->iTimeout;
1225 *iBoundarytype = pChunk->iBoundarytype;
1226 *iBoundaryl = pChunk->iBoundaryl;
1227 *iBoundaryr = pChunk->iBoundaryr;
1228 *iBoundaryt = pChunk->iBoundaryt;
1229 *iBoundaryb = pChunk->iBoundaryb;
1230 *iCount = pChunk->iCount;
1231 *pSyncids = pChunk->pSyncids;
1232
1233#ifdef MNG_SUPPORT_TRACE
1234 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_FRAM, MNG_LC_END)
1235#endif
1236
1237 return MNG_NOERROR;
1238}
1239
1240/* ************************************************************************** */
1241
1242mng_retcode MNG_DECL mng_getchunk_move (mng_handle hHandle,
1243 mng_handle hChunk,
1244 mng_uint16 *iFirstid,
1245 mng_uint16 *iLastid,
1246 mng_uint8 *iMovetype,
1247 mng_int32 *iMovex,
1248 mng_int32 *iMovey)
1249{
1250 mng_datap pData;
1251 mng_movep pChunk;
1252
1253#ifdef MNG_SUPPORT_TRACE
1254 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MOVE, MNG_LC_START)
1255#endif
1256
1257 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1258 pData = (mng_datap)hHandle; /* and make it addressable */
1259 pChunk = (mng_movep)hChunk; /* address the chunk */
1260
1261 if (pChunk->sHeader.iChunkname != MNG_UINT_MOVE)
1262 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1263
1264 *iFirstid = pChunk->iFirstid; /* fill the fields */
1265 *iLastid = pChunk->iLastid;
1266 *iMovetype = pChunk->iMovetype;
1267 *iMovex = pChunk->iMovex;
1268 *iMovey = pChunk->iMovey;
1269
1270#ifdef MNG_SUPPORT_TRACE
1271 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MOVE, MNG_LC_END)
1272#endif
1273
1274 return MNG_NOERROR;
1275}
1276
1277/* ************************************************************************** */
1278
1279mng_retcode MNG_DECL mng_getchunk_clip (mng_handle hHandle,
1280 mng_handle hChunk,
1281 mng_uint16 *iFirstid,
1282 mng_uint16 *iLastid,
1283 mng_uint8 *iCliptype,
1284 mng_int32 *iClipl,
1285 mng_int32 *iClipr,
1286 mng_int32 *iClipt,
1287 mng_int32 *iClipb)
1288{
1289 mng_datap pData;
1290 mng_clipp pChunk;
1291
1292#ifdef MNG_SUPPORT_TRACE
1293 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CLIP, MNG_LC_START)
1294#endif
1295
1296 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1297 pData = (mng_datap)hHandle; /* and make it addressable */
1298 pChunk = (mng_clipp)hChunk; /* address the chunk */
1299
1300 if (pChunk->sHeader.iChunkname != MNG_UINT_CLIP)
1301 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1302
1303 *iFirstid = pChunk->iFirstid; /* fill the fields */
1304 *iLastid = pChunk->iLastid;
1305 *iCliptype = pChunk->iCliptype;
1306 *iClipl = pChunk->iClipl;
1307 *iClipr = pChunk->iClipr;
1308 *iClipt = pChunk->iClipt;
1309 *iClipb = pChunk->iClipb;
1310
1311#ifdef MNG_SUPPORT_TRACE
1312 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CLIP, MNG_LC_END)
1313#endif
1314
1315 return MNG_NOERROR;
1316}
1317
1318/* ************************************************************************** */
1319
1320mng_retcode MNG_DECL mng_getchunk_show (mng_handle hHandle,
1321 mng_handle hChunk,
1322 mng_bool *bEmpty,
1323 mng_uint16 *iFirstid,
1324 mng_uint16 *iLastid,
1325 mng_uint8 *iMode)
1326{
1327 mng_datap pData;
1328 mng_showp pChunk;
1329
1330#ifdef MNG_SUPPORT_TRACE
1331 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SHOW, MNG_LC_START)
1332#endif
1333
1334 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1335 pData = (mng_datap)hHandle; /* and make it addressable */
1336 pChunk = (mng_showp)hChunk; /* address the chunk */
1337
1338 if (pChunk->sHeader.iChunkname != MNG_UINT_SHOW)
1339 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1340
1341 *bEmpty = pChunk->bEmpty; /* fill the fields */
1342 *iFirstid = pChunk->iFirstid;
1343 *iLastid = pChunk->iLastid;
1344 *iMode = pChunk->iMode;
1345
1346#ifdef MNG_SUPPORT_TRACE
1347 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SHOW, MNG_LC_END)
1348#endif
1349
1350 return MNG_NOERROR;
1351}
1352
1353/* ************************************************************************** */
1354
1355mng_retcode MNG_DECL mng_getchunk_term (mng_handle hHandle,
1356 mng_handle hChunk,
1357 mng_uint8 *iTermaction,
1358 mng_uint8 *iIteraction,
1359 mng_uint32 *iDelay,
1360 mng_uint32 *iItermax)
1361{
1362 mng_datap pData;
1363 mng_termp pChunk;
1364
1365#ifdef MNG_SUPPORT_TRACE
1366 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TERM, MNG_LC_START)
1367#endif
1368
1369 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1370 pData = (mng_datap)hHandle; /* and make it addressable */
1371 pChunk = (mng_termp)hChunk; /* address the chunk */
1372
1373 if (pChunk->sHeader.iChunkname != MNG_UINT_TERM)
1374 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1375
1376 *iTermaction = pChunk->iTermaction; /* fill the fields */
1377 *iIteraction = pChunk->iIteraction;
1378 *iDelay = pChunk->iDelay;
1379 *iItermax = pChunk->iItermax;
1380
1381#ifdef MNG_SUPPORT_TRACE
1382 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TERM, MNG_LC_END)
1383#endif
1384
1385 return MNG_NOERROR;
1386}
1387
1388/* ************************************************************************** */
1389
1390mng_retcode MNG_DECL mng_getchunk_save (mng_handle hHandle,
1391 mng_handle hChunk,
1392 mng_bool *bEmpty,
1393 mng_uint8 *iOffsettype,
1394 mng_uint32 *iCount)
1395{
1396 mng_datap pData;
1397 mng_savep pChunk;
1398
1399#ifdef MNG_SUPPORT_TRACE
1400 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SAVE, MNG_LC_START)
1401#endif
1402
1403 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1404 pData = (mng_datap)hHandle; /* and make it addressable */
1405 pChunk = (mng_savep)hChunk; /* address the chunk */
1406
1407 if (pChunk->sHeader.iChunkname != MNG_UINT_SAVE)
1408 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1409
1410 *bEmpty = pChunk->bEmpty; /* fill the fields */
1411 *iOffsettype = pChunk->iOffsettype;
1412 *iCount = pChunk->iCount;
1413
1414#ifdef MNG_SUPPORT_TRACE
1415 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SAVE, MNG_LC_END)
1416#endif
1417
1418 return MNG_NOERROR;
1419}
1420
1421/* ************************************************************************** */
1422
1423mng_retcode MNG_DECL mng_getchunk_save_entry (mng_handle hHandle,
1424 mng_handle hChunk,
1425 mng_uint32 iEntry,
1426 mng_uint8 *iEntrytype,
1427 mng_uint32arr2 *iOffset,
1428 mng_uint32arr2 *iStarttime,
1429 mng_uint32 *iLayernr,
1430 mng_uint32 *iFramenr,
1431 mng_uint32 *iNamesize,
1432 mng_pchar *zName)
1433{
1434 mng_datap pData;
1435 mng_savep pChunk;
1436 mng_save_entryp pEntry;
1437
1438#ifdef MNG_SUPPORT_TRACE
1439 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SAVE_ENTRY, MNG_LC_START)
1440#endif
1441
1442 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1443 pData = (mng_datap)hHandle; /* and make it addressable */
1444 pChunk = (mng_savep)hChunk; /* address the chunk */
1445
1446 if (pChunk->sHeader.iChunkname != MNG_UINT_SAVE)
1447 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1448
1449 if (iEntry >= pChunk->iCount) /* valid index ? */
1450 MNG_ERROR (pData, MNG_INVALIDENTRYIX)
1451
1452 pEntry = pChunk->pEntries + iEntry; /* address the entry */
1453 /* fill the fields */
1454 *iEntrytype = pEntry->iEntrytype;
1455 (*iOffset)[0] = pEntry->iOffset[0];
1456 (*iOffset)[1] = pEntry->iOffset[1];
1457 (*iStarttime)[0] = pEntry->iStarttime[0];
1458 (*iStarttime)[1] = pEntry->iStarttime[1];
1459 *iLayernr = pEntry->iLayernr;
1460 *iFramenr = pEntry->iFramenr;
1461 *iNamesize = pEntry->iNamesize;
1462 *zName = pEntry->zName;
1463
1464#ifdef MNG_SUPPORT_TRACE
1465 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SAVE_ENTRY, MNG_LC_END)
1466#endif
1467
1468 return MNG_NOERROR;
1469}
1470
1471/* ************************************************************************** */
1472
1473mng_retcode MNG_DECL mng_getchunk_seek (mng_handle hHandle,
1474 mng_handle hChunk,
1475 mng_uint32 *iNamesize,
1476 mng_pchar *zName)
1477{
1478 mng_datap pData;
1479 mng_seekp pChunk;
1480
1481#ifdef MNG_SUPPORT_TRACE
1482 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SEEK, MNG_LC_START)
1483#endif
1484
1485 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1486 pData = (mng_datap)hHandle; /* and make it addressable */
1487 pChunk = (mng_seekp)hChunk; /* address the chunk */
1488
1489 if (pChunk->sHeader.iChunkname != MNG_UINT_SEEK)
1490 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1491
1492 *iNamesize = pChunk->iNamesize; /* fill the fields */
1493 *zName = pChunk->zName;
1494
1495#ifdef MNG_SUPPORT_TRACE
1496 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SEEK, MNG_LC_END)
1497#endif
1498
1499 return MNG_NOERROR;
1500}
1501
1502/* ************************************************************************** */
1503
1504mng_retcode MNG_DECL mng_getchunk_expi (mng_handle hHandle,
1505 mng_handle hChunk,
1506 mng_uint16 *iSnapshotid,
1507 mng_uint32 *iNamesize,
1508 mng_pchar *zName)
1509{
1510 mng_datap pData;
1511 mng_expip pChunk;
1512
1513#ifdef MNG_SUPPORT_TRACE
1514 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EXPI, MNG_LC_START)
1515#endif
1516
1517 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1518 pData = (mng_datap)hHandle; /* and make it addressable */
1519 pChunk = (mng_expip)hChunk; /* address the chunk */
1520
1521 if (pChunk->sHeader.iChunkname != MNG_UINT_eXPI)
1522 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1523
1524 *iSnapshotid = pChunk->iSnapshotid; /* fill the fields */
1525 *iNamesize = pChunk->iNamesize;
1526 *zName = pChunk->zName;
1527
1528#ifdef MNG_SUPPORT_TRACE
1529 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EXPI, MNG_LC_END)
1530#endif
1531
1532 return MNG_NOERROR;
1533}
1534
1535/* ************************************************************************** */
1536
1537mng_retcode MNG_DECL mng_getchunk_fpri (mng_handle hHandle,
1538 mng_handle hChunk,
1539 mng_uint8 *iDeltatype,
1540 mng_uint8 *iPriority)
1541{
1542 mng_datap pData;
1543 mng_fprip pChunk;
1544
1545#ifdef MNG_SUPPORT_TRACE
1546 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_FPRI, MNG_LC_START)
1547#endif
1548
1549 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1550 pData = (mng_datap)hHandle; /* and make it addressable */
1551 pChunk = (mng_fprip)hChunk; /* address the chunk */
1552
1553 if (pChunk->sHeader.iChunkname != MNG_UINT_fPRI)
1554 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1555
1556 *iDeltatype = pChunk->iDeltatype; /* fill the fields */
1557 *iPriority = pChunk->iPriority;
1558
1559#ifdef MNG_SUPPORT_TRACE
1560 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_FPRI, MNG_LC_END)
1561#endif
1562
1563 return MNG_NOERROR;
1564}
1565
1566/* ************************************************************************** */
1567
1568mng_retcode MNG_DECL mng_getchunk_need (mng_handle hHandle,
1569 mng_handle hChunk,
1570 mng_uint32 *iKeywordssize,
1571 mng_pchar *zKeywords)
1572{
1573 mng_datap pData;
1574 mng_needp pChunk;
1575
1576#ifdef MNG_SUPPORT_TRACE
1577 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_NEED, MNG_LC_START)
1578#endif
1579
1580 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1581 pData = (mng_datap)hHandle; /* and make it addressable */
1582 pChunk = (mng_needp)hChunk; /* address the chunk */
1583
1584 if (pChunk->sHeader.iChunkname != MNG_UINT_nEED)
1585 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1586 /* fill the fields */
1587 *iKeywordssize = pChunk->iKeywordssize;
1588 *zKeywords = pChunk->zKeywords;
1589
1590#ifdef MNG_SUPPORT_TRACE
1591 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_NEED, MNG_LC_END)
1592#endif
1593
1594 return MNG_NOERROR;
1595}
1596
1597/* ************************************************************************** */
1598
1599mng_retcode MNG_DECL mng_getchunk_phyg (mng_handle hHandle,
1600 mng_handle hChunk,
1601 mng_bool *bEmpty,
1602 mng_uint32 *iSizex,
1603 mng_uint32 *iSizey,
1604 mng_uint8 *iUnit)
1605{
1606 mng_datap pData;
1607 mng_phygp pChunk;
1608
1609#ifdef MNG_SUPPORT_TRACE
1610 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PHYG, MNG_LC_START)
1611#endif
1612
1613 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1614 pData = (mng_datap)hHandle; /* and make it addressable */
1615 pChunk = (mng_phygp)hChunk; /* address the chunk */
1616
1617 if (pChunk->sHeader.iChunkname != MNG_UINT_pHYg)
1618 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1619
1620 *bEmpty = pChunk->bEmpty; /* fill the fields */
1621 *iSizex = pChunk->iSizex;
1622 *iSizey = pChunk->iSizey;
1623 *iUnit = pChunk->iUnit;
1624
1625#ifdef MNG_SUPPORT_TRACE
1626 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PHYG, MNG_LC_END)
1627#endif
1628
1629 return MNG_NOERROR;
1630}
1631
1632/* ************************************************************************** */
1633/* B004 */
1634#ifdef MNG_INCLUDE_JNG
1635/* B004 */
1636mng_retcode MNG_DECL mng_getchunk_jhdr (mng_handle hHandle,
1637 mng_handle hChunk,
1638 mng_uint32 *iWidth,
1639 mng_uint32 *iHeight,
1640 mng_uint8 *iColortype,
1641 mng_uint8 *iImagesampledepth,
1642 mng_uint8 *iImagecompression,
1643 mng_uint8 *iImageinterlace,
1644 mng_uint8 *iAlphasampledepth,
1645 mng_uint8 *iAlphacompression,
1646 mng_uint8 *iAlphafilter,
1647 mng_uint8 *iAlphainterlace)
1648{
1649 mng_datap pData;
1650 mng_jhdrp pChunk;
1651
1652#ifdef MNG_SUPPORT_TRACE
1653 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JHDR, MNG_LC_START)
1654#endif
1655
1656 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1657 pData = (mng_datap)hHandle; /* and make it addressable */
1658 pChunk = (mng_jhdrp)hChunk; /* address the chunk */
1659
1660 if (pChunk->sHeader.iChunkname != MNG_UINT_JHDR)
1661 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1662
1663 *iWidth = pChunk->iWidth; /* fill the fields */
1664 *iHeight = pChunk->iHeight;
1665 *iColortype = pChunk->iColortype;
1666 *iImagesampledepth = pChunk->iImagesampledepth;
1667 *iImagecompression = pChunk->iImagecompression;
1668 *iImageinterlace = pChunk->iImageinterlace;
1669 *iAlphasampledepth = pChunk->iAlphasampledepth;
1670 *iAlphacompression = pChunk->iAlphacompression;
1671 *iAlphafilter = pChunk->iAlphafilter;
1672 *iAlphainterlace = pChunk->iAlphainterlace;
1673
1674#ifdef MNG_SUPPORT_TRACE
1675 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JHDR, MNG_LC_END)
1676#endif
1677
1678 return MNG_NOERROR;
1679}
1680/* B004 */
1681#endif /* MNG_INCLUDE_JNG */
1682/* B004 */
1683/* ************************************************************************** */
1684/* B004 */
1685#ifdef MNG_INCLUDE_JNG
1686/* B004 */
1687mng_retcode MNG_DECL mng_getchunk_jdat (mng_handle hHandle,
1688 mng_handle hChunk,
1689 mng_uint32 *iRawlen,
1690 mng_ptr *pRawdata)
1691{
1692 mng_datap pData;
1693 mng_jdatp pChunk;
1694
1695#ifdef MNG_SUPPORT_TRACE
1696 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JDAT, MNG_LC_START)
1697#endif
1698
1699 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1700 pData = (mng_datap)hHandle; /* and make it addressable */
1701 pChunk = (mng_jdatp)hChunk; /* address the chunk */
1702
1703 if (pChunk->sHeader.iChunkname != MNG_UINT_JDAT)
1704 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1705
1706 *iRawlen = pChunk->iDatasize; /* fill the fields */
1707 *pRawdata = pChunk->pData;
1708
1709#ifdef MNG_SUPPORT_TRACE
1710 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JDAT, MNG_LC_END)
1711#endif
1712
1713 return MNG_NOERROR;
1714}
1715/* B004 */
1716#endif /* MNG_INCLUDE_JNG */
1717/* B004 */
1718/* ************************************************************************** */
1719
1720mng_retcode MNG_DECL mng_getchunk_dhdr (mng_handle hHandle,
1721 mng_handle hChunk,
1722 mng_uint16 *iObjectid,
1723 mng_uint8 *iImagetype,
1724 mng_uint8 *iDeltatype,
1725 mng_uint32 *iBlockwidth,
1726 mng_uint32 *iBlockheight,
1727 mng_uint32 *iBlockx,
1728 mng_uint32 *iBlocky)
1729{
1730 mng_datap pData;
1731 mng_dhdrp pChunk;
1732
1733#ifdef MNG_SUPPORT_TRACE
1734 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DHDR, MNG_LC_START)
1735#endif
1736
1737 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1738 pData = (mng_datap)hHandle; /* and make it addressable */
1739 pChunk = (mng_dhdrp)hChunk; /* address the chunk */
1740
1741 if (pChunk->sHeader.iChunkname != MNG_UINT_DHDR)
1742 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1743
1744 *iObjectid = pChunk->iObjectid; /* fill the fields */
1745 *iImagetype = pChunk->iImagetype;
1746 *iDeltatype = pChunk->iDeltatype;
1747 *iBlockwidth = pChunk->iBlockwidth;
1748 *iBlockheight = pChunk->iBlockheight;
1749 *iBlockx = pChunk->iBlockx;
1750 *iBlocky = pChunk->iBlocky;
1751
1752#ifdef MNG_SUPPORT_TRACE
1753 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DHDR, MNG_LC_END)
1754#endif
1755
1756 return MNG_NOERROR;
1757}
1758
1759/* ************************************************************************** */
1760
1761mng_retcode MNG_DECL mng_getchunk_prom (mng_handle hHandle,
1762 mng_handle hChunk,
1763 mng_uint8 *iColortype,
1764 mng_uint8 *iSampledepth,
1765 mng_uint8 *iFilltype)
1766{
1767 mng_datap pData;
1768 mng_promp pChunk;
1769
1770#ifdef MNG_SUPPORT_TRACE
1771 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PROM, MNG_LC_START)
1772#endif
1773
1774 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1775 pData = (mng_datap)hHandle; /* and make it addressable */
1776 pChunk = (mng_promp)hChunk; /* address the chunk */
1777
1778 if (pChunk->sHeader.iChunkname != MNG_UINT_PROM)
1779 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1780
1781 *iColortype = pChunk->iColortype; /* fill the fields */
1782 *iSampledepth = pChunk->iSampledepth;
1783 *iFilltype = pChunk->iFilltype;
1784
1785#ifdef MNG_SUPPORT_TRACE
1786 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PROM, MNG_LC_END)
1787#endif
1788
1789 return MNG_NOERROR;
1790}
1791
1792/* ************************************************************************** */
1793
1794mng_retcode MNG_DECL mng_getchunk_pplt (mng_handle hHandle,
1795 mng_handle hChunk,
1796 mng_uint32 *iCount)
1797{
1798 mng_datap pData;
1799 mng_ppltp pChunk;
1800
1801#ifdef MNG_SUPPORT_TRACE
1802 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PPLT, MNG_LC_START)
1803#endif
1804
1805 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1806 pData = (mng_datap)hHandle; /* and make it addressable */
1807 pChunk = (mng_ppltp)hChunk; /* address the chunk */
1808
1809 if (pChunk->sHeader.iChunkname != MNG_UINT_PPLT)
1810 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1811
1812 *iCount = pChunk->iCount; /* fill the field */
1813
1814#ifdef MNG_SUPPORT_TRACE
1815 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PPLT, MNG_LC_END)
1816#endif
1817
1818 return MNG_NOERROR;
1819}
1820
1821/* ************************************************************************** */
1822
1823mng_retcode MNG_DECL mng_getchunk_pplt_entry (mng_handle hHandle,
1824 mng_handle hChunk,
1825 mng_uint32 iEntry,
1826 mng_uint16 *iRed,
1827 mng_uint16 *iGreen,
1828 mng_uint16 *iBlue,
1829 mng_uint16 *iAlpha,
1830 mng_bool *bUsed)
1831{
1832 mng_datap pData;
1833 mng_ppltp pChunk;
1834 mng_pplt_entryp pEntry;
1835
1836#ifdef MNG_SUPPORT_TRACE
1837 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PPLT_ENTRY, MNG_LC_START)
1838#endif
1839
1840 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1841 pData = (mng_datap)hHandle; /* and make it addressable */
1842 pChunk = (mng_ppltp)hChunk; /* address the chunk */
1843
1844 if (pChunk->sHeader.iChunkname != MNG_UINT_PPLT)
1845 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1846
1847 if (iEntry >= pChunk->iCount) /* valid index ? */
1848 MNG_ERROR (pData, MNG_INVALIDENTRYIX)
1849
1850 pEntry = &pChunk->aEntries[iEntry]; /* address the entry */
1851
1852 *iRed = pEntry->iRed; /* fill the fields */
1853 *iGreen = pEntry->iGreen;
1854 *iBlue = pEntry->iBlue;
1855 *iAlpha = pEntry->iAlpha;
1856 *bUsed = pEntry->bUsed;
1857
1858#ifdef MNG_SUPPORT_TRACE
1859 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PPLT_ENTRY, MNG_LC_END)
1860#endif
1861
1862 return MNG_NOERROR;
1863}
1864
1865/* ************************************************************************** */
1866
1867mng_retcode MNG_DECL mng_getchunk_drop (mng_handle hHandle,
1868 mng_handle hChunk,
1869 mng_uint32 *iCount,
1870 mng_chunkidp *pChunknames)
1871{
1872 mng_datap pData;
1873 mng_dropp pChunk;
1874
1875#ifdef MNG_SUPPORT_TRACE
1876 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DROP, MNG_LC_START)
1877#endif
1878
1879 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1880 pData = (mng_datap)hHandle; /* and make it addressable */
1881 pChunk = (mng_dropp)hChunk; /* address the chunk */
1882
1883 if (pChunk->sHeader.iChunkname != MNG_UINT_DROP)
1884 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1885
1886 *iCount = pChunk->iCount; /* fill the fields */
1887 *pChunknames = pChunk->pChunknames;
1888
1889#ifdef MNG_SUPPORT_TRACE
1890 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DROP, MNG_LC_END)
1891#endif
1892
1893 return MNG_NOERROR;
1894}
1895
1896/* ************************************************************************** */
1897
1898mng_retcode MNG_DECL mng_getchunk_dbyk (mng_handle hHandle,
1899 mng_handle hChunk,
1900 mng_chunkid *iChunkname,
1901 mng_uint8 *iPolarity,
1902 mng_uint32 *iKeywordssize,
1903 mng_pchar *zKeywords)
1904{
1905 mng_datap pData;
1906 mng_dbykp pChunk;
1907
1908#ifdef MNG_SUPPORT_TRACE
1909 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DBYK, MNG_LC_START)
1910#endif
1911
1912 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1913 pData = (mng_datap)hHandle; /* and make it addressable */
1914 pChunk = (mng_dbykp)hChunk; /* address the chunk */
1915
1916 if (pChunk->sHeader.iChunkname != MNG_UINT_DBYK)
1917 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1918
1919 *iChunkname = pChunk->iChunkname; /* fill the fields */
1920 *iPolarity = pChunk->iPolarity;
1921 *iKeywordssize = pChunk->iKeywordssize;
1922 *zKeywords = pChunk->zKeywords;
1923
1924#ifdef MNG_SUPPORT_TRACE
1925 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DBYK, MNG_LC_END)
1926#endif
1927
1928 return MNG_NOERROR;
1929}
1930
1931/* ************************************************************************** */
1932
1933mng_retcode MNG_DECL mng_getchunk_ordr (mng_handle hHandle,
1934 mng_handle hChunk,
1935 mng_uint32 *iCount)
1936{
1937 mng_datap pData;
1938 mng_ordrp pChunk;
1939
1940#ifdef MNG_SUPPORT_TRACE
1941 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ORDR, MNG_LC_START)
1942#endif
1943
1944 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1945 pData = (mng_datap)hHandle; /* and make it addressable */
1946 pChunk = (mng_ordrp)hChunk; /* address the chunk */
1947
1948 if (pChunk->sHeader.iChunkname != MNG_UINT_ORDR)
1949 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1950
1951 *iCount = pChunk->iCount; /* fill the field */
1952
1953#ifdef MNG_SUPPORT_TRACE
1954 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ORDR, MNG_LC_END)
1955#endif
1956
1957 return MNG_NOERROR;
1958}
1959
1960/* ************************************************************************** */
1961
1962mng_retcode MNG_DECL mng_getchunk_ordr_entry (mng_handle hHandle,
1963 mng_handle hChunk,
1964 mng_uint32 iEntry,
1965 mng_chunkid *iChunkname,
1966 mng_uint8 *iOrdertype)
1967{
1968 mng_datap pData;
1969 mng_ordrp pChunk;
1970 mng_ordr_entryp pEntry;
1971
1972#ifdef MNG_SUPPORT_TRACE
1973 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ORDR_ENTRY, MNG_LC_START)
1974#endif
1975
1976 MNG_VALIDHANDLE (hHandle) /* check validity handle */
1977 pData = (mng_datap)hHandle; /* and make it addressable */
1978 pChunk = (mng_ordrp)hChunk; /* address the chunk */
1979
1980 if (pChunk->sHeader.iChunkname != MNG_UINT_ORDR)
1981 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
1982
1983 if (iEntry >= pChunk->iCount) /* valid index ? */
1984 MNG_ERROR (pData, MNG_INVALIDENTRYIX)
1985
1986 pEntry = pChunk->pEntries + iEntry; /* address the proper entry */
1987
1988 *iChunkname = pEntry->iChunkname; /* fill the fields */
1989 *iOrdertype = pEntry->iOrdertype;
1990
1991#ifdef MNG_SUPPORT_TRACE
1992 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ORDR_ENTRY, MNG_LC_END)
1993#endif
1994
1995 return MNG_NOERROR;
1996}
1997
1998/* ************************************************************************** */
1999
2000mng_retcode MNG_DECL mng_getchunk_magn (mng_handle hHandle,
2001 mng_handle hChunk,
2002 mng_uint16 *iFirstid,
2003 mng_uint16 *iLastid,
2004 mng_uint16 *iMethodX,
2005 mng_uint16 *iMX,
2006 mng_uint16 *iMY,
2007 mng_uint16 *iML,
2008 mng_uint16 *iMR,
2009 mng_uint16 *iMT,
2010 mng_uint16 *iMB,
2011 mng_uint16 *iMethodY)
2012{
2013 mng_datap pData;
2014 mng_magnp pChunk;
2015
2016#ifdef MNG_SUPPORT_TRACE
2017 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MAGN, MNG_LC_START)
2018#endif
2019
2020 MNG_VALIDHANDLE (hHandle) /* check validity handle */
2021 pData = (mng_datap)hHandle; /* and make it addressable */
2022 pChunk = (mng_magnp)hChunk; /* address the chunk */
2023
2024 if (pChunk->sHeader.iChunkname != MNG_UINT_MAGN)
2025 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
2026
2027 *iFirstid = pChunk->iFirstid; /* fill the fields */
2028 *iLastid = pChunk->iLastid;
2029 *iMethodX = pChunk->iMethodX;
2030 *iMX = pChunk->iMX;
2031 *iMY = pChunk->iMY;
2032 *iML = pChunk->iML;
2033 *iMR = pChunk->iMR;
2034 *iMT = pChunk->iMT;
2035 *iMB = pChunk->iMB;
2036 *iMethodY = pChunk->iMethodY;
2037
2038#ifdef MNG_SUPPORT_TRACE
2039 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MAGN, MNG_LC_END)
2040#endif
2041
2042 return MNG_NOERROR;
2043}
2044
2045/* ************************************************************************** */
2046
2047mng_retcode MNG_DECL mng_getchunk_unknown (mng_handle hHandle,
2048 mng_handle hChunk,
2049 mng_chunkid *iChunkname,
2050 mng_uint32 *iRawlen,
2051 mng_ptr *pRawdata)
2052{
2053 mng_datap pData;
2054 mng_unknown_chunkp pChunk;
2055
2056#ifdef MNG_SUPPORT_TRACE
2057 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_UNKNOWN, MNG_LC_START)
2058#endif
2059
2060 MNG_VALIDHANDLE (hHandle) /* check validity handle */
2061 pData = (mng_datap)hHandle; /* and make it addressable */
2062 pChunk = (mng_unknown_chunkp)hChunk; /* address the chunk */
2063
2064 if (pChunk->sHeader.fCreate != init_unknown)
2065 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
2066 /* fill the fields */
2067 *iChunkname = pChunk->sHeader.iChunkname;
2068 *iRawlen = pChunk->iDatasize;
2069 *pRawdata = pChunk->pData;
2070
2071#ifdef MNG_SUPPORT_TRACE
2072 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_UNKNOWN, MNG_LC_END)
2073#endif
2074
2075 return MNG_NOERROR;
2076}
2077
2078/* ************************************************************************** */
2079/* ************************************************************************** */
2080/* B004 */
2081#ifdef MNG_INCLUDE_WRITE_PROCS
2082/* B004 */
2083/* ************************************************************************** */
2084
2085mng_retcode MNG_DECL mng_putchunk_ihdr (mng_handle hHandle,
2086 mng_uint32 iWidth,
2087 mng_uint32 iHeight,
2088 mng_uint8 iBitdepth,
2089 mng_uint8 iColortype,
2090 mng_uint8 iCompression,
2091 mng_uint8 iFilter,
2092 mng_uint8 iInterlace)
2093{
2094 mng_datap pData;
2095 mng_chunkp pChunk;
2096 mng_retcode iRetcode;
2097 mng_chunk_header sChunkheader =
2098 {MNG_UINT_IHDR, init_ihdr, free_ihdr, read_ihdr, write_ihdr, 0, 0};
2099
2100#ifdef MNG_SUPPORT_TRACE
2101 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IHDR, MNG_LC_START)
2102#endif
2103
2104 MNG_VALIDHANDLE (hHandle) /* check validity handle */
2105 pData = (mng_datap)hHandle; /* and make it addressable */
2106
2107 if (!pData->bCreating) /* aren't we creating a new file ? */
2108 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
2109 /* create the chunk */
2110 iRetcode = init_ihdr (pData, &sChunkheader, &pChunk);
2111
2112 if (iRetcode) /* on error bail out */
2113 return iRetcode;
2114 /* fill the chunk */
2115 ((mng_ihdrp)pChunk)->iWidth = iWidth;
2116 ((mng_ihdrp)pChunk)->iHeight = iHeight;
2117 ((mng_ihdrp)pChunk)->iBitdepth = iBitdepth;
2118 ((mng_ihdrp)pChunk)->iColortype = iColortype;
2119 ((mng_ihdrp)pChunk)->iCompression = iCompression;
2120 ((mng_ihdrp)pChunk)->iFilter = iFilter;
2121 ((mng_ihdrp)pChunk)->iInterlace = iInterlace;
2122
2123 add_chunk (pData, pChunk); /* add it to the list */
2124
2125#ifdef MNG_SUPPORT_TRACE
2126 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IHDR, MNG_LC_END)
2127#endif
2128
2129 return MNG_NOERROR;
2130}
2131
2132/* ************************************************************************** */
2133
2134mng_retcode MNG_DECL mng_putchunk_plte (mng_handle hHandle,
2135 mng_uint32 iCount,
2136 mng_palette8 aPalette)
2137{
2138 mng_datap pData;
2139 mng_chunkp pChunk;
2140 mng_retcode iRetcode;
2141 mng_chunk_header sChunkheader =
2142 {MNG_UINT_PLTE, init_plte, free_plte, read_plte, write_plte, 0, 0};
2143
2144#ifdef MNG_SUPPORT_TRACE
2145 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PLTE, MNG_LC_START)
2146#endif
2147
2148 MNG_VALIDHANDLE (hHandle) /* check validity handle */
2149 pData = (mng_datap)hHandle; /* and make it addressable */
2150
2151 if (!pData->bCreating) /* aren't we creating a new file ? */
2152 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
2153 /* must have had a header first! */
2154 if (pData->iFirstchunkadded == 0)
2155 MNG_ERROR (pData, MNG_NOHEADER)
2156 /* create the chunk */
2157 iRetcode = init_plte (pData, &sChunkheader, &pChunk);
2158
2159 if (iRetcode) /* on error bail out */
2160 return iRetcode;
2161 /* fill the chunk */
2162 ((mng_pltep)pChunk)->iEntrycount = iCount;
2163 ((mng_pltep)pChunk)->bEmpty = (mng_bool)(iCount == 0);
2164
2165 MNG_COPY (((mng_pltep)pChunk)->aEntries, aPalette, sizeof (mng_palette8))
2166
2167 add_chunk (pData, pChunk); /* add it to the list */
2168
2169#ifdef MNG_SUPPORT_TRACE
2170 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PLTE, MNG_LC_END)
2171#endif
2172
2173 return MNG_NOERROR;
2174}
2175
2176/* ************************************************************************** */
2177
2178mng_retcode MNG_DECL mng_putchunk_idat (mng_handle hHandle,
2179 mng_uint32 iRawlen,
2180 mng_ptr pRawdata)
2181{
2182 mng_datap pData;
2183 mng_chunkp pChunk;
2184 mng_retcode iRetcode;
2185 mng_chunk_header sChunkheader =
2186 {MNG_UINT_IDAT, init_idat, free_idat, read_idat, write_idat, 0, 0};
2187
2188#ifdef MNG_SUPPORT_TRACE
2189 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IDAT, MNG_LC_START)
2190#endif
2191
2192 MNG_VALIDHANDLE (hHandle) /* check validity handle */
2193 pData = (mng_datap)hHandle; /* and make it addressable */
2194
2195 if (!pData->bCreating) /* aren't we creating a new file ? */
2196 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
2197 /* must have had a header first! */
2198 if (pData->iFirstchunkadded == 0)
2199 MNG_ERROR (pData, MNG_NOHEADER)
2200 /* create the chunk */
2201 iRetcode = init_idat (pData, &sChunkheader, &pChunk);
2202
2203 if (iRetcode) /* on error bail out */
2204 return iRetcode;
2205 /* fill the chunk */
2206 ((mng_idatp)pChunk)->bEmpty = (mng_bool)(iRawlen == 0);
2207 ((mng_idatp)pChunk)->iDatasize = iRawlen;
2208
2209 if (iRawlen)
2210 {
2211 MNG_ALLOC (pData, ((mng_idatp)pChunk)->pData, iRawlen)
2212 MNG_COPY (((mng_idatp)pChunk)->pData, pRawdata, iRawlen)
2213 }
2214
2215 add_chunk (pData, pChunk); /* add it to the list */
2216
2217#ifdef MNG_SUPPORT_TRACE
2218 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IDAT, MNG_LC_END)
2219#endif
2220
2221 return MNG_NOERROR;
2222}
2223
2224/* ************************************************************************** */
2225
2226mng_retcode MNG_DECL mng_putchunk_iend (mng_handle hHandle)
2227{
2228 mng_datap pData;
2229 mng_chunkp pChunk;
2230 mng_retcode iRetcode;
2231 mng_chunk_header sChunkheader =
2232 {MNG_UINT_IEND, init_iend, free_iend, read_iend, write_iend, 0, 0};
2233
2234#ifdef MNG_SUPPORT_TRACE
2235 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IEND, MNG_LC_START)
2236#endif
2237
2238 MNG_VALIDHANDLE (hHandle) /* check validity handle */
2239 pData = (mng_datap)hHandle; /* and make it addressable */
2240
2241 if (!pData->bCreating) /* aren't we creating a new file ? */
2242 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
2243 /* must have had a header first! */
2244 if (pData->iFirstchunkadded == 0)
2245 MNG_ERROR (pData, MNG_NOHEADER)
2246 /* create the chunk */
2247 iRetcode = init_iend (pData, &sChunkheader, &pChunk);
2248
2249 if (iRetcode) /* on error bail out */
2250 return iRetcode;
2251
2252 add_chunk (pData, pChunk); /* add it to the list */
2253
2254#ifdef MNG_INCLUDE_JNG
2255 if ((pData->iFirstchunkadded == MNG_UINT_IHDR) ||
2256 (pData->iFirstchunkadded == MNG_UINT_JHDR) )
2257#else
2258 if (pData->iFirstchunkadded == MNG_UINT_IHDR)
2259#endif
2260 pData->bCreating = MNG_FALSE; /* should be last chunk !!! */
2261
2262#ifdef MNG_SUPPORT_TRACE
2263 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IEND, MNG_LC_END)
2264#endif
2265
2266 return MNG_NOERROR;
2267}
2268
2269/* ************************************************************************** */
2270
2271mng_retcode MNG_DECL mng_putchunk_trns (mng_handle hHandle,
2272 mng_bool bEmpty,
2273 mng_bool bGlobal,
2274 mng_uint8 iType,
2275 mng_uint32 iCount,
2276 mng_uint8arr aAlphas,
2277 mng_uint16 iGray,
2278 mng_uint16 iRed,
2279 mng_uint16 iGreen,
2280 mng_uint16 iBlue,
2281 mng_uint32 iRawlen,
2282 mng_uint8arr aRawdata)
2283{
2284 mng_datap pData;
2285 mng_chunkp pChunk;
2286 mng_retcode iRetcode;
2287 mng_chunk_header sChunkheader =
2288 {MNG_UINT_tRNS, init_trns, free_trns, read_trns, write_trns, 0, 0};
2289
2290#ifdef MNG_SUPPORT_TRACE
2291 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TRNS, MNG_LC_START)
2292#endif
2293
2294 MNG_VALIDHANDLE (hHandle) /* check validity handle */
2295 pData = (mng_datap)hHandle; /* and make it addressable */
2296
2297 if (!pData->bCreating) /* aren't we creating a new file ? */
2298 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
2299 /* must have had a header first! */
2300 if (pData->iFirstchunkadded == 0)
2301 MNG_ERROR (pData, MNG_NOHEADER)
2302 /* create the chunk */
2303 iRetcode = init_trns (pData, &sChunkheader, &pChunk);
2304
2305 if (iRetcode) /* on error bail out */
2306 return iRetcode;
2307 /* fill the chunk */
2308 ((mng_trnsp)pChunk)->bEmpty = bEmpty;
2309 ((mng_trnsp)pChunk)->bGlobal = bGlobal;
2310 ((mng_trnsp)pChunk)->iType = iType;
2311 ((mng_trnsp)pChunk)->iCount = iCount;
2312 ((mng_trnsp)pChunk)->iGray = iGray;
2313 ((mng_trnsp)pChunk)->iRed = iRed;
2314 ((mng_trnsp)pChunk)->iGreen = iGreen;
2315 ((mng_trnsp)pChunk)->iBlue = iBlue;
2316 ((mng_trnsp)pChunk)->iRawlen = iRawlen;
2317
2318 MNG_COPY (((mng_trnsp)pChunk)->aEntries, aAlphas, sizeof (mng_uint8arr))
2319 MNG_COPY (((mng_trnsp)pChunk)->aRawdata, aRawdata, sizeof (mng_uint8arr))
2320
2321 add_chunk (pData, pChunk); /* add it to the list */
2322
2323#ifdef MNG_SUPPORT_TRACE
2324 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TRNS, MNG_LC_END)
2325#endif
2326
2327 return MNG_NOERROR;
2328}
2329
2330/* ************************************************************************** */
2331
2332mng_retcode MNG_DECL mng_putchunk_gama (mng_handle hHandle,
2333 mng_bool bEmpty,
2334 mng_uint32 iGamma)
2335{
2336 mng_datap pData;
2337 mng_chunkp pChunk;
2338 mng_retcode iRetcode;
2339 mng_chunk_header sChunkheader =
2340 {MNG_UINT_gAMA, init_gama, free_gama, read_gama, write_gama, 0, 0};
2341
2342#ifdef MNG_SUPPORT_TRACE
2343 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_GAMA, MNG_LC_START)
2344#endif
2345
2346 MNG_VALIDHANDLE (hHandle) /* check validity handle */
2347 pData = (mng_datap)hHandle; /* and make it addressable */
2348
2349 if (!pData->bCreating) /* aren't we creating a new file ? */
2350 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
2351 /* must have had a header first! */
2352 if (pData->iFirstchunkadded == 0)
2353 MNG_ERROR (pData, MNG_NOHEADER)
2354 /* create the chunk */
2355 iRetcode = init_gama (pData, &sChunkheader, &pChunk);
2356
2357 if (iRetcode) /* on error bail out */
2358 return iRetcode;
2359 /* fill the chunk */
2360 ((mng_gamap)pChunk)->bEmpty = bEmpty;
2361 ((mng_gamap)pChunk)->iGamma = iGamma;
2362
2363 add_chunk (pData, pChunk); /* add it to the list */
2364
2365#ifdef MNG_SUPPORT_TRACE
2366 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_GAMA, MNG_LC_END)
2367#endif
2368
2369 return MNG_NOERROR;
2370}
2371
2372/* ************************************************************************** */
2373
2374mng_retcode MNG_DECL mng_putchunk_chrm (mng_handle hHandle,
2375 mng_bool bEmpty,
2376 mng_uint32 iWhitepointx,
2377 mng_uint32 iWhitepointy,
2378 mng_uint32 iRedx,
2379 mng_uint32 iRedy,
2380 mng_uint32 iGreenx,
2381 mng_uint32 iGreeny,
2382 mng_uint32 iBluex,
2383 mng_uint32 iBluey)
2384{
2385 mng_datap pData;
2386 mng_chunkp pChunk;
2387 mng_retcode iRetcode;
2388 mng_chunk_header sChunkheader =
2389 {MNG_UINT_cHRM, init_chrm, free_chrm, read_chrm, write_chrm, 0, 0};
2390
2391#ifdef MNG_SUPPORT_TRACE
2392 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CHRM, MNG_LC_START)
2393#endif
2394
2395 MNG_VALIDHANDLE (hHandle) /* check validity handle */
2396 pData = (mng_datap)hHandle; /* and make it addressable */
2397
2398 if (!pData->bCreating) /* aren't we creating a new file ? */
2399 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
2400 /* must have had a header first! */
2401 if (pData->iFirstchunkadded == 0)
2402 MNG_ERROR (pData, MNG_NOHEADER)
2403 /* create the chunk */
2404 iRetcode = init_chrm (pData, &sChunkheader, &pChunk);
2405
2406 if (iRetcode) /* on error bail out */
2407 return iRetcode;
2408 /* fill the chunk */
2409 ((mng_chrmp)pChunk)->bEmpty = bEmpty;
2410 ((mng_chrmp)pChunk)->iWhitepointx = iWhitepointx;
2411 ((mng_chrmp)pChunk)->iWhitepointy = iWhitepointy;
2412 ((mng_chrmp)pChunk)->iRedx = iRedx;
2413 ((mng_chrmp)pChunk)->iRedy = iRedy;
2414 ((mng_chrmp)pChunk)->iGreenx = iGreenx;
2415 ((mng_chrmp)pChunk)->iGreeny = iGreeny;
2416 ((mng_chrmp)pChunk)->iBluex = iBluex;
2417 ((mng_chrmp)pChunk)->iBluey = iBluey;
2418
2419 add_chunk (pData, pChunk); /* add it to the list */
2420
2421#ifdef MNG_SUPPORT_TRACE
2422 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CHRM, MNG_LC_END)
2423#endif
2424
2425 return MNG_NOERROR;
2426}
2427
2428/* ************************************************************************** */
2429
2430mng_retcode MNG_DECL mng_putchunk_srgb (mng_handle hHandle,
2431 mng_bool bEmpty,
2432 mng_uint8 iRenderingintent)
2433{
2434 mng_datap pData;
2435 mng_chunkp pChunk;
2436 mng_retcode iRetcode;
2437 mng_chunk_header sChunkheader =
2438 {MNG_UINT_sRGB, init_srgb, free_srgb, read_srgb, write_srgb, 0, 0};
2439
2440#ifdef MNG_SUPPORT_TRACE
2441 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SRGB, MNG_LC_START)
2442#endif
2443
2444 MNG_VALIDHANDLE (hHandle) /* check validity handle */
2445 pData = (mng_datap)hHandle; /* and make it addressable */
2446
2447 if (!pData->bCreating) /* aren't we creating a new file ? */
2448 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
2449 /* must have had a header first! */
2450 if (pData->iFirstchunkadded == 0)
2451 MNG_ERROR (pData, MNG_NOHEADER)
2452 /* create the chunk */
2453 iRetcode = init_srgb (pData, &sChunkheader, &pChunk);
2454
2455 if (iRetcode) /* on error bail out */
2456 return iRetcode;
2457 /* fill the chunk */
2458 ((mng_srgbp)pChunk)->bEmpty = bEmpty;
2459 ((mng_srgbp)pChunk)->iRenderingintent = iRenderingintent;
2460
2461 add_chunk (pData, pChunk); /* add it to the list */
2462
2463#ifdef MNG_SUPPORT_TRACE
2464 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SRGB, MNG_LC_END)
2465#endif
2466
2467 return MNG_NOERROR;
2468}
2469
2470/* ************************************************************************** */
2471
2472mng_retcode MNG_DECL mng_putchunk_iccp (mng_handle hHandle,
2473 mng_bool bEmpty,
2474 mng_uint32 iNamesize,
2475 mng_pchar zName,
2476 mng_uint8 iCompression,
2477 mng_uint32 iProfilesize,
2478 mng_ptr pProfile)
2479{
2480 mng_datap pData;
2481 mng_chunkp pChunk;
2482 mng_retcode iRetcode;
2483 mng_chunk_header sChunkheader =
2484 {MNG_UINT_iCCP, init_iccp, free_iccp, read_iccp, write_iccp, 0, 0};
2485
2486#ifdef MNG_SUPPORT_TRACE
2487 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ICCP, MNG_LC_START)
2488#endif
2489
2490 MNG_VALIDHANDLE (hHandle) /* check validity handle */
2491 pData = (mng_datap)hHandle; /* and make it addressable */
2492
2493 if (!pData->bCreating) /* aren't we creating a new file ? */
2494 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
2495 /* must have had a header first! */
2496 if (pData->iFirstchunkadded == 0)
2497 MNG_ERROR (pData, MNG_NOHEADER)
2498 /* create the chunk */
2499 iRetcode = init_iccp (pData, &sChunkheader, &pChunk);
2500
2501 if (iRetcode) /* on error bail out */
2502 return iRetcode;
2503 /* fill the chunk */
2504 ((mng_iccpp)pChunk)->bEmpty = bEmpty;
2505 ((mng_iccpp)pChunk)->iNamesize = iNamesize;
2506 ((mng_iccpp)pChunk)->iCompression = iCompression;
2507 ((mng_iccpp)pChunk)->iProfilesize = iProfilesize;
2508
2509 if (iNamesize)
2510 {
2511 MNG_ALLOC (pData, ((mng_iccpp)pChunk)->zName, iNamesize + 1)
2512 MNG_COPY (((mng_iccpp)pChunk)->zName, zName, iNamesize)
2513 }
2514
2515 if (iProfilesize)
2516 {
2517 MNG_ALLOC (pData, ((mng_iccpp)pChunk)->pProfile, iProfilesize)
2518 MNG_COPY (((mng_iccpp)pChunk)->pProfile, pProfile, iProfilesize)
2519 }
2520
2521 add_chunk (pData, pChunk); /* add it to the list */
2522
2523#ifdef MNG_SUPPORT_TRACE
2524 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ICCP, MNG_LC_END)
2525#endif
2526
2527 return MNG_NOERROR;
2528}
2529
2530/* ************************************************************************** */
2531
2532mng_retcode MNG_DECL mng_putchunk_text (mng_handle hHandle,
2533 mng_uint32 iKeywordsize,
2534 mng_pchar zKeyword,
2535 mng_uint32 iTextsize,
2536 mng_pchar zText)
2537{
2538 mng_datap pData;
2539 mng_chunkp pChunk;
2540 mng_retcode iRetcode;
2541 mng_chunk_header sChunkheader =
2542 {MNG_UINT_tEXt, init_text, free_text, read_text, write_text, 0, 0};
2543
2544#ifdef MNG_SUPPORT_TRACE
2545 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TEXT, MNG_LC_START)
2546#endif
2547
2548 MNG_VALIDHANDLE (hHandle) /* check validity handle */
2549 pData = (mng_datap)hHandle; /* and make it addressable */
2550
2551 if (!pData->bCreating) /* aren't we creating a new file ? */
2552 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
2553 /* must have had a header first! */
2554 if (pData->iFirstchunkadded == 0)
2555 MNG_ERROR (pData, MNG_NOHEADER)
2556 /* create the chunk */
2557 iRetcode = init_text (pData, &sChunkheader, &pChunk);
2558
2559 if (iRetcode) /* on error bail out */
2560 return iRetcode;
2561 /* fill the chunk */
2562 ((mng_textp)pChunk)->iKeywordsize = iKeywordsize;
2563 ((mng_textp)pChunk)->iTextsize = iTextsize;
2564
2565 if (iKeywordsize)
2566 {
2567 MNG_ALLOC (pData, ((mng_textp)pChunk)->zKeyword, iKeywordsize + 1)
2568 MNG_COPY (((mng_textp)pChunk)->zKeyword, zKeyword, iKeywordsize)
2569 }
2570
2571 if (iTextsize)
2572 {
2573 MNG_ALLOC (pData, ((mng_textp)pChunk)->zText, iTextsize + 1)
2574 MNG_COPY (((mng_textp)pChunk)->zText, zText, iTextsize)
2575 }
2576
2577 add_chunk (pData, pChunk); /* add it to the list */
2578
2579#ifdef MNG_SUPPORT_TRACE
2580 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TEXT, MNG_LC_END)
2581#endif
2582
2583 return MNG_NOERROR;
2584}
2585
2586/* ************************************************************************** */
2587
2588mng_retcode MNG_DECL mng_putchunk_ztxt (mng_handle hHandle,
2589 mng_uint32 iKeywordsize,
2590 mng_pchar zKeyword,
2591 mng_uint8 iCompression,
2592 mng_uint32 iTextsize,
2593 mng_pchar zText)
2594{
2595 mng_datap pData;
2596 mng_chunkp pChunk;
2597 mng_retcode iRetcode;
2598 mng_chunk_header sChunkheader =
2599 {MNG_UINT_zTXt, init_ztxt, free_ztxt, read_ztxt, write_ztxt, 0, 0};
2600
2601#ifdef MNG_SUPPORT_TRACE
2602 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ZTXT, MNG_LC_START)
2603#endif
2604
2605 MNG_VALIDHANDLE (hHandle) /* check validity handle */
2606 pData = (mng_datap)hHandle; /* and make it addressable */
2607
2608 if (!pData->bCreating) /* aren't we creating a new file ? */
2609 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
2610 /* must have had a header first! */
2611 if (pData->iFirstchunkadded == 0)
2612 MNG_ERROR (pData, MNG_NOHEADER)
2613 /* create the chunk */
2614 iRetcode = init_ztxt (pData, &sChunkheader, &pChunk);
2615
2616 if (iRetcode) /* on error bail out */
2617 return iRetcode;
2618 /* fill the chunk */
2619 ((mng_ztxtp)pChunk)->iKeywordsize = iKeywordsize;
2620 ((mng_ztxtp)pChunk)->iCompression = iCompression;
2621 ((mng_ztxtp)pChunk)->iTextsize = iTextsize;
2622
2623 if (iKeywordsize)
2624 {
2625 MNG_ALLOC (pData, ((mng_ztxtp)pChunk)->zKeyword, iKeywordsize + 1)
2626 MNG_COPY (((mng_ztxtp)pChunk)->zKeyword, zKeyword, iKeywordsize)
2627 }
2628
2629 if (iTextsize)
2630 {
2631 MNG_ALLOC (pData, ((mng_ztxtp)pChunk)->zText, iTextsize + 1)
2632 MNG_COPY (((mng_ztxtp)pChunk)->zText, zText, iTextsize)
2633 }
2634
2635 add_chunk (pData, pChunk); /* add it to the list */
2636
2637#ifdef MNG_SUPPORT_TRACE
2638 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ZTXT, MNG_LC_END)
2639#endif
2640
2641 return MNG_NOERROR;
2642}
2643
2644/* ************************************************************************** */
2645
2646mng_retcode MNG_DECL mng_putchunk_itxt (mng_handle hHandle,
2647 mng_uint32 iKeywordsize,
2648 mng_pchar zKeyword,
2649 mng_uint8 iCompressionflag,
2650 mng_uint8 iCompressionmethod,
2651 mng_uint32 iLanguagesize,
2652 mng_pchar zLanguage,
2653 mng_uint32 iTranslationsize,
2654 mng_pchar zTranslation,
2655 mng_uint32 iTextsize,
2656 mng_pchar zText)
2657{
2658 mng_datap pData;
2659 mng_chunkp pChunk;
2660 mng_retcode iRetcode;
2661 mng_chunk_header sChunkheader =
2662 {MNG_UINT_iTXt, init_itxt, free_itxt, read_itxt, write_itxt, 0, 0};
2663
2664#ifdef MNG_SUPPORT_TRACE
2665 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ITXT, MNG_LC_START)
2666#endif
2667
2668 MNG_VALIDHANDLE (hHandle) /* check validity handle */
2669 pData = (mng_datap)hHandle; /* and make it addressable */
2670
2671 if (!pData->bCreating) /* aren't we creating a new file ? */
2672 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
2673 /* must have had a header first! */
2674 if (pData->iFirstchunkadded == 0)
2675 MNG_ERROR (pData, MNG_NOHEADER)
2676 /* create the chunk */
2677 iRetcode = init_itxt (pData, &sChunkheader, &pChunk);
2678
2679 if (iRetcode) /* on error bail out */
2680 return iRetcode;
2681 /* fill the chunk */
2682 ((mng_itxtp)pChunk)->iKeywordsize = iKeywordsize;
2683 ((mng_itxtp)pChunk)->iCompressionflag = iCompressionflag;
2684 ((mng_itxtp)pChunk)->iCompressionmethod = iCompressionmethod;
2685 ((mng_itxtp)pChunk)->iLanguagesize = iLanguagesize;
2686 ((mng_itxtp)pChunk)->iTranslationsize = iTranslationsize;
2687 ((mng_itxtp)pChunk)->iTextsize = iTextsize;
2688
2689 if (iKeywordsize)
2690 {
2691 MNG_ALLOC (pData, ((mng_itxtp)pChunk)->zKeyword, iKeywordsize + 1)
2692 MNG_COPY (((mng_itxtp)pChunk)->zKeyword, zKeyword, iKeywordsize)
2693 }
2694
2695 if (iLanguagesize)
2696 {
2697 MNG_ALLOC (pData, ((mng_itxtp)pChunk)->zLanguage, iLanguagesize + 1)
2698 MNG_COPY (((mng_itxtp)pChunk)->zLanguage, zLanguage, iLanguagesize)
2699 }
2700
2701 if (iTranslationsize)
2702 {
2703 MNG_ALLOC (pData, ((mng_itxtp)pChunk)->zTranslation, iTranslationsize + 1)
2704 MNG_COPY (((mng_itxtp)pChunk)->zTranslation, zTranslation, iTranslationsize)
2705 }
2706
2707 if (iTextsize)
2708 {
2709 MNG_ALLOC (pData, ((mng_itxtp)pChunk)->zText, iTextsize + 1)
2710 MNG_COPY (((mng_itxtp)pChunk)->zText, zText, iTextsize)
2711 }
2712
2713 add_chunk (pData, pChunk); /* add it to the list */
2714
2715#ifdef MNG_SUPPORT_TRACE
2716 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ITXT, MNG_LC_END)
2717#endif
2718
2719 return MNG_NOERROR;
2720}
2721
2722/* ************************************************************************** */
2723
2724mng_retcode MNG_DECL mng_putchunk_bkgd (mng_handle hHandle,
2725 mng_bool bEmpty,
2726 mng_uint8 iType,
2727 mng_uint8 iIndex,
2728 mng_uint16 iGray,
2729 mng_uint16 iRed,
2730 mng_uint16 iGreen,
2731 mng_uint16 iBlue)
2732{
2733 mng_datap pData;
2734 mng_chunkp pChunk;
2735 mng_retcode iRetcode;
2736 mng_chunk_header sChunkheader =
2737 {MNG_UINT_bKGD, init_bkgd, free_bkgd, read_bkgd, write_bkgd, 0, 0};
2738
2739#ifdef MNG_SUPPORT_TRACE
2740 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BKGD, MNG_LC_START)
2741#endif
2742
2743 MNG_VALIDHANDLE (hHandle) /* check validity handle */
2744 pData = (mng_datap)hHandle; /* and make it addressable */
2745
2746 if (!pData->bCreating) /* aren't we creating a new file ? */
2747 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
2748 /* must have had a header first! */
2749 if (pData->iFirstchunkadded == 0)
2750 MNG_ERROR (pData, MNG_NOHEADER)
2751 /* create the chunk */
2752 iRetcode = init_bkgd (pData, &sChunkheader, &pChunk);
2753
2754 if (iRetcode) /* on error bail out */
2755 return iRetcode;
2756 /* fill the chunk */
2757 ((mng_bkgdp)pChunk)->bEmpty = bEmpty;
2758 ((mng_bkgdp)pChunk)->iType = iType;
2759 ((mng_bkgdp)pChunk)->iIndex = iIndex;
2760 ((mng_bkgdp)pChunk)->iGray = iGray;
2761 ((mng_bkgdp)pChunk)->iRed = iRed;
2762 ((mng_bkgdp)pChunk)->iGreen = iGreen;
2763 ((mng_bkgdp)pChunk)->iBlue = iBlue;
2764
2765 add_chunk (pData, pChunk); /* add it to the list */
2766
2767#ifdef MNG_SUPPORT_TRACE
2768 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BKGD, MNG_LC_END)
2769#endif
2770
2771 return MNG_NOERROR;
2772}
2773
2774/* ************************************************************************** */
2775
2776mng_retcode MNG_DECL mng_putchunk_phys (mng_handle hHandle,
2777 mng_bool bEmpty,
2778 mng_uint32 iSizex,
2779 mng_uint32 iSizey,
2780 mng_uint8 iUnit)
2781{
2782 mng_datap pData;
2783 mng_chunkp pChunk;
2784 mng_retcode iRetcode;
2785 mng_chunk_header sChunkheader =
2786 {MNG_UINT_pHYs, init_phys, free_phys, read_phys, write_phys, 0, 0};
2787
2788#ifdef MNG_SUPPORT_TRACE
2789 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PHYS, MNG_LC_START)
2790#endif
2791
2792 MNG_VALIDHANDLE (hHandle) /* check validity handle */
2793 pData = (mng_datap)hHandle; /* and make it addressable */
2794
2795 if (!pData->bCreating) /* aren't we creating a new file ? */
2796 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
2797 /* must have had a header first! */
2798 if (pData->iFirstchunkadded == 0)
2799 MNG_ERROR (pData, MNG_NOHEADER)
2800 /* create the chunk */
2801 iRetcode = init_phys (pData, &sChunkheader, &pChunk);
2802
2803 if (iRetcode) /* on error bail out */
2804 return iRetcode;
2805 /* fill the chunk */
2806 ((mng_physp)pChunk)->bEmpty = bEmpty;
2807 ((mng_physp)pChunk)->iSizex = iSizex;
2808 ((mng_physp)pChunk)->iSizey = iSizey;
2809 ((mng_physp)pChunk)->iUnit = iUnit;
2810
2811 add_chunk (pData, pChunk); /* add it to the list */
2812
2813#ifdef MNG_SUPPORT_TRACE
2814 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PHYS, MNG_LC_END)
2815#endif
2816
2817 return MNG_NOERROR;
2818}
2819
2820/* ************************************************************************** */
2821
2822mng_retcode MNG_DECL mng_putchunk_sbit (mng_handle hHandle,
2823 mng_bool bEmpty,
2824 mng_uint8 iType,
2825 mng_uint8arr4 aBits)
2826{
2827 mng_datap pData;
2828 mng_chunkp pChunk;
2829 mng_retcode iRetcode;
2830 mng_chunk_header sChunkheader =
2831 {MNG_UINT_sBIT, init_sbit, free_sbit, read_sbit, write_sbit, 0, 0};
2832
2833#ifdef MNG_SUPPORT_TRACE
2834 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SBIT, MNG_LC_START)
2835#endif
2836
2837 MNG_VALIDHANDLE (hHandle) /* check validity handle */
2838 pData = (mng_datap)hHandle; /* and make it addressable */
2839
2840 if (!pData->bCreating) /* aren't we creating a new file ? */
2841 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
2842 /* must have had a header first! */
2843 if (pData->iFirstchunkadded == 0)
2844 MNG_ERROR (pData, MNG_NOHEADER)
2845 /* create the chunk */
2846 iRetcode = init_sbit (pData, &sChunkheader, &pChunk);
2847
2848 if (iRetcode) /* on error bail out */
2849 return iRetcode;
2850 /* fill the chunk */
2851 ((mng_sbitp)pChunk)->bEmpty = bEmpty;
2852 ((mng_sbitp)pChunk)->iType = iType;
2853 ((mng_sbitp)pChunk)->aBits[0] = aBits[0];
2854 ((mng_sbitp)pChunk)->aBits[1] = aBits[1];
2855 ((mng_sbitp)pChunk)->aBits[2] = aBits[2];
2856 ((mng_sbitp)pChunk)->aBits[3] = aBits[3];
2857
2858 add_chunk (pData, pChunk); /* add it to the list */
2859
2860#ifdef MNG_SUPPORT_TRACE
2861 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SBIT, MNG_LC_END)
2862#endif
2863
2864 return MNG_NOERROR;
2865}
2866
2867/* ************************************************************************** */
2868
2869mng_retcode MNG_DECL mng_putchunk_splt (mng_handle hHandle,
2870 mng_bool bEmpty,
2871 mng_uint32 iNamesize,
2872 mng_pchar zName,
2873 mng_uint8 iSampledepth,
2874 mng_uint32 iEntrycount,
2875 mng_ptr pEntries)
2876{
2877 mng_datap pData;
2878 mng_chunkp pChunk;
2879 mng_retcode iRetcode;
2880 mng_chunk_header sChunkheader =
2881 {MNG_UINT_sPLT, init_splt, free_splt, read_splt, write_splt, 0, 0};
2882
2883#ifdef MNG_SUPPORT_TRACE
2884 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SPLT, MNG_LC_START)
2885#endif
2886
2887 MNG_VALIDHANDLE (hHandle) /* check validity handle */
2888 pData = (mng_datap)hHandle; /* and make it addressable */
2889
2890 if (!pData->bCreating) /* aren't we creating a new file ? */
2891 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
2892 /* must have had a header first! */
2893 if (pData->iFirstchunkadded == 0)
2894 MNG_ERROR (pData, MNG_NOHEADER)
2895 /* create the chunk */
2896 iRetcode = init_splt (pData, &sChunkheader, &pChunk);
2897
2898 if (iRetcode) /* on error bail out */
2899 return iRetcode;
2900 /* fill the chunk */
2901 ((mng_spltp)pChunk)->bEmpty = bEmpty;
2902 ((mng_spltp)pChunk)->iNamesize = iNamesize;
2903 ((mng_spltp)pChunk)->iSampledepth = iSampledepth;
2904 ((mng_spltp)pChunk)->iEntrycount = iEntrycount;
2905
2906 if (iNamesize)
2907 {
2908 MNG_ALLOC (pData, ((mng_spltp)pChunk)->zName, iNamesize + 1)
2909 MNG_COPY (((mng_spltp)pChunk)->zName, zName, iNamesize)
2910 }
2911
2912 if (iEntrycount)
2913 {
2914 mng_uint32 iSize = iEntrycount * ((iSampledepth >> 1) + 2);
2915
2916 MNG_ALLOC (pData, ((mng_spltp)pChunk)->pEntries, iSize)
2917 MNG_COPY (((mng_spltp)pChunk)->pEntries, pEntries, iSize)
2918 }
2919
2920 add_chunk (pData, pChunk); /* add it to the list */
2921
2922#ifdef MNG_SUPPORT_TRACE
2923 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SPLT, MNG_LC_END)
2924#endif
2925
2926 return MNG_NOERROR;
2927}
2928
2929/* ************************************************************************** */
2930
2931mng_retcode MNG_DECL mng_putchunk_hist (mng_handle hHandle,
2932 mng_uint32 iEntrycount,
2933 mng_uint16arr aEntries)
2934{
2935 mng_datap pData;
2936 mng_chunkp pChunk;
2937 mng_retcode iRetcode;
2938 mng_chunk_header sChunkheader =
2939 {MNG_UINT_hIST, init_hist, free_hist, read_hist, write_hist, 0, 0};
2940
2941#ifdef MNG_SUPPORT_TRACE
2942 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_HIST, MNG_LC_START)
2943#endif
2944
2945 MNG_VALIDHANDLE (hHandle) /* check validity handle */
2946 pData = (mng_datap)hHandle; /* and make it addressable */
2947
2948 if (!pData->bCreating) /* aren't we creating a new file ? */
2949 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
2950 /* must have had a header first! */
2951 if (pData->iFirstchunkadded == 0)
2952 MNG_ERROR (pData, MNG_NOHEADER)
2953 /* create the chunk */
2954 iRetcode = init_hist (pData, &sChunkheader, &pChunk);
2955
2956 if (iRetcode) /* on error bail out */
2957 return iRetcode;
2958 /* fill the chunk */
2959 ((mng_histp)pChunk)->iEntrycount = iEntrycount;
2960
2961 MNG_COPY (((mng_histp)pChunk)->aEntries, aEntries, sizeof (mng_uint16arr))
2962
2963 add_chunk (pData, pChunk); /* add it to the list */
2964
2965#ifdef MNG_SUPPORT_TRACE
2966 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_HIST, MNG_LC_END)
2967#endif
2968
2969 return MNG_NOERROR;
2970}
2971
2972/* ************************************************************************** */
2973
2974mng_retcode MNG_DECL mng_putchunk_time (mng_handle hHandle,
2975 mng_uint16 iYear,
2976 mng_uint8 iMonth,
2977 mng_uint8 iDay,
2978 mng_uint8 iHour,
2979 mng_uint8 iMinute,
2980 mng_uint8 iSecond)
2981{
2982 mng_datap pData;
2983 mng_chunkp pChunk;
2984 mng_retcode iRetcode;
2985 mng_chunk_header sChunkheader =
2986 {MNG_UINT_tIME, init_time, free_time, read_time, write_time, 0, 0};
2987
2988#ifdef MNG_SUPPORT_TRACE
2989 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TIME, MNG_LC_START)
2990#endif
2991
2992 MNG_VALIDHANDLE (hHandle) /* check validity handle */
2993 pData = (mng_datap)hHandle; /* and make it addressable */
2994
2995 if (!pData->bCreating) /* aren't we creating a new file ? */
2996 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
2997 /* must have had a header first! */
2998 if (pData->iFirstchunkadded == 0)
2999 MNG_ERROR (pData, MNG_NOHEADER)
3000 /* create the chunk */
3001 iRetcode = init_time (pData, &sChunkheader, &pChunk);
3002
3003 if (iRetcode) /* on error bail out */
3004 return iRetcode;
3005 /* fill the chunk */
3006 ((mng_timep)pChunk)->iYear = iYear;
3007 ((mng_timep)pChunk)->iMonth = iMonth;
3008 ((mng_timep)pChunk)->iDay = iDay;
3009 ((mng_timep)pChunk)->iHour = iHour;
3010 ((mng_timep)pChunk)->iMinute = iMinute;
3011 ((mng_timep)pChunk)->iSecond = iSecond;
3012
3013 add_chunk (pData, pChunk); /* add it to the list */
3014
3015#ifdef MNG_SUPPORT_TRACE
3016 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TIME, MNG_LC_END)
3017#endif
3018
3019 return MNG_NOERROR;
3020}
3021
3022/* ************************************************************************** */
3023
3024mng_retcode MNG_DECL mng_putchunk_mhdr (mng_handle hHandle,
3025 mng_uint32 iWidth,
3026 mng_uint32 iHeight,
3027 mng_uint32 iTicks,
3028 mng_uint32 iLayercount,
3029 mng_uint32 iFramecount,
3030 mng_uint32 iPlaytime,
3031 mng_uint32 iSimplicity)
3032{
3033 mng_datap pData;
3034 mng_chunkp pChunk;
3035 mng_retcode iRetcode;
3036 mng_chunk_header sChunkheader =
3037 {MNG_UINT_MHDR, init_mhdr, free_mhdr, read_mhdr, write_mhdr, 0, 0};
3038
3039#ifdef MNG_SUPPORT_TRACE
3040 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MHDR, MNG_LC_START)
3041#endif
3042
3043 MNG_VALIDHANDLE (hHandle) /* check validity handle */
3044 pData = (mng_datap)hHandle; /* and make it addressable */
3045
3046 if (!pData->bCreating) /* aren't we creating a new file ? */
3047 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
3048 /* create the chunk */
3049 iRetcode = init_mhdr (pData, &sChunkheader, &pChunk);
3050
3051 if (iRetcode) /* on error bail out */
3052 return iRetcode;
3053 /* fill the chunk */
3054 ((mng_mhdrp)pChunk)->iWidth = iWidth;
3055 ((mng_mhdrp)pChunk)->iHeight = iHeight;
3056 ((mng_mhdrp)pChunk)->iTicks = iTicks;
3057 ((mng_mhdrp)pChunk)->iLayercount = iLayercount;
3058 ((mng_mhdrp)pChunk)->iFramecount = iFramecount;
3059 ((mng_mhdrp)pChunk)->iPlaytime = iPlaytime;
3060 ((mng_mhdrp)pChunk)->iSimplicity = iSimplicity;
3061
3062 add_chunk (pData, pChunk); /* add it to the list */
3063
3064#ifdef MNG_SUPPORT_TRACE
3065 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MHDR, MNG_LC_END)
3066#endif
3067
3068 return MNG_NOERROR;
3069}
3070
3071/* ************************************************************************** */
3072
3073mng_retcode MNG_DECL mng_putchunk_mend (mng_handle hHandle)
3074{
3075 mng_datap pData;
3076 mng_chunkp pChunk;
3077 mng_retcode iRetcode;
3078 mng_chunk_header sChunkheader =
3079 {MNG_UINT_MEND, init_mend, free_mend, read_mend, write_mend, 0, 0};
3080
3081#ifdef MNG_SUPPORT_TRACE
3082 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MEND, MNG_LC_START)
3083#endif
3084
3085 MNG_VALIDHANDLE (hHandle) /* check validity handle */
3086 pData = (mng_datap)hHandle; /* and make it addressable */
3087
3088 if (!pData->bCreating) /* aren't we creating a new file ? */
3089 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
3090 /* must have had a header first! */
3091 if (pData->iFirstchunkadded == 0)
3092 MNG_ERROR (pData, MNG_NOHEADER)
3093 /* create the chunk */
3094 iRetcode = init_mend (pData, &sChunkheader, &pChunk);
3095
3096 if (iRetcode) /* on error bail out */
3097 return iRetcode;
3098
3099 add_chunk (pData, pChunk); /* add it to the list */
3100
3101 pData->bCreating = MNG_FALSE; /* should be last chunk !!! */
3102
3103#ifdef MNG_SUPPORT_TRACE
3104 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MEND, MNG_LC_END)
3105#endif
3106
3107 return MNG_NOERROR;
3108}
3109
3110/* ************************************************************************** */
3111
3112mng_retcode MNG_DECL mng_putchunk_loop (mng_handle hHandle,
3113 mng_uint8 iLevel,
3114 mng_uint32 iRepeat,
3115 mng_uint8 iTermination,
3116 mng_uint32 iItermin,
3117 mng_uint32 iItermax,
3118 mng_uint32 iCount,
3119 mng_uint32p pSignals)
3120{
3121 mng_datap pData;
3122 mng_chunkp pChunk;
3123 mng_retcode iRetcode;
3124 mng_chunk_header sChunkheader =
3125 {MNG_UINT_LOOP, init_loop, free_loop, read_loop, write_loop, 0, 0};
3126
3127#ifdef MNG_SUPPORT_TRACE
3128 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_LOOP, MNG_LC_START)
3129#endif
3130
3131 MNG_VALIDHANDLE (hHandle) /* check validity handle */
3132 pData = (mng_datap)hHandle; /* and make it addressable */
3133
3134 if (!pData->bCreating) /* aren't we creating a new file ? */
3135 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
3136 /* must have had a MHDR first! */
3137 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
3138 MNG_ERROR (pData, MNG_NOHEADER)
3139 /* create the chunk */
3140 iRetcode = init_loop (pData, &sChunkheader, &pChunk);
3141
3142 if (iRetcode) /* on error bail out */
3143 return iRetcode;
3144 /* fill the chunk */
3145 ((mng_loopp)pChunk)->iLevel = iLevel;
3146 ((mng_loopp)pChunk)->iRepeat = iRepeat;
3147 ((mng_loopp)pChunk)->iTermination = iTermination;
3148 ((mng_loopp)pChunk)->iItermin = iItermin;
3149 ((mng_loopp)pChunk)->iItermax = iItermax;
3150 ((mng_loopp)pChunk)->iCount = iCount;
3151 ((mng_loopp)pChunk)->pSignals = pSignals;
3152
3153 add_chunk (pData, pChunk); /* add it to the list */
3154
3155#ifdef MNG_SUPPORT_TRACE
3156 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_LOOP, MNG_LC_END)
3157#endif
3158
3159 return MNG_NOERROR;
3160}
3161
3162/* ************************************************************************** */
3163
3164mng_retcode MNG_DECL mng_putchunk_endl (mng_handle hHandle,
3165 mng_uint8 iLevel)
3166{
3167 mng_datap pData;
3168 mng_chunkp pChunk;
3169 mng_retcode iRetcode;
3170 mng_chunk_header sChunkheader =
3171 {MNG_UINT_ENDL, init_endl, free_endl, read_endl, write_endl, 0, 0};
3172
3173#ifdef MNG_SUPPORT_TRACE
3174 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ENDL, MNG_LC_START)
3175#endif
3176
3177 MNG_VALIDHANDLE (hHandle) /* check validity handle */
3178 pData = (mng_datap)hHandle; /* and make it addressable */
3179
3180 if (!pData->bCreating) /* aren't we creating a new file ? */
3181 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
3182 /* must have had a MHDR first! */
3183 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
3184 MNG_ERROR (pData, MNG_NOHEADER)
3185 /* create the chunk */
3186 iRetcode = init_endl (pData, &sChunkheader, &pChunk);
3187
3188 if (iRetcode) /* on error bail out */
3189 return iRetcode;
3190 /* fill the chunk */
3191 ((mng_endlp)pChunk)->iLevel = iLevel;
3192
3193 add_chunk (pData, pChunk); /* add it to the list */
3194
3195#ifdef MNG_SUPPORT_TRACE
3196 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ENDL, MNG_LC_END)
3197#endif
3198
3199 return MNG_NOERROR;
3200}
3201
3202/* ************************************************************************** */
3203
3204mng_retcode MNG_DECL mng_putchunk_defi (mng_handle hHandle,
3205 mng_uint16 iObjectid,
3206 mng_uint8 iDonotshow,
3207 mng_uint8 iConcrete,
3208 mng_bool bHasloca,
3209 mng_int32 iXlocation,
3210 mng_int32 iYlocation,
3211 mng_bool bHasclip,
3212 mng_int32 iLeftcb,
3213 mng_int32 iRightcb,
3214 mng_int32 iTopcb,
3215 mng_int32 iBottomcb)
3216{
3217 mng_datap pData;
3218 mng_chunkp pChunk;
3219 mng_retcode iRetcode;
3220 mng_chunk_header sChunkheader =
3221 {MNG_UINT_DEFI, init_defi, free_defi, read_defi, write_defi, 0, 0};
3222
3223#ifdef MNG_SUPPORT_TRACE
3224 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DEFI, MNG_LC_START)
3225#endif
3226
3227 MNG_VALIDHANDLE (hHandle) /* check validity handle */
3228 pData = (mng_datap)hHandle; /* and make it addressable */
3229
3230 if (!pData->bCreating) /* aren't we creating a new file ? */
3231 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
3232 /* must have had a MHDR first! */
3233 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
3234 MNG_ERROR (pData, MNG_NOHEADER)
3235 /* create the chunk */
3236 iRetcode = init_defi (pData, &sChunkheader, &pChunk);
3237
3238 if (iRetcode) /* on error bail out */
3239 return iRetcode;
3240 /* fill the chunk */
3241 ((mng_defip)pChunk)->iObjectid = iObjectid;
3242 ((mng_defip)pChunk)->iDonotshow = iDonotshow;
3243 ((mng_defip)pChunk)->iConcrete = iConcrete;
3244 ((mng_defip)pChunk)->bHasloca = bHasloca;
3245 ((mng_defip)pChunk)->iXlocation = iXlocation;
3246 ((mng_defip)pChunk)->iYlocation = iYlocation;
3247 ((mng_defip)pChunk)->bHasclip = bHasclip;
3248 ((mng_defip)pChunk)->iLeftcb = iLeftcb;
3249 ((mng_defip)pChunk)->iRightcb = iRightcb;
3250 ((mng_defip)pChunk)->iTopcb = iTopcb;
3251 ((mng_defip)pChunk)->iBottomcb = iBottomcb;
3252
3253 add_chunk (pData, pChunk); /* add it to the list */
3254
3255#ifdef MNG_SUPPORT_TRACE
3256 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DEFI, MNG_LC_END)
3257#endif
3258
3259 return MNG_NOERROR;
3260}
3261
3262/* ************************************************************************** */
3263
3264mng_retcode MNG_DECL mng_putchunk_basi (mng_handle hHandle,
3265 mng_uint32 iWidth,
3266 mng_uint32 iHeight,
3267 mng_uint8 iBitdepth,
3268 mng_uint8 iColortype,
3269 mng_uint8 iCompression,
3270 mng_uint8 iFilter,
3271 mng_uint8 iInterlace,
3272 mng_uint16 iRed,
3273 mng_uint16 iGreen,
3274 mng_uint16 iBlue,
3275 mng_uint16 iAlpha,
3276 mng_uint8 iViewable)
3277{
3278 mng_datap pData;
3279 mng_chunkp pChunk;
3280 mng_retcode iRetcode;
3281 mng_chunk_header sChunkheader =
3282 {MNG_UINT_BASI, init_basi, free_basi, read_basi, write_basi, 0, 0};
3283
3284#ifdef MNG_SUPPORT_TRACE
3285 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BASI, MNG_LC_START)
3286#endif
3287
3288 MNG_VALIDHANDLE (hHandle) /* check validity handle */
3289 pData = (mng_datap)hHandle; /* and make it addressable */
3290
3291 if (!pData->bCreating) /* aren't we creating a new file ? */
3292 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
3293 /* must have had a MHDR first! */
3294 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
3295 MNG_ERROR (pData, MNG_NOHEADER)
3296 /* create the chunk */
3297 iRetcode = init_basi (pData, &sChunkheader, &pChunk);
3298
3299 if (iRetcode) /* on error bail out */
3300 return iRetcode;
3301 /* fill the chunk */
3302 ((mng_basip)pChunk)->iWidth = iWidth;
3303 ((mng_basip)pChunk)->iHeight = iHeight;
3304 ((mng_basip)pChunk)->iBitdepth = iBitdepth;
3305 ((mng_basip)pChunk)->iColortype = iColortype;
3306 ((mng_basip)pChunk)->iCompression = iCompression;
3307 ((mng_basip)pChunk)->iFilter = iFilter;
3308 ((mng_basip)pChunk)->iInterlace = iInterlace;
3309 ((mng_basip)pChunk)->iRed = iRed;
3310 ((mng_basip)pChunk)->iGreen = iGreen;
3311 ((mng_basip)pChunk)->iBlue = iBlue;
3312 ((mng_basip)pChunk)->iAlpha = iAlpha;
3313 ((mng_basip)pChunk)->iViewable = iViewable;
3314
3315 add_chunk (pData, pChunk); /* add it to the list */
3316
3317#ifdef MNG_SUPPORT_TRACE
3318 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BASI, MNG_LC_END)
3319#endif
3320
3321 return MNG_NOERROR;
3322}
3323
3324/* ************************************************************************** */
3325
3326mng_retcode MNG_DECL mng_putchunk_clon (mng_handle hHandle,
3327 mng_uint16 iSourceid,
3328 mng_uint16 iCloneid,
3329 mng_uint8 iClonetype,
3330 mng_uint8 iDonotshow,
3331 mng_uint8 iConcrete,
3332 mng_bool bHasloca,
3333 mng_uint8 iLocationtype,
3334 mng_int32 iLocationx,
3335 mng_int32 iLocationy)
3336{
3337 mng_datap pData;
3338 mng_chunkp pChunk;
3339 mng_retcode iRetcode;
3340 mng_chunk_header sChunkheader =
3341 {MNG_UINT_CLON, init_clon, free_clon, read_clon, write_clon, 0, 0};
3342
3343#ifdef MNG_SUPPORT_TRACE
3344 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CLON, MNG_LC_START)
3345#endif
3346
3347 MNG_VALIDHANDLE (hHandle) /* check validity handle */
3348 pData = (mng_datap)hHandle; /* and make it addressable */
3349
3350 if (!pData->bCreating) /* aren't we creating a new file ? */
3351 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
3352 /* must have had a MHDR first! */
3353 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
3354 MNG_ERROR (pData, MNG_NOHEADER)
3355 /* create the chunk */
3356 iRetcode = init_clon (pData, &sChunkheader, &pChunk);
3357
3358 if (iRetcode) /* on error bail out */
3359 return iRetcode;
3360 /* fill the chunk */
3361 ((mng_clonp)pChunk)->iSourceid = iSourceid;
3362 ((mng_clonp)pChunk)->iCloneid = iCloneid;
3363 ((mng_clonp)pChunk)->iClonetype = iClonetype;
3364 ((mng_clonp)pChunk)->iDonotshow = iDonotshow;
3365 ((mng_clonp)pChunk)->iConcrete = iConcrete;
3366 ((mng_clonp)pChunk)->bHasloca = bHasloca;
3367 ((mng_clonp)pChunk)->iLocationtype = iLocationtype;
3368 ((mng_clonp)pChunk)->iLocationx = iLocationx;
3369 ((mng_clonp)pChunk)->iLocationy = iLocationy;
3370
3371 add_chunk (pData, pChunk); /* add it to the list */
3372
3373#ifdef MNG_SUPPORT_TRACE
3374 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CLON, MNG_LC_END)
3375#endif
3376
3377 return MNG_NOERROR;
3378}
3379
3380/* ************************************************************************** */
3381
3382mng_retcode MNG_DECL mng_putchunk_past (mng_handle hHandle,
3383 mng_uint16 iDestid,
3384 mng_uint8 iTargettype,
3385 mng_int32 iTargetx,
3386 mng_int32 iTargety,
3387 mng_uint32 iCount)
3388{
3389 mng_datap pData;
3390 mng_chunkp pChunk;
3391 mng_retcode iRetcode;
3392 mng_chunk_header sChunkheader =
3393 {MNG_UINT_PAST, init_past, free_past, read_past, write_past, 0, 0};
3394
3395#ifdef MNG_SUPPORT_TRACE
3396 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PAST, MNG_LC_START)
3397#endif
3398
3399 MNG_VALIDHANDLE (hHandle) /* check validity handle */
3400 pData = (mng_datap)hHandle; /* and make it addressable */
3401
3402 if (!pData->bCreating) /* aren't we creating a new file ? */
3403 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
3404 /* must have had a MHDR first! */
3405 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
3406 MNG_ERROR (pData, MNG_NOHEADER)
3407 /* create the chunk */
3408 iRetcode = init_past (pData, &sChunkheader, &pChunk);
3409
3410 if (iRetcode) /* on error bail out */
3411 return iRetcode;
3412 /* fill the chunk */
3413 ((mng_pastp)pChunk)->iDestid = iDestid;
3414 ((mng_pastp)pChunk)->iTargettype = iTargettype;
3415 ((mng_pastp)pChunk)->iTargetx = iTargetx;
3416 ((mng_pastp)pChunk)->iTargety = iTargety;
3417 ((mng_pastp)pChunk)->iCount = iCount;
3418
3419 if (iCount)
3420 MNG_ALLOC (pData, ((mng_pastp)pChunk)->pSources, iCount * sizeof (mng_past_source))
3421
3422 add_chunk (pData, pChunk); /* add it to the list */
3423
3424#ifdef MNG_SUPPORT_TRACE
3425 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PAST, MNG_LC_END)
3426#endif
3427
3428 return MNG_NOERROR;
3429}
3430
3431/* ************************************************************************** */
3432
3433mng_retcode MNG_DECL mng_putchunk_past_src (mng_handle hHandle,
3434 mng_uint32 iEntry,
3435 mng_uint16 iSourceid,
3436 mng_uint8 iComposition,
3437 mng_uint8 iOrientation,
3438 mng_uint8 iOffsettype,
3439 mng_int32 iOffsetx,
3440 mng_int32 iOffsety,
3441 mng_uint8 iBoundarytype,
3442 mng_int32 iBoundaryl,
3443 mng_int32 iBoundaryr,
3444 mng_int32 iBoundaryt,
3445 mng_int32 iBoundaryb)
3446{
3447 mng_datap pData;
3448 mng_chunkp pChunk;
3449 mng_past_sourcep pEntry;
3450
3451#ifdef MNG_SUPPORT_TRACE
3452 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PAST_SRC, MNG_LC_START)
3453#endif
3454
3455 MNG_VALIDHANDLE (hHandle) /* check validity handle */
3456 pData = (mng_datap)hHandle; /* and make it addressable */
3457
3458 if (!pData->bCreating) /* aren't we creating a new file ? */
3459 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
3460 /* must have had a MHDR first! */
3461 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
3462 MNG_ERROR (pData, MNG_NOHEADER)
3463
3464 pChunk = pData->pLastchunk; /* last one must have been PAST ! */
3465
3466 if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_PAST)
3467 MNG_ERROR (pData, MNG_NOCORRCHUNK)
3468 /* index out of bounds ? */
3469 if (iEntry >= ((mng_pastp)pChunk)->iCount)
3470 MNG_ERROR (pData, MNG_INVALIDENTRYIX)
3471 /* address proper entry */
3472 pEntry = ((mng_pastp)pChunk)->pSources + iEntry;
3473
3474 pEntry->iSourceid = iSourceid; /* fill entry */
3475 pEntry->iComposition = iComposition;
3476 pEntry->iOrientation = iOrientation;
3477 pEntry->iOffsettype = iOffsettype;
3478 pEntry->iOffsetx = iOffsetx;
3479 pEntry->iOffsety = iOffsety;
3480 pEntry->iBoundarytype = iBoundarytype;
3481 pEntry->iBoundaryl = iBoundaryl;
3482 pEntry->iBoundaryr = iBoundaryr;
3483 pEntry->iBoundaryt = iBoundaryt;
3484 pEntry->iBoundaryb = iBoundaryb;
3485
3486#ifdef MNG_SUPPORT_TRACE
3487 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PAST_SRC, MNG_LC_END)
3488#endif
3489
3490 return MNG_NOERROR;
3491}
3492
3493/* ************************************************************************** */
3494
3495mng_retcode MNG_DECL mng_putchunk_disc (mng_handle hHandle,
3496 mng_uint32 iCount,
3497 mng_uint16p pObjectids)
3498{
3499 mng_datap pData;
3500 mng_chunkp pChunk;
3501 mng_retcode iRetcode;
3502 mng_chunk_header sChunkheader =
3503 {MNG_UINT_DISC, init_disc, free_disc, read_disc, write_disc, 0, 0};
3504
3505#ifdef MNG_SUPPORT_TRACE
3506 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DISC, MNG_LC_START)
3507#endif
3508
3509 MNG_VALIDHANDLE (hHandle) /* check validity handle */
3510 pData = (mng_datap)hHandle; /* and make it addressable */
3511
3512 if (!pData->bCreating) /* aren't we creating a new file ? */
3513 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
3514 /* must have had a MHDR first! */
3515 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
3516 MNG_ERROR (pData, MNG_NOHEADER)
3517 /* create the chunk */
3518 iRetcode = init_disc (pData, &sChunkheader, &pChunk);
3519
3520 if (iRetcode) /* on error bail out */
3521 return iRetcode;
3522 /* fill the chunk */
3523 ((mng_discp)pChunk)->iCount = iCount;
3524
3525 if (iCount)
3526 {
3527 mng_uint32 iSize = iCount * sizeof (mng_uint32);
3528
3529 MNG_ALLOC (pData, ((mng_discp)pChunk)->pObjectids, iSize);
3530 MNG_COPY (((mng_discp)pChunk)->pObjectids, pObjectids, iSize);
3531 }
3532
3533 add_chunk (pData, pChunk); /* add it to the list */
3534
3535#ifdef MNG_SUPPORT_TRACE
3536 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DISC, MNG_LC_END)
3537#endif
3538
3539 return MNG_NOERROR;
3540}
3541
3542/* ************************************************************************** */
3543
3544mng_retcode MNG_DECL mng_putchunk_back (mng_handle hHandle,
3545 mng_uint16 iRed,
3546 mng_uint16 iGreen,
3547 mng_uint16 iBlue,
3548 mng_uint8 iMandatory,
3549 mng_uint16 iImageid,
3550 mng_uint8 iTile)
3551{
3552 mng_datap pData;
3553 mng_chunkp pChunk;
3554 mng_retcode iRetcode;
3555 mng_chunk_header sChunkheader =
3556 {MNG_UINT_BACK, init_back, free_back, read_back, write_back, 0, 0};
3557
3558#ifdef MNG_SUPPORT_TRACE
3559 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BACK, MNG_LC_START)
3560#endif
3561
3562 MNG_VALIDHANDLE (hHandle) /* check validity handle */
3563 pData = (mng_datap)hHandle; /* and make it addressable */
3564
3565 if (!pData->bCreating) /* aren't we creating a new file ? */
3566 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
3567 /* must have had a MHDR first! */
3568 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
3569 MNG_ERROR (pData, MNG_NOHEADER)
3570 /* create the chunk */
3571 iRetcode = init_back (pData, &sChunkheader, &pChunk);
3572
3573 if (iRetcode) /* on error bail out */
3574 return iRetcode;
3575 /* fill the chunk */
3576 ((mng_backp)pChunk)->iRed = iRed;
3577 ((mng_backp)pChunk)->iGreen = iGreen;
3578 ((mng_backp)pChunk)->iBlue = iBlue;
3579 ((mng_backp)pChunk)->iMandatory = iMandatory;
3580 ((mng_backp)pChunk)->iImageid = iImageid;
3581 ((mng_backp)pChunk)->iTile = iTile;
3582
3583 add_chunk (pData, pChunk); /* add it to the list */
3584
3585#ifdef MNG_SUPPORT_TRACE
3586 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BACK, MNG_LC_END)
3587#endif
3588
3589 return MNG_NOERROR;
3590}
3591
3592/* ************************************************************************** */
3593
3594mng_retcode MNG_DECL mng_putchunk_fram (mng_handle hHandle,
3595 mng_bool bEmpty,
3596 mng_uint8 iMode,
3597 mng_uint32 iNamesize,
3598 mng_pchar zName,
3599 mng_uint8 iChangedelay,
3600 mng_uint8 iChangetimeout,
3601 mng_uint8 iChangeclipping,
3602 mng_uint8 iChangesyncid,
3603 mng_uint32 iDelay,
3604 mng_uint32 iTimeout,
3605 mng_uint8 iBoundarytype,
3606 mng_int32 iBoundaryl,
3607 mng_int32 iBoundaryr,
3608 mng_int32 iBoundaryt,
3609 mng_int32 iBoundaryb,
3610 mng_uint32 iCount,
3611 mng_uint32p pSyncids)
3612{
3613 mng_datap pData;
3614 mng_chunkp pChunk;
3615 mng_retcode iRetcode;
3616 mng_chunk_header sChunkheader =
3617 {MNG_UINT_FRAM, init_fram, free_fram, read_fram, write_fram, 0, 0};
3618
3619#ifdef MNG_SUPPORT_TRACE
3620 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_FRAM, MNG_LC_START)
3621#endif
3622
3623 MNG_VALIDHANDLE (hHandle) /* check validity handle */
3624 pData = (mng_datap)hHandle; /* and make it addressable */
3625
3626 if (!pData->bCreating) /* aren't we creating a new file ? */
3627 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
3628 /* must have had a MHDR first! */
3629 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
3630 MNG_ERROR (pData, MNG_NOHEADER)
3631 /* create the chunk */
3632 iRetcode = init_fram (pData, &sChunkheader, &pChunk);
3633
3634 if (iRetcode) /* on error bail out */
3635 return iRetcode;
3636 /* fill the chunk */
3637 ((mng_framp)pChunk)->bEmpty = bEmpty;
3638 ((mng_framp)pChunk)->iMode = iMode;
3639 ((mng_framp)pChunk)->iNamesize = iNamesize;
3640 ((mng_framp)pChunk)->iChangedelay = iChangedelay;
3641 ((mng_framp)pChunk)->iChangetimeout = iChangetimeout;
3642 ((mng_framp)pChunk)->iChangeclipping = iChangeclipping;
3643 ((mng_framp)pChunk)->iChangesyncid = iChangesyncid;
3644 ((mng_framp)pChunk)->iDelay = iDelay;
3645 ((mng_framp)pChunk)->iTimeout = iTimeout;
3646 ((mng_framp)pChunk)->iBoundarytype = iBoundarytype;
3647 ((mng_framp)pChunk)->iBoundaryl = iBoundaryl;
3648 ((mng_framp)pChunk)->iBoundaryr = iBoundaryr;
3649 ((mng_framp)pChunk)->iBoundaryt = iBoundaryt;
3650 ((mng_framp)pChunk)->iBoundaryb = iBoundaryb;
3651 ((mng_framp)pChunk)->iCount = iCount;
3652
3653 if (iNamesize)
3654 {
3655 MNG_ALLOC (pData, ((mng_framp)pChunk)->zName, iNamesize + 1)
3656 MNG_COPY (((mng_framp)pChunk)->zName, zName, iNamesize)
3657 }
3658
3659 if (iCount)
3660 {
3661 mng_uint32 iSize = iCount * sizeof (mng_uint32);
3662
3663 MNG_ALLOC (pData, ((mng_framp)pChunk)->pSyncids, iSize)
3664 MNG_COPY (((mng_framp)pChunk)->pSyncids, pSyncids, iSize)
3665 }
3666
3667 add_chunk (pData, pChunk); /* add it to the list */
3668
3669#ifdef MNG_SUPPORT_TRACE
3670 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_FRAM, MNG_LC_END)
3671#endif
3672
3673 return MNG_NOERROR;
3674}
3675
3676/* ************************************************************************** */
3677
3678mng_retcode MNG_DECL mng_putchunk_move (mng_handle hHandle,
3679 mng_uint16 iFirstid,
3680 mng_uint16 iLastid,
3681 mng_uint8 iMovetype,
3682 mng_int32 iMovex,
3683 mng_int32 iMovey)
3684{
3685 mng_datap pData;
3686 mng_chunkp pChunk;
3687 mng_retcode iRetcode;
3688 mng_chunk_header sChunkheader =
3689 {MNG_UINT_MOVE, init_move, free_move, read_move, write_move, 0, 0};
3690
3691#ifdef MNG_SUPPORT_TRACE
3692 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MOVE, MNG_LC_START)
3693#endif
3694
3695 MNG_VALIDHANDLE (hHandle) /* check validity handle */
3696 pData = (mng_datap)hHandle; /* and make it addressable */
3697
3698 if (!pData->bCreating) /* aren't we creating a new file ? */
3699 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
3700 /* must have had a MHDR first! */
3701 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
3702 MNG_ERROR (pData, MNG_NOHEADER)
3703 /* create the chunk */
3704 iRetcode = init_move (pData, &sChunkheader, &pChunk);
3705
3706 if (iRetcode) /* on error bail out */
3707 return iRetcode;
3708 /* fill the chunk */
3709 ((mng_movep)pChunk)->iFirstid = iFirstid;
3710 ((mng_movep)pChunk)->iLastid = iLastid;
3711 ((mng_movep)pChunk)->iMovetype = iMovetype;
3712 ((mng_movep)pChunk)->iMovex = iMovex;
3713 ((mng_movep)pChunk)->iMovey = iMovey;
3714
3715 add_chunk (pData, pChunk); /* add it to the list */
3716
3717#ifdef MNG_SUPPORT_TRACE
3718 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MOVE, MNG_LC_END)
3719#endif
3720
3721 return MNG_NOERROR;
3722}
3723
3724/* ************************************************************************** */
3725
3726mng_retcode MNG_DECL mng_putchunk_clip (mng_handle hHandle,
3727 mng_uint16 iFirstid,
3728 mng_uint16 iLastid,
3729 mng_uint8 iCliptype,
3730 mng_int32 iClipl,
3731 mng_int32 iClipr,
3732 mng_int32 iClipt,
3733 mng_int32 iClipb)
3734{
3735 mng_datap pData;
3736 mng_chunkp pChunk;
3737 mng_retcode iRetcode;
3738 mng_chunk_header sChunkheader =
3739 {MNG_UINT_CLIP, init_clip, free_clip, read_clip, write_clip, 0, 0};
3740
3741#ifdef MNG_SUPPORT_TRACE
3742 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CLIP, MNG_LC_START)
3743#endif
3744
3745 MNG_VALIDHANDLE (hHandle) /* check validity handle */
3746 pData = (mng_datap)hHandle; /* and make it addressable */
3747
3748 if (!pData->bCreating) /* aren't we creating a new file ? */
3749 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
3750 /* must have had a MHDR first! */
3751 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
3752 MNG_ERROR (pData, MNG_NOHEADER)
3753 /* create the chunk */
3754 iRetcode = init_clip (pData, &sChunkheader, &pChunk);
3755
3756 if (iRetcode) /* on error bail out */
3757 return iRetcode;
3758 /* fill the chunk */
3759 ((mng_clipp)pChunk)->iFirstid = iFirstid;
3760 ((mng_clipp)pChunk)->iLastid = iLastid;
3761 ((mng_clipp)pChunk)->iCliptype = iCliptype;
3762 ((mng_clipp)pChunk)->iClipl = iClipl;
3763 ((mng_clipp)pChunk)->iClipr = iClipr;
3764 ((mng_clipp)pChunk)->iClipt = iClipt;
3765 ((mng_clipp)pChunk)->iClipb = iClipb;
3766
3767 add_chunk (pData, pChunk); /* add it to the list */
3768
3769#ifdef MNG_SUPPORT_TRACE
3770 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CLIP, MNG_LC_END)
3771#endif
3772
3773 return MNG_NOERROR;
3774}
3775
3776/* ************************************************************************** */
3777
3778mng_retcode MNG_DECL mng_putchunk_show (mng_handle hHandle,
3779 mng_bool bEmpty,
3780 mng_uint16 iFirstid,
3781 mng_uint16 iLastid,
3782 mng_uint8 iMode)
3783{
3784 mng_datap pData;
3785 mng_chunkp pChunk;
3786 mng_retcode iRetcode;
3787 mng_chunk_header sChunkheader =
3788 {MNG_UINT_SHOW, init_show, free_show, read_show, write_show, 0, 0};
3789
3790#ifdef MNG_SUPPORT_TRACE
3791 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SHOW, MNG_LC_START)
3792#endif
3793
3794 MNG_VALIDHANDLE (hHandle) /* check validity handle */
3795 pData = (mng_datap)hHandle; /* and make it addressable */
3796
3797 if (!pData->bCreating) /* aren't we creating a new file ? */
3798 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
3799 /* must have had a MHDR first! */
3800 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
3801 MNG_ERROR (pData, MNG_NOHEADER)
3802 /* create the chunk */
3803 iRetcode = init_show (pData, &sChunkheader, &pChunk);
3804
3805 if (iRetcode) /* on error bail out */
3806 return iRetcode;
3807 /* fill the chunk */
3808 ((mng_showp)pChunk)->bEmpty = bEmpty;
3809 ((mng_showp)pChunk)->iFirstid = iFirstid;
3810 ((mng_showp)pChunk)->iLastid = iLastid;
3811 ((mng_showp)pChunk)->iMode = iMode;
3812
3813 add_chunk (pData, pChunk); /* add it to the list */
3814
3815#ifdef MNG_SUPPORT_TRACE
3816 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SHOW, MNG_LC_END)
3817#endif
3818
3819 return MNG_NOERROR;
3820}
3821
3822/* ************************************************************************** */
3823
3824mng_retcode MNG_DECL mng_putchunk_term (mng_handle hHandle,
3825 mng_uint8 iTermaction,
3826 mng_uint8 iIteraction,
3827 mng_uint32 iDelay,
3828 mng_uint32 iItermax)
3829{
3830 mng_datap pData;
3831 mng_chunkp pChunk;
3832 mng_retcode iRetcode;
3833 mng_chunk_header sChunkheader =
3834 {MNG_UINT_TERM, init_term, free_term, read_term, write_term, 0, 0};
3835
3836#ifdef MNG_SUPPORT_TRACE
3837 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TERM, MNG_LC_START)
3838#endif
3839
3840 MNG_VALIDHANDLE (hHandle) /* check validity handle */
3841 pData = (mng_datap)hHandle; /* and make it addressable */
3842
3843 if (!pData->bCreating) /* aren't we creating a new file ? */
3844 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
3845 /* must have had a MHDR first! */
3846 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
3847 MNG_ERROR (pData, MNG_NOHEADER)
3848 /* create the chunk */
3849 iRetcode = init_term (pData, &sChunkheader, &pChunk);
3850
3851 if (iRetcode) /* on error bail out */
3852 return iRetcode;
3853 /* fill the chunk */
3854 ((mng_termp)pChunk)->iTermaction = iTermaction;
3855 ((mng_termp)pChunk)->iIteraction = iIteraction;
3856 ((mng_termp)pChunk)->iDelay = iDelay;
3857 ((mng_termp)pChunk)->iItermax = iItermax;
3858
3859 add_chunk (pData, pChunk); /* add it to the list */
3860
3861#ifdef MNG_SUPPORT_TRACE
3862 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TERM, MNG_LC_END)
3863#endif
3864
3865 return MNG_NOERROR;
3866}
3867
3868/* ************************************************************************** */
3869
3870mng_retcode MNG_DECL mng_putchunk_save (mng_handle hHandle,
3871 mng_bool bEmpty,
3872 mng_uint8 iOffsettype,
3873 mng_uint32 iCount)
3874{
3875 mng_datap pData;
3876 mng_chunkp pChunk;
3877 mng_retcode iRetcode;
3878 mng_chunk_header sChunkheader =
3879 {MNG_UINT_SAVE, init_save, free_save, read_save, write_save, 0, 0};
3880
3881#ifdef MNG_SUPPORT_TRACE
3882 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SAVE, MNG_LC_START)
3883#endif
3884
3885 MNG_VALIDHANDLE (hHandle) /* check validity handle */
3886 pData = (mng_datap)hHandle; /* and make it addressable */
3887
3888 if (!pData->bCreating) /* aren't we creating a new file ? */
3889 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
3890 /* must have had a MHDR first! */
3891 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
3892 MNG_ERROR (pData, MNG_NOHEADER)
3893 /* create the chunk */
3894 iRetcode = init_save (pData, &sChunkheader, &pChunk);
3895
3896 if (iRetcode) /* on error bail out */
3897 return iRetcode;
3898 /* fill the chunk */
3899 ((mng_savep)pChunk)->bEmpty = bEmpty;
3900 ((mng_savep)pChunk)->iOffsettype = iOffsettype;
3901 ((mng_savep)pChunk)->iCount = iCount;
3902
3903 if (iCount)
3904 MNG_ALLOC (pData, ((mng_savep)pChunk)->pEntries, iCount * sizeof (mng_save_entry))
3905
3906 add_chunk (pData, pChunk); /* add it to the list */
3907
3908#ifdef MNG_SUPPORT_TRACE
3909 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SAVE, MNG_LC_END)
3910#endif
3911
3912 return MNG_NOERROR;
3913}
3914
3915/* ************************************************************************** */
3916
3917mng_retcode MNG_DECL mng_putchunk_save_entry (mng_handle hHandle,
3918 mng_uint32 iEntry,
3919 mng_uint8 iEntrytype,
3920 mng_uint32arr2 iOffset,
3921 mng_uint32arr2 iStarttime,
3922 mng_uint32 iLayernr,
3923 mng_uint32 iFramenr,
3924 mng_uint32 iNamesize,
3925 mng_pchar zName)
3926{
3927 mng_datap pData;
3928 mng_chunkp pChunk;
3929 mng_save_entryp pEntry;
3930
3931#ifdef MNG_SUPPORT_TRACE
3932 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SAVE_ENTRY, MNG_LC_START)
3933#endif
3934
3935 MNG_VALIDHANDLE (hHandle) /* check validity handle */
3936 pData = (mng_datap)hHandle; /* and make it addressable */
3937
3938 if (!pData->bCreating) /* aren't we creating a new file ? */
3939 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
3940 /* must have had a MHDR first! */
3941 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
3942 MNG_ERROR (pData, MNG_NOHEADER)
3943
3944 pChunk = pData->pLastchunk; /* last one must have been SAVE ! */
3945
3946 if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_SAVE)
3947 MNG_ERROR (pData, MNG_NOCORRCHUNK)
3948 /* index out of bounds ? */
3949 if (iEntry >= ((mng_savep)pChunk)->iCount)
3950 MNG_ERROR (pData, MNG_INVALIDENTRYIX)
3951 /* address proper entry */
3952 pEntry = ((mng_savep)pChunk)->pEntries + iEntry;
3953
3954 pEntry->iEntrytype = iEntrytype; /* fill entry */
3955 pEntry->iOffset[0] = iOffset[0];
3956 pEntry->iOffset[1] = iOffset[1];
3957 pEntry->iStarttime[0] = iStarttime[0];
3958 pEntry->iStarttime[1] = iStarttime[1];
3959 pEntry->iLayernr = iLayernr;
3960 pEntry->iFramenr = iFramenr;
3961 pEntry->iNamesize = iNamesize;
3962
3963 if (iNamesize)
3964 {
3965 MNG_ALLOC (pData, pEntry->zName, iNamesize + 1)
3966 MNG_COPY (pEntry->zName, zName, iNamesize)
3967 }
3968
3969#ifdef MNG_SUPPORT_TRACE
3970 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SAVE_ENTRY, MNG_LC_END)
3971#endif
3972
3973 return MNG_NOERROR;
3974}
3975
3976/* ************************************************************************** */
3977
3978mng_retcode MNG_DECL mng_putchunk_seek (mng_handle hHandle,
3979 mng_uint32 iNamesize,
3980 mng_pchar zName)
3981{
3982 mng_datap pData;
3983 mng_chunkp pChunk;
3984 mng_retcode iRetcode;
3985 mng_chunk_header sChunkheader =
3986 {MNG_UINT_SEEK, init_seek, free_seek, read_seek, write_seek, 0, 0};
3987
3988#ifdef MNG_SUPPORT_TRACE
3989 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SEEK, MNG_LC_START)
3990#endif
3991
3992 MNG_VALIDHANDLE (hHandle) /* check validity handle */
3993 pData = (mng_datap)hHandle; /* and make it addressable */
3994
3995 if (!pData->bCreating) /* aren't we creating a new file ? */
3996 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
3997 /* must have had a MHDR first! */
3998 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
3999 MNG_ERROR (pData, MNG_NOHEADER)
4000 /* create the chunk */
4001 iRetcode = init_seek (pData, &sChunkheader, &pChunk);
4002
4003 if (iRetcode) /* on error bail out */
4004 return iRetcode;
4005 /* fill the chunk */
4006 ((mng_seekp)pChunk)->iNamesize = iNamesize;
4007
4008 if (iNamesize)
4009 {
4010 MNG_ALLOC (pData, ((mng_seekp)pChunk)->zName, iNamesize + 1)
4011 MNG_COPY (((mng_seekp)pChunk)->zName, zName, iNamesize)
4012 }
4013
4014 add_chunk (pData, pChunk); /* add it to the list */
4015
4016#ifdef MNG_SUPPORT_TRACE
4017 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SEEK, MNG_LC_END)
4018#endif
4019
4020 return MNG_NOERROR;
4021}
4022
4023/* ************************************************************************** */
4024
4025mng_retcode MNG_DECL mng_putchunk_expi (mng_handle hHandle,
4026 mng_uint16 iSnapshotid,
4027 mng_uint32 iNamesize,
4028 mng_pchar zName)
4029{
4030 mng_datap pData;
4031 mng_chunkp pChunk;
4032 mng_retcode iRetcode;
4033 mng_chunk_header sChunkheader =
4034 {MNG_UINT_eXPI, init_expi, free_expi, read_expi, write_expi, 0, 0};
4035
4036#ifdef MNG_SUPPORT_TRACE
4037 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EXPI, MNG_LC_START)
4038#endif
4039
4040 MNG_VALIDHANDLE (hHandle) /* check validity handle */
4041 pData = (mng_datap)hHandle; /* and make it addressable */
4042
4043 if (!pData->bCreating) /* aren't we creating a new file ? */
4044 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
4045 /* must have had a MHDR first! */
4046 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
4047 MNG_ERROR (pData, MNG_NOHEADER)
4048 /* create the chunk */
4049 iRetcode = init_expi (pData, &sChunkheader, &pChunk);
4050
4051 if (iRetcode) /* on error bail out */
4052 return iRetcode;
4053 /* fill the chunk */
4054 ((mng_expip)pChunk)->iSnapshotid = iSnapshotid;
4055 ((mng_expip)pChunk)->iNamesize = iNamesize;
4056
4057 if (iNamesize)
4058 {
4059 MNG_ALLOC (pData, ((mng_expip)pChunk)->zName, iNamesize + 1)
4060 MNG_COPY (((mng_expip)pChunk)->zName, zName, iNamesize)
4061 }
4062
4063 add_chunk (pData, pChunk); /* add it to the list */
4064
4065#ifdef MNG_SUPPORT_TRACE
4066 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EXPI, MNG_LC_END)
4067#endif
4068
4069 return MNG_NOERROR;
4070}
4071
4072/* ************************************************************************** */
4073
4074mng_retcode MNG_DECL mng_putchunk_fpri (mng_handle hHandle,
4075 mng_uint8 iDeltatype,
4076 mng_uint8 iPriority)
4077{
4078 mng_datap pData;
4079 mng_chunkp pChunk;
4080 mng_retcode iRetcode;
4081 mng_chunk_header sChunkheader =
4082 {MNG_UINT_fPRI, init_fpri, free_fpri, read_fpri, write_fpri, 0, 0};
4083
4084#ifdef MNG_SUPPORT_TRACE
4085 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_FPRI, MNG_LC_START)
4086#endif
4087
4088 MNG_VALIDHANDLE (hHandle) /* check validity handle */
4089 pData = (mng_datap)hHandle; /* and make it addressable */
4090
4091 if (!pData->bCreating) /* aren't we creating a new file ? */
4092 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
4093 /* must have had a MHDR first! */
4094 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
4095 MNG_ERROR (pData, MNG_NOHEADER)
4096 /* create the chunk */
4097 iRetcode = init_fpri (pData, &sChunkheader, &pChunk);
4098
4099 if (iRetcode) /* on error bail out */
4100 return iRetcode;
4101 /* fill the chunk */
4102 ((mng_fprip)pChunk)->iDeltatype = iDeltatype;
4103 ((mng_fprip)pChunk)->iPriority = iPriority;
4104
4105 add_chunk (pData, pChunk); /* add it to the list */
4106
4107#ifdef MNG_SUPPORT_TRACE
4108 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_FPRI, MNG_LC_END)
4109#endif
4110
4111 return MNG_NOERROR;
4112}
4113
4114/* ************************************************************************** */
4115
4116mng_retcode MNG_DECL mng_putchunk_need (mng_handle hHandle,
4117 mng_uint32 iKeywordssize,
4118 mng_pchar zKeywords)
4119{
4120 mng_datap pData;
4121 mng_chunkp pChunk;
4122 mng_retcode iRetcode;
4123 mng_chunk_header sChunkheader =
4124 {MNG_UINT_nEED, init_need, free_need, read_need, write_need, 0, 0};
4125
4126#ifdef MNG_SUPPORT_TRACE
4127 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_NEED, MNG_LC_START)
4128#endif
4129
4130 MNG_VALIDHANDLE (hHandle) /* check validity handle */
4131 pData = (mng_datap)hHandle; /* and make it addressable */
4132
4133 if (!pData->bCreating) /* aren't we creating a new file ? */
4134 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
4135 /* must have had a MHDR first! */
4136 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
4137 MNG_ERROR (pData, MNG_NOHEADER)
4138 /* create the chunk */
4139 iRetcode = init_need (pData, &sChunkheader, &pChunk);
4140
4141 if (iRetcode) /* on error bail out */
4142 return iRetcode;
4143 /* fill the chunk */
4144 ((mng_needp)pChunk)->iKeywordssize = iKeywordssize;
4145
4146 if (iKeywordssize)
4147 {
4148 MNG_ALLOC (pData, ((mng_needp)pChunk)->zKeywords, iKeywordssize + 1)
4149 MNG_COPY (((mng_needp)pChunk)->zKeywords, zKeywords, iKeywordssize)
4150 }
4151
4152 add_chunk (pData, pChunk); /* add it to the list */
4153
4154#ifdef MNG_SUPPORT_TRACE
4155 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_NEED, MNG_LC_END)
4156#endif
4157
4158 return MNG_NOERROR;
4159}
4160
4161/* ************************************************************************** */
4162
4163mng_retcode MNG_DECL mng_putchunk_phyg (mng_handle hHandle,
4164 mng_bool bEmpty,
4165 mng_uint32 iSizex,
4166 mng_uint32 iSizey,
4167 mng_uint8 iUnit)
4168{
4169 mng_datap pData;
4170 mng_chunkp pChunk;
4171 mng_retcode iRetcode;
4172 mng_chunk_header sChunkheader =
4173 {MNG_UINT_pHYg, init_phyg, free_phyg, read_phyg, write_phyg, 0, 0};
4174
4175#ifdef MNG_SUPPORT_TRACE
4176 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PHYG, MNG_LC_START)
4177#endif
4178
4179 MNG_VALIDHANDLE (hHandle) /* check validity handle */
4180 pData = (mng_datap)hHandle; /* and make it addressable */
4181
4182 if (!pData->bCreating) /* aren't we creating a new file ? */
4183 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
4184 /* must have had a MHDR first! */
4185 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
4186 MNG_ERROR (pData, MNG_NOHEADER)
4187 /* create the chunk */
4188 iRetcode = init_phyg (pData, &sChunkheader, &pChunk);
4189
4190 if (iRetcode) /* on error bail out */
4191 return iRetcode;
4192 /* fill the chunk */
4193 ((mng_phygp)pChunk)->bEmpty = bEmpty;
4194 ((mng_phygp)pChunk)->iSizex = iSizex;
4195 ((mng_phygp)pChunk)->iSizey = iSizey;
4196 ((mng_phygp)pChunk)->iUnit = iUnit;
4197
4198 add_chunk (pData, pChunk); /* add it to the list */
4199
4200#ifdef MNG_SUPPORT_TRACE
4201 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PHYG, MNG_LC_END)
4202#endif
4203
4204 return MNG_NOERROR;
4205}
4206
4207/* ************************************************************************** */
4208/* B004 */
4209#ifdef MNG_INCLUDE_JNG
4210/* B004 */
4211mng_retcode MNG_DECL mng_putchunk_jhdr (mng_handle hHandle,
4212 mng_uint32 iWidth,
4213 mng_uint32 iHeight,
4214 mng_uint8 iColortype,
4215 mng_uint8 iImagesampledepth,
4216 mng_uint8 iImagecompression,
4217 mng_uint8 iImageinterlace,
4218 mng_uint8 iAlphasampledepth,
4219 mng_uint8 iAlphacompression,
4220 mng_uint8 iAlphafilter,
4221 mng_uint8 iAlphainterlace)
4222{
4223 mng_datap pData;
4224 mng_chunkp pChunk;
4225 mng_retcode iRetcode;
4226 mng_chunk_header sChunkheader =
4227 {MNG_UINT_JHDR, init_jhdr, free_jhdr, read_jhdr, write_jhdr, 0, 0};
4228
4229#ifdef MNG_SUPPORT_TRACE
4230 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JHDR, MNG_LC_START)
4231#endif
4232
4233 MNG_VALIDHANDLE (hHandle) /* check validity handle */
4234 pData = (mng_datap)hHandle; /* and make it addressable */
4235
4236 if (!pData->bCreating) /* aren't we creating a new file ? */
4237 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
4238 /* create the chunk */
4239 iRetcode = init_jhdr (pData, &sChunkheader, &pChunk);
4240
4241 if (iRetcode) /* on error bail out */
4242 return iRetcode;
4243 /* fill the chunk */
4244 ((mng_jhdrp)pChunk)->iWidth = iWidth;
4245 ((mng_jhdrp)pChunk)->iHeight = iHeight;
4246 ((mng_jhdrp)pChunk)->iColortype = iColortype;
4247 ((mng_jhdrp)pChunk)->iImagesampledepth = iImagesampledepth;
4248 ((mng_jhdrp)pChunk)->iImagecompression = iImagecompression;
4249 ((mng_jhdrp)pChunk)->iImageinterlace = iImageinterlace;
4250 ((mng_jhdrp)pChunk)->iAlphasampledepth = iAlphasampledepth;
4251 ((mng_jhdrp)pChunk)->iAlphacompression = iAlphacompression;
4252 ((mng_jhdrp)pChunk)->iAlphafilter = iAlphafilter;
4253 ((mng_jhdrp)pChunk)->iAlphainterlace = iAlphainterlace;
4254
4255 add_chunk (pData, pChunk); /* add it to the list */
4256
4257#ifdef MNG_SUPPORT_TRACE
4258 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JHDR, MNG_LC_END)
4259#endif
4260
4261 return MNG_NOERROR;
4262}
4263/* B004 */
4264#endif /* MNG_INCLUDE_JNG */
4265/* B004 */
4266/* ************************************************************************** */
4267/* B004 */
4268#ifdef MNG_INCLUDE_JNG
4269/* B004 */
4270mng_retcode MNG_DECL mng_putchunk_jdat (mng_handle hHandle,
4271 mng_uint32 iRawlen,
4272 mng_ptr pRawdata)
4273{
4274 mng_datap pData;
4275 mng_chunkp pChunk;
4276 mng_retcode iRetcode;
4277 mng_chunk_header sChunkheader =
4278 {MNG_UINT_JDAT, init_jdat, free_jdat, read_jdat, write_jdat, 0, 0};
4279
4280#ifdef MNG_SUPPORT_TRACE
4281 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JDAT, MNG_LC_START)
4282#endif
4283
4284 MNG_VALIDHANDLE (hHandle) /* check validity handle */
4285 pData = (mng_datap)hHandle; /* and make it addressable */
4286
4287 if (!pData->bCreating) /* aren't we creating a new file ? */
4288 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
4289 /* must have had a MHDR or JHDR first! */
4290 if ((pData->iFirstchunkadded != MNG_UINT_MHDR) &&
4291 (pData->iFirstchunkadded != MNG_UINT_JHDR) )
4292 MNG_ERROR (pData, MNG_NOHEADER)
4293 /* create the chunk */
4294 iRetcode = init_jdat (pData, &sChunkheader, &pChunk);
4295
4296 if (iRetcode) /* on error bail out */
4297 return iRetcode;
4298 /* fill the chunk */
4299 ((mng_jdatp)pChunk)->iDatasize = iRawlen;
4300
4301 if (iRawlen)
4302 {
4303 MNG_ALLOC (pData, ((mng_jdatp)pChunk)->pData, iRawlen)
4304 MNG_COPY (((mng_jdatp)pChunk)->pData, pRawdata, iRawlen)
4305 }
4306
4307 add_chunk (pData, pChunk); /* add it to the list */
4308
4309#ifdef MNG_SUPPORT_TRACE
4310 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JDAT, MNG_LC_END)
4311#endif
4312
4313 return MNG_NOERROR;
4314}
4315/* B004 */
4316#endif /* MNG_INCLUDE_JNG */
4317/* B004 */
4318/* ************************************************************************** */
4319/* B004 */
4320#ifdef MNG_INCLUDE_JNG
4321/* B004 */
4322mng_retcode MNG_DECL mng_putchunk_jsep (mng_handle hHandle)
4323{
4324 mng_datap pData;
4325 mng_chunkp pChunk;
4326 mng_retcode iRetcode;
4327 mng_chunk_header sChunkheader =
4328 {MNG_UINT_JSEP, init_jsep, free_jsep, read_jsep, write_jsep, 0, 0};
4329
4330#ifdef MNG_SUPPORT_TRACE
4331 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JSEP, MNG_LC_START)
4332#endif
4333
4334 MNG_VALIDHANDLE (hHandle) /* check validity handle */
4335 pData = (mng_datap)hHandle; /* and make it addressable */
4336
4337 if (!pData->bCreating) /* aren't we creating a new file ? */
4338 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
4339 /* must have had a MHDR or JHDR first! */
4340 if ((pData->iFirstchunkadded != MNG_UINT_MHDR) &&
4341 (pData->iFirstchunkadded != MNG_UINT_JHDR) )
4342 MNG_ERROR (pData, MNG_NOHEADER)
4343 /* create the chunk */
4344 iRetcode = init_jsep (pData, &sChunkheader, &pChunk);
4345
4346 if (iRetcode) /* on error bail out */
4347 return iRetcode;
4348
4349 add_chunk (pData, pChunk); /* add it to the list */
4350
4351#ifdef MNG_SUPPORT_TRACE
4352 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JSEP, MNG_LC_END)
4353#endif
4354
4355 return MNG_NOERROR;
4356}
4357/* B004 */
4358#endif /* MNG_INCLUDE_JNG */
4359/* B004 */
4360/* ************************************************************************** */
4361
4362mng_retcode MNG_DECL mng_putchunk_dhdr (mng_handle hHandle,
4363 mng_uint16 iObjectid,
4364 mng_uint8 iImagetype,
4365 mng_uint8 iDeltatype,
4366 mng_uint32 iBlockwidth,
4367 mng_uint32 iBlockheight,
4368 mng_uint32 iBlockx,
4369 mng_uint32 iBlocky)
4370{
4371 mng_datap pData;
4372 mng_chunkp pChunk;
4373 mng_retcode iRetcode;
4374 mng_chunk_header sChunkheader =
4375 {MNG_UINT_DHDR, init_dhdr, free_dhdr, read_dhdr, write_dhdr, 0, 0};
4376
4377#ifdef MNG_SUPPORT_TRACE
4378 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DHDR, MNG_LC_START)
4379#endif
4380
4381 MNG_VALIDHANDLE (hHandle) /* check validity handle */
4382 pData = (mng_datap)hHandle; /* and make it addressable */
4383
4384 if (!pData->bCreating) /* aren't we creating a new file ? */
4385 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
4386 /* must have had a MHDR first! */
4387 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
4388 MNG_ERROR (pData, MNG_NOHEADER)
4389 /* create the chunk */
4390 iRetcode = init_dhdr (pData, &sChunkheader, &pChunk);
4391
4392 if (iRetcode) /* on error bail out */
4393 return iRetcode;
4394 /* fill the chunk */
4395 ((mng_dhdrp)pChunk)->iObjectid = iObjectid;
4396 ((mng_dhdrp)pChunk)->iImagetype = iImagetype;
4397 ((mng_dhdrp)pChunk)->iDeltatype = iDeltatype;
4398 ((mng_dhdrp)pChunk)->iBlockwidth = iBlockwidth;
4399 ((mng_dhdrp)pChunk)->iBlockheight = iBlockheight;
4400 ((mng_dhdrp)pChunk)->iBlockx = iBlockx;
4401 ((mng_dhdrp)pChunk)->iBlocky = iBlocky;
4402
4403 add_chunk (pData, pChunk); /* add it to the list */
4404
4405#ifdef MNG_SUPPORT_TRACE
4406 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DHDR, MNG_LC_END)
4407#endif
4408
4409 return MNG_NOERROR;
4410}
4411
4412/* ************************************************************************** */
4413
4414mng_retcode MNG_DECL mng_putchunk_prom (mng_handle hHandle,
4415 mng_uint8 iColortype,
4416 mng_uint8 iSampledepth,
4417 mng_uint8 iFilltype)
4418{
4419 mng_datap pData;
4420 mng_chunkp pChunk;
4421 mng_retcode iRetcode;
4422 mng_chunk_header sChunkheader =
4423 {MNG_UINT_PROM, init_prom, free_prom, read_prom, write_prom, 0, 0};
4424
4425#ifdef MNG_SUPPORT_TRACE
4426 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PROM, MNG_LC_START)
4427#endif
4428
4429 MNG_VALIDHANDLE (hHandle) /* check validity handle */
4430 pData = (mng_datap)hHandle; /* and make it addressable */
4431
4432 if (!pData->bCreating) /* aren't we creating a new file ? */
4433 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
4434 /* must have had a MHDR first! */
4435 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
4436 MNG_ERROR (pData, MNG_NOHEADER)
4437 /* create the chunk */
4438 iRetcode = init_prom (pData, &sChunkheader, &pChunk);
4439
4440 if (iRetcode) /* on error bail out */
4441 return iRetcode;
4442 /* fill the chunk */
4443 ((mng_promp)pChunk)->iColortype = iColortype;
4444 ((mng_promp)pChunk)->iSampledepth = iSampledepth;
4445 ((mng_promp)pChunk)->iFilltype = iFilltype;
4446
4447 add_chunk (pData, pChunk); /* add it to the list */
4448
4449#ifdef MNG_SUPPORT_TRACE
4450 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PROM, MNG_LC_END)
4451#endif
4452
4453 return MNG_NOERROR;
4454}
4455
4456/* ************************************************************************** */
4457
4458mng_retcode MNG_DECL mng_putchunk_ipng (mng_handle hHandle)
4459{
4460 mng_datap pData;
4461 mng_chunkp pChunk;
4462 mng_retcode iRetcode;
4463 mng_chunk_header sChunkheader =
4464 {MNG_UINT_IPNG, init_ipng, free_ipng, read_ipng, write_ipng, 0, 0};
4465
4466#ifdef MNG_SUPPORT_TRACE
4467 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IPNG, MNG_LC_START)
4468#endif
4469
4470 MNG_VALIDHANDLE (hHandle) /* check validity handle */
4471 pData = (mng_datap)hHandle; /* and make it addressable */
4472
4473 if (!pData->bCreating) /* aren't we creating a new file ? */
4474 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
4475 /* must have had a MHDR first! */
4476 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
4477 MNG_ERROR (pData, MNG_NOHEADER)
4478 /* create the chunk */
4479 iRetcode = init_ipng (pData, &sChunkheader, &pChunk);
4480
4481 if (iRetcode) /* on error bail out */
4482 return iRetcode;
4483
4484 add_chunk (pData, pChunk); /* add it to the list */
4485
4486#ifdef MNG_SUPPORT_TRACE
4487 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IPNG, MNG_LC_END)
4488#endif
4489
4490 return MNG_NOERROR;
4491}
4492
4493/* ************************************************************************** */
4494
4495mng_retcode MNG_DECL mng_putchunk_pplt (mng_handle hHandle,
4496 mng_uint32 iCount)
4497{
4498 mng_datap pData;
4499 mng_chunkp pChunk;
4500 mng_retcode iRetcode;
4501 mng_chunk_header sChunkheader =
4502 {MNG_UINT_PPLT, init_pplt, free_pplt, read_pplt, write_pplt, 0, 0};
4503
4504#ifdef MNG_SUPPORT_TRACE
4505 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PPLT, MNG_LC_START)
4506#endif
4507
4508 MNG_VALIDHANDLE (hHandle) /* check validity handle */
4509 pData = (mng_datap)hHandle; /* and make it addressable */
4510
4511 if (!pData->bCreating) /* aren't we creating a new file ? */
4512 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
4513 /* must have had a MHDR first! */
4514 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
4515 MNG_ERROR (pData, MNG_NOHEADER)
4516 /* create the chunk */
4517 iRetcode = init_pplt (pData, &sChunkheader, &pChunk);
4518
4519 if (iRetcode) /* on error bail out */
4520 return iRetcode;
4521 /* fill the chunk */
4522 ((mng_ppltp)pChunk)->iCount = iCount;
4523
4524 add_chunk (pData, pChunk); /* add it to the list */
4525
4526#ifdef MNG_SUPPORT_TRACE
4527 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PPLT, MNG_LC_END)
4528#endif
4529
4530 return MNG_NOERROR;
4531}
4532
4533/* ************************************************************************** */
4534
4535mng_retcode MNG_DECL mng_putchunk_pplt_entry (mng_handle hHandle,
4536 mng_uint32 iEntry,
4537 mng_uint16 iRed,
4538 mng_uint16 iGreen,
4539 mng_uint16 iBlue,
4540 mng_uint16 iAlpha,
4541 mng_bool bUsed)
4542{
4543 mng_datap pData;
4544 mng_chunkp pChunk;
4545 mng_pplt_entryp pEntry;
4546
4547#ifdef MNG_SUPPORT_TRACE
4548 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PPLT_ENTRY, MNG_LC_START)
4549#endif
4550
4551 MNG_VALIDHANDLE (hHandle) /* check validity handle */
4552 pData = (mng_datap)hHandle; /* and make it addressable */
4553
4554 if (!pData->bCreating) /* aren't we creating a new file ? */
4555 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
4556 /* must have had a MHDR first! */
4557 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
4558 MNG_ERROR (pData, MNG_NOHEADER)
4559
4560 pChunk = pData->pLastchunk; /* last one must have been PPLT ! */
4561
4562 if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_PPLT)
4563 MNG_ERROR (pData, MNG_NOCORRCHUNK)
4564
4565 /* index out of bounds ? */
4566 if (iEntry >= ((mng_ppltp)pChunk)->iCount)
4567 MNG_ERROR (pData, MNG_INVALIDENTRYIX)
4568 /* address proper entry */
4569 pEntry = (mng_pplt_entryp)(((mng_ppltp)pChunk)->aEntries) + iEntry;
4570
4571 pEntry->iRed = (mng_uint8)iRed; /* fill the entry */
4572 pEntry->iGreen = (mng_uint8)iGreen;
4573 pEntry->iBlue = (mng_uint8)iBlue;
4574 pEntry->iAlpha = (mng_uint8)iAlpha;
4575 pEntry->bUsed = bUsed;
4576
4577#ifdef MNG_SUPPORT_TRACE
4578 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PPLT_ENTRY, MNG_LC_END)
4579#endif
4580
4581 return MNG_NOERROR;
4582}
4583
4584/* ************************************************************************** */
4585
4586mng_retcode MNG_DECL mng_putchunk_ijng (mng_handle hHandle)
4587{
4588 mng_datap pData;
4589 mng_chunkp pChunk;
4590 mng_retcode iRetcode;
4591 mng_chunk_header sChunkheader =
4592 {MNG_UINT_IJNG, init_ijng, free_ijng, read_ijng, write_ijng, 0, 0};
4593
4594#ifdef MNG_SUPPORT_TRACE
4595 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IJNG, MNG_LC_START)
4596#endif
4597
4598 MNG_VALIDHANDLE (hHandle) /* check validity handle */
4599 pData = (mng_datap)hHandle; /* and make it addressable */
4600
4601 if (!pData->bCreating) /* aren't we creating a new file ? */
4602 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
4603 /* must have had a MHDR first! */
4604 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
4605 MNG_ERROR (pData, MNG_NOHEADER)
4606 /* create the chunk */
4607 iRetcode = init_ijng (pData, &sChunkheader, &pChunk);
4608
4609 if (iRetcode) /* on error bail out */
4610 return iRetcode;
4611
4612 add_chunk (pData, pChunk); /* add it to the list */
4613
4614#ifdef MNG_SUPPORT_TRACE
4615 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IJNG, MNG_LC_END)
4616#endif
4617
4618 return MNG_NOERROR;
4619}
4620
4621/* ************************************************************************** */
4622
4623mng_retcode MNG_DECL mng_putchunk_drop (mng_handle hHandle,
4624 mng_uint32 iCount,
4625 mng_chunkidp pChunknames)
4626{
4627 mng_datap pData;
4628 mng_chunkp pChunk;
4629 mng_retcode iRetcode;
4630 mng_chunk_header sChunkheader =
4631 {MNG_UINT_DROP, init_drop, free_drop, read_drop, write_drop, 0, 0};
4632
4633#ifdef MNG_SUPPORT_TRACE
4634 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DROP, MNG_LC_START)
4635#endif
4636
4637 MNG_VALIDHANDLE (hHandle) /* check validity handle */
4638 pData = (mng_datap)hHandle; /* and make it addressable */
4639
4640 if (!pData->bCreating) /* aren't we creating a new file ? */
4641 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
4642 /* must have had a MHDR first! */
4643 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
4644 MNG_ERROR (pData, MNG_NOHEADER)
4645 /* create the chunk */
4646 iRetcode = init_drop (pData, &sChunkheader, &pChunk);
4647
4648 if (iRetcode) /* on error bail out */
4649 return iRetcode;
4650 /* fill the chunk */
4651 ((mng_dropp)pChunk)->iCount = iCount;
4652
4653 if (iCount)
4654 {
4655 mng_uint32 iSize = iCount * sizeof (mng_chunkid);
4656
4657 MNG_ALLOC (pData, ((mng_dropp)pChunk)->pChunknames, iSize)
4658 MNG_COPY (((mng_dropp)pChunk)->pChunknames, pChunknames, iSize)
4659 }
4660
4661 add_chunk (pData, pChunk); /* add it to the list */
4662
4663#ifdef MNG_SUPPORT_TRACE
4664 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DROP, MNG_LC_END)
4665#endif
4666
4667 return MNG_NOERROR;
4668}
4669
4670/* ************************************************************************** */
4671
4672mng_retcode MNG_DECL mng_putchunk_dbyk (mng_handle hHandle,
4673 mng_chunkid iChunkname,
4674 mng_uint8 iPolarity,
4675 mng_uint32 iKeywordssize,
4676 mng_pchar zKeywords)
4677{
4678 mng_datap pData;
4679 mng_chunkp pChunk;
4680 mng_retcode iRetcode;
4681 mng_chunk_header sChunkheader =
4682 {MNG_UINT_DBYK, init_dbyk, free_dbyk, read_dbyk, write_dbyk, 0, 0};
4683
4684#ifdef MNG_SUPPORT_TRACE
4685 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DBYK, MNG_LC_START)
4686#endif
4687
4688 MNG_VALIDHANDLE (hHandle) /* check validity handle */
4689 pData = (mng_datap)hHandle; /* and make it addressable */
4690
4691 if (!pData->bCreating) /* aren't we creating a new file ? */
4692 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
4693 /* must have had a MHDR first! */
4694 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
4695 MNG_ERROR (pData, MNG_NOHEADER)
4696 /* create the chunk */
4697 iRetcode = init_dbyk (pData, &sChunkheader, &pChunk);
4698
4699 if (iRetcode) /* on error bail out */
4700 return iRetcode;
4701 /* fill the chunk */
4702 ((mng_dbykp)pChunk)->iChunkname = iChunkname;
4703 ((mng_dbykp)pChunk)->iPolarity = iPolarity;
4704 ((mng_dbykp)pChunk)->iKeywordssize = iKeywordssize;
4705
4706 if (iKeywordssize)
4707 {
4708 MNG_ALLOC (pData, ((mng_dbykp)pChunk)->zKeywords, iKeywordssize + 1)
4709 MNG_COPY (((mng_dbykp)pChunk)->zKeywords, zKeywords, iKeywordssize)
4710 }
4711
4712 add_chunk (pData, pChunk); /* add it to the list */
4713
4714#ifdef MNG_SUPPORT_TRACE
4715 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DBYK, MNG_LC_END)
4716#endif
4717
4718 return MNG_NOERROR;
4719}
4720
4721/* ************************************************************************** */
4722
4723mng_retcode MNG_DECL mng_putchunk_ordr (mng_handle hHandle,
4724 mng_uint32 iCount)
4725{
4726 mng_datap pData;
4727 mng_chunkp pChunk;
4728 mng_retcode iRetcode;
4729 mng_chunk_header sChunkheader =
4730 {MNG_UINT_ORDR, init_ordr, free_ordr, read_ordr, write_ordr, 0, 0};
4731
4732#ifdef MNG_SUPPORT_TRACE
4733 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ORDR, MNG_LC_START)
4734#endif
4735
4736 MNG_VALIDHANDLE (hHandle) /* check validity handle */
4737 pData = (mng_datap)hHandle; /* and make it addressable */
4738
4739 if (!pData->bCreating) /* aren't we creating a new file ? */
4740 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
4741 /* must have had a MHDR first! */
4742 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
4743 MNG_ERROR (pData, MNG_NOHEADER)
4744 /* create the chunk */
4745 iRetcode = init_ordr (pData, &sChunkheader, &pChunk);
4746
4747 if (iRetcode) /* on error bail out */
4748 return iRetcode;
4749 /* fill the chunk */
4750 ((mng_ordrp)pChunk)->iCount = iCount;
4751
4752 if (iCount)
4753 MNG_ALLOC (pData, ((mng_ordrp)pChunk)->pEntries, iCount * sizeof (mng_ordr_entry))
4754
4755 add_chunk (pData, pChunk); /* add it to the list */
4756
4757#ifdef MNG_SUPPORT_TRACE
4758 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ORDR, MNG_LC_END)
4759#endif
4760
4761 return MNG_NOERROR;
4762}
4763
4764/* ************************************************************************** */
4765
4766mng_retcode MNG_DECL mng_putchunk_ordr_entry (mng_handle hHandle,
4767 mng_uint32 iEntry,
4768 mng_chunkid iChunkname,
4769 mng_uint8 iOrdertype)
4770{
4771 mng_datap pData;
4772 mng_chunkp pChunk;
4773 mng_ordr_entryp pEntry;
4774
4775#ifdef MNG_SUPPORT_TRACE
4776 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ORDR_ENTRY, MNG_LC_START)
4777#endif
4778
4779 MNG_VALIDHANDLE (hHandle) /* check validity handle */
4780 pData = (mng_datap)hHandle; /* and make it addressable */
4781
4782 if (!pData->bCreating) /* aren't we creating a new file ? */
4783 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
4784 /* must have had a MHDR first! */
4785 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
4786 MNG_ERROR (pData, MNG_NOHEADER)
4787
4788 pChunk = pData->pLastchunk; /* last one must have been ORDR ! */
4789
4790 if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_ORDR)
4791 MNG_ERROR (pData, MNG_NOCORRCHUNK)
4792 /* index out of bounds ? */
4793 if (iEntry >= ((mng_ordrp)pChunk)->iCount)
4794 MNG_ERROR (pData, MNG_INVALIDENTRYIX)
4795 /* address proper entry */
4796 pEntry = ((mng_ordrp)pChunk)->pEntries + iEntry;
4797
4798 pEntry->iChunkname = iChunkname; /* fill the entry */
4799 pEntry->iOrdertype = iOrdertype;
4800
4801#ifdef MNG_SUPPORT_TRACE
4802 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ORDR_ENTRY, MNG_LC_END)
4803#endif
4804
4805 return MNG_NOERROR;
4806}
4807
4808/* ************************************************************************** */
4809
4810mng_retcode MNG_DECL mng_putchunk_magn (mng_handle hHandle,
4811 mng_uint16 iFirstid,
4812 mng_uint16 iLastid,
4813 mng_uint16 iMethodX,
4814 mng_uint16 iMX,
4815 mng_uint16 iMY,
4816 mng_uint16 iML,
4817 mng_uint16 iMR,
4818 mng_uint16 iMT,
4819 mng_uint16 iMB,
4820 mng_uint16 iMethodY)
4821{
4822 mng_datap pData;
4823 mng_chunkp pChunk;
4824 mng_retcode iRetcode;
4825 mng_chunk_header sChunkheader =
4826 {MNG_UINT_MAGN, init_magn, free_magn, read_magn, write_magn, 0, 0};
4827
4828#ifdef MNG_SUPPORT_TRACE
4829 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MAGN, MNG_LC_START)
4830#endif
4831
4832 MNG_VALIDHANDLE (hHandle) /* check validity handle */
4833 pData = (mng_datap)hHandle; /* and make it addressable */
4834
4835 if (!pData->bCreating) /* aren't we creating a new file ? */
4836 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
4837 /* must have had a MHDR first! */
4838 if (pData->iFirstchunkadded != MNG_UINT_MHDR)
4839 MNG_ERROR (pData, MNG_NOHEADER)
4840 /* create the chunk */
4841 iRetcode = init_magn (pData, &sChunkheader, &pChunk);
4842
4843 if (iRetcode) /* on error bail out */
4844 return iRetcode;
4845 /* fill the chunk */
4846 ((mng_magnp)pChunk)->iFirstid = iFirstid;
4847 ((mng_magnp)pChunk)->iLastid = iLastid;
4848 ((mng_magnp)pChunk)->iMethodX = iMethodX;
4849 ((mng_magnp)pChunk)->iMX = iMX;
4850 ((mng_magnp)pChunk)->iMY = iMY;
4851 ((mng_magnp)pChunk)->iML = iML;
4852 ((mng_magnp)pChunk)->iMR = iMR;
4853 ((mng_magnp)pChunk)->iMT = iMT;
4854 ((mng_magnp)pChunk)->iMB = iMB;
4855 ((mng_magnp)pChunk)->iMethodY = iMethodY;
4856
4857 add_chunk (pData, pChunk); /* add it to the list */
4858
4859#ifdef MNG_SUPPORT_TRACE
4860 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MAGN, MNG_LC_END)
4861#endif
4862
4863 return MNG_NOERROR;
4864}
4865
4866/* ************************************************************************** */
4867
4868mng_retcode MNG_DECL mng_putchunk_unknown (mng_handle hHandle,
4869 mng_chunkid iChunkname,
4870 mng_uint32 iRawlen,
4871 mng_ptr pRawdata)
4872{
4873 mng_datap pData;
4874 mng_chunkp pChunk;
4875 mng_retcode iRetcode;
4876 mng_chunk_header sChunkheader =
4877 {MNG_UINT_HUH, init_unknown, free_unknown, read_unknown, write_unknown, 0, 0};
4878
4879#ifdef MNG_SUPPORT_TRACE
4880 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_UNKNOWN, MNG_LC_START)
4881#endif
4882
4883 MNG_VALIDHANDLE (hHandle) /* check validity handle */
4884 pData = (mng_datap)hHandle; /* and make it addressable */
4885
4886 if (!pData->bCreating) /* aren't we creating a new file ? */
4887 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
4888 /* must have had a header first! */
4889 if (pData->iFirstchunkadded == 0)
4890 MNG_ERROR (pData, MNG_NOHEADER)
4891 /* create the chunk */
4892 iRetcode = init_unknown (pData, &sChunkheader, &pChunk);
4893
4894 if (iRetcode) /* on error bail out */
4895 return iRetcode;
4896 /* fill the chunk */
4897 ((mng_unknown_chunkp)pChunk)->sHeader.iChunkname = iChunkname;
4898 ((mng_unknown_chunkp)pChunk)->iDatasize = iRawlen;
4899
4900 if (iRawlen)
4901 {
4902 MNG_ALLOC (pData, ((mng_unknown_chunkp)pChunk)->pData, iRawlen)
4903 MNG_COPY (((mng_unknown_chunkp)pChunk)->pData, pRawdata, iRawlen)
4904 }
4905
4906 add_chunk (pData, pChunk); /* add it to the list */
4907
4908#ifdef MNG_SUPPORT_TRACE
4909 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_UNKNOWN, MNG_LC_END)
4910#endif
4911
4912 return MNG_NOERROR;
4913}
4914
4915/* ************************************************************************** */
4916/* B004 */
4917#endif /* MNG_INCLUDE_WRITE_PROCS */
4918/* B004 */
4919/* ************************************************************************** */
4920/* ************************************************************************** */
4921
4922mng_retcode MNG_DECL mng_getimgdata_seq (mng_handle hHandle,
4923 mng_uint32 iSeqnr,
4924 mng_uint32 iCanvasstyle,
4925 mng_getcanvasline fGetcanvasline)
4926{
4927#ifdef MNG_SUPPORT_TRACE
4928 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_SEQ, MNG_LC_START)
4929#endif
4930
4931
4932
4933#ifdef MNG_SUPPORT_TRACE
4934 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_SEQ, MNG_LC_END)
4935#endif
4936
4937 return MNG_NOERROR;
4938}
4939
4940/* ************************************************************************** */
4941
4942mng_retcode MNG_DECL mng_getimgdata_chunkseq (mng_handle hHandle,
4943 mng_uint32 iSeqnr,
4944 mng_uint32 iCanvasstyle,
4945 mng_getcanvasline fGetcanvasline)
4946{
4947#ifdef MNG_SUPPORT_TRACE
4948 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_CHUNKSEQ, MNG_LC_START)
4949#endif
4950
4951
4952
4953#ifdef MNG_SUPPORT_TRACE
4954 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_CHUNKSEQ, MNG_LC_END)
4955#endif
4956
4957 return MNG_NOERROR;
4958}
4959
4960/* ************************************************************************** */
4961
4962mng_retcode MNG_DECL mng_getimgdata_chunk (mng_handle hHandle,
4963 mng_handle hChunk,
4964 mng_uint32 iCanvasstyle,
4965 mng_getcanvasline fGetcanvasline)
4966{
4967#ifdef MNG_SUPPORT_TRACE
4968 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_CHUNK, MNG_LC_START)
4969#endif
4970
4971
4972
4973#ifdef MNG_SUPPORT_TRACE
4974 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_CHUNK, MNG_LC_END)
4975#endif
4976
4977 return MNG_NOERROR;
4978}
4979
4980/* ************************************************************************** */
4981/* ************************************************************************** */
4982/* B004 */
4983#ifdef MNG_INCLUDE_WRITE_PROCS
4984/* B004 */
4985/* ************************************************************************** */
4986
4987mng_retcode MNG_DECL mng_putimgdata_ihdr (mng_handle hHandle,
4988 mng_uint32 iWidth,
4989 mng_uint32 iHeight,
4990 mng_uint8 iColortype,
4991 mng_uint8 iBitdepth,
4992 mng_uint8 iCompression,
4993 mng_uint8 iFilter,
4994 mng_uint8 iInterlace,
4995 mng_uint32 iCanvasstyle,
4996 mng_getcanvasline fGetcanvasline)
4997{
4998#ifdef MNG_SUPPORT_TRACE
4999 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTIMGDATA_IHDR, MNG_LC_START)
5000#endif
5001
5002
5003
5004#ifdef MNG_SUPPORT_TRACE
5005 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTIMGDATA_IHDR, MNG_LC_END)
5006#endif
5007
5008 return MNG_NOERROR;
5009}
5010
5011/* ************************************************************************** */
5012
5013mng_retcode MNG_DECL mng_putimgdata_jhdr (mng_handle hHandle,
5014 mng_uint32 iWidth,
5015 mng_uint32 iHeight,
5016 mng_uint8 iColortype,
5017 mng_uint8 iBitdepth,
5018 mng_uint8 iCompression,
5019 mng_uint8 iInterlace,
5020 mng_uint8 iAlphaBitdepth,
5021 mng_uint8 iAlphaCompression,
5022 mng_uint8 iAlphaFilter,
5023 mng_uint8 iAlphaInterlace,
5024 mng_uint32 iCanvasstyle,
5025 mng_getcanvasline fGetcanvasline)
5026{
5027#ifdef MNG_SUPPORT_TRACE
5028 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTIMGDATA_JHDR, MNG_LC_START)
5029#endif
5030
5031
5032
5033#ifdef MNG_SUPPORT_TRACE
5034 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTIMGDATA_JHDR, MNG_LC_END)
5035#endif
5036
5037 return MNG_NOERROR;
5038}
5039
5040/* ************************************************************************** */
5041
5042mng_retcode MNG_DECL mng_updatemngheader (mng_handle hHandle,
5043 mng_uint32 iFramecount,
5044 mng_uint32 iLayercount,
5045 mng_uint32 iPlaytime)
5046{
5047 mng_datap pData;
5048 mng_chunkp pChunk;
5049
5050#ifdef MNG_SUPPORT_TRACE
5051 MNG_TRACE (((mng_datap)hHandle), MNG_FN_UPDATEMNGHEADER, MNG_LC_START)
5052#endif
5053
5054 MNG_VALIDHANDLE (hHandle) /* check validity handle */
5055 pData = (mng_datap)hHandle; /* and make it addressable */
5056
5057 if (!pData->bCreating) /* aren't we creating a new file ? */
5058 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
5059 /* must be a MNG animation! */
5060 if ((pData->eImagetype != mng_it_mng) || (pData->iFirstchunkadded != MNG_UINT_MHDR))
5061 MNG_ERROR (pData, MNG_NOMHDR)
5062
5063 pChunk = pData->pFirstchunk; /* get the first chunk */
5064 /* and update the variables */
5065 ((mng_mhdrp)pChunk)->iFramecount = iFramecount;
5066 ((mng_mhdrp)pChunk)->iLayercount = iLayercount;
5067 ((mng_mhdrp)pChunk)->iPlaytime = iPlaytime;
5068
5069#ifdef MNG_SUPPORT_TRACE
5070 MNG_TRACE (((mng_datap)hHandle), MNG_FN_UPDATEMNGHEADER, MNG_LC_END)
5071#endif
5072
5073 return MNG_NOERROR;
5074}
5075
5076/* ************************************************************************** */
5077
5078mng_retcode MNG_DECL mng_updatemngsimplicity (mng_handle hHandle,
5079 mng_uint32 iSimplicity)
5080{
5081 mng_datap pData;
5082 mng_chunkp pChunk;
5083
5084#ifdef MNG_SUPPORT_TRACE
5085 MNG_TRACE (((mng_datap)hHandle), MNG_FN_UPDATEMNGSIMPLICITY, MNG_LC_START)
5086#endif
5087
5088 MNG_VALIDHANDLE (hHandle) /* check validity handle */
5089 pData = (mng_datap)hHandle; /* and make it addressable */
5090
5091 if (!pData->bCreating) /* aren't we creating a new file ? */
5092 MNG_ERROR (pData, MNG_FUNCTIONINVALID)
5093 /* must be a MNG animation! */
5094 if ((pData->eImagetype != mng_it_mng) || (pData->iFirstchunkadded != MNG_UINT_MHDR))
5095 MNG_ERROR (pData, MNG_NOMHDR)
5096
5097 pChunk = pData->pFirstchunk; /* get the first chunk */
5098 /* and update the variable */
5099 ((mng_mhdrp)pChunk)->iSimplicity = iSimplicity;
5100
5101#ifdef MNG_SUPPORT_TRACE
5102 MNG_TRACE (((mng_datap)hHandle), MNG_FN_UPDATEMNGSIMPLICITY, MNG_LC_END)
5103#endif
5104
5105 return MNG_NOERROR;
5106}
5107
5108/* ************************************************************************** */
5109/* B004 */
5110#endif /* MNG_INCLUDE_WRITE_PROCS */
5111/* B004 */
5112/* ************************************************************************** */
5113
5114#endif /* MNG_ACCESS_CHUNKS */
5115
5116/* ************************************************************************** */
5117/* * end of file * */
5118/* ************************************************************************** */
5119
Note: See TracBrowser for help on using the repository browser.