~ubuntu-branches/ubuntu/oneiric/libmng/oneiric

« back to all changes in this revision

Viewing changes to libmng_data.h

  • Committer: Bazaar Package Importer
  • Author(s): Shiju p. Nair
  • Date: 2004-09-27 10:29:48 UTC
  • mfrom: (0.2.1 upstream) (1.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040927102948-k2hbz9ywsf6d3fy3
Tags: 1.0.8-1
* New upstream release (closes: #250106).
* Removed unwanted dependencies (closes: #256526, #218469)

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
/* ************************************************************************** */
5
5
/* *                                                                        * */
6
6
/* * project   : libmng                                                     * */
7
 
/* * file      : libmng_data.h             copyright (c) 2000 G.Juyn        * */
8
 
/* * version   : 1.0.2                                                      * */
 
7
/* * file      : libmng_data.h             copyright (c) 2000-2004 G.Juyn   * */
 
8
/* * version   : 1.0.8                                                      * */
9
9
/* *                                                                        * */
10
10
/* * purpose   : main data structure definition                             * */
11
11
/* *                                                                        * */
12
12
/* * author    : G.Juyn                                                     * */
13
 
/* * web       : http://www.3-t.com                                         * */
14
 
/* * email     : mailto:info@3-t.com                                        * */
15
13
/* *                                                                        * */
16
14
/* * comment   : Definition of the library main data structure              * */
17
15
/* *                                                                        * */
107
105
/* *             1.0.2 - 06/25/2001 - G.Juyn                                * */
108
106
/* *             - added option to turn off progressive refresh             * */
109
107
/* *                                                                        * */
 
108
/* *             1.0.5 - 07/08/2002 - G.Juyn                                * */
 
109
/* *             - B578572 - removed eMNGma hack (thanks Dimitri!)          * */
 
110
/* *             1.0.5 - 07/16/2002 - G.Juyn                                * */
 
111
/* *             - B581625 - large chunks fail with suspension reads        * */
 
112
/* *             1.0.5 - 08/15/2002 - G.Juyn                                * */
 
113
/* *             - completed PROM support                                   * */
 
114
/* *             1.0.5 - 09/15/2002 - G.Juyn                                * */
 
115
/* *             - fixed LOOP iteration=0 special case                      * */
 
116
/* *             1.0.5 - 09/20/2002 - G.Juyn                                * */
 
117
/* *             - finished support for BACK image & tiling                 * */
 
118
/* *             1.0.5 - 10/07/2002 - G.Juyn                                * */
 
119
/* *             - added another fix for misplaced TERM chunk               * */
 
120
/* *             - completed support for condition=2 in TERM chunk          * */
 
121
/* *             1.0.5 - 10/20/2002 - G.Juyn                                * */
 
122
/* *             - fixed processing for multiple objects in MAGN            * */
 
123
/* *             - fixed display of visible target of PAST operation        * */
 
124
/* *             1.0.5 - 11/07/2002 - G.Juyn                                * */
 
125
/* *             - added support to get totals after mng_read()             * */
 
126
/* *             1.0.5 - 24/02/2003 - G.Juyn                                * */
 
127
/* *             - B683152 - libjpeg suspension not always honored correctly* */
 
128
/* *                                                                        * */
 
129
/* *             1.0.6 - 04/11/2003 - G.Juyn                                * */
 
130
/* *             - B719420 - fixed several MNG_APP_CMS problems             * */
 
131
/* *             1.0.6 - 07/05/2003 - G. R-P                                * */
 
132
/* *             - optionally use zlib's crc32() function                   * */
 
133
/* *             1.0.6 - 07/29/2003 - G.R-P                                 * */
 
134
/* *             - added SKIPCHUNK conditionals around PAST chunk support   * */
 
135
/* *             1.0.6 - 08/17/2003 - G.R-P                                 * */
 
136
/* *             - added iPNGdepth member to pData structure                * */
 
137
/* *                                                                        * */
 
138
/* *             1.0.7 - 03/10/2004 - G.R-P                                 * */
 
139
/* *             - added conditionals around openstream/closestream         * */
 
140
/* *             1.0.7 - 03/24/2004 - G.R-P                                 * */
 
141
/* *             - added more SKIPCHUNK conditionals                        * */
 
142
/* *                                                                        * */
 
143
/* *             1.0.8 - 04/02/2004 - G.Juyn                                * */
 
144
/* *             - added CRC existence & checking flags                     * */
 
145
/* *             1.0.8 - 04/10/2004 - G.Juyn                                * */
 
146
/* *             - added data-push mechanisms for specialized decoders      * */
 
147
/* *                                                                        * */
110
148
/* ************************************************************************** */
111
149
 
112
150
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
175
213
 
176
214
           mng_uint32        iGlobalGamma;       /* global gAMA fields */
177
215
 
 
216
#ifndef MNG_SKIPCHUNK_cHRM
178
217
           mng_uint32        iGlobalWhitepointx; /* global cHRM fields */
179
218
           mng_uint32        iGlobalWhitepointy;
180
219
           mng_uint32        iGlobalPrimaryredx;
183
222
           mng_uint32        iGlobalPrimarygreeny;
184
223
           mng_uint32        iGlobalPrimarybluex;
185
224
           mng_uint32        iGlobalPrimarybluey;
 
225
#endif
186
226
 
187
227
           mng_uint8         iGlobalRendintent;  /* global sRGB fields */
188
228
 
200
240
 
201
241
/* ************************************************************************** */
202
242
/* *                                                                        * */
 
243
/* * Internal buffer structure for data push mechanisms                     * */
 
244
/* *                                                                        * */
 
245
/* ************************************************************************** */
 
246
 
 
247
typedef struct {
 
248
           mng_ptr           pNext;              /* for linked list */
 
249
           mng_ptr           pData;              /* used for chunks & data */
 
250
           mng_uint32        iLength;
 
251
           mng_bool          bOwned;
 
252
           mng_uint8p        pDatanext;          /* only used for data */
 
253
           mng_uint32        iRemaining;
 
254
        } mng_pushdata;
 
255
typedef mng_pushdata * mng_pushdatap;
 
256
 
 
257
/* ************************************************************************** */
 
258
/* *                                                                        * */
203
259
/* * The main libmng data structure                                         * */
204
260
/* *                                                                        * */
205
261
/* * The handle used in all functions points to this structure which        * */
224
280
           mng_uint32        iSimplicity;
225
281
           mng_uint8         iAlphadepth;        /* indicates expected alpha-depth */
226
282
 
227
 
           mng_uint32        iImagelevel;        /* level an image inside a stream */
 
283
           mng_uint32        iImagelevel;        /* level of image inside a stream */
228
284
 
229
285
           mng_uint32        iCanvasstyle;       /* layout of the drawing-canvas */
230
286
           mng_uint32        iBkgdstyle;         /* layout of the background-canvas */
256
312
           mng_bool          bStorechunks;       /* switch for storing chunkdata */
257
313
           mng_bool          bSectionbreaks;     /* indicate NEEDSECTIONWAIT breaks */
258
314
           mng_bool          bCacheplayback;     /* switch to cache playback info */
259
 
           mng_bool          bDoProgressive;     /* progressive refresh for large images */ 
 
315
           mng_bool          bDoProgressive;     /* progressive refresh for large images */
 
316
           mng_uint32        iCrcmode;           /* CRC existence & checking flags */
260
317
 
261
318
           mng_speedtype     iSpeed;             /* speed-modifier for animations */
262
319
 
271
328
 
272
329
           mng_memalloc      fMemalloc;          /* callback pointers */
273
330
           mng_memfree       fMemfree;           /* initially nulled */
 
331
           mng_releasedata   fReleasedata;
 
332
#ifndef MNG_NO_OPEN_CLOSE_STREAM
274
333
           mng_openstream    fOpenstream;
275
334
           mng_closestream   fClosestream;
 
335
#endif
276
336
           mng_readdata      fReaddata;
277
337
           mng_writedata     fWritedata;
278
338
           mng_errorproc     fErrorproc;
298
358
           mng_processarow   fProcessarow;
299
359
 
300
360
#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
 
361
#ifndef MNG_NO_OLD_VERSIONS
301
362
           mng_bool          bPreDraft48;        /* flags ancient style draft */
 
363
#endif
302
364
 
303
365
           mng_chunkid       iChunkname;         /* read/write-state variables */
304
366
           mng_uint32        iChunkseq;
349
411
 
350
412
           mng_uint32        iPLTEcount;         /* PLTE fields */
351
413
 
352
 
           mng_bool          bEMNGMAhack;        /* TODO: to be removed in 1.0.0 !!! */
353
 
 
354
414
#ifdef MNG_INCLUDE_JNG
355
415
           mng_uint8         iJHDRcolortype;     /* JHDR fields */
356
416
           mng_uint8         iJHDRimgbitdepth;   /* valid if inside JHDR-IEND */
388
448
           mng_uint32        iSuspendbufleft;
389
449
           mng_uint32        iChunklen;          /* chunk length */
390
450
           mng_uint8p        pReadbufnext;       /* 32K+ suspension-processing */
 
451
           mng_uint8p        pLargebufnext;
 
452
 
 
453
           mng_pushdatap     pFirstpushchunk;    /* variables for push mechanisms */
 
454
           mng_pushdatap     pLastpushchunk;
 
455
           mng_pushdatap     pFirstpushdata;
 
456
           mng_pushdatap     pLastpushdata;
391
457
#endif /* MNG_SUPPORT_READ */
392
458
 
393
459
#ifdef MNG_SUPPORT_WRITE
394
460
           mng_bool          bCreating;          /* create/write processing variables */
395
461
           mng_bool          bWriting;
396
 
           mng_chunkid       iFirstchunkadded;           
 
462
           mng_chunkid       iFirstchunkadded;
397
463
           mng_uint32        iWritebufsize;
398
464
           mng_uint8p        pWritebuf;
399
465
#endif
405
471
           mng_uint32        iLayerseq;
406
472
           mng_uint32        iFrametime;         /* millisecs */
407
473
 
 
474
           mng_uint32        iTotalframes;       /* end-totals after mng_read() */
 
475
           mng_uint32        iTotallayers;
 
476
           mng_uint32        iTotalplaytime;     /* millisecs */
 
477
 
 
478
           mng_bool          bSkipping;          /* LOOP iteration=0 */
 
479
           
 
480
#ifdef MNG_SUPPORT_DYNAMICMNG
 
481
           mng_bool          bDynamic;           /* MNG is dynamic (eg. has events) */
 
482
           mng_bool          bRunningevent;      /* currently processing an event */
 
483
           mng_bool          bStopafterseek;     /* stop after next SEEK */
 
484
           mng_int32         iEventx;            /* X/Y of current event */
 
485
           mng_int32         iEventy;
 
486
           mng_objectp       pLastmousemove;     /* last event triggered */
 
487
#endif
 
488
 
408
489
           mng_uint32        iRequestframe;      /* go_xxxx variables */
409
490
           mng_uint32        iRequestlayer;
410
491
           mng_uint32        iRequesttime;
426
507
           mng_bool          bFreezing;          /* indicates app requested a freeze */   
427
508
           mng_bool          bResetting;         /* indicates app requested a reset */   
428
509
           mng_bool          bNeedrefresh;       /* indicates screen-refresh is needed */
 
510
           mng_bool          bMisplacedTERM;     /* indicates TERM is out of place */
 
511
           mng_bool          bOnlyfirstframe;    /* show first frame after TERM and stop */
 
512
           mng_uint32        iFramesafterTERM;   /* determines frame-count after TERM */          
429
513
           mng_objectp       pCurrentobj;        /* current "object" */
430
514
           mng_objectp       pCurraniobj;        /* current animation object
431
515
                                                    "to be"/"being" processed */
481
565
           mng_objectp       pLastimgobj;        /* image-object structures */
482
566
           mng_objectp       pFirstaniobj;       /* double-linked list of */
483
567
           mng_objectp       pLastaniobj;        /* animation-object structures */
 
568
#ifdef MNG_SUPPORT_DYNAMICMNG
 
569
           mng_objectp       pFirstevent;        /* double-linked list of */
 
570
           mng_objectp       pLastevent;         /* event-object structures */
 
571
#endif
484
572
 
485
 
#if defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS)
 
573
#if defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS) || defined(MNG_APP_CMS)
486
574
           mng_uint8         aGammatab[256];     /* precomputed gamma lookup table */
487
575
           mng_float         dLastgamma;         /* last gamma used to compute table */
488
576
#endif
507
595
                                                    delta-row to the bitdepth of its target */
508
596
           mng_fptr          fDeltarow;          /* internal callback to execute a
509
597
                                                    delta-row onto a target */
 
598
#ifndef MNG_SKIPCHUNK_PAST
 
599
           mng_fptr          fFliprow;           /* internal callback to flip a row of pixels
 
600
                                                    left<->right for a PAST operation */
 
601
           mng_fptr          fTilerow;           /* internal callback to tile a row of pixels
 
602
                                                    during a PAST operation */
 
603
#endif
510
604
           mng_fptr          fInitrowproc;       /* internal callback to initialize
511
605
                                                    the row processing */
512
606
 
531
625
           mng_uint16        iBACKimageid;
532
626
           mng_uint8         iBACKtile;
533
627
 
 
628
           mng_int32         iBackimgoffsx;      /* temp variables for restore_bkgd */
 
629
           mng_int32         iBackimgoffsy;
 
630
           mng_uint32        iBackimgwidth;
 
631
           mng_uint32        iBackimgheight;
 
632
 
 
633
#ifndef MNG_SKIPCHUNK_FRAM
534
634
           mng_uint8         iFRAMmode;          /* FRAM fields (global) */
535
635
           mng_uint32        iFRAMdelay;
536
636
           mng_uint32        iFRAMtimeout;
549
649
           mng_int32         iFrameclipt;
550
650
           mng_int32         iFrameclipb;
551
651
 
552
 
           mng_uint32        iNextdelay;         /* delay for *after* next image */
 
652
           mng_uint32        iNextdelay;         /* delay *after* next image */
 
653
#endif
553
654
 
554
 
           mng_uint8         iSHOWmode;          /* SAVE fields */
 
655
#ifndef MNG_SKIPCHUNK_SHOW
 
656
           mng_uint8         iSHOWmode;          /* SHOW fields */
555
657
           mng_uint16        iSHOWfromid;
556
658
           mng_uint16        iSHOWtoid;
557
659
           mng_uint16        iSHOWnextid;
558
660
           mng_int16         iSHOWskip;
 
661
#endif
559
662
 
560
663
           mng_uint32        iGlobalPLTEcount;   /* global PLTE fields */
561
664
           mng_rgbpaltab     aGlobalPLTEentries;
565
668
 
566
669
           mng_uint32        iGlobalGamma;       /* global gAMA fields */
567
670
 
 
671
#ifndef MNG_SKIPCHUNK_cHRM
568
672
           mng_uint32        iGlobalWhitepointx; /* global cHRM fields */
569
673
           mng_uint32        iGlobalWhitepointy;
570
674
           mng_uint32        iGlobalPrimaryredx;
573
677
           mng_uint32        iGlobalPrimarygreeny;
574
678
           mng_uint32        iGlobalPrimarybluex;
575
679
           mng_uint32        iGlobalPrimarybluey;
 
680
#endif
576
681
 
577
682
           mng_uint8         iGlobalRendintent;  /* global sRGB fields */
578
683
 
 
684
#ifndef MNG_SKIPCHUNK_iCCP
579
685
           mng_uint32        iGlobalProfilesize; /* global iCCP fields */
580
686
           mng_ptr           pGlobalProfile;
 
687
#endif
581
688
 
582
689
           mng_uint16        iGlobalBKGDred;     /* global bKGD fields */
583
690
           mng_uint16        iGlobalBKGDgreen;
585
692
 
586
693
           mng_ptr           pDeltaImage;        /* delta-image fields */
587
694
           mng_uint8         iDeltaImagetype;
588
 
           mng_uint8         iDeltatype;
 
695
#endif /* MNG_SUPPORT_DISPLAY */
 
696
           mng_uint8         iDeltatype;         /* need this one in read processing !! */
 
697
#ifdef MNG_SUPPORT_DISPLAY
589
698
           mng_uint32        iDeltaBlockwidth;
590
699
           mng_uint32        iDeltaBlockheight;
591
700
           mng_uint32        iDeltaBlockx;
597
706
           mng_fptr          fDeltareplacerow;
598
707
           mng_fptr          fDeltaputrow;
599
708
 
 
709
#ifndef MNG_SKIPCHUNK_PROM
 
710
           mng_fptr          fPromoterow;        /* internal PROM fields */
 
711
           mng_fptr          fPromBitdepth;
 
712
           mng_ptr           pPromBuf;
 
713
           mng_uint8         iPromColortype;
 
714
           mng_uint8         iPromBitdepth;
 
715
           mng_uint8         iPromFilltype;
 
716
           mng_uint32        iPromWidth;
 
717
           mng_ptr           pPromSrc;
 
718
           mng_ptr           pPromDst;
 
719
#endif
 
720
 
 
721
#ifndef MNG_SKIPCHUNK_MAGN
600
722
           mng_uint16        iMAGNfromid;
 
723
           mng_uint16        iMAGNcurrentid;
601
724
           mng_uint16        iMAGNtoid;
 
725
#endif
 
726
 
 
727
#ifndef MNG_SKIPCHUNK_PAST
 
728
           mng_uint16        iPASTid;
 
729
           mng_int32         iPastx;             /* target x/y of last PAST */
 
730
           mng_int32         iPasty;
 
731
#endif
 
732
 
 
733
           mng_objectp       pLastseek;          /* last processed ani_seek object */  
602
734
#endif /* MNG_SUPPORT_DISPLAY */
603
735
 
604
736
#ifdef MNG_INCLUDE_ZLIB
660
792
           mng_bool          bJPEGhasheader;     /* indicates "readheader" succeeded (JDAT) */
661
793
           mng_bool          bJPEGdecostarted;   /* indicates "decompress" started (JDAT) */
662
794
           mng_bool          bJPEGscanstarted;   /* indicates "first scan" started (JDAT) */
 
795
           mng_bool          bJPEGscanending;    /* indicates "finish_output" suspended (JDAT) */
663
796
           mng_bool          bJPEGprogressive;   /* indicates a progressive image (JDAT) */
664
797
 
665
798
           mng_bool          bJPEGdecompress2;   /* indicates "decompress" initialized (JDAA) */
685
818
 
686
819
#endif /* MNG_INCLUDE_JNG */
687
820
 
688
 
           mng_uint32        aCRCtable [256];    /* CRC prefab table */
689
 
           mng_bool          bCRCcomputed;       /* "has been build" indicator */
 
821
#ifndef MNG_USE_ZLIB_CRC
 
822
           mng_uint32        aCRCtable [256];  /* CRC prefab table */
 
823
           mng_bool          bCRCcomputed;     /* "has been built" indicator */
 
824
#endif
 
825
 
 
826
#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT
 
827
           png_imgtype       ePng_imgtype;
 
828
#endif
 
829
 
 
830
#if defined(MNG_NO_16BIT_SUPPORT)
 
831
           mng_uint8         iPNGdepth;     /* Real input depth */
 
832
           mng_uint8         iPNGmult;
 
833
#endif
690
834
 
691
835
        } mng_data;
692
836
 
708
852
typedef mng_retcode(*mng_differrow)   (mng_datap  pData);
709
853
typedef mng_retcode(*mng_scalerow)    (mng_datap  pData);
710
854
typedef mng_retcode(*mng_deltarow)    (mng_datap  pData);
 
855
typedef mng_retcode(*mng_promoterow)  (mng_datap  pData);
 
856
typedef mng_retcode(*mng_fliprow)     (mng_datap  pData);
 
857
typedef mng_retcode(*mng_tilerow)     (mng_datap  pData);
 
858
 
 
859
typedef mng_uint8  (*mng_bitdepth_8)  (mng_uint8  iB);
 
860
typedef mng_uint16 (*mng_bitdepth_16) (mng_uint8  iB);
711
861
 
712
862
typedef mng_retcode(*mng_magnify_x)   (mng_datap  pData,
713
863
                                       mng_uint16 iMX,