Eneboo - Documentación para desarrolladores
src/qt/src/3rdparty/libmng/libmng_data.h
Ir a la documentación de este archivo.
00001 /* ************************************************************************** */
00002 /* *             For conditions of distribution and use,                    * */
00003 /* *                see copyright notice in libmng.h                        * */
00004 /* ************************************************************************** */
00005 /* *                                                                        * */
00006 /* * project   : libmng                                                     * */
00007 /* * file      : libmng_data.h             copyright (c) 2000 G.Juyn        * */
00008 /* * version   : 1.0.2                                                      * */
00009 /* *                                                                        * */
00010 /* * purpose   : main data structure definition                             * */
00011 /* *                                                                        * */
00012 /* * author    : G.Juyn                                                     * */
00013 /* * web       : http://www.3-t.com                                         * */
00014 /* * email     : mailto:info@3-t.com                                        * */
00015 /* *                                                                        * */
00016 /* * comment   : Definition of the library main data structure              * */
00017 /* *                                                                        * */
00018 /* * changes   : 0.5.1 - 05/04/2000 - G.Juyn                                * */
00019 /* *             - added CRC table to main structure (for thread-safety)    * */
00020 /* *             0.5.1 - 05/06/2000 - G.Juyn                                * */
00021 /* *             - added iPLTEentries for checking hIST-length              * */
00022 /* *             0.5.1 - 05/08/2000 - G.Juyn                                * */
00023 /* *             - changed palette definition to exported palette-type      * */
00024 /* *             - removed frozen indicator                                 * */
00025 /* *             - added create/write indicators                            * */
00026 /* *             - changed strict-ANSI stuff                                * */
00027 /* *             0.5.1 - 05/13/2000 - G.Juyn                                * */
00028 /* *             - added eMNGma hack (will be removed in 1.0.0 !!!)         * */
00029 /* *             - added TERM animation object pointer (easier reference)   * */
00030 /* *             - added saved-data structure for SAVE/SEEK processing      * */
00031 /* *                                                                        * */
00032 /* *             0.5.2 - 05/18/2000 - G.Juyn                                * */
00033 /* *             - added fields for JNG support (IJG-based)                 * */
00034 /* *             0.5.2 - 05/24/2000 - G.Juyn                                * */
00035 /* *             - changed global tRNS definition                           * */
00036 /* *             0.5.2 - 05/30/2000 - G.Juyn                                * */
00037 /* *             - added delta-image fields                                 * */
00038 /* *             0.5.2 - 06/01/2000 - G.Juyn                                * */
00039 /* *             - added internal delta-image processing callbacks          * */
00040 /* *             0.5.2 - 06/02/2000 - G.Juyn                                * */
00041 /* *             - changed SWAP_ENDIAN to BIGENDIAN_SUPPORTED               * */
00042 /* *               (contributed by Tim Rowley)                              * */
00043 /* *             - added getalphaline callback for RGB8_A8 canvasstyle      * */
00044 /* *             0.5.2 - 06/06/2000 - G.Juyn                                * */
00045 /* *             - added parameter for delayed buffer-processing            * */
00046 /* *                                                                        * */
00047 /* *             0.5.3 - 06/16/2000 - G.Juyn                                * */
00048 /* *             - added update-region parms for refresh calback            * */
00049 /* *             - added Needrefresh parameter                              * */
00050 /* *             0.5.3 - 06/17/2000 - G.Juyn                                * */
00051 /* *             - added Deltaimmediate parm for faster delta-processing    * */
00052 /* *             0.5.3 - 06/21/2000 - G.Juyn                                * */
00053 /* *             - added Speed parameter to facilitate testing              * */
00054 /* *             - added Imagelevel parameter for processtext callback      * */
00055 /* *             0.5.3 - 06/26/2000 - G.Juyn                                * */
00056 /* *             - changed userdata variable to mng_ptr                     * */
00057 /* *                                                                        * */
00058 /* *             0.9.1 - 07/07/2000 - G.Juyn                                * */
00059 /* *             - added variables for go_xxxx processing                   * */
00060 /* *             0.9.1 - 07/08/2000 - G.Juyn                                * */
00061 /* *             - added variables for improved timing support              * */
00062 /* *             0.9.1 - 07/15/2000 - G.Juyn                                * */
00063 /* *             - added callbacks for SAVE/SEEK processing                 * */
00064 /* *             - added variable for NEEDSECTIONWAIT breaks                * */
00065 /* *             - added variable for freeze & reset processing             * */
00066 /* *             0.9.1 - 07/17/2000 - G.Juyn                                * */
00067 /* *             - fixed suspension-buffering for 32K+ chunks               * */
00068 /* *                                                                        * */
00069 /* *             0.9.2 - 07/29/2000 - G.Juyn                                * */
00070 /* *             - removed Nextbackxxx fields (no longer used)              * */
00071 /* *             0.9.2 - 07/31/2000 - G.Juyn                                * */
00072 /* *             - fixed wrapping of suspension parameters                  * */
00073 /* *             0.9.2 - 08/04/2000 - G.Juyn                                * */
00074 /* *             - B111096 - fixed large-buffer read-suspension             * */
00075 /* *             0.9.2 - 08/05/2000 - G.Juyn                                * */
00076 /* *             - changed file-prefixes                                    * */
00077 /* *                                                                        * */
00078 /* *             0.9.3 - 08/26/2000 - G.Juyn                                * */
00079 /* *             - added MAGN chunk                                         * */
00080 /* *             0.9.3 - 09/07/2000 - G.Juyn                                * */
00081 /* *             - added support for new filter_types                       * */
00082 /* *             0.9.3 - 09/10/2000 - G.Juyn                                * */
00083 /* *             - fixed DEFI behavior                                      * */
00084 /* *             0.9.3 - 10/10/2000 - G.Juyn                                * */
00085 /* *             - added support for alpha-depth prediction                 * */
00086 /* *             0.9.3 - 10/11/2000 - G.Juyn                                * */
00087 /* *             - added support for nEED                                   * */
00088 /* *             0.9.3 - 10/16/2000 - G.Juyn                                * */
00089 /* *             - added optional support for bKGD for PNG images           * */
00090 /* *             - added support for JDAA                                   * */
00091 /* *             0.9.3 - 10/17/2000 - G.Juyn                                * */
00092 /* *             - added callback to process non-critical unknown chunks    * */
00093 /* *             - fixed support for bKGD                                   * */
00094 /* *             0.9.3 - 10/19/2000 - G.Juyn                                * */
00095 /* *             - implemented delayed delta-processing                     * */
00096 /* *             0.9.4 - 12/16/2000 - G.Juyn                                * */
00097 /* *             - fixed mixup of data- & function-pointers (thanks Dimitri)* */
00098 /* *                                                                        * */
00099 /* *             1.0.1 - 02/08/2001 - G.Juyn                                * */
00100 /* *             - added MEND processing callback                           * */
00101 /* *             1.0.1 - 02/13/2001 - G.Juyn                                * */
00102 /* *             - fixed first FRAM_MODE=4 timing problem                   * */
00103 /* *                                                                        * */
00104 /* *             1.0.2 - 06/23/2001 - G.Juyn                                * */
00105 /* *             - added optimization option for MNG-video playback         * */
00106 /* *             - added processterm callback                               * */
00107 /* *             1.0.2 - 06/25/2001 - G.Juyn                                * */
00108 /* *             - added option to turn off progressive refresh             * */
00109 /* *                                                                        * */
00110 /* ************************************************************************** */
00111 
00112 #if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
00113 #pragma option -A                      /* force ANSI-C */
00114 #endif
00115 
00116 #ifndef _libmng_data_h_
00117 #define _libmng_data_h_
00118 
00119 /* ************************************************************************** */
00120 
00121 #define MNG_MAGIC 0x52530a0aL
00122 
00123 /* ************************************************************************** */
00124 /* *                                                                        * */
00125 /* * Internal structures                                                    * */
00126 /* *                                                                        * */
00127 /* ************************************************************************** */
00128 
00129 typedef mng_palette8 mng_rgbpaltab;
00130 
00131 /* ************************************************************************** */
00132 /* *                                                                        * */
00133 /* * The saved_data structure                                               * */
00134 /* *                                                                        * */
00135 /* * This contains the saved data after a SAVE chunk has been processed.    * */
00136 /* * The data is saved from the main data structure during SAVE processing, * */
00137 /* * and restored to the main data structure during SEEK processing.        * */
00138 /* *                                                                        * */
00139 /* ************************************************************************** */
00140 
00141 typedef struct mng_savedata_struct {
00142 
00143 #if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
00144            mng_bool          bHasglobalPLTE;     /* global PLTE chunk processed */
00145            mng_bool          bHasglobalTRNS;     /* global tRNS chunk processed */
00146            mng_bool          bHasglobalGAMA;     /* global gAMA chunk processed */
00147            mng_bool          bHasglobalCHRM;     /* global cHRM chunk processed */
00148            mng_bool          bHasglobalSRGB;     /* global sRGB chunk processed */
00149            mng_bool          bHasglobalICCP;     /* global iCCP chunk processed */
00150            mng_bool          bHasglobalBKGD;     /* global bKGD chunk processed */
00151 #endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */
00152 
00153 #ifdef MNG_SUPPORT_DISPLAY
00154            mng_uint16        iBACKred;           /* BACK fields */
00155            mng_uint16        iBACKgreen;
00156            mng_uint16        iBACKblue;
00157            mng_uint8         iBACKmandatory;
00158            mng_uint16        iBACKimageid;
00159            mng_uint8         iBACKtile;
00160 
00161            mng_uint8         iFRAMmode;          /* FRAM fields (global) */
00162            mng_uint32        iFRAMdelay;
00163            mng_uint32        iFRAMtimeout;
00164            mng_bool          bFRAMclipping;
00165            mng_int32         iFRAMclipl;
00166            mng_int32         iFRAMclipr;
00167            mng_int32         iFRAMclipt;
00168            mng_int32         iFRAMclipb;
00169 
00170            mng_uint32        iGlobalPLTEcount;   /* global PLTE fields */
00171            mng_rgbpaltab     aGlobalPLTEentries;
00172 
00173            mng_uint32        iGlobalTRNSrawlen;  /* global tRNS fields */
00174            mng_uint8arr      aGlobalTRNSrawdata;
00175 
00176            mng_uint32        iGlobalGamma;       /* global gAMA fields */
00177 
00178            mng_uint32        iGlobalWhitepointx; /* global cHRM fields */
00179            mng_uint32        iGlobalWhitepointy;
00180            mng_uint32        iGlobalPrimaryredx;
00181            mng_uint32        iGlobalPrimaryredy;
00182            mng_uint32        iGlobalPrimarygreenx;
00183            mng_uint32        iGlobalPrimarygreeny;
00184            mng_uint32        iGlobalPrimarybluex;
00185            mng_uint32        iGlobalPrimarybluey;
00186 
00187            mng_uint8         iGlobalRendintent;  /* global sRGB fields */
00188 
00189            mng_uint32        iGlobalProfilesize; /* global iCCP fields */
00190            mng_ptr           pGlobalProfile;
00191 
00192            mng_uint16        iGlobalBKGDred;     /* global bKGD fields */
00193            mng_uint16        iGlobalBKGDgreen;
00194            mng_uint16        iGlobalBKGDblue;
00195 #endif /* MNG_SUPPORT_DISPLAY */
00196 
00197         } mng_savedata;
00198 
00199 typedef mng_savedata * mng_savedatap;
00200 
00201 /* ************************************************************************** */
00202 /* *                                                                        * */
00203 /* * The main libmng data structure                                         * */
00204 /* *                                                                        * */
00205 /* * The handle used in all functions points to this structure which        * */
00206 /* * contains all volatile data necessary to process the network graphic.   * */
00207 /* *                                                                        * */
00208 /* ************************************************************************** */
00209 
00210 typedef struct mng_data_struct {
00211 
00212            mng_uint32        iMagic;             /* magic number to validate
00213                                                     a given handle */     
00214            mng_ptr           pUserdata;          /* application workdata */
00215 
00216            mng_imgtype       eSigtype;           /* image information */
00217            mng_imgtype       eImagetype;         /* initially zeroed */
00218            mng_uint32        iWidth;             /* filled after header is processed */
00219            mng_uint32        iHeight;
00220            mng_uint32        iTicks;             /* these only after MHDR */
00221            mng_uint32        iLayercount;
00222            mng_uint32        iFramecount;
00223            mng_uint32        iPlaytime;
00224            mng_uint32        iSimplicity;
00225            mng_uint8         iAlphadepth;        /* indicates expected alpha-depth */
00226 
00227            mng_uint32        iImagelevel;        /* level an image inside a stream */
00228 
00229            mng_uint32        iCanvasstyle;       /* layout of the drawing-canvas */
00230            mng_uint32        iBkgdstyle;         /* layout of the background-canvas */
00231 
00232            mng_int8          iMagnify;           /* magnification factor (not used yet) */
00233            mng_uint32        iOffsetx;           /* x-offset for extremely large image */
00234            mng_uint32        iOffsety;           /* y-offset for extremely large image */
00235            mng_uint32        iCanvaswidth;       /* real canvas size */
00236            mng_uint32        iCanvasheight;      /* must be set by processheader callback */
00237 
00238            mng_uint16        iBGred;             /* default background color */
00239            mng_uint16        iBGgreen;           /* initially "black" */
00240            mng_uint16        iBGblue;
00241            mng_bool          bUseBKGD;           /* preferred use of bKGD for PNG */
00242 
00243            mng_bool          bIssRGB;            /* indicates sRGB system */
00244 
00245 #ifdef MNG_FULL_CMS                              /* little CMS variables */
00246            mng_cmsprof       hProf1;             /* image input profile */
00247            mng_cmsprof       hProf2;             /* default output profile */
00248            mng_cmsprof       hProf3;             /* default sRGB profile */
00249            mng_cmstrans      hTrans;             /* current transformation handle */
00250 #endif
00251 
00252            mng_float         dViewgamma;         /* gamma calculation variables */
00253            mng_float         dDisplaygamma;      /* initially set for sRGB conditions */
00254            mng_float         dDfltimggamma;
00255 
00256            mng_bool          bStorechunks;       /* switch for storing chunkdata */
00257            mng_bool          bSectionbreaks;     /* indicate NEEDSECTIONWAIT breaks */
00258            mng_bool          bCacheplayback;     /* switch to cache playback info */
00259            mng_bool          bDoProgressive;     /* progressive refresh for large images */ 
00260 
00261            mng_speedtype     iSpeed;             /* speed-modifier for animations */
00262 
00263            mng_uint32        iMaxwidth;          /* maximum canvas size */
00264            mng_uint32        iMaxheight;         /* initially set to 1024 x 1024 */
00265 
00266            mng_int32         iErrorcode;         /* error reporting fields */
00267            mng_int8          iSeverity;
00268            mng_int32         iErrorx1;
00269            mng_int32         iErrorx2;
00270            mng_pchar         zErrortext;
00271 
00272            mng_memalloc      fMemalloc;          /* callback pointers */
00273            mng_memfree       fMemfree;           /* initially nulled */
00274            mng_openstream    fOpenstream;
00275            mng_closestream   fClosestream;
00276            mng_readdata      fReaddata;
00277            mng_writedata     fWritedata;
00278            mng_errorproc     fErrorproc;
00279            mng_traceproc     fTraceproc;
00280            mng_processheader fProcessheader;
00281            mng_processtext   fProcesstext;
00282            mng_processsave   fProcesssave;
00283            mng_processseek   fProcessseek;
00284            mng_processneed   fProcessneed;
00285            mng_processmend   fProcessmend;
00286            mng_processunknown fProcessunknown;
00287            mng_processterm   fProcessterm;
00288            mng_getcanvasline fGetcanvasline;
00289            mng_getbkgdline   fGetbkgdline;
00290            mng_getalphaline  fGetalphaline;
00291            mng_refresh       fRefresh;
00292            mng_gettickcount  fGettickcount;
00293            mng_settimer      fSettimer;
00294            mng_processgamma  fProcessgamma;
00295            mng_processchroma fProcesschroma;
00296            mng_processsrgb   fProcesssrgb;
00297            mng_processiccp   fProcessiccp;
00298            mng_processarow   fProcessarow;
00299 
00300 #if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
00301            mng_bool          bPreDraft48;        /* flags ancient style draft */
00302 
00303            mng_chunkid       iChunkname;         /* read/write-state variables */
00304            mng_uint32        iChunkseq;
00305            mng_chunkp        pFirstchunk;        /* double-linked list of */
00306            mng_chunkp        pLastchunk;         /* stored chunk-structures */
00307 
00308            mng_bool          bHasheader;         /* first header chunk processed */
00309            mng_bool          bHasMHDR;           /* inside a MHDR-MEND sequence */
00310            mng_bool          bHasIHDR;           /* inside a IHDR-IEND sequence */
00311            mng_bool          bHasBASI;           /* inside a BASI-IEND sequence */
00312            mng_bool          bHasDHDR;           /* inside a DHDR-IEND sequence */
00313 #ifdef MNG_INCLUDE_JNG
00314            mng_bool          bHasJHDR;           /* inside a JHDR-IEND sequence */
00315            mng_bool          bHasJSEP;           /* passed the JSEP separator */
00316            mng_bool          bHasJDAA;           /* at least 1 JDAA processed */
00317            mng_bool          bHasJDAT;           /* at least 1 JDAT processed */
00318 #endif
00319            mng_bool          bHasPLTE;           /* PLTE chunk processed */
00320            mng_bool          bHasTRNS;           /* tRNS chunk processed */
00321            mng_bool          bHasGAMA;           /* gAMA chunk processed */
00322            mng_bool          bHasCHRM;           /* cHRM chunk processed */
00323            mng_bool          bHasSRGB;           /* sRGB chunk processed */
00324            mng_bool          bHasICCP;           /* iCCP chunk processed */
00325            mng_bool          bHasBKGD;           /* bKGD chunk processed */
00326            mng_bool          bHasIDAT;           /* at least 1 IDAT processed */
00327            
00328            mng_bool          bHasSAVE;           /* SAVE chunk processed */
00329            mng_bool          bHasBACK;           /* BACK chunk processed */
00330            mng_bool          bHasFRAM;           /* FRAM chunk processed */
00331            mng_bool          bHasTERM;           /* TERM chunk processed */
00332            mng_bool          bHasLOOP;           /* at least 1 LOOP open */
00333 
00334            mng_bool          bHasglobalPLTE;     /* global PLTE chunk processed */
00335            mng_bool          bHasglobalTRNS;     /* global tRNS chunk processed */
00336            mng_bool          bHasglobalGAMA;     /* global gAMA chunk processed */
00337            mng_bool          bHasglobalCHRM;     /* global cHRM chunk processed */
00338            mng_bool          bHasglobalSRGB;     /* global sRGB chunk processed */
00339            mng_bool          bHasglobalICCP;     /* global iCCP chunk processed */
00340            mng_bool          bHasglobalBKGD;     /* global bKGD chunk processed */
00341 
00342            mng_uint32        iDatawidth;         /* IHDR/BASI/DHDR fields */
00343            mng_uint32        iDataheight;        /* valid if inside IHDR-IEND, */
00344            mng_uint8         iBitdepth;          /* BASI-IEND or DHDR-IEND */
00345            mng_uint8         iColortype;
00346            mng_uint8         iCompression;
00347            mng_uint8         iFilter;
00348            mng_uint8         iInterlace;
00349 
00350            mng_uint32        iPLTEcount;         /* PLTE fields */
00351 
00352            mng_bool          bEMNGMAhack;        /* TODO: to be removed in 1.0.0 !!! */
00353 
00354 #ifdef MNG_INCLUDE_JNG
00355            mng_uint8         iJHDRcolortype;     /* JHDR fields */
00356            mng_uint8         iJHDRimgbitdepth;   /* valid if inside JHDR-IEND */
00357            mng_uint8         iJHDRimgcompression;
00358            mng_uint8         iJHDRimginterlace;
00359            mng_uint8         iJHDRalphabitdepth;
00360            mng_uint8         iJHDRalphacompression;
00361            mng_uint8         iJHDRalphafilter;
00362            mng_uint8         iJHDRalphainterlace;
00363 #endif
00364 
00365 #endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */
00366 
00367 #ifdef MNG_SUPPORT_READ
00368            mng_bool          bReading;           /* read processing variables */
00369            mng_bool          bHavesig;
00370            mng_bool          bEOF;
00371            mng_uint32        iReadbufsize;
00372            mng_uint8p        pReadbuf;
00373 
00374            mng_uint32        iLargebufsize;      /* temp for very large chunks */
00375            mng_uint8p        pLargebuf;
00376 
00377            mng_uint32        iSuspendtime;       /* tickcount at last suspension */
00378            mng_bool          bSuspended;         /* input-reading has been suspended;
00379                                                     we're expecting a call to
00380                                                     mng_read_resume! */
00381            mng_uint8         iSuspendpoint;      /* indicates at which point the flow
00382                                                     was broken to suspend input-reading */
00383                                                     
00384            mng_bool          bSuspensionmode;    /* I/O-suspension variables */
00385            mng_uint32        iSuspendbufsize;
00386            mng_uint8p        pSuspendbuf;
00387            mng_uint8p        pSuspendbufnext;
00388            mng_uint32        iSuspendbufleft;
00389            mng_uint32        iChunklen;          /* chunk length */
00390            mng_uint8p        pReadbufnext;       /* 32K+ suspension-processing */
00391 #endif /* MNG_SUPPORT_READ */
00392 
00393 #ifdef MNG_SUPPORT_WRITE
00394            mng_bool          bCreating;          /* create/write processing variables */
00395            mng_bool          bWriting;
00396            mng_chunkid       iFirstchunkadded;           
00397            mng_uint32        iWritebufsize;
00398            mng_uint8p        pWritebuf;
00399 #endif
00400 
00401 #ifdef MNG_SUPPORT_DISPLAY
00402            mng_bool          bDisplaying;        /* display-state variables */
00403            mng_bool          bFramedone;
00404            mng_uint32        iFrameseq;
00405            mng_uint32        iLayerseq;
00406            mng_uint32        iFrametime;         /* millisecs */
00407 
00408            mng_uint32        iRequestframe;      /* go_xxxx variables */
00409            mng_uint32        iRequestlayer;
00410            mng_uint32        iRequesttime;
00411            mng_bool          bSearching;
00412 
00413            mng_bool          bRestorebkgd;       /* flags restore required before IDAT/JDAT */
00414 
00415            mng_uint32        iRuntime;           /* millisecs since start */
00416            mng_uint32        iSynctime;          /* tickcount at last framesync */
00417            mng_uint32        iStarttime;         /* tickcount at start */
00418            mng_uint32        iEndtime;           /* tickcount at end */
00419            mng_bool          bRunning;           /* animation is active */
00420            mng_bool          bTimerset;          /* the timer has been set;
00421                                                     we're expecting a call to
00422                                                     mng_display_resume! */
00423            mng_uint8         iBreakpoint;        /* indicates at which point the
00424                                                     flow was broken to run the timer */
00425            mng_bool          bSectionwait;       /* indicates a section break */
00426            mng_bool          bFreezing;          /* indicates app requested a freeze */   
00427            mng_bool          bResetting;         /* indicates app requested a reset */   
00428            mng_bool          bNeedrefresh;       /* indicates screen-refresh is needed */
00429            mng_objectp       pCurrentobj;        /* current "object" */
00430            mng_objectp       pCurraniobj;        /* current animation object
00431                                                     "to be"/"being" processed */
00432            mng_objectp       pTermaniobj;        /* TERM animation object */
00433            mng_uint32        iIterations;        /* TERM/MEND iteration count */
00434            mng_objectp       pObjzero;           /* "on-the-fly" image (object = 0) */
00435            mng_objectp       pLastclone;         /* last clone */
00436            mng_objectp       pStoreobj;          /* current store object for row routines */
00437            mng_objectp       pStorebuf;          /* current store object-buffer for row routines */
00438            mng_objectp       pRetrieveobj;       /* current retrieve object for row routines */
00439            mng_savedatap     pSavedata;          /* pointer to saved data (after SAVE) */
00440 
00441            mng_uint32        iUpdateleft;        /* update region for refresh */
00442            mng_uint32        iUpdateright;
00443            mng_uint32        iUpdatetop;
00444            mng_uint32        iUpdatebottom;
00445 
00446            mng_int8          iPass;              /* current interlacing pass;
00447                                                     negative value means no interlace */
00448            mng_int32         iRow;               /* current row counter */
00449            mng_int32         iRowinc;            /* row increment for this pass */
00450            mng_int32         iCol;               /* current starting column */
00451            mng_int32         iColinc;            /* column increment for this pass */
00452            mng_int32         iRowsamples;        /* nr. of samples in current workrow */
00453            mng_int32         iSamplemul;         /* needed to calculate rowsize */
00454            mng_int32         iSampleofs;            /* from rowsamples */
00455            mng_int32         iSamplediv;
00456            mng_int32         iRowsize;           /* size of actual data in work row */
00457            mng_int32         iRowmax;            /* maximum size of data in work row */
00458            mng_int32         iFilterofs;         /* offset to filter-byte in work row */
00459            mng_int32         iPixelofs;          /* offset to pixel-bytes in work row */
00460            mng_uint32        iLevel0;            /* leveling variables */
00461            mng_uint32        iLevel1;
00462            mng_uint32        iLevel2;
00463            mng_uint32        iLevel3;
00464            mng_uint8p        pWorkrow;           /* working row of pixel-data */
00465            mng_uint8p        pPrevrow;           /* previous row of pixel-data */
00466            mng_uint8p        pRGBArow;           /* intermediate row of RGBA8 or RGBA16 data */
00467            mng_bool          bIsRGBA16;          /* indicates intermediate row is RGBA16 */
00468            mng_bool          bIsOpaque;          /* indicates intermediate row is fully opaque */
00469            mng_int32         iFilterbpp;         /* bpp index for filtering routines */
00470 
00471            mng_int32         iSourcel;           /* variables for showing objects */
00472            mng_int32         iSourcer;
00473            mng_int32         iSourcet;
00474            mng_int32         iSourceb;
00475            mng_int32         iDestl;
00476            mng_int32         iDestr;
00477            mng_int32         iDestt;
00478            mng_int32         iDestb;
00479 
00480            mng_objectp       pFirstimgobj;       /* double-linked list of */
00481            mng_objectp       pLastimgobj;        /* image-object structures */
00482            mng_objectp       pFirstaniobj;       /* double-linked list of */
00483            mng_objectp       pLastaniobj;        /* animation-object structures */
00484 
00485 #if defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS)
00486            mng_uint8         aGammatab[256];     /* precomputed gamma lookup table */
00487            mng_float         dLastgamma;         /* last gamma used to compute table */
00488 #endif
00489 
00490            mng_fptr          fDisplayrow;        /* internal callback to display an
00491                                                     uncompressed/unfiltered/
00492                                                     color-corrected row */
00493            mng_fptr          fRestbkgdrow;       /* internal callback for restore-
00494                                                     background processing of a row */
00495            mng_fptr          fCorrectrow;        /* internal callback to color-correct an
00496                                                     uncompressed/unfiltered row */
00497            mng_fptr          fRetrieverow;       /* internal callback to retrieve an
00498                                                     uncompressed/unfiltered row of data */
00499            mng_fptr          fStorerow;          /* internal callback to store an
00500                                                     uncompressed/unfiltered row of data */
00501            mng_fptr          fProcessrow;        /* internal callback to process an
00502                                                     uncompressed row of data */
00503            mng_fptr          fDifferrow;         /* internal callback to perform
00504                                                     added filter leveling and
00505                                                     differing on an unfiltered row */
00506            mng_fptr          fScalerow;          /* internal callback to scale a
00507                                                     delta-row to the bitdepth of its target */
00508            mng_fptr          fDeltarow;          /* internal callback to execute a
00509                                                     delta-row onto a target */
00510            mng_fptr          fInitrowproc;       /* internal callback to initialize
00511                                                     the row processing */
00512 
00513            mng_uint16        iDEFIobjectid;      /* DEFI fields */
00514            mng_bool          bDEFIhasdonotshow;
00515            mng_uint8         iDEFIdonotshow;
00516            mng_bool          bDEFIhasconcrete;
00517            mng_uint8         iDEFIconcrete;
00518            mng_bool          bDEFIhasloca;
00519            mng_int32         iDEFIlocax;
00520            mng_int32         iDEFIlocay;
00521            mng_bool          bDEFIhasclip;
00522            mng_int32         iDEFIclipl;
00523            mng_int32         iDEFIclipr;
00524            mng_int32         iDEFIclipt;
00525            mng_int32         iDEFIclipb;
00526 
00527            mng_uint16        iBACKred;           /* BACK fields */
00528            mng_uint16        iBACKgreen;
00529            mng_uint16        iBACKblue;
00530            mng_uint8         iBACKmandatory;
00531            mng_uint16        iBACKimageid;
00532            mng_uint8         iBACKtile;
00533 
00534            mng_uint8         iFRAMmode;          /* FRAM fields (global) */
00535            mng_uint32        iFRAMdelay;
00536            mng_uint32        iFRAMtimeout;
00537            mng_bool          bFRAMclipping;
00538            mng_int32         iFRAMclipl;
00539            mng_int32         iFRAMclipr;
00540            mng_int32         iFRAMclipt;
00541            mng_int32         iFRAMclipb;
00542 
00543            mng_uint8         iFramemode;         /* current subframe variables */
00544            mng_uint32        iFramedelay;
00545            mng_uint32        iFrametimeout;
00546            mng_bool          bFrameclipping;
00547            mng_int32         iFrameclipl;
00548            mng_int32         iFrameclipr;
00549            mng_int32         iFrameclipt;
00550            mng_int32         iFrameclipb;
00551 
00552            mng_uint32        iNextdelay;         /* delay for *after* next image */
00553 
00554            mng_uint8         iSHOWmode;          /* SAVE fields */
00555            mng_uint16        iSHOWfromid;
00556            mng_uint16        iSHOWtoid;
00557            mng_uint16        iSHOWnextid;
00558            mng_int16         iSHOWskip;
00559 
00560            mng_uint32        iGlobalPLTEcount;   /* global PLTE fields */
00561            mng_rgbpaltab     aGlobalPLTEentries;
00562 
00563            mng_uint32        iGlobalTRNSrawlen;  /* global tRNS fields */
00564            mng_uint8arr      aGlobalTRNSrawdata;
00565 
00566            mng_uint32        iGlobalGamma;       /* global gAMA fields */
00567 
00568            mng_uint32        iGlobalWhitepointx; /* global cHRM fields */
00569            mng_uint32        iGlobalWhitepointy;
00570            mng_uint32        iGlobalPrimaryredx;
00571            mng_uint32        iGlobalPrimaryredy;
00572            mng_uint32        iGlobalPrimarygreenx;
00573            mng_uint32        iGlobalPrimarygreeny;
00574            mng_uint32        iGlobalPrimarybluex;
00575            mng_uint32        iGlobalPrimarybluey;
00576 
00577            mng_uint8         iGlobalRendintent;  /* global sRGB fields */
00578 
00579            mng_uint32        iGlobalProfilesize; /* global iCCP fields */
00580            mng_ptr           pGlobalProfile;
00581 
00582            mng_uint16        iGlobalBKGDred;     /* global bKGD fields */
00583            mng_uint16        iGlobalBKGDgreen;
00584            mng_uint16        iGlobalBKGDblue;
00585 
00586            mng_ptr           pDeltaImage;        /* delta-image fields */
00587            mng_uint8         iDeltaImagetype;
00588            mng_uint8         iDeltatype;
00589            mng_uint32        iDeltaBlockwidth;
00590            mng_uint32        iDeltaBlockheight;
00591            mng_uint32        iDeltaBlockx;
00592            mng_uint32        iDeltaBlocky;
00593            mng_bool          bDeltaimmediate;
00594 
00595            mng_fptr          fDeltagetrow;       /* internal delta-proc callbacks */
00596            mng_fptr          fDeltaaddrow;
00597            mng_fptr          fDeltareplacerow;
00598            mng_fptr          fDeltaputrow;
00599 
00600            mng_uint16        iMAGNfromid;
00601            mng_uint16        iMAGNtoid;
00602 #endif /* MNG_SUPPORT_DISPLAY */
00603 
00604 #ifdef MNG_INCLUDE_ZLIB
00605            z_stream          sZlib;              /* zlib (de)compression variables */
00606 
00607            mng_int32         iZlevel;            /* zlib compression parameters */
00608            mng_int32         iZmethod;
00609            mng_int32         iZwindowbits;
00610            mng_int32         iZmemlevel;
00611            mng_int32         iZstrategy;
00612 
00613            mng_uint32        iMaxIDAT;           /* maximum size of IDAT data */
00614 
00615            mng_bool          bInflating;         /* indicates "inflate" in progress */
00616            mng_bool          bDeflating;         /* indicates "deflate" in progress */
00617 #endif /* MNG_INCLUDE_ZLIB */
00618 
00619 #ifdef MNG_INCLUDE_JNG
00620            mngjpeg_dctmethod eJPEGdctmethod;     /* IJG compression variables */
00621            mng_int32         iJPEGquality;
00622            mng_int32         iJPEGsmoothing;
00623            mng_bool          bJPEGcompressprogr;
00624            mng_bool          bJPEGcompressopt;
00625 
00626            mng_uint32        iMaxJDAT;           /* maximum size of JDAT/JDAA data */
00627 
00628            mngjpeg_compp     pJPEGcinfo;         /* compression structure */
00629            mngjpeg_errorp    pJPEGcerr;          /* error-manager compress */
00630 
00631            mngjpeg_decompp   pJPEGdinfo;         /* decompression structure (JDAT) */
00632            mngjpeg_errorp    pJPEGderr;          /* error-manager decompress (JDAT) */
00633            mngjpeg_sourcep   pJPEGdsrc;          /* source-manager decompress (JDAT) */
00634 
00635            mngjpeg_decompp   pJPEGdinfo2;        /* decompression structure (JDAA) */
00636            mngjpeg_errorp    pJPEGderr2;         /* error-manager decompress (JDAA) */
00637            mngjpeg_sourcep   pJPEGdsrc2;         /* source-manager decompress (JDAA) */
00638 
00639            mng_uint8p        pJPEGbuf;           /* buffer for JPEG (de)compression (JDAT) */
00640            mng_uint32        iJPEGbufmax;        /* allocated space for buffer (JDAT) */
00641            mng_uint8p        pJPEGcurrent;       /* current pointer into buffer (JDAT) */
00642            mng_uint32        iJPEGbufremain;     /* remaining bytes in buffer (JDAT) */
00643            mng_uint32        iJPEGtoskip;        /* bytes to skip on next input-block (JDAT) */
00644 
00645            mng_uint8p        pJPEGbuf2;          /* buffer for JPEG (de)compression (JDAA) */
00646            mng_uint32        iJPEGbufmax2;       /* allocated space for buffer (JDAA) */
00647            mng_uint8p        pJPEGcurrent2;      /* current pointer into buffer (JDAA) */
00648            mng_uint32        iJPEGbufremain2;    /* remaining bytes in buffer (JDAA) */
00649            mng_uint32        iJPEGtoskip2;       /* bytes to skip on next input-block (JDAA) */
00650 
00651            mng_uint8p        pJPEGrow;           /* buffer for a JPEG row of samples (JDAT) */
00652            mng_uint32        iJPEGrowlen;
00653 
00654            mng_uint8p        pJPEGrow2;          /* buffer for a JPEG row of samples (JDAA) */
00655            mng_uint32        iJPEGrowlen2;
00656 
00657            mng_bool          bJPEGcompress;      /* indicates "compress" initialized */
00658 
00659            mng_bool          bJPEGdecompress;    /* indicates "decompress" initialized (JDAT) */
00660            mng_bool          bJPEGhasheader;     /* indicates "readheader" succeeded (JDAT) */
00661            mng_bool          bJPEGdecostarted;   /* indicates "decompress" started (JDAT) */
00662            mng_bool          bJPEGscanstarted;   /* indicates "first scan" started (JDAT) */
00663            mng_bool          bJPEGprogressive;   /* indicates a progressive image (JDAT) */
00664 
00665            mng_bool          bJPEGdecompress2;   /* indicates "decompress" initialized (JDAA) */
00666            mng_bool          bJPEGhasheader2;    /* indicates "readheader" succeeded (JDAA) */
00667            mng_bool          bJPEGdecostarted2;  /* indicates "decompress" started (JDAA) */
00668            mng_bool          bJPEGscanstarted2;  /* indicates "first scan" started (JDAA) */
00669            mng_bool          bJPEGprogressive2;  /* indicates a progressive image (JDAA) */
00670 
00671            mng_fptr          fStorerow2;         /* internal callback to store an
00672                                                     uncompressed/unfiltered row of JPEG-data (JDAT) */
00673 
00674            mng_fptr          fStorerow3;         /* internal callback to store an
00675                                                     uncompressed/unfiltered row of JPEG-data (JDAA) */
00676 
00677            mng_uint32        iJPEGrow;           /* row-number for current JPEG row */
00678            mng_uint32        iJPEGalpharow;      /* nr. of rows filled with alpha */
00679            mng_uint32        iJPEGrgbrow;        /* nr. of rows filled with 'color'-info */
00680            mng_uint32        iJPEGdisprow;       /* nr. of rows already displayed "on-the-fly" */
00681 
00682 #if defined(MNG_USE_SETJMP) && defined (MNG_INCLUDE_IJG6B)
00683            jmp_buf           sErrorbuf;          /* setjmp/longjmp buffer (error-recovery) */
00684 #endif
00685 
00686 #endif /* MNG_INCLUDE_JNG */
00687 
00688            mng_uint32        aCRCtable [256];    /* CRC prefab table */
00689            mng_bool          bCRCcomputed;       /* "has been build" indicator */
00690 
00691         } mng_data;
00692 
00693 typedef mng_data * mng_datap;
00694 
00695 /* ************************************************************************** */
00696 /* *                                                                        * */
00697 /* * Internal Callback-Function prototypes                                  * */
00698 /* *                                                                        * */
00699 /* ************************************************************************** */
00700 
00701 typedef mng_retcode(*mng_displayrow)  (mng_datap  pData);
00702 typedef mng_retcode(*mng_restbkgdrow) (mng_datap  pData);
00703 typedef mng_retcode(*mng_correctrow)  (mng_datap  pData);
00704 typedef mng_retcode(*mng_retrieverow) (mng_datap  pData);
00705 typedef mng_retcode(*mng_storerow)    (mng_datap  pData);
00706 typedef mng_retcode(*mng_processrow)  (mng_datap  pData);
00707 typedef mng_retcode(*mng_initrowproc) (mng_datap  pData);
00708 typedef mng_retcode(*mng_differrow)   (mng_datap  pData);
00709 typedef mng_retcode(*mng_scalerow)    (mng_datap  pData);
00710 typedef mng_retcode(*mng_deltarow)    (mng_datap  pData);
00711 
00712 typedef mng_retcode(*mng_magnify_x)   (mng_datap  pData,
00713                                        mng_uint16 iMX,
00714                                        mng_uint16 iML,
00715                                        mng_uint16 iMR,
00716                                        mng_uint32 iWidth,
00717                                        mng_uint8p iSrcline,
00718                                        mng_uint8p iDstline);
00719 typedef mng_retcode(*mng_magnify_y)   (mng_datap  pData,
00720                                        mng_int32  iM,
00721                                        mng_int32  iS,
00722                                        mng_uint32 iWidth,
00723                                        mng_uint8p iSrcline1,
00724                                        mng_uint8p iSrcline2,
00725                                        mng_uint8p iDstline);
00726 
00727 /* ************************************************************************** */
00728 /* *                                                                        * */
00729 /* * Routines for swapping byte-order from and to graphic files             * */
00730 /* * (This code is adapted from the libpng package)                         * */
00731 /* *                                                                        * */
00732 /* ************************************************************************** */
00733 
00734 #ifndef MNG_BIGENDIAN_SUPPORTED
00735 mng_uint32 mng_get_uint32 (mng_uint8p pBuf);
00736 mng_int32  mng_get_int32  (mng_uint8p pBuf);
00737 mng_uint16 mng_get_uint16 (mng_uint8p pBuf);
00738 void       mng_put_uint32 (mng_uint8p pBuf,
00739                            mng_uint32 i);
00740 void       mng_put_int32  (mng_uint8p pBuf,
00741                            mng_int32  i);
00742 void       mng_put_uint16 (mng_uint8p pBuf,
00743                            mng_uint16 i);
00744 #else /* MNG_BIGENDIAN_SUPPORTED */
00745 #define mng_get_uint32(P)   *(mng_uint32p)(P)
00746 #define mng_get_int32(P)    *(mng_int32p)(P)
00747 #define mng_get_uint16(P)   *(mng_uint16p)(P)
00748 #define mng_put_uint32(P,I) *(mng_uint32p)(P) = (I)
00749 #define mng_put_int32(P,I)  *(mng_int32p)(P) = (I)
00750 #define mng_put_uint16(P,I) *(mng_uint16p)(P) = (I)
00751 #endif /* MNG_BIGENDIAN_SUPPORTED */
00752 
00753 /* ************************************************************************** */
00754 /* *                                                                        * */
00755 /* * Some handy(?) macro definitions                                        * */
00756 /* *                                                                        * */
00757 /* ************************************************************************** */
00758 
00759 #define MAX_COORD(a, b)  (((a) > (b)) ? (a) : (b))
00760 #define MIN_COORD(a, b)  (((a) < (b)) ? (a) : (b))
00761 
00762 /* ************************************************************************** */
00763 
00764 #endif /* _libmng_data_h_ */
00765 
00766 /* ************************************************************************** */
00767 /* * end of file                                                            * */
00768 /* ************************************************************************** */
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'