|
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-2007 G.Juyn * */ |
|
8 /* * version : 1.0.10 * */ |
|
9 /* * * */ |
|
10 /* * purpose : chunk access functions (implementation) * */ |
|
11 /* * * */ |
|
12 /* * author : G.Juyn * */ |
|
13 /* * * */ |
|
14 /* * comment : implementation of the chunk access functions * */ |
|
15 /* * * */ |
|
16 /* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */ |
|
17 /* * - changed and filled iterate-chunk function * */ |
|
18 /* * 0.5.1 - 05/08/2000 - G.Juyn * */ |
|
19 /* * - fixed calling convention * */ |
|
20 /* * - added getchunk functions * */ |
|
21 /* * - added putchunk functions * */ |
|
22 /* * - changed strict-ANSI stuff * */ |
|
23 /* * 0.5.1 - 05/11/2000 - G.Juyn * */ |
|
24 /* * - added empty-chunk put-routines * */ |
|
25 /* * 0.5.1 - 05/12/2000 - G.Juyn * */ |
|
26 /* * - changed trace to macro for callback error-reporting * */ |
|
27 /* * 0.5.1 - 05/15/2000 - G.Juyn * */ |
|
28 /* * - added getimgdata & putimgdata functions * */ |
|
29 /* * * */ |
|
30 /* * 0.5.2 - 05/19/2000 - G.Juyn * */ |
|
31 /* * - B004 - fixed problem with MNG_SUPPORT_WRITE not defined * */ |
|
32 /* * also for MNG_SUPPORT_WRITE without MNG_INCLUDE_JNG * */ |
|
33 /* * - Cleaned up some code regarding mixed support * */ |
|
34 /* * * */ |
|
35 /* * 0.9.1 - 07/19/2000 - G.Juyn * */ |
|
36 /* * - fixed creation-code * */ |
|
37 /* * * */ |
|
38 /* * 0.9.2 - 08/05/2000 - G.Juyn * */ |
|
39 /* * - changed file-prefixes * */ |
|
40 /* * - added function to set simplicity field * */ |
|
41 /* * - fixed putchunk_unknown() function * */ |
|
42 /* * * */ |
|
43 /* * 0.9.3 - 08/07/2000 - G.Juyn * */ |
|
44 /* * - B111300 - fixup for improved portability * */ |
|
45 /* * 0.9.3 - 08/26/2000 - G.Juyn * */ |
|
46 /* * - added MAGN chunk * */ |
|
47 /* * 0.9.3 - 10/20/2000 - G.Juyn * */ |
|
48 /* * - fixed putchunk_plte() to set bEmpty parameter * */ |
|
49 /* * * */ |
|
50 /* * 0.9.5 - 01/25/2001 - G.Juyn * */ |
|
51 /* * - fixed some small compiler warnings (thanks Nikki) * */ |
|
52 /* * * */ |
|
53 /* * 1.0.5 - 09/07/2002 - G.Juyn * */ |
|
54 /* * - B578940 - unimplemented functions return errorcode * */ |
|
55 /* * 1.0.5 - 08/19/2002 - G.Juyn * */ |
|
56 /* * - B597134 - libmng pollutes the linker namespace * */ |
|
57 /* * - added HLAPI function to copy chunks * */ |
|
58 /* * 1.0.5 - 09/14/2002 - G.Juyn * */ |
|
59 /* * - added event handling for dynamic MNG * */ |
|
60 /* * 1.0.5 - 10/07/2002 - G.Juyn * */ |
|
61 /* * - added check for TERM placement during create/write * */ |
|
62 /* * 1.0.5 - 11/28/2002 - G.Juyn * */ |
|
63 /* * - fixed definition of iMethodX/Y for MAGN chunk * */ |
|
64 /* * * */ |
|
65 /* * 1.0.6 - 05/25/2003 - G.R-P * */ |
|
66 /* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */ |
|
67 /* * 1.0.6 - 07/07/2003 - G.R-P * */ |
|
68 /* * - added MNG_NO_DELTA_PNG reduction and more SKIPCHUNK * */ |
|
69 /* * optimizations * */ |
|
70 /* * 1.0.6 - 07/29/2003 - G.R-P * */ |
|
71 /* * - added conditionals around PAST chunk support * */ |
|
72 /* * 1.0.6 - 08/17/2003 - G.R-P * */ |
|
73 /* * - added conditionals around non-VLC chunk support * */ |
|
74 /* * * */ |
|
75 /* * 1.0.8 - 04/01/2004 - G.Juyn * */ |
|
76 /* * - added missing get-/put-chunk-jdaa * */ |
|
77 /* * 1.0.8 - 08/02/2004 - G.Juyn * */ |
|
78 /* * - added conditional to allow easier writing of large MNG's * */ |
|
79 /* * * */ |
|
80 /* * 1.0.9 - 09/17/2004 - G.R-P * */ |
|
81 /* * - added two more conditionals * */ |
|
82 /* * 1.0.9 - 09/25/2004 - G.Juyn * */ |
|
83 /* * - replaced MNG_TWEAK_LARGE_FILES with permanent solution * */ |
|
84 /* * 1.0.9 - 17/14/2004 - G.Juyn * */ |
|
85 /* * - fixed PPLT getchunk/putchunk routines * */ |
|
86 /* * 1.0.9 - 12/05/2004 - G.Juyn * */ |
|
87 /* * - added conditional MNG_OPTIMIZE_CHUNKINITFREE * */ |
|
88 /* * 1.0.9 - 12/20/2004 - G.Juyn * */ |
|
89 /* * - cleaned up macro-invocations (thanks to D. Airlie) * */ |
|
90 /* * * */ |
|
91 /* * 1.0.10 - 04/08/2007 - G.Juyn * */ |
|
92 /* * - added support for mPNG proposal * */ |
|
93 /* * * */ |
|
94 /* ************************************************************************** */ |
|
95 |
|
96 #include "libmng.h" |
|
97 #include "libmng_data.h" |
|
98 #include "libmng_error.h" |
|
99 #include "libmng_trace.h" |
|
100 #ifdef __BORLANDC__ |
|
101 #pragma hdrstop |
|
102 #endif |
|
103 #include "libmng_memory.h" |
|
104 #include "libmng_chunks.h" |
|
105 #ifdef MNG_OPTIMIZE_CHUNKREADER |
|
106 #include "libmng_chunk_descr.h" |
|
107 #endif |
|
108 #include "libmng_chunk_prc.h" |
|
109 #include "libmng_chunk_io.h" |
|
110 |
|
111 #if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) |
|
112 #pragma option -A /* force ANSI-C */ |
|
113 #endif |
|
114 |
|
115 /* ************************************************************************** */ |
|
116 |
|
117 #ifdef MNG_ACCESS_CHUNKS |
|
118 |
|
119 /* ************************************************************************** */ |
|
120 |
|
121 mng_retcode MNG_DECL mng_iterate_chunks (mng_handle hHandle, |
|
122 mng_uint32 iChunkseq, |
|
123 mng_iteratechunk fProc) |
|
124 { |
|
125 mng_uint32 iSeq; |
|
126 mng_chunkid iChunkname; |
|
127 mng_datap pData; |
|
128 mng_chunkp pChunk; |
|
129 mng_bool bCont; |
|
130 |
|
131 #ifdef MNG_SUPPORT_TRACE |
|
132 MNG_TRACE (((mng_datap)hHandle), MNG_FN_ITERATE_CHUNKS, MNG_LC_START); |
|
133 #endif |
|
134 |
|
135 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
136 pData = ((mng_datap)hHandle); /* and make it addressable */ |
|
137 |
|
138 iSeq = 0; |
|
139 bCont = MNG_TRUE; |
|
140 pChunk = pData->pFirstchunk; /* get the first chunk */ |
|
141 /* as long as there are some more */ |
|
142 while ((pChunk) && (bCont)) /* and the app didn't signal a stop */ |
|
143 { |
|
144 if (iSeq >= iChunkseq) /* reached the first target ? */ |
|
145 { /* then call this and next ones back in... */ |
|
146 iChunkname = ((mng_chunk_headerp)pChunk)->iChunkname; |
|
147 bCont = fProc (hHandle, (mng_handle)pChunk, iChunkname, iSeq); |
|
148 } |
|
149 |
|
150 iSeq++; /* next one */ |
|
151 pChunk = ((mng_chunk_headerp)pChunk)->pNext; |
|
152 } |
|
153 |
|
154 #ifdef MNG_SUPPORT_TRACE |
|
155 MNG_TRACE (((mng_datap)hHandle), MNG_FN_ITERATE_CHUNKS, MNG_LC_END); |
|
156 #endif |
|
157 |
|
158 return MNG_NOERROR; |
|
159 } |
|
160 |
|
161 /* ************************************************************************** */ |
|
162 |
|
163 #ifdef MNG_SUPPORT_WRITE |
|
164 mng_retcode MNG_DECL mng_copy_chunk (mng_handle hHandle, |
|
165 mng_handle hChunk, |
|
166 mng_handle hHandleOut) |
|
167 { |
|
168 mng_datap pDataOut; |
|
169 mng_chunkp pChunk; |
|
170 mng_chunkp pChunkOut; |
|
171 mng_retcode iRetcode; |
|
172 |
|
173 #ifdef MNG_SUPPORT_TRACE |
|
174 MNG_TRACE (((mng_datap)hHandle), MNG_FN_COPY_CHUNK, MNG_LC_START); |
|
175 #endif |
|
176 |
|
177 MNG_VALIDHANDLE (hHandle) /* check validity handles */ |
|
178 MNG_VALIDHANDLE (hHandleOut) |
|
179 |
|
180 pDataOut = (mng_datap)hHandleOut; /* make outhandle addressable */ |
|
181 pChunk = (mng_chunkp)hChunk; /* address the chunk */ |
|
182 |
|
183 if (!pDataOut->bCreating) /* aren't we creating a new file ? */ |
|
184 MNG_ERROR (pDataOut, MNG_FUNCTIONINVALID) |
|
185 /* create a new chunk */ |
|
186 iRetcode = ((mng_createchunk)((mng_chunk_headerp)pChunk)->fCreate) |
|
187 (pDataOut, ((mng_chunk_headerp)pChunk), &pChunkOut); |
|
188 if (!iRetcode) /* assign the chunk-specific data */ |
|
189 iRetcode = ((mng_assignchunk)((mng_chunk_headerp)pChunk)->fAssign) |
|
190 (pDataOut, pChunkOut, pChunk); |
|
191 |
|
192 if (iRetcode) /* on error bail out */ |
|
193 return iRetcode; |
|
194 |
|
195 mng_add_chunk (pDataOut, pChunkOut); /* and put it in the output-stream */ |
|
196 |
|
197 /* could it be the end of the chain ? */ |
|
198 if (((mng_chunk_headerp)pChunkOut)->iChunkname == MNG_UINT_IEND) |
|
199 { |
|
200 #ifdef MNG_INCLUDE_JNG |
|
201 if ((pDataOut->iFirstchunkadded == MNG_UINT_IHDR) || |
|
202 (pDataOut->iFirstchunkadded == MNG_UINT_JHDR) ) |
|
203 #else |
|
204 if (pDataOut->iFirstchunkadded == MNG_UINT_IHDR) |
|
205 #endif |
|
206 pDataOut->bCreating = MNG_FALSE; /* right; this should be the last chunk !!! */ |
|
207 } |
|
208 |
|
209 if (((mng_chunk_headerp)pChunkOut)->iChunkname == MNG_UINT_MEND) |
|
210 pDataOut->bCreating = MNG_FALSE; /* definitely this should be the last !!! */ |
|
211 |
|
212 #ifdef MNG_SUPPORT_TRACE |
|
213 MNG_TRACE (((mng_datap)hHandle), MNG_FN_COPY_CHUNK, MNG_LC_END); |
|
214 #endif |
|
215 |
|
216 return MNG_NOERROR; |
|
217 } |
|
218 #endif /* MNG_SUPPORT_WRITE */ |
|
219 |
|
220 /* ************************************************************************** */ |
|
221 |
|
222 mng_retcode MNG_DECL mng_getchunk_ihdr (mng_handle hHandle, |
|
223 mng_handle hChunk, |
|
224 mng_uint32 *iWidth, |
|
225 mng_uint32 *iHeight, |
|
226 mng_uint8 *iBitdepth, |
|
227 mng_uint8 *iColortype, |
|
228 mng_uint8 *iCompression, |
|
229 mng_uint8 *iFilter, |
|
230 mng_uint8 *iInterlace) |
|
231 { |
|
232 mng_datap pData; |
|
233 mng_ihdrp pChunk; |
|
234 |
|
235 #ifdef MNG_SUPPORT_TRACE |
|
236 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_IHDR, MNG_LC_START); |
|
237 #endif |
|
238 |
|
239 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
240 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
241 pChunk = (mng_ihdrp)hChunk; /* address the chunk */ |
|
242 |
|
243 if (pChunk->sHeader.iChunkname != MNG_UINT_IHDR) |
|
244 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
245 |
|
246 *iWidth = pChunk->iWidth; /* fill the fields */ |
|
247 *iHeight = pChunk->iHeight; |
|
248 *iBitdepth = pChunk->iBitdepth; |
|
249 *iColortype = pChunk->iColortype; |
|
250 *iCompression = pChunk->iCompression; |
|
251 *iFilter = pChunk->iFilter; |
|
252 *iInterlace = pChunk->iInterlace; |
|
253 |
|
254 /* fill the chunk */ |
|
255 |
|
256 #ifdef MNG_SUPPORT_TRACE |
|
257 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_IHDR, MNG_LC_END); |
|
258 #endif |
|
259 |
|
260 return MNG_NOERROR; |
|
261 } |
|
262 |
|
263 /* ************************************************************************** */ |
|
264 |
|
265 mng_retcode MNG_DECL mng_getchunk_plte (mng_handle hHandle, |
|
266 mng_handle hChunk, |
|
267 mng_uint32 *iCount, |
|
268 mng_palette8 *aPalette) |
|
269 { |
|
270 mng_datap pData; |
|
271 mng_pltep pChunk; |
|
272 |
|
273 #ifdef MNG_SUPPORT_TRACE |
|
274 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PLTE, MNG_LC_START); |
|
275 #endif |
|
276 |
|
277 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
278 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
279 pChunk = (mng_pltep)hChunk; /* address the chunk */ |
|
280 |
|
281 if (pChunk->sHeader.iChunkname != MNG_UINT_PLTE) |
|
282 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
283 |
|
284 *iCount = pChunk->iEntrycount; /* fill the fields */ |
|
285 |
|
286 MNG_COPY (*aPalette, pChunk->aEntries, sizeof (mng_palette8)); |
|
287 |
|
288 #ifdef MNG_SUPPORT_TRACE |
|
289 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PLTE, MNG_LC_END); |
|
290 #endif |
|
291 |
|
292 return MNG_NOERROR; |
|
293 } |
|
294 |
|
295 /* ************************************************************************** */ |
|
296 |
|
297 mng_retcode MNG_DECL mng_getchunk_idat (mng_handle hHandle, |
|
298 mng_handle hChunk, |
|
299 mng_uint32 *iRawlen, |
|
300 mng_ptr *pRawdata) |
|
301 { |
|
302 mng_datap pData; |
|
303 mng_idatp pChunk; |
|
304 |
|
305 #ifdef MNG_SUPPORT_TRACE |
|
306 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_IDAT, MNG_LC_START); |
|
307 #endif |
|
308 |
|
309 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
310 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
311 pChunk = (mng_idatp)hChunk; /* address the chunk */ |
|
312 |
|
313 if (pChunk->sHeader.iChunkname != MNG_UINT_IDAT) |
|
314 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
315 |
|
316 *iRawlen = pChunk->iDatasize; /* fill the fields */ |
|
317 *pRawdata = pChunk->pData; |
|
318 |
|
319 #ifdef MNG_SUPPORT_TRACE |
|
320 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_IDAT, MNG_LC_END); |
|
321 #endif |
|
322 |
|
323 return MNG_NOERROR; |
|
324 } |
|
325 |
|
326 /* ************************************************************************** */ |
|
327 |
|
328 mng_retcode MNG_DECL mng_getchunk_trns (mng_handle hHandle, |
|
329 mng_handle hChunk, |
|
330 mng_bool *bEmpty, |
|
331 mng_bool *bGlobal, |
|
332 mng_uint8 *iType, |
|
333 mng_uint32 *iCount, |
|
334 mng_uint8arr *aAlphas, |
|
335 mng_uint16 *iGray, |
|
336 mng_uint16 *iRed, |
|
337 mng_uint16 *iGreen, |
|
338 mng_uint16 *iBlue, |
|
339 mng_uint32 *iRawlen, |
|
340 mng_uint8arr *aRawdata) |
|
341 { |
|
342 mng_datap pData; |
|
343 mng_trnsp pChunk; |
|
344 |
|
345 #ifdef MNG_SUPPORT_TRACE |
|
346 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TRNS, MNG_LC_START); |
|
347 #endif |
|
348 |
|
349 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
350 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
351 pChunk = (mng_trnsp)hChunk; /* address the chunk */ |
|
352 |
|
353 if (pChunk->sHeader.iChunkname != MNG_UINT_tRNS) |
|
354 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
355 |
|
356 *bEmpty = pChunk->bEmpty; /* fill the fields */ |
|
357 *bGlobal = pChunk->bGlobal; |
|
358 *iType = pChunk->iType; |
|
359 *iCount = pChunk->iCount; |
|
360 *iGray = pChunk->iGray; |
|
361 *iRed = pChunk->iRed; |
|
362 *iGreen = pChunk->iGreen; |
|
363 *iBlue = pChunk->iBlue; |
|
364 *iRawlen = pChunk->iRawlen; |
|
365 |
|
366 MNG_COPY (*aAlphas, pChunk->aEntries, sizeof (mng_uint8arr)); |
|
367 MNG_COPY (*aRawdata, pChunk->aRawdata, sizeof (mng_uint8arr)); |
|
368 |
|
369 #ifdef MNG_SUPPORT_TRACE |
|
370 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TRNS, MNG_LC_END); |
|
371 #endif |
|
372 |
|
373 return MNG_NOERROR; |
|
374 } |
|
375 |
|
376 /* ************************************************************************** */ |
|
377 |
|
378 #ifndef MNG_SKIPCHUNK_gAMA |
|
379 mng_retcode MNG_DECL mng_getchunk_gama (mng_handle hHandle, |
|
380 mng_handle hChunk, |
|
381 mng_bool *bEmpty, |
|
382 mng_uint32 *iGamma) |
|
383 { |
|
384 mng_datap pData; |
|
385 mng_gamap pChunk; |
|
386 |
|
387 #ifdef MNG_SUPPORT_TRACE |
|
388 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_GAMA, MNG_LC_START); |
|
389 #endif |
|
390 |
|
391 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
392 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
393 pChunk = (mng_gamap)hChunk; /* address the chunk */ |
|
394 |
|
395 if (pChunk->sHeader.iChunkname != MNG_UINT_gAMA) |
|
396 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
397 |
|
398 *bEmpty = pChunk->bEmpty; /* fill the fields */ |
|
399 *iGamma = pChunk->iGamma; |
|
400 |
|
401 #ifdef MNG_SUPPORT_TRACE |
|
402 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_GAMA, MNG_LC_END); |
|
403 #endif |
|
404 |
|
405 return MNG_NOERROR; |
|
406 } |
|
407 #endif |
|
408 |
|
409 /* ************************************************************************** */ |
|
410 |
|
411 #ifndef MNG_SKIPCHUNK_cHRM |
|
412 mng_retcode MNG_DECL mng_getchunk_chrm (mng_handle hHandle, |
|
413 mng_handle hChunk, |
|
414 mng_bool *bEmpty, |
|
415 mng_uint32 *iWhitepointx, |
|
416 mng_uint32 *iWhitepointy, |
|
417 mng_uint32 *iRedx, |
|
418 mng_uint32 *iRedy, |
|
419 mng_uint32 *iGreenx, |
|
420 mng_uint32 *iGreeny, |
|
421 mng_uint32 *iBluex, |
|
422 mng_uint32 *iBluey) |
|
423 { |
|
424 mng_datap pData; |
|
425 mng_chrmp pChunk; |
|
426 |
|
427 #ifdef MNG_SUPPORT_TRACE |
|
428 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CHRM, MNG_LC_START); |
|
429 #endif |
|
430 |
|
431 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
432 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
433 pChunk = (mng_chrmp)hChunk; /* address the chunk */ |
|
434 |
|
435 if (pChunk->sHeader.iChunkname != MNG_UINT_cHRM) |
|
436 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
437 |
|
438 *bEmpty = pChunk->bEmpty; /* fill the fields */ |
|
439 *iWhitepointx = pChunk->iWhitepointx; |
|
440 *iWhitepointy = pChunk->iWhitepointy; |
|
441 *iRedx = pChunk->iRedx; |
|
442 *iRedy = pChunk->iRedy; |
|
443 *iGreenx = pChunk->iGreenx; |
|
444 *iGreeny = pChunk->iGreeny; |
|
445 *iBluex = pChunk->iBluex; |
|
446 *iBluey = pChunk->iBluey; |
|
447 |
|
448 #ifdef MNG_SUPPORT_TRACE |
|
449 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CHRM, MNG_LC_END); |
|
450 #endif |
|
451 |
|
452 return MNG_NOERROR; |
|
453 } |
|
454 #endif |
|
455 |
|
456 /* ************************************************************************** */ |
|
457 |
|
458 #ifndef MNG_SKIPCHUNK_sRGB |
|
459 mng_retcode MNG_DECL mng_getchunk_srgb (mng_handle hHandle, |
|
460 mng_handle hChunk, |
|
461 mng_bool *bEmpty, |
|
462 mng_uint8 *iRenderingintent) |
|
463 { |
|
464 mng_datap pData; |
|
465 mng_srgbp pChunk; |
|
466 |
|
467 #ifdef MNG_SUPPORT_TRACE |
|
468 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SRGB, 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_srgbp)hChunk; /* address the chunk */ |
|
474 |
|
475 if (pChunk->sHeader.iChunkname != MNG_UINT_sRGB) |
|
476 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
477 |
|
478 *bEmpty = pChunk->bEmpty; /* fill the fields */ |
|
479 *iRenderingintent = pChunk->iRenderingintent; |
|
480 |
|
481 #ifdef MNG_SUPPORT_TRACE |
|
482 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SRGB, MNG_LC_END); |
|
483 #endif |
|
484 |
|
485 return MNG_NOERROR; |
|
486 } |
|
487 #endif |
|
488 |
|
489 /* ************************************************************************** */ |
|
490 |
|
491 #ifndef MNG_SKIPCHUNK_iCCP |
|
492 mng_retcode MNG_DECL mng_getchunk_iccp (mng_handle hHandle, |
|
493 mng_handle hChunk, |
|
494 mng_bool *bEmpty, |
|
495 mng_uint32 *iNamesize, |
|
496 mng_pchar *zName, |
|
497 mng_uint8 *iCompression, |
|
498 mng_uint32 *iProfilesize, |
|
499 mng_ptr *pProfile) |
|
500 { |
|
501 mng_datap pData; |
|
502 mng_iccpp pChunk; |
|
503 |
|
504 #ifdef MNG_SUPPORT_TRACE |
|
505 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ICCP, MNG_LC_START); |
|
506 #endif |
|
507 |
|
508 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
509 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
510 pChunk = (mng_iccpp)hChunk; /* address the chunk */ |
|
511 |
|
512 if (pChunk->sHeader.iChunkname != MNG_UINT_iCCP) |
|
513 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
514 |
|
515 *bEmpty = pChunk->bEmpty; /* fill the fields */ |
|
516 *iNamesize = pChunk->iNamesize; |
|
517 *zName = pChunk->zName; |
|
518 *iCompression = pChunk->iCompression; |
|
519 *iProfilesize = pChunk->iProfilesize; |
|
520 *pProfile = pChunk->pProfile; |
|
521 |
|
522 #ifdef MNG_SUPPORT_TRACE |
|
523 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ICCP, MNG_LC_END); |
|
524 #endif |
|
525 |
|
526 return MNG_NOERROR; |
|
527 } |
|
528 #endif |
|
529 |
|
530 /* ************************************************************************** */ |
|
531 |
|
532 #ifndef MNG_SKIPCHUNK_tEXt |
|
533 mng_retcode MNG_DECL mng_getchunk_text (mng_handle hHandle, |
|
534 mng_handle hChunk, |
|
535 mng_uint32 *iKeywordsize, |
|
536 mng_pchar *zKeyword, |
|
537 mng_uint32 *iTextsize, |
|
538 mng_pchar *zText) |
|
539 { |
|
540 mng_datap pData; |
|
541 mng_textp pChunk; |
|
542 |
|
543 #ifdef MNG_SUPPORT_TRACE |
|
544 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TEXT, MNG_LC_START); |
|
545 #endif |
|
546 |
|
547 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
548 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
549 pChunk = (mng_textp)hChunk; /* address the chunk */ |
|
550 |
|
551 if (pChunk->sHeader.iChunkname != MNG_UINT_tEXt) |
|
552 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
553 /* fill the fields */ |
|
554 *iKeywordsize = pChunk->iKeywordsize; |
|
555 *zKeyword = pChunk->zKeyword; |
|
556 *iTextsize = pChunk->iTextsize; |
|
557 *zText = pChunk->zText; |
|
558 |
|
559 #ifdef MNG_SUPPORT_TRACE |
|
560 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TEXT, MNG_LC_END); |
|
561 #endif |
|
562 |
|
563 return MNG_NOERROR; |
|
564 } |
|
565 #endif |
|
566 |
|
567 /* ************************************************************************** */ |
|
568 |
|
569 #ifndef MNG_SKIPCHUNK_zTXt |
|
570 mng_retcode MNG_DECL mng_getchunk_ztxt (mng_handle hHandle, |
|
571 mng_handle hChunk, |
|
572 mng_uint32 *iKeywordsize, |
|
573 mng_pchar *zKeyword, |
|
574 mng_uint8 *iCompression, |
|
575 mng_uint32 *iTextsize, |
|
576 mng_pchar *zText) |
|
577 { |
|
578 mng_datap pData; |
|
579 mng_ztxtp pChunk; |
|
580 |
|
581 #ifdef MNG_SUPPORT_TRACE |
|
582 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ZTXT, MNG_LC_START); |
|
583 #endif |
|
584 |
|
585 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
586 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
587 pChunk = (mng_ztxtp)hChunk; /* address the chunk */ |
|
588 |
|
589 if (pChunk->sHeader.iChunkname != MNG_UINT_zTXt) |
|
590 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
591 /* fill the fields */ |
|
592 *iKeywordsize = pChunk->iKeywordsize; |
|
593 *zKeyword = pChunk->zKeyword; |
|
594 *iCompression = pChunk->iCompression; |
|
595 *iTextsize = pChunk->iTextsize; |
|
596 *zText = pChunk->zText; |
|
597 |
|
598 #ifdef MNG_SUPPORT_TRACE |
|
599 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ZTXT, MNG_LC_END); |
|
600 #endif |
|
601 |
|
602 return MNG_NOERROR; |
|
603 } |
|
604 #endif |
|
605 |
|
606 /* ************************************************************************** */ |
|
607 |
|
608 #ifndef MNG_SKIPCHUNK_iTXt |
|
609 mng_retcode MNG_DECL mng_getchunk_itxt (mng_handle hHandle, |
|
610 mng_handle hChunk, |
|
611 mng_uint32 *iKeywordsize, |
|
612 mng_pchar *zKeyword, |
|
613 mng_uint8 *iCompressionflag, |
|
614 mng_uint8 *iCompressionmethod, |
|
615 mng_uint32 *iLanguagesize, |
|
616 mng_pchar *zLanguage, |
|
617 mng_uint32 *iTranslationsize, |
|
618 mng_pchar *zTranslation, |
|
619 mng_uint32 *iTextsize, |
|
620 mng_pchar *zText) |
|
621 { |
|
622 mng_datap pData; |
|
623 mng_itxtp pChunk; |
|
624 |
|
625 #ifdef MNG_SUPPORT_TRACE |
|
626 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ITXT, 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_itxtp)hChunk; /* address the chunk */ |
|
632 |
|
633 if (pChunk->sHeader.iChunkname != MNG_UINT_iTXt) |
|
634 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
635 /* fill the fields */ |
|
636 *iKeywordsize = pChunk->iKeywordsize; |
|
637 *zKeyword = pChunk->zKeyword; |
|
638 *iCompressionflag = pChunk->iCompressionflag; |
|
639 *iCompressionmethod = pChunk->iCompressionmethod; |
|
640 *iLanguagesize = pChunk->iLanguagesize; |
|
641 *zLanguage = pChunk->zLanguage; |
|
642 *iTranslationsize = pChunk->iTranslationsize; |
|
643 *zTranslation = pChunk->zTranslation; |
|
644 *iTextsize = pChunk->iTextsize; |
|
645 *zText = pChunk->zText; |
|
646 |
|
647 #ifdef MNG_SUPPORT_TRACE |
|
648 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ITXT, MNG_LC_END); |
|
649 #endif |
|
650 |
|
651 return MNG_NOERROR; |
|
652 } |
|
653 #endif |
|
654 |
|
655 /* ************************************************************************** */ |
|
656 |
|
657 #ifndef MNG_SKIPCHUNK_bKGD |
|
658 mng_retcode MNG_DECL mng_getchunk_bkgd (mng_handle hHandle, |
|
659 mng_handle hChunk, |
|
660 mng_bool *bEmpty, |
|
661 mng_uint8 *iType, |
|
662 mng_uint8 *iIndex, |
|
663 mng_uint16 *iGray, |
|
664 mng_uint16 *iRed, |
|
665 mng_uint16 *iGreen, |
|
666 mng_uint16 *iBlue) |
|
667 { |
|
668 mng_datap pData; |
|
669 mng_bkgdp pChunk; |
|
670 |
|
671 #ifdef MNG_SUPPORT_TRACE |
|
672 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BKGD, MNG_LC_START); |
|
673 #endif |
|
674 |
|
675 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
676 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
677 pChunk = (mng_bkgdp)hChunk; /* address the chunk */ |
|
678 |
|
679 if (pChunk->sHeader.iChunkname != MNG_UINT_bKGD) |
|
680 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
681 |
|
682 *bEmpty = pChunk->bEmpty; /* fill the fields */ |
|
683 *iType = pChunk->iType; |
|
684 *iIndex = pChunk->iIndex; |
|
685 *iGray = pChunk->iGray; |
|
686 *iRed = pChunk->iRed; |
|
687 *iGreen = pChunk->iGreen; |
|
688 *iBlue = pChunk->iBlue; |
|
689 |
|
690 #ifdef MNG_SUPPORT_TRACE |
|
691 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BKGD, MNG_LC_END); |
|
692 #endif |
|
693 |
|
694 return MNG_NOERROR; |
|
695 } |
|
696 #endif |
|
697 |
|
698 /* ************************************************************************** */ |
|
699 |
|
700 #ifndef MNG_SKIPCHUNK_pHYs |
|
701 mng_retcode MNG_DECL mng_getchunk_phys (mng_handle hHandle, |
|
702 mng_handle hChunk, |
|
703 mng_bool *bEmpty, |
|
704 mng_uint32 *iSizex, |
|
705 mng_uint32 *iSizey, |
|
706 mng_uint8 *iUnit) |
|
707 { |
|
708 mng_datap pData; |
|
709 mng_physp pChunk; |
|
710 |
|
711 #ifdef MNG_SUPPORT_TRACE |
|
712 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PHYS, MNG_LC_START); |
|
713 #endif |
|
714 |
|
715 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
716 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
717 pChunk = (mng_physp)hChunk; /* address the chunk */ |
|
718 |
|
719 if (pChunk->sHeader.iChunkname != MNG_UINT_pHYs) |
|
720 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
721 |
|
722 *bEmpty = pChunk->bEmpty; /* fill the fields */ |
|
723 *iSizex = pChunk->iSizex; |
|
724 *iSizey = pChunk->iSizey; |
|
725 *iUnit = pChunk->iUnit; |
|
726 |
|
727 #ifdef MNG_SUPPORT_TRACE |
|
728 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PHYS, MNG_LC_END); |
|
729 #endif |
|
730 |
|
731 return MNG_NOERROR; |
|
732 } |
|
733 #endif |
|
734 |
|
735 /* ************************************************************************** */ |
|
736 |
|
737 #ifndef MNG_SKIPCHUNK_sBIT |
|
738 mng_retcode MNG_DECL mng_getchunk_sbit (mng_handle hHandle, |
|
739 mng_handle hChunk, |
|
740 mng_bool *bEmpty, |
|
741 mng_uint8 *iType, |
|
742 mng_uint8arr4 *aBits) |
|
743 { |
|
744 mng_datap pData; |
|
745 mng_sbitp pChunk; |
|
746 |
|
747 #ifdef MNG_SUPPORT_TRACE |
|
748 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SBIT, MNG_LC_START); |
|
749 #endif |
|
750 |
|
751 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
752 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
753 pChunk = (mng_sbitp)hChunk; /* address the chunk */ |
|
754 |
|
755 if (pChunk->sHeader.iChunkname != MNG_UINT_sBIT) |
|
756 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
757 |
|
758 *bEmpty = pChunk->bEmpty; |
|
759 *iType = pChunk->iType; |
|
760 (*aBits)[0] = pChunk->aBits[0]; |
|
761 (*aBits)[1] = pChunk->aBits[1]; |
|
762 (*aBits)[2] = pChunk->aBits[2]; |
|
763 (*aBits)[3] = pChunk->aBits[3]; |
|
764 |
|
765 #ifdef MNG_SUPPORT_TRACE |
|
766 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SBIT, MNG_LC_END); |
|
767 #endif |
|
768 |
|
769 return MNG_NOERROR; |
|
770 } |
|
771 #endif |
|
772 |
|
773 /* ************************************************************************** */ |
|
774 |
|
775 #ifndef MNG_SKIPCHUNK_sPLT |
|
776 mng_retcode MNG_DECL mng_getchunk_splt (mng_handle hHandle, |
|
777 mng_handle hChunk, |
|
778 mng_bool *bEmpty, |
|
779 mng_uint32 *iNamesize, |
|
780 mng_pchar *zName, |
|
781 mng_uint8 *iSampledepth, |
|
782 mng_uint32 *iEntrycount, |
|
783 mng_ptr *pEntries) |
|
784 { |
|
785 mng_datap pData; |
|
786 mng_spltp pChunk; |
|
787 |
|
788 #ifdef MNG_SUPPORT_TRACE |
|
789 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SPLT, MNG_LC_START); |
|
790 #endif |
|
791 |
|
792 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
793 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
794 pChunk = (mng_spltp)hChunk; /* address the chunk */ |
|
795 |
|
796 if (pChunk->sHeader.iChunkname != MNG_UINT_sPLT) |
|
797 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
798 |
|
799 *bEmpty = pChunk->bEmpty; /* fill the fields */ |
|
800 *iNamesize = pChunk->iNamesize; |
|
801 *zName = pChunk->zName; |
|
802 *iSampledepth = pChunk->iSampledepth; |
|
803 *iEntrycount = pChunk->iEntrycount; |
|
804 *pEntries = pChunk->pEntries; |
|
805 |
|
806 #ifdef MNG_SUPPORT_TRACE |
|
807 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SPLT, MNG_LC_END); |
|
808 #endif |
|
809 |
|
810 return MNG_NOERROR; |
|
811 } |
|
812 #endif |
|
813 |
|
814 /* ************************************************************************** */ |
|
815 |
|
816 #ifndef MNG_SKIPCHUNK_hIST |
|
817 mng_retcode MNG_DECL mng_getchunk_hist (mng_handle hHandle, |
|
818 mng_handle hChunk, |
|
819 mng_uint32 *iEntrycount, |
|
820 mng_uint16arr *aEntries) |
|
821 { |
|
822 mng_datap pData; |
|
823 mng_histp pChunk; |
|
824 |
|
825 #ifdef MNG_SUPPORT_TRACE |
|
826 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_HIST, MNG_LC_START); |
|
827 #endif |
|
828 |
|
829 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
830 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
831 pChunk = (mng_histp)hChunk; /* address the chunk */ |
|
832 |
|
833 if (pChunk->sHeader.iChunkname != MNG_UINT_hIST) |
|
834 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
835 |
|
836 *iEntrycount = pChunk->iEntrycount; /* fill the fields */ |
|
837 |
|
838 MNG_COPY (*aEntries, pChunk->aEntries, sizeof (mng_uint16arr)); |
|
839 |
|
840 #ifdef MNG_SUPPORT_TRACE |
|
841 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_HIST, MNG_LC_END); |
|
842 #endif |
|
843 |
|
844 return MNG_NOERROR; |
|
845 } |
|
846 #endif |
|
847 |
|
848 /* ************************************************************************** */ |
|
849 |
|
850 #ifndef MNG_SKIPCHUNK_tIME |
|
851 mng_retcode MNG_DECL mng_getchunk_time (mng_handle hHandle, |
|
852 mng_handle hChunk, |
|
853 mng_uint16 *iYear, |
|
854 mng_uint8 *iMonth, |
|
855 mng_uint8 *iDay, |
|
856 mng_uint8 *iHour, |
|
857 mng_uint8 *iMinute, |
|
858 mng_uint8 *iSecond) |
|
859 { |
|
860 mng_datap pData; |
|
861 mng_timep pChunk; |
|
862 |
|
863 #ifdef MNG_SUPPORT_TRACE |
|
864 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TIME, MNG_LC_START); |
|
865 #endif |
|
866 |
|
867 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
868 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
869 pChunk = (mng_timep)hChunk; /* address the chunk */ |
|
870 |
|
871 if (pChunk->sHeader.iChunkname != MNG_UINT_tIME) |
|
872 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
873 |
|
874 *iYear = pChunk->iYear; /* fill the fields */ |
|
875 *iMonth = pChunk->iMonth; |
|
876 *iDay = pChunk->iDay; |
|
877 *iHour = pChunk->iHour; |
|
878 *iMinute = pChunk->iMinute; |
|
879 *iSecond = pChunk->iSecond; |
|
880 |
|
881 #ifdef MNG_SUPPORT_TRACE |
|
882 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TIME, MNG_LC_END); |
|
883 #endif |
|
884 |
|
885 return MNG_NOERROR; |
|
886 } |
|
887 #endif |
|
888 |
|
889 /* ************************************************************************** */ |
|
890 |
|
891 mng_retcode MNG_DECL mng_getchunk_mhdr (mng_handle hHandle, |
|
892 mng_handle hChunk, |
|
893 mng_uint32 *iWidth, |
|
894 mng_uint32 *iHeight, |
|
895 mng_uint32 *iTicks, |
|
896 mng_uint32 *iLayercount, |
|
897 mng_uint32 *iFramecount, |
|
898 mng_uint32 *iPlaytime, |
|
899 mng_uint32 *iSimplicity) |
|
900 { |
|
901 mng_datap pData; |
|
902 mng_mhdrp pChunk; |
|
903 |
|
904 #ifdef MNG_SUPPORT_TRACE |
|
905 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MHDR, MNG_LC_START); |
|
906 #endif |
|
907 |
|
908 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
909 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
910 pChunk = (mng_mhdrp)hChunk; /* address the chunk */ |
|
911 |
|
912 if (pChunk->sHeader.iChunkname != MNG_UINT_MHDR) |
|
913 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
914 |
|
915 *iWidth = pChunk->iWidth; /* fill the fields */ |
|
916 *iHeight = pChunk->iHeight; |
|
917 *iTicks = pChunk->iTicks; |
|
918 *iLayercount = pChunk->iLayercount; |
|
919 *iFramecount = pChunk->iFramecount; |
|
920 *iPlaytime = pChunk->iPlaytime; |
|
921 *iSimplicity = pChunk->iSimplicity; |
|
922 |
|
923 #ifdef MNG_SUPPORT_TRACE |
|
924 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MHDR, MNG_LC_END); |
|
925 #endif |
|
926 |
|
927 return MNG_NOERROR; |
|
928 } |
|
929 |
|
930 /* ************************************************************************** */ |
|
931 |
|
932 #ifndef MNG_SKIPCHUNK_LOOP |
|
933 mng_retcode MNG_DECL mng_getchunk_loop (mng_handle hHandle, |
|
934 mng_handle hChunk, |
|
935 mng_uint8 *iLevel, |
|
936 mng_uint32 *iRepeat, |
|
937 mng_uint8 *iTermination, |
|
938 mng_uint32 *iItermin, |
|
939 mng_uint32 *iItermax, |
|
940 mng_uint32 *iCount, |
|
941 mng_uint32p *pSignals) |
|
942 { |
|
943 mng_datap pData; |
|
944 mng_loopp pChunk; |
|
945 |
|
946 #ifdef MNG_SUPPORT_TRACE |
|
947 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_LOOP, MNG_LC_START); |
|
948 #endif |
|
949 |
|
950 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
951 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
952 pChunk = (mng_loopp)hChunk; /* address the chunk */ |
|
953 |
|
954 if (pChunk->sHeader.iChunkname != MNG_UINT_LOOP) |
|
955 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
956 |
|
957 *iLevel = pChunk->iLevel; /* fill teh fields */ |
|
958 *iRepeat = pChunk->iRepeat; |
|
959 *iTermination = pChunk->iTermination; |
|
960 *iItermin = pChunk->iItermin; |
|
961 *iItermax = pChunk->iItermax; |
|
962 *iCount = pChunk->iCount; |
|
963 *pSignals = pChunk->pSignals; |
|
964 |
|
965 #ifdef MNG_SUPPORT_TRACE |
|
966 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_LOOP, MNG_LC_END); |
|
967 #endif |
|
968 |
|
969 return MNG_NOERROR; |
|
970 } |
|
971 |
|
972 /* ************************************************************************** */ |
|
973 |
|
974 mng_retcode MNG_DECL mng_getchunk_endl (mng_handle hHandle, |
|
975 mng_handle hChunk, |
|
976 mng_uint8 *iLevel) |
|
977 { |
|
978 mng_datap pData; |
|
979 mng_endlp pChunk; |
|
980 |
|
981 #ifdef MNG_SUPPORT_TRACE |
|
982 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ENDL, MNG_LC_START); |
|
983 #endif |
|
984 |
|
985 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
986 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
987 pChunk = (mng_endlp)hChunk; /* address the chunk */ |
|
988 |
|
989 if (pChunk->sHeader.iChunkname != MNG_UINT_ENDL) |
|
990 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
991 |
|
992 *iLevel = pChunk->iLevel; /* fill the field */ |
|
993 |
|
994 #ifdef MNG_SUPPORT_TRACE |
|
995 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ENDL, MNG_LC_END); |
|
996 #endif |
|
997 |
|
998 return MNG_NOERROR; |
|
999 } |
|
1000 #endif |
|
1001 |
|
1002 /* ************************************************************************** */ |
|
1003 |
|
1004 #ifndef MNG_SKIPCHUNK_DEFI |
|
1005 mng_retcode MNG_DECL mng_getchunk_defi (mng_handle hHandle, |
|
1006 mng_handle hChunk, |
|
1007 mng_uint16 *iObjectid, |
|
1008 mng_uint8 *iDonotshow, |
|
1009 mng_uint8 *iConcrete, |
|
1010 mng_bool *bHasloca, |
|
1011 mng_int32 *iXlocation, |
|
1012 mng_int32 *iYlocation, |
|
1013 mng_bool *bHasclip, |
|
1014 mng_int32 *iLeftcb, |
|
1015 mng_int32 *iRightcb, |
|
1016 mng_int32 *iTopcb, |
|
1017 mng_int32 *iBottomcb) |
|
1018 { |
|
1019 mng_datap pData; |
|
1020 mng_defip pChunk; |
|
1021 |
|
1022 #ifdef MNG_SUPPORT_TRACE |
|
1023 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DEFI, MNG_LC_START); |
|
1024 #endif |
|
1025 |
|
1026 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1027 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1028 pChunk = (mng_defip)hChunk; /* address the chunk */ |
|
1029 |
|
1030 if (pChunk->sHeader.iChunkname != MNG_UINT_DEFI) |
|
1031 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1032 |
|
1033 *iObjectid = pChunk->iObjectid; /* fill the fields */ |
|
1034 *iDonotshow = pChunk->iDonotshow; |
|
1035 *iConcrete = pChunk->iConcrete; |
|
1036 *bHasloca = pChunk->bHasloca; |
|
1037 *iXlocation = pChunk->iXlocation; |
|
1038 *iYlocation = pChunk->iYlocation; |
|
1039 *bHasclip = pChunk->bHasclip; |
|
1040 *iLeftcb = pChunk->iLeftcb; |
|
1041 *iRightcb = pChunk->iRightcb; |
|
1042 *iTopcb = pChunk->iTopcb; |
|
1043 *iBottomcb = pChunk->iBottomcb; |
|
1044 |
|
1045 #ifdef MNG_SUPPORT_TRACE |
|
1046 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DEFI, MNG_LC_END); |
|
1047 #endif |
|
1048 |
|
1049 return MNG_NOERROR; |
|
1050 } |
|
1051 #endif |
|
1052 |
|
1053 /* ************************************************************************** */ |
|
1054 |
|
1055 #ifndef MNG_SKIPCHUNK_BASI |
|
1056 mng_retcode MNG_DECL mng_getchunk_basi (mng_handle hHandle, |
|
1057 mng_handle hChunk, |
|
1058 mng_uint32 *iWidth, |
|
1059 mng_uint32 *iHeight, |
|
1060 mng_uint8 *iBitdepth, |
|
1061 mng_uint8 *iColortype, |
|
1062 mng_uint8 *iCompression, |
|
1063 mng_uint8 *iFilter, |
|
1064 mng_uint8 *iInterlace, |
|
1065 mng_uint16 *iRed, |
|
1066 mng_uint16 *iGreen, |
|
1067 mng_uint16 *iBlue, |
|
1068 mng_uint16 *iAlpha, |
|
1069 mng_uint8 *iViewable) |
|
1070 { |
|
1071 mng_datap pData; |
|
1072 mng_basip pChunk; |
|
1073 |
|
1074 #ifdef MNG_SUPPORT_TRACE |
|
1075 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BASI, 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_basip)hChunk; /* address the chunk */ |
|
1081 |
|
1082 if (pChunk->sHeader.iChunkname != MNG_UINT_BASI) |
|
1083 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1084 |
|
1085 *iWidth = pChunk->iWidth; /* fill the fields */ |
|
1086 *iHeight = pChunk->iHeight; |
|
1087 *iBitdepth = pChunk->iBitdepth; |
|
1088 *iColortype = pChunk->iColortype; |
|
1089 *iCompression = pChunk->iCompression; |
|
1090 *iFilter = pChunk->iFilter; |
|
1091 *iInterlace = pChunk->iInterlace; |
|
1092 *iRed = pChunk->iRed; |
|
1093 *iGreen = pChunk->iGreen; |
|
1094 *iBlue = pChunk->iBlue; |
|
1095 *iAlpha = pChunk->iAlpha; |
|
1096 *iViewable = pChunk->iViewable; |
|
1097 |
|
1098 #ifdef MNG_SUPPORT_TRACE |
|
1099 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BASI, MNG_LC_END); |
|
1100 #endif |
|
1101 |
|
1102 return MNG_NOERROR; |
|
1103 } |
|
1104 #endif |
|
1105 |
|
1106 /* ************************************************************************** */ |
|
1107 |
|
1108 #ifndef MNG_SKIPCHUNK_CLON |
|
1109 mng_retcode MNG_DECL mng_getchunk_clon (mng_handle hHandle, |
|
1110 mng_handle hChunk, |
|
1111 mng_uint16 *iSourceid, |
|
1112 mng_uint16 *iCloneid, |
|
1113 mng_uint8 *iClonetype, |
|
1114 mng_uint8 *iDonotshow, |
|
1115 mng_uint8 *iConcrete, |
|
1116 mng_bool *bHasloca, |
|
1117 mng_uint8 *iLocationtype, |
|
1118 mng_int32 *iLocationx, |
|
1119 mng_int32 *iLocationy) |
|
1120 { |
|
1121 mng_datap pData; |
|
1122 mng_clonp pChunk; |
|
1123 |
|
1124 #ifdef MNG_SUPPORT_TRACE |
|
1125 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CLON, MNG_LC_START); |
|
1126 #endif |
|
1127 |
|
1128 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1129 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1130 pChunk = (mng_clonp)hChunk; /* address the chunk */ |
|
1131 |
|
1132 if (pChunk->sHeader.iChunkname != MNG_UINT_CLON) |
|
1133 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1134 |
|
1135 *iSourceid = pChunk->iSourceid; /* fill the fields */ |
|
1136 *iCloneid = pChunk->iCloneid; |
|
1137 *iClonetype = pChunk->iClonetype; |
|
1138 *iDonotshow = pChunk->iDonotshow; |
|
1139 *iConcrete = pChunk->iConcrete; |
|
1140 *bHasloca = pChunk->bHasloca; |
|
1141 *iLocationtype = pChunk->iLocationtype; |
|
1142 *iLocationx = pChunk->iLocationx; |
|
1143 *iLocationy = pChunk->iLocationy; |
|
1144 |
|
1145 #ifdef MNG_SUPPORT_TRACE |
|
1146 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CLON, MNG_LC_END); |
|
1147 #endif |
|
1148 |
|
1149 return MNG_NOERROR; |
|
1150 } |
|
1151 #endif |
|
1152 |
|
1153 /* ************************************************************************** */ |
|
1154 |
|
1155 #ifndef MNG_SKIPCHUNK_PAST |
|
1156 mng_retcode MNG_DECL mng_getchunk_past (mng_handle hHandle, |
|
1157 mng_handle hChunk, |
|
1158 mng_uint16 *iDestid, |
|
1159 mng_uint8 *iTargettype, |
|
1160 mng_int32 *iTargetx, |
|
1161 mng_int32 *iTargety, |
|
1162 mng_uint32 *iCount) |
|
1163 { |
|
1164 mng_datap pData; |
|
1165 mng_pastp pChunk; |
|
1166 |
|
1167 #ifdef MNG_SUPPORT_TRACE |
|
1168 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PAST, MNG_LC_START); |
|
1169 #endif |
|
1170 |
|
1171 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1172 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1173 pChunk = (mng_pastp)hChunk; /* address the chunk */ |
|
1174 |
|
1175 if (pChunk->sHeader.iChunkname != MNG_UINT_PAST) |
|
1176 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1177 |
|
1178 *iDestid = pChunk->iDestid; /* fill the fields */ |
|
1179 *iTargettype = pChunk->iTargettype; |
|
1180 *iTargetx = pChunk->iTargetx; |
|
1181 *iTargety = pChunk->iTargety; |
|
1182 *iCount = pChunk->iCount; |
|
1183 |
|
1184 #ifdef MNG_SUPPORT_TRACE |
|
1185 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PAST, MNG_LC_END); |
|
1186 #endif |
|
1187 |
|
1188 return MNG_NOERROR; |
|
1189 } |
|
1190 #endif |
|
1191 |
|
1192 /* ************************************************************************** */ |
|
1193 |
|
1194 #ifndef MNG_SKIPCHUNK_PAST |
|
1195 mng_retcode MNG_DECL mng_getchunk_past_src (mng_handle hHandle, |
|
1196 mng_handle hChunk, |
|
1197 mng_uint32 iEntry, |
|
1198 mng_uint16 *iSourceid, |
|
1199 mng_uint8 *iComposition, |
|
1200 mng_uint8 *iOrientation, |
|
1201 mng_uint8 *iOffsettype, |
|
1202 mng_int32 *iOffsetx, |
|
1203 mng_int32 *iOffsety, |
|
1204 mng_uint8 *iBoundarytype, |
|
1205 mng_int32 *iBoundaryl, |
|
1206 mng_int32 *iBoundaryr, |
|
1207 mng_int32 *iBoundaryt, |
|
1208 mng_int32 *iBoundaryb) |
|
1209 { |
|
1210 mng_datap pData; |
|
1211 mng_pastp pChunk; |
|
1212 mng_past_sourcep pEntry; |
|
1213 |
|
1214 #ifdef MNG_SUPPORT_TRACE |
|
1215 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PAST_SRC, MNG_LC_START); |
|
1216 #endif |
|
1217 |
|
1218 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1219 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1220 pChunk = (mng_pastp)hChunk; /* address the chunk */ |
|
1221 |
|
1222 if (pChunk->sHeader.iChunkname != MNG_UINT_PAST) |
|
1223 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1224 |
|
1225 if (iEntry >= pChunk->iCount) /* valid index ? */ |
|
1226 MNG_ERROR (pData, MNG_INVALIDENTRYIX) |
|
1227 /* address the entry */ |
|
1228 pEntry = pChunk->pSources + iEntry; |
|
1229 |
|
1230 *iSourceid = pEntry->iSourceid; /* fill the fields */ |
|
1231 *iComposition = pEntry->iComposition; |
|
1232 *iOrientation = pEntry->iOrientation; |
|
1233 *iOffsettype = pEntry->iOffsettype; |
|
1234 *iOffsetx = pEntry->iOffsetx; |
|
1235 *iOffsety = pEntry->iOffsety; |
|
1236 *iBoundarytype = pEntry->iBoundarytype; |
|
1237 *iBoundaryl = pEntry->iBoundaryl; |
|
1238 *iBoundaryr = pEntry->iBoundaryr; |
|
1239 *iBoundaryt = pEntry->iBoundaryt; |
|
1240 *iBoundaryb = pEntry->iBoundaryb; |
|
1241 |
|
1242 #ifdef MNG_SUPPORT_TRACE |
|
1243 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PAST_SRC, MNG_LC_END); |
|
1244 #endif |
|
1245 |
|
1246 return MNG_NOERROR; |
|
1247 } |
|
1248 #endif |
|
1249 |
|
1250 /* ************************************************************************** */ |
|
1251 |
|
1252 #ifndef MNG_SKIPCHUNK_DISC |
|
1253 mng_retcode MNG_DECL mng_getchunk_disc (mng_handle hHandle, |
|
1254 mng_handle hChunk, |
|
1255 mng_uint32 *iCount, |
|
1256 mng_uint16p *pObjectids) |
|
1257 { |
|
1258 mng_datap pData; |
|
1259 mng_discp pChunk; |
|
1260 |
|
1261 #ifdef MNG_SUPPORT_TRACE |
|
1262 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DISC, MNG_LC_START); |
|
1263 #endif |
|
1264 |
|
1265 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1266 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1267 pChunk = (mng_discp)hChunk; /* address the chunk */ |
|
1268 |
|
1269 if (pChunk->sHeader.iChunkname != MNG_UINT_DISC) |
|
1270 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1271 |
|
1272 *iCount = pChunk->iCount; /* fill the fields */ |
|
1273 *pObjectids = pChunk->pObjectids; |
|
1274 |
|
1275 #ifdef MNG_SUPPORT_TRACE |
|
1276 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DISC, MNG_LC_END); |
|
1277 #endif |
|
1278 |
|
1279 return MNG_NOERROR; |
|
1280 } |
|
1281 #endif |
|
1282 |
|
1283 /* ************************************************************************** */ |
|
1284 |
|
1285 #ifndef MNG_SKIPCHUNK_BACK |
|
1286 mng_retcode MNG_DECL mng_getchunk_back (mng_handle hHandle, |
|
1287 mng_handle hChunk, |
|
1288 mng_uint16 *iRed, |
|
1289 mng_uint16 *iGreen, |
|
1290 mng_uint16 *iBlue, |
|
1291 mng_uint8 *iMandatory, |
|
1292 mng_uint16 *iImageid, |
|
1293 mng_uint8 *iTile) |
|
1294 { |
|
1295 mng_datap pData; |
|
1296 mng_backp pChunk; |
|
1297 |
|
1298 #ifdef MNG_SUPPORT_TRACE |
|
1299 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BACK, MNG_LC_START); |
|
1300 #endif |
|
1301 |
|
1302 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1303 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1304 pChunk = (mng_backp)hChunk; /* address the chunk */ |
|
1305 |
|
1306 if (pChunk->sHeader.iChunkname != MNG_UINT_BACK) |
|
1307 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1308 |
|
1309 *iRed = pChunk->iRed; /* fill the fields */ |
|
1310 *iGreen = pChunk->iGreen; |
|
1311 *iBlue = pChunk->iBlue; |
|
1312 *iMandatory = pChunk->iMandatory; |
|
1313 *iImageid = pChunk->iImageid; |
|
1314 *iTile = pChunk->iTile; |
|
1315 |
|
1316 #ifdef MNG_SUPPORT_TRACE |
|
1317 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BACK, MNG_LC_END); |
|
1318 #endif |
|
1319 |
|
1320 return MNG_NOERROR; |
|
1321 } |
|
1322 #endif |
|
1323 |
|
1324 /* ************************************************************************** */ |
|
1325 |
|
1326 #ifndef MNG_SKIPCHUNK_FRAM |
|
1327 mng_retcode MNG_DECL mng_getchunk_fram (mng_handle hHandle, |
|
1328 mng_handle hChunk, |
|
1329 mng_bool *bEmpty, |
|
1330 mng_uint8 *iMode, |
|
1331 mng_uint32 *iNamesize, |
|
1332 mng_pchar *zName, |
|
1333 mng_uint8 *iChangedelay, |
|
1334 mng_uint8 *iChangetimeout, |
|
1335 mng_uint8 *iChangeclipping, |
|
1336 mng_uint8 *iChangesyncid, |
|
1337 mng_uint32 *iDelay, |
|
1338 mng_uint32 *iTimeout, |
|
1339 mng_uint8 *iBoundarytype, |
|
1340 mng_int32 *iBoundaryl, |
|
1341 mng_int32 *iBoundaryr, |
|
1342 mng_int32 *iBoundaryt, |
|
1343 mng_int32 *iBoundaryb, |
|
1344 mng_uint32 *iCount, |
|
1345 mng_uint32p *pSyncids) |
|
1346 { |
|
1347 mng_datap pData; |
|
1348 mng_framp pChunk; |
|
1349 |
|
1350 #ifdef MNG_SUPPORT_TRACE |
|
1351 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_FRAM, MNG_LC_START); |
|
1352 #endif |
|
1353 |
|
1354 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1355 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1356 pChunk = (mng_framp)hChunk; /* address the chunk */ |
|
1357 |
|
1358 if (pChunk->sHeader.iChunkname != MNG_UINT_FRAM) |
|
1359 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1360 |
|
1361 *bEmpty = pChunk->bEmpty; /* fill the fields */ |
|
1362 *iMode = pChunk->iMode; |
|
1363 *iNamesize = pChunk->iNamesize; |
|
1364 *zName = pChunk->zName; |
|
1365 *iChangedelay = pChunk->iChangedelay; |
|
1366 *iChangetimeout = pChunk->iChangetimeout; |
|
1367 *iChangeclipping = pChunk->iChangeclipping; |
|
1368 *iChangesyncid = pChunk->iChangesyncid; |
|
1369 *iDelay = pChunk->iDelay; |
|
1370 *iTimeout = pChunk->iTimeout; |
|
1371 *iBoundarytype = pChunk->iBoundarytype; |
|
1372 *iBoundaryl = pChunk->iBoundaryl; |
|
1373 *iBoundaryr = pChunk->iBoundaryr; |
|
1374 *iBoundaryt = pChunk->iBoundaryt; |
|
1375 *iBoundaryb = pChunk->iBoundaryb; |
|
1376 *iCount = pChunk->iCount; |
|
1377 *pSyncids = pChunk->pSyncids; |
|
1378 |
|
1379 #ifdef MNG_SUPPORT_TRACE |
|
1380 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_FRAM, MNG_LC_END); |
|
1381 #endif |
|
1382 |
|
1383 return MNG_NOERROR; |
|
1384 } |
|
1385 #endif |
|
1386 |
|
1387 /* ************************************************************************** */ |
|
1388 |
|
1389 #ifndef MNG_SKIPCHUNK_MOVE |
|
1390 mng_retcode MNG_DECL mng_getchunk_move (mng_handle hHandle, |
|
1391 mng_handle hChunk, |
|
1392 mng_uint16 *iFirstid, |
|
1393 mng_uint16 *iLastid, |
|
1394 mng_uint8 *iMovetype, |
|
1395 mng_int32 *iMovex, |
|
1396 mng_int32 *iMovey) |
|
1397 { |
|
1398 mng_datap pData; |
|
1399 mng_movep pChunk; |
|
1400 |
|
1401 #ifdef MNG_SUPPORT_TRACE |
|
1402 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MOVE, MNG_LC_START); |
|
1403 #endif |
|
1404 |
|
1405 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1406 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1407 pChunk = (mng_movep)hChunk; /* address the chunk */ |
|
1408 |
|
1409 if (pChunk->sHeader.iChunkname != MNG_UINT_MOVE) |
|
1410 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1411 |
|
1412 *iFirstid = pChunk->iFirstid; /* fill the fields */ |
|
1413 *iLastid = pChunk->iLastid; |
|
1414 *iMovetype = pChunk->iMovetype; |
|
1415 *iMovex = pChunk->iMovex; |
|
1416 *iMovey = pChunk->iMovey; |
|
1417 |
|
1418 #ifdef MNG_SUPPORT_TRACE |
|
1419 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MOVE, MNG_LC_END); |
|
1420 #endif |
|
1421 |
|
1422 return MNG_NOERROR; |
|
1423 } |
|
1424 #endif |
|
1425 |
|
1426 /* ************************************************************************** */ |
|
1427 |
|
1428 #ifndef MNG_SKIPCHUNK_CLIP |
|
1429 mng_retcode MNG_DECL mng_getchunk_clip (mng_handle hHandle, |
|
1430 mng_handle hChunk, |
|
1431 mng_uint16 *iFirstid, |
|
1432 mng_uint16 *iLastid, |
|
1433 mng_uint8 *iCliptype, |
|
1434 mng_int32 *iClipl, |
|
1435 mng_int32 *iClipr, |
|
1436 mng_int32 *iClipt, |
|
1437 mng_int32 *iClipb) |
|
1438 { |
|
1439 mng_datap pData; |
|
1440 mng_clipp pChunk; |
|
1441 |
|
1442 #ifdef MNG_SUPPORT_TRACE |
|
1443 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CLIP, MNG_LC_START); |
|
1444 #endif |
|
1445 |
|
1446 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1447 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1448 pChunk = (mng_clipp)hChunk; /* address the chunk */ |
|
1449 |
|
1450 if (pChunk->sHeader.iChunkname != MNG_UINT_CLIP) |
|
1451 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1452 |
|
1453 *iFirstid = pChunk->iFirstid; /* fill the fields */ |
|
1454 *iLastid = pChunk->iLastid; |
|
1455 *iCliptype = pChunk->iCliptype; |
|
1456 *iClipl = pChunk->iClipl; |
|
1457 *iClipr = pChunk->iClipr; |
|
1458 *iClipt = pChunk->iClipt; |
|
1459 *iClipb = pChunk->iClipb; |
|
1460 |
|
1461 #ifdef MNG_SUPPORT_TRACE |
|
1462 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CLIP, MNG_LC_END); |
|
1463 #endif |
|
1464 |
|
1465 return MNG_NOERROR; |
|
1466 } |
|
1467 #endif |
|
1468 |
|
1469 /* ************************************************************************** */ |
|
1470 |
|
1471 #ifndef MNG_SKIPCHUNK_SHOW |
|
1472 mng_retcode MNG_DECL mng_getchunk_show (mng_handle hHandle, |
|
1473 mng_handle hChunk, |
|
1474 mng_bool *bEmpty, |
|
1475 mng_uint16 *iFirstid, |
|
1476 mng_uint16 *iLastid, |
|
1477 mng_uint8 *iMode) |
|
1478 { |
|
1479 mng_datap pData; |
|
1480 mng_showp pChunk; |
|
1481 |
|
1482 #ifdef MNG_SUPPORT_TRACE |
|
1483 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SHOW, MNG_LC_START); |
|
1484 #endif |
|
1485 |
|
1486 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1487 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1488 pChunk = (mng_showp)hChunk; /* address the chunk */ |
|
1489 |
|
1490 if (pChunk->sHeader.iChunkname != MNG_UINT_SHOW) |
|
1491 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1492 |
|
1493 *bEmpty = pChunk->bEmpty; /* fill the fields */ |
|
1494 *iFirstid = pChunk->iFirstid; |
|
1495 *iLastid = pChunk->iLastid; |
|
1496 *iMode = pChunk->iMode; |
|
1497 |
|
1498 #ifdef MNG_SUPPORT_TRACE |
|
1499 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SHOW, MNG_LC_END); |
|
1500 #endif |
|
1501 |
|
1502 return MNG_NOERROR; |
|
1503 } |
|
1504 #endif |
|
1505 |
|
1506 /* ************************************************************************** */ |
|
1507 |
|
1508 #ifndef MNG_SKIPCHUNK_TERM |
|
1509 mng_retcode MNG_DECL mng_getchunk_term (mng_handle hHandle, |
|
1510 mng_handle hChunk, |
|
1511 mng_uint8 *iTermaction, |
|
1512 mng_uint8 *iIteraction, |
|
1513 mng_uint32 *iDelay, |
|
1514 mng_uint32 *iItermax) |
|
1515 { |
|
1516 mng_datap pData; |
|
1517 mng_termp pChunk; |
|
1518 |
|
1519 #ifdef MNG_SUPPORT_TRACE |
|
1520 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TERM, MNG_LC_START); |
|
1521 #endif |
|
1522 |
|
1523 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1524 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1525 pChunk = (mng_termp)hChunk; /* address the chunk */ |
|
1526 |
|
1527 if (pChunk->sHeader.iChunkname != MNG_UINT_TERM) |
|
1528 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1529 |
|
1530 *iTermaction = pChunk->iTermaction; /* fill the fields */ |
|
1531 *iIteraction = pChunk->iIteraction; |
|
1532 *iDelay = pChunk->iDelay; |
|
1533 *iItermax = pChunk->iItermax; |
|
1534 |
|
1535 #ifdef MNG_SUPPORT_TRACE |
|
1536 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TERM, MNG_LC_END); |
|
1537 #endif |
|
1538 |
|
1539 return MNG_NOERROR; |
|
1540 } |
|
1541 #endif |
|
1542 |
|
1543 /* ************************************************************************** */ |
|
1544 |
|
1545 #ifndef MNG_SKIPCHUNK_SAVE |
|
1546 mng_retcode MNG_DECL mng_getchunk_save (mng_handle hHandle, |
|
1547 mng_handle hChunk, |
|
1548 mng_bool *bEmpty, |
|
1549 mng_uint8 *iOffsettype, |
|
1550 mng_uint32 *iCount) |
|
1551 { |
|
1552 mng_datap pData; |
|
1553 mng_savep pChunk; |
|
1554 |
|
1555 #ifdef MNG_SUPPORT_TRACE |
|
1556 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SAVE, MNG_LC_START); |
|
1557 #endif |
|
1558 |
|
1559 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1560 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1561 pChunk = (mng_savep)hChunk; /* address the chunk */ |
|
1562 |
|
1563 if (pChunk->sHeader.iChunkname != MNG_UINT_SAVE) |
|
1564 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1565 |
|
1566 *bEmpty = pChunk->bEmpty; /* fill the fields */ |
|
1567 *iOffsettype = pChunk->iOffsettype; |
|
1568 *iCount = pChunk->iCount; |
|
1569 |
|
1570 #ifdef MNG_SUPPORT_TRACE |
|
1571 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SAVE, MNG_LC_END); |
|
1572 #endif |
|
1573 |
|
1574 return MNG_NOERROR; |
|
1575 } |
|
1576 |
|
1577 /* ************************************************************************** */ |
|
1578 |
|
1579 mng_retcode MNG_DECL mng_getchunk_save_entry (mng_handle hHandle, |
|
1580 mng_handle hChunk, |
|
1581 mng_uint32 iEntry, |
|
1582 mng_uint8 *iEntrytype, |
|
1583 mng_uint32arr2 *iOffset, |
|
1584 mng_uint32arr2 *iStarttime, |
|
1585 mng_uint32 *iLayernr, |
|
1586 mng_uint32 *iFramenr, |
|
1587 mng_uint32 *iNamesize, |
|
1588 mng_pchar *zName) |
|
1589 { |
|
1590 mng_datap pData; |
|
1591 mng_savep pChunk; |
|
1592 mng_save_entryp pEntry; |
|
1593 |
|
1594 #ifdef MNG_SUPPORT_TRACE |
|
1595 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SAVE_ENTRY, MNG_LC_START); |
|
1596 #endif |
|
1597 |
|
1598 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1599 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1600 pChunk = (mng_savep)hChunk; /* address the chunk */ |
|
1601 |
|
1602 if (pChunk->sHeader.iChunkname != MNG_UINT_SAVE) |
|
1603 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1604 |
|
1605 if (iEntry >= pChunk->iCount) /* valid index ? */ |
|
1606 MNG_ERROR (pData, MNG_INVALIDENTRYIX) |
|
1607 |
|
1608 pEntry = pChunk->pEntries + iEntry; /* address the entry */ |
|
1609 /* fill the fields */ |
|
1610 *iEntrytype = pEntry->iEntrytype; |
|
1611 (*iOffset)[0] = pEntry->iOffset[0]; |
|
1612 (*iOffset)[1] = pEntry->iOffset[1]; |
|
1613 (*iStarttime)[0] = pEntry->iStarttime[0]; |
|
1614 (*iStarttime)[1] = pEntry->iStarttime[1]; |
|
1615 *iLayernr = pEntry->iLayernr; |
|
1616 *iFramenr = pEntry->iFramenr; |
|
1617 *iNamesize = pEntry->iNamesize; |
|
1618 *zName = pEntry->zName; |
|
1619 |
|
1620 #ifdef MNG_SUPPORT_TRACE |
|
1621 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SAVE_ENTRY, MNG_LC_END); |
|
1622 #endif |
|
1623 |
|
1624 return MNG_NOERROR; |
|
1625 } |
|
1626 #endif |
|
1627 |
|
1628 /* ************************************************************************** */ |
|
1629 |
|
1630 #ifndef MNG_SKIPCHUNK_SEEK |
|
1631 mng_retcode MNG_DECL mng_getchunk_seek (mng_handle hHandle, |
|
1632 mng_handle hChunk, |
|
1633 mng_uint32 *iNamesize, |
|
1634 mng_pchar *zName) |
|
1635 { |
|
1636 mng_datap pData; |
|
1637 mng_seekp pChunk; |
|
1638 |
|
1639 #ifdef MNG_SUPPORT_TRACE |
|
1640 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SEEK, MNG_LC_START); |
|
1641 #endif |
|
1642 |
|
1643 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1644 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1645 pChunk = (mng_seekp)hChunk; /* address the chunk */ |
|
1646 |
|
1647 if (pChunk->sHeader.iChunkname != MNG_UINT_SEEK) |
|
1648 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1649 |
|
1650 *iNamesize = pChunk->iNamesize; /* fill the fields */ |
|
1651 *zName = pChunk->zName; |
|
1652 |
|
1653 #ifdef MNG_SUPPORT_TRACE |
|
1654 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SEEK, MNG_LC_END); |
|
1655 #endif |
|
1656 |
|
1657 return MNG_NOERROR; |
|
1658 } |
|
1659 #endif |
|
1660 |
|
1661 /* ************************************************************************** */ |
|
1662 |
|
1663 #ifndef MNG_SKIPCHUNK_eXPI |
|
1664 mng_retcode MNG_DECL mng_getchunk_expi (mng_handle hHandle, |
|
1665 mng_handle hChunk, |
|
1666 mng_uint16 *iSnapshotid, |
|
1667 mng_uint32 *iNamesize, |
|
1668 mng_pchar *zName) |
|
1669 { |
|
1670 mng_datap pData; |
|
1671 mng_expip pChunk; |
|
1672 |
|
1673 #ifdef MNG_SUPPORT_TRACE |
|
1674 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EXPI, MNG_LC_START); |
|
1675 #endif |
|
1676 |
|
1677 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1678 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1679 pChunk = (mng_expip)hChunk; /* address the chunk */ |
|
1680 |
|
1681 if (pChunk->sHeader.iChunkname != MNG_UINT_eXPI) |
|
1682 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1683 |
|
1684 *iSnapshotid = pChunk->iSnapshotid; /* fill the fields */ |
|
1685 *iNamesize = pChunk->iNamesize; |
|
1686 *zName = pChunk->zName; |
|
1687 |
|
1688 #ifdef MNG_SUPPORT_TRACE |
|
1689 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EXPI, MNG_LC_END); |
|
1690 #endif |
|
1691 |
|
1692 return MNG_NOERROR; |
|
1693 } |
|
1694 #endif |
|
1695 |
|
1696 /* ************************************************************************** */ |
|
1697 |
|
1698 #ifndef MNG_SKIPCHUNK_fPRI |
|
1699 mng_retcode MNG_DECL mng_getchunk_fpri (mng_handle hHandle, |
|
1700 mng_handle hChunk, |
|
1701 mng_uint8 *iDeltatype, |
|
1702 mng_uint8 *iPriority) |
|
1703 { |
|
1704 mng_datap pData; |
|
1705 mng_fprip pChunk; |
|
1706 |
|
1707 #ifdef MNG_SUPPORT_TRACE |
|
1708 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_FPRI, MNG_LC_START); |
|
1709 #endif |
|
1710 |
|
1711 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1712 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1713 pChunk = (mng_fprip)hChunk; /* address the chunk */ |
|
1714 |
|
1715 if (pChunk->sHeader.iChunkname != MNG_UINT_fPRI) |
|
1716 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1717 |
|
1718 *iDeltatype = pChunk->iDeltatype; /* fill the fields */ |
|
1719 *iPriority = pChunk->iPriority; |
|
1720 |
|
1721 #ifdef MNG_SUPPORT_TRACE |
|
1722 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_FPRI, MNG_LC_END); |
|
1723 #endif |
|
1724 |
|
1725 return MNG_NOERROR; |
|
1726 } |
|
1727 #endif |
|
1728 |
|
1729 /* ************************************************************************** */ |
|
1730 |
|
1731 #ifndef MNG_SKIPCHUNK_nEED |
|
1732 mng_retcode MNG_DECL mng_getchunk_need (mng_handle hHandle, |
|
1733 mng_handle hChunk, |
|
1734 mng_uint32 *iKeywordssize, |
|
1735 mng_pchar *zKeywords) |
|
1736 { |
|
1737 mng_datap pData; |
|
1738 mng_needp pChunk; |
|
1739 |
|
1740 #ifdef MNG_SUPPORT_TRACE |
|
1741 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_NEED, MNG_LC_START); |
|
1742 #endif |
|
1743 |
|
1744 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1745 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1746 pChunk = (mng_needp)hChunk; /* address the chunk */ |
|
1747 |
|
1748 if (pChunk->sHeader.iChunkname != MNG_UINT_nEED) |
|
1749 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1750 /* fill the fields */ |
|
1751 *iKeywordssize = pChunk->iKeywordssize; |
|
1752 *zKeywords = pChunk->zKeywords; |
|
1753 |
|
1754 #ifdef MNG_SUPPORT_TRACE |
|
1755 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_NEED, MNG_LC_END); |
|
1756 #endif |
|
1757 |
|
1758 return MNG_NOERROR; |
|
1759 } |
|
1760 #endif |
|
1761 |
|
1762 /* ************************************************************************** */ |
|
1763 |
|
1764 #ifndef MNG_SKIPCHUNK_pHYg |
|
1765 mng_retcode MNG_DECL mng_getchunk_phyg (mng_handle hHandle, |
|
1766 mng_handle hChunk, |
|
1767 mng_bool *bEmpty, |
|
1768 mng_uint32 *iSizex, |
|
1769 mng_uint32 *iSizey, |
|
1770 mng_uint8 *iUnit) |
|
1771 { |
|
1772 mng_datap pData; |
|
1773 mng_phygp pChunk; |
|
1774 |
|
1775 #ifdef MNG_SUPPORT_TRACE |
|
1776 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PHYG, MNG_LC_START); |
|
1777 #endif |
|
1778 |
|
1779 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1780 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1781 pChunk = (mng_phygp)hChunk; /* address the chunk */ |
|
1782 |
|
1783 if (pChunk->sHeader.iChunkname != MNG_UINT_pHYg) |
|
1784 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1785 |
|
1786 *bEmpty = pChunk->bEmpty; /* fill the fields */ |
|
1787 *iSizex = pChunk->iSizex; |
|
1788 *iSizey = pChunk->iSizey; |
|
1789 *iUnit = pChunk->iUnit; |
|
1790 |
|
1791 #ifdef MNG_SUPPORT_TRACE |
|
1792 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PHYG, MNG_LC_END); |
|
1793 #endif |
|
1794 |
|
1795 return MNG_NOERROR; |
|
1796 } |
|
1797 #endif |
|
1798 |
|
1799 /* ************************************************************************** */ |
|
1800 |
|
1801 #ifdef MNG_INCLUDE_JNG |
|
1802 |
|
1803 mng_retcode MNG_DECL mng_getchunk_jhdr (mng_handle hHandle, |
|
1804 mng_handle hChunk, |
|
1805 mng_uint32 *iWidth, |
|
1806 mng_uint32 *iHeight, |
|
1807 mng_uint8 *iColortype, |
|
1808 mng_uint8 *iImagesampledepth, |
|
1809 mng_uint8 *iImagecompression, |
|
1810 mng_uint8 *iImageinterlace, |
|
1811 mng_uint8 *iAlphasampledepth, |
|
1812 mng_uint8 *iAlphacompression, |
|
1813 mng_uint8 *iAlphafilter, |
|
1814 mng_uint8 *iAlphainterlace) |
|
1815 { |
|
1816 mng_datap pData; |
|
1817 mng_jhdrp pChunk; |
|
1818 |
|
1819 #ifdef MNG_SUPPORT_TRACE |
|
1820 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JHDR, MNG_LC_START); |
|
1821 #endif |
|
1822 |
|
1823 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1824 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1825 pChunk = (mng_jhdrp)hChunk; /* address the chunk */ |
|
1826 |
|
1827 if (pChunk->sHeader.iChunkname != MNG_UINT_JHDR) |
|
1828 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1829 |
|
1830 *iWidth = pChunk->iWidth; /* fill the fields */ |
|
1831 *iHeight = pChunk->iHeight; |
|
1832 *iColortype = pChunk->iColortype; |
|
1833 *iImagesampledepth = pChunk->iImagesampledepth; |
|
1834 *iImagecompression = pChunk->iImagecompression; |
|
1835 *iImageinterlace = pChunk->iImageinterlace; |
|
1836 *iAlphasampledepth = pChunk->iAlphasampledepth; |
|
1837 *iAlphacompression = pChunk->iAlphacompression; |
|
1838 *iAlphafilter = pChunk->iAlphafilter; |
|
1839 *iAlphainterlace = pChunk->iAlphainterlace; |
|
1840 |
|
1841 #ifdef MNG_SUPPORT_TRACE |
|
1842 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JHDR, MNG_LC_END); |
|
1843 #endif |
|
1844 |
|
1845 return MNG_NOERROR; |
|
1846 } |
|
1847 |
|
1848 #endif /* MNG_INCLUDE_JNG */ |
|
1849 |
|
1850 /* ************************************************************************** */ |
|
1851 |
|
1852 #ifdef MNG_INCLUDE_JNG |
|
1853 |
|
1854 mng_retcode MNG_DECL mng_getchunk_jdat (mng_handle hHandle, |
|
1855 mng_handle hChunk, |
|
1856 mng_uint32 *iRawlen, |
|
1857 mng_ptr *pRawdata) |
|
1858 { |
|
1859 mng_datap pData; |
|
1860 mng_jdatp pChunk; |
|
1861 |
|
1862 #ifdef MNG_SUPPORT_TRACE |
|
1863 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JDAT, MNG_LC_START); |
|
1864 #endif |
|
1865 |
|
1866 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1867 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1868 pChunk = (mng_jdatp)hChunk; /* address the chunk */ |
|
1869 |
|
1870 if (pChunk->sHeader.iChunkname != MNG_UINT_JDAT) |
|
1871 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1872 |
|
1873 *iRawlen = pChunk->iDatasize; /* fill the fields */ |
|
1874 *pRawdata = pChunk->pData; |
|
1875 |
|
1876 #ifdef MNG_SUPPORT_TRACE |
|
1877 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JDAT, MNG_LC_END); |
|
1878 #endif |
|
1879 |
|
1880 return MNG_NOERROR; |
|
1881 } |
|
1882 |
|
1883 #endif /* MNG_INCLUDE_JNG */ |
|
1884 |
|
1885 /* ************************************************************************** */ |
|
1886 |
|
1887 #ifdef MNG_INCLUDE_JNG |
|
1888 |
|
1889 mng_retcode MNG_DECL mng_getchunk_jdaa (mng_handle hHandle, |
|
1890 mng_handle hChunk, |
|
1891 mng_uint32 *iRawlen, |
|
1892 mng_ptr *pRawdata) |
|
1893 { |
|
1894 mng_datap pData; |
|
1895 mng_jdaap pChunk; |
|
1896 |
|
1897 #ifdef MNG_SUPPORT_TRACE |
|
1898 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JDAA, MNG_LC_START); |
|
1899 #endif |
|
1900 |
|
1901 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1902 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1903 pChunk = (mng_jdaap)hChunk; /* address the chunk */ |
|
1904 |
|
1905 if (pChunk->sHeader.iChunkname != MNG_UINT_JDAA) |
|
1906 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1907 |
|
1908 *iRawlen = pChunk->iDatasize; /* fill the fields */ |
|
1909 *pRawdata = pChunk->pData; |
|
1910 |
|
1911 #ifdef MNG_SUPPORT_TRACE |
|
1912 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JDAA, MNG_LC_END); |
|
1913 #endif |
|
1914 |
|
1915 return MNG_NOERROR; |
|
1916 } |
|
1917 |
|
1918 #endif /* MNG_INCLUDE_JNG */ |
|
1919 |
|
1920 /* ************************************************************************** */ |
|
1921 |
|
1922 #ifndef MNG_NO_DELTA_PNG |
|
1923 mng_retcode MNG_DECL mng_getchunk_dhdr (mng_handle hHandle, |
|
1924 mng_handle hChunk, |
|
1925 mng_uint16 *iObjectid, |
|
1926 mng_uint8 *iImagetype, |
|
1927 mng_uint8 *iDeltatype, |
|
1928 mng_uint32 *iBlockwidth, |
|
1929 mng_uint32 *iBlockheight, |
|
1930 mng_uint32 *iBlockx, |
|
1931 mng_uint32 *iBlocky) |
|
1932 { |
|
1933 mng_datap pData; |
|
1934 mng_dhdrp pChunk; |
|
1935 |
|
1936 #ifdef MNG_SUPPORT_TRACE |
|
1937 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DHDR, MNG_LC_START); |
|
1938 #endif |
|
1939 |
|
1940 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1941 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1942 pChunk = (mng_dhdrp)hChunk; /* address the chunk */ |
|
1943 |
|
1944 if (pChunk->sHeader.iChunkname != MNG_UINT_DHDR) |
|
1945 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1946 |
|
1947 *iObjectid = pChunk->iObjectid; /* fill the fields */ |
|
1948 *iImagetype = pChunk->iImagetype; |
|
1949 *iDeltatype = pChunk->iDeltatype; |
|
1950 *iBlockwidth = pChunk->iBlockwidth; |
|
1951 *iBlockheight = pChunk->iBlockheight; |
|
1952 *iBlockx = pChunk->iBlockx; |
|
1953 *iBlocky = pChunk->iBlocky; |
|
1954 |
|
1955 #ifdef MNG_SUPPORT_TRACE |
|
1956 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DHDR, MNG_LC_END); |
|
1957 #endif |
|
1958 |
|
1959 return MNG_NOERROR; |
|
1960 } |
|
1961 #endif |
|
1962 |
|
1963 /* ************************************************************************** */ |
|
1964 |
|
1965 #ifndef MNG_NO_DELTA_PNG |
|
1966 mng_retcode MNG_DECL mng_getchunk_prom (mng_handle hHandle, |
|
1967 mng_handle hChunk, |
|
1968 mng_uint8 *iColortype, |
|
1969 mng_uint8 *iSampledepth, |
|
1970 mng_uint8 *iFilltype) |
|
1971 { |
|
1972 mng_datap pData; |
|
1973 mng_promp pChunk; |
|
1974 |
|
1975 #ifdef MNG_SUPPORT_TRACE |
|
1976 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PROM, MNG_LC_START); |
|
1977 #endif |
|
1978 |
|
1979 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
1980 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
1981 pChunk = (mng_promp)hChunk; /* address the chunk */ |
|
1982 |
|
1983 if (pChunk->sHeader.iChunkname != MNG_UINT_PROM) |
|
1984 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
1985 |
|
1986 *iColortype = pChunk->iColortype; /* fill the fields */ |
|
1987 *iSampledepth = pChunk->iSampledepth; |
|
1988 *iFilltype = pChunk->iFilltype; |
|
1989 |
|
1990 #ifdef MNG_SUPPORT_TRACE |
|
1991 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PROM, MNG_LC_END); |
|
1992 #endif |
|
1993 |
|
1994 return MNG_NOERROR; |
|
1995 } |
|
1996 #endif |
|
1997 |
|
1998 /* ************************************************************************** */ |
|
1999 |
|
2000 #ifndef MNG_NO_DELTA_PNG |
|
2001 mng_retcode MNG_DECL mng_getchunk_pplt (mng_handle hHandle, |
|
2002 mng_handle hChunk, |
|
2003 mng_uint8 *iDeltatype, |
|
2004 mng_uint32 *iCount) |
|
2005 { |
|
2006 mng_datap pData; |
|
2007 mng_ppltp pChunk; |
|
2008 |
|
2009 #ifdef MNG_SUPPORT_TRACE |
|
2010 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PPLT, MNG_LC_START); |
|
2011 #endif |
|
2012 |
|
2013 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
2014 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
2015 pChunk = (mng_ppltp)hChunk; /* address the chunk */ |
|
2016 |
|
2017 if (pChunk->sHeader.iChunkname != MNG_UINT_PPLT) |
|
2018 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
2019 |
|
2020 *iDeltatype = pChunk->iDeltatype; /* fill the fields */ |
|
2021 *iCount = pChunk->iCount; |
|
2022 |
|
2023 #ifdef MNG_SUPPORT_TRACE |
|
2024 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PPLT, MNG_LC_END); |
|
2025 #endif |
|
2026 |
|
2027 return MNG_NOERROR; |
|
2028 } |
|
2029 #endif |
|
2030 |
|
2031 /* ************************************************************************** */ |
|
2032 |
|
2033 #ifndef MNG_NO_DELTA_PNG |
|
2034 mng_retcode MNG_DECL mng_getchunk_pplt_entry (mng_handle hHandle, |
|
2035 mng_handle hChunk, |
|
2036 mng_uint32 iEntry, |
|
2037 mng_uint16 *iRed, |
|
2038 mng_uint16 *iGreen, |
|
2039 mng_uint16 *iBlue, |
|
2040 mng_uint16 *iAlpha, |
|
2041 mng_bool *bUsed) |
|
2042 { |
|
2043 mng_datap pData; |
|
2044 mng_ppltp pChunk; |
|
2045 mng_pplt_entryp pEntry; |
|
2046 |
|
2047 #ifdef MNG_SUPPORT_TRACE |
|
2048 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PPLT_ENTRY, MNG_LC_START); |
|
2049 #endif |
|
2050 |
|
2051 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
2052 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
2053 pChunk = (mng_ppltp)hChunk; /* address the chunk */ |
|
2054 |
|
2055 if (pChunk->sHeader.iChunkname != MNG_UINT_PPLT) |
|
2056 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
2057 |
|
2058 if (iEntry >= pChunk->iCount) /* valid index ? */ |
|
2059 MNG_ERROR (pData, MNG_INVALIDENTRYIX) |
|
2060 |
|
2061 pEntry = &pChunk->aEntries[iEntry]; /* address the entry */ |
|
2062 |
|
2063 *iRed = pEntry->iRed; /* fill the fields */ |
|
2064 *iGreen = pEntry->iGreen; |
|
2065 *iBlue = pEntry->iBlue; |
|
2066 *iAlpha = pEntry->iAlpha; |
|
2067 *bUsed = pEntry->bUsed; |
|
2068 |
|
2069 #ifdef MNG_SUPPORT_TRACE |
|
2070 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PPLT_ENTRY, MNG_LC_END); |
|
2071 #endif |
|
2072 |
|
2073 return MNG_NOERROR; |
|
2074 } |
|
2075 #endif |
|
2076 |
|
2077 /* ************************************************************************** */ |
|
2078 |
|
2079 #ifndef MNG_NO_DELTA_PNG |
|
2080 mng_retcode MNG_DECL mng_getchunk_drop (mng_handle hHandle, |
|
2081 mng_handle hChunk, |
|
2082 mng_uint32 *iCount, |
|
2083 mng_chunkidp *pChunknames) |
|
2084 { |
|
2085 mng_datap pData; |
|
2086 mng_dropp pChunk; |
|
2087 |
|
2088 #ifdef MNG_SUPPORT_TRACE |
|
2089 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DROP, MNG_LC_START); |
|
2090 #endif |
|
2091 |
|
2092 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
2093 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
2094 pChunk = (mng_dropp)hChunk; /* address the chunk */ |
|
2095 |
|
2096 if (pChunk->sHeader.iChunkname != MNG_UINT_DROP) |
|
2097 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
2098 |
|
2099 *iCount = pChunk->iCount; /* fill the fields */ |
|
2100 *pChunknames = pChunk->pChunknames; |
|
2101 |
|
2102 #ifdef MNG_SUPPORT_TRACE |
|
2103 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DROP, MNG_LC_END); |
|
2104 #endif |
|
2105 |
|
2106 return MNG_NOERROR; |
|
2107 } |
|
2108 #endif |
|
2109 |
|
2110 /* ************************************************************************** */ |
|
2111 |
|
2112 #ifndef MNG_NO_DELTA_PNG |
|
2113 #ifndef MNG_SKIPCHUNK_DBYK |
|
2114 mng_retcode MNG_DECL mng_getchunk_dbyk (mng_handle hHandle, |
|
2115 mng_handle hChunk, |
|
2116 mng_chunkid *iChunkname, |
|
2117 mng_uint8 *iPolarity, |
|
2118 mng_uint32 *iKeywordssize, |
|
2119 mng_pchar *zKeywords) |
|
2120 { |
|
2121 mng_datap pData; |
|
2122 mng_dbykp pChunk; |
|
2123 |
|
2124 #ifdef MNG_SUPPORT_TRACE |
|
2125 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DBYK, MNG_LC_START); |
|
2126 #endif |
|
2127 |
|
2128 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
2129 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
2130 pChunk = (mng_dbykp)hChunk; /* address the chunk */ |
|
2131 |
|
2132 if (pChunk->sHeader.iChunkname != MNG_UINT_DBYK) |
|
2133 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
2134 |
|
2135 *iChunkname = pChunk->iChunkname; /* fill the fields */ |
|
2136 *iPolarity = pChunk->iPolarity; |
|
2137 *iKeywordssize = pChunk->iKeywordssize; |
|
2138 *zKeywords = pChunk->zKeywords; |
|
2139 |
|
2140 #ifdef MNG_SUPPORT_TRACE |
|
2141 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DBYK, MNG_LC_END); |
|
2142 #endif |
|
2143 |
|
2144 return MNG_NOERROR; |
|
2145 } |
|
2146 #endif |
|
2147 #endif |
|
2148 |
|
2149 /* ************************************************************************** */ |
|
2150 |
|
2151 #ifndef MNG_NO_DELTA_PNG |
|
2152 #ifndef MNG_SKIPCHUNK_ORDR |
|
2153 mng_retcode MNG_DECL mng_getchunk_ordr (mng_handle hHandle, |
|
2154 mng_handle hChunk, |
|
2155 mng_uint32 *iCount) |
|
2156 { |
|
2157 mng_datap pData; |
|
2158 mng_ordrp pChunk; |
|
2159 |
|
2160 #ifdef MNG_SUPPORT_TRACE |
|
2161 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ORDR, MNG_LC_START); |
|
2162 #endif |
|
2163 |
|
2164 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
2165 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
2166 pChunk = (mng_ordrp)hChunk; /* address the chunk */ |
|
2167 |
|
2168 if (pChunk->sHeader.iChunkname != MNG_UINT_ORDR) |
|
2169 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
2170 |
|
2171 *iCount = pChunk->iCount; /* fill the field */ |
|
2172 |
|
2173 #ifdef MNG_SUPPORT_TRACE |
|
2174 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ORDR, MNG_LC_END); |
|
2175 #endif |
|
2176 |
|
2177 return MNG_NOERROR; |
|
2178 } |
|
2179 #endif |
|
2180 #endif |
|
2181 |
|
2182 /* ************************************************************************** */ |
|
2183 |
|
2184 #ifndef MNG_NO_DELTA_PNG |
|
2185 #ifndef MNG_SKIPCHUNK_ORDR |
|
2186 mng_retcode MNG_DECL mng_getchunk_ordr_entry (mng_handle hHandle, |
|
2187 mng_handle hChunk, |
|
2188 mng_uint32 iEntry, |
|
2189 mng_chunkid *iChunkname, |
|
2190 mng_uint8 *iOrdertype) |
|
2191 { |
|
2192 mng_datap pData; |
|
2193 mng_ordrp pChunk; |
|
2194 mng_ordr_entryp pEntry; |
|
2195 |
|
2196 #ifdef MNG_SUPPORT_TRACE |
|
2197 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ORDR_ENTRY, MNG_LC_START); |
|
2198 #endif |
|
2199 |
|
2200 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
2201 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
2202 pChunk = (mng_ordrp)hChunk; /* address the chunk */ |
|
2203 |
|
2204 if (pChunk->sHeader.iChunkname != MNG_UINT_ORDR) |
|
2205 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
2206 |
|
2207 if (iEntry >= pChunk->iCount) /* valid index ? */ |
|
2208 MNG_ERROR (pData, MNG_INVALIDENTRYIX) |
|
2209 |
|
2210 pEntry = pChunk->pEntries + iEntry; /* address the proper entry */ |
|
2211 |
|
2212 *iChunkname = pEntry->iChunkname; /* fill the fields */ |
|
2213 *iOrdertype = pEntry->iOrdertype; |
|
2214 |
|
2215 #ifdef MNG_SUPPORT_TRACE |
|
2216 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ORDR_ENTRY, MNG_LC_END); |
|
2217 #endif |
|
2218 |
|
2219 return MNG_NOERROR; |
|
2220 } |
|
2221 #endif |
|
2222 #endif |
|
2223 |
|
2224 /* ************************************************************************** */ |
|
2225 |
|
2226 #ifndef MNG_SKIPCHUNK_MAGN |
|
2227 mng_retcode MNG_DECL mng_getchunk_magn (mng_handle hHandle, |
|
2228 mng_handle hChunk, |
|
2229 mng_uint16 *iFirstid, |
|
2230 mng_uint16 *iLastid, |
|
2231 mng_uint16 *iMethodX, |
|
2232 mng_uint16 *iMX, |
|
2233 mng_uint16 *iMY, |
|
2234 mng_uint16 *iML, |
|
2235 mng_uint16 *iMR, |
|
2236 mng_uint16 *iMT, |
|
2237 mng_uint16 *iMB, |
|
2238 mng_uint16 *iMethodY) |
|
2239 { |
|
2240 mng_datap pData; |
|
2241 mng_magnp pChunk; |
|
2242 |
|
2243 #ifdef MNG_SUPPORT_TRACE |
|
2244 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MAGN, MNG_LC_START); |
|
2245 #endif |
|
2246 |
|
2247 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
2248 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
2249 pChunk = (mng_magnp)hChunk; /* address the chunk */ |
|
2250 |
|
2251 if (pChunk->sHeader.iChunkname != MNG_UINT_MAGN) |
|
2252 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
2253 |
|
2254 *iFirstid = pChunk->iFirstid; /* fill the fields */ |
|
2255 *iLastid = pChunk->iLastid; |
|
2256 *iMethodX = (mng_uint16)pChunk->iMethodX; |
|
2257 *iMX = pChunk->iMX; |
|
2258 *iMY = pChunk->iMY; |
|
2259 *iML = pChunk->iML; |
|
2260 *iMR = pChunk->iMR; |
|
2261 *iMT = pChunk->iMT; |
|
2262 *iMB = pChunk->iMB; |
|
2263 *iMethodY = (mng_uint16)pChunk->iMethodY; |
|
2264 |
|
2265 #ifdef MNG_SUPPORT_TRACE |
|
2266 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MAGN, MNG_LC_END); |
|
2267 #endif |
|
2268 |
|
2269 return MNG_NOERROR; |
|
2270 } |
|
2271 #endif |
|
2272 |
|
2273 /* ************************************************************************** */ |
|
2274 |
|
2275 #ifdef MNG_INCLUDE_MPNG_PROPOSAL |
|
2276 MNG_EXT mng_retcode MNG_DECL mng_getchunk_mpng (mng_handle hHandle, |
|
2277 mng_handle hChunk, |
|
2278 mng_uint32 *iFramewidth, |
|
2279 mng_uint32 *iFrameheight, |
|
2280 mng_uint16 *iNumplays, |
|
2281 mng_uint16 *iTickspersec, |
|
2282 mng_uint8 *iCompressionmethod, |
|
2283 mng_uint32 *iCount) |
|
2284 { |
|
2285 mng_datap pData; |
|
2286 mng_mpngp pChunk; |
|
2287 |
|
2288 #ifdef MNG_SUPPORT_TRACE |
|
2289 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MPNG, MNG_LC_START); |
|
2290 #endif |
|
2291 |
|
2292 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
2293 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
2294 pChunk = (mng_mpngp)hChunk; /* address the chunk */ |
|
2295 |
|
2296 if (pChunk->sHeader.iChunkname != MNG_UINT_mpNG) |
|
2297 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
2298 /* fill the fields */ |
|
2299 *iFramewidth = pChunk->iFramewidth; |
|
2300 *iFrameheight = pChunk->iFrameheight; |
|
2301 *iNumplays = pChunk->iNumplays; |
|
2302 *iTickspersec = pChunk->iTickspersec; |
|
2303 *iCompressionmethod = pChunk->iCompressionmethod; |
|
2304 *iCount = pChunk->iFramessize / sizeof (mng_mpng_frame); |
|
2305 |
|
2306 #ifdef MNG_SUPPORT_TRACE |
|
2307 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MPNG, MNG_LC_END); |
|
2308 #endif |
|
2309 |
|
2310 return MNG_NOERROR; |
|
2311 } |
|
2312 #endif |
|
2313 |
|
2314 /* ************************************************************************** */ |
|
2315 |
|
2316 #ifdef MNG_INCLUDE_MPNG_PROPOSAL |
|
2317 MNG_EXT mng_retcode MNG_DECL mng_getchunk_mpng_frame (mng_handle hHandle, |
|
2318 mng_handle hChunk, |
|
2319 mng_uint32 iEntry, |
|
2320 mng_uint32 *iX, |
|
2321 mng_uint32 *iY, |
|
2322 mng_uint32 *iWidth, |
|
2323 mng_uint32 *iHeight, |
|
2324 mng_int32 *iXoffset, |
|
2325 mng_int32 *iYoffset, |
|
2326 mng_uint16 *iTicks) |
|
2327 { |
|
2328 mng_datap pData; |
|
2329 mng_mpngp pChunk; |
|
2330 mng_mpng_framep pFrame; |
|
2331 |
|
2332 #ifdef MNG_SUPPORT_TRACE |
|
2333 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MPNG_FRAME, MNG_LC_START); |
|
2334 #endif |
|
2335 |
|
2336 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
2337 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
2338 pChunk = (mng_mpngp)hChunk; /* address the chunk */ |
|
2339 |
|
2340 if (pChunk->sHeader.iChunkname != MNG_UINT_mpNG) |
|
2341 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
2342 /* valid index ? */ |
|
2343 if (iEntry >= (pChunk->iFramessize / sizeof (mng_mpng_frame))) |
|
2344 MNG_ERROR (pData, MNG_INVALIDENTRYIX) |
|
2345 |
|
2346 pFrame = pChunk->pFrames + iEntry; /* address the entry */ |
|
2347 /* fill the fields */ |
|
2348 *iX = pFrame->iX; |
|
2349 *iY = pFrame->iY; |
|
2350 *iWidth = pFrame->iWidth; |
|
2351 *iHeight = pFrame->iHeight; |
|
2352 *iXoffset = pFrame->iXoffset; |
|
2353 *iYoffset = pFrame->iYoffset; |
|
2354 *iTicks = pFrame->iTicks; |
|
2355 |
|
2356 #ifdef MNG_SUPPORT_TRACE |
|
2357 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MPNG_FRAME, MNG_LC_END); |
|
2358 #endif |
|
2359 |
|
2360 return MNG_NOERROR; |
|
2361 } |
|
2362 #endif |
|
2363 |
|
2364 /* ************************************************************************** */ |
|
2365 |
|
2366 #ifndef MNG_SKIPCHUNK_evNT |
|
2367 mng_retcode MNG_DECL mng_getchunk_evnt (mng_handle hHandle, |
|
2368 mng_handle hChunk, |
|
2369 mng_uint32 *iCount) |
|
2370 { |
|
2371 mng_datap pData; |
|
2372 mng_evntp pChunk; |
|
2373 |
|
2374 #ifdef MNG_SUPPORT_TRACE |
|
2375 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EVNT, MNG_LC_START); |
|
2376 #endif |
|
2377 |
|
2378 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
2379 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
2380 pChunk = (mng_evntp)hChunk; /* address the chunk */ |
|
2381 |
|
2382 if (pChunk->sHeader.iChunkname != MNG_UINT_evNT) |
|
2383 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
2384 |
|
2385 *iCount = pChunk->iCount; /* fill the fields */ |
|
2386 |
|
2387 #ifdef MNG_SUPPORT_TRACE |
|
2388 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EVNT, MNG_LC_END); |
|
2389 #endif |
|
2390 |
|
2391 return MNG_NOERROR; |
|
2392 } |
|
2393 |
|
2394 /* ************************************************************************** */ |
|
2395 |
|
2396 mng_retcode MNG_DECL mng_getchunk_evnt_entry (mng_handle hHandle, |
|
2397 mng_handle hChunk, |
|
2398 mng_uint32 iEntry, |
|
2399 mng_uint8 *iEventtype, |
|
2400 mng_uint8 *iMasktype, |
|
2401 mng_int32 *iLeft, |
|
2402 mng_int32 *iRight, |
|
2403 mng_int32 *iTop, |
|
2404 mng_int32 *iBottom, |
|
2405 mng_uint16 *iObjectid, |
|
2406 mng_uint8 *iIndex, |
|
2407 mng_uint32 *iSegmentnamesize, |
|
2408 mng_pchar *zSegmentname) |
|
2409 { |
|
2410 mng_datap pData; |
|
2411 mng_evntp pChunk; |
|
2412 mng_evnt_entryp pEntry; |
|
2413 |
|
2414 #ifdef MNG_SUPPORT_TRACE |
|
2415 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EVNT_ENTRY, MNG_LC_START); |
|
2416 #endif |
|
2417 |
|
2418 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
2419 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
2420 pChunk = (mng_evntp)hChunk; /* address the chunk */ |
|
2421 |
|
2422 if (pChunk->sHeader.iChunkname != MNG_UINT_evNT) |
|
2423 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
2424 |
|
2425 if (iEntry >= pChunk->iCount) /* valid index ? */ |
|
2426 MNG_ERROR (pData, MNG_INVALIDENTRYIX) |
|
2427 |
|
2428 pEntry = pChunk->pEntries + iEntry; /* address the entry */ |
|
2429 /* fill the fields */ |
|
2430 *iEventtype = pEntry->iEventtype; |
|
2431 *iMasktype = pEntry->iMasktype; |
|
2432 *iLeft = pEntry->iLeft; |
|
2433 *iRight = pEntry->iRight; |
|
2434 *iTop = pEntry->iTop; |
|
2435 *iBottom = pEntry->iBottom; |
|
2436 *iObjectid = pEntry->iObjectid; |
|
2437 *iIndex = pEntry->iIndex; |
|
2438 *iSegmentnamesize = pEntry->iSegmentnamesize; |
|
2439 *zSegmentname = pEntry->zSegmentname; |
|
2440 |
|
2441 #ifdef MNG_SUPPORT_TRACE |
|
2442 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EVNT_ENTRY, MNG_LC_END); |
|
2443 #endif |
|
2444 |
|
2445 return MNG_NOERROR; |
|
2446 } |
|
2447 #endif |
|
2448 |
|
2449 /* ************************************************************************** */ |
|
2450 |
|
2451 mng_retcode MNG_DECL mng_getchunk_unknown (mng_handle hHandle, |
|
2452 mng_handle hChunk, |
|
2453 mng_chunkid *iChunkname, |
|
2454 mng_uint32 *iRawlen, |
|
2455 mng_ptr *pRawdata) |
|
2456 { |
|
2457 mng_datap pData; |
|
2458 mng_unknown_chunkp pChunk; |
|
2459 |
|
2460 #ifdef MNG_SUPPORT_TRACE |
|
2461 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_UNKNOWN, MNG_LC_START); |
|
2462 #endif |
|
2463 |
|
2464 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
2465 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
2466 pChunk = (mng_unknown_chunkp)hChunk; /* address the chunk */ |
|
2467 |
|
2468 if (pChunk->sHeader.fCleanup != mng_free_unknown) |
|
2469 MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ |
|
2470 /* fill the fields */ |
|
2471 *iChunkname = pChunk->sHeader.iChunkname; |
|
2472 *iRawlen = pChunk->iDatasize; |
|
2473 *pRawdata = pChunk->pData; |
|
2474 |
|
2475 #ifdef MNG_SUPPORT_TRACE |
|
2476 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_UNKNOWN, MNG_LC_END); |
|
2477 #endif |
|
2478 |
|
2479 return MNG_NOERROR; |
|
2480 } |
|
2481 |
|
2482 /* ************************************************************************** */ |
|
2483 /* ************************************************************************** */ |
|
2484 |
|
2485 #ifdef MNG_INCLUDE_WRITE_PROCS |
|
2486 |
|
2487 /* ************************************************************************** */ |
|
2488 |
|
2489 #ifndef MNG_SKIPCHUNK_TERM |
|
2490 MNG_LOCAL mng_bool check_term (mng_datap pData, |
|
2491 mng_chunkid iChunkname) |
|
2492 { |
|
2493 mng_chunk_headerp pChunk = (mng_chunk_headerp)pData->pLastchunk; |
|
2494 |
|
2495 if (!pChunk) /* nothing added yet ? */ |
|
2496 return MNG_TRUE; |
|
2497 /* last added chunk is TERM ? */ |
|
2498 if (pChunk->iChunkname != MNG_UINT_TERM) |
|
2499 return MNG_TRUE; |
|
2500 /* previous to last is MHDR ? */ |
|
2501 if ((pChunk->pPrev) && (((mng_chunk_headerp)pChunk->pPrev)->iChunkname == MNG_UINT_MHDR)) |
|
2502 return MNG_TRUE; |
|
2503 |
|
2504 if (iChunkname == MNG_UINT_SEEK) /* new chunk to be added is SEEK ? */ |
|
2505 return MNG_TRUE; |
|
2506 |
|
2507 return MNG_FALSE; |
|
2508 } |
|
2509 #endif |
|
2510 |
|
2511 /* ************************************************************************** */ |
|
2512 |
|
2513 mng_retcode MNG_DECL mng_putchunk_ihdr (mng_handle hHandle, |
|
2514 mng_uint32 iWidth, |
|
2515 mng_uint32 iHeight, |
|
2516 mng_uint8 iBitdepth, |
|
2517 mng_uint8 iColortype, |
|
2518 mng_uint8 iCompression, |
|
2519 mng_uint8 iFilter, |
|
2520 mng_uint8 iInterlace) |
|
2521 { |
|
2522 mng_datap pData; |
|
2523 mng_chunkp pChunk; |
|
2524 mng_retcode iRetcode; |
|
2525 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
2526 mng_chunk_header sChunkheader = |
|
2527 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
2528 {MNG_UINT_IHDR, mng_init_general, mng_free_general, mng_read_ihdr, mng_write_ihdr, mng_assign_general, 0, 0, sizeof(mng_ihdr)}; |
|
2529 #else |
|
2530 {MNG_UINT_IHDR, mng_init_ihdr, mng_free_ihdr, mng_read_ihdr, mng_write_ihdr, mng_assign_ihdr, 0, 0}; |
|
2531 #endif |
|
2532 #else |
|
2533 mng_chunk_header sChunkheader; |
|
2534 #endif |
|
2535 |
|
2536 #ifdef MNG_SUPPORT_TRACE |
|
2537 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IHDR, MNG_LC_START); |
|
2538 #endif |
|
2539 |
|
2540 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
2541 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
2542 |
|
2543 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
2544 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
2545 /* prevent misplaced TERM ! */ |
|
2546 if (!check_term (pData, MNG_UINT_IHDR)) |
|
2547 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
2548 /* create the chunk */ |
|
2549 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
2550 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
2551 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
2552 #else |
|
2553 iRetcode = mng_init_ihdr (pData, &sChunkheader, &pChunk); |
|
2554 #endif |
|
2555 #else |
|
2556 mng_get_chunkheader(MNG_UINT_IHDR, &sChunkheader); |
|
2557 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
2558 #endif |
|
2559 |
|
2560 if (iRetcode) /* on error bail out */ |
|
2561 return iRetcode; |
|
2562 ((mng_ihdrp)pChunk)->iWidth = iWidth; |
|
2563 ((mng_ihdrp)pChunk)->iHeight = iHeight; |
|
2564 ((mng_ihdrp)pChunk)->iBitdepth = iBitdepth; |
|
2565 ((mng_ihdrp)pChunk)->iColortype = iColortype; |
|
2566 ((mng_ihdrp)pChunk)->iCompression = iCompression; |
|
2567 ((mng_ihdrp)pChunk)->iFilter = iFilter; |
|
2568 ((mng_ihdrp)pChunk)->iInterlace = iInterlace; |
|
2569 |
|
2570 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
2571 |
|
2572 #ifdef MNG_SUPPORT_TRACE |
|
2573 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IHDR, MNG_LC_END); |
|
2574 #endif |
|
2575 |
|
2576 return MNG_NOERROR; |
|
2577 } |
|
2578 |
|
2579 /* ************************************************************************** */ |
|
2580 |
|
2581 mng_retcode MNG_DECL mng_putchunk_plte (mng_handle hHandle, |
|
2582 mng_uint32 iCount, |
|
2583 mng_palette8 aPalette) |
|
2584 { |
|
2585 mng_datap pData; |
|
2586 mng_chunkp pChunk; |
|
2587 mng_retcode iRetcode; |
|
2588 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
2589 mng_chunk_header sChunkheader = |
|
2590 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
2591 {MNG_UINT_PLTE, mng_init_general, mng_free_general, mng_read_plte, mng_write_plte, mng_assign_general, 0, 0, sizeof(mng_plte)}; |
|
2592 #else |
|
2593 {MNG_UINT_PLTE, mng_init_plte, mng_free_plte, mng_read_plte, mng_write_plte, mng_assign_plte, 0, 0}; |
|
2594 #endif |
|
2595 #else |
|
2596 mng_chunk_header sChunkheader; |
|
2597 #endif |
|
2598 |
|
2599 #ifdef MNG_SUPPORT_TRACE |
|
2600 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PLTE, MNG_LC_START); |
|
2601 #endif |
|
2602 |
|
2603 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
2604 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
2605 |
|
2606 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
2607 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
2608 /* must have had a header first! */ |
|
2609 if (pData->iFirstchunkadded == 0) |
|
2610 MNG_ERROR (pData, MNG_NOHEADER) |
|
2611 /* prevent misplaced TERM ! */ |
|
2612 if (!check_term (pData, MNG_UINT_PLTE)) |
|
2613 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
2614 /* create the chunk */ |
|
2615 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
2616 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
2617 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
2618 #else |
|
2619 iRetcode = mng_init_plte (pData, &sChunkheader, &pChunk); |
|
2620 #endif |
|
2621 #else |
|
2622 mng_get_chunkheader(MNG_UINT_PLTE, &sChunkheader); |
|
2623 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
2624 #endif |
|
2625 |
|
2626 if (iRetcode) /* on error bail out */ |
|
2627 return iRetcode; |
|
2628 /* fill the chunk */ |
|
2629 ((mng_pltep)pChunk)->iEntrycount = iCount; |
|
2630 ((mng_pltep)pChunk)->bEmpty = (mng_bool)(iCount == 0); |
|
2631 |
|
2632 MNG_COPY (((mng_pltep)pChunk)->aEntries, aPalette, sizeof (mng_palette8)); |
|
2633 |
|
2634 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
2635 |
|
2636 #ifdef MNG_SUPPORT_TRACE |
|
2637 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PLTE, MNG_LC_END); |
|
2638 #endif |
|
2639 |
|
2640 return MNG_NOERROR; |
|
2641 } |
|
2642 |
|
2643 /* ************************************************************************** */ |
|
2644 |
|
2645 mng_retcode MNG_DECL mng_putchunk_idat (mng_handle hHandle, |
|
2646 mng_uint32 iRawlen, |
|
2647 mng_ptr pRawdata) |
|
2648 { |
|
2649 mng_datap pData; |
|
2650 mng_chunkp pChunk; |
|
2651 mng_retcode iRetcode; |
|
2652 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
2653 mng_chunk_header sChunkheader = |
|
2654 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
2655 {MNG_UINT_IDAT, mng_init_general, mng_free_idat, mng_read_idat, mng_write_idat, mng_assign_idat, 0, 0, sizeof(mng_idat)}; |
|
2656 #else |
|
2657 {MNG_UINT_IDAT, mng_init_idat, mng_free_idat, mng_read_idat, mng_write_idat, mng_assign_idat, 0, 0}; |
|
2658 #endif |
|
2659 #else |
|
2660 mng_chunk_header sChunkheader; |
|
2661 #endif |
|
2662 |
|
2663 #ifdef MNG_SUPPORT_TRACE |
|
2664 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IDAT, MNG_LC_START); |
|
2665 #endif |
|
2666 |
|
2667 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
2668 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
2669 |
|
2670 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
2671 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
2672 /* must have had a header first! */ |
|
2673 if (pData->iFirstchunkadded == 0) |
|
2674 MNG_ERROR (pData, MNG_NOHEADER) |
|
2675 /* prevent misplaced TERM ! */ |
|
2676 if (!check_term (pData, MNG_UINT_IDAT)) |
|
2677 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
2678 /* create the chunk */ |
|
2679 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
2680 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
2681 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
2682 #else |
|
2683 iRetcode = mng_init_idat (pData, &sChunkheader, &pChunk); |
|
2684 #endif |
|
2685 #else |
|
2686 mng_get_chunkheader(MNG_UINT_IDAT, &sChunkheader); |
|
2687 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
2688 #endif |
|
2689 |
|
2690 if (iRetcode) /* on error bail out */ |
|
2691 return iRetcode; |
|
2692 /* fill the chunk */ |
|
2693 ((mng_idatp)pChunk)->bEmpty = (mng_bool)(iRawlen == 0); |
|
2694 ((mng_idatp)pChunk)->iDatasize = iRawlen; |
|
2695 |
|
2696 if (iRawlen) |
|
2697 { |
|
2698 MNG_ALLOC (pData, ((mng_idatp)pChunk)->pData, iRawlen); |
|
2699 MNG_COPY (((mng_idatp)pChunk)->pData, pRawdata, iRawlen); |
|
2700 } |
|
2701 |
|
2702 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
2703 |
|
2704 #ifdef MNG_SUPPORT_TRACE |
|
2705 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IDAT, MNG_LC_END); |
|
2706 #endif |
|
2707 |
|
2708 return MNG_NOERROR; |
|
2709 } |
|
2710 |
|
2711 /* ************************************************************************** */ |
|
2712 |
|
2713 mng_retcode MNG_DECL mng_putchunk_iend (mng_handle hHandle) |
|
2714 { |
|
2715 mng_datap pData; |
|
2716 mng_chunkp pChunk; |
|
2717 mng_retcode iRetcode; |
|
2718 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
2719 mng_chunk_header sChunkheader = |
|
2720 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
2721 {MNG_UINT_IEND, mng_init_general, mng_free_general, mng_read_iend, mng_write_iend, mng_assign_general, 0, 0, sizeof(mng_iend)}; |
|
2722 #else |
|
2723 {MNG_UINT_IEND, mng_init_iend, mng_free_iend, mng_read_iend, mng_write_iend, mng_assign_iend, 0, 0}; |
|
2724 #endif |
|
2725 #else |
|
2726 mng_chunk_header sChunkheader; |
|
2727 #endif |
|
2728 |
|
2729 #ifdef MNG_SUPPORT_TRACE |
|
2730 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IEND, MNG_LC_START); |
|
2731 #endif |
|
2732 |
|
2733 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
2734 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
2735 |
|
2736 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
2737 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
2738 /* must have had a header first! */ |
|
2739 if (pData->iFirstchunkadded == 0) |
|
2740 MNG_ERROR (pData, MNG_NOHEADER) |
|
2741 /* prevent misplaced TERM ! */ |
|
2742 if (!check_term (pData, MNG_UINT_IEND)) |
|
2743 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
2744 /* create the chunk */ |
|
2745 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
2746 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
2747 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
2748 #else |
|
2749 iRetcode = mng_init_iend (pData, &sChunkheader, &pChunk); |
|
2750 #endif |
|
2751 #else |
|
2752 mng_get_chunkheader(MNG_UINT_IEND, &sChunkheader); |
|
2753 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
2754 #endif |
|
2755 |
|
2756 if (iRetcode) /* on error bail out */ |
|
2757 return iRetcode; |
|
2758 |
|
2759 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
2760 |
|
2761 #ifdef MNG_INCLUDE_JNG |
|
2762 if ((pData->iFirstchunkadded == MNG_UINT_IHDR) || |
|
2763 (pData->iFirstchunkadded == MNG_UINT_JHDR) ) |
|
2764 #else |
|
2765 if (pData->iFirstchunkadded == MNG_UINT_IHDR) |
|
2766 #endif |
|
2767 pData->bCreating = MNG_FALSE; /* should be last chunk !!! */ |
|
2768 |
|
2769 #ifdef MNG_SUPPORT_TRACE |
|
2770 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IEND, MNG_LC_END); |
|
2771 #endif |
|
2772 |
|
2773 return MNG_NOERROR; |
|
2774 } |
|
2775 |
|
2776 /* ************************************************************************** */ |
|
2777 |
|
2778 mng_retcode MNG_DECL mng_putchunk_trns (mng_handle hHandle, |
|
2779 mng_bool bEmpty, |
|
2780 mng_bool bGlobal, |
|
2781 mng_uint8 iType, |
|
2782 mng_uint32 iCount, |
|
2783 mng_uint8arr aAlphas, |
|
2784 mng_uint16 iGray, |
|
2785 mng_uint16 iRed, |
|
2786 mng_uint16 iGreen, |
|
2787 mng_uint16 iBlue, |
|
2788 mng_uint32 iRawlen, |
|
2789 mng_uint8arr aRawdata) |
|
2790 { |
|
2791 mng_datap pData; |
|
2792 mng_chunkp pChunk; |
|
2793 mng_retcode iRetcode; |
|
2794 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
2795 mng_chunk_header sChunkheader = |
|
2796 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
2797 {MNG_UINT_tRNS, mng_init_general, mng_free_general, mng_read_trns, mng_write_trns, mng_assign_general, 0, 0, sizeof(mng_trns)}; |
|
2798 #else |
|
2799 {MNG_UINT_tRNS, mng_init_trns, mng_free_trns, mng_read_trns, mng_write_trns, mng_assign_trns, 0, 0}; |
|
2800 #endif |
|
2801 #else |
|
2802 mng_chunk_header sChunkheader; |
|
2803 #endif |
|
2804 |
|
2805 #ifdef MNG_SUPPORT_TRACE |
|
2806 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TRNS, MNG_LC_START); |
|
2807 #endif |
|
2808 |
|
2809 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
2810 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
2811 |
|
2812 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
2813 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
2814 /* must have had a header first! */ |
|
2815 if (pData->iFirstchunkadded == 0) |
|
2816 MNG_ERROR (pData, MNG_NOHEADER) |
|
2817 /* prevent misplaced TERM ! */ |
|
2818 if (!check_term (pData, MNG_UINT_tRNS)) |
|
2819 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
2820 /* create the chunk */ |
|
2821 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
2822 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
2823 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
2824 #else |
|
2825 iRetcode = mng_init_trns (pData, &sChunkheader, &pChunk); |
|
2826 #endif |
|
2827 #else |
|
2828 mng_get_chunkheader(MNG_UINT_tRNS, &sChunkheader); |
|
2829 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
2830 #endif |
|
2831 |
|
2832 if (iRetcode) /* on error bail out */ |
|
2833 return iRetcode; |
|
2834 /* fill the chunk */ |
|
2835 ((mng_trnsp)pChunk)->bEmpty = bEmpty; |
|
2836 ((mng_trnsp)pChunk)->bGlobal = bGlobal; |
|
2837 ((mng_trnsp)pChunk)->iType = iType; |
|
2838 ((mng_trnsp)pChunk)->iCount = iCount; |
|
2839 ((mng_trnsp)pChunk)->iGray = iGray; |
|
2840 ((mng_trnsp)pChunk)->iRed = iRed; |
|
2841 ((mng_trnsp)pChunk)->iGreen = iGreen; |
|
2842 ((mng_trnsp)pChunk)->iBlue = iBlue; |
|
2843 ((mng_trnsp)pChunk)->iRawlen = iRawlen; |
|
2844 |
|
2845 MNG_COPY (((mng_trnsp)pChunk)->aEntries, aAlphas, sizeof (mng_uint8arr)); |
|
2846 MNG_COPY (((mng_trnsp)pChunk)->aRawdata, aRawdata, sizeof (mng_uint8arr)); |
|
2847 |
|
2848 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
2849 |
|
2850 #ifdef MNG_SUPPORT_TRACE |
|
2851 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TRNS, MNG_LC_END); |
|
2852 #endif |
|
2853 |
|
2854 return MNG_NOERROR; |
|
2855 } |
|
2856 |
|
2857 /* ************************************************************************** */ |
|
2858 |
|
2859 #ifndef MNG_SKIPCHUNK_gAMA |
|
2860 mng_retcode MNG_DECL mng_putchunk_gama (mng_handle hHandle, |
|
2861 mng_bool bEmpty, |
|
2862 mng_uint32 iGamma) |
|
2863 { |
|
2864 mng_datap pData; |
|
2865 mng_chunkp pChunk; |
|
2866 mng_retcode iRetcode; |
|
2867 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
2868 mng_chunk_header sChunkheader = |
|
2869 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
2870 {MNG_UINT_gAMA, mng_init_general, mng_free_general, mng_read_gama, mng_write_gama, mng_assign_general, 0, 0, sizeof(mng_gama)}; |
|
2871 #else |
|
2872 {MNG_UINT_gAMA, mng_init_gama, mng_free_gama, mng_read_gama, mng_write_gama, mng_assign_gama, 0, 0}; |
|
2873 #endif |
|
2874 #else |
|
2875 mng_chunk_header sChunkheader; |
|
2876 #endif |
|
2877 |
|
2878 #ifdef MNG_SUPPORT_TRACE |
|
2879 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_GAMA, MNG_LC_START); |
|
2880 #endif |
|
2881 |
|
2882 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
2883 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
2884 |
|
2885 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
2886 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
2887 /* must have had a header first! */ |
|
2888 if (pData->iFirstchunkadded == 0) |
|
2889 MNG_ERROR (pData, MNG_NOHEADER) |
|
2890 /* prevent misplaced TERM ! */ |
|
2891 if (!check_term (pData, MNG_UINT_gAMA)) |
|
2892 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
2893 /* create the chunk */ |
|
2894 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
2895 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
2896 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
2897 #else |
|
2898 iRetcode = mng_init_gama (pData, &sChunkheader, &pChunk); |
|
2899 #endif |
|
2900 #else |
|
2901 mng_get_chunkheader(MNG_UINT_gAMA, &sChunkheader); |
|
2902 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
2903 #endif |
|
2904 |
|
2905 if (iRetcode) /* on error bail out */ |
|
2906 return iRetcode; |
|
2907 /* fill the chunk */ |
|
2908 ((mng_gamap)pChunk)->bEmpty = bEmpty; |
|
2909 ((mng_gamap)pChunk)->iGamma = iGamma; |
|
2910 |
|
2911 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
2912 |
|
2913 #ifdef MNG_SUPPORT_TRACE |
|
2914 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_GAMA, MNG_LC_END); |
|
2915 #endif |
|
2916 |
|
2917 return MNG_NOERROR; |
|
2918 } |
|
2919 #endif |
|
2920 |
|
2921 /* ************************************************************************** */ |
|
2922 |
|
2923 #ifndef MNG_SKIPCHUNK_cHRM |
|
2924 mng_retcode MNG_DECL mng_putchunk_chrm (mng_handle hHandle, |
|
2925 mng_bool bEmpty, |
|
2926 mng_uint32 iWhitepointx, |
|
2927 mng_uint32 iWhitepointy, |
|
2928 mng_uint32 iRedx, |
|
2929 mng_uint32 iRedy, |
|
2930 mng_uint32 iGreenx, |
|
2931 mng_uint32 iGreeny, |
|
2932 mng_uint32 iBluex, |
|
2933 mng_uint32 iBluey) |
|
2934 { |
|
2935 mng_datap pData; |
|
2936 mng_chunkp pChunk; |
|
2937 mng_retcode iRetcode; |
|
2938 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
2939 mng_chunk_header sChunkheader = |
|
2940 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
2941 {MNG_UINT_cHRM, mng_init_general, mng_free_general, mng_read_chrm, mng_write_chrm, mng_assign_general, 0, 0, sizeof(mng_chrm)}; |
|
2942 #else |
|
2943 {MNG_UINT_cHRM, mng_init_chrm, mng_free_chrm, mng_read_chrm, mng_write_chrm, mng_assign_chrm, 0, 0}; |
|
2944 #endif |
|
2945 #else |
|
2946 mng_chunk_header sChunkheader; |
|
2947 #endif |
|
2948 |
|
2949 #ifdef MNG_SUPPORT_TRACE |
|
2950 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CHRM, MNG_LC_START); |
|
2951 #endif |
|
2952 |
|
2953 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
2954 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
2955 |
|
2956 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
2957 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
2958 /* must have had a header first! */ |
|
2959 if (pData->iFirstchunkadded == 0) |
|
2960 MNG_ERROR (pData, MNG_NOHEADER) |
|
2961 /* prevent misplaced TERM ! */ |
|
2962 if (!check_term (pData, MNG_UINT_cHRM)) |
|
2963 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
2964 /* create the chunk */ |
|
2965 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
2966 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
2967 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
2968 #else |
|
2969 iRetcode = mng_init_chrm (pData, &sChunkheader, &pChunk); |
|
2970 #endif |
|
2971 #else |
|
2972 mng_get_chunkheader(MNG_UINT_cHRM, &sChunkheader); |
|
2973 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
2974 #endif |
|
2975 |
|
2976 if (iRetcode) /* on error bail out */ |
|
2977 return iRetcode; |
|
2978 /* fill the chunk */ |
|
2979 ((mng_chrmp)pChunk)->bEmpty = bEmpty; |
|
2980 ((mng_chrmp)pChunk)->iWhitepointx = iWhitepointx; |
|
2981 ((mng_chrmp)pChunk)->iWhitepointy = iWhitepointy; |
|
2982 ((mng_chrmp)pChunk)->iRedx = iRedx; |
|
2983 ((mng_chrmp)pChunk)->iRedy = iRedy; |
|
2984 ((mng_chrmp)pChunk)->iGreenx = iGreenx; |
|
2985 ((mng_chrmp)pChunk)->iGreeny = iGreeny; |
|
2986 ((mng_chrmp)pChunk)->iBluex = iBluex; |
|
2987 ((mng_chrmp)pChunk)->iBluey = iBluey; |
|
2988 |
|
2989 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
2990 |
|
2991 #ifdef MNG_SUPPORT_TRACE |
|
2992 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CHRM, MNG_LC_END); |
|
2993 #endif |
|
2994 |
|
2995 return MNG_NOERROR; |
|
2996 } |
|
2997 #endif |
|
2998 |
|
2999 /* ************************************************************************** */ |
|
3000 |
|
3001 #ifndef MNG_SKIPCHUNK_sRGB |
|
3002 mng_retcode MNG_DECL mng_putchunk_srgb (mng_handle hHandle, |
|
3003 mng_bool bEmpty, |
|
3004 mng_uint8 iRenderingintent) |
|
3005 { |
|
3006 mng_datap pData; |
|
3007 mng_chunkp pChunk; |
|
3008 mng_retcode iRetcode; |
|
3009 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3010 mng_chunk_header sChunkheader = |
|
3011 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3012 {MNG_UINT_sRGB, mng_init_general, mng_free_general, mng_read_srgb, mng_write_srgb, mng_assign_general, 0, 0, sizeof(mng_srgb)}; |
|
3013 #else |
|
3014 {MNG_UINT_sRGB, mng_init_srgb, mng_free_srgb, mng_read_srgb, mng_write_srgb, mng_assign_srgb, 0, 0}; |
|
3015 #endif |
|
3016 #else |
|
3017 mng_chunk_header sChunkheader; |
|
3018 #endif |
|
3019 |
|
3020 #ifdef MNG_SUPPORT_TRACE |
|
3021 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SRGB, MNG_LC_START); |
|
3022 #endif |
|
3023 |
|
3024 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
3025 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
3026 |
|
3027 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
3028 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
3029 /* must have had a header first! */ |
|
3030 if (pData->iFirstchunkadded == 0) |
|
3031 MNG_ERROR (pData, MNG_NOHEADER) |
|
3032 /* prevent misplaced TERM ! */ |
|
3033 if (!check_term (pData, MNG_UINT_sRGB)) |
|
3034 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
3035 /* create the chunk */ |
|
3036 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3037 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3038 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3039 #else |
|
3040 iRetcode = mng_init_srgb (pData, &sChunkheader, &pChunk); |
|
3041 #endif |
|
3042 #else |
|
3043 mng_get_chunkheader(MNG_UINT_sRGB, &sChunkheader); |
|
3044 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3045 #endif |
|
3046 |
|
3047 if (iRetcode) /* on error bail out */ |
|
3048 return iRetcode; |
|
3049 /* fill the chunk */ |
|
3050 ((mng_srgbp)pChunk)->bEmpty = bEmpty; |
|
3051 ((mng_srgbp)pChunk)->iRenderingintent = iRenderingintent; |
|
3052 |
|
3053 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
3054 |
|
3055 #ifdef MNG_SUPPORT_TRACE |
|
3056 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SRGB, MNG_LC_END); |
|
3057 #endif |
|
3058 |
|
3059 return MNG_NOERROR; |
|
3060 } |
|
3061 #endif |
|
3062 |
|
3063 /* ************************************************************************** */ |
|
3064 |
|
3065 #ifndef MNG_SKIPCHUNK_iCCP |
|
3066 mng_retcode MNG_DECL mng_putchunk_iccp (mng_handle hHandle, |
|
3067 mng_bool bEmpty, |
|
3068 mng_uint32 iNamesize, |
|
3069 mng_pchar zName, |
|
3070 mng_uint8 iCompression, |
|
3071 mng_uint32 iProfilesize, |
|
3072 mng_ptr pProfile) |
|
3073 { |
|
3074 mng_datap pData; |
|
3075 mng_chunkp pChunk; |
|
3076 mng_retcode iRetcode; |
|
3077 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3078 mng_chunk_header sChunkheader = |
|
3079 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3080 {MNG_UINT_iCCP, mng_init_general, mng_free_iccp, mng_read_iccp, mng_write_iccp, mng_assign_iccp, 0, 0, sizeof(mng_iccp)}; |
|
3081 #else |
|
3082 {MNG_UINT_iCCP, mng_init_iccp, mng_free_iccp, mng_read_iccp, mng_write_iccp, mng_assign_iccp, 0, 0}; |
|
3083 #endif |
|
3084 #else |
|
3085 mng_chunk_header sChunkheader; |
|
3086 #endif |
|
3087 |
|
3088 #ifdef MNG_SUPPORT_TRACE |
|
3089 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ICCP, MNG_LC_START); |
|
3090 #endif |
|
3091 |
|
3092 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
3093 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
3094 |
|
3095 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
3096 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
3097 /* must have had a header first! */ |
|
3098 if (pData->iFirstchunkadded == 0) |
|
3099 MNG_ERROR (pData, MNG_NOHEADER) |
|
3100 /* prevent misplaced TERM ! */ |
|
3101 if (!check_term (pData, MNG_UINT_iCCP)) |
|
3102 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
3103 /* create the chunk */ |
|
3104 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3105 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3106 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3107 #else |
|
3108 iRetcode = mng_init_iccp (pData, &sChunkheader, &pChunk); |
|
3109 #endif |
|
3110 #else |
|
3111 mng_get_chunkheader(MNG_UINT_iCCP, &sChunkheader); |
|
3112 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3113 #endif |
|
3114 |
|
3115 if (iRetcode) /* on error bail out */ |
|
3116 return iRetcode; |
|
3117 /* fill the chunk */ |
|
3118 ((mng_iccpp)pChunk)->bEmpty = bEmpty; |
|
3119 ((mng_iccpp)pChunk)->iNamesize = iNamesize; |
|
3120 ((mng_iccpp)pChunk)->iCompression = iCompression; |
|
3121 ((mng_iccpp)pChunk)->iProfilesize = iProfilesize; |
|
3122 |
|
3123 if (iNamesize) |
|
3124 { |
|
3125 MNG_ALLOC (pData, ((mng_iccpp)pChunk)->zName, iNamesize + 1); |
|
3126 MNG_COPY (((mng_iccpp)pChunk)->zName, zName, iNamesize); |
|
3127 } |
|
3128 |
|
3129 if (iProfilesize) |
|
3130 { |
|
3131 MNG_ALLOC (pData, ((mng_iccpp)pChunk)->pProfile, iProfilesize); |
|
3132 MNG_COPY (((mng_iccpp)pChunk)->pProfile, pProfile, iProfilesize); |
|
3133 } |
|
3134 |
|
3135 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
3136 |
|
3137 #ifdef MNG_SUPPORT_TRACE |
|
3138 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ICCP, MNG_LC_END); |
|
3139 #endif |
|
3140 |
|
3141 return MNG_NOERROR; |
|
3142 } |
|
3143 #endif |
|
3144 |
|
3145 /* ************************************************************************** */ |
|
3146 |
|
3147 #ifndef MNG_SKIPCHUNK_tEXt |
|
3148 mng_retcode MNG_DECL mng_putchunk_text (mng_handle hHandle, |
|
3149 mng_uint32 iKeywordsize, |
|
3150 mng_pchar zKeyword, |
|
3151 mng_uint32 iTextsize, |
|
3152 mng_pchar zText) |
|
3153 { |
|
3154 mng_datap pData; |
|
3155 mng_chunkp pChunk; |
|
3156 mng_retcode iRetcode; |
|
3157 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3158 mng_chunk_header sChunkheader = |
|
3159 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3160 {MNG_UINT_tEXt, mng_init_general, mng_free_text, mng_read_text, mng_write_text, mng_assign_text, 0, 0, sizeof(mng_text)}; |
|
3161 #else |
|
3162 {MNG_UINT_tEXt, mng_init_text, mng_free_text, mng_read_text, mng_write_text, mng_assign_text, 0, 0}; |
|
3163 #endif |
|
3164 #else |
|
3165 mng_chunk_header sChunkheader; |
|
3166 #endif |
|
3167 |
|
3168 #ifdef MNG_SUPPORT_TRACE |
|
3169 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TEXT, MNG_LC_START); |
|
3170 #endif |
|
3171 |
|
3172 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
3173 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
3174 |
|
3175 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
3176 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
3177 /* must have had a header first! */ |
|
3178 if (pData->iFirstchunkadded == 0) |
|
3179 MNG_ERROR (pData, MNG_NOHEADER) |
|
3180 /* prevent misplaced TERM ! */ |
|
3181 if (!check_term (pData, MNG_UINT_tEXt)) |
|
3182 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
3183 /* create the chunk */ |
|
3184 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3185 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3186 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3187 #else |
|
3188 iRetcode = mng_init_text (pData, &sChunkheader, &pChunk); |
|
3189 #endif |
|
3190 #else |
|
3191 mng_get_chunkheader(MNG_UINT_tEXt, &sChunkheader); |
|
3192 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3193 #endif |
|
3194 |
|
3195 if (iRetcode) /* on error bail out */ |
|
3196 return iRetcode; |
|
3197 /* fill the chunk */ |
|
3198 ((mng_textp)pChunk)->iKeywordsize = iKeywordsize; |
|
3199 ((mng_textp)pChunk)->iTextsize = iTextsize; |
|
3200 |
|
3201 if (iKeywordsize) |
|
3202 { |
|
3203 MNG_ALLOC (pData, ((mng_textp)pChunk)->zKeyword, iKeywordsize + 1); |
|
3204 MNG_COPY (((mng_textp)pChunk)->zKeyword, zKeyword, iKeywordsize); |
|
3205 } |
|
3206 |
|
3207 if (iTextsize) |
|
3208 { |
|
3209 MNG_ALLOC (pData, ((mng_textp)pChunk)->zText, iTextsize + 1); |
|
3210 MNG_COPY (((mng_textp)pChunk)->zText, zText, iTextsize); |
|
3211 } |
|
3212 |
|
3213 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
3214 |
|
3215 #ifdef MNG_SUPPORT_TRACE |
|
3216 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TEXT, MNG_LC_END); |
|
3217 #endif |
|
3218 |
|
3219 return MNG_NOERROR; |
|
3220 } |
|
3221 #endif |
|
3222 |
|
3223 /* ************************************************************************** */ |
|
3224 |
|
3225 #ifndef MNG_SKIPCHUNK_zTXt |
|
3226 mng_retcode MNG_DECL mng_putchunk_ztxt (mng_handle hHandle, |
|
3227 mng_uint32 iKeywordsize, |
|
3228 mng_pchar zKeyword, |
|
3229 mng_uint8 iCompression, |
|
3230 mng_uint32 iTextsize, |
|
3231 mng_pchar zText) |
|
3232 { |
|
3233 mng_datap pData; |
|
3234 mng_chunkp pChunk; |
|
3235 mng_retcode iRetcode; |
|
3236 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3237 mng_chunk_header sChunkheader = |
|
3238 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3239 {MNG_UINT_zTXt, mng_init_general, mng_free_ztxt, mng_read_ztxt, mng_write_ztxt, mng_assign_ztxt, 0, 0, sizeof(mng_ztxt)}; |
|
3240 #else |
|
3241 {MNG_UINT_zTXt, mng_init_ztxt, mng_free_ztxt, mng_read_ztxt, mng_write_ztxt, mng_assign_ztxt, 0, 0}; |
|
3242 #endif |
|
3243 #else |
|
3244 mng_chunk_header sChunkheader; |
|
3245 #endif |
|
3246 |
|
3247 #ifdef MNG_SUPPORT_TRACE |
|
3248 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ZTXT, MNG_LC_START); |
|
3249 #endif |
|
3250 |
|
3251 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
3252 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
3253 |
|
3254 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
3255 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
3256 /* must have had a header first! */ |
|
3257 if (pData->iFirstchunkadded == 0) |
|
3258 MNG_ERROR (pData, MNG_NOHEADER) |
|
3259 /* prevent misplaced TERM ! */ |
|
3260 if (!check_term (pData, MNG_UINT_zTXt)) |
|
3261 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
3262 /* create the chunk */ |
|
3263 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3264 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3265 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3266 #else |
|
3267 iRetcode = mng_init_ztxt (pData, &sChunkheader, &pChunk); |
|
3268 #endif |
|
3269 #else |
|
3270 mng_get_chunkheader(MNG_UINT_zTXt, &sChunkheader); |
|
3271 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3272 #endif |
|
3273 |
|
3274 if (iRetcode) /* on error bail out */ |
|
3275 return iRetcode; |
|
3276 /* fill the chunk */ |
|
3277 ((mng_ztxtp)pChunk)->iKeywordsize = iKeywordsize; |
|
3278 ((mng_ztxtp)pChunk)->iCompression = iCompression; |
|
3279 ((mng_ztxtp)pChunk)->iTextsize = iTextsize; |
|
3280 |
|
3281 if (iKeywordsize) |
|
3282 { |
|
3283 MNG_ALLOC (pData, ((mng_ztxtp)pChunk)->zKeyword, iKeywordsize + 1); |
|
3284 MNG_COPY (((mng_ztxtp)pChunk)->zKeyword, zKeyword, iKeywordsize); |
|
3285 } |
|
3286 |
|
3287 if (iTextsize) |
|
3288 { |
|
3289 MNG_ALLOC (pData, ((mng_ztxtp)pChunk)->zText, iTextsize + 1); |
|
3290 MNG_COPY (((mng_ztxtp)pChunk)->zText, zText, iTextsize); |
|
3291 } |
|
3292 |
|
3293 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
3294 |
|
3295 #ifdef MNG_SUPPORT_TRACE |
|
3296 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ZTXT, MNG_LC_END); |
|
3297 #endif |
|
3298 |
|
3299 return MNG_NOERROR; |
|
3300 } |
|
3301 #endif |
|
3302 |
|
3303 /* ************************************************************************** */ |
|
3304 |
|
3305 #ifndef MNG_SKIPCHUNK_iTXt |
|
3306 mng_retcode MNG_DECL mng_putchunk_itxt (mng_handle hHandle, |
|
3307 mng_uint32 iKeywordsize, |
|
3308 mng_pchar zKeyword, |
|
3309 mng_uint8 iCompressionflag, |
|
3310 mng_uint8 iCompressionmethod, |
|
3311 mng_uint32 iLanguagesize, |
|
3312 mng_pchar zLanguage, |
|
3313 mng_uint32 iTranslationsize, |
|
3314 mng_pchar zTranslation, |
|
3315 mng_uint32 iTextsize, |
|
3316 mng_pchar zText) |
|
3317 { |
|
3318 mng_datap pData; |
|
3319 mng_chunkp pChunk; |
|
3320 mng_retcode iRetcode; |
|
3321 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3322 mng_chunk_header sChunkheader = |
|
3323 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3324 {MNG_UINT_iTXt, mng_init_general, mng_free_itxt, mng_read_itxt, mng_write_itxt, mng_assign_itxt, 0, 0, sizeof(mng_itxt)}; |
|
3325 #else |
|
3326 {MNG_UINT_iTXt, mng_init_itxt, mng_free_itxt, mng_read_itxt, mng_write_itxt, mng_assign_itxt, 0, 0}; |
|
3327 #endif |
|
3328 #else |
|
3329 mng_chunk_header sChunkheader; |
|
3330 #endif |
|
3331 |
|
3332 #ifdef MNG_SUPPORT_TRACE |
|
3333 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ITXT, MNG_LC_START); |
|
3334 #endif |
|
3335 |
|
3336 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
3337 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
3338 |
|
3339 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
3340 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
3341 /* must have had a header first! */ |
|
3342 if (pData->iFirstchunkadded == 0) |
|
3343 MNG_ERROR (pData, MNG_NOHEADER) |
|
3344 /* prevent misplaced TERM ! */ |
|
3345 if (!check_term (pData, MNG_UINT_iTXt)) |
|
3346 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
3347 /* create the chunk */ |
|
3348 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3349 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3350 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3351 #else |
|
3352 iRetcode = mng_init_itxt (pData, &sChunkheader, &pChunk); |
|
3353 #endif |
|
3354 #else |
|
3355 mng_get_chunkheader(MNG_UINT_iTXt, &sChunkheader); |
|
3356 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3357 #endif |
|
3358 |
|
3359 if (iRetcode) /* on error bail out */ |
|
3360 return iRetcode; |
|
3361 /* fill the chunk */ |
|
3362 ((mng_itxtp)pChunk)->iKeywordsize = iKeywordsize; |
|
3363 ((mng_itxtp)pChunk)->iCompressionflag = iCompressionflag; |
|
3364 ((mng_itxtp)pChunk)->iCompressionmethod = iCompressionmethod; |
|
3365 ((mng_itxtp)pChunk)->iLanguagesize = iLanguagesize; |
|
3366 ((mng_itxtp)pChunk)->iTranslationsize = iTranslationsize; |
|
3367 ((mng_itxtp)pChunk)->iTextsize = iTextsize; |
|
3368 |
|
3369 if (iKeywordsize) |
|
3370 { |
|
3371 MNG_ALLOC (pData, ((mng_itxtp)pChunk)->zKeyword, iKeywordsize + 1); |
|
3372 MNG_COPY (((mng_itxtp)pChunk)->zKeyword, zKeyword, iKeywordsize); |
|
3373 } |
|
3374 |
|
3375 if (iLanguagesize) |
|
3376 { |
|
3377 MNG_ALLOC (pData, ((mng_itxtp)pChunk)->zLanguage, iLanguagesize + 1); |
|
3378 MNG_COPY (((mng_itxtp)pChunk)->zLanguage, zLanguage, iLanguagesize); |
|
3379 } |
|
3380 |
|
3381 if (iTranslationsize) |
|
3382 { |
|
3383 MNG_ALLOC (pData, ((mng_itxtp)pChunk)->zTranslation, iTranslationsize + 1); |
|
3384 MNG_COPY (((mng_itxtp)pChunk)->zTranslation, zTranslation, iTranslationsize); |
|
3385 } |
|
3386 |
|
3387 if (iTextsize) |
|
3388 { |
|
3389 MNG_ALLOC (pData, ((mng_itxtp)pChunk)->zText, iTextsize + 1); |
|
3390 MNG_COPY (((mng_itxtp)pChunk)->zText, zText, iTextsize); |
|
3391 } |
|
3392 |
|
3393 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
3394 |
|
3395 #ifdef MNG_SUPPORT_TRACE |
|
3396 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ITXT, MNG_LC_END); |
|
3397 #endif |
|
3398 |
|
3399 return MNG_NOERROR; |
|
3400 } |
|
3401 #endif |
|
3402 |
|
3403 /* ************************************************************************** */ |
|
3404 |
|
3405 #ifndef MNG_SKIPCHUNK_bKGD |
|
3406 mng_retcode MNG_DECL mng_putchunk_bkgd (mng_handle hHandle, |
|
3407 mng_bool bEmpty, |
|
3408 mng_uint8 iType, |
|
3409 mng_uint8 iIndex, |
|
3410 mng_uint16 iGray, |
|
3411 mng_uint16 iRed, |
|
3412 mng_uint16 iGreen, |
|
3413 mng_uint16 iBlue) |
|
3414 { |
|
3415 mng_datap pData; |
|
3416 mng_chunkp pChunk; |
|
3417 mng_retcode iRetcode; |
|
3418 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3419 mng_chunk_header sChunkheader = |
|
3420 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3421 {MNG_UINT_bKGD, mng_init_general, mng_free_general, mng_read_bkgd, mng_write_bkgd, mng_assign_general, 0, 0, sizeof(mng_bkgd)}; |
|
3422 #else |
|
3423 {MNG_UINT_bKGD, mng_init_bkgd, mng_free_bkgd, mng_read_bkgd, mng_write_bkgd, mng_assign_bkgd, 0, 0}; |
|
3424 #endif |
|
3425 #else |
|
3426 mng_chunk_header sChunkheader; |
|
3427 #endif |
|
3428 |
|
3429 #ifdef MNG_SUPPORT_TRACE |
|
3430 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BKGD, MNG_LC_START); |
|
3431 #endif |
|
3432 |
|
3433 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
3434 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
3435 |
|
3436 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
3437 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
3438 /* must have had a header first! */ |
|
3439 if (pData->iFirstchunkadded == 0) |
|
3440 MNG_ERROR (pData, MNG_NOHEADER) |
|
3441 /* prevent misplaced TERM ! */ |
|
3442 if (!check_term (pData, MNG_UINT_bKGD)) |
|
3443 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
3444 /* create the chunk */ |
|
3445 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3446 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3447 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3448 #else |
|
3449 iRetcode = mng_init_bkgd (pData, &sChunkheader, &pChunk); |
|
3450 #endif |
|
3451 #else |
|
3452 mng_get_chunkheader(MNG_UINT_bKGD, &sChunkheader); |
|
3453 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3454 #endif |
|
3455 |
|
3456 if (iRetcode) /* on error bail out */ |
|
3457 return iRetcode; |
|
3458 /* fill the chunk */ |
|
3459 ((mng_bkgdp)pChunk)->bEmpty = bEmpty; |
|
3460 ((mng_bkgdp)pChunk)->iType = iType; |
|
3461 ((mng_bkgdp)pChunk)->iIndex = iIndex; |
|
3462 ((mng_bkgdp)pChunk)->iGray = iGray; |
|
3463 ((mng_bkgdp)pChunk)->iRed = iRed; |
|
3464 ((mng_bkgdp)pChunk)->iGreen = iGreen; |
|
3465 ((mng_bkgdp)pChunk)->iBlue = iBlue; |
|
3466 |
|
3467 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
3468 |
|
3469 #ifdef MNG_SUPPORT_TRACE |
|
3470 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BKGD, MNG_LC_END); |
|
3471 #endif |
|
3472 |
|
3473 return MNG_NOERROR; |
|
3474 } |
|
3475 #endif |
|
3476 |
|
3477 /* ************************************************************************** */ |
|
3478 |
|
3479 #ifndef MNG_SKIPCHUNK_pHYs |
|
3480 mng_retcode MNG_DECL mng_putchunk_phys (mng_handle hHandle, |
|
3481 mng_bool bEmpty, |
|
3482 mng_uint32 iSizex, |
|
3483 mng_uint32 iSizey, |
|
3484 mng_uint8 iUnit) |
|
3485 { |
|
3486 mng_datap pData; |
|
3487 mng_chunkp pChunk; |
|
3488 mng_retcode iRetcode; |
|
3489 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3490 mng_chunk_header sChunkheader = |
|
3491 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3492 {MNG_UINT_pHYs, mng_init_general, mng_free_general, mng_read_phys, mng_write_phys, mng_assign_general, 0, 0, sizeof(mng_phys)}; |
|
3493 #else |
|
3494 {MNG_UINT_pHYs, mng_init_phys, mng_free_phys, mng_read_phys, mng_write_phys, mng_assign_phys, 0, 0}; |
|
3495 #endif |
|
3496 #else |
|
3497 mng_chunk_header sChunkheader; |
|
3498 #endif |
|
3499 |
|
3500 #ifdef MNG_SUPPORT_TRACE |
|
3501 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PHYS, MNG_LC_START); |
|
3502 #endif |
|
3503 |
|
3504 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
3505 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
3506 |
|
3507 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
3508 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
3509 /* must have had a header first! */ |
|
3510 if (pData->iFirstchunkadded == 0) |
|
3511 MNG_ERROR (pData, MNG_NOHEADER) |
|
3512 /* prevent misplaced TERM ! */ |
|
3513 if (!check_term (pData, MNG_UINT_pHYs)) |
|
3514 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
3515 /* create the chunk */ |
|
3516 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3517 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3518 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3519 #else |
|
3520 iRetcode = mng_init_phys (pData, &sChunkheader, &pChunk); |
|
3521 #endif |
|
3522 #else |
|
3523 mng_get_chunkheader(MNG_UINT_pHYs, &sChunkheader); |
|
3524 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3525 #endif |
|
3526 |
|
3527 if (iRetcode) /* on error bail out */ |
|
3528 return iRetcode; |
|
3529 /* fill the chunk */ |
|
3530 ((mng_physp)pChunk)->bEmpty = bEmpty; |
|
3531 ((mng_physp)pChunk)->iSizex = iSizex; |
|
3532 ((mng_physp)pChunk)->iSizey = iSizey; |
|
3533 ((mng_physp)pChunk)->iUnit = iUnit; |
|
3534 |
|
3535 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
3536 |
|
3537 #ifdef MNG_SUPPORT_TRACE |
|
3538 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PHYS, MNG_LC_END); |
|
3539 #endif |
|
3540 |
|
3541 return MNG_NOERROR; |
|
3542 } |
|
3543 #endif |
|
3544 |
|
3545 /* ************************************************************************** */ |
|
3546 |
|
3547 #ifndef MNG_SKIPCHUNK_sBIT |
|
3548 mng_retcode MNG_DECL mng_putchunk_sbit (mng_handle hHandle, |
|
3549 mng_bool bEmpty, |
|
3550 mng_uint8 iType, |
|
3551 mng_uint8arr4 aBits) |
|
3552 { |
|
3553 mng_datap pData; |
|
3554 mng_chunkp pChunk; |
|
3555 mng_retcode iRetcode; |
|
3556 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3557 mng_chunk_header sChunkheader = |
|
3558 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3559 {MNG_UINT_sBIT, mng_init_general, mng_free_general, mng_read_sbit, mng_write_sbit, mng_assign_general, 0, 0, sizeof(mng_sbit)}; |
|
3560 #else |
|
3561 {MNG_UINT_sBIT, mng_init_sbit, mng_free_sbit, mng_read_sbit, mng_write_sbit, mng_assign_sbit, 0, 0}; |
|
3562 #endif |
|
3563 #else |
|
3564 mng_chunk_header sChunkheader; |
|
3565 #endif |
|
3566 |
|
3567 #ifdef MNG_SUPPORT_TRACE |
|
3568 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SBIT, MNG_LC_START); |
|
3569 #endif |
|
3570 |
|
3571 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
3572 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
3573 |
|
3574 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
3575 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
3576 /* must have had a header first! */ |
|
3577 if (pData->iFirstchunkadded == 0) |
|
3578 MNG_ERROR (pData, MNG_NOHEADER) |
|
3579 /* prevent misplaced TERM ! */ |
|
3580 if (!check_term (pData, MNG_UINT_sBIT)) |
|
3581 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
3582 /* create the chunk */ |
|
3583 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3584 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3585 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3586 #else |
|
3587 iRetcode = mng_init_sbit (pData, &sChunkheader, &pChunk); |
|
3588 #endif |
|
3589 #else |
|
3590 mng_get_chunkheader(MNG_UINT_sBIT, &sChunkheader); |
|
3591 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3592 #endif |
|
3593 |
|
3594 if (iRetcode) /* on error bail out */ |
|
3595 return iRetcode; |
|
3596 /* fill the chunk */ |
|
3597 ((mng_sbitp)pChunk)->bEmpty = bEmpty; |
|
3598 ((mng_sbitp)pChunk)->iType = iType; |
|
3599 ((mng_sbitp)pChunk)->aBits[0] = aBits[0]; |
|
3600 ((mng_sbitp)pChunk)->aBits[1] = aBits[1]; |
|
3601 ((mng_sbitp)pChunk)->aBits[2] = aBits[2]; |
|
3602 ((mng_sbitp)pChunk)->aBits[3] = aBits[3]; |
|
3603 |
|
3604 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
3605 |
|
3606 #ifdef MNG_SUPPORT_TRACE |
|
3607 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SBIT, MNG_LC_END); |
|
3608 #endif |
|
3609 |
|
3610 return MNG_NOERROR; |
|
3611 } |
|
3612 #endif |
|
3613 |
|
3614 /* ************************************************************************** */ |
|
3615 |
|
3616 #ifndef MNG_SKIPCHUNK_sPLT |
|
3617 mng_retcode MNG_DECL mng_putchunk_splt (mng_handle hHandle, |
|
3618 mng_bool bEmpty, |
|
3619 mng_uint32 iNamesize, |
|
3620 mng_pchar zName, |
|
3621 mng_uint8 iSampledepth, |
|
3622 mng_uint32 iEntrycount, |
|
3623 mng_ptr pEntries) |
|
3624 { |
|
3625 mng_datap pData; |
|
3626 mng_chunkp pChunk; |
|
3627 mng_retcode iRetcode; |
|
3628 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3629 mng_chunk_header sChunkheader = |
|
3630 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3631 {MNG_UINT_sPLT, mng_init_general, mng_free_splt, mng_read_splt, mng_write_splt, mng_assign_splt, 0, 0, sizeof(mng_splt)}; |
|
3632 #else |
|
3633 {MNG_UINT_sPLT, mng_init_splt, mng_free_splt, mng_read_splt, mng_write_splt, mng_assign_splt, 0, 0}; |
|
3634 #endif |
|
3635 #else |
|
3636 mng_chunk_header sChunkheader; |
|
3637 #endif |
|
3638 |
|
3639 #ifdef MNG_SUPPORT_TRACE |
|
3640 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SPLT, MNG_LC_START); |
|
3641 #endif |
|
3642 |
|
3643 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
3644 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
3645 |
|
3646 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
3647 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
3648 /* must have had a header first! */ |
|
3649 if (pData->iFirstchunkadded == 0) |
|
3650 MNG_ERROR (pData, MNG_NOHEADER) |
|
3651 /* prevent misplaced TERM ! */ |
|
3652 if (!check_term (pData, MNG_UINT_sPLT)) |
|
3653 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
3654 /* create the chunk */ |
|
3655 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3656 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3657 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3658 #else |
|
3659 iRetcode = mng_init_splt (pData, &sChunkheader, &pChunk); |
|
3660 #endif |
|
3661 #else |
|
3662 mng_get_chunkheader(MNG_UINT_sPLT, &sChunkheader); |
|
3663 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3664 #endif |
|
3665 |
|
3666 if (iRetcode) /* on error bail out */ |
|
3667 return iRetcode; |
|
3668 /* fill the chunk */ |
|
3669 ((mng_spltp)pChunk)->bEmpty = bEmpty; |
|
3670 ((mng_spltp)pChunk)->iNamesize = iNamesize; |
|
3671 ((mng_spltp)pChunk)->iSampledepth = iSampledepth; |
|
3672 ((mng_spltp)pChunk)->iEntrycount = iEntrycount; |
|
3673 |
|
3674 if (iNamesize) |
|
3675 { |
|
3676 MNG_ALLOC (pData, ((mng_spltp)pChunk)->zName, iNamesize + 1); |
|
3677 MNG_COPY (((mng_spltp)pChunk)->zName, zName, iNamesize); |
|
3678 } |
|
3679 |
|
3680 if (iEntrycount) |
|
3681 { |
|
3682 mng_uint32 iSize = iEntrycount * ((iSampledepth >> 1) + 2); |
|
3683 |
|
3684 MNG_ALLOC (pData, ((mng_spltp)pChunk)->pEntries, iSize); |
|
3685 MNG_COPY (((mng_spltp)pChunk)->pEntries, pEntries, iSize); |
|
3686 } |
|
3687 |
|
3688 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
3689 |
|
3690 #ifdef MNG_SUPPORT_TRACE |
|
3691 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SPLT, MNG_LC_END); |
|
3692 #endif |
|
3693 |
|
3694 return MNG_NOERROR; |
|
3695 } |
|
3696 #endif |
|
3697 |
|
3698 /* ************************************************************************** */ |
|
3699 |
|
3700 #ifndef MNG_SKIPCHUNK_hIST |
|
3701 mng_retcode MNG_DECL mng_putchunk_hist (mng_handle hHandle, |
|
3702 mng_uint32 iEntrycount, |
|
3703 mng_uint16arr aEntries) |
|
3704 { |
|
3705 mng_datap pData; |
|
3706 mng_chunkp pChunk; |
|
3707 mng_retcode iRetcode; |
|
3708 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3709 mng_chunk_header sChunkheader = |
|
3710 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3711 {MNG_UINT_hIST, mng_init_general, mng_free_general, mng_read_hist, mng_write_hist, mng_assign_general, 0, 0, sizeof(mng_hist)}; |
|
3712 #else |
|
3713 {MNG_UINT_hIST, mng_init_hist, mng_free_hist, mng_read_hist, mng_write_hist, mng_assign_hist, 0, 0}; |
|
3714 #endif |
|
3715 #else |
|
3716 mng_chunk_header sChunkheader; |
|
3717 #endif |
|
3718 |
|
3719 #ifdef MNG_SUPPORT_TRACE |
|
3720 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_HIST, MNG_LC_START); |
|
3721 #endif |
|
3722 |
|
3723 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
3724 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
3725 |
|
3726 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
3727 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
3728 /* must have had a header first! */ |
|
3729 if (pData->iFirstchunkadded == 0) |
|
3730 MNG_ERROR (pData, MNG_NOHEADER) |
|
3731 /* prevent misplaced TERM ! */ |
|
3732 if (!check_term (pData, MNG_UINT_hIST)) |
|
3733 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
3734 /* create the chunk */ |
|
3735 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3736 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3737 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3738 #else |
|
3739 iRetcode = mng_init_hist (pData, &sChunkheader, &pChunk); |
|
3740 #endif |
|
3741 #else |
|
3742 mng_get_chunkheader(MNG_UINT_hIST, &sChunkheader); |
|
3743 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3744 #endif |
|
3745 |
|
3746 if (iRetcode) /* on error bail out */ |
|
3747 return iRetcode; |
|
3748 /* fill the chunk */ |
|
3749 ((mng_histp)pChunk)->iEntrycount = iEntrycount; |
|
3750 |
|
3751 MNG_COPY (((mng_histp)pChunk)->aEntries, aEntries, sizeof (mng_uint16arr)); |
|
3752 |
|
3753 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
3754 |
|
3755 #ifdef MNG_SUPPORT_TRACE |
|
3756 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_HIST, MNG_LC_END); |
|
3757 #endif |
|
3758 |
|
3759 return MNG_NOERROR; |
|
3760 } |
|
3761 #endif |
|
3762 |
|
3763 /* ************************************************************************** */ |
|
3764 |
|
3765 #ifndef MNG_SKIPCHUNK_tIME |
|
3766 mng_retcode MNG_DECL mng_putchunk_time (mng_handle hHandle, |
|
3767 mng_uint16 iYear, |
|
3768 mng_uint8 iMonth, |
|
3769 mng_uint8 iDay, |
|
3770 mng_uint8 iHour, |
|
3771 mng_uint8 iMinute, |
|
3772 mng_uint8 iSecond) |
|
3773 { |
|
3774 mng_datap pData; |
|
3775 mng_chunkp pChunk; |
|
3776 mng_retcode iRetcode; |
|
3777 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3778 mng_chunk_header sChunkheader = |
|
3779 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3780 {MNG_UINT_tIME, mng_init_general, mng_free_general, mng_read_time, mng_write_time, mng_assign_general, 0, 0, sizeof(mng_time)}; |
|
3781 #else |
|
3782 {MNG_UINT_tIME, mng_init_time, mng_free_time, mng_read_time, mng_write_time, mng_assign_time, 0, 0}; |
|
3783 #endif |
|
3784 #else |
|
3785 mng_chunk_header sChunkheader; |
|
3786 #endif |
|
3787 |
|
3788 #ifdef MNG_SUPPORT_TRACE |
|
3789 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TIME, MNG_LC_START); |
|
3790 #endif |
|
3791 |
|
3792 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
3793 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
3794 |
|
3795 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
3796 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
3797 /* prevent misplaced TERM ! */ |
|
3798 if (!check_term (pData, MNG_UINT_tIME)) |
|
3799 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
3800 /* must have had a header first! */ |
|
3801 if (pData->iFirstchunkadded == 0) |
|
3802 MNG_ERROR (pData, MNG_NOHEADER) |
|
3803 /* create the chunk */ |
|
3804 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3805 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3806 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3807 #else |
|
3808 iRetcode = mng_init_time (pData, &sChunkheader, &pChunk); |
|
3809 #endif |
|
3810 #else |
|
3811 mng_get_chunkheader(MNG_UINT_tIME, &sChunkheader); |
|
3812 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3813 #endif |
|
3814 |
|
3815 if (iRetcode) /* on error bail out */ |
|
3816 return iRetcode; |
|
3817 /* fill the chunk */ |
|
3818 ((mng_timep)pChunk)->iYear = iYear; |
|
3819 ((mng_timep)pChunk)->iMonth = iMonth; |
|
3820 ((mng_timep)pChunk)->iDay = iDay; |
|
3821 ((mng_timep)pChunk)->iHour = iHour; |
|
3822 ((mng_timep)pChunk)->iMinute = iMinute; |
|
3823 ((mng_timep)pChunk)->iSecond = iSecond; |
|
3824 |
|
3825 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
3826 |
|
3827 #ifdef MNG_SUPPORT_TRACE |
|
3828 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TIME, MNG_LC_END); |
|
3829 #endif |
|
3830 |
|
3831 return MNG_NOERROR; |
|
3832 } |
|
3833 #endif |
|
3834 |
|
3835 /* ************************************************************************** */ |
|
3836 |
|
3837 mng_retcode MNG_DECL mng_putchunk_mhdr (mng_handle hHandle, |
|
3838 mng_uint32 iWidth, |
|
3839 mng_uint32 iHeight, |
|
3840 mng_uint32 iTicks, |
|
3841 mng_uint32 iLayercount, |
|
3842 mng_uint32 iFramecount, |
|
3843 mng_uint32 iPlaytime, |
|
3844 mng_uint32 iSimplicity) |
|
3845 { |
|
3846 mng_datap pData; |
|
3847 mng_chunkp pChunk; |
|
3848 mng_retcode iRetcode; |
|
3849 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3850 mng_chunk_header sChunkheader = |
|
3851 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3852 {MNG_UINT_MHDR, mng_init_general, mng_free_general, mng_read_mhdr, mng_write_mhdr, mng_assign_general, 0, 0, sizeof(mng_mhdr)}; |
|
3853 #else |
|
3854 {MNG_UINT_MHDR, mng_init_mhdr, mng_free_mhdr, mng_read_mhdr, mng_write_mhdr, mng_assign_mhdr, 0, 0}; |
|
3855 #endif |
|
3856 #else |
|
3857 mng_chunk_header sChunkheader; |
|
3858 #endif |
|
3859 |
|
3860 #ifdef MNG_SUPPORT_TRACE |
|
3861 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MHDR, MNG_LC_START); |
|
3862 #endif |
|
3863 |
|
3864 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
3865 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
3866 |
|
3867 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
3868 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
3869 /* must be very first! */ |
|
3870 if (pData->iFirstchunkadded != 0) |
|
3871 MNG_ERROR (pData, MNG_SEQUENCEERROR) |
|
3872 /* prevent misplaced TERM ! */ |
|
3873 if (!check_term (pData, MNG_UINT_MHDR)) |
|
3874 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
3875 /* create the chunk */ |
|
3876 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3877 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3878 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3879 #else |
|
3880 iRetcode = mng_init_mhdr (pData, &sChunkheader, &pChunk); |
|
3881 #endif |
|
3882 #else |
|
3883 mng_get_chunkheader(MNG_UINT_MHDR, &sChunkheader); |
|
3884 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3885 #endif |
|
3886 |
|
3887 if (iRetcode) /* on error bail out */ |
|
3888 return iRetcode; |
|
3889 /* fill the chunk */ |
|
3890 ((mng_mhdrp)pChunk)->iWidth = iWidth; |
|
3891 ((mng_mhdrp)pChunk)->iHeight = iHeight; |
|
3892 ((mng_mhdrp)pChunk)->iTicks = iTicks; |
|
3893 ((mng_mhdrp)pChunk)->iLayercount = iLayercount; |
|
3894 ((mng_mhdrp)pChunk)->iFramecount = iFramecount; |
|
3895 ((mng_mhdrp)pChunk)->iPlaytime = iPlaytime; |
|
3896 ((mng_mhdrp)pChunk)->iSimplicity = iSimplicity; |
|
3897 |
|
3898 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
3899 |
|
3900 #ifdef MNG_SUPPORT_TRACE |
|
3901 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MHDR, MNG_LC_END); |
|
3902 #endif |
|
3903 |
|
3904 return MNG_NOERROR; |
|
3905 } |
|
3906 |
|
3907 /* ************************************************************************** */ |
|
3908 |
|
3909 mng_retcode MNG_DECL mng_putchunk_mend (mng_handle hHandle) |
|
3910 { |
|
3911 mng_datap pData; |
|
3912 mng_chunkp pChunk; |
|
3913 mng_retcode iRetcode; |
|
3914 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3915 mng_chunk_header sChunkheader = |
|
3916 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3917 {MNG_UINT_MEND, mng_init_general, mng_free_general, mng_read_mend, mng_write_mend, mng_assign_general, 0, 0, sizeof(mng_mend)}; |
|
3918 #else |
|
3919 {MNG_UINT_MEND, mng_init_mend, mng_free_mend, mng_read_mend, mng_write_mend, mng_assign_mend, 0, 0}; |
|
3920 #endif |
|
3921 #else |
|
3922 mng_chunk_header sChunkheader; |
|
3923 #endif |
|
3924 |
|
3925 #ifdef MNG_SUPPORT_TRACE |
|
3926 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MEND, MNG_LC_START); |
|
3927 #endif |
|
3928 |
|
3929 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
3930 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
3931 |
|
3932 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
3933 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
3934 /* must have had a header first! */ |
|
3935 if (pData->iFirstchunkadded == 0) |
|
3936 MNG_ERROR (pData, MNG_NOHEADER) |
|
3937 /* prevent misplaced TERM ! */ |
|
3938 if (!check_term (pData, MNG_UINT_MEND)) |
|
3939 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
3940 /* create the chunk */ |
|
3941 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3942 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3943 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3944 #else |
|
3945 iRetcode = mng_init_mend (pData, &sChunkheader, &pChunk); |
|
3946 #endif |
|
3947 #else |
|
3948 mng_get_chunkheader(MNG_UINT_MEND, &sChunkheader); |
|
3949 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
3950 #endif |
|
3951 |
|
3952 if (iRetcode) /* on error bail out */ |
|
3953 return iRetcode; |
|
3954 |
|
3955 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
3956 |
|
3957 pData->bCreating = MNG_FALSE; /* should be last chunk !!! */ |
|
3958 |
|
3959 #ifdef MNG_SUPPORT_TRACE |
|
3960 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MEND, MNG_LC_END); |
|
3961 #endif |
|
3962 |
|
3963 return MNG_NOERROR; |
|
3964 } |
|
3965 |
|
3966 /* ************************************************************************** */ |
|
3967 |
|
3968 #ifndef MNG_SKIPCHUNK_LOOP |
|
3969 mng_retcode MNG_DECL mng_putchunk_loop (mng_handle hHandle, |
|
3970 mng_uint8 iLevel, |
|
3971 mng_uint32 iRepeat, |
|
3972 mng_uint8 iTermination, |
|
3973 mng_uint32 iItermin, |
|
3974 mng_uint32 iItermax, |
|
3975 mng_uint32 iCount, |
|
3976 mng_uint32p pSignals) |
|
3977 { |
|
3978 mng_datap pData; |
|
3979 mng_chunkp pChunk; |
|
3980 mng_retcode iRetcode; |
|
3981 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
3982 mng_chunk_header sChunkheader = |
|
3983 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
3984 {MNG_UINT_LOOP, mng_init_general, mng_free_loop, mng_read_loop, mng_write_loop, mng_assign_loop, 0, 0, sizeof(mng_loop)}; |
|
3985 #else |
|
3986 {MNG_UINT_LOOP, mng_init_loop, mng_free_loop, mng_read_loop, mng_write_loop, mng_assign_loop, 0, 0}; |
|
3987 #endif |
|
3988 #else |
|
3989 mng_chunk_header sChunkheader; |
|
3990 #endif |
|
3991 |
|
3992 #ifdef MNG_SUPPORT_TRACE |
|
3993 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_LOOP, MNG_LC_START); |
|
3994 #endif |
|
3995 |
|
3996 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
3997 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
3998 |
|
3999 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
4000 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
4001 /* must have had a MHDR first! */ |
|
4002 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
4003 MNG_ERROR (pData, MNG_NOHEADER) |
|
4004 /* prevent misplaced TERM ! */ |
|
4005 if (!check_term (pData, MNG_UINT_LOOP)) |
|
4006 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
4007 /* create the chunk */ |
|
4008 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4009 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4010 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4011 #else |
|
4012 iRetcode = mng_init_loop (pData, &sChunkheader, &pChunk); |
|
4013 #endif |
|
4014 #else |
|
4015 mng_get_chunkheader(MNG_UINT_LOOP, &sChunkheader); |
|
4016 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4017 #endif |
|
4018 |
|
4019 if (iRetcode) /* on error bail out */ |
|
4020 return iRetcode; |
|
4021 /* fill the chunk */ |
|
4022 ((mng_loopp)pChunk)->iLevel = iLevel; |
|
4023 ((mng_loopp)pChunk)->iRepeat = iRepeat; |
|
4024 ((mng_loopp)pChunk)->iTermination = iTermination; |
|
4025 ((mng_loopp)pChunk)->iItermin = iItermin; |
|
4026 ((mng_loopp)pChunk)->iItermax = iItermax; |
|
4027 ((mng_loopp)pChunk)->iCount = iCount; |
|
4028 ((mng_loopp)pChunk)->pSignals = pSignals; |
|
4029 |
|
4030 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
4031 |
|
4032 #ifdef MNG_SUPPORT_TRACE |
|
4033 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_LOOP, MNG_LC_END); |
|
4034 #endif |
|
4035 |
|
4036 return MNG_NOERROR; |
|
4037 } |
|
4038 |
|
4039 /* ************************************************************************** */ |
|
4040 |
|
4041 mng_retcode MNG_DECL mng_putchunk_endl (mng_handle hHandle, |
|
4042 mng_uint8 iLevel) |
|
4043 { |
|
4044 mng_datap pData; |
|
4045 mng_chunkp pChunk; |
|
4046 mng_retcode iRetcode; |
|
4047 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4048 mng_chunk_header sChunkheader = |
|
4049 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4050 {MNG_UINT_ENDL, mng_init_general, mng_free_general, mng_read_endl, mng_write_endl, mng_assign_general, 0, 0, sizeof(mng_endl)}; |
|
4051 #else |
|
4052 {MNG_UINT_ENDL, mng_init_endl, mng_free_endl, mng_read_endl, mng_write_endl, mng_assign_endl, 0, 0}; |
|
4053 #endif |
|
4054 #else |
|
4055 mng_chunk_header sChunkheader; |
|
4056 #endif |
|
4057 |
|
4058 #ifdef MNG_SUPPORT_TRACE |
|
4059 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ENDL, MNG_LC_START); |
|
4060 #endif |
|
4061 |
|
4062 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
4063 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
4064 |
|
4065 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
4066 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
4067 /* must have had a MHDR first! */ |
|
4068 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
4069 MNG_ERROR (pData, MNG_NOHEADER) |
|
4070 /* prevent misplaced TERM ! */ |
|
4071 if (!check_term (pData, MNG_UINT_ENDL)) |
|
4072 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
4073 /* create the chunk */ |
|
4074 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4075 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4076 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4077 #else |
|
4078 iRetcode = mng_init_endl (pData, &sChunkheader, &pChunk); |
|
4079 #endif |
|
4080 #else |
|
4081 mng_get_chunkheader(MNG_UINT_ENDL, &sChunkheader); |
|
4082 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4083 #endif |
|
4084 |
|
4085 if (iRetcode) /* on error bail out */ |
|
4086 return iRetcode; |
|
4087 /* fill the chunk */ |
|
4088 ((mng_endlp)pChunk)->iLevel = iLevel; |
|
4089 |
|
4090 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
4091 |
|
4092 #ifdef MNG_SUPPORT_TRACE |
|
4093 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ENDL, MNG_LC_END); |
|
4094 #endif |
|
4095 |
|
4096 return MNG_NOERROR; |
|
4097 } |
|
4098 #endif |
|
4099 |
|
4100 /* ************************************************************************** */ |
|
4101 |
|
4102 #ifndef MNG_SKIPCHUNK_DEFI |
|
4103 mng_retcode MNG_DECL mng_putchunk_defi (mng_handle hHandle, |
|
4104 mng_uint16 iObjectid, |
|
4105 mng_uint8 iDonotshow, |
|
4106 mng_uint8 iConcrete, |
|
4107 mng_bool bHasloca, |
|
4108 mng_int32 iXlocation, |
|
4109 mng_int32 iYlocation, |
|
4110 mng_bool bHasclip, |
|
4111 mng_int32 iLeftcb, |
|
4112 mng_int32 iRightcb, |
|
4113 mng_int32 iTopcb, |
|
4114 mng_int32 iBottomcb) |
|
4115 { |
|
4116 mng_datap pData; |
|
4117 mng_chunkp pChunk; |
|
4118 mng_retcode iRetcode; |
|
4119 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4120 mng_chunk_header sChunkheader = |
|
4121 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4122 {MNG_UINT_DEFI, mng_init_general, mng_free_general, mng_read_defi, mng_write_defi, mng_assign_general, 0, 0, sizeof(mng_defi)}; |
|
4123 #else |
|
4124 {MNG_UINT_DEFI, mng_init_defi, mng_free_defi, mng_read_defi, mng_write_defi, mng_assign_defi, 0, 0}; |
|
4125 #endif |
|
4126 #else |
|
4127 mng_chunk_header sChunkheader; |
|
4128 #endif |
|
4129 |
|
4130 #ifdef MNG_SUPPORT_TRACE |
|
4131 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DEFI, MNG_LC_START); |
|
4132 #endif |
|
4133 |
|
4134 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
4135 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
4136 |
|
4137 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
4138 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
4139 /* must have had a MHDR first! */ |
|
4140 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
4141 MNG_ERROR (pData, MNG_NOHEADER) |
|
4142 /* prevent misplaced TERM ! */ |
|
4143 if (!check_term (pData, MNG_UINT_DEFI)) |
|
4144 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
4145 /* create the chunk */ |
|
4146 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4147 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4148 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4149 #else |
|
4150 iRetcode = mng_init_defi (pData, &sChunkheader, &pChunk); |
|
4151 #endif |
|
4152 #else |
|
4153 mng_get_chunkheader(MNG_UINT_DEFI, &sChunkheader); |
|
4154 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4155 #endif |
|
4156 |
|
4157 if (iRetcode) /* on error bail out */ |
|
4158 return iRetcode; |
|
4159 /* fill the chunk */ |
|
4160 ((mng_defip)pChunk)->iObjectid = iObjectid; |
|
4161 ((mng_defip)pChunk)->iDonotshow = iDonotshow; |
|
4162 ((mng_defip)pChunk)->iConcrete = iConcrete; |
|
4163 ((mng_defip)pChunk)->bHasloca = bHasloca; |
|
4164 ((mng_defip)pChunk)->iXlocation = iXlocation; |
|
4165 ((mng_defip)pChunk)->iYlocation = iYlocation; |
|
4166 ((mng_defip)pChunk)->bHasclip = bHasclip; |
|
4167 ((mng_defip)pChunk)->iLeftcb = iLeftcb; |
|
4168 ((mng_defip)pChunk)->iRightcb = iRightcb; |
|
4169 ((mng_defip)pChunk)->iTopcb = iTopcb; |
|
4170 ((mng_defip)pChunk)->iBottomcb = iBottomcb; |
|
4171 |
|
4172 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
4173 |
|
4174 #ifdef MNG_SUPPORT_TRACE |
|
4175 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DEFI, MNG_LC_END); |
|
4176 #endif |
|
4177 |
|
4178 return MNG_NOERROR; |
|
4179 } |
|
4180 #endif |
|
4181 |
|
4182 /* ************************************************************************** */ |
|
4183 |
|
4184 #ifndef MNG_SKIPCHUNK_BASI |
|
4185 mng_retcode MNG_DECL mng_putchunk_basi (mng_handle hHandle, |
|
4186 mng_uint32 iWidth, |
|
4187 mng_uint32 iHeight, |
|
4188 mng_uint8 iBitdepth, |
|
4189 mng_uint8 iColortype, |
|
4190 mng_uint8 iCompression, |
|
4191 mng_uint8 iFilter, |
|
4192 mng_uint8 iInterlace, |
|
4193 mng_uint16 iRed, |
|
4194 mng_uint16 iGreen, |
|
4195 mng_uint16 iBlue, |
|
4196 mng_uint16 iAlpha, |
|
4197 mng_uint8 iViewable) |
|
4198 { |
|
4199 mng_datap pData; |
|
4200 mng_chunkp pChunk; |
|
4201 mng_retcode iRetcode; |
|
4202 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4203 mng_chunk_header sChunkheader = |
|
4204 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4205 {MNG_UINT_BASI, mng_init_general, mng_free_general, mng_read_basi, mng_write_basi, mng_assign_general, 0, 0, sizeof(mng_basi)}; |
|
4206 #else |
|
4207 {MNG_UINT_BASI, mng_init_basi, mng_free_basi, mng_read_basi, mng_write_basi, mng_assign_basi, 0, 0}; |
|
4208 #endif |
|
4209 #else |
|
4210 mng_chunk_header sChunkheader; |
|
4211 #endif |
|
4212 |
|
4213 #ifdef MNG_SUPPORT_TRACE |
|
4214 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BASI, MNG_LC_START); |
|
4215 #endif |
|
4216 |
|
4217 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
4218 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
4219 |
|
4220 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
4221 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
4222 /* must have had a MHDR first! */ |
|
4223 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
4224 MNG_ERROR (pData, MNG_NOHEADER) |
|
4225 /* prevent misplaced TERM ! */ |
|
4226 if (!check_term (pData, MNG_UINT_BASI)) |
|
4227 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
4228 /* create the chunk */ |
|
4229 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4230 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4231 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4232 #else |
|
4233 iRetcode = mng_init_basi (pData, &sChunkheader, &pChunk); |
|
4234 #endif |
|
4235 #else |
|
4236 mng_get_chunkheader(MNG_UINT_BASI, &sChunkheader); |
|
4237 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4238 #endif |
|
4239 |
|
4240 if (iRetcode) /* on error bail out */ |
|
4241 return iRetcode; |
|
4242 /* fill the chunk */ |
|
4243 ((mng_basip)pChunk)->iWidth = iWidth; |
|
4244 ((mng_basip)pChunk)->iHeight = iHeight; |
|
4245 ((mng_basip)pChunk)->iBitdepth = iBitdepth; |
|
4246 ((mng_basip)pChunk)->iColortype = iColortype; |
|
4247 ((mng_basip)pChunk)->iCompression = iCompression; |
|
4248 ((mng_basip)pChunk)->iFilter = iFilter; |
|
4249 ((mng_basip)pChunk)->iInterlace = iInterlace; |
|
4250 ((mng_basip)pChunk)->iRed = iRed; |
|
4251 ((mng_basip)pChunk)->iGreen = iGreen; |
|
4252 ((mng_basip)pChunk)->iBlue = iBlue; |
|
4253 ((mng_basip)pChunk)->iAlpha = iAlpha; |
|
4254 ((mng_basip)pChunk)->iViewable = iViewable; |
|
4255 |
|
4256 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
4257 |
|
4258 #ifdef MNG_SUPPORT_TRACE |
|
4259 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BASI, MNG_LC_END); |
|
4260 #endif |
|
4261 |
|
4262 return MNG_NOERROR; |
|
4263 } |
|
4264 #endif |
|
4265 |
|
4266 /* ************************************************************************** */ |
|
4267 |
|
4268 #ifndef MNG_SKIPCHUNK_CLON |
|
4269 mng_retcode MNG_DECL mng_putchunk_clon (mng_handle hHandle, |
|
4270 mng_uint16 iSourceid, |
|
4271 mng_uint16 iCloneid, |
|
4272 mng_uint8 iClonetype, |
|
4273 mng_uint8 iDonotshow, |
|
4274 mng_uint8 iConcrete, |
|
4275 mng_bool bHasloca, |
|
4276 mng_uint8 iLocationtype, |
|
4277 mng_int32 iLocationx, |
|
4278 mng_int32 iLocationy) |
|
4279 { |
|
4280 mng_datap pData; |
|
4281 mng_chunkp pChunk; |
|
4282 mng_retcode iRetcode; |
|
4283 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4284 mng_chunk_header sChunkheader = |
|
4285 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4286 {MNG_UINT_CLON, mng_init_general, mng_free_general, mng_read_clon, mng_write_clon, mng_assign_general, 0, 0, sizeof(mng_clon)}; |
|
4287 #else |
|
4288 {MNG_UINT_CLON, mng_init_clon, mng_free_clon, mng_read_clon, mng_write_clon, mng_assign_clon, 0, 0}; |
|
4289 #endif |
|
4290 #else |
|
4291 mng_chunk_header sChunkheader; |
|
4292 #endif |
|
4293 |
|
4294 #ifdef MNG_SUPPORT_TRACE |
|
4295 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CLON, MNG_LC_START); |
|
4296 #endif |
|
4297 |
|
4298 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
4299 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
4300 |
|
4301 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
4302 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
4303 /* must have had a MHDR first! */ |
|
4304 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
4305 MNG_ERROR (pData, MNG_NOHEADER) |
|
4306 /* prevent misplaced TERM ! */ |
|
4307 if (!check_term (pData, MNG_UINT_CLON)) |
|
4308 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
4309 /* create the chunk */ |
|
4310 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4311 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4312 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4313 #else |
|
4314 iRetcode = mng_init_clon (pData, &sChunkheader, &pChunk); |
|
4315 #endif |
|
4316 #else |
|
4317 mng_get_chunkheader(MNG_UINT_CLON, &sChunkheader); |
|
4318 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4319 #endif |
|
4320 |
|
4321 if (iRetcode) /* on error bail out */ |
|
4322 return iRetcode; |
|
4323 /* fill the chunk */ |
|
4324 ((mng_clonp)pChunk)->iSourceid = iSourceid; |
|
4325 ((mng_clonp)pChunk)->iCloneid = iCloneid; |
|
4326 ((mng_clonp)pChunk)->iClonetype = iClonetype; |
|
4327 ((mng_clonp)pChunk)->iDonotshow = iDonotshow; |
|
4328 ((mng_clonp)pChunk)->iConcrete = iConcrete; |
|
4329 ((mng_clonp)pChunk)->bHasloca = bHasloca; |
|
4330 ((mng_clonp)pChunk)->iLocationtype = iLocationtype; |
|
4331 ((mng_clonp)pChunk)->iLocationx = iLocationx; |
|
4332 ((mng_clonp)pChunk)->iLocationy = iLocationy; |
|
4333 |
|
4334 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
4335 |
|
4336 #ifdef MNG_SUPPORT_TRACE |
|
4337 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CLON, MNG_LC_END); |
|
4338 #endif |
|
4339 |
|
4340 return MNG_NOERROR; |
|
4341 } |
|
4342 #endif |
|
4343 |
|
4344 /* ************************************************************************** */ |
|
4345 |
|
4346 #ifndef MNG_SKIPCHUNK_PAST |
|
4347 mng_retcode MNG_DECL mng_putchunk_past (mng_handle hHandle, |
|
4348 mng_uint16 iDestid, |
|
4349 mng_uint8 iTargettype, |
|
4350 mng_int32 iTargetx, |
|
4351 mng_int32 iTargety, |
|
4352 mng_uint32 iCount) |
|
4353 { |
|
4354 mng_datap pData; |
|
4355 mng_chunkp pChunk; |
|
4356 mng_retcode iRetcode; |
|
4357 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4358 mng_chunk_header sChunkheader = |
|
4359 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4360 {MNG_UINT_PAST, mng_init_general, mng_free_past, mng_read_past, mng_write_past, mng_assign_past, 0, 0, sizeof(mng_past)}; |
|
4361 #else |
|
4362 {MNG_UINT_PAST, mng_init_past, mng_free_past, mng_read_past, mng_write_past, mng_assign_past, 0, 0}; |
|
4363 #endif |
|
4364 #else |
|
4365 mng_chunk_header sChunkheader; |
|
4366 #endif |
|
4367 |
|
4368 #ifdef MNG_SUPPORT_TRACE |
|
4369 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PAST, MNG_LC_START); |
|
4370 #endif |
|
4371 |
|
4372 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
4373 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
4374 |
|
4375 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
4376 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
4377 /* must have had a MHDR first! */ |
|
4378 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
4379 MNG_ERROR (pData, MNG_NOHEADER) |
|
4380 /* prevent misplaced TERM ! */ |
|
4381 if (!check_term (pData, MNG_UINT_PAST)) |
|
4382 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
4383 /* create the chunk */ |
|
4384 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4385 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4386 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4387 #else |
|
4388 iRetcode = mng_init_past (pData, &sChunkheader, &pChunk); |
|
4389 #endif |
|
4390 #else |
|
4391 mng_get_chunkheader(MNG_UINT_PAST, &sChunkheader); |
|
4392 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4393 #endif |
|
4394 |
|
4395 if (iRetcode) /* on error bail out */ |
|
4396 return iRetcode; |
|
4397 /* fill the chunk */ |
|
4398 ((mng_pastp)pChunk)->iDestid = iDestid; |
|
4399 ((mng_pastp)pChunk)->iTargettype = iTargettype; |
|
4400 ((mng_pastp)pChunk)->iTargetx = iTargetx; |
|
4401 ((mng_pastp)pChunk)->iTargety = iTargety; |
|
4402 ((mng_pastp)pChunk)->iCount = iCount; |
|
4403 |
|
4404 if (iCount) |
|
4405 MNG_ALLOC (pData, ((mng_pastp)pChunk)->pSources, iCount * sizeof (mng_past_source)); |
|
4406 |
|
4407 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
4408 |
|
4409 #ifdef MNG_SUPPORT_TRACE |
|
4410 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PAST, MNG_LC_END); |
|
4411 #endif |
|
4412 |
|
4413 return MNG_NOERROR; |
|
4414 } |
|
4415 #endif |
|
4416 |
|
4417 /* ************************************************************************** */ |
|
4418 |
|
4419 #ifndef MNG_SKIPCHUNK_PAST |
|
4420 mng_retcode MNG_DECL mng_putchunk_past_src (mng_handle hHandle, |
|
4421 mng_uint32 iEntry, |
|
4422 mng_uint16 iSourceid, |
|
4423 mng_uint8 iComposition, |
|
4424 mng_uint8 iOrientation, |
|
4425 mng_uint8 iOffsettype, |
|
4426 mng_int32 iOffsetx, |
|
4427 mng_int32 iOffsety, |
|
4428 mng_uint8 iBoundarytype, |
|
4429 mng_int32 iBoundaryl, |
|
4430 mng_int32 iBoundaryr, |
|
4431 mng_int32 iBoundaryt, |
|
4432 mng_int32 iBoundaryb) |
|
4433 { |
|
4434 mng_datap pData; |
|
4435 mng_chunkp pChunk; |
|
4436 mng_past_sourcep pEntry; |
|
4437 |
|
4438 #ifdef MNG_SUPPORT_TRACE |
|
4439 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PAST_SRC, MNG_LC_START); |
|
4440 #endif |
|
4441 |
|
4442 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
4443 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
4444 |
|
4445 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
4446 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
4447 /* must have had a MHDR first! */ |
|
4448 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
4449 MNG_ERROR (pData, MNG_NOHEADER) |
|
4450 |
|
4451 pChunk = pData->pLastchunk; /* last one must have been PAST ! */ |
|
4452 |
|
4453 if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_PAST) |
|
4454 MNG_ERROR (pData, MNG_NOCORRCHUNK) |
|
4455 /* index out of bounds ? */ |
|
4456 if (iEntry >= ((mng_pastp)pChunk)->iCount) |
|
4457 MNG_ERROR (pData, MNG_INVALIDENTRYIX) |
|
4458 /* address proper entry */ |
|
4459 pEntry = ((mng_pastp)pChunk)->pSources + iEntry; |
|
4460 |
|
4461 pEntry->iSourceid = iSourceid; /* fill entry */ |
|
4462 pEntry->iComposition = iComposition; |
|
4463 pEntry->iOrientation = iOrientation; |
|
4464 pEntry->iOffsettype = iOffsettype; |
|
4465 pEntry->iOffsetx = iOffsetx; |
|
4466 pEntry->iOffsety = iOffsety; |
|
4467 pEntry->iBoundarytype = iBoundarytype; |
|
4468 pEntry->iBoundaryl = iBoundaryl; |
|
4469 pEntry->iBoundaryr = iBoundaryr; |
|
4470 pEntry->iBoundaryt = iBoundaryt; |
|
4471 pEntry->iBoundaryb = iBoundaryb; |
|
4472 |
|
4473 #ifdef MNG_SUPPORT_TRACE |
|
4474 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PAST_SRC, MNG_LC_END); |
|
4475 #endif |
|
4476 |
|
4477 return MNG_NOERROR; |
|
4478 } |
|
4479 #endif |
|
4480 |
|
4481 /* ************************************************************************** */ |
|
4482 |
|
4483 #ifndef MNG_SKIPCHUNK_DISC |
|
4484 mng_retcode MNG_DECL mng_putchunk_disc (mng_handle hHandle, |
|
4485 mng_uint32 iCount, |
|
4486 mng_uint16p pObjectids) |
|
4487 { |
|
4488 mng_datap pData; |
|
4489 mng_chunkp pChunk; |
|
4490 mng_retcode iRetcode; |
|
4491 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4492 mng_chunk_header sChunkheader = |
|
4493 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4494 {MNG_UINT_DISC, mng_init_general, mng_free_disc, mng_read_disc, mng_write_disc, mng_assign_disc, 0, 0, sizeof(mng_disc)}; |
|
4495 #else |
|
4496 {MNG_UINT_DISC, mng_init_disc, mng_free_disc, mng_read_disc, mng_write_disc, mng_assign_disc, 0, 0}; |
|
4497 #endif |
|
4498 #else |
|
4499 mng_chunk_header sChunkheader; |
|
4500 #endif |
|
4501 |
|
4502 #ifdef MNG_SUPPORT_TRACE |
|
4503 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DISC, MNG_LC_START); |
|
4504 #endif |
|
4505 |
|
4506 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
4507 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
4508 |
|
4509 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
4510 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
4511 /* must have had a MHDR first! */ |
|
4512 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
4513 MNG_ERROR (pData, MNG_NOHEADER) |
|
4514 /* prevent misplaced TERM ! */ |
|
4515 if (!check_term (pData, MNG_UINT_DISC)) |
|
4516 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
4517 /* create the chunk */ |
|
4518 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4519 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4520 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4521 #else |
|
4522 iRetcode = mng_init_disc (pData, &sChunkheader, &pChunk); |
|
4523 #endif |
|
4524 #else |
|
4525 mng_get_chunkheader(MNG_UINT_DISC, &sChunkheader); |
|
4526 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4527 #endif |
|
4528 |
|
4529 if (iRetcode) /* on error bail out */ |
|
4530 return iRetcode; |
|
4531 /* fill the chunk */ |
|
4532 ((mng_discp)pChunk)->iCount = iCount; |
|
4533 |
|
4534 if (iCount) |
|
4535 { |
|
4536 mng_uint32 iSize = iCount * sizeof (mng_uint32); |
|
4537 |
|
4538 MNG_ALLOC (pData, ((mng_discp)pChunk)->pObjectids, iSize); |
|
4539 MNG_COPY (((mng_discp)pChunk)->pObjectids, pObjectids, iSize); |
|
4540 } |
|
4541 |
|
4542 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
4543 |
|
4544 #ifdef MNG_SUPPORT_TRACE |
|
4545 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DISC, MNG_LC_END); |
|
4546 #endif |
|
4547 |
|
4548 return MNG_NOERROR; |
|
4549 } |
|
4550 #endif |
|
4551 |
|
4552 /* ************************************************************************** */ |
|
4553 |
|
4554 #ifndef MNG_SKIPCHUNK_BACK |
|
4555 mng_retcode MNG_DECL mng_putchunk_back (mng_handle hHandle, |
|
4556 mng_uint16 iRed, |
|
4557 mng_uint16 iGreen, |
|
4558 mng_uint16 iBlue, |
|
4559 mng_uint8 iMandatory, |
|
4560 mng_uint16 iImageid, |
|
4561 mng_uint8 iTile) |
|
4562 { |
|
4563 mng_datap pData; |
|
4564 mng_chunkp pChunk; |
|
4565 mng_retcode iRetcode; |
|
4566 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4567 mng_chunk_header sChunkheader = |
|
4568 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4569 {MNG_UINT_BACK, mng_init_general, mng_free_general, mng_read_back, mng_write_back, mng_assign_general, 0, 0, sizeof(mng_back)}; |
|
4570 #else |
|
4571 {MNG_UINT_BACK, mng_init_back, mng_free_back, mng_read_back, mng_write_back, mng_assign_back, 0, 0}; |
|
4572 #endif |
|
4573 #else |
|
4574 mng_chunk_header sChunkheader; |
|
4575 #endif |
|
4576 |
|
4577 #ifdef MNG_SUPPORT_TRACE |
|
4578 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BACK, MNG_LC_START); |
|
4579 #endif |
|
4580 |
|
4581 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
4582 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
4583 |
|
4584 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
4585 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
4586 /* must have had a MHDR first! */ |
|
4587 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
4588 MNG_ERROR (pData, MNG_NOHEADER) |
|
4589 /* prevent misplaced TERM ! */ |
|
4590 if (!check_term (pData, MNG_UINT_BACK)) |
|
4591 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
4592 /* create the chunk */ |
|
4593 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4594 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4595 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4596 #else |
|
4597 iRetcode = mng_init_back (pData, &sChunkheader, &pChunk); |
|
4598 #endif |
|
4599 #else |
|
4600 mng_get_chunkheader(MNG_UINT_BACK, &sChunkheader); |
|
4601 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4602 #endif |
|
4603 |
|
4604 if (iRetcode) /* on error bail out */ |
|
4605 return iRetcode; |
|
4606 /* fill the chunk */ |
|
4607 ((mng_backp)pChunk)->iRed = iRed; |
|
4608 ((mng_backp)pChunk)->iGreen = iGreen; |
|
4609 ((mng_backp)pChunk)->iBlue = iBlue; |
|
4610 ((mng_backp)pChunk)->iMandatory = iMandatory; |
|
4611 ((mng_backp)pChunk)->iImageid = iImageid; |
|
4612 ((mng_backp)pChunk)->iTile = iTile; |
|
4613 |
|
4614 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
4615 |
|
4616 #ifdef MNG_SUPPORT_TRACE |
|
4617 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BACK, MNG_LC_END); |
|
4618 #endif |
|
4619 |
|
4620 return MNG_NOERROR; |
|
4621 } |
|
4622 #endif |
|
4623 |
|
4624 /* ************************************************************************** */ |
|
4625 |
|
4626 #ifndef MNG_SKIPCHUNK_FRAM |
|
4627 mng_retcode MNG_DECL mng_putchunk_fram (mng_handle hHandle, |
|
4628 mng_bool bEmpty, |
|
4629 mng_uint8 iMode, |
|
4630 mng_uint32 iNamesize, |
|
4631 mng_pchar zName, |
|
4632 mng_uint8 iChangedelay, |
|
4633 mng_uint8 iChangetimeout, |
|
4634 mng_uint8 iChangeclipping, |
|
4635 mng_uint8 iChangesyncid, |
|
4636 mng_uint32 iDelay, |
|
4637 mng_uint32 iTimeout, |
|
4638 mng_uint8 iBoundarytype, |
|
4639 mng_int32 iBoundaryl, |
|
4640 mng_int32 iBoundaryr, |
|
4641 mng_int32 iBoundaryt, |
|
4642 mng_int32 iBoundaryb, |
|
4643 mng_uint32 iCount, |
|
4644 mng_uint32p pSyncids) |
|
4645 { |
|
4646 mng_datap pData; |
|
4647 mng_chunkp pChunk; |
|
4648 mng_retcode iRetcode; |
|
4649 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4650 mng_chunk_header sChunkheader = |
|
4651 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4652 {MNG_UINT_FRAM, mng_init_general, mng_free_fram, mng_read_fram, mng_write_fram, mng_assign_fram, 0, 0, sizeof(mng_fram)}; |
|
4653 #else |
|
4654 {MNG_UINT_FRAM, mng_init_fram, mng_free_fram, mng_read_fram, mng_write_fram, mng_assign_fram, 0, 0}; |
|
4655 #endif |
|
4656 #else |
|
4657 mng_chunk_header sChunkheader; |
|
4658 #endif |
|
4659 |
|
4660 #ifdef MNG_SUPPORT_TRACE |
|
4661 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_FRAM, MNG_LC_START); |
|
4662 #endif |
|
4663 |
|
4664 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
4665 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
4666 |
|
4667 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
4668 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
4669 /* must have had a MHDR first! */ |
|
4670 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
4671 MNG_ERROR (pData, MNG_NOHEADER) |
|
4672 /* prevent misplaced TERM ! */ |
|
4673 if (!check_term (pData, MNG_UINT_FRAM)) |
|
4674 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
4675 /* create the chunk */ |
|
4676 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4677 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4678 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4679 #else |
|
4680 iRetcode = mng_init_fram (pData, &sChunkheader, &pChunk); |
|
4681 #endif |
|
4682 #else |
|
4683 mng_get_chunkheader(MNG_UINT_FRAM, &sChunkheader); |
|
4684 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4685 #endif |
|
4686 |
|
4687 if (iRetcode) /* on error bail out */ |
|
4688 return iRetcode; |
|
4689 /* fill the chunk */ |
|
4690 ((mng_framp)pChunk)->bEmpty = bEmpty; |
|
4691 ((mng_framp)pChunk)->iMode = iMode; |
|
4692 ((mng_framp)pChunk)->iNamesize = iNamesize; |
|
4693 ((mng_framp)pChunk)->iChangedelay = iChangedelay; |
|
4694 ((mng_framp)pChunk)->iChangetimeout = iChangetimeout; |
|
4695 ((mng_framp)pChunk)->iChangeclipping = iChangeclipping; |
|
4696 ((mng_framp)pChunk)->iChangesyncid = iChangesyncid; |
|
4697 ((mng_framp)pChunk)->iDelay = iDelay; |
|
4698 ((mng_framp)pChunk)->iTimeout = iTimeout; |
|
4699 ((mng_framp)pChunk)->iBoundarytype = iBoundarytype; |
|
4700 ((mng_framp)pChunk)->iBoundaryl = iBoundaryl; |
|
4701 ((mng_framp)pChunk)->iBoundaryr = iBoundaryr; |
|
4702 ((mng_framp)pChunk)->iBoundaryt = iBoundaryt; |
|
4703 ((mng_framp)pChunk)->iBoundaryb = iBoundaryb; |
|
4704 ((mng_framp)pChunk)->iCount = iCount; |
|
4705 |
|
4706 if (iNamesize) |
|
4707 { |
|
4708 MNG_ALLOC (pData, ((mng_framp)pChunk)->zName, iNamesize + 1); |
|
4709 MNG_COPY (((mng_framp)pChunk)->zName, zName, iNamesize); |
|
4710 } |
|
4711 |
|
4712 if (iCount) |
|
4713 { |
|
4714 mng_uint32 iSize = iCount * sizeof (mng_uint32); |
|
4715 |
|
4716 MNG_ALLOC (pData, ((mng_framp)pChunk)->pSyncids, iSize); |
|
4717 MNG_COPY (((mng_framp)pChunk)->pSyncids, pSyncids, iSize); |
|
4718 } |
|
4719 |
|
4720 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
4721 |
|
4722 #ifdef MNG_SUPPORT_TRACE |
|
4723 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_FRAM, MNG_LC_END); |
|
4724 #endif |
|
4725 |
|
4726 return MNG_NOERROR; |
|
4727 } |
|
4728 #endif |
|
4729 |
|
4730 /* ************************************************************************** */ |
|
4731 |
|
4732 #ifndef MNG_SKIPCHUNK_MOVE |
|
4733 mng_retcode MNG_DECL mng_putchunk_move (mng_handle hHandle, |
|
4734 mng_uint16 iFirstid, |
|
4735 mng_uint16 iLastid, |
|
4736 mng_uint8 iMovetype, |
|
4737 mng_int32 iMovex, |
|
4738 mng_int32 iMovey) |
|
4739 { |
|
4740 mng_datap pData; |
|
4741 mng_chunkp pChunk; |
|
4742 mng_retcode iRetcode; |
|
4743 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4744 mng_chunk_header sChunkheader = |
|
4745 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4746 {MNG_UINT_MOVE, mng_init_general, mng_free_general, mng_read_move, mng_write_move, mng_assign_general, 0, 0, sizeof(mng_move)}; |
|
4747 #else |
|
4748 {MNG_UINT_MOVE, mng_init_move, mng_free_move, mng_read_move, mng_write_move, mng_assign_move, 0, 0}; |
|
4749 #endif |
|
4750 #else |
|
4751 mng_chunk_header sChunkheader; |
|
4752 #endif |
|
4753 |
|
4754 #ifdef MNG_SUPPORT_TRACE |
|
4755 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MOVE, MNG_LC_START); |
|
4756 #endif |
|
4757 |
|
4758 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
4759 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
4760 |
|
4761 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
4762 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
4763 /* must have had a MHDR first! */ |
|
4764 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
4765 MNG_ERROR (pData, MNG_NOHEADER) |
|
4766 /* prevent misplaced TERM ! */ |
|
4767 if (!check_term (pData, MNG_UINT_MOVE)) |
|
4768 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
4769 /* create the chunk */ |
|
4770 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4771 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4772 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4773 #else |
|
4774 iRetcode = mng_init_move (pData, &sChunkheader, &pChunk); |
|
4775 #endif |
|
4776 #else |
|
4777 mng_get_chunkheader(MNG_UINT_MOVE, &sChunkheader); |
|
4778 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4779 #endif |
|
4780 |
|
4781 if (iRetcode) /* on error bail out */ |
|
4782 return iRetcode; |
|
4783 /* fill the chunk */ |
|
4784 ((mng_movep)pChunk)->iFirstid = iFirstid; |
|
4785 ((mng_movep)pChunk)->iLastid = iLastid; |
|
4786 ((mng_movep)pChunk)->iMovetype = iMovetype; |
|
4787 ((mng_movep)pChunk)->iMovex = iMovex; |
|
4788 ((mng_movep)pChunk)->iMovey = iMovey; |
|
4789 |
|
4790 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
4791 |
|
4792 #ifdef MNG_SUPPORT_TRACE |
|
4793 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MOVE, MNG_LC_END); |
|
4794 #endif |
|
4795 |
|
4796 return MNG_NOERROR; |
|
4797 } |
|
4798 #endif |
|
4799 |
|
4800 /* ************************************************************************** */ |
|
4801 |
|
4802 #ifndef MNG_SKIPCHUNK_CLIP |
|
4803 mng_retcode MNG_DECL mng_putchunk_clip (mng_handle hHandle, |
|
4804 mng_uint16 iFirstid, |
|
4805 mng_uint16 iLastid, |
|
4806 mng_uint8 iCliptype, |
|
4807 mng_int32 iClipl, |
|
4808 mng_int32 iClipr, |
|
4809 mng_int32 iClipt, |
|
4810 mng_int32 iClipb) |
|
4811 { |
|
4812 mng_datap pData; |
|
4813 mng_chunkp pChunk; |
|
4814 mng_retcode iRetcode; |
|
4815 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4816 mng_chunk_header sChunkheader = |
|
4817 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4818 {MNG_UINT_CLIP, mng_init_general, mng_free_general, mng_read_clip, mng_write_clip, mng_assign_general, 0, 0, sizeof(mng_clip)}; |
|
4819 #else |
|
4820 {MNG_UINT_CLIP, mng_init_clip, mng_free_clip, mng_read_clip, mng_write_clip, mng_assign_clip, 0, 0}; |
|
4821 #endif |
|
4822 #else |
|
4823 mng_chunk_header sChunkheader; |
|
4824 #endif |
|
4825 |
|
4826 #ifdef MNG_SUPPORT_TRACE |
|
4827 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CLIP, MNG_LC_START); |
|
4828 #endif |
|
4829 |
|
4830 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
4831 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
4832 |
|
4833 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
4834 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
4835 /* must have had a MHDR first! */ |
|
4836 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
4837 MNG_ERROR (pData, MNG_NOHEADER) |
|
4838 /* prevent misplaced TERM ! */ |
|
4839 if (!check_term (pData, MNG_UINT_CLIP)) |
|
4840 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
4841 /* create the chunk */ |
|
4842 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4843 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4844 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4845 #else |
|
4846 iRetcode = mng_init_clip (pData, &sChunkheader, &pChunk); |
|
4847 #endif |
|
4848 #else |
|
4849 mng_get_chunkheader(MNG_UINT_CLIP, &sChunkheader); |
|
4850 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4851 #endif |
|
4852 |
|
4853 if (iRetcode) /* on error bail out */ |
|
4854 return iRetcode; |
|
4855 /* fill the chunk */ |
|
4856 ((mng_clipp)pChunk)->iFirstid = iFirstid; |
|
4857 ((mng_clipp)pChunk)->iLastid = iLastid; |
|
4858 ((mng_clipp)pChunk)->iCliptype = iCliptype; |
|
4859 ((mng_clipp)pChunk)->iClipl = iClipl; |
|
4860 ((mng_clipp)pChunk)->iClipr = iClipr; |
|
4861 ((mng_clipp)pChunk)->iClipt = iClipt; |
|
4862 ((mng_clipp)pChunk)->iClipb = iClipb; |
|
4863 |
|
4864 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
4865 |
|
4866 #ifdef MNG_SUPPORT_TRACE |
|
4867 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CLIP, MNG_LC_END); |
|
4868 #endif |
|
4869 |
|
4870 return MNG_NOERROR; |
|
4871 } |
|
4872 #endif |
|
4873 |
|
4874 |
|
4875 /* ************************************************************************** */ |
|
4876 |
|
4877 #ifndef MNG_SKIPCHUNK_SHOW |
|
4878 mng_retcode MNG_DECL mng_putchunk_show (mng_handle hHandle, |
|
4879 mng_bool bEmpty, |
|
4880 mng_uint16 iFirstid, |
|
4881 mng_uint16 iLastid, |
|
4882 mng_uint8 iMode) |
|
4883 { |
|
4884 mng_datap pData; |
|
4885 mng_chunkp pChunk; |
|
4886 mng_retcode iRetcode; |
|
4887 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4888 mng_chunk_header sChunkheader = |
|
4889 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4890 {MNG_UINT_SHOW, mng_init_general, mng_free_general, mng_read_show, mng_write_show, mng_assign_general, 0, 0, sizeof(mng_show)}; |
|
4891 #else |
|
4892 {MNG_UINT_SHOW, mng_init_show, mng_free_show, mng_read_show, mng_write_show, mng_assign_show, 0, 0}; |
|
4893 #endif |
|
4894 #else |
|
4895 mng_chunk_header sChunkheader; |
|
4896 #endif |
|
4897 |
|
4898 #ifdef MNG_SUPPORT_TRACE |
|
4899 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SHOW, MNG_LC_START); |
|
4900 #endif |
|
4901 |
|
4902 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
4903 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
4904 |
|
4905 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
4906 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
4907 /* must have had a MHDR first! */ |
|
4908 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
4909 MNG_ERROR (pData, MNG_NOHEADER) |
|
4910 /* prevent misplaced TERM ! */ |
|
4911 if (!check_term (pData, MNG_UINT_SHOW)) |
|
4912 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
4913 /* create the chunk */ |
|
4914 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4915 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4916 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4917 #else |
|
4918 iRetcode = mng_init_show (pData, &sChunkheader, &pChunk); |
|
4919 #endif |
|
4920 #else |
|
4921 mng_get_chunkheader(MNG_UINT_SHOW, &sChunkheader); |
|
4922 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4923 #endif |
|
4924 |
|
4925 if (iRetcode) /* on error bail out */ |
|
4926 return iRetcode; |
|
4927 /* fill the chunk */ |
|
4928 ((mng_showp)pChunk)->bEmpty = bEmpty; |
|
4929 ((mng_showp)pChunk)->iFirstid = iFirstid; |
|
4930 ((mng_showp)pChunk)->iLastid = iLastid; |
|
4931 ((mng_showp)pChunk)->iMode = iMode; |
|
4932 |
|
4933 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
4934 |
|
4935 #ifdef MNG_SUPPORT_TRACE |
|
4936 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SHOW, MNG_LC_END); |
|
4937 #endif |
|
4938 |
|
4939 return MNG_NOERROR; |
|
4940 } |
|
4941 #endif |
|
4942 |
|
4943 /* ************************************************************************** */ |
|
4944 |
|
4945 #ifndef MNG_SKIPCHUNK_TERM |
|
4946 mng_retcode MNG_DECL mng_putchunk_term (mng_handle hHandle, |
|
4947 mng_uint8 iTermaction, |
|
4948 mng_uint8 iIteraction, |
|
4949 mng_uint32 iDelay, |
|
4950 mng_uint32 iItermax) |
|
4951 { |
|
4952 mng_datap pData; |
|
4953 mng_chunkp pChunk; |
|
4954 mng_retcode iRetcode; |
|
4955 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4956 mng_chunk_header sChunkheader = |
|
4957 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4958 {MNG_UINT_TERM, mng_init_general, mng_free_general, mng_read_term, mng_write_term, mng_assign_general, 0, 0, sizeof(mng_term)}; |
|
4959 #else |
|
4960 {MNG_UINT_TERM, mng_init_term, mng_free_term, mng_read_term, mng_write_term, mng_assign_term, 0, 0}; |
|
4961 #endif |
|
4962 #else |
|
4963 mng_chunk_header sChunkheader; |
|
4964 #endif |
|
4965 |
|
4966 #ifdef MNG_SUPPORT_TRACE |
|
4967 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TERM, MNG_LC_START); |
|
4968 #endif |
|
4969 |
|
4970 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
4971 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
4972 |
|
4973 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
4974 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
4975 /* must have had a MHDR first! */ |
|
4976 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
4977 MNG_ERROR (pData, MNG_NOHEADER) |
|
4978 /* create the chunk */ |
|
4979 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
4980 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
4981 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4982 #else |
|
4983 iRetcode = mng_init_term (pData, &sChunkheader, &pChunk); |
|
4984 #endif |
|
4985 #else |
|
4986 mng_get_chunkheader(MNG_UINT_TERM, &sChunkheader); |
|
4987 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
4988 #endif |
|
4989 |
|
4990 if (iRetcode) /* on error bail out */ |
|
4991 return iRetcode; |
|
4992 /* fill the chunk */ |
|
4993 ((mng_termp)pChunk)->iTermaction = iTermaction; |
|
4994 ((mng_termp)pChunk)->iIteraction = iIteraction; |
|
4995 ((mng_termp)pChunk)->iDelay = iDelay; |
|
4996 ((mng_termp)pChunk)->iItermax = iItermax; |
|
4997 |
|
4998 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
4999 |
|
5000 #ifdef MNG_SUPPORT_TRACE |
|
5001 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TERM, MNG_LC_END); |
|
5002 #endif |
|
5003 |
|
5004 return MNG_NOERROR; |
|
5005 } |
|
5006 #endif |
|
5007 |
|
5008 /* ************************************************************************** */ |
|
5009 |
|
5010 #ifndef MNG_SKIPCHUNK_SAVE |
|
5011 mng_retcode MNG_DECL mng_putchunk_save (mng_handle hHandle, |
|
5012 mng_bool bEmpty, |
|
5013 mng_uint8 iOffsettype, |
|
5014 mng_uint32 iCount) |
|
5015 { |
|
5016 mng_datap pData; |
|
5017 mng_chunkp pChunk; |
|
5018 mng_retcode iRetcode; |
|
5019 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5020 mng_chunk_header sChunkheader = |
|
5021 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5022 {MNG_UINT_SAVE, mng_init_general, mng_free_save, mng_read_save, mng_write_save, mng_assign_save, 0, 0, sizeof(mng_save)}; |
|
5023 #else |
|
5024 {MNG_UINT_SAVE, mng_init_save, mng_free_save, mng_read_save, mng_write_save, mng_assign_save, 0, 0}; |
|
5025 #endif |
|
5026 #else |
|
5027 mng_chunk_header sChunkheader; |
|
5028 #endif |
|
5029 |
|
5030 #ifdef MNG_SUPPORT_TRACE |
|
5031 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SAVE, MNG_LC_START); |
|
5032 #endif |
|
5033 |
|
5034 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
5035 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
5036 |
|
5037 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
5038 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
5039 /* must have had a MHDR first! */ |
|
5040 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
5041 MNG_ERROR (pData, MNG_NOHEADER) |
|
5042 /* prevent misplaced TERM ! */ |
|
5043 if (!check_term (pData, MNG_UINT_SAVE)) |
|
5044 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
5045 /* create the chunk */ |
|
5046 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5047 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5048 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5049 #else |
|
5050 iRetcode = mng_init_save (pData, &sChunkheader, &pChunk); |
|
5051 #endif |
|
5052 #else |
|
5053 mng_get_chunkheader(MNG_UINT_SAVE, &sChunkheader); |
|
5054 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5055 #endif |
|
5056 |
|
5057 if (iRetcode) /* on error bail out */ |
|
5058 return iRetcode; |
|
5059 /* fill the chunk */ |
|
5060 ((mng_savep)pChunk)->bEmpty = bEmpty; |
|
5061 ((mng_savep)pChunk)->iOffsettype = iOffsettype; |
|
5062 ((mng_savep)pChunk)->iCount = iCount; |
|
5063 |
|
5064 if (iCount) |
|
5065 MNG_ALLOC (pData, ((mng_savep)pChunk)->pEntries, iCount * sizeof (mng_save_entry)); |
|
5066 |
|
5067 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
5068 |
|
5069 #ifdef MNG_SUPPORT_TRACE |
|
5070 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SAVE, MNG_LC_END); |
|
5071 #endif |
|
5072 |
|
5073 return MNG_NOERROR; |
|
5074 } |
|
5075 |
|
5076 /* ************************************************************************** */ |
|
5077 |
|
5078 mng_retcode MNG_DECL mng_putchunk_save_entry (mng_handle hHandle, |
|
5079 mng_uint32 iEntry, |
|
5080 mng_uint8 iEntrytype, |
|
5081 mng_uint32arr2 iOffset, |
|
5082 mng_uint32arr2 iStarttime, |
|
5083 mng_uint32 iLayernr, |
|
5084 mng_uint32 iFramenr, |
|
5085 mng_uint32 iNamesize, |
|
5086 mng_pchar zName) |
|
5087 { |
|
5088 mng_datap pData; |
|
5089 mng_chunkp pChunk; |
|
5090 mng_save_entryp pEntry; |
|
5091 |
|
5092 #ifdef MNG_SUPPORT_TRACE |
|
5093 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SAVE_ENTRY, MNG_LC_START); |
|
5094 #endif |
|
5095 |
|
5096 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
5097 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
5098 |
|
5099 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
5100 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
5101 /* must have had a MHDR first! */ |
|
5102 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
5103 MNG_ERROR (pData, MNG_NOHEADER) |
|
5104 |
|
5105 pChunk = pData->pLastchunk; /* last one must have been SAVE ! */ |
|
5106 |
|
5107 if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_SAVE) |
|
5108 MNG_ERROR (pData, MNG_NOCORRCHUNK) |
|
5109 /* index out of bounds ? */ |
|
5110 if (iEntry >= ((mng_savep)pChunk)->iCount) |
|
5111 MNG_ERROR (pData, MNG_INVALIDENTRYIX) |
|
5112 /* address proper entry */ |
|
5113 pEntry = ((mng_savep)pChunk)->pEntries + iEntry; |
|
5114 |
|
5115 pEntry->iEntrytype = iEntrytype; /* fill entry */ |
|
5116 pEntry->iOffset[0] = iOffset[0]; |
|
5117 pEntry->iOffset[1] = iOffset[1]; |
|
5118 pEntry->iStarttime[0] = iStarttime[0]; |
|
5119 pEntry->iStarttime[1] = iStarttime[1]; |
|
5120 pEntry->iLayernr = iLayernr; |
|
5121 pEntry->iFramenr = iFramenr; |
|
5122 pEntry->iNamesize = iNamesize; |
|
5123 |
|
5124 if (iNamesize) |
|
5125 { |
|
5126 MNG_ALLOC (pData, pEntry->zName, iNamesize + 1); |
|
5127 MNG_COPY (pEntry->zName, zName, iNamesize); |
|
5128 } |
|
5129 |
|
5130 #ifdef MNG_SUPPORT_TRACE |
|
5131 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SAVE_ENTRY, MNG_LC_END); |
|
5132 #endif |
|
5133 |
|
5134 return MNG_NOERROR; |
|
5135 } |
|
5136 #endif |
|
5137 |
|
5138 /* ************************************************************************** */ |
|
5139 |
|
5140 #ifndef MNG_SKIPCHUNK_SEEK |
|
5141 mng_retcode MNG_DECL mng_putchunk_seek (mng_handle hHandle, |
|
5142 mng_uint32 iNamesize, |
|
5143 mng_pchar zName) |
|
5144 { |
|
5145 mng_datap pData; |
|
5146 mng_chunkp pChunk; |
|
5147 mng_retcode iRetcode; |
|
5148 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5149 mng_chunk_header sChunkheader = |
|
5150 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5151 {MNG_UINT_SEEK, mng_init_general, mng_free_seek, mng_read_seek, mng_write_seek, mng_assign_seek, 0, 0, sizeof(mng_seek)}; |
|
5152 #else |
|
5153 {MNG_UINT_SEEK, mng_init_seek, mng_free_seek, mng_read_seek, mng_write_seek, mng_assign_seek, 0, 0}; |
|
5154 #endif |
|
5155 #else |
|
5156 mng_chunk_header sChunkheader; |
|
5157 #endif |
|
5158 |
|
5159 #ifdef MNG_SUPPORT_TRACE |
|
5160 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SEEK, MNG_LC_START); |
|
5161 #endif |
|
5162 |
|
5163 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
5164 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
5165 |
|
5166 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
5167 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
5168 /* must have had a MHDR first! */ |
|
5169 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
5170 MNG_ERROR (pData, MNG_NOHEADER) |
|
5171 /* prevent misplaced TERM ! */ |
|
5172 if (!check_term (pData, MNG_UINT_SEEK)) |
|
5173 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
5174 /* create the chunk */ |
|
5175 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5176 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5177 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5178 #else |
|
5179 iRetcode = mng_init_seek (pData, &sChunkheader, &pChunk); |
|
5180 #endif |
|
5181 #else |
|
5182 mng_get_chunkheader(MNG_UINT_SEEK, &sChunkheader); |
|
5183 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5184 #endif |
|
5185 |
|
5186 if (iRetcode) /* on error bail out */ |
|
5187 return iRetcode; |
|
5188 /* fill the chunk */ |
|
5189 ((mng_seekp)pChunk)->iNamesize = iNamesize; |
|
5190 |
|
5191 if (iNamesize) |
|
5192 { |
|
5193 MNG_ALLOC (pData, ((mng_seekp)pChunk)->zName, iNamesize + 1); |
|
5194 MNG_COPY (((mng_seekp)pChunk)->zName, zName, iNamesize); |
|
5195 } |
|
5196 |
|
5197 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
5198 |
|
5199 #ifdef MNG_SUPPORT_TRACE |
|
5200 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SEEK, MNG_LC_END); |
|
5201 #endif |
|
5202 |
|
5203 return MNG_NOERROR; |
|
5204 } |
|
5205 #endif |
|
5206 |
|
5207 /* ************************************************************************** */ |
|
5208 |
|
5209 #ifndef MNG_SKIPCHUNK_eXPI |
|
5210 mng_retcode MNG_DECL mng_putchunk_expi (mng_handle hHandle, |
|
5211 mng_uint16 iSnapshotid, |
|
5212 mng_uint32 iNamesize, |
|
5213 mng_pchar zName) |
|
5214 { |
|
5215 mng_datap pData; |
|
5216 mng_chunkp pChunk; |
|
5217 mng_retcode iRetcode; |
|
5218 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5219 mng_chunk_header sChunkheader = |
|
5220 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5221 {MNG_UINT_eXPI, mng_init_general, mng_free_expi, mng_read_expi, mng_write_expi, mng_assign_general, 0, 0, sizeof(mng_expi)}; |
|
5222 #else |
|
5223 {MNG_UINT_eXPI, mng_init_expi, mng_free_expi, mng_read_expi, mng_write_expi, mng_assign_expi, 0, 0}; |
|
5224 #endif |
|
5225 #else |
|
5226 mng_chunk_header sChunkheader; |
|
5227 #endif |
|
5228 |
|
5229 #ifdef MNG_SUPPORT_TRACE |
|
5230 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EXPI, MNG_LC_START); |
|
5231 #endif |
|
5232 |
|
5233 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
5234 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
5235 |
|
5236 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
5237 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
5238 /* must have had a MHDR first! */ |
|
5239 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
5240 MNG_ERROR (pData, MNG_NOHEADER) |
|
5241 /* prevent misplaced TERM ! */ |
|
5242 if (!check_term (pData, MNG_UINT_eXPI)) |
|
5243 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
5244 /* create the chunk */ |
|
5245 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5246 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5247 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5248 #else |
|
5249 iRetcode = mng_init_expi (pData, &sChunkheader, &pChunk); |
|
5250 #endif |
|
5251 #else |
|
5252 mng_get_chunkheader(MNG_UINT_eXPI, &sChunkheader); |
|
5253 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5254 #endif |
|
5255 |
|
5256 if (iRetcode) /* on error bail out */ |
|
5257 return iRetcode; |
|
5258 /* fill the chunk */ |
|
5259 ((mng_expip)pChunk)->iSnapshotid = iSnapshotid; |
|
5260 ((mng_expip)pChunk)->iNamesize = iNamesize; |
|
5261 |
|
5262 if (iNamesize) |
|
5263 { |
|
5264 MNG_ALLOC (pData, ((mng_expip)pChunk)->zName, iNamesize + 1); |
|
5265 MNG_COPY (((mng_expip)pChunk)->zName, zName, iNamesize); |
|
5266 } |
|
5267 |
|
5268 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
5269 |
|
5270 #ifdef MNG_SUPPORT_TRACE |
|
5271 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EXPI, MNG_LC_END); |
|
5272 #endif |
|
5273 |
|
5274 return MNG_NOERROR; |
|
5275 } |
|
5276 #endif |
|
5277 |
|
5278 /* ************************************************************************** */ |
|
5279 |
|
5280 #ifndef MNG_SKIPCHUNK_fPRI |
|
5281 mng_retcode MNG_DECL mng_putchunk_fpri (mng_handle hHandle, |
|
5282 mng_uint8 iDeltatype, |
|
5283 mng_uint8 iPriority) |
|
5284 { |
|
5285 mng_datap pData; |
|
5286 mng_chunkp pChunk; |
|
5287 mng_retcode iRetcode; |
|
5288 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5289 mng_chunk_header sChunkheader = |
|
5290 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5291 {MNG_UINT_fPRI, mng_init_general, mng_free_general, mng_read_fpri, mng_write_fpri, mng_assign_general, 0, 0, sizeof(mng_fpri)}; |
|
5292 #else |
|
5293 {MNG_UINT_fPRI, mng_init_fpri, mng_free_fpri, mng_read_fpri, mng_write_fpri, mng_assign_fpri, 0, 0}; |
|
5294 #endif |
|
5295 #else |
|
5296 mng_chunk_header sChunkheader; |
|
5297 #endif |
|
5298 |
|
5299 #ifdef MNG_SUPPORT_TRACE |
|
5300 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_FPRI, MNG_LC_START); |
|
5301 #endif |
|
5302 |
|
5303 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
5304 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
5305 |
|
5306 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
5307 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
5308 /* must have had a MHDR first! */ |
|
5309 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
5310 MNG_ERROR (pData, MNG_NOHEADER) |
|
5311 /* prevent misplaced TERM ! */ |
|
5312 if (!check_term (pData, MNG_UINT_fPRI)) |
|
5313 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
5314 /* create the chunk */ |
|
5315 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5316 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5317 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5318 #else |
|
5319 iRetcode = mng_init_fpri (pData, &sChunkheader, &pChunk); |
|
5320 #endif |
|
5321 #else |
|
5322 mng_get_chunkheader(MNG_UINT_fPRI, &sChunkheader); |
|
5323 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5324 #endif |
|
5325 |
|
5326 if (iRetcode) /* on error bail out */ |
|
5327 return iRetcode; |
|
5328 /* fill the chunk */ |
|
5329 ((mng_fprip)pChunk)->iDeltatype = iDeltatype; |
|
5330 ((mng_fprip)pChunk)->iPriority = iPriority; |
|
5331 |
|
5332 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
5333 |
|
5334 #ifdef MNG_SUPPORT_TRACE |
|
5335 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_FPRI, MNG_LC_END); |
|
5336 #endif |
|
5337 |
|
5338 return MNG_NOERROR; |
|
5339 } |
|
5340 #endif |
|
5341 |
|
5342 /* ************************************************************************** */ |
|
5343 |
|
5344 #ifndef MNG_SKIPCHUNK_nEED |
|
5345 mng_retcode MNG_DECL mng_putchunk_need (mng_handle hHandle, |
|
5346 mng_uint32 iKeywordssize, |
|
5347 mng_pchar zKeywords) |
|
5348 { |
|
5349 mng_datap pData; |
|
5350 mng_chunkp pChunk; |
|
5351 mng_retcode iRetcode; |
|
5352 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5353 mng_chunk_header sChunkheader = |
|
5354 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5355 {MNG_UINT_nEED, mng_init_general, mng_free_need, mng_read_need, mng_write_need, mng_assign_need, 0, 0, sizeof(mng_need)}; |
|
5356 #else |
|
5357 {MNG_UINT_nEED, mng_init_need, mng_free_need, mng_read_need, mng_write_need, mng_assign_need, 0, 0}; |
|
5358 #endif |
|
5359 #else |
|
5360 mng_chunk_header sChunkheader; |
|
5361 #endif |
|
5362 |
|
5363 #ifdef MNG_SUPPORT_TRACE |
|
5364 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_NEED, MNG_LC_START); |
|
5365 #endif |
|
5366 |
|
5367 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
5368 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
5369 |
|
5370 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
5371 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
5372 /* must have had a MHDR first! */ |
|
5373 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
5374 MNG_ERROR (pData, MNG_NOHEADER) |
|
5375 /* prevent misplaced TERM ! */ |
|
5376 if (!check_term (pData, MNG_UINT_nEED)) |
|
5377 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
5378 /* create the chunk */ |
|
5379 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5380 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5381 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5382 #else |
|
5383 iRetcode = mng_init_need (pData, &sChunkheader, &pChunk); |
|
5384 #endif |
|
5385 #else |
|
5386 mng_get_chunkheader(MNG_UINT_nEED, &sChunkheader); |
|
5387 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5388 #endif |
|
5389 |
|
5390 if (iRetcode) /* on error bail out */ |
|
5391 return iRetcode; |
|
5392 /* fill the chunk */ |
|
5393 ((mng_needp)pChunk)->iKeywordssize = iKeywordssize; |
|
5394 |
|
5395 if (iKeywordssize) |
|
5396 { |
|
5397 MNG_ALLOC (pData, ((mng_needp)pChunk)->zKeywords, iKeywordssize + 1); |
|
5398 MNG_COPY (((mng_needp)pChunk)->zKeywords, zKeywords, iKeywordssize); |
|
5399 } |
|
5400 |
|
5401 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
5402 |
|
5403 #ifdef MNG_SUPPORT_TRACE |
|
5404 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_NEED, MNG_LC_END); |
|
5405 #endif |
|
5406 |
|
5407 return MNG_NOERROR; |
|
5408 } |
|
5409 #endif |
|
5410 |
|
5411 /* ************************************************************************** */ |
|
5412 |
|
5413 #ifndef MNG_SKIPCHUNK_pHYg |
|
5414 mng_retcode MNG_DECL mng_putchunk_phyg (mng_handle hHandle, |
|
5415 mng_bool bEmpty, |
|
5416 mng_uint32 iSizex, |
|
5417 mng_uint32 iSizey, |
|
5418 mng_uint8 iUnit) |
|
5419 { |
|
5420 mng_datap pData; |
|
5421 mng_chunkp pChunk; |
|
5422 mng_retcode iRetcode; |
|
5423 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5424 mng_chunk_header sChunkheader = |
|
5425 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5426 {MNG_UINT_pHYg, mng_init_general, mng_free_general, mng_read_phyg, mng_write_phyg, mng_assign_general, 0, 0, sizeof(mng_phyg)}; |
|
5427 #else |
|
5428 {MNG_UINT_pHYg, mng_init_phyg, mng_free_phyg, mng_read_phyg, mng_write_phyg, mng_assign_phyg, 0, 0}; |
|
5429 #endif |
|
5430 #else |
|
5431 mng_chunk_header sChunkheader; |
|
5432 #endif |
|
5433 |
|
5434 #ifdef MNG_SUPPORT_TRACE |
|
5435 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PHYG, MNG_LC_START); |
|
5436 #endif |
|
5437 |
|
5438 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
5439 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
5440 |
|
5441 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
5442 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
5443 /* must have had a MHDR first! */ |
|
5444 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
5445 MNG_ERROR (pData, MNG_NOHEADER) |
|
5446 /* prevent misplaced TERM ! */ |
|
5447 if (!check_term (pData, MNG_UINT_pHYg)) |
|
5448 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
5449 /* create the chunk */ |
|
5450 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5451 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5452 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5453 #else |
|
5454 iRetcode = mng_init_phyg (pData, &sChunkheader, &pChunk); |
|
5455 #endif |
|
5456 #else |
|
5457 mng_get_chunkheader(MNG_UINT_pHYg, &sChunkheader); |
|
5458 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5459 #endif |
|
5460 |
|
5461 if (iRetcode) /* on error bail out */ |
|
5462 return iRetcode; |
|
5463 /* fill the chunk */ |
|
5464 ((mng_phygp)pChunk)->bEmpty = bEmpty; |
|
5465 ((mng_phygp)pChunk)->iSizex = iSizex; |
|
5466 ((mng_phygp)pChunk)->iSizey = iSizey; |
|
5467 ((mng_phygp)pChunk)->iUnit = iUnit; |
|
5468 |
|
5469 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
5470 |
|
5471 #ifdef MNG_SUPPORT_TRACE |
|
5472 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PHYG, MNG_LC_END); |
|
5473 #endif |
|
5474 |
|
5475 return MNG_NOERROR; |
|
5476 } |
|
5477 #endif |
|
5478 |
|
5479 /* ************************************************************************** */ |
|
5480 |
|
5481 #ifdef MNG_INCLUDE_JNG |
|
5482 |
|
5483 mng_retcode MNG_DECL mng_putchunk_jhdr (mng_handle hHandle, |
|
5484 mng_uint32 iWidth, |
|
5485 mng_uint32 iHeight, |
|
5486 mng_uint8 iColortype, |
|
5487 mng_uint8 iImagesampledepth, |
|
5488 mng_uint8 iImagecompression, |
|
5489 mng_uint8 iImageinterlace, |
|
5490 mng_uint8 iAlphasampledepth, |
|
5491 mng_uint8 iAlphacompression, |
|
5492 mng_uint8 iAlphafilter, |
|
5493 mng_uint8 iAlphainterlace) |
|
5494 { |
|
5495 mng_datap pData; |
|
5496 mng_chunkp pChunk; |
|
5497 mng_retcode iRetcode; |
|
5498 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5499 mng_chunk_header sChunkheader = |
|
5500 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5501 {MNG_UINT_JHDR, mng_init_general, mng_free_general, mng_read_jhdr, mng_write_jhdr, mng_assign_general, 0, 0, sizeof(mng_jhdr)}; |
|
5502 #else |
|
5503 {MNG_UINT_JHDR, mng_init_jhdr, mng_free_jhdr, mng_read_jhdr, mng_write_jhdr, mng_assign_jhdr, 0, 0}; |
|
5504 #endif |
|
5505 #else |
|
5506 mng_chunk_header sChunkheader; |
|
5507 #endif |
|
5508 |
|
5509 #ifdef MNG_SUPPORT_TRACE |
|
5510 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JHDR, MNG_LC_START); |
|
5511 #endif |
|
5512 |
|
5513 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
5514 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
5515 |
|
5516 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
5517 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
5518 /* prevent misplaced TERM ! */ |
|
5519 if (!check_term (pData, MNG_UINT_JHDR)) |
|
5520 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
5521 /* create the chunk */ |
|
5522 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5523 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5524 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5525 #else |
|
5526 iRetcode = mng_init_jhdr (pData, &sChunkheader, &pChunk); |
|
5527 #endif |
|
5528 #else |
|
5529 mng_get_chunkheader(MNG_UINT_JHDR, &sChunkheader); |
|
5530 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5531 #endif |
|
5532 |
|
5533 if (iRetcode) /* on error bail out */ |
|
5534 return iRetcode; |
|
5535 /* fill the chunk */ |
|
5536 ((mng_jhdrp)pChunk)->iWidth = iWidth; |
|
5537 ((mng_jhdrp)pChunk)->iHeight = iHeight; |
|
5538 ((mng_jhdrp)pChunk)->iColortype = iColortype; |
|
5539 ((mng_jhdrp)pChunk)->iImagesampledepth = iImagesampledepth; |
|
5540 ((mng_jhdrp)pChunk)->iImagecompression = iImagecompression; |
|
5541 ((mng_jhdrp)pChunk)->iImageinterlace = iImageinterlace; |
|
5542 ((mng_jhdrp)pChunk)->iAlphasampledepth = iAlphasampledepth; |
|
5543 ((mng_jhdrp)pChunk)->iAlphacompression = iAlphacompression; |
|
5544 ((mng_jhdrp)pChunk)->iAlphafilter = iAlphafilter; |
|
5545 ((mng_jhdrp)pChunk)->iAlphainterlace = iAlphainterlace; |
|
5546 |
|
5547 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
5548 |
|
5549 #ifdef MNG_SUPPORT_TRACE |
|
5550 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JHDR, MNG_LC_END); |
|
5551 #endif |
|
5552 |
|
5553 return MNG_NOERROR; |
|
5554 } |
|
5555 |
|
5556 #endif /* MNG_INCLUDE_JNG */ |
|
5557 |
|
5558 /* ************************************************************************** */ |
|
5559 |
|
5560 #ifdef MNG_INCLUDE_JNG |
|
5561 |
|
5562 mng_retcode MNG_DECL mng_putchunk_jdat (mng_handle hHandle, |
|
5563 mng_uint32 iRawlen, |
|
5564 mng_ptr pRawdata) |
|
5565 { |
|
5566 mng_datap pData; |
|
5567 mng_chunkp pChunk; |
|
5568 mng_retcode iRetcode; |
|
5569 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5570 mng_chunk_header sChunkheader = |
|
5571 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5572 {MNG_UINT_JDAT, mng_init_general, mng_free_jdat, mng_read_jdat, mng_write_jdat, mng_assign_jdat, 0, 0, sizeof(mng_jdat)}; |
|
5573 #else |
|
5574 {MNG_UINT_JDAT, mng_init_jdat, mng_free_jdat, mng_read_jdat, mng_write_jdat, mng_assign_jdat, 0, 0}; |
|
5575 #endif |
|
5576 #else |
|
5577 mng_chunk_header sChunkheader; |
|
5578 #endif |
|
5579 |
|
5580 #ifdef MNG_SUPPORT_TRACE |
|
5581 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JDAT, MNG_LC_START); |
|
5582 #endif |
|
5583 |
|
5584 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
5585 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
5586 |
|
5587 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
5588 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
5589 /* must have had a MHDR or JHDR first! */ |
|
5590 if ((pData->iFirstchunkadded != MNG_UINT_MHDR) && |
|
5591 (pData->iFirstchunkadded != MNG_UINT_JHDR) ) |
|
5592 MNG_ERROR (pData, MNG_NOHEADER) |
|
5593 /* prevent misplaced TERM ! */ |
|
5594 if (!check_term (pData, MNG_UINT_JDAT)) |
|
5595 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
5596 /* create the chunk */ |
|
5597 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5598 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5599 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5600 #else |
|
5601 iRetcode = mng_init_jdat (pData, &sChunkheader, &pChunk); |
|
5602 #endif |
|
5603 #else |
|
5604 mng_get_chunkheader(MNG_UINT_JDAT, &sChunkheader); |
|
5605 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5606 #endif |
|
5607 |
|
5608 if (iRetcode) /* on error bail out */ |
|
5609 return iRetcode; |
|
5610 /* fill the chunk */ |
|
5611 ((mng_jdatp)pChunk)->iDatasize = iRawlen; |
|
5612 |
|
5613 if (iRawlen) |
|
5614 { |
|
5615 MNG_ALLOC (pData, ((mng_jdatp)pChunk)->pData, iRawlen); |
|
5616 MNG_COPY (((mng_jdatp)pChunk)->pData, pRawdata, iRawlen); |
|
5617 } |
|
5618 |
|
5619 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
5620 |
|
5621 #ifdef MNG_SUPPORT_TRACE |
|
5622 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JDAT, MNG_LC_END); |
|
5623 #endif |
|
5624 |
|
5625 return MNG_NOERROR; |
|
5626 } |
|
5627 |
|
5628 #endif /* MNG_INCLUDE_JNG */ |
|
5629 |
|
5630 /* ************************************************************************** */ |
|
5631 |
|
5632 #ifdef MNG_INCLUDE_JNG |
|
5633 |
|
5634 mng_retcode MNG_DECL mng_putchunk_jdaa (mng_handle hHandle, |
|
5635 mng_uint32 iRawlen, |
|
5636 mng_ptr pRawdata) |
|
5637 { |
|
5638 mng_datap pData; |
|
5639 mng_chunkp pChunk; |
|
5640 mng_retcode iRetcode; |
|
5641 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5642 mng_chunk_header sChunkheader = |
|
5643 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5644 {MNG_UINT_JDAA, mng_init_general, mng_free_jdaa, mng_read_jdaa, mng_write_jdaa, mng_assign_jdaa, 0, 0, sizeof(mng_jdaa)}; |
|
5645 #else |
|
5646 {MNG_UINT_JDAA, mng_init_jdaa, mng_free_jdaa, mng_read_jdaa, mng_write_jdaa, mng_assign_jdaa, 0, 0}; |
|
5647 #endif |
|
5648 #else |
|
5649 mng_chunk_header sChunkheader; |
|
5650 #endif |
|
5651 |
|
5652 #ifdef MNG_SUPPORT_TRACE |
|
5653 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JDAA, MNG_LC_START); |
|
5654 #endif |
|
5655 |
|
5656 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
5657 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
5658 |
|
5659 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
5660 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
5661 /* must have had a MHDR or JHDR first! */ |
|
5662 if ((pData->iFirstchunkadded != MNG_UINT_MHDR) && |
|
5663 (pData->iFirstchunkadded != MNG_UINT_JHDR) ) |
|
5664 MNG_ERROR (pData, MNG_NOHEADER) |
|
5665 /* prevent misplaced TERM ! */ |
|
5666 if (!check_term (pData, MNG_UINT_JDAA)) |
|
5667 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
5668 /* create the chunk */ |
|
5669 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5670 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5671 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5672 #else |
|
5673 iRetcode = mng_init_jdaa (pData, &sChunkheader, &pChunk); |
|
5674 #endif |
|
5675 #else |
|
5676 mng_get_chunkheader(MNG_UINT_JDAA, &sChunkheader); |
|
5677 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5678 #endif |
|
5679 |
|
5680 if (iRetcode) /* on error bail out */ |
|
5681 return iRetcode; |
|
5682 /* fill the chunk */ |
|
5683 ((mng_jdaap)pChunk)->iDatasize = iRawlen; |
|
5684 |
|
5685 if (iRawlen) |
|
5686 { |
|
5687 MNG_ALLOC (pData, ((mng_jdaap)pChunk)->pData, iRawlen); |
|
5688 MNG_COPY (((mng_jdaap)pChunk)->pData, pRawdata, iRawlen); |
|
5689 } |
|
5690 |
|
5691 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
5692 |
|
5693 #ifdef MNG_SUPPORT_TRACE |
|
5694 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JDAA, MNG_LC_END); |
|
5695 #endif |
|
5696 |
|
5697 return MNG_NOERROR; |
|
5698 } |
|
5699 |
|
5700 #endif /* MNG_INCLUDE_JNG */ |
|
5701 |
|
5702 /* ************************************************************************** */ |
|
5703 |
|
5704 #ifdef MNG_INCLUDE_JNG |
|
5705 |
|
5706 mng_retcode MNG_DECL mng_putchunk_jsep (mng_handle hHandle) |
|
5707 { |
|
5708 mng_datap pData; |
|
5709 mng_chunkp pChunk; |
|
5710 mng_retcode iRetcode; |
|
5711 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5712 mng_chunk_header sChunkheader = |
|
5713 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5714 {MNG_UINT_JSEP, mng_init_general, mng_free_general, mng_read_jsep, mng_write_jsep, mng_assign_general, 0, 0, sizeof(mng_jsep)}; |
|
5715 #else |
|
5716 {MNG_UINT_JSEP, mng_init_jsep, mng_free_jsep, mng_read_jsep, mng_write_jsep, mng_assign_jsep, 0, 0}; |
|
5717 #endif |
|
5718 #else |
|
5719 mng_chunk_header sChunkheader; |
|
5720 #endif |
|
5721 |
|
5722 #ifdef MNG_SUPPORT_TRACE |
|
5723 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JSEP, MNG_LC_START); |
|
5724 #endif |
|
5725 |
|
5726 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
5727 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
5728 |
|
5729 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
5730 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
5731 /* must have had a MHDR or JHDR first! */ |
|
5732 if ((pData->iFirstchunkadded != MNG_UINT_MHDR) && |
|
5733 (pData->iFirstchunkadded != MNG_UINT_JHDR) ) |
|
5734 MNG_ERROR (pData, MNG_NOHEADER) |
|
5735 /* prevent misplaced TERM ! */ |
|
5736 if (!check_term (pData, MNG_UINT_JSEP)) |
|
5737 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
5738 /* create the chunk */ |
|
5739 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5740 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5741 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5742 #else |
|
5743 iRetcode = mng_init_jsep (pData, &sChunkheader, &pChunk); |
|
5744 #endif |
|
5745 #else |
|
5746 mng_get_chunkheader(MNG_UINT_JSEP, &sChunkheader); |
|
5747 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5748 #endif |
|
5749 |
|
5750 if (iRetcode) /* on error bail out */ |
|
5751 return iRetcode; |
|
5752 |
|
5753 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
5754 |
|
5755 #ifdef MNG_SUPPORT_TRACE |
|
5756 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JSEP, MNG_LC_END); |
|
5757 #endif |
|
5758 |
|
5759 return MNG_NOERROR; |
|
5760 } |
|
5761 |
|
5762 #endif /* MNG_INCLUDE_JNG */ |
|
5763 |
|
5764 /* ************************************************************************** */ |
|
5765 |
|
5766 #ifndef MNG_NO_DELTA_PNG |
|
5767 mng_retcode MNG_DECL mng_putchunk_dhdr (mng_handle hHandle, |
|
5768 mng_uint16 iObjectid, |
|
5769 mng_uint8 iImagetype, |
|
5770 mng_uint8 iDeltatype, |
|
5771 mng_uint32 iBlockwidth, |
|
5772 mng_uint32 iBlockheight, |
|
5773 mng_uint32 iBlockx, |
|
5774 mng_uint32 iBlocky) |
|
5775 { |
|
5776 mng_datap pData; |
|
5777 mng_chunkp pChunk; |
|
5778 mng_retcode iRetcode; |
|
5779 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5780 mng_chunk_header sChunkheader = |
|
5781 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5782 {MNG_UINT_DHDR, mng_init_general, mng_free_general, mng_read_dhdr, mng_write_dhdr, mng_assign_general, 0, 0, sizeof(mng_dhdr)}; |
|
5783 #else |
|
5784 {MNG_UINT_DHDR, mng_init_dhdr, mng_free_dhdr, mng_read_dhdr, mng_write_dhdr, mng_assign_dhdr, 0, 0}; |
|
5785 #endif |
|
5786 #else |
|
5787 mng_chunk_header sChunkheader; |
|
5788 #endif |
|
5789 |
|
5790 #ifdef MNG_SUPPORT_TRACE |
|
5791 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DHDR, MNG_LC_START); |
|
5792 #endif |
|
5793 |
|
5794 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
5795 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
5796 |
|
5797 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
5798 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
5799 /* must have had a MHDR first! */ |
|
5800 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
5801 MNG_ERROR (pData, MNG_NOHEADER) |
|
5802 /* prevent misplaced TERM ! */ |
|
5803 if (!check_term (pData, MNG_UINT_DHDR)) |
|
5804 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
5805 /* create the chunk */ |
|
5806 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5807 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5808 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5809 #else |
|
5810 iRetcode = mng_init_dhdr (pData, &sChunkheader, &pChunk); |
|
5811 #endif |
|
5812 #else |
|
5813 mng_get_chunkheader(MNG_UINT_DHDR, &sChunkheader); |
|
5814 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5815 #endif |
|
5816 |
|
5817 if (iRetcode) /* on error bail out */ |
|
5818 return iRetcode; |
|
5819 /* fill the chunk */ |
|
5820 ((mng_dhdrp)pChunk)->iObjectid = iObjectid; |
|
5821 ((mng_dhdrp)pChunk)->iImagetype = iImagetype; |
|
5822 ((mng_dhdrp)pChunk)->iDeltatype = iDeltatype; |
|
5823 ((mng_dhdrp)pChunk)->iBlockwidth = iBlockwidth; |
|
5824 ((mng_dhdrp)pChunk)->iBlockheight = iBlockheight; |
|
5825 ((mng_dhdrp)pChunk)->iBlockx = iBlockx; |
|
5826 ((mng_dhdrp)pChunk)->iBlocky = iBlocky; |
|
5827 |
|
5828 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
5829 |
|
5830 #ifdef MNG_SUPPORT_TRACE |
|
5831 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DHDR, MNG_LC_END); |
|
5832 #endif |
|
5833 |
|
5834 return MNG_NOERROR; |
|
5835 } |
|
5836 #endif |
|
5837 |
|
5838 /* ************************************************************************** */ |
|
5839 |
|
5840 #ifndef MNG_NO_DELTA_PNG |
|
5841 mng_retcode MNG_DECL mng_putchunk_prom (mng_handle hHandle, |
|
5842 mng_uint8 iColortype, |
|
5843 mng_uint8 iSampledepth, |
|
5844 mng_uint8 iFilltype) |
|
5845 { |
|
5846 mng_datap pData; |
|
5847 mng_chunkp pChunk; |
|
5848 mng_retcode iRetcode; |
|
5849 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5850 mng_chunk_header sChunkheader = |
|
5851 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5852 {MNG_UINT_PROM, mng_init_general, mng_free_general, mng_read_prom, mng_write_prom, mng_assign_general, 0, 0, sizeof(mng_prom)}; |
|
5853 #else |
|
5854 {MNG_UINT_PROM, mng_init_prom, mng_free_prom, mng_read_prom, mng_write_prom, mng_assign_prom, 0, 0}; |
|
5855 #endif |
|
5856 #else |
|
5857 mng_chunk_header sChunkheader; |
|
5858 #endif |
|
5859 |
|
5860 #ifdef MNG_SUPPORT_TRACE |
|
5861 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PROM, MNG_LC_START); |
|
5862 #endif |
|
5863 |
|
5864 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
5865 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
5866 |
|
5867 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
5868 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
5869 /* must have had a MHDR first! */ |
|
5870 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
5871 MNG_ERROR (pData, MNG_NOHEADER) |
|
5872 /* prevent misplaced TERM ! */ |
|
5873 if (!check_term (pData, MNG_UINT_PROM)) |
|
5874 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
5875 /* create the chunk */ |
|
5876 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5877 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5878 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5879 #else |
|
5880 iRetcode = mng_init_prom (pData, &sChunkheader, &pChunk); |
|
5881 #endif |
|
5882 #else |
|
5883 mng_get_chunkheader(MNG_UINT_PROM, &sChunkheader); |
|
5884 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5885 #endif |
|
5886 |
|
5887 if (iRetcode) /* on error bail out */ |
|
5888 return iRetcode; |
|
5889 /* fill the chunk */ |
|
5890 ((mng_promp)pChunk)->iColortype = iColortype; |
|
5891 ((mng_promp)pChunk)->iSampledepth = iSampledepth; |
|
5892 ((mng_promp)pChunk)->iFilltype = iFilltype; |
|
5893 |
|
5894 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
5895 |
|
5896 #ifdef MNG_SUPPORT_TRACE |
|
5897 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PROM, MNG_LC_END); |
|
5898 #endif |
|
5899 |
|
5900 return MNG_NOERROR; |
|
5901 } |
|
5902 #endif |
|
5903 |
|
5904 /* ************************************************************************** */ |
|
5905 |
|
5906 #ifndef MNG_NO_DELTA_PNG |
|
5907 mng_retcode MNG_DECL mng_putchunk_ipng (mng_handle hHandle) |
|
5908 { |
|
5909 mng_datap pData; |
|
5910 mng_chunkp pChunk; |
|
5911 mng_retcode iRetcode; |
|
5912 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5913 mng_chunk_header sChunkheader = |
|
5914 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5915 {MNG_UINT_IPNG, mng_init_general, mng_free_general, mng_read_ipng, mng_write_ipng, mng_assign_general, 0, 0, sizeof(mng_ipng)}; |
|
5916 #else |
|
5917 {MNG_UINT_IPNG, mng_init_ipng, mng_free_ipng, mng_read_ipng, mng_write_ipng, mng_assign_ipng, 0, 0}; |
|
5918 #endif |
|
5919 #else |
|
5920 mng_chunk_header sChunkheader; |
|
5921 #endif |
|
5922 |
|
5923 #ifdef MNG_SUPPORT_TRACE |
|
5924 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IPNG, MNG_LC_START); |
|
5925 #endif |
|
5926 |
|
5927 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
5928 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
5929 |
|
5930 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
5931 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
5932 /* must have had a MHDR first! */ |
|
5933 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
5934 MNG_ERROR (pData, MNG_NOHEADER) |
|
5935 /* prevent misplaced TERM ! */ |
|
5936 if (!check_term (pData, MNG_UINT_IPNG)) |
|
5937 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
5938 /* create the chunk */ |
|
5939 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5940 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5941 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5942 #else |
|
5943 iRetcode = mng_init_ipng (pData, &sChunkheader, &pChunk); |
|
5944 #endif |
|
5945 #else |
|
5946 mng_get_chunkheader(MNG_UINT_IPNG, &sChunkheader); |
|
5947 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
5948 #endif |
|
5949 |
|
5950 if (iRetcode) /* on error bail out */ |
|
5951 return iRetcode; |
|
5952 |
|
5953 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
5954 |
|
5955 #ifdef MNG_SUPPORT_TRACE |
|
5956 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IPNG, MNG_LC_END); |
|
5957 #endif |
|
5958 |
|
5959 return MNG_NOERROR; |
|
5960 } |
|
5961 #endif |
|
5962 |
|
5963 /* ************************************************************************** */ |
|
5964 |
|
5965 #ifndef MNG_NO_DELTA_PNG |
|
5966 mng_retcode MNG_DECL mng_putchunk_pplt (mng_handle hHandle, |
|
5967 mng_uint8 iDeltatype, |
|
5968 mng_uint32 iCount) |
|
5969 { |
|
5970 mng_datap pData; |
|
5971 mng_chunkp pChunk; |
|
5972 mng_retcode iRetcode; |
|
5973 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
5974 mng_chunk_header sChunkheader = |
|
5975 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
5976 {MNG_UINT_PPLT, mng_init_general, mng_free_general, mng_read_pplt, mng_write_pplt, mng_assign_general, 0, 0, sizeof(mng_pplt)}; |
|
5977 #else |
|
5978 {MNG_UINT_PPLT, mng_init_pplt, mng_free_pplt, mng_read_pplt, mng_write_pplt, mng_assign_pplt, 0, 0}; |
|
5979 #endif |
|
5980 #else |
|
5981 mng_chunk_header sChunkheader; |
|
5982 #endif |
|
5983 |
|
5984 #ifdef MNG_SUPPORT_TRACE |
|
5985 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PPLT, MNG_LC_START); |
|
5986 #endif |
|
5987 |
|
5988 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
5989 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
5990 |
|
5991 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
5992 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
5993 /* must have had a MHDR first! */ |
|
5994 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
5995 MNG_ERROR (pData, MNG_NOHEADER) |
|
5996 /* prevent misplaced TERM ! */ |
|
5997 if (!check_term (pData, MNG_UINT_PPLT)) |
|
5998 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
5999 /* create the chunk */ |
|
6000 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
6001 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
6002 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
6003 #else |
|
6004 iRetcode = mng_init_pplt (pData, &sChunkheader, &pChunk); |
|
6005 #endif |
|
6006 #else |
|
6007 mng_get_chunkheader(MNG_UINT_PPLT, &sChunkheader); |
|
6008 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
6009 #endif |
|
6010 |
|
6011 if (iRetcode) /* on error bail out */ |
|
6012 return iRetcode; |
|
6013 /* fill the chunk */ |
|
6014 ((mng_ppltp)pChunk)->iDeltatype = iDeltatype; |
|
6015 ((mng_ppltp)pChunk)->iCount = iCount; |
|
6016 |
|
6017 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
6018 |
|
6019 #ifdef MNG_SUPPORT_TRACE |
|
6020 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PPLT, MNG_LC_END); |
|
6021 #endif |
|
6022 |
|
6023 return MNG_NOERROR; |
|
6024 } |
|
6025 #endif |
|
6026 |
|
6027 /* ************************************************************************** */ |
|
6028 |
|
6029 #ifndef MNG_NO_DELTA_PNG |
|
6030 mng_retcode MNG_DECL mng_putchunk_pplt_entry (mng_handle hHandle, |
|
6031 mng_uint32 iEntry, |
|
6032 mng_uint16 iRed, |
|
6033 mng_uint16 iGreen, |
|
6034 mng_uint16 iBlue, |
|
6035 mng_uint16 iAlpha) |
|
6036 { |
|
6037 mng_datap pData; |
|
6038 mng_chunkp pChunk; |
|
6039 mng_pplt_entryp pEntry; |
|
6040 |
|
6041 #ifdef MNG_SUPPORT_TRACE |
|
6042 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PPLT_ENTRY, MNG_LC_START); |
|
6043 #endif |
|
6044 |
|
6045 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
6046 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
6047 |
|
6048 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
6049 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
6050 /* must have had a MHDR first! */ |
|
6051 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
6052 MNG_ERROR (pData, MNG_NOHEADER) |
|
6053 |
|
6054 pChunk = pData->pLastchunk; /* last one must have been PPLT ! */ |
|
6055 |
|
6056 if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_PPLT) |
|
6057 MNG_ERROR (pData, MNG_NOCORRCHUNK) |
|
6058 |
|
6059 /* index out of bounds ? */ |
|
6060 if (iEntry >= ((mng_ppltp)pChunk)->iCount) |
|
6061 MNG_ERROR (pData, MNG_INVALIDENTRYIX) |
|
6062 /* address proper entry */ |
|
6063 pEntry = (mng_pplt_entryp)(((mng_ppltp)pChunk)->aEntries) + iEntry; |
|
6064 |
|
6065 pEntry->iRed = (mng_uint8)iRed; /* fill the entry */ |
|
6066 pEntry->iGreen = (mng_uint8)iGreen; |
|
6067 pEntry->iBlue = (mng_uint8)iBlue; |
|
6068 pEntry->iAlpha = (mng_uint8)iAlpha; |
|
6069 pEntry->bUsed = MNG_TRUE; |
|
6070 |
|
6071 #ifdef MNG_SUPPORT_TRACE |
|
6072 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PPLT_ENTRY, MNG_LC_END); |
|
6073 #endif |
|
6074 |
|
6075 return MNG_NOERROR; |
|
6076 } |
|
6077 #endif |
|
6078 |
|
6079 /* ************************************************************************** */ |
|
6080 |
|
6081 #ifndef MNG_NO_DELTA_PNG |
|
6082 #ifdef MNG_INCLUDE_JNG |
|
6083 mng_retcode MNG_DECL mng_putchunk_ijng (mng_handle hHandle) |
|
6084 { |
|
6085 mng_datap pData; |
|
6086 mng_chunkp pChunk; |
|
6087 mng_retcode iRetcode; |
|
6088 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
6089 mng_chunk_header sChunkheader = |
|
6090 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
6091 {MNG_UINT_IJNG, mng_init_general, mng_free_general, mng_read_ijng, mng_write_ijng, mng_assign_general, 0, 0, sizeof(mng_ijng)}; |
|
6092 #else |
|
6093 {MNG_UINT_IJNG, mng_init_ijng, mng_free_ijng, mng_read_ijng, mng_write_ijng, mng_assign_ijng, 0, 0}; |
|
6094 #endif |
|
6095 #else |
|
6096 mng_chunk_header sChunkheader; |
|
6097 #endif |
|
6098 |
|
6099 #ifdef MNG_SUPPORT_TRACE |
|
6100 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IJNG, MNG_LC_START); |
|
6101 #endif |
|
6102 |
|
6103 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
6104 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
6105 |
|
6106 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
6107 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
6108 /* must have had a MHDR first! */ |
|
6109 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
6110 MNG_ERROR (pData, MNG_NOHEADER) |
|
6111 /* prevent misplaced TERM ! */ |
|
6112 if (!check_term (pData, MNG_UINT_IJNG)) |
|
6113 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
6114 /* create the chunk */ |
|
6115 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
6116 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
6117 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
6118 #else |
|
6119 iRetcode = mng_init_ijng (pData, &sChunkheader, &pChunk); |
|
6120 #endif |
|
6121 #else |
|
6122 mng_get_chunkheader(MNG_UINT_IJNG, &sChunkheader); |
|
6123 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
6124 #endif |
|
6125 |
|
6126 if (iRetcode) /* on error bail out */ |
|
6127 return iRetcode; |
|
6128 |
|
6129 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
6130 |
|
6131 #ifdef MNG_SUPPORT_TRACE |
|
6132 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IJNG, MNG_LC_END); |
|
6133 #endif |
|
6134 |
|
6135 return MNG_NOERROR; |
|
6136 } |
|
6137 #endif |
|
6138 #endif |
|
6139 |
|
6140 /* ************************************************************************** */ |
|
6141 |
|
6142 #ifndef MNG_NO_DELTA_PNG |
|
6143 mng_retcode MNG_DECL mng_putchunk_drop (mng_handle hHandle, |
|
6144 mng_uint32 iCount, |
|
6145 mng_chunkidp pChunknames) |
|
6146 { |
|
6147 mng_datap pData; |
|
6148 mng_chunkp pChunk; |
|
6149 mng_retcode iRetcode; |
|
6150 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
6151 mng_chunk_header sChunkheader = |
|
6152 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
6153 {MNG_UINT_DROP, mng_init_general, mng_free_drop, mng_read_drop, mng_write_drop, mng_assign_drop, 0, 0, sizeof(mng_drop)}; |
|
6154 #else |
|
6155 {MNG_UINT_DROP, mng_init_drop, mng_free_drop, mng_read_drop, mng_write_drop, mng_assign_drop, 0, 0}; |
|
6156 #endif |
|
6157 #else |
|
6158 mng_chunk_header sChunkheader; |
|
6159 #endif |
|
6160 |
|
6161 #ifdef MNG_SUPPORT_TRACE |
|
6162 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DROP, MNG_LC_START); |
|
6163 #endif |
|
6164 |
|
6165 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
6166 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
6167 |
|
6168 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
6169 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
6170 /* must have had a MHDR first! */ |
|
6171 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
6172 MNG_ERROR (pData, MNG_NOHEADER) |
|
6173 /* prevent misplaced TERM ! */ |
|
6174 if (!check_term (pData, MNG_UINT_DROP)) |
|
6175 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
6176 /* create the chunk */ |
|
6177 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
6178 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
6179 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
6180 #else |
|
6181 iRetcode = mng_init_drop (pData, &sChunkheader, &pChunk); |
|
6182 #endif |
|
6183 #else |
|
6184 mng_get_chunkheader(MNG_UINT_DROP, &sChunkheader); |
|
6185 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
6186 #endif |
|
6187 |
|
6188 if (iRetcode) /* on error bail out */ |
|
6189 return iRetcode; |
|
6190 /* fill the chunk */ |
|
6191 ((mng_dropp)pChunk)->iCount = iCount; |
|
6192 |
|
6193 if (iCount) |
|
6194 { |
|
6195 mng_uint32 iSize = iCount * sizeof (mng_chunkid); |
|
6196 |
|
6197 MNG_ALLOC (pData, ((mng_dropp)pChunk)->pChunknames, iSize); |
|
6198 MNG_COPY (((mng_dropp)pChunk)->pChunknames, pChunknames, iSize); |
|
6199 } |
|
6200 |
|
6201 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
6202 |
|
6203 #ifdef MNG_SUPPORT_TRACE |
|
6204 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DROP, MNG_LC_END); |
|
6205 #endif |
|
6206 |
|
6207 return MNG_NOERROR; |
|
6208 } |
|
6209 #endif |
|
6210 |
|
6211 /* ************************************************************************** */ |
|
6212 |
|
6213 #ifndef MNG_NO_DELTA_PNG |
|
6214 #ifndef MNG_SKIPCHUNK_DBYK |
|
6215 mng_retcode MNG_DECL mng_putchunk_dbyk (mng_handle hHandle, |
|
6216 mng_chunkid iChunkname, |
|
6217 mng_uint8 iPolarity, |
|
6218 mng_uint32 iKeywordssize, |
|
6219 mng_pchar zKeywords) |
|
6220 { |
|
6221 mng_datap pData; |
|
6222 mng_chunkp pChunk; |
|
6223 mng_retcode iRetcode; |
|
6224 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
6225 mng_chunk_header sChunkheader = |
|
6226 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
6227 {MNG_UINT_DBYK, mng_init_general, mng_free_dbyk, mng_read_dbyk, mng_write_dbyk, mng_assign_dbyk, 0, 0, sizeof(mng_dbyk)}; |
|
6228 #else |
|
6229 {MNG_UINT_DBYK, mng_init_dbyk, mng_free_dbyk, mng_read_dbyk, mng_write_dbyk, mng_assign_dbyk, 0, 0}; |
|
6230 #endif |
|
6231 #else |
|
6232 mng_chunk_header sChunkheader; |
|
6233 #endif |
|
6234 |
|
6235 #ifdef MNG_SUPPORT_TRACE |
|
6236 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DBYK, MNG_LC_START); |
|
6237 #endif |
|
6238 |
|
6239 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
6240 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
6241 |
|
6242 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
6243 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
6244 /* must have had a MHDR first! */ |
|
6245 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
6246 MNG_ERROR (pData, MNG_NOHEADER) |
|
6247 /* prevent misplaced TERM ! */ |
|
6248 if (!check_term (pData, MNG_UINT_DBYK)) |
|
6249 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
6250 /* create the chunk */ |
|
6251 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
6252 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
6253 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
6254 #else |
|
6255 iRetcode = mng_init_dbyk (pData, &sChunkheader, &pChunk); |
|
6256 #endif |
|
6257 #else |
|
6258 mng_get_chunkheader(MNG_UINT_DBYK, &sChunkheader); |
|
6259 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
6260 #endif |
|
6261 |
|
6262 if (iRetcode) /* on error bail out */ |
|
6263 return iRetcode; |
|
6264 /* fill the chunk */ |
|
6265 ((mng_dbykp)pChunk)->iChunkname = iChunkname; |
|
6266 ((mng_dbykp)pChunk)->iPolarity = iPolarity; |
|
6267 ((mng_dbykp)pChunk)->iKeywordssize = iKeywordssize; |
|
6268 |
|
6269 if (iKeywordssize) |
|
6270 { |
|
6271 MNG_ALLOC (pData, ((mng_dbykp)pChunk)->zKeywords, iKeywordssize + 1); |
|
6272 MNG_COPY (((mng_dbykp)pChunk)->zKeywords, zKeywords, iKeywordssize); |
|
6273 } |
|
6274 |
|
6275 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
6276 |
|
6277 #ifdef MNG_SUPPORT_TRACE |
|
6278 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DBYK, MNG_LC_END); |
|
6279 #endif |
|
6280 |
|
6281 return MNG_NOERROR; |
|
6282 } |
|
6283 #endif |
|
6284 #endif |
|
6285 |
|
6286 /* ************************************************************************** */ |
|
6287 |
|
6288 #ifndef MNG_NO_DELTA_PNG |
|
6289 #ifndef MNG_SKIPCHUNK_ORDR |
|
6290 mng_retcode MNG_DECL mng_putchunk_ordr (mng_handle hHandle, |
|
6291 mng_uint32 iCount) |
|
6292 { |
|
6293 mng_datap pData; |
|
6294 mng_chunkp pChunk; |
|
6295 mng_retcode iRetcode; |
|
6296 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
6297 mng_chunk_header sChunkheader = |
|
6298 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
6299 {MNG_UINT_ORDR, mng_init_general, mng_free_ordr, mng_read_ordr, mng_write_ordr, mng_assign_ordr, 0, 0, sizeof(mng_ordr)}; |
|
6300 #else |
|
6301 {MNG_UINT_ORDR, mng_init_ordr, mng_free_ordr, mng_read_ordr, mng_write_ordr, mng_assign_ordr, 0, 0}; |
|
6302 #endif |
|
6303 #else |
|
6304 mng_chunk_header sChunkheader; |
|
6305 #endif |
|
6306 |
|
6307 #ifdef MNG_SUPPORT_TRACE |
|
6308 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ORDR, MNG_LC_START); |
|
6309 #endif |
|
6310 |
|
6311 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
6312 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
6313 |
|
6314 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
6315 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
6316 /* must have had a MHDR first! */ |
|
6317 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
6318 MNG_ERROR (pData, MNG_NOHEADER) |
|
6319 /* prevent misplaced TERM ! */ |
|
6320 if (!check_term (pData, MNG_UINT_ORDR)) |
|
6321 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
6322 /* create the chunk */ |
|
6323 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
6324 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
6325 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
6326 #else |
|
6327 iRetcode = mng_init_ordr (pData, &sChunkheader, &pChunk); |
|
6328 #endif |
|
6329 #else |
|
6330 mng_get_chunkheader(MNG_UINT_ORDR, &sChunkheader); |
|
6331 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
6332 #endif |
|
6333 |
|
6334 if (iRetcode) /* on error bail out */ |
|
6335 return iRetcode; |
|
6336 /* fill the chunk */ |
|
6337 ((mng_ordrp)pChunk)->iCount = iCount; |
|
6338 |
|
6339 if (iCount) |
|
6340 MNG_ALLOC (pData, ((mng_ordrp)pChunk)->pEntries, iCount * sizeof (mng_ordr_entry)); |
|
6341 |
|
6342 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
6343 |
|
6344 #ifdef MNG_SUPPORT_TRACE |
|
6345 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ORDR, MNG_LC_END); |
|
6346 #endif |
|
6347 |
|
6348 return MNG_NOERROR; |
|
6349 } |
|
6350 #endif |
|
6351 #endif |
|
6352 |
|
6353 /* ************************************************************************** */ |
|
6354 |
|
6355 #ifndef MNG_NO_DELTA_PNG |
|
6356 #ifndef MNG_SKIPCHUNK_ORDR |
|
6357 mng_retcode MNG_DECL mng_putchunk_ordr_entry (mng_handle hHandle, |
|
6358 mng_uint32 iEntry, |
|
6359 mng_chunkid iChunkname, |
|
6360 mng_uint8 iOrdertype) |
|
6361 { |
|
6362 mng_datap pData; |
|
6363 mng_chunkp pChunk; |
|
6364 mng_ordr_entryp pEntry; |
|
6365 |
|
6366 #ifdef MNG_SUPPORT_TRACE |
|
6367 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ORDR_ENTRY, MNG_LC_START); |
|
6368 #endif |
|
6369 |
|
6370 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
6371 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
6372 |
|
6373 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
6374 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
6375 /* must have had a MHDR first! */ |
|
6376 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
6377 MNG_ERROR (pData, MNG_NOHEADER) |
|
6378 |
|
6379 pChunk = pData->pLastchunk; /* last one must have been ORDR ! */ |
|
6380 |
|
6381 if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_ORDR) |
|
6382 MNG_ERROR (pData, MNG_NOCORRCHUNK) |
|
6383 /* index out of bounds ? */ |
|
6384 if (iEntry >= ((mng_ordrp)pChunk)->iCount) |
|
6385 MNG_ERROR (pData, MNG_INVALIDENTRYIX) |
|
6386 /* address proper entry */ |
|
6387 pEntry = ((mng_ordrp)pChunk)->pEntries + iEntry; |
|
6388 |
|
6389 pEntry->iChunkname = iChunkname; /* fill the entry */ |
|
6390 pEntry->iOrdertype = iOrdertype; |
|
6391 |
|
6392 #ifdef MNG_SUPPORT_TRACE |
|
6393 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ORDR_ENTRY, MNG_LC_END); |
|
6394 #endif |
|
6395 |
|
6396 return MNG_NOERROR; |
|
6397 } |
|
6398 #endif |
|
6399 #endif |
|
6400 |
|
6401 /* ************************************************************************** */ |
|
6402 |
|
6403 #ifndef MNG_SKIPCHUNK_MAGN |
|
6404 mng_retcode MNG_DECL mng_putchunk_magn (mng_handle hHandle, |
|
6405 mng_uint16 iFirstid, |
|
6406 mng_uint16 iLastid, |
|
6407 mng_uint16 iMethodX, |
|
6408 mng_uint16 iMX, |
|
6409 mng_uint16 iMY, |
|
6410 mng_uint16 iML, |
|
6411 mng_uint16 iMR, |
|
6412 mng_uint16 iMT, |
|
6413 mng_uint16 iMB, |
|
6414 mng_uint16 iMethodY) |
|
6415 { |
|
6416 mng_datap pData; |
|
6417 mng_chunkp pChunk; |
|
6418 mng_retcode iRetcode; |
|
6419 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
6420 mng_chunk_header sChunkheader = |
|
6421 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
6422 {MNG_UINT_MAGN, mng_init_general, mng_free_general, mng_read_magn, mng_write_magn, mng_assign_general, 0, 0, sizeof(mng_magn)}; |
|
6423 #else |
|
6424 {MNG_UINT_MAGN, mng_init_magn, mng_free_magn, mng_read_magn, mng_write_magn, mng_assign_magn, 0, 0}; |
|
6425 #endif |
|
6426 #else |
|
6427 mng_chunk_header sChunkheader; |
|
6428 #endif |
|
6429 |
|
6430 #ifdef MNG_SUPPORT_TRACE |
|
6431 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MAGN, MNG_LC_START); |
|
6432 #endif |
|
6433 |
|
6434 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
6435 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
6436 |
|
6437 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
6438 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
6439 /* must have had a MHDR first! */ |
|
6440 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
6441 MNG_ERROR (pData, MNG_NOHEADER) |
|
6442 /* prevent misplaced TERM ! */ |
|
6443 if (!check_term (pData, MNG_UINT_MAGN)) |
|
6444 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
6445 /* create the chunk */ |
|
6446 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
6447 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
6448 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
6449 #else |
|
6450 iRetcode = mng_init_magn (pData, &sChunkheader, &pChunk); |
|
6451 #endif |
|
6452 #else |
|
6453 mng_get_chunkheader(MNG_UINT_MAGN, &sChunkheader); |
|
6454 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
6455 #endif |
|
6456 |
|
6457 if (iRetcode) /* on error bail out */ |
|
6458 return iRetcode; |
|
6459 /* fill the chunk */ |
|
6460 ((mng_magnp)pChunk)->iFirstid = iFirstid; |
|
6461 ((mng_magnp)pChunk)->iLastid = iLastid; |
|
6462 ((mng_magnp)pChunk)->iMethodX = (mng_uint8)iMethodX; |
|
6463 ((mng_magnp)pChunk)->iMX = iMX; |
|
6464 ((mng_magnp)pChunk)->iMY = iMY; |
|
6465 ((mng_magnp)pChunk)->iML = iML; |
|
6466 ((mng_magnp)pChunk)->iMR = iMR; |
|
6467 ((mng_magnp)pChunk)->iMT = iMT; |
|
6468 ((mng_magnp)pChunk)->iMB = iMB; |
|
6469 ((mng_magnp)pChunk)->iMethodY = (mng_uint8)iMethodY; |
|
6470 |
|
6471 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
6472 |
|
6473 #ifdef MNG_SUPPORT_TRACE |
|
6474 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MAGN, MNG_LC_END); |
|
6475 #endif |
|
6476 |
|
6477 return MNG_NOERROR; |
|
6478 } |
|
6479 #endif |
|
6480 |
|
6481 /* ************************************************************************** */ |
|
6482 |
|
6483 #ifdef MNG_INCLUDE_MPNG_PROPOSAL |
|
6484 MNG_EXT mng_retcode MNG_DECL mng_putchunk_mpng (mng_handle hHandle, |
|
6485 mng_uint32 iFramewidth, |
|
6486 mng_uint32 iFrameheight, |
|
6487 mng_uint16 iNumplays, |
|
6488 mng_uint16 iTickspersec, |
|
6489 mng_uint8 iCompressionmethod, |
|
6490 mng_uint32 iCount) |
|
6491 { |
|
6492 mng_datap pData; |
|
6493 mng_chunkp pChunk; |
|
6494 mng_retcode iRetcode; |
|
6495 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
6496 mng_chunk_header sChunkheader = |
|
6497 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
6498 {MNG_UINT_mpNG, mng_init_general, mng_free_mpng, mng_read_mpng, mng_write_mpng, mng_assign_mpng, 0, 0, sizeof(mng_mpng)}; |
|
6499 #else |
|
6500 {MNG_UINT_mpNG, mng_init_mpng, mng_free_mpng, mng_read_mpng, mng_write_mpng, mng_assign_mpng, 0, 0}; |
|
6501 #endif |
|
6502 #else |
|
6503 mng_chunk_header sChunkheader; |
|
6504 #endif |
|
6505 |
|
6506 #ifdef MNG_SUPPORT_TRACE |
|
6507 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MPNG, MNG_LC_START); |
|
6508 #endif |
|
6509 |
|
6510 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
6511 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
6512 |
|
6513 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
6514 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
6515 /* must have had a IHDR first! */ |
|
6516 if (pData->iFirstchunkadded != MNG_UINT_IHDR) |
|
6517 MNG_ERROR (pData, MNG_NOHEADER) |
|
6518 /* create the chunk */ |
|
6519 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
6520 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
6521 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
6522 #else |
|
6523 iRetcode = mng_init_mpng (pData, &sChunkheader, &pChunk); |
|
6524 #endif |
|
6525 #else |
|
6526 mng_get_chunkheader(MNG_UINT_mpNG, &sChunkheader); |
|
6527 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
6528 #endif |
|
6529 |
|
6530 if (iRetcode) /* on error bail out */ |
|
6531 return iRetcode; |
|
6532 /* fill the chunk */ |
|
6533 ((mng_mpngp)pChunk)->iFramewidth = iFramewidth; |
|
6534 ((mng_mpngp)pChunk)->iFrameheight = iFrameheight; |
|
6535 ((mng_mpngp)pChunk)->iNumplays = iNumplays; |
|
6536 ((mng_mpngp)pChunk)->iTickspersec = iTickspersec; |
|
6537 ((mng_mpngp)pChunk)->iCompressionmethod = iCompressionmethod; |
|
6538 ((mng_mpngp)pChunk)->iFramessize = iCount * sizeof (mng_mpng_frame); |
|
6539 |
|
6540 if (iCount) |
|
6541 MNG_ALLOC (pData, ((mng_mpngp)pChunk)->pFrames, ((mng_mpngp)pChunk)->iFramessize); |
|
6542 |
|
6543 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
6544 |
|
6545 #ifdef MNG_SUPPORT_TRACE |
|
6546 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MPNG, MNG_LC_END); |
|
6547 #endif |
|
6548 |
|
6549 return MNG_NOERROR; |
|
6550 } |
|
6551 #endif |
|
6552 |
|
6553 /* ************************************************************************** */ |
|
6554 |
|
6555 #ifdef MNG_INCLUDE_MPNG_PROPOSAL |
|
6556 MNG_EXT mng_retcode MNG_DECL mng_putchunk_mpng_frame (mng_handle hHandle, |
|
6557 mng_uint32 iEntry, |
|
6558 mng_uint32 iX, |
|
6559 mng_uint32 iY, |
|
6560 mng_uint32 iWidth, |
|
6561 mng_uint32 iHeight, |
|
6562 mng_int32 iXoffset, |
|
6563 mng_int32 iYoffset, |
|
6564 mng_uint16 iTicks) |
|
6565 { |
|
6566 mng_datap pData; |
|
6567 mng_chunkp pChunk; |
|
6568 mng_mpng_framep pFrame; |
|
6569 |
|
6570 #ifdef MNG_SUPPORT_TRACE |
|
6571 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MPNG_FRAME, MNG_LC_START); |
|
6572 #endif |
|
6573 |
|
6574 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
6575 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
6576 |
|
6577 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
6578 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
6579 /* must have had a IHDR first! */ |
|
6580 if (pData->iFirstchunkadded != MNG_UINT_IHDR) |
|
6581 MNG_ERROR (pData, MNG_NOHEADER) |
|
6582 |
|
6583 pChunk = pData->pLastchunk; /* last one must have been mpNG ! */ |
|
6584 |
|
6585 if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_mpNG) |
|
6586 MNG_ERROR (pData, MNG_NOCORRCHUNK) |
|
6587 /* index out of bounds ? */ |
|
6588 if (iEntry >= (((mng_mpngp)pChunk)->iFramessize / sizeof (mng_mpng_frame))) |
|
6589 MNG_ERROR (pData, MNG_INVALIDENTRYIX) |
|
6590 /* address proper entry */ |
|
6591 pFrame = ((mng_mpngp)pChunk)->pFrames + iEntry; |
|
6592 /* fill entry */ |
|
6593 pFrame->iX = iX; |
|
6594 pFrame->iY = iY; |
|
6595 pFrame->iWidth = iWidth; |
|
6596 pFrame->iHeight = iHeight; |
|
6597 pFrame->iXoffset = iXoffset; |
|
6598 pFrame->iYoffset = iYoffset; |
|
6599 pFrame->iTicks = iTicks; |
|
6600 |
|
6601 #ifdef MNG_SUPPORT_TRACE |
|
6602 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MPNG_FRAME, MNG_LC_END); |
|
6603 #endif |
|
6604 |
|
6605 return MNG_NOERROR; |
|
6606 } |
|
6607 #endif |
|
6608 |
|
6609 /* ************************************************************************** */ |
|
6610 |
|
6611 #ifndef MNG_SKIPCHUNK_evNT |
|
6612 mng_retcode MNG_DECL mng_putchunk_evnt (mng_handle hHandle, |
|
6613 mng_uint32 iCount) |
|
6614 { |
|
6615 mng_datap pData; |
|
6616 mng_chunkp pChunk; |
|
6617 mng_retcode iRetcode; |
|
6618 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
6619 mng_chunk_header sChunkheader = |
|
6620 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
6621 {MNG_UINT_evNT, mng_init_general, mng_free_evnt, mng_read_evnt, mng_write_evnt, mng_assign_evnt, 0, 0, sizeof(mng_evnt)}; |
|
6622 #else |
|
6623 {MNG_UINT_evNT, mng_init_evnt, mng_free_evnt, mng_read_evnt, mng_write_evnt, mng_assign_evnt, 0, 0}; |
|
6624 #endif |
|
6625 #else |
|
6626 mng_chunk_header sChunkheader; |
|
6627 #endif |
|
6628 |
|
6629 #ifdef MNG_SUPPORT_TRACE |
|
6630 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EVNT, MNG_LC_START); |
|
6631 #endif |
|
6632 |
|
6633 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
6634 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
6635 |
|
6636 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
6637 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
6638 /* must have had a MHDR first! */ |
|
6639 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
6640 MNG_ERROR (pData, MNG_NOHEADER) |
|
6641 /* prevent misplaced TERM ! */ |
|
6642 if (!check_term (pData, MNG_UINT_evNT)) |
|
6643 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
6644 /* create the chunk */ |
|
6645 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
6646 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
6647 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
6648 #else |
|
6649 iRetcode = mng_init_evnt (pData, &sChunkheader, &pChunk); |
|
6650 #endif |
|
6651 #else |
|
6652 mng_get_chunkheader(MNG_UINT_evNT, &sChunkheader); |
|
6653 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
6654 #endif |
|
6655 |
|
6656 if (iRetcode) /* on error bail out */ |
|
6657 return iRetcode; |
|
6658 /* fill the chunk */ |
|
6659 ((mng_evntp)pChunk)->iCount = iCount; |
|
6660 |
|
6661 if (iCount) |
|
6662 MNG_ALLOC (pData, ((mng_evntp)pChunk)->pEntries, iCount * sizeof (mng_evnt_entry)); |
|
6663 |
|
6664 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
6665 |
|
6666 #ifdef MNG_SUPPORT_TRACE |
|
6667 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EVNT, MNG_LC_END); |
|
6668 #endif |
|
6669 |
|
6670 return MNG_NOERROR; |
|
6671 } |
|
6672 |
|
6673 /* ************************************************************************** */ |
|
6674 |
|
6675 mng_retcode MNG_DECL mng_putchunk_evnt_entry (mng_handle hHandle, |
|
6676 mng_uint32 iEntry, |
|
6677 mng_uint8 iEventtype, |
|
6678 mng_uint8 iMasktype, |
|
6679 mng_int32 iLeft, |
|
6680 mng_int32 iRight, |
|
6681 mng_int32 iTop, |
|
6682 mng_int32 iBottom, |
|
6683 mng_uint16 iObjectid, |
|
6684 mng_uint8 iIndex, |
|
6685 mng_uint32 iSegmentnamesize, |
|
6686 mng_pchar zSegmentname) |
|
6687 { |
|
6688 mng_datap pData; |
|
6689 mng_chunkp pChunk; |
|
6690 mng_evnt_entryp pEntry; |
|
6691 |
|
6692 #ifdef MNG_SUPPORT_TRACE |
|
6693 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EVNT_ENTRY, MNG_LC_START); |
|
6694 #endif |
|
6695 |
|
6696 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
6697 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
6698 |
|
6699 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
6700 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
6701 /* must have had a MHDR first! */ |
|
6702 if (pData->iFirstchunkadded != MNG_UINT_MHDR) |
|
6703 MNG_ERROR (pData, MNG_NOHEADER) |
|
6704 |
|
6705 pChunk = pData->pLastchunk; /* last one must have been evNT ! */ |
|
6706 |
|
6707 if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_evNT) |
|
6708 MNG_ERROR (pData, MNG_NOCORRCHUNK) |
|
6709 /* index out of bounds ? */ |
|
6710 if (iEntry >= ((mng_evntp)pChunk)->iCount) |
|
6711 MNG_ERROR (pData, MNG_INVALIDENTRYIX) |
|
6712 /* address proper entry */ |
|
6713 pEntry = ((mng_evntp)pChunk)->pEntries + iEntry; |
|
6714 /* fill entry */ |
|
6715 pEntry->iEventtype = iEventtype; |
|
6716 pEntry->iMasktype = iMasktype; |
|
6717 pEntry->iLeft = iLeft; |
|
6718 pEntry->iRight = iRight; |
|
6719 pEntry->iTop = iTop; |
|
6720 pEntry->iBottom = iBottom; |
|
6721 pEntry->iObjectid = iObjectid; |
|
6722 pEntry->iIndex = iIndex; |
|
6723 pEntry->iSegmentnamesize = iSegmentnamesize; |
|
6724 |
|
6725 if (iSegmentnamesize) |
|
6726 { |
|
6727 MNG_ALLOC (pData, pEntry->zSegmentname, iSegmentnamesize + 1); |
|
6728 MNG_COPY (pEntry->zSegmentname, zSegmentname, iSegmentnamesize); |
|
6729 } |
|
6730 |
|
6731 #ifdef MNG_SUPPORT_TRACE |
|
6732 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EVNT_ENTRY, MNG_LC_END); |
|
6733 #endif |
|
6734 |
|
6735 return MNG_NOERROR; |
|
6736 } |
|
6737 #endif |
|
6738 |
|
6739 /* ************************************************************************** */ |
|
6740 |
|
6741 mng_retcode MNG_DECL mng_putchunk_unknown (mng_handle hHandle, |
|
6742 mng_chunkid iChunkname, |
|
6743 mng_uint32 iRawlen, |
|
6744 mng_ptr pRawdata) |
|
6745 { |
|
6746 mng_datap pData; |
|
6747 mng_chunkp pChunk; |
|
6748 mng_retcode iRetcode; |
|
6749 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
6750 mng_chunk_header sChunkheader = |
|
6751 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
6752 {MNG_UINT_HUH, mng_init_general, mng_free_unknown, mng_read_unknown, mng_write_unknown, mng_assign_unknown, 0, 0, sizeof(mng_unknown_chunk)}; |
|
6753 #else |
|
6754 {MNG_UINT_HUH, mng_init_unknown, mng_free_unknown, mng_read_unknown, mng_write_unknown, mng_assign_unknown, 0, 0}; |
|
6755 #endif |
|
6756 #else |
|
6757 mng_chunk_header sChunkheader; |
|
6758 #endif |
|
6759 |
|
6760 #ifdef MNG_SUPPORT_TRACE |
|
6761 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_UNKNOWN, MNG_LC_START); |
|
6762 #endif |
|
6763 |
|
6764 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
6765 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
6766 |
|
6767 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
6768 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
6769 /* must have had a header first! */ |
|
6770 if (pData->iFirstchunkadded == 0) |
|
6771 MNG_ERROR (pData, MNG_NOHEADER) |
|
6772 /* prevent misplaced TERM ! */ |
|
6773 if (!check_term (pData, iChunkname)) |
|
6774 MNG_ERROR (pData, MNG_TERMSEQERROR) |
|
6775 /* create the chunk */ |
|
6776 #ifndef MNG_OPTIMIZE_CHUNKREADER |
|
6777 #ifdef MNG_OPTIMIZE_CHUNKINITFREE |
|
6778 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
6779 #else |
|
6780 iRetcode = mng_init_unknown (pData, &sChunkheader, &pChunk); |
|
6781 #endif |
|
6782 #else |
|
6783 mng_get_chunkheader(MNG_UINT_HUH, &sChunkheader); |
|
6784 iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); |
|
6785 #endif |
|
6786 |
|
6787 if (iRetcode) /* on error bail out */ |
|
6788 return iRetcode; |
|
6789 /* fill the chunk */ |
|
6790 ((mng_unknown_chunkp)pChunk)->sHeader.iChunkname = iChunkname; |
|
6791 ((mng_unknown_chunkp)pChunk)->iDatasize = iRawlen; |
|
6792 |
|
6793 if (iRawlen) |
|
6794 { |
|
6795 MNG_ALLOC (pData, ((mng_unknown_chunkp)pChunk)->pData, iRawlen); |
|
6796 MNG_COPY (((mng_unknown_chunkp)pChunk)->pData, pRawdata, iRawlen); |
|
6797 } |
|
6798 |
|
6799 mng_add_chunk (pData, pChunk); /* add it to the list */ |
|
6800 |
|
6801 #ifdef MNG_SUPPORT_TRACE |
|
6802 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_UNKNOWN, MNG_LC_END); |
|
6803 #endif |
|
6804 |
|
6805 return MNG_NOERROR; |
|
6806 } |
|
6807 |
|
6808 /* ************************************************************************** */ |
|
6809 |
|
6810 #endif /* MNG_INCLUDE_WRITE_PROCS */ |
|
6811 |
|
6812 /* ************************************************************************** */ |
|
6813 /* ************************************************************************** */ |
|
6814 |
|
6815 mng_retcode MNG_DECL mng_getimgdata_seq (mng_handle hHandle, |
|
6816 mng_uint32 iSeqnr, |
|
6817 mng_uint32 iCanvasstyle, |
|
6818 mng_getcanvasline fGetcanvasline) |
|
6819 { |
|
6820 #ifdef MNG_SUPPORT_TRACE |
|
6821 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_SEQ, MNG_LC_START); |
|
6822 #endif |
|
6823 |
|
6824 |
|
6825 |
|
6826 #ifdef MNG_SUPPORT_TRACE |
|
6827 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_SEQ, MNG_LC_END); |
|
6828 #endif |
|
6829 |
|
6830 return MNG_FNNOTIMPLEMENTED; |
|
6831 } |
|
6832 |
|
6833 /* ************************************************************************** */ |
|
6834 |
|
6835 mng_retcode MNG_DECL mng_getimgdata_chunkseq (mng_handle hHandle, |
|
6836 mng_uint32 iSeqnr, |
|
6837 mng_uint32 iCanvasstyle, |
|
6838 mng_getcanvasline fGetcanvasline) |
|
6839 { |
|
6840 #ifdef MNG_SUPPORT_TRACE |
|
6841 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_CHUNKSEQ, MNG_LC_START); |
|
6842 #endif |
|
6843 |
|
6844 |
|
6845 |
|
6846 #ifdef MNG_SUPPORT_TRACE |
|
6847 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_CHUNKSEQ, MNG_LC_END); |
|
6848 #endif |
|
6849 |
|
6850 return MNG_FNNOTIMPLEMENTED; |
|
6851 } |
|
6852 |
|
6853 /* ************************************************************************** */ |
|
6854 |
|
6855 mng_retcode MNG_DECL mng_getimgdata_chunk (mng_handle hHandle, |
|
6856 mng_handle hChunk, |
|
6857 mng_uint32 iCanvasstyle, |
|
6858 mng_getcanvasline fGetcanvasline) |
|
6859 { |
|
6860 #ifdef MNG_SUPPORT_TRACE |
|
6861 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_CHUNK, MNG_LC_START); |
|
6862 #endif |
|
6863 |
|
6864 |
|
6865 |
|
6866 #ifdef MNG_SUPPORT_TRACE |
|
6867 MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_CHUNK, MNG_LC_END); |
|
6868 #endif |
|
6869 |
|
6870 return MNG_FNNOTIMPLEMENTED; |
|
6871 } |
|
6872 |
|
6873 /* ************************************************************************** */ |
|
6874 /* ************************************************************************** */ |
|
6875 |
|
6876 #ifdef MNG_INCLUDE_WRITE_PROCS |
|
6877 |
|
6878 /* ************************************************************************** */ |
|
6879 |
|
6880 mng_retcode MNG_DECL mng_putimgdata_ihdr (mng_handle hHandle, |
|
6881 mng_uint32 iWidth, |
|
6882 mng_uint32 iHeight, |
|
6883 mng_uint8 iColortype, |
|
6884 mng_uint8 iBitdepth, |
|
6885 mng_uint8 iCompression, |
|
6886 mng_uint8 iFilter, |
|
6887 mng_uint8 iInterlace, |
|
6888 mng_uint32 iCanvasstyle, |
|
6889 mng_getcanvasline fGetcanvasline) |
|
6890 { |
|
6891 #ifdef MNG_SUPPORT_TRACE |
|
6892 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTIMGDATA_IHDR, MNG_LC_START); |
|
6893 #endif |
|
6894 |
|
6895 |
|
6896 |
|
6897 #ifdef MNG_SUPPORT_TRACE |
|
6898 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTIMGDATA_IHDR, MNG_LC_END); |
|
6899 #endif |
|
6900 |
|
6901 return MNG_FNNOTIMPLEMENTED; |
|
6902 } |
|
6903 |
|
6904 /* ************************************************************************** */ |
|
6905 |
|
6906 #ifdef MNG_INCLUDE_JNG |
|
6907 mng_retcode MNG_DECL mng_putimgdata_jhdr (mng_handle hHandle, |
|
6908 mng_uint32 iWidth, |
|
6909 mng_uint32 iHeight, |
|
6910 mng_uint8 iColortype, |
|
6911 mng_uint8 iBitdepth, |
|
6912 mng_uint8 iCompression, |
|
6913 mng_uint8 iInterlace, |
|
6914 mng_uint8 iAlphaBitdepth, |
|
6915 mng_uint8 iAlphaCompression, |
|
6916 mng_uint8 iAlphaFilter, |
|
6917 mng_uint8 iAlphaInterlace, |
|
6918 mng_uint32 iCanvasstyle, |
|
6919 mng_getcanvasline fGetcanvasline) |
|
6920 { |
|
6921 #ifdef MNG_SUPPORT_TRACE |
|
6922 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTIMGDATA_JHDR, MNG_LC_START); |
|
6923 #endif |
|
6924 |
|
6925 |
|
6926 |
|
6927 #ifdef MNG_SUPPORT_TRACE |
|
6928 MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTIMGDATA_JHDR, MNG_LC_END); |
|
6929 #endif |
|
6930 |
|
6931 return MNG_FNNOTIMPLEMENTED; |
|
6932 } |
|
6933 #endif |
|
6934 |
|
6935 /* ************************************************************************** */ |
|
6936 |
|
6937 mng_retcode MNG_DECL mng_updatemngheader (mng_handle hHandle, |
|
6938 mng_uint32 iFramecount, |
|
6939 mng_uint32 iLayercount, |
|
6940 mng_uint32 iPlaytime) |
|
6941 { |
|
6942 mng_datap pData; |
|
6943 mng_chunkp pChunk; |
|
6944 |
|
6945 #ifdef MNG_SUPPORT_TRACE |
|
6946 MNG_TRACE (((mng_datap)hHandle), MNG_FN_UPDATEMNGHEADER, MNG_LC_START); |
|
6947 #endif |
|
6948 |
|
6949 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
6950 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
6951 |
|
6952 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
6953 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
6954 /* must be a MNG animation! */ |
|
6955 if ((pData->eImagetype != mng_it_mng) || (pData->iFirstchunkadded != MNG_UINT_MHDR)) |
|
6956 MNG_ERROR (pData, MNG_NOMHDR) |
|
6957 |
|
6958 pChunk = pData->pFirstchunk; /* get the first chunk */ |
|
6959 /* and update the variables */ |
|
6960 ((mng_mhdrp)pChunk)->iFramecount = iFramecount; |
|
6961 ((mng_mhdrp)pChunk)->iLayercount = iLayercount; |
|
6962 ((mng_mhdrp)pChunk)->iPlaytime = iPlaytime; |
|
6963 |
|
6964 #ifdef MNG_SUPPORT_TRACE |
|
6965 MNG_TRACE (((mng_datap)hHandle), MNG_FN_UPDATEMNGHEADER, MNG_LC_END); |
|
6966 #endif |
|
6967 |
|
6968 return MNG_NOERROR; |
|
6969 } |
|
6970 |
|
6971 /* ************************************************************************** */ |
|
6972 |
|
6973 mng_retcode MNG_DECL mng_updatemngsimplicity (mng_handle hHandle, |
|
6974 mng_uint32 iSimplicity) |
|
6975 { |
|
6976 mng_datap pData; |
|
6977 mng_chunkp pChunk; |
|
6978 |
|
6979 #ifdef MNG_SUPPORT_TRACE |
|
6980 MNG_TRACE (((mng_datap)hHandle), MNG_FN_UPDATEMNGSIMPLICITY, MNG_LC_START); |
|
6981 #endif |
|
6982 |
|
6983 MNG_VALIDHANDLE (hHandle) /* check validity handle */ |
|
6984 pData = (mng_datap)hHandle; /* and make it addressable */ |
|
6985 |
|
6986 if (!pData->bCreating) /* aren't we creating a new file ? */ |
|
6987 MNG_ERROR (pData, MNG_FUNCTIONINVALID) |
|
6988 /* must be a MNG animation! */ |
|
6989 if ((pData->eImagetype != mng_it_mng) || (pData->iFirstchunkadded != MNG_UINT_MHDR)) |
|
6990 MNG_ERROR (pData, MNG_NOMHDR) |
|
6991 |
|
6992 pChunk = pData->pFirstchunk; /* get the first chunk */ |
|
6993 /* and update the variable */ |
|
6994 ((mng_mhdrp)pChunk)->iSimplicity = iSimplicity; |
|
6995 |
|
6996 #ifdef MNG_SUPPORT_TRACE |
|
6997 MNG_TRACE (((mng_datap)hHandle), MNG_FN_UPDATEMNGSIMPLICITY, MNG_LC_END); |
|
6998 #endif |
|
6999 |
|
7000 return MNG_NOERROR; |
|
7001 } |
|
7002 |
|
7003 /* ************************************************************************** */ |
|
7004 |
|
7005 #endif /* MNG_INCLUDE_WRITE_PROCS */ |
|
7006 |
|
7007 /* ************************************************************************** */ |
|
7008 |
|
7009 #endif /* MNG_ACCESS_CHUNKS */ |
|
7010 |
|
7011 /* ************************************************************************** */ |
|
7012 /* * end of file * */ |
|
7013 /* ************************************************************************** */ |
|
7014 |
|
7015 |
|
7016 |