Update tree libmng to 1.0.1 rs=blizzard

This commit is contained in:
tor%cs.brown.edu 2001-05-20 17:36:25 +00:00
Родитель a8d9dd1b3c
Коммит 617fd78f26
41 изменённых файлов: 812 добавлений и 344 удалений

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

@ -76,7 +76,7 @@ dnl Set the version number of the libs included with mozilla
dnl ========================================================
MOZJPEG=62
MOZPNG=10009
MOZMNG="((0<<16)|(9<<8)|(4))"
MOZMNG="((1<<16)|(0<<8)|(1))"
NSPR_VERSION=4
dnl Set the minimum version of toolkit libs used by mozilla

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

@ -1,21 +1,36 @@
-----------------------------------------------------------
0.9.5 (... ..th 2001)
----------------------
1.0.1 (May 2nd 2001)
--------------------
in short:
intermediate
Maintenance release.
Fixed several memory-leaks with the help of Gregg Kelly, added/fixed some CMS
handling, exported JPEG functions from standard DLL, and some other minor fixes.
The CMS fix now makes libmng automagically work in MNG_FULL_CMS mode as a
sRGB compliant system. YOU WILL NEED TO CHANGE THIS IF YOU ARE NOT ON AN sRGB
COMPLIANT SYSTEM AND WANT TO USE CMS!!!!
(look in libmng.h for the proper function-calls)
-------------------
bugfixes:
B129681 - fixed compiler warnings SGI/Irix (thanks Dimitri)
core:
- fixed compiler-warnings Mozilla (thanks Tim)
- fixed timing-problem with switching framing_modes
- fixed some small compiler warnings (thanks Nikki)
- added MEND processing callback
- fixed first FRAM_MODE=4 timing problem
- added handle status-copy function (use with care)
- exported JPEG functions from standard DLL
- added BGRA8 canvas with premultiplied alpha (contrib by Gregg Kelly)
- fixed problem with display_reset/display_resume (Thanks Gregg!)
- fixed several memory-leaks (Thanks Gregg!)
- fixed reset_rundata to drop all objects (Thanks again, Gregg!)
- fixed problem with cms profile being created multiple times when both
iCCP & cHRM/gAMA are present (And again... Gregg)
- moved mng_clear_cms to libmng_cms
- added "default" sRGB generation (Thanks Marti!)
samples:
@ -29,6 +44,63 @@ autoconf:
-----------------------------------------------------------
1.0.0 (Feb 6th 2001)
--------------------
in short:
First public release. Finally(!)
This is the 0.9.5 CVS version, which will never be released, because I feel it
is now ready for a public release. So apart from the version-numbers here and
there, all other changes are listed under 0.9.5.
This library will work with every MNG/JNG known and available to me. Note that
there are still parts that need to be coded, and that MNG support is around
90-95% (JNG at 100%). It is however compliant with the latest and greatest
MNG 1.0 specification.
I hope to dedicate a bit more time this year to finish up full support and fill
in the remaining blanks. But this is coming out of my spare time. And extra
help is always appreciated.
Please enjoy!
Gerard
-----------------------------------------------------------
0.9.5 (no release)
------------------
in short:
intermediate CVS
-------------------
bugfixes:
B129681 - fixed compiler warnings SGI/Irix (thanks Dimitri)
core:
- fixed compiler-warnings Mozilla (thanks Tim)
- fixed timing-problem with switching framing_modes
- fixed some small compiler warnings (thanks Nikki)
samples:
contrib:
- fixed library-paths for MSVC DLL project (thanks Chad)
doc:
makefiles:
- added makefile for DJGPP (thanks Silvio)
autoconf:
-----------------------------------------------------------
0.9.4 (Jan 19th 2001)
----------------------

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

@ -2,7 +2,7 @@
/* * * */
/* * COPYRIGHT NOTICE: * */
/* * * */
/* * Copyright (c) 2000 Gerard Juyn (gerard@libmng.com) * */
/* * Copyright (c) 2000,2001 Gerard Juyn (gerard@libmng.com) * */
/* * [You may insert additional notices after this sentence if you modify * */
/* * this source] * */
/* * * */
@ -100,7 +100,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.5 * */
/* * version : 1.0.1 * */
/* * * */
/* * purpose : main application interface * */
/* * * */
@ -205,10 +205,20 @@
/* * 0.9.3 - 10/21/2000 - G.Juyn * */
/* * - added get function for interlace/progressive display * */
/* * * */
/* * 0.9.4 - 1/18/2001 - G.Juyn * */
/* * 0.9.4 - 01/18/2001 - G.Juyn * */
/* * - added errorcode for MAGN methods * */
/* * - removed test filter-methods 1 & 65 * */
/* * * */
/* * 1.0.0 - 02/05/2001 - G.Juyn * */
/* * - version numbers (obviously) * */
/* * * */
/* * 1.0.1 - 02/08/2001 - G.Juyn * */
/* * - added MEND processing callback * */
/* * 1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly) * */
/* * - added BGRA8 canvas with premultiplied alpha * */
/* * 1.0.1 - 05/02/2001 - G.Juyn * */
/* * - added "default" sRGB generation (Thanks Marti!) * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -347,12 +357,12 @@ extern "C" {
/* * * */
/* ************************************************************************** */
#define MNG_VERSION_TEXT "0.9.5"
#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 5
#define MNG_VERSION_TEXT "1.0.1"
#define MNG_VERSION_SO 1 /* eg. libmng.so.1 */
#define MNG_VERSION_DLL 1 /* but: libmng.dll (!) */
#define MNG_VERSION_MAJOR 1
#define MNG_VERSION_MINOR 0
#define MNG_VERSION_RELEASE 1
MNG_EXT mng_pchar MNG_DECL mng_version_text (void);
MNG_EXT mng_uint8 MNG_DECL mng_version_so (void);
@ -374,7 +384,7 @@ MNG_EXT mng_uint8 MNG_DECL mng_version_release (void);
#define MNG_MNG_VERSION "1.0"
#define MNG_MNG_VERSION_MAJ 1
#define MNG_MNG_VERSION_MIN 0
#define MNG_MNG_DRAFT 99
#define MNG_MNG_DRAFT 99 /* deprecated */
/* ************************************************************************** */
/* * * */
@ -536,6 +546,8 @@ 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_processmend (mng_handle hHandle,
mng_processmend fProc);
MNG_EXT mng_retcode MNG_DECL mng_setcb_processunknown(mng_handle hHandle,
mng_processunknown fProc);
#endif
@ -706,31 +718,69 @@ MNG_EXT mng_retcode MNG_DECL mng_set_storechunks (mng_handle hHandle,
MNG_EXT mng_retcode MNG_DECL mng_set_sectionbreaks (mng_handle hHandle,
mng_bool bSectionbreaks);
/* Color-management necessaties */
/* if you've defined MNG_FULL_CMS, you must specify the profile of the
output-device and the sRGB conditions */
/* if you're on a sRGB system (Linux (intel), Windows, etc.), you can
tell the CMS with mng_set_srgb and specify a default sRGB profile for
the output-device; otherwise you'll need to specify the correct profile
for your output-device and a default sRGB profile for input-images tagged
with the sRGB chunk only */
/* NOTE: either call set_srgb with MNG_TRUE & call set_outputprofile(2)
or call set_srgb with MNG_FALSE & call set_outputprofile(2) &
set_srgbprofile(2) */
/* BTW: the default for set_srgb is MNG_TRUE */
/* Color-management necessaries */
/*
*************************************************************************
!!!!!!!! THIS BIT IS IMPORTANT !!!!!!!!!
*************************************************************************
If you have defined MNG_FULL_CMS (and are using lcms), you will have to
think hard about the following routines.
lcms requires 2 profiles to work off the differences in the input-image
and the output-device. The ICC profile for the input-image will be
embedded within it to reflect its color-characteristics, but the output
profile depends on the output-device, which is something only *YOU* know
about. sRGB (standard RGB) is common for x86 compatible environments
(eg. Windows, Linux and some others)
If you are compiling for a sRGB compliant system you probably won't have
to do anything special. (unless you want to ofcourse)
If you are compiling for a non-sRGB compliant system
(eg. SGI, Mac, Next, others...)
you *MUST* define a proper ICC profile for the generic output-device
associated with that platform.
In either event, you may also want to offer an option to your users to
set the profile manually, or, if you know how, set it from a
system-defined default.
TO RECAP: for sRGB systems (Windows, Linux) no action required!
for non-sRGB systems (SGI, Mac, Next) ACTION REQUIRED!
Please visit http://www.srgb.com, http://www.color.org and
http://www.littlecms.com for more info.
*************************************************************************
!!!!!!!! THIS BIT IS IMPORTANT !!!!!!!!!
*************************************************************************
*/
/* mng_set_srgb tells libmng if it's running on a sRGB compliant system or not
the default is already set to MNG_TRUE */
/* mng_set_outputprofile, mng_set_outputprofile2, mng_set_outputsrgb
are used to set the default profile describing the output-device
by default it is already initialized with an sRGB profile */
/* mng_set_srgbprofile, mng_set_srgbprofile2, mng_set_srgbimplicit
are used to set the default profile describing a standard sRGB device
this is used when the input-image is tagged only as being sRGB, but the
output-device is defined as not being sRGB compliant
by default it is already initialized with a standard sRGB profile */
#if defined(MNG_SUPPORT_DISPLAY)
MNG_EXT mng_retcode MNG_DECL mng_set_srgb (mng_handle hHandle,
mng_bool bIssRGB);
MNG_EXT mng_retcode MNG_DECL mng_set_outputprofile (mng_handle hHandle,
mng_pchar zFilename);
MNG_EXT mng_retcode MNG_DECL mng_set_srgbprofile (mng_handle hHandle,
mng_pchar zFilename);
MNG_EXT mng_retcode MNG_DECL mng_set_outputprofile2 (mng_handle hHandle,
mng_uint32 iProfilesize,
mng_ptr pProfile);
MNG_EXT mng_retcode MNG_DECL mng_set_outputsrgb (mng_handle hHandle);
MNG_EXT mng_retcode MNG_DECL mng_set_srgbprofile (mng_handle hHandle,
mng_pchar zFilename);
MNG_EXT mng_retcode MNG_DECL mng_set_srgbprofile2 (mng_handle hHandle,
mng_uint32 iProfilesize,
mng_ptr pProfile);
MNG_EXT mng_retcode MNG_DECL mng_set_srgbimplicit (mng_handle hHandle);
#endif
/* Gamma settings */
@ -2071,6 +2121,7 @@ MNG_EXT mng_retcode MNG_DECL mng_updatemngsimplicity (mng_handle hHandle,
#define MNG_CANVAS_RGB8_A8 0x00005000L
#define MNG_CANVAS_BGR8 0x00000001L
#define MNG_CANVAS_BGRA8 0x00001001L
#define MNG_CANVAS_BGRA8PM 0x00009001L
#define MNG_CANVAS_ABGR8 0x00003001L
#define MNG_CANVAS_RGB16 0x00000100L /* not supported yet */
#define MNG_CANVAS_RGBA16 0x00001100L /* not supported yet */
@ -2092,6 +2143,7 @@ MNG_EXT mng_retcode MNG_DECL mng_updatemngsimplicity (mng_handle hHandle,
#define MNG_CANVAS_HASALPHA(C) (C & 0x00001000L)
#define MNG_CANVAS_ALPHAFIRST(C) (C & 0x00002000L)
#define MNG_CANVAS_ALPHASEPD(C) (C & 0x00004000L)
#define MNG_CANVAS_ALPHAPM(C) (C & 0x00008000L)
#define MNG_CANVAS_RGB(C) (MNG_CANVAS_PIXELTYPE (C) == 0)
#define MNG_CANVAS_BGR(C) (MNG_CANVAS_PIXELTYPE (C) == 1)

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_callback_xs.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.3 * */
/* * version : 1.0.1 * */
/* * * */
/* * purpose : callback get/set interface (implementation) * */
/* * * */
@ -37,6 +37,9 @@
/* * 0.9.3 - 10/17/2000 - G.Juyn * */
/* * - added callback to process non-critical unknown chunks * */
/* * * */
/* * 1.0.1 - 02/08/2001 - G.Juyn * */
/* * - added MEND processing callback * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -328,6 +331,27 @@ mng_retcode MNG_DECL mng_setcb_processneed (mng_handle hHandle,
/* ************************************************************************** */
#ifdef MNG_SUPPORT_READ
mng_retcode MNG_DECL mng_setcb_processmend (mng_handle hHandle,
mng_processmend fProc)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSMEND, MNG_LC_START)
#endif
MNG_VALIDHANDLE (hHandle)
((mng_datap)hHandle)->fProcessmend = fProc;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSMEND, 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)
@ -829,6 +853,25 @@ mng_processneed MNG_DECL mng_getcb_processneed (mng_handle hHandle)
/* ************************************************************************** */
#ifdef MNG_SUPPORT_READ
mng_processmend MNG_DECL mng_getcb_processmend (mng_handle hHandle)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSMEND, MNG_LC_START)
#endif
MNG_VALIDHANDLEX (hHandle)
#ifdef MNG_SUPPORT_TRACE
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSMEND, MNG_LC_END)
#endif
return ((mng_datap)hHandle)->fProcessmend;
}
#endif /* MNG_SUPPORT_READ */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_READ
mng_processunknown MNG_DECL mng_getcb_processunknown (mng_handle hHandle)
{

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_chunk_io.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.5 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : Chunk I/O routines (implementation) * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_chunk_io.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.3 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : Chunk I/O routines (definition) * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_chunk_prc.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.3 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : Chunk initialization & cleanup (implementation) * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_chunk_prc.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.3 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : Chunk initialization & cleanup (definition) * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_chunk_xs.c copyright (c) 2000 G. Juyn * */
/* * version : 0.9.5 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : chunk access functions (implementation) * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_chunks.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.3 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : Chunk structures (definition) * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_cms.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.4 * */
/* * version : 1.0.1 * */
/* * * */
/* * purpose : color management routines (implementation) * */
/* * * */
@ -45,6 +45,16 @@
/* * 0.9.4 - 12/16/2000 - G.Juyn * */
/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */
/* * * */
/* * 1.0.1 - 03/31/2001 - G.Juyn * */
/* * - ignore gamma=0 (see png-list for more info) * */
/* * 1.0.1 - 04/25/2001 - G.Juyn (reported by Gregg Kelly) * */
/* * - fixed problem with cms profile being created multiple * */
/* * times when both iCCP & cHRM/gAMA are present * */
/* * 1.0.1 - 04/25/2001 - G.Juyn * */
/* * - moved mng_clear_cms to libmng_cms * */
/* * 1.0.1 - 05/02/2001 - G.Juyn * */
/* * - added "default" sRGB generation (Thanks Marti!) * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -99,6 +109,27 @@ mng_cmsprof mnglcms_creatememprofile (mng_uint32 iProfilesize,
/* ************************************************************************** */
mng_cmsprof mnglcms_createsrgbprofile (void)
{
cmsCIExyY D65;
cmsCIExyYTRIPLE Rec709Primaries = {
{0.6400, 0.3300, 1.0},
{0.3000, 0.6000, 1.0},
{0.1500, 0.0600, 1.0}
};
LPGAMMATABLE Gamma24[3];
mng_cmsprof hsRGB;
cmsWhitePointFromTemp(6504, &D65);
Gamma24[0] = Gamma24[1] = Gamma24[2] = cmsBuildGamma(256, 2.4);
hsRGB = cmsCreateRGBProfile(&D65, &Rec709Primaries, Gamma24);
cmsFreeGamma(Gamma24[0]);
return hsRGB;
}
/* ************************************************************************** */
void mnglcms_freeprofile (mng_cmsprof hProf)
{
cmsCloseProfile (hProf);
@ -117,6 +148,31 @@ void mnglcms_freetransform (mng_cmstrans hTrans)
/* ************************************************************************** */
mng_retcode mng_clear_cms (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_CLEAR_CMS, MNG_LC_START)
#endif
if (pData->hTrans) /* transformation still active ? */
mnglcms_freetransform (pData->hTrans);
pData->hTrans = 0;
if (pData->hProf1) /* file profile still active ? */
mnglcms_freeprofile (pData->hProf1);
pData->hProf1 = 0;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_CLEAR_CMS, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#endif /* MNG_INCLUDE_LCMS */
/* ************************************************************************** */
@ -145,8 +201,13 @@ mng_retcode init_full_cms (mng_datap pData)
if ((pBuf->bHasICCP) || (pData->bHasglobalICCP))
{
if (!pData->hProf2) /* output profile defined ? */
MNG_ERROR (pData, MNG_NOOUTPUTPROFILE);
if (!pData->hProf2) /* output profile not defined ? */
{ /* then assume sRGB !! */
pData->hProf2 = mnglcms_createsrgbprofile ();
if (!pData->hProf2) /* handle error ? */
MNG_ERRORL (pData, MNG_LCMS_NOHANDLE)
}
if (pBuf->bHasICCP) /* generate a profile handle */
hProf = cmsOpenProfileFromMem (pBuf->pProfile, pBuf->iProfilesize);
@ -176,7 +237,7 @@ mng_retcode init_full_cms (mng_datap pData)
return MNG_NOERROR; /* and done */
}
else
if ((pBuf->bHasSRGB) || (pData->bHasglobalSRGB))
{
mng_uint8 iIntent;
@ -184,8 +245,13 @@ mng_retcode init_full_cms (mng_datap pData)
if (pData->bIssRGB) /* sRGB system ? */
return MNG_NOERROR; /* no conversion required */
if (!pData->hProf3) /* sRGB profile defined ? */
MNG_ERROR (pData, MNG_NOSRGBPROFILE)
if (!pData->hProf3) /* sRGB profile not defined ? */
{ /* then create it implicitly !! */
pData->hProf3 = mnglcms_createsrgbprofile ();
if (!pData->hProf3) /* handle error ? */
MNG_ERRORL (pData, MNG_LCMS_NOHANDLE)
}
hProf = pData->hProf3; /* convert from sRGB profile */
@ -212,15 +278,24 @@ mng_retcode init_full_cms (mng_datap pData)
return MNG_NOERROR; /* and done */
}
else
if ( ((pBuf->bHasCHRM) || (pData->bHasglobalCHRM)) &&
((pBuf->bHasGAMA) || (pData->bHasglobalGAMA)) )
( ((pBuf->bHasGAMA) && (pBuf->iGamma > 0)) ||
((pData->bHasglobalGAMA) && (pData->iGlobalGamma > 0)) ))
{
mng_CIExyY sWhitepoint;
mng_CIExyYTRIPLE sPrimaries;
mng_gammatabp pGammatable[3];
mng_float dGamma;
if (!pData->hProf2) /* output profile not defined ? */
{ /* then assume sRGB !! */
pData->hProf2 = mnglcms_createsrgbprofile ();
if (!pData->hProf2) /* handle error ? */
MNG_ERRORL (pData, MNG_LCMS_NOHANDLE)
}
if (pBuf->bHasCHRM) /* local cHRM ? */
{
sWhitepoint.x = (mng_float)pBuf->iWhitepointx / 100000;
@ -323,9 +398,13 @@ mng_retcode init_full_cms_object (mng_datap pData)
if (pBuf->bHasICCP)
{
if (!pData->hProf2) /* output profile defined ? */
MNG_ERROR (pData, MNG_NOOUTPUTPROFILE);
if (!pData->hProf2) /* output profile not defined ? */
{ /* then assume sRGB !! */
pData->hProf2 = mnglcms_createsrgbprofile ();
if (!pData->hProf2) /* handle error ? */
MNG_ERRORL (pData, MNG_LCMS_NOHANDLE)
}
/* generate a profile handle */
hProf = cmsOpenProfileFromMem (pBuf->pProfile, pBuf->iProfilesize);
@ -352,14 +431,19 @@ mng_retcode init_full_cms_object (mng_datap pData)
return MNG_NOERROR; /* and done */
}
else
if (pBuf->bHasSRGB)
{
if (pData->bIssRGB) /* sRGB system ? */
return MNG_NOERROR; /* no conversion required */
if (!pData->hProf3) /* sRGB profile defined ? */
MNG_ERROR (pData, MNG_NOSRGBPROFILE)
if (!pData->hProf3) /* sRGB profile not defined ? */
{ /* then create it implicitly !! */
pData->hProf3 = mnglcms_createsrgbprofile ();
if (!pData->hProf3) /* handle error ? */
MNG_ERRORL (pData, MNG_LCMS_NOHANDLE)
}
hProf = pData->hProf3; /* convert from sRGB profile */
@ -381,14 +465,22 @@ mng_retcode init_full_cms_object (mng_datap pData)
return MNG_NOERROR; /* and done */
}
if ((pBuf->bHasCHRM) && (pBuf->bHasGAMA))
else
if ((pBuf->bHasCHRM) && (pBuf->bHasGAMA) && (pBuf->iGamma > 0))
{
mng_CIExyY sWhitepoint;
mng_CIExyYTRIPLE sPrimaries;
mng_gammatabp pGammatable[3];
mng_float dGamma;
if (!pData->hProf2) /* output profile not defined ? */
{ /* then assume sRGB !! */
pData->hProf2 = mnglcms_createsrgbprofile ();
if (!pData->hProf2) /* handle error ? */
MNG_ERRORL (pData, MNG_LCMS_NOHANDLE)
}
sWhitepoint.x = (mng_float)pBuf->iWhitepointx / 100000;
sWhitepoint.y = (mng_float)pBuf->iWhitepointy / 100000;
sPrimaries.Red.x = (mng_float)pBuf->iPrimaryredx / 100000;
@ -508,22 +600,24 @@ mng_retcode init_gamma_only (mng_datap pData)
else
dGamma = pData->dDfltimggamma;
if (dGamma) /* lets not divide by zero, shall we... */
if (dGamma > 0) /* ignore gamma=0 */
{
dGamma = pData->dViewgamma / (dGamma * pData->dDisplaygamma);
if (dGamma != pData->dLastgamma) /* lookup table needs to be computed ? */
{
mng_int32 iX;
if (dGamma != pData->dLastgamma) /* lookup table needs to be computed ? */
{
mng_int32 iX;
pData->aGammatab [0] = 0;
pData->aGammatab [0] = 0;
for (iX = 1; iX <= 255; iX++)
pData->aGammatab [iX] = (mng_uint8)(pow (iX / 255.0, dGamma) * 255 + 0.5);
for (iX = 1; iX <= 255; iX++)
pData->aGammatab [iX] = (mng_uint8)(pow (iX / 255.0, dGamma) * 255 + 0.5);
pData->dLastgamma = dGamma; /* keep for next time */
}
pData->dLastgamma = dGamma; /* keep for next time */
}
/* load color-correction routine */
pData->fCorrectrow = (mng_fptr)correct_gamma_only;
pData->fCorrectrow = (mng_fptr)correct_gamma_only;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_GAMMA_ONLY, MNG_LC_END)

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_cms.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 1.0.1 * */
/* * * */
/* * purpose : color management routines (definition) * */
/* * * */
@ -23,6 +23,11 @@
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 1.0.1 - 04/25/2001 - G.Juyn * */
/* * - moved mng_clear_cms to libmng_cms * */
/* * 1.0.1 - 05/02/2001 - G.Juyn * */
/* * - added "default" sRGB generation (Thanks Marti!) * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -39,8 +44,11 @@ void mnglcms_initlibrary (void);
mng_cmsprof mnglcms_createfileprofile (mng_pchar zFilename);
mng_cmsprof mnglcms_creatememprofile (mng_uint32 iProfilesize,
mng_ptr pProfile );
mng_cmsprof mnglcms_createsrgbprofile (void);
void mnglcms_freeprofile (mng_cmsprof hProf );
void mnglcms_freetransform (mng_cmstrans hTrans );
mng_retcode mng_clear_cms (mng_datap pData );
#endif
/* ************************************************************************** */

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

@ -2,7 +2,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_conf.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.3 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : main configuration file * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_data.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.3 * */
/* * version : 1.0.1 * */
/* * * */
/* * purpose : main data structure definition * */
/* * * */
@ -96,6 +96,11 @@
/* * 0.9.4 - 12/16/2000 - G.Juyn * */
/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */
/* * * */
/* * 1.0.1 - 02/08/2001 - G.Juyn * */
/* * - added MEND processing callback * */
/* * 1.0.1 - 02/13/2001 - G.Juyn * */
/* * - fixed first FRAM_MODE=4 timing problem * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -269,6 +274,7 @@ typedef struct mng_data_struct {
mng_processsave fProcesssave;
mng_processseek fProcessseek;
mng_processneed fProcessneed;
mng_processmend fProcessmend;
mng_processunknown fProcessunknown;
mng_getcanvasline fGetcanvasline;
mng_getbkgdline fGetbkgdline;
@ -385,6 +391,7 @@ typedef struct mng_data_struct {
#ifdef MNG_SUPPORT_DISPLAY
mng_bool bDisplaying; /* display-state variables */
mng_bool bFramedone;
mng_uint32 iFrameseq;
mng_uint32 iLayerseq;
mng_uint32 iFrametime; /* millisecs */
@ -414,6 +421,7 @@ typedef struct mng_data_struct {
mng_objectp pCurraniobj; /* current animation object
"to be"/"being" processed */
mng_objectp pTermaniobj; /* TERM animation object */
mng_uint32 iIterations; /* TERM/MEND iteration count */
mng_objectp pObjzero; /* "on-the-fly" image (object = 0) */
mng_objectp pLastclone; /* last clone */
mng_objectp pStoreobj; /* current store object for row routines */
@ -639,13 +647,13 @@ typedef struct mng_data_struct {
mng_bool bJPEGcompress; /* indicates "compress" initialized */
mng_bool bJPEGdecompress; /* indicates "decompress" ininitialized (JDAT) */
mng_bool bJPEGdecompress; /* indicates "decompress" initialized (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 bJPEGdecompress2; /* indicates "decompress" initialized (JDAA) */
mng_bool bJPEGhasheader2; /* indicates "readheader" succeeded (JDAA) */
mng_bool bJPEGdecostarted2; /* indicates "decompress" started (JDAA) */
mng_bool bJPEGscanstarted2; /* indicates "first scan" started (JDAA) */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_display.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.5 * */
/* * version : 1.0.1 * */
/* * * */
/* * purpose : Display management (implementation) * */
/* * * */
@ -134,6 +134,14 @@
/* * 0.9.5 - 1/23/2001 - G.Juyn * */
/* * - fixed timing-problem with switching framing_modes * */
/* * * */
/* * 1.0.1 - 02/08/2001 - G.Juyn * */
/* * - added MEND processing callback * */
/* * 1.0.1 - 02/13/2001 - G.Juyn * */
/* * - fixed first FRAM_MODE=4 timing problem * */
/* * 1.0.1 - 04/21/2001 - G.Juyn * */
/* * - fixed memory-leak for JNGs with alpha (Thanks Gregg!) * */
/* * - added BGRA8 canvas with premultiplied alpha * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -332,30 +340,31 @@ void set_display_routine (mng_datap pData)
{
switch (pData->iCanvasstyle) /* determine display routine */
{
case MNG_CANVAS_RGB8 : { pData->fDisplayrow = (mng_fptr)display_rgb8; break; }
case MNG_CANVAS_RGBA8 : { pData->fDisplayrow = (mng_fptr)display_rgba8; break; }
case MNG_CANVAS_ARGB8 : { pData->fDisplayrow = (mng_fptr)display_argb8; break; }
case MNG_CANVAS_RGB8_A8 : { pData->fDisplayrow = (mng_fptr)display_rgb8_a8; break; }
case MNG_CANVAS_BGR8 : { pData->fDisplayrow = (mng_fptr)display_bgr8; break; }
case MNG_CANVAS_BGRA8 : { pData->fDisplayrow = (mng_fptr)display_bgra8; break; }
case MNG_CANVAS_ABGR8 : { pData->fDisplayrow = (mng_fptr)display_abgr8; break; }
/* case MNG_CANVAS_RGB16 : { pData->fDisplayrow = (mng_fptr)display_rgb16; break; } */
/* case MNG_CANVAS_RGBA16 : { pData->fDisplayrow = (mng_fptr)display_rgba16; break; } */
/* case MNG_CANVAS_ARGB16 : { pData->fDisplayrow = (mng_fptr)display_argb16; break; } */
/* case MNG_CANVAS_BGR16 : { pData->fDisplayrow = (mng_fptr)display_bgr16; break; } */
/* case MNG_CANVAS_BGRA16 : { pData->fDisplayrow = (mng_fptr)display_bgra16; break; } */
/* case MNG_CANVAS_ABGR16 : { pData->fDisplayrow = (mng_fptr)display_abgr16; break; } */
/* case MNG_CANVAS_INDEX8 : { pData->fDisplayrow = (mng_fptr)display_index8; break; } */
/* case MNG_CANVAS_INDEXA8 : { pData->fDisplayrow = (mng_fptr)display_indexa8; break; } */
/* case MNG_CANVAS_AINDEX8 : { pData->fDisplayrow = (mng_fptr)display_aindex8; break; } */
/* case MNG_CANVAS_GRAY8 : { pData->fDisplayrow = (mng_fptr)display_gray8; break; } */
/* case MNG_CANVAS_GRAY16 : { pData->fDisplayrow = (mng_fptr)display_gray16; break; } */
/* case MNG_CANVAS_GRAYA8 : { pData->fDisplayrow = (mng_fptr)display_graya8; break; } */
/* case MNG_CANVAS_GRAYA16 : { pData->fDisplayrow = (mng_fptr)display_graya16; break; } */
/* case MNG_CANVAS_AGRAY8 : { pData->fDisplayrow = (mng_fptr)display_agray8; break; } */
/* case MNG_CANVAS_AGRAY16 : { pData->fDisplayrow = (mng_fptr)display_agray16; break; } */
/* case MNG_CANVAS_DX15 : { pData->fDisplayrow = (mng_fptr)display_dx15; break; } */
/* case MNG_CANVAS_DX16 : { pData->fDisplayrow = (mng_fptr)display_dx16; break; } */
case MNG_CANVAS_RGB8 : { pData->fDisplayrow = (mng_fptr)display_rgb8; break; }
case MNG_CANVAS_RGBA8 : { pData->fDisplayrow = (mng_fptr)display_rgba8; break; }
case MNG_CANVAS_ARGB8 : { pData->fDisplayrow = (mng_fptr)display_argb8; break; }
case MNG_CANVAS_RGB8_A8 : { pData->fDisplayrow = (mng_fptr)display_rgb8_a8; break; }
case MNG_CANVAS_BGR8 : { pData->fDisplayrow = (mng_fptr)display_bgr8; break; }
case MNG_CANVAS_BGRA8 : { pData->fDisplayrow = (mng_fptr)display_bgra8; break; }
case MNG_CANVAS_BGRA8PM : { pData->fDisplayrow = (mng_fptr)display_bgra8_pm; break; }
case MNG_CANVAS_ABGR8 : { pData->fDisplayrow = (mng_fptr)display_abgr8; break; }
/* case MNG_CANVAS_RGB16 : { pData->fDisplayrow = (mng_fptr)display_rgb16; break; } */
/* case MNG_CANVAS_RGBA16 : { pData->fDisplayrow = (mng_fptr)display_rgba16; break; } */
/* case MNG_CANVAS_ARGB16 : { pData->fDisplayrow = (mng_fptr)display_argb16; break; } */
/* case MNG_CANVAS_BGR16 : { pData->fDisplayrow = (mng_fptr)display_bgr16; break; } */
/* case MNG_CANVAS_BGRA16 : { pData->fDisplayrow = (mng_fptr)display_bgra16; break; } */
/* case MNG_CANVAS_ABGR16 : { pData->fDisplayrow = (mng_fptr)display_abgr16; break; } */
/* case MNG_CANVAS_INDEX8 : { pData->fDisplayrow = (mng_fptr)display_index8; break; } */
/* case MNG_CANVAS_INDEXA8 : { pData->fDisplayrow = (mng_fptr)display_indexa8; break; } */
/* case MNG_CANVAS_AINDEX8 : { pData->fDisplayrow = (mng_fptr)display_aindex8; break; } */
/* case MNG_CANVAS_GRAY8 : { pData->fDisplayrow = (mng_fptr)display_gray8; break; } */
/* case MNG_CANVAS_GRAY16 : { pData->fDisplayrow = (mng_fptr)display_gray16; break; } */
/* case MNG_CANVAS_GRAYA8 : { pData->fDisplayrow = (mng_fptr)display_graya8; break; } */
/* case MNG_CANVAS_GRAYA16 : { pData->fDisplayrow = (mng_fptr)display_graya16; break; } */
/* case MNG_CANVAS_AGRAY8 : { pData->fDisplayrow = (mng_fptr)display_agray8; break; } */
/* case MNG_CANVAS_AGRAY16 : { pData->fDisplayrow = (mng_fptr)display_agray16; break; } */
/* case MNG_CANVAS_DX15 : { pData->fDisplayrow = (mng_fptr)display_dx15; break; } */
/* case MNG_CANVAS_DX16 : { pData->fDisplayrow = (mng_fptr)display_dx16; break; } */
}
}
@ -624,8 +633,8 @@ mng_retcode next_frame (mng_datap pData,
pData->iFramedelay = pData->iNextdelay;
}
else
{
if (iFramemode == 4) /* delay before inserting background layer? */
{ /* delay before inserting background layer? */
if ((pData->bFramedone) && (iFramemode == 4))
iRetcode = interframe_delay (pData);
}
@ -645,7 +654,8 @@ mng_retcode next_frame (mng_datap pData,
pData->iNextdelay = iDelay; /* for *after* next subframe */
if ((iOldmode == 2) || (iOldmode == 4))
pData->iFramedelay = iDelay;
/* pData->iFramedelay = iDelay; */
pData->iFramedelay = pData->iFRAMdelay;
if (iChangedelay == 2) /* also overall ? */
pData->iFRAMdelay = iDelay;
@ -730,8 +740,10 @@ mng_retcode next_frame (mng_datap pData,
return iRetcode;
if ((pData->bDisplaying) && (pData->bRunning))
{
pData->iFrameseq++; /* count the frame ! */
pData->bFramedone = MNG_TRUE; /* and indicate we've done one */
}
}
#ifdef MNG_SUPPORT_TRACE
@ -1056,6 +1068,13 @@ mng_retcode display_image (mng_datap pData,
if (iRetcode) /* on error bail out */
return iRetcode;
#if defined(MNG_INCLUDE_LCMS) /* cleanup cms stuff */
iRetcode = mng_clear_cms (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
#endif
}
}
}
@ -1552,6 +1571,8 @@ mng_retcode restore_state (mng_datap pData)
if (iRetcode) /* on error bail out */
return iRetcode;
/* fresh cycle; fake no frames done yet */
pData->bFramedone = MNG_FALSE;
if (pData->pSavedata) /* do we have a saved state ? */
{
@ -2220,14 +2241,16 @@ mng_retcode process_display_idat (mng_datap pData,
pData->iLayerseq++; /* and it counts as a layer then ! */
}
if (!pData->bInflating) /* if we're not inflating already */
{ /* initialize row-processing */
if (pData->fInitrowproc) /* need to initialize row processing? */
{
iRetcode = ((mng_initrowproc)pData->fInitrowproc) (pData);
if (!iRetcode) /* initialize inflate */
iRetcode = mngzlib_inflateinit (pData);
pData->fInitrowproc = MNG_NULL; /* only call this once !!! */
}
if ((!iRetcode) && (!pData->bInflating))
/* initialize inflate */
iRetcode = mngzlib_inflateinit (pData);
if (!iRetcode) /* all ok? then inflate, my man */
iRetcode = mngzlib_inflaterows (pData, iRawlen, pRawdata);
@ -2411,6 +2434,8 @@ mng_retcode process_display_mend (mng_datap pData)
/* get the right animation object ! */
pTERM = (mng_ani_termp)pData->pTermaniobj;
pData->iIterations++; /* increase iteration count */
switch (pTERM->iTermaction) /* determine what to do! */
{
case 0 : { /* show last frame indefinitly */
@ -2440,6 +2465,15 @@ mng_retcode process_display_mend (mng_datap pData)
if (iRetcode) /* on error bail out */
return iRetcode;
/* notify the app ? */
if (pData->fProcessmend)
{
mng_bool bOke = pData->fProcessmend ((mng_handle)pData,
pData->iIterations,
pTERM->iItermax);
if (!bOke) /* stop here and now ? */
break;
}
/* restart from TERM chunk */
pData->pCurraniobj = pTERM;
@ -3718,7 +3752,9 @@ mng_retcode process_display_jhdr (mng_datap pData)
}
if (!pData->bTimerset) /* no timer break ? */
{
{ /* default row initialization ! */
pData->fInitrowproc = (mng_fptr)init_rowproc;
if ((!pData->bHasDHDR) || (pData->iDeltatype == MNG_DELTATYPE_REPLACE))
{ /* 8-bit JPEG ? */
if (pData->iJHDRimgbitdepth == 8)
@ -3862,10 +3898,11 @@ mng_retcode process_display_jdaa (mng_datap pData,
if (!pData->bJPEGdecompress2) /* if we're not decompressing already */
{
if (pData->fInitrowproc) /* initialize row-processing */
if (pData->fInitrowproc) /* initialize row-processing? */
{
iRetcode = ((mng_initrowproc)pData->fInitrowproc) (pData);
else
iRetcode = init_rowproc (pData); /* this still if no alpha present ! */
pData->fInitrowproc = MNG_NULL; /* only call this once !!! */
}
if (!iRetcode) /* initialize decompress */
iRetcode = mngjpeg_decompressinit2 (pData);
@ -3874,11 +3911,14 @@ mng_retcode process_display_jdaa (mng_datap pData,
if (!iRetcode) /* all ok? then decompress, my man */
iRetcode = mngjpeg_decompressdata2 (pData, iRawlen, pRawdata);
if (iRetcode)
return iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JDAA, MNG_LC_END)
#endif
return iRetcode;
return MNG_NOERROR;
}
#endif /* MNG_INCLUDE_JNG */
@ -3909,10 +3949,11 @@ mng_retcode process_display_jdat (mng_datap pData,
if (!pData->bJPEGdecompress) /* if we're not decompressing already */
{
if (pData->fInitrowproc) /* initialize row-processing */
if (pData->fInitrowproc) /* initialize row-processing? */
{
iRetcode = ((mng_initrowproc)pData->fInitrowproc) (pData);
else
iRetcode = init_rowproc (pData); /* this still if no alpha present ! */
pData->fInitrowproc = MNG_NULL; /* only call this once !!! */
}
if (!iRetcode) /* initialize decompress */
iRetcode = mngjpeg_decompressinit (pData);
@ -3921,11 +3962,14 @@ mng_retcode process_display_jdat (mng_datap pData,
if (!iRetcode) /* all ok? then decompress, my man */
iRetcode = mngjpeg_decompressdata (pData, iRawlen, pRawdata);
if (iRetcode)
return iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JDAT, MNG_LC_END)
#endif
return iRetcode;
return MNG_NOERROR;
}
#endif /* MNG_INCLUDE_JNG */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_display.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.4 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : Display management (definition) * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_dither.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : Dithering routines (implementation) * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_dither.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : Dithering routines (definition) * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_error.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.4 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : Error routines (implementation) * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_error.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : Error functions (definition) * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_filter.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.3 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : Filtering routines (implementation) * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_filter.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.3 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : Filtering routines (definition) * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_hlapi.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.4 * */
/* * version : 1.0.1 * */
/* * * */
/* * purpose : high-level application API (implementation) * */
/* * * */
@ -115,6 +115,19 @@
/* * 0.9.4 - 11/24/2000 - G.Juyn * */
/* * - moved restore of object 0 to libmng_display * */
/* * * */
/* * 1.0.1 - 02/08/2001 - G.Juyn * */
/* * - added MEND processing callback * */
/* * 1.0.1 - 02/13/2001 - G.Juyn * */
/* * - fixed first FRAM_MODE=4 timing problem * */
/* * 1.0.1 - 04/21/2001 - G.Juyn * */
/* * - fixed bug with display_reset/display_resume (Thanks G!) * */
/* * 1.0.1 - 04/22/2001 - G.Juyn * */
/* * - fixed memory-leak (Thanks Gregg!) * */
/* * 1.0.1 - 04/23/2001 - G.Juyn * */
/* * - fixed reset_rundata to drop all objects * */
/* * 1.0.1 - 04/25/2001 - G.Juyn * */
/* * - moved mng_clear_cms to libmng_cms * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -146,33 +159,6 @@
/* * * */
/* ************************************************************************** */
#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_INCLUDE_LCMS)
mng_retcode mng_clear_cms (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_CLEAR_CMS, MNG_LC_START)
#endif
if (pData->hTrans) /* transformation still active ? */
mnglcms_freetransform (pData->hTrans);
pData->hTrans = 0;
if (pData->hProf1) /* file profile still active ? */
mnglcms_freeprofile (pData->hProf1);
pData->hProf1 = 0;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_CLEAR_CMS, MNG_LC_END)
#endif
return MNG_NOERROR;
}
#endif /* MNG_SUPPORT_DISPLAY && MNG_INCLUDE_LCMS */
/* ************************************************************************** */
#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
mng_retcode mng_drop_chunks (mng_datap pData)
{
@ -230,6 +216,8 @@ mng_retcode mng_drop_objects (mng_datap pData,
pObject = pNext; /* neeeext */
}
pData->pFirstimgobj = MNG_NULL; /* clean this up!!! */
if (bDropaniobj) /* drop animation objects ? */
{
pObject = pData->pFirstaniobj; /* get first stored animation-object (if any) */
@ -243,6 +231,8 @@ mng_retcode mng_drop_objects (mng_datap pData,
pObject = pNext; /* neeeext */
}
pData->pFirstaniobj = MNG_NULL; /* clean this up!!! */
}
#ifdef MNG_SUPPORT_TRACE
@ -286,12 +276,19 @@ mng_retcode mng_drop_savedata (mng_datap pData)
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_drop_savedata (pData); /* drop stored savedata */
mng_reset_objzero (pData); /* reset object 0 */
/* drop stored objects (if any) */
mng_drop_objects (pData, MNG_FALSE);
pData->bFramedone = MNG_FALSE;
pData->iFrameseq = 0; /* reset counters & stuff */
pData->iLayerseq = 0;
pData->iFrametime = 0;
pData->iRequestframe = 0;
pData->iRequestlayer = 0;
pData->iRequesttime = 0;
pData->bSearching = MNG_FALSE;
pData->iRuntime = 0;
pData->iSynctime = 0;
@ -305,6 +302,10 @@ mng_retcode mng_reset_rundata (mng_datap pData)
pData->bResetting = MNG_FALSE;
pData->bNeedrefresh = MNG_FALSE;
pData->iIterations = 0;
/* start of animation objects! */
pData->pCurraniobj = MNG_NULL;
pData->iUpdateleft = 0; /* reset region */
pData->iUpdateright = 0;
pData->iUpdatetop = 0;
@ -1001,63 +1002,24 @@ mng_retcode MNG_DECL mng_cleanup (mng_handle* hHandle)
MNG_VALIDHANDLE (*hHandle) /* check validity handle */
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 /* cleanup default write buffers */
MNG_FREE (pData, pData->pWritebuf, pData->iWritebufsize)
#endif
mng_reset (*hHandle); /* do an implicit reset to cleanup most stuff */
#ifdef MNG_SUPPORT_DISPLAY /* drop object 0 */
free_imageobject (pData, (mng_imagep)pData->pObjzero);
#endif
#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_INCLUDE_LCMS)
mng_clear_cms (pData); /* cleanup left-over cms stuff if any */
if (pData->hProf2) /* output profile defined ? */
mnglcms_freeprofile (pData->hProf2);
if (pData->hProf3) /* sRGB profile defined ? */
mnglcms_freeprofile (pData->hProf3);
#endif /* MNG_SUPPORT_DISPLAY && MNG_INCLUDE_LCMS */
#ifdef MNG_INCLUDE_JNG
mngjpeg_cleanup (pData); /* cleanup jpeg stuff */
#endif
#ifdef MNG_INCLUDE_ZLIB
if (pData->bInflating) /* if we've been inflating */
{
#ifdef MNG_INCLUDE_DISPLAY_PROCS
cleanup_rowproc (pData); /* cleanup row-processing, */
#endif
mngzlib_inflatefree (pData); /* cleanup inflate! */
}
#endif /* MNG_INCLUDE_ZLIB */
#ifdef MNG_INCLUDE_ZLIB
mngzlib_cleanup (pData); /* cleanup zlib stuff */
#endif
#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
mng_drop_chunks (pData); /* drop stored chunks (if any) */
#endif
#ifdef MNG_SUPPORT_DISPLAY
mng_drop_objects (pData, MNG_TRUE); /* drop stored objects (if any) */
if (pData->iGlobalProfilesize) /* drop global profile (if any) */
MNG_FREEX (pData, pData->pGlobalProfile, pData->iGlobalProfilesize)
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)*hHandle), MNG_FN_CLEANUP, MNG_LC_CLEANUP)
#endif
@ -1543,34 +1505,18 @@ mng_retcode MNG_DECL mng_display_resume (mng_handle hHandle)
iRetcode = MNG_NEEDSECTIONWAIT;
else
{ /* no breaks = end of run */
pData->bRunning = MNG_FALSE;
pData->bRunning = MNG_FALSE;
if (pData->bFreezing) /* trying to freeze ? */
{ /* then we're there ! */
pData->bFreezing = MNG_FALSE;
pData->bFreezing = MNG_FALSE;
}
if (pData->bResetting) /* trying to reset as well ? */
{ /* full stop!!! */
pData->bDisplaying = MNG_FALSE;
pData->bTimerset = MNG_FALSE;
pData->iBreakpoint = 0;
pData->bSectionwait = MNG_FALSE;
pData->bFreezing = MNG_FALSE;
pData->bResetting = MNG_FALSE;
pData->pCurraniobj = MNG_NULL;
pData->iFrameseq = 0; /* reset all display-state variables */
pData->iLayerseq = 0;
pData->iFrametime = 0;
pData->iRequestframe = 0;
pData->iRequestlayer = 0;
pData->iRequesttime = 0;
pData->bSearching = MNG_FALSE;
/* drop all display objects */
iRetcode = mng_drop_objects (pData, MNG_FALSE);
pData->bDisplaying = MNG_FALSE;
if (!iRetcode) /* drop the savebuffer */
iRetcode = mng_drop_savedata (pData);
iRetcode = mng_reset_rundata (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
@ -1655,27 +1601,10 @@ mng_retcode MNG_DECL mng_display_reset (mng_handle hHandle)
return iRetcode;
}
else
{
pData->bDisplaying = MNG_FALSE; /* full stop!!! */
pData->bRunning = MNG_FALSE;
pData->bTimerset = MNG_FALSE;
pData->iBreakpoint = 0;
pData->bSectionwait = MNG_FALSE;
pData->bFreezing = MNG_FALSE;
pData->bResetting = MNG_FALSE;
pData->pCurraniobj = MNG_NULL;
pData->iFrameseq = 0; /* reset all display-state variables */
pData->iLayerseq = 0;
pData->iFrametime = 0;
pData->iRequestframe = 0;
pData->iRequestlayer = 0;
pData->iRequesttime = 0;
pData->bSearching = MNG_FALSE;
/* drop all display objects */
iRetcode = mng_drop_objects (pData, MNG_FALSE);
{ /* full stop!!! */
pData->bDisplaying = MNG_FALSE;
if (!iRetcode) /* drop the savebuffer */
iRetcode = mng_drop_savedata (pData);
iRetcode = mng_reset_rundata (pData);
if (iRetcode) /* on error bail out */
return iRetcode;

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_jpeg.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.3 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : JPEG library interface (implementation) * */
/* * * */
@ -34,6 +34,11 @@
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
/* * - added support for JDAA * */
/* * * */
/* * 1.0.1 - 04/19/2001 - G.Juyn * */
/* * - added export of JPEG functions for DLL * */
/* * 1.0.1 - 04/22/2001 - G.Juyn * */
/* * - fixed memory-leaks (Thanks Gregg!) * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -66,7 +71,7 @@
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
void mng_init_source (j_decompress_ptr cinfo)
void MNG_DECL mng_init_source (j_decompress_ptr cinfo)
{
return; /* nothing needed */
}
@ -75,7 +80,7 @@ void mng_init_source (j_decompress_ptr cinfo)
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
boolean mng_fill_input_buffer (j_decompress_ptr cinfo)
boolean MNG_DECL mng_fill_input_buffer (j_decompress_ptr cinfo)
{
return FALSE; /* force IJG routine to return to caller */
}
@ -84,7 +89,7 @@ boolean mng_fill_input_buffer (j_decompress_ptr cinfo)
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
void mng_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
void MNG_DECL mng_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
{
if (num_bytes > 0) /* ignore fony calls */
{ /* address my generic structure */
@ -113,7 +118,7 @@ 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)
void MNG_DECL mng_skip_input_data2 (j_decompress_ptr cinfo, long num_bytes)
{
if (num_bytes > 0) /* ignore fony calls */
{ /* address my generic structure */
@ -142,7 +147,7 @@ void mng_skip_input_data2 (j_decompress_ptr cinfo, long num_bytes)
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
void mng_term_source (j_decompress_ptr cinfo)
void MNG_DECL mng_term_source (j_decompress_ptr cinfo)
{
return; /* nothing needed */
}
@ -151,7 +156,7 @@ void mng_term_source (j_decompress_ptr cinfo)
/* ************************************************************************** */
#ifdef MNG_USE_SETJMP
void mng_error_exit (j_common_ptr cinfo)
void MNG_DECL mng_error_exit (j_common_ptr cinfo)
{ /* address my generic structure */
mng_datap pData = (mng_datap)cinfo->client_data;
@ -166,7 +171,7 @@ void mng_error_exit (j_common_ptr cinfo)
/* ************************************************************************** */
#ifdef MNG_USE_SETJMP
void mng_output_message (j_common_ptr cinfo)
void MNG_DECL mng_output_message (j_common_ptr cinfo)
{
return; /* just do nothing ! */
}
@ -216,12 +221,18 @@ mng_retcode mngjpeg_initialize (mng_datap pData)
/* enable reverse addressing */
pData->pJPEGcinfo->client_data = pData;
#endif
/* 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)
if (pData->pJPEGbuf == MNG_NULL) /* initialize temporary buffers */
{
pData->iJPEGbufmax = MNG_JPEG_MAXBUF;
MNG_ALLOC (pData, pData->pJPEGbuf, pData->iJPEGbufmax)
}
if (pData->pJPEGbuf2 == MNG_NULL)
{
pData->iJPEGbufmax2 = MNG_JPEG_MAXBUF;
MNG_ALLOC (pData, pData->pJPEGbuf2, pData->iJPEGbufmax2)
}
pData->pJPEGcurrent = pData->pJPEGbuf;
pData->iJPEGbufremain = 0;
@ -292,9 +303,14 @@ mng_retcode mngjpeg_cleanup (mng_datap pData)
#endif /* MNG_INCLUDE_IJG6B */
/* cleanup temporary buffers */
MNG_FREE (pData, pData->pJPEGbuf, pData->iJPEGbufmax)
MNG_FREE (pData, pData->pJPEGbuf2, pData->iJPEGbufmax2)
MNG_FREE (pData, pData->pJPEGbuf, pData->iJPEGbufmax)
/* cleanup space for JPEG structures */
#ifdef MNG_INCLUDE_JNG_WRITE
MNG_FREE (pData, pData->pJPEGcinfo, sizeof (mngjpeg_comp ))
MNG_FREE (pData, pData->pJPEGcerr, sizeof (mngjpeg_error ))
#endif
#ifdef MNG_INCLUDE_JNG_READ
MNG_FREE (pData, pData->pJPEGdinfo, sizeof (mngjpeg_decomp))
MNG_FREE (pData, pData->pJPEGdsrc, sizeof (mngjpeg_source))
@ -304,13 +320,8 @@ mng_retcode mngjpeg_cleanup (mng_datap pData)
MNG_FREE (pData, pData->pJPEGderr2, sizeof (mngjpeg_error ))
#endif
#ifdef MNG_INCLUDE_JNG_WRITE
MNG_FREE (pData, pData->pJPEGcinfo, sizeof (mngjpeg_comp ))
MNG_FREE (pData, pData->pJPEGcerr, sizeof (mngjpeg_error ))
#endif
MNG_FREE (pData, pData->pJPEGrow, pData->iJPEGrowlen)
MNG_FREE (pData, pData->pJPEGrow2, pData->iJPEGrowlen2)
MNG_FREE (pData, pData->pJPEGrow, pData->iJPEGrowlen)
/* whatever we were doing ... */
/* we don't anymore ... */
pData->bJPEGcompress = MNG_FALSE;
@ -656,6 +667,8 @@ mng_retcode mngjpeg_decompressfree (mng_datap pData)
if (iRetcode != 0) /* got here from longjmp ? */
MNG_ERRORJ (pData, iRetcode) /* then IJG-lib issued an error */
#endif
/* free the row of JPEG-samples*/
MNG_FREE (pData, pData->pJPEGrow, pData->iJPEGrowlen)
/* release the JPEG decompression object */
#ifdef MNG_SUPPORT_TRACE
@ -990,6 +1003,8 @@ mng_retcode mngjpeg_decompressfree2 (mng_datap pData)
if (iRetcode != 0) /* got here from longjmp ? */
MNG_ERRORJ (pData, iRetcode) /* then IJG-lib issued an error */
#endif
/* free the row of JPEG-samples*/
MNG_FREE (pData, pData->pJPEGrow2, pData->iJPEGrowlen2)
/* release the JPEG decompression object */
#ifdef MNG_SUPPORT_TRACE

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_jpeg.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : JPEG library interface (definition) * */
/* * * */

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

@ -1,66 +0,0 @@
/* ************************************************************************** */
/* * For conditions of distribution and use, * */
/* * see copyright notice in libmng.h * */
/* ************************************************************************** */
/* * * */
/* * project : libmng * */
/* * file : libmng_memory.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * * */
/* * purpose : Memory management (definition) * */
/* * * */
/* * author : G.Juyn * */
/* * web : http://www.3-t.com * */
/* * email : mailto:info@3-t.com * */
/* * * */
/* * comment : Definition of memory management functions * */
/* * * */
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
/* * - changed strict-ANSI stuff * */
/* * * */
/* * 0.5.3 - 06/12/2000 - G.Juyn * */
/* * - swapped MNG_COPY parameter-names * */
/* * 0.5.3 - 06/27/2000 - G.Juyn * */
/* * - changed size parameter to mng_size_t * */
/* * * */
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
#pragma option -A /* force ANSI-C */
#endif
#ifndef _libmng_memory_h_
#define _libmng_memory_h_
/* ************************************************************************** */
/* * * */
/* * Generic memory manager macros * */
/* * * */
/* ************************************************************************** */
#ifdef MNG_INTERNAL_MEMMNGMT
#define MNG_ALLOC(H,P,L) { P = calloc (1, (mng_size_t)(L)); \
if (P == 0) { MNG_ERROR (H, MNG_OUTOFMEMORY) } }
#define MNG_ALLOCX(H,P,L) { P = calloc (1, (mng_size_t)(L)); }
#define MNG_FREE(H,P,L) { if (P) { free (P); P = 0; } }
#define MNG_FREEX(H,P,L) { if (P) free (P); }
#else
#define MNG_ALLOC(H,P,L) { P = H->fMemalloc ((mng_size_t)(L)); \
if (P == 0) { MNG_ERROR (H, MNG_OUTOFMEMORY) } }
#define MNG_ALLOCX(H,P,L) { P = H->fMemalloc ((mng_size_t)(L)); }
#define MNG_FREE(H,P,L) { if (P) { H->fMemfree (P, (mng_size_t)(L)); P = 0; } }
#define MNG_FREEX(H,P,L) { if (P) { H->fMemfree (P, (mng_size_t)(L)); } }
#endif /* mng_internal_memmngmt */
#define MNG_COPY(D,S,L) { memcpy (D, S, (mng_size_t)(L)); }
/* ************************************************************************** */
#endif /* _libmng_memory_h_ */
/* ************************************************************************** */
/* * end of file * */
/* ************************************************************************** */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_object_prc.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.5 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : Object processing routines (implementation) * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_object_prc.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.3 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : Object processing routines (definition) * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_objects.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.3 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : Internal object structures (definition) * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_pixels.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.4 * */
/* * version : 1.0.1 * */
/* * * */
/* * purpose : Pixel-row management routines (implementation) * */
/* * * */
@ -94,6 +94,11 @@
/* * - added "new" MAGN methods 3, 4 & 5 * */
/* * - removed test filter-methods 1 & 65 * */
/* * * */
/* * 1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly) * */
/* * - added BGRA8 canvas with premultiplied alpha * */
/* * 1.0.1 - 04/25/2001 - G.Juyn * */
/* * - moved mng_clear_cms to libmng_cms * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -209,6 +214,12 @@ mng_uint32 const interlace_divider [7] = { 3, 3, 2, 2, 1, 1, 0 };
(BC) = (mng_uint16)((S * (mng_uint32)(BT) + \
T * (mng_uint32)(BB) + (mng_uint32)32767) >> 16); }
/* ************************************************************************** */
/* note a good optimizing compiler will optimize this */
#define DIV255B8(x) (mng_uint8)(((x) + 127) / 255)
#define DIV255B16(x) (mng_uint16)(((x) + 32767) / 65535)
/* ************************************************************************** */
/* * * */
/* * Progressive display check - checks to see if progressive display is * */
@ -1297,6 +1308,159 @@ mng_retcode display_bgra8 (mng_datap pData)
/* ************************************************************************** */
mng_retcode display_bgra8_pm (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint32 s, t;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8PM, MNG_LC_START)
#endif
/* viewable row ? */
if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb))
{ /* address destination row */
pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData),
pData->iRow + pData->iDestt -
pData->iSourcet);
/* adjust destination row starting-point */
pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2);
pDataline = pData->pRGBArow; /* address source row */
if (pData->bIsRGBA16) /* adjust source row starting-point */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3);
else
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2);
if (pData->bIsOpaque) /* forget about transparency ? */
{
if (pData->bIsRGBA16) /* 16-bit input row ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* scale down by dropping the LSB */
if ((s = pDataline[6]) == 0)
*(mng_uint32*) pScanline = 0; /* set all components = 0 */
else
{
if (s == 255)
{
pScanline[0] = pDataline[4];
pScanline[1] = pDataline[2];
pScanline[2] = pDataline[0];
pScanline[3] = 255;
}
else
{
pScanline[0] = DIV255B8(s * pDataline[4]);
pScanline[1] = DIV255B8(s * pDataline[2]);
pScanline[2] = DIV255B8(s * pDataline[0]);
pScanline[3] = (mng_uint8)s;
}
}
pScanline += (pData->iColinc << 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* copy the values and premultiply */
if ((s = pDataline[3]) == 0)
*(mng_uint32*) pScanline = 0; /* set all components = 0 */
else
{
if (s == 255)
{
pScanline[0] = pDataline[2];
pScanline[1] = pDataline[1];
pScanline[2] = pDataline[0];
pScanline[3] = 255;
}
else
{
pScanline[0] = DIV255B8(s * pDataline[2]);
pScanline[1] = DIV255B8(s * pDataline[1]);
pScanline[2] = DIV255B8(s * pDataline[0]);
pScanline[3] = (mng_uint8)s;
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
else
{
if (pData->bIsRGBA16) /* 16-bit input row ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* get alpha values */
if ((s = pDataline[6]) != 0) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if (s == 255)
{ /* plain copy it */
pScanline[0] = pDataline[4];
pScanline[1] = pDataline[2];
pScanline[2] = pDataline[0];
pScanline[3] = 255;
}
else
{ /* now blend (premultiplied) */
t = 255 - s;
pScanline[0] = DIV255B8(s * pDataline[4] + t * pScanline[0]);
pScanline[1] = DIV255B8(s * pDataline[2] + t * pScanline[1]);
pScanline[2] = DIV255B8(s * pDataline[0] + t * pScanline[2]);
pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3])));
}
}
pScanline += (pData->iColinc << 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{
if ((s = pDataline[3]) != 0) /* any opacity at all ? */
{ /* fully opaque ? */
if (s == 255)
{ /* then simply copy the values */
pScanline[0] = pDataline[2];
pScanline[1] = pDataline[1];
pScanline[2] = pDataline[0];
pScanline[3] = 255;
}
else
{ /* now blend (premultiplied) */
t = 255 - s;
pScanline[0] = DIV255B8(s * pDataline[2] + t * pScanline[0]);
pScanline[1] = DIV255B8(s * pDataline[1] + t * pScanline[1]);
pScanline[2] = DIV255B8(s * pDataline[0] + t * pScanline[2]);
pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3])));
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8PM, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode display_abgr8 (mng_datap pData)
{
mng_uint8p pScanline;
@ -8164,16 +8328,11 @@ mng_retcode cleanup_rowproc (mng_datap pData)
MNG_TRACE (pData, MNG_FN_CLEANUP_ROWPROC, MNG_LC_START)
#endif
#ifdef MNG_INCLUDE_LCMS
if (pData->hTrans) /* cleanup CMS transform */
mnglcms_freetransform (pData->hTrans);
pData->hTrans = 0;
if (pData->hProf1) /* cleanup CMS image-profile */
mnglcms_freeprofile (pData->hProf1);
pData->hProf1 = 0;
#ifdef MNG_INCLUDE_LCMS /* cleanup cms profile/transform */
mng_retcode iRetcode = mng_clear_cms (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
#endif /* MNG_INCLUDE_LCMS */
if (pData->pWorkrow) /* cleanup buffer for working row */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_pixels.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.4 * */
/* * version : 1.0.1 * */
/* * * */
/* * purpose : Pixel-row management routines (definition) * */
/* * * */
@ -43,6 +43,9 @@
/* * 0.9.4 - 1/18/2001 - G.Juyn * */
/* * - added "new" MAGN methods 3, 4 & 5 * */
/* * * */
/* * 1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly) * */
/* * - added BGRA8 canvas with premultiplied alpha * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -81,6 +84,7 @@ mng_retcode display_argb8 (mng_datap pData);
mng_retcode display_rgb8_a8 (mng_datap pData);
mng_retcode display_bgr8 (mng_datap pData);
mng_retcode display_bgra8 (mng_datap pData);
mng_retcode display_bgra8_pm (mng_datap pData);
mng_retcode display_abgr8 (mng_datap pData);
/* ************************************************************************** */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_prop_xs.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.3 * */
/* * version : 1.0.1 * */
/* * * */
/* * purpose : property get/set interface (implementation) * */
/* * * */
@ -60,6 +60,11 @@
/* * 0.9.3 - 10/21/2000 - G.Juyn * */
/* * - added get function for interlace/progressive display * */
/* * * */
/* * 1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly) * */
/* * - added BGRA8 canvas with premultiplied alpha * */
/* * 1.0.1 - 05/02/2001 - G.Juyn * */
/* * - added "default" sRGB generation (Thanks Marti!) * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -117,6 +122,7 @@ mng_retcode MNG_DECL mng_set_canvasstyle (mng_handle hHandle,
case MNG_CANVAS_RGB8_A8 : break;
case MNG_CANVAS_BGR8 : break;
case MNG_CANVAS_BGRA8 : break;
case MNG_CANVAS_BGRA8PM : break;
case MNG_CANVAS_ABGR8 : break;
/* case MNG_CANVAS_RGB16 : break; */
/* case MNG_CANVAS_RGBA16 : break; */
@ -331,7 +337,7 @@ mng_retcode MNG_DECL mng_set_outputprofile2 (mng_handle hHandle,
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_OUTPUTPROFILE, MNG_LC_START)
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_OUTPUTPROFILE2, MNG_LC_START)
#endif
#ifdef MNG_INCLUDE_LCMS
@ -349,7 +355,7 @@ mng_retcode MNG_DECL mng_set_outputprofile2 (mng_handle hHandle,
#endif /* MNG_INCLUDE_LCMS */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_OUTPUTPROFILE, MNG_LC_END)
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_OUTPUTPROFILE2, MNG_LC_END)
#endif
return MNG_NOERROR;
@ -358,6 +364,39 @@ mng_retcode MNG_DECL mng_set_outputprofile2 (mng_handle hHandle,
/* ************************************************************************** */
mng_retcode MNG_DECL mng_set_outputsrgb (mng_handle hHandle)
{
#ifdef MNG_INCLUDE_LCMS
mng_datap pData;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_OUTPUTSRGB, MNG_LC_START)
#endif
#ifdef MNG_INCLUDE_LCMS
MNG_VALIDHANDLE (hHandle)
pData = (mng_datap)hHandle; /* address the structure */
if (pData->hProf2) /* previously defined ? */
mnglcms_freeprofile (pData->hProf2);
/* allocate new CMS profile handle */
pData->hProf2 = mnglcms_createsrgbprofile ();
if (!pData->hProf2) /* handle error ? */
MNG_ERRORL (pData, MNG_LCMS_NOHANDLE)
#endif /* MNG_INCLUDE_LCMS */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_OUTPUTSRGB, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifdef MNG_SUPPORT_DISPLAY
mng_retcode MNG_DECL mng_set_srgbprofile (mng_handle hHandle,
mng_pchar zFilename)
@ -367,7 +406,7 @@ mng_retcode MNG_DECL mng_set_srgbprofile (mng_handle hHandle,
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGBPROFILE, MNG_LC_START)
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGBPROFILE2, MNG_LC_START)
#endif
#ifdef MNG_INCLUDE_LCMS
@ -385,7 +424,7 @@ mng_retcode MNG_DECL mng_set_srgbprofile (mng_handle hHandle,
#endif /* MNG_INCLUDE_LCMS */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGBPROFILE, MNG_LC_END)
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGBPROFILE2, MNG_LC_END)
#endif
return MNG_NOERROR;
@ -431,6 +470,39 @@ mng_retcode MNG_DECL mng_set_srgbprofile2 (mng_handle hHandle,
/* ************************************************************************** */
mng_retcode MNG_DECL mng_set_srgbimplicit (mng_handle hHandle)
{
#ifdef MNG_INCLUDE_LCMS
mng_datap pData;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGBIMPLICIT, MNG_LC_START)
#endif
#ifdef MNG_INCLUDE_LCMS
MNG_VALIDHANDLE (hHandle)
pData = (mng_datap)hHandle; /* address the structure */
if (pData->hProf3) /* previously defined ? */
mnglcms_freeprofile (pData->hProf3);
/* allocate new CMS profile handle */
pData->hProf3 = mnglcms_createsrgbprofile ();
if (!pData->hProf3) /* handle error ? */
MNG_ERRORL (pData, MNG_LCMS_NOHANDLE)
#endif /* MNG_INCLUDE_LCMS */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGBIMPLICIT, MNG_LC_END)
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_set_viewgamma (mng_handle hHandle,
mng_float dGamma)
{

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_read.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.5 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : Read logic (implementation) * */
/* * * */

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

@ -2,7 +2,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_read.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.3 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : Read management (definition) * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_trace.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.4 * */
/* * version : 1.0.1 * */
/* * * */
/* * purpose : Trace functions (implementation) * */
/* * * */
@ -87,6 +87,13 @@
/* * 0.9.4 - 1/18/2001 - G.Juyn * */
/* * - added "new" MAGN methods 3, 4 & 5 * */
/* * * */
/* * 1.0.1 - 02/08/2001 - G.Juyn * */
/* * - added MEND processing callback * */
/* * 1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly) * */
/* * - added BGRA8 canvas with premultiplied alpha * */
/* * 1.0.1 - 05/02/2001 - G.Juyn * */
/* * - added "default" sRGB generation (Thanks Marti!) * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
@ -152,6 +159,7 @@
{MNG_FN_SETCB_PROCESSSEEK, "setcb_processseek"},
{MNG_FN_SETCB_PROCESSNEED, "setcb_processneed"},
{MNG_FN_SETCB_PROCESSUNKNOWN, "setcb_processunknown"},
{MNG_FN_SETCB_PROCESSMEND, "setcb_processmend"},
{MNG_FN_GETCB_MEMALLOC, "getcb_memalloc"},
{MNG_FN_GETCB_MEMFREE, "getcb_memfree"},
@ -178,6 +186,7 @@
{MNG_FN_GETCB_PROCESSSEEK, "getcb_processseek"},
{MNG_FN_GETCB_PROCESSNEED, "getcb_processneed"},
{MNG_FN_GETCB_PROCESSUNKNOWN, "getcb_processunknown"},
{MNG_FN_GETCB_PROCESSMEND, "getcb_processmend"},
{MNG_FN_SET_USERDATA, "set_userdata"},
{MNG_FN_SET_CANVASSTYLE, "set_canvasstyle"},
@ -209,6 +218,10 @@
{MNG_FN_SET_SUSPENSIONMODE, "set_suspensionmode"},
{MNG_FN_SET_SECTIONBREAKS, "set_sectionbreaks"},
{MNG_FN_SET_USEBKGD, "set_usebkgd"},
{MNG_FN_SET_OUTPUTPROFILE2, "set_outputprofile2"},
{MNG_FN_SET_SRGBPROFILE2, "set_srgbprofile2"},
{MNG_FN_SET_OUTPUTSRGB, "set_outputsrgb"},
{MNG_FN_SET_SRGBIMPLICIT, "set_srgbimplicit"},
{MNG_FN_GET_USERDATA, "get_userdata"},
{MNG_FN_GET_SIGTYPE, "get_sigtype"},
@ -457,6 +470,7 @@
{MNG_FN_DISPLAY_DX15, "display_dx15"},
{MNG_FN_DISPLAY_DX16, "display_dx16"},
{MNG_FN_DISPLAY_RGB8_A8, "display_rgb8_a8"},
{MNG_FN_DISPLAY_BGRA8PM, "display_bgra8_pm"},
{MNG_FN_INIT_FULL_CMS, "init_full_cms"},
{MNG_FN_CORRECT_FULL_CMS, "correct_full_cms"},

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_trace.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.4 * */
/* * version : 1.0.1 * */
/* * * */
/* * purpose : Trace functions (definition) * */
/* * * */
@ -96,6 +96,13 @@
/* * 0.9.4 - 1/18/2001 - G.Juyn * */
/* * - added "new" MAGN methods 3, 4 & 5 * */
/* * * */
/* * 1.0.1 - 02/08/2001 - G.Juyn * */
/* * - added MEND processing callback * */
/* * 1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly) * */
/* * - added BGRA8 canvas with premultiplied alpha * */
/* * 1.0.1 - 05/02/2001 - G.Juyn * */
/* * - added "default" sRGB generation (Thanks Marti!) * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
@ -188,6 +195,7 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_SETCB_PROCESSSEEK 123
#define MNG_FN_SETCB_PROCESSNEED 124
#define MNG_FN_SETCB_PROCESSUNKNOWN 125
#define MNG_FN_SETCB_PROCESSMEND 126
#define MNG_FN_GETCB_MEMALLOC 201
#define MNG_FN_GETCB_MEMFREE 202
@ -214,6 +222,7 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_GETCB_PROCESSSEEK 223
#define MNG_FN_GETCB_PROCESSNEED 224
#define MNG_FN_GETCB_PROCESSUNKNOWN 225
#define MNG_FN_GETCB_PROCESSMEND 226
#define MNG_FN_SET_USERDATA 301
#define MNG_FN_SET_CANVASSTYLE 302
@ -245,6 +254,10 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_SET_SUSPENSIONMODE 328
#define MNG_FN_SET_SECTIONBREAKS 329
#define MNG_FN_SET_USEBKGD 330
#define MNG_FN_SET_OUTPUTPROFILE2 331
#define MNG_FN_SET_SRGBPROFILE2 332
#define MNG_FN_SET_OUTPUTSRGB 333
#define MNG_FN_SET_SRGBIMPLICIT 334
#define MNG_FN_GET_USERDATA 401
#define MNG_FN_GET_SIGTYPE 402
@ -501,6 +514,7 @@ mng_retcode mng_trace (mng_datap pData,
#define MNG_FN_DISPLAY_DX15 1122
#define MNG_FN_DISPLAY_DX16 1123
#define MNG_FN_DISPLAY_RGB8_A8 1124
#define MNG_FN_DISPLAY_BGRA8PM 1125
/* ************************************************************************** */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_types.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.4 * */
/* * version : 1.0.1 * */
/* * * */
/* * purpose : type specifications * */
/* * * */
@ -91,6 +91,9 @@
/* * 0.9.4 - 12/16/2000 - G.Juyn * */
/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */
/* * * */
/* * 1.0.1 - 02/08/2001 - G.Juyn * */
/* * - added MEND processing callback * */
/* * * */
/* ************************************************************************** */
#ifndef _libmng_types_h_
@ -419,6 +422,9 @@ 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_processmend) (mng_handle hHandle,
mng_uint32 iIterationsdone,
mng_uint32 iIterationsleft);
typedef mng_bool (MNG_DECL *mng_processunknown) (mng_handle hHandle,
mng_chunkid iChunkid,
mng_uint32 iRawlen,

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_write.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : Write management (implementation) * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_write.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : Write management (definition) * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_zlib.c copyright (c) 2000 G.Juyn * */
/* * version : 0.9.3 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : ZLIB library interface (implementation) * */
/* * * */

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

@ -5,7 +5,7 @@
/* * * */
/* * project : libmng * */
/* * file : libmng_zlib.h copyright (c) 2000 G.Juyn * */
/* * version : 0.9.2 * */
/* * version : 1.0.0 * */
/* * * */
/* * purpose : ZLIB package interface (definition) * */
/* * * */