Bug 60789 - update libmng snapshot and handle alpha depth

requirements better.
This commit is contained in:
tor%cs.brown.edu 2000-11-29 06:45:16 +00:00
Родитель 5e6330d920
Коммит c8a49aa752
38 изменённых файлов: 9440 добавлений и 1695 удалений

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

@ -1,28 +1,142 @@
-----------------------------------------------------------
0.9.3 (xxxxxx nth 2000)
-----------------------
0.9.4 (xxxx nnth 2000)
----------------------
in short:
Intermediate for the moment.
intermediate for now
- fixed bug 111300
-------------------
bugfixes:
core:
- version numbers
- fixed possible loop in display_resume() (Thanks Vova!)
- fixed unwanted repetition in mng_readdisplay()
- changed inclusion of the lcms header file for non-windows platforms
- changed IHDR filter_method check for PNGs
- moved restore of object 0 to libmng_display
- added restore of object 0 to TERM processing !!!
- fixed TERM delay processing
- fixed TERM end processing (count = 0)
samples:
contrib:
- added GTK mng-view example by Vova Babin
- added MSVC MNGview sample by Nikolaus Brennig
- updated Jason Summer's mngplg to version 0.9.2
(that's mngplg-0.9.2 based on libmng-0.9.3 !!!)
- rearranged contrib directory slightly
doc:
- added README.dll
- added README.config
makefiles:
- added a makefile for MS Visual C++ (Thanks to Atsushi Matsuda)
autoconf:
- fixed configure.in for lcms (FreeBSD port by Mikhail Teterin)
- by default configure includes CMS support if lcms is present
-----------------------------------------------------------
0.9.3 (October 29th 2000)
-------------------------
in short:
Another beta release. The number of changes in the MNG specification have
resulted in a lot of new code and some changed code. At the same time I saw
no need to withhold some new functionality as it was pretty clear there was
going to be another beta-round. If things go well, I'm going to try to release
libmng 1.0.0 very shortly after this one.
Many thanks to a lot of people for helping out, sending contributions, making
suggestions and testing this little baby. This would get nowhere without YOU!!!
- fixed bug 111300/117103
- added workaround for faulty PhotoShop iCCP chunk
- added MAGN/JDAA chunks
- added support for new filter_types
- added PNG/MNG spec version indicators
- added BCB mngview contribution by Andy Protano
- added BCB mngdump; a GUI-based MNG dumping utility (Andy Protano)
- implemented support for nEED "draft nn"
- implemented app-defined support for bKGD for PNG images
- removed trace-options from default SO/DLL builds (!!!)
- raised initial maximum canvas size to 10000x10000 (!!!)
(an App that wants to protect from overly large images should call
mng_set_maxcanvassize() with appropriate values)
- fixed other assorted stuff
-------------------
bugfixes:
- B111300 - fixup for improved portability
- B117103 - fixed compilation errors on *nix with lcms (thanks Ralph!)
core:
- fixed compiler-warnings from Mozilla
- added check for simplicity-bits in MHDR
- added workaround for faulty PhotoShop iCCP chunk
- fixed app-supplied background restore
- fixed TERM processing delay of 0 msecs
- fixed write-code for zTXt & iTXt
- fixed read-code for iTXt
- added MAGN chunk
- fixed sRGB precedence for gamma_only corection
- added support for new filter_types
- fixed problem with no refresh after TERM
- fixed DEFI behavior
- fixed inclusion parameters to make the external libs work together
- added export of zlib functions from windows dll
- fixed timing & refresh behavior for single PNG/JNG
- removed trace-options from default SO/DLL builds (!!!)
- fixed MAGN rounding errors (thanks Matthias!)
- fixed small timing problem when FRAM delay = 0
- fixed simplicity-check in compliance with draft 81/0.98a
- fixed alpha-blending for all alpha-canvasstyles
- added support for alpha-depth prediction
- fixed processing of unknown critical chunks
- removed test-MaGN
- added PNG/MNG spec version indicators
- implemented support for nEED
- added support for JDAA
- added functions to retrieve PNG/JNG specific header-info
- added optional support for bKGD for PNG images
- raised initial maximum canvas size to 10000x10000
- added support for delta-JNG
- added callback to process non-critical unknown chunks
- fixed support for delta-images during read() / display()
- added closestream() processing for mng_cleanup()
- fixed delta-processing behavior
- added storage for pixel-/alpha-sampledepth for delta's
- implemented delayed delta-processing
- fixed putchunk_plte() to set bEmpty parameter (thanks Ben!)
- added errorcode for delayed delta-processing
- added get/set for bKGD preference setting
- added get function for interlace/progressive display
- fixed bug in empty PLTE handling
- fixed seperate read() & display() processing
- fixed tRNS processing for gray-image < 8-bits
samples:
- added BCB mngview contribution by Andy Protano
contrib:
- added BCB mngdump; a GUI-based MNG dumping utility (Andy Protano)
doc:
- updated RPM spec-file by MATSUURA Takanori
- updated README.contrib
makefiles:
- fixed some stuff in automake/autoconf/libtool
- fixed auto* for bug B117103
-----------------------------------------------------------

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

@ -100,7 +100,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : main application interface * */
/* * * */
@ -179,6 +179,32 @@
/* * - changed file-prefixes * */
/* * - added function to set simplicity field * */
/* * * */
/* * 0.9.3 - 08/09/2000 - G.Juyn * */
/* * - added check for simplicity-bits in MHDR * */
/* * 0.9.3 - 08/12/2000 - G.Juyn * */
/* * - added workaround for faulty PhotoShop iCCP chunk * */
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
/* * - added MAGN chunk * */
/* * 0.9.3 - 09/07/2000 - G.Juyn * */
/* * - added support for new filter_types * */
/* * 0.9.3 - 10/10/2000 - G.Juyn * */
/* * - added support for alpha-depth prediction * */
/* * 0.9.3 - 10/11/2000 - G.Juyn * */
/* * - fixed processing of unknown critical chunks * */
/* * - removed test-MaGN * */
/* * - added PNG/MNG spec version indicators * */
/* * - added support for nEED * */
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
/* * - added functions to retrieve PNG/JNG specific header-info * */
/* * - added JDAA chunk * */
/* * 0.9.3 - 10/17/2000 - G.Juyn * */
/* * - added callback to process non-critical unknown chunks * */
/* * 0.9.3 - 10/20/2000 - G.Juyn * */
/* * - added errocode for delayed delta-processing * */
/* * - added get/set for bKGD preference setting * */
/* * 0.9.3 - 10/21/2000 - G.Juyn * */
/* * - added get function for interlace/progressive display * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -194,6 +220,8 @@
/* ************************************************************************** */
#define MNG_CHECK_BAD_ICCP /* let's catch that sucker !!! */
#ifdef MNG_SUPPORT_READ /* dependencies based on user-configuration */
#define MNG_INCLUDE_READ_PROCS
#endif
@ -315,12 +343,12 @@ extern "C" {
/* * * */
/* ************************************************************************** */
#define MNG_VERSION_TEXT "0.9.2"
#define MNG_VERSION_TEXT "0.9.4"
#define MNG_VERSION_SO 0 /* eg. libmng.so.0 (while in test/beta) */
#define MNG_VERSION_DLL 0 /* eg. libmng.dll (nb. same for version 1) */
#define MNG_VERSION_MAJOR 0
#define MNG_VERSION_MINOR 9
#define MNG_VERSION_RELEASE 2
#define MNG_VERSION_RELEASE 4
MNG_EXT mng_pchar MNG_DECL mng_version_text (void);
MNG_EXT mng_uint8 MNG_DECL mng_version_so (void);
@ -329,6 +357,21 @@ MNG_EXT mng_uint8 MNG_DECL mng_version_major (void);
MNG_EXT mng_uint8 MNG_DECL mng_version_minor (void);
MNG_EXT mng_uint8 MNG_DECL mng_version_release (void);
/* ************************************************************************** */
/* * * */
/* * MNG/PNG specification level conformance * */
/* * * */
/* ************************************************************************** */
#define MNG_PNG_VERSION "1.2"
#define MNG_PNG_VERSION_MAJ 1
#define MNG_PNG_VERSION_MIN 2
#define MNG_MNG_VERSION "0.98a"
#define MNG_MNG_VERSION_MAJ 0
#define MNG_MNG_VERSION_MIN 98
#define MNG_MNG_DRAFT 81
/* ************************************************************************** */
/* * * */
/* * High-level application functions * */
@ -470,8 +513,14 @@ MNG_EXT mng_retcode MNG_DECL mng_setcb_traceproc (mng_handle hHandle,
/* processheader is called when all header information has been gathered
from the inputstream */
/* processtext is called for every tEXt, zTXt and iTXt chunk in the
inputstream (iType=0 for tEXt, 1 for zTXt and 2 for iTXt) */
/* processsave & processseek are called for a SAVE/SEEK chunks */
inputstream (iType=0 for tEXt, 1 for zTXt and 2 for iTXt);
you can call get_imagelevel to check at what nesting-level the chunk is
encountered (eg. tEXt inside an embedded image inside a MNG -> level == 2;
in most other case -> level == 1) */
/* processsave & processseek are called for SAVE/SEEK chunks */
/* processneed is called for the nEED chunk; you should specify a callback
for this as the default behavior will be to abort processing */
/* processunknown is called after reading each non-critical unknown chunk */
#ifdef MNG_SUPPORT_READ
MNG_EXT mng_retcode MNG_DECL mng_setcb_processheader (mng_handle hHandle,
mng_processheader fProc);
@ -481,6 +530,10 @@ MNG_EXT mng_retcode MNG_DECL mng_setcb_processsave (mng_handle hHandle,
mng_processsave fProc);
MNG_EXT mng_retcode MNG_DECL mng_setcb_processseek (mng_handle hHandle,
mng_processseek fProc);
MNG_EXT mng_retcode MNG_DECL mng_setcb_processneed (mng_handle hHandle,
mng_processneed fProc);
MNG_EXT mng_retcode MNG_DECL mng_setcb_processunknown(mng_handle hHandle,
mng_processunknown fProc);
#endif
/* callbacks for display processing */
@ -581,6 +634,8 @@ MNG_EXT mng_processheader MNG_DECL mng_getcb_processheader (mng_handle hHandle);
MNG_EXT mng_processtext MNG_DECL mng_getcb_processtext (mng_handle hHandle);
MNG_EXT mng_processsave MNG_DECL mng_getcb_processsave (mng_handle hHandle);
MNG_EXT mng_processseek MNG_DECL mng_getcb_processseek (mng_handle hHandle);
MNG_EXT mng_processneed MNG_DECL mng_getcb_processneed (mng_handle hHandle);
MNG_EXT mng_processunknown MNG_DECL mng_getcb_processunknown (mng_handle hHandle);
#endif
/* see _setcb_ */
@ -631,6 +686,10 @@ MNG_EXT mng_retcode MNG_DECL mng_set_bgcolor (mng_handle hHandle,
mng_uint16 iGreen,
mng_uint16 iBlue);
/* Indicates preferred use of the bKGD chunk for PNG images */
MNG_EXT mng_retcode MNG_DECL mng_set_usebkgd (mng_handle hHandle,
mng_bool bUseBKGD);
/* Indicates storage of read chunks */
/* only useful if you #define mng_store_chunks */
/* can be used to dynamically change storage management */
@ -728,8 +787,10 @@ MNG_EXT mng_retcode MNG_DECL mng_set_zlib_maxidat (mng_handle hHandle,
/* set to your liking; usually the defaults will suffice though! */
/* check the documentation for IJGSRC6B for details on these parameters */
#ifdef MNG_INCLUDE_JNG
#ifdef MNG_INCLUDE_IJG6B
MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_dctmethod (mng_handle hHandle,
mngjpeg_dctmethod eJPEGdctmethod);
#endif
MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_quality (mng_handle hHandle,
mng_int32 iJPEGquality);
MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_smoothing (mng_handle hHandle,
@ -773,17 +834,50 @@ MNG_EXT mng_ptr MNG_DECL mng_get_userdata (mng_handle hHandle)
so they are available in the processheader callback; before that
they are zeroed out and imagetype is set to it_unknown */
/* this might be a good point for the app to initialize the drawing-canvas! */
/* note that PNG and JNG files will not set the ticks thru simplicity fields! */
/* note that some fields are only set for the first(!) header-chunk:
MNG/MHDR (imagetype = mng_it_mng) - ticks thru simplicity
PNG/IHDR (imagetype = mng_it_png) - bitdepth thru interlace
JNG/JHDR (imagetype = mng_it_jng) - bitdepth thru compression &
interlace thru alphainterlace */
MNG_EXT mng_imgtype MNG_DECL mng_get_sigtype (mng_handle hHandle);
MNG_EXT mng_imgtype MNG_DECL mng_get_imagetype (mng_handle hHandle);
MNG_EXT mng_uint32 MNG_DECL mng_get_imagewidth (mng_handle hHandle);
MNG_EXT mng_uint32 MNG_DECL mng_get_imageheight (mng_handle hHandle);
MNG_EXT mng_uint32 MNG_DECL mng_get_ticks (mng_handle hHandle);
MNG_EXT mng_uint32 MNG_DECL mng_get_framecount (mng_handle hHandle);
MNG_EXT mng_uint32 MNG_DECL mng_get_layercount (mng_handle hHandle);
MNG_EXT mng_uint32 MNG_DECL mng_get_playtime (mng_handle hHandle);
MNG_EXT mng_uint32 MNG_DECL mng_get_simplicity (mng_handle hHandle);
MNG_EXT mng_uint8 MNG_DECL mng_get_bitdepth (mng_handle hHandle);
MNG_EXT mng_uint8 MNG_DECL mng_get_colortype (mng_handle hHandle);
MNG_EXT mng_uint8 MNG_DECL mng_get_compression (mng_handle hHandle);
MNG_EXT mng_uint8 MNG_DECL mng_get_filter (mng_handle hHandle);
MNG_EXT mng_uint8 MNG_DECL mng_get_interlace (mng_handle hHandle);
MNG_EXT mng_uint8 MNG_DECL mng_get_alphabitdepth (mng_handle hHandle);
MNG_EXT mng_uint8 MNG_DECL mng_get_alphacompression(mng_handle hHandle);
MNG_EXT mng_uint8 MNG_DECL mng_get_alphafilter (mng_handle hHandle);
MNG_EXT mng_uint8 MNG_DECL mng_get_alphainterlace (mng_handle hHandle);
/* indicates the predicted alpha-depth required to properly display the image */
/* gets set once the graphics header is processed and is available in the
processheader callback for any type of input-image (PNG, JNG or MNG) */
/* possible values are 0,1,2,4,8,16
0 = no transparency required
1 = on/off transparency required (alpha-values are 0 or 2^bit_depth-1)
2+ = semi-transparency required (values will be scaled to the bitdepth of the
canvasstyle supplied by the application) */
MNG_EXT mng_uint8 MNG_DECL mng_get_alphadepth (mng_handle hHandle);
/* defines whether a refresh() callback is called for an interlace pass (PNG)
or progressive scan (JNG) */
/* returns the interlace pass number for PNG or a fabricated pass number for JNG;
returns 0 in all other cases */
/* only useful if the image_type = mng_it_png or mng_it_jng and if the image
is actually interlaced (PNG) or progressive (JNG) */
MNG_EXT mng_uint8 MNG_DECL mng_get_refreshpass (mng_handle hHandle);
/* see _set_ */
MNG_EXT mng_uint32 MNG_DECL mng_get_canvasstyle (mng_handle hHandle);
MNG_EXT mng_uint32 MNG_DECL mng_get_bkgdstyle (mng_handle hHandle);
@ -794,6 +888,9 @@ MNG_EXT mng_retcode MNG_DECL mng_get_bgcolor (mng_handle hHandle,
mng_uint16* iGreen,
mng_uint16* iBlue);
/* see _set_ */
MNG_EXT mng_bool MNG_DECL mng_get_usebkgd (mng_handle hHandle);
/* see _set_ */
MNG_EXT mng_bool MNG_DECL mng_get_storechunks (mng_handle hHandle);
@ -830,8 +927,10 @@ MNG_EXT mng_uint32 MNG_DECL mng_get_zlib_maxidat (mng_handle hHandle)
/* see _set_ */
#ifdef MNG_INCLUDE_JNG
#ifdef MNG_INCLUDE_IJG6B
MNG_EXT mngjpeg_dctmethod
MNG_DECL mng_get_jpeg_dctmethod (mng_handle hHandle);
#endif
MNG_EXT mng_int32 MNG_DECL mng_get_jpeg_quality (mng_handle hHandle);
MNG_EXT mng_int32 MNG_DECL mng_get_jpeg_smoothing (mng_handle hHandle);
MNG_EXT mng_bool MNG_DECL mng_get_jpeg_progressive(mng_handle hHandle);
@ -1276,6 +1375,11 @@ MNG_EXT mng_retcode MNG_DECL mng_getchunk_jdat (mng_handle hHandle,
mng_uint32 *iRawlen,
mng_ptr *pRawdata);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_jdaa (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iRawlen,
mng_ptr *pRawdata);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_dhdr (mng_handle hHandle,
mng_handle hChunk,
mng_uint16 *iObjectid,
@ -1327,6 +1431,19 @@ MNG_EXT mng_retcode MNG_DECL mng_getchunk_ordr_entry (mng_handle hHandle,
mng_chunkid *iChunkname,
mng_uint8 *iOrdertype);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_magn (mng_handle hHandle,
mng_handle hChunk,
mng_uint16 *iFirstid,
mng_uint16 *iLastid,
mng_uint16 *iMethodX,
mng_uint16 *iMX,
mng_uint16 *iMY,
mng_uint16 *iML,
mng_uint16 *iMR,
mng_uint16 *iMT,
mng_uint16 *iMB,
mng_uint16 *iMethodY);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_unknown (mng_handle hHandle,
mng_handle hChunk,
mng_chunkid *iChunkname,
@ -1658,6 +1775,10 @@ MNG_EXT mng_retcode MNG_DECL mng_putchunk_jdat (mng_handle hHandle,
mng_uint32 iRawlen,
mng_ptr pRawdata);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_jdaa (mng_handle hHandle,
mng_uint32 iRawlen,
mng_ptr pRawdata);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_jsep (mng_handle hHandle);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_dhdr (mng_handle hHandle,
@ -1707,6 +1828,18 @@ MNG_EXT mng_retcode MNG_DECL mng_putchunk_ordr_entry (mng_handle hHandle,
mng_chunkid iChunkname,
mng_uint8 iOrdertype);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_magn (mng_handle hHandle,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint16 iMethodX,
mng_uint16 iMX,
mng_uint16 iMY,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint16 iMT,
mng_uint16 iMB,
mng_uint16 iMethodY);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_unknown (mng_handle hHandle,
mng_chunkid iChunkname,
mng_uint32 iRawlen,
@ -1889,6 +2022,10 @@ MNG_EXT mng_retcode MNG_DECL mng_updatemngsimplicity (mng_handle hHandle,
#define MNG_INVFILLMETHOD (mng_retcode)1057 /* invalid fill_method */
#define MNG_OBJNOTCONCRETE (mng_retcode)1058 /* object must be concrete */
#define MNG_TARGETNOALPHA (mng_retcode)1059 /* object has no alpha-channel */
#define MNG_MNGTOOCOMPLEX (mng_retcode)1060 /* can't handle complexity */
#define MNG_UNKNOWNCRITICAL (mng_retcode)1061 /* unknown critical chunk found*/
#define MNG_UNSUPPORTEDNEED (mng_retcode)1062 /* nEED requirement unsupported*/
#define MNG_INVALIDDELTA (mng_retcode)1063 /* Delta operation illegal */
#define MNG_INVALIDCNVSTYLE (mng_retcode)2049 /* can't make anything of this */
#define MNG_WRONGCHUNK (mng_retcode)2050 /* accessing the wrong chunk */
@ -1984,10 +2121,13 @@ MNG_EXT mng_retcode MNG_DECL mng_updatemngsimplicity (mng_handle hHandle,
#define MNG_UINT_IHDR 0x49484452L
#define MNG_UINT_IJNG 0x494a4e47L
#define MNG_UINT_IPNG 0x49504e47L
#define MNG_UINT_JDAA 0x4a444141L
#define MNG_UINT_JDAT 0x4a444154L
#define MNG_UINT_JHDR 0x4a484452L
#define MNG_UINT_JSEP 0x4a534550L
#define MNG_UINT_JdAA 0x4a644141L
#define MNG_UINT_LOOP 0x4c4f4f50L
#define MNG_UINT_MAGN 0x4d41474eL
#define MNG_UINT_MEND 0x4d454e44L
#define MNG_UINT_MHDR 0x4d484452L
#define MNG_UINT_MOVE 0x4d4f5645L
@ -2044,6 +2184,10 @@ MNG_EXT mng_retcode MNG_DECL mng_updatemngsimplicity (mng_handle hHandle,
BASI, JHDR */
#define MNG_FILTER_ADAPTIVE 0 /* IHDR, BASI, JHDR */
#define MNG_FILTER_NO_ADAPTIVE 1
#define MNG_FILTER_NO_DIFFERING 0
#define MNG_FILTER_DIFFERING 0x40
#define MNG_FILTER_MASK (MNG_FILTER_NO_ADAPTIVE | MNG_FILTER_DIFFERING)
#define MNG_INTERLACE_NONE 0 /* IHDR, BASI, JHDR */
#define MNG_INTERLACE_ADAM7 1

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_callback_xs.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : callback get/set interface (implementation) * */
/* * * */
@ -32,6 +32,11 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 10/11/2000 - G.Juyn * */
/* * - added support for nEED * */
/* * 0.9.3 - 10/17/2000 - G.Juyn * */
/* * - added callback to process non-critical unknown chunks * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -302,6 +307,48 @@ mng_retcode MNG_DECL mng_setcb_processseek (mng_handle hHandle,
/* ************************************************************************** */
#ifdef MNG_SUPPORT_READ
mng_retcode MNG_DECL mng_setcb_processneed (mng_handle hHandle,
mng_processneed fProc)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSNEED, MNG_LC_START)
#endif
MNG_VALIDHANDLE (hHandle)
((mng_datap)hHandle)->fProcessneed = fProc;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSNEED, MNG_LC_END)
#endif
return MNG_NOERROR;
}
#endif /* MNG_SUPPORT_READ */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_READ
mng_retcode MNG_DECL mng_setcb_processunknown (mng_handle hHandle,
mng_processunknown fProc)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSUNKNOWN, MNG_LC_START)
#endif
MNG_VALIDHANDLE (hHandle)
((mng_datap)hHandle)->fProcessunknown = fProc;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSUNKNOWN, MNG_LC_END)
#endif
return MNG_NOERROR;
}
#endif /* MNG_SUPPORT_READ */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_DISPLAY
mng_retcode MNG_DECL mng_setcb_getcanvasline (mng_handle hHandle,
mng_getcanvasline fProc)
@ -763,6 +810,44 @@ mng_processseek MNG_DECL mng_getcb_processseek (mng_handle hHandle)
/* ************************************************************************** */
#ifdef MNG_SUPPORT_READ
mng_processneed MNG_DECL mng_getcb_processneed (mng_handle hHandle)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSNEED, MNG_LC_START)
#endif
MNG_VALIDHANDLEX (hHandle)
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSNEED, MNG_LC_END)
#endif
return ((mng_datap)hHandle)->fProcessneed;
}
#endif /* MNG_SUPPORT_READ */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_READ
mng_processunknown MNG_DECL mng_getcb_processunknown (mng_handle hHandle)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSUNKNOWN, MNG_LC_START)
#endif
MNG_VALIDHANDLEX (hHandle)
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSUNKNOWN, MNG_LC_END)
#endif
return ((mng_datap)hHandle)->fProcessunknown;
}
#endif /* MNG_SUPPORT_READ */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_DISPLAY
mng_getcanvasline MNG_DECL mng_getcb_getcanvasline (mng_handle hHandle)
{

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

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_chunk_io.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : Chunk I/O routines (definition) * */
/* * * */
@ -25,6 +25,11 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
/* * - added MAGN chunk * */
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
/* * - added support for JDAA * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -34,10 +39,6 @@
#ifndef _libmng_chunk_io_h_
#define _libmng_chunk_io_h_
#include "libmng.h"
#include "libmng_data.h"
#include "libmng_chunks.h"
/* ************************************************************************** */
mng_uint32 crc (mng_datap pData,
@ -93,6 +94,7 @@ READ_CHUNK (read_expi) ;
READ_CHUNK (read_fpri) ;
READ_CHUNK (read_phyg) ;
READ_CHUNK (read_jhdr) ;
READ_CHUNK (read_jdaa) ;
READ_CHUNK (read_jdat) ;
READ_CHUNK (read_jsep) ;
READ_CHUNK (read_dhdr) ;
@ -103,6 +105,7 @@ READ_CHUNK (read_ijng) ;
READ_CHUNK (read_drop) ;
READ_CHUNK (read_dbyk) ;
READ_CHUNK (read_ordr) ;
READ_CHUNK (read_magn) ;
READ_CHUNK (read_need) ;
READ_CHUNK (read_unknown) ;
@ -148,6 +151,7 @@ READ_CHUNK (read_unknown) ;
#define read_fpri 0
#define read_phyg 0
#define read_jhdr 0
#define read_jdaa 0
#define read_jdat 0
#define read_jsep 0
#define read_dhdr 0
@ -158,6 +162,7 @@ READ_CHUNK (read_unknown) ;
#define read_drop 0
#define read_dbyk 0
#define read_ordr 0
#define read_magn 0
#define read_need 0
#define read_unknown 0
#endif /* MNG_INCLUDE_READ_PROCS */
@ -208,6 +213,7 @@ WRITE_CHUNK (write_expi) ;
WRITE_CHUNK (write_fpri) ;
WRITE_CHUNK (write_phyg) ;
WRITE_CHUNK (write_jhdr) ;
WRITE_CHUNK (write_jdaa) ;
WRITE_CHUNK (write_jdat) ;
WRITE_CHUNK (write_jsep) ;
WRITE_CHUNK (write_dhdr) ;
@ -218,6 +224,7 @@ WRITE_CHUNK (write_ijng) ;
WRITE_CHUNK (write_drop) ;
WRITE_CHUNK (write_dbyk) ;
WRITE_CHUNK (write_ordr) ;
WRITE_CHUNK (write_magn) ;
WRITE_CHUNK (write_need) ;
WRITE_CHUNK (write_unknown) ;
@ -263,6 +270,7 @@ WRITE_CHUNK (write_unknown) ;
#define write_fpri 0
#define write_phyg 0
#define write_jhdr 0
#define write_jdaa 0
#define write_jdat 0
#define write_jsep 0
#define write_dhdr 0
@ -273,6 +281,7 @@ WRITE_CHUNK (write_unknown) ;
#define write_drop 0
#define write_dbyk 0
#define write_ordr 0
#define write_magn 0
#define write_need 0
#define write_unknown 0
#endif /* MNG_INCLUDE_WRITE_PROCS */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_chunk_prc.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : Chunk initialization & cleanup (implementation) * */
/* * * */
@ -31,6 +31,11 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
/* * - added MAGN chunk * */
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
/* * - added support for JDAA * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -816,6 +821,26 @@ INIT_CHUNK_HDR (init_jhdr)
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG
INIT_CHUNK_HDR (init_jdaa)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_JDAA, MNG_LC_START)
#endif
MNG_ALLOC (pData, *ppChunk, sizeof (mng_jdaa))
((mng_jdaap)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_JDAA, MNG_LC_END)
#endif
return MNG_NOERROR;
}
#endif /* MNG_INCLUDE_JNG */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG
INIT_CHUNK_HDR (init_jdat)
{
@ -1000,6 +1025,24 @@ INIT_CHUNK_HDR (init_ordr)
/* ************************************************************************** */
INIT_CHUNK_HDR (init_magn)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_MAGN, MNG_LC_START)
#endif
MNG_ALLOC (pData, *ppChunk, sizeof (mng_magn))
((mng_magnp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_MAGN, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
INIT_CHUNK_HDR (init_unknown)
{
#ifdef MNG_SUPPORT_TRACE
@ -1804,6 +1847,29 @@ FREE_CHUNK_HDR (free_jhdr)
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG
FREE_CHUNK_HDR (free_jdaa)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_FREE_JDAA, MNG_LC_START)
#endif
if (((mng_jdaap)pHeader)->iDatasize)
MNG_FREEX (pData, ((mng_jdaap)pHeader)->pData,
((mng_jdaap)pHeader)->iDatasize)
MNG_FREEX (pData, pHeader, sizeof (mng_jdaa))
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_FREE_JDAA, MNG_LC_END)
#endif
return MNG_NOERROR;
}
#endif /* MNG_INCLUDE_JNG */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG
FREE_CHUNK_HDR (free_jdat)
{
@ -1994,6 +2060,23 @@ FREE_CHUNK_HDR (free_ordr)
/* ************************************************************************** */
FREE_CHUNK_HDR (free_magn)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_FREE_MAGN, MNG_LC_START)
#endif
MNG_FREEX (pData, pHeader, sizeof (mng_magn))
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_FREE_MAGN, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
FREE_CHUNK_HDR (free_unknown)
{
#ifdef MNG_SUPPORT_TRACE

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_chunk_prc.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : Chunk initialization & cleanup (definition) * */
/* * * */
@ -21,6 +21,11 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
/* * - added MAGN chunk * */
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
/* * - added support for JDAA * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -30,10 +35,6 @@
#ifndef _libmng_chunk_prc_h_
#define _libmng_chunk_prc_h_
#include "libmng.h"
#include "libmng_data.h"
#include "libmng_chunks.h"
/* ************************************************************************** */
void add_chunk (mng_datap pData,
@ -85,6 +86,7 @@ INIT_CHUNK_HDR (init_fpri) ;
INIT_CHUNK_HDR (init_need) ;
INIT_CHUNK_HDR (init_phyg) ;
INIT_CHUNK_HDR (init_jhdr) ;
INIT_CHUNK_HDR (init_jdaa) ;
INIT_CHUNK_HDR (init_jdat) ;
INIT_CHUNK_HDR (init_jsep) ;
INIT_CHUNK_HDR (init_dhdr) ;
@ -95,6 +97,7 @@ INIT_CHUNK_HDR (init_ijng) ;
INIT_CHUNK_HDR (init_drop) ;
INIT_CHUNK_HDR (init_dbyk) ;
INIT_CHUNK_HDR (init_ordr) ;
INIT_CHUNK_HDR (init_magn) ;
INIT_CHUNK_HDR (init_unknown) ;
/* ************************************************************************** */
@ -142,6 +145,7 @@ FREE_CHUNK_HDR (free_fpri) ;
FREE_CHUNK_HDR (free_need) ;
FREE_CHUNK_HDR (free_phyg) ;
FREE_CHUNK_HDR (free_jhdr) ;
FREE_CHUNK_HDR (free_jdaa) ;
FREE_CHUNK_HDR (free_jdat) ;
FREE_CHUNK_HDR (free_jsep) ;
FREE_CHUNK_HDR (free_dhdr) ;
@ -152,6 +156,7 @@ FREE_CHUNK_HDR (free_ijng) ;
FREE_CHUNK_HDR (free_drop) ;
FREE_CHUNK_HDR (free_dbyk) ;
FREE_CHUNK_HDR (free_ordr) ;
FREE_CHUNK_HDR (free_magn) ;
FREE_CHUNK_HDR (free_unknown) ;
/* ************************************************************************** */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_chunk_xs.c copyright (c) 2000 G. Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : chunk access functions (implementation) * */
/* * * */
@ -41,8 +41,13 @@
/* * - changed file-prefixes * */
/* * - added function to set simplicity field * */
/* * - fixed putchunk_unknown() function * */
/* * * */
/* * 0.9.3 - 08/07/2000 - G.Juyn * */
/* * - B111300 - fixup for improved portability * */
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
/* * - added MAGN chunk * */
/* * 0.9.3 - 10/20/2000 - G.Juyn * */
/* * - fixed putchunk_plte() to set bEmpty parameter * */
/* * * */
/* ************************************************************************** */
@ -1989,6 +1994,53 @@ mng_retcode MNG_DECL mng_getchunk_ordr_entry (mng_handle hHandle,
/* ************************************************************************** */
mng_retcode MNG_DECL mng_getchunk_magn (mng_handle hHandle,
mng_handle hChunk,
mng_uint16 *iFirstid,
mng_uint16 *iLastid,
mng_uint16 *iMethodX,
mng_uint16 *iMX,
mng_uint16 *iMY,
mng_uint16 *iML,
mng_uint16 *iMR,
mng_uint16 *iMT,
mng_uint16 *iMB,
mng_uint16 *iMethodY)
{
mng_datap pData;
mng_magnp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MAGN, MNG_LC_START)
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_magnp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_MAGN)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iFirstid = pChunk->iFirstid; /* fill the fields */
*iLastid = pChunk->iLastid;
*iMethodX = pChunk->iMethodX;
*iMX = pChunk->iMX;
*iMY = pChunk->iMY;
*iML = pChunk->iML;
*iMR = pChunk->iMR;
*iMT = pChunk->iMT;
*iMB = pChunk->iMB;
*iMethodY = pChunk->iMethodY;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MAGN, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_getchunk_unknown (mng_handle hHandle,
mng_handle hChunk,
mng_chunkid *iChunkname,
@ -2105,6 +2157,7 @@ mng_retcode MNG_DECL mng_putchunk_plte (mng_handle hHandle,
return iRetcode;
/* fill the chunk */
((mng_pltep)pChunk)->iEntrycount = iCount;
((mng_pltep)pChunk)->bEmpty = (mng_bool)(iCount == 0);
MNG_COPY (((mng_pltep)pChunk)->aEntries, aPalette, sizeof (mng_palette8))
@ -4751,6 +4804,64 @@ mng_retcode MNG_DECL mng_putchunk_ordr_entry (mng_handle hHandle,
/* ************************************************************************** */
mng_retcode MNG_DECL mng_putchunk_magn (mng_handle hHandle,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint16 iMethodX,
mng_uint16 iMX,
mng_uint16 iMY,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint16 iMT,
mng_uint16 iMB,
mng_uint16 iMethodY)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
mng_chunk_header sChunkheader =
{MNG_UINT_MAGN, init_magn, free_magn, read_magn, write_magn, 0, 0};
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MAGN, MNG_LC_START)
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
if (!pData->bCreating) /* aren't we creating a new file ? */
MNG_ERROR (pData, MNG_FUNCTIONINVALID)
/* must have had a MHDR first! */
if (pData->iFirstchunkadded != MNG_UINT_MHDR)
MNG_ERROR (pData, MNG_NOHEADER)
/* create the chunk */
iRetcode = init_magn (pData, &sChunkheader, &pChunk);
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_magnp)pChunk)->iFirstid = iFirstid;
((mng_magnp)pChunk)->iLastid = iLastid;
((mng_magnp)pChunk)->iMethodX = iMethodX;
((mng_magnp)pChunk)->iMX = iMX;
((mng_magnp)pChunk)->iMY = iMY;
((mng_magnp)pChunk)->iML = iML;
((mng_magnp)pChunk)->iMR = iMR;
((mng_magnp)pChunk)->iMT = iMT;
((mng_magnp)pChunk)->iMB = iMB;
((mng_magnp)pChunk)->iMethodY = iMethodY;
add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MAGN, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_putchunk_unknown (mng_handle hHandle,
mng_chunkid iChunkname,
mng_uint32 iRawlen,

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_chunks.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : Chunk structures (definition) * */
/* * * */
@ -33,6 +33,13 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
/* * - added MAGN chunk * */
/* * 0.9.3 - 09/10/2000 - G.Juyn * */
/* * - fixed DEFI behavior * */
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
/* * - added JDAA chunk * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -351,7 +358,9 @@ typedef mng_endl * mng_endlp;
typedef struct { /* DEFI */
mng_chunk_header sHeader;
mng_uint16 iObjectid;
mng_bool bHasdonotshow;
mng_uint8 iDonotshow;
mng_bool bHasconcrete;
mng_uint8 iConcrete;
mng_bool bHasloca;
mng_int32 iXlocation;
@ -606,6 +615,11 @@ typedef mng_jhdr * mng_jhdrp;
/* ************************************************************************** */
typedef mng_idat mng_jdaa; /* JDAA */
typedef mng_jdaa * mng_jdaap;
/* ************************************************************************** */
typedef mng_idat mng_jdat; /* JDAT */
typedef mng_jdat * mng_jdatp;
@ -712,6 +726,23 @@ typedef mng_ordr * mng_ordrp;
/* ************************************************************************** */
typedef struct { /* MAGN */
mng_chunk_header sHeader;
mng_uint16 iFirstid;
mng_uint16 iLastid;
mng_uint16 iMethodX;
mng_uint16 iMX;
mng_uint16 iMY;
mng_uint16 iML;
mng_uint16 iMR;
mng_uint16 iMT;
mng_uint16 iMB;
mng_uint16 iMethodY;
} mng_magn;
typedef mng_magn * mng_magnp;
/* ************************************************************************** */
typedef struct { /* unknown chunk */
mng_chunk_header sHeader;
mng_uint32 iDatasize;

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_cms.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : color management routines (implementation) * */
/* * * */
@ -39,6 +39,9 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 08/31/2000 - G.Juyn * */
/* * - fixed sRGB precedence for gamma_only corection * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -488,9 +491,15 @@ mng_retcode init_gamma_only (mng_datap pData)
pBuf = pImage->pImgbuf; /* address the buffer */
if (pBuf->bHasGAMA) /* get the gamma value */
if (pBuf->bHasSRGB) /* get the gamma value */
dGamma = 0.45455;
else
if (pBuf->bHasGAMA)
dGamma = (mng_float)pBuf->iGamma / 100000;
else
if (pData->bHasglobalSRGB)
dGamma = 0.45455;
else
if (pData->bHasglobalGAMA)
dGamma = (mng_float)pData->iGlobalGamma / 100000;
else
@ -535,7 +544,10 @@ mng_retcode init_gamma_only_object (mng_datap pData)
/* address the object-buffer */
pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf;
if (pBuf->bHasGAMA) /* get the gamma value */
if (pBuf->bHasSRGB) /* get the gamma value */
dGamma = 0.45455;
else
if (pBuf->bHasGAMA)
dGamma = (mng_float)pBuf->iGamma / 100000;
else
dGamma = pData->dDfltimggamma;

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

@ -32,9 +32,6 @@
#ifndef _libmng_cms_h_
#define _libmng_cms_h_
#include "libmng.h"
#include "libmng_data.h"
/* ************************************************************************** */
#ifdef MNG_INCLUDE_LCMS

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

@ -2,7 +2,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_conf.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : main configuration file * */
/* * * */
@ -26,6 +26,11 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 08/12/2000 - G.Juyn * */
/* * - added workaround for faulty PhotoShop iCCP chunk * */
/* * 0.9.3 - 09/16/2000 - G.Juyn * */
/* * - removed trace-options from default SO/DLL builds * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -166,11 +171,7 @@
/* use this if you have trouble location bugs or problems */
/* NOTE that you'll need to specify the trace callback function! */
#ifndef MNG_SUPPORT_TRACE
#if defined(MNG_BUILD_SO) || defined(MNG_USE_SO) || defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL)
#define MNG_SUPPORT_TRACE
#endif
#endif
/* #define MNG_SUPPORT_TRACE */
/* ************************************************************************** */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_data.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : main data structure definition * */
/* * * */
@ -75,6 +75,25 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
/* * - added MAGN chunk * */
/* * 0.9.3 - 09/07/2000 - G.Juyn * */
/* * - added support for new filter_types * */
/* * 0.9.3 - 09/10/2000 - G.Juyn * */
/* * - fixed DEFI behavior * */
/* * 0.9.3 - 10/10/2000 - G.Juyn * */
/* * - added support for alpha-depth prediction * */
/* * 0.9.3 - 10/11/2000 - G.Juyn * */
/* * - added support for nEED * */
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
/* * - added optional support for bKGD for PNG images * */
/* * - added support for JDAA * */
/* * 0.9.3 - 10/17/2000 - G.Juyn * */
/* * - added callback to process non-critical unknown chunks * */
/* * - fixed support for bKGD * */
/* * 0.9.3 - 10/19/2000 - G.Juyn * */
/* * - implemented delayed delta-processing * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -119,18 +138,6 @@ typedef struct mng_savedata_struct {
#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */
#ifdef MNG_SUPPORT_DISPLAY
mng_uint16 iDEFIobjectid; /* DEFI fields */
mng_uint8 iDEFIdonotshow;
mng_uint8 iDEFIconcrete;
mng_bool bDEFIhasloca;
mng_int32 iDEFIlocax;
mng_int32 iDEFIlocay;
mng_bool bDEFIhasclip;
mng_int32 iDEFIclipl;
mng_int32 iDEFIclipr;
mng_int32 iDEFIclipt;
mng_int32 iDEFIclipb;
mng_uint16 iBACKred; /* BACK fields */
mng_uint16 iBACKgreen;
mng_uint16 iBACKblue;
@ -202,6 +209,7 @@ typedef struct mng_data_struct {
mng_uint32 iFramecount;
mng_uint32 iPlaytime;
mng_uint32 iSimplicity;
mng_uint8 iAlphadepth; /* indicates expected alpha-depth */
mng_uint32 iImagelevel; /* level an image inside a stream */
@ -217,6 +225,7 @@ typedef struct mng_data_struct {
mng_uint16 iBGred; /* default background color */
mng_uint16 iBGgreen; /* initially "black" */
mng_uint16 iBGblue;
mng_bool bUseBKGD; /* preferred use of bKGD for PNG */
mng_bool bIssRGB; /* indicates sRGB system */
@ -257,6 +266,8 @@ typedef struct mng_data_struct {
mng_processtext fProcesstext;
mng_processsave fProcesssave;
mng_processseek fProcessseek;
mng_processneed fProcessneed;
mng_processunknown fProcessunknown;
mng_getcanvasline fGetcanvasline;
mng_getbkgdline fGetbkgdline;
mng_getalphaline fGetalphaline;
@ -285,6 +296,7 @@ typedef struct mng_data_struct {
#ifdef MNG_INCLUDE_JNG
mng_bool bHasJHDR; /* inside a JHDR-IEND sequence */
mng_bool bHasJSEP; /* passed the JSEP separator */
mng_bool bHasJDAA; /* at least 1 JDAA processed */
mng_bool bHasJDAT; /* at least 1 JDAT processed */
#endif
mng_bool bHasPLTE; /* PLTE chunk processed */
@ -380,6 +392,8 @@ typedef struct mng_data_struct {
mng_uint32 iRequesttime;
mng_bool bSearching;
mng_bool bRestorebkgd; /* flags restore required before IDAT/JDAT */
mng_uint32 iRuntime; /* millisecs since start */
mng_uint32 iSynctime; /* tickcount at last framesync */
mng_uint32 iStarttime; /* tickcount at start */
@ -422,6 +436,12 @@ typedef struct mng_data_struct {
mng_int32 iSamplediv;
mng_int32 iRowsize; /* size of actual data in work row */
mng_int32 iRowmax; /* maximum size of data in work row */
mng_int32 iFilterofs; /* offset to filter-byte in work row */
mng_int32 iPixelofs; /* offset to pixel-bytes in work row */
mng_uint32 iLevel0; /* leveling variables */
mng_uint32 iLevel1;
mng_uint32 iLevel2;
mng_uint32 iLevel3;
mng_uint8p pWorkrow; /* working row of pixel-data */
mng_uint8p pPrevrow; /* previous row of pixel-data */
mng_uint8p pRGBArow; /* intermediate row of RGBA8 or RGBA16 data */
@ -461,11 +481,20 @@ typedef struct mng_data_struct {
uncompressed/unfiltered row of data */
mng_ptr fProcessrow; /* internal callback to process an
uncompressed row of data */
mng_ptr fDifferrow; /* internal callback to perform
added filter leveling and
differing on an unfiltered row */
mng_ptr fScalerow; /* internal callback to scale a
delta-row to the bitdepth of its target */
mng_ptr fDeltarow; /* internal callback to execute a
delta-row onto a target */
mng_ptr fInitrowproc; /* internal callback to initialize
the row processing */
mng_uint16 iDEFIobjectid; /* DEFI fields */
mng_bool bDEFIhasdonotshow;
mng_uint8 iDEFIdonotshow;
mng_bool bDEFIhasconcrete;
mng_uint8 iDEFIconcrete;
mng_bool bDEFIhasloca;
mng_int32 iDEFIlocax;
@ -549,6 +578,8 @@ typedef struct mng_data_struct {
mng_ptr fDeltareplacerow;
mng_ptr fDeltaputrow;
mng_uint16 iMAGNfromid;
mng_uint16 iMAGNtoid;
#endif /* MNG_SUPPORT_DISPLAY */
#ifdef MNG_INCLUDE_ZLIB
@ -573,33 +604,57 @@ typedef struct mng_data_struct {
mng_bool bJPEGcompressprogr;
mng_bool bJPEGcompressopt;
mng_uint32 iMaxJDAT; /* maximum size of JDAT data */
mng_uint32 iMaxJDAT; /* maximum size of JDAT/JDAA data */
mngjpeg_compp pJPEGcinfo; /* compression structure */
mngjpeg_errorp pJPEGcerr; /* error-manager compress */
mngjpeg_decompp pJPEGdinfo; /* decompression structure */
mngjpeg_errorp pJPEGderr; /* error-manager decompress */
mngjpeg_sourcep pJPEGdsrc; /* source-manager decompress */
mng_uint8p pJPEGbuf; /* buffer for JPEG (de)compression */
mng_uint32 iJPEGbufmax; /* allocated space for buffer */
mng_uint8p pJPEGcurrent; /* current pointer into buffer */
mng_uint32 iJPEGbufremain; /* remaining bytes in buffer */
mng_uint32 iJPEGtoskip; /* bytes to skip on next input-block */
mngjpeg_decompp pJPEGdinfo; /* decompression structure (JDAT) */
mngjpeg_errorp pJPEGderr; /* error-manager decompress (JDAT) */
mngjpeg_sourcep pJPEGdsrc; /* source-manager decompress (JDAT) */
mng_uint8p pJPEGrow; /* buffer for a JPEG row of samples */
mngjpeg_decompp pJPEGdinfo2; /* decompression structure (JDAA) */
mngjpeg_errorp pJPEGderr2; /* error-manager decompress (JDAA) */
mngjpeg_sourcep pJPEGdsrc2; /* source-manager decompress (JDAA) */
mng_uint8p pJPEGbuf; /* buffer for JPEG (de)compression (JDAT) */
mng_uint32 iJPEGbufmax; /* allocated space for buffer (JDAT) */
mng_uint8p pJPEGcurrent; /* current pointer into buffer (JDAT) */
mng_uint32 iJPEGbufremain; /* remaining bytes in buffer (JDAT) */
mng_uint32 iJPEGtoskip; /* bytes to skip on next input-block (JDAT) */
mng_uint8p pJPEGbuf2; /* buffer for JPEG (de)compression (JDAA) */
mng_uint32 iJPEGbufmax2; /* allocated space for buffer (JDAA) */
mng_uint8p pJPEGcurrent2; /* current pointer into buffer (JDAA) */
mng_uint32 iJPEGbufremain2; /* remaining bytes in buffer (JDAA) */
mng_uint32 iJPEGtoskip2; /* bytes to skip on next input-block (JDAA) */
mng_uint8p pJPEGrow; /* buffer for a JPEG row of samples (JDAT) */
mng_uint32 iJPEGrowlen;
mng_uint8p pJPEGrow2; /* buffer for a JPEG row of samples (JDAA) */
mng_uint32 iJPEGrowlen2;
mng_bool bJPEGcompress; /* indicates "compress" initialized */
mng_bool bJPEGdecompress; /* indicates "decompress" ininitialized */
mng_bool bJPEGhasheader; /* indicates "readheader" succeeded */
mng_bool bJPEGdecostarted; /* indicates "decompress" started */
mng_bool bJPEGscanstarted; /* indicates "first scan" started */
mng_bool bJPEGprogressive; /* indicates a progressive image */
mng_bool bJPEGdecompress; /* indicates "decompress" ininitialized (JDAT) */
mng_bool bJPEGhasheader; /* indicates "readheader" succeeded (JDAT) */
mng_bool bJPEGdecostarted; /* indicates "decompress" started (JDAT) */
mng_bool bJPEGscanstarted; /* indicates "first scan" started (JDAT) */
mng_bool bJPEGprogressive; /* indicates a progressive image (JDAT) */
mng_bool bJPEGdecompress2; /* indicates "decompress" ininitialized (JDAA) */
mng_bool bJPEGhasheader2; /* indicates "readheader" succeeded (JDAA) */
mng_bool bJPEGdecostarted2; /* indicates "decompress" started (JDAA) */
mng_bool bJPEGscanstarted2; /* indicates "first scan" started (JDAA) */
mng_bool bJPEGprogressive2; /* indicates a progressive image (JDAA) */
mng_ptr fStorerow2; /* internal callback to store an
uncompressed/unfiltered row of JPEG-data */
uncompressed/unfiltered row of JPEG-data (JDAT) */
mng_ptr fStorerow3; /* internal callback to store an
uncompressed/unfiltered row of JPEG-data (JDAA) */
mng_uint32 iJPEGrow; /* row-number for current JPEG row */
mng_uint32 iJPEGalpharow; /* nr. of rows filled with alpha */
mng_uint32 iJPEGrgbrow; /* nr. of rows filled with 'color'-info */
@ -631,6 +686,24 @@ typedef mng_retcode(*mng_retrieverow) (mng_datap pData);
typedef mng_retcode(*mng_storerow) (mng_datap pData);
typedef mng_retcode(*mng_processrow) (mng_datap pData);
typedef mng_retcode(*mng_initrowproc) (mng_datap pData);
typedef mng_retcode(*mng_differrow) (mng_datap pData);
typedef mng_retcode(*mng_scalerow) (mng_datap pData);
typedef mng_retcode(*mng_deltarow) (mng_datap pData);
typedef mng_retcode(*mng_magnify_x) (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p iSrcline,
mng_uint8p iDstline);
typedef mng_retcode(*mng_magnify_y) (mng_datap pData,
mng_int32 iM,
mng_int32 iS,
mng_uint32 iWidth,
mng_uint8p iSrcline1,
mng_uint8p iSrcline2,
mng_uint8p iDstline);
/* ************************************************************************** */
/* * * */

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

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_display.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.4 * */
/* * * */
/* * purpose : Display management (definition) * */
/* * * */
@ -31,6 +31,13 @@
/* * - changed file-prefixes * */
/* * 0.9.3 - 08/07/2000 - G.Juyn * */
/* * - B111300 - fixup for improved portability * */
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
/* * - added MAGN chunk * */
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
/* * - added JDAA chunk * */
/* * * */
/* * 0.9.4 - 11/24/2000 - G.Juyn * */
/* * - moved restore of object 0 to libmng_display * */
/* * * */
/* ************************************************************************** */
@ -41,9 +48,6 @@
#ifndef _libmng_display_h_
#define _libmng_display_h_
#include "libmng.h"
#include "libmng_data.h"
/* ************************************************************************** */
mng_retcode display_progressive_refresh (mng_datap pData,
@ -51,6 +55,8 @@ mng_retcode display_progressive_refresh (mng_datap pData,
/* ************************************************************************** */
mng_retcode mng_reset_objzero (mng_datap pData);
mng_retcode display_image (mng_datap pData,
mng_imagep pImage,
mng_bool bLayeradvanced);
@ -135,6 +141,10 @@ 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_jdaa (mng_datap pData,
mng_uint32 iRawlen,
mng_uint8p pRawdata);
mng_retcode process_display_jdat (mng_datap pData,
mng_uint32 iRawlen,
mng_uint8p pRawdata);
@ -163,6 +173,19 @@ mng_retcode process_display_pplt (mng_datap pData,
mng_uint8p paAlphaentries,
mng_uint8p paUsedentries);
mng_retcode process_display_magn (mng_datap pData,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint16 iMethodX,
mng_uint16 iMX,
mng_uint16 iMY,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint16 iMT,
mng_uint16 iMB,
mng_uint16 iMethodY);
mng_retcode process_display_magn2 (mng_datap pData);
/* ************************************************************************** */
#endif /* _libmng_display_h_ */

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

@ -30,9 +30,6 @@
#ifndef _libmng_dither_h_
#define _libmng_dither_h_
#include "libmng.h"
#include "libmng_data.h"
/* ************************************************************************** */
mng_retcode dither_a_row (mng_datap pData,

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_error.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : Error routines (implementation) * */
/* * * */
@ -39,6 +39,14 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 08/09/2000 - G.Juyn * */
/* * - added check for simplicity-bits in MHDR * */
/* * 0.9.3 - 10/11/2000 - G.Juyn * */
/* * - fixed processing of unknown critical chunks * */
/* * - added support for nEED * */
/* * 0.9.3 - 10/20/2000 - G.Juyn * */
/* * - added errocode for delayed delta-processing * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -118,6 +126,10 @@
{MNG_INVFILLMETHOD, "The fill_method is invalid"},
{MNG_OBJNOTCONCRETE, "Target object for DHDR must be concrete"},
{MNG_TARGETNOALPHA, "Target object must have alpha-channel"},
{MNG_MNGTOOCOMPLEX, "MHDR simplicity indicates unsupported feature(s)"},
{MNG_UNKNOWNCRITICAL, "Unknown critical chunk encountered"},
{MNG_UNSUPPORTEDNEED, "Requested nEED resources are not supported"},
{MNG_INVALIDDELTA, "The delta operation is invalid (mismatched color_types?)"},
{MNG_INVALIDCNVSTYLE, "Canvas_style is invalid"},
{MNG_WRONGCHUNK, "Attempt to access the wrong chunk"},

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_filter.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : Filtering routines (implementation) * */
/* * * */
@ -23,6 +23,9 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 09/07/2000 - G.Juyn * */
/* * - added support for new filter_types * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -52,7 +55,7 @@ mng_retcode filter_a_row (mng_datap pData)
MNG_TRACE (pData, MNG_FN_FILTER_A_ROW, MNG_LC_START)
#endif
switch (pData->pWorkrow[0])
switch (*(pData->pWorkrow + pData->iFilterofs))
{
case 1 : {
iRetcode = filter_sub (pData);
@ -95,12 +98,12 @@ mng_retcode filter_sub (mng_datap pData)
#endif
iBpp = pData->iFilterbpp;
pRawx = pData->pWorkrow + 1 + iBpp;
pRawx_prev = pData->pWorkrow + 1;
pRawx = pData->pWorkrow + pData->iPixelofs + iBpp;
pRawx_prev = pData->pWorkrow + pData->iPixelofs;
for (iX = iBpp; iX < pData->iRowsize; iX++)
{
pRawx [0] = (mng_uint8)(pRawx [0] + pRawx_prev [0]);
*pRawx = (mng_uint8)(*pRawx + *pRawx_prev);
pRawx++;
pRawx_prev++;
}
@ -124,12 +127,12 @@ mng_retcode filter_up (mng_datap pData)
MNG_TRACE (pData, MNG_FN_FILTER_UP, MNG_LC_START)
#endif
pRawx = pData->pWorkrow + 1;
pPriorx = pData->pPrevrow + 1;
pRawx = pData->pWorkrow + pData->iPixelofs;
pPriorx = pData->pPrevrow + pData->iPixelofs;
for (iX = 0; iX < pData->iRowsize; iX++)
{
pRawx [0] = (mng_uint8)(pRawx [0] + pPriorx [0]);
*pRawx = (mng_uint8)(*pRawx + *pPriorx);
pRawx++;
pPriorx++;
}
@ -156,20 +159,20 @@ mng_retcode filter_average (mng_datap pData)
#endif
iBpp = pData->iFilterbpp;
pRawx = pData->pWorkrow + 1;
pPriorx = pData->pPrevrow + 1;
pRawx_prev = pData->pWorkrow + 1;
pRawx = pData->pWorkrow + pData->iPixelofs;
pPriorx = pData->pPrevrow + pData->iPixelofs;
pRawx_prev = pData->pWorkrow + pData->iPixelofs;
for (iX = 0; iX < iBpp; iX++)
{
pRawx [0] = (mng_uint8)(pRawx [0] + (pPriorx [0] >> 1));
*pRawx = (mng_uint8)(*pRawx + ((*pPriorx) >> 1));
pRawx++;
pPriorx++;
}
for (iX = iBpp; iX < pData->iRowsize; iX++)
{
pRawx [0] = (mng_uint8)(pRawx [0] + ((pRawx_prev [0] + pPriorx [0]) >> 1));
*pRawx = (mng_uint8)(*pRawx + ((*pRawx_prev + *pPriorx) >> 1));
pRawx++;
pPriorx++;
pRawx_prev++;
@ -201,14 +204,14 @@ mng_retcode filter_paeth (mng_datap pData)
#endif
iBpp = pData->iFilterbpp;
pRawx = pData->pWorkrow + 1;
pPriorx = pData->pPrevrow + 1;
pRawx_prev = pData->pWorkrow + 1;
pPriorx_prev = pData->pPrevrow + 1;
pRawx = pData->pWorkrow + pData->iPixelofs;
pPriorx = pData->pPrevrow + pData->iPixelofs;
pRawx_prev = pData->pWorkrow + pData->iPixelofs;
pPriorx_prev = pData->pPrevrow + pData->iPixelofs;
for (iX = 0; iX < iBpp; iX++)
{
pRawx [0] = (mng_uint8)(pRawx [0] + pPriorx [0]);
*pRawx = (mng_uint8)(*pRawx + *pPriorx);
pRawx++;
pPriorx++;
@ -216,21 +219,21 @@ mng_retcode filter_paeth (mng_datap pData)
for (iX = iBpp; iX < pData->iRowsize; iX++)
{
iA = (mng_uint32)pRawx_prev [0];
iB = (mng_uint32)pPriorx [0];
iC = (mng_uint32)pPriorx_prev [0];
iA = (mng_uint32)*pRawx_prev;
iB = (mng_uint32)*pPriorx;
iC = (mng_uint32)*pPriorx_prev;
iP = iA + iB - iC;
iPa = abs (iP - iA);
iPb = abs (iP - iB);
iPc = abs (iP - iC);
if ((iPa <= iPb) && (iPa <= iPc))
pRawx [0] = (mng_uint8)(pRawx [0] + iA);
*pRawx = (mng_uint8)(*pRawx + iA);
else
if (iPb <= iPc)
pRawx [0] = (mng_uint8)(pRawx [0] + iB);
*pRawx = (mng_uint8)(*pRawx + iB);
else
pRawx [0] = (mng_uint8)(pRawx [0] + iC);
*pRawx = (mng_uint8)(*pRawx + iC);
pRawx++;
pPriorx++;
@ -245,6 +248,643 @@ mng_retcode filter_paeth (mng_datap pData)
return MNG_NOERROR;
}
/* ************************************************************************** */
/* ************************************************************************** */
mng_retcode init_rowdiffering (mng_datap pData)
{
mng_uint8p pRawi, pRawo;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_ROWDIFFERING, MNG_LC_START)
#endif
pData->iLevel0 = 0; /* default levels */
pData->iLevel1 = 0;
pData->iLevel2 = 0;
pData->iLevel3 = 0;
if (pData->iFilter & 0x40) /* has leveling parameters ? */
{
switch (pData->iColortype) /* salvage leveling parameters */
{
case 0 : { /* gray */
if (pData->iBitdepth <= 8)
pData->iLevel0 = (mng_uint16)*pData->pWorkrow;
else
pData->iLevel0 = mng_get_uint16 (pData->pWorkrow);
break;
}
case 2 : { /* rgb */
if (pData->iBitdepth <= 8)
{
pData->iLevel0 = (mng_uint16)*pData->pWorkrow;
pData->iLevel1 = (mng_uint16)*(pData->pWorkrow+1);
pData->iLevel2 = (mng_uint16)*(pData->pWorkrow+2);
}
else
{
pData->iLevel0 = mng_get_uint16 (pData->pWorkrow);
pData->iLevel1 = mng_get_uint16 (pData->pWorkrow+2);
pData->iLevel2 = mng_get_uint16 (pData->pWorkrow+4);
}
break;
}
case 3 : { /* indexed */
pData->iLevel0 = (mng_uint16)*pData->pWorkrow;
break;
}
case 4 : { /* gray+alpha */
if (pData->iBitdepth <= 8)
{
pData->iLevel0 = (mng_uint16)*pData->pWorkrow;
pData->iLevel1 = (mng_uint16)*(pData->pWorkrow+1);
}
else
{
pData->iLevel0 = mng_get_uint16 (pData->pWorkrow);
pData->iLevel1 = mng_get_uint16 (pData->pWorkrow+2);
}
break;
}
case 6 : { /* rgb+alpha */
if (pData->iBitdepth <= 8)
{
pData->iLevel0 = (mng_uint16)*pData->pWorkrow;
pData->iLevel1 = (mng_uint16)*(pData->pWorkrow+1);
pData->iLevel2 = (mng_uint16)*(pData->pWorkrow+2);
pData->iLevel3 = (mng_uint16)*(pData->pWorkrow+3);
}
else
{
pData->iLevel0 = mng_get_uint16 (pData->pWorkrow);
pData->iLevel1 = mng_get_uint16 (pData->pWorkrow+2);
pData->iLevel2 = mng_get_uint16 (pData->pWorkrow+4);
pData->iLevel3 = mng_get_uint16 (pData->pWorkrow+6);
}
break;
}
}
}
/* shift the entire row back in place */
pRawi = pData->pWorkrow + pData->iFilterofs;
pRawo = pData->pWorkrow;
for (iX = 0; iX < pData->iRowsize + pData->iPixelofs - pData->iFilterofs; iX++)
*pRawo++ = *pRawi++;
pData->iFilterofs = 0; /* indicate so ! */
if (pData->iFilter & 0x01) /* no adaptive filtering ? */
pData->iPixelofs = pData->iFilterofs;
else
pData->iPixelofs = pData->iFilterofs + 1;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_ROWDIFFERING, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode differ_g1 (mng_datap pData)
{
mng_uint8p pRawi, pRawo;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_G1, MNG_LC_START)
#endif
if (pData->iLevel0 & 0x01) /* is it uneven level ? */
{
pRawi = pData->pWorkrow + pData->iPixelofs;
pRawo = pData->pPrevrow + pData->iPixelofs;
/* just invert every bit */
for (iX = 0; iX < pData->iRowsize; iX++)
*pRawo++ = (mng_uint8)(~(*pRawi++));
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_G1, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode differ_g2 (mng_datap pData)
{
mng_uint8p pRawi, pRawo;
mng_int32 iX;
mng_int32 iC, iS;
mng_uint8 iB, iN, iQ;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_G2, MNG_LC_START)
#endif
pRawi = pData->pWorkrow + pData->iPixelofs;
pRawo = pData->pPrevrow + pData->iPixelofs;
iC = 0;
iB = 0;
iN = 0;
iS = 0;
for (iX = 0; iX < pData->iRowsamples; iX++)
{
if (!iC)
{
iC = 4;
iB = *pRawi++;
iN = 0;
iS = 8;
}
iS -= 2;
iQ = (mng_uint8)(((iB >> iS) + pData->iLevel0) & 0x03);
iN = (mng_uint8)((iN << 2) + iQ);
iC--;
if (!iC)
*pRawo++ = iN;
}
if (iC)
*pRawo = (mng_uint8)(iN << iS);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_G2, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode differ_g4 (mng_datap pData)
{
mng_uint8p pRawi, pRawo;
mng_int32 iX;
mng_int32 iC, iS;
mng_uint8 iB, iN, iQ;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_G4, MNG_LC_START)
#endif
pRawi = pData->pWorkrow + pData->iPixelofs;
pRawo = pData->pPrevrow + pData->iPixelofs;
iC = 0;
iB = 0;
iN = 0;
iS = 0;
for (iX = 0; iX < pData->iRowsamples; iX++)
{
if (!iC)
{
iC = 2;
iB = *pRawi++;
iN = 0;
iS = 8;
}
iS -= 4;
iQ = (mng_uint8)(((iB >> iS) + pData->iLevel0) & 0x0F);
iN = (mng_uint8)((iN << 4) + iQ);
iC--;
if (!iC)
*pRawo++ = iN;
}
if (iC)
*pRawo = (mng_uint8)(iN << iS);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_G4, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode differ_g8 (mng_datap pData)
{
mng_uint8p pRawi, pRawo;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_G8, MNG_LC_START)
#endif
pRawi = pData->pWorkrow + pData->iPixelofs;
pRawo = pData->pPrevrow + pData->iPixelofs;
for (iX = 0; iX < pData->iRowsamples; iX++)
{
*pRawo++ = (mng_uint8)(((mng_uint16)*pRawi + pData->iLevel0) & 0xFF);
pRawi++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_G8, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode differ_g16 (mng_datap pData)
{
mng_uint16p pRawi, pRawo;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_G16, MNG_LC_START)
#endif
pRawi = (mng_uint16p)(pData->pWorkrow + pData->iPixelofs);
pRawo = (mng_uint16p)(pData->pPrevrow + pData->iPixelofs);
for (iX = 0; iX < pData->iRowsamples; iX++)
{
*pRawo++ = (mng_uint16)(((mng_uint32)*pRawi + (mng_uint32)pData->iLevel0) & 0xFFFF);
pRawi++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_G16, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode differ_rgb8 (mng_datap pData)
{
mng_uint8p pRawi, pRawo;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_RGB8, MNG_LC_START)
#endif
pRawi = pData->pWorkrow + pData->iPixelofs;
pRawo = pData->pPrevrow + pData->iPixelofs;
for (iX = 0; iX < pData->iRowsamples; iX++)
{
*(pRawo+1) = (mng_uint8)(((mng_uint16)*(pRawi+1) + pData->iLevel1) & 0xFF);
*pRawo = (mng_uint8)(((mng_uint16)*pRawi + pData->iLevel0 +
(mng_uint16)*(pRawo+1)) & 0xFF);
*(pRawo+2) = (mng_uint8)(((mng_uint16)*(pRawi+2) + pData->iLevel2 +
(mng_uint16)*(pRawo+1)) & 0xFF);
pRawi += 3;
pRawo += 3;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_RGB8, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode differ_rgb16 (mng_datap pData)
{
mng_uint16p pRawi, pRawo;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_RGB16, MNG_LC_START)
#endif
pRawi = (mng_uint16p)(pData->pWorkrow + pData->iPixelofs);
pRawo = (mng_uint16p)(pData->pPrevrow + pData->iPixelofs);
for (iX = 0; iX < pData->iRowsamples; iX++)
{
*(pRawo+1) = (mng_uint16)(((mng_uint32)*(pRawi+1) + (mng_uint32)pData->iLevel1) & 0xFFFF);
*pRawo = (mng_uint16)(((mng_uint32)*pRawi + (mng_uint32)pData->iLevel0 +
(mng_uint32)*(pRawo+1)) & 0xFFFF);
*(pRawo+2) = (mng_uint16)(((mng_uint32)*(pRawi+2) + (mng_uint32)pData->iLevel2 +
(mng_uint32)*(pRawo+1)) & 0xFFFF);
pRawi += 3;
pRawo += 3;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_RGB16, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode differ_idx1 (mng_datap pData)
{
mng_uint8p pRawi, pRawo;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_IDX1, MNG_LC_START)
#endif
if (pData->iLevel0 & 0x01) /* is it uneven level ? */
{
pRawi = pData->pWorkrow + pData->iPixelofs;
pRawo = pData->pPrevrow + pData->iPixelofs;
/* just invert every bit */
for (iX = 0; iX < pData->iRowsize; iX++)
*pRawo++ = (mng_uint8)(~(*pRawi++));
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_IDX1, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode differ_idx2 (mng_datap pData)
{
mng_uint8p pRawi, pRawo;
mng_int32 iX;
mng_int32 iC, iS;
mng_uint8 iB, iN, iQ;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_IDX2, MNG_LC_START)
#endif
pRawi = pData->pWorkrow + pData->iPixelofs;
pRawo = pData->pPrevrow + pData->iPixelofs;
iC = 0;
iB = 0;
iN = 0;
iS = 0;
for (iX = 0; iX < pData->iRowsamples; iX++)
{
if (!iC)
{
iC = 4;
iB = *pRawi++;
iN = 0;
iS = 8;
}
iS -= 2;
iQ = (mng_uint8)(((iB >> iS) + pData->iLevel0) & 0x03);
iN = (mng_uint8)((iN << 2) + iQ);
iC--;
if (!iC)
*pRawo++ = iN;
}
if (iC)
*pRawo = (mng_uint8)(iN << iS);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_IDX2, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode differ_idx4 (mng_datap pData)
{
mng_uint8p pRawi, pRawo;
mng_int32 iX;
mng_int32 iC, iS;
mng_uint8 iB, iN, iQ;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_IDX4, MNG_LC_START)
#endif
pRawi = pData->pWorkrow + pData->iPixelofs;
pRawo = pData->pPrevrow + pData->iPixelofs;
iC = 0;
iB = 0;
iN = 0;
iS = 0;
for (iX = 0; iX < pData->iRowsamples; iX++)
{
if (!iC)
{
iC = 2;
iB = *pRawi++;
iN = 0;
iS = 8;
}
iS -= 4;
iQ = (mng_uint8)(((iB >> iS) + pData->iLevel0) & 0x0F);
iN = (mng_uint8)((iN << 4) + iQ);
iC--;
if (!iC)
*pRawo++ = iN;
}
if (iC)
*pRawo = (mng_uint8)(iN << iS);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_IDX4, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode differ_idx8 (mng_datap pData)
{
mng_uint8p pRawi, pRawo;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_IDX8, MNG_LC_START)
#endif
pRawi = pData->pWorkrow + pData->iPixelofs;
pRawo = pData->pPrevrow + pData->iPixelofs;
for (iX = 0; iX < pData->iRowsamples; iX++)
{
*pRawo++ = (mng_uint8)(((mng_uint16)*pRawi + pData->iLevel0) & 0xFF);
pRawi++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_IDX8, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode differ_ga8 (mng_datap pData)
{
mng_uint8p pRawi, pRawo;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_GA8, MNG_LC_START)
#endif
pRawi = pData->pWorkrow + pData->iPixelofs;
pRawo = pData->pPrevrow + pData->iPixelofs;
for (iX = 0; iX < pData->iRowsamples; iX++)
{
*pRawo = (mng_uint8)(((mng_uint16)*pRawi + pData->iLevel0) & 0xFF);
*(pRawo+1) = (mng_uint8)(((mng_uint16)*(pRawi+1) + pData->iLevel1) & 0xFF);
pRawi += 2;
pRawo += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_GA8, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode differ_ga16 (mng_datap pData)
{
mng_uint16p pRawi, pRawo;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_GA16, MNG_LC_START)
#endif
pRawi = (mng_uint16p)(pData->pWorkrow + pData->iPixelofs);
pRawo = (mng_uint16p)(pData->pPrevrow + pData->iPixelofs);
for (iX = 0; iX < pData->iRowsamples; iX++)
{
*pRawo = (mng_uint16)(((mng_uint32)*pRawi + (mng_uint32)pData->iLevel0) & 0xFFFF);
*(pRawo+1) = (mng_uint16)(((mng_uint32)*(pRawi+1) + (mng_uint32)pData->iLevel1) & 0xFFFF);
pRawi += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_GA16, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode differ_rgba8 (mng_datap pData)
{
mng_uint8p pRawi, pRawo;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_RGBA8, MNG_LC_START)
#endif
pRawi = pData->pWorkrow + pData->iPixelofs;
pRawo = pData->pPrevrow + pData->iPixelofs;
for (iX = 0; iX < pData->iRowsamples; iX++)
{
*(pRawo+1) = (mng_uint8)(((mng_uint16)*(pRawi+1) + pData->iLevel1) & 0xFF);
*pRawo = (mng_uint8)(((mng_uint16)*pRawi + pData->iLevel0 +
(mng_uint16)*(pRawo+1)) & 0xFF);
*(pRawo+2) = (mng_uint8)(((mng_uint16)*(pRawi+2) + pData->iLevel2 +
(mng_uint16)*(pRawo+1)) & 0xFF);
*(pRawo+3) = (mng_uint8)(((mng_uint16)*(pRawi+3) + pData->iLevel3) & 0xFF);
pRawi += 4;
pRawo += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_RGBA8, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode differ_rgba16 (mng_datap pData)
{
mng_uint16p pRawi, pRawo;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_RGBA16, MNG_LC_START)
#endif
pRawi = (mng_uint16p)(pData->pWorkrow + pData->iPixelofs);
pRawo = (mng_uint16p)(pData->pPrevrow + pData->iPixelofs);
for (iX = 0; iX < pData->iRowsamples; iX++)
{
*(pRawo+1) = (mng_uint16)(((mng_uint32)*(pRawi+1) + (mng_uint32)pData->iLevel1) & 0xFFFF);
*pRawo = (mng_uint16)(((mng_uint32)*pRawi + (mng_uint32)pData->iLevel0 +
(mng_uint32)*(pRawo+1)) & 0xFFFF);
*(pRawo+2) = (mng_uint16)(((mng_uint32)*(pRawi+2) + (mng_uint32)pData->iLevel2 +
(mng_uint32)*(pRawo+1)) & 0xFFFF);
*(pRawo+3) = (mng_uint16)(((mng_uint32)*(pRawi+3) + (mng_uint32)pData->iLevel3) & 0xFFFF);
pRawi += 4;
pRawo += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DIFFER_RGBA16, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#endif /* MNG_INCLUDE_FILTERS */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_filter.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : Filtering routines (definition) * */
/* * * */
@ -21,6 +21,9 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 09/07/2000 - G.Juyn * */
/* * - added support for new filter_types * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -30,9 +33,6 @@
#ifndef _libmng_filter_h_
#define _libmng_filter_h_
#include "libmng.h"
#include "libmng_data.h"
/* ************************************************************************** */
mng_retcode filter_a_row (mng_datap pData);
@ -44,6 +44,26 @@ mng_retcode filter_paeth (mng_datap pData);
/* ************************************************************************** */
mng_retcode init_rowdiffering (mng_datap pData);
mng_retcode differ_g1 (mng_datap pData);
mng_retcode differ_g2 (mng_datap pData);
mng_retcode differ_g4 (mng_datap pData);
mng_retcode differ_g8 (mng_datap pData);
mng_retcode differ_g16 (mng_datap pData);
mng_retcode differ_rgb8 (mng_datap pData);
mng_retcode differ_rgb16 (mng_datap pData);
mng_retcode differ_idx1 (mng_datap pData);
mng_retcode differ_idx2 (mng_datap pData);
mng_retcode differ_idx4 (mng_datap pData);
mng_retcode differ_idx8 (mng_datap pData);
mng_retcode differ_ga8 (mng_datap pData);
mng_retcode differ_ga16 (mng_datap pData);
mng_retcode differ_rgba8 (mng_datap pData);
mng_retcode differ_rgba16 (mng_datap pData);
/* ************************************************************************** */
#endif /* _libmng_filter_h_ */
/* ************************************************************************** */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_hlapi.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.4 * */
/* * * */
/* * purpose : high-level application API (implementation) * */
/* * * */
@ -92,6 +92,29 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 09/07/2000 - G.Juyn * */
/* * - added support for new filter_types * */
/* * 0.9.3 - 09/10/2000 - G.Juyn * */
/* * - fixed DEFI behavior * */
/* * 0.9.3 - 10/11/2000 - G.Juyn * */
/* * - added support for nEED * */
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
/* * - added optional support for bKGD for PNG images * */
/* * - raised initial maximum canvas size * */
/* * - added support for JDAA * */
/* * 0.9.3 - 10/17/2000 - G.Juyn * */
/* * - added callback to process non-critical unknown chunks * */
/* * - fixed support for delta-images during read() / display() * */
/* * 0.9.3 - 10/18/2000 - G.Juyn * */
/* * - added closestream() processing for mng_cleanup() * */
/* * 0.9.3 - 10/27/2000 - G.Juyn * */
/* * - fixed seperate read() & display() processing * */
/* * * */
/* * 0.9.4 - 11/20/2000 - G.Juyn * */
/* * - fixed unwanted repetition in mng_readdisplay() * */
/* * 0.9.4 - 11/24/2000 - G.Juyn * */
/* * - moved restore of object 0 to libmng_display * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -259,6 +282,123 @@ mng_retcode mng_drop_savedata (mng_datap pData)
/* ************************************************************************** */
#ifdef MNG_SUPPORT_DISPLAY
mng_retcode mng_reset_rundata (mng_datap pData)
{
drop_invalid_objects (pData); /* drop invalidly stored objects */
mng_drop_savedata (pData); /* drop invalidly stored savedata */
mng_reset_objzero (pData); /* reset object 0 */
pData->iFrameseq = 0; /* reset counters & stuff */
pData->iLayerseq = 0;
pData->iFrametime = 0;
pData->iRuntime = 0;
pData->iSynctime = 0;
pData->iStarttime = 0;
pData->iEndtime = 0;
pData->bRunning = MNG_FALSE;
pData->bTimerset = MNG_FALSE;
pData->iBreakpoint = 0;
pData->bSectionwait = MNG_FALSE;
pData->bFreezing = MNG_FALSE;
pData->bResetting = MNG_FALSE;
pData->bNeedrefresh = MNG_FALSE;
pData->iUpdateleft = 0; /* reset region */
pData->iUpdateright = 0;
pData->iUpdatetop = 0;
pData->iUpdatebottom = 0;
pData->iPLTEcount = 0; /* reset PLTE data */
pData->iDEFIobjectid = 0; /* reset DEFI data */
pData->bDEFIhasdonotshow = MNG_FALSE;
pData->iDEFIdonotshow = 0;
pData->bDEFIhasconcrete = MNG_FALSE;
pData->iDEFIconcrete = 0;
pData->bDEFIhasloca = MNG_FALSE;
pData->iDEFIlocax = 0;
pData->iDEFIlocay = 0;
pData->bDEFIhasclip = MNG_FALSE;
pData->iDEFIclipl = 0;
pData->iDEFIclipr = 0;
pData->iDEFIclipt = 0;
pData->iDEFIclipb = 0;
pData->iBACKred = 0; /* reset BACK data */
pData->iBACKgreen = 0;
pData->iBACKblue = 0;
pData->iBACKmandatory = 0;
pData->iBACKimageid = 0;
pData->iBACKtile = 0;
pData->iFRAMmode = 1; /* default global FRAM variables */
pData->iFRAMdelay = 1;
pData->iFRAMtimeout = 0x7fffffffl;
pData->bFRAMclipping = MNG_FALSE;
pData->iFRAMclipl = 0;
pData->iFRAMclipr = 0;
pData->iFRAMclipt = 0;
pData->iFRAMclipb = 0;
pData->iFramemode = 1; /* again for the current frame */
pData->iFramedelay = 1;
pData->iFrametimeout = 0x7fffffffl;
pData->bFrameclipping = MNG_FALSE;
pData->iFrameclipl = 0;
pData->iFrameclipr = 0;
pData->iFrameclipt = 0;
pData->iFrameclipb = 0;
pData->iNextdelay = 1;
pData->iSHOWmode = 0; /* reset SHOW data */
pData->iSHOWfromid = 0;
pData->iSHOWtoid = 0;
pData->iSHOWnextid = 0;
pData->iSHOWskip = 0;
pData->iGlobalPLTEcount = 0; /* reset global PLTE data */
pData->iGlobalTRNSrawlen = 0; /* reset global tRNS data */
pData->iGlobalGamma = 0; /* reset global gAMA data */
pData->iGlobalWhitepointx = 0; /* reset global cHRM data */
pData->iGlobalWhitepointy = 0;
pData->iGlobalPrimaryredx = 0;
pData->iGlobalPrimaryredy = 0;
pData->iGlobalPrimarygreenx = 0;
pData->iGlobalPrimarygreeny = 0;
pData->iGlobalPrimarybluex = 0;
pData->iGlobalPrimarybluey = 0;
pData->iGlobalRendintent = 0; /* reset global sRGB data */
if (pData->iGlobalProfilesize) /* drop global profile (if any) */
MNG_FREE (pData, pData->pGlobalProfile, pData->iGlobalProfilesize)
pData->iGlobalProfilesize = 0;
pData->iGlobalBKGDred = 0; /* reset global bKGD data */
pData->iGlobalBKGDgreen = 0;
pData->iGlobalBKGDblue = 0;
/* reset delta-image */
pData->pDeltaImage = MNG_NULL;
pData->iDeltaImagetype = 0;
pData->iDeltatype = 0;
pData->iDeltaBlockwidth = 0;
pData->iDeltaBlockheight = 0;
pData->iDeltaBlockx = 0;
pData->iDeltaBlocky = 0;
pData->bDeltaimmediate = MNG_FALSE;
return MNG_NOERROR;
}
#endif /* MNG_SUPPORT_DISPLAY */
/* ************************************************************************** */
void cleanup_errors (mng_datap pData)
{
pData->iErrorcode = MNG_NOERROR;
@ -363,6 +503,8 @@ mng_handle MNG_DECL mng_initialize (mng_ptr pUserdata,
pData->iBGgreen = 0;
pData->iBGblue = 0;
pData->bUseBKGD = MNG_TRUE;
#ifdef MNG_FULL_CMS
pData->bIssRGB = MNG_TRUE;
pData->hProf1 = 0; /* no profiles yet */
@ -381,37 +523,39 @@ mng_handle MNG_DECL mng_initialize (mng_ptr pUserdata,
/* normal animation-speed ! */
pData->iSpeed = mng_st_normal;
/* initial image limits */
pData->iMaxwidth = 1600;
pData->iMaxheight = 1200;
pData->iMaxwidth = 10000;
pData->iMaxheight = 10000;
#ifdef MNG_INTERNAL_MEMMNGMT
pData->fMemalloc = 0; /* internal management */
pData->fMemfree = 0;
#ifdef MNG_INTERNAL_MEMMNGMT /* internal management */
pData->fMemalloc = MNG_NULL;
pData->fMemfree = MNG_NULL;
#else /* keep callbacks */
pData->fMemalloc = fMemalloc;
pData->fMemfree = fMemfree;
#endif
pData->fOpenstream = 0; /* no value (yet) */
pData->fClosestream = 0;
pData->fReaddata = 0;
pData->fWritedata = 0;
pData->fErrorproc = 0;
pData->fProcessheader = 0;
pData->fProcesstext = 0;
pData->fProcesssave = 0;
pData->fProcessseek = 0;
pData->fGetcanvasline = 0;
pData->fGetbkgdline = 0;
pData->fGetalphaline = 0;
pData->fRefresh = 0;
pData->fGettickcount = 0;
pData->fSettimer = 0;
pData->fProcessgamma = 0;
pData->fProcesschroma = 0;
pData->fProcesssrgb = 0;
pData->fProcessiccp = 0;
pData->fProcessarow = 0;
/* no value (yet) */
pData->fOpenstream = MNG_NULL;
pData->fClosestream = MNG_NULL;
pData->fReaddata = MNG_NULL;
pData->fWritedata = MNG_NULL;
pData->fErrorproc = MNG_NULL;
pData->fProcessheader = MNG_NULL;
pData->fProcesstext = MNG_NULL;
pData->fProcesssave = MNG_NULL;
pData->fProcessseek = MNG_NULL;
pData->fProcessneed = MNG_NULL;
pData->fProcessunknown = MNG_NULL;
pData->fGetcanvasline = MNG_NULL;
pData->fGetbkgdline = MNG_NULL;
pData->fGetalphaline = MNG_NULL;
pData->fRefresh = MNG_NULL;
pData->fGettickcount = MNG_NULL;
pData->fSettimer = MNG_NULL;
pData->fProcessgamma = MNG_NULL;
pData->fProcesschroma = MNG_NULL;
pData->fProcesssrgb = MNG_NULL;
pData->fProcessiccp = MNG_NULL;
pData->fProcessarow = MNG_NULL;
#if defined(MNG_SUPPORT_DISPLAY) && (defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS))
pData->dLastgamma = 0; /* lookup table needs first-time calc */
@ -485,10 +629,6 @@ mng_handle MNG_DECL mng_initialize (mng_ptr pUserdata,
mng_retcode MNG_DECL mng_reset (mng_handle hHandle)
{
mng_datap pData;
#ifdef MNG_SUPPORT_DISPLAY
mng_retcode iRetcode;
mng_imagep pImage;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_RESET, MNG_LC_START)
@ -519,7 +659,10 @@ mng_retcode MNG_DECL mng_reset (mng_handle hHandle)
}
#endif /* MNG_INCLUDE_ZLIB */
#ifdef MNG_SUPPORT_READ /* cleanup default read buffers */
#ifdef MNG_SUPPORT_READ
if ((pData->bReading) && (!pData->bEOF))
process_eof (pData); /* cleanup app streaming */
/* cleanup default read buffers */
MNG_FREE (pData, pData->pReadbuf, pData->iReadbufsize)
MNG_FREE (pData, pData->pLargebuf, pData->iLargebufsize)
MNG_FREE (pData, pData->pSuspendbuf, pData->iSuspendbufsize)
@ -548,6 +691,8 @@ mng_retcode MNG_DECL mng_reset (mng_handle hHandle)
pData->iLayercount = 0;
pData->iFramecount = 0;
pData->iPlaytime = 0;
pData->iSimplicity = 0;
pData->iAlphadepth = 16; /* assume the worst! */
pData->iImagelevel = 0; /* no image encountered */
@ -569,8 +714,8 @@ mng_retcode MNG_DECL mng_reset (mng_handle hHandle)
/* the unknown chunk */
pData->iChunkname = MNG_UINT_HUH;
pData->iChunkseq = 0;
pData->pFirstchunk = 0;
pData->pLastchunk = 0;
pData->pFirstchunk = MNG_NULL;
pData->pLastchunk = MNG_NULL;
/* nothing processed yet */
pData->bHasheader = MNG_FALSE;
pData->bHasMHDR = MNG_FALSE;
@ -580,6 +725,7 @@ mng_retcode MNG_DECL mng_reset (mng_handle hHandle)
#ifdef MNG_INCLUDE_JNG
pData->bHasJHDR = MNG_FALSE;
pData->bHasJSEP = MNG_FALSE;
pData->bHasJDAA = MNG_FALSE;
pData->bHasJDAT = MNG_FALSE;
#endif
pData->bHasPLTE = MNG_FALSE;
@ -648,7 +794,7 @@ mng_retcode MNG_DECL mng_reset (mng_handle hHandle)
pData->bWriting = MNG_FALSE;
pData->iFirstchunkadded = 0;
pData->iWritebufsize = 0;
pData->pWritebuf = 0;
pData->pWritebuf = MNG_NULL;
#endif /* MNG_SUPPORT_WRITE */
#ifdef MNG_SUPPORT_DISPLAY /* done nuttin' yet */
@ -662,6 +808,8 @@ mng_retcode MNG_DECL mng_reset (mng_handle hHandle)
pData->iRequesttime = 0;
pData->bSearching = MNG_FALSE;
pData->bRestorebkgd = MNG_FALSE;
pData->iRuntime = 0;
pData->iSynctime = 0;
pData->iStarttime = 0;
@ -673,16 +821,16 @@ mng_retcode MNG_DECL mng_reset (mng_handle hHandle)
pData->bFreezing = MNG_FALSE;
pData->bResetting = MNG_FALSE;
pData->bNeedrefresh = MNG_FALSE;
pData->pCurrentobj = 0; /* these don't exist yet */
pData->pCurraniobj = 0;
pData->pTermaniobj = 0;
pData->pLastclone = 0;
pData->pStoreobj = 0;
pData->pStorebuf = 0;
pData->pRetrieveobj = 0;
pData->pSavedata = 0; /* no saved data ! */
/* these don't exist yet */
pData->pCurrentobj = MNG_NULL;
pData->pCurraniobj = MNG_NULL;
pData->pTermaniobj = MNG_NULL;
pData->pLastclone = MNG_NULL;
pData->pStoreobj = MNG_NULL;
pData->pStorebuf = MNG_NULL;
pData->pRetrieveobj = MNG_NULL;
/* no saved data ! */
pData->pSavedata = MNG_NULL;
/* TODO: remove in 1.0.0 !!! */
pData->bEMNGMAhack = MNG_FALSE;
@ -691,19 +839,25 @@ mng_retcode MNG_DECL mng_reset (mng_handle hHandle)
pData->iUpdatetop = 0;
pData->iUpdatebottom = 0;
pData->iPass = 0; /* interlacing stuff and temp buffers */
pData->iPass = -1; /* interlacing stuff and temp buffers */
pData->iRow = 0;
pData->iRowinc = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 0;
pData->iColinc = 1;
pData->iRowsamples = 0;
pData->iSamplemul = 0;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = 0;
pData->iRowmax = 0;
pData->pWorkrow = 0;
pData->pPrevrow = 0;
pData->iFilterofs = 0;
pData->iPixelofs = 1;
pData->iLevel0 = 0;
pData->iLevel1 = 0;
pData->iLevel2 = 0;
pData->iLevel3 = 0;
pData->pWorkrow = MNG_NULL;
pData->pPrevrow = MNG_NULL;
pData->pRGBArow = 0;
pData->bIsRGBA16 = MNG_TRUE;
pData->bIsOpaque = MNG_TRUE;
@ -717,24 +871,27 @@ mng_retcode MNG_DECL mng_reset (mng_handle hHandle)
pData->iDestr = 0;
pData->iDestt = 0;
pData->iDestb = 0;
pData->pFirstimgobj = 0; /* lists are empty */
pData->pLastimgobj = 0;
pData->pFirstaniobj = 0;
pData->pLastaniobj = 0;
pData->fDisplayrow = 0; /* no processing callbacks */
pData->fRestbkgdrow = 0;
pData->fCorrectrow = 0;
pData->fRetrieverow = 0;
pData->fStorerow = 0;
pData->fProcessrow = 0;
pData->fInitrowproc = 0;
/* lists are empty */
pData->pFirstimgobj = MNG_NULL;
pData->pLastimgobj = MNG_NULL;
pData->pFirstaniobj = MNG_NULL;
pData->pLastaniobj = MNG_NULL;
/* no processing callbacks */
pData->fDisplayrow = MNG_NULL;
pData->fRestbkgdrow = MNG_NULL;
pData->fCorrectrow = MNG_NULL;
pData->fRetrieverow = MNG_NULL;
pData->fStorerow = MNG_NULL;
pData->fProcessrow = MNG_NULL;
pData->fDifferrow = MNG_NULL;
pData->fInitrowproc = MNG_NULL;
pData->iPLTEcount = 0; /* no PLTE data */
pData->iDEFIobjectid = 0; /* no DEFI data */
pData->bDEFIhasdonotshow = MNG_FALSE;
pData->iDEFIdonotshow = 0;
pData->bDEFIhasconcrete = MNG_FALSE;
pData->iDEFIconcrete = 0;
pData->bDEFIhasloca = MNG_FALSE;
pData->iDEFIlocax = 0;
@ -818,21 +975,7 @@ mng_retcode MNG_DECL mng_reset (mng_handle hHandle)
#endif
#ifdef MNG_SUPPORT_DISPLAY /* reset object 0 */
pImage = (mng_imagep)pData->pObjzero;
iRetcode = reset_object_details (pData, pImage, 0, 0, 0, 0, 0, 0, 0, MNG_TRUE);
if (iRetcode) /* on error bail out */
return iRetcode;
pImage->bVisible = MNG_TRUE;
pImage->bViewable = MNG_TRUE;
pImage->iPosx = 0;
pImage->iPosy = 0;
pImage->bClipped = MNG_FALSE;
pImage->iClipl = 0;
pImage->iClipr = 0;
pImage->iClipt = 0;
pImage->iClipb = 0;
mng_reset_objzero (pData);
#endif
#ifdef MNG_SUPPORT_TRACE
@ -859,12 +1002,15 @@ mng_retcode MNG_DECL mng_cleanup (mng_handle* hHandle)
pData = ((mng_datap)(*hHandle)); /* and address main structure */
#ifdef MNG_SUPPORT_READ
if ((pData->bReading) && (!pData->bEOF))
process_eof (pData); /* cleanup app streaming */
/* cleanup default read buffers */
MNG_FREE (pData, pData->pReadbuf, pData->iReadbufsize)
MNG_FREE (pData, pData->pLargebuf, pData->iLargebufsize)
MNG_FREE (pData, pData->pSuspendbuf, pData->iSuspendbufsize)
#endif
#ifdef MNG_SUPPORT_WRITE
#ifdef MNG_SUPPORT_WRITE /* cleanup default write buffers */
MNG_FREE (pData, pData->pWritebuf, pData->iWritebufsize)
#endif
@ -976,8 +1122,14 @@ mng_retcode MNG_DECL mng_read (mng_handle hHandle)
iRetcode = read_graphic (pData);
if (pData->bEOF) /* already at EOF ? */
{
pData->bReading = MNG_FALSE; /* then we're no longer reading */
#ifdef MNG_SUPPORT_DISPLAY
mng_reset_rundata (pData); /* reset rundata */
#endif
}
if (iRetcode) /* on error bail out */
return iRetcode;
@ -1026,8 +1178,14 @@ mng_retcode MNG_DECL mng_read_resume (mng_handle hHandle)
iRetcode = read_graphic (pData); /* continue reading now */
if (pData->bEOF) /* at EOF ? */
{
pData->bReading = MNG_FALSE; /* then we're no longer reading */
#ifdef MNG_SUPPORT_DISPLAY
mng_reset_rundata (pData); /* reset rundata */
#endif
}
if (iRetcode) /* on error bail out */
return iRetcode;
@ -1195,7 +1353,10 @@ mng_retcode MNG_DECL mng_readdisplay (mng_handle hHandle)
iRetcode = read_graphic (pData);
if (pData->bEOF) /* already at EOF ? */
{
pData->bReading = MNG_FALSE; /* then we're no longer reading */
drop_invalid_objects (pData); /* drop invalidly stored objects */
}
if (iRetcode) /* on error bail out */
return iRetcode;
@ -1278,6 +1439,7 @@ mng_retcode MNG_DECL mng_display (mng_handle hHandle)
#endif
pData->iStarttime = pData->iSynctime;
pData->iEndtime = 0;
pData->pCurraniobj = pData->pFirstaniobj;
iRetcode = process_display (pData); /* go do it */
@ -1338,7 +1500,11 @@ mng_retcode MNG_DECL mng_display_resume (mng_handle hHandle)
iRetcode = read_graphic (pData);
if (pData->bEOF) /* already at EOF ? */
{
pData->bReading = MNG_FALSE; /* then we're no longer reading */
/* drop invalidly stored objects */
drop_invalid_objects (pData);
}
}
else
#endif /* MNG_SUPPORT_READ */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_jpeg.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : JPEG library interface (implementation) * */
/* * * */
@ -31,6 +31,9 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
/* * - added support for JDAA * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -54,7 +57,7 @@
/* ************************************************************************** */
/* * * */
/* * Local IJG callback routines (source-manager & error-manager) * */
/* * Local IJG callback routines (source-manager, error-manager and such) * */
/* * * */
/* ************************************************************************** */
@ -109,6 +112,35 @@ void mng_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
void mng_skip_input_data2 (j_decompress_ptr cinfo, long num_bytes)
{
if (num_bytes > 0) /* ignore fony calls */
{ /* address my generic structure */
mng_datap pData = (mng_datap)cinfo->client_data;
/* address source manager */
mngjpeg_sourcep pSrc = pData->pJPEGdinfo2->src;
/* problem scenario ? */
if (pSrc->bytes_in_buffer < (size_t)num_bytes)
{ /* tell the boss we need to skip some data! */
pData->iJPEGtoskip2 = (mng_uint32)((size_t)num_bytes - pSrc->bytes_in_buffer);
pSrc->bytes_in_buffer = 0; /* let the JPEG lib suspend */
pSrc->next_input_byte = MNG_NULL;
}
else
{ /* simply advance in the buffer */
pSrc->bytes_in_buffer -= num_bytes;
pSrc->next_input_byte += num_bytes;
}
}
return;
}
#endif /* MNG_INCLUDE_JNG_READ */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
void mng_term_source (j_decompress_ptr cinfo)
{
@ -165,6 +197,15 @@ mng_retcode mngjpeg_initialize (mng_datap pData)
MNG_ALLOC (pData, pData->pJPEGdinfo, sizeof (mngjpeg_decomp))
/* enable reverse addressing */
pData->pJPEGdinfo->client_data = pData;
if (pData->pJPEGderr2 == MNG_NULL)
MNG_ALLOC (pData, pData->pJPEGderr2, sizeof (mngjpeg_error ))
if (pData->pJPEGdsrc2 == MNG_NULL)
MNG_ALLOC (pData, pData->pJPEGdsrc2, sizeof (mngjpeg_source))
if (pData->pJPEGdinfo2 == MNG_NULL)
MNG_ALLOC (pData, pData->pJPEGdinfo2, sizeof (mngjpeg_decomp))
/* enable reverse addressing */
pData->pJPEGdinfo2->client_data = pData;
#endif
#ifdef MNG_INCLUDE_JNG_WRITE
@ -175,22 +216,37 @@ mng_retcode mngjpeg_initialize (mng_datap pData)
/* enable reverse addressing */
pData->pJPEGcinfo->client_data = pData;
#endif
/* initialize temporary buffer parms */
/* initialize temporary buffers */
pData->iJPEGbufmax = MNG_JPEG_MAXBUF;
MNG_ALLOC (pData, pData->pJPEGbuf, pData->iJPEGbufmax)
pData->iJPEGbufmax2 = MNG_JPEG_MAXBUF;
MNG_ALLOC (pData, pData->pJPEGbuf2, pData->iJPEGbufmax2)
pData->pJPEGcurrent = pData->pJPEGbuf;
pData->iJPEGbufremain = 0;
pData->pJPEGrow = MNG_NULL;
pData->iJPEGrowlen = 0;
pData->iJPEGtoskip = 0;
pData->bJPEGcompress = MNG_FALSE; /* not doing anything yet ! */
pData->pJPEGcurrent2 = pData->pJPEGbuf2;
pData->iJPEGbufremain2 = 0;
pData->pJPEGrow2 = MNG_NULL;
pData->iJPEGrowlen2 = 0;
pData->iJPEGtoskip2 = 0;
/* not doing anything yet ! */
pData->bJPEGcompress = MNG_FALSE;
pData->bJPEGdecompress = MNG_FALSE;
pData->bJPEGhasheader = MNG_FALSE;
pData->bJPEGdecostarted = MNG_FALSE;
pData->bJPEGscanstarted = MNG_FALSE;
pData->bJPEGdecompress2 = MNG_FALSE;
pData->bJPEGhasheader2 = MNG_FALSE;
pData->bJPEGdecostarted2 = MNG_FALSE;
pData->bJPEGscanstarted2 = MNG_FALSE;
pData->iJPEGrow = 0; /* zero input/output lines */
pData->iJPEGalpharow = 0;
pData->iJPEGrgbrow = 0;
@ -222,9 +278,11 @@ mng_retcode mngjpeg_cleanup (mng_datap pData)
MNG_ERRORJ (pData, iRetcode) /* then IJG-lib issued an error */
#endif
#ifdef MNG_INCLUDE_JNG_READ
if (pData->bJPEGdecompress) /* still decompressing something ? */
#ifdef MNG_INCLUDE_JNG_READ /* still decompressing something ? */
if (pData->bJPEGdecompress)
jpeg_destroy_decompress (pData->pJPEGdinfo);
if (pData->bJPEGdecompress2)
jpeg_destroy_decompress (pData->pJPEGdinfo2);
#endif
#ifdef MNG_INCLUDE_JNG_WRITE
@ -233,13 +291,17 @@ mng_retcode mngjpeg_cleanup (mng_datap pData)
#endif
#endif /* MNG_INCLUDE_IJG6B */
/* cleanup temporary buffer */
/* cleanup temporary buffers */
MNG_FREE (pData, pData->pJPEGbuf, pData->iJPEGbufmax)
MNG_FREE (pData, pData->pJPEGbuf2, pData->iJPEGbufmax2)
/* cleanup space for JPEG structures */
#ifdef MNG_INCLUDE_JNG_READ
MNG_FREE (pData, pData->pJPEGdinfo, sizeof (mngjpeg_decomp))
MNG_FREE (pData, pData->pJPEGdsrc, sizeof (mngjpeg_source))
MNG_FREE (pData, pData->pJPEGderr, sizeof (mngjpeg_error ))
MNG_FREE (pData, pData->pJPEGdinfo2, sizeof (mngjpeg_decomp))
MNG_FREE (pData, pData->pJPEGdsrc2, sizeof (mngjpeg_source))
MNG_FREE (pData, pData->pJPEGderr2, sizeof (mngjpeg_error ))
#endif
#ifdef MNG_INCLUDE_JNG_WRITE
@ -248,13 +310,21 @@ mng_retcode mngjpeg_cleanup (mng_datap pData)
#endif
MNG_FREE (pData, pData->pJPEGrow, pData->iJPEGrowlen)
MNG_FREE (pData, pData->pJPEGrow2, pData->iJPEGrowlen2)
/* whatever we were doing ... */
/* we don't anymore ... */
pData->bJPEGcompress = MNG_FALSE;
pData->bJPEGcompress = MNG_FALSE; /* whatever we were doing ... */
pData->bJPEGdecompress = MNG_FALSE; /* we don't anymore ... */
pData->bJPEGdecompress = MNG_FALSE;
pData->bJPEGhasheader = MNG_FALSE;
pData->bJPEGdecostarted = MNG_FALSE;
pData->bJPEGscanstarted = MNG_FALSE;
pData->bJPEGdecompress2 = MNG_FALSE;
pData->bJPEGhasheader2 = MNG_FALSE;
pData->bJPEGdecostarted2 = MNG_FALSE;
pData->bJPEGscanstarted2 = MNG_FALSE;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_CLEANUP, MNG_LC_END)
#endif
@ -262,6 +332,10 @@ mng_retcode mngjpeg_cleanup (mng_datap pData)
return MNG_NOERROR;
}
/* ************************************************************************** */
/* * * */
/* * JPEG decompression routines (JDAT) * */
/* * * */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
@ -406,7 +480,7 @@ mng_retcode mngjpeg_decompressdata (mng_datap pData,
if (jpeg_read_header (pData->pJPEGdinfo, TRUE) != JPEG_SUSPENDED)
{ /* indicate the header's oke */
pData->bJPEGhasheader = MNG_TRUE;
/* let's do some sanity checks ! */
if ((pData->pJPEGdinfo->image_width != pData->iDatawidth ) ||
(pData->pJPEGdinfo->image_height != pData->iDataheight) )
MNG_ERROR (pData, MNG_JPEGPARMSERR)
@ -601,6 +675,340 @@ mng_retcode mngjpeg_decompressfree (mng_datap pData)
}
#endif /* MNG_INCLUDE_JNG_READ */
/* ************************************************************************** */
/* * * */
/* * JPEG decompression routines (JDAA) * */
/* * * */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
mng_retcode mngjpeg_decompressinit2 (mng_datap pData)
{
#if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP)
mng_retcode iRetcode;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_START)
#endif
#ifdef MNG_INCLUDE_IJG6B
/* allocate and initialize a JPEG decompression object */
pData->pJPEGdinfo2->err = jpeg_std_error (pData->pJPEGderr2);
#ifdef MNG_USE_SETJMP /* setup local JPEG error-routines */
pData->pJPEGderr2->error_exit = mng_error_exit;
pData->pJPEGderr2->output_message = mng_output_message;
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 */
#endif /* MNG_USE_SETJMP */
/* 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->pJPEGdinfo2);
pData->bJPEGdecompress2 = MNG_TRUE; /* indicate it's initialized */
/* specify the source of the compressed data (eg, a file) */
/* no, not a file; we have buffered input */
pData->pJPEGdinfo2->src = pData->pJPEGdsrc2;
/* use the default handler */
pData->pJPEGdinfo2->src->resync_to_restart = jpeg_resync_to_restart;
/* setup local source routine & parms */
pData->pJPEGdinfo2->src->init_source = mng_init_source;
pData->pJPEGdinfo2->src->fill_input_buffer = mng_fill_input_buffer;
pData->pJPEGdinfo2->src->skip_input_data = mng_skip_input_data2;
pData->pJPEGdinfo2->src->term_source = mng_term_source;
pData->pJPEGdinfo2->src->next_input_byte = pData->pJPEGcurrent2;
pData->pJPEGdinfo2->src->bytes_in_buffer = pData->iJPEGbufremain2;
#endif /* MNG_INCLUDE_IJG6B */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_END)
#endif
return MNG_NOERROR;
}
#endif /* MNG_INCLUDE_JNG_READ */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
mng_retcode mngjpeg_decompressdata2 (mng_datap pData,
mng_uint32 iRawsize,
mng_uint8p pRawdata)
{
mng_retcode iRetcode;
mng_uint32 iRemain;
mng_uint8p pWork;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_START)
#endif
#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 */
#endif
pWork = pRawdata;
iRemain = iRawsize;
if (pData->iJPEGtoskip2) /* JPEG-lib told us to skip some more data ? */
{
if (iRemain > pData->iJPEGtoskip2) /* enough data in this buffer ? */
{
iRemain -= pData->iJPEGtoskip2; /* skip enough to access the next byte */
pWork += pData->iJPEGtoskip2;
pData->iJPEGtoskip2 = 0; /* no more to skip then */
}
else
{
pData->iJPEGtoskip2 -= iRemain; /* skip all data in the buffer */
iRemain = 0; /* and indicate this accordingly */
}
/* the skip set current-pointer to NULL ! */
pData->pJPEGcurrent2 = pData->pJPEGbuf2;
}
while (iRemain) /* repeat until no more input-bytes */
{ /* need to shift anything ? */
if ((pData->pJPEGcurrent2 > pData->pJPEGbuf2) &&
(pData->pJPEGcurrent2 - pData->pJPEGbuf2 + pData->iJPEGbufremain2 + iRemain > pData->iJPEGbufmax2))
{
if (pData->iJPEGbufremain2 > 0) /* then do so */
MNG_COPY (pData->pJPEGbuf2, pData->pJPEGcurrent2, pData->iJPEGbufremain2)
pData->pJPEGcurrent2 = pData->pJPEGbuf2;
}
/* does the remaining input fit into the buffer ? */
if (pData->iJPEGbufremain2 + iRemain <= pData->iJPEGbufmax2)
{ /* move the lot */
MNG_COPY ((pData->pJPEGcurrent2 + pData->iJPEGbufremain2), pWork, iRemain)
/* adjust remaining_bytes counter */
pData->iJPEGbufremain2 += iRemain;
iRemain = 0; /* and indicate there's no input left */
}
else
{ /* calculate what does fit */
mng_uint32 iFits = pData->iJPEGbufmax2 - pData->iJPEGbufremain2;
if (iFits <= 0) /* no space is just bugger 'm all */
MNG_ERROR (pData, MNG_JPEGBUFTOOSMALL)
/* move that */
MNG_COPY ((pData->pJPEGcurrent2 + pData->iJPEGbufremain2), pWork, iFits)
pData->iJPEGbufremain2 += iFits; /* adjust remain_bytes counter */
iRemain -= iFits; /* and the input-parms */
pWork += iFits;
}
#ifdef MNG_INCLUDE_IJG6B
pData->pJPEGdinfo2->src->next_input_byte = pData->pJPEGcurrent2;
pData->pJPEGdinfo2->src->bytes_in_buffer = pData->iJPEGbufremain2;
if (!pData->bJPEGhasheader2) /* haven't got the header yet ? */
{
/* 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->pJPEGdinfo2, TRUE) != JPEG_SUSPENDED)
{ /* indicate the header's oke */
pData->bJPEGhasheader2 = MNG_TRUE;
/* let's do some sanity checks ! */
if ((pData->pJPEGdinfo2->image_width != pData->iDatawidth ) ||
(pData->pJPEGdinfo2->image_height != pData->iDataheight) )
MNG_ERROR (pData, MNG_JPEGPARMSERR)
if (pData->pJPEGdinfo2->jpeg_color_space != JCS_GRAYSCALE)
MNG_ERROR (pData, MNG_JPEGPARMSERR)
/* indicate whether or not it's progressive */
pData->bJPEGprogressive2 = (mng_bool)jpeg_has_multiple_scans (pData->pJPEGdinfo2);
if (pData->bJPEGprogressive2) /* progressive alphachannel not allowed !!! */
MNG_ERROR (pData, MNG_JPEGPARMSERR)
/* allocate a row of JPEG-samples */
if (pData->pJPEGdinfo2->jpeg_color_space == JCS_YCbCr)
pData->iJPEGrowlen2 = pData->pJPEGdinfo2->image_width * 3;
else
pData->iJPEGrowlen2 = pData->pJPEGdinfo2->image_width;
MNG_ALLOC (pData, pData->pJPEGrow2, pData->iJPEGrowlen2)
pData->iJPEGalpharow = 0; /* quite empty up to now */
}
pData->pJPEGcurrent2 = (mng_uint8p)pData->pJPEGdinfo2->src->next_input_byte;
pData->iJPEGbufremain2 = (mng_uint32)pData->pJPEGdinfo2->src->bytes_in_buffer;
}
/* decompress not started ? */
if ((pData->bJPEGhasheader2) && (!pData->bJPEGdecostarted2))
{
/* set parameters for decompression */
if (pData->bJPEGprogressive2) /* progressive display ? */
pData->pJPEGdinfo2->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->pJPEGdinfo2) == TRUE)
/* indicate it started */
pData->bJPEGdecostarted2 = MNG_TRUE;
pData->pJPEGcurrent2 = (mng_uint8p)pData->pJPEGdinfo2->src->next_input_byte;
pData->iJPEGbufremain2 = (mng_uint32)pData->pJPEGdinfo2->src->bytes_in_buffer;
}
/* process some scanlines ? */
if ((pData->bJPEGhasheader2) && (pData->bJPEGdecostarted2) &&
((!jpeg_input_complete (pData->pJPEGdinfo2)) ||
(pData->pJPEGdinfo2->output_scanline < pData->pJPEGdinfo2->output_height)))
{
mng_int32 iLines;
/* for (each output pass) */
do
{ /* address the row output buffer */
JSAMPROW pRow = (JSAMPROW)pData->pJPEGrow2;
/* init new pass ? */
if ((pData->bJPEGprogressive2) &&
((!pData->bJPEGscanstarted2) ||
(pData->pJPEGdinfo2->output_scanline >= pData->pJPEGdinfo2->output_height)))
{
pData->bJPEGscanstarted2 = MNG_TRUE;
/* adjust output decompression parameters if required */
/* 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->pJPEGdinfo2, pData->pJPEGdinfo2->input_scan_number);
pData->iJPEGrow = 0; /* start at row 0 in the image again */
}
/* while (scan lines remain to be read) */
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->pJPEGdinfo2, (JSAMPARRAY)&pRow, 1);
pData->pJPEGcurrent2 = (mng_uint8p)pData->pJPEGdinfo2->src->next_input_byte;
pData->iJPEGbufremain2 = (mng_uint32)pData->pJPEGdinfo2->src->bytes_in_buffer;
if (iLines > 0) /* got something ? */
{
if (pData->fStorerow3) /* store in object ? */
{
iRetcode = ((mng_storerow)pData->fStorerow3) (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
}
}
}
while ((pData->pJPEGdinfo2->output_scanline < pData->pJPEGdinfo2->output_height) &&
(iLines > 0)); /* until end-of-image or not enough input-data */
/* terminate output pass */
if ((pData->bJPEGprogressive2) &&
(pData->pJPEGdinfo2->output_scanline >= pData->pJPEGdinfo2->output_height))
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_FINISH_OUTPUT)
#endif
jpeg_finish_output (pData->pJPEGdinfo2);
/* this scan has ended */
pData->bJPEGscanstarted2 = MNG_FALSE;
}
}
while ((!jpeg_input_complete (pData->pJPEGdinfo2)) && (iLines > 0));
}
/* end of image ? */
if ((pData->bJPEGhasheader2) && (pData->bJPEGdecostarted2) &&
(jpeg_input_complete (pData->pJPEGdinfo2)) &&
(pData->pJPEGdinfo2->input_scan_number == pData->pJPEGdinfo2->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->pJPEGdinfo2) == TRUE)
{ /* indicate it's done */
pData->bJPEGhasheader2 = MNG_FALSE;
pData->bJPEGdecostarted2 = MNG_FALSE;
pData->pJPEGcurrent2 = (mng_uint8p)pData->pJPEGdinfo2->src->next_input_byte;
pData->iJPEGbufremain2 = (mng_uint32)pData->pJPEGdinfo2->src->bytes_in_buffer;
/* remaining fluff is an error ! */
if ((pData->iJPEGbufremain2 > 0) || (iRemain > 0))
MNG_ERROR (pData, MNG_TOOMUCHJDAT)
}
}
#endif /* MNG_INCLUDE_IJG6B */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_END)
#endif
return MNG_NOERROR;
}
#endif /* MNG_INCLUDE_JNG_READ */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
mng_retcode mngjpeg_decompressfree2 (mng_datap pData)
{
#if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP)
mng_retcode iRetcode;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_START)
#endif
#ifdef MNG_INCLUDE_IJG6B
#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 */
#endif
/* 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->pJPEGdinfo2);
pData->bJPEGdecompress2 = MNG_FALSE; /* indicate it's done */
#endif /* MNG_INCLUDE_IJG6B */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_END)
#endif
return MNG_NOERROR;
}
#endif /* MNG_INCLUDE_JNG_READ */
/* ************************************************************************** */
#endif /* MNG_INCLUDE_JNG */

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

@ -21,6 +21,9 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
/* * - added support for JDAA * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -41,6 +44,12 @@ mng_retcode mngjpeg_decompressdata (mng_datap pData,
mng_uint8p pRawdata);
mng_retcode mngjpeg_decompressfree (mng_datap pData);
mng_retcode mngjpeg_decompressinit2 (mng_datap pData);
mng_retcode mngjpeg_decompressdata2 (mng_datap pData,
mng_uint32 iRawsize,
mng_uint8p pRawdata);
mng_retcode mngjpeg_decompressfree2 (mng_datap pData);
/* ************************************************************************** */
#endif /* _libmng_jpeg_h_ */

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

@ -35,10 +35,6 @@
#ifndef _libmng_memory_h_
#define _libmng_memory_h_
#include "libmng.h"
#include "libmng_data.h"
#include "libmng_error.h"
/* ************************************************************************** */
/* * * */
/* * Generic memory manager macros * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_object_prc.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : Object processing routines (implementation) * */
/* * * */
@ -58,6 +58,17 @@
/* * * */
/* * 0.9.3 - 08/07/2000 - G.Juyn * */
/* * - B111300 - fixup for improved portability * */
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
/* * - added MAGN chunk * */
/* * 0.9.3 - 09/10/2000 - G.Juyn * */
/* * - fixed DEFI behavior * */
/* * 0.9.3 - 10/17/2000 - G.Juyn * */
/* * - added valid-flag to stored objects for read() / display()* */
/* * - added routine to discard "invalid" objects * */
/* * 0.9.3 - 10/18/2000 - G.Juyn * */
/* * - fixed delta-processing behavior * */
/* * 0.9.3 - 10/19/2000 - G.Juyn * */
/* * - added storage for pixel-/alpha-sampledepth for delta's * */
/* * * */
/* ************************************************************************** */
@ -71,6 +82,7 @@
#include "libmng_memory.h"
#include "libmng_objects.h"
#include "libmng_display.h"
#include "libmng_pixels.h"
#include "libmng_object_prc.h"
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -81,6 +93,44 @@
#ifdef MNG_INCLUDE_DISPLAY_PROCS
/* ************************************************************************** */
/* * * */
/* * Generic object routines * */
/* * * */
/* ************************************************************************** */
mng_retcode drop_invalid_objects (mng_datap pData)
{
mng_objectp pObject;
mng_objectp pNext;
mng_cleanupobject fCleanup;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DROP_INVALID_OBJECTS, MNG_LC_START)
#endif
pObject = pData->pFirstimgobj; /* get first stored image-object (if any) */
while (pObject) /* more objects to check ? */
{
pNext = ((mng_object_headerp)pObject)->pNext;
/* invalid ? */
if (!((mng_imagep)pObject)->bValid)
{ /* call appropriate cleanup */
fCleanup = ((mng_object_headerp)pObject)->fCleanup;
fCleanup (pData, pObject);
}
pObject = pNext; /* neeeext */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DROP_INVALID_OBJECTS, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
/* * * */
/* * Image-data-object routines * */
@ -124,6 +174,10 @@ mng_retcode create_imagedataobject (mng_datap pData,
pImagedata->iFilter = iFilter;
pImagedata->iInterlace = iInterlace;
pImagedata->iAlphabitdepth = 0;
pImagedata->iJHDRcompression = 0;
pImagedata->iJHDRinterlace = 0;
pImagedata->iPixelsampledepth = iBitdepth;
pImagedata->iAlphasampledepth = iBitdepth;
/* determine samplesize from color_type/bit_depth */
switch (iColortype) /* for < 8-bit samples we just reserve 8 bits */
{
@ -385,6 +439,9 @@ mng_retcode create_imageobject (mng_datap pData,
pImage->bFrozen = MNG_FALSE;
pImage->bVisible = bVisible;
pImage->bViewable = bViewable;
pImage->bValid = (mng_bool)((pData->bDisplaying) &&
(pData->bRunning ) &&
(!pData->bFreezing ) );
pImage->iPosx = iPosx;
pImage->iPosy = iPosy;
pImage->bClipped = bClipped;
@ -392,6 +449,14 @@ mng_retcode create_imageobject (mng_datap pData,
pImage->iClipr = iClipr;
pImage->iClipt = iClipt;
pImage->iClipb = iClipb;
pImage->iMAGN_MethodX = 0;
pImage->iMAGN_MethodY = 0;
pImage->iMAGN_MX = 0;
pImage->iMAGN_MY = 0;
pImage->iMAGN_ML = 0;
pImage->iMAGN_MR = 0;
pImage->iMAGN_MT = 0;
pImage->iMAGN_MB = 0;
pImage->pImgbuf = pImgbuf;
if (iId) /* only if not object 0 ! */
@ -513,6 +578,15 @@ mng_retcode clone_imageobject (mng_datap pData,
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_CLONE_IMGOBJECT, MNG_LC_START)
#endif
if ((pSource->iId) && /* needs magnification ? */
((pSource->iMAGN_MethodX) || (pSource->iMAGN_MethodY)))
{
iRetcode = magnify_imageobject (pData, pSource);
if (iRetcode) /* on error bail out */
return iRetcode;
}
/* get a buffer */
MNG_ALLOC (pData, pNew, sizeof (mng_image))
/* fill or copy the appropriate fields */
@ -547,6 +621,15 @@ mng_retcode clone_imageobject (mng_datap pData,
pNew->iClipr = pSource->iClipr;
pNew->iClipt = pSource->iClipt;
pNew->iClipb = pSource->iClipb;
/* copy magnification info */
pNew->iMAGN_MethodX = pSource->iMAGN_MethodX;
pNew->iMAGN_MethodY = pSource->iMAGN_MethodY;
pNew->iMAGN_MX = pSource->iMAGN_MX;
pNew->iMAGN_MY = pSource->iMAGN_MY;
pNew->iMAGN_ML = pSource->iMAGN_ML;
pNew->iMAGN_MR = pSource->iMAGN_MR;
pNew->iMAGN_MT = pSource->iMAGN_MT;
pNew->iMAGN_MB = pSource->iMAGN_MB;
if (iId) /* not for object 0 */
{ /* find previous lower object-id */
@ -791,6 +874,18 @@ mng_retcode reset_object_details (mng_datap pData,
pImage->iClipb = iHeight;
}
if (pImage->iId) /* reset magnification info ? */
{
pImage->iMAGN_MethodX = 0;
pImage->iMAGN_MethodY = 0;
pImage->iMAGN_MX = 0;
pImage->iMAGN_MY = 0;
pImage->iMAGN_ML = 0;
pImage->iMAGN_MR = 0;
pImage->iMAGN_MT = 0;
pImage->iMAGN_MB = 0;
}
if (bResetall) /* reset the other characteristics ? */
{
pBuf->bHasPLTE = MNG_FALSE;
@ -859,12 +954,113 @@ mng_retcode promote_imageobject (mng_datap pData,
mng_uint8 iColortype,
mng_uint8 iFilltype)
{
mng_uint8p pNewbuf;
mng_uint32 iNewbufsize;
mng_uint32 iNewrowsize;
mng_uint32 iNewsamplesize;
mng_uint32 iX, iY;
mng_uint8p pSrcline, pDstline;
mng_uint8 iB;
mng_imagedatap pBuf = pImage->pImgbuf;
mng_uint32 iW = pBuf->iWidth;
mng_uint32 iH = pBuf->iHeight;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_IMGOBJECT, MNG_LC_START)
#endif
if ((pBuf->iColortype == 3) && (iColortype == 2))
{ /* indexed -> rgb */
iNewsamplesize = 3;
iNewrowsize = iW * iNewsamplesize;
iNewbufsize = iH * iNewrowsize;
MNG_ALLOC (pData, pNewbuf, iNewbufsize)
pSrcline = pBuf->pImgdata;
pDstline = pNewbuf;
for (iY = 0; iY < iH; iY++)
{
for (iX = 0; iX < iW; iX++)
{
iB = *pSrcline;
if ((mng_uint32)iB < pBuf->iPLTEcount)
{
*pDstline = pBuf->aPLTEentries [iB].iRed;
*(pDstline+1) = pBuf->aPLTEentries [iB].iGreen;
*(pDstline+2) = pBuf->aPLTEentries [iB].iBlue;
}
pSrcline++;
pDstline += 3;
}
}
MNG_FREEX (pData, pBuf->pImgdata, pBuf->iImgdatasize)
pBuf->iBitdepth = iBitdepth;
pBuf->iColortype = iColortype;
pBuf->iSamplesize = iNewsamplesize;
pBuf->iRowsize = iNewrowsize;
pBuf->iImgdatasize = iNewbufsize;
pBuf->pImgdata = pNewbuf;
pBuf->bHasPLTE = MNG_FALSE;
pBuf->bHasTRNS = MNG_FALSE;
}
else
if ((pBuf->iColortype == 3) && (iColortype == 6))
{ /* indexed -> rgba */
iNewsamplesize = 4;
iNewrowsize = iW * iNewsamplesize;
iNewbufsize = iH * iNewrowsize;
MNG_ALLOC (pData, pNewbuf, iNewbufsize)
pSrcline = pBuf->pImgdata;
pDstline = pNewbuf;
for (iY = 0; iY < iH; iY++)
{
for (iX = 0; iX < iW; iX++)
{
iB = *pSrcline;
if ((mng_uint32)iB < pBuf->iPLTEcount)
{
*pDstline = pBuf->aPLTEentries [iB].iRed;
*(pDstline+1) = pBuf->aPLTEentries [iB].iGreen;
*(pDstline+2) = pBuf->aPLTEentries [iB].iBlue;
if ((mng_uint32)iB < pBuf->iTRNScount)
*(pDstline+3) = pBuf->aTRNSentries [iB];
else
*(pDstline+3) = 255;
}
pSrcline++;
pDstline += 4;
}
}
MNG_FREEX (pData, pBuf->pImgdata, pBuf->iImgdatasize)
pBuf->iBitdepth = iBitdepth;
pBuf->iColortype = iColortype;
pBuf->iSamplesize = iNewsamplesize;
pBuf->iRowsize = iNewrowsize;
pBuf->iImgdatasize = iNewbufsize;
pBuf->pImgdata = pNewbuf;
pBuf->bHasPLTE = MNG_FALSE;
pBuf->bHasTRNS = MNG_FALSE;
}
else
{
/* TODO: other promotion */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_IMGOBJECT, MNG_LC_END)
@ -873,6 +1069,326 @@ mng_retcode promote_imageobject (mng_datap pData,
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode magnify_imageobject (mng_datap pData,
mng_imagep pImage)
{
mng_uint8p pNewdata;
mng_uint8p pSrcline1;
mng_uint8p pSrcline2;
mng_uint8p pTempline;
mng_uint8p pDstline;
mng_uint32 iNewrowsize;
mng_uint32 iNewsize;
mng_uint32 iY;
mng_int32 iS, iM;
mng_retcode iRetcode;
mng_imagedatap pBuf = pImage->pImgbuf;
mng_uint32 iNewW = pBuf->iWidth;
mng_uint32 iNewH = pBuf->iHeight;
mng_magnify_x fMagnifyX = MNG_NULL;
mng_magnify_y fMagnifyY = MNG_NULL;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_IMGOBJECT, MNG_LC_START)
#endif
if (pBuf->iColortype == 3) /* indexed color ? */
{ /* concrete buffer ? */
if ((pBuf->bConcrete) && (pImage->iId))
MNG_ERROR (pData, MNG_INVALIDCOLORTYPE)
if (pBuf->iTRNScount) /* with transparency ? */
iRetcode = promote_imageobject (pData, pImage, 8, 6, 0);
else
iRetcode = promote_imageobject (pData, pImage, 8, 2, 0);
if (iRetcode) /* on error bail out */
return iRetcode;
}
if (pImage->iMAGN_MethodX) /* determine new width */
{
if (pImage->iMAGN_MethodX == 1)
{
iNewW = pImage->iMAGN_ML;
if (pBuf->iWidth > 1)
iNewW = iNewW + pImage->iMAGN_MR;
if (pBuf->iWidth > 2)
iNewW = iNewW + (pBuf->iWidth - 2) * (pImage->iMAGN_MX);
}
else
{
iNewW = pBuf->iWidth + pImage->iMAGN_ML - 1;
if (pBuf->iWidth > 2)
iNewW = iNewW + pImage->iMAGN_MR - 1;
if (pBuf->iWidth > 3)
iNewW = iNewW + (pBuf->iWidth - 3) * (pImage->iMAGN_MX - 1);
}
}
if (pImage->iMAGN_MethodY) /* determine new height */
{
if (pImage->iMAGN_MethodY == 1)
{
iNewH = pImage->iMAGN_MT;
if (pBuf->iHeight > 1)
iNewH = iNewH + pImage->iMAGN_ML;
if (pBuf->iHeight > 2)
iNewH = iNewH + (pBuf->iHeight - 2) * (pImage->iMAGN_MY);
}
else
{
iNewH = pBuf->iHeight + pImage->iMAGN_MT - 1;
if (pBuf->iHeight > 2)
iNewH = iNewH + pImage->iMAGN_MB - 1;
if (pBuf->iHeight > 3)
iNewH = iNewH + (pBuf->iHeight - 3) * (pImage->iMAGN_MY - 1);
}
}
/* get new buffer */
iNewrowsize = iNewW * pBuf->iSamplesize;
iNewsize = iNewH * iNewrowsize;
MNG_ALLOC (pData, pNewdata, iNewsize);
switch (pBuf->iColortype) /* determine magnification routines */
{
case 0 : ;
case 8 : {
if (pBuf->iBitdepth <= 8)
{
switch (pImage->iMAGN_MethodX)
{
case 1 : { fMagnifyX = magnify_g8_x1; break; }
case 2 : { fMagnifyX = magnify_g8_x2; break; }
case 3 : { fMagnifyX = magnify_g8_x1; break; }
case 4 : { fMagnifyX = magnify_g8_x2; break; }
}
switch (pImage->iMAGN_MethodY)
{
case 1 : { fMagnifyY = magnify_g8_y1; break; }
case 2 : { fMagnifyY = magnify_g8_y2; break; }
case 3 : { fMagnifyY = magnify_g8_y1; break; }
case 4 : { fMagnifyY = magnify_g8_y2; break; }
}
}
else
{
/* TODO: magnify 16-bit */
}
break;
}
case 2 : ;
case 10 : {
if (pBuf->iBitdepth <= 8)
{
switch (pImage->iMAGN_MethodX)
{
case 1 : { fMagnifyX = magnify_rgb8_x1; break; }
case 2 : { fMagnifyX = magnify_rgb8_x2; break; }
case 3 : { fMagnifyX = magnify_rgb8_x1; break; }
case 4 : { fMagnifyX = magnify_rgb8_x2; break; }
}
switch (pImage->iMAGN_MethodY)
{
case 1 : { fMagnifyY = magnify_rgb8_y1; break; }
case 2 : { fMagnifyY = magnify_rgb8_y2; break; }
case 3 : { fMagnifyY = magnify_rgb8_y1; break; }
case 4 : { fMagnifyY = magnify_rgb8_y2; break; }
}
}
else
{
/* TODO: magnify 16-bit */
}
break;
}
case 4 : ;
case 12 : {
if (pBuf->iBitdepth <= 8)
{
switch (pImage->iMAGN_MethodX)
{
case 1 : { fMagnifyX = magnify_ga8_x1; break; }
case 2 : { fMagnifyX = magnify_ga8_x2; break; }
case 3 : { fMagnifyX = magnify_ga8_x3; break; }
case 4 : { fMagnifyX = magnify_ga8_x4; break; }
}
switch (pImage->iMAGN_MethodY)
{
case 1 : { fMagnifyY = magnify_ga8_y1; break; }
case 2 : { fMagnifyY = magnify_ga8_y2; break; }
case 3 : { fMagnifyY = magnify_ga8_y3; break; }
case 4 : { fMagnifyY = magnify_ga8_y4; break; }
}
}
else
{
/* TODO: magnify 16-bit */
}
break;
}
case 6 : ;
case 14 : {
if (pBuf->iBitdepth <= 8)
{
switch (pImage->iMAGN_MethodX)
{
case 1 : { fMagnifyX = magnify_rgba8_x1; break; }
case 2 : { fMagnifyX = magnify_rgba8_x2; break; }
case 3 : { fMagnifyX = magnify_rgba8_x2; break; }
case 4 : { fMagnifyX = magnify_rgba8_x3; break; }
}
switch (pImage->iMAGN_MethodY)
{
case 1 : { fMagnifyY = magnify_rgba8_y1; break; }
case 2 : { fMagnifyY = magnify_rgba8_y2; break; }
case 3 : { fMagnifyY = magnify_rgba8_y3; break; }
case 4 : { fMagnifyY = magnify_rgba8_y4; break; }
}
}
else
{
/* TODO: magnify 16-bit */
}
break;
}
}
pSrcline1 = pBuf->pImgdata; /* initialize row-loop variables */
pDstline = pNewdata;
/* allocate temporary row */
MNG_ALLOC (pData, pTempline, iNewrowsize)
for (iY = 0; iY < pBuf->iHeight; iY++)
{
pSrcline2 = pSrcline1 + pBuf->iRowsize;
if (fMagnifyX) /* magnifying in X-direction ? */
{
iRetcode = fMagnifyX (pData, pImage->iMAGN_MX,
pImage->iMAGN_ML, pImage->iMAGN_MR,
pBuf->iWidth, pSrcline1, pDstline);
if (iRetcode) /* on error bail out */
{
MNG_FREEX (pData, pTempline, iNewrowsize)
MNG_FREEX (pData, pNewdata, iNewsize)
return iRetcode;
}
}
else
{
MNG_COPY (pDstline, pSrcline1, iNewrowsize)
}
pDstline += iNewrowsize;
/* magnifying in Y-direction ? */
if ((fMagnifyY) &&
((iY < pBuf->iHeight - 1) || (pBuf->iHeight == 1) || (pImage->iMAGN_MethodY == 1)))
{
if (iY == 0) /* first interval ? */
{
if (pBuf->iHeight == 1) /* single row ? */
pSrcline2 = MNG_NULL;
iM = (mng_int32)pImage->iMAGN_MT;
}
else /* last interval ? */
if (((pImage->iMAGN_MethodY == 1) && (iY == (pBuf->iHeight - 1))) ||
((pImage->iMAGN_MethodY != 1) && (iY == (pBuf->iHeight - 2))) )
iM = (mng_int32)pImage->iMAGN_MB;
else /* middle interval */
iM = (mng_int32)pImage->iMAGN_MY;
for (iS = 1; iS < iM; iS++)
{
iRetcode = fMagnifyY (pData, iS, iM, pBuf->iWidth,
pSrcline1, pSrcline2, pTempline);
if (iRetcode) /* on error bail out */
{
MNG_FREEX (pData, pTempline, iNewrowsize)
MNG_FREEX (pData, pNewdata, iNewsize)
return iRetcode;
}
if (fMagnifyX) /* magnifying in X-direction ? */
{
iRetcode = fMagnifyX (pData, pImage->iMAGN_MX,
pImage->iMAGN_ML, pImage->iMAGN_MR,
pBuf->iWidth, pTempline, pDstline);
if (iRetcode) /* on error bail out */
{
MNG_FREEX (pData, pTempline, iNewrowsize)
MNG_FREEX (pData, pNewdata, iNewsize)
return iRetcode;
}
}
else
{
MNG_COPY (pDstline, pTempline, iNewrowsize)
}
pDstline += iNewrowsize;
}
}
pSrcline1 += pBuf->iRowsize;
}
/* drop temporary row */
MNG_FREEX (pData, pTempline, iNewrowsize)
/* drop old pixel-data */
MNG_FREEX (pData, pBuf->pImgdata, pBuf->iImgdatasize)
pBuf->pImgdata = pNewdata; /* save new buffer dimensions */
pBuf->iRowsize = iNewrowsize;
pBuf->iImgdatasize = iNewsize;
pBuf->iWidth = iNewW;
pBuf->iHeight = iNewH;
if (pImage->iId) /* real object ? */
{
pImage->iMAGN_MethodX = 0; /* it's done; don't do it again !!! */
pImage->iMAGN_MethodY = 0;
pImage->iMAGN_MX = 0;
pImage->iMAGN_MY = 0;
pImage->iMAGN_ML = 0;
pImage->iMAGN_MR = 0;
pImage->iMAGN_MT = 0;
pImage->iMAGN_MB = 0;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_IMGOBJECT, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
/* * * */
/* * Animation-object routines * */
@ -933,7 +1449,7 @@ mng_retcode create_ani_image (mng_datap pData)
pCurrent = (mng_imagep)pData->pObjzero;
/* now just clone the object !!! */
iRetcode = clone_imageobject (pData, 0, MNG_FALSE, pCurrent->bVisible,
MNG_TRUE, MNG_FALSE, 0, 0, 0, pCurrent, &pImage);
MNG_FALSE, MNG_FALSE, 0, 0, 0, pCurrent, &pImage);
if (iRetcode) /* on error bail out */
return iRetcode;
@ -994,7 +1510,7 @@ mng_retcode process_ani_image (mng_datap pData,
{ /* 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);
iRetcode = execute_delta_image (pData, pDelta, (mng_imagep)pObject);
if (iRetcode) /* on error bail out */
return iRetcode;
@ -1800,6 +2316,8 @@ mng_retcode process_ani_endl (mng_datap pData,
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_ENDL, MNG_LC_START)
#endif
if ((pData->bDisplaying) && (pData->bRunning))
{
pLOOP = pENDL->pLOOP; /* determine matching LOOP */
if (!pLOOP) /* haven't got it yet ? */
@ -1821,7 +2339,7 @@ mng_retcode process_ani_endl (mng_datap pData,
/* TODO: we're cheating out on the termination_condition,
iteration_min, iteration_max and possible signals;
it's just not ready for that can of worms.... */
the code is just not ready for that can of worms.... */
if (!pLOOP->iRunningcount) /* reached zero ? */
{ /* was this the outer LOOP ? */
@ -1842,6 +2360,7 @@ mng_retcode process_ani_endl (mng_datap pData,
/* TODO: error abort ??? */
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_ENDL, MNG_LC_END)
@ -1869,7 +2388,9 @@ mng_retcode create_ani_defi (mng_datap pData)
add_ani_object (pData, (mng_object_headerp)pDEFI);
pDEFI->iId = pData->iDEFIobjectid;
pDEFI->bHasdonotshow = pData->bDEFIhasdonotshow;
pDEFI->iDonotshow = pData->iDEFIdonotshow;
pDEFI->bHasconcrete = pData->bDEFIhasconcrete;
pDEFI->iConcrete = pData->iDEFIconcrete;
pDEFI->bHasloca = pData->bDEFIhasloca;
pDEFI->iLocax = pData->iDEFIlocax;
@ -1918,7 +2439,9 @@ mng_retcode process_ani_defi (mng_datap pData,
#endif
pData->iDEFIobjectid = pDEFI->iId;
pData->bDEFIhasdonotshow = pDEFI->bHasdonotshow;
pData->iDEFIdonotshow = pDEFI->iDonotshow;
pData->bDEFIhasconcrete = pDEFI->bHasconcrete;
pData->iDEFIconcrete = pDEFI->iConcrete;
pData->bDEFIhasloca = pDEFI->bHasloca;
pData->iDEFIlocax = pDEFI->iLocax;
@ -3105,6 +3628,97 @@ mng_retcode process_ani_pplt (mng_datap pData,
return MNG_NOERROR;
}
/* ************************************************************************** */
/* ************************************************************************** */
mng_retcode create_ani_magn (mng_datap pData,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint16 iMethodX,
mng_uint16 iMX,
mng_uint16 iMY,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint16 iMT,
mng_uint16 iMB,
mng_uint16 iMethodY)
{
mng_ani_magnp pMAGN;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_CREATE_ANI_MAGN, MNG_LC_START)
#endif
MNG_ALLOC (pData, pMAGN, sizeof (mng_ani_magn))
pMAGN->sHeader.fCleanup = free_ani_magn;
pMAGN->sHeader.fProcess = process_ani_magn;
pMAGN->iFirstid = iFirstid;
pMAGN->iLastid = iLastid;
pMAGN->iMethodX = iMethodX;
pMAGN->iMX = iMX;
pMAGN->iMY = iMY;
pMAGN->iML = iML;
pMAGN->iMR = iMR;
pMAGN->iMT = iMT;
pMAGN->iMB = iMB;
pMAGN->iMethodY = iMethodY;
add_ani_object (pData, (mng_object_headerp)pMAGN);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_CREATE_ANI_MAGN, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode free_ani_magn (mng_datap pData,
mng_objectp pObject)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_FREE_ANI_MAGN, MNG_LC_START)
#endif
MNG_FREEX (pData, pObject, sizeof (mng_ani_magn))
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_FREE_ANI_MAGN, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode process_ani_magn (mng_datap pData,
mng_objectp pObject)
{
mng_ani_magnp pMAGN = (mng_ani_magnp)pObject;
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_MAGN, MNG_LC_START)
#endif
iRetcode = process_display_magn (pData, pMAGN->iFirstid, pMAGN->iLastid,
pMAGN->iMethodX, pMAGN->iMX, pMAGN->iMY,
pMAGN->iML, pMAGN->iMR, pMAGN->iMT, pMAGN->iMB,
pMAGN->iMethodY);
if (iRetcode) /* on error bail out */
return iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_MAGN, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#endif /* MNG_INCLUDE_DISPLAY_PROCS */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_object_prc.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : Object processing routines (definition) * */
/* * * */
@ -34,6 +34,11 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
/* * - added MAGN chunk * */
/* * 0.9.3 - 10/17/2000 - G.Juyn * */
/* * - added routine to discard "invalid" objects * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -43,8 +48,9 @@
#ifndef _libmng_object_prc_h_
#define _libmng_object_prc_h_
#include "libmng.h"
#include "libmng_data.h"
/* ************************************************************************** */
mng_retcode drop_invalid_objects (mng_datap pData);
/* ************************************************************************** */
@ -136,6 +142,9 @@ mng_retcode promote_imageobject (mng_datap pData,
mng_uint8 iColortype,
mng_uint8 iFilltype);
mng_retcode magnify_imageobject (mng_datap pData,
mng_imagep pImage);
/* ************************************************************************** */
mng_retcode create_ani_image (mng_datap pData);
@ -286,6 +295,18 @@ mng_retcode create_ani_pplt (mng_datap pData,
mng_uint8p paAlphaentries,
mng_uint8p paUsedentries);
mng_retcode create_ani_magn (mng_datap pData,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint16 iMethodX,
mng_uint16 iMX,
mng_uint16 iMY,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint16 iMT,
mng_uint16 iMB,
mng_uint16 iMethodY);
/* ************************************************************************** */
mng_retcode free_ani_image (mng_datap pData,
@ -341,6 +362,8 @@ mng_retcode free_ani_ijng (mng_datap pData,
mng_objectp pObject);
mng_retcode free_ani_pplt (mng_datap pData,
mng_objectp pObject);
mng_retcode free_ani_magn (mng_datap pData,
mng_objectp pObject);
/* ************************************************************************** */
@ -397,6 +420,8 @@ mng_retcode process_ani_ijng (mng_datap pData,
mng_objectp pObject);
mng_retcode process_ani_pplt (mng_datap pData,
mng_objectp pObject);
mng_retcode process_ani_magn (mng_datap pData,
mng_objectp pObject);
/* ************************************************************************** */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_objects.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : Internal object structures (definition) * */
/* * * */
@ -39,6 +39,17 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
/* * - added MAGN chunk * */
/* * 0.9.3 - 09/10/2000 - G.Juyn * */
/* * - fixed DEFI behavior * */
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
/* * - added support for delta-JNG * */
/* * 0.9.3 - 10/17/2000 - G.Juyn * */
/* * - added valid-flag to stored objects for read() / display()* */
/* * 0.9.3 - 10/19/2000 - G.Juyn * */
/* * - added storage for pixel-/alpha-sampledepth for delta's * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -88,7 +99,13 @@ typedef struct { /* MNG specification "object-bu
mng_uint8 iCompression;
mng_uint8 iFilter;
mng_uint8 iInterlace;
mng_uint8 iAlphabitdepth; /* used only for JNG images */
mng_uint8 iJHDRcompression;
mng_uint8 iJHDRinterlace;
mng_uint8 iPixelsampledepth; /* used with delta-images */
mng_uint8 iAlphasampledepth;
mng_bool bHasPLTE; /* PLTE chunk present */
mng_bool bHasTRNS; /* tRNS chunk present */
@ -146,6 +163,7 @@ typedef struct { /* MNG specification "object" *
mng_bool bFrozen; /* frozen flag */
mng_bool bVisible; /* potential visibility flag */
mng_bool bViewable; /* viewable flag */
mng_bool bValid; /* marks invalid when only reading */
mng_int32 iPosx; /* location fields */
mng_int32 iPosy;
mng_bool bClipped; /* clipping fields */
@ -153,6 +171,14 @@ typedef struct { /* MNG specification "object" *
mng_int32 iClipr;
mng_int32 iClipt;
mng_int32 iClipb;
mng_uint16 iMAGN_MethodX; /* magnification (MAGN) */
mng_uint16 iMAGN_MethodY;
mng_uint16 iMAGN_MX;
mng_uint16 iMAGN_MY;
mng_uint16 iMAGN_ML;
mng_uint16 iMAGN_MR;
mng_uint16 iMAGN_MT;
mng_uint16 iMAGN_MB;
mng_imagedatap pImgbuf; /* the image-data buffer */
} mng_image;
typedef mng_image * mng_imagep;
@ -266,7 +292,9 @@ typedef mng_ani_endl * mng_ani_endlp;
typedef struct { /* DEFI object */
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
mng_uint16 iId;
mng_bool bHasdonotshow;
mng_uint8 iDonotshow;
mng_bool bHasconcrete;
mng_uint8 iConcrete;
mng_bool bHasloca;
mng_int32 iLocax;
@ -453,6 +481,23 @@ typedef mng_ani_pplt * mng_ani_ppltp;
/* ************************************************************************** */
typedef struct { /* MAGN object */
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
mng_uint16 iFirstid;
mng_uint16 iLastid;
mng_uint16 iMethodX;
mng_uint16 iMX;
mng_uint16 iMY;
mng_uint16 iML;
mng_uint16 iMR;
mng_uint16 iMT;
mng_uint16 iMB;
mng_uint16 iMethodY;
} mng_ani_magn;
typedef mng_ani_magn * mng_ani_magnp;
/* ************************************************************************** */
#endif /* MNG_INCLUDE_DISPLAY_PROCS */
/* ************************************************************************** */

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

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_pixels.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : Pixel-row management routines (definition) * */
/* * * */
@ -30,6 +30,16 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
/* * - added MAGN support * */
/* * 0.9.3 - 09/07/2000 - G.Juyn * */
/* * - added support for new filter_types * */
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
/* * - added optional support for bKGD for PNG images * */
/* * - added support for JDAA * */
/* * 0.9.3 - 10/19/2000 - G.Juyn * */
/* * - implemented delayed delta-processing * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -39,9 +49,6 @@
#ifndef _libmng_pixels_h_
#define _libmng_pixels_h_
#include "libmng.h"
#include "libmng_data.h"
/* ************************************************************************** */
/* * * */
/* * Progressive display check - checks to see if progressive display is * */
@ -82,6 +89,7 @@ mng_retcode display_abgr8 (mng_datap pData);
mng_retcode restore_bkgd_backimage (mng_datap pData);
mng_retcode restore_bkgd_backcolor (mng_datap pData);
mng_retcode restore_bkgd_bkgd (mng_datap pData);
mng_retcode restore_bkgd_bgcolor (mng_datap pData);
mng_retcode restore_bkgd_rgb8 (mng_datap pData);
mng_retcode restore_bkgd_bgr8 (mng_datap pData);
@ -143,6 +151,9 @@ mng_retcode store_jpeg_rgb12 (mng_datap pData);
mng_retcode store_jpeg_ga12 (mng_datap pData);
mng_retcode store_jpeg_rgba12 (mng_datap pData);
mng_retcode store_jpeg_g8_alpha (mng_datap pData);
mng_retcode store_jpeg_rgb8_alpha (mng_datap pData);
mng_retcode store_jpeg_g8_a1 (mng_datap pData);
mng_retcode store_jpeg_g8_a2 (mng_datap pData);
mng_retcode store_jpeg_g8_a4 (mng_datap pData);
@ -190,6 +201,40 @@ mng_retcode delta_ga16 (mng_datap pData);
mng_retcode delta_rgba8 (mng_datap pData);
mng_retcode delta_rgba16 (mng_datap pData);
/* ************************************************************************** */
/* * * */
/* * Delta-image row routines - apply the source row onto the target * */
/* * * */
/* ************************************************************************** */
mng_retcode delta_g1_g1 (mng_datap pData);
mng_retcode delta_g2_g2 (mng_datap pData);
mng_retcode delta_g4_g4 (mng_datap pData);
mng_retcode delta_g8_g8 (mng_datap pData);
mng_retcode delta_g16_g16 (mng_datap pData);
mng_retcode delta_rgb8_rgb8 (mng_datap pData);
mng_retcode delta_rgb16_rgb16 (mng_datap pData);
mng_retcode delta_ga8_ga8 (mng_datap pData);
mng_retcode delta_ga8_g8 (mng_datap pData);
mng_retcode delta_ga8_a8 (mng_datap pData);
mng_retcode delta_ga16_ga16 (mng_datap pData);
mng_retcode delta_ga16_g16 (mng_datap pData);
mng_retcode delta_ga16_a16 (mng_datap pData);
mng_retcode delta_rgba8_rgba8 (mng_datap pData);
mng_retcode delta_rgba8_rgb8 (mng_datap pData);
mng_retcode delta_rgba8_a8 (mng_datap pData);
mng_retcode delta_rgba16_rgba16 (mng_datap pData);
mng_retcode delta_rgba16_rgb16 (mng_datap pData);
mng_retcode delta_rgba16_a16 (mng_datap pData);
/* ************************************************************************** */
/* * * */
/* * Delta-image row routines - scale the source to bitdepth of target * */
/* * * */
/* ************************************************************************** */
/* ************************************************************************** */
/* * * */
/* * Row processing routines - convert uncompressed data from zlib to * */
@ -265,6 +310,10 @@ mng_retcode init_jpeg_a4_ni (mng_datap pData);
mng_retcode init_jpeg_a8_ni (mng_datap pData);
mng_retcode init_jpeg_a16_ni (mng_datap pData);
/* ************************************************************************** */
/* * * */
/* * General row processing routines * */
/* * * */
/* ************************************************************************** */
mng_retcode init_rowproc (mng_datap pData);
@ -273,6 +322,182 @@ mng_retcode next_jpeg_alpharow (mng_datap pData);
mng_retcode next_jpeg_row (mng_datap pData);
mng_retcode cleanup_rowproc (mng_datap pData);
/* ************************************************************************** */
/* * * */
/* * Magnification row routines - apply magnification transforms * */
/* * * */
/* ************************************************************************** */
mng_retcode magnify_g8_x1 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline);
mng_retcode magnify_g8_x2 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline);
mng_retcode magnify_rgb8_x1 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline);
mng_retcode magnify_rgb8_x2 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline);
mng_retcode magnify_ga8_x1 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline);
mng_retcode magnify_ga8_x2 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline);
mng_retcode magnify_ga8_x3 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline);
mng_retcode magnify_ga8_x4 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline);
mng_retcode magnify_rgba8_x1 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline);
mng_retcode magnify_rgba8_x2 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline);
mng_retcode magnify_rgba8_x3 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline);
mng_retcode magnify_rgba8_x4 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline);
mng_retcode magnify_g8_y1 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline);
mng_retcode magnify_g8_y2 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline);
mng_retcode magnify_rgb8_y1 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline);
mng_retcode magnify_rgb8_y2 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline);
mng_retcode magnify_ga8_y1 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline);
mng_retcode magnify_ga8_y2 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline);
mng_retcode magnify_ga8_y3 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline);
mng_retcode magnify_ga8_y4 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline);
mng_retcode magnify_rgba8_y1 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline);
mng_retcode magnify_rgba8_y2 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline);
mng_retcode magnify_rgba8_y3 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline);
mng_retcode magnify_rgba8_y4 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline);
/* ************************************************************************** */
#endif /* _libmng_pixels_h_ */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_prop_xs.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : property get/set interface (implementation) * */
/* * * */
@ -51,6 +51,15 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 10/10/2000 - G.Juyn * */
/* * - added support for alpha-depth prediction * */
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
/* * - added functions to retrieve PNG/JNG specific header-info * */
/* * 0.9.3 - 10/20/2000 - G.Juyn * */
/* * - added get/set for bKGD preference setting * */
/* * 0.9.3 - 10/21/2000 - G.Juyn * */
/* * - added get function for interlace/progressive display * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -187,6 +196,7 @@ mng_retcode MNG_DECL mng_set_bgcolor (mng_handle hHandle,
((mng_datap)hHandle)->iBGred = iRed;
((mng_datap)hHandle)->iBGgreen = iGreen;
((mng_datap)hHandle)->iBGblue = iBlue;
((mng_datap)hHandle)->bUseBKGD = MNG_FALSE;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_BGCOLOR, MNG_LC_END)
@ -197,6 +207,25 @@ mng_retcode MNG_DECL mng_set_bgcolor (mng_handle hHandle,
/* ************************************************************************** */
mng_retcode MNG_DECL mng_set_usebkgd (mng_handle hHandle,
mng_bool bUseBKGD)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_USEBKGD, MNG_LC_START)
#endif
MNG_VALIDHANDLE (hHandle)
((mng_datap)hHandle)->bUseBKGD = bUseBKGD;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_USEBKGD, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_set_storechunks (mng_handle hHandle,
mng_bool bStorechunks)
{
@ -1040,6 +1069,294 @@ mng_uint32 MNG_DECL mng_get_simplicity (mng_handle hHandle)
/* ************************************************************************** */
mng_uint8 MNG_DECL mng_get_bitdepth (mng_handle hHandle)
{
mng_uint8 iRslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_BITDEPTH, MNG_LC_START)
#endif
MNG_VALIDHANDLEX (hHandle)
if (((mng_datap)hHandle)->eImagetype == mng_it_png)
iRslt = ((mng_datap)hHandle)->iBitdepth;
else
if (((mng_datap)hHandle)->eImagetype == mng_it_jng)
iRslt = ((mng_datap)hHandle)->iJHDRimgbitdepth;
else
iRslt = 0;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_BITDEPTH, MNG_LC_END)
#endif
return iRslt;
}
/* ************************************************************************** */
mng_uint8 MNG_DECL mng_get_colortype (mng_handle hHandle)
{
mng_uint8 iRslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_COLORTYPE, MNG_LC_START)
#endif
MNG_VALIDHANDLEX (hHandle)
if (((mng_datap)hHandle)->eImagetype == mng_it_png)
iRslt = ((mng_datap)hHandle)->iColortype;
else
if (((mng_datap)hHandle)->eImagetype == mng_it_jng)
iRslt = ((mng_datap)hHandle)->iJHDRcolortype;
else
iRslt = 0;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_COLORTYPE, MNG_LC_END)
#endif
return iRslt;
}
/* ************************************************************************** */
mng_uint8 MNG_DECL mng_get_compression (mng_handle hHandle)
{
mng_uint8 iRslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_COMPRESSION, MNG_LC_START)
#endif
MNG_VALIDHANDLEX (hHandle)
if (((mng_datap)hHandle)->eImagetype == mng_it_png)
iRslt = ((mng_datap)hHandle)->iCompression;
else
if (((mng_datap)hHandle)->eImagetype == mng_it_jng)
iRslt = ((mng_datap)hHandle)->iJHDRimgcompression;
else
iRslt = 0;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_COMPRESSION, MNG_LC_END)
#endif
return iRslt;
}
/* ************************************************************************** */
mng_uint8 MNG_DECL mng_get_filter (mng_handle hHandle)
{
mng_uint8 iRslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_FILTER, MNG_LC_START)
#endif
MNG_VALIDHANDLEX (hHandle)
if (((mng_datap)hHandle)->eImagetype == mng_it_png)
iRslt = ((mng_datap)hHandle)->iFilter;
else
iRslt = 0;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_FILTER, MNG_LC_END)
#endif
return iRslt;
}
/* ************************************************************************** */
mng_uint8 MNG_DECL mng_get_interlace (mng_handle hHandle)
{
mng_uint8 iRslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_INTERLACE, MNG_LC_START)
#endif
MNG_VALIDHANDLEX (hHandle)
if (((mng_datap)hHandle)->eImagetype == mng_it_png)
iRslt = ((mng_datap)hHandle)->iInterlace;
else
if (((mng_datap)hHandle)->eImagetype == mng_it_jng)
iRslt = ((mng_datap)hHandle)->iJHDRimginterlace;
else
iRslt = 0;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_INTERLACE, MNG_LC_END)
#endif
return iRslt;
}
/* ************************************************************************** */
mng_uint8 MNG_DECL mng_get_alphabitdepth (mng_handle hHandle)
{
mng_uint8 iRslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHABITDEPTH, MNG_LC_START)
#endif
MNG_VALIDHANDLEX (hHandle)
if (((mng_datap)hHandle)->eImagetype == mng_it_jng)
iRslt = ((mng_datap)hHandle)->iJHDRalphabitdepth;
else
iRslt = 0;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHABITDEPTH, MNG_LC_END)
#endif
return iRslt;
}
/* ************************************************************************** */
mng_uint8 MNG_DECL mng_get_refreshpass (mng_handle hHandle)
{
mng_uint8 iRslt;
mng_datap pData;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_REFRESHPASS, MNG_LC_START)
#endif
MNG_VALIDHANDLEX (hHandle)
pData = (mng_datap)hHandle;
/* for PNG we know the exact pass */
if ((pData->eImagetype == mng_it_png) && (pData->iPass >= 0))
iRslt = pData->iPass;
#ifdef MNG_INCLUDE_JNG
else /* for JNG we'll fake it... */
if ((pData->eImagetype == mng_it_jng) &&
(pData->bJPEGhasheader) && (pData->bJPEGdecostarted) &&
(pData->bJPEGprogressive))
{
if (pData->pJPEGdinfo->input_scan_number <= 1)
iRslt = 0; /* first pass (I think...) */
else
if (jpeg_input_complete (pData->pJPEGdinfo))
iRslt = 7; /* input complete; aka final pass */
else
iRslt = 3; /* anything between 0 and 7 will do */
}
#endif
else
iRslt = 0;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_REFRESHPASS, MNG_LC_END)
#endif
return iRslt;
}
/* ************************************************************************** */
mng_uint8 MNG_DECL mng_get_alphacompression (mng_handle hHandle)
{
mng_uint8 iRslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHACOMPRESSION, MNG_LC_START)
#endif
MNG_VALIDHANDLEX (hHandle)
if (((mng_datap)hHandle)->eImagetype == mng_it_jng)
iRslt = ((mng_datap)hHandle)->iJHDRalphacompression;
else
iRslt = 0;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHACOMPRESSION, MNG_LC_END)
#endif
return iRslt;
}
/* ************************************************************************** */
mng_uint8 MNG_DECL mng_get_alphafilter (mng_handle hHandle)
{
mng_uint8 iRslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHAFILTER, MNG_LC_START)
#endif
MNG_VALIDHANDLEX (hHandle)
if (((mng_datap)hHandle)->eImagetype == mng_it_jng)
iRslt = ((mng_datap)hHandle)->iJHDRalphafilter;
else
iRslt = 0;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHAFILTER, MNG_LC_END)
#endif
return iRslt;
}
/* ************************************************************************** */
mng_uint8 MNG_DECL mng_get_alphainterlace (mng_handle hHandle)
{
mng_uint8 iRslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHAINTERLACE, MNG_LC_START)
#endif
MNG_VALIDHANDLEX (hHandle)
if (((mng_datap)hHandle)->eImagetype == mng_it_jng)
iRslt = ((mng_datap)hHandle)->iJHDRalphainterlace;
else
iRslt = 0;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHAINTERLACE, MNG_LC_END)
#endif
return iRslt;
}
/* ************************************************************************** */
mng_uint8 MNG_DECL mng_get_alphadepth (mng_handle hHandle)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHADEPTH, MNG_LC_START)
#endif
MNG_VALIDHANDLEX (hHandle)
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHADEPTH, MNG_LC_END)
#endif
return ((mng_datap)hHandle)->iAlphadepth;
}
/* ************************************************************************** */
mng_uint32 MNG_DECL mng_get_canvasstyle (mng_handle hHandle)
{
#ifdef MNG_SUPPORT_TRACE
@ -1097,6 +1414,23 @@ mng_retcode MNG_DECL mng_get_bgcolor (mng_handle hHandle,
/* ************************************************************************** */
mng_bool MNG_DECL mng_get_usebkgd (mng_handle hHandle)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_USEBKGD, MNG_LC_START)
#endif
MNG_VALIDHANDLEX (hHandle)
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_USEBKGD, MNG_LC_END)
#endif
return ((mng_datap)hHandle)->bUseBKGD;
}
/* ************************************************************************** */
mng_bool MNG_DECL mng_get_storechunks (mng_handle hHandle)
{
#ifdef MNG_SUPPORT_TRACE

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_read.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : Read logic (implementation) * */
/* * * */
@ -48,6 +48,13 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
/* * - added MAGN chunk * */
/* * 0.9.3 - 10/11/2000 - G.Juyn * */
/* * - removed test-MaGN * */
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
/* * - added support for JDAA * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -279,11 +286,14 @@ mng_retcode process_raw_chunk (mng_datap pData,
{MNG_UINT_IJNG, init_ijng, free_ijng, read_ijng, write_ijng, 0, 0},
{MNG_UINT_IPNG, init_ipng, free_ipng, read_ipng, write_ipng, 0, 0},
#ifdef MNG_INCLUDE_JNG
{MNG_UINT_JDAA, init_jdaa, free_jdaa, read_jdaa, write_jdaa, 0, 0},
{MNG_UINT_JDAT, init_jdat, free_jdat, read_jdat, write_jdat, 0, 0},
{MNG_UINT_JHDR, init_jhdr, free_jhdr, read_jhdr, write_jhdr, 0, 0},
{MNG_UINT_JSEP, init_jsep, free_jsep, read_jsep, write_jsep, 0, 0},
{MNG_UINT_JdAA, init_jdaa, free_jdaa, read_jdaa, write_jdaa, 0, 0},
#endif
{MNG_UINT_LOOP, init_loop, free_loop, read_loop, write_loop, 0, 0},
{MNG_UINT_MAGN, init_magn, free_magn, read_magn, write_magn, 0, 0},
{MNG_UINT_MEND, init_mend, free_mend, read_mend, write_mend, 0, 0},
{MNG_UINT_MHDR, init_mhdr, free_mhdr, read_mhdr, write_mhdr, 0, 0},
{MNG_UINT_MOVE, init_move, free_move, read_move, write_move, 0, 0},
@ -451,6 +461,7 @@ mng_retcode read_chunk (mng_datap pData)
#endif
case 6 : ; /* same as 8 !!! */
case 8 : { iRetcode = process_display_iend (pData); break; }
case 9 : { iRetcode = process_display_magn2 (pData); break; }
}
}
}

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

@ -2,7 +2,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_read.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : Read management (definition) * */
/* * * */
@ -18,6 +18,9 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 10/18/2000 - G.Juyn * */
/* * - added closestream() processing for mng_cleanup() * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -27,11 +30,10 @@
#ifndef _libmng_read_h_
#define _libmng_read_h_
#include "libmng.h"
#include "libmng_data.h"
/* ************************************************************************** */
mng_retcode process_eof (mng_datap pData);
mng_retcode read_graphic (mng_datap pData);
/* ************************************************************************** */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_trace.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : Trace functions (implementation) * */
/* * * */
@ -62,6 +62,28 @@
/* * - changed file-prefixes * */
/* * - added tracestring for updatemngsimplicity * */
/* * * */
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
/* * - added MAGN chunk * */
/* * 0.9.3 - 09/07/2000 - G.Juyn * */
/* * - added support for new filter_types * */
/* * 0.9.3 - 10/10/2000 - G.Juyn * */
/* * - added support for alpha-depth prediction * */
/* * 0.9.3 - 10/11/2000 - G.Juyn * */
/* * - added JDAA chunk * */
/* * - added support for nEED * */
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
/* * - added functions to retrieve PNG/JNG specific header-info * */
/* * - added optional support for bKGD for PNG images * */
/* * 0.9.3 - 10/17/2000 - G.Juyn * */
/* * - added callback to process non-critical unknown chunks * */
/* * - added routine to discard "invalid" objects * */
/* * 0.9.3 - 10/19/2000 - G.Juyn * */
/* * - implemented delayed delta-processing * */
/* * 0.9.3 - 10/20/2000 - G.Juyn * */
/* * - added get/set for bKGD preference setting * */
/* * 0.9.3 - 10/21/2000 - G.Juyn * */
/* * - added get function for interlace/progressive display * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -125,6 +147,8 @@
{MNG_FN_SETCB_GETALPHALINE, "setcb_getalphaline"},
{MNG_FN_SETCB_PROCESSSAVE, "setcb_processsave"},
{MNG_FN_SETCB_PROCESSSEEK, "setcb_processseek"},
{MNG_FN_SETCB_PROCESSNEED, "setcb_processneed"},
{MNG_FN_SETCB_PROCESSUNKNOWN, "setcb_processunknown"},
{MNG_FN_GETCB_MEMALLOC, "getcb_memalloc"},
{MNG_FN_GETCB_MEMFREE, "getcb_memfree"},
@ -149,6 +173,8 @@
{MNG_FN_GETCB_GETALPHALINE, "getcb_getalphaline"},
{MNG_FN_GETCB_PROCESSSAVE, "getcb_processsave"},
{MNG_FN_GETCB_PROCESSSEEK, "getcb_processseek"},
{MNG_FN_GETCB_PROCESSNEED, "getcb_processneed"},
{MNG_FN_GETCB_PROCESSUNKNOWN, "getcb_processunknown"},
{MNG_FN_SET_USERDATA, "set_userdata"},
{MNG_FN_SET_CANVASSTYLE, "set_canvasstyle"},
@ -179,6 +205,7 @@
{MNG_FN_SET_SPEED, "set_speed"},
{MNG_FN_SET_SUSPENSIONMODE, "set_suspensionmode"},
{MNG_FN_SET_SECTIONBREAKS, "set_sectionbreaks"},
{MNG_FN_SET_USEBKGD, "set_usebkgd"},
{MNG_FN_GET_USERDATA, "get_userdata"},
{MNG_FN_GET_SIGTYPE, "get_sigtype"},
@ -221,6 +248,18 @@
{MNG_FN_GET_CURRENTLAYER, "get_currentlayer"},
{MNG_FN_GET_CURRENTPLAYTIME, "get_currentplaytime"},
{MNG_FN_GET_SECTIONBREAKS, "get_sectionbreaks"},
{MNG_FN_GET_ALPHADEPTH, "get_alphadepth"},
{MNG_FN_GET_BITDEPTH, "get_bitdepth"},
{MNG_FN_GET_COLORTYPE, "get_colortype"},
{MNG_FN_GET_COMPRESSION, "get_compression"},
{MNG_FN_GET_FILTER, "get_filter"},
{MNG_FN_GET_INTERLACE, "get_interlace"},
{MNG_FN_GET_ALPHABITDEPTH, "get_alphabitdepth"},
{MNG_FN_GET_ALPHACOMPRESSION, "get_alphacompression"},
{MNG_FN_GET_ALPHAFILTER, "get_alphafilter"},
{MNG_FN_GET_ALPHAINTERLACE, "get_alphainterlace"},
{MNG_FN_GET_USEBKGD, "get_usebkgd"},
{MNG_FN_GET_REFRESHPASS, "get_refreshpass"},
{MNG_FN_STATUS_ERROR, "status_error"},
{MNG_FN_STATUS_READING, "status_reading"},
@ -284,6 +323,8 @@
{MNG_FN_GETCHUNK_DBYK, "getchunk_dbyk"},
{MNG_FN_GETCHUNK_ORDR, "getchunk_ordr"},
{MNG_FN_GETCHUNK_UNKNOWN, "getchunk_unknown"},
{MNG_FN_GETCHUNK_MAGN, "getchunk_magn"},
{MNG_FN_GETCHUNK_JDAA, "getchunk_jdaa"},
{MNG_FN_GETCHUNK_PAST_SRC, "getchunk_past_src"},
{MNG_FN_GETCHUNK_SAVE_ENTRY, "getchunk_save_entry"},
@ -341,6 +382,8 @@
{MNG_FN_PUTCHUNK_DBYK, "putchunk_dbyk"},
{MNG_FN_PUTCHUNK_ORDR, "putchunk_ordr"},
{MNG_FN_PUTCHUNK_UNKNOWN, "putchunk_unknown"},
{MNG_FN_PUTCHUNK_MAGN, "putchunk_magn"},
{MNG_FN_PUTCHUNK_JDAA, "putchunk_jdaa"},
{MNG_FN_PUTCHUNK_PAST_SRC, "putchunk_past_src"},
{MNG_FN_PUTCHUNK_SAVE_ENTRY, "putchunk_save_entry"},
@ -385,6 +428,7 @@
{MNG_FN_CLEAR_CANVAS, "clear_canvas"},
{MNG_FN_READ_DATABUFFER, "read_databuffer"},
{MNG_FN_STORE_ERROR, "store_error"},
{MNG_FN_DROP_INVALID_OBJECTS, "drop_invalid_objects"},
{MNG_FN_DISPLAY_RGB8, "display_rgb8"},
{MNG_FN_DISPLAY_RGBA8, "display_rgba8"},
@ -478,6 +522,23 @@
{MNG_FN_FILTER_AVERAGE, "filter_average"},
{MNG_FN_FILTER_PAETH, "filter_paeth"},
{MNG_FN_INIT_ROWDIFFERING, "init_rowdiffering"},
{MNG_FN_DIFFER_G1, "differ_g1"},
{MNG_FN_DIFFER_G2, "differ_g2"},
{MNG_FN_DIFFER_G4, "differ_g4"},
{MNG_FN_DIFFER_G8, "differ_g8"},
{MNG_FN_DIFFER_G16, "differ_g16"},
{MNG_FN_DIFFER_RGB8, "differ_rgb8"},
{MNG_FN_DIFFER_RGB16, "differ_rgb16"},
{MNG_FN_DIFFER_IDX1, "differ_idx1"},
{MNG_FN_DIFFER_IDX2, "differ_idx2"},
{MNG_FN_DIFFER_IDX4, "differ_idx4"},
{MNG_FN_DIFFER_IDX8, "differ_idx8"},
{MNG_FN_DIFFER_GA8, "differ_ga8"},
{MNG_FN_DIFFER_GA16, "differ_ga16"},
{MNG_FN_DIFFER_RGBA8, "differ_rgba8"},
{MNG_FN_DIFFER_RGBA16, "differ_rgba16"},
{MNG_FN_CREATE_IMGDATAOBJECT, "create_imgdataobject"},
{MNG_FN_FREE_IMGDATAOBJECT, "free_imgdataobject"},
{MNG_FN_CLONE_IMGDATAOBJECT, "clone_imgdataobject"},
@ -488,6 +549,7 @@
{MNG_FN_RESET_OBJECTDETAILS, "reset_objectdetails"},
{MNG_FN_RENUM_IMGOBJECT, "renum_imgobject"},
{MNG_FN_PROMOTE_IMGOBJECT, "promote_imgobject"},
{MNG_FN_MAGNIFY_IMGOBJECT, "magnify_imgobject"},
{MNG_FN_STORE_G1, "store_g1"},
{MNG_FN_STORE_G2, "store_g2"},
@ -558,6 +620,7 @@
{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_MAGN, "create_ani_magn"},
{MNG_FN_CREATE_ANI_IMAGE, "create_ani_image"},
@ -588,6 +651,7 @@
{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_MAGN, "free_ani_magn"},
{MNG_FN_FREE_ANI_IMAGE, "free_ani_image"},
@ -618,6 +682,7 @@
{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_MAGN, "process_ani_magn"},
{MNG_FN_PROCESS_ANI_IMAGE, "process_ani_image"},
@ -626,6 +691,7 @@
{MNG_FN_RESTORE_BGCOLOR, "restore_bgcolor"},
{MNG_FN_RESTORE_RGB8, "restore_rgb8"},
{MNG_FN_RESTORE_BGR8, "restore_bgr8"},
{MNG_FN_RESTORE_BKGD, "restore_bkgd"},
{MNG_FN_INIT_IHDR, "init_ihdr"},
{MNG_FN_INIT_PLTE, "init_plte"},
@ -678,6 +744,8 @@
{MNG_FN_INIT_DBYK, "init_dbyk"},
{MNG_FN_INIT_ORDR, "init_ordr"},
{MNG_FN_INIT_UNKNOWN, "init_unknown"},
{MNG_FN_INIT_MAGN, "init_magn"},
{MNG_FN_INIT_JDAA, "init_jdaa"},
{MNG_FN_FREE_IHDR, "free_ihdr"},
{MNG_FN_FREE_PLTE, "free_plte"},
@ -730,6 +798,8 @@
{MNG_FN_FREE_DBYK, "free_dbyk"},
{MNG_FN_FREE_ORDR, "free_ordr"},
{MNG_FN_FREE_UNKNOWN, "free_unknown"},
{MNG_FN_FREE_MAGN, "free_magn"},
{MNG_FN_FREE_JDAA, "free_jdaa"},
{MNG_FN_READ_IHDR, "read_ihdr"},
{MNG_FN_READ_PLTE, "read_plte"},
@ -782,6 +852,8 @@
{MNG_FN_READ_DBYK, "read_dbyk"},
{MNG_FN_READ_ORDR, "read_ordr"},
{MNG_FN_READ_UNKNOWN, "read_unknown"},
{MNG_FN_READ_MAGN, "read_magn"},
{MNG_FN_READ_JDAA, "read_jdaa"},
{MNG_FN_WRITE_IHDR, "write_ihdr"},
{MNG_FN_WRITE_PLTE, "write_plte"},
@ -834,6 +906,8 @@
{MNG_FN_WRITE_DBYK, "write_dbyk"},
{MNG_FN_WRITE_ORDR, "write_ordr"},
{MNG_FN_WRITE_UNKNOWN, "write_unknown"},
{MNG_FN_WRITE_MAGN, "write_magn"},
{MNG_FN_WRITE_JDAA, "write_jdaa"},
{MNG_FN_ZLIB_INITIALIZE, "zlib_initialize"},
{MNG_FN_ZLIB_CLEANUP, "zlib_cleanup"},
@ -892,6 +966,8 @@
{MNG_FN_PROCESS_DISPLAY_DROP, "process_display_drop"},
{MNG_FN_PROCESS_DISPLAY_DBYK, "process_display_dbyk"},
{MNG_FN_PROCESS_DISPLAY_ORDR, "process_display_ordr"},
{MNG_FN_PROCESS_DISPLAY_MAGN, "process_display_magn"},
{MNG_FN_PROCESS_DISPLAY_JDAA, "process_display_jdaa"},
{MNG_FN_JPEG_INITIALIZE, "jpeg_initialize"},
{MNG_FN_JPEG_CLEANUP, "jpeg_cleanup"},
@ -941,6 +1017,52 @@
{MNG_FN_NEXT_JPEG_ALPHAROW, "next_jpeg_alpharow"},
{MNG_FN_NEXT_JPEG_ROW, "next_jpeg_row"},
{MNG_FN_DISPLAY_JPEG_ROWS, "display_jpeg_rows"},
{MNG_FN_MAGNIFY_G8_X1, "magnify_g8_x1"},
{MNG_FN_MAGNIFY_G8_X2, "magnify_g8_x2"},
{MNG_FN_MAGNIFY_RGB8_X1, "magnify_rgb8_x1"},
{MNG_FN_MAGNIFY_RGB8_X2, "magnify_rgb8_x2"},
{MNG_FN_MAGNIFY_GA8_X1, "magnify_ga8_x1"},
{MNG_FN_MAGNIFY_GA8_X2, "magnify_ga8_x2"},
{MNG_FN_MAGNIFY_GA8_X3, "magnify_ga8_x3"},
{MNG_FN_MAGNIFY_GA8_X4, "magnify_ga8_x4"},
{MNG_FN_MAGNIFY_RGBA8_X1, "magnify_rgba8_x1"},
{MNG_FN_MAGNIFY_RGBA8_X2, "magnify_rgba8_x2"},
{MNG_FN_MAGNIFY_RGBA8_X3, "magnify_rgba8_x3"},
{MNG_FN_MAGNIFY_RGBA8_X4, "magnify_rgba8_x4"},
{MNG_FN_MAGNIFY_G8_Y1, "magnify_g8_y1"},
{MNG_FN_MAGNIFY_G8_Y2, "magnify_g8_y2"},
{MNG_FN_MAGNIFY_RGB8_Y1, "magnify_rgb8_y1"},
{MNG_FN_MAGNIFY_RGB8_Y2, "magnify_rgb8_y2"},
{MNG_FN_MAGNIFY_GA8_Y1, "magnify_ga8_y1"},
{MNG_FN_MAGNIFY_GA8_Y2, "magnify_ga8_y2"},
{MNG_FN_MAGNIFY_GA8_Y3, "magnify_ga8_y3"},
{MNG_FN_MAGNIFY_GA8_Y4, "magnify_ga8_y4"},
{MNG_FN_MAGNIFY_RGBA8_Y1, "magnify_rgba8_y1"},
{MNG_FN_MAGNIFY_RGBA8_Y2, "magnify_rgba8_y2"},
{MNG_FN_MAGNIFY_RGBA8_Y3, "magnify_rgba8_y3"},
{MNG_FN_MAGNIFY_RGBA8_Y4, "magnify_rgba8_y4"},
{MNG_FN_DELTA_G1_G1, "delta_g1_g1"},
{MNG_FN_DELTA_G2_G2, "delta_g2_g2"},
{MNG_FN_DELTA_G4_G4, "delta_g4_g4"},
{MNG_FN_DELTA_G8_G8, "delta_g8_g8"},
{MNG_FN_DELTA_G16_G16, "delta_g16_g16"},
{MNG_FN_DELTA_RGB8_RGB8, "delta_rgb8_rgb8"},
{MNG_FN_DELTA_RGB16_RGB16, "delta_rgb16_rgb16"},
{MNG_FN_DELTA_GA8_GA8, "delta_ga8_ga8"},
{MNG_FN_DELTA_GA8_G8, "delta_ga8_g8"},
{MNG_FN_DELTA_GA8_A8, "delta_ga8_a8"},
{MNG_FN_DELTA_GA16_GA16, "delta_ga16_ga16"},
{MNG_FN_DELTA_GA16_G16, "delta_ga16_g16"},
{MNG_FN_DELTA_GA16_A16, "delta_ga16_a16"},
{MNG_FN_DELTA_RGBA8_RGBA8, "delta_rgba8_rgba8"},
{MNG_FN_DELTA_RGBA8_RGB8, "delta_rgba8_rgb8"},
{MNG_FN_DELTA_RGBA8_A8, "delta_rgba8_a8"},
{MNG_FN_DELTA_RGBA16_RGBA16, "delta_rgba16_rgba16"},
{MNG_FN_DELTA_RGBA16_RGB16, "delta_rgba16_rgb16"},
{MNG_FN_DELTA_RGBA16_A16, "delta_rgba16_a16"},
};
#endif /* MNG_INCLUDE_TRACE_STINGS */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_trace.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : Trace functions (definition) * */
/* * * */
@ -71,6 +71,28 @@
/* * - changed file-prefixes * */
/* * - added tracecode for updatemngsimplicity * */
/* * * */
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
/* * - added MAGN chunk * */
/* * 0.9.3 - 09/07/2000 - G.Juyn * */
/* * - added support for new filter_types * */
/* * 0.9.3 - 10/10/2000 - G.Juyn * */
/* * - added support for alpha-depth prediction * */
/* * 0.9.3 - 10/11/2000 - G.Juyn * */
/* * - added JDAA chunk * */
/* * - added support for nEED * */
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
/* * - added functions to retrieve PNG/JNG specific header-info * */
/* * - added optional support for bKGD for PNG images * */
/* * 0.9.3 - 10/17/2000 - G.Juyn * */
/* * - added callback to process non-critical unknown chunks * */
/* * - added routine to discard "invalid" objects * */
/* * 0.9.3 - 10/19/2000 - G.Juyn * */
/* * - implemented delayed delta-processing * */
/* * 0.9.3 - 10/20/2000 - G.Juyn * */
/* * - added get/set for bKGD preference setting * */
/* * 0.9.3 - 10/21/2000 - G.Juyn * */
/* * - added get function for interlace/progressive display * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -161,6 +183,8 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_SETCB_GETALPHALINE 121
#define MNG_FN_SETCB_PROCESSSAVE 122
#define MNG_FN_SETCB_PROCESSSEEK 123
#define MNG_FN_SETCB_PROCESSNEED 124
#define MNG_FN_SETCB_PROCESSUNKNOWN 125
#define MNG_FN_GETCB_MEMALLOC 201
#define MNG_FN_GETCB_MEMFREE 202
@ -185,6 +209,8 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_GETCB_GETALPHALINE 221
#define MNG_FN_GETCB_PROCESSSAVE 222
#define MNG_FN_GETCB_PROCESSSEEK 223
#define MNG_FN_GETCB_PROCESSNEED 224
#define MNG_FN_GETCB_PROCESSUNKNOWN 225
#define MNG_FN_SET_USERDATA 301
#define MNG_FN_SET_CANVASSTYLE 302
@ -215,6 +241,7 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_SET_SPEED 327
#define MNG_FN_SET_SUSPENSIONMODE 328
#define MNG_FN_SET_SECTIONBREAKS 329
#define MNG_FN_SET_USEBKGD 330
#define MNG_FN_GET_USERDATA 401
#define MNG_FN_GET_SIGTYPE 402
@ -257,6 +284,18 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_GET_CURRENTLAYER 439
#define MNG_FN_GET_CURRENTPLAYTIME 440
#define MNG_FN_GET_SECTIONBREAKS 441
#define MNG_FN_GET_ALPHADEPTH 442
#define MNG_FN_GET_BITDEPTH 443
#define MNG_FN_GET_COLORTYPE 444
#define MNG_FN_GET_COMPRESSION 445
#define MNG_FN_GET_FILTER 446
#define MNG_FN_GET_INTERLACE 447
#define MNG_FN_GET_ALPHABITDEPTH 448
#define MNG_FN_GET_ALPHACOMPRESSION 449
#define MNG_FN_GET_ALPHAFILTER 450
#define MNG_FN_GET_ALPHAINTERLACE 451
#define MNG_FN_GET_USEBKGD 452
#define MNG_FN_GET_REFRESHPASS 453
#define MNG_FN_STATUS_ERROR 481
#define MNG_FN_STATUS_READING 482
@ -322,6 +361,8 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_GETCHUNK_DBYK 749
#define MNG_FN_GETCHUNK_ORDR 750
#define MNG_FN_GETCHUNK_UNKNOWN 751
#define MNG_FN_GETCHUNK_MAGN 752
#define MNG_FN_GETCHUNK_JDAA 753
#define MNG_FN_GETCHUNK_PAST_SRC 781
#define MNG_FN_GETCHUNK_SAVE_ENTRY 782
@ -379,6 +420,8 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_PUTCHUNK_DBYK 849
#define MNG_FN_PUTCHUNK_ORDR 850
#define MNG_FN_PUTCHUNK_UNKNOWN 851
#define MNG_FN_PUTCHUNK_MAGN 852
#define MNG_FN_PUTCHUNK_JDAA 853
#define MNG_FN_PUTCHUNK_PAST_SRC 881
#define MNG_FN_PUTCHUNK_SAVE_ENTRY 882
@ -427,6 +470,7 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_CLEAR_CANVAS 1024
#define MNG_FN_READ_DATABUFFER 1025
#define MNG_FN_STORE_ERROR 1026
#define MNG_FN_DROP_INVALID_OBJECTS 1027
/* ************************************************************************** */
@ -530,6 +574,23 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_FILTER_AVERAGE 1504
#define MNG_FN_FILTER_PAETH 1505
#define MNG_FN_INIT_ROWDIFFERING 1551
#define MNG_FN_DIFFER_G1 1552
#define MNG_FN_DIFFER_G2 1553
#define MNG_FN_DIFFER_G4 1554
#define MNG_FN_DIFFER_G8 1555
#define MNG_FN_DIFFER_G16 1556
#define MNG_FN_DIFFER_RGB8 1557
#define MNG_FN_DIFFER_RGB16 1558
#define MNG_FN_DIFFER_IDX1 1559
#define MNG_FN_DIFFER_IDX2 1560
#define MNG_FN_DIFFER_IDX4 1561
#define MNG_FN_DIFFER_IDX8 1562
#define MNG_FN_DIFFER_GA8 1563
#define MNG_FN_DIFFER_GA16 1564
#define MNG_FN_DIFFER_RGBA8 1565
#define MNG_FN_DIFFER_RGBA16 1566
/* ************************************************************************** */
#define MNG_FN_CREATE_IMGDATAOBJECT 1601
@ -542,6 +603,7 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_RESET_OBJECTDETAILS 1608
#define MNG_FN_RENUM_IMGOBJECT 1609
#define MNG_FN_PROMOTE_IMGOBJECT 1610
#define MNG_FN_MAGNIFY_IMGOBJECT 1611
/* ************************************************************************** */
@ -616,6 +678,7 @@ mng_retcode mng_trace (mng_datap pData,
#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_MAGN 1828
#define MNG_FN_CREATE_ANI_IMAGE 1891
@ -648,6 +711,7 @@ mng_retcode mng_trace (mng_datap pData,
#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_MAGN 1928
#define MNG_FN_FREE_ANI_IMAGE 1991
@ -680,6 +744,7 @@ mng_retcode mng_trace (mng_datap pData,
#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_MAGN 2028
#define MNG_FN_PROCESS_ANI_IMAGE 2091
@ -690,6 +755,7 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_RESTORE_BGCOLOR 2103
#define MNG_FN_RESTORE_RGB8 2104
#define MNG_FN_RESTORE_BGR8 2105
#define MNG_FN_RESTORE_BKGD 2106
/* ************************************************************************** */
@ -744,6 +810,8 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_INIT_DBYK 2249
#define MNG_FN_INIT_ORDR 2250
#define MNG_FN_INIT_UNKNOWN 2251
#define MNG_FN_INIT_MAGN 2252
#define MNG_FN_INIT_JDAA 2253
/* ************************************************************************** */
@ -798,6 +866,8 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_FREE_DBYK 2449
#define MNG_FN_FREE_ORDR 2450
#define MNG_FN_FREE_UNKNOWN 2451
#define MNG_FN_FREE_MAGN 2452
#define MNG_FN_FREE_JDAA 2453
/* ************************************************************************** */
@ -852,6 +922,8 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_READ_DBYK 2649
#define MNG_FN_READ_ORDR 2650
#define MNG_FN_READ_UNKNOWN 2651
#define MNG_FN_READ_MAGN 2652
#define MNG_FN_READ_JDAA 2653
/* ************************************************************************** */
@ -906,6 +978,8 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_WRITE_DBYK 2849
#define MNG_FN_WRITE_ORDR 2850
#define MNG_FN_WRITE_UNKNOWN 2851
#define MNG_FN_WRITE_MAGN 2852
#define MNG_FN_WRITE_JDAA 2853
/* ************************************************************************** */
@ -968,6 +1042,8 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_PROCESS_DISPLAY_DROP 3244
#define MNG_FN_PROCESS_DISPLAY_DBYK 3245
#define MNG_FN_PROCESS_DISPLAY_ORDR 3246
#define MNG_FN_PROCESS_DISPLAY_MAGN 3247
#define MNG_FN_PROCESS_DISPLAY_JDAA 3248
/* ************************************************************************** */
@ -1020,6 +1096,56 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_NEXT_JPEG_ROW 3592
#define MNG_FN_DISPLAY_JPEG_ROWS 3593
/* ************************************************************************** */
#define MNG_FN_MAGNIFY_G8_X1 3701
#define MNG_FN_MAGNIFY_G8_X2 3702
#define MNG_FN_MAGNIFY_RGB8_X1 3703
#define MNG_FN_MAGNIFY_RGB8_X2 3704
#define MNG_FN_MAGNIFY_GA8_X1 3705
#define MNG_FN_MAGNIFY_GA8_X2 3706
#define MNG_FN_MAGNIFY_GA8_X3 3707
#define MNG_FN_MAGNIFY_GA8_X4 3708
#define MNG_FN_MAGNIFY_RGBA8_X1 3709
#define MNG_FN_MAGNIFY_RGBA8_X2 3710
#define MNG_FN_MAGNIFY_RGBA8_X3 3711
#define MNG_FN_MAGNIFY_RGBA8_X4 3712
#define MNG_FN_MAGNIFY_G8_Y1 3751
#define MNG_FN_MAGNIFY_G8_Y2 3752
#define MNG_FN_MAGNIFY_RGB8_Y1 3753
#define MNG_FN_MAGNIFY_RGB8_Y2 3754
#define MNG_FN_MAGNIFY_GA8_Y1 3755
#define MNG_FN_MAGNIFY_GA8_Y2 3756
#define MNG_FN_MAGNIFY_GA8_Y3 3757
#define MNG_FN_MAGNIFY_GA8_Y4 3758
#define MNG_FN_MAGNIFY_RGBA8_Y1 3759
#define MNG_FN_MAGNIFY_RGBA8_Y2 3760
#define MNG_FN_MAGNIFY_RGBA8_Y3 3761
#define MNG_FN_MAGNIFY_RGBA8_Y4 3762
/* ************************************************************************** */
#define MNG_FN_DELTA_G1_G1 3801
#define MNG_FN_DELTA_G2_G2 3802
#define MNG_FN_DELTA_G4_G4 3803
#define MNG_FN_DELTA_G8_G8 3804
#define MNG_FN_DELTA_G16_G16 3805
#define MNG_FN_DELTA_RGB8_RGB8 3806
#define MNG_FN_DELTA_RGB16_RGB16 3807
#define MNG_FN_DELTA_GA8_GA8 3808
#define MNG_FN_DELTA_GA8_G8 3809
#define MNG_FN_DELTA_GA8_A8 3810
#define MNG_FN_DELTA_GA16_GA16 3811
#define MNG_FN_DELTA_GA16_G16 3812
#define MNG_FN_DELTA_GA16_A16 3813
#define MNG_FN_DELTA_RGBA8_RGBA8 3814
#define MNG_FN_DELTA_RGBA8_RGB8 3815
#define MNG_FN_DELTA_RGBA8_A8 3816
#define MNG_FN_DELTA_RGBA16_RGBA16 3817
#define MNG_FN_DELTA_RGBA16_RGB16 3818
#define MNG_FN_DELTA_RGBA16_A16 3819
/* ************************************************************************** */
/* * * */
/* * Trace string-table entry * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_types.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.4 * */
/* * * */
/* * purpose : type specifications * */
/* * * */
@ -71,6 +71,21 @@
/* * * */
/* * 0.9.3 - 08/07/2000 - G.Juyn * */
/* * - B111300 - fixup for improved portability * */
/* * 0.9.3 - 08/12/2000 - G.Juyn * */
/* * - added workaround for faulty PhotoShop iCCP chunk * */
/* * 0.9.3 - 09/11/2000 - G.Juyn * */
/* * - added export of zlib functions from windows dll * */
/* * - fixed inclusion parameters once again to make those * */
/* * external libs work together * */
/* * - re-fixed fixed inclusion parameters * */
/* * (these freeking libraries make me mad) * */
/* * 0.9.3 - 10/11/2000 - G.Juyn * */
/* * - added support for nEED * */
/* * 0.9.3 - 10/17/2000 - G.Juyn * */
/* * - added callback to process non-critical unknown chunks * */
/* * * */
/* * 0.9.4 - 11/20/2000 - R.Giles * */
/* * - fixed inclusion of lcms header for non-windows platforms * */
/* * * */
/* ************************************************************************** */
@ -98,13 +113,34 @@
/* * * */
/* ************************************************************************** */
#ifdef WIN32 /* only include needed stuff */
#define WIN32_LEAN_AND_MEAN
#endif
#ifdef MNG_USE_DLL
#ifdef MNG_SKIP_ZLIB
#undef MNG_INCLUDE_ZLIB
#endif
#ifdef MNG_SKIP_LCMS
#undef MNG_INCLUDE_LCMS
#endif
#ifdef MNG_SKIP_IJG6B
#undef MNG_INCLUDE_IJG6B
#endif
#endif
#ifdef MNG_INCLUDE_ZLIB /* zlib by Mark Adler & Jean-loup Gailly */
#include "zlib.h"
#endif
#ifdef MNG_INCLUDE_LCMS /* little cms by Marti Maria */
#undef FAR /* possibly defined by zlib */
#ifdef MNG_INCLUDE_LCMS /* little cms by Marti Maria Saguer */
#ifndef ZLIB_DLL
#undef FAR
#endif
#ifdef WIN32 /* different header locations */
#include "lcms.h"
#else
#include "lcms/lcms.h"
#endif
#endif /* MNG_INCLUDE_LCMS */
#ifdef MNG_INCLUDE_IJG6B /* IJG's jpgsrc6b */
@ -116,7 +152,9 @@
#define USE_WINDOWS_MESSAGEBOX /* display a messagebox under Windoze */
#endif
#endif /* MNG_USE_SETJMP */
#ifdef FAR
#undef FAR /* possibly defined by zlib or lcms */
#endif
#include "jpeglib.h" /* all that for JPEG support :-) */
#endif /* MNG_INCLUDE_IJG6B */
@ -134,8 +172,11 @@
#include <memory.h> /* defines "memcpy" for other win32 platforms */
#endif
/* B003 */
#ifdef MNG_CHECK_BAD_ICCP
#include <string.h> /* strncmp() */
#endif
#else
#if defined(BSD) && !defined(XP_OS2)
#ifdef BSD
#include <strings.h> /* defines "memcpy" for BSD (?) */
#else
#include <string.h> /* defines "memcpy" for all others (???) */
@ -368,6 +409,12 @@ typedef mng_bool MNG_DECL (*mng_processtext) (mng_handle hHandle,
typedef mng_bool MNG_DECL (*mng_processsave) (mng_handle hHandle);
typedef mng_bool MNG_DECL (*mng_processseek) (mng_handle hHandle,
mng_pchar zName);
typedef mng_bool MNG_DECL (*mng_processneed) (mng_handle hHandle,
mng_pchar zKeyword);
typedef mng_bool MNG_DECL (*mng_processunknown) (mng_handle hHandle,
mng_chunkid iChunkid,
mng_uint32 iRawlen,
mng_ptr pRawdata);
/* display processing callbacks */
typedef mng_ptr MNG_DECL (*mng_getcanvasline) (mng_handle hHandle,

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

@ -30,9 +30,6 @@
#ifndef _libmng_write_h_
#define _libmng_write_h_
#include "libmng.h"
#include "libmng_data.h"
/* ************************************************************************** */
mng_retcode write_graphic (mng_datap pData);

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_zlib.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 0.9.3 * */
/* * * */
/* * purpose : ZLIB library interface (implementation) * */
/* * * */
@ -34,6 +34,11 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 08/08/2000 - G.Juyn * */
/* * - fixed compiler-warnings from Mozilla * */
/* * 0.9.3 - 09/07/2000 - G.Juyn * */
/* * - added support for new filter_types * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -141,7 +146,7 @@ mng_retcode mngzlib_cleanup (mng_datap pData)
mng_retcode mngzlib_inflateinit (mng_datap pData)
{
uInt iZrslt;
int iZrslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEINIT, MNG_LC_START)
@ -169,7 +174,7 @@ mng_retcode mngzlib_inflaterows (mng_datap pData,
mng_uint32 iInlen,
mng_uint8p pIndata)
{
uInt iZrslt;
int iZrslt;
mng_retcode iRslt;
mng_ptr pSwap;
@ -183,7 +188,7 @@ mng_retcode mngzlib_inflaterows (mng_datap pData,
if (pData->sZlib.next_out == 0) /* initialize output variables ? */
{ /* let zlib know where to store stuff */
pData->sZlib.next_out = pData->pWorkrow;
pData->sZlib.avail_out = (uInt)(pData->iRowsize + 1);
pData->sZlib.avail_out = (uInt)(pData->iRowsize + pData->iPixelofs);
}
do
@ -194,13 +199,26 @@ mng_retcode mngzlib_inflaterows (mng_datap pData,
(pData->sZlib.avail_out == 0))
{ /* shouldn't we be at the end ? */
if (pData->iRow >= (mng_int32)pData->iDataheight)
/* MNG_ERROR (pData, MNG_TOOMUCHIDAT) */ ;
/* MNG_ERROR (pData, MNG_TOOMUCHIDAT) */ ; /* TODO: check this!!! */
else
{ /* filter the row if necessary */
if (pData->pWorkrow[0])
iRslt = filter_a_row (pData);
{
if (pData->iFilterofs) /* has leveling info ? */
iRslt = init_rowdiffering (pData);
else
iRslt = MNG_NOERROR;
/* filter the row if necessary */
if ((!iRslt) && (pData->iFilterofs < pData->iPixelofs ) &&
(*(pData->pWorkrow + pData->iFilterofs)) )
iRslt = filter_a_row (pData);
/* additonal leveling/differing ? */
if ((!iRslt) && (pData->fDifferrow))
{
iRslt = ((mng_differrow)pData->fDifferrow) (pData);
pSwap = pData->pWorkrow;
pData->pWorkrow = pData->pPrevrow;
pData->pPrevrow = pSwap; /* so prev points to the processed row! */
}
if (!iRslt)
{
@ -235,10 +253,13 @@ mng_retcode mngzlib_inflaterows (mng_datap pData,
if (iRslt) /* on error bail out */
MNG_ERROR (pData, iRslt);
/* swap row-pointers */
if (!pData->fDifferrow) /* swap row-pointers */
{
pSwap = pData->pWorkrow;
pData->pWorkrow = pData->pPrevrow;
pData->pPrevrow = pSwap; /* so prev points to the processed row! */
}
iRslt = next_row (pData); /* adjust variables for next row */
@ -247,7 +268,7 @@ mng_retcode mngzlib_inflaterows (mng_datap pData,
}
/* let zlib know where to store next output */
pData->sZlib.next_out = pData->pWorkrow;
pData->sZlib.avail_out = (uInt)(pData->iRowsize + 1);
pData->sZlib.avail_out = (uInt)(pData->iRowsize + pData->iPixelofs);
}
} /* until some error or EOI */
while ((iZrslt == Z_OK) && (pData->sZlib.avail_in > 0));
@ -269,7 +290,7 @@ mng_retcode mngzlib_inflatedata (mng_datap pData,
mng_uint32 iInlen,
mng_uint8p pIndata)
{
uInt iZrslt;
int iZrslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEDATA, MNG_LC_START)
@ -297,7 +318,7 @@ mng_retcode mngzlib_inflatedata (mng_datap pData,
mng_retcode mngzlib_inflatefree (mng_datap pData)
{
uInt iZrslt;
int iZrslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEFREE, MNG_LC_START)
@ -321,7 +342,7 @@ mng_retcode mngzlib_inflatefree (mng_datap pData)
mng_retcode mngzlib_deflateinit (mng_datap pData)
{
uInt iZrslt;
int iZrslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEINIT, MNG_LC_START)
@ -369,7 +390,7 @@ mng_retcode mngzlib_deflatedata (mng_datap pData,
mng_uint32 iInlen,
mng_uint8p pIndata)
{
uInt iZrslt;
int iZrslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEDATA, MNG_LC_START)
@ -397,7 +418,7 @@ mng_retcode mngzlib_deflatedata (mng_datap pData,
mng_retcode mngzlib_deflatefree (mng_datap pData)
{
uInt iZrslt;
int iZrslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEFREE, MNG_LC_START)

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

@ -30,9 +30,6 @@
#ifndef _libmng_zlib_h_
#define _libmng_zlib_h_
#include "libmng.h"
#include "libmng_data.h"
/* ************************************************************************** */
mng_retcode mngzlib_initialize (mng_datap pData);

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

@ -27,23 +27,15 @@
#include "libmng.h"
#include "prinrval.h"
// Define this if you just want an RGB (no alpha) target
//#define NO_ALPHA
#ifdef NO_ALPHA
#define CHANNELS 3
#else
#define CHANNELS 4
#endif
typedef struct ipng_str {
typedef struct imng_str {
mng_handle handle;
PRUint32 width;
PRUint32 height;
PRUint8 *image; /* RGBA full image buffer */
PRUint8 *image; /* full image buffer */
PRUint8 *rowbuf; /* ImgDCBHaveRow is destructive. Grrr... */
PRUint32 channels; /* How many channels (3 or 4) */
void *timer_id;
@ -63,6 +55,7 @@ typedef struct ipng_str {
il_container *ic = (il_container *)mng_get_userdata(handle); \
imng_structp imng_p = (imng_structp)ic->ds
#define DEBUG_tor
#ifdef DEBUG_tor
#define dprintf(x) fprintf x
#else
@ -112,23 +105,35 @@ il_mng_processheader(mng_handle handle, mng_uint32 width, mng_uint32 height)
ic->src_header->width = width;
ic->src_header->height = height;
#ifndef NO_ALPHA
if (mng_get_simplicity(handle) & MNG_SIMPLICITY_TRANSPARENCY) {
dprintf((stderr, "--- MNG ALPHA 8-BIT\n"));
ic->image->header.alpha_bits = 8;
} else {
switch (mng_get_alphadepth(handle)) {
case 0:
dprintf((stderr, "--- MNG ALPHA NONE\n"));
ic->image->header.alpha_bits = 0;
mng_set_canvasstyle(imng_p->handle, MNG_CANVAS_RGB8);
imng_p->channels = 3;
break;
case 1:
dprintf((stderr, "--- MNG ALPHA THRESHHOLD\n"));
ic->image->header.alpha_bits = 1;
mng_set_canvasstyle(imng_p->handle, MNG_CANVAS_RGBA8);
imng_p->channels = 4;
break;
default:
dprintf((stderr, "--- MNG ALPHA 8-BIT\n"));
ic->image->header.alpha_bits = 8;
mng_set_canvasstyle(imng_p->handle, MNG_CANVAS_RGBA8);
imng_p->channels = 4;
break;
}
ic->image->header.alpha_shift = 0;
ic->image->header.is_interleaved_alpha = TRUE;
#endif
imng_p->image =
(unsigned char*)nsMemory::Alloc(CHANNELS*width*height);
memset(imng_p->image, 0, CHANNELS*width*height);
(unsigned char*)nsMemory::Alloc(imng_p->channels*width*height);
memset(imng_p->image, 0, imng_p->channels*width*height);
imng_p->rowbuf = (unsigned char*)nsMemory::Alloc(CHANNELS*width);
imng_p->rowbuf = (unsigned char*)nsMemory::Alloc(imng_p->channels*width);
ic->imgdcb->ImgDCBImageSize();
ic->imgdcb->ImgDCBSetupColorspaceConverter();
@ -141,7 +146,7 @@ il_mng_getcanvasline(mng_handle handle, mng_uint32 iLinenr)
{
EXTRACT_STRUCTS;
return imng_p->image+CHANNELS*imng_p->width*iLinenr;
return imng_p->image+imng_p->channels*imng_p->width*iLinenr;
}
static mng_bool
@ -156,8 +161,8 @@ il_mng_refresh(mng_handle handle,
for (mng_uint32 y=top; y<top+height; y++) {
memcpy(imng_p->rowbuf,
imng_p->image+y*CHANNELS*imng_p->width,
CHANNELS*imng_p->width);
imng_p->image+y*imng_p->channels*imng_p->width,
imng_p->channels*imng_p->width);
ic->imgdcb->ImgDCBHaveRow(0 /* color index data */,
imng_p->rowbuf /* rgb[a] */,
0 /* x-offset */,
@ -165,7 +170,7 @@ il_mng_refresh(mng_handle handle,
y /* start row */,
1 /* row duplication count */,
ilErase /* draw mode */,
0 /* pass */);
mng_get_refreshpass(handle) /* pass */);
}
return MNG_TRUE;
@ -346,10 +351,6 @@ MNGDecoder::ImgDInit()
mng_set_displaygamma(imng_p->handle, display_exponent);
////////////
#ifndef NO_ALPHA
mng_set_canvasstyle(imng_p->handle, MNG_CANVAS_RGBA8);
#endif
mng_setcb_openstream(imng_p->handle, il_mng_openstream);
mng_setcb_closestream(imng_p->handle, il_mng_closestream);
mng_setcb_readdata(imng_p->handle, il_mng_readdata);
@ -403,8 +404,7 @@ MNGDecoder::ImgDWrite(const unsigned char *buf, int32 len)
imng_p->bufferEnd += len;
if (imng_p->resumeNeeded) {
// dprintf((stderr, "MNG::ImgDWrite display_resume (%d)\n",
// imng_p->bytesBuffered));
// dprintf((stderr, "MNG::ImgDWrite display_resume\n"));
imng_p->resumeNeeded = PR_FALSE;
int ret = mng_display_resume(imng_p->handle);
if (ret == MNG_NEEDMOREDATA)