Update libmng snapshot. Not in default build.

This commit is contained in:
tor%cs.brown.edu 2000-06-23 22:59:51 +00:00
Родитель c332e90651
Коммит 38e572778c
20 изменённых файлов: 3109 добавлений и 1161 удалений

Просмотреть файл

@ -0,0 +1,310 @@
-----------------------------------------------------------
0.5.3 (never released)
----------------------
in short:
This is a working version only; the next release will be 0.9.0 (first Beta!)
- implemented the update-region parameters of the refresh callback
- added support for most common delta-image options
- added an animation-speed modifier
- added an image-level parameter for the processtext callback
- updated mngplg to 0.3.0 (supports JNG & full color-correction!)
- fixed a lot of small things
-------------------
bugfixes:
core:
- added processing of color-info on delta-image
- fixed handling of empty SAVE chunk
- fixed display of stored JNG images
- fixed problem with BASI-IEND as object 0
- changed the version parameters (obviously)
- added update-region parms for refresh calback
- added Needrefresh parameter
- added initialization of update-region for refresh
- added initialization of Needrefresh parameter
- changed progressive-display processing
- added tracecodes for tracing JPEG progression
- added tracing of JPEG calls
- added Deltaimmediate parm for faster delta-processing
- added extra checks for delta-images
- many changes to support delta-images
- optimized some store_xxx routines
- fixed some small things (as precaution)
- fixed possible trouble if IEND display-processing got broken up
- fixed nasty bug with embedded PNG after delta-image
- added processing of PLTE & tRNS for delta-images
- added processing of PLTE/tRNS & color-info for delta-images in the
ani_objects chain
- fixed problem with color-correction for stored images
- added get/set for speedtype to facilitate testing
- added trace-codes & -strings for get/set speedtype
- added speed-modifier to timing routine
- added get-routine of imagelevel for processtext callback
- added trace-code & -string for get imagelevel
- added administration of imagelevel parameter
- added support for PPLT chunk
- added trace-codes & -strings for PPLT chunk processing
- fixed problem with incorrect gamma-correction
samples:
contrib:
- updated mngplg to 0.3.0 (supports JNG & full color-correction!)
doc:
makefiles:
- changed makefile.linux to reflect versionnr for shared-lib
-----------------------------------------------------------
0.5.2 (June 10th 2000)
----------------------
in short:
This is the third release for developers
Another milestone since JNG is now fully supported
The next release will most likely be numbered 0.9.0 as the first Beta!!
Fixed bug 106017 & 106019
Added many constants regarding chunk-property values
Implemented full JNG support
Added all the error- & trace-strings
Added get/set routines for default ZLIB/IJG parameters
Added a generic makefile for Unix platforms (contributed by Tim Rowley)
Added canvasstyle for separate RGB + A canvas (eg. mozilla-style)
Separated configuration-options into a separate file: "mng_conf.h"
Fixed stuff for generic Unix compilation (contributed by Tim Rowley)
Upgraded to lcms1.0.6 (now supports 16-bit endian-peculiarities)
Added a makefile for Linux ELF & fixed some code-issues to go along with gcc
Added support for suspended input-buffer processing
Implemented the display-routines for RGBA/ARGB/BGRA/ABGR canvasstyles
Implemented the application background-restore functionality
Fixed & tested the mngtree Unix-sample (runs on Linux-RH6.2 with libmng.so)
Upgraded mngplg to v0.2.2 (based on the latest code including JNG)
Fixed a lot of other assorted stuff
-------------------
bugfixes:
B003(106017) - fixed problem with <mem.h> being proprietary to BCB
B004(106019) - fixed problem when MNG_SUPPORT_WRITE not defined
core:
- bumped version-numbers up to 0.5.2 (yeah, really)
- fixed support for IJGSRC6B
- cleaned up some code regarding mixed support-options
- complemented constants for chunk-property values
- fixed MNG_UINT_pHYg value
- implemented JNG support
- fixed problem with DEFI clipping
- added error telltale strings & support
- added trace telltale strings & support
- added support for global color-chunks inside TERM/LOOP
- added support for global PLTE,tRNS,bKGD inside TERM/LOOP
- added default IJG compression parameters and such
- moved init of default zlib parms to "mng_hlapi.c"
- added init of default IJG parms
- added support for get/set of zlib/IJG default parms
- added tracestrings for global animation color-chunks
- added tracestrings for get/set of default ZLIB/IJG parms
- added tracestrings for global PLTE,tRNS,bKGD
- added framenr/layernr/playtime to object header
- added initialization of framenr/layernr/playtime
- changed ani_create calls not returning object pointer
- create ani objects always (not just inside TERM/LOOP)
- fixed inconsistancy with freeing global iCCP profile
- fixed minor bugs 16-bit pixel-handling
- added object promotion routine (PROM handling)
- added trace-codes & -strings for image-object promotion
- added trace-codes & -strings for delta-image processing
- added error-codes & -strings for delta-image processing
- added support for delta-image processing
- added ani-object routines for delta-image processing
- added delta-image fields
- added compression/filter/interlace fields to object-buffer for
delta-image processing
- added delta-image row-processing routines
- fixed up punctuation in several files (contributed by Tim Rowley)
- removed useless definition in "mng_chunks.h" (contributed by Tim Rowley)
- fixed pointer confusion in "mng_display.c" (contributed by Tim Rowley)
- fixed inclusion for memcpy (contributed by Tim Rowley)
- added mng_int32p (contributed by Tim Rowley)
- added internal delta-image processing callbacks
- separated configuration-options into "mng_conf.h"
- changed to most likely configuration
- added RGB8_A8 canvasstyle
- added getalphaline callback for RGB8_A8 canvasstyle
- fixed some makeup for Linux gcc compile
- implemented app bkgd restore routines
- implemented RGBA8, ARGB8, BGRA8 & ABGR8 display routines
- added support for RGB8_A8 canvasstyle
- added support for suspended input-buffer processing
- added mng_read_resume HLAPI function to support read-suspension
- fixed timer-handling to run with Mozilla (Tim Rowley)
- fixed alpha-handling for alpha canvasstyles
- fixed some compilation-warnings (contrib Jason Morris)
samples:
- fixed mngview(delphi) to work with the new core
- synchronized libmng.pas(delphi) with the new libmng.h header
- removed the error- & trace-strings from libmng.pas(delphi)
- fixed mngtree(Unix) to compile on Linux (runs with libmng.so)
- added makefile.linux for mngtree(Unix) (tested on RedHat6.2)
contrib:
- updated mngplg to 0.2.2 (based on latest code; supports JNG!)
doc:
- this file obviously
- added Tim Rowley as contributing author
- changed the examples.readme doc
- updated the design-schematics in line with the current code
makefiles:
- changed the directory to "makefiles" to avoid name-conflicts
- added generic Unix makefile (thanks to Tim Rowley)
- added Linux ELF makefile (tested on RedHat6.2)
-----------------------------------------------------------
0.5.1 May 16th 2000
-------------------
in short:
This is the second release for developers
It's a bit of a milestone since all the chunk functionality is in place and
functioning (read, examine, create & write)
This version is incompatible with 0.5.0 since some of the callback prototypes
have changed (should be the last time that happens!)
There are a few more samples and even a real contribution!
Fixed bug 105795 & 105797
Fixed a mis-alignment in animation-timing
Added chunk-access functions
Finished all chunk-storage routine-bits
Finished all chunk-write routines
Changed the callback prototypes to allow error-reporting back to the library
Fixed some routines to allow for callback error-reporting
Added version-control functions & constants
Added two functions to set display- & sRGB-profile from memory
Moved CRC table to dynamic structure (for improved thread-safety)
Added SAVE & SEEK save&restore functionality
Finished the application-based CMS-callbacks
Fixed a few BCB specifics
Changed the Win32 DLL and samples to use __stdcall
Did some more assorted little changes
Added 2 BCB samples
Added 1 Unix sample
Added the MNG plugin by Jason Summers in the contrib section
Changed some documents to reflect these changes
-------------------
bugfixes:
B001(105795) - fixed wrong lcms call & memory-leak for gammatables
B002(105797) - fixed problem with missing sRGB profile
core:
- changed chunk iteration function
- added chunk access functions
- added version control constants & functions
- changed strict-ANSI stuff
- added set_outputprofile2 & set_srgbprofile2
- added empty-chunk put-routines
- added version_dll & VERSION_DLL (for consistency)
- added version control explanatory text & samples
- added iteratechunk callback definition
- improved definitions for DLL support
- added 8-bit palette definition
- added general array definitions
- added MNG_NULL definition
- changed most callback prototypes to allow the app
to report errors during callback processing
- added CRC table to main structure (for thread-safety)
- added iPLTEentries for checking hIST-length
- changed palette definition to exported palette-type
- removed frozen indicator
- added create/write indicators
- added eMNGma hack (will be removed in 1.0.0 !!!)
- added TERM animation object pointer (easier reference)
- added saved-data structure for SAVE/SEEK processing
- added some errorcodes
- added application errorcodes (used with callbacks)
- moved chunk-access errorcodes to severity 5
- added chunk-access function trace-codes
- changed trace to macro for callback error-reporting
- added save_state & restore_state trace-codes
- put in some extra comments
- fixed layout for sBIT, PPLT
- changed write callback definition
- fixed layout for PPLT again (missed deltatype ?!?)
- cleaned up left-over teststuff in the BACK chunk routine
- changed CRC initialization to use dynamic structure
(wasn't thread-safe the old way !)
- filled in many missing sequence&length checks
- filled in many missing chunk-store snippets
- added checks for running animations
- filled remaining write routines
- fixed read_pplt with regard to deltatype
- added callback error-reporting support
- added pre-draft48 support (short MHDR, frame_mode, LOOP)
- fixed chunk-storage bit in several routines
- supplemented the SAVE & SEEK display processing
- added init of iPLTEcount
- changed calling-convention definition
- changed status-handling of display-routines
- added versioning-control routines
- filled the write routine
- fixed frame_delay misalignment
- added sanity check for frozen status
- changed display_mend to reset state to initial or SAVE
- added save_state and restore_state for SAVE/SEEK/TERM
processing
- added process_save & process_seek routines
- changed and filled iterate-chunk function
- added getchunk functions
- added putchunk functions
- added empty-chunk put-routines
- filled application-based color-management routines
- added creatememprofile
- filled the deflatedata routine
- added cleanup of saved-data (SAVE/SEEK processing)
- moved the actual write_graphic functionality from mng_hlapi.c
to it's appropriate function in the mng_write.c module
- moved standard header includes into mng_types.h
(stdlib/mem for mem-mngmt & math for fp gamma-calc)
- added getimgdata & putimgdata functions
samples:
- fixed mngview(delphi) to work with the new core
- synchronized libmng.pas(delphi) with the new libmng.h header
- added mngtree(bcb) sample
- added bogus(bcb) sample
- added mngtree(unix) sample
contrib:
- added mngplg 0.1.0 / a MNG plugin for Win32 by Jason Summers
doc:
- added this changes.readme file
- changed the samples.readme doc accordingly
- changed the contrib.readme doc accordingly
-----------------------------------------------------------
0.5.0 May 1st 2000
------------------
in short:
This is the first developers release.
It's roughly about 60% done.

Просмотреть файл

@ -101,7 +101,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng.h copyright (c) 2000 G.Juyn * */
/* * version : 0.5.2 * */
/* * version : 0.5.3 * */
/* * * */
/* * purpose : main application interface * */
/* * * */
@ -145,6 +145,12 @@
/* * - added mng_read_resume function to support * */
/* * read-suspension * */
/* * * */
/* * 0.5.3 - 06/16/2000 - G.Juyn * */
/* * - changed the version parameters (obviously) * */
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
/* * - added get/set for speedtype to facilitate testing * */
/* * - added get for imagelevel during processtext callback * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -272,12 +278,12 @@ extern "C" {
/* * * */
/* ************************************************************************** */
#define MNG_VERSION_TEXT "0.5.2"
#define MNG_VERSION_TEXT "0.5.3"
#define MNG_VERSION_SO 0 /* eg. libmng.so.0 (while in test) */
#define MNG_VERSION_DLL 0 /* eg. libmng.dll (nb. same for version 1) */
#define MNG_VERSION_MAJOR 0
#define MNG_VERSION_MINOR 5
#define MNG_VERSION_RELEASE 2
#define MNG_VERSION_RELEASE 3
MNG_EXT mng_pchar MNG_DECL mng_version_text (void);
MNG_EXT mng_uint8 MNG_DECL mng_version_so (void);
@ -674,6 +680,13 @@ MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_maxjdat (mng_handle hHandle,
mng_uint32 iMaxJDAT);
#endif /* MNG_INCLUDE_JNG */
/* Speed-setting */
/* use this to facilitate testing of animations */
#if defined(MNG_SUPPORT_DISPLAY)
MNG_EXT mng_retcode MNG_DECL mng_set_speed (mng_handle hHandle,
mng_speedtype iSpeed);
#endif
/* ************************************************************************** */
/* * * */
/* * Property get functions * */
@ -752,6 +765,18 @@ MNG_EXT mng_bool MNG_DECL mng_get_jpeg_optimized (mng_handle hHandle)
MNG_EXT mng_uint32 MNG_DECL mng_get_jpeg_maxjdat (mng_handle hHandle);
#endif /* MNG_INCLUDE_JNG */
/* see _set_ */
#if defined(MNG_SUPPORT_DISPLAY)
MNG_EXT mng_speedtype
MNG_DECL mng_get_speed (mng_handle hHandle);
#endif
/* Image-level */
/* this can be used inside the processtext callback to determine the level of
text of the image being processed; the value 1 is returned for top-level
texts, and the value 2 for a text inside an embedded image inside a MNG */
MNG_EXT mng_uint32 MNG_DECL mng_get_imagelevel (mng_handle hHandle);
/* ************************************************************************** */
/* * * */
/* * Chunk access functions * */

Просмотреть файл

@ -69,6 +69,17 @@
/* * - added processing of color-info on delta-image * */
/* * 0.5.3 - 06/13/2000 - G.Juyn * */
/* * - fixed handling of empty SAVE chunk * */
/* * 0.5.3 - 06/17/2000 - G.Juyn * */
/* * - changed to support delta-images * */
/* * - added extra checks for delta-images * */
/* * 0.5.3 - 06/20/2000 - G.Juyn * */
/* * - fixed possible trouble if IEND display-process got * */
/* * broken up * */
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
/* * - added processing of PLTE & tRNS for delta-images * */
/* * - added administration of imagelevel parameter * */
/* * 0.5.3 - 06/22/2000 - G.Juyn * */
/* * - implemented support for PPLT chunk * */
/* * * */
/* ************************************************************************** */
@ -481,9 +492,9 @@ READ_CHUNK (read_ihdr)
MNG_ERROR (pData, MNG_SEQUENCEERROR)
#ifdef MNG_INCLUDE_JNG
if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasJHDR))
if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasIDAT) || (pData->bHasJHDR))
#else
if ((pData->bHasIHDR) || (pData->bHasBASI))
if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasIDAT))
#endif
MNG_ERROR (pData, MNG_SEQUENCEERROR)
@ -534,6 +545,20 @@ READ_CHUNK (read_ihdr)
(pData->iInterlace != MNG_INTERLACE_ADAM7) )
MNG_ERROR (pData, MNG_INVALIDINTERLACE)
if (pData->bHasDHDR) /* check the colortype for delta-images ! */
{
mng_imagedatap pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf;
if (pData->iColortype != pBuf->iColortype)
{
if ( ( (pData->iColortype != MNG_COLORTYPE_INDEXED) ||
(pBuf->iColortype == MNG_COLORTYPE_GRAY ) ) &&
( (pData->iColortype != MNG_COLORTYPE_GRAY ) ||
(pBuf->iColortype == MNG_COLORTYPE_INDEXED) ) )
MNG_ERROR (pData, MNG_INVALIDCOLORTYPE)
}
}
if (!pData->bHasheader) /* first chunk ? */
{
pData->bHasheader = MNG_TRUE; /* we've got a header */
@ -550,6 +575,9 @@ READ_CHUNK (read_ihdr)
}
if (!pData->bHasDHDR)
pData->iImagelevel++; /* one level deeper */
#ifdef MNG_SUPPORT_DISPLAY
if (pData->bDisplaying)
{
@ -646,41 +674,18 @@ READ_CHUNK (read_plte)
#ifdef MNG_SUPPORT_DISPLAY
if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR))
{
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
mng_imagep pImage;
mng_imagedatap pBuf;
if (!pImage) /* no object then dump it in obj 0 */
pImage = (mng_imagep)pData->pObjzero;
if (pData->bHasDHDR) /* processing delta-image ? */
{ /* store in object 0 !!! */
pImage = (mng_imagep)pData->pObjzero;
pBuf = pImage->pImgbuf;
pBuf->bHasPLTE = MNG_TRUE; /* it's definitely got a PLTE now */
pBuf->iPLTEcount = iRawlen / 3; /* this is the exact length */
pRawdata2 = pRawdata; /* copy the entries */
pBuf = pImage->pImgbuf; /* address the object buffer */
pBuf->bHasPLTE = MNG_TRUE; /* and tell it it's got a PLTE now */
if (!iRawlen) /* if empty, inherit from global */
{
pBuf->iPLTEcount = pData->iGlobalPLTEcount;
MNG_COPY (&pBuf->aPLTEentries, &pData->aGlobalPLTEentries,
sizeof (pBuf->aPLTEentries))
if (pData->bHasglobalTRNS) /* also copy global tRNS ? */
{ /* indicate tRNS available */
pBuf->bHasTRNS = MNG_TRUE;
iRawlen2 = pData->iGlobalTRNSrawlen;
pRawdata2 = (mng_uint8p)(&pData->aGlobalTRNSrawdata);
/* global length oke ? */
if ((iRawlen2 == 0) || (iRawlen2 > pBuf->iPLTEcount))
MNG_ERROR (pData, MNG_GLOBALLENGTHERR)
/* copy it */
pBuf->iTRNScount = iRawlen2;
MNG_COPY (&pBuf->aTRNSentries, pRawdata2, iRawlen2)
}
}
else
{
pBuf->iPLTEcount = iRawlen / 3; /* store fields for future reference */
pRawdata2 = pRawdata;
for (iX = 0; iX < pBuf->iPLTEcount; iX++)
for (iX = 0; iX < iRawlen / 3; iX++)
{
pBuf->aPLTEentries[iX].iRed = *pRawdata2;
pBuf->aPLTEentries[iX].iGreen = *(pRawdata2+1);
@ -689,6 +694,51 @@ READ_CHUNK (read_plte)
pRawdata2 += 3;
}
}
else
{ /* get the current object */
pImage = (mng_imagep)pData->pCurrentobj;
if (!pImage) /* no object then dump it in obj 0 */
pImage = (mng_imagep)pData->pObjzero;
pBuf = pImage->pImgbuf; /* address the object buffer */
pBuf->bHasPLTE = MNG_TRUE; /* and tell it it's got a PLTE now */
if (!iRawlen) /* if empty, inherit from global */
{
pBuf->iPLTEcount = pData->iGlobalPLTEcount;
MNG_COPY (&pBuf->aPLTEentries, &pData->aGlobalPLTEentries,
sizeof (pBuf->aPLTEentries))
if (pData->bHasglobalTRNS) /* also copy global tRNS ? */
{ /* indicate tRNS available */
pBuf->bHasTRNS = MNG_TRUE;
iRawlen2 = pData->iGlobalTRNSrawlen;
pRawdata2 = (mng_uint8p)(&pData->aGlobalTRNSrawdata);
/* global length oke ? */
if ((iRawlen2 == 0) || (iRawlen2 > pBuf->iPLTEcount))
MNG_ERROR (pData, MNG_GLOBALLENGTHERR)
/* copy it */
pBuf->iTRNScount = iRawlen2;
MNG_COPY (&pBuf->aTRNSentries, pRawdata2, iRawlen2)
}
}
else
{ /* store fields for future reference */
pBuf->iPLTEcount = iRawlen / 3;
pRawdata2 = pRawdata;
for (iX = 0; iX < pBuf->iPLTEcount; iX++)
{
pBuf->aPLTEentries[iX].iRed = *pRawdata2;
pBuf->aPLTEentries[iX].iGreen = *(pRawdata2+1);
pBuf->aPLTEentries[iX].iBlue = *(pRawdata2+2);
pRawdata2 += 3;
}
}
}
}
else /* store as global */
{
@ -763,6 +813,9 @@ READ_CHUNK (read_idat)
if (pData->bHasJSEP)
MNG_ERROR (pData, MNG_SEQUENCEERROR)
#endif
/* not allowed for for deltatype NO_CHANGE */
if ((pData->bHasDHDR) && ((pData->iDeltatype == MNG_DELTATYPE_NOCHANGE)))
MNG_ERROR (pData, MNG_CHUNKNOTALLOWED)
/* can only be empty in BASI-block! */
if ((iRawlen == 0) && (!pData->bHasBASI))
MNG_ERROR (pData, MNG_INVALIDLENGTH)
@ -832,6 +885,8 @@ READ_CHUNK (read_iend)
if ((pData->bHasIHDR) && (!pData->bHasIDAT))
MNG_ERROR (pData, MNG_IDATMISSING)
pData->iImagelevel--; /* one level up */
#ifdef MNG_SUPPORT_DISPLAY
if (pData->bHasMHDR)
{ /* create an animation object */
@ -850,22 +905,30 @@ READ_CHUNK (read_iend)
}
#endif /* MNG_SUPPORT_DISPLAY */
pData->bHasIHDR = MNG_FALSE; /* IEND signals the end */
pData->bHasBASI = MNG_FALSE; /* for most ... */
pData->bHasDHDR = MNG_FALSE;
#ifdef MNG_INCLUDE_JNG
pData->bHasJHDR = MNG_FALSE;
pData->bHasJSEP = MNG_FALSE;
pData->bHasJDAT = MNG_FALSE;
#ifdef MNG_SUPPORT_DISPLAY
if (!pData->bTimerset) /* reset only if not broken !!! */
{
#endif
pData->bHasPLTE = MNG_FALSE;
pData->bHasTRNS = MNG_FALSE;
pData->bHasGAMA = MNG_FALSE;
pData->bHasCHRM = MNG_FALSE;
pData->bHasSRGB = MNG_FALSE;
pData->bHasICCP = MNG_FALSE;
pData->bHasBKGD = MNG_FALSE;
pData->bHasIDAT = MNG_FALSE;
/* IEND signals the end for most ... */
pData->bHasIHDR = MNG_FALSE;
pData->bHasBASI = MNG_FALSE;
pData->bHasDHDR = MNG_FALSE;
#ifdef MNG_INCLUDE_JNG
pData->bHasJHDR = MNG_FALSE;
pData->bHasJSEP = MNG_FALSE;
pData->bHasJDAT = MNG_FALSE;
#endif
pData->bHasPLTE = MNG_FALSE;
pData->bHasTRNS = MNG_FALSE;
pData->bHasGAMA = MNG_FALSE;
pData->bHasCHRM = MNG_FALSE;
pData->bHasSRGB = MNG_FALSE;
pData->bHasICCP = MNG_FALSE;
pData->bHasBKGD = MNG_FALSE;
pData->bHasIDAT = MNG_FALSE;
#ifdef MNG_SUPPORT_DISPLAY
}
#endif
#ifdef MNG_STORE_CHUNKS
if (pData->bStorechunks)
@ -953,65 +1016,106 @@ READ_CHUNK (read_trns)
#ifdef MNG_SUPPORT_DISPLAY
if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR))
{
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
mng_imagep pImage;
mng_imagedatap pBuf;
mng_uint8p pRawdata2;
mng_uint32 iRawlen2;
if (!pImage) /* no object then dump it in obj 0 */
if (pData->bHasDHDR) /* processing delta-image ? */
{ /* store in object 0 !!! */
pImage = (mng_imagep)pData->pObjzero;
pBuf = pImage->pImgbuf; /* address object buffer */
pBuf = pImage->pImgbuf; /* address object buffer */
pBuf->bHasTRNS = MNG_TRUE; /* and tell it it's got a tRNS now */
switch (pData->iColortype) /* store fields for future reference */
{
case 0: { /* gray */
pBuf->iTRNSgray = mng_get_uint16 (pRawdata);
pBuf->iTRNSred = 0;
pBuf->iTRNSgreen = 0;
pBuf->iTRNSblue = 0;
pBuf->iTRNScount = 0;
break;
}
case 2: { /* rgb */
pBuf->iTRNSgray = 0;
pBuf->iTRNSred = mng_get_uint16 (pRawdata);
pBuf->iTRNSgreen = mng_get_uint16 (pRawdata+2);
pBuf->iTRNSblue = mng_get_uint16 (pRawdata+4);
pBuf->iTRNScount = 0;
break;
}
case 3: { /* indexed */
pBuf->iTRNSgray = 0;
pBuf->iTRNSred = 0;
pBuf->iTRNSgreen = 0;
pBuf->iTRNSblue = 0;
pBuf->iTRNScount = iRawlen;
MNG_COPY (&pBuf->aTRNSentries, pRawdata, iRawlen)
break;
}
}
if (iRawlen == 0) /* if empty, inherit from global */
{
iRawlen2 = pData->iGlobalTRNSrawlen;
pRawdata2 = (mng_ptr)(&pData->aGlobalTRNSrawdata);
/* global length oke ? */
if ((pData->iColortype == 0) && (iRawlen2 != 2))
MNG_ERROR (pData, MNG_GLOBALLENGTHERR)
if ((pData->iColortype == 2) && (iRawlen2 != 6))
MNG_ERROR (pData, MNG_GLOBALLENGTHERR)
if ((pData->iColortype == 3) && ((iRawlen2 == 0) || (iRawlen2 > pBuf->iPLTEcount)))
MNG_ERROR (pData, MNG_GLOBALLENGTHERR)
pBuf->bHasTRNS = MNG_TRUE; /* tell it it's got a tRNS now */
}
else
{
iRawlen2 = iRawlen;
pRawdata2 = pRawdata;
}
{ /* address current object */
pImage = (mng_imagep)pData->pCurrentobj;
switch (pData->iColortype) /* store fields for future reference */
{
case 0: { /* gray */
pBuf->iTRNSgray = mng_get_uint16 (pRawdata2);
pBuf->iTRNSred = 0;
pBuf->iTRNSgreen = 0;
pBuf->iTRNSblue = 0;
pBuf->iTRNScount = 0;
break;
}
case 2: { /* rgb */
pBuf->iTRNSgray = 0;
pBuf->iTRNSred = mng_get_uint16 (pRawdata2);
pBuf->iTRNSgreen = mng_get_uint16 (pRawdata2+2);
pBuf->iTRNSblue = mng_get_uint16 (pRawdata2+4);
pBuf->iTRNScount = 0;
break;
}
case 3: { /* indexed */
pBuf->iTRNSgray = 0;
pBuf->iTRNSred = 0;
pBuf->iTRNSgreen = 0;
pBuf->iTRNSblue = 0;
pBuf->iTRNScount = iRawlen2;
MNG_COPY (&pBuf->aTRNSentries, pRawdata2, iRawlen2)
break;
}
}
if (!pImage) /* no object then dump it in obj 0 */
pImage = (mng_imagep)pData->pObjzero;
pBuf = pImage->pImgbuf; /* address object buffer */
pBuf->bHasTRNS = MNG_TRUE; /* and tell it it's got a tRNS now */
if (iRawlen == 0) /* if empty, inherit from global */
{
iRawlen2 = pData->iGlobalTRNSrawlen;
pRawdata2 = (mng_ptr)(&pData->aGlobalTRNSrawdata);
/* global length oke ? */
if ((pData->iColortype == 0) && (iRawlen2 != 2))
MNG_ERROR (pData, MNG_GLOBALLENGTHERR)
if ((pData->iColortype == 2) && (iRawlen2 != 6))
MNG_ERROR (pData, MNG_GLOBALLENGTHERR)
if ((pData->iColortype == 3) && ((iRawlen2 == 0) || (iRawlen2 > pBuf->iPLTEcount)))
MNG_ERROR (pData, MNG_GLOBALLENGTHERR)
}
else
{
iRawlen2 = iRawlen;
pRawdata2 = pRawdata;
}
switch (pData->iColortype) /* store fields for future reference */
{
case 0: { /* gray */
pBuf->iTRNSgray = mng_get_uint16 (pRawdata2);
pBuf->iTRNSred = 0;
pBuf->iTRNSgreen = 0;
pBuf->iTRNSblue = 0;
pBuf->iTRNScount = 0;
break;
}
case 2: { /* rgb */
pBuf->iTRNSgray = 0;
pBuf->iTRNSred = mng_get_uint16 (pRawdata2);
pBuf->iTRNSgreen = mng_get_uint16 (pRawdata2+2);
pBuf->iTRNSblue = mng_get_uint16 (pRawdata2+4);
pBuf->iTRNScount = 0;
break;
}
case 3: { /* indexed */
pBuf->iTRNSgray = 0;
pBuf->iTRNSred = 0;
pBuf->iTRNSgreen = 0;
pBuf->iTRNSblue = 0;
pBuf->iTRNScount = iRawlen2;
MNG_COPY (&pBuf->aTRNSentries, pRawdata2, iRawlen2)
break;
}
}
}
}
else /* store as global */
{
@ -1035,7 +1139,7 @@ READ_CHUNK (read_trns)
if (iRetcode) /* on error bail out */
return iRetcode;
if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR))
{ /* not global! */
((mng_trnsp)*ppChunk)->bGlobal = MNG_FALSE;
@ -1144,9 +1248,9 @@ READ_CHUNK (read_gama)
mng_imagep pImage;
if (pData->bHasDHDR) /* update delta image ? */
{
pImage = (mng_imagep)pData->pDeltaImage;
{ /* store in object 0 ! */
pImage = (mng_imagep)pData->pObjzero;
/* store for color-processing routines */
pImage->pImgbuf->iGamma = mng_get_uint32 (pRawdata);
pImage->pImgbuf->bHasGAMA = MNG_TRUE;
}
@ -1248,78 +1352,90 @@ READ_CHUNK (read_chrm)
pData->bHasglobalCHRM = (mng_bool)(iRawlen != 0);
#ifdef MNG_SUPPORT_DISPLAY
#ifdef MNG_INCLUDE_JNG
if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR))
#else
if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR))
#endif
{
mng_imagep pImage;
mng_imagedatap pBuf;
mng_uint32 iWhitepointx, iWhitepointy;
mng_uint32 iPrimaryredx, iPrimaryredy;
mng_uint32 iPrimarygreenx, iPrimarygreeny;
mng_uint32 iPrimarybluex, iPrimarybluey;
if (pData->bHasDHDR) /* update delta image ? */
iWhitepointx = mng_get_uint32 (pRawdata);
iWhitepointy = mng_get_uint32 (pRawdata+4);
iPrimaryredx = mng_get_uint32 (pRawdata+8);
iPrimaryredy = mng_get_uint32 (pRawdata+12);
iPrimarygreenx = mng_get_uint32 (pRawdata+16);
iPrimarygreeny = mng_get_uint32 (pRawdata+20);
iPrimarybluex = mng_get_uint32 (pRawdata+24);
iPrimarybluey = mng_get_uint32 (pRawdata+28);
#ifdef MNG_INCLUDE_JNG
if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR))
#else
if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR))
#endif
{
pImage = (mng_imagep)pData->pDeltaImage;
mng_imagep pImage;
mng_imagedatap pBuf;
pBuf = pImage->pImgbuf; /* address object buffer */
pBuf->bHasCHRM = MNG_TRUE; /* and tell it it's got a CHRM now */
/* store for color-processing routines */
pBuf->iWhitepointx = mng_get_uint32 (pRawdata);
pBuf->iWhitepointy = mng_get_uint32 (pRawdata+4);
pBuf->iPrimaryredx = mng_get_uint32 (pRawdata+8);
pBuf->iPrimaryredy = mng_get_uint32 (pRawdata+12);
pBuf->iPrimarygreenx = mng_get_uint32 (pRawdata+16);
pBuf->iPrimarygreeny = mng_get_uint32 (pRawdata+20);
pBuf->iPrimarybluex = mng_get_uint32 (pRawdata+24);
pBuf->iPrimarybluey = mng_get_uint32 (pRawdata+28);
}
else
{
pImage = (mng_imagep)pData->pCurrentobj;
if (!pImage) /* no object then dump it in obj 0 */
if (pData->bHasDHDR) /* update delta image ? */
{ /* store it in object 0 ! */
pImage = (mng_imagep)pData->pObjzero;
pBuf = pImage->pImgbuf; /* address object buffer */
pBuf->bHasCHRM = MNG_TRUE; /* and tell it it's got a CHRM now */
pBuf = pImage->pImgbuf; /* address object buffer */
pBuf->bHasCHRM = MNG_TRUE; /* and tell it it's got a CHRM now */
/* store for color-processing routines */
pBuf->iWhitepointx = mng_get_uint32 (pRawdata);
pBuf->iWhitepointy = mng_get_uint32 (pRawdata+4);
pBuf->iPrimaryredx = mng_get_uint32 (pRawdata+8);
pBuf->iPrimaryredy = mng_get_uint32 (pRawdata+12);
pBuf->iPrimarygreenx = mng_get_uint32 (pRawdata+16);
pBuf->iPrimarygreeny = mng_get_uint32 (pRawdata+20);
pBuf->iPrimarybluex = mng_get_uint32 (pRawdata+24);
pBuf->iPrimarybluey = mng_get_uint32 (pRawdata+28);
}
}
else
{ /* store as global */
if (iRawlen != 0)
{
pData->iGlobalWhitepointx = mng_get_uint32 (pRawdata);
pData->iGlobalWhitepointy = mng_get_uint32 (pRawdata+4);
pData->iGlobalPrimaryredx = mng_get_uint32 (pRawdata+8);
pData->iGlobalPrimaryredy = mng_get_uint32 (pRawdata+12);
pData->iGlobalPrimarygreenx = mng_get_uint32 (pRawdata+16);
pData->iGlobalPrimarygreeny = mng_get_uint32 (pRawdata+20);
pData->iGlobalPrimarybluex = mng_get_uint32 (pRawdata+24);
pData->iGlobalPrimarybluey = mng_get_uint32 (pRawdata+28);
}
pBuf->iWhitepointx = iWhitepointx;
pBuf->iWhitepointy = iWhitepointy;
pBuf->iPrimaryredx = iPrimaryredx;
pBuf->iPrimaryredy = iPrimaryredy;
pBuf->iPrimarygreenx = iPrimarygreenx;
pBuf->iPrimarygreeny = iPrimarygreeny;
pBuf->iPrimarybluex = iPrimarybluex;
pBuf->iPrimarybluey = iPrimarybluey;
}
else
{
pImage = (mng_imagep)pData->pCurrentobj;
{ /* create an animation object */
mng_retcode iRetcode = create_ani_chrm (pData, (mng_bool)(iRawlen == 0),
pData->iGlobalWhitepointx,
pData->iGlobalWhitepointy,
pData->iGlobalPrimaryredx,
pData->iGlobalPrimaryredy,
pData->iGlobalPrimarygreenx,
pData->iGlobalPrimarygreeny,
pData->iGlobalPrimarybluex,
pData->iGlobalPrimarybluey);
if (!pImage) /* no object then dump it in obj 0 */
pImage = (mng_imagep)pData->pObjzero;
if (iRetcode) /* on error bail out */
return iRetcode;
pBuf = pImage->pImgbuf; /* address object buffer */
pBuf->bHasCHRM = MNG_TRUE; /* and tell it it's got a CHRM now */
/* store for color-processing routines */
pBuf->iWhitepointx = iWhitepointx;
pBuf->iWhitepointy = iWhitepointy;
pBuf->iPrimaryredx = iPrimaryredx;
pBuf->iPrimaryredy = iPrimaryredy;
pBuf->iPrimarygreenx = iPrimarygreenx;
pBuf->iPrimarygreeny = iPrimarygreeny;
pBuf->iPrimarybluex = iPrimarybluex;
pBuf->iPrimarybluey = iPrimarybluey;
}
}
else
{ /* store as global */
if (iRawlen != 0)
{
pData->iGlobalWhitepointx = iWhitepointx;
pData->iGlobalWhitepointy = iWhitepointy;
pData->iGlobalPrimaryredx = iPrimaryredx;
pData->iGlobalPrimaryredy = iPrimaryredy;
pData->iGlobalPrimarygreenx = iPrimarygreenx;
pData->iGlobalPrimarygreeny = iPrimarygreeny;
pData->iGlobalPrimarybluex = iPrimarybluex;
pData->iGlobalPrimarybluey = iPrimarybluey;
}
{ /* create an animation object */
mng_retcode iRetcode = create_ani_chrm (pData, (mng_bool)(iRawlen == 0),
iWhitepointx, iWhitepointy,
iPrimaryredx, iPrimaryredy,
iPrimarygreenx, iPrimarygreeny,
iPrimarybluex, iPrimarybluey);
if (iRetcode) /* on error bail out */
return iRetcode;
}
}
}
#endif /* MNG_SUPPORT_DISPLAY */
@ -1413,9 +1529,9 @@ READ_CHUNK (read_srgb)
mng_imagep pImage;
if (pData->bHasDHDR) /* update delta image ? */
{
pImage = (mng_imagep)pData->pDeltaImage;
{ /* store in object 0 ! */
pImage = (mng_imagep)pData->pObjzero;
/* store for color-processing routines */
pImage->pImgbuf->iRenderingintent = *pRawdata;
pImage->pImgbuf->bHasSRGB = MNG_TRUE;
}
@ -1551,8 +1667,8 @@ READ_CHUNK (read_iccp)
mng_imagep pImage;
if (pData->bHasDHDR) /* update delta image ? */
{
pImage = (mng_imagep)pData->pDeltaImage;
{ /* store in object 0 ! */
pImage = (mng_imagep)pData->pObjzero;
if (pImage->pImgbuf->pProfile) /* profile existed ? */
MNG_FREEX (pData, pImage->pImgbuf->pProfile, pImage->pImgbuf->iProfilesize)
@ -2713,6 +2829,8 @@ READ_CHUNK (read_mhdr)
if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight))
MNG_ERROR (pData, MNG_APPMISCERROR)
pData->iImagelevel++; /* one level deeper */
#ifdef MNG_STORE_CHUNKS
if (pData->bStorechunks)
{ /* initialize storage */
@ -3185,6 +3303,8 @@ READ_CHUNK (read_basi)
(pData->iInterlace != MNG_INTERLACE_ADAM7) )
MNG_ERROR (pData, MNG_INVALIDINTERLACE)
pData->iImagelevel++; /* one level deeper */
#ifdef MNG_SUPPORT_DISPLAY
{
mng_uint16 iRed = 0;
@ -3718,9 +3838,10 @@ READ_CHUNK (read_fram)
{
switch (iFramemode)
{
case 0: { break; }
case 1: { iFramemode = 3; break; }
case 2: { iFramemode = 4; break; }
case 3: { iFramemode = 5; break; } /* TODO: provision for mode=5 ??? */
case 3: { break; }
case 4: { iFramemode = 1; break; }
case 5: { iFramemode = 2; break; }
default: { iFramemode = 1; break; }
@ -4809,6 +4930,7 @@ READ_CHUNK (read_jhdr)
}
pData->iColortype = 0; /* fake grayscale for other routines */
pData->iImagelevel++; /* one level deeper */
#ifdef MNG_SUPPORT_DISPLAY
if (pData->bDisplaying)
@ -4990,6 +5112,8 @@ READ_CHUNK (read_dhdr)
pData->bHasDHDR = MNG_TRUE; /* inside a DHDR-IEND block now */
pData->iImagelevel++; /* one level deeper */
#ifdef MNG_SUPPORT_DISPLAY
{
mng_uint16 iObjectid = mng_get_uint16 (pRawdata);
@ -5195,28 +5319,46 @@ READ_CHUNK (read_ipng)
READ_CHUNK (read_pplt)
{
mng_uint8 iDeltatype;
mng_uint8p pTemp;
mng_uint32 iLen;
mng_uint8 iX, iM;
mng_uint8 iDeltatype;
mng_uint8p pTemp;
mng_uint32 iLen;
mng_uint8 iX, iM;
mng_uint32 iY;
mng_uint32 iMax;
mng_rgbpaltab aIndexentries;
mng_uint8arr aAlphaentries;
mng_uint8arr aUsedentries;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_READ_PPLT, MNG_LC_START)
#endif
/* sequence checks */
if ((!pData->bHasMHDR) || (!pData->bHasDHDR))
if ((!pData->bHasMHDR) && (!pData->bHasDHDR))
MNG_ERROR (pData, MNG_SEQUENCEERROR)
if (iRawlen < 1) /* must have at least 1 byte */
MNG_ERROR (pData, MNG_INVALIDLENGTH)
iDeltatype = *pRawdata;
if (iDeltatype > 5) /* valid ? */
/* valid ? */
if (iDeltatype > MNG_DELTATYPE_DELTARGBA)
MNG_ERROR (pData, MNG_INVDELTATYPE)
/* must be indexed color ! */
if (pData->iColortype != MNG_COLORTYPE_INDEXED)
MNG_ERROR (pData, MNG_INVALIDCOLORTYPE)
pTemp = pRawdata + 1;
iLen = iRawlen - 1;
iMax = 0;
for (iY = 0; iY < 256; iY++) /* reset arrays */
{
aIndexentries [iY].iRed = 0;
aIndexentries [iY].iGreen = 0;
aIndexentries [iY].iBlue = 0;
aAlphaentries [iY] = 255;
aUsedentries [iY] = 0;
}
while (iLen) /* as long as there are entries left ... */
{
@ -5231,13 +5373,18 @@ READ_CHUNK (read_pplt)
if (iM < iX)
MNG_ERROR (pData, MNG_INVALIDINDEX)
if ((mng_uint32)iM >= iMax) /* determine highest used index */
iMax = (mng_uint32)iM + 1;
pTemp += 2;
iLen -= 2;
if ((iDeltatype == 0) || (iDeltatype == 1))
if ((iDeltatype == MNG_DELTATYPE_REPLACERGB ) ||
(iDeltatype == MNG_DELTATYPE_DELTARGB ) )
iDiff = (iM - iX + 1) * 3;
else
if ((iDeltatype == 2) || (iDeltatype == 3))
if ((iDeltatype == MNG_DELTATYPE_REPLACEALPHA) ||
(iDeltatype == MNG_DELTATYPE_DELTAALPHA ) )
iDiff = (iM - iX + 1);
else
iDiff = (iM - iX + 1) * 4;
@ -5245,18 +5392,86 @@ READ_CHUNK (read_pplt)
if (iLen < iDiff)
MNG_ERROR (pData, MNG_INVALIDLENGTH)
pTemp += iDiff;
iLen -= iDiff;
if ((iDeltatype == MNG_DELTATYPE_REPLACERGB ) ||
(iDeltatype == MNG_DELTATYPE_DELTARGB ) )
{
for (iY = (mng_uint32)iX; iY <= (mng_uint32)iM; iY++)
{
aIndexentries [iY].iRed = *pTemp;
aIndexentries [iY].iGreen = *(pTemp+1);
aIndexentries [iY].iBlue = *(pTemp+2);
aUsedentries [iY] = 1;
pTemp += 3;
iLen -= 3;
}
}
else
if ((iDeltatype == MNG_DELTATYPE_REPLACEALPHA) ||
(iDeltatype == MNG_DELTATYPE_DELTAALPHA ) )
{
for (iY = (mng_uint32)iX; iY <= (mng_uint32)iM; iY++)
{
aAlphaentries [iY] = *pTemp;
aUsedentries [iY] = 1;
pTemp++;
iLen--;
}
}
else
{
for (iY = (mng_uint32)iX; iY <= (mng_uint32)iM; iY++)
{
aIndexentries [iY].iRed = *pTemp;
aIndexentries [iY].iGreen = *(pTemp+1);
aIndexentries [iY].iBlue = *(pTemp+2);
aAlphaentries [iY] = *(pTemp+3);
aUsedentries [iY] = 1;
pTemp += 4;
iLen -= 4;
}
}
}
#ifdef MNG_SUPPORT_DISPLAY
if (pData->bDisplaying)
switch (pData->iBitdepth) /* check maximum allowed entries for bitdepth */
{
case MNG_BITDEPTH_1 : {
if (iMax > 2)
MNG_ERROR (pData, MNG_INVALIDINDEX)
break;
}
case MNG_BITDEPTH_2 : {
if (iMax > 4)
MNG_ERROR (pData, MNG_INVALIDINDEX)
break;
}
case MNG_BITDEPTH_4 : {
if (iMax > 16)
MNG_ERROR (pData, MNG_INVALIDINDEX)
break;
}
}
#ifdef MNG_SUPPORT_DISPLAY
{ /* create animation object */
mng_retcode iRetcode = create_ani_pplt (pData, iDeltatype, iMax,
&aIndexentries, &aAlphaentries,
&aUsedentries);
/* TODO: something !!! */
if (iRetcode) /* on error bail out */
return iRetcode;
}
/* execute it now ? */
if ((pData->bDisplaying) && (pData->bRunning))
{
mng_retcode iRetcode = process_display_pplt (pData, iDeltatype, iMax,
&aIndexentries, &aAlphaentries,
&aUsedentries);
if (iRetcode) /* on error bail out */
return iRetcode;
}
#endif /* MNG_SUPPORT_DISPLAY */
@ -5269,65 +5484,15 @@ READ_CHUNK (read_pplt)
return iRetcode;
/* store the fields */
((mng_ppltp)*ppChunk)->iDeltatype = iDeltatype;
((mng_ppltp)*ppChunk)->iCount = 0;
((mng_ppltp)*ppChunk)->iCount = iMax;
pTemp = pRawdata + 1;
iLen = iRawlen - 1;
while (iLen) /* as long as there are entries left ... */
for (iY = 0; iY < 256; iY++)
{
iX = *pRawdata; /* get start and end index */
iM = *(pRawdata+1);
if ((mng_uint32)iM > ((mng_ppltp)*ppChunk)->iCount)
((mng_ppltp)*ppChunk)->iCount = iM;
pTemp += 2;
iLen -= 2;
if ((iDeltatype == 0) || (iDeltatype == 1))
{
while (iX <= iM)
{
((mng_ppltp)*ppChunk)->aEntries [iX].iRed = *pTemp;
((mng_ppltp)*ppChunk)->aEntries [iX].iGreen = *(pTemp+1);
((mng_ppltp)*ppChunk)->aEntries [iX].iBlue = *(pTemp+2);
((mng_ppltp)*ppChunk)->aEntries [iX].bUsed = MNG_TRUE;
iX++;
pTemp += 3;
iLen -= 3;
}
}
else
if ((iDeltatype == 2) || (iDeltatype == 3))
{
while (iX <= iM)
{
((mng_ppltp)*ppChunk)->aEntries [iX].iAlpha = *pTemp;
((mng_ppltp)*ppChunk)->aEntries [iX].bUsed = MNG_TRUE;
iX++;
pTemp++;
iLen--;
}
}
else
if ((iDeltatype == 4) || (iDeltatype == 5))
{
while (iX <= iM)
{
((mng_ppltp)*ppChunk)->aEntries [iX].iRed = *pTemp;
((mng_ppltp)*ppChunk)->aEntries [iX].iGreen = *(pTemp+1);
((mng_ppltp)*ppChunk)->aEntries [iX].iBlue = *(pTemp+2);
((mng_ppltp)*ppChunk)->aEntries [iX].iAlpha = *(pTemp+3);
((mng_ppltp)*ppChunk)->aEntries [iX].bUsed = MNG_TRUE;
iX++;
pTemp += 4;
iLen -= 4;
}
}
((mng_ppltp)*ppChunk)->aEntries [iY].iRed = aIndexentries [iY].iRed;
((mng_ppltp)*ppChunk)->aEntries [iY].iGreen = aIndexentries [iY].iGreen;
((mng_ppltp)*ppChunk)->aEntries [iY].iBlue = aIndexentries [iY].iBlue;
((mng_ppltp)*ppChunk)->aEntries [iY].iAlpha = aAlphaentries [iY];
((mng_ppltp)*ppChunk)->aEntries [iY].bUsed = (mng_bool)(aUsedentries [iY]);
}
}
#endif /* MNG_STORE_CHUNKS */

Просмотреть файл

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : mng_cms.c copyright (c) 2000 G.Juyn * */
/* * version : 0.5.2 * */
/* * version : 0.5.3 * */
/* * * */
/* * purpose : color management routines (implementation) * */
/* * * */
@ -31,6 +31,11 @@
/* * 0.5.2 - 06/10/2000 - G.Juyn * */
/* * - fixed some compilation-warnings (contrib Jason Morris) * */
/* * * */
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
/* * - fixed problem with color-correction for stored images * */
/* * 0.5.3 - 06/23/2000 - G.Juyn * */
/* * - fixed problem with incorrect gamma-correction * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -117,12 +122,18 @@ mng_retcode init_full_cms (mng_datap pData)
{
mng_cmsprof hProf;
mng_cmstrans hTrans;
mng_imagedatap pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf;
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
mng_imagedatap pBuf;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_FULL_CMS, MNG_LC_START)
#endif
if (!pImage) /* no current object? then use object 0 */
pImage = (mng_imagep)pData->pObjzero;
pBuf = pImage->pImgbuf; /* address the buffer */
if ((pBuf->bHasICCP) || (pData->bHasglobalICCP))
{
if (!pData->hProf2) /* output profile defined ? */
@ -462,12 +473,18 @@ mng_retcode correct_full_cms (mng_datap pData)
mng_retcode init_gamma_only (mng_datap pData)
{
mng_float dGamma;
mng_imagedatap pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf;
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
mng_imagedatap pBuf;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_GAMMA_ONLY, MNG_LC_START)
#endif
if (!pImage) /* no current object? then use object 0 */
pImage = (mng_imagep)pData->pObjzero;
pBuf = pImage->pImgbuf; /* address the buffer */
if (pBuf->bHasGAMA) /* get the gamma value */
dGamma = (mng_float)pBuf->iGamma / 100000;
else

Просмотреть файл

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : mng_data.h copyright (c) 2000 G.Juyn * */
/* * version : 0.5.2 * */
/* * version : 0.5.3 * */
/* * * */
/* * purpose : main data structure definition * */
/* * * */
@ -44,6 +44,15 @@
/* * 0.5.2 - 06/06/2000 - G.Juyn * */
/* * - added parameter for delayed buffer-processing * */
/* * * */
/* * 0.5.3 - 06/16/2000 - G.Juyn * */
/* * - added update-region parms for refresh calback * */
/* * - added Needrefresh parameter * */
/* * 0.5.3 - 06/17/2000 - G.Juyn * */
/* * - added Deltaimmediate parm for faster delta-processing * */
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
/* * - added Speed parameter to facilitate testing * */
/* * - added Imagelevel parameter for processtext callback * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -172,6 +181,8 @@ typedef struct mng_data_struct {
mng_uint32 iPlaytime;
mng_uint32 iSimplicity;
mng_uint32 iImagelevel; /* level an image inside a stream */
mng_uint32 iCanvasstyle; /* layout of the drawing-canvas */
mng_uint32 iBkgdstyle; /* layout of the background-canvas */
@ -198,7 +209,9 @@ typedef struct mng_data_struct {
mng_float dDisplaygamma; /* initially set for sRGB conditions */
mng_float dDfltimggamma;
mng_bool bStorechunks; /* switch to store chunkdata */
mng_bool bStorechunks; /* switch for storing chunkdata */
mng_speedtype iSpeed; /* speed-modifier for animations */
mng_uint32 iMaxwidth; /* maximum canvas size */
mng_uint32 iMaxheight; /* initially set to 1024 x 1024 */
@ -333,6 +346,7 @@ typedef struct mng_data_struct {
mng_read_resume! */
mng_uint8 iSuspendpoint; /* indicates at which point the flow
was broken to suspend input-reading */
mng_bool bNeedrefresh; /* indicates screen-refresh is needed */
mng_objectp pCurrentobj; /* current "object" */
mng_objectp pCurraniobj; /* current animation object
"to be"/"being" processed */
@ -344,6 +358,11 @@ typedef struct mng_data_struct {
mng_objectp pRetrieveobj; /* current retrieve object for row routines */
mng_savedatap pSavedata; /* pointer to saved data (after SAVE) */
mng_uint32 iUpdateleft; /* update region for refresh */
mng_uint32 iUpdateright;
mng_uint32 iUpdatetop;
mng_uint32 iUpdatebottom;
mng_int8 iPass; /* current interlacing pass;
negative value means no interlace */
mng_int32 iRow; /* current row counter */
@ -484,6 +503,7 @@ typedef struct mng_data_struct {
mng_uint32 iDeltaBlockheight;
mng_uint32 iDeltaBlockx;
mng_uint32 iDeltaBlocky;
mng_bool bDeltaimmediate;
mng_ptr fDeltagetrow; /* internal delta-proc callbacks */
mng_ptr fDeltaaddrow;

Просмотреть файл

@ -54,6 +54,16 @@
/* * - fixed display of stored JNG images * */
/* * 0.5.3 - 06/13/2000 - G.Juyn * */
/* * - fixed problem with BASI-IEND as object 0 * */
/* * 0.5.3 - 06/16/2000 - G.Juyn * */
/* * - changed progressive-display processing * */
/* * 0.5.3 - 06/17/2000 - G.Juyn * */
/* * - changed delta-image processing * */
/* * 0.5.3 - 06/20/2000 - G.Juyn * */
/* * - fixed some minor stuff * */
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
/* * - added speed-modifier to timing routine * */
/* * 0.5.3 - 06/22/2000 - G.Juyn * */
/* * - added support for PPLT chunk processing * */
/* * * */
/* ************************************************************************** */
@ -81,6 +91,42 @@
#ifdef MNG_INCLUDE_DISPLAY_PROCS
/* ************************************************************************** */
/* * * */
/* * Progressive display refresh - does the actual call to refresh and sets * */
/* * the timer to allow the app to perform the actual refresh to the screen * */
/* * (eg. process its main message-loop) * */
/* * * */
/* ************************************************************************** */
mng_retcode display_progressive_refresh (mng_datap pData,
mng_uint32 iInterval)
{ /* tell the app to refresh */
if ((pData->iUpdatetop < pData->iUpdatebottom) && (pData->iUpdateleft < pData->iUpdateright))
{
if (!pData->fRefresh (((mng_handle)pData),
pData->iUpdatetop, pData->iUpdateleft,
pData->iUpdatebottom, pData->iUpdateright))
MNG_ERROR (pData, MNG_APPMISCERROR)
pData->iUpdateleft = 0; /* reset update-region */
pData->iUpdateright = 0;
pData->iUpdatetop = 0;
pData->iUpdatebottom = 0;
pData->bNeedrefresh = MNG_FALSE; /* reset refreshneeded indicator */
if (iInterval) /* interval requested ? */
{ /* setup the timer */
if (!pData->fSettimer ((mng_handle)pData, iInterval))
MNG_ERROR (pData, MNG_APPTIMERERROR)
pData->bTimerset = MNG_TRUE; /* and indicate so */
}
}
return MNG_NOERROR;
}
/* ************************************************************************** */
/* * * */
/* * Generic display routines * */
@ -94,16 +140,29 @@
mng_retcode interframe_delay (mng_datap pData)
{
mng_uint32 iWaitfor;
mng_bool bOke;
mng_uint32 iInterval;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INTERFRAME_DELAY, MNG_LC_START)
#endif
if (!pData->bRunning) /* sanity check for frozen status */
MNG_WARNING (pData, MNG_IMAGEFROZEN)
if (pData->iFramedelay > 0) /* let the app refresh first */
if (!pData->fRefresh (((mng_handle)pData), 0, 0,
pData->iHeight, pData->iWidth))
MNG_ERROR (pData, MNG_APPMISCERROR)
{
if ((pData->iUpdatetop < pData->iUpdatebottom) && (pData->iUpdateleft < pData->iUpdateright))
if (!pData->fRefresh (((mng_handle)pData),
pData->iUpdatetop, pData->iUpdateleft,
pData->iUpdatebottom, pData->iUpdateright))
MNG_ERROR (pData, MNG_APPMISCERROR)
pData->iUpdateleft = 0; /* reset update-region */
pData->iUpdateright = 0;
pData->iUpdatetop = 0;
pData->iUpdatebottom = 0;
pData->bNeedrefresh = MNG_FALSE; /* reset refreshneeded indicator */
}
/* get current tickcount */
pData->iRuntime = pData->fGettickcount ((mng_handle)pData);
/* tickcount wrapped around ? */
@ -117,34 +176,48 @@ mng_retcode interframe_delay (mng_datap pData)
/* TODO: yeah, what to do ??? */
if (pData->iTicks) /* what are we aiming for */
iWaitfor = pData->iFrametime + ((1000 * pData->iFramedelay) / pData->iTicks);
{
switch (pData->iSpeed) /* honor speed modifier */
{
case mng_st_fast :
{
iWaitfor = (mng_uint32)(( 500 * pData->iFramedelay) / pData->iTicks);
break;
}
case mng_st_slow :
{
iWaitfor = (mng_uint32)((3000 * pData->iFramedelay) / pData->iTicks);
break;
}
case mng_st_slowest :
{
iWaitfor = (mng_uint32)((8000 * pData->iFramedelay) / pData->iTicks);
break;
}
default :
{
iWaitfor = (mng_uint32)((1000 * pData->iFramedelay) / pData->iTicks);
}
}
iWaitfor = pData->iFrametime + iWaitfor;
}
else
iWaitfor = pData->iFrametime;
if (pData->iRuntime < iWaitfor) /* delay necessary ? */
{ /* then set the timer */
bOke = pData->fSettimer ((mng_handle)pData, iWaitfor - pData->iRuntime);
pData->bTimerset = MNG_TRUE; /* and indicate so */
}
iInterval = iWaitfor - pData->iRuntime;
else
{
if (!pData->bRunning) /* sanity check for frozen status */
MNG_WARNING (pData, MNG_IMAGEFROZEN)
/* just give the app some breathing space */
bOke = pData->fSettimer ((mng_handle)pData, 10);
pData->bTimerset = MNG_TRUE; /* and indicate so */
}
if (!bOke) /* timer set not oke ? */
iInterval = 10; /* force app to process messageloop */
/* set the timer */
if (!pData->fSettimer ((mng_handle)pData, iInterval))
MNG_ERROR (pData, MNG_APPTIMERERROR)
pData->bTimerset = MNG_TRUE; /* and indicate so */
pData->iFrametime = iWaitfor; /* increase frametime in advance */
/* setup for next delay */
pData->iFramedelay = pData->iNextdelay;
/* note that slow systems may never catch up !!!
TODO: set timer at least 10 times per second to prevent deadlock */
/* TODO: some provision to compensate during slow file-access (such as
on low-bandwidth network connections);
only necessary during read-processing! */
@ -453,7 +526,7 @@ mng_retcode next_frame (mng_datap pData,
mng_retcode next_layer (mng_datap pData)
{
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
mng_imagep pImage;
mng_retcode iRetcode = MNG_NOERROR;
#ifdef MNG_SUPPORT_TRACE
@ -486,6 +559,11 @@ mng_retcode next_layer (mng_datap pData)
if (iRetcode) /* on error bail out */
return iRetcode;
if (pData->bHasDHDR) /* processing a delta-image ? */
pImage = (mng_imagep)pData->pDeltaImage;
else
pImage = (mng_imagep)pData->pCurrentobj;
if (!pImage) /* not an active object ? */
pImage = (mng_imagep)pData->pObjzero;
/* determine display rectangle */
@ -576,7 +654,11 @@ mng_retcode display_image (mng_datap pData,
if ((pData->iDestr >= pData->iDestl) && (pData->iDestb >= pData->iDestt))
{
mng_int32 iY;
#ifdef MNG_NO_CMS
mng_retcode iRetcode = MNG_NOERROR;
#else
mng_retcode iRetcode;
#endif
set_display_routine (pData); /* determine display routine */
/* and image-buffer retrieval routine */
@ -731,6 +813,131 @@ mng_retcode display_image (mng_datap pData,
/* ************************************************************************** */
mng_retcode execute_delta_image (mng_datap pData,
mng_imagep pTarget,
mng_imagep pDelta)
{
mng_imagedatap pBuftarget = pTarget->pImgbuf;
mng_imagedatap pBufdelta = pDelta->pImgbuf;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_EXECUTE_DELTA_IMAGE, MNG_LC_START)
#endif
if (pBufdelta->bHasPLTE) /* palette in delta ? */
{
mng_uint32 iX;
/* new palette larger than old one ? */
if ((!pBuftarget->bHasPLTE) || (pBuftarget->iPLTEcount < pBufdelta->iPLTEcount))
pBuftarget->iPLTEcount = pBufdelta->iPLTEcount;
/* it's definitely got a PLTE now */
pBuftarget->bHasPLTE = MNG_TRUE;
for (iX = 0; iX < pBufdelta->iPLTEcount; iX++)
{
pBuftarget->aPLTEentries[iX].iRed = pBufdelta->aPLTEentries[iX].iRed;
pBuftarget->aPLTEentries[iX].iGreen = pBufdelta->aPLTEentries[iX].iGreen;
pBuftarget->aPLTEentries[iX].iBlue = pBufdelta->aPLTEentries[iX].iBlue;
}
}
if (pBufdelta->bHasTRNS) /* cheap transparency in delta ? */
{
switch (pData->iColortype) /* drop it into the target */
{
case 0: { /* gray */
pBuftarget->iTRNSgray = pBufdelta->iTRNSgray;
pBuftarget->iTRNSred = 0;
pBuftarget->iTRNSgreen = 0;
pBuftarget->iTRNSblue = 0;
pBuftarget->iTRNScount = 0;
break;
}
case 2: { /* rgb */
pBuftarget->iTRNSgray = 0;
pBuftarget->iTRNSred = pBufdelta->iTRNSred;
pBuftarget->iTRNSgreen = pBufdelta->iTRNSgreen;
pBuftarget->iTRNSblue = pBufdelta->iTRNSblue;
pBuftarget->iTRNScount = 0;
break;
}
case 3: { /* indexed */
pBuftarget->iTRNSgray = 0;
pBuftarget->iTRNSred = 0;
pBuftarget->iTRNSgreen = 0;
pBuftarget->iTRNSblue = 0;
/* existing range smaller than new one ? */
if ((!pBuftarget->bHasTRNS) || (pBuftarget->iTRNScount < pBufdelta->iTRNScount))
pBuftarget->iTRNScount = pBufdelta->iTRNScount;
MNG_COPY (&pBuftarget->aTRNSentries, &pBufdelta->aTRNSentries, pBufdelta->iTRNScount)
break;
}
}
pBuftarget->bHasTRNS = MNG_TRUE; /* tell it it's got a tRNS now */
}
/* TODO: copy bKGD (if it exists!) */
if (pBufdelta->bHasGAMA) /* gamma in source ? */
{
pBuftarget->bHasGAMA = MNG_TRUE; /* drop it onto the target */
pBuftarget->iGamma = pBufdelta->iGamma;
}
if (pBufdelta->bHasCHRM) /* chroma in delta ? */
{ /* drop it onto the target */
pBuftarget->bHasCHRM = MNG_TRUE;
pBuftarget->iWhitepointx = pBufdelta->iWhitepointx;
pBuftarget->iWhitepointy = pBufdelta->iWhitepointy;
pBuftarget->iPrimaryredx = pBufdelta->iPrimaryredx;
pBuftarget->iPrimaryredy = pBufdelta->iPrimaryredy;
pBuftarget->iPrimarygreenx = pBufdelta->iPrimarygreenx;
pBuftarget->iPrimarygreeny = pBufdelta->iPrimarygreeny;
pBuftarget->iPrimarybluex = pBufdelta->iPrimarybluex;
pBuftarget->iPrimarybluey = pBufdelta->iPrimarybluey;
}
if (pBufdelta->bHasSRGB) /* sRGB in delta ? */
{ /* drop it onto the target */
pBuftarget->bHasSRGB = MNG_TRUE;
pBuftarget->iRenderingintent = pBufdelta->iRenderingintent;
}
if (pBufdelta->bHasICCP) /* ICC profile in delta ? */
{
pBuftarget->bHasICCP = MNG_TRUE; /* drop it onto the target */
if (pBuftarget->pProfile) /* profile existed ? */
MNG_FREEX (pData, pBuftarget->pProfile, pBuftarget->iProfilesize)
/* allocate a buffer & copy it */
MNG_ALLOC (pData, pBuftarget->pProfile, pBufdelta->iProfilesize)
MNG_COPY (pBuftarget->pProfile, pBufdelta->pProfile, pBufdelta->iProfilesize)
/* store it's length as well */
pBuftarget->iProfilesize = pBufdelta->iProfilesize;
}
if (!pData->bDeltaimmediate) /* need to execute delta pixels ? */
{
/* TODO: execute delta pixels (if they exist!) */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_EXECUTE_DELTA_IMAGE, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode save_state (mng_datap pData)
{
mng_savedatap pSave;
@ -1104,6 +1311,10 @@ mng_retcode process_display_ihdr (mng_datap pData)
pData->iBitdepth, pData->iColortype,
pData->iCompression, pData->iFilter,
pData->iInterlace, MNG_TRUE);
/* process immediatly if bitdepth & colortype are equal */
pData->bDeltaimmediate =
(mng_bool)((pData->iBitdepth == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iBitdepth ) &&
(pData->iColortype == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iColortype) );
}
else
{
@ -1358,6 +1569,7 @@ mng_retcode process_display_iend (mng_datap pData)
{
mng_retcode iRetcode, iRetcode2;
mng_bool bDodisplay = MNG_FALSE;
mng_bool bCleanup = (mng_bool)(pData->iBreakpoint != 0);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IEND, MNG_LC_START)
@ -1374,7 +1586,8 @@ mng_retcode process_display_iend (mng_datap pData)
if ((pData->bHasBASI) || /* was it a BASI stream */
(bDodisplay) || /* or should we display the JNG */
(pData->iBreakpoint)) /* or did we get broken last time ? */
/* or did we get broken here last time ? */
((pData->iBreakpoint) && (pData->iBreakpoint != 8)))
{
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
@ -1393,6 +1606,28 @@ mng_retcode process_display_iend (mng_datap pData)
}
}
if ((pData->bHasDHDR) || /* was it a DHDR stream */
(pData->iBreakpoint == 8)) /* or did we get broken here last time ? */
{
mng_imagep pImage = (mng_imagep)pData->pDeltaImage;
/* perform the delta operations needed */
iRetcode = execute_delta_image (pData, pImage, (mng_imagep)pData->pObjzero);
if (iRetcode) /* on error bail out */
return iRetcode;
/* display it now then ? */
if ((pImage->bVisible) && (pImage->bViewable))
{ /* ok, so do it */
iRetcode = display_image (pData, pImage, MNG_FALSE);
if (iRetcode) /* on error bail out */
return iRetcode;
if (pData->bTimerset) /* timer break ? */
pData->iBreakpoint = 8;
}
}
if (!pData->bTimerset) /* can we continue ? */
{
pData->iBreakpoint = 0; /* clear this flag now ! */
@ -1428,10 +1663,27 @@ mng_retcode process_display_iend (mng_datap pData)
/* if the image was displayed on the fly, */
/* we'll have to make the app refresh */
if ((pData->eImagetype != mng_it_mng) && (pData->fDisplayrow))
if (!pData->fRefresh (((mng_handle)pData), 0, 0,
pData->iHeight, pData->iWidth))
MNG_ERROR (pData, MNG_APPMISCERROR)
pData->bNeedrefresh = MNG_TRUE;
if (bCleanup) /* if we got broken last time we need to cleanup */
{
pData->bHasIHDR = MNG_FALSE; /* IEND signals the end for most ... */
pData->bHasBASI = MNG_FALSE;
pData->bHasDHDR = MNG_FALSE;
#ifdef MNG_INCLUDE_JNG
pData->bHasJHDR = MNG_FALSE;
pData->bHasJSEP = MNG_FALSE;
pData->bHasJDAT = MNG_FALSE;
#endif
pData->bHasPLTE = MNG_FALSE;
pData->bHasTRNS = MNG_FALSE;
pData->bHasGAMA = MNG_FALSE;
pData->bHasCHRM = MNG_FALSE;
pData->bHasSRGB = MNG_FALSE;
pData->bHasICCP = MNG_FALSE;
pData->bHasBKGD = MNG_FALSE;
pData->bHasIDAT = MNG_FALSE;
}
}
#ifdef MNG_SUPPORT_TRACE
@ -1519,9 +1771,7 @@ mng_retcode process_display_mend (mng_datap pData)
}
if (!pData->pCurraniobj) /* always let the app refresh at the end ! */
if (!pData->fRefresh (((mng_handle)pData), 0, 0,
pData->iHeight, pData->iWidth))
MNG_ERROR (pData, MNG_APPMISCERROR)
pData->bNeedrefresh = MNG_TRUE;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MEND, MNG_LC_END)
@ -2763,7 +3013,8 @@ mng_retcode process_display_dhdr (mng_datap pData,
mng_uint32 iBlockx,
mng_uint32 iBlocky)
{
mng_imagep pImage;
mng_imagep pImage;
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DHDR, MNG_LC_START)
@ -2808,18 +3059,6 @@ mng_retcode process_display_dhdr (mng_datap pData,
pData->iDatawidth = iBlockwidth;
pData->iDataheight = iBlockheight;
}
/* full image replace ? */
if (iDeltatype == MNG_DELTATYPE_REPLACE)
{
mng_retcode iRetcode = reset_object_details (pData, pImage,
pData->iDatawidth, pData->iDataheight,
pData->iBitdepth, pData->iColortype,
pData->iCompression, pData->iFilter,
pData->iInterlace, MNG_TRUE);
if (iRetcode) /* on error bail out */
return iRetcode;
}
switch (iDeltatype) /* determine nr of delta-channels */
{
@ -2852,8 +3091,71 @@ mng_retcode process_display_dhdr (mng_datap pData,
}
}
/* full image replace ? */
if (iDeltatype == MNG_DELTATYPE_REPLACE)
{
iRetcode = reset_object_details (pData, pImage,
pData->iDatawidth, pData->iDataheight,
pData->iBitdepth, pData->iColortype,
pData->iCompression, pData->iFilter,
pData->iInterlace, MNG_FALSE);
pData->pStoreobj = pImage; /* this is our target */
if (iRetcode) /* on error bail out */
return iRetcode;
pData->pStoreobj = pImage; /* and store straight into this object */
}
else
{
mng_imagedatap pBufzero, pBuf;
/* we store in object 0 and process it later */
pData->pStoreobj = pData->pObjzero;
/* make sure to initialize object 0 then */
iRetcode = reset_object_details (pData, (mng_imagep)pData->pObjzero,
pData->iDatawidth, pData->iDataheight,
pData->iBitdepth, pData->iColortype,
pData->iCompression, pData->iFilter,
pData->iInterlace, MNG_TRUE);
if (iRetcode) /* on error bail out */
return iRetcode;
pBuf = pImage->pImgbuf; /* copy possible palette & cheap transparency */
pBufzero = ((mng_imagep)pData->pObjzero)->pImgbuf;
pBufzero->bHasPLTE = pBuf->bHasPLTE;
pBufzero->bHasTRNS = pBuf->bHasTRNS;
if (pBufzero->bHasPLTE) /* copy palette ? */
{
mng_uint32 iX;
pBufzero->iPLTEcount = pBuf->iPLTEcount;
for (iX = 0; iX < pBuf->iPLTEcount; iX++)
{
pBufzero->aPLTEentries [iX].iRed = pBuf->aPLTEentries [iX].iRed;
pBufzero->aPLTEentries [iX].iGreen = pBuf->aPLTEentries [iX].iGreen;
pBufzero->aPLTEentries [iX].iBlue = pBuf->aPLTEentries [iX].iBlue;
}
}
if (pBufzero->bHasTRNS) /* copy cheap transparency ? */
{
pBufzero->iTRNSgray = pBuf->iTRNSgray;
pBufzero->iTRNSred = pBuf->iTRNSred;
pBufzero->iTRNSgreen = pBuf->iTRNSgreen;
pBufzero->iTRNSblue = pBuf->iTRNSblue;
pBufzero->iTRNScount = pBuf->iTRNScount;
MNG_COPY (&pBufzero->aTRNSentries, &pBuf->aTRNSentries,
sizeof (pBufzero->aTRNSentries))
}
/* process immediatly if bitdepth & colortype are equal */
pData->bDeltaimmediate =
(mng_bool)((pData->iBitdepth == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iBitdepth ) &&
(pData->iColortype == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iColortype) );
}
switch (pData->iColortype) /* determine row initialization routine */
{
@ -3087,6 +3389,148 @@ mng_retcode process_display_ijng (mng_datap pData)
/* ************************************************************************** */
mng_retcode process_display_pplt (mng_datap pData,
mng_uint8 iType,
mng_uint32 iCount,
mng_rgbpaltab* paIndexentries,
mng_uint8arr* paAlphaentries,
mng_uint8arr* paUsedentries)
{
mng_uint32 iX;
mng_imagep pImage = (mng_imagep)pData->pObjzero;
mng_imagedatap pBuf = pImage->pImgbuf;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PPLT, MNG_LC_START)
#endif
switch (iType)
{
case MNG_DELTATYPE_REPLACERGB :
{
for (iX = 0; iX < iCount; iX++)
{
if ((*(paUsedentries)) [iX])
{
pBuf->aPLTEentries [iX].iRed = (*(paIndexentries)) [iX].iRed;
pBuf->aPLTEentries [iX].iGreen = (*(paIndexentries)) [iX].iGreen;
pBuf->aPLTEentries [iX].iBlue = (*(paIndexentries)) [iX].iBlue;
}
}
break;
}
case MNG_DELTATYPE_DELTARGB :
{
for (iX = 0; iX < iCount; iX++)
{
if ((*(paUsedentries)) [iX])
{
pBuf->aPLTEentries [iX].iRed =
(mng_uint8)(pBuf->aPLTEentries [iX].iRed +
(*(paIndexentries)) [iX].iRed );
pBuf->aPLTEentries [iX].iGreen =
(mng_uint8)(pBuf->aPLTEentries [iX].iGreen +
(*(paIndexentries)) [iX].iGreen);
pBuf->aPLTEentries [iX].iBlue =
(mng_uint8)(pBuf->aPLTEentries [iX].iBlue +
(*(paIndexentries)) [iX].iBlue );
}
}
break;
}
case MNG_DELTATYPE_REPLACEALPHA :
{
for (iX = 0; iX < iCount; iX++)
{
if ((*(paUsedentries)) [iX])
pBuf->aTRNSentries [iX] = (*(paAlphaentries)) [iX];
}
break;
}
case MNG_DELTATYPE_DELTAALPHA :
{
for (iX = 0; iX < iCount; iX++)
{
if ((*(paUsedentries)) [iX])
pBuf->aTRNSentries [iX] =
(mng_uint8)(pBuf->aTRNSentries [iX] +
(*(paAlphaentries)) [iX]);
}
break;
}
case MNG_DELTATYPE_REPLACERGBA :
{
for (iX = 0; iX < iCount; iX++)
{
if ((*(paUsedentries)) [iX])
{
pBuf->aPLTEentries [iX].iRed = (*(paIndexentries)) [iX].iRed;
pBuf->aPLTEentries [iX].iGreen = (*(paIndexentries)) [iX].iGreen;
pBuf->aPLTEentries [iX].iBlue = (*(paIndexentries)) [iX].iBlue;
pBuf->aTRNSentries [iX] = (*(paAlphaentries)) [iX];
}
}
break;
}
case MNG_DELTATYPE_DELTARGBA :
{
for (iX = 0; iX < iCount; iX++)
{
if ((*(paUsedentries)) [iX])
{
pBuf->aPLTEentries [iX].iRed =
(mng_uint8)(pBuf->aPLTEentries [iX].iRed +
(*(paIndexentries)) [iX].iRed );
pBuf->aPLTEentries [iX].iGreen =
(mng_uint8)(pBuf->aPLTEentries [iX].iGreen +
(*(paIndexentries)) [iX].iGreen);
pBuf->aPLTEentries [iX].iBlue =
(mng_uint8)(pBuf->aPLTEentries [iX].iBlue +
(*(paIndexentries)) [iX].iBlue );
pBuf->aTRNSentries [iX] =
(mng_uint8)(pBuf->aTRNSentries [iX] +
(*(paAlphaentries)) [iX]);
}
}
break;
}
}
if ((iType != MNG_DELTATYPE_REPLACERGB) && (iType != MNG_DELTATYPE_DELTARGB))
{
if (pBuf->bHasTRNS)
{
if (iCount > pBuf->iTRNScount)
pBuf->iTRNScount = iCount;
}
else
{
pBuf->iTRNScount = iCount;
pBuf->bHasTRNS = MNG_TRUE;
}
}
if ((iType != MNG_DELTATYPE_REPLACEALPHA) && (iType != MNG_DELTATYPE_DELTAALPHA))
{
if (iCount > pBuf->iPLTEcount)
pBuf->iPLTEcount = iCount;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PPLT, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#endif /* MNG_INCLUDE_DISPLAY_PROCS */
/* ************************************************************************** */

Просмотреть файл

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : mng_display.h copyright (c) 2000 G.Juyn * */
/* * version : 0.5.2 * */
/* * version : 0.5.3 * */
/* * * */
/* * purpose : Display management (definition) * */
/* * * */
@ -21,6 +21,12 @@
/* * 0.5.2 - 05/20/2000 - G.Juyn * */
/* * - added JNG support stuff * */
/* * * */
/* * 0.5.3 - 06/16/2000 - G.Juyn * */
/* * - changed progressive-display processing * */
/* * 0.5.3 - 06/22/2000 - G.Juyn * */
/* * - added support for delta-image processing * */
/* * - added support for PPLT chunk processing * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -35,102 +41,118 @@
/* ************************************************************************** */
mng_retcode display_image (mng_datap pData,
mng_imagep pImage,
mng_bool bLayeradvanced);
mng_retcode display_progressive_refresh (mng_datap pData,
mng_uint32 iInterval);
/* ************************************************************************** */
mng_retcode process_display_ihdr (mng_datap pData);
mng_retcode display_image (mng_datap pData,
mng_imagep pImage,
mng_bool bLayeradvanced);
mng_retcode process_display_idat (mng_datap pData,
mng_uint32 iRawlen,
mng_uint8p pRawdata);
mng_retcode execute_delta_image (mng_datap pData,
mng_imagep pTarget,
mng_imagep pDelta);
/* ************************************************************************** */
mng_retcode process_display_iend (mng_datap pData);
mng_retcode process_display_mend (mng_datap pData);
mng_retcode process_display_defi (mng_datap pData);
mng_retcode process_display_ihdr (mng_datap pData);
mng_retcode process_display_basi (mng_datap pData,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue,
mng_bool bHasalpha,
mng_uint16 iAlpha,
mng_uint8 iViewable);
mng_retcode process_display_idat (mng_datap pData,
mng_uint32 iRawlen,
mng_uint8p pRawdata);
mng_retcode process_display_clon (mng_datap pData,
mng_uint16 iSourceid,
mng_uint16 iCloneid,
mng_uint8 iClonetype,
mng_bool bHasdonotshow,
mng_uint8 iDonotshow,
mng_uint8 iConcrete,
mng_bool bHasloca,
mng_uint8 iLocationtype,
mng_int32 iLocationx,
mng_int32 iLocationy);
mng_retcode process_display_clon2 (mng_datap pData);
mng_retcode process_display_iend (mng_datap pData);
mng_retcode process_display_mend (mng_datap pData);
mng_retcode process_display_defi (mng_datap pData);
mng_retcode process_display_disc (mng_datap pData,
mng_uint32 iCount,
mng_uint16p pIds);
mng_retcode process_display_basi (mng_datap pData,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue,
mng_bool bHasalpha,
mng_uint16 iAlpha,
mng_uint8 iViewable);
mng_retcode process_display_fram (mng_datap pData,
mng_uint8 iFramemode,
mng_uint8 iChangedelay,
mng_uint32 iDelay,
mng_uint8 iChangetimeout,
mng_uint32 iTimeout,
mng_uint8 iChangeclipping,
mng_uint8 iCliptype,
mng_int32 iClipl,
mng_int32 iClipr,
mng_int32 iClipt,
mng_int32 iClipb);
mng_retcode process_display_fram2 (mng_datap pData);
mng_retcode process_display_clon (mng_datap pData,
mng_uint16 iSourceid,
mng_uint16 iCloneid,
mng_uint8 iClonetype,
mng_bool bHasdonotshow,
mng_uint8 iDonotshow,
mng_uint8 iConcrete,
mng_bool bHasloca,
mng_uint8 iLocationtype,
mng_int32 iLocationx,
mng_int32 iLocationy);
mng_retcode process_display_clon2 (mng_datap pData);
mng_retcode process_display_move (mng_datap pData,
mng_uint16 iFromid,
mng_uint16 iToid,
mng_uint8 iMovetype,
mng_int32 iMovex,
mng_int32 iMovey);
mng_retcode process_display_disc (mng_datap pData,
mng_uint32 iCount,
mng_uint16p pIds);
mng_retcode process_display_clip (mng_datap pData,
mng_uint16 iFromid,
mng_uint16 iToid,
mng_uint8 iCliptype,
mng_int32 iClipl,
mng_int32 iClipr,
mng_int32 iClipt,
mng_int32 iClipb);
mng_retcode process_display_fram (mng_datap pData,
mng_uint8 iFramemode,
mng_uint8 iChangedelay,
mng_uint32 iDelay,
mng_uint8 iChangetimeout,
mng_uint32 iTimeout,
mng_uint8 iChangeclipping,
mng_uint8 iCliptype,
mng_int32 iClipl,
mng_int32 iClipr,
mng_int32 iClipt,
mng_int32 iClipb);
mng_retcode process_display_fram2 (mng_datap pData);
mng_retcode process_display_show (mng_datap pData);
mng_retcode process_display_save (mng_datap pData);
mng_retcode process_display_seek (mng_datap pData);
mng_retcode process_display_jhdr (mng_datap pData);
mng_retcode process_display_move (mng_datap pData,
mng_uint16 iFromid,
mng_uint16 iToid,
mng_uint8 iMovetype,
mng_int32 iMovex,
mng_int32 iMovey);
mng_retcode process_display_jdat (mng_datap pData,
mng_uint32 iRawlen,
mng_uint8p pRawdata);
mng_retcode process_display_clip (mng_datap pData,
mng_uint16 iFromid,
mng_uint16 iToid,
mng_uint8 iCliptype,
mng_int32 iClipl,
mng_int32 iClipr,
mng_int32 iClipt,
mng_int32 iClipb);
mng_retcode process_display_dhdr (mng_datap pData,
mng_uint16 iObjectid,
mng_uint8 iImagetype,
mng_uint8 iDeltatype,
mng_uint32 iBlockwidth,
mng_uint32 iBlockheight,
mng_uint32 iBlockx,
mng_uint32 iBlocky);
mng_retcode process_display_show (mng_datap pData);
mng_retcode process_display_save (mng_datap pData);
mng_retcode process_display_seek (mng_datap pData);
mng_retcode process_display_jhdr (mng_datap pData);
mng_retcode process_display_prom (mng_datap pData,
mng_uint8 iBitdepth,
mng_uint8 iColortype,
mng_uint8 iFilltype);
mng_retcode process_display_jdat (mng_datap pData,
mng_uint32 iRawlen,
mng_uint8p pRawdata);
mng_retcode process_display_ipng (mng_datap pData);
mng_retcode process_display_ijng (mng_datap pData);
mng_retcode process_display_dhdr (mng_datap pData,
mng_uint16 iObjectid,
mng_uint8 iImagetype,
mng_uint8 iDeltatype,
mng_uint32 iBlockwidth,
mng_uint32 iBlockheight,
mng_uint32 iBlockx,
mng_uint32 iBlocky);
mng_retcode process_display_prom (mng_datap pData,
mng_uint8 iBitdepth,
mng_uint8 iColortype,
mng_uint8 iFilltype);
mng_retcode process_display_ipng (mng_datap pData);
mng_retcode process_display_ijng (mng_datap pData);
mng_retcode process_display_pplt (mng_datap pData,
mng_uint8 iType,
mng_uint32 iCount,
mng_rgbpaltab* paIndexentries,
mng_uint8arr* paAlphaentries,
mng_uint8arr* paUsedentries);
/* ************************************************************************** */

Просмотреть файл

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : mng_hlapi.c copyright (c) 2000 G.Juyn * */
/* * version : 0.5.2 * */
/* * version : 0.5.3 * */
/* * * */
/* * purpose : high-level application API (implementation) * */
/* * * */
@ -50,6 +50,15 @@
/* * 0.5.2 - 06/06/2000 - G.Juyn * */
/* * - added initialization of the buffer-suspend parameter * */
/* * * */
/* * 0.5.3 - 06/16/2000 - G.Juyn * */
/* * - added initialization of update-region for refresh * */
/* * - added initialization of Needrefresh parameter * */
/* * 0.5.3 - 06/17/2000 - G.Juyn * */
/* * - added initialization of Deltaimmediate * */
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
/* * - added initialization of Speed * */
/* * - added initialization of Imagelevel * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -313,6 +322,8 @@ mng_handle MNG_DECL mng_initialize (mng_int32 iUserdata,
pData->dDfltimggamma = 0.45455;
pData->bStorechunks = 1; /* initially remember chunks */
/* normal animation-speed ! */
pData->iSpeed = mng_st_normal;
/* initial image limits */
pData->iMaxwidth = 1600;
pData->iMaxheight = 1200;
@ -464,6 +475,8 @@ mng_retcode MNG_DECL mng_reset (mng_handle hHandle)
pData->iFramecount = 0;
pData->iPlaytime = 0;
pData->iImagelevel = 0; /* no image encountered */
pData->iMagnify = 0; /* 1-to-1 display */
pData->iOffsetx = 0; /* no offsets */
pData->iOffsety = 0;
@ -568,6 +581,7 @@ mng_retcode MNG_DECL mng_reset (mng_handle hHandle)
pData->iBreakpoint = 0;
pData->bSuspended = MNG_FALSE;
pData->iSuspendpoint = 0;
pData->bNeedrefresh = MNG_FALSE;
pData->pCurrentobj = 0; /* these don't exist yet */
pData->pCurraniobj = 0;
@ -581,6 +595,11 @@ mng_retcode MNG_DECL mng_reset (mng_handle hHandle)
/* TODO: remove in 1.0.0 !!! */
pData->bEMNGMAhack = MNG_FALSE;
pData->iUpdateleft = 0; /* no region updated yet */
pData->iUpdateright = 0;
pData->iUpdatetop = 0;
pData->iUpdatebottom = 0;
pData->iPass = 0; /* interlacing stuff and temp buffers */
pData->iRow = 0;
pData->iRowinc = 0;
@ -707,6 +726,7 @@ mng_retcode MNG_DECL mng_reset (mng_handle hHandle)
pData->iDeltaBlockheight = 0;
pData->iDeltaBlockx = 0;
pData->iDeltaBlocky = 0;
pData->bDeltaimmediate = MNG_FALSE;
#endif
#ifdef MNG_INCLUDE_ZLIB

Просмотреть файл

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : mng_jpeg.c copyright (c) 2000 G.Juyn * */
/* * version : 0.5.2 * */
/* * version : 0.5.3 * */
/* * * */
/* * purpose : JPEG library interface (implementation) * */
/* * * */
@ -21,6 +21,9 @@
/* * 0.5.2 - 05/22/2000 - G.Juyn * */
/* * - implemented all the JNG routines * */
/* * * */
/* * 0.5.3 - 06/17/2000 - G.Juyn * */
/* * - added tracing of JPEG calls * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -201,7 +204,7 @@ mng_retcode mngjpeg_cleanup (mng_datap pData)
#ifdef MNG_USE_SETJMP
iRetcode = setjmp (pData->sErrorbuf);/* setup local JPEG error-recovery */
if (iRetcode != 0) /* got here from longjmp ? */
MNG_ERRORJ (pData, iRetcode); /* then IJG-lib issued an error */
MNG_ERRORJ (pData, iRetcode) /* then IJG-lib issued an error */
#endif
if (pData->bJPEGcompress) /* still compressing something ? */
@ -253,7 +256,7 @@ mng_retcode mngjpeg_decompressinit (mng_datap pData)
#endif
#ifdef MNG_INCLUDE_IJG6B
/* Allocate and initialize a JPEG decompression object */
/* allocate and initialize a JPEG decompression object */
pData->pJPEGdinfo->err = jpeg_std_error (pData->pJPEGderr);
#ifdef MNG_USE_SETJMP /* setup local JPEG error-routines */
@ -262,15 +265,18 @@ mng_retcode mngjpeg_decompressinit (mng_datap pData)
iRetcode = setjmp (pData->sErrorbuf);/* setup local JPEG error-recovery */
if (iRetcode != 0) /* got here from longjmp ? */
MNG_ERRORJ (pData, iRetcode); /* then IJG-lib issued an error */
MNG_ERRORJ (pData, iRetcode) /* then IJG-lib issued an error */
#endif /* MNG_USE_SETJMP */
/* Allocate and initialize a JPEG decompression object (continued) */
/* allocate and initialize a JPEG decompression object (continued) */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_JPEG_CREATE_DECOMPRESS)
#endif
jpeg_create_decompress (pData->pJPEGdinfo);
pData->bJPEGdecompress = MNG_TRUE; /* indicate it's initialized */
/* Specify the source of the compressed data (eg, a file) */
/* specify the source of the compressed data (eg, a file) */
/* no, not a file; we have buffered input */
pData->pJPEGdinfo->src = pData->pJPEGdsrc;
/* use the default handler */
@ -309,7 +315,7 @@ mng_retcode mngjpeg_decompressdata (mng_datap pData,
#if defined (MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP)
iRetcode = setjmp (pData->sErrorbuf);/* initialize local JPEG error-recovery */
if (iRetcode != 0) /* got here from longjmp ? */
MNG_ERRORJ (pData, iRetcode); /* then IJG-lib issued an error */
MNG_ERRORJ (pData, iRetcode) /* then IJG-lib issued an error */
#endif
pWork = pRawdata;
@ -365,13 +371,16 @@ mng_retcode mngjpeg_decompressdata (mng_datap pData,
pWork += iFits;
}
#ifdef MNG_INCLUDE_IJG6B
pData->pJPEGdinfo->src->next_input_byte = pData->pJPEGcurrent;
pData->pJPEGdinfo->src->bytes_in_buffer = pData->iJPEGbufremain;
#ifdef MNG_INCLUDE_IJG6B
if (!pData->bJPEGhasheader) /* haven't got the header yet ? */
{
/* Call jpeg_read_header() to obtain image info */
/* call jpeg_read_header() to obtain image info */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_READ_HEADER)
#endif
if (jpeg_read_header (pData->pJPEGdinfo, TRUE) != JPEG_SUSPENDED)
{ /* indicate the header's oke */
pData->bJPEGhasheader = MNG_TRUE;
@ -413,12 +422,15 @@ mng_retcode mngjpeg_decompressdata (mng_datap pData,
/* decompress not started ? */
if ((pData->bJPEGhasheader) && (!pData->bJPEGdecostarted))
{
/* Set parameters for decompression */
/* set parameters for decompression */
if (pData->bJPEGprogressive) /* progressive display ? */
pData->pJPEGdinfo->buffered_image = TRUE;
/* jpeg_start_decompress(...); */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_START_DECOMPRESS)
#endif
if (jpeg_start_decompress (pData->pJPEGdinfo) == TRUE)
/* indicate it started */
pData->bJPEGdecostarted = MNG_TRUE;
@ -449,6 +461,9 @@ mng_retcode mngjpeg_decompressdata (mng_datap pData,
/* nop */
/* start a new output pass */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_START_OUTPUT)
#endif
jpeg_start_output (pData->pJPEGdinfo, pData->pJPEGdinfo->input_scan_number);
pData->iJPEGrow = 0; /* start at row 0 in the image again */
@ -458,6 +473,9 @@ mng_retcode mngjpeg_decompressdata (mng_datap pData,
do
{
/* jpeg_read_scanlines(...); */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_READ_SCANLINES)
#endif
iLines = jpeg_read_scanlines (pData->pJPEGdinfo, (JSAMPARRAY)&pRow, 1);
pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte;
@ -481,8 +499,14 @@ mng_retcode mngjpeg_decompressdata (mng_datap pData,
/* terminate output pass */
if ((pData->bJPEGprogressive) &&
(pData->pJPEGdinfo->output_scanline >= pData->pJPEGdinfo->output_height))
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_FINISH_OUTPUT)
#endif
jpeg_finish_output (pData->pJPEGdinfo);
/* this scan has ended */
pData->bJPEGscanstarted = MNG_FALSE;
}
}
while ((!jpeg_input_complete (pData->pJPEGdinfo)) && (iLines > 0));
}
@ -492,6 +516,9 @@ mng_retcode mngjpeg_decompressdata (mng_datap pData,
(pData->pJPEGdinfo->input_scan_number == pData->pJPEGdinfo->output_scan_number))
{
/* jpeg_finish_decompress(...); */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_FINISH_DECOMPRESS)
#endif
if (jpeg_finish_decompress (pData->pJPEGdinfo) == TRUE)
{ /* indicate it's done */
pData->bJPEGhasheader = MNG_FALSE;
@ -529,10 +556,13 @@ mng_retcode mngjpeg_decompressfree (mng_datap pData)
#ifdef MNG_USE_SETJMP
iRetcode = setjmp (pData->sErrorbuf);/* setup local JPEG error-recovery */
if (iRetcode != 0) /* got here from longjmp ? */
MNG_ERRORJ (pData, iRetcode); /* then IJG-lib issued an error */
MNG_ERRORJ (pData, iRetcode) /* then IJG-lib issued an error */
#endif
/* Release the JPEG decompression object */
/* release the JPEG decompression object */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_JPEG_DESTROY_DECOMPRESS)
#endif
jpeg_destroy_decompress (pData->pJPEGdinfo);
pData->bJPEGdecompress = MNG_FALSE; /* indicate it's done */

Просмотреть файл

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : mng_object_prc.c copyright (c) 2000 G.Juyn * */
/* * version : 0.5.2 * */
/* * version : 0.5.3 * */
/* * * */
/* * purpose : Object processing routines (implementation) * */
/* * * */
@ -36,6 +36,16 @@
/* * - added compression/filter/interlace fields to * */
/* * object-buffer for delta-image processing * */
/* * * */
/* * 0.5.3 - 06/17/2000 - G.Juyn * */
/* * - changed support for delta-image processing * */
/* * 0.5.3 - 06/20/2000 - G.Juyn * */
/* * - fixed some small things (as precaution) * */
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
/* * - added processing of PLTE/tRNS & color-info for * */
/* * delta-images in the ani_objects chain * */
/* * 0.5.3 - 06/22/2000 - G.Juyn * */
/* * - added support for PPLT chunk * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -799,10 +809,10 @@ mng_retcode reset_object_details (mng_datap pData,
pBuf->iPrimarybluey = pData->iGlobalPrimarybluey;
}
if (pData->bHasglobalSRGB) /* glbal sRGB present ? */
if (pData->bHasglobalSRGB) /* global sRGB present ? */
pBuf->iRenderingintent = pData->iGlobalRendintent;
if (pData->bHasglobalICCP) /* glbal iCCP present ? */
if (pData->bHasglobalICCP) /* global iCCP present ? */
{
if (pData->iGlobalProfilesize)
{
@ -864,18 +874,20 @@ void add_ani_object (mng_datap pData,
{
mng_object_headerp pLast = (mng_object_headerp)pData->pLastaniobj;
if (pLast)
if (pLast) /* link it as last in the chain */
{
pObject->pPrev = pLast;
pLast->pNext = pObject;
}
else
{
pObject->pPrev = MNG_NULL; /* be on the safe side */
pData->pFirstaniobj = pObject;
}
pObject->pNext = MNG_NULL; /* be on the safe side */
pData->pLastaniobj = pObject;
/* keep track for jumping */
pObject->iFramenr = pData->iFrameseq;
pObject->iLayernr = pData->iLayerseq;
pObject->iPlaytime = pData->iFrametime;
@ -889,13 +901,18 @@ void add_ani_object (mng_datap pData,
mng_retcode create_ani_image (mng_datap pData)
{
mng_ani_imagep pImage;
mng_imagep pCurrent = (mng_imagep)pData->pCurrentobj;
mng_imagep pCurrent;
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_CREATE_ANI_IMAGE, MNG_LC_START)
#endif
if (pData->bHasDHDR) /* processing delta-image ? */
pCurrent = (mng_imagep)pData->pObjzero;
else /* get the current object */
pCurrent = (mng_imagep)pData->pCurrentobj;
if (!pCurrent) /* otherwise object 0 */
pCurrent = (mng_imagep)pData->pObjzero;
/* just clone the object !!! */
@ -948,22 +965,47 @@ mng_retcode process_ani_image (mng_datap pData,
{
mng_retcode iRetcode = MNG_NOERROR;
mng_ani_imagep pImage = (mng_imagep)pObject;
mng_imagep pCurrent = (mng_imagep)pData->pCurrentobj;
mng_imagep pObjzero = (mng_imagep)pData->pObjzero;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_IMAGE, MNG_LC_START)
#endif
if (pCurrent) /* active object ? */
if (pData->bHasDHDR) /* processing delta-image ? */
{
mng_imagedatap pBuf = pCurrent->pImgbuf;
mng_imagep pDelta = (mng_imagep)pData->pDeltaImage;
if (!pData->iBreakpoint) /* only execute if not broken before */
{ /* make sure to process pixels as well */
pData->bDeltaimmediate = MNG_FALSE;
/* execute the delta process */
iRetcode = execute_delta_image (pData, pDelta, (mng_imagep)pData->pObjzero);
if (iRetcode) /* on error bail out */
return iRetcode;
}
/* now go and shoot it off (if required) */
if ((pDelta->bVisible) && (pDelta->bViewable))
iRetcode = display_image (pData, pDelta, MNG_FALSE);
if (!pData->bTimerset)
pData->bHasDHDR = MNG_FALSE; /* this image signifies IEND !! */
}
else
if (pData->pCurrentobj) /* active object ? */
{
mng_imagep pCurrent = (mng_imagep)pData->pCurrentobj;
mng_imagedatap pBuf = pCurrent->pImgbuf;
if (!pData->iBreakpoint) /* don't copy it again ! */
{
if (pBuf->iImgdatasize) /* buffer present in active object ? */
/* then drop it */
MNG_FREE (pData, pBuf->pImgdata, pBuf->iImgdatasize)
if (pBuf->iProfilesize) /* iCCP profile present ? */
/* then drop it */
MNG_FREE (pData, pBuf->pProfile, pBuf->iProfilesize)
/* now blatently copy the animation buffer */
MNG_COPY (pBuf, pImage->pImgbuf, sizeof (mng_imagedata))
@ -978,23 +1020,25 @@ mng_retcode process_ani_image (mng_datap pData,
MNG_ALLOC (pData, pBuf->pProfile, pBuf->iProfilesize)
MNG_COPY (pBuf->pProfile, pImage->pImgbuf->pProfile, pBuf->iProfilesize)
}
}
}
/* now go and shoot it off (if required) */
if ((pImage->bVisible) && (pImage->bViewable))
if ((pCurrent->bVisible) && (pCurrent->bViewable))
iRetcode = display_image (pData, pCurrent, MNG_FALSE);
}
else /* overlay with object 0 status */
else
{
pImage->bVisible = pObjzero->bVisible;
pImage->bViewable = pObjzero->bViewable;
pImage->iPosx = pObjzero->iPosx;
pImage->iPosy = pObjzero->iPosy;
pImage->bClipped = pObjzero->bClipped;
pImage->iClipl = pObjzero->iClipl;
pImage->iClipr = pObjzero->iClipr;
pImage->iClipt = pObjzero->iClipt;
pImage->iClipb = pObjzero->iClipb;
/* so this should do the trick */
mng_imagep pObjzero = (mng_imagep)pData->pObjzero;
/* overlay with object 0 status */
pImage->bVisible = pObjzero->bVisible;
pImage->bViewable = pObjzero->bViewable;
pImage->iPosx = pObjzero->iPosx;
pImage->iPosy = pObjzero->iPosy;
pImage->bClipped = pObjzero->bClipped;
pImage->iClipl = pObjzero->iClipl;
pImage->iClipr = pObjzero->iClipr;
pImage->iClipt = pObjzero->iClipt;
pImage->iClipb = pObjzero->iClipb;
/* now this should do the trick */
if ((pImage->bVisible) && (pImage->bViewable))
iRetcode = display_image (pData, pImage, MNG_FALSE);
}
@ -1002,7 +1046,7 @@ mng_retcode process_ani_image (mng_datap pData,
if (!iRetcode) /* all's well ? */
{
if (pData->bTimerset) /* timer break ? */
pData->iBreakpoint = 99; /* fictive number ! */
pData->iBreakpoint = 99; /* fictive number; no more processing needed! */
else
pData->iBreakpoint = 0; /* else clear it */
}
@ -1747,7 +1791,7 @@ mng_retcode process_ani_endl (mng_datap pData,
while ((pLOOP) &&
((pLOOP->sHeader.fCleanup != free_ani_loop) ||
(pLOOP->iLevel != pENDL->iLevel) ))
pLOOP = (mng_ani_loopp)pLOOP->sHeader.pPrev;
pLOOP = pLOOP->sHeader.pPrev;
}
/* got it now ? */
if ((pLOOP) && (pLOOP->iLevel == pENDL->iLevel))
@ -1764,26 +1808,7 @@ mng_retcode process_ani_endl (mng_datap pData,
if (!pLOOP->iRunningcount) /* reached zero ? */
{ /* was this the outer LOOP ? */
if (pLOOP == pData->pFirstaniobj)
{ /* then we can clean up all ani objects */
mng_objectp pObject = pData->pFirstaniobj;
mng_objectp pNext;
mng_cleanupobject fCleanup;
while (pObject) /* more objects to discard ? */
{
pNext = ((mng_object_headerp)pObject)->pNext;
/* call appropriate cleanup */
fCleanup = ((mng_object_headerp)pObject)->fCleanup;
fCleanup (pData, pObject);
pObject = pNext; /* neeeext */
}
/* indicate we left the outmost loop */
pData->bHasLOOP = MNG_FALSE;
pData->pFirstaniobj = 0; /* leave no trace !!! */
pData->pLastaniobj = 0;
pData->pCurraniobj = 0;
}
pData->bHasLOOP = MNG_FALSE;
}
else
{
@ -1795,7 +1820,7 @@ mng_retcode process_ani_endl (mng_datap pData,
}
else
{
MNG_ERROR (pData, 1234);
/* TODO: error abort ??? */
}
@ -2757,6 +2782,8 @@ mng_retcode process_ani_dhdr (mng_datap pData,
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_DHDR, MNG_LC_START)
#endif
pData->bHasDHDR = MNG_TRUE; /* let everyone know we're inside a DHDR */
iRetcode = process_display_dhdr (pData, pDHDR->iObjectid,
pDHDR->iImagetype, pDHDR->iDeltatype,
pDHDR->iBlockwidth, pDHDR->iBlockheight,
@ -2979,6 +3006,87 @@ mng_retcode process_ani_ijng (mng_datap pData,
return MNG_NOERROR;
}
/* ************************************************************************** */
/* ************************************************************************** */
mng_retcode create_ani_pplt (mng_datap pData,
mng_uint8 iType,
mng_uint32 iCount,
mng_rgbpaltab* paIndexentries,
mng_uint8arr* paAlphaentries,
mng_uint8arr* paUsedentries)
{
mng_ani_ppltp pPPLT;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_CREATE_ANI_PPLT, MNG_LC_START)
#endif
MNG_ALLOC (pData, pPPLT, sizeof (mng_ani_pplt))
pPPLT->sHeader.fCleanup = free_ani_pplt;
pPPLT->sHeader.fProcess = process_ani_pplt;
pPPLT->iType = iType;
pPPLT->iCount = iCount;
MNG_COPY (&pPPLT->aIndexentries, paIndexentries, sizeof (pPPLT->aIndexentries))
MNG_COPY (&pPPLT->aAlphaentries, paAlphaentries, sizeof (pPPLT->aAlphaentries))
MNG_COPY (&pPPLT->aUsedentries, paUsedentries, sizeof (pPPLT->aUsedentries ))
add_ani_object (pData, (mng_object_headerp)pPPLT);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_CREATE_ANI_PPLT, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode free_ani_pplt (mng_datap pData,
mng_objectp pObject)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_FREE_ANI_PPLT, MNG_LC_START)
#endif
MNG_FREEX (pData, pObject, sizeof (mng_ani_pplt))
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_FREE_ANI_PPLT, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode process_ani_pplt (mng_datap pData,
mng_objectp pObject)
{
mng_ani_ppltp pPPLT = (mng_ani_ppltp)pObject;
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PPLT, MNG_LC_START)
#endif
iRetcode = process_display_pplt (pData, pPPLT->iType, pPPLT->iCount,
&pPPLT->aIndexentries, &pPPLT->aAlphaentries,
&pPPLT->aUsedentries);
if (iRetcode) /* on error bail out */
return iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PPLT, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#endif /* MNG_INCLUDE_DISPLAY_PROCS */

Просмотреть файл

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : mng_object_prc.h copyright (c) 2000 G.Juyn * */
/* * version : 0.5.1 * */
/* * version : 0.5.3 * */
/* * * */
/* * purpose : Object processing routines (definition) * */
/* * * */
@ -28,6 +28,9 @@
/* * - added compression/filter/interlace fields to * */
/* * object-buffer for delta-image processing * */
/* * * */
/* * 0.5.3 - 06/22/2000 - G.Juyn * */
/* * - added support for PPLT chunk * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -132,146 +135,153 @@ mng_retcode promote_imageobject (mng_datap pData,
/* ************************************************************************** */
mng_retcode create_ani_image (mng_datap pData);
mng_retcode create_ani_image (mng_datap pData);
mng_retcode create_ani_plte (mng_datap pData,
mng_uint32 iEntrycount,
mng_rgbpaltab aEntries);
mng_retcode create_ani_plte (mng_datap pData,
mng_uint32 iEntrycount,
mng_rgbpaltab aEntries);
mng_retcode create_ani_trns (mng_datap pData,
mng_uint32 iRawlen,
mng_uint8arr aRawdata);
mng_retcode create_ani_trns (mng_datap pData,
mng_uint32 iRawlen,
mng_uint8arr aRawdata);
mng_retcode create_ani_gama (mng_datap pData,
mng_bool bEmpty,
mng_uint32 iGamma);
mng_retcode create_ani_gama (mng_datap pData,
mng_bool bEmpty,
mng_uint32 iGamma);
mng_retcode create_ani_chrm (mng_datap pData,
mng_bool bEmpty,
mng_uint32 iWhitepointx,
mng_uint32 iWhitepointy,
mng_uint32 iRedx,
mng_uint32 iRedy,
mng_uint32 iGreenx,
mng_uint32 iGreeny,
mng_uint32 iBluex,
mng_uint32 iBluey);
mng_retcode create_ani_chrm (mng_datap pData,
mng_bool bEmpty,
mng_uint32 iWhitepointx,
mng_uint32 iWhitepointy,
mng_uint32 iRedx,
mng_uint32 iRedy,
mng_uint32 iGreenx,
mng_uint32 iGreeny,
mng_uint32 iBluex,
mng_uint32 iBluey);
mng_retcode create_ani_srgb (mng_datap pData,
mng_bool bEmpty,
mng_uint8 iRenderinginent);
mng_retcode create_ani_srgb (mng_datap pData,
mng_bool bEmpty,
mng_uint8 iRenderinginent);
mng_retcode create_ani_iccp (mng_datap pData,
mng_bool bEmpty,
mng_uint32 iProfilesize,
mng_ptr pProfile);
mng_retcode create_ani_iccp (mng_datap pData,
mng_bool bEmpty,
mng_uint32 iProfilesize,
mng_ptr pProfile);
mng_retcode create_ani_bkgd (mng_datap pData,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue);
mng_retcode create_ani_bkgd (mng_datap pData,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue);
mng_retcode create_ani_loop (mng_datap pData,
mng_uint8 iLevel,
mng_uint32 iRepeatcount,
mng_uint8 iTermcond,
mng_uint32 iItermin,
mng_uint32 iItermax,
mng_uint32 iCount,
mng_uint32p pSignals);
mng_retcode create_ani_loop (mng_datap pData,
mng_uint8 iLevel,
mng_uint32 iRepeatcount,
mng_uint8 iTermcond,
mng_uint32 iItermin,
mng_uint32 iItermax,
mng_uint32 iCount,
mng_uint32p pSignals);
mng_retcode create_ani_endl (mng_datap pData,
mng_uint8 iLevel);
mng_retcode create_ani_endl (mng_datap pData,
mng_uint8 iLevel);
mng_retcode create_ani_defi (mng_datap pData);
mng_retcode create_ani_defi (mng_datap pData);
mng_retcode create_ani_basi (mng_datap pData,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue,
mng_bool bHasalpha,
mng_uint16 iAlpha,
mng_uint8 iViewable);
mng_retcode create_ani_basi (mng_datap pData,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue,
mng_bool bHasalpha,
mng_uint16 iAlpha,
mng_uint8 iViewable);
mng_retcode create_ani_clon (mng_datap pData,
mng_uint16 iCloneid,
mng_uint16 iSourceid,
mng_uint8 iClonetype,
mng_bool bHasdonotshow,
mng_uint8 iDonotshow,
mng_uint8 iConcrete,
mng_bool bHasloca,
mng_uint8 iLocatype,
mng_int32 iLocax,
mng_int32 iLocay);
mng_retcode create_ani_clon (mng_datap pData,
mng_uint16 iCloneid,
mng_uint16 iSourceid,
mng_uint8 iClonetype,
mng_bool bHasdonotshow,
mng_uint8 iDonotshow,
mng_uint8 iConcrete,
mng_bool bHasloca,
mng_uint8 iLocatype,
mng_int32 iLocax,
mng_int32 iLocay);
mng_retcode create_ani_back (mng_datap pData,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue,
mng_uint8 iMandatory,
mng_uint16 iImageid,
mng_uint8 iTile);
mng_retcode create_ani_back (mng_datap pData,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue,
mng_uint8 iMandatory,
mng_uint16 iImageid,
mng_uint8 iTile);
mng_retcode create_ani_fram (mng_datap pData,
mng_uint8 iFramemode,
mng_uint8 iChangedelay,
mng_uint32 iDelay,
mng_uint8 iChangetimeout,
mng_uint32 iTimeout,
mng_uint8 iChangeclipping,
mng_uint8 iCliptype,
mng_int32 iClipl,
mng_int32 iClipr,
mng_int32 iClipt,
mng_int32 iClipb);
mng_retcode create_ani_fram (mng_datap pData,
mng_uint8 iFramemode,
mng_uint8 iChangedelay,
mng_uint32 iDelay,
mng_uint8 iChangetimeout,
mng_uint32 iTimeout,
mng_uint8 iChangeclipping,
mng_uint8 iCliptype,
mng_int32 iClipl,
mng_int32 iClipr,
mng_int32 iClipt,
mng_int32 iClipb);
mng_retcode create_ani_move (mng_datap pData,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint8 iType,
mng_int32 iLocax,
mng_int32 iLocay);
mng_retcode create_ani_move (mng_datap pData,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint8 iType,
mng_int32 iLocax,
mng_int32 iLocay);
mng_retcode create_ani_clip (mng_datap pData,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint8 iType,
mng_int32 iClipl,
mng_int32 iClipr,
mng_int32 iClipt,
mng_int32 iClipb);
mng_retcode create_ani_clip (mng_datap pData,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint8 iType,
mng_int32 iClipl,
mng_int32 iClipr,
mng_int32 iClipt,
mng_int32 iClipb);
mng_retcode create_ani_show (mng_datap pData,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint8 iMode);
mng_retcode create_ani_show (mng_datap pData,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint8 iMode);
mng_retcode create_ani_term (mng_datap pData,
mng_uint8 iTermaction,
mng_uint8 iIteraction,
mng_uint32 iDelay,
mng_uint32 iItermax);
mng_retcode create_ani_term (mng_datap pData,
mng_uint8 iTermaction,
mng_uint8 iIteraction,
mng_uint32 iDelay,
mng_uint32 iItermax);
mng_retcode create_ani_save (mng_datap pData);
mng_retcode create_ani_seek (mng_datap pData);
mng_retcode create_ani_save (mng_datap pData);
mng_retcode create_ani_seek (mng_datap pData);
mng_retcode create_ani_dhdr (mng_datap pData,
mng_uint16 iObjectid,
mng_uint8 iImagetype,
mng_uint8 iDeltatype,
mng_uint32 iBlockwidth,
mng_uint32 iBlockheight,
mng_uint32 iBlockx,
mng_uint32 iBlocky);
mng_retcode create_ani_dhdr (mng_datap pData,
mng_uint16 iObjectid,
mng_uint8 iImagetype,
mng_uint8 iDeltatype,
mng_uint32 iBlockwidth,
mng_uint32 iBlockheight,
mng_uint32 iBlockx,
mng_uint32 iBlocky);
mng_retcode create_ani_prom (mng_datap pData,
mng_uint8 iBitdepth,
mng_uint8 iColortype,
mng_uint8 iFilltype);
mng_retcode create_ani_prom (mng_datap pData,
mng_uint8 iBitdepth,
mng_uint8 iColortype,
mng_uint8 iFilltype);
mng_retcode create_ani_ipng (mng_datap pData);
mng_retcode create_ani_ijng (mng_datap pData);
mng_retcode create_ani_ipng (mng_datap pData);
mng_retcode create_ani_ijng (mng_datap pData);
mng_retcode create_ani_pplt (mng_datap pData,
mng_uint8 iType,
mng_uint32 iCount,
mng_rgbpaltab* paIndexentries,
mng_uint8arr* paAlphaentries,
mng_uint8arr* paUsedentries);
/* ************************************************************************** */
@ -326,6 +336,8 @@ mng_retcode free_ani_ipng (mng_datap pData,
mng_objectp pObject);
mng_retcode free_ani_ijng (mng_datap pData,
mng_objectp pObject);
mng_retcode free_ani_pplt (mng_datap pData,
mng_objectp pObject);
/* ************************************************************************** */
@ -380,6 +392,8 @@ mng_retcode process_ani_ipng (mng_datap pData,
mng_objectp pObject);
mng_retcode process_ani_ijng (mng_datap pData,
mng_objectp pObject);
mng_retcode process_ani_pplt (mng_datap pData,
mng_objectp pObject);
/* ************************************************************************** */

Просмотреть файл

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : mng_objects.h copyright (c) 2000 G.Juyn * */
/* * version : 0.5.2 * */
/* * version : 0.5.3 * */
/* * * */
/* * purpose : Internal object structures (definition) * */
/* * * */
@ -33,6 +33,11 @@
/* * - added compression/filter/interlace fields to * */
/* * object-buffer for delta-image processing * */
/* * * */
/* * 0.5.3 - 06/17/2000 - G.Juyn * */
/* * - changed definition of aTRNSentries * */
/* * 0.5.3 - 06/22/2000 - G.Juyn * */
/* * - added definition for PPLT animation-processing * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -100,7 +105,7 @@ typedef struct { /* MNG specification "object-bu
mng_uint16 iTRNSgreen;
mng_uint16 iTRNSblue;
mng_uint32 iTRNScount;
mng_uint8 aTRNSentries[256];
mng_uint8arr aTRNSentries;
mng_uint32 iGamma; /* gAMA fields */
@ -435,6 +440,18 @@ typedef mng_ani_ijng * mng_ani_ijngp;
/* ************************************************************************** */
typedef struct { /* PPLT object */
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
mng_uint8 iType;
mng_uint32 iCount;
mng_rgbpaltab aIndexentries;
mng_uint8arr aAlphaentries;
mng_uint8arr aUsedentries;
} mng_ani_pplt;
typedef mng_ani_pplt * mng_ani_ppltp;
/* ************************************************************************** */
#endif /* MNG_INCLUDE_DISPLAY_PROCS */
/* ************************************************************************** */

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : mng_pixels.h copyright (c) 2000 G.Juyn * */
/* * version : 0.5.2 * */
/* * version : 0.5.3 * */
/* * * */
/* * purpose : Pixel-row management routines (definition) * */
/* * * */
@ -24,6 +24,9 @@
/* * 0.5.2 - 06/05/2000 - G.Juyn * */
/* * - added support for RGB8_A8 canvasstyle * */
/* * * */
/* * 0.5.3 - 06/16/2000 - G.Juyn * */
/* * - changed progressive-display processing * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -36,6 +39,22 @@
#include "libmng.h"
#include "mng_data.h"
/* ************************************************************************** */
/* * * */
/* * Progressive display check - checks to see if progressive display is * */
/* * in order & indicates so * */
/* * * */
/* * The routine is called after a call to one of the display_xxx routines * */
/* * if appropriate * */
/* * * */
/* * The refresh is warrented in the read_chunk routine (mng_read.c) * */
/* * and only during read&display processing, since there's not much point * */
/* * doing it from memory! * */
/* * * */
/* ************************************************************************** */
mng_retcode display_progressive_check (mng_datap pData);
/* ************************************************************************** */
/* * * */
/* * Display routines - convert rowdata (which is already color-corrected) * */

Просмотреть файл

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : mng_prop_xs.c copyright (c) 2000 G.Juyn * */
/* * version : 0.5.2 * */
/* * version : 0.5.3 * */
/* * * */
/* * purpose : property get/set interface (implementation) * */
/* * * */
@ -15,10 +15,6 @@
/* * * */
/* * comment : implementation of the property get/set functions * */
/* * * */
/* * requires : libmng.h * */
/* * mng_data.h * */
/* * mng_error.h * */
/* * * */
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
/* * - fixed calling convention * */
/* * - changed strict-ANSI stuff * */
@ -36,6 +32,10 @@
/* * 0.5.2 - 06/05/2000 - G.Juyn * */
/* * - added support for RGB8_A8 canvasstyle * */
/* * * */
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
/* * - added get/set for speedtype to facilitate testing * */
/* * - added get for imagelevel during processtext callback * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -791,6 +791,26 @@ mng_retcode MNG_DECL mng_set_jpeg_maxjdat (mng_handle hHandle,
}
#endif /* MNG_INCLUDE_JNG */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_DISPLAY
mng_retcode MNG_DECL mng_set_speed (mng_handle hHandle,
mng_speedtype iSpeed)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SPEED, MNG_LC_START)
#endif
((mng_datap)hHandle)->iSpeed = iSpeed;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SPEED, MNG_LC_END)
#endif
return MNG_NOERROR;
}
#endif /* MNG_SUPPORT_DISPLAY */
/* ************************************************************************** */
/* * * */
/* * Property get functions * */
@ -1413,6 +1433,42 @@ mng_uint32 MNG_DECL mng_get_jpeg_maxjdat (mng_handle hHandle)
}
#endif /* MNG_INCLUDE_JNG */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_DISPLAY
mng_speedtype MNG_DECL mng_get_speed (mng_handle hHandle)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SPEED, MNG_LC_START)
#endif
MNG_VALIDHANDLEX (hHandle)
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SPEED, MNG_LC_END)
#endif
return ((mng_datap)hHandle)->iSpeed;
}
#endif /* MNG_SUPPORT_DISPLAY */
/* ************************************************************************** */
mng_uint32 MNG_DECL mng_get_imagelevel (mng_handle hHandle)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_IMAGELEVEL, MNG_LC_START)
#endif
MNG_VALIDHANDLEX (hHandle)
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_IMAGELEVEL, MNG_LC_END)
#endif
return ((mng_datap)hHandle)->iImagelevel;
}
/* ************************************************************************** */
/* * end of file * */
/* ************************************************************************** */

Просмотреть файл

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : mng_read.c copyright (c) 2000 G.Juyn * */
/* * version : 0.5.2 * */
/* * version : 0.5.3 * */
/* * * */
/* * purpose : Read logic (implementation) * */
/* * * */
@ -29,6 +29,9 @@
/* * 0.5.2 - 05/31/2000 - G.Juyn * */
/* * - fixed up punctuation (contribution by Tim Rowley) * */
/* * * */
/* * 0.5.3 - 06/16/2000 - G.Juyn * */
/* * - changed progressive-display processing * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -222,6 +225,9 @@ mng_retcode read_chunk (mng_datap pData)
do /* process it then */
{
iRetcode = ((mng_object_headerp)pData->pCurraniobj)->fProcess (pData, pData->pCurraniobj);
/* refresh needed ? */
/* if ((!iRetcode) && (!pData->bTimerset) && (pData->bNeedrefresh))
iRetcode = display_progressive_refresh (pData, 10); */
/* can we advance to next object ? */
if ((!iRetcode) && (!pData->bTimerset) && (pData->pCurraniobj))
{
@ -244,10 +250,11 @@ mng_retcode read_chunk (mng_datap pData)
case 3 : ; /* same as 4 !!! */
case 4 : { iRetcode = process_display_show (pData); break; }
case 5 : { iRetcode = process_display_clon2 (pData); break; }
case 6 : { iRetcode = process_display_iend (pData); break; }
#ifdef MNG_INCLUDE_JNG
case 7 : { iRetcode = process_display_jhdr (pData); break; }
#endif
case 6 : ; /* same as 8 !!! */
case 8 : { iRetcode = process_display_iend (pData); break; }
}
}
}
@ -377,6 +384,15 @@ mng_retcode read_chunk (mng_datap pData)
}
}
/* refresh needed ? */
if ((!pData->bTimerset) && (pData->bNeedrefresh))
{
iRetcode = display_progressive_refresh (pData, 10);
if (iRetcode) /* on error bail out */
return iRetcode;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_READ_CHUNK, MNG_LC_END)
#endif

Просмотреть файл

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : mng_trace.c copyright (c) 2000 G.Juyn * */
/* * version : 0.5.1 * */
/* * version : 0.5.3 * */
/* * * */
/* * purpose : Trace functions (implementation) * */
/* * * */
@ -36,6 +36,13 @@
/* * 0.5.2 - 06/06/2000 - G.Juyn * */
/* * - added tracestring for mng_read_resume HLAPI function * */
/* * * */
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
/* * - added tracestrings for get/set speedtype * */
/* * - added tracestring for get imagelevel * */
/* * 0.5.3 - 06/22/2000 - G.Juyn * */
/* * - added tracestring for delta-image processing * */
/* * - added tracestrings for PPLT chunk processing * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -146,6 +153,7 @@
{MNG_FN_SET_JPEG_PROGRESSIVE, "set_jpeg_progressive"},
{MNG_FN_SET_JPEG_OPTIMIZED, "set_jpeg_optimized"},
{MNG_FN_SET_JPEG_MAXJDAT, "set_jpeg_maxjdat"},
{MNG_FN_SET_SPEED, "set_speed"},
{MNG_FN_GET_USERDATA, "get_userdata"},
{MNG_FN_GET_SIGTYPE, "get_sigtype"},
@ -179,6 +187,8 @@
{MNG_FN_GET_JPEG_PROGRESSIVE, "get_jpeg_progressive"},
{MNG_FN_GET_JPEG_OPTIMIZED, "get_jpeg_optimized"},
{MNG_FN_GET_JPEG_MAXJDAT, "get_jpeg_maxjdat"},
{MNG_FN_GET_SPEED, "get_speed"},
{MNG_FN_GET_IMAGELEVEL, "get_imagelevel"},
{MNG_FN_ITERATE_CHUNKS, "iterate_chunks"},
@ -326,6 +336,7 @@
{MNG_FN_SAVE_STATE, "save_state"},
{MNG_FN_RESTORE_STATE, "restore_state"},
{MNG_FN_DROP_SAVEDATA, "drop_savedata"},
{MNG_FN_EXECUTE_DELTA_IMAGE, "execute_delta_image"},
{MNG_FN_DISPLAY_RGB8, "display_rgb8"},
{MNG_FN_DISPLAY_RGBA8, "display_rgba8"},
@ -498,6 +509,7 @@
{MNG_FN_CREATE_ANI_PROM, "create_ani_prom"},
{MNG_FN_CREATE_ANI_IPNG, "create_ani_ipng"},
{MNG_FN_CREATE_ANI_IJNG, "create_ani_ijng"},
{MNG_FN_CREATE_ANI_PPLT, "create_ani_pplt"},
{MNG_FN_CREATE_ANI_IMAGE, "create_ani_image"},
@ -527,6 +539,7 @@
{MNG_FN_FREE_ANI_PROM, "free_ani_prom"},
{MNG_FN_FREE_ANI_IPNG, "free_ani_ipng"},
{MNG_FN_FREE_ANI_IJNG, "free_ani_ijng"},
{MNG_FN_FREE_ANI_PPLT, "free_ani_pplt"},
{MNG_FN_FREE_ANI_IMAGE, "free_ani_image"},
@ -556,6 +569,7 @@
{MNG_FN_PROCESS_ANI_PROM, "process_ani_prom"},
{MNG_FN_PROCESS_ANI_IPNG, "process_ani_ipng"},
{MNG_FN_PROCESS_ANI_IJNG, "process_ani_ijng"},
{MNG_FN_PROCESS_ANI_PPLT, "process_ani_pplt"},
{MNG_FN_PROCESS_ANI_IMAGE, "process_ani_image"},

Просмотреть файл

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : mng_trace.h copyright (c) 2000 G.Juyn * */
/* * version : 0.5.2 * */
/* * version : 0.5.3 * */
/* * * */
/* * purpose : Trace functions (definition) * */
/* * * */
@ -43,6 +43,15 @@
/* * 0.5.2 - 06/06/2000 - G.Juyn * */
/* * - added tracecode for mng_read_resume HLAPI function * */
/* * * */
/* * 0.5.3 - 06/06/2000 - G.Juyn * */
/* * - added tracecodes for tracing JPEG progression * */
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
/* * - added tracecodes for get/set speedtype * */
/* * - added tracecodes for get imagelevel * */
/* * 0.5.3 - 06/22/2000 - G.Juyn * */
/* * - added tracecode for delta-image processing * */
/* * - added tracecodes for PPLT chunk processing * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -82,6 +91,17 @@ mng_retcode mng_trace (mng_datap pData,
/* ************************************************************************** */
#define MNG_LC_JPEG_CREATE_DECOMPRESS 101
#define MNG_LC_JPEG_READ_HEADER 102
#define MNG_LC_JPEG_START_DECOMPRESS 103
#define MNG_LC_JPEG_START_OUTPUT 104
#define MNG_LC_JPEG_READ_SCANLINES 105
#define MNG_LC_JPEG_FINISH_OUTPUT 106
#define MNG_LC_JPEG_FINISH_DECOMPRESS 107
#define MNG_LC_JPEG_DESTROY_DECOMPRESS 108
/* ************************************************************************** */
#define MNG_FN_INITIALIZE 1
#define MNG_FN_RESET 2
#define MNG_FN_CLEANUP 3
@ -169,6 +189,7 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_SET_JPEG_PROGRESSIVE 324
#define MNG_FN_SET_JPEG_OPTIMIZED 325
#define MNG_FN_SET_JPEG_MAXJDAT 326
#define MNG_FN_SET_SPEED 327
#define MNG_FN_GET_USERDATA 401
#define MNG_FN_GET_SIGTYPE 402
@ -202,6 +223,8 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_GET_JPEG_PROGRESSIVE 430
#define MNG_FN_GET_JPEG_OPTIMIZED 431
#define MNG_FN_GET_JPEG_MAXJDAT 432
#define MNG_FN_GET_SPEED 433
#define MNG_FN_GET_IMAGELEVEL 434
/* ************************************************************************** */
@ -355,6 +378,7 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_SAVE_STATE 1019
#define MNG_FN_RESTORE_STATE 1020
#define MNG_FN_DROP_SAVEDATA 1021
#define MNG_FN_EXECUTE_DELTA_IMAGE 1022
/* ************************************************************************** */
@ -543,6 +567,7 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_CREATE_ANI_PROM 1824
#define MNG_FN_CREATE_ANI_IPNG 1825
#define MNG_FN_CREATE_ANI_IJNG 1826
#define MNG_FN_CREATE_ANI_PPLT 1827
#define MNG_FN_CREATE_ANI_IMAGE 1891
@ -574,6 +599,7 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_FREE_ANI_PROM 1924
#define MNG_FN_FREE_ANI_IPNG 1925
#define MNG_FN_FREE_ANI_IJNG 1926
#define MNG_FN_FREE_ANI_PPLT 1927
#define MNG_FN_FREE_ANI_IMAGE 1991
@ -605,6 +631,7 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_PROCESS_ANI_PROM 2024
#define MNG_FN_PROCESS_ANI_IPNG 2025
#define MNG_FN_PROCESS_ANI_IJNG 2026
#define MNG_FN_PROCESS_ANI_PPLT 2027
#define MNG_FN_PROCESS_ANI_IMAGE 2091

Просмотреть файл

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : mng_types.h copyright (c) 2000 G.Juyn * */
/* * version : 0.5.2 * */
/* * version : 0.5.3 * */
/* * * */
/* * purpose : type specifications * */
/* * * */
@ -45,6 +45,9 @@
/* * - removed SWAP_ENDIAN reference (contributed by Tim Rowley)* */
/* * - added getalphaline callback for RGB8_A8 canvasstyle * */
/* * * */
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
/* * - added speedtype to facilitate testing * */
/* * * */
/* ************************************************************************** */
#ifndef _mng_types_h_
@ -270,6 +273,10 @@ typedef LPGAMMATABLE mng_gammatabp;
enum mng_imgtypes {mng_it_unknown, mng_it_png, mng_it_mng, mng_it_jng};
typedef enum mng_imgtypes mng_imgtype;
/* enumeration of animation speed-types */
enum mng_speedtypes {mng_st_normal, mng_st_fast, mng_st_slow, mng_st_slowest};
typedef enum mng_speedtypes mng_speedtype;
/* ************************************************************************** */
/* memory management callbacks */

Просмотреть файл

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : mng_zlib.c copyright (c) 2000 G.Juyn * */
/* * version : 0.5.2 * */
/* * version : 0.5.3 * */
/* * * */
/* * purpose : ZLIB library interface (implementation) * */
/* * * */
@ -28,6 +28,9 @@
/* * - moved init of default zlib parms from here to * */
/* * "mng_hlapi.c" * */
/* * * */
/* * 0.5.3 - 06/16/2000 - G.Juyn * */
/* * - changed progressive-display processing * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -217,7 +220,13 @@ mng_retcode mngzlib_inflaterows (mng_datap pData,
iRslt = ((mng_correctrow)pData->fCorrectrow) (pData);
/* slap onto canvas ? */
if ((!iRslt) && (pData->fDisplayrow))
{
iRslt = ((mng_displayrow)pData->fDisplayrow) (pData);
if (!iRslt) /* check progressive display refresh */
iRslt = display_progressive_check (pData);
}
}
}