src/3rdparty/libmng/libmng_chunks.h
changeset 0 1918ee327afb
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /* ************************************************************************** */
       
     2 /* *             For conditions of distribution and use,                    * */
       
     3 /* *                see copyright notice in libmng.h                        * */
       
     4 /* ************************************************************************** */
       
     5 /* *                                                                        * */
       
     6 /* * project   : libmng                                                     * */
       
     7 /* * file      : libmng_chunks.h           copyright (c) 2000-2007 G.Juyn   * */
       
     8 /* * version   : 1.0.10                                                     * */
       
     9 /* *                                                                        * */
       
    10 /* * purpose   : Chunk structures (definition)                              * */
       
    11 /* *                                                                        * */
       
    12 /* * author    : G.Juyn                                                     * */
       
    13 /* *                                                                        * */
       
    14 /* * comment   : Definition of known chunk structures                       * */
       
    15 /* *                                                                        * */
       
    16 /* * changes   : 0.5.1 - 05/04/2000 - G.Juyn                                * */
       
    17 /* *             - put in some extra comments                               * */
       
    18 /* *             0.5.1 - 05/06/2000 - G.Juyn                                * */
       
    19 /* *             - fixed layout for sBIT, PPLT                              * */
       
    20 /* *             0.5.1 - 05/08/2000 - G.Juyn                                * */
       
    21 /* *             - changed write callback definition                        * */
       
    22 /* *             - changed strict-ANSI stuff                                * */
       
    23 /* *             0.5.1 - 05/11/2000 - G.Juyn                                * */
       
    24 /* *             - fixed layout for PPLT again (missed deltatype ?!?)       * */
       
    25 /* *                                                                        * */
       
    26 /* *             0.5.2 - 05/31/2000 - G.Juyn                                * */
       
    27 /* *             - removed useless definition (contributed by Tim Rowley)   * */
       
    28 /* *             0.5.2 - 06/03/2000 - G.Juyn                                * */
       
    29 /* *             - fixed makeup for Linux gcc compile                       * */
       
    30 /* *                                                                        * */
       
    31 /* *             0.9.2 - 08/05/2000 - G.Juyn                                * */
       
    32 /* *             - changed file-prefixes                                    * */
       
    33 /* *                                                                        * */
       
    34 /* *             0.9.3 - 08/26/2000 - G.Juyn                                * */
       
    35 /* *             - added MAGN chunk                                         * */
       
    36 /* *             0.9.3 - 09/10/2000 - G.Juyn                                * */
       
    37 /* *             - fixed DEFI behavior                                      * */
       
    38 /* *             0.9.3 - 10/16/2000 - G.Juyn                                * */
       
    39 /* *             - added JDAA chunk                                         * */
       
    40 /* *                                                                        * */
       
    41 /* *             1.0.5 - 08/19/2002 - G.Juyn                                * */
       
    42 /* *             - added HLAPI function to copy chunks                      * */
       
    43 /* *             1.0.5 - 09/14/2002 - G.Juyn                                * */
       
    44 /* *             - added event handling for dynamic MNG                     * */
       
    45 /* *             1.0.5 - 11/28/2002 - G.Juyn                                * */
       
    46 /* *             - fixed definition of iMethodX/Y for MAGN chunk            * */
       
    47 /* *                                                                        * */
       
    48 /* *             1.0.6 - 05/25/2003 - G.R-P                                 * */
       
    49 /* *               added MNG_SKIPCHUNK_cHNK footprint optimizations         * */
       
    50 /* *             1.0.6 - 07/29/2003 - G.R-P                                 * */
       
    51 /* *             - added conditionals around PAST chunk support             * */
       
    52 /* *                                                                        * */
       
    53 /* *             1.0.7 - 03/24/2004 - G.R-P                                 * */
       
    54 /* *             - added conditional around MNG_NO_DELTA_PNG support        * */
       
    55 /* *                                                                        * */
       
    56 /* *             1.0.9 - 12/05/2004 - G.Juyn                                * */
       
    57 /* *             - added conditional MNG_OPTIMIZE_CHUNKINITFREE             * */
       
    58 /* *             1.0.9 - 12/06/2004 - G.Juyn                                * */
       
    59 /* *             - added conditional MNG_OPTIMIZE_CHUNKREADER               * */
       
    60 /* *                                                                        * */
       
    61 /* *             1.0.10 - 04/08/2007 - G.Juyn                               * */
       
    62 /* *             - added support for mPNG proposal                          * */
       
    63 /* *             1.0.10 - 04/12/2007 - G.Juyn                               * */
       
    64 /* *             - added support for ANG proposal                           * */
       
    65 /* *                                                                        * */
       
    66 /* ************************************************************************** */
       
    67 
       
    68 #if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
       
    69 #pragma option -A                      /* force ANSI-C */
       
    70 #endif
       
    71 
       
    72 #ifndef _libmng_chunks_h_
       
    73 #define _libmng_chunks_h_
       
    74 
       
    75 /* ************************************************************************** */
       
    76 
       
    77 #ifdef MNG_SWAP_ENDIAN
       
    78 #define PNG_SIG 0x474e5089L
       
    79 #define JNG_SIG 0x474e4a8bL
       
    80 #define MNG_SIG 0x474e4d8aL
       
    81 #define POST_SIG 0x0a1a0a0dL
       
    82 #else
       
    83 #define PNG_SIG 0x89504e47L
       
    84 #define JNG_SIG 0x8b4a4e47L
       
    85 #define MNG_SIG 0x8a4d4e47L
       
    86 #define POST_SIG 0x0d0a1a0aL
       
    87 #endif
       
    88 
       
    89 /* ************************************************************************** */
       
    90 
       
    91 #ifdef MNG_OPTIMIZE_CHUNKREADER
       
    92 
       
    93 typedef mng_retcode (*mng_f_specialfunc)  (mng_datap   pData,
       
    94                                            mng_chunkp  pChunk,
       
    95                                            mng_uint32* piRawlen,
       
    96                                            mng_uint8p* ppRawdata);
       
    97                                            
       
    98 typedef mng_retcode (*mng_c_specialfunc)  (mng_datap  pData,
       
    99                                            mng_chunkp pChunk);
       
   100 
       
   101 #define MNG_FIELD_OPTIONAL    0x0001
       
   102 #define MNG_FIELD_TERMINATOR  0x0002
       
   103 #define MNG_FIELD_REPETITIVE  0x0004
       
   104 #define MNG_FIELD_DEFLATED    0x0008
       
   105 #define MNG_FIELD_IFIMGTYPES  0x01F0   /* image-type mask */
       
   106 #define MNG_FIELD_IFIMGTYPE0  0x0010
       
   107 #define MNG_FIELD_IFIMGTYPE2  0x0020
       
   108 #define MNG_FIELD_IFIMGTYPE3  0x0040
       
   109 #define MNG_FIELD_IFIMGTYPE4  0x0080
       
   110 #define MNG_FIELD_IFIMGTYPE6  0x0100
       
   111 #define MNG_FIELD_PUTIMGTYPE  0x0200
       
   112 #define MNG_FIELD_NOHIGHBIT   0x0400
       
   113 #define MNG_FIELD_GROUPMASK   0x7000
       
   114 #define MNG_FIELD_GROUP1      0x1000
       
   115 #define MNG_FIELD_GROUP2      0x2000
       
   116 #define MNG_FIELD_GROUP3      0x3000
       
   117 #define MNG_FIELD_GROUP4      0x4000
       
   118 #define MNG_FIELD_GROUP5      0x5000
       
   119 #define MNG_FIELD_GROUP6      0x6000
       
   120 #define MNG_FIELD_GROUP7      0x7000
       
   121 #define MNG_FIELD_INT         0x8000
       
   122 
       
   123 typedef struct {                       /* chunk-field descriptor */
       
   124            mng_f_specialfunc pSpecialfunc;
       
   125            mng_uint16        iFlags;
       
   126            mng_uint16        iMinvalue;
       
   127            mng_uint16        iMaxvalue;
       
   128            mng_uint16        iLengthmin;
       
   129            mng_uint16        iLengthmax;
       
   130            mng_uint16        iOffsetchunk;
       
   131            mng_uint16        iOffsetchunkind;
       
   132            mng_uint16        iOffsetchunklen;
       
   133         } mng_field_descriptor;
       
   134 typedef mng_field_descriptor * mng_field_descp;
       
   135 
       
   136 #define MNG_DESCR_GLOBAL      0x0001
       
   137 #define MNG_DESCR_EMPTY       0x0002
       
   138 #define MNG_DESCR_EMPTYEMBED  0x0006
       
   139 #define MNG_DESCR_EMPTYGLOBAL 0x000A
       
   140 
       
   141 #define MNG_DESCR_GenHDR      0x0001   /* IHDR/JHDR/BASI/DHDR */
       
   142 #define MNG_DESCR_JngHDR      0x0002   /* JHDR/DHDR */
       
   143 #define MNG_DESCR_MHDR        0x0004
       
   144 #define MNG_DESCR_IHDR        0x0008
       
   145 #define MNG_DESCR_JHDR        0x0010
       
   146 #define MNG_DESCR_DHDR        0x0020
       
   147 #define MNG_DESCR_LOOP        0x0040
       
   148 #define MNG_DESCR_PLTE        0x0080
       
   149 #define MNG_DESCR_SAVE        0x0100
       
   150 
       
   151 #define MNG_DESCR_NOIHDR      0x0001
       
   152 #define MNG_DESCR_NOJHDR      0x0002
       
   153 #define MNG_DESCR_NOBASI      0x0004
       
   154 #define MNG_DESCR_NODHDR      0x0008
       
   155 #define MNG_DESCR_NOIDAT      0x0010
       
   156 #define MNG_DESCR_NOJDAT      0x0020
       
   157 #define MNG_DESCR_NOJDAA      0x0040
       
   158 #define MNG_DESCR_NOPLTE      0x0080
       
   159 #define MNG_DESCR_NOJSEP      0x0100
       
   160 #define MNG_DESCR_NOMHDR      0x0200
       
   161 #define MNG_DESCR_NOTERM      0x0400
       
   162 #define MNG_DESCR_NOLOOP      0x0800
       
   163 #define MNG_DESCR_NOSAVE      0x1000
       
   164 
       
   165 typedef struct {                       /* chunk descriptor */
       
   166            mng_imgtype       eImgtype;
       
   167            mng_createobjtype eCreateobject;
       
   168            mng_uint16        iObjsize;
       
   169            mng_uint16        iOffsetempty;
       
   170            mng_ptr           pObjcleanup;
       
   171            mng_ptr           pObjprocess;
       
   172            mng_c_specialfunc pSpecialfunc;
       
   173            mng_field_descp   pFielddesc;
       
   174            mng_uint16        iFielddesc;
       
   175            mng_uint16        iAllowed;
       
   176            mng_uint16        iMusthaves;
       
   177            mng_uint16        iMustNOThaves;
       
   178         } mng_chunk_descriptor;
       
   179 typedef mng_chunk_descriptor * mng_chunk_descp;
       
   180 
       
   181 #endif /* MNG_OPTIMIZE_CHUNKREADER */
       
   182 
       
   183 /* ************************************************************************** */
       
   184 
       
   185 typedef mng_retcode (*mng_createchunk)  (mng_datap   pData,
       
   186                                          mng_chunkp  pHeader,
       
   187                                          mng_chunkp* ppChunk);
       
   188 
       
   189 typedef mng_retcode (*mng_cleanupchunk) (mng_datap   pData,
       
   190                                          mng_chunkp  pHeader);
       
   191 
       
   192 typedef mng_retcode (*mng_readchunk)    (mng_datap   pData,
       
   193                                          mng_chunkp  pHeader,
       
   194                                          mng_uint32  iRawlen,
       
   195                                          mng_uint8p  pRawdata,
       
   196                                          mng_chunkp* pChunk);
       
   197 
       
   198 typedef mng_retcode (*mng_writechunk)   (mng_datap   pData,
       
   199                                          mng_chunkp  pChunk);
       
   200 
       
   201 typedef mng_retcode (*mng_assignchunk)  (mng_datap   pData,
       
   202                                          mng_chunkp  pChunkto,
       
   203                                          mng_chunkp  pChunkfrom);
       
   204 
       
   205 /* ************************************************************************** */
       
   206 
       
   207 typedef struct {                       /* generic header */
       
   208            mng_chunkid       iChunkname;
       
   209            mng_createchunk   fCreate;
       
   210            mng_cleanupchunk  fCleanup;
       
   211            mng_readchunk     fRead;
       
   212            mng_writechunk    fWrite;
       
   213            mng_assignchunk   fAssign;
       
   214            mng_chunkp        pNext;    /* for double-linked list */
       
   215            mng_chunkp        pPrev;
       
   216 #ifdef MNG_OPTIMIZE_CHUNKINITFREE
       
   217            mng_size_t        iChunksize;
       
   218 #endif
       
   219 #ifdef MNG_OPTIMIZE_CHUNKREADER
       
   220            mng_chunk_descp   pChunkdescr;
       
   221 #endif
       
   222         } mng_chunk_header;
       
   223 typedef mng_chunk_header * mng_chunk_headerp;
       
   224 
       
   225 /* ************************************************************************** */
       
   226 
       
   227 typedef struct {                       /* IHDR */
       
   228            mng_chunk_header  sHeader;
       
   229            mng_uint32        iWidth;
       
   230            mng_uint32        iHeight;
       
   231            mng_uint8         iBitdepth;
       
   232            mng_uint8         iColortype;
       
   233            mng_uint8         iCompression;
       
   234            mng_uint8         iFilter;
       
   235            mng_uint8         iInterlace;
       
   236         } mng_ihdr;
       
   237 typedef mng_ihdr * mng_ihdrp;
       
   238 
       
   239 /* ************************************************************************** */
       
   240 
       
   241 typedef struct {                       /* PLTE */
       
   242            mng_chunk_header  sHeader;
       
   243            mng_bool          bEmpty;
       
   244            mng_uint32        iEntrycount;
       
   245            mng_rgbpaltab     aEntries;
       
   246         } mng_plte;
       
   247 typedef mng_plte * mng_pltep;
       
   248 
       
   249 /* ************************************************************************** */
       
   250 
       
   251 typedef struct {                       /* IDAT */
       
   252            mng_chunk_header  sHeader;
       
   253            mng_bool          bEmpty;
       
   254            mng_uint32        iDatasize;
       
   255            mng_ptr           pData;
       
   256         } mng_idat;
       
   257 typedef mng_idat * mng_idatp;
       
   258 
       
   259 /* ************************************************************************** */
       
   260 
       
   261 typedef struct {                       /* IEND */
       
   262            mng_chunk_header  sHeader;
       
   263         } mng_iend;
       
   264 typedef mng_iend * mng_iendp;
       
   265 
       
   266 /* ************************************************************************** */
       
   267 
       
   268 typedef struct {                       /* tRNS */
       
   269            mng_chunk_header  sHeader;
       
   270            mng_bool          bEmpty;
       
   271            mng_bool          bGlobal;
       
   272            mng_uint8         iType;    /* colortype (0,2,3) */
       
   273            mng_uint32        iCount;
       
   274            mng_uint8arr      aEntries;
       
   275            mng_uint16        iGray;
       
   276            mng_uint16        iRed;
       
   277            mng_uint16        iGreen;
       
   278            mng_uint16        iBlue;
       
   279            mng_uint32        iRawlen;
       
   280            mng_uint8arr      aRawdata;
       
   281         } mng_trns;
       
   282 typedef mng_trns * mng_trnsp;
       
   283 
       
   284 /* ************************************************************************** */
       
   285 
       
   286 typedef struct {                       /* gAMA */
       
   287            mng_chunk_header  sHeader;
       
   288            mng_bool          bEmpty;
       
   289            mng_uint32        iGamma;
       
   290         } mng_gama;
       
   291 typedef mng_gama * mng_gamap;
       
   292 
       
   293 /* ************************************************************************** */
       
   294 
       
   295 #ifndef MNG_SKIPCHUNK_cHRM
       
   296 typedef struct {                       /* cHRM */
       
   297            mng_chunk_header  sHeader;
       
   298            mng_bool          bEmpty;
       
   299            mng_uint32        iWhitepointx;
       
   300            mng_uint32        iWhitepointy;
       
   301            mng_uint32        iRedx;
       
   302            mng_uint32        iRedy;
       
   303            mng_uint32        iGreenx;
       
   304            mng_uint32        iGreeny;
       
   305            mng_uint32        iBluex;
       
   306            mng_uint32        iBluey;
       
   307         } mng_chrm;
       
   308 typedef mng_chrm * mng_chrmp;
       
   309 #endif
       
   310 
       
   311 /* ************************************************************************** */
       
   312 
       
   313 typedef struct {                       /* sRGB */
       
   314            mng_chunk_header  sHeader;
       
   315            mng_bool          bEmpty;
       
   316            mng_uint8         iRenderingintent;
       
   317         } mng_srgb;
       
   318 typedef mng_srgb * mng_srgbp;
       
   319 
       
   320 /* ************************************************************************** */
       
   321 
       
   322 #ifndef MNG_SKIPCHUNK_iCCP
       
   323 typedef struct {                       /* iCCP */
       
   324            mng_chunk_header  sHeader;
       
   325            mng_bool          bEmpty;
       
   326            mng_uint32        iNamesize;
       
   327            mng_pchar         zName;
       
   328            mng_uint8         iCompression;
       
   329            mng_uint32        iProfilesize;
       
   330            mng_ptr           pProfile;
       
   331         } mng_iccp;
       
   332 typedef mng_iccp * mng_iccpp;
       
   333 #endif
       
   334 
       
   335 /* ************************************************************************** */
       
   336 
       
   337 #ifndef MNG_SKIPCHUNK_tEXt
       
   338 typedef struct {                       /* tEXt */
       
   339            mng_chunk_header  sHeader;
       
   340            mng_uint32        iKeywordsize;
       
   341            mng_pchar         zKeyword;
       
   342            mng_uint32        iTextsize;
       
   343            mng_pchar         zText;
       
   344         } mng_text;
       
   345 typedef mng_text * mng_textp;
       
   346 #endif
       
   347 
       
   348 /* ************************************************************************** */
       
   349 
       
   350 #ifndef MNG_SKIPCHUNK_zTXt
       
   351 typedef struct {                       /* zTXt */
       
   352            mng_chunk_header  sHeader;
       
   353            mng_uint32        iKeywordsize;
       
   354            mng_pchar         zKeyword;
       
   355            mng_uint8         iCompression;
       
   356            mng_uint32        iTextsize;
       
   357            mng_pchar         zText;
       
   358         } mng_ztxt;
       
   359 typedef mng_ztxt * mng_ztxtp;
       
   360 #endif
       
   361 
       
   362 /* ************************************************************************** */
       
   363 
       
   364 #ifndef MNG_SKIPCHUNK_iTXt
       
   365 typedef struct {                       /* iTXt */
       
   366            mng_chunk_header  sHeader;
       
   367            mng_uint32        iKeywordsize;
       
   368            mng_pchar         zKeyword;
       
   369            mng_uint8         iCompressionflag;
       
   370            mng_uint8         iCompressionmethod;
       
   371            mng_uint32        iLanguagesize;
       
   372            mng_pchar         zLanguage;
       
   373            mng_uint32        iTranslationsize;
       
   374            mng_pchar         zTranslation;
       
   375            mng_uint32        iTextsize;
       
   376            mng_pchar         zText;
       
   377         } mng_itxt;
       
   378 typedef mng_itxt * mng_itxtp;
       
   379 #endif
       
   380 
       
   381 /* ************************************************************************** */
       
   382 
       
   383 #ifndef MNG_SKIPCHUNK_bKGD
       
   384 typedef struct {                       /* bKGD */
       
   385            mng_chunk_header  sHeader;
       
   386            mng_bool          bEmpty;
       
   387            mng_uint8         iType;    /* 3=indexed, 0=gray, 2=rgb */
       
   388            mng_uint8         iIndex;
       
   389            mng_uint16        iGray;
       
   390            mng_uint16        iRed;
       
   391            mng_uint16        iGreen;
       
   392            mng_uint16        iBlue;
       
   393         } mng_bkgd;
       
   394 typedef mng_bkgd * mng_bkgdp;
       
   395 #endif
       
   396 
       
   397 /* ************************************************************************** */
       
   398 
       
   399 #ifndef MNG_SKIPCHUNK_pHYs
       
   400 typedef struct {                       /* pHYs */
       
   401            mng_chunk_header  sHeader;
       
   402            mng_bool          bEmpty;
       
   403            mng_uint32        iSizex;
       
   404            mng_uint32        iSizey;
       
   405            mng_uint8         iUnit;
       
   406         } mng_phys;
       
   407 typedef mng_phys * mng_physp;
       
   408 #endif
       
   409 
       
   410 /* ************************************************************************** */
       
   411 #ifndef MNG_SKIPCHUNK_sBIT
       
   412 
       
   413 typedef struct {                       /* sBIT */
       
   414            mng_chunk_header  sHeader;
       
   415            mng_bool          bEmpty;
       
   416            mng_uint8         iType;    /* colortype (0,2,3,4,6,10,12,14,16) */
       
   417            mng_uint8arr4     aBits;
       
   418         } mng_sbit;
       
   419 typedef mng_sbit * mng_sbitp;
       
   420 #endif
       
   421 
       
   422 /* ************************************************************************** */
       
   423 
       
   424 #ifndef MNG_SKIPCHUNK_sPLT
       
   425 typedef struct {                       /* sPLT */
       
   426            mng_chunk_header  sHeader;
       
   427            mng_bool          bEmpty;
       
   428            mng_uint32        iNamesize;
       
   429            mng_pchar         zName;
       
   430            mng_uint8         iSampledepth;
       
   431            mng_uint32        iEntrycount;
       
   432            mng_ptr           pEntries;
       
   433         } mng_splt;
       
   434 typedef mng_splt * mng_spltp;
       
   435 #endif
       
   436 
       
   437 /* ************************************************************************** */
       
   438 
       
   439 #ifndef MNG_SKIPCHUNK_hIST
       
   440 typedef struct {                       /* hIST */
       
   441            mng_chunk_header  sHeader;
       
   442            mng_uint32        iEntrycount;
       
   443            mng_uint16arr     aEntries;
       
   444         } mng_hist;
       
   445 typedef mng_hist * mng_histp;
       
   446 #endif
       
   447 
       
   448 /* ************************************************************************** */
       
   449 
       
   450 #ifndef MNG_SKIPCHUNK_tIME
       
   451 typedef struct {                       /* tIME */
       
   452            mng_chunk_header  sHeader;
       
   453            mng_uint16        iYear;
       
   454            mng_uint8         iMonth;
       
   455            mng_uint8         iDay;
       
   456            mng_uint8         iHour;
       
   457            mng_uint8         iMinute;
       
   458            mng_uint8         iSecond;
       
   459         } mng_time;
       
   460 typedef mng_time * mng_timep;
       
   461 #endif
       
   462 
       
   463 /* ************************************************************************** */
       
   464 
       
   465 typedef struct {                       /* MHDR */
       
   466            mng_chunk_header  sHeader;
       
   467            mng_uint32        iWidth;
       
   468            mng_uint32        iHeight;
       
   469            mng_uint32        iTicks;
       
   470            mng_uint32        iLayercount;
       
   471            mng_uint32        iFramecount;
       
   472            mng_uint32        iPlaytime;
       
   473            mng_uint32        iSimplicity;
       
   474         } mng_mhdr;
       
   475 typedef mng_mhdr * mng_mhdrp;
       
   476 
       
   477 /* ************************************************************************** */
       
   478 
       
   479 typedef struct {                       /* MEND */
       
   480            mng_chunk_header  sHeader;
       
   481         } mng_mend;
       
   482 typedef mng_mend * mng_mendp;
       
   483 
       
   484 /* ************************************************************************** */
       
   485 
       
   486 typedef struct {                       /* LOOP */
       
   487            mng_chunk_header  sHeader;
       
   488            mng_uint8         iLevel;
       
   489            mng_uint32        iRepeat;
       
   490            mng_uint8         iTermination;
       
   491            mng_uint32        iItermin;
       
   492            mng_uint32        iItermax;
       
   493            mng_uint32        iCount;
       
   494            mng_uint32p       pSignals;
       
   495         } mng_loop;
       
   496 typedef mng_loop * mng_loopp;
       
   497 
       
   498 /* ************************************************************************** */
       
   499 
       
   500 typedef struct {                       /* ENDL */
       
   501            mng_chunk_header  sHeader;
       
   502            mng_uint8         iLevel;
       
   503         } mng_endl;
       
   504 typedef mng_endl * mng_endlp;
       
   505 
       
   506 /* ************************************************************************** */
       
   507 
       
   508 typedef struct {                       /* DEFI */
       
   509            mng_chunk_header  sHeader;
       
   510            mng_uint16        iObjectid;
       
   511            mng_bool          bHasdonotshow;
       
   512            mng_uint8         iDonotshow;
       
   513            mng_bool          bHasconcrete;
       
   514            mng_uint8         iConcrete;
       
   515            mng_bool          bHasloca;
       
   516            mng_int32         iXlocation;
       
   517            mng_int32         iYlocation;
       
   518            mng_bool          bHasclip;
       
   519            mng_int32         iLeftcb;
       
   520            mng_int32         iRightcb;
       
   521            mng_int32         iTopcb;
       
   522            mng_int32         iBottomcb;
       
   523         } mng_defi;
       
   524 typedef mng_defi * mng_defip;
       
   525 
       
   526 /* ************************************************************************** */
       
   527 
       
   528 typedef struct {                       /* BASI */
       
   529            mng_chunk_header  sHeader;
       
   530            mng_uint32        iWidth;
       
   531            mng_uint32        iHeight;
       
   532            mng_uint8         iBitdepth;
       
   533            mng_uint8         iColortype;
       
   534            mng_uint8         iCompression;
       
   535            mng_uint8         iFilter;
       
   536            mng_uint8         iInterlace;
       
   537            mng_uint16        iRed;
       
   538            mng_uint16        iGreen;
       
   539            mng_uint16        iBlue;
       
   540 #ifdef MNG_OPTIMIZE_CHUNKREADER
       
   541            mng_bool          bHasalpha;
       
   542 #endif
       
   543            mng_uint16        iAlpha;
       
   544            mng_uint8         iViewable;
       
   545         } mng_basi;
       
   546 typedef mng_basi * mng_basip;
       
   547 
       
   548 /* ************************************************************************** */
       
   549 
       
   550 typedef struct {                       /* CLON */
       
   551            mng_chunk_header  sHeader;
       
   552            mng_uint16        iSourceid;
       
   553            mng_uint16        iCloneid;
       
   554            mng_uint8         iClonetype;
       
   555 #ifdef MNG_OPTIMIZE_CHUNKREADER
       
   556            mng_bool          bHasdonotshow;
       
   557 #endif
       
   558            mng_uint8         iDonotshow;
       
   559            mng_uint8         iConcrete;
       
   560            mng_bool          bHasloca;
       
   561            mng_uint8         iLocationtype;
       
   562            mng_int32         iLocationx;
       
   563            mng_int32         iLocationy;
       
   564         } mng_clon;
       
   565 typedef mng_clon * mng_clonp;
       
   566 
       
   567 /* ************************************************************************** */
       
   568 
       
   569 #ifndef MNG_SKIPCHUNK_PAST
       
   570 typedef struct {                       /* PAST source */
       
   571            mng_uint16        iSourceid;
       
   572            mng_uint8         iComposition;
       
   573            mng_uint8         iOrientation;
       
   574            mng_uint8         iOffsettype;
       
   575            mng_int32         iOffsetx;
       
   576            mng_int32         iOffsety;
       
   577            mng_uint8         iBoundarytype;
       
   578            mng_int32         iBoundaryl;
       
   579            mng_int32         iBoundaryr;
       
   580            mng_int32         iBoundaryt;
       
   581            mng_int32         iBoundaryb;
       
   582         } mng_past_source;
       
   583 typedef mng_past_source * mng_past_sourcep;
       
   584 
       
   585 typedef struct {                       /* PAST */
       
   586            mng_chunk_header  sHeader;
       
   587            mng_uint16        iDestid;
       
   588            mng_uint8         iTargettype;
       
   589            mng_int32         iTargetx;
       
   590            mng_int32         iTargety;
       
   591            mng_uint32        iCount;
       
   592            mng_past_sourcep  pSources;
       
   593         } mng_past;
       
   594 typedef mng_past * mng_pastp;
       
   595 #endif
       
   596 
       
   597 /* ************************************************************************** */
       
   598 
       
   599 typedef struct {                       /* DISC */
       
   600            mng_chunk_header  sHeader;
       
   601            mng_uint32        iCount;
       
   602            mng_uint16p       pObjectids;
       
   603         } mng_disc;
       
   604 typedef mng_disc * mng_discp;
       
   605 
       
   606 /* ************************************************************************** */
       
   607 
       
   608 typedef struct {                       /* BACK */
       
   609            mng_chunk_header  sHeader;
       
   610            mng_uint16        iRed;
       
   611            mng_uint16        iGreen;
       
   612            mng_uint16        iBlue;
       
   613            mng_uint8         iMandatory;
       
   614            mng_uint16        iImageid;
       
   615            mng_uint8         iTile;
       
   616         } mng_back;
       
   617 typedef mng_back * mng_backp;
       
   618 
       
   619 /* ************************************************************************** */
       
   620 
       
   621 typedef struct {                       /* FRAM */
       
   622            mng_chunk_header  sHeader;
       
   623            mng_bool          bEmpty;
       
   624            mng_uint8         iMode;
       
   625            mng_uint32        iNamesize;
       
   626            mng_pchar         zName;
       
   627            mng_uint8         iChangedelay;
       
   628            mng_uint8         iChangetimeout;
       
   629            mng_uint8         iChangeclipping;
       
   630            mng_uint8         iChangesyncid;
       
   631            mng_uint32        iDelay;
       
   632            mng_uint32        iTimeout;
       
   633            mng_uint8         iBoundarytype;
       
   634            mng_int32         iBoundaryl;
       
   635            mng_int32         iBoundaryr;
       
   636            mng_int32         iBoundaryt;
       
   637            mng_int32         iBoundaryb;
       
   638            mng_uint32        iCount;
       
   639            mng_uint32p       pSyncids;
       
   640         } mng_fram;
       
   641 typedef mng_fram * mng_framp;
       
   642 
       
   643 /* ************************************************************************** */
       
   644 
       
   645 typedef struct {                       /* MOVE */
       
   646            mng_chunk_header  sHeader;
       
   647            mng_uint16        iFirstid;
       
   648            mng_uint16        iLastid;
       
   649            mng_uint8         iMovetype;
       
   650            mng_int32         iMovex;
       
   651            mng_int32         iMovey;
       
   652         } mng_move;
       
   653 typedef mng_move * mng_movep;
       
   654 
       
   655 /* ************************************************************************** */
       
   656 
       
   657 typedef struct {                       /* CLIP */
       
   658            mng_chunk_header  sHeader;
       
   659            mng_uint16        iFirstid;
       
   660            mng_uint16        iLastid;
       
   661            mng_uint8         iCliptype;
       
   662            mng_int32         iClipl;
       
   663            mng_int32         iClipr;
       
   664            mng_int32         iClipt;
       
   665            mng_int32         iClipb;
       
   666         } mng_clip;
       
   667 typedef mng_clip * mng_clipp;
       
   668 
       
   669 /* ************************************************************************** */
       
   670 
       
   671 typedef struct {                       /* SHOW */
       
   672            mng_chunk_header  sHeader;
       
   673            mng_bool          bEmpty;
       
   674            mng_uint16        iFirstid;
       
   675 #ifdef MNG_OPTIMIZE_CHUNKREADER
       
   676            mng_bool          bHaslastid;
       
   677 #endif
       
   678            mng_uint16        iLastid;
       
   679            mng_uint8         iMode;
       
   680         } mng_show;
       
   681 typedef mng_show * mng_showp;
       
   682 
       
   683 /* ************************************************************************** */
       
   684 
       
   685 typedef struct {                       /* TERM */
       
   686            mng_chunk_header  sHeader;
       
   687            mng_uint8         iTermaction;
       
   688            mng_uint8         iIteraction;
       
   689            mng_uint32        iDelay;
       
   690            mng_uint32        iItermax;
       
   691         } mng_term;
       
   692 typedef mng_term * mng_termp;
       
   693 
       
   694 /* ************************************************************************** */
       
   695 
       
   696 #ifndef MNG_SKIPCHUNK_SAVE
       
   697 typedef struct {                       /* SAVE entry */
       
   698            mng_uint8         iEntrytype;
       
   699            mng_uint32arr2    iOffset;            /* 0=MSI, 1=LSI */
       
   700            mng_uint32arr2    iStarttime;         /* 0=MSI, 1=LSI */
       
   701            mng_uint32        iLayernr;
       
   702            mng_uint32        iFramenr;
       
   703            mng_uint32        iNamesize;
       
   704            mng_pchar         zName;
       
   705         } mng_save_entry;
       
   706 typedef mng_save_entry * mng_save_entryp;
       
   707 
       
   708 typedef struct {                       /* SAVE */
       
   709            mng_chunk_header  sHeader;
       
   710            mng_bool          bEmpty;
       
   711            mng_uint8         iOffsettype;
       
   712            mng_uint32        iCount;
       
   713            mng_save_entryp   pEntries;
       
   714         } mng_save;
       
   715 typedef mng_save * mng_savep;
       
   716 #endif
       
   717 
       
   718 /* ************************************************************************** */
       
   719 
       
   720 #ifndef MNG_SKIPCHUNK_SEEK
       
   721 typedef struct {                       /* SEEK */
       
   722            mng_chunk_header  sHeader;
       
   723            mng_uint32        iNamesize;
       
   724            mng_pchar         zName;
       
   725         } mng_seek;
       
   726 typedef mng_seek * mng_seekp;
       
   727 #endif
       
   728 
       
   729 /* ************************************************************************** */
       
   730 
       
   731 #ifndef MNG_SKIPCHUNK_eXPI
       
   732 typedef struct {                       /* eXPI */
       
   733            mng_chunk_header  sHeader;
       
   734            mng_uint16        iSnapshotid;
       
   735            mng_uint32        iNamesize;
       
   736            mng_pchar         zName;
       
   737         } mng_expi;
       
   738 typedef mng_expi * mng_expip;
       
   739 #endif
       
   740 
       
   741 /* ************************************************************************** */
       
   742 
       
   743 #ifndef MNG_SKIPCHUNK_fPRI
       
   744 typedef struct {                       /* fPRI */
       
   745            mng_chunk_header  sHeader;
       
   746            mng_uint8         iDeltatype;
       
   747            mng_uint8         iPriority;
       
   748         } mng_fpri;
       
   749 typedef mng_fpri * mng_fprip;
       
   750 #endif
       
   751 
       
   752 /* ************************************************************************** */
       
   753 
       
   754 #ifndef MNG_SKIPCHUNK_nEED
       
   755 typedef struct {                       /* nEED */
       
   756            mng_chunk_header  sHeader;
       
   757            mng_uint32        iKeywordssize;
       
   758            mng_pchar         zKeywords;
       
   759         } mng_need;
       
   760 typedef mng_need * mng_needp;
       
   761 #endif
       
   762 
       
   763 /* ************************************************************************** */
       
   764 
       
   765 #ifndef MNG_SKIPCHUNK_pHYg
       
   766 typedef mng_phys mng_phyg;             /* pHYg */
       
   767 typedef mng_phyg * mng_phygp;
       
   768 #endif
       
   769 
       
   770 /* ************************************************************************** */
       
   771 
       
   772 #ifdef MNG_INCLUDE_JNG
       
   773 
       
   774 typedef struct {                       /* JHDR */
       
   775            mng_chunk_header  sHeader;
       
   776            mng_uint32        iWidth;
       
   777            mng_uint32        iHeight;
       
   778            mng_uint8         iColortype;
       
   779            mng_uint8         iImagesampledepth;
       
   780            mng_uint8         iImagecompression;
       
   781            mng_uint8         iImageinterlace;
       
   782            mng_uint8         iAlphasampledepth;
       
   783            mng_uint8         iAlphacompression;
       
   784            mng_uint8         iAlphafilter;
       
   785            mng_uint8         iAlphainterlace;
       
   786         } mng_jhdr;
       
   787 typedef mng_jhdr * mng_jhdrp;
       
   788 
       
   789 /* ************************************************************************** */
       
   790 
       
   791 typedef mng_idat mng_jdaa;             /* JDAA */
       
   792 typedef mng_jdaa * mng_jdaap;
       
   793 
       
   794 /* ************************************************************************** */
       
   795 
       
   796 typedef mng_idat mng_jdat;             /* JDAT */
       
   797 typedef mng_jdat * mng_jdatp;
       
   798 
       
   799 /* ************************************************************************** */
       
   800 
       
   801 typedef struct {                       /* JSEP */
       
   802            mng_chunk_header  sHeader;
       
   803         } mng_jsep;
       
   804 typedef mng_jsep * mng_jsepp;
       
   805 
       
   806 #endif /* MNG_INCLUDE_JNG */
       
   807 
       
   808 /* ************************************************************************** */
       
   809 
       
   810 #ifndef MNG_NO_DELTA_PNG
       
   811 
       
   812 typedef struct {                       /* DHDR */
       
   813            mng_chunk_header  sHeader;
       
   814            mng_uint16        iObjectid;
       
   815            mng_uint8         iImagetype;
       
   816            mng_uint8         iDeltatype;
       
   817 #ifdef MNG_OPTIMIZE_CHUNKREADER
       
   818            mng_bool          bHasblocksize;
       
   819 #endif
       
   820            mng_uint32        iBlockwidth;
       
   821            mng_uint32        iBlockheight;
       
   822 #ifdef MNG_OPTIMIZE_CHUNKREADER
       
   823            mng_bool          bHasblockloc;
       
   824 #endif
       
   825            mng_uint32        iBlockx;
       
   826            mng_uint32        iBlocky;
       
   827         } mng_dhdr;
       
   828 typedef mng_dhdr * mng_dhdrp;
       
   829 
       
   830 /* ************************************************************************** */
       
   831 
       
   832 typedef struct {                       /* PROM */
       
   833            mng_chunk_header  sHeader;
       
   834            mng_uint8         iColortype;
       
   835            mng_uint8         iSampledepth;
       
   836            mng_uint8         iFilltype;
       
   837         } mng_prom;
       
   838 typedef mng_prom * mng_promp;
       
   839 
       
   840 /* ************************************************************************** */
       
   841 
       
   842 typedef struct {                       /* IPNG */
       
   843            mng_chunk_header  sHeader;
       
   844         } mng_ipng;
       
   845 typedef mng_ipng *mng_ipngp;
       
   846 
       
   847 /* ************************************************************************** */
       
   848 
       
   849 typedef struct {                       /* PPLT entry */
       
   850            mng_uint8         iRed;
       
   851            mng_uint8         iGreen;
       
   852            mng_uint8         iBlue;
       
   853            mng_uint8         iAlpha;
       
   854            mng_bool          bUsed;
       
   855         } mng_pplt_entry;
       
   856 typedef mng_pplt_entry * mng_pplt_entryp;
       
   857 
       
   858 typedef struct {                       /* PPLT */
       
   859            mng_chunk_header  sHeader;
       
   860            mng_uint8         iDeltatype;
       
   861            mng_uint32        iCount;
       
   862            mng_pplt_entry    aEntries [256];
       
   863         } mng_pplt;
       
   864 typedef mng_pplt * mng_ppltp;
       
   865 
       
   866 /* ************************************************************************** */
       
   867 
       
   868 typedef struct {                       /* IJNG */
       
   869            mng_chunk_header  sHeader;
       
   870         } mng_ijng;
       
   871 typedef mng_ijng *mng_ijngp;
       
   872 
       
   873 /* ************************************************************************** */
       
   874 
       
   875 typedef struct {                       /* DROP */
       
   876            mng_chunk_header  sHeader;
       
   877            mng_uint32        iCount;
       
   878            mng_chunkidp      pChunknames;
       
   879         } mng_drop;
       
   880 typedef mng_drop * mng_dropp;
       
   881 
       
   882 /* ************************************************************************** */
       
   883 
       
   884 #ifndef MNG_SKIPCHUNK_DBYK
       
   885 typedef struct {                       /* DBYK */
       
   886            mng_chunk_header  sHeader;
       
   887            mng_chunkid       iChunkname;
       
   888            mng_uint8         iPolarity;
       
   889            mng_uint32        iKeywordssize;
       
   890            mng_pchar         zKeywords;
       
   891         } mng_dbyk;
       
   892 typedef mng_dbyk * mng_dbykp;
       
   893 #endif
       
   894 
       
   895 /* ************************************************************************** */
       
   896 
       
   897 #ifndef MNG_SKIPCHUNK_ORDR
       
   898 typedef struct {                       /* ORDR entry */
       
   899            mng_chunkid       iChunkname;
       
   900            mng_uint8         iOrdertype;
       
   901         } mng_ordr_entry;
       
   902 typedef mng_ordr_entry * mng_ordr_entryp;
       
   903 
       
   904 typedef struct mng_ordr_struct {       /* ORDR */
       
   905            mng_chunk_header  sHeader;
       
   906            mng_uint32        iCount;
       
   907            mng_ordr_entryp   pEntries;
       
   908         } mng_ordr;
       
   909 typedef mng_ordr * mng_ordrp;
       
   910 #endif
       
   911 #endif /* MNG_NO_DELTA_PNG */
       
   912 
       
   913 /* ************************************************************************** */
       
   914 
       
   915 typedef struct {                       /* MAGN */
       
   916            mng_chunk_header  sHeader;
       
   917            mng_uint16        iFirstid;
       
   918            mng_uint16        iLastid;
       
   919            mng_uint8         iMethodX;
       
   920            mng_uint16        iMX;
       
   921            mng_uint16        iMY;
       
   922            mng_uint16        iML;
       
   923            mng_uint16        iMR;
       
   924            mng_uint16        iMT;
       
   925            mng_uint16        iMB;
       
   926            mng_uint8         iMethodY;
       
   927         } mng_magn;
       
   928 typedef mng_magn * mng_magnp;
       
   929 
       
   930 /* ************************************************************************** */
       
   931 
       
   932 typedef struct {                       /* evNT entry */
       
   933            mng_uint8         iEventtype;
       
   934            mng_uint8         iMasktype;
       
   935            mng_int32         iLeft;
       
   936            mng_int32         iRight;
       
   937            mng_int32         iTop;
       
   938            mng_int32         iBottom;
       
   939            mng_uint16        iObjectid;
       
   940            mng_uint8         iIndex;
       
   941            mng_uint32        iSegmentnamesize;
       
   942            mng_pchar         zSegmentname;
       
   943         } mng_evnt_entry;
       
   944 typedef mng_evnt_entry * mng_evnt_entryp;
       
   945 
       
   946 typedef struct {                       /* evNT */
       
   947            mng_chunk_header  sHeader;
       
   948            mng_uint32        iCount;
       
   949            mng_evnt_entryp   pEntries;
       
   950         } mng_evnt;
       
   951 typedef mng_evnt * mng_evntp;
       
   952 
       
   953 /* ************************************************************************** */
       
   954 
       
   955 #ifdef MNG_INCLUDE_MPNG_PROPOSAL
       
   956 typedef struct {                       /* mpNG frame */
       
   957            mng_uint32        iX;
       
   958            mng_uint32        iY;
       
   959            mng_uint32        iWidth;
       
   960            mng_uint32        iHeight;
       
   961            mng_int32         iXoffset;
       
   962            mng_int32         iYoffset;
       
   963            mng_uint16        iTicks;
       
   964         } mng_mpng_frame;
       
   965 typedef mng_mpng_frame * mng_mpng_framep;
       
   966 
       
   967 typedef struct {                       /* mpNG */
       
   968            mng_chunk_header  sHeader;
       
   969            mng_uint32        iFramewidth;
       
   970            mng_uint32        iFrameheight;
       
   971            mng_uint16        iNumplays;
       
   972            mng_uint16        iTickspersec;
       
   973            mng_uint8         iCompressionmethod;
       
   974            mng_uint32        iFramessize;
       
   975            mng_mpng_framep   pFrames;
       
   976         } mng_mpng;
       
   977 typedef mng_mpng * mng_mpngp;
       
   978 #endif
       
   979 
       
   980 /* ************************************************************************** */
       
   981 
       
   982 #ifdef MNG_INCLUDE_ANG_PROPOSAL
       
   983 typedef struct {                       /* ahDR */
       
   984            mng_chunk_header  sHeader;
       
   985            mng_uint32        iNumframes;
       
   986            mng_uint32        iTickspersec;
       
   987            mng_uint32        iNumplays;
       
   988            mng_uint32        iTilewidth;
       
   989            mng_uint32        iTileheight;
       
   990            mng_uint8         iInterlace;
       
   991            mng_uint8         iStillused;
       
   992         } mng_ahdr;
       
   993 typedef mng_ahdr * mng_ahdrp;
       
   994 
       
   995 typedef struct {                       /* adAT tile */
       
   996            mng_uint32        iTicks;
       
   997            mng_int32         iXoffset;
       
   998            mng_int32         iYoffset;
       
   999            mng_uint8         iTilesource;
       
  1000         } mng_adat_tile;
       
  1001 typedef mng_adat_tile * mng_adat_tilep;
       
  1002 
       
  1003 typedef struct {                       /* adAT */
       
  1004            mng_chunk_header  sHeader;
       
  1005            mng_uint32        iTilessize;
       
  1006            mng_adat_tilep    pTiles;
       
  1007         } mng_adat;
       
  1008 typedef mng_adat * mng_adatp;
       
  1009 #endif
       
  1010 
       
  1011 /* ************************************************************************** */
       
  1012 
       
  1013 typedef struct {                       /* unknown chunk */
       
  1014            mng_chunk_header  sHeader;
       
  1015            mng_uint32        iDatasize;
       
  1016            mng_ptr           pData;
       
  1017         } mng_unknown_chunk;
       
  1018 typedef mng_unknown_chunk * mng_unknown_chunkp;
       
  1019 
       
  1020 /* ************************************************************************** */
       
  1021 
       
  1022 #endif /* _libmng_chunks_h_ */
       
  1023 
       
  1024 /* ************************************************************************** */
       
  1025 /* * end of file                                                            * */
       
  1026 /* ************************************************************************** */