libmng-2.0.3/ 0000755 0001750 0001750 00000000000 12515250314 012656 5 ustar glennrp glennrp libmng-2.0.3/LICENSE 0000644 0001750 0001750 00000011016 12005307152 013657 0 ustar glennrp glennrp /* ************************************************************************** */
/* * * */
/* * COPYRIGHT NOTICE: * */
/* * * */
/* * Copyright (c) 2000-2007 Gerard Juyn (gerard@libmng.com) * */
/* * [You may insert additional notices after this sentence if you modify * */
/* * this source] * */
/* * * */
/* * For the purposes of this copyright and license, "Contributing Authors" * */
/* * is defined as the following set of individuals: * */
/* * * */
/* * Gerard Juyn * */
/* * Glenn Randers-Pehrson * */
/* * * */
/* * The MNG Library is supplied "AS IS". The Contributing Authors * */
/* * disclaim all warranties, expressed or implied, including, without * */
/* * limitation, the warranties of merchantability and of fitness for any * */
/* * purpose. The Contributing Authors assume no liability for direct, * */
/* * indirect, incidental, special, exemplary, or consequential damages, * */
/* * which may result from the use of the MNG Library, even if advised of * */
/* * the possibility of such damage. * */
/* * * */
/* * Permission is hereby granted to use, copy, modify, and distribute this * */
/* * source code, or portions hereof, for any purpose, without fee, subject * */
/* * to the following restrictions: * */
/* * * */
/* * 1. The origin of this source code must not be misrepresented; * */
/* * you must not claim that you wrote the original software. * */
/* * * */
/* * 2. Altered versions must be plainly marked as such and must not be * */
/* * misrepresented as being the original source. * */
/* * * */
/* * 3. This Copyright notice may not be removed or altered from any source * */
/* * or altered source distribution. * */
/* * * */
/* * The Contributing Authors specifically permit, without fee, and * */
/* * encourage the use of this source code as a component to supporting * */
/* * the MNG and JNG file format in commercial products. If you use this * */
/* * source code in a product, acknowledgment would be highly appreciated. * */
/* * * */
/* ************************************************************************** */
/* * * */
/* * Parts of this software have been adapted from the libpng package. * */
/* * Although this library supports all features from the PNG specification * */
/* * (as MNG descends from it) it does not require the libpng package. * */
/* * It does require the zlib library and optionally the IJG jpeg library, * */
/* * and/or the "little-cms" library by Marti Maria (depending on the * */
/* * inclusion of support for JNG and Full-Color-Management respectively. * */
/* * * */
/* * This library's function is primarily to read and display MNG * */
/* * animations. It is not meant as a full-featured image-editing * */
/* * component! It does however offer creation and editing functionality * */
/* * at the chunk level. * */
/* * (future modifications may include some more support for creation * */
/* * and or editing) * */
/* * * */
/* ************************************************************************** */
libmng-2.0.3/README.config 0000644 0001750 0001750 00000010012 12005307152 014771 0 ustar glennrp glennrp Configuration options in libmng
===============================
The library is fairly configurable through the use of a number of defines.
Please note however that certain defines are for internal use only.
The following list gives a summary of options that can be used externally to
define the functionality of the library:
========================================
#define MNG_BUILD_DLL
This is used to indicate that a "standard" DLL should result from compiling
the library. Please note the remarks in README.dll if you intend to work
with the library as a DLL. The purpose of this option is to ensure that
DLL builds have the same set of functions.
#define MNG_BUILD_SO
This is used to indicate that a "standard" shared library (SO) should result
from a compilation. The purpose of this option is to ensure that all
shared libraries generated this way will have the same set of functions.
#define MNG_USE_DLL / #define MNG_USE_SO
These should be used when including the library header in the compilation
of an application to indicate that the compiler/linker must take the
necessary steps to make the binary executable to use the standard DLL
or shared library (SO).
#define MNG_SKIP_ZLIB / #define MNG_SKIP_LCMS / #define MNG_SKIP_IJG6B
Use these in conjunction with MNG_USE_DLL / MNG_USE_SO. This is useful if
you only need the external definitions of the MNG library and not the others,
which will speed up the compilation process.
#define MNG_SUPPORT_FULL / #define MNG_SUPPORT_LC / #define MNG_SUPPORT_VLC
These can be used to indicate the level of MNG spec compliance required.
Currently only full MNG compliance is supported.
#define MNG_SUPPORT_IJG6B
This can be used to indicate if JNG support is required. This option will
include the IJG JPEG-library. Note that MNG_SUPPORT_FULL will automatically
set this option. Use this only if you need JNG support with MNG-(V)LC.
#define MNG_FULL_CMS / #define MNG_GAMMA_ONLY / #define MNG_NO_CMS /
#define MNG_APP_CMS
These indicate the color-correction support level of the library.
If you are on a platform that supports lcms (Little CMS by Marti Maria Saguar)
then it is highly recommended to define MNG_FULL_CMS.
If your platform has it's own CMS then select MNG_APP_CMS and be sure to
include the appropriate callbacks in your app.
In all other cases it is recommended to define MNG_GAMMA_ONLY.
#define MNG_SUPPORT_READ / #define MNG_SUPPORT_WRITE /
#define MNG_SUPPORT_DISPLAY
These indicate the high-level support for reading, writing and/or
displaying files. Note that in order to display a file, you'll need to read
it first. (yes, really!)
#define MNG_STORE_CHUNKS
This indicates that the library should store chunk-information when reading
a file. This information can then be processed through the
MNG_ITERATE_CHUNKS() function. Note that you must specify this option if
you want to create and write a new file.
#define MNG_ACCESS_CHUNKS
This is used to indicate that the app may need access to internally stored
chunk information. MNG_STORE_CHUNKS must be defined as well for this option
to function properly.
#define MNG_INTERNAL_MEMMNGMT
You can use this to have the library handle it's own memory allocation and
deallocation through the "standard" memory functions. This option is turned
off by default, which means your app must define the memory callbacks.
#define MNG_ERROR_TELLTALE
Set this on to allow human-readable error-messages to be included in the
library and the error function and callback.
#define MNG_BIGENDIAN_SUPPORTED
This option should be used to indicate the hardware is based on big endian
integers.
#define MNG_SUPPORT_TRACE / #define MNG_TRACE_TELLTALE
These two can be used when debugging an app. You'll need to have the trace
callback setup also. This allows for a rather thorough investigation of the
libraries function paths.
========================================
Any other optional defines you may encounter are for internal use only.
please do not specify them externally. In case of doubt, consult the
support email lists. More info can be found on http://www.libmng.com
libmng-2.0.3/README.autoconf 0000644 0001750 0001750 00000021454 12005307152 015356 0 ustar glennrp glennrp **********************************************************************
**********************************************************************
***** this is unmaintained *****
If you happen to find problems with autoconfiguration and building,
I simply cannot help you. I'm looking for a maintainer that doesn't mind
spending a few minutes every now and then on the next release to make sure
things are still in working order.
For the moment all autoconf stuff ahs been moved into unmaintained!!
**********************************************************************
**********************************************************************
Configuration from CVS
======================
If you're using source checked out from CVS, rather than a source
distribution tarball, please be aware that you can use ./autogen.sh in
place of ./configure below.
Because this is a cross-platform project, the source templates for
the autoconf scripts are sequestered in the 'makefiles' directory.
Running './autogen.sh' will copy them into their conventional places at
the lop level. If you already see the files there, you don't need to
worry about this step.
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.
libmng-2.0.3/README.examples 0000644 0001750 0001750 00000003633 12005307152 015355 0 ustar glennrp glennrp The samples are in platform-specific directories.
!!! contributions are very welcome !!!
bcb - Borland C++ Builder (3.0) (found under bcb/xxx)
-----------------------------------------------------
win32dll - sample project to create a Windows dll. Requires zlib1.2.1,
IJG jpgsrc6b and lcms1.0.14. The directories containing these
libraries must be at the same level as the libmng directory.
So if you're in the directory with this file and the libmng
sources, they should be in ..\zlib , ..\jpgsrc6b and ..\lcms
respectively.
!!! To run the other Win32 samples you need to copy the libmng.dll
file from here into the sample's directory !!!
mngtree - sample project to create a little command-line tool that dumps
the chunk-structure of a given file onto stdout.
bogus - a completely bogus example on how to create a perfectly valid
(though slightly biased) MNG.
mngview - port of the Delphi mngview sample. contributed by Andy Protano.
see also README.contrib
mngrepair- an example on how to fix invalid MNG files
uses the new mng_copy_chunks() function and MNG_SOFTERRORS to
'ignore' certain input-errors. This conditional *MUST* only be used
for exactly this kind of software; eg. repair utilities.
delphi - Borland Delphi (3.0+) (found under contrib/delphi/xxx)
---------------------------------------------------------------
mngview - sample project for a simple mng-viewer. The general unit in
the delphi directory was translated from libmng.h It can be
used in other projects to access libmng.dll created with the
win32dll example above.
unix - Unix (found under contrib/gcc/xxx)
-----------------------------------------
mngtree - basically a copy of the BCB sample. It includes a makefile for
Linux and it's been tested on RedHat6.2
libmng-2.0.3/README.version 0000644 0001750 0001750 00000000733 12515247042 015231 0 ustar glennrp glennrp Version changes - here 2.0.3 - must be written into the following files:
libmng.h :
=======================
#define MNG_VERSION_TEXT "2.0.3"
CMake/vers.cmake:
=======================
SET(MNG_VERSION_MAJOR 2)
SET(MNG_VERSION_MINOR 0)
SET(MNG_VERSION_PATCH 3)
makefiles/configure.ac :
=======================
define([MAJ_NR],[2])
define([MIN_NR],[0])
define([REL_NR],[3])
makefiles/version.mak :
=======================
MNGMAJ = 2
MNGMIN = 0
MNGREL = 3
MNGVER = 2.0.3
libmng-2.0.3/config.guess 0000755 0001750 0001750 00000127463 12115360516 015215 0 ustar glennrp glennrp #! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012, 2013 Free Software Foundation, Inc.
timestamp='2012-12-29'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see .
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
#
# Originally written by Per Bothner.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
#
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION]
Output the configuration name of the system \`$me' is run on.
Operation modes:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
Report bugs and patches to ."
version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
2012, 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="
Try \`$me --help' for more information."
# Parse command line
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit ;;
--version | -v )
echo "$version" ; exit ;;
--help | --h* | -h )
echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
break ;;
-* )
echo "$me: invalid option $1$help" >&2
exit 1 ;;
* )
break ;;
esac
done
if test $# != 0; then
echo "$me: too many arguments$help" >&2
exit 1
fi
trap 'exit 1' 1 2 15
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
# compiler to aid in system detection is discouraged as it requires
# temporary files to be created and, as you can see below, it is a
# headache to deal with in a portable fashion.
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.
# Portable tmp directory creation inspired by the Autoconf team.
set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
dummy=$tmp/dummy ;
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
case $CC_FOR_BUILD,$HOST_CC,$CC in
,,) echo "int x;" > $dummy.c ;
for c in cc gcc c89 c99 ; do
if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
CC_FOR_BUILD="$c"; break ;
fi ;
done ;
if test x"$CC_FOR_BUILD" = x ; then
CC_FOR_BUILD=no_compiler_found ;
fi
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
esac ; set_cc_for_build= ;'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
# compatibility and a consistent mechanism for selecting the
# object file format.
#
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || echo unknown)`
case "${UNAME_MACHINE_ARCH}" in
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently, or will in the future.
case "${UNAME_MACHINE_ARCH}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
os=netbsd
else
os=netbsdelf
fi
;;
*)
os=netbsd
;;
esac
# The OS release
# Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need
# kernel version information, so it can be replaced with a
# suitable tag, in the style of linux-gnu.
case "${UNAME_VERSION}" in
Debian*)
release='-gnu'
;;
*)
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
;;
esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit ;;
*:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
exit ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
exit ;;
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;;
*:SolidBSD:*:*)
echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
exit ;;
macppc:MirBSD:*:*)
echo powerpc-unknown-mirbsd${UNAME_RELEASE}
exit ;;
*:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
exit ;;
alpha:OSF1:*:*)
case $UNAME_RELEASE in
*4.0)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
;;
*5.*)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on
# OSF/1 and Tru64 systems produced since 1995. I hope that
# covers most systems running today. This code pipes the CPU
# types through head -n 1, so we only detect the type of CPU 0.
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
case "$ALPHA_CPU_TYPE" in
"EV4 (21064)")
UNAME_MACHINE="alpha" ;;
"EV4.5 (21064)")
UNAME_MACHINE="alpha" ;;
"LCA4 (21066/21068)")
UNAME_MACHINE="alpha" ;;
"EV5 (21164)")
UNAME_MACHINE="alphaev5" ;;
"EV5.6 (21164A)")
UNAME_MACHINE="alphaev56" ;;
"EV5.6 (21164PC)")
UNAME_MACHINE="alphapca56" ;;
"EV5.7 (21164PC)")
UNAME_MACHINE="alphapca57" ;;
"EV6 (21264)")
UNAME_MACHINE="alphaev6" ;;
"EV6.7 (21264A)")
UNAME_MACHINE="alphaev67" ;;
"EV6.8CB (21264C)")
UNAME_MACHINE="alphaev68" ;;
"EV6.8AL (21264B)")
UNAME_MACHINE="alphaev68" ;;
"EV6.8CX (21264D)")
UNAME_MACHINE="alphaev68" ;;
"EV6.9A (21264/EV69A)")
UNAME_MACHINE="alphaev69" ;;
"EV7 (21364)")
UNAME_MACHINE="alphaev7" ;;
"EV7.9 (21364A)")
UNAME_MACHINE="alphaev79" ;;
esac
# A Pn.n version is a patched version.
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
exitcode=$?
trap '' 0
exit $exitcode ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
# of the specific Alpha model?
echo alpha-pc-interix
exit ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-unknown-sysv4
exit ;;
*:[Aa]miga[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-amigaos
exit ;;
*:[Mm]orph[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-morphos
exit ;;
*:OS/390:*:*)
echo i370-ibm-openedition
exit ;;
*:z/VM:*:*)
echo s390-ibm-zvmoe
exit ;;
*:OS400:*:*)
echo powerpc-ibm-os400
exit ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
arm*:riscos:*:*|arm*:RISCOS:*:*)
echo arm-unknown-riscos
exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
exit ;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
else
echo pyramid-pyramid-bsd
fi
exit ;;
NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
exit ;;
DRS?6000:unix:4.0:6*)
echo sparc-icl-nx6
exit ;;
DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7; exit ;;
esac ;;
s390x:SunOS:*:*)
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
echo i386-pc-auroraux${UNAME_RELEASE}
exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build
SUN_ARCH="i386"
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
SUN_ARCH="x86_64"
fi
fi
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
exit ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
case "`/bin/arch`" in
sun3)
echo m68k-sun-sunos${UNAME_RELEASE}
;;
sun4)
echo sparc-sun-sunos${UNAME_RELEASE}
;;
esac
exit ;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
exit ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
# > m68000). The system name ranges from "MiNT" over "FreeMiNT"
# to the lowercase version "mint" (or "freemint"). Finally
# the system name "TOS" denotes a system which is actually not
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
echo m68k-milan-mint${UNAME_RELEASE}
exit ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
echo m68k-hades-mint${UNAME_RELEASE}
exit ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
exit ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
exit ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit ;;
2020:CLIX:*:* | 2430:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
exit ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __cplusplus
#include /* for printf() prototype */
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
#endif
#endif
exit (-1);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c &&
dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
SYSTEM_NAME=`$dummy $dummyarg` &&
{ echo "$SYSTEM_NAME"; exit; }
echo mips-mips-riscos${UNAME_RELEASE}
exit ;;
Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax
exit ;;
Motorola:*:4.3:PL8-*)
echo powerpc-harris-powermax
exit ;;
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
echo powerpc-harris-powermax
exit ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
exit ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
exit ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
exit ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
[ ${TARGET_BINARY_INTERFACE}x = x ]
then
echo m88k-dg-dgux${UNAME_RELEASE}
else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
fi
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
exit ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
exit ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
exit ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
exit ;;
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
exit ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i*86:AIX:*:*)
echo i386-ibm-aix
exit ;;
ia64:AIX:*:*)
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
exit ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include
main()
{
if (!__power_pc())
exit(1);
puts("powerpc-ibm-aix3.2.5");
exit(0);
}
EOF
if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
then
echo "$SYSTEM_NAME"
else
echo rs6000-ibm-aix3.2.5
fi
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
exit ;;
*:AIX:*:[4567])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
exit ;;
*:AIX:*:*)
echo rs6000-ibm-aix
exit ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
exit ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
exit ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
exit ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
exit ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit ;;
9000/[34678]??:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
if [ -x /usr/bin/getconf ]; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in
32) HP_ARCH="hppa2.0n" ;;
64) HP_ARCH="hppa2.0w" ;;
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
esac ;;
esac
fi
if [ "${HP_ARCH}" = "" ]; then
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#define _HPUX_SOURCE
#include
#include
int main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
#endif
long cpu = sysconf (_SC_CPU_VERSION);
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
case CPU_PA_RISC2_0:
#if defined(_SC_KERNEL_BITS)
switch (bits)
{
case 64: puts ("hppa2.0w"); break;
case 32: puts ("hppa2.0n"); break;
default: puts ("hppa2.0"); break;
} break;
#else /* !defined(_SC_KERNEL_BITS) */
puts ("hppa2.0"); break;
#endif
default: puts ("hppa1.0"); break;
}
exit (0);
}
EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
if [ ${HP_ARCH} = "hppa2.0w" ]
then
eval $set_cc_for_build
# hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
# 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
# generating 64-bit code. GNU and HP use different nomenclature:
#
# $ CC_FOR_BUILD=cc ./config.guess
# => hppa2.0w-hp-hpux11.23
# $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
grep -q __LP64__
then
HP_ARCH="hppa2.0w"
else
HP_ARCH="hppa64"
fi
fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit ;;
ia64:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ia64-hp-hpux${HPUX_REV}
exit ;;
3050*:HI-UX:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
results, however. */
if (CPU_IS_PA_RISC (cpu))
{
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
default: puts ("hppa-hitachi-hiuxwe2"); break;
}
}
else if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
else puts ("unknown-hitachi-hiuxwe2");
exit (0);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
{ echo "$SYSTEM_NAME"; exit; }
echo unknown-hitachi-hiuxwe2
exit ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
echo hppa1.1-hp-bsd
exit ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit ;;
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix
exit ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
exit ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit ;;
i*86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
echo ${UNAME_MACHINE}-unknown-osf1
fi
exit ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-e 's/\.[^.]*$/.X/'
exit ;;
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*T3E:*:*:*)
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
*:UNICOS/mp:*:*)
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit ;;
sparc*:BSD/OS:*:*)
echo sparc-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:FreeBSD:*:*)
UNAME_PROCESSOR=`/usr/bin/uname -p`
case ${UNAME_PROCESSOR} in
amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*)
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
*:MINGW64*:*)
echo ${UNAME_MACHINE}-pc-mingw64
exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
i*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
i*:windows32*:*)
# uname -m includes "-pc" on this system.
echo ${UNAME_MACHINE}-mingw32
exit ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
*:Interix*:*)
case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
authenticamd | genuineintel | EM64T)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
echo ia64-unknown-interix${UNAME_RELEASE}
exit ;;
esac ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
8664:Windows_NT:*)
echo x86_64-pc-mks
exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
echo i586-pc-interix
exit ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
exit ;;
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
echo x86_64-unknown-cygwin
exit ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin
exit ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
*:GNU:*:*)
# the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
aarch64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
PCA57) UNAME_MACHINE=alphapca56 ;;
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
echo ${UNAME_MACHINE}-unknown-linux-gnu
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
else
echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
fi
fi
exit ;;
avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
cris:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-gnu
exit ;;
crisv32:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-gnu
exit ;;
frv:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
hexagon:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
LIBC=gnu
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef ${UNAME_MACHINE}
#undef ${UNAME_MACHINE}el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=${UNAME_MACHINE}el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=${UNAME_MACHINE}
#else
CPU=
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
or32:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-gnu
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
PA7*) echo hppa1.1-unknown-linux-gnu ;;
PA8*) echo hppa2.0-unknown-linux-gnu ;;
*) echo hppa-unknown-linux-gnu ;;
esac
exit ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
exit ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
tile*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;;
x86_64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
# sysname and nodename.
echo i386-sequent-sysv4
exit ;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
exit ;;
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
exit ;;
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
exit ;;
i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
exit ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
fi
exit ;;
i*86:*:5:[678]*)
# UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
exit ;;
i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
&& UNAME_MACHINE=i686
(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configury will decide that
# this is a cross-build.
echo i586-pc-msdosdjgpp
exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit ;;
paragon:*:*:*)
echo i860-intel-osf1
exit ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
fi
exit ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
exit ;;
mc68k:UNIX:SYSTEM5:3.51m)
echo m68k-convergent-sysv
exit ;;
M680?0:D-NIX:5.3:*)
echo m68k-diab-dnix
exit ;;
M68*:*:R3V[5678]*:*)
test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
OS_REL='.3'
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit ;;
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
exit ;;
RM*:ReliantUNIX-*:*:*)
echo mips-sni-sysv4
exit ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
exit ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
echo ${UNAME_MACHINE}-sni-sysv4
else
echo ns32k-sni-sysv
fi
exit ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says
echo i586-unisys-sysv4
exit ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes .
# How about differentiating between stratus architectures? -djm
echo hppa1.1-stratus-sysv4
exit ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
exit ;;
i*86:VOS:*:*)
# From Paul.Green@stratus.com.
echo ${UNAME_MACHINE}-stratus-vos
exit ;;
*:VOS:*:*)
# From Paul.Green@stratus.com.
echo hppa1.1-stratus-vos
exit ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit ;;
news*:NEWS-OS:6*:*)
echo mips-sony-newsos6
exit ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
exit ;;
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
echo powerpc-apple-beos
exit ;;
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
exit ;;
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
x86_64:Haiku:*:*)
echo x86_64-unknown-haiku
exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE}
exit ;;
SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE}
exit ;;
SX-7:SUPER-UX:*:*)
echo sx7-nec-superux${UNAME_RELEASE}
exit ;;
SX-8:SUPER-UX:*:*)
echo sx8-nec-superux${UNAME_RELEASE}
exit ;;
SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE}
exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;;
*:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in
i386)
eval $set_cc_for_build
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
UNAME_PROCESSOR="x86_64"
fi
fi ;;
unknown) UNAME_PROCESSOR=powerpc ;;
esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = "x86"; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
fi
echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
exit ;;
*:QNX:*:4*)
echo i386-pc-qnx
exit ;;
NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit ;;
*:NonStop-UX:*:*)
echo mips-compaq-nonstopux
exit ;;
BS2000:POSIX*:*:*)
echo bs2000-siemens-sysv
exit ;;
DS/*:UNIX_System_V:*:*)
echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
exit ;;
*:Plan9:*:*)
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
# operating systems.
if test "$cputype" = "386"; then
UNAME_MACHINE=i386
else
UNAME_MACHINE="$cputype"
fi
echo ${UNAME_MACHINE}-unknown-plan9
exit ;;
*:TOPS-10:*:*)
echo pdp10-unknown-tops10
exit ;;
*:TENEX:*:*)
echo pdp10-unknown-tenex
exit ;;
KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
echo pdp10-dec-tops20
exit ;;
XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
echo pdp10-xkl-tops20
exit ;;
*:TOPS-20:*:*)
echo pdp10-unknown-tops20
exit ;;
*:ITS:*:*)
echo pdp10-unknown-its
exit ;;
SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE}
exit ;;
*:DragonFly:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit ;;
*:*VMS:*:*)
UNAME_MACHINE=`(uname -p) 2>/dev/null`
case "${UNAME_MACHINE}" in
A*) echo alpha-dec-vms ; exit ;;
I*) echo ia64-dec-vms ; exit ;;
V*) echo vax-dec-vms ; exit ;;
esac ;;
*:XENIX:*:SysV)
echo i386-pc-xenix
exit ;;
i*86:skyos:*:*)
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
exit ;;
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
exit ;;
i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros
exit ;;
x86_64:VMkernel:*:*)
echo ${UNAME_MACHINE}-unknown-esx
exit ;;
esac
eval $set_cc_for_build
cat >$dummy.c <
# include
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix\n"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
if (version < 4)
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
# if !defined (ultrix)
# include
# if defined (BSD)
# if BSD == 43
printf ("vax-dec-bsd4.3\n"); exit (0);
# else
# if BSD == 199006
printf ("vax-dec-bsd4.3reno\n"); exit (0);
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# endif
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# else
printf ("vax-dec-ultrix\n"); exit (0);
# endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
{ echo "$SYSTEM_NAME"; exit; }
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
c34*)
echo c34-convex-bsd
exit ;;
c38*)
echo c38-convex-bsd
exit ;;
c4*)
echo c4-convex-bsd
exit ;;
esac
fi
cat >&2 < in order to provide the needed
information to handle your system.
config.guess timestamp = $timestamp
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
hostinfo = `(hostinfo) 2>/dev/null`
/bin/universe = `(/bin/universe) 2>/dev/null`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
/bin/arch = `(/bin/arch) 2>/dev/null`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
UNAME_MACHINE = ${UNAME_MACHINE}
UNAME_RELEASE = ${UNAME_RELEASE}
UNAME_SYSTEM = ${UNAME_SYSTEM}
UNAME_VERSION = ${UNAME_VERSION}
EOF
exit 1
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
libmng-2.0.3/CMake/ 0000755 0001750 0001750 00000000000 12115351630 013635 5 ustar glennrp glennrp libmng-2.0.3/CMake/FindLCMS1.cmake 0000644 0001750 0001750 00000001410 12005307151 016250 0 ustar glennrp glennrp # - Find LCMS version 1 library
#
# LCMS_INCLUDE_DIR
# LCMS_LIBRARIES
# LCMS_FOUND
#
# also defined, but not for general use are
# LCMS_LIBRARY
FIND_PATH(LCMS1_INCLUDE_DIR lcms.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
SET(LCMS1_NAMES ${LCMS_NAMES} lcms liblcms liblcms_static)
FIND_LIBRARY(LCMS1_LIBRARY NAMES ${LCMS1_NAMES} )
MARK_AS_ADVANCED(LCMS1_INCLUDE_DIR LCMS1_LIBRARY)
# handle the QUIETLY and REQUIRED arguments and set LCMS_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS1 DEFAULT_MSG LCMS1_LIBRARY LCMS1_INCLUDE_DIR)
IF(LCMS1_FOUND)
SET(LCMS1_INCLUDE_DIRS ${LCMS1_INCLUDE_DIR})
SET(LCMS1_LIBRARIES ${LCMS1_LIBRARY} )
ENDIF(LCMS1_FOUND)
libmng-2.0.3/CMake/vers.cmake 0000644 0001750 0001750 00000000113 12115351630 015611 0 ustar glennrp glennrp SET(MNG_VERSION_MAJOR 2)
SET(MNG_VERSION_MINOR 0)
SET(MNG_VERSION_PATCH 2)
libmng-2.0.3/CMake/FindMAN.cmake 0000644 0001750 0001750 00000000435 12005307151 016052 0 ustar glennrp glennrp FIND_PROGRAM(MAN_EXE
NAMES man
PATHS /bin
/usr/bin
/usr/local/bin)
IF(MAN_EXE)
SET(MAN_FOUND YES)
ELSE(MAN_EXE)
# MESSAGE(WARNING "Unable to find 'man' program.MAN pages not installed")
SET(MAN_FOUND NO)
ENDIF(MAN_EXE)
libmng-2.0.3/CMake/libmng.pc.cmake 0000644 0001750 0001750 00000000462 12005307151 016507 0 ustar glennrp glennrp prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=${prefix}/@MNG_INSTALL_LIB_DIR@
includedir=${prefix}/@MNG_INSTALL_INCLUDE_DIR@
Name: libmng
Description: Loads PNG/MNG/JNG files
Version: @MNG_VERSION@
Libs: -L${libdir} -lmng
Libs.private: @MNG_LIBS_PRIVATE@
Cflags: -I${includedir}
libmng-2.0.3/CMake/FindGZIP.cmake 0000644 0001750 0001750 00000000415 12005307151 016206 0 ustar glennrp glennrp FIND_PROGRAM(GZIP_EXE
NAMES gzip
PATHS /bin
/usr/bin
/usr/local/bin)
IF(GZIP_EXE)
SET(GZIP_FOUND YES)
ELSE(GZIP_EXE)
MESSAGE(WARNING "Unable to find 'gzip' program")
SET(GZIP_FOUND NO)
ENDIF(GZIP_EXE)
libmng-2.0.3/CMake/FindLCMS2.cmake 0000644 0001750 0001750 00000001672 12005307151 016263 0 ustar glennrp glennrp # - Find LCMS version 2 library
#
# LCMS2_INCLUDE_DIR - Where to find lcms2.h, etc.
# LCMS2_LIBRARIES - Libraries to link against to use LCMS2.
# LCMS2_FOUND - If false, do not try to use LCMS2.
#
# also defined, but not for general use are
# LCMS2_LIBRARY - Where to find the LCMS2 library.
FIND_PATH(LCMS2_INCLUDE_DIR lcms2.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
SET(LCMS2_NAMES ${LCMS2_NAMES} lcms2 liblcms2 liblcms2_static)
FIND_LIBRARY(LCMS2_LIBRARY NAMES ${LCMS2_NAMES} )
MARK_AS_ADVANCED(LCMS2_INCLUDE_DIR LCMS2_LIBRARY)
# handle the QUIETLY and REQUIRED arguments and set LCMS2_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS2 DEFAULT_MSG LCMS2_LIBRARY LCMS2_INCLUDE_DIR)
IF(LCMS2_FOUND)
SET(LCMS2_INCLUDE_DIRS ${LCMS2_INCLUDE_DIR})
SET(LCMS2_LIBRARIES ${LCMS2_LIBRARY} )
ENDIF(LCMS2_FOUND)
libmng-2.0.3/libmng_zlib.c 0000644 0001750 0001750 00000053232 12005307152 015314 0 ustar glennrp glennrp #include "config.h"
/* ************************************************************************** */
/* * For conditions of distribution and use, * */
/* * see copyright notice in libmng.h * */
/* ************************************************************************** */
/* * * */
/* * project : libmng * */
/* * file : libmng_zlib.c copyright (c) 2000-2004 G.Juyn * */
/* * version : 1.0.9 * */
/* * * */
/* * purpose : ZLIB library interface (implementation) * */
/* * * */
/* * author : G.Juyn * */
/* * * */
/* * comment : implementation of the ZLIB library interface * */
/* * * */
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
/* * - changed strict-ANSI stuff * */
/* * 0.5.1 - 05/11/2000 - G.Juyn * */
/* * - filled the deflatedata routine * */
/* * 0.5.1 - 05/12/2000 - G.Juyn * */
/* * - changed trace to macro for callback error-reporting * */
/* * * */
/* * 0.5.2 - 05/20/2000 - G.Juyn * */
/* * - fixed for JNG alpha handling * */
/* * 0.5.2 - 05/24/2000 - G.Juyn * */
/* * - moved init of default zlib parms from here to * */
/* * "mng_hlapi.c" * */
/* * * */
/* * 0.5.3 - 06/16/2000 - G.Juyn * */
/* * - changed progressive-display processing * */
/* * * */
/* * 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 * */
/* * * */
/* * 1.0.5 - 08/07/2002 - G.Juyn * */
/* * - added test-option for PNG filter method 193 (=no filter) * */
/* * 1.0.5 - 08/19/2002 - G.Juyn * */
/* * - B597134 - libmng pollutes the linker namespace * */
/* * 1.0.5 - 09/19/2002 - G.Juyn * */
/* * - added warning for too much IDAT data * */
/* * * */
/* * 1.0.6 - 07/07/2003 - G.R-P * */
/* * - added MNG_NO_16BIT_SUPPORT support * */
/* * * */
/* * 1.0.9 - 10/09/2004 - G.R-P * */
/* * - added MNG_NO_1_2_4BIT_SUPPORT support * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
#include "libmng_data.h"
#include "libmng_error.h"
#include "libmng_trace.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "libmng_memory.h"
#include "libmng_pixels.h"
#include "libmng_filter.h"
#include "libmng_zlib.h"
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
#pragma option -A /* force ANSI-C */
#endif
/* ************************************************************************** */
#ifdef MNG_INCLUDE_ZLIB
/* ************************************************************************** */
voidpf mngzlib_alloc (voidpf pData,
uInt iCount,
uInt iSize)
{
voidpf pPtr; /* temporary space */
#ifdef MNG_INTERNAL_MEMMNGMT
pPtr = calloc (iCount, iSize); /* local allocation */
#else
if (((mng_datap)pData)->fMemalloc) /* callback function set ? */
pPtr = ((mng_datap)pData)->fMemalloc (iCount * iSize);
else
pPtr = Z_NULL; /* can't allocate! */
#endif
return pPtr; /* return the result */
}
/* ************************************************************************** */
void mngzlib_free (voidpf pData,
voidpf pAddress)
{
#ifdef MNG_INTERNAL_MEMMNGMT
free (pAddress); /* free locally */
#else
if (((mng_datap)pData)->fMemfree) /* callback set? */
((mng_datap)pData)->fMemfree (pAddress, 1);
#endif
}
/* ************************************************************************** */
mng_retcode mngzlib_initialize (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_INITIALIZE, MNG_LC_START);
#endif
#ifdef MNG_INTERNAL_MEMMNGMT
pData->sZlib.zalloc = Z_NULL; /* let zlib figure out memory management */
pData->sZlib.zfree = Z_NULL;
pData->sZlib.opaque = Z_NULL;
#else /* use user-provided callbacks */
pData->sZlib.zalloc = mngzlib_alloc;
pData->sZlib.zfree = mngzlib_free;
pData->sZlib.opaque = (voidpf)pData;
#endif
pData->bInflating = MNG_FALSE; /* not performing any action yet */
pData->bDeflating = MNG_FALSE;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_INITIALIZE, MNG_LC_END);
#endif
return MNG_NOERROR; /* done */
}
/* ************************************************************************** */
mng_retcode mngzlib_cleanup (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_CLEANUP, MNG_LC_START);
#endif
if (pData->bInflating) /* force zlib cleanup */
mngzlib_inflatefree (pData);
if (pData->bDeflating)
mngzlib_deflatefree (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_CLEANUP, MNG_LC_END);
#endif
return MNG_NOERROR; /* done */
}
/* ************************************************************************** */
mng_retcode mngzlib_inflateinit (mng_datap pData)
{
int iZrslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEINIT, MNG_LC_START);
#endif
/* initialize zlib structures and such */
iZrslt = inflateInit (&pData->sZlib);
if (iZrslt != Z_OK) /* on error bail out */
MNG_ERRORZ (pData, (mng_uint32)iZrslt);
pData->bInflating = MNG_TRUE; /* really inflating something now */
pData->sZlib.next_out = 0; /* force JIT initialization */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEINIT, MNG_LC_END);
#endif
return MNG_NOERROR; /* done */
}
/* ************************************************************************** */
#ifdef MNG_SUPPORT_DISPLAY
mng_retcode mngzlib_inflaterows (mng_datap pData,
mng_uint32 iInlen,
mng_uint8p pIndata)
{
int iZrslt;
mng_retcode iRslt;
mng_ptr pSwap;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEROWS, MNG_LC_START);
#endif
pData->sZlib.next_in = pIndata; /* let zlib know where to get stuff */
pData->sZlib.avail_in = (uInt)iInlen;
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 + pData->iPixelofs);
#ifdef MNG_NO_1_2_4BIT_SUPPORT
if (pData->iPNGdepth < 8)
pData->sZlib.avail_out = (uInt)((pData->iPNGdepth*pData->iRowsize + 7)/8
+ pData->iPixelofs);
#endif
#ifdef MNG_NO_16BIT_SUPPORT
if (pData->iPNGdepth > 8)
pData->sZlib.avail_out = (uInt)(2*pData->iRowsize + pData->iPixelofs);
#endif
}
do
{ /* now inflate a row */
iZrslt = inflate (&pData->sZlib, Z_SYNC_FLUSH);
/* produced a full row ? */
if (((iZrslt == Z_OK) || (iZrslt == Z_STREAM_END)) &&
(pData->sZlib.avail_out == 0))
{ /* image not completed yet ? */
if (pData->iRow < (mng_int32)pData->iDataheight)
{
#ifdef MNG_NO_1_2_4BIT_SUPPORT
if (pData->iPNGdepth == 1)
{
/* Inflate Workrow to 8-bit */
mng_int32 iX;
mng_uint8p pSrc = pData->pWorkrow+1;
mng_uint8p pDest = pSrc + pData->iRowsize - (pData->iRowsize+7)/8;
for (iX = ((pData->iRowsize+7)/8) ; iX > 0 ; iX--)
*pDest++ = *pSrc++;
pDest = pData->pWorkrow+1;
pSrc = pDest + pData->iRowsize - (pData->iRowsize+7)/8;
for (iX = pData->iRowsize; ;)
{
*pDest++ = (((*pSrc)>>7)&1);
if (iX-- <= 0)
break;
*pDest++ = (((*pSrc)>>6)&1);
if (iX-- <= 0)
break;
*pDest++ = (((*pSrc)>>5)&1);
if (iX-- <= 0)
break;
*pDest++ = (((*pSrc)>>4)&1);
if (iX-- <= 0)
break;
*pDest++ = (((*pSrc)>>3)&1);
if (iX-- <= 0)
break;
*pDest++ = (((*pSrc)>>2)&1);
if (iX-- <= 0)
break;
*pDest++ = (((*pSrc)>>1)&1);
if (iX-- <= 0)
break;
*pDest++ = (((*pSrc) )&1);
if (iX-- <= 0)
break;
pSrc++;
}
}
else if (pData->iPNGdepth == 2)
{
/* Inflate Workrow to 8-bit */
mng_int32 iX;
mng_uint8p pSrc = pData->pWorkrow+1;
mng_uint8p pDest = pSrc + pData->iRowsize - (2*pData->iRowsize+7)/8;
for (iX = ((2*pData->iRowsize+7)/8) ; iX > 0 ; iX--)
*pDest++ = *pSrc++;
pDest = pData->pWorkrow+1;
pSrc = pDest + pData->iRowsize - (2*pData->iRowsize+7)/8;
for (iX = pData->iRowsize; ;)
{
*pDest++ = (((*pSrc)>>6)&3);
if (iX-- <= 0)
break;
*pDest++ = (((*pSrc)>>4)&3);
if (iX-- <= 0)
break;
*pDest++ = (((*pSrc)>>2)&3);
if (iX-- <= 0)
break;
*pDest++ = (((*pSrc) )&3);
if (iX-- <= 0)
break;
pSrc++;
}
}
else if (pData->iPNGdepth == 4)
{
/* Inflate Workrow to 8-bit */
mng_int32 iX;
mng_uint8p pSrc = pData->pWorkrow+1;
mng_uint8p pDest = pSrc + pData->iRowsize - (4*pData->iRowsize+7)/8;
for (iX = ((4*pData->iRowsize+7)/8) ; iX > 0 ; iX--)
*pDest++ = *pSrc++;
pDest = pData->pWorkrow+1;
pSrc = pDest + pData->iRowsize - (4*pData->iRowsize+7)/8;
for (iX = pData->iRowsize; ;)
{
*pDest++ = (((*pSrc)>>4)&0x0f);
if (iX-- <= 0)
break;
*pDest++ = (((*pSrc) )&0x0f);
if (iX-- <= 0)
break;
pSrc++;
}
}
if (pData->iPNGdepth < 8 && pData->iColortype == 0)
{
/* Expand samples to 8-bit by LBR */
mng_int32 iX;
mng_uint8p pSrc = pData->pWorkrow+1;
mng_uint8 multiplier[]={0,255,85,0,17,0,0,0,1};
for (iX = pData->iRowsize; iX > 0; iX--)
*pSrc++ *= multiplier[pData->iPNGdepth];
}
#endif
#ifdef MNG_NO_16BIT_SUPPORT
if (pData->iPNGdepth > 8)
{
/* Reduce Workrow to 8-bit */
mng_int32 iX;
mng_uint8p pSrc = pData->pWorkrow+1;
mng_uint8p pDest = pSrc;
for (iX = pData->iRowsize; iX > 0; iX--)
{
*pDest = *pSrc;
pDest++;
pSrc+=2;
}
}
#endif
#ifdef FILTER192 /* has leveling info ? */
if (pData->iFilterofs == MNG_FILTER_DIFFERING)
iRslt = init_rowdiffering (pData);
else
#endif
iRslt = MNG_NOERROR;
/* filter the row if necessary */
if ((!iRslt) && (pData->iFilterofs < pData->iPixelofs ) &&
(*(pData->pWorkrow + pData->iFilterofs)) )
iRslt = mng_filter_a_row (pData);
else
iRslt = MNG_NOERROR;
/* additional leveling/differing ? */
if ((!iRslt) && (pData->fDifferrow))
{
iRslt = ((mng_differrow)pData->fDifferrow) (pData);
pSwap = pData->pWorkrow;
pData->pWorkrow = pData->pPrevrow;
pData->pPrevrow = pSwap; /* make sure we're processing the right data */
}
if (!iRslt)
{
#ifdef MNG_INCLUDE_JNG
if (pData->bHasJHDR) /* is JNG alpha-channel ? */
{ /* just store in object ? */
if ((!iRslt) && (pData->fStorerow))
iRslt = ((mng_storerow)pData->fStorerow) (pData);
}
else
#endif /* MNG_INCLUDE_JNG */
{ /* process this row */
if ((!iRslt) && (pData->fProcessrow))
iRslt = ((mng_processrow)pData->fProcessrow) (pData);
/* store in object ? */
if ((!iRslt) && (pData->fStorerow))
iRslt = ((mng_storerow)pData->fStorerow) (pData);
/* color correction ? */
if ((!iRslt) && (pData->fCorrectrow))
iRslt = ((mng_correctrow)pData->fCorrectrow) (pData);
/* slap onto canvas ? */
if ((!iRslt) && (pData->fDisplayrow))
{
iRslt = ((mng_displayrow)pData->fDisplayrow) (pData);
if (!iRslt) /* check progressive display refresh */
iRslt = mng_display_progressive_check (pData);
}
}
}
if (iRslt) /* on error bail out */
MNG_ERROR (pData, iRslt);
if (!pData->fDifferrow) /* swap row-pointers */
{
pSwap = pData->pWorkrow;
pData->pWorkrow = pData->pPrevrow;
pData->pPrevrow = pSwap; /* so prev points to the processed row! */
}
iRslt = mng_next_row (pData); /* adjust variables for next row */
if (iRslt) /* on error bail out */
MNG_ERROR (pData, iRslt);
}
/* let zlib know where to store next output */
pData->sZlib.next_out = pData->pWorkrow;
pData->sZlib.avail_out = (uInt)(pData->iRowsize + pData->iPixelofs);
#ifdef MNG_NO_1_2_4BIT_SUPPORT
if (pData->iPNGdepth < 8)
pData->sZlib.avail_out = (uInt)((pData->iPNGdepth*pData->iRowsize + 7)/8
+ pData->iPixelofs);
#endif
#ifdef MNG_NO_16BIT_SUPPORT
if (pData->iPNGdepth > 8)
pData->sZlib.avail_out = (uInt)(2*pData->iRowsize + pData->iPixelofs);
#endif
}
} /* until some error or EOI
or all pixels received */
while ( (iZrslt == Z_OK) && (pData->sZlib.avail_in > 0) &&
( (pData->iRow < (mng_int32)pData->iDataheight) ||
( (pData->iPass >= 0) && (pData->iPass < 7) ) ) );
/* on error bail out */
if ((iZrslt != Z_OK) && (iZrslt != Z_STREAM_END))
MNG_ERRORZ (pData, (mng_uint32)iZrslt);
/* too much data ? */
if ((iZrslt == Z_OK) && (pData->sZlib.avail_in > 0))
MNG_WARNING (pData, MNG_TOOMUCHIDAT);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEROWS, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_SUPPORT_DISPLAY */
/* ************************************************************************** */
mng_retcode mngzlib_inflatedata (mng_datap pData,
mng_uint32 iInlen,
mng_uint8p pIndata)
{
int iZrslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEDATA, MNG_LC_START);
#endif
/* let zlib know where to get stuff */
pData->sZlib.next_in = pIndata;
pData->sZlib.avail_in = (uInt)iInlen;
/* now inflate the data in one go! */
iZrslt = inflate (&pData->sZlib, Z_FINISH);
/* not enough room in output-buffer ? */
if ((iZrslt == Z_BUF_ERROR) || (pData->sZlib.avail_in > 0))
return MNG_BUFOVERFLOW;
/* on error bail out */
if ((iZrslt != Z_OK) && (iZrslt != Z_STREAM_END))
MNG_ERRORZ (pData, (mng_uint32)iZrslt);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEDATA, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mngzlib_inflatefree (mng_datap pData)
{
int iZrslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEFREE, MNG_LC_START);
#endif
pData->bInflating = MNG_FALSE; /* stopped it */
iZrslt = inflateEnd (&pData->sZlib); /* let zlib cleanup its own stuff */
if (iZrslt != Z_OK) /* on error bail out */
MNG_ERRORZ (pData, (mng_uint32)iZrslt);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEFREE, MNG_LC_END);
#endif
return MNG_NOERROR; /* done */
}
/* ************************************************************************** */
mng_retcode mngzlib_deflateinit (mng_datap pData)
{
int iZrslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEINIT, MNG_LC_START);
#endif
/* initialize zlib structures and such */
iZrslt = deflateInit2 (&pData->sZlib, pData->iZlevel, pData->iZmethod,
pData->iZwindowbits, pData->iZmemlevel,
pData->iZstrategy);
if (iZrslt != Z_OK) /* on error bail out */
MNG_ERRORZ (pData, (mng_uint32)iZrslt);
pData->bDeflating = MNG_TRUE; /* really deflating something now */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEINIT, MNG_LC_END);
#endif
return MNG_NOERROR; /* done */
}
/* ************************************************************************** */
mng_retcode mngzlib_deflaterows (mng_datap pData,
mng_uint32 iInlen,
mng_uint8p pIndata)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEROWS, MNG_LC_START);
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEROWS, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mngzlib_deflatedata (mng_datap pData,
mng_uint32 iInlen,
mng_uint8p pIndata)
{
int iZrslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEDATA, MNG_LC_START);
#endif
pData->sZlib.next_in = pIndata; /* let zlib know where to get stuff */
pData->sZlib.avail_in = (uInt)iInlen;
/* now deflate the data in one go! */
iZrslt = deflate (&pData->sZlib, Z_FINISH);
/* not enough room in output-buffer ? */
if ((iZrslt == Z_BUF_ERROR) || (pData->sZlib.avail_in > 0))
return MNG_BUFOVERFLOW;
/* on error bail out */
if ((iZrslt != Z_OK) && (iZrslt != Z_STREAM_END))
MNG_ERRORZ (pData, (mng_uint32)iZrslt);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEDATA, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mngzlib_deflatefree (mng_datap pData)
{
int iZrslt;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEFREE, MNG_LC_START);
#endif
iZrslt = deflateEnd (&pData->sZlib); /* let zlib cleanup its own stuff */
if (iZrslt != Z_OK) /* on error bail out */
MNG_ERRORZ (pData, (mng_uint32)iZrslt);
pData->bDeflating = MNG_FALSE; /* stopped it */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEFREE, MNG_LC_END);
#endif
return MNG_NOERROR; /* done */
}
/* ************************************************************************** */
#endif /* MNG_INCLUDE_ZLIB */
/* ************************************************************************** */
/* * end of file * */
/* ************************************************************************** */
libmng-2.0.3/config.h 0000644 0001750 0001750 00000007743 12515247541 014317 0 ustar glennrp glennrp /* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */
/* Define to 1 if you have the header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the header file. */
#define HAVE_INTTYPES_H 1
/* define if you want JPEG support */
#define HAVE_LIBJPEG 1
/* define if you want lcms v1 support */
/* #undef HAVE_LIBLCMS1 */
/* define if you want lcms v2 support */
#define HAVE_LIBLCMS2 1
/* Define to 1 if you have the `z' library (-lz). */
#define HAVE_LIBZ 1
/* Define to 1 if you have the header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the header file. */
#define HAVE_UNISTD_H 1
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* define if you want chunk access support */
#define MNG_ACCESS_CHUNKS 1
/* enable building standard shared object */
#define MNG_BUILD_SO 1
/* enable verbose error text */
#define MNG_ERROR_TELLTALE 1
/* define if you want full lcms support */
#define MNG_FULL_CMS 1
/* enable support for accessing chunks */
#define MNG_STORE_CHUNKS 1
/* define if you want display support */
#define MNG_SUPPORT_DISPLAY 1
/* define if you want dynamic support */
#define MNG_SUPPORT_DYNAMICMNG 1
/* define if you want full mng support */
#define MNG_SUPPORT_FULL 1
/* define if you want read support */
#define MNG_SUPPORT_READ 1
/* enable support for debug tracing */
/* #undef MNG_SUPPORT_TRACE */
/* define if you want write support */
#define MNG_SUPPORT_WRITE 1
/* enable support for debug messages */
/* #undef MNG_TRACE_TELLTALE */
/* but: libmng.dll (!) */
#define MNG_VERSION_DLL 2
/* MAJOR number of version */
#define MNG_VERSION_MAJOR 2
/* MINOR number of version */
#define MNG_VERSION_MINOR 0
/* PATCH number of version */
#define MNG_VERSION_RELEASE 3
/* eg. libmng.so.1 */
#define MNG_VERSION_SO 2
/* Name of package */
#define PACKAGE "libmng-2.0.3"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "png-mng-implement@lists.sourceforge.net"
/* Define to the full name of this package. */
#define PACKAGE_NAME "libmng"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "libmng 2.0.3"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libmng-2.0.3"
/* Define to the home page for this package. */
#define PACKAGE_URL "http://www.libmng.com/"
/* Define to the version of this package. */
#define PACKAGE_VERSION "2.0.3"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "2.0.3"
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
/* # undef WORDS_BIGENDIAN */
# endif
#endif
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
libmng-2.0.3/configure.ac 0000644 0001750 0001750 00000017033 12115357037 015156 0 ustar glennrp glennrp dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.65)
#
define([MAJ_NR],[2])
define([MIN_NR],[0])
define([REL_NR],[2])
#
#AC_INIT (PACKAGE, VERSION, [BUG-REPORT], [TARNAME], [URL])
AC_INIT( [libmng],[MAJ_NR.MIN_NR.REL_NR],
[png-mng-implement@lists.sourceforge.net],
[libmng-MAJ_NR.MIN_NR.REL_NR],
[http://www.libmng.com/])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([libmng_hlapi.c])
#
AC_CONFIG_HEADERS(config.h)
#
MNG_MAJOR_NR=MAJ_NR
MNG_MINOR_NR=MIN_NR
MNG_RELEASE_NR=REL_NR
#
AC_SUBST(MNG_MAJOR_NR)
AC_SUBST(MNG_MINOR_NR)
AC_SUBST(MNG_RELEASE_NR)
#
AM_INIT_AUTOMAKE([-Wall -Werror])
dnl pass the version string on the the makefiles
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_DEFINE([MNG_VERSION_MAJOR],[MAJ_NR],[MAJOR number of version])
AC_DEFINE([MNG_VERSION_MINOR],[MIN_NR],[MINOR number of version])
AC_DEFINE([MNG_VERSION_RELEASE],[REL_NR],[PATCH number of version])
AC_DEFINE([MNG_VERSION_SO],[MAJ_NR],[eg. libmng.so.1])
AC_DEFINE([MNG_VERSION_DLL],[MAJ_NR],[ but: libmng.dll (!)])
dnl Checks for programs.
AC_PROG_CC
AC_ISC_POSIX
AM_PROG_LIBTOOL
AC_PROG_INSTALL
AC_LIBTOOL_WIN32_DLL
#
AC_C_BIGENDIAN
#
dnl support for files >2GB
AC_SYS_LARGEFILE
dnl Check for required header files
AC_HEADER_STDC
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
dnl need pow and fabs
AC_CHECK_FUNC(pow, , AC_CHECK_LIB(m, pow, LIBS="$LIBS -lm"))
dnl what functionality we want to add (read, write, display).
dnl all on by default. see libmng_conf.h for full descriptions
dnl not building a standard shared object?
AC_ARG_ENABLE(buildso,
[ --disable-buildso disable building standard shared object])
if test "x$enable_buildso" != "xno"; then
AC_DEFINE([MNG_BUILD_SO], [1], [enable building standard shared object])
fi
dnl we only support the full mng spec for now (no LC or VLC)
AC_DEFINE([MNG_SUPPORT_FULL], [1], [define if you want full mng support])
dnl remove support in library to read images?
AC_ARG_ENABLE(read,
[ --disable-read remove read support from library])
if test "x$enable_read" != "xno"; then
AC_DEFINE([MNG_SUPPORT_READ], [1], [define if you want read support])
fi
dnl remove support in library to write images?
AC_ARG_ENABLE(write,
[ --disable-write remove write support from library])
if test "x$enable_write" != "xno"; then
AC_DEFINE([MNG_SUPPORT_WRITE], [1], [define if you want write support])
fi
dnl remove support in library to display images?
AC_ARG_ENABLE(display,
[ --disable-display remove display support from library])
if test "x$enable_display" != "xno"; then
AC_DEFINE([MNG_SUPPORT_DISPLAY], [1], [define if you want display support])
fi
dnl remove support for 'dynamic' MNG?
AC_ARG_ENABLE(dynamic,
[ --disable-dynamic remove dynamic MNG support from library])
if test "x$enable_dynamic" != "xno"; then
AC_DEFINE([MNG_SUPPORT_DYNAMICMNG], [1], [define if you want dynamic support])
fi
dnl remove support in library to access chunks?
AC_ARG_ENABLE(chunks,
[ --disable-chunks remove support for chunk access])
if test "x$enable_chunks" != "xno"; then
AC_DEFINE([MNG_ACCESS_CHUNKS], [1], [define if you want chunk access support])
fi
dnl disable support for accessing chunks that have been previously read?
AC_ARG_ENABLE(storechunks,
[ --disable-storechunks remove support for access of previous chunks])
if test "x$enable_storechunks" != "xno"; then
AC_DEFINE([MNG_STORE_CHUNKS], [1], [enable support for accessing chunks])
fi
dnl enable support for debug tracing callbacks and messages?
AC_ARG_ENABLE(trace,
[ --enable-trace include support for debug tracing callbacks],[
if test "x$enable_trace" = "xyes"; then
AC_DEFINE([MNG_SUPPORT_TRACE], [1], [enable support for debug tracing])
AC_DEFINE([MNG_TRACE_TELLTALE], [1], [enable support for debug messages])
fi
])
dnl verbose error text
dnl this should always be on
AC_DEFINE([MNG_ERROR_TELLTALE], [1], [enable verbose error text])
dnl libz is required.
AC_ARG_WITH(zlib,
[ --with-zlib[=DIR] use zlib include/library files in DIR],[
if test -d "$withval"; then
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
fi
])
AC_CHECK_HEADER(zlib.h,
AC_CHECK_LIB(z, gzread, , AC_MSG_ERROR(zlib library not found)),
AC_MSG_ERROR(zlib header not found)
)
dnl check for jpeg library
AC_ARG_WITH(jpeg,
[ --with-jpeg[=DIR] use jpeg include/library files in DIR],
[with_jpeg=$withval],[with_jpeg=_auto])
if test "x$with_jpeg" != "xno" -a "x$with_jpeg" != "xyes" -a \
"x$with_jpeg" != "x_auto"; then
# Save in case test with directory specified fails
_cppflags=${CPPFLAGS}
_ldflags=${LDFLAGS}
_restore=1
CPPFLAGS="${CPPFLAGS} -I$withval/include"
LDFLAGS="${LDFLAGS} -L$withval/lib"
else
_restore=0
fi
if test "x$with_jpeg" != "xno"; then
AC_CHECK_HEADER(jpeglib.h,
AC_CHECK_LIB(jpeg, jpeg_read_header, [
LIBS="$LIBS -ljpeg"
AC_DEFINE([HAVE_LIBJPEG], [1], [define if you want JPEG support])
_restore=0
],
AC_MSG_WARN(jpeg library not found)),
AC_MSG_WARN(jpeg header not found)
)
fi
test $_restore -eq 1 && CPPFLAGS=$_cppflags LDFLAGS=$_ldflags
dnl check for lcms2 library
AC_ARG_WITH(lcms2,
[ --with-lcms2[=DIR] use lcms2 include/library files in DIR],
[with_lcms2=$withval],[with_lcms2=_auto])
if test "x$with_lcms2" != "xno" -a "x$with_lcms2" != "xyes" -a \
"x$with_lcms2" != "x_auto"; then
# Save in case test with directory specified fails
_cppflags=$CPPFLAGS
_ldflags=$LDFLAGS
_restore=1
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
else
_restore=0
fi
if test "x$with_lcms2" != "xno"; then
AC_CHECK_HEADER(lcms2.h, [
have_lcms2=yes
AC_CHECK_LIB(lcms2, cmsFreeToneCurve, [
LIBS="$LIBS -llcms2"
AC_DEFINE([HAVE_LIBLCMS2], [1], [define if you want lcms v2 support])
dnl for now this implies MNG_INCLUDE_LCMS in the headers:
AC_DEFINE([MNG_FULL_CMS], [1], [define if you want full lcms support])
_restore=0
have_lcms2=yes
],[
have_lcms2=no
])
])
dnl give feedback only if the user asked specifically for lcms2
if test "x$with_lcms2" != "x_auto" -a "x$have_lcms2" != "xyes"; then
AC_MSG_WARN([lcms2 not found... disabling LCMS v2 support])
fi
fi
if test "x$with_lcms2" != "x_auto" -a "x$have_lcms2" != "xyes"; then
dnl check for lcms library
AC_ARG_WITH(lcms,
[ --with-lcms[=DIR] use lcms include/library files in DIR],
[with_lcms=$withval],[with_lcms=_auto])
if test "x$with_lcms" != "xno" -a "x$with_lcms" != "xyes" -a \
"x$with_lcms" != "x_auto"; then
# Save in case test with directory specified fails
_cppflags=$CPPFLAGS
_ldflags=$LDFLAGS
_restore=1
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
else
_restore=0
fi
if test "x$with_lcms" != "xno"; then
AC_CHECK_HEADER(lcms.h, [
have_lcms=yes
AC_CHECK_LIB(lcms, cmsCreateRGBProfile, [
LIBS="$LIBS -llcms"
AC_DEFINE([HAVE_LIBLCMS1], [1], [define if you want lcms v1 support])
dnl for now this implies MNG_INCLUDE_LCMS in the headers:
AC_DEFINE([MNG_FULL_CMS], [1], [define if you want full lcms support])
_restore=0
have_lcms=yes
],[
have_lcms=no
])
])
dnl give feedback only if the user asked specifically for lcms
if test "x$with_lcms" != "x_auto" -a "x$have_lcms" != "xyes"; then
AC_MSG_WARN([lcms not found... disabling LCMS v1 support])
fi
fi
fi
test $_restore -eq 1 && CPPFLAGS=$_cppflags LDFLAGS=$_ldflags
AC_CONFIG_FILES([Makefile
libmng.pc:libmng.pc.in
])
AC_OUTPUT
libmng-2.0.3/libmng_trace.c 0000644 0001750 0001750 00000244753 12005307152 015464 0 ustar glennrp glennrp #include "config.h"
/* ************************************************************************** */
/* * For conditions of distribution and use, * */
/* * see copyright notice in libmng.h * */
/* ************************************************************************** */
/* * * */
/* * project : libmng * */
/* * file : libmng_trace.c copyright (c) 2000-2007 G.Juyn * */
/* * version : 1.0.10 * */
/* * * */
/* * purpose : Trace functions (implementation) * */
/* * * */
/* * author : G.Juyn * */
/* * * */
/* * comment : implementation of the trace functions * */
/* * * */
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
/* * - changed strict-ANSI stuff * */
/* * 0.5.1 - 05/12/2000 - G.Juyn * */
/* * - added callback error-reporting support * */
/* * * */
/* * 0.5.2 - 05/23/2000 - G.Juyn * */
/* * - added trace telltale reporting * */
/* * 0.5.2 - 05/24/2000 - G.Juyn * */
/* * - added tracestrings for global animation color-chunks * */
/* * - added tracestrings for get/set of default ZLIB/IJG parms * */
/* * - added tracestrings for global PLTE,tRNS,bKGD * */
/* * 0.5.2 - 05/30/2000 - G.Juyn * */
/* * - added tracestrings for image-object promotion * */
/* * - added tracestrings for delta-image processing * */
/* * 0.5.2 - 06/02/2000 - G.Juyn * */
/* * - added tracestrings for getalphaline callback * */
/* * 0.5.2 - 06/05/2000 - G.Juyn * */
/* * - added tracestring for RGB8_A8 canvasstyle * */
/* * 0.5.2 - 06/06/2000 - G.Juyn * */
/* * - added tracestring for mng_read_resume HLAPI function * */
/* * * */
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
/* * - added tracestrings for get/set speedtype * */
/* * - added tracestring for get imagelevel * */
/* * 0.5.3 - 06/22/2000 - G.Juyn * */
/* * - added tracestring for delta-image processing * */
/* * - added tracestrings for PPLT chunk processing * */
/* * * */
/* * 0.9.1 - 07/07/2000 - G.Juyn * */
/* * - added tracecodes for special display processing * */
/* * 0.9.1 - 07/08/2000 - G.Juyn * */
/* * - added tracestring for get/set suspensionmode * */
/* * - added tracestrings for get/set display variables * */
/* * - added tracecode for read_databuffer (I/O-suspension) * */
/* * 0.9.1 - 07/15/2000 - G.Juyn * */
/* * - added tracestrings for SAVE/SEEK callbacks * */
/* * - added tracestrings for get/set sectionbreaks * */
/* * - added tracestring for special error routine * */
/* * 0.9.1 - 07/19/2000 - G.Juyn * */
/* * - added tracestring for updatemngheader * */
/* * * */
/* * 0.9.2 - 07/31/2000 - G.Juyn * */
/* * - added tracestrings for status_xxxxx functions * */
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - 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 * */
/* * * */
/* * 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!) * */
/* * * */
/* * 1.0.2 - 06/23/2001 - G.Juyn * */
/* * - added optimization option for MNG-video playback * */
/* * - added processterm callback * */
/* * 1.0.2 - 06/25/2001 - G.Juyn * */
/* * - added option to turn off progressive refresh * */
/* * * */
/* * 1.0.3 - 08/06/2001 - G.Juyn * */
/* * - added get function for last processed BACK chunk * */
/* * * */
/* * 1.0.5 - 08/15/2002 - G.Juyn * */
/* * - completed PROM support * */
/* * - completed delta-image support * */
/* * 1.0.5 - 08/19/2002 - G.Juyn * */
/* * - B597134 - libmng pollutes the linker namespace * */
/* * - added HLAPI function to copy chunks * */
/* * 1.0.5 - 09/14/2002 - G.Juyn * */
/* * - added event handling for dynamic MNG * */
/* * 1.0.5 - 09/20/2002 - G.Juyn * */
/* * - added support for PAST * */
/* * 1.0.5 - 09/22/2002 - G.Juyn * */
/* * - added bgrx8 canvas (filler byte) * */
/* * 1.0.5 - 09/23/2002 - G.Juyn * */
/* * - added in-memory color-correction of abstract images * */
/* * - added compose over/under routines for PAST processing * */
/* * - added flip & tile routines for PAST processing * */
/* * 1.0.5 - 10/09/2002 - G.Juyn * */
/* * - fixed trace-constants for PAST chunk * */
/* * 1.0.5 - 11/07/2002 - G.Juyn * */
/* * - added support to get totals after mng_read() * */
/* * * */
/* * 1.0.6 - 07/07/2003 - G.R-P * */
/* * - added conditionals around JNG and Delta-PNG code * */
/* * 1.0.6 - 07/14/2003 - G.R-P * */
/* * - added conditionals around various unused functions * */
/* * 1.0.6 - 07/29/2003 - G.R-P * */
/* * - added conditionals around PAST chunk support * */
/* * * */
/* * 1.0.7 - 11/27/2003 - R.A * */
/* * - added CANVAS_RGB565 and CANVAS_BGR565 * */
/* * 1.0.7 - 01/25/2004 - J.S * */
/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */
/* * 1.0.7 - 03/07/2004 - G. Randers-Pehrson * */
/* * - put gamma, cms-related declarations inside #ifdef * */
/* * 1.0.7 - 03/10/2004 - G.R-P * */
/* * - added conditionals around openstream/closestream * */
/* * * */
/* * 1.0.8 - 04/02/2004 - G.Juyn * */
/* * - added CRC existence & checking flags * */
/* * 1.0.8 - 04/11/2004 - G.Juyn * */
/* * - added data-push mechanisms for specialized decoders * */
/* * * */
/* * 1.0.9 - 10/03/2004 - G.Juyn * */
/* * - added function to retrieve current FRAM delay * */
/* * 1.0.9 - 10/14/2004 - G.Juyn * */
/* * - added bgr565_a8 canvas-style (thanks to J. Elvander) * */
/* * * */
/* * 1.0.10 - 04/08/2007 - G.Juyn * */
/* * - added support for mPNG proposal * */
/* * 1.0.10 - 07/06/2007 - G.R-P bugfix by Lucas Quintana * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
#include "libmng_data.h"
#include "libmng_error.h"
#include "libmng_trace.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
#pragma option -A /* force ANSI-C */
#endif
/* ************************************************************************** */
#ifdef MNG_INCLUDE_TRACE_PROCS
/* ************************************************************************** */
#ifdef MNG_INCLUDE_TRACE_STRINGS
MNG_LOCAL mng_trace_entry const trace_table [] =
{
{MNG_FN_INITIALIZE, "initialize"},
{MNG_FN_RESET, "reset"},
{MNG_FN_CLEANUP, "cleanup"},
{MNG_FN_READ, "read"},
{MNG_FN_WRITE, "write"},
{MNG_FN_CREATE, "create"},
{MNG_FN_READDISPLAY, "readdisplay"},
{MNG_FN_DISPLAY, "display"},
{MNG_FN_DISPLAY_RESUME, "display_resume"},
{MNG_FN_DISPLAY_FREEZE, "display_freeze"},
{MNG_FN_DISPLAY_RESET, "display_reset"},
#ifndef MNG_NO_DISPLAY_GO_SUPPORTED
{MNG_FN_DISPLAY_GOFRAME, "display_goframe"},
{MNG_FN_DISPLAY_GOLAYER, "display_golayer"},
{MNG_FN_DISPLAY_GOTIME, "display_gotime"},
#endif
{MNG_FN_GETLASTERROR, "getlasterror"},
{MNG_FN_READ_RESUME, "read_resume"},
{MNG_FN_TRAPEVENT, "trapevent"},
{MNG_FN_READ_PUSHDATA, "read_pushdata"},
{MNG_FN_READ_PUSHSIG, "read_pushsig"},
{MNG_FN_READ_PUSHCHUNK, "read_pushchunk"},
{MNG_FN_SETCB_MEMALLOC, "setcb_memalloc"},
{MNG_FN_SETCB_MEMFREE, "setcb_memfree"},
{MNG_FN_SETCB_READDATA, "setcb_readdata"},
{MNG_FN_SETCB_WRITEDATA, "setcb_writedata"},
{MNG_FN_SETCB_ERRORPROC, "setcb_errorproc"},
{MNG_FN_SETCB_TRACEPROC, "setcb_traceproc"},
{MNG_FN_SETCB_PROCESSHEADER, "setcb_processheader"},
{MNG_FN_SETCB_PROCESSTEXT, "setcb_processtext"},
{MNG_FN_SETCB_GETCANVASLINE, "setcb_getcanvasline"},
{MNG_FN_SETCB_GETBKGDLINE, "setcb_getbkgdline"},
{MNG_FN_SETCB_REFRESH, "setcb_refresh"},
{MNG_FN_SETCB_GETTICKCOUNT, "setcb_gettickcount"},
{MNG_FN_SETCB_SETTIMER, "setcb_settimer"},
{MNG_FN_SETCB_PROCESSGAMMA, "setcb_processgamma"},
{MNG_FN_SETCB_PROCESSCHROMA, "setcb_processchroma"},
{MNG_FN_SETCB_PROCESSSRGB, "setcb_processsrgb"},
{MNG_FN_SETCB_PROCESSICCP, "setcb_processiccp"},
{MNG_FN_SETCB_PROCESSAROW, "setcb_processarow"},
#ifndef MNG_NO_OPEN_CLOSE_STREAM
{MNG_FN_SETCB_OPENSTREAM, "setcb_openstream"},
{MNG_FN_SETCB_CLOSESTREAM, "setcb_closestream"},
#endif
{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_SETCB_PROCESSMEND, "setcb_processmend"},
{MNG_FN_SETCB_PROCESSTERM, "setcb_processterm"},
{MNG_FN_SETCB_RELEASEDATA, "setcb_releasedata"},
{MNG_FN_GETCB_MEMALLOC, "getcb_memalloc"},
{MNG_FN_GETCB_MEMFREE, "getcb_memfree"},
{MNG_FN_GETCB_READDATA, "getcb_readdata,"},
{MNG_FN_GETCB_WRITEDATA, "getcb_writedata"},
{MNG_FN_GETCB_ERRORPROC, "getcb_errorproc"},
{MNG_FN_GETCB_TRACEPROC, "getcb_traceproc"},
{MNG_FN_GETCB_PROCESSHEADER, "getcb_processheader"},
{MNG_FN_GETCB_PROCESSTEXT, "getcb_processtext"},
{MNG_FN_GETCB_GETCANVASLINE, "getcb_getcanvasline"},
{MNG_FN_GETCB_GETBKGDLINE, "getcb_getbkgdline"},
{MNG_FN_GETCB_REFRESH, "getcb_refresh"},
{MNG_FN_GETCB_GETTICKCOUNT, "getcb_gettickcount"},
{MNG_FN_GETCB_SETTIMER, "getcb_settimer"},
{MNG_FN_GETCB_PROCESSGAMMA, "getcb_processgamma"},
{MNG_FN_GETCB_PROCESSCHROMA, "getcb_processchroma"},
{MNG_FN_GETCB_PROCESSSRGB, "getcb_processsrgb"},
{MNG_FN_GETCB_PROCESSICCP, "getcb_processiccp"},
{MNG_FN_GETCB_PROCESSAROW, "getcb_processarow"},
#ifndef MNG_NO_OPEN_CLOSE_STREAM
{MNG_FN_GETCB_OPENSTREAM, "getcb_openstream"},
{MNG_FN_GETCB_CLOSESTREAM, "getcb_closestream"},
#endif
{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_GETCB_PROCESSMEND, "getcb_processmend"},
{MNG_FN_GETCB_PROCESSTERM, "getcb_processterm"},
{MNG_FN_GETCB_RELEASEDATA, "getcb_releasedata"},
{MNG_FN_SET_USERDATA, "set_userdata"},
{MNG_FN_SET_CANVASSTYLE, "set_canvasstyle"},
{MNG_FN_SET_BKGDSTYLE, "set_bkgdstyle"},
{MNG_FN_SET_BGCOLOR, "set_bgcolor"},
{MNG_FN_SET_STORECHUNKS, "set_storechunks"},
#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS)
{MNG_FN_SET_VIEWGAMMA, "set_viewgamma"},
#ifndef MNG_NO_DFLT_INFO
{MNG_FN_SET_DISPLAYGAMMA, "set_displaygamma"},
#endif
{MNG_FN_SET_DFLTIMGGAMMA, "set_dfltimggamma"},
#endif
{MNG_FN_SET_SRGB, "set_srgb"},
{MNG_FN_SET_OUTPUTPROFILE, "set_outputprofile"},
{MNG_FN_SET_SRGBPROFILE, "set_srgbprofile"},
#ifndef MNG_SKIP_MAXCANVAS
{MNG_FN_SET_MAXCANVASWIDTH, "set_maxcanvaswidth"},
{MNG_FN_SET_MAXCANVASHEIGHT, "set_maxcanvasheight"},
{MNG_FN_SET_MAXCANVASSIZE, "set_maxcanvassize"},
#endif
#ifndef MNG_NO_ACCESS_ZLIB
{MNG_FN_SET_ZLIB_LEVEL, "set_zlib_level"},
{MNG_FN_SET_ZLIB_METHOD, "set_zlib_method"},
{MNG_FN_SET_ZLIB_WINDOWBITS, "set_zlib_windowbits"},
{MNG_FN_SET_ZLIB_MEMLEVEL, "set_zlib_memlevel"},
{MNG_FN_SET_ZLIB_STRATEGY, "set_zlib_strategy"},
{MNG_FN_SET_ZLIB_MAXIDAT, "set_zlib_maxidat"},
#endif
#ifndef MNG_NO_ACCESS_JPEG
{MNG_FN_SET_JPEG_DCTMETHOD, "set_jpeg_dctmethod"},
{MNG_FN_SET_JPEG_QUALITY, "set_jpeg_quality"},
{MNG_FN_SET_JPEG_SMOOTHING, "set_jpeg_smoothing"},
{MNG_FN_SET_JPEG_PROGRESSIVE, "set_jpeg_progressive"},
{MNG_FN_SET_JPEG_OPTIMIZED, "set_jpeg_optimized"},
{MNG_FN_SET_JPEG_MAXJDAT, "set_jpeg_maxjdat"},
#endif
{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_SET_OUTPUTPROFILE2, "set_outputprofile2"},
{MNG_FN_SET_SRGBPROFILE2, "set_srgbprofile2"},
{MNG_FN_SET_OUTPUTSRGB, "set_outputsrgb"},
{MNG_FN_SET_SRGBIMPLICIT, "set_srgbimplicit"},
{MNG_FN_SET_CACHEPLAYBACK, "set_cacheplayback"},
{MNG_FN_SET_DOPROGRESSIVE, "set_doprogressive"},
{MNG_FN_SET_CRCMODE, "set_crcmode"},
{MNG_FN_GET_USERDATA, "get_userdata"},
{MNG_FN_GET_SIGTYPE, "get_sigtype"},
{MNG_FN_GET_IMAGETYPE, "get_imagetype"},
{MNG_FN_GET_IMAGEWIDTH, "get_imagewidth"},
{MNG_FN_GET_IMAGEHEIGHT, "get_imageheight"},
{MNG_FN_GET_TICKS, "get_ticks"},
{MNG_FN_GET_FRAMECOUNT, "get_framecount"},
{MNG_FN_GET_LAYERCOUNT, "get_layercount"},
{MNG_FN_GET_PLAYTIME, "get_playtime"},
{MNG_FN_GET_SIMPLICITY, "get_simplicity"},
{MNG_FN_GET_CANVASSTYLE, "get_canvasstyle"},
{MNG_FN_GET_BKGDSTYLE, "get_bkgdstyle"},
{MNG_FN_GET_BGCOLOR, "get_bgcolor"},
{MNG_FN_GET_STORECHUNKS, "get_storechunks"},
#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS)
{MNG_FN_GET_VIEWGAMMA, "get_viewgamma"},
{MNG_FN_GET_DISPLAYGAMMA, "get_displaygamma"},
#ifndef MNG_NO_DFLT_INFO
{MNG_FN_GET_DFLTIMGGAMMA, "get_dfltimggamma"},
#endif
#endif
{MNG_FN_GET_SRGB, "get_srgb"},
#ifndef MNG_SKIP_MAXCANVAS
{MNG_FN_GET_MAXCANVASWIDTH, "get_maxcanvaswidth"},
{MNG_FN_GET_MAXCANVASHEIGHT, "get_maxcanvasheight"},
#endif
#ifndef MNG_NO_ACCESS_ZLIB
{MNG_FN_GET_ZLIB_LEVEL, "get_zlib_level"},
{MNG_FN_GET_ZLIB_METHOD, "get_zlib_method"},
{MNG_FN_GET_ZLIB_WINDOWBITS, "get_zlib_windowbits"},
{MNG_FN_GET_ZLIB_MEMLEVEL, "get_zlib_memlevel"},
{MNG_FN_GET_ZLIB_STRATEGY, "get_zlib_strategy"},
{MNG_FN_GET_ZLIB_MAXIDAT, "get_zlib_maxidat"},
#endif
#ifndef MNG_NO_ACCESS_JPEG
{MNG_FN_GET_JPEG_DCTMETHOD, "get_jpeg_dctmethod"},
{MNG_FN_GET_JPEG_QUALITY, "get_jpeg_quality"},
{MNG_FN_GET_JPEG_SMOOTHING, "get_jpeg_smoothing"},
{MNG_FN_GET_JPEG_PROGRESSIVE, "get_jpeg_progressive"},
{MNG_FN_GET_JPEG_OPTIMIZED, "get_jpeg_optimized"},
{MNG_FN_GET_JPEG_MAXJDAT, "get_jpeg_maxjdat"},
#endif
{MNG_FN_GET_SPEED, "get_speed"},
{MNG_FN_GET_IMAGELEVEL, "get_imagelevel"},
{MNG_FN_GET_SUSPENSIONMODE, "get_speed"},
{MNG_FN_GET_STARTTIME, "get_starttime"},
{MNG_FN_GET_RUNTIME, "get_runtime"},
#ifndef MNG_NO_CURRENT_INFO
{MNG_FN_GET_CURRENTFRAME, "get_currentframe"},
{MNG_FN_GET_CURRENTLAYER, "get_currentlayer"},
{MNG_FN_GET_CURRENTPLAYTIME, "get_currentplaytime"},
#endif
{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_GET_CACHEPLAYBACK, "get_cacheplayback"},
{MNG_FN_GET_DOPROGRESSIVE, "get_doprogressive"},
{MNG_FN_GET_LASTBACKCHUNK, "get_lastbackchunk"},
{MNG_FN_GET_LASTSEEKNAME, "get_lastseekname"},
#ifndef MNG_NO_CURRENT_INFO
{MNG_FN_GET_TOTALFRAMES, "get_totalframes"},
{MNG_FN_GET_TOTALLAYERS, "get_totallayers"},
{MNG_FN_GET_TOTALPLAYTIME, "get_totalplaytime"},
#endif
{MNG_FN_GET_CRCMODE, "get_crcmode"},
{MNG_FN_GET_CURRFRAMDELAY, "get_currframdelay"},
{MNG_FN_STATUS_ERROR, "status_error"},
{MNG_FN_STATUS_READING, "status_reading"},
{MNG_FN_STATUS_SUSPENDBREAK, "status_suspendbreak"},
{MNG_FN_STATUS_CREATING, "status_creating"},
{MNG_FN_STATUS_WRITING, "status_writing"},
{MNG_FN_STATUS_DISPLAYING, "status_displaying"},
{MNG_FN_STATUS_RUNNING, "status_running"},
{MNG_FN_STATUS_TIMERBREAK, "status_timerbreak"},
{MNG_FN_STATUS_DYNAMIC, "status_dynamic"},
{MNG_FN_STATUS_RUNNINGEVENT, "status_runningevent"},
{MNG_FN_ITERATE_CHUNKS, "iterate_chunks"},
{MNG_FN_COPY_CHUNK, "copy_chunk"},
{MNG_FN_GETCHUNK_IHDR, "getchunk_ihdr"},
{MNG_FN_GETCHUNK_PLTE, "getchunk_plte"},
{MNG_FN_GETCHUNK_IDAT, "getchunk_idat"},
{MNG_FN_GETCHUNK_IEND, "getchunk_iend"},
{MNG_FN_GETCHUNK_TRNS, "getchunk_trns"},
#ifndef MNG_SKIPCHUNK_gAMA
{MNG_FN_GETCHUNK_GAMA, "getchunk_gama"},
#endif
#ifndef MNG_SKIPCHUNK_cHRM
{MNG_FN_GETCHUNK_CHRM, "getchunk_chrm"},
#endif
#ifndef MNG_SKIPCHUNK_sRGB
{MNG_FN_GETCHUNK_SRGB, "getchunk_srgb"},
#endif
#ifndef MNG_SKIPCHUNK_iCCP
{MNG_FN_GETCHUNK_ICCP, "getchunk_iccp"},
#endif
#ifndef MNG_SKIPCHUNK_tEXt
{MNG_FN_GETCHUNK_TEXT, "getchunk_text"},
#endif
#ifndef MNG_SKIPCHUNK_zTXt
{MNG_FN_GETCHUNK_ZTXT, "getchunk_ztxt"},
#endif
#ifndef MNG_SKIPCHUNK_iTXt
{MNG_FN_GETCHUNK_ITXT, "getchunk_itxt"},
#endif
#ifndef MNG_SKIPCHUNK_bKGD
{MNG_FN_GETCHUNK_BKGD, "getchunk_bkgd"},
#endif
#ifndef MNG_SKIPCHUNK_pHYs
{MNG_FN_GETCHUNK_PHYS, "getchunk_phys"},
#endif
#ifndef MNG_SKIPCHUNK_sBIT
{MNG_FN_GETCHUNK_SBIT, "getchunk_sbit"},
#endif
#ifndef MNG_SKIPCHUNK_sPLT
{MNG_FN_GETCHUNK_SPLT, "getchunk_splt"},
#endif
#ifndef MNG_SKIPCHUNK_hIST
{MNG_FN_GETCHUNK_HIST, "getchunk_hist"},
#endif
#ifndef MNG_SKIPCHUNK_tIME
{MNG_FN_GETCHUNK_TIME, "getchunk_time"},
#endif
{MNG_FN_GETCHUNK_MHDR, "getchunk_mhdr"},
{MNG_FN_GETCHUNK_MEND, "getchunk_mend"},
#ifndef MNG_SKIPCHUNK_LOOP
{MNG_FN_GETCHUNK_LOOP, "getchunk_loop"},
{MNG_FN_GETCHUNK_ENDL, "getchunk_endl"},
#endif
{MNG_FN_GETCHUNK_DEFI, "getchunk_defi"},
#ifndef MNG_SKIPCHUNK_BASI
{MNG_FN_GETCHUNK_BASI, "getchunk_basi"},
#endif
{MNG_FN_GETCHUNK_CLON, "getchunk_clon"},
#ifndef MNG_SKIPCHUNK_PAST
{MNG_FN_GETCHUNK_PAST, "getchunk_past"},
#endif
{MNG_FN_GETCHUNK_DISC, "getchunk_disc"},
{MNG_FN_GETCHUNK_BACK, "getchunk_back"},
{MNG_FN_GETCHUNK_FRAM, "getchunk_fram"},
{MNG_FN_GETCHUNK_MOVE, "getchunk_move"},
{MNG_FN_GETCHUNK_CLIP, "getchunk_clip"},
{MNG_FN_GETCHUNK_SHOW, "getchunk_show"},
{MNG_FN_GETCHUNK_TERM, "getchunk_term"},
#ifndef MNG_SKIPCHUNK_SAVE
{MNG_FN_GETCHUNK_SAVE, "getchunk_save"},
#endif
#ifndef MNG_SKIPCHUNK_SEEK
{MNG_FN_GETCHUNK_SEEK, "getchunk_seek"},
#endif
#ifndef MNG_SKIPCHUNK_eXPI
{MNG_FN_GETCHUNK_EXPI, "getchunk_expi"},
#endif
#ifndef MNG_SKIPCHUNK_fPRI
{MNG_FN_GETCHUNK_FPRI, "getchunk_fpri"},
#endif
#ifndef MNG_SKIPCHUNK_nEED
{MNG_FN_GETCHUNK_NEED, "getchunk_need"},
#endif
#ifndef MNG_SKIPCHUNK_pHYg
{MNG_FN_GETCHUNK_PHYG, "getchunk_phyg"},
#endif
#ifdef MNG_INCLUDE_JNG
{MNG_FN_GETCHUNK_JHDR, "getchunk_jhdr"},
{MNG_FN_GETCHUNK_JDAT, "getchunk_jdat"},
{MNG_FN_GETCHUNK_JSEP, "getchunk_jsep"},
#endif
#ifndef MNG_NO_DELTA_PNG
{MNG_FN_GETCHUNK_DHDR, "getchunk_dhdr"},
{MNG_FN_GETCHUNK_PROM, "getchunk_prom"},
{MNG_FN_GETCHUNK_IPNG, "getchunk_ipng"},
{MNG_FN_GETCHUNK_PPLT, "getchunk_pplt"},
#ifdef MNG_INCLUDE_JNG
{MNG_FN_GETCHUNK_IJNG, "getchunk_ijng"},
#endif
#ifndef MNG_SKIPCHUNK_DROP
{MNG_FN_GETCHUNK_DROP, "getchunk_drop"},
#endif
#ifndef MNG_SKIPCHUNK_DBYK
{MNG_FN_GETCHUNK_DBYK, "getchunk_dbyk"},
#endif
#ifndef MNG_SKIPCHUNK_ORDR
{MNG_FN_GETCHUNK_ORDR, "getchunk_ordr"},
#endif
#endif
{MNG_FN_GETCHUNK_UNKNOWN, "getchunk_unknown"},
{MNG_FN_GETCHUNK_MAGN, "getchunk_magn"},
#ifdef MNG_INCLUDE_JNG
{MNG_FN_GETCHUNK_JDAA, "getchunk_jdaa"},
#endif
#ifndef MNG_SKIPCHUNK_evNT
{MNG_FN_GETCHUNK_EVNT, "getchunk_evnt"},
#endif
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
{MNG_FN_GETCHUNK_MPNG, "getchunk_mpng"},
#endif
#ifndef MNG_SKIPCHUNK_PAST
{MNG_FN_GETCHUNK_PAST_SRC, "getchunk_past_src"},
#endif
#ifndef MNG_SKIPCHUNK_SAVE
{MNG_FN_GETCHUNK_SAVE_ENTRY, "getchunk_save_entry"},
#endif
#ifndef MNG_NO_DELTA_PNG
{MNG_FN_GETCHUNK_PPLT_ENTRY, "getchunk_pplt_entry"},
{MNG_FN_GETCHUNK_ORDR_ENTRY, "getchunk_ordr_entry"},
#endif
#ifndef MNG_SKIPCHUNK_evNT
{MNG_FN_GETCHUNK_EVNT_ENTRY, "getchunk_evnt_entry"},
#endif
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
{MNG_FN_GETCHUNK_MPNG_FRAME, "getchunk_mpng_frame"},
#endif
{MNG_FN_PUTCHUNK_IHDR, "putchunk_ihdr"},
{MNG_FN_PUTCHUNK_PLTE, "putchunk_plte"},
{MNG_FN_PUTCHUNK_IDAT, "putchunk_idat"},
{MNG_FN_PUTCHUNK_IEND, "putchunk_iend"},
{MNG_FN_PUTCHUNK_TRNS, "putchunk_trns"},
#ifndef MNG_SKIPCHUNK_gAMA
{MNG_FN_PUTCHUNK_GAMA, "putchunk_gama"},
#endif
#ifndef MNG_SKIPCHUNK_cHRM
{MNG_FN_PUTCHUNK_CHRM, "putchunk_chrm"},
#endif
#ifndef MNG_SKIPCHUNK_sRGB
{MNG_FN_PUTCHUNK_SRGB, "putchunk_srgb"},
#endif
#ifndef MNG_SKIPCHUNK_iCCP
{MNG_FN_PUTCHUNK_ICCP, "putchunk_iccp"},
#endif
#ifndef MNG_SKIPCHUNK_tEXt
{MNG_FN_PUTCHUNK_TEXT, "putchunk_text"},
#endif
#ifndef MNG_SKIPCHUNK_zTXt
{MNG_FN_PUTCHUNK_ZTXT, "putchunk_ztxt"},
#endif
#ifndef MNG_SKIPCHUNK_iTXt
{MNG_FN_PUTCHUNK_ITXT, "putchunk_itxt"},
#endif
#ifndef MNG_SKIPCHUNK_bKGD
{MNG_FN_PUTCHUNK_BKGD, "putchunk_bkgd"},
#endif
#ifndef MNG_SKIPCHUNK_pHYs
{MNG_FN_PUTCHUNK_PHYS, "putchunk_phys"},
#endif
#ifndef MNG_SKIPCHUNK_sBIT
{MNG_FN_PUTCHUNK_SBIT, "putchunk_sbit"},
#endif
#ifndef MNG_SKIPCHUNK_sPLT
{MNG_FN_PUTCHUNK_SPLT, "putchunk_splt"},
#endif
#ifndef MNG_SKIPCHUNK_hIST
{MNG_FN_PUTCHUNK_HIST, "putchunk_hist"},
#endif
#ifndef MNG_SKIPCHUNK_tIME
{MNG_FN_PUTCHUNK_TIME, "putchunk_time"},
#endif
{MNG_FN_PUTCHUNK_MHDR, "putchunk_mhdr"},
{MNG_FN_PUTCHUNK_MEND, "putchunk_mend"},
{MNG_FN_PUTCHUNK_LOOP, "putchunk_loop"},
{MNG_FN_PUTCHUNK_ENDL, "putchunk_endl"},
{MNG_FN_PUTCHUNK_DEFI, "putchunk_defi"},
{MNG_FN_PUTCHUNK_BASI, "putchunk_basi"},
{MNG_FN_PUTCHUNK_CLON, "putchunk_clon"},
#ifndef MNG_SKIPCHUNK_PAST
{MNG_FN_PUTCHUNK_PAST, "putchunk_past"},
#endif
{MNG_FN_PUTCHUNK_DISC, "putchunk_disc"},
{MNG_FN_PUTCHUNK_BACK, "putchunk_back"},
{MNG_FN_PUTCHUNK_FRAM, "putchunk_fram"},
{MNG_FN_PUTCHUNK_MOVE, "putchunk_move"},
{MNG_FN_PUTCHUNK_CLIP, "putchunk_clip"},
{MNG_FN_PUTCHUNK_SHOW, "putchunk_show"},
{MNG_FN_PUTCHUNK_TERM, "putchunk_term"},
#ifndef MNG_SKIPCHUNK_SAVE
{MNG_FN_PUTCHUNK_SAVE, "putchunk_save"},
#endif
#ifndef MNG_SKIPCHUNK_SEEK
{MNG_FN_PUTCHUNK_SEEK, "putchunk_seek"},
#endif
#ifndef MNG_SKIPCHUNK_eXPI
{MNG_FN_PUTCHUNK_EXPI, "putchunk_expi"},
#endif
#ifndef MNG_SKIPCHUNK_fPRI
{MNG_FN_PUTCHUNK_FPRI, "putchunk_fpri"},
#endif
#ifndef MNG_SKIPCHUNK_nEED
{MNG_FN_PUTCHUNK_NEED, "putchunk_need"},
#endif
#ifndef MNG_SKIPCHUNK_pHYg
{MNG_FN_PUTCHUNK_PHYG, "putchunk_phyg"},
#endif
#ifdef MNG_INCLUDE_JNG
{MNG_FN_PUTCHUNK_JHDR, "putchunk_jhdr"},
{MNG_FN_PUTCHUNK_JDAT, "putchunk_jdat"},
{MNG_FN_PUTCHUNK_JSEP, "putchunk_jsep"},
#endif
#ifndef MNG_NO_DELTA_PNG
{MNG_FN_PUTCHUNK_DHDR, "putchunk_dhdr"},
{MNG_FN_PUTCHUNK_PROM, "putchunk_prom"},
#ifdef MNG_INCLUDE_JNG
{MNG_FN_PUTCHUNK_IPNG, "putchunk_ipng"},
#endif
{MNG_FN_PUTCHUNK_PPLT, "putchunk_pplt"},
{MNG_FN_PUTCHUNK_IJNG, "putchunk_ijng"},
#ifndef MNG_SKIPCHUNK_DROP
{MNG_FN_PUTCHUNK_DROP, "putchunk_drop"},
#endif
#ifndef MNG_SKIPCHUNK_DBYK
{MNG_FN_PUTCHUNK_DBYK, "putchunk_dbyk"},
#endif
#ifndef MNG_SKIPCHUNK_ORDR
{MNG_FN_PUTCHUNK_ORDR, "putchunk_ordr"},
#endif
#endif
{MNG_FN_PUTCHUNK_UNKNOWN, "putchunk_unknown"},
{MNG_FN_PUTCHUNK_MAGN, "putchunk_magn"},
{MNG_FN_PUTCHUNK_JDAA, "putchunk_jdaa"},
#ifndef MNG_SKIPCHUNK_evNT
{MNG_FN_PUTCHUNK_EVNT, "putchunk_evnt"},
#endif
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
{MNG_FN_PUTCHUNK_MPNG, "putchunk_mpng"},
#endif
#ifndef MNG_SKIPCHUNK_PAST
{MNG_FN_PUTCHUNK_PAST_SRC, "putchunk_past_src"},
#endif
#ifndef MNG_SKIPCHUNK_SAVE
{MNG_FN_PUTCHUNK_SAVE_ENTRY, "putchunk_save_entry"},
#endif
#ifndef MNG_NO_DELTA_PNG
{MNG_FN_PUTCHUNK_PPLT_ENTRY, "putchunk_pplt_entry"},
#ifndef MNG_SKIPCHUNK_ORDR
{MNG_FN_PUTCHUNK_ORDR_ENTRY, "putchunk_ordr_entry"},
#endif
#endif
#ifndef MNG_SKIPCHUNK_evNT
{MNG_FN_PUTCHUNK_EVNT_ENTRY, "putchunk_evnt_entry"},
#endif
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
{MNG_FN_PUTCHUNK_MPNG_FRAME, "putchunk_mpng_frame"},
#endif
{MNG_FN_GETIMGDATA_SEQ, "getimgdata_seq"},
{MNG_FN_GETIMGDATA_CHUNKSEQ, "getimgdata_chunkseq"},
{MNG_FN_GETIMGDATA_CHUNK, "getimgdata_chunk"},
{MNG_FN_PUTIMGDATA_IHDR, "putimgdata_ihdr"},
#ifdef MNG_INCLUDE_JNG
{MNG_FN_PUTIMGDATA_JHDR, "putimgdata_jhdr"},
{MNG_FN_PUTIMGDATA_BASI, "putimgdata_basi"},
{MNG_FN_PUTIMGDATA_DHDR, "putimgdata_dhdr"},
#endif
{MNG_FN_UPDATEMNGHEADER, "updatemngheader"},
{MNG_FN_UPDATEMNGSIMPLICITY, "updatemngsimplicity"},
{MNG_FN_PROCESS_RAW_CHUNK, "process_raw_chunk"},
{MNG_FN_READ_GRAPHIC, "read_graphic"},
{MNG_FN_DROP_CHUNKS, "drop_chunks"},
{MNG_FN_PROCESS_ERROR, "process_error"},
{MNG_FN_CLEAR_CMS, "clear_cms"},
{MNG_FN_DROP_OBJECTS, "drop_objects"},
{MNG_FN_READ_CHUNK, "read_chunk"},
{MNG_FN_LOAD_BKGDLAYER, "load_bkgdlayer"},
{MNG_FN_NEXT_FRAME, "next_frame"},
{MNG_FN_NEXT_LAYER, "next_layer"},
{MNG_FN_INTERFRAME_DELAY, "interframe_delay"},
{MNG_FN_DISPLAY_IMAGE, "display_image"},
{MNG_FN_DROP_IMGOBJECTS, "drop_imgobjects"},
{MNG_FN_DROP_ANIOBJECTS, "drop_aniobjects"},
{MNG_FN_INFLATE_BUFFER, "inflate_buffer"},
{MNG_FN_DEFLATE_BUFFER, "deflate_buffer"},
{MNG_FN_WRITE_RAW_CHUNK, "write_raw_chunk"},
{MNG_FN_WRITE_GRAPHIC, "write_graphic"},
{MNG_FN_SAVE_STATE, "save_state"},
{MNG_FN_RESTORE_STATE, "restore_state"},
{MNG_FN_DROP_SAVEDATA, "drop_savedata"},
#ifndef MNG_NO_DELTA_PNG
{MNG_FN_EXECUTE_DELTA_IMAGE, "execute_delta_image"},
#endif
{MNG_FN_PROCESS_DISPLAY, "process_display"},
{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_RELEASE_PUSHDATA, "release_pushdata"},
{MNG_FN_READ_DATA, "read_data"},
{MNG_FN_READ_CHUNK_CRC, "read_chunk_crc"},
{MNG_FN_RELEASE_PUSHCHUNK, "release_pushchunk"},
{MNG_FN_DISPLAY_RGB8, "display_rgb8"},
{MNG_FN_DISPLAY_RGBA8, "display_rgba8"},
{MNG_FN_DISPLAY_ARGB8, "display_argb8"},
{MNG_FN_DISPLAY_BGR8, "display_bgr8"},
{MNG_FN_DISPLAY_BGRA8, "display_bgra8"},
{MNG_FN_DISPLAY_ABGR8, "display_abgr8"},
{MNG_FN_DISPLAY_RGB16, "display_rgb16"},
{MNG_FN_DISPLAY_RGBA16, "display_rgba16"},
{MNG_FN_DISPLAY_ARGB16, "display_argb16"},
{MNG_FN_DISPLAY_BGR16, "display_bgr16"},
{MNG_FN_DISPLAY_BGRA16, "display_bgra16"},
{MNG_FN_DISPLAY_ABGR16, "display_abgr16"},
{MNG_FN_DISPLAY_INDEX8, "display_index8"},
{MNG_FN_DISPLAY_INDEXA8, "display_indexa8"},
{MNG_FN_DISPLAY_AINDEX8, "display_aindex8"},
{MNG_FN_DISPLAY_GRAY8, "display_gray8"},
{MNG_FN_DISPLAY_GRAY16, "display_gray16"},
{MNG_FN_DISPLAY_GRAYA8, "display_graya8"},
{MNG_FN_DISPLAY_GRAYA16, "display_graya16"},
{MNG_FN_DISPLAY_AGRAY8, "display_agray8"},
{MNG_FN_DISPLAY_AGRAY16, "display_agray16"},
{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_DISPLAY_BGRX8, "display_bgrx8"},
{MNG_FN_DISPLAY_RGB565, "display_rgb565"},
{MNG_FN_DISPLAY_RGBA565, "display_rgba565"},
{MNG_FN_DISPLAY_BGR565, "display_bgr565"},
{MNG_FN_DISPLAY_BGRA565, "display_bgra565"},
{MNG_FN_DISPLAY_RGBA8_PM, "display_rgba8_pm"},
{MNG_FN_DISPLAY_ARGB8_PM, "display_argb8_pm"},
{MNG_FN_DISPLAY_ABGR8_PM, "display_abgr8_pm"},
{MNG_FN_DISPLAY_BGR565_A8, "display_bgr565_a8"},
{MNG_FN_INIT_FULL_CMS, "init_full_cms"},
{MNG_FN_CORRECT_FULL_CMS, "correct_full_cms"},
{MNG_FN_INIT_GAMMA_ONLY, "init_gamma_only"},
{MNG_FN_CORRECT_GAMMA_ONLY, "correct_gamma_only"},
{MNG_FN_CORRECT_APP_CMS, "correct_app_cms"},
{MNG_FN_INIT_FULL_CMS_OBJ, "init_full_cms_obj"},
{MNG_FN_INIT_GAMMA_ONLY_OBJ, "init_gamma_only_obj"},
{MNG_FN_INIT_APP_CMS, "init_app_cms"},
{MNG_FN_INIT_APP_CMS_OBJ, "init_app_cms_obj"},
{MNG_FN_PROCESS_G1, "process_g1"},
{MNG_FN_PROCESS_G2, "process_g2"},
{MNG_FN_PROCESS_G4, "process_g4"},
{MNG_FN_PROCESS_G8, "process_g8"},
{MNG_FN_PROCESS_G16, "process_g16"},
{MNG_FN_PROCESS_RGB8, "process_rgb8"},
{MNG_FN_PROCESS_RGB16, "process_rgb16"},
{MNG_FN_PROCESS_IDX1, "process_idx1"},
{MNG_FN_PROCESS_IDX2, "process_idx2"},
{MNG_FN_PROCESS_IDX4, "process_idx4"},
{MNG_FN_PROCESS_IDX8, "process_idx8"},
{MNG_FN_PROCESS_GA8, "process_ga8"},
{MNG_FN_PROCESS_GA16, "process_ga16"},
{MNG_FN_PROCESS_RGBA8, "process_rgba8"},
{MNG_FN_PROCESS_RGBA16, "process_rgba16"},
{MNG_FN_INIT_G1_I, "init_g1_i"},
{MNG_FN_INIT_G2_I, "init_g2_i"},
{MNG_FN_INIT_G4_I, "init_g4_i"},
{MNG_FN_INIT_G8_I, "init_g8_i"},
{MNG_FN_INIT_G16_I, "init_g16_i"},
{MNG_FN_INIT_RGB8_I, "init_rgb8_i"},
{MNG_FN_INIT_RGB16_I, "init_rgb16_i"},
{MNG_FN_INIT_IDX1_I, "init_idx1_i"},
{MNG_FN_INIT_IDX2_I, "init_idx2_i"},
{MNG_FN_INIT_IDX4_I, "init_idx4_i"},
{MNG_FN_INIT_IDX8_I, "init_idx8_i"},
{MNG_FN_INIT_GA8_I, "init_ga8_i"},
{MNG_FN_INIT_GA16_I, "init_ga16_i"},
{MNG_FN_INIT_RGBA8_I, "init_rgba8_i"},
{MNG_FN_INIT_RGBA16_I, "init_rgba16_i"},
#ifndef MNG_OPTIMIZE_FOOTPRINT_INIT
{MNG_FN_INIT_G1_NI, "init_g1_ni"},
{MNG_FN_INIT_G2_NI, "init_g2_ni"},
{MNG_FN_INIT_G4_NI, "init_g4_ni"},
{MNG_FN_INIT_G8_NI, "init_g8_ni"},
{MNG_FN_INIT_G16_NI, "init_g16_ni"},
{MNG_FN_INIT_RGB8_NI, "init_rgb8_ni"},
{MNG_FN_INIT_RGB16_NI, "init_rgb16_ni"},
{MNG_FN_INIT_IDX1_NI, "init_idx1_ni"},
{MNG_FN_INIT_IDX2_NI, "init_idx2_ni"},
{MNG_FN_INIT_IDX4_NI, "init_idx4_ni"},
{MNG_FN_INIT_IDX8_NI, "init_idx8_ni"},
{MNG_FN_INIT_GA8_NI, "init_ga8_ni"},
{MNG_FN_INIT_GA16_NI, "init_ga16_ni"},
{MNG_FN_INIT_RGBA8_NI, "init_rgba8_ni"},
{MNG_FN_INIT_RGBA16_NI, "init_rgba16_ni"},
#endif
{MNG_FN_INIT_ROWPROC, "init_rowproc"},
{MNG_FN_NEXT_ROW, "next_row"},
{MNG_FN_CLEANUP_ROWPROC, "cleanup_rowproc"},
{MNG_FN_FILTER_A_ROW, "filter_a_row"},
{MNG_FN_FILTER_SUB, "filter_sub"},
{MNG_FN_FILTER_UP, "filter_up"},
{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"},
{MNG_FN_CREATE_IMGOBJECT, "create_imgobject"},
{MNG_FN_FREE_IMGOBJECT, "free_imgobject"},
{MNG_FN_FIND_IMGOBJECT, "find_imgobject"},
{MNG_FN_CLONE_IMGOBJECT, "clone_imgobject"},
{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_COLORCORRECT_OBJECT, "colorcorrect_object"},
{MNG_FN_STORE_G1, "store_g1"},
{MNG_FN_STORE_G2, "store_g2"},
{MNG_FN_STORE_G4, "store_g4"},
{MNG_FN_STORE_G8, "store_g8"},
{MNG_FN_STORE_G16, "store_g16"},
{MNG_FN_STORE_RGB8, "store_rgb8"},
{MNG_FN_STORE_RGB16, "store_rgb16"},
{MNG_FN_STORE_IDX1, "store_idx1"},
{MNG_FN_STORE_IDX2, "store_idx2"},
{MNG_FN_STORE_IDX4, "store_idx4"},
{MNG_FN_STORE_IDX8, "store_idx8"},
{MNG_FN_STORE_GA8, "store_ga8"},
{MNG_FN_STORE_GA16, "store_ga16"},
{MNG_FN_STORE_RGBA8, "store_rgba8"},
{MNG_FN_STORE_RGBA16, "store_rgba16"},
{MNG_FN_RETRIEVE_G8, "retrieve_g8"},
{MNG_FN_RETRIEVE_G16, "retrieve_g16"},
{MNG_FN_RETRIEVE_RGB8, "retrieve_rgb8"},
{MNG_FN_RETRIEVE_RGB16, "retrieve_rgb16"},
{MNG_FN_RETRIEVE_IDX8, "retrieve_idx8"},
{MNG_FN_RETRIEVE_GA8, "retrieve_ga8"},
{MNG_FN_RETRIEVE_GA16, "retrieve_ga16"},
{MNG_FN_RETRIEVE_RGBA8, "retrieve_rgba8"},
{MNG_FN_RETRIEVE_RGBA16, "retrieve_rgba16"},
#ifndef MNG_NO_DELTA_PNG
{MNG_FN_DELTA_G1, "delta_g1"},
{MNG_FN_DELTA_G2, "delta_g2"},
{MNG_FN_DELTA_G4, "delta_g4"},
{MNG_FN_DELTA_G8, "delta_g8"},
{MNG_FN_DELTA_G16, "delta_g16"},
{MNG_FN_DELTA_RGB8, "delta_rgb8"},
{MNG_FN_DELTA_RGB16, "delta_rgb16"},
{MNG_FN_DELTA_IDX1, "delta_idx1"},
{MNG_FN_DELTA_IDX2, "delta_idx2"},
{MNG_FN_DELTA_IDX4, "delta_idx4"},
{MNG_FN_DELTA_IDX8, "delta_idx8"},
{MNG_FN_DELTA_GA8, "delta_ga8"},
{MNG_FN_DELTA_GA16, "delta_ga16"},
{MNG_FN_DELTA_RGBA8, "delta_rgba8"},
{MNG_FN_DELTA_RGBA16, "delta_rgba16"},
#endif
{MNG_FN_CREATE_ANI_LOOP, "create_ani_loop"},
{MNG_FN_CREATE_ANI_ENDL, "create_ani_endl"},
{MNG_FN_CREATE_ANI_DEFI, "create_ani_defi"},
{MNG_FN_CREATE_ANI_BASI, "create_ani_basi"},
{MNG_FN_CREATE_ANI_CLON, "create_ani_clon"},
#ifndef MNG_SKIPCHUNK_PAST
{MNG_FN_CREATE_ANI_PAST, "create_ani_past"},
#endif
{MNG_FN_CREATE_ANI_DISC, "create_ani_disc"},
{MNG_FN_CREATE_ANI_BACK, "create_ani_back"},
{MNG_FN_CREATE_ANI_FRAM, "create_ani_fram"},
{MNG_FN_CREATE_ANI_MOVE, "create_ani_move"},
{MNG_FN_CREATE_ANI_CLIP, "create_ani_clip"},
{MNG_FN_CREATE_ANI_SHOW, "create_ani_show"},
{MNG_FN_CREATE_ANI_TERM, "create_ani_term"},
{MNG_FN_CREATE_ANI_SAVE, "create_ani_save"},
{MNG_FN_CREATE_ANI_SEEK, "create_ani_seek"},
{MNG_FN_CREATE_ANI_GAMA, "create_ani_gama"},
{MNG_FN_CREATE_ANI_CHRM, "create_ani_chrm"},
{MNG_FN_CREATE_ANI_SRGB, "create_ani_srgb"},
{MNG_FN_CREATE_ANI_ICCP, "create_ani_iccp"},
{MNG_FN_CREATE_ANI_PLTE, "create_ani_plte"},
{MNG_FN_CREATE_ANI_TRNS, "create_ani_trns"},
{MNG_FN_CREATE_ANI_BKGD, "create_ani_bkgd"},
#ifndef MNG_NO_DELTA_PNG
{MNG_FN_CREATE_ANI_DHDR, "create_ani_dhdr"},
{MNG_FN_CREATE_ANI_PROM, "create_ani_prom"},
#ifdef MNG_INCLUDE_JNG
{MNG_FN_CREATE_ANI_IPNG, "create_ani_ipng"},
#endif
{MNG_FN_CREATE_ANI_IJNG, "create_ani_ijng"},
{MNG_FN_CREATE_ANI_PPLT, "create_ani_pplt"},
#endif
{MNG_FN_CREATE_ANI_MAGN, "create_ani_magn"},
{MNG_FN_CREATE_ANI_IMAGE, "create_ani_image"},
{MNG_FN_CREATE_EVENT, "create_event"},
{MNG_FN_FREE_ANI_LOOP, "free_ani_loop"},
{MNG_FN_FREE_ANI_ENDL, "free_ani_endl"},
{MNG_FN_FREE_ANI_DEFI, "free_ani_defi"},
{MNG_FN_FREE_ANI_BASI, "free_ani_basi"},
{MNG_FN_FREE_ANI_CLON, "free_ani_clon"},
#ifndef MNG_SKIPCHUNK_PAST
{MNG_FN_FREE_ANI_PAST, "free_ani_past"},
#endif
{MNG_FN_FREE_ANI_DISC, "free_ani_disc"},
{MNG_FN_FREE_ANI_BACK, "free_ani_back"},
{MNG_FN_FREE_ANI_FRAM, "free_ani_fram"},
{MNG_FN_FREE_ANI_MOVE, "free_ani_move"},
{MNG_FN_FREE_ANI_CLIP, "free_ani_clip"},
{MNG_FN_FREE_ANI_SHOW, "free_ani_show"},
{MNG_FN_FREE_ANI_TERM, "free_ani_term"},
{MNG_FN_FREE_ANI_SAVE, "free_ani_save"},
{MNG_FN_FREE_ANI_SEEK, "free_ani_seek"},
{MNG_FN_FREE_ANI_GAMA, "free_ani_gama"},
{MNG_FN_FREE_ANI_CHRM, "free_ani_chrm"},
{MNG_FN_FREE_ANI_SRGB, "free_ani_srgb"},
{MNG_FN_FREE_ANI_ICCP, "free_ani_iccp"},
{MNG_FN_FREE_ANI_PLTE, "free_ani_plte"},
{MNG_FN_FREE_ANI_TRNS, "free_ani_trns"},
{MNG_FN_FREE_ANI_BKGD, "free_ani_bkgd"},
#ifndef MNG_NO_DELTA_PNG
{MNG_FN_FREE_ANI_DHDR, "free_ani_dhdr"},
{MNG_FN_FREE_ANI_PROM, "free_ani_prom"},
#ifdef MNG_INCLUDE_JNG
{MNG_FN_FREE_ANI_IPNG, "free_ani_ipng"},
#endif
{MNG_FN_FREE_ANI_IJNG, "free_ani_ijng"},
{MNG_FN_FREE_ANI_PPLT, "free_ani_pplt"},
#endif
{MNG_FN_FREE_ANI_MAGN, "free_ani_magn"},
{MNG_FN_FREE_ANI_IMAGE, "free_ani_image"},
{MNG_FN_FREE_EVENT, "free_event"},
{MNG_FN_PROCESS_ANI_LOOP, "process_ani_loop"},
{MNG_FN_PROCESS_ANI_ENDL, "process_ani_endl"},
{MNG_FN_PROCESS_ANI_DEFI, "process_ani_defi"},
{MNG_FN_PROCESS_ANI_BASI, "process_ani_basi"},
{MNG_FN_PROCESS_ANI_CLON, "process_ani_clon"},
#ifndef MNG_SKIPCHUNK_PAST
{MNG_FN_PROCESS_ANI_PAST, "process_ani_past"},
#endif
{MNG_FN_PROCESS_ANI_DISC, "process_ani_disc"},
{MNG_FN_PROCESS_ANI_BACK, "process_ani_back"},
{MNG_FN_PROCESS_ANI_FRAM, "process_ani_fram"},
{MNG_FN_PROCESS_ANI_MOVE, "process_ani_move"},
{MNG_FN_PROCESS_ANI_CLIP, "process_ani_clip"},
{MNG_FN_PROCESS_ANI_SHOW, "process_ani_show"},
{MNG_FN_PROCESS_ANI_TERM, "process_ani_term"},
{MNG_FN_PROCESS_ANI_SAVE, "process_ani_save"},
{MNG_FN_PROCESS_ANI_SEEK, "process_ani_seek"},
{MNG_FN_PROCESS_ANI_GAMA, "process_ani_gama"},
{MNG_FN_PROCESS_ANI_CHRM, "process_ani_chrm"},
{MNG_FN_PROCESS_ANI_SRGB, "process_ani_srgb"},
{MNG_FN_PROCESS_ANI_ICCP, "process_ani_iccp"},
{MNG_FN_PROCESS_ANI_PLTE, "process_ani_plte"},
{MNG_FN_PROCESS_ANI_TRNS, "process_ani_trns"},
{MNG_FN_PROCESS_ANI_BKGD, "process_ani_bkgd"},
#ifndef MNG_NO_DELTA_PNG
{MNG_FN_PROCESS_ANI_DHDR, "process_ani_dhdr"},
{MNG_FN_PROCESS_ANI_PROM, "process_ani_prom"},
#ifdef MNG_INCLUDE_JNG
{MNG_FN_PROCESS_ANI_IPNG, "process_ani_ipng"},
#endif
{MNG_FN_PROCESS_ANI_IJNG, "process_ani_ijng"},
{MNG_FN_PROCESS_ANI_PPLT, "process_ani_pplt"},
#endif
{MNG_FN_PROCESS_ANI_MAGN, "process_ani_magn"},
{MNG_FN_PROCESS_ANI_IMAGE, "process_ani_image"},
{MNG_FN_PROCESS_EVENT, "process_event"},
{MNG_FN_RESTORE_BACKIMAGE, "restore_backimage"},
{MNG_FN_RESTORE_BACKCOLOR, "restore_backcolor"},
{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_RESTORE_BGRX8, "restore_bgrx8"},
{MNG_FN_RESTORE_RGB565, "restore_rgb565"},
{MNG_FN_INIT_IHDR, "init_ihdr"},
{MNG_FN_INIT_PLTE, "init_plte"},
{MNG_FN_INIT_IDAT, "init_idat"},
{MNG_FN_INIT_IEND, "init_iend"},
{MNG_FN_INIT_TRNS, "init_trns"},
{MNG_FN_INIT_GAMA, "init_gama"},
{MNG_FN_INIT_CHRM, "init_chrm"},
{MNG_FN_INIT_SRGB, "init_srgb"},
{MNG_FN_INIT_ICCP, "init_iccp"},
{MNG_FN_INIT_TEXT, "init_text"},
{MNG_FN_INIT_ZTXT, "init_ztxt"},
{MNG_FN_INIT_ITXT, "init_itxt"},
{MNG_FN_INIT_BKGD, "init_bkgd"},
{MNG_FN_INIT_PHYS, "init_phys"},
{MNG_FN_INIT_SBIT, "init_sbit"},
{MNG_FN_INIT_SPLT, "init_splt"},
{MNG_FN_INIT_HIST, "init_hist"},
{MNG_FN_INIT_TIME, "init_time"},
{MNG_FN_INIT_MHDR, "init_mhdr"},
{MNG_FN_INIT_MEND, "init_mend"},
{MNG_FN_INIT_LOOP, "init_loop"},
{MNG_FN_INIT_ENDL, "init_endl"},
{MNG_FN_INIT_DEFI, "init_defi"},
{MNG_FN_INIT_BASI, "init_basi"},
{MNG_FN_INIT_CLON, "init_clon"},
#ifndef MNG_SKIPCHUNK_PAST
{MNG_FN_INIT_PAST, "init_past"},
#endif
{MNG_FN_INIT_DISC, "init_disc"},
{MNG_FN_INIT_BACK, "init_back"},
{MNG_FN_INIT_FRAM, "init_fram"},
{MNG_FN_INIT_MOVE, "init_move"},
{MNG_FN_INIT_CLIP, "init_clip"},
{MNG_FN_INIT_SHOW, "init_show"},
{MNG_FN_INIT_TERM, "init_term"},
{MNG_FN_INIT_SAVE, "init_save"},
{MNG_FN_INIT_SEEK, "init_seek"},
{MNG_FN_INIT_EXPI, "init_expi"},
{MNG_FN_INIT_FPRI, "init_fpri"},
{MNG_FN_INIT_NEED, "init_need"},
{MNG_FN_INIT_PHYG, "init_phyg"},
#ifndef MNG_NO_DELTA_PNG
{MNG_FN_INIT_JHDR, "init_jhdr"},
{MNG_FN_INIT_JDAT, "init_jdat"},
{MNG_FN_INIT_JSEP, "init_jsep"},
#endif
#ifndef MNG_NO_DELTA_PNG
{MNG_FN_INIT_DHDR, "init_dhdr"},
{MNG_FN_INIT_PROM, "init_prom"},
#ifdef MNG_INCLUDE_JNG
{MNG_FN_INIT_IPNG, "init_ipng"},
#endif
{MNG_FN_INIT_PPLT, "init_pplt"},
{MNG_FN_INIT_IJNG, "init_ijng"},
{MNG_FN_INIT_DROP, "init_drop"},
{MNG_FN_INIT_DBYK, "init_dbyk"},
{MNG_FN_INIT_ORDR, "init_ordr"},
#endif
{MNG_FN_INIT_UNKNOWN, "init_unknown"},
{MNG_FN_INIT_MAGN, "init_magn"},
{MNG_FN_INIT_JDAA, "init_jdaa"},
{MNG_FN_INIT_EVNT, "init_evnt"},
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
{MNG_FN_INIT_MPNG, "init_mpng"},
#endif
{MNG_FN_ASSIGN_IHDR, "assign_ihdr"},
{MNG_FN_ASSIGN_PLTE, "assign_plte"},
{MNG_FN_ASSIGN_IDAT, "assign_idat"},
{MNG_FN_ASSIGN_IEND, "assign_iend"},
{MNG_FN_ASSIGN_TRNS, "assign_trns"},
{MNG_FN_ASSIGN_GAMA, "assign_gama"},
{MNG_FN_ASSIGN_CHRM, "assign_chrm"},
{MNG_FN_ASSIGN_SRGB, "assign_srgb"},
{MNG_FN_ASSIGN_ICCP, "assign_iccp"},
{MNG_FN_ASSIGN_TEXT, "assign_text"},
{MNG_FN_ASSIGN_ZTXT, "assign_ztxt"},
{MNG_FN_ASSIGN_ITXT, "assign_itxt"},
{MNG_FN_ASSIGN_BKGD, "assign_bkgd"},
{MNG_FN_ASSIGN_PHYS, "assign_phys"},
{MNG_FN_ASSIGN_SBIT, "assign_sbit"},
{MNG_FN_ASSIGN_SPLT, "assign_splt"},
{MNG_FN_ASSIGN_HIST, "assign_hist"},
{MNG_FN_ASSIGN_TIME, "assign_time"},
{MNG_FN_ASSIGN_MHDR, "assign_mhdr"},
{MNG_FN_ASSIGN_MEND, "assign_mend"},
{MNG_FN_ASSIGN_LOOP, "assign_loop"},
{MNG_FN_ASSIGN_ENDL, "assign_endl"},
{MNG_FN_ASSIGN_DEFI, "assign_defi"},
{MNG_FN_ASSIGN_BASI, "assign_basi"},
{MNG_FN_ASSIGN_CLON, "assign_clon"},
#ifndef MNG_SKIPCHUNK_PAST
{MNG_FN_ASSIGN_PAST, "assign_past"},
#endif
{MNG_FN_ASSIGN_DISC, "assign_disc"},
{MNG_FN_ASSIGN_BACK, "assign_back"},
{MNG_FN_ASSIGN_FRAM, "assign_fram"},
{MNG_FN_ASSIGN_MOVE, "assign_move"},
{MNG_FN_ASSIGN_CLIP, "assign_clip"},
{MNG_FN_ASSIGN_SHOW, "assign_show"},
{MNG_FN_ASSIGN_TERM, "assign_term"},
{MNG_FN_ASSIGN_SAVE, "assign_save"},
{MNG_FN_ASSIGN_SEEK, "assign_seek"},
{MNG_FN_ASSIGN_EXPI, "assign_expi"},
{MNG_FN_ASSIGN_FPRI, "assign_fpri"},
{MNG_FN_ASSIGN_NEED, "assign_need"},
{MNG_FN_ASSIGN_PHYG, "assign_phyg"},
#ifdef MNG_INCLUDE_JNG
{MNG_FN_ASSIGN_JHDR, "assign_jhdr"},
{MNG_FN_ASSIGN_JDAT, "assign_jdat"},
{MNG_FN_ASSIGN_JSEP, "assign_jsep"},
#endif
#ifndef MNG_NO_DELTA_PNG
{MNG_FN_ASSIGN_DHDR, "assign_dhdr"},
{MNG_FN_ASSIGN_PROM, "assign_prom"},
#ifdef MNG_INCLUDE_JNG
{MNG_FN_ASSIGN_IPNG, "assign_ipng"},
#endif
{MNG_FN_ASSIGN_PPLT, "assign_pplt"},
{MNG_FN_ASSIGN_IJNG, "assign_ijng"},
{MNG_FN_ASSIGN_DROP, "assign_drop"},
{MNG_FN_ASSIGN_DBYK, "assign_dbyk"},
{MNG_FN_ASSIGN_ORDR, "assign_ordr"},
#endif
{MNG_FN_ASSIGN_UNKNOWN, "assign_unknown"},
{MNG_FN_ASSIGN_MAGN, "assign_magn"},
{MNG_FN_ASSIGN_JDAA, "assign_jdaa"},
{MNG_FN_ASSIGN_EVNT, "assign_evnt"},
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
{MNG_FN_ASSIGN_MPNG, "assign_mpng"},
#endif
{MNG_FN_FREE_IHDR, "free_ihdr"},
{MNG_FN_FREE_PLTE, "free_plte"},
{MNG_FN_FREE_IDAT, "free_idat"},
{MNG_FN_FREE_IEND, "free_iend"},
{MNG_FN_FREE_TRNS, "free_trns"},
{MNG_FN_FREE_GAMA, "free_gama"},
{MNG_FN_FREE_CHRM, "free_chrm"},
{MNG_FN_FREE_SRGB, "free_srgb"},
{MNG_FN_FREE_ICCP, "free_iccp"},
{MNG_FN_FREE_TEXT, "free_text"},
{MNG_FN_FREE_ZTXT, "free_ztxt"},
{MNG_FN_FREE_ITXT, "free_itxt"},
{MNG_FN_FREE_BKGD, "free_bkgd"},
{MNG_FN_FREE_PHYS, "free_phys"},
{MNG_FN_FREE_SBIT, "free_sbit"},
{MNG_FN_FREE_SPLT, "free_splt"},
{MNG_FN_FREE_HIST, "free_hist"},
{MNG_FN_FREE_TIME, "free_time"},
{MNG_FN_FREE_MHDR, "free_mhdr"},
{MNG_FN_FREE_MEND, "free_mend"},
{MNG_FN_FREE_LOOP, "free_loop"},
{MNG_FN_FREE_ENDL, "free_endl"},
{MNG_FN_FREE_DEFI, "free_defi"},
{MNG_FN_FREE_BASI, "free_basi"},
{MNG_FN_FREE_CLON, "free_clon"},
#ifndef MNG_SKIPCHUNK_PAST
{MNG_FN_FREE_PAST, "free_past"},
#endif
{MNG_FN_FREE_DISC, "free_disc"},
{MNG_FN_FREE_BACK, "free_back"},
{MNG_FN_FREE_FRAM, "free_fram"},
{MNG_FN_FREE_MOVE, "free_move"},
{MNG_FN_FREE_CLIP, "free_clip"},
{MNG_FN_FREE_SHOW, "free_show"},
{MNG_FN_FREE_TERM, "free_term"},
{MNG_FN_FREE_SAVE, "free_save"},
{MNG_FN_FREE_SEEK, "free_seek"},
{MNG_FN_FREE_EXPI, "free_expi"},
{MNG_FN_FREE_FPRI, "free_fpri"},
{MNG_FN_FREE_NEED, "free_need"},
{MNG_FN_FREE_PHYG, "free_phyg"},
#ifdef MNG_INCLUDE_JNG
{MNG_FN_FREE_JHDR, "free_jhdr"},
{MNG_FN_FREE_JDAT, "free_jdat"},
{MNG_FN_FREE_JSEP, "free_jsep"},
#endif
#ifndef MNG_NO_DELTA_PNG
{MNG_FN_FREE_DHDR, "free_dhdr"},
{MNG_FN_FREE_PROM, "free_prom"},
#ifdef MNG_INCLUDE_JNG
{MNG_FN_FREE_IPNG, "free_ipng"},
#endif
{MNG_FN_FREE_PPLT, "free_pplt"},
{MNG_FN_FREE_IJNG, "free_ijng"},
{MNG_FN_FREE_DROP, "free_drop"},
{MNG_FN_FREE_DBYK, "free_dbyk"},
{MNG_FN_FREE_ORDR, "free_ordr"},
#endif
{MNG_FN_FREE_UNKNOWN, "free_unknown"},
{MNG_FN_FREE_MAGN, "free_magn"},
{MNG_FN_FREE_JDAA, "free_jdaa"},
{MNG_FN_FREE_EVNT, "free_evnt"},
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
{MNG_FN_FREE_MPNG, "free_mpng"},
#endif
{MNG_FN_READ_IHDR, "read_ihdr"},
{MNG_FN_READ_PLTE, "read_plte"},
{MNG_FN_READ_IDAT, "read_idat"},
{MNG_FN_READ_IEND, "read_iend"},
{MNG_FN_READ_TRNS, "read_trns"},
{MNG_FN_READ_GAMA, "read_gama"},
{MNG_FN_READ_CHRM, "read_chrm"},
{MNG_FN_READ_SRGB, "read_srgb"},
{MNG_FN_READ_ICCP, "read_iccp"},
{MNG_FN_READ_TEXT, "read_text"},
{MNG_FN_READ_ZTXT, "read_ztxt"},
{MNG_FN_READ_ITXT, "read_itxt"},
{MNG_FN_READ_BKGD, "read_bkgd"},
{MNG_FN_READ_PHYS, "read_phys"},
{MNG_FN_READ_SBIT, "read_sbit"},
{MNG_FN_READ_SPLT, "read_splt"},
{MNG_FN_READ_HIST, "read_hist"},
{MNG_FN_READ_TIME, "read_time"},
{MNG_FN_READ_MHDR, "read_mhdr"},
{MNG_FN_READ_MEND, "read_mend"},
{MNG_FN_READ_LOOP, "read_loop"},
{MNG_FN_READ_ENDL, "read_endl"},
{MNG_FN_READ_DEFI, "read_defi"},
{MNG_FN_READ_BASI, "read_basi"},
{MNG_FN_READ_CLON, "read_clon"},
#ifndef MNG_SKIPCHUNK_PAST
{MNG_FN_READ_PAST, "read_past"},
#endif
{MNG_FN_READ_DISC, "read_disc"},
{MNG_FN_READ_BACK, "read_back"},
{MNG_FN_READ_FRAM, "read_fram"},
{MNG_FN_READ_MOVE, "read_move"},
{MNG_FN_READ_CLIP, "read_clip"},
{MNG_FN_READ_SHOW, "read_show"},
{MNG_FN_READ_TERM, "read_term"},
{MNG_FN_READ_SAVE, "read_save"},
{MNG_FN_READ_SEEK, "read_seek"},
{MNG_FN_READ_EXPI, "read_expi"},
{MNG_FN_READ_FPRI, "read_fpri"},
{MNG_FN_READ_NEED, "read_need"},
{MNG_FN_READ_PHYG, "read_phyg"},
#ifdef MNG_INCLUDE_JNG
{MNG_FN_READ_JHDR, "read_jhdr"},
{MNG_FN_READ_JDAT, "read_jdat"},
{MNG_FN_READ_JSEP, "read_jsep"},
#endif
#ifndef MNG_NO_DELTA_PNG
{MNG_FN_READ_DHDR, "read_dhdr"},
{MNG_FN_READ_PROM, "read_prom"},
{MNG_FN_READ_IPNG, "read_ipng"},
{MNG_FN_READ_PPLT, "read_pplt"},
#ifdef MNG_INCLUDE_JNG
{MNG_FN_READ_IJNG, "read_ijng"},
#endif
{MNG_FN_READ_DROP, "read_drop"},
{MNG_FN_READ_DBYK, "read_dbyk"},
{MNG_FN_READ_ORDR, "read_ordr"},
#endif
{MNG_FN_READ_UNKNOWN, "read_unknown"},
{MNG_FN_READ_MAGN, "read_magn"},
{MNG_FN_READ_JDAA, "read_jdaa"},
{MNG_FN_READ_EVNT, "read_evnt"},
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
{MNG_FN_READ_MPNG, "read_mpng"},
#endif
{MNG_FN_WRITE_IHDR, "write_ihdr"},
{MNG_FN_WRITE_PLTE, "write_plte"},
{MNG_FN_WRITE_IDAT, "write_idat"},
{MNG_FN_WRITE_IEND, "write_iend"},
{MNG_FN_WRITE_TRNS, "write_trns"},
{MNG_FN_WRITE_GAMA, "write_gama"},
{MNG_FN_WRITE_CHRM, "write_chrm"},
{MNG_FN_WRITE_SRGB, "write_srgb"},
{MNG_FN_WRITE_ICCP, "write_iccp"},
{MNG_FN_WRITE_TEXT, "write_text"},
{MNG_FN_WRITE_ZTXT, "write_ztxt"},
{MNG_FN_WRITE_ITXT, "write_itxt"},
{MNG_FN_WRITE_BKGD, "write_bkgd"},
{MNG_FN_WRITE_PHYS, "write_phys"},
{MNG_FN_WRITE_SBIT, "write_sbit"},
{MNG_FN_WRITE_SPLT, "write_splt"},
{MNG_FN_WRITE_HIST, "write_hist"},
{MNG_FN_WRITE_TIME, "write_time"},
{MNG_FN_WRITE_MHDR, "write_mhdr"},
{MNG_FN_WRITE_MEND, "write_mend"},
{MNG_FN_WRITE_LOOP, "write_loop"},
{MNG_FN_WRITE_ENDL, "write_endl"},
{MNG_FN_WRITE_DEFI, "write_defi"},
{MNG_FN_WRITE_BASI, "write_basi"},
{MNG_FN_WRITE_CLON, "write_clon"},
#ifndef MNG_SKIPCHUNK_PAST
{MNG_FN_WRITE_PAST, "write_past"},
#endif
{MNG_FN_WRITE_DISC, "write_disc"},
{MNG_FN_WRITE_BACK, "write_back"},
{MNG_FN_WRITE_FRAM, "write_fram"},
{MNG_FN_WRITE_MOVE, "write_move"},
{MNG_FN_WRITE_CLIP, "write_clip"},
{MNG_FN_WRITE_SHOW, "write_show"},
{MNG_FN_WRITE_TERM, "write_term"},
{MNG_FN_WRITE_SAVE, "write_save"},
{MNG_FN_WRITE_SEEK, "write_seek"},
{MNG_FN_WRITE_EXPI, "write_expi"},
{MNG_FN_WRITE_FPRI, "write_fpri"},
{MNG_FN_WRITE_NEED, "write_need"},
{MNG_FN_WRITE_PHYG, "write_phyg"},
#ifdef MNG_INCLUDE_JNG
{MNG_FN_WRITE_JHDR, "write_jhdr"},
{MNG_FN_WRITE_JDAT, "write_jdat"},
{MNG_FN_WRITE_JSEP, "write_jsep"},
#endif
#ifndef MNG_NO_DELTA_PNG
{MNG_FN_WRITE_DHDR, "write_dhdr"},
{MNG_FN_WRITE_PROM, "write_prom"},
#ifdef MNG_INCLUDE_JNG
{MNG_FN_WRITE_IPNG, "write_ipng"},
#endif
{MNG_FN_WRITE_PPLT, "write_pplt"},
{MNG_FN_WRITE_IJNG, "write_ijng"},
{MNG_FN_WRITE_DROP, "write_drop"},
{MNG_FN_WRITE_DBYK, "write_dbyk"},
{MNG_FN_WRITE_ORDR, "write_ordr"},
#endif
{MNG_FN_WRITE_UNKNOWN, "write_unknown"},
{MNG_FN_WRITE_MAGN, "write_magn"},
{MNG_FN_WRITE_JDAA, "write_jdaa"},
{MNG_FN_WRITE_EVNT, "write_evnt"},
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
{MNG_FN_WRITE_MPNG, "write_mpng"},
#endif
{MNG_FN_ZLIB_INITIALIZE, "zlib_initialize"},
{MNG_FN_ZLIB_CLEANUP, "zlib_cleanup"},
{MNG_FN_ZLIB_INFLATEINIT, "zlib_inflateinit"},
{MNG_FN_ZLIB_INFLATEROWS, "zlib_inflaterows"},
{MNG_FN_ZLIB_INFLATEDATA, "zlib_inflatedata"},
{MNG_FN_ZLIB_INFLATEFREE, "zlib_inflatefree"},
{MNG_FN_ZLIB_DEFLATEINIT, "zlib_deflateinit"},
{MNG_FN_ZLIB_DEFLATEROWS, "zlib_deflaterows"},
{MNG_FN_ZLIB_DEFLATEDATA, "zlib_deflatedata"},
{MNG_FN_ZLIB_DEFLATEFREE, "zlib_deflatefree"},
{MNG_FN_PROCESS_DISPLAY_IHDR, "process_display_ihdr"},
{MNG_FN_PROCESS_DISPLAY_PLTE, "process_display_plte"},
{MNG_FN_PROCESS_DISPLAY_IDAT, "process_display_idat"},
{MNG_FN_PROCESS_DISPLAY_IEND, "process_display_iend"},
{MNG_FN_PROCESS_DISPLAY_TRNS, "process_display_trns"},
{MNG_FN_PROCESS_DISPLAY_GAMA, "process_display_gama"},
{MNG_FN_PROCESS_DISPLAY_CHRM, "process_display_chrm"},
{MNG_FN_PROCESS_DISPLAY_SRGB, "process_display_srgb"},
{MNG_FN_PROCESS_DISPLAY_ICCP, "process_display_iccp"},
{MNG_FN_PROCESS_DISPLAY_BKGD, "process_display_bkgd"},
{MNG_FN_PROCESS_DISPLAY_PHYS, "process_display_phys"},
{MNG_FN_PROCESS_DISPLAY_SBIT, "process_display_sbit"},
{MNG_FN_PROCESS_DISPLAY_SPLT, "process_display_splt"},
{MNG_FN_PROCESS_DISPLAY_HIST, "process_display_hist"},
{MNG_FN_PROCESS_DISPLAY_MHDR, "process_display_mhdr"},
{MNG_FN_PROCESS_DISPLAY_MEND, "process_display_mend"},
{MNG_FN_PROCESS_DISPLAY_LOOP, "process_display_loop"},
{MNG_FN_PROCESS_DISPLAY_ENDL, "process_display_endl"},
{MNG_FN_PROCESS_DISPLAY_DEFI, "process_display_defi"},
{MNG_FN_PROCESS_DISPLAY_BASI, "process_display_basi"},
{MNG_FN_PROCESS_DISPLAY_CLON, "process_display_clon"},
#ifndef MNG_SKIPCHUNK_PAST
{MNG_FN_PROCESS_DISPLAY_PAST, "process_display_past"},
#endif
{MNG_FN_PROCESS_DISPLAY_DISC, "process_display_disc"},
{MNG_FN_PROCESS_DISPLAY_BACK, "process_display_back"},
{MNG_FN_PROCESS_DISPLAY_FRAM, "process_display_fram"},
{MNG_FN_PROCESS_DISPLAY_MOVE, "process_display_move"},
{MNG_FN_PROCESS_DISPLAY_CLIP, "process_display_clip"},
{MNG_FN_PROCESS_DISPLAY_SHOW, "process_display_show"},
{MNG_FN_PROCESS_DISPLAY_TERM, "process_display_term"},
{MNG_FN_PROCESS_DISPLAY_SAVE, "process_display_save"},
{MNG_FN_PROCESS_DISPLAY_SEEK, "process_display_seek"},
{MNG_FN_PROCESS_DISPLAY_EXPI, "process_display_expi"},
{MNG_FN_PROCESS_DISPLAY_FPRI, "process_display_fpri"},
{MNG_FN_PROCESS_DISPLAY_NEED, "process_display_need"},
{MNG_FN_PROCESS_DISPLAY_PHYG, "process_display_phyg"},
#ifdef MNG_INCLUDE_JNG
{MNG_FN_PROCESS_DISPLAY_JHDR, "process_display_jhdr"},
{MNG_FN_PROCESS_DISPLAY_JDAT, "process_display_jdat"},
{MNG_FN_PROCESS_DISPLAY_JSEP, "process_display_jsep"},
#endif
#ifndef MNG_NO_DELTA_PNG
{MNG_FN_PROCESS_DISPLAY_DHDR, "process_display_dhdr"},
{MNG_FN_PROCESS_DISPLAY_PROM, "process_display_prom"},
#ifdef MNG_INCLUDE_JNG
{MNG_FN_PROCESS_DISPLAY_IPNG, "process_display_ipng"},
#endif
{MNG_FN_PROCESS_DISPLAY_PPLT, "process_display_pplt"},
{MNG_FN_PROCESS_DISPLAY_IJNG, "process_display_ijng"},
{MNG_FN_PROCESS_DISPLAY_DROP, "process_display_drop"},
{MNG_FN_PROCESS_DISPLAY_DBYK, "process_display_dbyk"},
{MNG_FN_PROCESS_DISPLAY_ORDR, "process_display_ordr"},
#endif
{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"},
{MNG_FN_JPEG_DECOMPRESSINIT, "jpeg_decompressinit"},
{MNG_FN_JPEG_DECOMPRESSDATA, "jpeg_decompressdata"},
{MNG_FN_JPEG_DECOMPRESSFREE, "jpeg_decompressfree"},
{MNG_FN_STORE_JPEG_G8, "store_jpeg_g8"},
{MNG_FN_STORE_JPEG_RGB8, "store_jpeg_rgb8"},
{MNG_FN_STORE_JPEG_G12, "store_jpeg_g12"},
{MNG_FN_STORE_JPEG_RGB12, "store_jpeg_rgb12"},
{MNG_FN_STORE_JPEG_GA8, "store_jpeg_ga8"},
{MNG_FN_STORE_JPEG_RGBA8, "store_jpeg_rgba8"},
{MNG_FN_STORE_JPEG_GA12, "store_jpeg_ga12"},
{MNG_FN_STORE_JPEG_RGBA12, "store_jpeg_rgba12"},
{MNG_FN_STORE_JPEG_G8_ALPHA, "store_jpeg_g8_alpha"},
{MNG_FN_STORE_JPEG_RGB8_ALPHA, "store_jpeg_rgb8_alpha"},
{MNG_FN_INIT_JPEG_A1_NI, "init_jpeg_a1_ni"},
{MNG_FN_INIT_JPEG_A2_NI, "init_jpeg_a2_ni"},
{MNG_FN_INIT_JPEG_A4_NI, "init_jpeg_a4_ni"},
{MNG_FN_INIT_JPEG_A8_NI, "init_jpeg_a8_ni"},
{MNG_FN_INIT_JPEG_A16_NI, "init_jpeg_a16_ni"},
{MNG_FN_STORE_JPEG_G8_A1, "store_jpeg_g8_a1"},
{MNG_FN_STORE_JPEG_G8_A2, "store_jpeg_g8_a2"},
{MNG_FN_STORE_JPEG_G8_A4, "store_jpeg_g8_a4"},
{MNG_FN_STORE_JPEG_G8_A8, "store_jpeg_g8_a8"},
{MNG_FN_STORE_JPEG_G8_A16, "store_jpeg_g8_a16"},
{MNG_FN_STORE_JPEG_RGB8_A1, "store_jpeg_rgb8_a1"},
{MNG_FN_STORE_JPEG_RGB8_A2, "store_jpeg_rgb8_a2"},
{MNG_FN_STORE_JPEG_RGB8_A4, "store_jpeg_rgb8_a4"},
{MNG_FN_STORE_JPEG_RGB8_A8, "store_jpeg_rgb8_a8"},
{MNG_FN_STORE_JPEG_RGB8_A16, "store_jpeg_rgb8_a16"},
{MNG_FN_STORE_JPEG_G12_A1, "store_jpeg_g12_a1"},
{MNG_FN_STORE_JPEG_G12_A2, "store_jpeg_g12_a2"},
{MNG_FN_STORE_JPEG_G12_A4, "store_jpeg_g12_a4"},
{MNG_FN_STORE_JPEG_G12_A8, "store_jpeg_g12_a8"},
{MNG_FN_STORE_JPEG_G12_A16, "store_jpeg_g12_a16"},
{MNG_FN_STORE_JPEG_RGB12_A1, "store_jpeg_rgb12_a1"},
{MNG_FN_STORE_JPEG_RGB12_A2, "store_jpeg_rgb12_a2"},
{MNG_FN_STORE_JPEG_RGB12_A4, "store_jpeg_rgb12_a4"},
{MNG_FN_STORE_JPEG_RGB12_A8, "store_jpeg_rgb12_a8"},
{MNG_FN_STORE_JPEG_RGB12_A16, "store_jpeg_rgb12_a16"},
{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_X3, "magnify_g8_x3"},
{MNG_FN_MAGNIFY_RGB8_X3, "magnify_rgb8_x3"},
{MNG_FN_MAGNIFY_GA8_X5, "magnify_ga8_x5"},
{MNG_FN_MAGNIFY_RGBA8_X5, "magnify_rgba8_x5"},
{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_MAGNIFY_G8_Y3, "magnify_g8_y3"},
{MNG_FN_MAGNIFY_RGB8_Y3, "magnify_rgb8_y3"},
{MNG_FN_MAGNIFY_GA8_Y5, "magnify_ga8_y5"},
{MNG_FN_MAGNIFY_RGBA8_Y5, "magnify_rgba8_y5"},
{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_X3, "magnify_g8_x3"},
{MNG_FN_MAGNIFY_RGB8_X3, "magnify_rgb8_x3"},
{MNG_FN_MAGNIFY_GA8_X5, "magnify_ga8_x5"},
{MNG_FN_MAGNIFY_RGBA8_X5, "magnify_rgba8_x5"},
{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_MAGNIFY_G8_Y3, "magnify_g8_y3"},
{MNG_FN_MAGNIFY_RGB8_Y3, "magnify_rgb8_y3"},
{MNG_FN_MAGNIFY_GA8_Y5, "magnify_ga8_y5"},
{MNG_FN_MAGNIFY_RGBA8_Y5, "magnify_rgba8_y5"},
{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"},
{MNG_FN_PROMOTE_G8_G8, "promote_g8_g8"},
{MNG_FN_PROMOTE_G8_G16, "promote_g8_g16"},
{MNG_FN_PROMOTE_G16_G16, "promote_g8_g16"},
{MNG_FN_PROMOTE_G8_GA8, "promote_g8_ga8"},
{MNG_FN_PROMOTE_G8_GA16, "promote_g8_ga16"},
{MNG_FN_PROMOTE_G16_GA16, "promote_g16_ga16"},
{MNG_FN_PROMOTE_G8_RGB8, "promote_g8_rgb8"},
{MNG_FN_PROMOTE_G8_RGB16, "promote_g8_rgb16"},
{MNG_FN_PROMOTE_G16_RGB16, "promote_g16_rgb16"},
{MNG_FN_PROMOTE_G8_RGBA8, "promote_g8_rgba8"},
{MNG_FN_PROMOTE_G8_RGBA16, "promote_g8_rgba16"},
{MNG_FN_PROMOTE_G16_RGBA16, "promote_g16_rgba16"},
{MNG_FN_PROMOTE_GA8_GA16, "promote_ga8_ga16"},
{MNG_FN_PROMOTE_GA8_RGBA8, "promote_ga8_rgba8"},
{MNG_FN_PROMOTE_GA8_RGBA16, "promote_ga8_rgba16"},
{MNG_FN_PROMOTE_GA16_RGBA16, "promote_ga16_rgba16"},
{MNG_FN_PROMOTE_RGB8_RGB16, "promote_rgb8_rgb16"},
{MNG_FN_PROMOTE_RGB8_RGBA8, "promote_rgb8_rgba8"},
{MNG_FN_PROMOTE_RGB8_RGBA16, "promote_rgb8_rgba16"},
{MNG_FN_PROMOTE_RGB16_RGBA16, "promote_rgb16_rgba16"},
{MNG_FN_PROMOTE_RGBA8_RGBA16, "promote_rgba8_rgba16"},
{MNG_FN_PROMOTE_IDX8_RGB8, "promote_idx8_rgb8"},
{MNG_FN_PROMOTE_IDX8_RGB16, "promote_idx8_rgb16"},
{MNG_FN_PROMOTE_IDX8_RGBA8, "promote_idx8_rgba8"},
{MNG_FN_PROMOTE_IDX8_RGBA16, "promote_idx8_rgba16"},
{MNG_FN_SCALE_G1_G2, "scale_g1_g2"},
{MNG_FN_SCALE_G1_G4, "scale_g1_g4"},
{MNG_FN_SCALE_G1_G8, "scale_g1_g8"},
{MNG_FN_SCALE_G1_G16, "scale_g1_g16"},
{MNG_FN_SCALE_G2_G4, "scale_g2_g4"},
{MNG_FN_SCALE_G2_G8, "scale_g2_g8"},
{MNG_FN_SCALE_G2_G16, "scale_g2_g16"},
{MNG_FN_SCALE_G4_G8, "scale_g4_g8"},
{MNG_FN_SCALE_G4_G16, "scale_g4_g16"},
{MNG_FN_SCALE_G8_G16, "scale_g8_g16"},
{MNG_FN_SCALE_GA8_GA16, "scale_ga8_ga16"},
{MNG_FN_SCALE_RGB8_RGB16, "scale_rgb8_rgb16"},
{MNG_FN_SCALE_RGBA8_RGBA16, "scale_rgba8_rgba16"},
{MNG_FN_SCALE_G2_G1, "scale_g2_g1"},
{MNG_FN_SCALE_G4_G1, "scale_g4_g1"},
{MNG_FN_SCALE_G8_G1, "scale_g8_g1"},
{MNG_FN_SCALE_G16_G1, "scale_g16_g1"},
{MNG_FN_SCALE_G4_G2, "scale_g4_g2"},
{MNG_FN_SCALE_G8_G2, "scale_g8_g2"},
{MNG_FN_SCALE_G16_G2, "scale_g16_g2"},
{MNG_FN_SCALE_G8_G4, "scale_g8_g4"},
{MNG_FN_SCALE_G16_G4, "scale_g16_g4"},
{MNG_FN_SCALE_G16_G8, "scale_g16_g8"},
{MNG_FN_SCALE_GA16_GA8, "scale_ga16_ga8"},
{MNG_FN_SCALE_RGB16_RGB8, "scale_rgb16_rgb8"},
{MNG_FN_SCALE_RGBA16_RGBA8, "scale_rgba16_rgba8"},
{MNG_FN_COMPOSEOVER_RGBA8, "composeover_rgba8"},
{MNG_FN_COMPOSEOVER_RGBA16, "composeover_rgba16"},
{MNG_FN_COMPOSEUNDER_RGBA8, "composeunder_rgba8"},
{MNG_FN_COMPOSEUNDER_RGBA16, "composeunder_rgba16"},
{MNG_FN_FLIP_RGBA8, "flip_rgba8"},
{MNG_FN_FLIP_RGBA16, "flip_rgba16"},
{MNG_FN_TILE_RGBA8, "tile_rgba8"},
{MNG_FN_TILE_RGBA16, "tile_rgba16"}
};
#endif /* MNG_INCLUDE_TRACE_STINGS */
/* ************************************************************************** */
mng_retcode mng_trace (mng_datap pData,
mng_uint32 iFunction,
mng_uint32 iLocation)
{
mng_pchar zName = 0; /* bufferptr for tracestring */
if ((pData == 0) || (pData->iMagic != MNG_MAGIC))
return MNG_INVALIDHANDLE; /* no good if the handle is corrupt */
if (pData->fTraceproc) /* report back to user ? */
{
#ifdef MNG_INCLUDE_TRACE_STRINGS
{ /* binary search variables */
mng_int32 iTop, iLower, iUpper, iMiddle;
mng_trace_entryp pEntry; /* pointer to found entry */
/* determine max index of table */
iTop = (sizeof (trace_table) / sizeof (trace_table [0])) - 1;
iLower = 0; /* initialize binary search */
iMiddle = iTop >> 1; /* start in the middle */
iUpper = iTop;
pEntry = 0; /* no goods yet! */
do /* the binary search itself */
{
if (trace_table [iMiddle].iFunction < iFunction)
iLower = iMiddle + 1;
else if (trace_table [iMiddle].iFunction > iFunction)
iUpper = iMiddle - 1;
else
{
pEntry = &trace_table [iMiddle];
break;
};
iMiddle = (iLower + iUpper) >> 1;
}
while (iLower <= iUpper);
if (pEntry) /* found it ? */
zName = pEntry->zTracetext;
}
#endif
/* oke, now tell */
if (!pData->fTraceproc (((mng_handle)pData), iFunction, iLocation, zName))
return MNG_APPTRACEABORT;
}
return MNG_NOERROR;
}
/* ************************************************************************** */
#endif /* MNG_INCLUDE_TRACE_PROCS */
/* ************************************************************************** */
/* * end of file * */
/* ************************************************************************** */
libmng-2.0.3/ltmain.sh 0000755 0001750 0001750 00001050174 12115360512 014507 0 ustar glennrp glennrp
# libtool (GNU libtool) 2.4
# Written by Gordon Matzigkeit , 1996
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
# 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
# This is free software; see the source for copying conditions. There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# GNU Libtool is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# As a special exception to the GNU General Public License,
# if you distribute this file as part of a program or library that
# is built using GNU Libtool, you may include this file under the
# same distribution terms that you use for the rest of that program.
#
# GNU Libtool is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Libtool; see the file COPYING. If not, a copy
# can be downloaded from http://www.gnu.org/licenses/gpl.html,
# or obtained by writing to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Usage: $progname [OPTION]... [MODE-ARG]...
#
# Provide generalized library-building support services.
#
# --config show all configuration variables
# --debug enable verbose shell tracing
# -n, --dry-run display commands without modifying any files
# --features display basic configuration information and exit
# --mode=MODE use operation mode MODE
# --preserve-dup-deps don't remove duplicate dependency libraries
# --quiet, --silent don't print informational messages
# --no-quiet, --no-silent
# print informational messages (default)
# --tag=TAG use configuration variables from tag TAG
# -v, --verbose print more informational messages than default
# --no-verbose don't print the extra informational messages
# --version print version information
# -h, --help, --help-all print short, long, or detailed help message
#
# MODE must be one of the following:
#
# clean remove files from the build directory
# compile compile a source file into a libtool object
# execute automatically set library path, then run a program
# finish complete the installation of libtool libraries
# install install libraries or executables
# link create a library or an executable
# uninstall remove libraries from an installed directory
#
# MODE-ARGS vary depending on the MODE. When passed as first option,
# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
#
# When reporting a bug, please describe a test case to reproduce it and
# include the following information:
#
# host-triplet: $host
# shell: $SHELL
# compiler: $LTCC
# compiler flags: $LTCFLAGS
# linker: $LD (gnu? $with_gnu_ld)
# $progname: (GNU libtool) 2.4
# automake: $automake_version
# autoconf: $autoconf_version
#
# Report bugs to .
# GNU libtool home page: .
# General help using GNU software: .
PROGRAM=libtool
PACKAGE=libtool
VERSION=2.4
TIMESTAMP=""
package_revision=1.3293
# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
fi
BIN_SH=xpg4; export BIN_SH # for Tru64
DUALCASE=1; export DUALCASE # for MKS sh
# A function that is used when there is no print builtin or printf.
func_fallback_echo ()
{
eval 'cat <<_LTECHO_EOF
$1
_LTECHO_EOF'
}
# NLS nuisances: We save the old values to restore during execute mode.
lt_user_locale=
lt_safe_locale=
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
do
eval "if test \"\${$lt_var+set}\" = set; then
save_$lt_var=\$$lt_var
$lt_var=C
export $lt_var
lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
fi"
done
LC_ALL=C
LANGUAGE=C
export LANGUAGE LC_ALL
$lt_unset CDPATH
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
# is ksh but when the shell is invoked as "sh" and the current value of
# the _XPG environment variable is not equal to 1 (one), the special
# positional parameter $0, within a function call, is the name of the
# function.
progpath="$0"
: ${CP="cp -f"}
test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
: ${EGREP="grep -E"}
: ${FGREP="grep -F"}
: ${GREP="grep"}
: ${LN_S="ln -s"}
: ${MAKE="make"}
: ${MKDIR="mkdir"}
: ${MV="mv -f"}
: ${RM="rm -f"}
: ${SED="sed"}
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
: ${Xsed="$SED -e 1s/^X//"}
# Global variables:
EXIT_SUCCESS=0
EXIT_FAILURE=1
EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
exit_status=$EXIT_SUCCESS
# Make sure IFS has a sensible default
lt_nl='
'
IFS=" $lt_nl"
dirname="s,/[^/]*$,,"
basename="s,^.*/,,"
# func_dirname file append nondir_replacement
# Compute the dirname of FILE. If nonempty, add APPEND to the result,
# otherwise set result to NONDIR_REPLACEMENT.
func_dirname ()
{
func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
if test "X$func_dirname_result" = "X${1}"; then
func_dirname_result="${3}"
else
func_dirname_result="$func_dirname_result${2}"
fi
} # func_dirname may be replaced by extended shell implementation
# func_basename file
func_basename ()
{
func_basename_result=`$ECHO "${1}" | $SED "$basename"`
} # func_basename may be replaced by extended shell implementation
# func_dirname_and_basename file append nondir_replacement
# perform func_basename and func_dirname in a single function
# call:
# dirname: Compute the dirname of FILE. If nonempty,
# add APPEND to the result, otherwise set result
# to NONDIR_REPLACEMENT.
# value returned in "$func_dirname_result"
# basename: Compute filename of FILE.
# value retuned in "$func_basename_result"
# Implementation must be kept synchronized with func_dirname
# and func_basename. For efficiency, we do not delegate to
# those functions but instead duplicate the functionality here.
func_dirname_and_basename ()
{
# Extract subdirectory from the argument.
func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
if test "X$func_dirname_result" = "X${1}"; then
func_dirname_result="${3}"
else
func_dirname_result="$func_dirname_result${2}"
fi
func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
} # func_dirname_and_basename may be replaced by extended shell implementation
# func_stripname prefix suffix name
# strip PREFIX and SUFFIX off of NAME.
# PREFIX and SUFFIX must not contain globbing or regex special
# characters, hashes, percent signs, but SUFFIX may contain a leading
# dot (in which case that matches only a dot).
# func_strip_suffix prefix name
func_stripname ()
{
case ${2} in
.*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
esac
} # func_stripname may be replaced by extended shell implementation
# These SED scripts presuppose an absolute path with a trailing slash.
pathcar='s,^/\([^/]*\).*$,\1,'
pathcdr='s,^/[^/]*,,'
removedotparts=':dotsl
s@/\./@/@g
t dotsl
s,/\.$,/,'
collapseslashes='s@/\{1,\}@/@g'
finalslash='s,/*$,/,'
# func_normal_abspath PATH
# Remove doubled-up and trailing slashes, "." path components,
# and cancel out any ".." path components in PATH after making
# it an absolute path.
# value returned in "$func_normal_abspath_result"
func_normal_abspath ()
{
# Start from root dir and reassemble the path.
func_normal_abspath_result=
func_normal_abspath_tpath=$1
func_normal_abspath_altnamespace=
case $func_normal_abspath_tpath in
"")
# Empty path, that just means $cwd.
func_stripname '' '/' "`pwd`"
func_normal_abspath_result=$func_stripname_result
return
;;
# The next three entries are used to spot a run of precisely
# two leading slashes without using negated character classes;
# we take advantage of case's first-match behaviour.
///*)
# Unusual form of absolute path, do nothing.
;;
//*)
# Not necessarily an ordinary path; POSIX reserves leading '//'
# and for example Cygwin uses it to access remote file shares
# over CIFS/SMB, so we conserve a leading double slash if found.
func_normal_abspath_altnamespace=/
;;
/*)
# Absolute path, do nothing.
;;
*)
# Relative path, prepend $cwd.
func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
;;
esac
# Cancel out all the simple stuff to save iterations. We also want
# the path to end with a slash for ease of parsing, so make sure
# there is one (and only one) here.
func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
-e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
while :; do
# Processed it all yet?
if test "$func_normal_abspath_tpath" = / ; then
# If we ascended to the root using ".." the result may be empty now.
if test -z "$func_normal_abspath_result" ; then
func_normal_abspath_result=/
fi
break
fi
func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
-e "$pathcar"`
func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
-e "$pathcdr"`
# Figure out what to do with it
case $func_normal_abspath_tcomponent in
"")
# Trailing empty path component, ignore it.
;;
..)
# Parent dir; strip last assembled component from result.
func_dirname "$func_normal_abspath_result"
func_normal_abspath_result=$func_dirname_result
;;
*)
# Actual path component, append it.
func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
;;
esac
done
# Restore leading double-slash if one was found on entry.
func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
}
# func_relative_path SRCDIR DSTDIR
# generates a relative path from SRCDIR to DSTDIR, with a trailing
# slash if non-empty, suitable for immediately appending a filename
# without needing to append a separator.
# value returned in "$func_relative_path_result"
func_relative_path ()
{
func_relative_path_result=
func_normal_abspath "$1"
func_relative_path_tlibdir=$func_normal_abspath_result
func_normal_abspath "$2"
func_relative_path_tbindir=$func_normal_abspath_result
# Ascend the tree starting from libdir
while :; do
# check if we have found a prefix of bindir
case $func_relative_path_tbindir in
$func_relative_path_tlibdir)
# found an exact match
func_relative_path_tcancelled=
break
;;
$func_relative_path_tlibdir*)
# found a matching prefix
func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
func_relative_path_tcancelled=$func_stripname_result
if test -z "$func_relative_path_result"; then
func_relative_path_result=.
fi
break
;;
*)
func_dirname $func_relative_path_tlibdir
func_relative_path_tlibdir=${func_dirname_result}
if test "x$func_relative_path_tlibdir" = x ; then
# Have to descend all the way to the root!
func_relative_path_result=../$func_relative_path_result
func_relative_path_tcancelled=$func_relative_path_tbindir
break
fi
func_relative_path_result=../$func_relative_path_result
;;
esac
done
# Now calculate path; take care to avoid doubling-up slashes.
func_stripname '' '/' "$func_relative_path_result"
func_relative_path_result=$func_stripname_result
func_stripname '/' '/' "$func_relative_path_tcancelled"
if test "x$func_stripname_result" != x ; then
func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
fi
# Normalisation. If bindir is libdir, return empty string,
# else relative path ending with a slash; either way, target
# file name can be directly appended.
if test ! -z "$func_relative_path_result"; then
func_stripname './' '' "$func_relative_path_result/"
func_relative_path_result=$func_stripname_result
fi
}
# The name of this program:
func_dirname_and_basename "$progpath"
progname=$func_basename_result
# Make sure we have an absolute path for reexecution:
case $progpath in
[\\/]*|[A-Za-z]:\\*) ;;
*[\\/]*)
progdir=$func_dirname_result
progdir=`cd "$progdir" && pwd`
progpath="$progdir/$progname"
;;
*)
save_IFS="$IFS"
IFS=:
for progdir in $PATH; do
IFS="$save_IFS"
test -x "$progdir/$progname" && break
done
IFS="$save_IFS"
test -n "$progdir" || progdir=`pwd`
progpath="$progdir/$progname"
;;
esac
# Sed substitution that helps us do robust quoting. It backslashifies
# metacharacters that are still active within double-quoted strings.
Xsed="${SED}"' -e 1s/^X//'
sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
# Same as above, but do not quote variable references.
double_quote_subst='s/\(["`\\]\)/\\\1/g'
# Sed substitution that turns a string into a regex matching for the
# string literally.
sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
# Sed substitution that converts a w32 file name or path
# which contains forward slashes, into one that contains
# (escaped) backslashes. A very naive implementation.
lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
# Re-`\' parameter expansions in output of double_quote_subst that were
# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
# in input to double_quote_subst, that '$' was protected from expansion.
# Since each input `\' is now two `\'s, look for any number of runs of
# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
bs='\\'
bs2='\\\\'
bs4='\\\\\\\\'
dollar='\$'
sed_double_backslash="\
s/$bs4/&\\
/g
s/^$bs2$dollar/$bs&/
s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
s/\n//g"
# Standard options:
opt_dry_run=false
opt_help=false
opt_quiet=false
opt_verbose=false
opt_warning=:
# func_echo arg...
# Echo program name prefixed message, along with the current mode
# name if it has been set yet.
func_echo ()
{
$ECHO "$progname: ${opt_mode+$opt_mode: }$*"
}
# func_verbose arg...
# Echo program name prefixed message in verbose mode only.
func_verbose ()
{
$opt_verbose && func_echo ${1+"$@"}
# A bug in bash halts the script if the last line of a function
# fails when set -e is in force, so we need another command to
# work around that:
:
}
# func_echo_all arg...
# Invoke $ECHO with all args, space-separated.
func_echo_all ()
{
$ECHO "$*"
}
# func_error arg...
# Echo program name prefixed message to standard error.
func_error ()
{
$ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
}
# func_warning arg...
# Echo program name prefixed warning message to standard error.
func_warning ()
{
$opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
# bash bug again:
:
}
# func_fatal_error arg...
# Echo program name prefixed message to standard error, and exit.
func_fatal_error ()
{
func_error ${1+"$@"}
exit $EXIT_FAILURE
}
# func_fatal_help arg...
# Echo program name prefixed message to standard error, followed by
# a help hint, and exit.
func_fatal_help ()
{
func_error ${1+"$@"}
func_fatal_error "$help"
}
help="Try \`$progname --help' for more information." ## default
# func_grep expression filename
# Check whether EXPRESSION matches any line of FILENAME, without output.
func_grep ()
{
$GREP "$1" "$2" >/dev/null 2>&1
}
# func_mkdir_p directory-path
# Make sure the entire path to DIRECTORY-PATH is available.
func_mkdir_p ()
{
my_directory_path="$1"
my_dir_list=
if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
# Protect directory names starting with `-'
case $my_directory_path in
-*) my_directory_path="./$my_directory_path" ;;
esac
# While some portion of DIR does not yet exist...
while test ! -d "$my_directory_path"; do
# ...make a list in topmost first order. Use a colon delimited
# list incase some portion of path contains whitespace.
my_dir_list="$my_directory_path:$my_dir_list"
# If the last portion added has no slash in it, the list is done
case $my_directory_path in */*) ;; *) break ;; esac
# ...otherwise throw away the child directory and loop
my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
done
my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
save_mkdir_p_IFS="$IFS"; IFS=':'
for my_dir in $my_dir_list; do
IFS="$save_mkdir_p_IFS"
# mkdir can fail with a `File exist' error if two processes
# try to create one of the directories concurrently. Don't
# stop in that case!
$MKDIR "$my_dir" 2>/dev/null || :
done
IFS="$save_mkdir_p_IFS"
# Bail out if we (or some other process) failed to create a directory.
test -d "$my_directory_path" || \
func_fatal_error "Failed to create \`$1'"
fi
}
# func_mktempdir [string]
# Make a temporary directory that won't clash with other running
# libtool processes, and avoids race conditions if possible. If
# given, STRING is the basename for that directory.
func_mktempdir ()
{
my_template="${TMPDIR-/tmp}/${1-$progname}"
if test "$opt_dry_run" = ":"; then
# Return a directory name, but don't create it in dry-run mode
my_tmpdir="${my_template}-$$"
else
# If mktemp works, use that first and foremost
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
if test ! -d "$my_tmpdir"; then
# Failing that, at least try and use $RANDOM to avoid a race
my_tmpdir="${my_template}-${RANDOM-0}$$"
save_mktempdir_umask=`umask`
umask 0077
$MKDIR "$my_tmpdir"
umask $save_mktempdir_umask
fi
# If we're not in dry-run mode, bomb out on failure
test -d "$my_tmpdir" || \
func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
fi
$ECHO "$my_tmpdir"
}
# func_quote_for_eval arg
# Aesthetically quote ARG to be evaled later.
# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
# is double-quoted, suitable for a subsequent eval, whereas
# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
# which are still active within double quotes backslashified.
func_quote_for_eval ()
{
case $1 in
*[\\\`\"\$]*)
func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
*)
func_quote_for_eval_unquoted_result="$1" ;;
esac
case $func_quote_for_eval_unquoted_result in
# Double-quote args containing shell metacharacters to delay
# word splitting, command substitution and and variable
# expansion for a subsequent eval.
# Many Bourne shells cannot handle close brackets correctly
# in scan sets, so we specify it separately.
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
;;
*)
func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
esac
}
# func_quote_for_expand arg
# Aesthetically quote ARG to be evaled later; same as above,
# but do not quote variable references.
func_quote_for_expand ()
{
case $1 in
*[\\\`\"]*)
my_arg=`$ECHO "$1" | $SED \
-e "$double_quote_subst" -e "$sed_double_backslash"` ;;
*)
my_arg="$1" ;;
esac
case $my_arg in
# Double-quote args containing shell metacharacters to delay
# word splitting and command substitution for a subsequent eval.
# Many Bourne shells cannot handle close brackets correctly
# in scan sets, so we specify it separately.
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
my_arg="\"$my_arg\""
;;
esac
func_quote_for_expand_result="$my_arg"
}
# func_show_eval cmd [fail_exp]
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
# is given, then evaluate it.
func_show_eval ()
{
my_cmd="$1"
my_fail_exp="${2-:}"
${opt_silent-false} || {
func_quote_for_expand "$my_cmd"
eval "func_echo $func_quote_for_expand_result"
}
if ${opt_dry_run-false}; then :; else
eval "$my_cmd"
my_status=$?
if test "$my_status" -eq 0; then :; else
eval "(exit $my_status); $my_fail_exp"
fi
fi
}
# func_show_eval_locale cmd [fail_exp]
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
# is given, then evaluate it. Use the saved locale for evaluation.
func_show_eval_locale ()
{
my_cmd="$1"
my_fail_exp="${2-:}"
${opt_silent-false} || {
func_quote_for_expand "$my_cmd"
eval "func_echo $func_quote_for_expand_result"
}
if ${opt_dry_run-false}; then :; else
eval "$lt_user_locale
$my_cmd"
my_status=$?
eval "$lt_safe_locale"
if test "$my_status" -eq 0; then :; else
eval "(exit $my_status); $my_fail_exp"
fi
fi
}
# func_tr_sh
# Turn $1 into a string suitable for a shell variable name.
# Result is stored in $func_tr_sh_result. All characters
# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
# if $1 begins with a digit, a '_' is prepended as well.
func_tr_sh ()
{
case $1 in
[0-9]* | *[!a-zA-Z0-9_]*)
func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
;;
* )
func_tr_sh_result=$1
;;
esac
}
# func_version
# Echo version message to standard output and exit.
func_version ()
{
$opt_debug
$SED -n '/(C)/!b go
:more
/\./!{
N
s/\n# / /
b more
}
:go
/^# '$PROGRAM' (GNU /,/# warranty; / {
s/^# //
s/^# *$//
s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
p
}' < "$progpath"
exit $?
}
# func_usage
# Echo short help message to standard output and exit.
func_usage ()
{
$opt_debug
$SED -n '/^# Usage:/,/^# *.*--help/ {
s/^# //
s/^# *$//
s/\$progname/'$progname'/
p
}' < "$progpath"
echo
$ECHO "run \`$progname --help | more' for full usage"
exit $?
}
# func_help [NOEXIT]
# Echo long help message to standard output and exit,
# unless 'noexit' is passed as argument.
func_help ()
{
$opt_debug
$SED -n '/^# Usage:/,/# Report bugs to/ {
:print
s/^# //
s/^# *$//
s*\$progname*'$progname'*
s*\$host*'"$host"'*
s*\$SHELL*'"$SHELL"'*
s*\$LTCC*'"$LTCC"'*
s*\$LTCFLAGS*'"$LTCFLAGS"'*
s*\$LD*'"$LD"'*
s/\$with_gnu_ld/'"$with_gnu_ld"'/
s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
p
d
}
/^# .* home page:/b print
/^# General help using/b print
' < "$progpath"
ret=$?
if test -z "$1"; then
exit $ret
fi
}
# func_missing_arg argname
# Echo program name prefixed message to standard error and set global
# exit_cmd.
func_missing_arg ()
{
$opt_debug
func_error "missing argument for $1."
exit_cmd=exit
}
# func_split_short_opt shortopt
# Set func_split_short_opt_name and func_split_short_opt_arg shell
# variables after splitting SHORTOPT after the 2nd character.
func_split_short_opt ()
{
my_sed_short_opt='1s/^\(..\).*$/\1/;q'
my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
} # func_split_short_opt may be replaced by extended shell implementation
# func_split_long_opt longopt
# Set func_split_long_opt_name and func_split_long_opt_arg shell
# variables after splitting LONGOPT at the `=' sign.
func_split_long_opt ()
{
my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
my_sed_long_arg='1s/^--[^=]*=//'
func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
} # func_split_long_opt may be replaced by extended shell implementation
exit_cmd=:
magic="%%%MAGIC variable%%%"
magic_exe="%%%MAGIC EXE variable%%%"
# Global variables.
nonopt=
preserve_args=
lo2o="s/\\.lo\$/.${objext}/"
o2lo="s/\\.${objext}\$/.lo/"
extracted_archives=
extracted_serial=0
# If this variable is set in any of the actions, the command in it
# will be execed at the end. This prevents here-documents from being
# left over by shells.
exec_cmd=
# func_append var value
# Append VALUE to the end of shell variable VAR.
func_append ()
{
eval "${1}=\$${1}\${2}"
} # func_append may be replaced by extended shell implementation
# func_append_quoted var value
# Quote VALUE and append to the end of shell variable VAR, separated
# by a space.
func_append_quoted ()
{
func_quote_for_eval "${2}"
eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
} # func_append_quoted may be replaced by extended shell implementation
# func_arith arithmetic-term...
func_arith ()
{
func_arith_result=`expr "${@}"`
} # func_arith may be replaced by extended shell implementation
# func_len string
# STRING may not start with a hyphen.
func_len ()
{
func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
} # func_len may be replaced by extended shell implementation
# func_lo2o object
func_lo2o ()
{
func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
} # func_lo2o may be replaced by extended shell implementation
# func_xform libobj-or-source
func_xform ()
{
func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
} # func_xform may be replaced by extended shell implementation
# func_fatal_configuration arg...
# Echo program name prefixed message to standard error, followed by
# a configuration failure hint, and exit.
func_fatal_configuration ()
{
func_error ${1+"$@"}
func_error "See the $PACKAGE documentation for more information."
func_fatal_error "Fatal configuration error."
}
# func_config
# Display the configuration for all the tags in this script.
func_config ()
{
re_begincf='^# ### BEGIN LIBTOOL'
re_endcf='^# ### END LIBTOOL'
# Default configuration.
$SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
# Now print the configurations for the tags.
for tagname in $taglist; do
$SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
done
exit $?
}
# func_features
# Display the features supported by this script.
func_features ()
{
echo "host: $host"
if test "$build_libtool_libs" = yes; then
echo "enable shared libraries"
else
echo "disable shared libraries"
fi
if test "$build_old_libs" = yes; then
echo "enable static libraries"
else
echo "disable static libraries"
fi
exit $?
}
# func_enable_tag tagname
# Verify that TAGNAME is valid, and either flag an error and exit, or
# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
# variable here.
func_enable_tag ()
{
# Global variable:
tagname="$1"
re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
sed_extractcf="/$re_begincf/,/$re_endcf/p"
# Validate tagname.
case $tagname in
*[!-_A-Za-z0-9,/]*)
func_fatal_error "invalid tag name: $tagname"
;;
esac
# Don't test for the "default" C tag, as we know it's
# there but not specially marked.
case $tagname in
CC) ;;
*)
if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
taglist="$taglist $tagname"
# Evaluate the configuration. Be careful to quote the path
# and the sed script, to avoid splitting on whitespace, but
# also don't use non-portable quotes within backquotes within
# quotes we have to do it in 2 steps:
extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
eval "$extractedcf"
else
func_error "ignoring unknown tag $tagname"
fi
;;
esac
}
# func_check_version_match
# Ensure that we are using m4 macros, and libtool script from the same
# release of libtool.
func_check_version_match ()
{
if test "$package_revision" != "$macro_revision"; then
if test "$VERSION" != "$macro_version"; then
if test -z "$macro_version"; then
cat >&2 <<_LT_EOF
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
$progname: definition of this LT_INIT comes from an older release.
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
$progname: and run autoconf again.
_LT_EOF
else
cat >&2 <<_LT_EOF
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
$progname: and run autoconf again.
_LT_EOF
fi
else
cat >&2 <<_LT_EOF
$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
$progname: of $PACKAGE $VERSION and run autoconf again.
_LT_EOF
fi
exit $EXIT_MISMATCH
fi
}
# Shorthand for --mode=foo, only valid as the first argument
case $1 in
clean|clea|cle|cl)
shift; set dummy --mode clean ${1+"$@"}; shift
;;
compile|compil|compi|comp|com|co|c)
shift; set dummy --mode compile ${1+"$@"}; shift
;;
execute|execut|execu|exec|exe|ex|e)
shift; set dummy --mode execute ${1+"$@"}; shift
;;
finish|finis|fini|fin|fi|f)
shift; set dummy --mode finish ${1+"$@"}; shift
;;
install|instal|insta|inst|ins|in|i)
shift; set dummy --mode install ${1+"$@"}; shift
;;
link|lin|li|l)
shift; set dummy --mode link ${1+"$@"}; shift
;;
uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
shift; set dummy --mode uninstall ${1+"$@"}; shift
;;
esac
# Option defaults:
opt_debug=:
opt_dry_run=false
opt_config=false
opt_preserve_dup_deps=false
opt_features=false
opt_finish=false
opt_help=false
opt_help_all=false
opt_silent=:
opt_verbose=:
opt_silent=false
opt_verbose=false
# Parse options once, thoroughly. This comes as soon as possible in the
# script to make things like `--version' happen as quickly as we can.
{
# this just eases exit handling
while test $# -gt 0; do
opt="$1"
shift
case $opt in
--debug|-x) opt_debug='set -x'
func_echo "enabling shell trace mode"
$opt_debug
;;
--dry-run|--dryrun|-n)
opt_dry_run=:
;;
--config)
opt_config=:
func_config
;;
--dlopen|-dlopen)
optarg="$1"
opt_dlopen="${opt_dlopen+$opt_dlopen
}$optarg"
shift
;;
--preserve-dup-deps)
opt_preserve_dup_deps=:
;;
--features)
opt_features=:
func_features
;;
--finish)
opt_finish=:
set dummy --mode finish ${1+"$@"}; shift
;;
--help)
opt_help=:
;;
--help-all)
opt_help_all=:
opt_help=': help-all'
;;
--mode)
test $# = 0 && func_missing_arg $opt && break
optarg="$1"
opt_mode="$optarg"
case $optarg in
# Valid mode arguments:
clean|compile|execute|finish|install|link|relink|uninstall) ;;
# Catch anything else as an error
*) func_error "invalid argument for $opt"
exit_cmd=exit
break
;;
esac
shift
;;
--no-silent|--no-quiet)
opt_silent=false
func_append preserve_args " $opt"
;;
--no-verbose)
opt_verbose=false
func_append preserve_args " $opt"
;;
--silent|--quiet)
opt_silent=:
func_append preserve_args " $opt"
opt_verbose=false
;;
--verbose|-v)
opt_verbose=:
func_append preserve_args " $opt"
opt_silent=false
;;
--tag)
test $# = 0 && func_missing_arg $opt && break
optarg="$1"
opt_tag="$optarg"
func_append preserve_args " $opt $optarg"
func_enable_tag "$optarg"
shift
;;
-\?|-h) func_usage ;;
--help) func_help ;;
--version) func_version ;;
# Separate optargs to long options:
--*=*)
func_split_long_opt "$opt"
set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
shift
;;
# Separate non-argument short options:
-\?*|-h*|-n*|-v*)
func_split_short_opt "$opt"
set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
shift
;;
--) break ;;
-*) func_fatal_help "unrecognized option \`$opt'" ;;
*) set dummy "$opt" ${1+"$@"}; shift; break ;;
esac
done
# Validate options:
# save first non-option argument
if test "$#" -gt 0; then
nonopt="$opt"
shift
fi
# preserve --debug
test "$opt_debug" = : || func_append preserve_args " --debug"
case $host in
*cygwin* | *mingw* | *pw32* | *cegcc*)
# don't eliminate duplications in $postdeps and $predeps
opt_duplicate_compiler_generated_deps=:
;;
*)
opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
;;
esac
$opt_help || {
# Sanity checks first:
func_check_version_match
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
func_fatal_configuration "not configured to build any kind of library"
fi
# Darwin sucks
eval std_shrext=\"$shrext_cmds\"
# Only execute mode is allowed to have -dlopen flags.
if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
func_error "unrecognized option \`-dlopen'"
$ECHO "$help" 1>&2
exit $EXIT_FAILURE
fi
# Change the help message to a mode-specific one.
generic_help="$help"
help="Try \`$progname --help --mode=$opt_mode' for more information."
}
# Bail if the options were screwed
$exit_cmd $EXIT_FAILURE
}
## ----------- ##
## Main. ##
## ----------- ##
# func_lalib_p file
# True iff FILE is a libtool `.la' library or `.lo' object file.
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_lalib_p ()
{
test -f "$1" &&
$SED -e 4q "$1" 2>/dev/null \
| $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
}
# func_lalib_unsafe_p file
# True iff FILE is a libtool `.la' library or `.lo' object file.
# This function implements the same check as func_lalib_p without
# resorting to external programs. To this end, it redirects stdin and
# closes it afterwards, without saving the original file descriptor.
# As a safety measure, use it only where a negative result would be
# fatal anyway. Works if `file' does not exist.
func_lalib_unsafe_p ()
{
lalib_p=no
if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
for lalib_p_l in 1 2 3 4
do
read lalib_p_line
case "$lalib_p_line" in
\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
esac
done
exec 0<&5 5<&-
fi
test "$lalib_p" = yes
}
# func_ltwrapper_script_p file
# True iff FILE is a libtool wrapper script
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_ltwrapper_script_p ()
{
func_lalib_p "$1"
}
# func_ltwrapper_executable_p file
# True iff FILE is a libtool wrapper executable
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_ltwrapper_executable_p ()
{
func_ltwrapper_exec_suffix=
case $1 in
*.exe) ;;
*) func_ltwrapper_exec_suffix=.exe ;;
esac
$GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
}
# func_ltwrapper_scriptname file
# Assumes file is an ltwrapper_executable
# uses $file to determine the appropriate filename for a
# temporary ltwrapper_script.
func_ltwrapper_scriptname ()
{
func_dirname_and_basename "$1" "" "."
func_stripname '' '.exe' "$func_basename_result"
func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
}
# func_ltwrapper_p file
# True iff FILE is a libtool wrapper script or wrapper executable
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_ltwrapper_p ()
{
func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
}
# func_execute_cmds commands fail_cmd
# Execute tilde-delimited COMMANDS.
# If FAIL_CMD is given, eval that upon failure.
# FAIL_CMD may read-access the current command in variable CMD!
func_execute_cmds ()
{
$opt_debug
save_ifs=$IFS; IFS='~'
for cmd in $1; do
IFS=$save_ifs
eval cmd=\"$cmd\"
func_show_eval "$cmd" "${2-:}"
done
IFS=$save_ifs
}
# func_source file
# Source FILE, adding directory component if necessary.
# Note that it is not necessary on cygwin/mingw to append a dot to
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
# behavior happens only for exec(3), not for open(2)! Also, sourcing
# `FILE.' does not work on cygwin managed mounts.
func_source ()
{
$opt_debug
case $1 in
*/* | *\\*) . "$1" ;;
*) . "./$1" ;;
esac
}
# func_resolve_sysroot PATH
# Replace a leading = in PATH with a sysroot. Store the result into
# func_resolve_sysroot_result
func_resolve_sysroot ()
{
func_resolve_sysroot_result=$1
case $func_resolve_sysroot_result in
=*)
func_stripname '=' '' "$func_resolve_sysroot_result"
func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
;;
esac
}
# func_replace_sysroot PATH
# If PATH begins with the sysroot, replace it with = and
# store the result into func_replace_sysroot_result.
func_replace_sysroot ()
{
case "$lt_sysroot:$1" in
?*:"$lt_sysroot"*)
func_stripname "$lt_sysroot" '' "$1"
func_replace_sysroot_result="=$func_stripname_result"
;;
*)
# Including no sysroot.
func_replace_sysroot_result=$1
;;
esac
}
# func_infer_tag arg
# Infer tagged configuration to use if any are available and
# if one wasn't chosen via the "--tag" command line option.
# Only attempt this if the compiler in the base compile
# command doesn't match the default compiler.
# arg is usually of the form 'gcc ...'
func_infer_tag ()
{
$opt_debug
if test -n "$available_tags" && test -z "$tagname"; then
CC_quoted=
for arg in $CC; do
func_append_quoted CC_quoted "$arg"
done
CC_expanded=`func_echo_all $CC`
CC_quoted_expanded=`func_echo_all $CC_quoted`
case $@ in
# Blanks in the command may have been stripped by the calling shell,
# but not from the CC environment variable when configure was run.
" $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
" $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
# Blanks at the start of $base_compile will cause this to fail
# if we don't check for them as well.
*)
for z in $available_tags; do
if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
# Evaluate the configuration.
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
CC_quoted=
for arg in $CC; do
# Double-quote args containing other shell metacharacters.
func_append_quoted CC_quoted "$arg"
done
CC_expanded=`func_echo_all $CC`
CC_quoted_expanded=`func_echo_all $CC_quoted`
case "$@ " in
" $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
" $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
# The compiler in the base compile command matches
# the one in the tagged configuration.
# Assume this is the tagged configuration we want.
tagname=$z
break
;;
esac
fi
done
# If $tagname still isn't set, then no tagged configuration
# was found and let the user know that the "--tag" command
# line option must be used.
if test -z "$tagname"; then
func_echo "unable to infer tagged configuration"
func_fatal_error "specify a tag with \`--tag'"
# else
# func_verbose "using $tagname tagged configuration"
fi
;;
esac
fi
}
# func_write_libtool_object output_name pic_name nonpic_name
# Create a libtool object file (analogous to a ".la" file),
# but don't create it if we're doing a dry run.
func_write_libtool_object ()
{
write_libobj=${1}
if test "$build_libtool_libs" = yes; then
write_lobj=\'${2}\'
else
write_lobj=none
fi
if test "$build_old_libs" = yes; then
write_oldobj=\'${3}\'
else
write_oldobj=none
fi
$opt_dry_run || {
cat >${write_libobj}T </dev/null`
if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
$SED -e "$lt_sed_naive_backslashify"`
else
func_convert_core_file_wine_to_w32_result=
fi
fi
}
# end: func_convert_core_file_wine_to_w32
# func_convert_core_path_wine_to_w32 ARG
# Helper function used by path conversion functions when $build is *nix, and
# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
# configured wine environment available, with the winepath program in $build's
# $PATH. Assumes ARG has no leading or trailing path separator characters.
#
# ARG is path to be converted from $build format to win32.
# Result is available in $func_convert_core_path_wine_to_w32_result.
# Unconvertible file (directory) names in ARG are skipped; if no directory names
# are convertible, then the result may be empty.
func_convert_core_path_wine_to_w32 ()
{
$opt_debug
# unfortunately, winepath doesn't convert paths, only file names
func_convert_core_path_wine_to_w32_result=""
if test -n "$1"; then
oldIFS=$IFS
IFS=:
for func_convert_core_path_wine_to_w32_f in $1; do
IFS=$oldIFS
func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
if test -n "$func_convert_core_file_wine_to_w32_result" ; then
if test -z "$func_convert_core_path_wine_to_w32_result"; then
func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
else
func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
fi
fi
done
IFS=$oldIFS
fi
}
# end: func_convert_core_path_wine_to_w32
# func_cygpath ARGS...
# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
# (2), returns the Cygwin file name or path in func_cygpath_result (input
# file name or path is assumed to be in w32 format, as previously converted
# from $build's *nix or MSYS format). In case (3), returns the w32 file name
# or path in func_cygpath_result (input file name or path is assumed to be in
# Cygwin format). Returns an empty string on error.
#
# ARGS are passed to cygpath, with the last one being the file name or path to
# be converted.
#
# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
# environment variable; do not put it in $PATH.
func_cygpath ()
{
$opt_debug
if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
if test "$?" -ne 0; then
# on failure, ensure result is empty
func_cygpath_result=
fi
else
func_cygpath_result=
func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
fi
}
#end: func_cygpath
# func_convert_core_msys_to_w32 ARG
# Convert file name or path ARG from MSYS format to w32 format. Return
# result in func_convert_core_msys_to_w32_result.
func_convert_core_msys_to_w32 ()
{
$opt_debug
# awkward: cmd appends spaces to result
func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
$SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
}
#end: func_convert_core_msys_to_w32
# func_convert_file_check ARG1 ARG2
# Verify that ARG1 (a file name in $build format) was converted to $host
# format in ARG2. Otherwise, emit an error message, but continue (resetting
# func_to_host_file_result to ARG1).
func_convert_file_check ()
{
$opt_debug
if test -z "$2" && test -n "$1" ; then
func_error "Could not determine host file name corresponding to"
func_error " \`$1'"
func_error "Continuing, but uninstalled executables may not work."
# Fallback:
func_to_host_file_result="$1"
fi
}
# end func_convert_file_check
# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
# Verify that FROM_PATH (a path in $build format) was converted to $host
# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
# func_to_host_file_result to a simplistic fallback value (see below).
func_convert_path_check ()
{
$opt_debug
if test -z "$4" && test -n "$3"; then
func_error "Could not determine the host path corresponding to"
func_error " \`$3'"
func_error "Continuing, but uninstalled executables may not work."
# Fallback. This is a deliberately simplistic "conversion" and
# should not be "improved". See libtool.info.
if test "x$1" != "x$2"; then
lt_replace_pathsep_chars="s|$1|$2|g"
func_to_host_path_result=`echo "$3" |
$SED -e "$lt_replace_pathsep_chars"`
else
func_to_host_path_result="$3"
fi
fi
}
# end func_convert_path_check
# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
# and appending REPL if ORIG matches BACKPAT.
func_convert_path_front_back_pathsep ()
{
$opt_debug
case $4 in
$1 ) func_to_host_path_result="$3$func_to_host_path_result"
;;
esac
case $4 in
$2 ) func_append func_to_host_path_result "$3"
;;
esac
}
# end func_convert_path_front_back_pathsep
##################################################
# $build to $host FILE NAME CONVERSION FUNCTIONS #
##################################################
# invoked via `$to_host_file_cmd ARG'
#
# In each case, ARG is the path to be converted from $build to $host format.
# Result will be available in $func_to_host_file_result.
# func_to_host_file ARG
# Converts the file name ARG from $build format to $host format. Return result
# in func_to_host_file_result.
func_to_host_file ()
{
$opt_debug
$to_host_file_cmd "$1"
}
# end func_to_host_file
# func_to_tool_file ARG LAZY
# converts the file name ARG from $build format to toolchain format. Return
# result in func_to_tool_file_result. If the conversion in use is listed
# in (the comma separated) LAZY, no conversion takes place.
func_to_tool_file ()
{
$opt_debug
case ,$2, in
*,"$to_tool_file_cmd",*)
func_to_tool_file_result=$1
;;
*)
$to_tool_file_cmd "$1"
func_to_tool_file_result=$func_to_host_file_result
;;
esac
}
# end func_to_tool_file
# func_convert_file_noop ARG
# Copy ARG to func_to_host_file_result.
func_convert_file_noop ()
{
func_to_host_file_result="$1"
}
# end func_convert_file_noop
# func_convert_file_msys_to_w32 ARG
# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
# conversion to w32 is not available inside the cwrapper. Returns result in
# func_to_host_file_result.
func_convert_file_msys_to_w32 ()
{
$opt_debug
func_to_host_file_result="$1"
if test -n "$1"; then
func_convert_core_msys_to_w32 "$1"
func_to_host_file_result="$func_convert_core_msys_to_w32_result"
fi
func_convert_file_check "$1" "$func_to_host_file_result"
}
# end func_convert_file_msys_to_w32
# func_convert_file_cygwin_to_w32 ARG
# Convert file name ARG from Cygwin to w32 format. Returns result in
# func_to_host_file_result.
func_convert_file_cygwin_to_w32 ()
{
$opt_debug
func_to_host_file_result="$1"
if test -n "$1"; then
# because $build is cygwin, we call "the" cygpath in $PATH; no need to use
# LT_CYGPATH in this case.
func_to_host_file_result=`cygpath -m "$1"`
fi
func_convert_file_check "$1" "$func_to_host_file_result"
}
# end func_convert_file_cygwin_to_w32
# func_convert_file_nix_to_w32 ARG
# Convert file name ARG from *nix to w32 format. Requires a wine environment
# and a working winepath. Returns result in func_to_host_file_result.
func_convert_file_nix_to_w32 ()
{
$opt_debug
func_to_host_file_result="$1"
if test -n "$1"; then
func_convert_core_file_wine_to_w32 "$1"
func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
fi
func_convert_file_check "$1" "$func_to_host_file_result"
}
# end func_convert_file_nix_to_w32
# func_convert_file_msys_to_cygwin ARG
# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
# Returns result in func_to_host_file_result.
func_convert_file_msys_to_cygwin ()
{
$opt_debug
func_to_host_file_result="$1"
if test -n "$1"; then
func_convert_core_msys_to_w32 "$1"
func_cygpath -u "$func_convert_core_msys_to_w32_result"
func_to_host_file_result="$func_cygpath_result"
fi
func_convert_file_check "$1" "$func_to_host_file_result"
}
# end func_convert_file_msys_to_cygwin
# func_convert_file_nix_to_cygwin ARG
# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
# in a wine environment, working winepath, and LT_CYGPATH set. Returns result
# in func_to_host_file_result.
func_convert_file_nix_to_cygwin ()
{
$opt_debug
func_to_host_file_result="$1"
if test -n "$1"; then
# convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
func_convert_core_file_wine_to_w32 "$1"
func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
func_to_host_file_result="$func_cygpath_result"
fi
func_convert_file_check "$1" "$func_to_host_file_result"
}
# end func_convert_file_nix_to_cygwin
#############################################
# $build to $host PATH CONVERSION FUNCTIONS #
#############################################
# invoked via `$to_host_path_cmd ARG'
#
# In each case, ARG is the path to be converted from $build to $host format.
# The result will be available in $func_to_host_path_result.
#
# Path separators are also converted from $build format to $host format. If
# ARG begins or ends with a path separator character, it is preserved (but
# converted to $host format) on output.
#
# All path conversion functions are named using the following convention:
# file name conversion function : func_convert_file_X_to_Y ()
# path conversion function : func_convert_path_X_to_Y ()
# where, for any given $build/$host combination the 'X_to_Y' value is the
# same. If conversion functions are added for new $build/$host combinations,
# the two new functions must follow this pattern, or func_init_to_host_path_cmd
# will break.
# func_init_to_host_path_cmd
# Ensures that function "pointer" variable $to_host_path_cmd is set to the
# appropriate value, based on the value of $to_host_file_cmd.
to_host_path_cmd=
func_init_to_host_path_cmd ()
{
$opt_debug
if test -z "$to_host_path_cmd"; then
func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
to_host_path_cmd="func_convert_path_${func_stripname_result}"
fi
}
# func_to_host_path ARG
# Converts the path ARG from $build format to $host format. Return result
# in func_to_host_path_result.
func_to_host_path ()
{
$opt_debug
func_init_to_host_path_cmd
$to_host_path_cmd "$1"
}
# end func_to_host_path
# func_convert_path_noop ARG
# Copy ARG to func_to_host_path_result.
func_convert_path_noop ()
{
func_to_host_path_result="$1"
}
# end func_convert_path_noop
# func_convert_path_msys_to_w32 ARG
# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
# conversion to w32 is not available inside the cwrapper. Returns result in
# func_to_host_path_result.
func_convert_path_msys_to_w32 ()
{
$opt_debug
func_to_host_path_result="$1"
if test -n "$1"; then
# Remove leading and trailing path separator characters from ARG. MSYS
# behavior is inconsistent here; cygpath turns them into '.;' and ';.';
# and winepath ignores them completely.
func_stripname : : "$1"
func_to_host_path_tmp1=$func_stripname_result
func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
func_to_host_path_result="$func_convert_core_msys_to_w32_result"
func_convert_path_check : ";" \
"$func_to_host_path_tmp1" "$func_to_host_path_result"
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
fi
}
# end func_convert_path_msys_to_w32
# func_convert_path_cygwin_to_w32 ARG
# Convert path ARG from Cygwin to w32 format. Returns result in
# func_to_host_file_result.
func_convert_path_cygwin_to_w32 ()
{
$opt_debug
func_to_host_path_result="$1"
if test -n "$1"; then
# See func_convert_path_msys_to_w32:
func_stripname : : "$1"
func_to_host_path_tmp1=$func_stripname_result
func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
func_convert_path_check : ";" \
"$func_to_host_path_tmp1" "$func_to_host_path_result"
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
fi
}
# end func_convert_path_cygwin_to_w32
# func_convert_path_nix_to_w32 ARG
# Convert path ARG from *nix to w32 format. Requires a wine environment and
# a working winepath. Returns result in func_to_host_file_result.
func_convert_path_nix_to_w32 ()
{
$opt_debug
func_to_host_path_result="$1"
if test -n "$1"; then
# See func_convert_path_msys_to_w32:
func_stripname : : "$1"
func_to_host_path_tmp1=$func_stripname_result
func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
func_convert_path_check : ";" \
"$func_to_host_path_tmp1" "$func_to_host_path_result"
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
fi
}
# end func_convert_path_nix_to_w32
# func_convert_path_msys_to_cygwin ARG
# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
# Returns result in func_to_host_file_result.
func_convert_path_msys_to_cygwin ()
{
$opt_debug
func_to_host_path_result="$1"
if test -n "$1"; then
# See func_convert_path_msys_to_w32:
func_stripname : : "$1"
func_to_host_path_tmp1=$func_stripname_result
func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
func_to_host_path_result="$func_cygpath_result"
func_convert_path_check : : \
"$func_to_host_path_tmp1" "$func_to_host_path_result"
func_convert_path_front_back_pathsep ":*" "*:" : "$1"
fi
}
# end func_convert_path_msys_to_cygwin
# func_convert_path_nix_to_cygwin ARG
# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
# a wine environment, working winepath, and LT_CYGPATH set. Returns result in
# func_to_host_file_result.
func_convert_path_nix_to_cygwin ()
{
$opt_debug
func_to_host_path_result="$1"
if test -n "$1"; then
# Remove leading and trailing path separator characters from
# ARG. msys behavior is inconsistent here, cygpath turns them
# into '.;' and ';.', and winepath ignores them completely.
func_stripname : : "$1"
func_to_host_path_tmp1=$func_stripname_result
func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
func_to_host_path_result="$func_cygpath_result"
func_convert_path_check : : \
"$func_to_host_path_tmp1" "$func_to_host_path_result"
func_convert_path_front_back_pathsep ":*" "*:" : "$1"
fi
}
# end func_convert_path_nix_to_cygwin
# func_mode_compile arg...
func_mode_compile ()
{
$opt_debug
# Get the compilation command and the source file.
base_compile=
srcfile="$nonopt" # always keep a non-empty value in "srcfile"
suppress_opt=yes
suppress_output=
arg_mode=normal
libobj=
later=
pie_flag=
for arg
do
case $arg_mode in
arg )
# do not "continue". Instead, add this to base_compile
lastarg="$arg"
arg_mode=normal
;;
target )
libobj="$arg"
arg_mode=normal
continue
;;
normal )
# Accept any command-line options.
case $arg in
-o)
test -n "$libobj" && \
func_fatal_error "you cannot specify \`-o' more than once"
arg_mode=target
continue
;;
-pie | -fpie | -fPIE)
func_append pie_flag " $arg"
continue
;;
-shared | -static | -prefer-pic | -prefer-non-pic)
func_append later " $arg"
continue
;;
-no-suppress)
suppress_opt=no
continue
;;
-Xcompiler)
arg_mode=arg # the next one goes into the "base_compile" arg list
continue # The current "srcfile" will either be retained or
;; # replaced later. I would guess that would be a bug.
-Wc,*)
func_stripname '-Wc,' '' "$arg"
args=$func_stripname_result
lastarg=
save_ifs="$IFS"; IFS=','
for arg in $args; do
IFS="$save_ifs"
func_append_quoted lastarg "$arg"
done
IFS="$save_ifs"
func_stripname ' ' '' "$lastarg"
lastarg=$func_stripname_result
# Add the arguments to base_compile.
func_append base_compile " $lastarg"
continue
;;
*)
# Accept the current argument as the source file.
# The previous "srcfile" becomes the current argument.
#
lastarg="$srcfile"
srcfile="$arg"
;;
esac # case $arg
;;
esac # case $arg_mode
# Aesthetically quote the previous argument.
func_append_quoted base_compile "$lastarg"
done # for arg
case $arg_mode in
arg)
func_fatal_error "you must specify an argument for -Xcompile"
;;
target)
func_fatal_error "you must specify a target with \`-o'"
;;
*)
# Get the name of the library object.
test -z "$libobj" && {
func_basename "$srcfile"
libobj="$func_basename_result"
}
;;
esac
# Recognize several different file suffixes.
# If the user specifies -o file.o, it is replaced with file.lo
case $libobj in
*.[cCFSifmso] | \
*.ada | *.adb | *.ads | *.asm | \
*.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
*.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
func_xform "$libobj"
libobj=$func_xform_result
;;
esac
case $libobj in
*.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
*)
func_fatal_error "cannot determine name of library object from \`$libobj'"
;;
esac
func_infer_tag $base_compile
for arg in $later; do
case $arg in
-shared)
test "$build_libtool_libs" != yes && \
func_fatal_configuration "can not build a shared library"
build_old_libs=no
continue
;;
-static)
build_libtool_libs=no
build_old_libs=yes
continue
;;
-prefer-pic)
pic_mode=yes
continue
;;
-prefer-non-pic)
pic_mode=no
continue
;;
esac
done
func_quote_for_eval "$libobj"
test "X$libobj" != "X$func_quote_for_eval_result" \
&& $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
&& func_warning "libobj name \`$libobj' may not contain shell special characters."
func_dirname_and_basename "$obj" "/" ""
objname="$func_basename_result"
xdir="$func_dirname_result"
lobj=${xdir}$objdir/$objname
test -z "$base_compile" && \
func_fatal_help "you must specify a compilation command"
# Delete any leftover library objects.
if test "$build_old_libs" = yes; then
removelist="$obj $lobj $libobj ${libobj}T"
else
removelist="$lobj $libobj ${libobj}T"
fi
# On Cygwin there's no "real" PIC flag so we must build both object types
case $host_os in
cygwin* | mingw* | pw32* | os2* | cegcc*)
pic_mode=default
;;
esac
if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
# non-PIC code in shared libraries is not supported
pic_mode=default
fi
# Calculate the filename of the output object if compiler does
# not support -o with -c
if test "$compiler_c_o" = no; then
output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
lockfile="$output_obj.lock"
else
output_obj=
need_locks=no
lockfile=
fi
# Lock this critical section if it is needed
# We use this script file to make the link, it avoids creating a new file
if test "$need_locks" = yes; then
until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
func_echo "Waiting for $lockfile to be removed"
sleep 2
done
elif test "$need_locks" = warn; then
if test -f "$lockfile"; then
$ECHO "\
*** ERROR, $lockfile exists and contains:
`cat $lockfile 2>/dev/null`
This indicates that another process is trying to use the same
temporary object file, and libtool could not work around it because
your compiler does not support \`-c' and \`-o' together. If you
repeat this compilation, it may succeed, by chance, but you had better
avoid parallel builds (make -j) in this platform, or get a better
compiler."
$opt_dry_run || $RM $removelist
exit $EXIT_FAILURE
fi
func_append removelist " $output_obj"
$ECHO "$srcfile" > "$lockfile"
fi
$opt_dry_run || $RM $removelist
func_append removelist " $lockfile"
trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
srcfile=$func_to_tool_file_result
func_quote_for_eval "$srcfile"
qsrcfile=$func_quote_for_eval_result
# Only build a PIC object if we are building libtool libraries.
if test "$build_libtool_libs" = yes; then
# Without this assignment, base_compile gets emptied.
fbsd_hideous_sh_bug=$base_compile
if test "$pic_mode" != no; then
command="$base_compile $qsrcfile $pic_flag"
else
# Don't build PIC code
command="$base_compile $qsrcfile"
fi
func_mkdir_p "$xdir$objdir"
if test -z "$output_obj"; then
# Place PIC objects in $objdir
func_append command " -o $lobj"
fi
func_show_eval_locale "$command" \
'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
if test "$need_locks" = warn &&
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
$ECHO "\
*** ERROR, $lockfile contains:
`cat $lockfile 2>/dev/null`
but it should contain:
$srcfile
This indicates that another process is trying to use the same
temporary object file, and libtool could not work around it because
your compiler does not support \`-c' and \`-o' together. If you
repeat this compilation, it may succeed, by chance, but you had better
avoid parallel builds (make -j) in this platform, or get a better
compiler."
$opt_dry_run || $RM $removelist
exit $EXIT_FAILURE
fi
# Just move the object if needed, then go on to compile the next one
if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
func_show_eval '$MV "$output_obj" "$lobj"' \
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
fi
# Allow error messages only from the first compilation.
if test "$suppress_opt" = yes; then
suppress_output=' >/dev/null 2>&1'
fi
fi
# Only build a position-dependent object if we build old libraries.
if test "$build_old_libs" = yes; then
if test "$pic_mode" != yes; then
# Don't build PIC code
command="$base_compile $qsrcfile$pie_flag"
else
command="$base_compile $qsrcfile $pic_flag"
fi
if test "$compiler_c_o" = yes; then
func_append command " -o $obj"
fi
# Suppress compiler output if we already did a PIC compilation.
func_append command "$suppress_output"
func_show_eval_locale "$command" \
'$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
if test "$need_locks" = warn &&
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
$ECHO "\
*** ERROR, $lockfile contains:
`cat $lockfile 2>/dev/null`
but it should contain:
$srcfile
This indicates that another process is trying to use the same
temporary object file, and libtool could not work around it because
your compiler does not support \`-c' and \`-o' together. If you
repeat this compilation, it may succeed, by chance, but you had better
avoid parallel builds (make -j) in this platform, or get a better
compiler."
$opt_dry_run || $RM $removelist
exit $EXIT_FAILURE
fi
# Just move the object if needed
if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
func_show_eval '$MV "$output_obj" "$obj"' \
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
fi
fi
$opt_dry_run || {
func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
# Unlock the critical section if it was locked
if test "$need_locks" != no; then
removelist=$lockfile
$RM "$lockfile"
fi
}
exit $EXIT_SUCCESS
}
$opt_help || {
test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
}
func_mode_help ()
{
# We need to display help for each of the modes.
case $opt_mode in
"")
# Generic help is extracted from the usage comments
# at the start of this file.
func_help
;;
clean)
$ECHO \
"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
Remove files from the build directory.
RM is the name of the program to use to delete files associated with each FILE
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
to RM.
If FILE is a libtool library, object or program, all the files associated
with it are deleted. Otherwise, only FILE itself is deleted using RM."
;;
compile)
$ECHO \
"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
Compile a source file into a libtool library object.
This mode accepts the following additional options:
-o OUTPUT-FILE set the output file name to OUTPUT-FILE
-no-suppress do not suppress compiler output for multiple passes
-prefer-pic try to build PIC objects only
-prefer-non-pic try to build non-PIC objects only
-shared do not build a \`.o' file suitable for static linking
-static only build a \`.o' file suitable for static linking
-Wc,FLAG pass FLAG directly to the compiler
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
from the given SOURCEFILE.
The output file name is determined by removing the directory component from
SOURCEFILE, then substituting the C source code suffix \`.c' with the
library object suffix, \`.lo'."
;;
execute)
$ECHO \
"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
Automatically set library path, then run a program.
This mode accepts the following additional options:
-dlopen FILE add the directory containing FILE to the library path
This mode sets the library path environment variable according to \`-dlopen'
flags.
If any of the ARGS are libtool executable wrappers, then they are translated
into their corresponding uninstalled binary, and any of their required library
directories are added to the library path.
Then, COMMAND is executed, with ARGS as arguments."
;;
finish)
$ECHO \
"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
Complete the installation of libtool libraries.
Each LIBDIR is a directory that contains libtool libraries.
The commands that this mode executes may require superuser privileges. Use
the \`--dry-run' option if you just want to see what would be executed."
;;
install)
$ECHO \
"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
Install executables or libraries.
INSTALL-COMMAND is the installation command. The first component should be
either the \`install' or \`cp' program.
The following components of INSTALL-COMMAND are treated specially:
-inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
The rest of the components are interpreted as arguments to that command (only
BSD-compatible install options are recognized)."
;;
link)
$ECHO \
"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
Link object files or libraries together to form another library, or to
create an executable program.
LINK-COMMAND is a command using the C compiler that you would use to create
a program from several object files.
The following components of LINK-COMMAND are treated specially:
-all-static do not do any dynamic linking at all
-avoid-version do not add a version suffix if possible
-bindir BINDIR specify path to binaries directory (for systems where
libraries must be found in the PATH setting at runtime)
-dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
-export-symbols SYMFILE
try to export only the symbols listed in SYMFILE
-export-symbols-regex REGEX
try to export only the symbols matching REGEX
-LLIBDIR search LIBDIR for required installed libraries
-lNAME OUTPUT-FILE requires the installed library libNAME
-module build a library that can dlopened
-no-fast-install disable the fast-install mode
-no-install link a not-installable executable
-no-undefined declare that a library does not refer to external symbols
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
-objectlist FILE Use a list of object files found in FILE to specify objects
-precious-files-regex REGEX
don't remove output files matching REGEX
-release RELEASE specify package release information
-rpath LIBDIR the created library will eventually be installed in LIBDIR
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
-shared only do dynamic linking of libtool libraries
-shrext SUFFIX override the standard shared library file extension
-static do not do any dynamic linking of uninstalled libtool libraries
-static-libtool-libs
do not do any dynamic linking of libtool libraries
-version-info CURRENT[:REVISION[:AGE]]
specify library version info [each variable defaults to 0]
-weak LIBNAME declare that the target provides the LIBNAME interface
-Wc,FLAG
-Xcompiler FLAG pass linker-specific FLAG directly to the compiler
-Wl,FLAG
-Xlinker FLAG pass linker-specific FLAG directly to the linker
-XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
All other options (arguments beginning with \`-') are ignored.
Every other argument is treated as a filename. Files ending in \`.la' are
treated as uninstalled libtool libraries, other files are standard or library
object files.
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
only library objects (\`.lo' files) may be specified, and \`-rpath' is
required, except when creating a convenience library.
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
using \`ar' and \`ranlib', or on Windows using \`lib'.
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
is created, otherwise an executable program is created."
;;
uninstall)
$ECHO \
"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
Remove libraries from an installation directory.
RM is the name of the program to use to delete files associated with each FILE
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
to RM.
If FILE is a libtool library, all the files associated with it are deleted.
Otherwise, only FILE itself is deleted using RM."
;;
*)
func_fatal_help "invalid operation mode \`$opt_mode'"
;;
esac
echo
$ECHO "Try \`$progname --help' for more information about other modes."
}
# Now that we've collected a possible --mode arg, show help if necessary
if $opt_help; then
if test "$opt_help" = :; then
func_mode_help
else
{
func_help noexit
for opt_mode in compile link execute install finish uninstall clean; do
func_mode_help
done
} | sed -n '1p; 2,$s/^Usage:/ or: /p'
{
func_help noexit
for opt_mode in compile link execute install finish uninstall clean; do
echo
func_mode_help
done
} |
sed '1d
/^When reporting/,/^Report/{
H
d
}
$x
/information about other modes/d
/more detailed .*MODE/d
s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
fi
exit $?
fi
# func_mode_execute arg...
func_mode_execute ()
{
$opt_debug
# The first argument is the command name.
cmd="$nonopt"
test -z "$cmd" && \
func_fatal_help "you must specify a COMMAND"
# Handle -dlopen flags immediately.
for file in $opt_dlopen; do
test -f "$file" \
|| func_fatal_help "\`$file' is not a file"
dir=
case $file in
*.la)
func_resolve_sysroot "$file"
file=$func_resolve_sysroot_result
# Check to see that this really is a libtool archive.
func_lalib_unsafe_p "$file" \
|| func_fatal_help "\`$lib' is not a valid libtool archive"
# Read the libtool library.
dlname=
library_names=
func_source "$file"
# Skip this library if it cannot be dlopened.
if test -z "$dlname"; then
# Warn if it was a shared library.
test -n "$library_names" && \
func_warning "\`$file' was not linked with \`-export-dynamic'"
continue
fi
func_dirname "$file" "" "."
dir="$func_dirname_result"
if test -f "$dir/$objdir/$dlname"; then
func_append dir "/$objdir"
else
if test ! -f "$dir/$dlname"; then
func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
fi
fi
;;
*.lo)
# Just add the directory containing the .lo file.
func_dirname "$file" "" "."
dir="$func_dirname_result"
;;
*)
func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
continue
;;
esac
# Get the absolute pathname.
absdir=`cd "$dir" && pwd`
test -n "$absdir" && dir="$absdir"
# Now add the directory to shlibpath_var.
if eval "test -z \"\$$shlibpath_var\""; then
eval "$shlibpath_var=\"\$dir\""
else
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
fi
done
# This variable tells wrapper scripts just to set shlibpath_var
# rather than running their programs.
libtool_execute_magic="$magic"
# Check if any of the arguments is a wrapper script.
args=
for file
do
case $file in
-* | *.la | *.lo ) ;;
*)
# Do a test to see if this is really a libtool program.
if func_ltwrapper_script_p "$file"; then
func_source "$file"
# Transform arg to wrapped name.
file="$progdir/$program"
elif func_ltwrapper_executable_p "$file"; then
func_ltwrapper_scriptname "$file"
func_source "$func_ltwrapper_scriptname_result"
# Transform arg to wrapped name.
file="$progdir/$program"
fi
;;
esac
# Quote arguments (to preserve shell metacharacters).
func_append_quoted args "$file"
done
if test "X$opt_dry_run" = Xfalse; then
if test -n "$shlibpath_var"; then
# Export the shlibpath_var.
eval "export $shlibpath_var"
fi
# Restore saved environment variables
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
do
eval "if test \"\${save_$lt_var+set}\" = set; then
$lt_var=\$save_$lt_var; export $lt_var
else
$lt_unset $lt_var
fi"
done
# Now prepare to actually exec the command.
exec_cmd="\$cmd$args"
else
# Display what would be done.
if test -n "$shlibpath_var"; then
eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
echo "export $shlibpath_var"
fi
$ECHO "$cmd$args"
exit $EXIT_SUCCESS
fi
}
test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
# func_mode_finish arg...
func_mode_finish ()
{
$opt_debug
libs=
libdirs=
admincmds=
for opt in "$nonopt" ${1+"$@"}
do
if test -d "$opt"; then
func_append libdirs " $opt"
elif test -f "$opt"; then
if func_lalib_unsafe_p "$opt"; then
func_append libs " $opt"
else
func_warning "\`$opt' is not a valid libtool archive"
fi
else
func_fatal_error "invalid argument \`$opt'"
fi
done
if test -n "$libs"; then
if test -n "$lt_sysroot"; then
sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
else
sysroot_cmd=
fi
# Remove sysroot references
if $opt_dry_run; then
for lib in $libs; do
echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
done
else
tmpdir=`func_mktempdir`
for lib in $libs; do
sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
> $tmpdir/tmp-la
mv -f $tmpdir/tmp-la $lib
done
${RM}r "$tmpdir"
fi
fi
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
for libdir in $libdirs; do
if test -n "$finish_cmds"; then
# Do each command in the finish commands.
func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
'"$cmd"'"'
fi
if test -n "$finish_eval"; then
# Do the single finish_eval.
eval cmds=\"$finish_eval\"
$opt_dry_run || eval "$cmds" || func_append admincmds "
$cmds"
fi
done
fi
# Exit here if they wanted silent mode.
$opt_silent && exit $EXIT_SUCCESS
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
echo "----------------------------------------------------------------------"
echo "Libraries have been installed in:"
for libdir in $libdirs; do
$ECHO " $libdir"
done
echo
echo "If you ever happen to want to link against installed libraries"
echo "in a given directory, LIBDIR, you must either use libtool, and"
echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
echo "flag during linking and do at least one of the following:"
if test -n "$shlibpath_var"; then
echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
echo " during execution"
fi
if test -n "$runpath_var"; then
echo " - add LIBDIR to the \`$runpath_var' environment variable"
echo " during linking"
fi
if test -n "$hardcode_libdir_flag_spec"; then
libdir=LIBDIR
eval flag=\"$hardcode_libdir_flag_spec\"
$ECHO " - use the \`$flag' linker flag"
fi
if test -n "$admincmds"; then
$ECHO " - have your system administrator run these commands:$admincmds"
fi
if test -f /etc/ld.so.conf; then
echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
fi
echo
echo "See any operating system documentation about shared libraries for"
case $host in
solaris2.[6789]|solaris2.1[0-9])
echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
echo "pages."
;;
*)
echo "more information, such as the ld(1) and ld.so(8) manual pages."
;;
esac
echo "----------------------------------------------------------------------"
fi
exit $EXIT_SUCCESS
}
test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
# func_mode_install arg...
func_mode_install ()
{
$opt_debug
# There may be an optional sh(1) argument at the beginning of
# install_prog (especially on Windows NT).
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
# Allow the use of GNU shtool's install command.
case $nonopt in *shtool*) :;; *) false;; esac; then
# Aesthetically quote it.
func_quote_for_eval "$nonopt"
install_prog="$func_quote_for_eval_result "
arg=$1
shift
else
install_prog=
arg=$nonopt
fi
# The real first argument should be the name of the installation program.
# Aesthetically quote it.
func_quote_for_eval "$arg"
func_append install_prog "$func_quote_for_eval_result"
install_shared_prog=$install_prog
case " $install_prog " in
*[\\\ /]cp\ *) install_cp=: ;;
*) install_cp=false ;;
esac
# We need to accept at least all the BSD install flags.
dest=
files=
opts=
prev=
install_type=
isdir=no
stripme=
no_mode=:
for arg
do
arg2=
if test -n "$dest"; then
func_append files " $dest"
dest=$arg
continue
fi
case $arg in
-d) isdir=yes ;;
-f)
if $install_cp; then :; else
prev=$arg
fi
;;
-g | -m | -o)
prev=$arg
;;
-s)
stripme=" -s"
continue
;;
-*)
;;
*)
# If the previous option needed an argument, then skip it.
if test -n "$prev"; then
if test "x$prev" = x-m && test -n "$install_override_mode"; then
arg2=$install_override_mode
no_mode=false
fi
prev=
else
dest=$arg
continue
fi
;;
esac
# Aesthetically quote the argument.
func_quote_for_eval "$arg"
func_append install_prog " $func_quote_for_eval_result"
if test -n "$arg2"; then
func_quote_for_eval "$arg2"
fi
func_append install_shared_prog " $func_quote_for_eval_result"
done
test -z "$install_prog" && \
func_fatal_help "you must specify an install program"
test -n "$prev" && \
func_fatal_help "the \`$prev' option requires an argument"
if test -n "$install_override_mode" && $no_mode; then
if $install_cp; then :; else
func_quote_for_eval "$install_override_mode"
func_append install_shared_prog " -m $func_quote_for_eval_result"
fi
fi
if test -z "$files"; then
if test -z "$dest"; then
func_fatal_help "no file or destination specified"
else
func_fatal_help "you must specify a destination"
fi
fi
# Strip any trailing slash from the destination.
func_stripname '' '/' "$dest"
dest=$func_stripname_result
# Check to see that the destination is a directory.
test -d "$dest" && isdir=yes
if test "$isdir" = yes; then
destdir="$dest"
destname=
else
func_dirname_and_basename "$dest" "" "."
destdir="$func_dirname_result"
destname="$func_basename_result"
# Not a directory, so check to see that there is only one file specified.
set dummy $files; shift
test "$#" -gt 1 && \
func_fatal_help "\`$dest' is not a directory"
fi
case $destdir in
[\\/]* | [A-Za-z]:[\\/]*) ;;
*)
for file in $files; do
case $file in
*.lo) ;;
*)
func_fatal_help "\`$destdir' must be an absolute directory name"
;;
esac
done
;;
esac
# This variable tells wrapper scripts just to set variables rather
# than running their programs.
libtool_install_magic="$magic"
staticlibs=
future_libdirs=
current_libdirs=
for file in $files; do
# Do each installation.
case $file in
*.$libext)
# Do the static libraries later.
func_append staticlibs " $file"
;;
*.la)
func_resolve_sysroot "$file"
file=$func_resolve_sysroot_result
# Check to see that this really is a libtool archive.
func_lalib_unsafe_p "$file" \
|| func_fatal_help "\`$file' is not a valid libtool archive"
library_names=
old_library=
relink_command=
func_source "$file"
# Add the libdir to current_libdirs if it is the destination.
if test "X$destdir" = "X$libdir"; then
case "$current_libdirs " in
*" $libdir "*) ;;
*) func_append current_libdirs " $libdir" ;;
esac
else
# Note the libdir as a future libdir.
case "$future_libdirs " in
*" $libdir "*) ;;
*) func_append future_libdirs " $libdir" ;;
esac
fi
func_dirname "$file" "/" ""
dir="$func_dirname_result"
func_append dir "$objdir"
if test -n "$relink_command"; then
# Determine the prefix the user has applied to our future dir.
inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
# Don't allow the user to place us outside of our expected
# location b/c this prevents finding dependent libraries that
# are installed to the same prefix.
# At present, this check doesn't affect windows .dll's that
# are installed into $libdir/../bin (currently, that works fine)
# but it's something to keep an eye on.
test "$inst_prefix_dir" = "$destdir" && \
func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
if test -n "$inst_prefix_dir"; then
# Stick the inst_prefix_dir data into the link command.
relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
else
relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
fi
func_warning "relinking \`$file'"
func_show_eval "$relink_command" \
'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
fi
# See the names of the shared library.
set dummy $library_names; shift
if test -n "$1"; then
realname="$1"
shift
srcname="$realname"
test -n "$relink_command" && srcname="$realname"T
# Install the shared library and build the symlinks.
func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
'exit $?'
tstripme="$stripme"
case $host_os in
cygwin* | mingw* | pw32* | cegcc*)
case $realname in
*.dll.a)
tstripme=""
;;
esac
;;
esac
if test -n "$tstripme" && test -n "$striplib"; then
func_show_eval "$striplib $destdir/$realname" 'exit $?'
fi
if test "$#" -gt 0; then
# Delete the old symlinks, and create new ones.
# Try `ln -sf' first, because the `ln' binary might depend on
# the symlink we replace! Solaris /bin/ln does not understand -f,
# so we also need to try rm && ln -s.
for linkname
do
test "$linkname" != "$realname" \
&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
done
fi
# Do each command in the postinstall commands.
lib="$destdir/$realname"
func_execute_cmds "$postinstall_cmds" 'exit $?'
fi
# Install the pseudo-library for information purposes.
func_basename "$file"
name="$func_basename_result"
instname="$dir/$name"i
func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
# Maybe install the static library, too.
test -n "$old_library" && func_append staticlibs " $dir/$old_library"
;;
*.lo)
# Install (i.e. copy) a libtool object.
# Figure out destination file name, if it wasn't already specified.
if test -n "$destname"; then
destfile="$destdir/$destname"
else
func_basename "$file"
destfile="$func_basename_result"
destfile="$destdir/$destfile"
fi
# Deduce the name of the destination old-style object file.
case $destfile in
*.lo)
func_lo2o "$destfile"
staticdest=$func_lo2o_result
;;
*.$objext)
staticdest="$destfile"
destfile=
;;
*)
func_fatal_help "cannot copy a libtool object to \`$destfile'"
;;
esac
# Install the libtool object if requested.
test -n "$destfile" && \
func_show_eval "$install_prog $file $destfile" 'exit $?'
# Install the old object if enabled.
if test "$build_old_libs" = yes; then
# Deduce the name of the old-style object file.
func_lo2o "$file"
staticobj=$func_lo2o_result
func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
fi
exit $EXIT_SUCCESS
;;
*)
# Figure out destination file name, if it wasn't already specified.
if test -n "$destname"; then
destfile="$destdir/$destname"
else
func_basename "$file"
destfile="$func_basename_result"
destfile="$destdir/$destfile"
fi
# If the file is missing, and there is a .exe on the end, strip it
# because it is most likely a libtool script we actually want to
# install
stripped_ext=""
case $file in
*.exe)
if test ! -f "$file"; then
func_stripname '' '.exe' "$file"
file=$func_stripname_result
stripped_ext=".exe"
fi
;;
esac
# Do a test to see if this is really a libtool program.
case $host in
*cygwin* | *mingw*)
if func_ltwrapper_executable_p "$file"; then
func_ltwrapper_scriptname "$file"
wrapper=$func_ltwrapper_scriptname_result
else
func_stripname '' '.exe' "$file"
wrapper=$func_stripname_result
fi
;;
*)
wrapper=$file
;;
esac
if func_ltwrapper_script_p "$wrapper"; then
notinst_deplibs=
relink_command=
func_source "$wrapper"
# Check the variables that should have been set.
test -z "$generated_by_libtool_version" && \
func_fatal_error "invalid libtool wrapper script \`$wrapper'"
finalize=yes
for lib in $notinst_deplibs; do
# Check to see that each library is installed.
libdir=
if test -f "$lib"; then
func_source "$lib"
fi
libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
if test -n "$libdir" && test ! -f "$libfile"; then
func_warning "\`$lib' has not been installed in \`$libdir'"
finalize=no
fi
done
relink_command=
func_source "$wrapper"
outputname=
if test "$fast_install" = no && test -n "$relink_command"; then
$opt_dry_run || {
if test "$finalize" = yes; then
tmpdir=`func_mktempdir`
func_basename "$file$stripped_ext"
file="$func_basename_result"
outputname="$tmpdir/$file"
# Replace the output file specification.
relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
$opt_silent || {
func_quote_for_expand "$relink_command"
eval "func_echo $func_quote_for_expand_result"
}
if eval "$relink_command"; then :
else
func_error "error: relink \`$file' with the above command before installing it"
$opt_dry_run || ${RM}r "$tmpdir"
continue
fi
file="$outputname"
else
func_warning "cannot relink \`$file'"
fi
}
else
# Install the binary that we compiled earlier.
file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
fi
fi
# remove .exe since cygwin /usr/bin/install will append another
# one anyway
case $install_prog,$host in
*/usr/bin/install*,*cygwin*)
case $file:$destfile in
*.exe:*.exe)
# this is ok
;;
*.exe:*)
destfile=$destfile.exe
;;
*:*.exe)
func_stripname '' '.exe' "$destfile"
destfile=$func_stripname_result
;;
esac
;;
esac
func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
$opt_dry_run || if test -n "$outputname"; then
${RM}r "$tmpdir"
fi
;;
esac
done
for file in $staticlibs; do
func_basename "$file"
name="$func_basename_result"
# Set up the ranlib parameters.
oldlib="$destdir/$name"
func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
if test -n "$stripme" && test -n "$old_striplib"; then
func_show_eval "$old_striplib $oldlib" 'exit $?'
fi
# Do each command in the postinstall commands.
func_execute_cmds "$old_postinstall_cmds" 'exit $?'
done
test -n "$future_libdirs" && \
func_warning "remember to run \`$progname --finish$future_libdirs'"
if test -n "$current_libdirs"; then
# Maybe just do a dry run.
$opt_dry_run && current_libdirs=" -n$current_libdirs"
exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
else
exit $EXIT_SUCCESS
fi
}
test "$opt_mode" = install && func_mode_install ${1+"$@"}
# func_generate_dlsyms outputname originator pic_p
# Extract symbols from dlprefiles and create ${outputname}S.o with
# a dlpreopen symbol table.
func_generate_dlsyms ()
{
$opt_debug
my_outputname="$1"
my_originator="$2"
my_pic_p="${3-no}"
my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
my_dlsyms=
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
if test -n "$NM" && test -n "$global_symbol_pipe"; then
my_dlsyms="${my_outputname}S.c"
else
func_error "not configured to extract global symbols from dlpreopened files"
fi
fi
if test -n "$my_dlsyms"; then
case $my_dlsyms in
"") ;;
*.c)
# Discover the nlist of each of the dlfiles.
nlist="$output_objdir/${my_outputname}.nm"
func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
# Parse the name list into a source file.
func_verbose "creating $output_objdir/$my_dlsyms"
$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
#ifdef __cplusplus
extern \"C\" {
#endif
#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
#endif
/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
/* DATA imports from DLLs on WIN32 con't be const, because runtime
relocations are performed -- see ld's documentation on pseudo-relocs. */
# define LT_DLSYM_CONST
#elif defined(__osf__)
/* This system does not cope well with relocations in const data. */
# define LT_DLSYM_CONST
#else
# define LT_DLSYM_CONST const
#endif
/* External symbol declarations for the compiler. */\
"
if test "$dlself" = yes; then
func_verbose "generating symbol list for \`$output'"
$opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
# Add our own program objects to the symbol list.
progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
for progfile in $progfiles; do
func_to_tool_file "$progfile" func_convert_file_msys_to_w32
func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
$opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
done
if test -n "$exclude_expsyms"; then
$opt_dry_run || {
eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
eval '$MV "$nlist"T "$nlist"'
}
fi
if test -n "$export_symbols_regex"; then
$opt_dry_run || {
eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
eval '$MV "$nlist"T "$nlist"'
}
fi
# Prepare the list of exported symbols
if test -z "$export_symbols"; then
export_symbols="$output_objdir/$outputname.exp"
$opt_dry_run || {
$RM $export_symbols
eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
case $host in
*cygwin* | *mingw* | *cegcc* )
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
;;
esac
}
else
$opt_dry_run || {
eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
eval '$MV "$nlist"T "$nlist"'
case $host in
*cygwin* | *mingw* | *cegcc* )
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
;;
esac
}
fi
fi
for dlprefile in $dlprefiles; do
func_verbose "extracting global C symbols from \`$dlprefile'"
func_basename "$dlprefile"
name="$func_basename_result"
case $host in
*cygwin* | *mingw* | *cegcc* )
# if an import library, we need to obtain dlname
if func_win32_import_lib_p "$dlprefile"; then
func_tr_sh "$dlprefile"
eval "curr_lafile=\$libfile_$func_tr_sh_result"
dlprefile_dlbasename=""
if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
# Use subshell, to avoid clobbering current variable values
dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
if test -n "$dlprefile_dlname" ; then
func_basename "$dlprefile_dlname"
dlprefile_dlbasename="$func_basename_result"
else
# no lafile. user explicitly requested -dlpreopen .
$sharedlib_from_linklib_cmd "$dlprefile"
dlprefile_dlbasename=$sharedlib_from_linklib_result
fi
fi
$opt_dry_run || {
if test -n "$dlprefile_dlbasename" ; then
eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
else
func_warning "Could not compute DLL name from $name"
eval '$ECHO ": $name " >> "$nlist"'
fi
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
$SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
}
else # not an import lib
$opt_dry_run || {
eval '$ECHO ": $name " >> "$nlist"'
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
}
fi
;;
*)
$opt_dry_run || {
eval '$ECHO ": $name " >> "$nlist"'
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
}
;;
esac
done
$opt_dry_run || {
# Make sure we have at least an empty file.
test -f "$nlist" || : > "$nlist"
if test -n "$exclude_expsyms"; then
$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
$MV "$nlist"T "$nlist"
fi
# Try sorting and uniquifying the output.
if $GREP -v "^: " < "$nlist" |
if sort -k 3 /dev/null 2>&1; then
sort -k 3
else
sort +2
fi |
uniq > "$nlist"S; then
:
else
$GREP -v "^: " < "$nlist" > "$nlist"S
fi
if test -f "$nlist"S; then
eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
else
echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
fi
echo >> "$output_objdir/$my_dlsyms" "\
/* The mapping between symbol names and symbols. */
typedef struct {
const char *name;
void *address;
} lt_dlsymlist;
extern LT_DLSYM_CONST lt_dlsymlist
lt_${my_prefix}_LTX_preloaded_symbols[];
LT_DLSYM_CONST lt_dlsymlist
lt_${my_prefix}_LTX_preloaded_symbols[] =
{\
{ \"$my_originator\", (void *) 0 },"
case $need_lib_prefix in
no)
eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
;;
*)
eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
;;
esac
echo >> "$output_objdir/$my_dlsyms" "\
{0, (void *) 0}
};
/* This works around a problem in FreeBSD linker */
#ifdef FREEBSD_WORKAROUND
static const void *lt_preloaded_setup() {
return lt_${my_prefix}_LTX_preloaded_symbols;
}
#endif
#ifdef __cplusplus
}
#endif\
"
} # !$opt_dry_run
pic_flag_for_symtable=
case "$compile_command " in
*" -static "*) ;;
*)
case $host in
# compiling the symbol table file with pic_flag works around
# a FreeBSD bug that causes programs to crash when -lm is
# linked before any other PIC object. But we must not use
# pic_flag when linking with -static. The problem exists in
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
*-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
*-*-hpux*)
pic_flag_for_symtable=" $pic_flag" ;;
*)
if test "X$my_pic_p" != Xno; then
pic_flag_for_symtable=" $pic_flag"
fi
;;
esac
;;
esac
symtab_cflags=
for arg in $LTCFLAGS; do
case $arg in
-pie | -fpie | -fPIE) ;;
*) func_append symtab_cflags " $arg" ;;
esac
done
# Now compile the dynamic symbol file.
func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
# Clean up the generated files.
func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
# Transform the symbol file into the correct name.
symfileobj="$output_objdir/${my_outputname}S.$objext"
case $host in
*cygwin* | *mingw* | *cegcc* )
if test -f "$output_objdir/$my_outputname.def"; then
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
else
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
fi
;;
*)
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
;;
esac
;;
*)
func_fatal_error "unknown suffix for \`$my_dlsyms'"
;;
esac
else
# We keep going just in case the user didn't refer to
# lt_preloaded_symbols. The linker will fail if global_symbol_pipe
# really was required.
# Nullify the symbol file.
compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
fi
}
# func_win32_libid arg
# return the library type of file 'arg'
#
# Need a lot of goo to handle *both* DLLs and import libs
# Has to be a shell function in order to 'eat' the argument
# that is supplied when $file_magic_command is called.
# Despite the name, also deal with 64 bit binaries.
func_win32_libid ()
{
$opt_debug
win32_libid_type="unknown"
win32_fileres=`file -L $1 2>/dev/null`
case $win32_fileres in
*ar\ archive\ import\ library*) # definitely import
win32_libid_type="x86 archive import"
;;
*ar\ archive*) # could be an import, or static
# Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
$EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
func_to_tool_file "$1" func_convert_file_msys_to_w32
win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
$SED -n -e '
1,100{
/ I /{
s,.*,import,
p
q
}
}'`
case $win32_nmres in
import*) win32_libid_type="x86 archive import";;
*) win32_libid_type="x86 archive static";;
esac
fi
;;
*DLL*)
win32_libid_type="x86 DLL"
;;
*executable*) # but shell scripts are "executable" too...
case $win32_fileres in
*MS\ Windows\ PE\ Intel*)
win32_libid_type="x86 DLL"
;;
esac
;;
esac
$ECHO "$win32_libid_type"
}
# func_cygming_dll_for_implib ARG
#
# Platform-specific function to extract the
# name of the DLL associated with the specified
# import library ARG.
# Invoked by eval'ing the libtool variable
# $sharedlib_from_linklib_cmd
# Result is available in the variable
# $sharedlib_from_linklib_result
func_cygming_dll_for_implib ()
{
$opt_debug
sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
}
# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
#
# The is the core of a fallback implementation of a
# platform-specific function to extract the name of the
# DLL associated with the specified import library LIBNAME.
#
# SECTION_NAME is either .idata$6 or .idata$7, depending
# on the platform and compiler that created the implib.
#
# Echos the name of the DLL associated with the
# specified import library.
func_cygming_dll_for_implib_fallback_core ()
{
$opt_debug
match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
$OBJDUMP -s --section "$1" "$2" 2>/dev/null |
$SED '/^Contents of section '"$match_literal"':/{
# Place marker at beginning of archive member dllname section
s/.*/====MARK====/
p
d
}
# These lines can sometimes be longer than 43 characters, but
# are always uninteresting
/:[ ]*file format pe[i]\{,1\}-/d
/^In archive [^:]*:/d
# Ensure marker is printed
/^====MARK====/p
# Remove all lines with less than 43 characters
/^.\{43\}/!d
# From remaining lines, remove first 43 characters
s/^.\{43\}//' |
$SED -n '
# Join marker and all lines until next marker into a single line
/^====MARK====/ b para
H
$ b para
b
:para
x
s/\n//g
# Remove the marker
s/^====MARK====//
# Remove trailing dots and whitespace
s/[\. \t]*$//
# Print
/./p' |
# we now have a list, one entry per line, of the stringified
# contents of the appropriate section of all members of the
# archive which possess that section. Heuristic: eliminate
# all those which have a first or second character that is
# a '.' (that is, objdump's representation of an unprintable
# character.) This should work for all archives with less than
# 0x302f exports -- but will fail for DLLs whose name actually
# begins with a literal '.' or a single character followed by
# a '.'.
#
# Of those that remain, print the first one.
$SED -e '/^\./d;/^.\./d;q'
}
# func_cygming_gnu_implib_p ARG
# This predicate returns with zero status (TRUE) if
# ARG is a GNU/binutils-style import library. Returns
# with nonzero status (FALSE) otherwise.
func_cygming_gnu_implib_p ()
{
$opt_debug
func_to_tool_file "$1" func_convert_file_msys_to_w32
func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
test -n "$func_cygming_gnu_implib_tmp"
}
# func_cygming_ms_implib_p ARG
# This predicate returns with zero status (TRUE) if
# ARG is an MS-style import library. Returns
# with nonzero status (FALSE) otherwise.
func_cygming_ms_implib_p ()
{
$opt_debug
func_to_tool_file "$1" func_convert_file_msys_to_w32
func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
test -n "$func_cygming_ms_implib_tmp"
}
# func_cygming_dll_for_implib_fallback ARG
# Platform-specific function to extract the
# name of the DLL associated with the specified
# import library ARG.
#
# This fallback implementation is for use when $DLLTOOL
# does not support the --identify-strict option.
# Invoked by eval'ing the libtool variable
# $sharedlib_from_linklib_cmd
# Result is available in the variable
# $sharedlib_from_linklib_result
func_cygming_dll_for_implib_fallback ()
{
$opt_debug
if func_cygming_gnu_implib_p "$1" ; then
# binutils import library
sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
elif func_cygming_ms_implib_p "$1" ; then
# ms-generated import library
sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
else
# unknown
sharedlib_from_linklib_result=""
fi
}
# func_extract_an_archive dir oldlib
func_extract_an_archive ()
{
$opt_debug
f_ex_an_ar_dir="$1"; shift
f_ex_an_ar_oldlib="$1"
if test "$lock_old_archive_extraction" = yes; then
lockfile=$f_ex_an_ar_oldlib.lock
until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
func_echo "Waiting for $lockfile to be removed"
sleep 2
done
fi
func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
'stat=$?; rm -f "$lockfile"; exit $stat'
if test "$lock_old_archive_extraction" = yes; then
$opt_dry_run || rm -f "$lockfile"
fi
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
:
else
func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
fi
}
# func_extract_archives gentop oldlib ...
func_extract_archives ()
{
$opt_debug
my_gentop="$1"; shift
my_oldlibs=${1+"$@"}
my_oldobjs=""
my_xlib=""
my_xabs=""
my_xdir=""
for my_xlib in $my_oldlibs; do
# Extract the objects.
case $my_xlib in
[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
*) my_xabs=`pwd`"/$my_xlib" ;;
esac
func_basename "$my_xlib"
my_xlib="$func_basename_result"
my_xlib_u=$my_xlib
while :; do
case " $extracted_archives " in
*" $my_xlib_u "*)
func_arith $extracted_serial + 1
extracted_serial=$func_arith_result
my_xlib_u=lt$extracted_serial-$my_xlib ;;
*) break ;;
esac
done
extracted_archives="$extracted_archives $my_xlib_u"
my_xdir="$my_gentop/$my_xlib_u"
func_mkdir_p "$my_xdir"
case $host in
*-darwin*)
func_verbose "Extracting $my_xabs"
# Do not bother doing anything if just a dry run
$opt_dry_run || {
darwin_orig_dir=`pwd`
cd $my_xdir || exit $?
darwin_archive=$my_xabs
darwin_curdir=`pwd`
darwin_base_archive=`basename "$darwin_archive"`
darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
if test -n "$darwin_arches"; then
darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
darwin_arch=
func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
for darwin_arch in $darwin_arches ; do
func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
$LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
func_extract_an_archive "`pwd`" "${darwin_base_archive}"
cd "$darwin_curdir"
$RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
done # $darwin_arches
## Okay now we've a bunch of thin objects, gotta fatten them up :)
darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
darwin_file=
darwin_files=
for darwin_file in $darwin_filelist; do
darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
$LIPO -create -output "$darwin_file" $darwin_files
done # $darwin_filelist
$RM -rf unfat-$$
cd "$darwin_orig_dir"
else
cd $darwin_orig_dir
func_extract_an_archive "$my_xdir" "$my_xabs"
fi # $darwin_arches
} # !$opt_dry_run
;;
*)
func_extract_an_archive "$my_xdir" "$my_xabs"
;;
esac
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
done
func_extract_archives_result="$my_oldobjs"
}
# func_emit_wrapper [arg=no]
#
# Emit a libtool wrapper script on stdout.
# Don't directly open a file because we may want to
# incorporate the script contents within a cygwin/mingw
# wrapper executable. Must ONLY be called from within
# func_mode_link because it depends on a number of variables
# set therein.
#
# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
# variable will take. If 'yes', then the emitted script
# will assume that the directory in which it is stored is
# the $objdir directory. This is a cygwin/mingw-specific
# behavior.
func_emit_wrapper ()
{
func_emit_wrapper_arg1=${1-no}
$ECHO "\
#! $SHELL
# $output - temporary wrapper script for $objdir/$outputname
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
#
# The $output program cannot be directly executed until all the libtool
# libraries that it depends on are installed.
#
# This wrapper script should never be moved out of the build directory.
# If it is, it will not operate correctly.
# Sed substitution that helps us do robust quoting. It backslashifies
# metacharacters that are still active within double-quoted strings.
sed_quote_subst='$sed_quote_subst'
# Be Bourne compatible
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
# is contrary to our usage. Disable this feature.
alias -g '\${1+\"\$@\"}'='\"\$@\"'
setopt NO_GLOB_SUBST
else
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
fi
BIN_SH=xpg4; export BIN_SH # for Tru64
DUALCASE=1; export DUALCASE # for MKS sh
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
relink_command=\"$relink_command\"
# This environment variable determines our operation mode.
if test \"\$libtool_install_magic\" = \"$magic\"; then
# install mode needs the following variables:
generated_by_libtool_version='$macro_version'
notinst_deplibs='$notinst_deplibs'
else
# When we are sourced in execute mode, \$file and \$ECHO are already set.
if test \"\$libtool_execute_magic\" != \"$magic\"; then
file=\"\$0\""
qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
$ECHO "\
# A function that is used when there is no print builtin or printf.
func_fallback_echo ()
{
eval 'cat <<_LTECHO_EOF
\$1
_LTECHO_EOF'
}
ECHO=\"$qECHO\"
fi
# Very basic option parsing. These options are (a) specific to
# the libtool wrapper, (b) are identical between the wrapper
# /script/ and the wrapper /executable/ which is used only on
# windows platforms, and (c) all begin with the string "--lt-"
# (application programs are unlikely to have options which match
# this pattern).
#
# There are only two supported options: --lt-debug and
# --lt-dump-script. There is, deliberately, no --lt-help.
#
# The first argument to this parsing function should be the
# script's $0 value, followed by "$@".
lt_option_debug=
func_parse_lt_options ()
{
lt_script_arg0=\$0
shift
for lt_opt
do
case \"\$lt_opt\" in
--lt-debug) lt_option_debug=1 ;;
--lt-dump-script)
lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
cat \"\$lt_dump_D/\$lt_dump_F\"
exit 0
;;
--lt-*)
\$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
exit 1
;;
esac
done
# Print the debug banner immediately:
if test -n \"\$lt_option_debug\"; then
echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
fi
}
# Used when --lt-debug. Prints its arguments to stdout
# (redirection is the responsibility of the caller)
func_lt_dump_args ()
{
lt_dump_args_N=1;
for lt_arg
do
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
done
}
# Core function for launching the target application
func_exec_program_core ()
{
"
case $host in
# Backslashes separate directories on plain windows
*-*-mingw | *-*-os2* | *-cegcc*)
$ECHO "\
if test -n \"\$lt_option_debug\"; then
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
func_lt_dump_args \${1+\"\$@\"} 1>&2
fi
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
"
;;
*)
$ECHO "\
if test -n \"\$lt_option_debug\"; then
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
func_lt_dump_args \${1+\"\$@\"} 1>&2
fi
exec \"\$progdir/\$program\" \${1+\"\$@\"}
"
;;
esac
$ECHO "\
\$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
exit 1
}
# A function to encapsulate launching the target application
# Strips options in the --lt-* namespace from \$@ and
# launches target application with the remaining arguments.
func_exec_program ()
{
for lt_wr_arg
do
case \$lt_wr_arg in
--lt-*) ;;
*) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
esac
shift
done
func_exec_program_core \${1+\"\$@\"}
}
# Parse options
func_parse_lt_options \"\$0\" \${1+\"\$@\"}
# Find the directory that this script lives in.
thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
# Follow symbolic links until we get to the real thisdir.
file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
while test -n \"\$file\"; do
destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
# If there was a directory component, then change thisdir.
if test \"x\$destdir\" != \"x\$file\"; then
case \"\$destdir\" in
[\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
*) thisdir=\"\$thisdir/\$destdir\" ;;
esac
fi
file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
done
# Usually 'no', except on cygwin/mingw when embedded into
# the cwrapper.
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
# special case for '.'
if test \"\$thisdir\" = \".\"; then
thisdir=\`pwd\`
fi
# remove .libs from thisdir
case \"\$thisdir\" in
*[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
$objdir ) thisdir=. ;;
esac
fi
# Try to get the absolute directory name.
absdir=\`cd \"\$thisdir\" && pwd\`
test -n \"\$absdir\" && thisdir=\"\$absdir\"
"
if test "$fast_install" = yes; then
$ECHO "\
program=lt-'$outputname'$exeext
progdir=\"\$thisdir/$objdir\"
if test ! -f \"\$progdir/\$program\" ||
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
file=\"\$\$-\$program\"
if test ! -d \"\$progdir\"; then
$MKDIR \"\$progdir\"
else
$RM \"\$progdir/\$file\"
fi"
$ECHO "\
# relink executable if necessary
if test -n \"\$relink_command\"; then
if relink_command_output=\`eval \$relink_command 2>&1\`; then :
else
$ECHO \"\$relink_command_output\" >&2
$RM \"\$progdir/\$file\"
exit 1
fi
fi
$MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
{ $RM \"\$progdir/\$program\";
$MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
$RM \"\$progdir/\$file\"
fi"
else
$ECHO "\
program='$outputname'
progdir=\"\$thisdir/$objdir\"
"
fi
$ECHO "\
if test -f \"\$progdir/\$program\"; then"
# fixup the dll searchpath if we need to.
#
# Fix the DLL searchpath if we need to. Do this before prepending
# to shlibpath, because on Windows, both are PATH and uninstalled
# libraries must come first.
if test -n "$dllsearchpath"; then
$ECHO "\
# Add the dll search path components to the executable PATH
PATH=$dllsearchpath:\$PATH
"
fi
# Export our shlibpath_var if we have one.
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
$ECHO "\
# Add our own library path to $shlibpath_var
$shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
# Some systems cannot cope with colon-terminated $shlibpath_var
# The second colon is a workaround for a bug in BeOS R4 sed
$shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
export $shlibpath_var
"
fi
$ECHO "\
if test \"\$libtool_execute_magic\" != \"$magic\"; then
# Run the actual program with our arguments.
func_exec_program \${1+\"\$@\"}
fi
else
# The program doesn't exist.
\$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
\$ECHO \"This script is just a wrapper for \$program.\" 1>&2
\$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
exit 1
fi
fi\
"
}
# func_emit_cwrapperexe_src
# emit the source code for a wrapper executable on stdout
# Must ONLY be called from within func_mode_link because
# it depends on a number of variable set therein.
func_emit_cwrapperexe_src ()
{
cat <
#include
#ifdef _MSC_VER
# include
# include
# include
#else
# include
# include
# ifdef __CYGWIN__
# include
# endif
#endif
#include
#include
#include
#include
#include
#include
#include
#include
/* declarations of non-ANSI functions */
#if defined(__MINGW32__)
# ifdef __STRICT_ANSI__
int _putenv (const char *);
# endif
#elif defined(__CYGWIN__)
# ifdef __STRICT_ANSI__
char *realpath (const char *, char *);
int putenv (char *);
int setenv (const char *, const char *, int);
# endif
/* #elif defined (other platforms) ... */
#endif
/* portability defines, excluding path handling macros */
#if defined(_MSC_VER)
# define setmode _setmode
# define stat _stat
# define chmod _chmod
# define getcwd _getcwd
# define putenv _putenv
# define S_IXUSR _S_IEXEC
# ifndef _INTPTR_T_DEFINED
# define _INTPTR_T_DEFINED
# define intptr_t int
# endif
#elif defined(__MINGW32__)
# define setmode _setmode
# define stat _stat
# define chmod _chmod
# define getcwd _getcwd
# define putenv _putenv
#elif defined(__CYGWIN__)
# define HAVE_SETENV
# define FOPEN_WB "wb"
/* #elif defined (other platforms) ... */
#endif
#if defined(PATH_MAX)
# define LT_PATHMAX PATH_MAX
#elif defined(MAXPATHLEN)
# define LT_PATHMAX MAXPATHLEN
#else
# define LT_PATHMAX 1024
#endif
#ifndef S_IXOTH
# define S_IXOTH 0
#endif
#ifndef S_IXGRP
# define S_IXGRP 0
#endif
/* path handling portability macros */
#ifndef DIR_SEPARATOR
# define DIR_SEPARATOR '/'
# define PATH_SEPARATOR ':'
#endif
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
defined (__OS2__)
# define HAVE_DOS_BASED_FILE_SYSTEM
# define FOPEN_WB "wb"
# ifndef DIR_SEPARATOR_2
# define DIR_SEPARATOR_2 '\\'
# endif
# ifndef PATH_SEPARATOR_2
# define PATH_SEPARATOR_2 ';'
# endif
#endif
#ifndef DIR_SEPARATOR_2
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
#else /* DIR_SEPARATOR_2 */
# define IS_DIR_SEPARATOR(ch) \
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
#endif /* DIR_SEPARATOR_2 */
#ifndef PATH_SEPARATOR_2
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
#else /* PATH_SEPARATOR_2 */
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
#endif /* PATH_SEPARATOR_2 */
#ifndef FOPEN_WB
# define FOPEN_WB "w"
#endif
#ifndef _O_BINARY
# define _O_BINARY 0
#endif
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
#define XFREE(stale) do { \
if (stale) { free ((void *) stale); stale = 0; } \
} while (0)
#if defined(LT_DEBUGWRAPPER)
static int lt_debug = 1;
#else
static int lt_debug = 0;
#endif
const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
void *xmalloc (size_t num);
char *xstrdup (const char *string);
const char *base_name (const char *name);
char *find_executable (const char *wrapper);
char *chase_symlinks (const char *pathspec);
int make_executable (const char *path);
int check_executable (const char *path);
char *strendzap (char *str, const char *pat);
void lt_debugprintf (const char *file, int line, const char *fmt, ...);
void lt_fatal (const char *file, int line, const char *message, ...);
static const char *nonnull (const char *s);
static const char *nonempty (const char *s);
void lt_setenv (const char *name, const char *value);
char *lt_extend_str (const char *orig_value, const char *add, int to_end);
void lt_update_exe_path (const char *name, const char *value);
void lt_update_lib_path (const char *name, const char *value);
char **prepare_spawn (char **argv);
void lt_dump_script (FILE *f);
EOF
cat <= 0)
&& (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
return 1;
else
return 0;
}
int
make_executable (const char *path)
{
int rval = 0;
struct stat st;
lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
nonempty (path));
if ((!path) || (!*path))
return 0;
if (stat (path, &st) >= 0)
{
rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
}
return rval;
}
/* Searches for the full path of the wrapper. Returns
newly allocated full path name if found, NULL otherwise
Does not chase symlinks, even on platforms that support them.
*/
char *
find_executable (const char *wrapper)
{
int has_slash = 0;
const char *p;
const char *p_next;
/* static buffer for getcwd */
char tmp[LT_PATHMAX + 1];
int tmp_len;
char *concat_name;
lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
nonempty (wrapper));
if ((wrapper == NULL) || (*wrapper == '\0'))
return NULL;
/* Absolute path? */
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
{
concat_name = xstrdup (wrapper);
if (check_executable (concat_name))
return concat_name;
XFREE (concat_name);
}
else
{
#endif
if (IS_DIR_SEPARATOR (wrapper[0]))
{
concat_name = xstrdup (wrapper);
if (check_executable (concat_name))
return concat_name;
XFREE (concat_name);
}
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
}
#endif
for (p = wrapper; *p; p++)
if (*p == '/')
{
has_slash = 1;
break;
}
if (!has_slash)
{
/* no slashes; search PATH */
const char *path = getenv ("PATH");
if (path != NULL)
{
for (p = path; *p; p = p_next)
{
const char *q;
size_t p_len;
for (q = p; *q; q++)
if (IS_PATH_SEPARATOR (*q))
break;
p_len = q - p;
p_next = (*q == '\0' ? q : q + 1);
if (p_len == 0)
{
/* empty path: current directory */
if (getcwd (tmp, LT_PATHMAX) == NULL)
lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
nonnull (strerror (errno)));
tmp_len = strlen (tmp);
concat_name =
XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
memcpy (concat_name, tmp, tmp_len);
concat_name[tmp_len] = '/';
strcpy (concat_name + tmp_len + 1, wrapper);
}
else
{
concat_name =
XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
memcpy (concat_name, p, p_len);
concat_name[p_len] = '/';
strcpy (concat_name + p_len + 1, wrapper);
}
if (check_executable (concat_name))
return concat_name;
XFREE (concat_name);
}
}
/* not found in PATH; assume curdir */
}
/* Relative path | not found in path: prepend cwd */
if (getcwd (tmp, LT_PATHMAX) == NULL)
lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
nonnull (strerror (errno)));
tmp_len = strlen (tmp);
concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
memcpy (concat_name, tmp, tmp_len);
concat_name[tmp_len] = '/';
strcpy (concat_name + tmp_len + 1, wrapper);
if (check_executable (concat_name))
return concat_name;
XFREE (concat_name);
return NULL;
}
char *
chase_symlinks (const char *pathspec)
{
#ifndef S_ISLNK
return xstrdup (pathspec);
#else
char buf[LT_PATHMAX];
struct stat s;
char *tmp_pathspec = xstrdup (pathspec);
char *p;
int has_symlinks = 0;
while (strlen (tmp_pathspec) && !has_symlinks)
{
lt_debugprintf (__FILE__, __LINE__,
"checking path component for symlinks: %s\n",
tmp_pathspec);
if (lstat (tmp_pathspec, &s) == 0)
{
if (S_ISLNK (s.st_mode) != 0)
{
has_symlinks = 1;
break;
}
/* search backwards for last DIR_SEPARATOR */
p = tmp_pathspec + strlen (tmp_pathspec) - 1;
while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
p--;
if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
{
/* no more DIR_SEPARATORS left */
break;
}
*p = '\0';
}
else
{
lt_fatal (__FILE__, __LINE__,
"error accessing file \"%s\": %s",
tmp_pathspec, nonnull (strerror (errno)));
}
}
XFREE (tmp_pathspec);
if (!has_symlinks)
{
return xstrdup (pathspec);
}
tmp_pathspec = realpath (pathspec, buf);
if (tmp_pathspec == 0)
{
lt_fatal (__FILE__, __LINE__,
"could not follow symlinks for %s", pathspec);
}
return xstrdup (tmp_pathspec);
#endif
}
char *
strendzap (char *str, const char *pat)
{
size_t len, patlen;
assert (str != NULL);
assert (pat != NULL);
len = strlen (str);
patlen = strlen (pat);
if (patlen <= len)
{
str += len - patlen;
if (strcmp (str, pat) == 0)
*str = '\0';
}
return str;
}
void
lt_debugprintf (const char *file, int line, const char *fmt, ...)
{
va_list args;
if (lt_debug)
{
(void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
va_start (args, fmt);
(void) vfprintf (stderr, fmt, args);
va_end (args);
}
}
static void
lt_error_core (int exit_status, const char *file,
int line, const char *mode,
const char *message, va_list ap)
{
fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
vfprintf (stderr, message, ap);
fprintf (stderr, ".\n");
if (exit_status >= 0)
exit (exit_status);
}
void
lt_fatal (const char *file, int line, const char *message, ...)
{
va_list ap;
va_start (ap, message);
lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
va_end (ap);
}
static const char *
nonnull (const char *s)
{
return s ? s : "(null)";
}
static const char *
nonempty (const char *s)
{
return (s && !*s) ? "(empty)" : nonnull (s);
}
void
lt_setenv (const char *name, const char *value)
{
lt_debugprintf (__FILE__, __LINE__,
"(lt_setenv) setting '%s' to '%s'\n",
nonnull (name), nonnull (value));
{
#ifdef HAVE_SETENV
/* always make a copy, for consistency with !HAVE_SETENV */
char *str = xstrdup (value);
setenv (name, str, 1);
#else
int len = strlen (name) + 1 + strlen (value) + 1;
char *str = XMALLOC (char, len);
sprintf (str, "%s=%s", name, value);
if (putenv (str) != EXIT_SUCCESS)
{
XFREE (str);
}
#endif
}
}
char *
lt_extend_str (const char *orig_value, const char *add, int to_end)
{
char *new_value;
if (orig_value && *orig_value)
{
int orig_value_len = strlen (orig_value);
int add_len = strlen (add);
new_value = XMALLOC (char, add_len + orig_value_len + 1);
if (to_end)
{
strcpy (new_value, orig_value);
strcpy (new_value + orig_value_len, add);
}
else
{
strcpy (new_value, add);
strcpy (new_value + add_len, orig_value);
}
}
else
{
new_value = xstrdup (add);
}
return new_value;
}
void
lt_update_exe_path (const char *name, const char *value)
{
lt_debugprintf (__FILE__, __LINE__,
"(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
nonnull (name), nonnull (value));
if (name && *name && value && *value)
{
char *new_value = lt_extend_str (getenv (name), value, 0);
/* some systems can't cope with a ':'-terminated path #' */
int len = strlen (new_value);
while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
{
new_value[len-1] = '\0';
}
lt_setenv (name, new_value);
XFREE (new_value);
}
}
void
lt_update_lib_path (const char *name, const char *value)
{
lt_debugprintf (__FILE__, __LINE__,
"(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
nonnull (name), nonnull (value));
if (name && *name && value && *value)
{
char *new_value = lt_extend_str (getenv (name), value, 0);
lt_setenv (name, new_value);
XFREE (new_value);
}
}
EOF
case $host_os in
mingw*)
cat <<"EOF"
/* Prepares an argument vector before calling spawn().
Note that spawn() does not by itself call the command interpreter
(getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&v);
v.dwPlatformId == VER_PLATFORM_WIN32_NT;
}) ? "cmd.exe" : "command.com").
Instead it simply concatenates the arguments, separated by ' ', and calls
CreateProcess(). We must quote the arguments since Win32 CreateProcess()
interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
special way:
- Space and tab are interpreted as delimiters. They are not treated as
delimiters if they are surrounded by double quotes: "...".
- Unescaped double quotes are removed from the input. Their only effect is
that within double quotes, space and tab are treated like normal
characters.
- Backslashes not followed by double quotes are not special.
- But 2*n+1 backslashes followed by a double quote become
n backslashes followed by a double quote (n >= 0):
\" -> "
\\\" -> \"
\\\\\" -> \\"
*/
#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
char **
prepare_spawn (char **argv)
{
size_t argc;
char **new_argv;
size_t i;
/* Count number of arguments. */
for (argc = 0; argv[argc] != NULL; argc++)
;
/* Allocate new argument vector. */
new_argv = XMALLOC (char *, argc + 1);
/* Put quoted arguments into the new argument vector. */
for (i = 0; i < argc; i++)
{
const char *string = argv[i];
if (string[0] == '\0')
new_argv[i] = xstrdup ("\"\"");
else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
{
int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
size_t length;
unsigned int backslashes;
const char *s;
char *quoted_string;
char *p;
length = 0;
backslashes = 0;
if (quote_around)
length++;
for (s = string; *s != '\0'; s++)
{
char c = *s;
if (c == '"')
length += backslashes + 1;
length++;
if (c == '\\')
backslashes++;
else
backslashes = 0;
}
if (quote_around)
length += backslashes + 1;
quoted_string = XMALLOC (char, length + 1);
p = quoted_string;
backslashes = 0;
if (quote_around)
*p++ = '"';
for (s = string; *s != '\0'; s++)
{
char c = *s;
if (c == '"')
{
unsigned int j;
for (j = backslashes + 1; j > 0; j--)
*p++ = '\\';
}
*p++ = c;
if (c == '\\')
backslashes++;
else
backslashes = 0;
}
if (quote_around)
{
unsigned int j;
for (j = backslashes; j > 0; j--)
*p++ = '\\';
*p++ = '"';
}
*p = '\0';
new_argv[i] = quoted_string;
}
else
new_argv[i] = (char *) string;
}
new_argv[argc] = NULL;
return new_argv;
}
EOF
;;
esac
cat <<"EOF"
void lt_dump_script (FILE* f)
{
EOF
func_emit_wrapper yes |
$SED -e 's/\([\\"]\)/\\\1/g' \
-e 's/^/ fputs ("/' -e 's/$/\\n", f);/'
cat <<"EOF"
}
EOF
}
# end: func_emit_cwrapperexe_src
# func_win32_import_lib_p ARG
# True if ARG is an import lib, as indicated by $file_magic_cmd
func_win32_import_lib_p ()
{
$opt_debug
case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
*import*) : ;;
*) false ;;
esac
}
# func_mode_link arg...
func_mode_link ()
{
$opt_debug
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
# It is impossible to link a dll without this setting, and
# we shouldn't force the makefile maintainer to figure out
# which system we are compiling for in order to pass an extra
# flag for every libtool invocation.
# allow_undefined=no
# FIXME: Unfortunately, there are problems with the above when trying
# to make a dll which has undefined symbols, in which case not
# even a static library is built. For now, we need to specify
# -no-undefined on the libtool link line when we can be certain
# that all symbols are satisfied, otherwise we get a static library.
allow_undefined=yes
;;
*)
allow_undefined=yes
;;
esac
libtool_args=$nonopt
base_compile="$nonopt $@"
compile_command=$nonopt
finalize_command=$nonopt
compile_rpath=
finalize_rpath=
compile_shlibpath=
finalize_shlibpath=
convenience=
old_convenience=
deplibs=
old_deplibs=
compiler_flags=
linker_flags=
dllsearchpath=
lib_search_path=`pwd`
inst_prefix_dir=
new_inherited_linker_flags=
avoid_version=no
bindir=
dlfiles=
dlprefiles=
dlself=no
export_dynamic=no
export_symbols=
export_symbols_regex=
generated=
libobjs=
ltlibs=
module=no
no_install=no
objs=
non_pic_objects=
precious_files_regex=
prefer_static_libs=no
preload=no
prev=
prevarg=
release=
rpath=
xrpath=
perm_rpath=
temp_rpath=
thread_safe=no
vinfo=
vinfo_number=no
weak_libs=
single_module="${wl}-single_module"
func_infer_tag $base_compile
# We need to know -static, to get the right output filenames.
for arg
do
case $arg in
-shared)
test "$build_libtool_libs" != yes && \
func_fatal_configuration "can not build a shared library"
build_old_libs=no
break
;;
-all-static | -static | -static-libtool-libs)
case $arg in
-all-static)
if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
func_warning "complete static linking is impossible in this configuration"
fi
if test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
fi
prefer_static_libs=yes
;;
-static)
if test -z "$pic_flag" && test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
fi
prefer_static_libs=built
;;
-static-libtool-libs)
if test -z "$pic_flag" && test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
fi
prefer_static_libs=yes
;;
esac
build_libtool_libs=no
build_old_libs=yes
break
;;
esac
done
# See if our shared archives depend on static archives.
test -n "$old_archive_from_new_cmds" && build_old_libs=yes
# Go through the arguments, transforming them on the way.
while test "$#" -gt 0; do
arg="$1"
shift
func_quote_for_eval "$arg"
qarg=$func_quote_for_eval_unquoted_result
func_append libtool_args " $func_quote_for_eval_result"
# If the previous option needs an argument, assign it.
if test -n "$prev"; then
case $prev in
output)
func_append compile_command " @OUTPUT@"
func_append finalize_command " @OUTPUT@"
;;
esac
case $prev in
bindir)
bindir="$arg"
prev=
continue
;;
dlfiles|dlprefiles)
if test "$preload" = no; then
# Add the symbol object into the linking commands.
func_append compile_command " @SYMFILE@"
func_append finalize_command " @SYMFILE@"
preload=yes
fi
case $arg in
*.la | *.lo) ;; # We handle these cases below.
force)
if test "$dlself" = no; then
dlself=needless
export_dynamic=yes
fi
prev=
continue
;;
self)
if test "$prev" = dlprefiles; then
dlself=yes
elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
dlself=yes
else
dlself=needless
export_dynamic=yes
fi
prev=
continue
;;
*)
if test "$prev" = dlfiles; then
func_append dlfiles " $arg"
else
func_append dlprefiles " $arg"
fi
prev=
continue
;;
esac
;;
expsyms)
export_symbols="$arg"
test -f "$arg" \
|| func_fatal_error "symbol file \`$arg' does not exist"
prev=
continue
;;
expsyms_regex)
export_symbols_regex="$arg"
prev=
continue
;;
framework)
case $host in
*-*-darwin*)
case "$deplibs " in
*" $qarg.ltframework "*) ;;
*) func_append deplibs " $qarg.ltframework" # this is fixed later
;;
esac
;;
esac
prev=
continue
;;
inst_prefix)
inst_prefix_dir="$arg"
prev=
continue
;;
objectlist)
if test -f "$arg"; then
save_arg=$arg
moreargs=
for fil in `cat "$save_arg"`
do
# func_append moreargs " $fil"
arg=$fil
# A libtool-controlled object.
# Check to see that this really is a libtool object.
if func_lalib_unsafe_p "$arg"; then
pic_object=
non_pic_object=
# Read the .lo file
func_source "$arg"
if test -z "$pic_object" ||
test -z "$non_pic_object" ||
test "$pic_object" = none &&
test "$non_pic_object" = none; then
func_fatal_error "cannot find name of object for \`$arg'"
fi
# Extract subdirectory from the argument.
func_dirname "$arg" "/" ""
xdir="$func_dirname_result"
if test "$pic_object" != none; then
# Prepend the subdirectory the object is found in.
pic_object="$xdir$pic_object"
if test "$prev" = dlfiles; then
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
func_append dlfiles " $pic_object"
prev=
continue
else
# If libtool objects are unsupported, then we need to preload.
prev=dlprefiles
fi
fi
# CHECK ME: I think I busted this. -Ossama
if test "$prev" = dlprefiles; then
# Preload the old-style object.
func_append dlprefiles " $pic_object"
prev=
fi
# A PIC object.
func_append libobjs " $pic_object"
arg="$pic_object"
fi
# Non-PIC object.
if test "$non_pic_object" != none; then
# Prepend the subdirectory the object is found in.
non_pic_object="$xdir$non_pic_object"
# A standard non-PIC object
func_append non_pic_objects " $non_pic_object"
if test -z "$pic_object" || test "$pic_object" = none ; then
arg="$non_pic_object"
fi
else
# If the PIC object exists, use it instead.
# $xdir was prepended to $pic_object above.
non_pic_object="$pic_object"
func_append non_pic_objects " $non_pic_object"
fi
else
# Only an error if not doing a dry-run.
if $opt_dry_run; then
# Extract subdirectory from the argument.
func_dirname "$arg" "/" ""
xdir="$func_dirname_result"
func_lo2o "$arg"
pic_object=$xdir$objdir/$func_lo2o_result
non_pic_object=$xdir$func_lo2o_result
func_append libobjs " $pic_object"
func_append non_pic_objects " $non_pic_object"
else
func_fatal_error "\`$arg' is not a valid libtool object"
fi
fi
done
else
func_fatal_error "link input file \`$arg' does not exist"
fi
arg=$save_arg
prev=
continue
;;
precious_regex)
precious_files_regex="$arg"
prev=
continue
;;
release)
release="-$arg"
prev=
continue
;;
rpath | xrpath)
# We need an absolute path.
case $arg in
[\\/]* | [A-Za-z]:[\\/]*) ;;
*)
func_fatal_error "only absolute run-paths are allowed"
;;
esac
if test "$prev" = rpath; then
case "$rpath " in
*" $arg "*) ;;
*) func_append rpath " $arg" ;;
esac
else
case "$xrpath " in
*" $arg "*) ;;
*) func_append xrpath " $arg" ;;
esac
fi
prev=
continue
;;
shrext)
shrext_cmds="$arg"
prev=
continue
;;
weak)
func_append weak_libs " $arg"
prev=
continue
;;
xcclinker)
func_append linker_flags " $qarg"
func_append compiler_flags " $qarg"
prev=
func_append compile_command " $qarg"
func_append finalize_command " $qarg"
continue
;;
xcompiler)
func_append compiler_flags " $qarg"
prev=
func_append compile_command " $qarg"
func_append finalize_command " $qarg"
continue
;;
xlinker)
func_append linker_flags " $qarg"
func_append compiler_flags " $wl$qarg"
prev=
func_append compile_command " $wl$qarg"
func_append finalize_command " $wl$qarg"
continue
;;
*)
eval "$prev=\"\$arg\""
prev=
continue
;;
esac
fi # test -n "$prev"
prevarg="$arg"
case $arg in
-all-static)
if test -n "$link_static_flag"; then
# See comment for -static flag below, for more details.
func_append compile_command " $link_static_flag"
func_append finalize_command " $link_static_flag"
fi
continue
;;
-allow-undefined)
# FIXME: remove this flag sometime in the future.
func_fatal_error "\`-allow-undefined' must not be used because it is the default"
;;
-avoid-version)
avoid_version=yes
continue
;;
-bindir)
prev=bindir
continue
;;
-dlopen)
prev=dlfiles
continue
;;
-dlpreopen)
prev=dlprefiles
continue
;;
-export-dynamic)
export_dynamic=yes
continue
;;
-export-symbols | -export-symbols-regex)
if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
func_fatal_error "more than one -exported-symbols argument is not allowed"
fi
if test "X$arg" = "X-export-symbols"; then
prev=expsyms
else
prev=expsyms_regex
fi
continue
;;
-framework)
prev=framework
continue
;;
-inst-prefix-dir)
prev=inst_prefix
continue
;;
# The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
# so, if we see these flags be careful not to treat them like -L
-L[A-Z][A-Z]*:*)
case $with_gcc/$host in
no/*-*-irix* | /*-*-irix*)
func_append compile_command " $arg"
func_append finalize_command " $arg"
;;
esac
continue
;;
-L*)
func_stripname "-L" '' "$arg"
if test -z "$func_stripname_result"; then
if test "$#" -gt 0; then
func_fatal_error "require no space between \`-L' and \`$1'"
else
func_fatal_error "need path for \`-L' option"
fi
fi
func_resolve_sysroot "$func_stripname_result"
dir=$func_resolve_sysroot_result
# We need an absolute path.
case $dir in
[\\/]* | [A-Za-z]:[\\/]*) ;;
*)
absdir=`cd "$dir" && pwd`
test -z "$absdir" && \
func_fatal_error "cannot determine absolute directory name of \`$dir'"
dir="$absdir"
;;
esac
case "$deplibs " in
*" -L$dir "* | *" $arg "*)
# Will only happen for absolute or sysroot arguments
;;
*)
# Preserve sysroot, but never include relative directories
case $dir in
[\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
*) func_append deplibs " -L$dir" ;;
esac
func_append lib_search_path " $dir"
;;
esac
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$dir:"*) ;;
::) dllsearchpath=$dir;;
*) func_append dllsearchpath ":$dir";;
esac
case :$dllsearchpath: in
*":$testbindir:"*) ;;
::) dllsearchpath=$testbindir;;
*) func_append dllsearchpath ":$testbindir";;
esac
;;
esac
continue
;;
-l*)
if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
# These systems don't actually have a C or math library (as such)
continue
;;
*-*-os2*)
# These systems don't actually have a C library (as such)
test "X$arg" = "X-lc" && continue
;;
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc due to us having libc/libc_r.
test "X$arg" = "X-lc" && continue
;;
*-*-rhapsody* | *-*-darwin1.[012])
# Rhapsody C and math libraries are in the System framework
func_append deplibs " System.ltframework"
continue
;;
*-*-sco3.2v5* | *-*-sco5v6*)
# Causes problems with __ctype
test "X$arg" = "X-lc" && continue
;;
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
# Compiler inserts libc in the correct place for threads to work
test "X$arg" = "X-lc" && continue
;;
esac
elif test "X$arg" = "X-lc_r"; then
case $host in
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc_r directly, use -pthread flag.
continue
;;
esac
fi
func_append deplibs " $arg"
continue
;;
-module)
module=yes
continue
;;
# Tru64 UNIX uses -model [arg] to determine the layout of C++
# classes, name mangling, and exception handling.
# Darwin uses the -arch flag to determine output architecture.
-model|-arch|-isysroot|--sysroot)
func_append compiler_flags " $arg"
func_append compile_command " $arg"
func_append finalize_command " $arg"
prev=xcompiler
continue
;;
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
func_append compiler_flags " $arg"
func_append compile_command " $arg"
func_append finalize_command " $arg"
case "$new_inherited_linker_flags " in
*" $arg "*) ;;
* ) func_append new_inherited_linker_flags " $arg" ;;
esac
continue
;;
-multi_module)
single_module="${wl}-multi_module"
continue
;;
-no-fast-install)
fast_install=no
continue
;;
-no-install)
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
# The PATH hackery in wrapper scripts is required on Windows
# and Darwin in order for the loader to find any dlls it needs.
func_warning "\`-no-install' is ignored for $host"
func_warning "assuming \`-no-fast-install' instead"
fast_install=no
;;
*) no_install=yes ;;
esac
continue
;;
-no-undefined)
allow_undefined=no
continue
;;
-objectlist)
prev=objectlist
continue
;;
-o) prev=output ;;
-precious-files-regex)
prev=precious_regex
continue
;;
-release)
prev=release
continue
;;
-rpath)
prev=rpath
continue
;;
-R)
prev=xrpath
continue
;;
-R*)
func_stripname '-R' '' "$arg"
dir=$func_stripname_result
# We need an absolute path.
case $dir in
[\\/]* | [A-Za-z]:[\\/]*) ;;
=*)
func_stripname '=' '' "$dir"
dir=$lt_sysroot$func_stripname_result
;;
*)
func_fatal_error "only absolute run-paths are allowed"
;;
esac
case "$xrpath " in
*" $dir "*) ;;
*) func_append xrpath " $dir" ;;
esac
continue
;;
-shared)
# The effects of -shared are defined in a previous loop.
continue
;;
-shrext)
prev=shrext
continue
;;
-static | -static-libtool-libs)
# The effects of -static are defined in a previous loop.
# We used to do the same as -all-static on platforms that
# didn't have a PIC flag, but the assumption that the effects
# would be equivalent was wrong. It would break on at least
# Digital Unix and AIX.
continue
;;
-thread-safe)
thread_safe=yes
continue
;;
-version-info)
prev=vinfo
continue
;;
-version-number)
prev=vinfo
vinfo_number=yes
continue
;;
-weak)
prev=weak
continue
;;
-Wc,*)
func_stripname '-Wc,' '' "$arg"
args=$func_stripname_result
arg=
save_ifs="$IFS"; IFS=','
for flag in $args; do
IFS="$save_ifs"
func_quote_for_eval "$flag"
func_append arg " $func_quote_for_eval_result"
func_append compiler_flags " $func_quote_for_eval_result"
done
IFS="$save_ifs"
func_stripname ' ' '' "$arg"
arg=$func_stripname_result
;;
-Wl,*)
func_stripname '-Wl,' '' "$arg"
args=$func_stripname_result
arg=
save_ifs="$IFS"; IFS=','
for flag in $args; do
IFS="$save_ifs"
func_quote_for_eval "$flag"
func_append arg " $wl$func_quote_for_eval_result"
func_append compiler_flags " $wl$func_quote_for_eval_result"
func_append linker_flags " $func_quote_for_eval_result"
done
IFS="$save_ifs"
func_stripname ' ' '' "$arg"
arg=$func_stripname_result
;;
-Xcompiler)
prev=xcompiler
continue
;;
-Xlinker)
prev=xlinker
continue
;;
-XCClinker)
prev=xcclinker
continue
;;
# -msg_* for osf cc
-msg_*)
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
;;
# Flags to be passed through unchanged, with rationale:
# -64, -mips[0-9] enable 64-bit mode for the SGI compiler
# -r[0-9][0-9]* specify processor for the SGI compiler
# -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
# +DA*, +DD* enable 64-bit mode for the HP compiler
# -q* compiler args for the IBM compiler
# -m*, -t[45]*, -txscale* architecture-specific flags for GCC
# -F/path path to uninstalled frameworks, gcc on darwin
# -p, -pg, --coverage, -fprofile-* profiling flags for GCC
# @file GCC response files
# -tp=* Portland pgcc target processor selection
# --sysroot=* for sysroot support
# -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
-O*|-flto*|-fwhopr*|-fuse-linker-plugin)
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
func_append compile_command " $arg"
func_append finalize_command " $arg"
func_append compiler_flags " $arg"
continue
;;
# Some other compiler flag.
-* | +*)
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
;;
*.$objext)
# A standard object.
func_append objs " $arg"
;;
*.lo)
# A libtool-controlled object.
# Check to see that this really is a libtool object.
if func_lalib_unsafe_p "$arg"; then
pic_object=
non_pic_object=
# Read the .lo file
func_source "$arg"
if test -z "$pic_object" ||
test -z "$non_pic_object" ||
test "$pic_object" = none &&
test "$non_pic_object" = none; then
func_fatal_error "cannot find name of object for \`$arg'"
fi
# Extract subdirectory from the argument.
func_dirname "$arg" "/" ""
xdir="$func_dirname_result"
if test "$pic_object" != none; then
# Prepend the subdirectory the object is found in.
pic_object="$xdir$pic_object"
if test "$prev" = dlfiles; then
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
func_append dlfiles " $pic_object"
prev=
continue
else
# If libtool objects are unsupported, then we need to preload.
prev=dlprefiles
fi
fi
# CHECK ME: I think I busted this. -Ossama
if test "$prev" = dlprefiles; then
# Preload the old-style object.
func_append dlprefiles " $pic_object"
prev=
fi
# A PIC object.
func_append libobjs " $pic_object"
arg="$pic_object"
fi
# Non-PIC object.
if test "$non_pic_object" != none; then
# Prepend the subdirectory the object is found in.
non_pic_object="$xdir$non_pic_object"
# A standard non-PIC object
func_append non_pic_objects " $non_pic_object"
if test -z "$pic_object" || test "$pic_object" = none ; then
arg="$non_pic_object"
fi
else
# If the PIC object exists, use it instead.
# $xdir was prepended to $pic_object above.
non_pic_object="$pic_object"
func_append non_pic_objects " $non_pic_object"
fi
else
# Only an error if not doing a dry-run.
if $opt_dry_run; then
# Extract subdirectory from the argument.
func_dirname "$arg" "/" ""
xdir="$func_dirname_result"
func_lo2o "$arg"
pic_object=$xdir$objdir/$func_lo2o_result
non_pic_object=$xdir$func_lo2o_result
func_append libobjs " $pic_object"
func_append non_pic_objects " $non_pic_object"
else
func_fatal_error "\`$arg' is not a valid libtool object"
fi
fi
;;
*.$libext)
# An archive.
func_append deplibs " $arg"
func_append old_deplibs " $arg"
continue
;;
*.la)
# A libtool-controlled library.
func_resolve_sysroot "$arg"
if test "$prev" = dlfiles; then
# This library was specified with -dlopen.
func_append dlfiles " $func_resolve_sysroot_result"
prev=
elif test "$prev" = dlprefiles; then
# The library was specified with -dlpreopen.
func_append dlprefiles " $func_resolve_sysroot_result"
prev=
else
func_append deplibs " $func_resolve_sysroot_result"
fi
continue
;;
# Some other compiler argument.
*)
# Unknown arguments in both finalize_command and compile_command need
# to be aesthetically quoted because they are evaled later.
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
;;
esac # arg
# Now actually substitute the argument into the commands.
if test -n "$arg"; then
func_append compile_command " $arg"
func_append finalize_command " $arg"
fi
done # argument parsing loop
test -n "$prev" && \
func_fatal_help "the \`$prevarg' option requires an argument"
if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
eval arg=\"$export_dynamic_flag_spec\"
func_append compile_command " $arg"
func_append finalize_command " $arg"
fi
oldlibs=
# calculate the name of the file, without its directory
func_basename "$output"
outputname="$func_basename_result"
libobjs_save="$libobjs"
if test -n "$shlibpath_var"; then
# get the directories listed in $shlibpath_var
eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
else
shlib_search_path=
fi
eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
func_dirname "$output" "/" ""
output_objdir="$func_dirname_result$objdir"
func_to_tool_file "$output_objdir/"
tool_output_objdir=$func_to_tool_file_result
# Create the object directory.
func_mkdir_p "$output_objdir"
# Determine the type of output
case $output in
"")
func_fatal_help "you must specify an output file"
;;
*.$libext) linkmode=oldlib ;;
*.lo | *.$objext) linkmode=obj ;;
*.la) linkmode=lib ;;
*) linkmode=prog ;; # Anything else should be a program.
esac
specialdeplibs=
libs=
# Find all interdependent deplibs by searching for libraries
# that are linked more than once (e.g. -la -lb -la)
for deplib in $deplibs; do
if $opt_preserve_dup_deps ; then
case "$libs " in
*" $deplib "*) func_append specialdeplibs " $deplib" ;;
esac
fi
func_append libs " $deplib"
done
if test "$linkmode" = lib; then
libs="$predeps $libs $compiler_lib_search_path $postdeps"
# Compute libraries that are listed more than once in $predeps
# $postdeps and mark them as special (i.e., whose duplicates are
# not to be eliminated).
pre_post_deps=
if $opt_duplicate_compiler_generated_deps; then
for pre_post_dep in $predeps $postdeps; do
case "$pre_post_deps " in
*" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
esac
func_append pre_post_deps " $pre_post_dep"
done
fi
pre_post_deps=
fi
deplibs=
newdependency_libs=
newlib_search_path=
need_relink=no # whether we're linking any uninstalled libtool libraries
notinst_deplibs= # not-installed libtool libraries
notinst_path= # paths that contain not-installed libtool libraries
case $linkmode in
lib)
passes="conv dlpreopen link"
for file in $dlfiles $dlprefiles; do
case $file in
*.la) ;;
*)
func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
;;
esac
done
;;
prog)
compile_deplibs=
finalize_deplibs=
alldeplibs=no
newdlfiles=
newdlprefiles=
passes="conv scan dlopen dlpreopen link"
;;
*) passes="conv"
;;
esac
for pass in $passes; do
# The preopen pass in lib mode reverses $deplibs; put it back here
# so that -L comes before libs that need it for instance...
if test "$linkmode,$pass" = "lib,link"; then
## FIXME: Find the place where the list is rebuilt in the wrong
## order, and fix it there properly
tmp_deplibs=
for deplib in $deplibs; do
tmp_deplibs="$deplib $tmp_deplibs"
done
deplibs="$tmp_deplibs"
fi
if test "$linkmode,$pass" = "lib,link" ||
test "$linkmode,$pass" = "prog,scan"; then
libs="$deplibs"
deplibs=
fi
if test "$linkmode" = prog; then
case $pass in
dlopen) libs="$dlfiles" ;;
dlpreopen) libs="$dlprefiles" ;;
link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
esac
fi
if test "$linkmode,$pass" = "lib,dlpreopen"; then
# Collect and forward deplibs of preopened libtool libs
for lib in $dlprefiles; do
# Ignore non-libtool-libs
dependency_libs=
func_resolve_sysroot "$lib"
case $lib in
*.la) func_source "$func_resolve_sysroot_result" ;;
esac
# Collect preopened libtool deplibs, except any this library
# has declared as weak libs
for deplib in $dependency_libs; do
func_basename "$deplib"
deplib_base=$func_basename_result
case " $weak_libs " in
*" $deplib_base "*) ;;
*) func_append deplibs " $deplib" ;;
esac
done
done
libs="$dlprefiles"
fi
if test "$pass" = dlopen; then
# Collect dlpreopened libraries
save_deplibs="$deplibs"
deplibs=
fi
for deplib in $libs; do
lib=
found=no
case $deplib in
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
func_append compiler_flags " $deplib"
if test "$linkmode" = lib ; then
case "$new_inherited_linker_flags " in
*" $deplib "*) ;;
* ) func_append new_inherited_linker_flags " $deplib" ;;
esac
fi
fi
continue
;;
-l*)
if test "$linkmode" != lib && test "$linkmode" != prog; then
func_warning "\`-l' is ignored for archives/objects"
continue
fi
func_stripname '-l' '' "$deplib"
name=$func_stripname_result
if test "$linkmode" = lib; then
searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
else
searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
fi
for searchdir in $searchdirs; do
for search_ext in .la $std_shrext .so .a; do
# Search the libtool library
lib="$searchdir/lib${name}${search_ext}"
if test -f "$lib"; then
if test "$search_ext" = ".la"; then
found=yes
else
found=no
fi
break 2
fi
done
done
if test "$found" != yes; then
# deplib doesn't seem to be a libtool library
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
deplibs="$deplib $deplibs"
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
fi
continue
else # deplib is a libtool library
# If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
# We need to do some special things here, and not later.
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $deplib "*)
if func_lalib_p "$lib"; then
library_names=
old_library=
func_source "$lib"
for l in $old_library $library_names; do
ll="$l"
done
if test "X$ll" = "X$old_library" ; then # only static version available
found=no
func_dirname "$lib" "" "."
ladir="$func_dirname_result"
lib=$ladir/$old_library
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
deplibs="$deplib $deplibs"
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
fi
continue
fi
fi
;;
*) ;;
esac
fi
fi
;; # -l
*.ltframework)
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
deplibs="$deplib $deplibs"
if test "$linkmode" = lib ; then
case "$new_inherited_linker_flags " in
*" $deplib "*) ;;
* ) func_append new_inherited_linker_flags " $deplib" ;;
esac
fi
fi
continue
;;
-L*)
case $linkmode in
lib)
deplibs="$deplib $deplibs"
test "$pass" = conv && continue
newdependency_libs="$deplib $newdependency_libs"
func_stripname '-L' '' "$deplib"
func_resolve_sysroot "$func_stripname_result"
func_append newlib_search_path " $func_resolve_sysroot_result"
;;
prog)
if test "$pass" = conv; then
deplibs="$deplib $deplibs"
continue
fi
if test "$pass" = scan; then
deplibs="$deplib $deplibs"
else
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
fi
func_stripname '-L' '' "$deplib"
func_resolve_sysroot "$func_stripname_result"
func_append newlib_search_path " $func_resolve_sysroot_result"
;;
*)
func_warning "\`-L' is ignored for archives/objects"
;;
esac # linkmode
continue
;; # -L
-R*)
if test "$pass" = link; then
func_stripname '-R' '' "$deplib"
func_resolve_sysroot "$func_stripname_result"
dir=$func_resolve_sysroot_result
# Make sure the xrpath contains only unique directories.
case "$xrpath " in
*" $dir "*) ;;
*) func_append xrpath " $dir" ;;
esac
fi
deplibs="$deplib $deplibs"
continue
;;
*.la)
func_resolve_sysroot "$deplib"
lib=$func_resolve_sysroot_result
;;
*.$libext)
if test "$pass" = conv; then
deplibs="$deplib $deplibs"
continue
fi
case $linkmode in
lib)
# Linking convenience modules into shared libraries is allowed,
# but linking other static libraries is non-portable.
case " $dlpreconveniencelibs " in
*" $deplib "*) ;;
*)
valid_a_lib=no
case $deplibs_check_method in
match_pattern*)
set dummy $deplibs_check_method; shift
match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
| $EGREP "$match_pattern_regex" > /dev/null; then
valid_a_lib=yes
fi
;;
pass_all)
valid_a_lib=yes
;;
esac
if test "$valid_a_lib" != yes; then
echo
$ECHO "*** Warning: Trying to link with static lib archive $deplib."
echo "*** I have the capability to make that library automatically link in when"
echo "*** you link to this library. But I can only do this if you have a"
echo "*** shared version of the library, which you do not appear to have"
echo "*** because the file extensions .$libext of this argument makes me believe"
echo "*** that it is just a static archive that I should not use here."
else
echo
$ECHO "*** Warning: Linking the shared library $output against the"
$ECHO "*** static library $deplib is not portable!"
deplibs="$deplib $deplibs"
fi
;;
esac
continue
;;
prog)
if test "$pass" != link; then
deplibs="$deplib $deplibs"
else
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
fi
continue
;;
esac # linkmode
;; # *.$libext
*.lo | *.$objext)
if test "$pass" = conv; then
deplibs="$deplib $deplibs"
elif test "$linkmode" = prog; then
if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
# If there is no dlopen support or we're linking statically,
# we need to preload.
func_append newdlprefiles " $deplib"
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
func_append newdlfiles " $deplib"
fi
fi
continue
;;
%DEPLIBS%)
alldeplibs=yes
continue
;;
esac # case $deplib
if test "$found" = yes || test -f "$lib"; then :
else
func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
fi
# Check to see that this really is a libtool archive.
func_lalib_unsafe_p "$lib" \
|| func_fatal_error "\`$lib' is not a valid libtool archive"
func_dirname "$lib" "" "."
ladir="$func_dirname_result"
dlname=
dlopen=
dlpreopen=
libdir=
library_names=
old_library=
inherited_linker_flags=
# If the library was installed with an old release of libtool,
# it will not redefine variables installed, or shouldnotlink
installed=yes
shouldnotlink=no
avoidtemprpath=
# Read the .la file
func_source "$lib"
# Convert "-framework foo" to "foo.ltframework"
if test -n "$inherited_linker_flags"; then
tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
case " $new_inherited_linker_flags " in
*" $tmp_inherited_linker_flag "*) ;;
*) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
esac
done
fi
dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
if test "$linkmode,$pass" = "lib,link" ||
test "$linkmode,$pass" = "prog,scan" ||
{ test "$linkmode" != prog && test "$linkmode" != lib; }; then
test -n "$dlopen" && func_append dlfiles " $dlopen"
test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
fi
if test "$pass" = conv; then
# Only check for convenience libraries
deplibs="$lib $deplibs"
if test -z "$libdir"; then
if test -z "$old_library"; then
func_fatal_error "cannot find name of link library for \`$lib'"
fi
# It is a libtool convenience library, so add in its objects.
func_append convenience " $ladir/$objdir/$old_library"
func_append old_convenience " $ladir/$objdir/$old_library"
elif test "$linkmode" != prog && test "$linkmode" != lib; then
func_fatal_error "\`$lib' is not a convenience library"
fi
tmp_libs=
for deplib in $dependency_libs; do
deplibs="$deplib $deplibs"
if $opt_preserve_dup_deps ; then
case "$tmp_libs " in
*" $deplib "*) func_append specialdeplibs " $deplib" ;;
esac
fi
func_append tmp_libs " $deplib"
done
continue
fi # $pass = conv
# Get the name of the library we link against.
linklib=
if test -n "$old_library" &&
{ test "$prefer_static_libs" = yes ||
test "$prefer_static_libs,$installed" = "built,no"; }; then
linklib=$old_library
else
for l in $old_library $library_names; do
linklib="$l"
done
fi
if test -z "$linklib"; then
func_fatal_error "cannot find name of link library for \`$lib'"
fi
# This library was specified with -dlopen.
if test "$pass" = dlopen; then
if test -z "$libdir"; then
func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
fi
if test -z "$dlname" ||
test "$dlopen_support" != yes ||
test "$build_libtool_libs" = no; then
# If there is no dlname, no dlopen support or we're linking
# statically, we need to preload. We also need to preload any
# dependent libraries so libltdl's deplib preloader doesn't
# bomb out in the load deplibs phase.
func_append dlprefiles " $lib $dependency_libs"
else
func_append newdlfiles " $lib"
fi
continue
fi # $pass = dlopen
# We need an absolute path.
case $ladir in
[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
*)
abs_ladir=`cd "$ladir" && pwd`
if test -z "$abs_ladir"; then
func_warning "cannot determine absolute directory name of \`$ladir'"
func_warning "passing it literally to the linker, although it might fail"
abs_ladir="$ladir"
fi
;;
esac
func_basename "$lib"
laname="$func_basename_result"
# Find the relevant object directory and library name.
if test "X$installed" = Xyes; then
if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
#func_warning "library \`$lib' was moved."
dir="$ladir"
absdir="$abs_ladir"
libdir="$abs_ladir"
else
dir="$lt_sysroot$libdir"
absdir="$lt_sysroot$libdir"
fi
test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
else
if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
dir="$ladir"
absdir="$abs_ladir"
# Remove this search path later
func_append notinst_path " $abs_ladir"
else
dir="$ladir/$objdir"
absdir="$abs_ladir/$objdir"
# Remove this search path later
func_append notinst_path " $abs_ladir"
fi
fi # $installed = yes
func_stripname 'lib' '.la' "$laname"
name=$func_stripname_result
# This library was specified with -dlpreopen.
if test "$pass" = dlpreopen; then
if test -z "$libdir" && test "$linkmode" = prog; then
func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
fi
case "$host" in
# special handling for platforms with PE-DLLs.
*cygwin* | *mingw* | *cegcc* )
# Linker will automatically link against shared library if both
# static and shared are present. Therefore, ensure we extract
# symbols from the import library if a shared library is present
# (otherwise, the dlopen module name will be incorrect). We do
# this by putting the import library name into $newdlprefiles.
# We recover the dlopen module name by 'saving' the la file
# name in a special purpose variable, and (later) extracting the
# dlname from the la file.
if test -n "$dlname"; then
func_tr_sh "$dir/$linklib"
eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
func_append newdlprefiles " $dir/$linklib"
else
func_append newdlprefiles " $dir/$old_library"
# Keep a list of preopened convenience libraries to check
# that they are being used correctly in the link pass.
test -z "$libdir" && \
func_append dlpreconveniencelibs " $dir/$old_library"
fi
;;
* )
# Prefer using a static library (so that no silly _DYNAMIC symbols
# are required to link).
if test -n "$old_library"; then
func_append newdlprefiles " $dir/$old_library"
# Keep a list of preopened convenience libraries to check
# that they are being used correctly in the link pass.
test -z "$libdir" && \
func_append dlpreconveniencelibs " $dir/$old_library"
# Otherwise, use the dlname, so that lt_dlopen finds it.
elif test -n "$dlname"; then
func_append newdlprefiles " $dir/$dlname"
else
func_append newdlprefiles " $dir/$linklib"
fi
;;
esac
fi # $pass = dlpreopen
if test -z "$libdir"; then
# Link the convenience library
if test "$linkmode" = lib; then
deplibs="$dir/$old_library $deplibs"
elif test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$dir/$old_library $compile_deplibs"
finalize_deplibs="$dir/$old_library $finalize_deplibs"
else
deplibs="$lib $deplibs" # used for prog,scan pass
fi
continue
fi
if test "$linkmode" = prog && test "$pass" != link; then
func_append newlib_search_path " $ladir"
deplibs="$lib $deplibs"
linkalldeplibs=no
if test "$link_all_deplibs" != no || test -z "$library_names" ||
test "$build_libtool_libs" = no; then
linkalldeplibs=yes
fi
tmp_libs=
for deplib in $dependency_libs; do
case $deplib in
-L*) func_stripname '-L' '' "$deplib"
func_resolve_sysroot "$func_stripname_result"
func_append newlib_search_path " $func_resolve_sysroot_result"
;;
esac
# Need to link against all dependency_libs?
if test "$linkalldeplibs" = yes; then
deplibs="$deplib $deplibs"
else
# Need to hardcode shared library paths
# or/and link against static libraries
newdependency_libs="$deplib $newdependency_libs"
fi
if $opt_preserve_dup_deps ; then
case "$tmp_libs " in
*" $deplib "*) func_append specialdeplibs " $deplib" ;;
esac
fi
func_append tmp_libs " $deplib"
done # for deplib
continue
fi # $linkmode = prog...
if test "$linkmode,$pass" = "prog,link"; then
if test -n "$library_names" &&
{ { test "$prefer_static_libs" = no ||
test "$prefer_static_libs,$installed" = "built,yes"; } ||
test -z "$old_library"; }; then
# We need to hardcode the library path
if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
# Make sure the rpath contains only unique directories.
case "$temp_rpath:" in
*"$absdir:"*) ;;
*) func_append temp_rpath "$absdir:" ;;
esac
fi
# Hardcode the library path.
# Skip directories that are in the system default run-time
# search path.
case " $sys_lib_dlsearch_path " in
*" $absdir "*) ;;
*)
case "$compile_rpath " in
*" $absdir "*) ;;
*) func_append compile_rpath " $absdir" ;;
esac
;;
esac
case " $sys_lib_dlsearch_path " in
*" $libdir "*) ;;
*)
case "$finalize_rpath " in
*" $libdir "*) ;;
*) func_append finalize_rpath " $libdir" ;;
esac
;;
esac
fi # $linkmode,$pass = prog,link...
if test "$alldeplibs" = yes &&
{ test "$deplibs_check_method" = pass_all ||
{ test "$build_libtool_libs" = yes &&
test -n "$library_names"; }; }; then
# We only need to search for static libraries
continue
fi
fi
link_static=no # Whether the deplib will be linked statically
use_static_libs=$prefer_static_libs
if test "$use_static_libs" = built && test "$installed" = yes; then
use_static_libs=no
fi
if test -n "$library_names" &&
{ test "$use_static_libs" = no || test -z "$old_library"; }; then
case $host in
*cygwin* | *mingw* | *cegcc*)
# No point in relinking DLLs because paths are not encoded
func_append notinst_deplibs " $lib"
need_relink=no
;;
*)
if test "$installed" = no; then
func_append notinst_deplibs " $lib"
need_relink=yes
fi
;;
esac
# This is a shared library
# Warn about portability, can't link against -module's on some
# systems (darwin). Don't bleat about dlopened modules though!
dlopenmodule=""
for dlpremoduletest in $dlprefiles; do
if test "X$dlpremoduletest" = "X$lib"; then
dlopenmodule="$dlpremoduletest"
break
fi
done
if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
echo
if test "$linkmode" = prog; then
$ECHO "*** Warning: Linking the executable $output against the loadable module"
else
$ECHO "*** Warning: Linking the shared library $output against the loadable module"
fi
$ECHO "*** $linklib is not portable!"
fi
if test "$linkmode" = lib &&
test "$hardcode_into_libs" = yes; then
# Hardcode the library path.
# Skip directories that are in the system default run-time
# search path.
case " $sys_lib_dlsearch_path " in
*" $absdir "*) ;;
*)
case "$compile_rpath " in
*" $absdir "*) ;;
*) func_append compile_rpath " $absdir" ;;
esac
;;
esac
case " $sys_lib_dlsearch_path " in
*" $libdir "*) ;;
*)
case "$finalize_rpath " in
*" $libdir "*) ;;
*) func_append finalize_rpath " $libdir" ;;
esac
;;
esac
fi
if test -n "$old_archive_from_expsyms_cmds"; then
# figure out the soname
set dummy $library_names
shift
realname="$1"
shift
libname=`eval "\\$ECHO \"$libname_spec\""`
# use dlname if we got it. it's perfectly good, no?
if test -n "$dlname"; then
soname="$dlname"
elif test -n "$soname_spec"; then
# bleh windows
case $host in
*cygwin* | mingw* | *cegcc*)
func_arith $current - $age
major=$func_arith_result
versuffix="-$major"
;;
esac
eval soname=\"$soname_spec\"
else
soname="$realname"
fi
# Make a new name for the extract_expsyms_cmds to use
soroot="$soname"
func_basename "$soroot"
soname="$func_basename_result"
func_stripname 'lib' '.dll' "$soname"
newlib=libimp-$func_stripname_result.a
# If the library has no export list, then create one now
if test -f "$output_objdir/$soname-def"; then :
else
func_verbose "extracting exported symbol list from \`$soname'"
func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
fi
# Create $newlib
if test -f "$output_objdir/$newlib"; then :; else
func_verbose "generating import library for \`$soname'"
func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
fi
# make sure the library variables are pointing to the new library
dir=$output_objdir
linklib=$newlib
fi # test -n "$old_archive_from_expsyms_cmds"
if test "$linkmode" = prog || test "$opt_mode" != relink; then
add_shlibpath=
add_dir=
add=
lib_linked=yes
case $hardcode_action in
immediate | unsupported)
if test "$hardcode_direct" = no; then
add="$dir/$linklib"
case $host in
*-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
*-*-sysv4*uw2*) add_dir="-L$dir" ;;
*-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
*-*-unixware7*) add_dir="-L$dir" ;;
*-*-darwin* )
# if the lib is a (non-dlopened) module then we can not
# link against it, someone is ignoring the earlier warnings
if /usr/bin/file -L $add 2> /dev/null |
$GREP ": [^:]* bundle" >/dev/null ; then
if test "X$dlopenmodule" != "X$lib"; then
$ECHO "*** Warning: lib $linklib is a module, not a shared library"
if test -z "$old_library" ; then
echo
echo "*** And there doesn't seem to be a static archive available"
echo "*** The link will probably fail, sorry"
else
add="$dir/$old_library"
fi
elif test -n "$old_library"; then
add="$dir/$old_library"
fi
fi
esac
elif test "$hardcode_minus_L" = no; then
case $host in
*-*-sunos*) add_shlibpath="$dir" ;;
esac
add_dir="-L$dir"
add="-l$name"
elif test "$hardcode_shlibpath_var" = no; then
add_shlibpath="$dir"
add="-l$name"
else
lib_linked=no
fi
;;
relink)
if test "$hardcode_direct" = yes &&
test "$hardcode_direct_absolute" = no; then
add="$dir/$linklib"
elif test "$hardcode_minus_L" = yes; then
add_dir="-L$dir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
case $libdir in
[\\/]*)
func_append add_dir " -L$inst_prefix_dir$libdir"
;;
esac
fi
add="-l$name"
elif test "$hardcode_shlibpath_var" = yes; then
add_shlibpath="$dir"
add="-l$name"
else
lib_linked=no
fi
;;
*) lib_linked=no ;;
esac
if test "$lib_linked" != yes; then
func_fatal_configuration "unsupported hardcode properties"
fi
if test -n "$add_shlibpath"; then
case :$compile_shlibpath: in
*":$add_shlibpath:"*) ;;
*) func_append compile_shlibpath "$add_shlibpath:" ;;
esac
fi
if test "$linkmode" = prog; then
test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
test -n "$add" && compile_deplibs="$add $compile_deplibs"
else
test -n "$add_dir" && deplibs="$add_dir $deplibs"
test -n "$add" && deplibs="$add $deplibs"
if test "$hardcode_direct" != yes &&
test "$hardcode_minus_L" != yes &&
test "$hardcode_shlibpath_var" = yes; then
case :$finalize_shlibpath: in
*":$libdir:"*) ;;
*) func_append finalize_shlibpath "$libdir:" ;;
esac
fi
fi
fi
if test "$linkmode" = prog || test "$opt_mode" = relink; then
add_shlibpath=
add_dir=
add=
# Finalize command for both is simple: just hardcode it.
if test "$hardcode_direct" = yes &&
test "$hardcode_direct_absolute" = no; then
add="$libdir/$linklib"
elif test "$hardcode_minus_L" = yes; then
add_dir="-L$libdir"
add="-l$name"
elif test "$hardcode_shlibpath_var" = yes; then
case :$finalize_shlibpath: in
*":$libdir:"*) ;;
*) func_append finalize_shlibpath "$libdir:" ;;
esac
add="-l$name"
elif test "$hardcode_automatic" = yes; then
if test -n "$inst_prefix_dir" &&
test -f "$inst_prefix_dir$libdir/$linklib" ; then
add="$inst_prefix_dir$libdir/$linklib"
else
add="$libdir/$linklib"
fi
else
# We cannot seem to hardcode it, guess we'll fake it.
add_dir="-L$libdir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
case $libdir in
[\\/]*)
func_append add_dir " -L$inst_prefix_dir$libdir"
;;
esac
fi
add="-l$name"
fi
if test "$linkmode" = prog; then
test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
else
test -n "$add_dir" && deplibs="$add_dir $deplibs"
test -n "$add" && deplibs="$add $deplibs"
fi
fi
elif test "$linkmode" = prog; then
# Here we assume that one of hardcode_direct or hardcode_minus_L
# is not unsupported. This is valid on all known static and
# shared platforms.
if test "$hardcode_direct" != unsupported; then
test -n "$old_library" && linklib="$old_library"
compile_deplibs="$dir/$linklib $compile_deplibs"
finalize_deplibs="$dir/$linklib $finalize_deplibs"
else
compile_deplibs="-l$name -L$dir $compile_deplibs"
finalize_deplibs="-l$name -L$dir $finalize_deplibs"
fi
elif test "$build_libtool_libs" = yes; then
# Not a shared library
if test "$deplibs_check_method" != pass_all; then
# We're trying link a shared library against a static one
# but the system doesn't support it.
# Just print a warning and add the library to dependency_libs so
# that the program can be linked against the static library.
echo
$ECHO "*** Warning: This system can not link to static lib archive $lib."
echo "*** I have the capability to make that library automatically link in when"
echo "*** you link to this library. But I can only do this if you have a"
echo "*** shared version of the library, which you do not appear to have."
if test "$module" = yes; then
echo "*** But as you try to build a module library, libtool will still create "
echo "*** a static module, that should work as long as the dlopening application"
echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
if test -z "$global_symbol_pipe"; then
echo
echo "*** However, this would only work if libtool was able to extract symbol"
echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
echo "*** not find such a program. So, this module is probably useless."
echo "*** \`nm' from GNU binutils and a full rebuild may help."
fi
if test "$build_old_libs" = no; then
build_libtool_libs=module
build_old_libs=yes
else
build_libtool_libs=no
fi
fi
else
deplibs="$dir/$old_library $deplibs"
link_static=yes
fi
fi # link shared/static library?
if test "$linkmode" = lib; then
if test -n "$dependency_libs" &&
{ test "$hardcode_into_libs" != yes ||
test "$build_old_libs" = yes ||
test "$link_static" = yes; }; then
# Extract -R from dependency_libs
temp_deplibs=
for libdir in $dependency_libs; do
case $libdir in
-R*) func_stripname '-R' '' "$libdir"
temp_xrpath=$func_stripname_result
case " $xrpath " in
*" $temp_xrpath "*) ;;
*) func_append xrpath " $temp_xrpath";;
esac;;
*) func_append temp_deplibs " $libdir";;
esac
done
dependency_libs="$temp_deplibs"
fi
func_append newlib_search_path " $absdir"
# Link against this library
test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
# ... and its dependency_libs
tmp_libs=
for deplib in $dependency_libs; do
newdependency_libs="$deplib $newdependency_libs"
case $deplib in
-L*) func_stripname '-L' '' "$deplib"
func_resolve_sysroot "$func_stripname_result";;
*) func_resolve_sysroot "$deplib" ;;
esac
if $opt_preserve_dup_deps ; then
case "$tmp_libs " in
*" $func_resolve_sysroot_result "*)
func_append specialdeplibs " $func_resolve_sysroot_result" ;;
esac
fi
func_append tmp_libs " $func_resolve_sysroot_result"
done
if test "$link_all_deplibs" != no; then
# Add the search paths of all dependency libraries
for deplib in $dependency_libs; do
path=
case $deplib in
-L*) path="$deplib" ;;
*.la)
func_resolve_sysroot "$deplib"
deplib=$func_resolve_sysroot_result
func_dirname "$deplib" "" "."
dir=$func_dirname_result
# We need an absolute path.
case $dir in
[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
*)
absdir=`cd "$dir" && pwd`
if test -z "$absdir"; then
func_warning "cannot determine absolute directory name of \`$dir'"
absdir="$dir"
fi
;;
esac
if $GREP "^installed=no" $deplib > /dev/null; then
case $host in
*-*-darwin*)
depdepl=
eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
if test -n "$deplibrary_names" ; then
for tmp in $deplibrary_names ; do
depdepl=$tmp
done
if test -f "$absdir/$objdir/$depdepl" ; then
depdepl="$absdir/$objdir/$depdepl"
darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
if test -z "$darwin_install_name"; then
darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
fi
func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
path=
fi
fi
;;
*)
path="-L$absdir/$objdir"
;;
esac
else
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
test -z "$libdir" && \
func_fatal_error "\`$deplib' is not a valid libtool archive"
#test "$absdir" != "$libdir" && \
# func_warning "\`$deplib' seems to be moved"
path="-L$absdir"
fi
;;
esac
case " $deplibs " in
*" $path "*) ;;
*) deplibs="$path $deplibs" ;;
esac
done
fi # link_all_deplibs != no
fi # linkmode = lib
done # for deplib in $libs
if test "$pass" = link; then
if test "$linkmode" = "prog"; then
compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
else
compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
fi
fi
dependency_libs="$newdependency_libs"
if test "$pass" = dlpreopen; then
# Link the dlpreopened libraries before other libraries
for deplib in $save_deplibs; do
deplibs="$deplib $deplibs"
done
fi
if test "$pass" != dlopen; then
if test "$pass" != conv; then
# Make sure lib_search_path contains only unique directories.
lib_search_path=
for dir in $newlib_search_path; do
case "$lib_search_path " in
*" $dir "*) ;;
*) func_append lib_search_path " $dir" ;;
esac
done
newlib_search_path=
fi
if test "$linkmode,$pass" != "prog,link"; then
vars="deplibs"
else
vars="compile_deplibs finalize_deplibs"
fi
for var in $vars dependency_libs; do
# Add libraries to $var in reverse order
eval tmp_libs=\"\$$var\"
new_libs=
for deplib in $tmp_libs; do
# FIXME: Pedantically, this is the right thing to do, so
# that some nasty dependency loop isn't accidentally
# broken:
#new_libs="$deplib $new_libs"
# Pragmatically, this seems to cause very few problems in
# practice:
case $deplib in
-L*) new_libs="$deplib $new_libs" ;;
-R*) ;;
*)
# And here is the reason: when a library appears more
# than once as an explicit dependence of a library, or
# is implicitly linked in more than once by the
# compiler, it is considered special, and multiple
# occurrences thereof are not removed. Compare this
# with having the same library being listed as a
# dependency of multiple other libraries: in this case,
# we know (pedantically, we assume) the library does not
# need to be listed more than once, so we keep only the
# last copy. This is not always right, but it is rare
# enough that we require users that really mean to play
# such unportable linking tricks to link the library
# using -Wl,-lname, so that libtool does not consider it
# for duplicate removal.
case " $specialdeplibs " in
*" $deplib "*) new_libs="$deplib $new_libs" ;;
*)
case " $new_libs " in
*" $deplib "*) ;;
*) new_libs="$deplib $new_libs" ;;
esac
;;
esac
;;
esac
done
tmp_libs=
for deplib in $new_libs; do
case $deplib in
-L*)
case " $tmp_libs " in
*" $deplib "*) ;;
*) func_append tmp_libs " $deplib" ;;
esac
;;
*) func_append tmp_libs " $deplib" ;;
esac
done
eval $var=\"$tmp_libs\"
done # for var
fi
# Last step: remove runtime libs from dependency_libs
# (they stay in deplibs)
tmp_libs=
for i in $dependency_libs ; do
case " $predeps $postdeps $compiler_lib_search_path " in
*" $i "*)
i=""
;;
esac
if test -n "$i" ; then
func_append tmp_libs " $i"
fi
done
dependency_libs=$tmp_libs
done # for pass
if test "$linkmode" = prog; then
dlfiles="$newdlfiles"
fi
if test "$linkmode" = prog || test "$linkmode" = lib; then
dlprefiles="$newdlprefiles"
fi
case $linkmode in
oldlib)
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
func_warning "\`-dlopen' is ignored for archives"
fi
case " $deplibs" in
*\ -l* | *\ -L*)
func_warning "\`-l' and \`-L' are ignored for archives" ;;
esac
test -n "$rpath" && \
func_warning "\`-rpath' is ignored for archives"
test -n "$xrpath" && \
func_warning "\`-R' is ignored for archives"
test -n "$vinfo" && \
func_warning "\`-version-info/-version-number' is ignored for archives"
test -n "$release" && \
func_warning "\`-release' is ignored for archives"
test -n "$export_symbols$export_symbols_regex" && \
func_warning "\`-export-symbols' is ignored for archives"
# Now set the variables for building old libraries.
build_libtool_libs=no
oldlibs="$output"
func_append objs "$old_deplibs"
;;
lib)
# Make sure we only generate libraries of the form `libNAME.la'.
case $outputname in
lib*)
func_stripname 'lib' '.la' "$outputname"
name=$func_stripname_result
eval shared_ext=\"$shrext_cmds\"
eval libname=\"$libname_spec\"
;;
*)
test "$module" = no && \
func_fatal_help "libtool library \`$output' must begin with \`lib'"
if test "$need_lib_prefix" != no; then
# Add the "lib" prefix for modules if required
func_stripname '' '.la' "$outputname"
name=$func_stripname_result
eval shared_ext=\"$shrext_cmds\"
eval libname=\"$libname_spec\"
else
func_stripname '' '.la' "$outputname"
libname=$func_stripname_result
fi
;;
esac
if test -n "$objs"; then
if test "$deplibs_check_method" != pass_all; then
func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
else
echo
$ECHO "*** Warning: Linking the shared library $output against the non-libtool"
$ECHO "*** objects $objs is not portable!"
func_append libobjs " $objs"
fi
fi
test "$dlself" != no && \
func_warning "\`-dlopen self' is ignored for libtool libraries"
set dummy $rpath
shift
test "$#" -gt 1 && \
func_warning "ignoring multiple \`-rpath's for a libtool library"
install_libdir="$1"
oldlibs=
if test -z "$rpath"; then
if test "$build_libtool_libs" = yes; then
# Building a libtool convenience library.
# Some compilers have problems with a `.al' extension so
# convenience libraries should have the same extension an
# archive normally would.
oldlibs="$output_objdir/$libname.$libext $oldlibs"
build_libtool_libs=convenience
build_old_libs=yes
fi
test -n "$vinfo" && \
func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
test -n "$release" && \
func_warning "\`-release' is ignored for convenience libraries"
else
# Parse the version information argument.
save_ifs="$IFS"; IFS=':'
set dummy $vinfo 0 0 0
shift
IFS="$save_ifs"
test -n "$7" && \
func_fatal_help "too many parameters to \`-version-info'"
# convert absolute version numbers to libtool ages
# this retains compatibility with .la files and attempts
# to make the code below a bit more comprehensible
case $vinfo_number in
yes)
number_major="$1"
number_minor="$2"
number_revision="$3"
#
# There are really only two kinds -- those that
# use the current revision as the major version
# and those that subtract age and use age as
# a minor version. But, then there is irix
# which has an extra 1 added just for fun
#
case $version_type in
darwin|linux|osf|windows|none)
func_arith $number_major + $number_minor
current=$func_arith_result
age="$number_minor"
revision="$number_revision"
;;
freebsd-aout|freebsd-elf|qnx|sunos)
current="$number_major"
revision="$number_minor"
age="0"
;;
irix|nonstopux)
func_arith $number_major + $number_minor
current=$func_arith_result
age="$number_minor"
revision="$number_minor"
lt_irix_increment=no
;;
esac
;;
no)
current="$1"
revision="$2"
age="$3"
;;
esac
# Check that each of the things are valid numbers.
case $current in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
func_error "CURRENT \`$current' must be a nonnegative integer"
func_fatal_error "\`$vinfo' is not valid version information"
;;
esac
case $revision in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
func_error "REVISION \`$revision' must be a nonnegative integer"
func_fatal_error "\`$vinfo' is not valid version information"
;;
esac
case $age in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
func_error "AGE \`$age' must be a nonnegative integer"
func_fatal_error "\`$vinfo' is not valid version information"
;;
esac
if test "$age" -gt "$current"; then
func_error "AGE \`$age' is greater than the current interface number \`$current'"
func_fatal_error "\`$vinfo' is not valid version information"
fi
# Calculate the version variables.
major=
versuffix=
verstring=
case $version_type in
none) ;;
darwin)
# Like Linux, but with the current version available in
# verstring for coding it into the library header
func_arith $current - $age
major=.$func_arith_result
versuffix="$major.$age.$revision"
# Darwin ld doesn't like 0 for these options...
func_arith $current + 1
minor_current=$func_arith_result
xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
;;
freebsd-aout)
major=".$current"
versuffix=".$current.$revision";
;;
freebsd-elf)
major=".$current"
versuffix=".$current"
;;
irix | nonstopux)
if test "X$lt_irix_increment" = "Xno"; then
func_arith $current - $age
else
func_arith $current - $age + 1
fi
major=$func_arith_result
case $version_type in
nonstopux) verstring_prefix=nonstopux ;;
*) verstring_prefix=sgi ;;
esac
verstring="$verstring_prefix$major.$revision"
# Add in all the interfaces that we are compatible with.
loop=$revision
while test "$loop" -ne 0; do
func_arith $revision - $loop
iface=$func_arith_result
func_arith $loop - 1
loop=$func_arith_result
verstring="$verstring_prefix$major.$iface:$verstring"
done
# Before this point, $major must not contain `.'.
major=.$major
versuffix="$major.$revision"
;;
linux)
func_arith $current - $age
major=.$func_arith_result
versuffix="$major.$age.$revision"
;;
osf)
func_arith $current - $age
major=.$func_arith_result
versuffix=".$current.$age.$revision"
verstring="$current.$age.$revision"
# Add in all the interfaces that we are compatible with.
loop=$age
while test "$loop" -ne 0; do
func_arith $current - $loop
iface=$func_arith_result
func_arith $loop - 1
loop=$func_arith_result
verstring="$verstring:${iface}.0"
done
# Make executables depend on our current version.
func_append verstring ":${current}.0"
;;
qnx)
major=".$current"
versuffix=".$current"
;;
sunos)
major=".$current"
versuffix=".$current.$revision"
;;
windows)
# Use '-' rather than '.', since we only want one
# extension on DOS 8.3 filesystems.
func_arith $current - $age
major=$func_arith_result
versuffix="-$major"
;;
*)
func_fatal_configuration "unknown library version type \`$version_type'"
;;
esac
# Clear the version info if we defaulted, and they specified a release.
if test -z "$vinfo" && test -n "$release"; then
major=
case $version_type in
darwin)
# we can't check for "0.0" in archive_cmds due to quoting
# problems, so we reset it completely
verstring=
;;
*)
verstring="0.0"
;;
esac
if test "$need_version" = no; then
versuffix=
else
versuffix=".0.0"
fi
fi
# Remove version info from name if versioning should be avoided
if test "$avoid_version" = yes && test "$need_version" = no; then
major=
versuffix=
verstring=""
fi
# Check to see if the archive will have undefined symbols.
if test "$allow_undefined" = yes; then
if test "$allow_undefined_flag" = unsupported; then
func_warning "undefined symbols not allowed in $host shared libraries"
build_libtool_libs=no
build_old_libs=yes
fi
else
# Don't allow undefined symbols.
allow_undefined_flag="$no_undefined_flag"
fi
fi
func_generate_dlsyms "$libname" "$libname" "yes"
func_append libobjs " $symfileobj"
test "X$libobjs" = "X " && libobjs=
if test "$opt_mode" != relink; then
# Remove our outputs, but don't remove object files since they
# may have been created when compiling PIC objects.
removelist=
tempremovelist=`$ECHO "$output_objdir/*"`
for p in $tempremovelist; do
case $p in
*.$objext | *.gcno)
;;
$output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
if test "X$precious_files_regex" != "X"; then
if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
then
continue
fi
fi
func_append removelist " $p"
;;
*) ;;
esac
done
test -n "$removelist" && \
func_show_eval "${RM}r \$removelist"
fi
# Now set the variables for building old libraries.
if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
func_append oldlibs " $output_objdir/$libname.$libext"
# Transform .lo files to .o files.
oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
fi
# Eliminate all temporary directories.
#for path in $notinst_path; do
# lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
# deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
# dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
#done
if test -n "$xrpath"; then
# If the user specified any rpath flags, then add them.
temp_xrpath=
for libdir in $xrpath; do
func_replace_sysroot "$libdir"
func_append temp_xrpath " -R$func_replace_sysroot_result"
case "$finalize_rpath " in
*" $libdir "*) ;;
*) func_append finalize_rpath " $libdir" ;;
esac
done
if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
dependency_libs="$temp_xrpath $dependency_libs"
fi
fi
# Make sure dlfiles contains only unique files that won't be dlpreopened
old_dlfiles="$dlfiles"
dlfiles=
for lib in $old_dlfiles; do
case " $dlprefiles $dlfiles " in
*" $lib "*) ;;
*) func_append dlfiles " $lib" ;;
esac
done
# Make sure dlprefiles contains only unique files
old_dlprefiles="$dlprefiles"
dlprefiles=
for lib in $old_dlprefiles; do
case "$dlprefiles " in
*" $lib "*) ;;
*) func_append dlprefiles " $lib" ;;
esac
done
if test "$build_libtool_libs" = yes; then
if test -n "$rpath"; then
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
# these systems don't actually have a c library (as such)!
;;
*-*-rhapsody* | *-*-darwin1.[012])
# Rhapsody C library is in the System framework
func_append deplibs " System.ltframework"
;;
*-*-netbsd*)
# Don't link with libc until the a.out ld.so is fixed.
;;
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc due to us having libc/libc_r.
;;
*-*-sco3.2v5* | *-*-sco5v6*)
# Causes problems with __ctype
;;
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
# Compiler inserts libc in the correct place for threads to work
;;
*)
# Add libc to deplibs on all other systems if necessary.
if test "$build_libtool_need_lc" = "yes"; then
func_append deplibs " -lc"
fi
;;
esac
fi
# Transform deplibs into only deplibs that can be linked in shared.
name_save=$name
libname_save=$libname
release_save=$release
versuffix_save=$versuffix
major_save=$major
# I'm not sure if I'm treating the release correctly. I think
# release should show up in the -l (ie -lgmp5) so we don't want to
# add it in twice. Is that correct?
release=""
versuffix=""
major=""
newdeplibs=
droppeddeps=no
case $deplibs_check_method in
pass_all)
# Don't check for shared/static. Everything works.
# This might be a little naive. We might want to check
# whether the library exists or not. But this is on
# osf3 & osf4 and I'm not really sure... Just
# implementing what was already the behavior.
newdeplibs=$deplibs
;;
test_compile)
# This code stresses the "libraries are programs" paradigm to its
# limits. Maybe even breaks it. We compile a program, linking it
# against the deplibs as a proxy for the library. Then we can check
# whether they linked in statically or dynamically with ldd.
$opt_dry_run || $RM conftest.c
cat > conftest.c </dev/null`
$nocaseglob
else
potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
fi
for potent_lib in $potential_libs; do
# Follow soft links.
if ls -lLd "$potent_lib" 2>/dev/null |
$GREP " -> " >/dev/null; then
continue
fi
# The statement above tries to avoid entering an
# endless loop below, in case of cyclic links.
# We might still enter an endless loop, since a link
# loop can be closed while we follow links,
# but so what?
potlib="$potent_lib"
while test -h "$potlib" 2>/dev/null; do
potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
case $potliblink in
[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
*) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
esac
done
if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
$SED -e 10q |
$EGREP "$file_magic_regex" > /dev/null; then
func_append newdeplibs " $a_deplib"
a_deplib=""
break 2
fi
done
done
fi
if test -n "$a_deplib" ; then
droppeddeps=yes
echo
$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
echo "*** I have the capability to make that library automatically link in when"
echo "*** you link to this library. But I can only do this if you have a"
echo "*** shared version of the library, which you do not appear to have"
echo "*** because I did check the linker path looking for a file starting"
if test -z "$potlib" ; then
$ECHO "*** with $libname but no candidates were found. (...for file magic test)"
else
$ECHO "*** with $libname and none of the candidates passed a file format test"
$ECHO "*** using a file magic. Last file checked: $potlib"
fi
fi
;;
*)
# Add a -L argument.
func_append newdeplibs " $a_deplib"
;;
esac
done # Gone through all deplibs.
;;
match_pattern*)
set dummy $deplibs_check_method; shift
match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
for a_deplib in $deplibs; do
case $a_deplib in
-l*)
func_stripname -l '' "$a_deplib"
name=$func_stripname_result
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $a_deplib "*)
func_append newdeplibs " $a_deplib"
a_deplib=""
;;
esac
fi
if test -n "$a_deplib" ; then
libname=`eval "\\$ECHO \"$libname_spec\""`
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
for potent_lib in $potential_libs; do
potlib="$potent_lib" # see symlink-check above in file_magic test
if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
$EGREP "$match_pattern_regex" > /dev/null; then
func_append newdeplibs " $a_deplib"
a_deplib=""
break 2
fi
done
done
fi
if test -n "$a_deplib" ; then
droppeddeps=yes
echo
$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
echo "*** I have the capability to make that library automatically link in when"
echo "*** you link to this library. But I can only do this if you have a"
echo "*** shared version of the library, which you do not appear to have"
echo "*** because I did check the linker path looking for a file starting"
if test -z "$potlib" ; then
$ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
else
$ECHO "*** with $libname and none of the candidates passed a file format test"
$ECHO "*** using a regex pattern. Last file checked: $potlib"
fi
fi
;;
*)
# Add a -L argument.
func_append newdeplibs " $a_deplib"
;;
esac
done # Gone through all deplibs.
;;
none | unknown | *)
newdeplibs=""
tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
for i in $predeps $postdeps ; do
# can't use Xsed below, because $i might contain '/'
tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
done
fi
case $tmp_deplibs in
*[!\ \ ]*)
echo
if test "X$deplibs_check_method" = "Xnone"; then
echo "*** Warning: inter-library dependencies are not supported in this platform."
else
echo "*** Warning: inter-library dependencies are not known to be supported."
fi
echo "*** All declared inter-library dependencies are being dropped."
droppeddeps=yes
;;
esac
;;
esac
versuffix=$versuffix_save
major=$major_save
release=$release_save
libname=$libname_save
name=$name_save
case $host in
*-*-rhapsody* | *-*-darwin1.[012])
# On Rhapsody replace the C library with the System framework
newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
;;
esac
if test "$droppeddeps" = yes; then
if test "$module" = yes; then
echo
echo "*** Warning: libtool could not satisfy all declared inter-library"
$ECHO "*** dependencies of module $libname. Therefore, libtool will create"
echo "*** a static module, that should work as long as the dlopening"
echo "*** application is linked with the -dlopen flag."
if test -z "$global_symbol_pipe"; then
echo
echo "*** However, this would only work if libtool was able to extract symbol"
echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
echo "*** not find such a program. So, this module is probably useless."
echo "*** \`nm' from GNU binutils and a full rebuild may help."
fi
if test "$build_old_libs" = no; then
oldlibs="$output_objdir/$libname.$libext"
build_libtool_libs=module
build_old_libs=yes
else
build_libtool_libs=no
fi
else
echo "*** The inter-library dependencies that have been dropped here will be"
echo "*** automatically added whenever a program is linked with this library"
echo "*** or is declared to -dlopen it."
if test "$allow_undefined" = no; then
echo
echo "*** Since this library must not contain undefined symbols,"
echo "*** because either the platform does not support them or"
echo "*** it was explicitly requested with -no-undefined,"
echo "*** libtool will only create a static version of it."
if test "$build_old_libs" = no; then
oldlibs="$output_objdir/$libname.$libext"
build_libtool_libs=module
build_old_libs=yes
else
build_libtool_libs=no
fi
fi
fi
fi
# Done checking deplibs!
deplibs=$newdeplibs
fi
# Time to change all our "foo.ltframework" stuff back to "-framework foo"
case $host in
*-*-darwin*)
newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
;;
esac
# move library search paths that coincide with paths to not yet
# installed libraries to the beginning of the library search list
new_libs=
for path in $notinst_path; do
case " $new_libs " in
*" -L$path/$objdir "*) ;;
*)
case " $deplibs " in
*" -L$path/$objdir "*)
func_append new_libs " -L$path/$objdir" ;;
esac
;;
esac
done
for deplib in $deplibs; do
case $deplib in
-L*)
case " $new_libs " in
*" $deplib "*) ;;
*) func_append new_libs " $deplib" ;;
esac
;;
*) func_append new_libs " $deplib" ;;
esac
done
deplibs="$new_libs"
# All the library-specific variables (install_libdir is set above).
library_names=
old_library=
dlname=
# Test again, we may have decided not to build it any more
if test "$build_libtool_libs" = yes; then
if test "$hardcode_into_libs" = yes; then
# Hardcode the library paths
hardcode_libdirs=
dep_rpath=
rpath="$finalize_rpath"
test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
for libdir in $rpath; do
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
func_replace_sysroot "$libdir"
libdir=$func_replace_sysroot_result
if test -z "$hardcode_libdirs"; then
hardcode_libdirs="$libdir"
else
# Just accumulate the unique libdirs.
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
;;
*)
func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
;;
esac
fi
else
eval flag=\"$hardcode_libdir_flag_spec\"
func_append dep_rpath " $flag"
fi
elif test -n "$runpath_var"; then
case "$perm_rpath " in
*" $libdir "*) ;;
*) func_apped perm_rpath " $libdir" ;;
esac
fi
done
# Substitute the hardcoded libdirs into the rpath.
if test -n "$hardcode_libdir_separator" &&
test -n "$hardcode_libdirs"; then
libdir="$hardcode_libdirs"
if test -n "$hardcode_libdir_flag_spec_ld"; then
eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
else
eval dep_rpath=\"$hardcode_libdir_flag_spec\"
fi
fi
if test -n "$runpath_var" && test -n "$perm_rpath"; then
# We should set the runpath_var.
rpath=
for dir in $perm_rpath; do
func_append rpath "$dir:"
done
eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
fi
test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
fi
shlibpath="$finalize_shlibpath"
test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
if test -n "$shlibpath"; then
eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
fi
# Get the real and link names of the library.
eval shared_ext=\"$shrext_cmds\"
eval library_names=\"$library_names_spec\"
set dummy $library_names
shift
realname="$1"
shift
if test -n "$soname_spec"; then
eval soname=\"$soname_spec\"
else
soname="$realname"
fi
if test -z "$dlname"; then
dlname=$soname
fi
lib="$output_objdir/$realname"
linknames=
for link
do
func_append linknames " $link"
done
# Use standard objects if they are pic
test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
test "X$libobjs" = "X " && libobjs=
delfiles=
if test -n "$export_symbols" && test -n "$include_expsyms"; then
$opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
export_symbols="$output_objdir/$libname.uexp"
func_append delfiles " $export_symbols"
fi
orig_export_symbols=
case $host_os in
cygwin* | mingw* | cegcc*)
if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
# exporting using user supplied symfile
if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
# and it's NOT already a .def file. Must figure out
# which of the given symbols are data symbols and tag
# them as such. So, trigger use of export_symbols_cmds.
# export_symbols gets reassigned inside the "prepare
# the list of exported symbols" if statement, so the
# include_expsyms logic still works.
orig_export_symbols="$export_symbols"
export_symbols=
always_export_symbols=yes
fi
fi
;;
esac
# Prepare the list of exported symbols
if test -z "$export_symbols"; then
if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
func_verbose "generating symbol list for \`$libname.la'"
export_symbols="$output_objdir/$libname.exp"
$opt_dry_run || $RM $export_symbols
cmds=$export_symbols_cmds
save_ifs="$IFS"; IFS='~'
for cmd1 in $cmds; do
IFS="$save_ifs"
# Take the normal branch if the nm_file_list_spec branch
# doesn't work or if tool conversion is not needed.
case $nm_file_list_spec~$to_tool_file_cmd in
*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
try_normal_branch=yes
eval cmd=\"$cmd1\"
func_len " $cmd"
len=$func_len_result
;;
*)
try_normal_branch=no
;;
esac
if test "$try_normal_branch" = yes \
&& { test "$len" -lt "$max_cmd_len" \
|| test "$max_cmd_len" -le -1; }
then
func_show_eval "$cmd" 'exit $?'
skipped_export=false
elif test -n "$nm_file_list_spec"; then
func_basename "$output"
output_la=$func_basename_result
save_libobjs=$libobjs
save_output=$output
output=${output_objdir}/${output_la}.nm
func_to_tool_file "$output"
libobjs=$nm_file_list_spec$func_to_tool_file_result
func_append delfiles " $output"
func_verbose "creating $NM input file list: $output"
for obj in $save_libobjs; do
func_to_tool_file "$obj"
$ECHO "$func_to_tool_file_result"
done > "$output"
eval cmd=\"$cmd1\"
func_show_eval "$cmd" 'exit $?'
output=$save_output
libobjs=$save_libobjs
skipped_export=false
else
# The command line is too long to execute in one step.
func_verbose "using reloadable object file for export list..."
skipped_export=:
# Break out early, otherwise skipped_export may be
# set to false by a later but shorter cmd.
break
fi
done
IFS="$save_ifs"
if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
fi
fi
fi
if test -n "$export_symbols" && test -n "$include_expsyms"; then
tmp_export_symbols="$export_symbols"
test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
$opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
fi
if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
# The given exports_symbols file has to be filtered, so filter it.
func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
# FIXME: $output_objdir/$libname.filter potentially contains lots of
# 's' commands which not all seds can handle. GNU sed should be fine
# though. Also, the filter scales superlinearly with the number of
# global variables. join(1) would be nice here, but unfortunately
# isn't a blessed tool.
$opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
func_append delfiles " $export_symbols $output_objdir/$libname.filter"
export_symbols=$output_objdir/$libname.def
$opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
fi
tmp_deplibs=
for test_deplib in $deplibs; do
case " $convenience " in
*" $test_deplib "*) ;;
*)
func_append tmp_deplibs " $test_deplib"
;;
esac
done
deplibs="$tmp_deplibs"
if test -n "$convenience"; then
if test -n "$whole_archive_flag_spec" &&
test "$compiler_needs_object" = yes &&
test -z "$libobjs"; then
# extract the archives, so we have objects to list.
# TODO: could optimize this to just extract one archive.
whole_archive_flag_spec=
fi
if test -n "$whole_archive_flag_spec"; then
save_libobjs=$libobjs
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
test "X$libobjs" = "X " && libobjs=
else
gentop="$output_objdir/${outputname}x"
func_append generated " $gentop"
func_extract_archives $gentop $convenience
func_append libobjs " $func_extract_archives_result"
test "X$libobjs" = "X " && libobjs=
fi
fi
if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
eval flag=\"$thread_safe_flag_spec\"
func_append linker_flags " $flag"
fi
# Make a backup of the uninstalled library when relinking
if test "$opt_mode" = relink; then
$opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
fi
# Do each of the archive commands.
if test "$module" = yes && test -n "$module_cmds" ; then
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
eval test_cmds=\"$module_expsym_cmds\"
cmds=$module_expsym_cmds
else
eval test_cmds=\"$module_cmds\"
cmds=$module_cmds
fi
else
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
eval test_cmds=\"$archive_expsym_cmds\"
cmds=$archive_expsym_cmds
else
eval test_cmds=\"$archive_cmds\"
cmds=$archive_cmds
fi
fi
if test "X$skipped_export" != "X:" &&
func_len " $test_cmds" &&
len=$func_len_result &&
test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
:
else
# The command line is too long to link in one step, link piecewise
# or, if using GNU ld and skipped_export is not :, use a linker
# script.
# Save the value of $output and $libobjs because we want to
# use them later. If we have whole_archive_flag_spec, we
# want to use save_libobjs as it was before
# whole_archive_flag_spec was expanded, because we can't
# assume the linker understands whole_archive_flag_spec.
# This may have to be revisited, in case too many
# convenience libraries get linked in and end up exceeding
# the spec.
if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
save_libobjs=$libobjs
fi
save_output=$output
func_basename "$output"
output_la=$func_basename_result
# Clear the reloadable object creation command queue and
# initialize k to one.
test_cmds=
concat_cmds=
objlist=
last_robj=
k=1
if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
output=${output_objdir}/${output_la}.lnkscript
func_verbose "creating GNU ld script: $output"
echo 'INPUT (' > $output
for obj in $save_libobjs
do
func_to_tool_file "$obj"
$ECHO "$func_to_tool_file_result" >> $output
done
echo ')' >> $output
func_append delfiles " $output"
func_to_tool_file "$output"
output=$func_to_tool_file_result
elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
output=${output_objdir}/${output_la}.lnk
func_verbose "creating linker input file list: $output"
: > $output
set x $save_libobjs
shift
firstobj=
if test "$compiler_needs_object" = yes; then
firstobj="$1 "
shift
fi
for obj
do
func_to_tool_file "$obj"
$ECHO "$func_to_tool_file_result" >> $output
done
func_append delfiles " $output"
func_to_tool_file "$output"
output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
else
if test -n "$save_libobjs"; then
func_verbose "creating reloadable object files..."
output=$output_objdir/$output_la-${k}.$objext
eval test_cmds=\"$reload_cmds\"
func_len " $test_cmds"
len0=$func_len_result
len=$len0
# Loop over the list of objects to be linked.
for obj in $save_libobjs
do
func_len " $obj"
func_arith $len + $func_len_result
len=$func_arith_result
if test "X$objlist" = X ||
test "$len" -lt "$max_cmd_len"; then
func_append objlist " $obj"
else
# The command $test_cmds is almost too long, add a
# command to the queue.
if test "$k" -eq 1 ; then
# The first file doesn't have a previous command to add.
reload_objs=$objlist
eval concat_cmds=\"$reload_cmds\"
else
# All subsequent reloadable object files will link in
# the last one created.
reload_objs="$objlist $last_robj"
eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
fi
last_robj=$output_objdir/$output_la-${k}.$objext
func_arith $k + 1
k=$func_arith_result
output=$output_objdir/$output_la-${k}.$objext
objlist=" $obj"
func_len " $last_robj"
func_arith $len0 + $func_len_result
len=$func_arith_result
fi
done
# Handle the remaining objects by creating one last
# reloadable object file. All subsequent reloadable object
# files will link in the last one created.
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
reload_objs="$objlist $last_robj"
eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
if test -n "$last_robj"; then
eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
fi
func_append delfiles " $output"
else
output=
fi
if ${skipped_export-false}; then
func_verbose "generating symbol list for \`$libname.la'"
export_symbols="$output_objdir/$libname.exp"
$opt_dry_run || $RM $export_symbols
libobjs=$output
# Append the command to create the export file.
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
if test -n "$last_robj"; then
eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
fi
fi
test -n "$save_libobjs" &&
func_verbose "creating a temporary reloadable object file: $output"
# Loop through the commands generated above and execute them.
save_ifs="$IFS"; IFS='~'
for cmd in $concat_cmds; do
IFS="$save_ifs"
$opt_silent || {
func_quote_for_expand "$cmd"
eval "func_echo $func_quote_for_expand_result"
}
$opt_dry_run || eval "$cmd" || {
lt_exit=$?
# Restore the uninstalled library and exit
if test "$opt_mode" = relink; then
( cd "$output_objdir" && \
$RM "${realname}T" && \
$MV "${realname}U" "$realname" )
fi
exit $lt_exit
}
done
IFS="$save_ifs"
if test -n "$export_symbols_regex" && ${skipped_export-false}; then
func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
fi
fi
if ${skipped_export-false}; then
if test -n "$export_symbols" && test -n "$include_expsyms"; then
tmp_export_symbols="$export_symbols"
test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
$opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
fi
if test -n "$orig_export_symbols"; then
# The given exports_symbols file has to be filtered, so filter it.
func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
# FIXME: $output_objdir/$libname.filter potentially contains lots of
# 's' commands which not all seds can handle. GNU sed should be fine
# though. Also, the filter scales superlinearly with the number of
# global variables. join(1) would be nice here, but unfortunately
# isn't a blessed tool.
$opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
func_append delfiles " $export_symbols $output_objdir/$libname.filter"
export_symbols=$output_objdir/$libname.def
$opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
fi
fi
libobjs=$output
# Restore the value of output.
output=$save_output
if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
test "X$libobjs" = "X " && libobjs=
fi
# Expand the library linking commands again to reset the
# value of $libobjs for piecewise linking.
# Do each of the archive commands.
if test "$module" = yes && test -n "$module_cmds" ; then
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
cmds=$module_expsym_cmds
else
cmds=$module_cmds
fi
else
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
cmds=$archive_expsym_cmds
else
cmds=$archive_cmds
fi
fi
fi
if test -n "$delfiles"; then
# Append the command to remove temporary files to $cmds.
eval cmds=\"\$cmds~\$RM $delfiles\"
fi
# Add any objects from preloaded convenience libraries
if test -n "$dlprefiles"; then
gentop="$output_objdir/${outputname}x"
func_append generated " $gentop"
func_extract_archives $gentop $dlprefiles
func_append libobjs " $func_extract_archives_result"
test "X$libobjs" = "X " && libobjs=
fi
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
eval cmd=\"$cmd\"
$opt_silent || {
func_quote_for_expand "$cmd"
eval "func_echo $func_quote_for_expand_result"
}
$opt_dry_run || eval "$cmd" || {
lt_exit=$?
# Restore the uninstalled library and exit
if test "$opt_mode" = relink; then
( cd "$output_objdir" && \
$RM "${realname}T" && \
$MV "${realname}U" "$realname" )
fi
exit $lt_exit
}
done
IFS="$save_ifs"
# Restore the uninstalled library and exit
if test "$opt_mode" = relink; then
$opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
if test -n "$convenience"; then
if test -z "$whole_archive_flag_spec"; then
func_show_eval '${RM}r "$gentop"'
fi
fi
exit $EXIT_SUCCESS
fi
# Create links to the real library.
for linkname in $linknames; do
if test "$realname" != "$linkname"; then
func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
fi
done
# If -module or -export-dynamic was specified, set the dlname.
if test "$module" = yes || test "$export_dynamic" = yes; then
# On all known operating systems, these are identical.
dlname="$soname"
fi
fi
;;
obj)
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
func_warning "\`-dlopen' is ignored for objects"
fi
case " $deplibs" in
*\ -l* | *\ -L*)
func_warning "\`-l' and \`-L' are ignored for objects" ;;
esac
test -n "$rpath" && \
func_warning "\`-rpath' is ignored for objects"
test -n "$xrpath" && \
func_warning "\`-R' is ignored for objects"
test -n "$vinfo" && \
func_warning "\`-version-info' is ignored for objects"
test -n "$release" && \
func_warning "\`-release' is ignored for objects"
case $output in
*.lo)
test -n "$objs$old_deplibs" && \
func_fatal_error "cannot build library object \`$output' from non-libtool objects"
libobj=$output
func_lo2o "$libobj"
obj=$func_lo2o_result
;;
*)
libobj=
obj="$output"
;;
esac
# Delete the old objects.
$opt_dry_run || $RM $obj $libobj
# Objects from convenience libraries. This assumes
# single-version convenience libraries. Whenever we create
# different ones for PIC/non-PIC, this we'll have to duplicate
# the extraction.
reload_conv_objs=
gentop=
# reload_cmds runs $LD directly, so let us get rid of
# -Wl from whole_archive_flag_spec and hope we can get by with
# turning comma into space..
wl=
if test -n "$convenience"; then
if test -n "$whole_archive_flag_spec"; then
eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
else
gentop="$output_objdir/${obj}x"
func_append generated " $gentop"
func_extract_archives $gentop $convenience
reload_conv_objs="$reload_objs $func_extract_archives_result"
fi
fi
# If we're not building shared, we need to use non_pic_objs
test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
# Create the old-style object.
reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
output="$obj"
func_execute_cmds "$reload_cmds" 'exit $?'
# Exit if we aren't doing a library object file.
if test -z "$libobj"; then
if test -n "$gentop"; then
func_show_eval '${RM}r "$gentop"'
fi
exit $EXIT_SUCCESS
fi
if test "$build_libtool_libs" != yes; then
if test -n "$gentop"; then
func_show_eval '${RM}r "$gentop"'
fi
# Create an invalid libtool object if no PIC, so that we don't
# accidentally link it into a program.
# $show "echo timestamp > $libobj"
# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
exit $EXIT_SUCCESS
fi
if test -n "$pic_flag" || test "$pic_mode" != default; then
# Only do commands if we really have different PIC objects.
reload_objs="$libobjs $reload_conv_objs"
output="$libobj"
func_execute_cmds "$reload_cmds" 'exit $?'
fi
if test -n "$gentop"; then
func_show_eval '${RM}r "$gentop"'
fi
exit $EXIT_SUCCESS
;;
prog)
case $host in
*cygwin*) func_stripname '' '.exe' "$output"
output=$func_stripname_result.exe;;
esac
test -n "$vinfo" && \
func_warning "\`-version-info' is ignored for programs"
test -n "$release" && \
func_warning "\`-release' is ignored for programs"
test "$preload" = yes \
&& test "$dlopen_support" = unknown \
&& test "$dlopen_self" = unknown \
&& test "$dlopen_self_static" = unknown && \
func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
case $host in
*-*-rhapsody* | *-*-darwin1.[012])
# On Rhapsody replace the C library is the System framework
compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
;;
esac
case $host in
*-*-darwin*)
# Don't allow lazy linking, it breaks C++ global constructors
# But is supposedly fixed on 10.4 or later (yay!).
if test "$tagname" = CXX ; then
case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
10.[0123])
func_append compile_command " ${wl}-bind_at_load"
func_append finalize_command " ${wl}-bind_at_load"
;;
esac
fi
# Time to change all our "foo.ltframework" stuff back to "-framework foo"
compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
;;
esac
# move library search paths that coincide with paths to not yet
# installed libraries to the beginning of the library search list
new_libs=
for path in $notinst_path; do
case " $new_libs " in
*" -L$path/$objdir "*) ;;
*)
case " $compile_deplibs " in
*" -L$path/$objdir "*)
func_append new_libs " -L$path/$objdir" ;;
esac
;;
esac
done
for deplib in $compile_deplibs; do
case $deplib in
-L*)
case " $new_libs " in
*" $deplib "*) ;;
*) func_append new_libs " $deplib" ;;
esac
;;
*) func_append new_libs " $deplib" ;;
esac
done
compile_deplibs="$new_libs"
func_append compile_command " $compile_deplibs"
func_append finalize_command " $finalize_deplibs"
if test -n "$rpath$xrpath"; then
# If the user specified any rpath flags, then add them.
for libdir in $rpath $xrpath; do
# This is the magic to use -rpath.
case "$finalize_rpath " in
*" $libdir "*) ;;
*) func_append finalize_rpath " $libdir" ;;
esac
done
fi
# Now hardcode the library paths
rpath=
hardcode_libdirs=
for libdir in $compile_rpath $finalize_rpath; do
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
if test -z "$hardcode_libdirs"; then
hardcode_libdirs="$libdir"
else
# Just accumulate the unique libdirs.
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
;;
*)
func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
;;
esac
fi
else
eval flag=\"$hardcode_libdir_flag_spec\"
func_append rpath " $flag"
fi
elif test -n "$runpath_var"; then
case "$perm_rpath " in
*" $libdir "*) ;;
*) func_append perm_rpath " $libdir" ;;
esac
fi
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$libdir:"*) ;;
::) dllsearchpath=$libdir;;
*) func_append dllsearchpath ":$libdir";;
esac
case :$dllsearchpath: in
*":$testbindir:"*) ;;
::) dllsearchpath=$testbindir;;
*) func_append dllsearchpath ":$testbindir";;
esac
;;
esac
done
# Substitute the hardcoded libdirs into the rpath.
if test -n "$hardcode_libdir_separator" &&
test -n "$hardcode_libdirs"; then
libdir="$hardcode_libdirs"
eval rpath=\" $hardcode_libdir_flag_spec\"
fi
compile_rpath="$rpath"
rpath=
hardcode_libdirs=
for libdir in $finalize_rpath; do
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
if test -z "$hardcode_libdirs"; then
hardcode_libdirs="$libdir"
else
# Just accumulate the unique libdirs.
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
;;
*)
func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
;;
esac
fi
else
eval flag=\"$hardcode_libdir_flag_spec\"
func_append rpath " $flag"
fi
elif test -n "$runpath_var"; then
case "$finalize_perm_rpath " in
*" $libdir "*) ;;
*) func_append finalize_perm_rpath " $libdir" ;;
esac
fi
done
# Substitute the hardcoded libdirs into the rpath.
if test -n "$hardcode_libdir_separator" &&
test -n "$hardcode_libdirs"; then
libdir="$hardcode_libdirs"
eval rpath=\" $hardcode_libdir_flag_spec\"
fi
finalize_rpath="$rpath"
if test -n "$libobjs" && test "$build_old_libs" = yes; then
# Transform all the library objects into standard objects.
compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
fi
func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
# template prelinking step
if test -n "$prelink_cmds"; then
func_execute_cmds "$prelink_cmds" 'exit $?'
fi
wrappers_required=yes
case $host in
*cegcc* | *mingw32ce*)
# Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
wrappers_required=no
;;
*cygwin* | *mingw* )
if test "$build_libtool_libs" != yes; then
wrappers_required=no
fi
;;
*)
if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
wrappers_required=no
fi
;;
esac
if test "$wrappers_required" = no; then
# Replace the output file specification.
compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
link_command="$compile_command$compile_rpath"
# We have no uninstalled library dependencies, so finalize right now.
exit_status=0
func_show_eval "$link_command" 'exit_status=$?'
if test -n "$postlink_cmds"; then
func_to_tool_file "$output"
postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
func_execute_cmds "$postlink_cmds" 'exit $?'
fi
# Delete the generated files.
if test -f "$output_objdir/${outputname}S.${objext}"; then
func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
fi
exit $exit_status
fi
if test -n "$compile_shlibpath$finalize_shlibpath"; then
compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
fi
if test -n "$finalize_shlibpath"; then
finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
fi
compile_var=
finalize_var=
if test -n "$runpath_var"; then
if test -n "$perm_rpath"; then
# We should set the runpath_var.
rpath=
for dir in $perm_rpath; do
func_append rpath "$dir:"
done
compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
fi
if test -n "$finalize_perm_rpath"; then
# We should set the runpath_var.
rpath=
for dir in $finalize_perm_rpath; do
func_append rpath "$dir:"
done
finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
fi
fi
if test "$no_install" = yes; then
# We don't need to create a wrapper script.
link_command="$compile_var$compile_command$compile_rpath"
# Replace the output file specification.
link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
# Delete the old output file.
$opt_dry_run || $RM $output
# Link the executable and exit
func_show_eval "$link_command" 'exit $?'
if test -n "$postlink_cmds"; then
func_to_tool_file "$output"
postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
func_execute_cmds "$postlink_cmds" 'exit $?'
fi
exit $EXIT_SUCCESS
fi
if test "$hardcode_action" = relink; then
# Fast installation is not supported
link_command="$compile_var$compile_command$compile_rpath"
relink_command="$finalize_var$finalize_command$finalize_rpath"
func_warning "this platform does not like uninstalled shared libraries"
func_warning "\`$output' will be relinked during installation"
else
if test "$fast_install" != no; then
link_command="$finalize_var$compile_command$finalize_rpath"
if test "$fast_install" = yes; then
relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
else
# fast_install is set to needless
relink_command=
fi
else
link_command="$compile_var$compile_command$compile_rpath"
relink_command="$finalize_var$finalize_command$finalize_rpath"
fi
fi
# Replace the output file specification.
link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
# Delete the old output files.
$opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
func_show_eval "$link_command" 'exit $?'
if test -n "$postlink_cmds"; then
func_to_tool_file "$output_objdir/$outputname"
postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
func_execute_cmds "$postlink_cmds" 'exit $?'
fi
# Now create the wrapper script.
func_verbose "creating $output"
# Quote the relink command for shipping.
if test -n "$relink_command"; then
# Preserve any variables that may affect compiler behavior
for var in $variables_saved_for_relink; do
if eval test -z \"\${$var+set}\"; then
relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
elif eval var_value=\$$var; test -z "$var_value"; then
relink_command="$var=; export $var; $relink_command"
else
func_quote_for_eval "$var_value"
relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
fi
done
relink_command="(cd `pwd`; $relink_command)"
relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
fi
# Only actually do things if not in dry run mode.
$opt_dry_run || {
# win32 will think the script is a binary if it has
# a .exe suffix, so we strip it off here.
case $output in
*.exe) func_stripname '' '.exe' "$output"
output=$func_stripname_result ;;
esac
# test for cygwin because mv fails w/o .exe extensions
case $host in
*cygwin*)
exeext=.exe
func_stripname '' '.exe' "$outputname"
outputname=$func_stripname_result ;;
*) exeext= ;;
esac
case $host in
*cygwin* | *mingw* )
func_dirname_and_basename "$output" "" "."
output_name=$func_basename_result
output_path=$func_dirname_result
cwrappersource="$output_path/$objdir/lt-$output_name.c"
cwrapper="$output_path/$output_name.exe"
$RM $cwrappersource $cwrapper
trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
func_emit_cwrapperexe_src > $cwrappersource
# The wrapper executable is built using the $host compiler,
# because it contains $host paths and files. If cross-
# compiling, it, like the target executable, must be
# executed on the $host or under an emulation environment.
$opt_dry_run || {
$LTCC $LTCFLAGS -o $cwrapper $cwrappersource
$STRIP $cwrapper
}
# Now, create the wrapper script for func_source use:
func_ltwrapper_scriptname $cwrapper
$RM $func_ltwrapper_scriptname_result
trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
$opt_dry_run || {
# note: this script will not be executed, so do not chmod.
if test "x$build" = "x$host" ; then
$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
else
func_emit_wrapper no > $func_ltwrapper_scriptname_result
fi
}
;;
* )
$RM $output
trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
func_emit_wrapper no > $output
chmod +x $output
;;
esac
}
exit $EXIT_SUCCESS
;;
esac
# See if we need to build an old-fashioned archive.
for oldlib in $oldlibs; do
if test "$build_libtool_libs" = convenience; then
oldobjs="$libobjs_save $symfileobj"
addlibs="$convenience"
build_libtool_libs=no
else
if test "$build_libtool_libs" = module; then
oldobjs="$libobjs_save"
build_libtool_libs=no
else
oldobjs="$old_deplibs $non_pic_objects"
if test "$preload" = yes && test -f "$symfileobj"; then
func_append oldobjs " $symfileobj"
fi
fi
addlibs="$old_convenience"
fi
if test -n "$addlibs"; then
gentop="$output_objdir/${outputname}x"
func_append generated " $gentop"
func_extract_archives $gentop $addlibs
func_append oldobjs " $func_extract_archives_result"
fi
# Do each command in the archive commands.
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
cmds=$old_archive_from_new_cmds
else
# Add any objects from preloaded convenience libraries
if test -n "$dlprefiles"; then
gentop="$output_objdir/${outputname}x"
func_append generated " $gentop"
func_extract_archives $gentop $dlprefiles
func_append oldobjs " $func_extract_archives_result"
fi
# POSIX demands no paths to be encoded in archives. We have
# to avoid creating archives with duplicate basenames if we
# might have to extract them afterwards, e.g., when creating a
# static archive out of a convenience library, or when linking
# the entirety of a libtool archive into another (currently
# not supported by libtool).
if (for obj in $oldobjs
do
func_basename "$obj"
$ECHO "$func_basename_result"
done | sort | sort -uc >/dev/null 2>&1); then
:
else
echo "copying selected object files to avoid basename conflicts..."
gentop="$output_objdir/${outputname}x"
func_append generated " $gentop"
func_mkdir_p "$gentop"
save_oldobjs=$oldobjs
oldobjs=
counter=1
for obj in $save_oldobjs
do
func_basename "$obj"
objbase="$func_basename_result"
case " $oldobjs " in
" ") oldobjs=$obj ;;
*[\ /]"$objbase "*)
while :; do
# Make sure we don't pick an alternate name that also
# overlaps.
newobj=lt$counter-$objbase
func_arith $counter + 1
counter=$func_arith_result
case " $oldobjs " in
*[\ /]"$newobj "*) ;;
*) if test ! -f "$gentop/$newobj"; then break; fi ;;
esac
done
func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
func_append oldobjs " $gentop/$newobj"
;;
*) func_append oldobjs " $obj" ;;
esac
done
fi
eval cmds=\"$old_archive_cmds\"
func_len " $cmds"
len=$func_len_result
if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
cmds=$old_archive_cmds
elif test -n "$archiver_list_spec"; then
func_verbose "using command file archive linking..."
for obj in $oldobjs
do
func_to_tool_file "$obj"
$ECHO "$func_to_tool_file_result"
done > $output_objdir/$libname.libcmd
func_to_tool_file "$output_objdir/$libname.libcmd"
oldobjs=" $archiver_list_spec$func_to_tool_file_result"
cmds=$old_archive_cmds
else
# the command line is too long to link in one step, link in parts
func_verbose "using piecewise archive linking..."
save_RANLIB=$RANLIB
RANLIB=:
objlist=
concat_cmds=
save_oldobjs=$oldobjs
oldobjs=
# Is there a better way of finding the last object in the list?
for obj in $save_oldobjs
do
last_oldobj=$obj
done
eval test_cmds=\"$old_archive_cmds\"
func_len " $test_cmds"
len0=$func_len_result
len=$len0
for obj in $save_oldobjs
do
func_len " $obj"
func_arith $len + $func_len_result
len=$func_arith_result
func_append objlist " $obj"
if test "$len" -lt "$max_cmd_len"; then
:
else
# the above command should be used before it gets too long
oldobjs=$objlist
if test "$obj" = "$last_oldobj" ; then
RANLIB=$save_RANLIB
fi
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
objlist=
len=$len0
fi
done
RANLIB=$save_RANLIB
oldobjs=$objlist
if test "X$oldobjs" = "X" ; then
eval cmds=\"\$concat_cmds\"
else
eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
fi
fi
fi
func_execute_cmds "$cmds" 'exit $?'
done
test -n "$generated" && \
func_show_eval "${RM}r$generated"
# Now create the libtool archive.
case $output in
*.la)
old_library=
test "$build_old_libs" = yes && old_library="$libname.$libext"
func_verbose "creating $output"
# Preserve any variables that may affect compiler behavior
for var in $variables_saved_for_relink; do
if eval test -z \"\${$var+set}\"; then
relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
elif eval var_value=\$$var; test -z "$var_value"; then
relink_command="$var=; export $var; $relink_command"
else
func_quote_for_eval "$var_value"
relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
fi
done
# Quote the link command for shipping.
relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
if test "$hardcode_automatic" = yes ; then
relink_command=
fi
# Only create the output if not a dry run.
$opt_dry_run || {
for installed in no yes; do
if test "$installed" = yes; then
if test -z "$install_libdir"; then
break
fi
output="$output_objdir/$outputname"i
# Replace all uninstalled libtool libraries with the installed ones
newdependency_libs=
for deplib in $dependency_libs; do
case $deplib in
*.la)
func_basename "$deplib"
name="$func_basename_result"
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
test -z "$libdir" && \
func_fatal_error "\`$deplib' is not a valid libtool archive"
func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
;;
-L*)
func_stripname -L '' "$deplib"
func_replace_sysroot "$func_stripname_result"
func_append newdependency_libs " -L$func_replace_sysroot_result"
;;
-R*)
func_stripname -R '' "$deplib"
func_replace_sysroot "$func_stripname_result"
func_append newdependency_libs " -R$func_replace_sysroot_result"
;;
*) func_append newdependency_libs " $deplib" ;;
esac
done
dependency_libs="$newdependency_libs"
newdlfiles=
for lib in $dlfiles; do
case $lib in
*.la)
func_basename "$lib"
name="$func_basename_result"
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
test -z "$libdir" && \
func_fatal_error "\`$lib' is not a valid libtool archive"
func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
;;
*) func_append newdlfiles " $lib" ;;
esac
done
dlfiles="$newdlfiles"
newdlprefiles=
for lib in $dlprefiles; do
case $lib in
*.la)
# Only pass preopened files to the pseudo-archive (for
# eventual linking with the app. that links it) if we
# didn't already link the preopened objects directly into
# the library:
func_basename "$lib"
name="$func_basename_result"
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
test -z "$libdir" && \
func_fatal_error "\`$lib' is not a valid libtool archive"
func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
;;
esac
done
dlprefiles="$newdlprefiles"
else
newdlfiles=
for lib in $dlfiles; do
case $lib in
[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
*) abs=`pwd`"/$lib" ;;
esac
func_append newdlfiles " $abs"
done
dlfiles="$newdlfiles"
newdlprefiles=
for lib in $dlprefiles; do
case $lib in
[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
*) abs=`pwd`"/$lib" ;;
esac
func_append newdlprefiles " $abs"
done
dlprefiles="$newdlprefiles"
fi
$RM $output
# place dlname in correct position for cygwin
# In fact, it would be nice if we could use this code for all target
# systems that can't hard-code library paths into their executables
# and that have no shared library path variable independent of PATH,
# but it turns out we can't easily determine that from inspecting
# libtool variables, so we have to hard-code the OSs to which it
# applies here; at the moment, that means platforms that use the PE
# object format with DLL files. See the long comment at the top of
# tests/bindir.at for full details.
tdlname=$dlname
case $host,$output,$installed,$module,$dlname in
*cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
# If a -bindir argument was supplied, place the dll there.
if test "x$bindir" != x ;
then
func_relative_path "$install_libdir" "$bindir"
tdlname=$func_relative_path_result$dlname
else
# Otherwise fall back on heuristic.
tdlname=../bin/$dlname
fi
;;
esac
$ECHO > $output "\
# $outputname - a libtool library file
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='$tdlname'
# Names of this library.
library_names='$library_names'
# The name of the static archive.
old_library='$old_library'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags='$new_inherited_linker_flags'
# Libraries that this one depends upon.
dependency_libs='$dependency_libs'
# Names of additional weak libraries provided by this library
weak_library_names='$weak_libs'
# Version information for $libname.
current=$current
age=$age
revision=$revision
# Is this an already installed library?
installed=$installed
# Should we warn about portability when linking against -modules?
shouldnotlink=$module
# Files to dlopen/dlpreopen
dlopen='$dlfiles'
dlpreopen='$dlprefiles'
# Directory that this library needs to be installed in:
libdir='$install_libdir'"
if test "$installed" = no && test "$need_relink" = yes; then
$ECHO >> $output "\
relink_command=\"$relink_command\""
fi
done
}
# Do a symbolic link so that the libtool archive can be found in
# LD_LIBRARY_PATH before the program is installed.
func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
;;
esac
exit $EXIT_SUCCESS
}
{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
func_mode_link ${1+"$@"}
# func_mode_uninstall arg...
func_mode_uninstall ()
{
$opt_debug
RM="$nonopt"
files=
rmforce=
exit_status=0
# This variable tells wrapper scripts just to set variables rather
# than running their programs.
libtool_install_magic="$magic"
for arg
do
case $arg in
-f) func_append RM " $arg"; rmforce=yes ;;
-*) func_append RM " $arg" ;;
*) func_append files " $arg" ;;
esac
done
test -z "$RM" && \
func_fatal_help "you must specify an RM program"
rmdirs=
for file in $files; do
func_dirname "$file" "" "."
dir="$func_dirname_result"
if test "X$dir" = X.; then
odir="$objdir"
else
odir="$dir/$objdir"
fi
func_basename "$file"
name="$func_basename_result"
test "$opt_mode" = uninstall && odir="$dir"
# Remember odir for removal later, being careful to avoid duplicates
if test "$opt_mode" = clean; then
case " $rmdirs " in
*" $odir "*) ;;
*) func_append rmdirs " $odir" ;;
esac
fi
# Don't error if the file doesn't exist and rm -f was used.
if { test -L "$file"; } >/dev/null 2>&1 ||
{ test -h "$file"; } >/dev/null 2>&1 ||
test -f "$file"; then
:
elif test -d "$file"; then
exit_status=1
continue
elif test "$rmforce" = yes; then
continue
fi
rmfiles="$file"
case $name in
*.la)
# Possibly a libtool archive, so verify it.
if func_lalib_p "$file"; then
func_source $dir/$name
# Delete the libtool libraries and symlinks.
for n in $library_names; do
func_append rmfiles " $odir/$n"
done
test -n "$old_library" && func_append rmfiles " $odir/$old_library"
case "$opt_mode" in
clean)
case " $library_names " in
*" $dlname "*) ;;
*) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
esac
test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
;;
uninstall)
if test -n "$library_names"; then
# Do each command in the postuninstall commands.
func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
fi
if test -n "$old_library"; then
# Do each command in the old_postuninstall commands.
func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
fi
# FIXME: should reinstall the best remaining shared library.
;;
esac
fi
;;
*.lo)
# Possibly a libtool object, so verify it.
if func_lalib_p "$file"; then
# Read the .lo file
func_source $dir/$name
# Add PIC object to the list of files to remove.
if test -n "$pic_object" &&
test "$pic_object" != none; then
func_append rmfiles " $dir/$pic_object"
fi
# Add non-PIC object to the list of files to remove.
if test -n "$non_pic_object" &&
test "$non_pic_object" != none; then
func_append rmfiles " $dir/$non_pic_object"
fi
fi
;;
*)
if test "$opt_mode" = clean ; then
noexename=$name
case $file in
*.exe)
func_stripname '' '.exe' "$file"
file=$func_stripname_result
func_stripname '' '.exe' "$name"
noexename=$func_stripname_result
# $file with .exe has already been added to rmfiles,
# add $file without .exe
func_append rmfiles " $file"
;;
esac
# Do a test to see if this is a libtool program.
if func_ltwrapper_p "$file"; then
if func_ltwrapper_executable_p "$file"; then
func_ltwrapper_scriptname "$file"
relink_command=
func_source $func_ltwrapper_scriptname_result
func_append rmfiles " $func_ltwrapper_scriptname_result"
else
relink_command=
func_source $dir/$noexename
fi
# note $name still contains .exe if it was in $file originally
# as does the version of $file that was added into $rmfiles
func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
if test "$fast_install" = yes && test -n "$relink_command"; then
func_append rmfiles " $odir/lt-$name"
fi
if test "X$noexename" != "X$name" ; then
func_append rmfiles " $odir/lt-${noexename}.c"
fi
fi
fi
;;
esac
func_show_eval "$RM $rmfiles" 'exit_status=1'
done
# Try to remove the ${objdir}s in the directories where we deleted files
for dir in $rmdirs; do
if test -d "$dir"; then
func_show_eval "rmdir $dir >/dev/null 2>&1"
fi
done
exit $exit_status
}
{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
func_mode_uninstall ${1+"$@"}
test -z "$opt_mode" && {
help="$generic_help"
func_fatal_help "you must specify a MODE"
}
test -z "$exec_cmd" && \
func_fatal_help "invalid operation mode \`$opt_mode'"
if test -n "$exec_cmd"; then
eval exec "$exec_cmd"
exit $EXIT_FAILURE
fi
exit $exit_status
# The TAGs below are defined such that we never get into a situation
# in which we disable both kinds of libraries. Given conflicting
# choices, we go for a static library, that is the most portable,
# since we can't tell whether shared libraries were disabled because
# the user asked for that or because the platform doesn't support
# them. This is particularly important on AIX, because we don't
# support having both static and shared libraries enabled at the same
# time on that platform, so we default to a shared-only configuration.
# If a disable-shared tag is given, we'll fallback to a static-only
# configuration. But we'll never go from static-only to shared-only.
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
build_libtool_libs=no
build_old_libs=yes
# ### END LIBTOOL TAG CONFIG: disable-shared
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
# ### END LIBTOOL TAG CONFIG: disable-static
# Local Variables:
# mode:shell-script
# sh-indentation:2
# End:
# vi:sw=2
libmng-2.0.3/libmng_write.h 0000644 0001750 0001750 00000005642 12005307152 015515 0 ustar glennrp glennrp /* ************************************************************************** */
/* * For conditions of distribution and use, * */
/* * see copyright notice in libmng.h * */
/* ************************************************************************** */
/* * * */
/* * project : libmng * */
/* * file : libmng_write.h copyright (c) 2000-2004 G.Juyn * */
/* * version : 1.0.9 * */
/* * * */
/* * purpose : Write management (definition) * */
/* * * */
/* * author : G.Juyn * */
/* * * */
/* * comment : Definition of the write management routines * */
/* * * */
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
/* * - changed strict-ANSI stuff * */
/* * * */
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 1.0.5 - 08/19/2002 - G.Juyn * */
/* * - B597134 - libmng pollutes the linker namespace * */
/* * * */
/* * 1.0.9 - 09/25/2004 - G.Juyn * */
/* * - replaced MNG_TWEAK_LARGE_FILES with permanent solution * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
#pragma option -A /* force ANSI-C */
#endif
#ifndef _libmng_write_h_
#define _libmng_write_h_
/* ************************************************************************** */
mng_retcode mng_drop_chunks (mng_datap pData);
mng_retcode mng_write_graphic (mng_datap pData);
/* ************************************************************************** */
#endif /* _libmng_write_h_ */
/* ************************************************************************** */
/* * end of file * */
/* ************************************************************************** */
libmng-2.0.3/Makefile.am 0000644 0001750 0001750 00000002601 12115357037 014717 0 ustar glennrp glennrp ## Process this file with automake to produce Makefile.in
MAINTAINERCLEANFILES = Makefile.in
ACLOCAL_AMFLAGS = -I m4
AUTOMAKE_OPTIONS = 1.3 foreign no-dependencies
# include the app subdirectories in the distribution
EXTRA_DIST = makefiles doc contrib
# libmng release @VERSION@
libmng_la_LDFLAGS = \
-version-number @MNG_MAJOR_NR@:@MNG_MINOR_NR@:@MNG_RELEASE_NR@
lib_LTLIBRARIES = libmng.la
include_HEADERS = libmng.h libmng_conf.h libmng_types.h
noinst_HEADERS = libmng_chunk_io.h libmng_chunk_prc.h libmng_chunks.h \
libmng_cms.h libmng_data.h libmng_display.h libmng_dither.h \
libmng_error.h libmng_filter.h libmng_jpeg.h libmng_memory.h \
libmng_object_prc.h libmng_objects.h libmng_pixels.h \
libmng_read.h libmng_trace.h libmng_write.h libmng_zlib.h
libmng_la_SOURCES = libmng_callback_xs.c libmng_chunk_io.c \
libmng_chunk_prc.c libmng_chunk_xs.c libmng_cms.c \
libmng_display.c libmng_dither.c libmng_error.c \
libmng_filter.c libmng_hlapi.c libmng_jpeg.c \
libmng_object_prc.c libmng_pixels.c libmng_prop_xs.c \
libmng_read.c libmng_trace.c libmng_write.c libmng_zlib.c
man_MANS = doc/man/libmng.3 doc/man/jng.5 doc/man/mng.5
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libmng.pc
uninstall-hook:
rm -f $(DESTDIR)$(pkgconfigdir)/libmng.pc
rm -f $(DESTDIR)$(includedir)/libmng.h
rm -f $(DESTDIR)$(includedir)/libmng_conf.h
rm -f $(DESTDIR)$(includedir)/libmng_types.h
libmng-2.0.3/libmng.h 0000644 0001750 0001750 00000533034 12515247260 014315 0 ustar glennrp glennrp /* ************************************************************************** */
/* * * */
/* * COPYRIGHT NOTICE: * */
/* * * */
/* * Copyright (c) 2000-2007 Gerard Juyn * */
/* * [You may insert additional notices after this sentence if you modify * */
/* * this source] * */
/* * * */
/* * For the purposes of this copyright and license, "Contributing Authors" * */
/* * is defined as the following set of individuals: * */
/* * * */
/* * Gerard Juyn - gjuyn :at: users.sourceforge.net * */
/* * Glenn Randers-Pehrson - glennrp :at: users.sourceforge.net * */
/* * Raphael Assenat - raph :at: raphnet.net * */
/* * John Stiles - * */
/* * * */
/* * The MNG Library is supplied "AS IS". The Contributing Authors * */
/* * disclaim all warranties, expressed or implied, including, without * */
/* * limitation, the warranties of merchantability and of fitness for any * */
/* * purpose. The Contributing Authors assume no liability for direct, * */
/* * indirect, incidental, special, exemplary, or consequential damages, * */
/* * which may result from the use of the MNG Library, even if advised of * */
/* * the possibility of such damage. * */
/* * * */
/* * Permission is hereby granted to use, copy, modify, and distribute this * */
/* * source code, or portions hereof, for any purpose, without fee, subject * */
/* * to the following restrictions: * */
/* * * */
/* * 1. The origin of this source code must not be misrepresented; * */
/* * you must not claim that you wrote the original software. * */
/* * * */
/* * 2. Altered versions must be plainly marked as such and must not be * */
/* * misrepresented as being the original source. * */
/* * * */
/* * 3. This Copyright notice may not be removed or altered from any source * */
/* * or altered source distribution. * */
/* * * */
/* * The Contributing Authors specifically permit, without fee, and * */
/* * encourage the use of this source code as a component to supporting * */
/* * the MNG and JNG file format in commercial products. If you use this * */
/* * source code in a product, acknowledgment would be highly appreciated. * */
/* * * */
/* ************************************************************************** */
/* * * */
/* * Parts of this software have been adapted from the libpng package. * */
/* * Although this library supports all features from the PNG specification * */
/* * (as MNG descends from it) it does not require the libpng package. * */
/* * It does require the zlib library and optionally the IJG jpeg library, * */
/* * and/or the "little-cms" library by Marti Maria (depending on the * */
/* * inclusion of support for JNG and Full-Color-Management respectively. * */
/* * * */
/* * This library's function is primarily to read and display MNG * */
/* * animations. It is not meant as a full-featured image-editing * */
/* * component! It does however offer creation and editing functionality * */
/* * at the chunk level. * */
/* * (future modifications may include some more support for creation * */
/* * and or editing) * */
/* * * */
/* ************************************************************************** */
/* ************************************************************************** */
/* * * */
/* * Version numbering * */
/* * * */
/* * X.Y.Z : X = release (0 = initial build) * */
/* * Y = major version (uneven = test; even = production) * */
/* * Z = minor version (bugfixes; 2 is older than 10) * */
/* * * */
/* * production versions only appear when a test-version is extensively * */
/* * tested and found stable or for intermediate bug-fixes (recognized by * */
/* * a change in the Z number) * */
/* * * */
/* * x.1.x = test version * */
/* * x.2.x = production version * */
/* * x.3.x = test version * */
/* * x.4.x = production version * */
/* * etc. * */
/* * * */
/* ************************************************************************** */
/* * * */
/* * Identifier naming conventions throughout this library * */
/* * * */
/* * iXxxx = an integer * */
/* * dXxxx = a float * */
/* * pXxxx = a pointer * */
/* * bXxxx = a boolean * */
/* * eXxxx = an enumeration * */
/* * hXxxx = a handle * */
/* * zXxxx = a zero-terminated string (pchar) * */
/* * fXxxx = a pointer to a function (callback) * */
/* * aXxxx = an array * */
/* * sXxxx = a structure * */
/* * * */
/* * Macros & defines are in all uppercase. * */
/* * Functions & typedefs in all lowercase. * */
/* * Exported stuff is prefixed with MNG_ or mng_ respectively. * */
/* * * */
/* * (I may have missed a couple; don't hesitate to let me know!) * */
/* * * */
/* ************************************************************************** */
/* ************************************************************************** */
/* * * */
/* * project : libmng * */
/* * file : libmng.h copyright (c) 2000-2007 G.Juyn * */
/* * version : 1.0.10 * */
/* * * */
/* * purpose : main application interface * */
/* * * */
/* * author : G.Juyn * */
/* * * */
/* * comment : The main application interface. An application should not * */
/* * need access to any of the other modules! * */
/* * * */
/* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */
/* * - changed chunk iteration function * */
/* * 0.5.1 - 05/08/2000 - G.Juyn * */
/* * - added chunk access functions * */
/* * - added version control constants & functions * */
/* * - changed strict-ANSI stuff * */
/* * 0.5.1 - 05/11/2000 - G.Juyn * */
/* * - added set_outputprofile2 & set_srgbprofile2 * */
/* * - added empty-chunk put-routines * */
/* * 0.5.1 - 05/12/2000 - G.Juyn * */
/* * - added version_dll & VERSION_DLL (for consistency) * */
/* * - added version control explanatory text & samples * */
/* * 0.5.1 - 05/15/2000 - G.Juyn * */
/* * - added getimgdata & putimgdata functions * */
/* * * */
/* * 0.5.2 - 05/16/2000 - G.Juyn * */
/* * - changed the version parameters (obviously) * */
/* * 0.5.2 - 05/18/2000 - G.Juyn * */
/* * - complimented constants for chunk-property values * */
/* * 0.5.2 - 05/23/2000 - G.Juyn * */
/* * - fixed MNG_UINT_pHYg value * */
/* * 0.5.2 - 05/24/2000 - G.Juyn * */
/* * - added support for get/set default zlib/IJG parms * */
/* * 0.5.2 - 06/02/2000 - G.Juyn * */
/* * - added MNG_BIGENDIAN_SUPPORT (contributed by Tim Rowley) * */
/* * - separated configuration-options into "mng_conf.h" * */
/* * - added RGB8_A8 canvasstyle * */
/* * - added getalphaline callback for RGB8_A8 canvasstyle * */
/* * 0.5.2 - 06/06/2000 - G.Juyn * */
/* * - moved errorcodes from "mng_error.h" * */
/* * - added mng_read_resume function to support * */
/* * read-suspension * */
/* * * */
/* * 0.5.3 - 06/16/2000 - G.Juyn * */
/* * - changed the version parameters (obviously) * */
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
/* * - added get/set for speedtype to facilitate testing * */
/* * - added get for imagelevel during processtext callback * */
/* * 0.5.3 - 06/24/2000 - G.Juyn * */
/* * - fixed inclusion of IJG read/write code * */
/* * 0.5.3 - 06/26/2000 - G.Juyn * */
/* * - changed userdata variable to mng_ptr * */
/* * * */
/* * 0.9.0 - 06/30/2000 - G.Juyn * */
/* * - changed refresh parameters to 'x,y,width,height' * */
/* * * */
/* * 0.9.1 - 07/06/2000 - G.Juyn * */
/* * - added MNG_NEEDTIMERWAIT errorcode * */
/* * - changed comments to indicate modified behavior for * */
/* * timer & suspension breaks * */
/* * 0.9.1 - 07/08/2000 - G.Juyn * */
/* * - added get routines for internal display variables * */
/* * - added get/set routines for suspensionmode variable * */
/* * 0.9.1 - 07/15/2000 - G.Juyn * */
/* * - added callbacks for SAVE/SEEK processing * */
/* * - added get/set routines for sectionbreak variable * */
/* * - added NEEDSECTIONWAIT errorcode * */
/* * 0.9.1 - 07/19/2000 - G.Juyn * */
/* * - added function to set frame-/layer-count & playtime * */
/* * - added errorcode for updatemngheader if not a MNG * */
/* * * */
/* * 0.9.2 - 07/31/2000 - G.Juyn * */
/* * - fixed problem with trace-functions improperly wrapped * */
/* * - added status_xxxx functions * */
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - 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 * */
/* * * */
/* * 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!) * */
/* * * */
/* * 1.0.2 - 06/23/2001 - G.Juyn * */
/* * - added optimization option for MNG-video playback * */
/* * - added processterm callback * */
/* * 1.0.2 - 06/25/2001 - G.Juyn * */
/* * - added late binding errorcode (not used internally) * */
/* * - added option to turn off progressive refresh * */
/* * * */
/* * 1.0.3 - 08/06/2001 - G.Juyn * */
/* * - added get function for last processed BACK chunk * */
/* * * */
/* * 1.0.5 - 07/04/2002 - G.Juyn * */
/* * - added errorcode for extreme chunk-sizes * */
/* * 1.0.5 - 08/07/2002 - G.Juyn * */
/* * - added test-option for PNG filter method 193 (=no filter) * */
/* * 1.0.5 - 08/15/2002 - G.Juyn * */
/* * - completed PROM support * */
/* * - completed delta-image support * */
/* * 1.0.5 - 08/19/2002 - G.Juyn * */
/* * - added HLAPI function to copy chunks * */
/* * 1.0.5 - 09/14/2002 - G.Juyn * */
/* * - added event handling for dynamic MNG * */
/* * - added 'supports' call to check function availability * */
/* * 1.0.5 - 09/15/2002 - G.Juyn * */
/* * - fixed LOOP iteration=0 special case * */
/* * 1.0.5 - 09/20/2002 - G.Juyn * */
/* * - added support for PAST * */
/* * 1.0.5 - 09/22/2002 - G.Juyn * */
/* * - added bgrx8 canvas (filler byte) * */
/* * 1.0.5 - 10/07/2002 - G.Juyn * */
/* * - added check for TERM placement during create/write * */
/* * - added beta version function & constant * */
/* * 1.0.5 - 11/07/2002 - G.Juyn * */
/* * - added support to get totals after mng_read() * */
/* * * */
/* * 1.0.6 - 07/07/2003 - G. Randers-Pehrson * */
/* * - added support for reducing the footprint of libmng * */
/* * by macros that optionally skip unused chunks, remove * */
/* * 16-bit sample support, remove Delta support, and * */
/* * remove JNG support, to accomodate Mozilla/Firebird. * */
/* * 1.0.6 - 07/14/2003 - G. Randers-Pehrson * */
/* * - further optional removal of unused functions * */
/* * * */
/* * 1.0.7 - 11/27/2003 - R.A * */
/* * - added CANVAS_RGB565 and CANVAS_BGR565 * */
/* * 1.0.7 - 12/06/2003 - R.A * */
/* * - added CANVAS_RGBA565 and CANVAS_BGRA565 * */
/* * 1.0.7 - 01/25/2004 - J.S * */
/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */
/* * 1.0.7 - 03/07/2004 - G. Randers-Pehrson * */
/* * - put gamma, cms-related declarations inside #ifdef * */
/* * 1.0.7 - 03/10/2004 - G.R-P * */
/* * - added conditionals around openstream/closestream * */
/* * * */
/* * 1.0.8 - 04/02/2004 - G.Juyn * */
/* * - added CRC existence & checking flags * */
/* * 1.0.8 - 04/12/2004 - G.Juyn * */
/* * - added data-push mechanisms for specialized decoders * */
/* * 1.0.8 - 06/05/2004 - G.R-P * */
/* * - define MNG_INCLUDE_ZLIB when MNG_USE_ZLIB_CRC is defined * */
/* * * */
/* * 1.0.9 - 10/03/2004 - G.Juyn * */
/* * - added function to retrieve current FRAM delay * */
/* * 1.0.9 - 10/14/2004 - G.Juyn * */
/* * - added bgr565_a8 canvas-style (thanks to J. Elvander) * */
/* * 1.0.9 - 10/17/2004 - G.Juyn * */
/* * - fixed PPLT getchunk/putchunk routines * */
/* * * */
/* * 1.0.10 - 03/07/2006 - (thanks to W. Manthey) * */
/* * - added CANVAS_RGB555 and CANVAS_BGR555 * */
/* * 1.0.10 - 04/08/2007 - G.Juyn * */
/* * - added support for mPNG proposal * */
/* * 1.0.10 - 04/12/2007 - G.Juyn * */
/* * - added support for ANG proposal * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
#pragma option -A /* force ANSI-C */
#endif
#ifndef _libmng_h_
#define _libmng_h_
/* ************************************************************************** */
#include "libmng_conf.h" /* user-specific configuration options */
/* ************************************************************************** */
#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
#ifdef MNG_SUPPORT_WRITE
#define MNG_INCLUDE_WRITE_PROCS
#endif
#ifdef MNG_USE_ZLIB_CRC
#define MNG_INCLUDE_ZLIB
#endif
#ifdef MNG_SUPPORT_DISPLAY
#define MNG_INCLUDE_FILTERS
#define MNG_INCLUDE_INTERLACE
#define MNG_INCLUDE_OBJECTS
#define MNG_INCLUDE_DISPLAY_PROCS
#define MNG_INCLUDE_TIMING_PROCS
#define MNG_INCLUDE_ZLIB
#endif
#ifdef MNG_STORE_CHUNKS
#define MNG_INCLUDE_ZLIB
#endif
#ifdef MNG_SUPPORT_IJG6B
#define MNG_INCLUDE_JNG
#define MNG_INCLUDE_IJG6B
#define MNG_USE_SETJMP
#endif
#ifdef MNG_INCLUDE_JNG
#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_ACCESS_CHUNKS)
#define MNG_INCLUDE_JNG_READ
#endif
#if defined(MNG_SUPPORT_WRITE) || defined(MNG_ACCESS_CHUNKS)
#define MNG_INCLUDE_JNG_WRITE
#endif
#endif
#ifdef MNG_FULL_CMS
#define MNG_INCLUDE_LCMS
#endif
#ifdef MNG_AUTO_DITHER
#define MNG_INCLUDE_DITHERING
#endif
#ifdef MNG_SUPPORT_TRACE
#define MNG_INCLUDE_TRACE_PROCS
#ifdef MNG_TRACE_TELLTALE
#define MNG_INCLUDE_TRACE_STRINGS
#endif
#endif
#ifdef MNG_ERROR_TELLTALE
#define MNG_INCLUDE_ERROR_STRINGS
#endif
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
#ifndef MNG_OPTIMIZE_CHUNKACCESS
#define MNG_OPTIMIZE_CHUNKACCESS
#endif
#else
#ifdef MNG_OPTIMIZE_CHUNKACCESS
#undef MNG_OPTIMIZE_CHUNKACCESS
#endif
#endif
/* ************************************************************************** */
#include "libmng_types.h" /* platform-specific definitions
and other assorted stuff */
/* ************************************************************************** */
#ifdef __cplusplus
extern "C" {
#endif
/* ************************************************************************** */
/* * * */
/* * Versioning control * */
/* * * */
/* * version_so and version_dll will NOT reflect version_major; * */
/* * these will only change for binary incompatible changes (which will * */
/* * hopefully never occur) * */
/* * note: they will be set to 1 on the first public release !!! * */
/* * * */
/* * first public release: * */
/* * #define MNG_VERSION_TEXT "1.0.0" * */
/* * #define MNG_VERSION_SO 1 eg. libmng.so.1 * */
/* * #define MNG_VERSION_DLL 1 eg. libmng.dll * */
/* * #define MNG_VERSION_MAJOR 1 * */
/* * #define MNG_VERSION_MINOR 0 * */
/* * #define MNG_VERSION_RELEASE 0 * */
/* * * */
/* * bug fix & cosmetics : * */
/* * #define MNG_VERSION_TEXT "1.0.1" * */
/* * #define MNG_VERSION_SO 1 eg. libmng.so.1 * */
/* * #define MNG_VERSION_DLL 1 eg. libmng.dll * */
/* * #define MNG_VERSION_MAJOR 1 * */
/* * #define MNG_VERSION_MINOR 0 * */
/* * #define MNG_VERSION_RELEASE 1 * */
/* * * */
/* * feature change : * */
/* * #define MNG_VERSION_TEXT "1.2.0" * */
/* * #define MNG_VERSION_SO 1 eg. libmng.so.1 * */
/* * #define MNG_VERSION_DLL 1 eg. libmng.dll * */
/* * #define MNG_VERSION_MAJOR 1 * */
/* * #define MNG_VERSION_MINOR 2 * */
/* * #define MNG_VERSION_RELEASE 0 * */
/* * * */
/* * major rewrite (still binary compatible) : * */
/* * #define MNG_VERSION_TEXT "2.0.0" * */
/* * #define MNG_VERSION_SO 1 eg. libmng.so.1 * */
/* * #define MNG_VERSION_DLL 1 eg. libmng.dll * */
/* * #define MNG_VERSION_MAJOR 2 * */
/* * #define MNG_VERSION_MINOR 0 * */
/* * #define MNG_VERSION_RELEASE 0 * */
/* * * */
/* * binary incompatible change: * */
/* * #define MNG_VERSION_TEXT "13.0.0" * */
/* * #define MNG_VERSION_SO 2 eg. libmng.so.2 * */
/* * #define MNG_VERSION_DLL 2 eg. libmng2.dll * */
/* * #define MNG_VERSION_MAJOR 13 * */
/* * #define MNG_VERSION_MINOR 0 * */
/* * #define MNG_VERSION_RELEASE 0 * */
/* * * */
/* * note that version_so & version_dll will always remain equal so it * */
/* * doesn't matter which one is called to do version-checking; they are * */
/* * just provided for their target platform * */
/* * * */
/* ************************************************************************** */
#define MNG_VERSION_TEXT "2.0.3"
#define MNG_VERSION_BETA MNG_FALSE
MNG_EXT mng_pchar MNG_DECL mng_version_text (void);
MNG_EXT mng_uint8 MNG_DECL mng_version_so (void);
MNG_EXT mng_uint8 MNG_DECL mng_version_dll (void);
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_EXT mng_bool MNG_DECL mng_version_beta (void);
/* use the following call to check wether the version of libmng your app
is using supports the given function; this is useful in apps that dynamically
load the library to make sure a certain function will work; the result will
be MNG_TRUE if the given function is implemented in this version of the library;
Major/Minor/Version indicate the version the function became available;
(if these fields are zero the function is not yet implemented!) */
#ifdef MNG_SUPPORT_FUNCQUERY
MNG_EXT mng_bool MNG_DECL mng_supports_func (mng_pchar zFunction,
mng_uint8* iMajor,
mng_uint8* iMinor,
mng_uint8* iRelease);
#endif
/* ************************************************************************** */
/* * * */
/* * 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 "1.1"
#define MNG_MNG_VERSION_MAJ 1
#define MNG_MNG_VERSION_MIN 1
#define MNG_MNG_DRAFT 99 /* deprecated;
only used for nEED "MNG DRAFT nn" */
/* ************************************************************************** */
/* * * */
/* * High-level application functions * */
/* * * */
/* ************************************************************************** */
/* library initialization function */
/* must be the first called before anything can be done at all */
/* initializes internal datastructure(s) */
MNG_EXT mng_handle MNG_DECL mng_initialize (mng_ptr pUserdata,
mng_memalloc fMemalloc,
mng_memfree fMemfree,
mng_traceproc fTraceproc);
/* library reset function */
/* can be used to re-initialize the library, so another image can be
processed. there's absolutely no harm in calling it, even when it's not
really necessary */
MNG_EXT mng_retcode MNG_DECL mng_reset (mng_handle hHandle);
/* library cleanup function */
/* must be the last called to clean up internal datastructure(s) */
MNG_EXT mng_retcode MNG_DECL mng_cleanup (mng_handle* hHandle);
/* high-level read functions */
/* use mng_read if you simply want to read a Network Graphic */
/* mng_read_resume is used in I/O-read-suspension scenarios, where the
"readdata" callback may return FALSE & length=0 indicating its buffer is
depleted or too short to supply the required bytes, and the buffer needs
to be refilled; libmng will return the errorcode MNG_NEEDMOREDATA telling
the app to refill its read-buffer after which it must call mng_read_resume
(or mng_display_resume if it also displaying the image simultaneously) */
#ifdef MNG_SUPPORT_READ
MNG_EXT mng_retcode MNG_DECL mng_read (mng_handle hHandle);
MNG_EXT mng_retcode MNG_DECL mng_read_resume (mng_handle hHandle);
#endif
/* high-level "data push" functions */
/* these functions can be used in situations where data is streaming into the
application and needs to be buffered by libmng before it is actually
requested by libmng itself. the pushing complements the normal reading
mechanism, but applications can decide to always return "0 bytes read" to
make libmng go into suspension mode with the returncode MNG_NEEDMOREDATA */
/* mng_read_pushdata can be used to push blobs of data of arbitrary size;
mng_read_pushsig and mng_read_pushchunk can be used if the application
has already done some low-level decoding (eg. at the chunk level) */
/* the data being pushed into libmng with mng_read_pushdata *must* contain
the regular 4-byte chunklength, but *must not* contain it with
mng_read_pushchunk!!! */
/* mng_read_pushsig is used to prevent libmng from trying to parse the regular
PNG/JNG/MNG signature bytes; the application must have done this itself
and *must* indicate the proper type in the function call or things will
go amiss!!
also you *must* call this first, so pretty much right after mng_initialize
and certainly before any call to mng_read or mng_readdisplay !!!! */
/* IMPORTANT!!! data can only be safely pushed when libmng is in a
"wait" state; eg. during MNG_NEEDTIMERWAIT, MNG_NEEDSECTIONWAIT or
MNG_NEEDMOREDATA !!! this just means you can't have one thread displaying
and another thread pushing data !!! */
/* if bOwnership = MNG_TRUE, libmng will retain the supplied pointer and
*will* expect the buffer to remain available until libmng is finished
with it; what happens then depends on whether or not you have set the
releasedata() callback; if this is set than the supplied buffer will
be returned through this callback and your application can take care of
cleaning it up, otherwise libmng will use its internal freeing mechanism
(which, depending on compile-options, will be the standard C free() call,
or the memfree() callback */
/* if bOwnership = MNG_FALSE, libmng will just copy the data into its own
buffers and dispose of it in the normal way */
#ifdef MNG_SUPPORT_READ
MNG_EXT mng_retcode MNG_DECL mng_read_pushdata (mng_handle hHandle,
mng_ptr pData,
mng_size_t iLength,
mng_bool bTakeownership);
MNG_EXT mng_retcode MNG_DECL mng_read_pushsig (mng_handle hHandle,
mng_imgtype eSigtype);
MNG_EXT mng_retcode MNG_DECL mng_read_pushchunk (mng_handle hHandle,
mng_ptr pChunk,
mng_size_t iLength,
mng_bool bTakeownership);
#endif
/* high-level write & create functions */
/* use this if you want to write a previously read Network Graphic or
if you want to create a new graphic and write it */
/* to write a previously read graphic you must have defined MNG_STORE_CHUNKS */
/* to create a new graphic you'll also need access to the chunks
(eg. #define MNG_ACCESS_CHUNKS !) */
#ifdef MNG_SUPPORT_WRITE
MNG_EXT mng_retcode MNG_DECL mng_write (mng_handle hHandle);
MNG_EXT mng_retcode MNG_DECL mng_create (mng_handle hHandle);
#endif
/* high-level display functions */
/* use these to display a previously read or created graphic or
to read & display a graphic simultaneously */
/* mng_display_resume should be called after a timer-interval
expires that was set through the settimer-callback, after a
read suspension-break, or, to resume an animation after a call
to mng_display_freeze/mng_display_reset */
/* mng_display_freeze thru mng_display_gotime can be used to influence
the display of an image, BUT ONLY if it has been completely read! */
#ifdef MNG_SUPPORT_DISPLAY
#ifdef MNG_SUPPORT_READ
MNG_EXT mng_retcode MNG_DECL mng_readdisplay (mng_handle hHandle);
#endif
MNG_EXT mng_retcode MNG_DECL mng_display (mng_handle hHandle);
MNG_EXT mng_retcode MNG_DECL mng_display_resume (mng_handle hHandle);
MNG_EXT mng_retcode MNG_DECL mng_display_freeze (mng_handle hHandle);
MNG_EXT mng_retcode MNG_DECL mng_display_reset (mng_handle hHandle);
#ifndef MNG_NO_DISPLAY_GO_SUPPORTED
MNG_EXT mng_retcode MNG_DECL mng_display_goframe (mng_handle hHandle,
mng_uint32 iFramenr);
MNG_EXT mng_retcode MNG_DECL mng_display_golayer (mng_handle hHandle,
mng_uint32 iLayernr);
MNG_EXT mng_retcode MNG_DECL mng_display_gotime (mng_handle hHandle,
mng_uint32 iPlaytime);
#endif
#endif /* MNG_SUPPORT_DISPLAY */
/* event processing function */
/* this needs to be called by the app when dynamic MNG is enabled and
a specific event occurs in the user-interface */
#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_SUPPORT_DYNAMICMNG)
MNG_EXT mng_retcode MNG_DECL mng_trapevent (mng_handle hHandle,
mng_uint8 iEventtype,
mng_int32 iX,
mng_int32 iY);
#endif
/* error reporting function */
/* use this if you need more detailed info on the last error */
/* iExtra1 & iExtra2 may contain errorcodes from zlib, jpeg, etc... */
/* zErrortext will only be filled if you #define MNG_ERROR_TELLTALE */
MNG_EXT mng_retcode MNG_DECL mng_getlasterror (mng_handle hHandle,
mng_int8* iSeverity,
mng_chunkid* iChunkname,
mng_uint32* iChunkseq,
mng_int32* iExtra1,
mng_int32* iExtra2,
mng_pchar* zErrortext);
/* ************************************************************************** */
/* * * */
/* * Callback set functions * */
/* * * */
/* ************************************************************************** */
/* memory callbacks */
/* called to allocate and release internal datastructures */
#ifndef MNG_INTERNAL_MEMMNGMT
MNG_EXT mng_retcode MNG_DECL mng_setcb_memalloc (mng_handle hHandle,
mng_memalloc fProc);
MNG_EXT mng_retcode MNG_DECL mng_setcb_memfree (mng_handle hHandle,
mng_memfree fProc);
#endif /* MNG_INTERNAL_MEMMNGMT */
/* open- & close-stream callbacks */
/* called to open & close streams for input or output */
#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
#ifndef MNG_NO_OPEN_CLOSE_STREAM
MNG_EXT mng_retcode MNG_DECL mng_setcb_openstream (mng_handle hHandle,
mng_openstream fProc);
MNG_EXT mng_retcode MNG_DECL mng_setcb_closestream (mng_handle hHandle,
mng_closestream fProc);
#endif
#endif
/* read callback */
/* called to get data from the inputstream */
#ifdef MNG_SUPPORT_READ
MNG_EXT mng_retcode MNG_DECL mng_setcb_readdata (mng_handle hHandle,
mng_readdata fProc);
#endif
/* write callback */
/* called to put data into the outputstream */
#ifdef MNG_SUPPORT_WRITE
MNG_EXT mng_retcode MNG_DECL mng_setcb_writedata (mng_handle hHandle,
mng_writedata fProc);
#endif
/* error callback */
/* called when an error occurs */
/* the application can determine if the error is recoverable,
and may inform the library by setting specific returncodes */
MNG_EXT mng_retcode MNG_DECL mng_setcb_errorproc (mng_handle hHandle,
mng_errorproc fProc);
/* trace callback */
/* called to show the currently executing function */
#ifdef MNG_SUPPORT_TRACE
MNG_EXT mng_retcode MNG_DECL mng_setcb_traceproc (mng_handle hHandle,
mng_traceproc fProc);
#endif
/* callbacks for read processing */
/* 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);
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, unless
the requirement is one of:
- a supported chunk
- the text "draft nn" where nn is a numeric value
- the text "MNG-1.0" or "MNG-1.1"
- the text "CACHEOFF" */
/* processmend is called at the very end of the animation-stream;
note that this may not be the end of the animation though! */
/* processterm is called when a TERM chunk is encountered; there can be only
1 in the stream (or none) */
/* 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);
MNG_EXT mng_retcode MNG_DECL mng_setcb_processtext (mng_handle hHandle,
mng_processtext fProc);
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_processmend (mng_handle hHandle,
mng_processmend fProc);
MNG_EXT mng_retcode MNG_DECL mng_setcb_processterm (mng_handle hHandle,
mng_processterm fProc);
MNG_EXT mng_retcode MNG_DECL mng_setcb_processunknown(mng_handle hHandle,
mng_processunknown fProc);
#endif
/* callbacks for display processing */
/* getcanvasline is called to get an access-pointer to a line on the
drawing-canvas */
/* getbkgdline is called to get an access-pointer to a line from the
background-canvas */
/* refresh is called to inform the GUI to redraw the current canvas onto
its output device (eg. in Win32 this would mean sending an
invalidate message for the specified region */
/* NOTE that the update-region is specified as x,y,width,height; eg. the
invalidate message for Windows requires left,top,right,bottom parameters
where the bottom-right is exclusive of the region!!
to get these correctly is as simple as:
left = x;
top = y;
right = x + width;
bottom = y + height;
if your implementation requires inclusive points, simply subtract 1 from
both the right & bottom values calculated above.
*/
#ifdef MNG_SUPPORT_DISPLAY
MNG_EXT mng_retcode MNG_DECL mng_setcb_getcanvasline (mng_handle hHandle,
mng_getcanvasline fProc);
MNG_EXT mng_retcode MNG_DECL mng_setcb_getbkgdline (mng_handle hHandle,
mng_getbkgdline fProc);
MNG_EXT mng_retcode MNG_DECL mng_setcb_getalphaline (mng_handle hHandle,
mng_getalphaline fProc);
MNG_EXT mng_retcode MNG_DECL mng_setcb_refresh (mng_handle hHandle,
mng_refresh fProc);
/* timing callbacks */
/* gettickcount is called to get the system tickcount (milliseconds);
this is used to determine the remaining interval between frames */
/* settimer is called to inform the application that it should set a timer;
when the timer is triggered the app must call mng_display_resume */
MNG_EXT mng_retcode MNG_DECL mng_setcb_gettickcount (mng_handle hHandle,
mng_gettickcount fProc);
MNG_EXT mng_retcode MNG_DECL mng_setcb_settimer (mng_handle hHandle,
mng_settimer fProc);
/* color management callbacks */
/* called to transmit color management information to the application */
/* these are only used when you #define MNG_APP_CMS */
#ifdef MNG_APP_CMS
MNG_EXT mng_retcode MNG_DECL mng_setcb_processgamma (mng_handle hHandle,
mng_processgamma fProc);
MNG_EXT mng_retcode MNG_DECL mng_setcb_processchroma (mng_handle hHandle,
mng_processchroma fProc);
MNG_EXT mng_retcode MNG_DECL mng_setcb_processsrgb (mng_handle hHandle,
mng_processsrgb fProc);
MNG_EXT mng_retcode MNG_DECL mng_setcb_processiccp (mng_handle hHandle,
mng_processiccp fProc);
MNG_EXT mng_retcode MNG_DECL mng_setcb_processarow (mng_handle hHandle,
mng_processarow fProc);
#endif /* MNG_APP_CMS */
#endif /* MNG_SUPPORT_DISPLAY */
/* release push data callback */
/* used when the app pushes data into libmng (as opposed to libmng pulling it)
and relinquishes ownership of the pushed data-buffer, but *does* want to
release (free) the buffer itself once libmng has finished processing it */
#ifdef MNG_SUPPORT_READ
MNG_EXT mng_retcode MNG_DECL mng_setcb_releasedata (mng_handle hHandle,
mng_releasedata fProc);
#endif
/* ************************************************************************** */
/* * * */
/* * Callback get functions * */
/* * * */
/* ************************************************************************** */
/* see _setcb_ */
#ifndef MNG_INTERNAL_MEMMNGMT
MNG_EXT mng_memalloc MNG_DECL mng_getcb_memalloc (mng_handle hHandle);
MNG_EXT mng_memfree MNG_DECL mng_getcb_memfree (mng_handle hHandle);
#endif
/* see _setcb_ */
#ifdef MNG_SUPPORT_READ
MNG_EXT mng_releasedata MNG_DECL mng_getcb_releasedata (mng_handle hHandle);
#endif
/* see _setcb_ */
#if defined(MNG_SUPPORT_READ) || defined(MNG_WRITE_SUPPORT)
#ifndef MNG_NO_OPEN_CLOSE_STREAM
MNG_EXT mng_openstream MNG_DECL mng_getcb_openstream (mng_handle hHandle);
MNG_EXT mng_closestream MNG_DECL mng_getcb_closestream (mng_handle hHandle);
#endif
#endif
/* see _setcb_ */
#ifdef MNG_SUPPORT_READ
MNG_EXT mng_readdata MNG_DECL mng_getcb_readdata (mng_handle hHandle);
#endif
/* see _setcb_ */
#ifdef MNG_SUPPORT_WRITE
MNG_EXT mng_writedata MNG_DECL mng_getcb_writedata (mng_handle hHandle);
#endif
/* see _setcb_ */
MNG_EXT mng_errorproc MNG_DECL mng_getcb_errorproc (mng_handle hHandle);
/* see _setcb_ */
#ifdef MNG_SUPPORT_TRACE
MNG_EXT mng_traceproc MNG_DECL mng_getcb_traceproc (mng_handle hHandle);
#endif
/* see _setcb_ */
#ifdef MNG_SUPPORT_READ
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);
MNG_EXT mng_processterm MNG_DECL mng_getcb_processterm (mng_handle hHandle);
#endif
/* see _setcb_ */
#ifdef MNG_SUPPORT_DISPLAY
MNG_EXT mng_getcanvasline MNG_DECL mng_getcb_getcanvasline (mng_handle hHandle);
MNG_EXT mng_getbkgdline MNG_DECL mng_getcb_getbkgdline (mng_handle hHandle);
MNG_EXT mng_getalphaline MNG_DECL mng_getcb_getalphaline (mng_handle hHandle);
MNG_EXT mng_refresh MNG_DECL mng_getcb_refresh (mng_handle hHandle);
/* see _setcb_ */
MNG_EXT mng_gettickcount MNG_DECL mng_getcb_gettickcount (mng_handle hHandle);
MNG_EXT mng_settimer MNG_DECL mng_getcb_settimer (mng_handle hHandle);
/* see _setcb_ */
#ifdef MNG_APP_CMS
MNG_EXT mng_processgamma MNG_DECL mng_getcb_processgamma (mng_handle hHandle);
MNG_EXT mng_processchroma MNG_DECL mng_getcb_processchroma (mng_handle hHandle);
MNG_EXT mng_processsrgb MNG_DECL mng_getcb_processsrgb (mng_handle hHandle);
MNG_EXT mng_processiccp MNG_DECL mng_getcb_processiccp (mng_handle hHandle);
MNG_EXT mng_processarow MNG_DECL mng_getcb_processarow (mng_handle hHandle);
#endif /* MNG_APP_CMS */
#endif /* MNG_SUPPORT_DISPLAY */
/* ************************************************************************** */
/* * * */
/* * Property set functions * */
/* * * */
/* ************************************************************************** */
/* Application data pointer */
/* provided for application use; not used by the library */
MNG_EXT mng_retcode MNG_DECL mng_set_userdata (mng_handle hHandle,
mng_ptr pUserdata);
/* The style of the drawing- & background-canvas */
/* only used for displaying images */
/* both are initially set to 24-bit RGB (eg. 8-bit per channel) */
MNG_EXT mng_retcode MNG_DECL mng_set_canvasstyle (mng_handle hHandle,
mng_uint32 iStyle);
MNG_EXT mng_retcode MNG_DECL mng_set_bkgdstyle (mng_handle hHandle,
mng_uint32 iStyle);
/* The default background color */
/* only used if the getbkgdline callback is not defined */
/* for initially painting the canvas and restoring (part of) the background */
MNG_EXT mng_retcode MNG_DECL mng_set_bgcolor (mng_handle hHandle,
mng_uint16 iRed,
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 */
MNG_EXT mng_retcode MNG_DECL mng_set_storechunks (mng_handle hHandle,
mng_bool bStorechunks);
/* Indicates breaks requested when processing SAVE/SEEK */
/* set this to let the app handle section breaks; the library will return
MNG_NEEDSECTIONWAIT return-codes for each SEEK chunk */
MNG_EXT mng_retcode MNG_DECL mng_set_sectionbreaks (mng_handle hHandle,
mng_bool bSectionbreaks);
/* Indicates storage of playback info (ON by default!) */
/* can be used to turn off caching of playback info; this is useful to
specifically optimize MNG-video playback; note that if caching is turned off
LOOP chunks will be flagged as errors! TERM chunks will be ignored and only
passed to the processterm() callback if it is defined by the app; also, this
feature can only be used with mng_readdisplay(); mng_read(),
mng_display_reset() and mng_display_goxxxx() will return an error;
once this option is turned off it can't be turned on for the same stream!!! */
MNG_EXT mng_retcode MNG_DECL mng_set_cacheplayback (mng_handle hHandle,
mng_bool bCacheplayback);
/* Indicates automatic progressive refreshes for large images (ON by default!) */
/* turn this off if you do not want intermittent painting while a large image
is being read. useful if the input-stream comes from a fast medium, such
as a local harddisk */
MNG_EXT mng_retcode MNG_DECL mng_set_doprogressive (mng_handle hHandle,
mng_bool bDoProgressive);
/* Indicates existence and required checking of the CRC in input streams,
and generation in output streams */
/* !!!! Use this ONLY if you know what you are doing !!!! */
/* The value is a combination of the following flags:
0x0000001 = CRC is present in the input stream
0x0000002 = CRC must be generated in the output stream
0x0000010 = CRC should be checked for ancillary chunks
0x0000020 = a faulty CRC for ancillary chunks generates a warning only
0x0000040 = a faulty CRC for ancillary chunks generates an error
0x0000100 = CRC should be checked for critical chunks
0x0000200 = a faulty CRC for critical chunks generates a warning only
0x0000400 = a faulty CRC for critical chunks generates an error
The default is 0x00000533 = CRC present in input streams; should be checked;
warning for ancillary chunks; error for critical
chunks; generate CRC for output streams
Note that some combinations are meaningless; eg. if the CRC is not present
it won't do any good to turn the checking flags on; if a checking flag
is off, it doesn't do any good to ask for generation of warnings or errors.
Also libmng will generate either an error or a warning, not both,
so if you specify both the default will be to generate an error!
The only useful combinations for input are 331, 551, 351, 531, 0, 301, 501
and optionally 031 and 051, but only checking ancillary chunks and not
critical chunks is generally not a very good idea!!!
If you've also writing these values should be combined with 0x02 if
CRC's are required in the output stream
*/
MNG_EXT mng_retcode MNG_DECL mng_set_crcmode (mng_handle hHandle,
mng_uint32 iCrcmode);
/* Color-management necessaries */
/*
*************************************************************************
!!!!!!!! THIS NEXT 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 of course)
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.
*************************************************************************
!!!!!!!! THE BIT ABOVE 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_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
#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS)
/* Gamma settings */
/* ... blabla (explain gamma processing a little; eg. formula & stuff) ... */
MNG_EXT mng_retcode MNG_DECL mng_set_viewgamma (mng_handle hHandle,
mng_float dGamma);
MNG_EXT mng_retcode MNG_DECL mng_set_displaygamma (mng_handle hHandle,
mng_float dGamma);
MNG_EXT mng_retcode MNG_DECL mng_set_dfltimggamma (mng_handle hHandle,
mng_float dGamma);
MNG_EXT mng_retcode MNG_DECL mng_set_viewgammaint (mng_handle hHandle,
mng_uint32 iGamma);
MNG_EXT mng_retcode MNG_DECL mng_set_displaygammaint (mng_handle hHandle,
mng_uint32 iGamma);
MNG_EXT mng_retcode MNG_DECL mng_set_dfltimggammaint (mng_handle hHandle,
mng_uint32 iGamma);
#endif
#ifndef MNG_SKIP_MAXCANVAS
/* Ultimate clipping size */
/* used to limit extreme graphics from overloading the system */
/* if a graphic exceeds these limits a warning is issued, which can
be ignored by the app (using the errorproc callback). in that case
the library will use these settings to clip the input graphic, and
the app's canvas must account for this */
MNG_EXT mng_retcode MNG_DECL mng_set_maxcanvaswidth (mng_handle hHandle,
mng_uint32 iMaxwidth);
MNG_EXT mng_retcode MNG_DECL mng_set_maxcanvasheight (mng_handle hHandle,
mng_uint32 iMaxheight);
MNG_EXT mng_retcode MNG_DECL mng_set_maxcanvassize (mng_handle hHandle,
mng_uint32 iMaxwidth,
mng_uint32 iMaxheight);
#endif
/* ZLIB default compression parameters */
/* these are used when writing out chunks */
/* they are also used when compressing PNG image-data or JNG alpha-data;
in this case you can set them just before calling mng_putimgdata_ihdr */
/* set to your liking; usually the defaults will suffice though! */
/* check the documentation for ZLIB for details on these parameters */
#ifdef MNG_INCLUDE_ZLIB
MNG_EXT mng_retcode MNG_DECL mng_set_zlib_level (mng_handle hHandle,
mng_int32 iZlevel);
MNG_EXT mng_retcode MNG_DECL mng_set_zlib_method (mng_handle hHandle,
mng_int32 iZmethod);
MNG_EXT mng_retcode MNG_DECL mng_set_zlib_windowbits (mng_handle hHandle,
mng_int32 iZwindowbits);
MNG_EXT mng_retcode MNG_DECL mng_set_zlib_memlevel (mng_handle hHandle,
mng_int32 iZmemlevel);
MNG_EXT mng_retcode MNG_DECL mng_set_zlib_strategy (mng_handle hHandle,
mng_int32 iZstrategy);
MNG_EXT mng_retcode MNG_DECL mng_set_zlib_maxidat (mng_handle hHandle,
mng_uint32 iMaxIDAT);
#endif /* MNG_INCLUDE_ZLIB */
/* JNG default compression parameters (based on IJG code) */
/* these are used when compressing JNG image-data; so you can set them
just before calling mng_putimgdata_jhdr */
/* 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,
mng_int32 iJPEGsmoothing);
MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_progressive(mng_handle hHandle,
mng_bool bJPEGprogressive);
MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_optimized (mng_handle hHandle,
mng_bool bJPEGoptimized);
MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_maxjdat (mng_handle hHandle,
mng_uint32 iMaxJDAT);
#endif /* MNG_INCLUDE_JNG */
/* Suspension-mode setting */
/* use this to activate the internal suspension-buffer to improve
read-suspension processing */
/* TODO: write-suspension ??? */
#if defined(MNG_SUPPORT_READ)
MNG_EXT mng_retcode MNG_DECL mng_set_suspensionmode (mng_handle hHandle,
mng_bool bSuspensionmode);
#endif
/* Speed setting */
/* use this to influence the display-speed of animations */
#if defined(MNG_SUPPORT_DISPLAY)
MNG_EXT mng_retcode MNG_DECL mng_set_speed (mng_handle hHandle,
mng_speedtype iSpeed);
#endif
/* ************************************************************************** */
/* * * */
/* * Property get functions * */
/* * * */
/* ************************************************************************** */
/* see _set_ */
MNG_EXT mng_ptr MNG_DECL mng_get_userdata (mng_handle hHandle);
/* Network Graphic header details */
/* these get filled once the graphics header is processed,
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 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) */
#ifdef MNG_SUPPORT_DISPLAY
MNG_EXT mng_uint8 MNG_DECL mng_get_refreshpass (mng_handle hHandle);
#endif
/* 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);
/* see _set_ */
MNG_EXT mng_retcode MNG_DECL mng_get_bgcolor (mng_handle hHandle,
mng_uint16* iRed,
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);
/* see _set_ */
MNG_EXT mng_bool MNG_DECL mng_get_sectionbreaks (mng_handle hHandle);
/* see _set_ */
MNG_EXT mng_bool MNG_DECL mng_get_cacheplayback (mng_handle hHandle);
/* see _set_ */
MNG_EXT mng_bool MNG_DECL mng_get_doprogressive (mng_handle hHandle);
/* see _set_ */
MNG_EXT mng_uint32 MNG_DECL mng_get_crcmode (mng_handle hHandle);
/* see _set_ */
#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_FULL_CMS)
MNG_EXT mng_bool MNG_DECL mng_get_srgb (mng_handle hHandle);
#endif
/* see _set_ */
MNG_EXT mng_float MNG_DECL mng_get_viewgamma (mng_handle hHandle);
MNG_EXT mng_float MNG_DECL mng_get_displaygamma (mng_handle hHandle);
MNG_EXT mng_float MNG_DECL mng_get_dfltimggamma (mng_handle hHandle);
MNG_EXT mng_uint32 MNG_DECL mng_get_viewgammaint (mng_handle hHandle);
MNG_EXT mng_uint32 MNG_DECL mng_get_displaygammaint (mng_handle hHandle);
MNG_EXT mng_uint32 MNG_DECL mng_get_dfltimggammaint (mng_handle hHandle);
#ifndef MNG_SKIP_MAXCANVAS
/* see _set_ */
MNG_EXT mng_uint32 MNG_DECL mng_get_maxcanvaswidth (mng_handle hHandle);
MNG_EXT mng_uint32 MNG_DECL mng_get_maxcanvasheight (mng_handle hHandle);
#endif
/* see _set_ */
#ifdef MNG_INCLUDE_ZLIB
MNG_EXT mng_int32 MNG_DECL mng_get_zlib_level (mng_handle hHandle);
MNG_EXT mng_int32 MNG_DECL mng_get_zlib_method (mng_handle hHandle);
MNG_EXT mng_int32 MNG_DECL mng_get_zlib_windowbits (mng_handle hHandle);
MNG_EXT mng_int32 MNG_DECL mng_get_zlib_memlevel (mng_handle hHandle);
MNG_EXT mng_int32 MNG_DECL mng_get_zlib_strategy (mng_handle hHandle);
MNG_EXT mng_uint32 MNG_DECL mng_get_zlib_maxidat (mng_handle hHandle);
#endif /* MNG_INCLUDE_ZLIB */
/* 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);
MNG_EXT mng_bool MNG_DECL mng_get_jpeg_optimized (mng_handle hHandle);
MNG_EXT mng_uint32 MNG_DECL mng_get_jpeg_maxjdat (mng_handle hHandle);
#endif /* MNG_INCLUDE_JNG */
/* see _set_ */
#if defined(MNG_SUPPORT_READ)
MNG_EXT mng_bool MNG_DECL mng_get_suspensionmode (mng_handle hHandle);
#endif
/* see _set_ */
#if defined(MNG_SUPPORT_DISPLAY)
MNG_EXT mng_speedtype
MNG_DECL mng_get_speed (mng_handle hHandle);
#endif
/* Image-level */
/* this can be used inside the processtext callback to determine the level of
text of the image being processed; the value 1 is returned for top-level
texts, and the value 2 for a text inside an embedded image inside a MNG */
MNG_EXT mng_uint32 MNG_DECL mng_get_imagelevel (mng_handle hHandle);
/* BACK info */
/* can be used to retrieve the color & mandatory values for the last processed
BACK chunk of a MNG (will fail for other image-types);
if no BACK chunk was processed yet, it will return all zeroes */
#ifdef MNG_SUPPORT_DISPLAY
MNG_EXT mng_retcode MNG_DECL mng_get_lastbackchunk (mng_handle hHandle,
mng_uint16* iRed,
mng_uint16* iGreen,
mng_uint16* iBlue,
mng_uint8* iMandatory);
#endif
/* SEEK info */
/* can be used to retrieve the segmentname of the last processed SEEK chunk;
if no SEEK chunk was processed or its segmentname was empty, the function
will return an empty string; the provided buffer must be at least 80 bytes!! */
#ifdef MNG_SUPPORT_DISPLAY
MNG_EXT mng_retcode MNG_DECL mng_get_lastseekname (mng_handle hHandle,
mng_pchar zSegmentname);
#endif
/* FRAM info */
/* can be used to retrieve the current FRAM delay; this may be useful when
retrieving a stream of frames with their corresponding delays by "fake"
reading and displaying the file */
#ifdef MNG_SUPPORT_DISPLAY
MNG_EXT mng_uint32 MNG_DECL mng_get_currframdelay (mng_handle hHandle);
#endif
/* Display status variables */
/* these get filled & updated during display processing */
/* starttime is the tickcount at the start of displaying the animation */
/* runtime is the actual number of millisecs since the start of the animation */
/* currentframe, currentlayer & currentplaytime indicate the current
frame/layer/playtime(msecs) in the animation (these keep increasing;
even after the animation loops back to the TERM chunk) */
/* totalframes, totallayers & totalplaytime are filled after a complete run
of an animation (eg. at MEND); they are also valid after just reading the MNG */
#ifdef MNG_SUPPORT_DISPLAY
MNG_EXT mng_uint32 MNG_DECL mng_get_starttime (mng_handle hHandle);
MNG_EXT mng_uint32 MNG_DECL mng_get_runtime (mng_handle hHandle);
#ifndef MNG_NO_CURRENT_INFO
MNG_EXT mng_uint32 MNG_DECL mng_get_currentframe (mng_handle hHandle);
MNG_EXT mng_uint32 MNG_DECL mng_get_currentlayer (mng_handle hHandle);
MNG_EXT mng_uint32 MNG_DECL mng_get_currentplaytime (mng_handle hHandle);
MNG_EXT mng_uint32 MNG_DECL mng_get_totalframes (mng_handle hHandle);
MNG_EXT mng_uint32 MNG_DECL mng_get_totallayers (mng_handle hHandle);
MNG_EXT mng_uint32 MNG_DECL mng_get_totalplaytime (mng_handle hHandle);
#endif
#endif
/* Status variables */
/* these indicate the internal state of the library */
/* most indicate exactly what you would expect -
status_error: true if the last function call returned an errorcode
status_reading: true if the library is (still) reading an image
status_suspendbreak: true if the library has suspended for "I/O"
status_creating: true if the library is in the middle of creating an image
status_writing: true if the library is in the middle of writing an image
status_displaying: true if the library is displaying an image
status_running: true if display processing is active (eg. not frozen or reset)
status_timerbreak: true if the library has suspended for a "timer-break"
status_dynamic: true if the library encountered an evNT chunk in the MNG
status_runningevent: true if the library is processing an external event */
/* eg. mng_readdisplay() will turn the reading, displaying and running status on;
when EOF is reached the reading status will be turned off */
MNG_EXT mng_bool MNG_DECL mng_status_error (mng_handle hHandle);
#ifdef MNG_SUPPORT_READ
MNG_EXT mng_bool MNG_DECL mng_status_reading (mng_handle hHandle);
MNG_EXT mng_bool MNG_DECL mng_status_suspendbreak (mng_handle hHandle);
#endif
#ifdef MNG_SUPPORT_WRITE
MNG_EXT mng_bool MNG_DECL mng_status_creating (mng_handle hHandle);
MNG_EXT mng_bool MNG_DECL mng_status_writing (mng_handle hHandle);
#endif
#ifdef MNG_SUPPORT_DISPLAY
MNG_EXT mng_bool MNG_DECL mng_status_displaying (mng_handle hHandle);
MNG_EXT mng_bool MNG_DECL mng_status_running (mng_handle hHandle);
MNG_EXT mng_bool MNG_DECL mng_status_timerbreak (mng_handle hHandle);
#endif
#ifdef MNG_SUPPORT_DYNAMICMNG
MNG_EXT mng_bool MNG_DECL mng_status_dynamic (mng_handle hHandle);
MNG_EXT mng_bool MNG_DECL mng_status_runningevent (mng_handle hHandle);
#endif
/* ************************************************************************** */
/* * * */
/* * Chunk access functions * */
/* * * */
/* ************************************************************************** */
#ifdef MNG_ACCESS_CHUNKS
/* ************************************************************************** */
/* use this to iterate the stored chunks */
/* requires MNG_ACCESS_CHUNKS & MNG_STORE_CHUNKS */
/* starts from the supplied chunk-index-nr; the first chunk has index 0!! */
MNG_EXT mng_retcode MNG_DECL mng_iterate_chunks (mng_handle hHandle,
mng_uint32 iChunkseq,
mng_iteratechunk fProc);
/* use the next function inside your 'iteratechunk' callback to copy
the given chunk to a new mng you are creating */
/* the 'out' handle should be in 'create' status! */
#ifdef MNG_SUPPORT_WRITE
MNG_EXT mng_retcode MNG_DECL mng_copy_chunk (mng_handle hHandle,
mng_handle hChunk,
mng_handle hHandleOut);
#endif
/* ************************************************************************** */
/* use these to get chunk data from within the callback in iterate_chunks */
MNG_EXT mng_retcode MNG_DECL mng_getchunk_ihdr (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iWidth,
mng_uint32 *iHeight,
mng_uint8 *iBitdepth,
mng_uint8 *iColortype,
mng_uint8 *iCompression,
mng_uint8 *iFilter,
mng_uint8 *iInterlace);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_plte (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iCount,
mng_palette8 *aPalette);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_idat (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iRawlen,
mng_ptr *pRawdata);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_trns (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_bool *bGlobal,
mng_uint8 *iType,
mng_uint32 *iCount,
mng_uint8arr *aAlphas,
mng_uint16 *iGray,
mng_uint16 *iRed,
mng_uint16 *iGreen,
mng_uint16 *iBlue,
mng_uint32 *iRawlen,
mng_uint8arr *aRawdata);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_gama (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint32 *iGamma);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_chrm (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint32 *iWhitepointx,
mng_uint32 *iWhitepointy,
mng_uint32 *iRedx,
mng_uint32 *iRedy,
mng_uint32 *iGreenx,
mng_uint32 *iGreeny,
mng_uint32 *iBluex,
mng_uint32 *iBluey);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_srgb (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint8 *iRenderingintent);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_iccp (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint32 *iNamesize,
mng_pchar *zName,
mng_uint8 *iCompression,
mng_uint32 *iProfilesize,
mng_ptr *pProfile);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_text (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iKeywordsize,
mng_pchar *zKeyword,
mng_uint32 *iTextsize,
mng_pchar *zText);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_ztxt (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iKeywordsize,
mng_pchar *zKeyword,
mng_uint8 *iCompression,
mng_uint32 *iTextsize,
mng_pchar *zText);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_itxt (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iKeywordsize,
mng_pchar *zKeyword,
mng_uint8 *iCompressionflag,
mng_uint8 *iCompressionmethod,
mng_uint32 *iLanguagesize,
mng_pchar *zLanguage,
mng_uint32 *iTranslationsize,
mng_pchar *zTranslation,
mng_uint32 *iTextsize,
mng_pchar *zText);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_bkgd (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint8 *iType,
mng_uint8 *iIndex,
mng_uint16 *iGray,
mng_uint16 *iRed,
mng_uint16 *iGreen,
mng_uint16 *iBlue);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_phys (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint32 *iSizex,
mng_uint32 *iSizey,
mng_uint8 *iUnit);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_sbit (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint8 *iType,
mng_uint8arr4 *aBits);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_splt (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint32 *iNamesize,
mng_pchar *zName,
mng_uint8 *iSampledepth,
mng_uint32 *iEntrycount,
mng_ptr *pEntries);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_hist (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iEntrycount,
mng_uint16arr *aEntries);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_time (mng_handle hHandle,
mng_handle hChunk,
mng_uint16 *iYear,
mng_uint8 *iMonth,
mng_uint8 *iDay,
mng_uint8 *iHour,
mng_uint8 *iMinute,
mng_uint8 *iSecond);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_mhdr (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iWidth,
mng_uint32 *iHeight,
mng_uint32 *iTicks,
mng_uint32 *iLayercount,
mng_uint32 *iFramecount,
mng_uint32 *iPlaytime,
mng_uint32 *iSimplicity);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_loop (mng_handle hHandle,
mng_handle hChunk,
mng_uint8 *iLevel,
mng_uint32 *iRepeat,
mng_uint8 *iTermination,
mng_uint32 *iItermin,
mng_uint32 *iItermax,
mng_uint32 *iCount,
mng_uint32p *pSignals);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_endl (mng_handle hHandle,
mng_handle hChunk,
mng_uint8 *iLevel);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_defi (mng_handle hHandle,
mng_handle hChunk,
mng_uint16 *iObjectid,
mng_uint8 *iDonotshow,
mng_uint8 *iConcrete,
mng_bool *bHasloca,
mng_int32 *iXlocation,
mng_int32 *iYlocation,
mng_bool *bHasclip,
mng_int32 *iLeftcb,
mng_int32 *iRightcb,
mng_int32 *iTopcb,
mng_int32 *iBottomcb);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_basi (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iWidth,
mng_uint32 *iHeight,
mng_uint8 *iBitdepth,
mng_uint8 *iColortype,
mng_uint8 *iCompression,
mng_uint8 *iFilter,
mng_uint8 *iInterlace,
mng_uint16 *iRed,
mng_uint16 *iGreen,
mng_uint16 *iBlue,
mng_uint16 *iAlpha,
mng_uint8 *iViewable);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_clon (mng_handle hHandle,
mng_handle hChunk,
mng_uint16 *iSourceid,
mng_uint16 *iCloneid,
mng_uint8 *iClonetype,
mng_uint8 *iDonotshow,
mng_uint8 *iConcrete,
mng_bool *bHasloca,
mng_uint8 *iLocationtype,
mng_int32 *iLocationx,
mng_int32 *iLocationy);
#ifndef MNG_SKIPCHUNK_PAST
MNG_EXT mng_retcode MNG_DECL mng_getchunk_past (mng_handle hHandle,
mng_handle hChunk,
mng_uint16 *iDestid,
mng_uint8 *iTargettype,
mng_int32 *iTargetx,
mng_int32 *iTargety,
mng_uint32 *iCount);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_past_src (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 iEntry,
mng_uint16 *iSourceid,
mng_uint8 *iComposition,
mng_uint8 *iOrientation,
mng_uint8 *iOffsettype,
mng_int32 *iOffsetx,
mng_int32 *iOffsety,
mng_uint8 *iBoundarytype,
mng_int32 *iBoundaryl,
mng_int32 *iBoundaryr,
mng_int32 *iBoundaryt,
mng_int32 *iBoundaryb);
#endif
MNG_EXT mng_retcode MNG_DECL mng_getchunk_disc (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iCount,
mng_uint16p *pObjectids);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_back (mng_handle hHandle,
mng_handle hChunk,
mng_uint16 *iRed,
mng_uint16 *iGreen,
mng_uint16 *iBlue,
mng_uint8 *iMandatory,
mng_uint16 *iImageid,
mng_uint8 *iTile);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_fram (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint8 *iMode,
mng_uint32 *iNamesize,
mng_pchar *zName,
mng_uint8 *iChangedelay,
mng_uint8 *iChangetimeout,
mng_uint8 *iChangeclipping,
mng_uint8 *iChangesyncid,
mng_uint32 *iDelay,
mng_uint32 *iTimeout,
mng_uint8 *iBoundarytype,
mng_int32 *iBoundaryl,
mng_int32 *iBoundaryr,
mng_int32 *iBoundaryt,
mng_int32 *iBoundaryb,
mng_uint32 *iCount,
mng_uint32p *pSyncids);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_move (mng_handle hHandle,
mng_handle hChunk,
mng_uint16 *iFirstid,
mng_uint16 *iLastid,
mng_uint8 *iMovetype,
mng_int32 *iMovex,
mng_int32 *iMovey);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_clip (mng_handle hHandle,
mng_handle hChunk,
mng_uint16 *iFirstid,
mng_uint16 *iLastid,
mng_uint8 *iCliptype,
mng_int32 *iClipl,
mng_int32 *iClipr,
mng_int32 *iClipt,
mng_int32 *iClipb);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_show (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint16 *iFirstid,
mng_uint16 *iLastid,
mng_uint8 *iMode);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_term (mng_handle hHandle,
mng_handle hChunk,
mng_uint8 *iTermaction,
mng_uint8 *iIteraction,
mng_uint32 *iDelay,
mng_uint32 *iItermax);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_save (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint8 *iOffsettype,
mng_uint32 *iCount);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_save_entry (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 iEntry,
mng_uint8 *iEntrytype,
mng_uint32arr2 *iOffset,
mng_uint32arr2 *iStarttime,
mng_uint32 *iLayernr,
mng_uint32 *iFramenr,
mng_uint32 *iNamesize,
mng_pchar *zName);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_seek (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iNamesize,
mng_pchar *zName);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_expi (mng_handle hHandle,
mng_handle hChunk,
mng_uint16 *iSnapshotid,
mng_uint32 *iNamesize,
mng_pchar *zName);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_fpri (mng_handle hHandle,
mng_handle hChunk,
mng_uint8 *iDeltatype,
mng_uint8 *iPriority);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_need (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iKeywordssize,
mng_pchar *zKeywords);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_phyg (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint32 *iSizex,
mng_uint32 *iSizey,
mng_uint8 *iUnit);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_jhdr (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iWidth,
mng_uint32 *iHeight,
mng_uint8 *iColortype,
mng_uint8 *iImagesampledepth,
mng_uint8 *iImagecompression,
mng_uint8 *iImageinterlace,
mng_uint8 *iAlphasampledepth,
mng_uint8 *iAlphacompression,
mng_uint8 *iAlphafilter,
mng_uint8 *iAlphainterlace);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_jdat (mng_handle hHandle,
mng_handle hChunk,
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,
mng_uint8 *iImagetype,
mng_uint8 *iDeltatype,
mng_uint32 *iBlockwidth,
mng_uint32 *iBlockheight,
mng_uint32 *iBlockx,
mng_uint32 *iBlocky);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_prom (mng_handle hHandle,
mng_handle hChunk,
mng_uint8 *iColortype,
mng_uint8 *iSampledepth,
mng_uint8 *iFilltype);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_pplt (mng_handle hHandle,
mng_handle hChunk,
mng_uint8 *iDeltatype,
mng_uint32 *iCount);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_pplt_entry (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 iEntry,
mng_uint16 *iRed,
mng_uint16 *iGreen,
mng_uint16 *iBlue,
mng_uint16 *iAlpha,
mng_bool *bUsed);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_drop (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iCount,
mng_chunkidp *pChunknames);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_dbyk (mng_handle hHandle,
mng_handle hChunk,
mng_chunkid *iChunkname,
mng_uint8 *iPolarity,
mng_uint32 *iKeywordssize,
mng_pchar *zKeywords);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_ordr (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iCount);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_ordr_entry (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 iEntry,
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);
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
MNG_EXT mng_retcode MNG_DECL mng_getchunk_mpng (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iFramewidth,
mng_uint32 *iFrameheight,
mng_uint16 *iNumplays,
mng_uint16 *iTickspersec,
mng_uint8 *iCompressionmethod,
mng_uint32 *iCount);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_mpng_frame (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 iEntry,
mng_uint32 *iX,
mng_uint32 *iY,
mng_uint32 *iWidth,
mng_uint32 *iHeight,
mng_int32 *iXoffset,
mng_int32 *iYoffset,
mng_uint16 *iTicks);
#endif
MNG_EXT mng_retcode MNG_DECL mng_getchunk_evnt (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iCount);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_evnt_entry (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 iEntry,
mng_uint8 *iEventtype,
mng_uint8 *iMasktype,
mng_int32 *iLeft,
mng_int32 *iRight,
mng_int32 *iTop,
mng_int32 *iBottom,
mng_uint16 *iObjectid,
mng_uint8 *iIndex,
mng_uint32 *iSegmentnamesize,
mng_pchar *zSegmentname);
MNG_EXT mng_retcode MNG_DECL mng_getchunk_unknown (mng_handle hHandle,
mng_handle hChunk,
mng_chunkid *iChunkname,
mng_uint32 *iRawlen,
mng_ptr *pRawdata);
/* ************************************************************************** */
#ifdef MNG_INCLUDE_WRITE_PROCS
/* use these to create new chunks at the end of the chunk-list */
/* requires at least MNG_ACCESS_CHUNKS (MNG_SUPPORT_WRITE may be nice too) */
MNG_EXT mng_retcode MNG_DECL mng_putchunk_ihdr (mng_handle hHandle,
mng_uint32 iWidth,
mng_uint32 iHeight,
mng_uint8 iBitdepth,
mng_uint8 iColortype,
mng_uint8 iCompression,
mng_uint8 iFilter,
mng_uint8 iInterlace);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_plte (mng_handle hHandle,
mng_uint32 iCount,
mng_palette8 aPalette);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_idat (mng_handle hHandle,
mng_uint32 iRawlen,
mng_ptr pRawdata);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_iend (mng_handle hHandle);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_trns (mng_handle hHandle,
mng_bool bEmpty,
mng_bool bGlobal,
mng_uint8 iType,
mng_uint32 iCount,
mng_uint8arr aAlphas,
mng_uint16 iGray,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue,
mng_uint32 iRawlen,
mng_uint8arr aRawdata);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_gama (mng_handle hHandle,
mng_bool bEmpty,
mng_uint32 iGamma);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_chrm (mng_handle hHandle,
mng_bool bEmpty,
mng_uint32 iWhitepointx,
mng_uint32 iWhitepointy,
mng_uint32 iRedx,
mng_uint32 iRedy,
mng_uint32 iGreenx,
mng_uint32 iGreeny,
mng_uint32 iBluex,
mng_uint32 iBluey);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_srgb (mng_handle hHandle,
mng_bool bEmpty,
mng_uint8 iRenderingintent);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_iccp (mng_handle hHandle,
mng_bool bEmpty,
mng_uint32 iNamesize,
mng_pchar zName,
mng_uint8 iCompression,
mng_uint32 iProfilesize,
mng_ptr pProfile);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_text (mng_handle hHandle,
mng_uint32 iKeywordsize,
mng_pchar zKeyword,
mng_uint32 iTextsize,
mng_pchar zText);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_ztxt (mng_handle hHandle,
mng_uint32 iKeywordsize,
mng_pchar zKeyword,
mng_uint8 iCompression,
mng_uint32 iTextsize,
mng_pchar zText);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_itxt (mng_handle hHandle,
mng_uint32 iKeywordsize,
mng_pchar zKeyword,
mng_uint8 iCompressionflag,
mng_uint8 iCompressionmethod,
mng_uint32 iLanguagesize,
mng_pchar zLanguage,
mng_uint32 iTranslationsize,
mng_pchar zTranslation,
mng_uint32 iTextsize,
mng_pchar zText);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_bkgd (mng_handle hHandle,
mng_bool bEmpty,
mng_uint8 iType,
mng_uint8 iIndex,
mng_uint16 iGray,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_phys (mng_handle hHandle,
mng_bool bEmpty,
mng_uint32 iSizex,
mng_uint32 iSizey,
mng_uint8 iUnit);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_sbit (mng_handle hHandle,
mng_bool bEmpty,
mng_uint8 iType,
mng_uint8arr4 aBits);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_splt (mng_handle hHandle,
mng_bool bEmpty,
mng_uint32 iNamesize,
mng_pchar zName,
mng_uint8 iSampledepth,
mng_uint32 iEntrycount,
mng_ptr pEntries);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_hist (mng_handle hHandle,
mng_uint32 iEntrycount,
mng_uint16arr aEntries);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_time (mng_handle hHandle,
mng_uint16 iYear,
mng_uint8 iMonth,
mng_uint8 iDay,
mng_uint8 iHour,
mng_uint8 iMinute,
mng_uint8 iSecond);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_mhdr (mng_handle hHandle,
mng_uint32 iWidth,
mng_uint32 iHeight,
mng_uint32 iTicks,
mng_uint32 iLayercount,
mng_uint32 iFramecount,
mng_uint32 iPlaytime,
mng_uint32 iSimplicity);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_mend (mng_handle hHandle);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_loop (mng_handle hHandle,
mng_uint8 iLevel,
mng_uint32 iRepeat,
mng_uint8 iTermination,
mng_uint32 iItermin,
mng_uint32 iItermax,
mng_uint32 iCount,
mng_uint32p pSignals);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_endl (mng_handle hHandle,
mng_uint8 iLevel);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_defi (mng_handle hHandle,
mng_uint16 iObjectid,
mng_uint8 iDonotshow,
mng_uint8 iConcrete,
mng_bool bHasloca,
mng_int32 iXlocation,
mng_int32 iYlocation,
mng_bool bHasclip,
mng_int32 iLeftcb,
mng_int32 iRightcb,
mng_int32 iTopcb,
mng_int32 iBottomcb);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_basi (mng_handle hHandle,
mng_uint32 iWidth,
mng_uint32 iHeight,
mng_uint8 iBitdepth,
mng_uint8 iColortype,
mng_uint8 iCompression,
mng_uint8 iFilter,
mng_uint8 iInterlace,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue,
mng_uint16 iAlpha,
mng_uint8 iViewable);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_clon (mng_handle hHandle,
mng_uint16 iSourceid,
mng_uint16 iCloneid,
mng_uint8 iClonetype,
mng_uint8 iDonotshow,
mng_uint8 iConcrete,
mng_bool bHasloca,
mng_uint8 iLocationtype,
mng_int32 iLocationx,
mng_int32 iLocationy);
#ifndef MNG_SKIPCHUNK_PAST
MNG_EXT mng_retcode MNG_DECL mng_putchunk_past (mng_handle hHandle,
mng_uint16 iDestid,
mng_uint8 iTargettype,
mng_int32 iTargetx,
mng_int32 iTargety,
mng_uint32 iCount);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_past_src (mng_handle hHandle,
mng_uint32 iEntry,
mng_uint16 iSourceid,
mng_uint8 iComposition,
mng_uint8 iOrientation,
mng_uint8 iOffsettype,
mng_int32 iOffsetx,
mng_int32 iOffsety,
mng_uint8 iBoundarytype,
mng_int32 iBoundaryl,
mng_int32 iBoundaryr,
mng_int32 iBoundaryt,
mng_int32 iBoundaryb);
#endif
MNG_EXT mng_retcode MNG_DECL mng_putchunk_disc (mng_handle hHandle,
mng_uint32 iCount,
mng_uint16p pObjectids);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_back (mng_handle hHandle,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue,
mng_uint8 iMandatory,
mng_uint16 iImageid,
mng_uint8 iTile);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_fram (mng_handle hHandle,
mng_bool bEmpty,
mng_uint8 iMode,
mng_uint32 iNamesize,
mng_pchar zName,
mng_uint8 iChangedelay,
mng_uint8 iChangetimeout,
mng_uint8 iChangeclipping,
mng_uint8 iChangesyncid,
mng_uint32 iDelay,
mng_uint32 iTimeout,
mng_uint8 iBoundarytype,
mng_int32 iBoundaryl,
mng_int32 iBoundaryr,
mng_int32 iBoundaryt,
mng_int32 iBoundaryb,
mng_uint32 iCount,
mng_uint32p pSyncids);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_move (mng_handle hHandle,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint8 iMovetype,
mng_int32 iMovex,
mng_int32 iMovey);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_clip (mng_handle hHandle,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint8 iCliptype,
mng_int32 iClipl,
mng_int32 iClipr,
mng_int32 iClipt,
mng_int32 iClipb);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_show (mng_handle hHandle,
mng_bool bEmpty,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint8 iMode);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_term (mng_handle hHandle,
mng_uint8 iTermaction,
mng_uint8 iIteraction,
mng_uint32 iDelay,
mng_uint32 iItermax);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_save (mng_handle hHandle,
mng_bool bEmpty,
mng_uint8 iOffsettype,
mng_uint32 iCount);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_save_entry (mng_handle hHandle,
mng_uint32 iEntry,
mng_uint8 iEntrytype,
mng_uint32arr2 iOffset,
mng_uint32arr2 iStarttime,
mng_uint32 iLayernr,
mng_uint32 iFramenr,
mng_uint32 iNamesize,
mng_pchar zName);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_seek (mng_handle hHandle,
mng_uint32 iNamesize,
mng_pchar zName);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_expi (mng_handle hHandle,
mng_uint16 iSnapshotid,
mng_uint32 iNamesize,
mng_pchar zName);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_fpri (mng_handle hHandle,
mng_uint8 iDeltatype,
mng_uint8 iPriority);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_need (mng_handle hHandle,
mng_uint32 iKeywordssize,
mng_pchar zKeywords);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_phyg (mng_handle hHandle,
mng_bool bEmpty,
mng_uint32 iSizex,
mng_uint32 iSizey,
mng_uint8 iUnit);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_jhdr (mng_handle hHandle,
mng_uint32 iWidth,
mng_uint32 iHeight,
mng_uint8 iColortype,
mng_uint8 iImagesampledepth,
mng_uint8 iImagecompression,
mng_uint8 iImageinterlace,
mng_uint8 iAlphasampledepth,
mng_uint8 iAlphacompression,
mng_uint8 iAlphafilter,
mng_uint8 iAlphainterlace);
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,
mng_uint16 iObjectid,
mng_uint8 iImagetype,
mng_uint8 iDeltatype,
mng_uint32 iBlockwidth,
mng_uint32 iBlockheight,
mng_uint32 iBlockx,
mng_uint32 iBlocky);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_prom (mng_handle hHandle,
mng_uint8 iColortype,
mng_uint8 iSampledepth,
mng_uint8 iFilltype);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_ipng (mng_handle hHandle);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_pplt (mng_handle hHandle,
mng_uint8 iDeltatype,
mng_uint32 iCount);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_pplt_entry (mng_handle hHandle,
mng_uint32 iEntry,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue,
mng_uint16 iAlpha);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_jpng (mng_handle hHandle);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_drop (mng_handle hHandle,
mng_uint32 iCount,
mng_chunkidp pChunknames);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_dbyk (mng_handle hHandle,
mng_chunkid iChunkname,
mng_uint8 iPolarity,
mng_uint32 iKeywordssize,
mng_pchar zKeywords);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_ordr (mng_handle hHandle,
mng_uint32 iCount);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_ordr_entry (mng_handle hHandle,
mng_uint32 iEntry,
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);
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
MNG_EXT mng_retcode MNG_DECL mng_putchunk_mpng (mng_handle hHandle,
mng_uint32 iFramewidth,
mng_uint32 iFrameheight,
mng_uint16 iNumplays,
mng_uint16 iTickspersec,
mng_uint8 iCompressionmethod,
mng_uint32 iCount);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_mpng_frame (mng_handle hHandle,
mng_uint32 iEntry,
mng_uint32 iX,
mng_uint32 iY,
mng_uint32 iWidth,
mng_uint32 iHeight,
mng_int32 iXoffset,
mng_int32 iYoffset,
mng_uint16 iTicks);
#endif
MNG_EXT mng_retcode MNG_DECL mng_putchunk_evnt (mng_handle hHandle,
mng_uint32 iCount);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_evnt_entry (mng_handle hHandle,
mng_uint32 iEntry,
mng_uint8 iEventtype,
mng_uint8 iMasktype,
mng_int32 iLeft,
mng_int32 iRight,
mng_int32 iTop,
mng_int32 iBottom,
mng_uint16 iObjectid,
mng_uint8 iIndex,
mng_uint32 iSegmentnamesize,
mng_pchar zSegmentname);
MNG_EXT mng_retcode MNG_DECL mng_putchunk_unknown (mng_handle hHandle,
mng_chunkid iChunkname,
mng_uint32 iRawlen,
mng_ptr pRawdata);
#endif /* MNG_INCLUDE_WRITE_PROCS */
/* ************************************************************************** */
/* use these functions to access the actual image-data in stored chunks,
as opposed to the IDAT/JDAT data */
/* to get accurate pixel-data the canvasstyle should seriously reflect the
bitdepth/colortype combination of the preceding IHDR/JHDR/BASI/DHDR;
all input can be converted to rgb(a)8 (rgb(a)16 for 16-bit images), but
there are only limited conversions back (see below for putimgdata) */
/* call this function if you want to extract the nth image from the list;
the first image is designated seqnr 0! */
/* this function finds the IHDR/JHDR/BASI/DHDR with the appropriate seqnr,
starting from the beginning of the chunk-list; this may tend to get a little
slow for animations with a large number of chunks for images near the end */
/* supplying a seqnr past the last image in the animation will return with
an errorcode */
MNG_EXT mng_retcode MNG_DECL mng_getimgdata_seq (mng_handle hHandle,
mng_uint32 iSeqnr,
mng_uint32 iCanvasstyle,
mng_getcanvasline fGetcanvasline);
/* both the following functions will search forward to find the first IDAT/JDAT,
and then traverse back to find the start of the image (IHDR,JHDR,DHDR,BASI);
note that this is very fast compared to decoding the IDAT/JDAT, so there's
not really a need for optimization; either can be called from the
iterate_chunks callback when a IHDR/JHDR is encountered; for BASI/DHDR there
may not be real image-data so it's wisest to keep iterating till the IEND,
and then call either of these functions if necessary (remember the correct seqnr!) */
/* call this function if you want to extract the image starting at or after the nth
position in the chunk-list; this number is returned in the iterate_chunks callback */
MNG_EXT mng_retcode MNG_DECL mng_getimgdata_chunkseq (mng_handle hHandle,
mng_uint32 iSeqnr,
mng_uint32 iCanvasstyle,
mng_getcanvasline fGetcanvasline);
/* call this function if you want to extract the image starting at or after the
indicated chunk; the handle of a chunk is returned in the iterate_chunks callback */
MNG_EXT mng_retcode MNG_DECL mng_getimgdata_chunk (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 iCanvasstyle,
mng_getcanvasline fGetcanvasline);
/* ************************************************************************** */
#ifdef MNG_INCLUDE_WRITE_PROCS
/* use the following functions to add image-data to the list of stored chunks */
/* note that this only adds the IDAT or JDAT chunks and no others; you must call
one of these functions after you 'put' the initial chunks of the image and
before you 'put' the closing chunks */
/* the canvasstyle should seriously reflect the bitdepth/colortype combination;
eg. bitdepth=16 would expect a 16-bit canvasstyle,
colortype=g or ga would expect a gray or gray+alpha style respectively
and so on, and so forth ...
(nb. the number of conversions will be extremely limited for the moment!) */
MNG_EXT mng_retcode MNG_DECL mng_putimgdata_ihdr (mng_handle hHandle,
mng_uint32 iWidth,
mng_uint32 iHeight,
mng_uint8 iColortype,
mng_uint8 iBitdepth,
mng_uint8 iCompression,
mng_uint8 iFilter,
mng_uint8 iInterlace,
mng_uint32 iCanvasstyle,
mng_getcanvasline fGetcanvasline);
MNG_EXT mng_retcode MNG_DECL mng_putimgdata_jhdr (mng_handle hHandle,
mng_uint32 iWidth,
mng_uint32 iHeight,
mng_uint8 iColortype,
mng_uint8 iBitdepth,
mng_uint8 iCompression,
mng_uint8 iInterlace,
mng_uint8 iAlphaBitdepth,
mng_uint8 iAlphaCompression,
mng_uint8 iAlphaFilter,
mng_uint8 iAlphaInterlace,
mng_uint32 iCanvasstyle,
mng_getcanvasline fGetcanvasline);
/* ************************************************************************** */
/* use the following functions to set the framecount/layercount/playtime or
simplicity of an animation you are creating; this may be useful if these
variables are calculated during the creation-process */
MNG_EXT mng_retcode MNG_DECL mng_updatemngheader (mng_handle hHandle,
mng_uint32 iFramecount,
mng_uint32 iLayercount,
mng_uint32 iPlaytime);
MNG_EXT mng_retcode MNG_DECL mng_updatemngsimplicity (mng_handle hHandle,
mng_uint32 iSimplicity);
/* ************************************************************************** */
#endif /* MNG_INCLUDE_WRITE_PROCS */
#endif /* MNG_ACCESS_CHUNKS */
/* ************************************************************************** */
/* * * */
/* * Error-code structure * */
/* * * */
/* * 0b0000 00xx xxxx xxxx - basic errors; severity 9 (environment) * */
/* * 0b0000 01xx xxxx xxxx - chunk errors; severity 9 (image induced) * */
/* * 0b0000 10xx xxxx xxxx - severity 5 errors (application induced) * */
/* * 0b0001 00xx xxxx xxxx - severity 2 warnings (recoverable) * */
/* * 0b0010 00xx xxxx xxxx - severity 1 warnings (recoverable) * */
/* * * */
/* ************************************************************************** */
#define MNG_NOERROR (mng_retcode)0 /* er.. indicates all's well */
#define MNG_OUTOFMEMORY (mng_retcode)1 /* oops, buy some megabytes! */
#define MNG_INVALIDHANDLE (mng_retcode)2 /* call mng_initialize first */
#define MNG_NOCALLBACK (mng_retcode)3 /* set the callbacks please */
#define MNG_UNEXPECTEDEOF (mng_retcode)4 /* what'd ya do with the data? */
#define MNG_ZLIBERROR (mng_retcode)5 /* zlib burped */
#define MNG_JPEGERROR (mng_retcode)6 /* jpglib complained */
#define MNG_LCMSERROR (mng_retcode)7 /* little cms stressed out */
#define MNG_NOOUTPUTPROFILE (mng_retcode)8 /* no output-profile defined */
#define MNG_NOSRGBPROFILE (mng_retcode)9 /* no sRGB-profile defined */
#define MNG_BUFOVERFLOW (mng_retcode)10 /* zlib output-buffer overflow */
#define MNG_FUNCTIONINVALID (mng_retcode)11 /* ay, totally inappropriate */
#define MNG_OUTPUTERROR (mng_retcode)12 /* disk full ? */
#define MNG_JPEGBUFTOOSMALL (mng_retcode)13 /* can't handle buffer overflow*/
#define MNG_NEEDMOREDATA (mng_retcode)14 /* I'm hungry, give me more */
#define MNG_NEEDTIMERWAIT (mng_retcode)15 /* Sleep a while then wake me */
#define MNG_NEEDSECTIONWAIT (mng_retcode)16 /* just processed a SEEK */
#define MNG_LOOPWITHCACHEOFF (mng_retcode)17 /* LOOP when playback info off */
#define MNG_DLLNOTLOADED (mng_retcode)99 /* late binding failed */
#define MNG_APPIOERROR (mng_retcode)901 /* application I/O error */
#define MNG_APPTIMERERROR (mng_retcode)902 /* application timing error */
#define MNG_APPCMSERROR (mng_retcode)903 /* application CMS error */
#define MNG_APPMISCERROR (mng_retcode)904 /* application other error */
#define MNG_APPTRACEABORT (mng_retcode)905 /* application aborts on trace */
#define MNG_INTERNALERROR (mng_retcode)999 /* internal inconsistancy */
#define MNG_INVALIDSIG (mng_retcode)1025 /* invalid graphics file */
#define MNG_INVALIDCRC (mng_retcode)1027 /* crc check failed */
#define MNG_INVALIDLENGTH (mng_retcode)1028 /* chunklength mystifies me */
#define MNG_SEQUENCEERROR (mng_retcode)1029 /* invalid chunk sequence */
#define MNG_CHUNKNOTALLOWED (mng_retcode)1030 /* completely out-of-place */
#define MNG_MULTIPLEERROR (mng_retcode)1031 /* only one occurence allowed */
#define MNG_PLTEMISSING (mng_retcode)1032 /* indexed-color requires PLTE */
#define MNG_IDATMISSING (mng_retcode)1033 /* IHDR-block requires IDAT */
#define MNG_CANNOTBEEMPTY (mng_retcode)1034 /* must contain some data */
#define MNG_GLOBALLENGTHERR (mng_retcode)1035 /* global data incorrect */
#define MNG_INVALIDBITDEPTH (mng_retcode)1036 /* bitdepth out-of-range */
#define MNG_INVALIDCOLORTYPE (mng_retcode)1037 /* colortype out-of-range */
#define MNG_INVALIDCOMPRESS (mng_retcode)1038 /* compression method invalid */
#define MNG_INVALIDFILTER (mng_retcode)1039 /* filter method invalid */
#define MNG_INVALIDINTERLACE (mng_retcode)1040 /* interlace method invalid */
#define MNG_NOTENOUGHIDAT (mng_retcode)1041 /* ran out of compressed data */
#define MNG_PLTEINDEXERROR (mng_retcode)1042 /* palette-index out-of-range */
#define MNG_NULLNOTFOUND (mng_retcode)1043 /* couldn't find null-separator*/
#define MNG_KEYWORDNULL (mng_retcode)1044 /* keyword cannot be empty */
#define MNG_OBJECTUNKNOWN (mng_retcode)1045 /* the object can't be found */
#define MNG_OBJECTEXISTS (mng_retcode)1046 /* the object already exists */
#define MNG_TOOMUCHIDAT (mng_retcode)1047 /* got too much compressed data*/
#define MNG_INVSAMPLEDEPTH (mng_retcode)1048 /* sampledepth out-of-range */
#define MNG_INVOFFSETSIZE (mng_retcode)1049 /* invalid offset-size */
#define MNG_INVENTRYTYPE (mng_retcode)1050 /* invalid entry-type */
#define MNG_ENDWITHNULL (mng_retcode)1051 /* may not end with NULL */
#define MNG_INVIMAGETYPE (mng_retcode)1052 /* invalid image_type */
#define MNG_INVDELTATYPE (mng_retcode)1053 /* invalid delta_type */
#define MNG_INVALIDINDEX (mng_retcode)1054 /* index-value invalid */
#define MNG_TOOMUCHJDAT (mng_retcode)1055 /* got too much compressed data*/
#define MNG_JPEGPARMSERR (mng_retcode)1056 /* JHDR/JPEG parms do not match*/
#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_INVALIDMETHOD (mng_retcode)1064 /* invalid MAGN method */
#define MNG_IMPROBABLELENGTH (mng_retcode)1065 /* impropable chunk length */
#define MNG_INVALIDBLOCK (mng_retcode)1066 /* invalid delta block */
#define MNG_INVALIDEVENT (mng_retcode)1067 /* invalid event_type */
#define MNG_INVALIDMASK (mng_retcode)1068 /* invalid mask_type */
#define MNG_NOMATCHINGLOOP (mng_retcode)1069 /* ENDL without matching LOOP */
#define MNG_SEEKNOTFOUND (mng_retcode)1070 /* EvNT points to unknown SEEK */
#define MNG_OBJNOTABSTRACT (mng_retcode)1071 /* object must be abstract */
#define MNG_TERMSEQERROR (mng_retcode)1072 /* TERM in wrong place */
#define MNG_INVALIDFIELDVAL (mng_retcode)1073 /* invalid fieldvalue (generic)*/
#define MNG_INVALIDWIDTH (mng_retcode)1074 /* invalid frame/image width */
#define MNG_INVALIDHEIGHT (mng_retcode)1075 /* invalid frame/image height */
#define MNG_INVALIDCNVSTYLE (mng_retcode)2049 /* can't make anything of this */
#define MNG_WRONGCHUNK (mng_retcode)2050 /* accessing the wrong chunk */
#define MNG_INVALIDENTRYIX (mng_retcode)2051 /* accessing the wrong entry */
#define MNG_NOHEADER (mng_retcode)2052 /* must have had header first */
#define MNG_NOCORRCHUNK (mng_retcode)2053 /* can't find parent chunk */
#define MNG_NOMHDR (mng_retcode)2054 /* no MNG header available */
#define MNG_IMAGETOOLARGE (mng_retcode)4097 /* input-image way too big */
#define MNG_NOTANANIMATION (mng_retcode)4098 /* file not a MNG */
#define MNG_FRAMENRTOOHIGH (mng_retcode)4099 /* frame-nr out-of-range */
#define MNG_LAYERNRTOOHIGH (mng_retcode)4100 /* layer-nr out-of-range */
#define MNG_PLAYTIMETOOHIGH (mng_retcode)4101 /* playtime out-of-range */
#define MNG_FNNOTIMPLEMENTED (mng_retcode)4102 /* function not yet available */
#define MNG_IMAGEFROZEN (mng_retcode)8193 /* stopped displaying */
#define MNG_LCMS_NOHANDLE 1 /* LCMS returned NULL handle */
#define MNG_LCMS_NOMEM 2 /* LCMS returned NULL gammatab */
#define MNG_LCMS_NOTRANS 3 /* LCMS returned NULL transform*/
/* ************************************************************************** */
/* * * */
/* * Canvas styles * */
/* * * */
/* * Note that the intentions are pretty darn good, but that the focus * */
/* * is currently on 8-bit color support * */
/* * * */
/* * The RGB8_A8 style is defined for apps that require a separate * */
/* * canvas for the color-planes and the alpha-plane (eg. mozilla) * */
/* * This requires for the app to supply the "getalphaline" callback!!! * */
/* * * */
/* ************************************************************************** */
#define MNG_CANVAS_RGB8 0x00000000L
#define MNG_CANVAS_RGBA8 0x00001000L
#define MNG_CANVAS_RGBA8_PM 0x00009000L
#define MNG_CANVAS_ARGB8 0x00003000L
#define MNG_CANVAS_ARGB8_PM 0x0000B000L
#define MNG_CANVAS_RGB8_A8 0x00005000L
#define MNG_CANVAS_BGR8 0x00000001L
#define MNG_CANVAS_BGRX8 0x00010001L
#define MNG_CANVAS_BGRA8 0x00001001L
#define MNG_CANVAS_BGRA8PM 0x00009001L /* backward compatibility */
#define MNG_CANVAS_BGRA8_PM 0x00009001L
#define MNG_CANVAS_ABGR8 0x00003001L
#define MNG_CANVAS_ABGR8_PM 0x0000B001L
#define MNG_CANVAS_RGB16 0x00000100L /* not supported yet */
#define MNG_CANVAS_RGBA16 0x00001100L /* not supported yet */
#define MNG_CANVAS_ARGB16 0x00003100L /* not supported yet */
#define MNG_CANVAS_BGR16 0x00000101L /* not supported yet */
#define MNG_CANVAS_BGRA16 0x00001101L /* not supported yet */
#define MNG_CANVAS_ABGR16 0x00003101L /* not supported yet */
#define MNG_CANVAS_GRAY8 0x00000002L /* not supported yet */
#define MNG_CANVAS_GRAY16 0x00000102L /* not supported yet */
#define MNG_CANVAS_GRAYA8 0x00001002L /* not supported yet */
#define MNG_CANVAS_GRAYA16 0x00001102L /* not supported yet */
#define MNG_CANVAS_AGRAY8 0x00003002L /* not supported yet */
#define MNG_CANVAS_AGRAY16 0x00003102L /* not supported yet */
#define MNG_CANVAS_DX15 0x00000003L /* not supported yet */
#define MNG_CANVAS_DX16 0x00000004L /* not supported yet */
#define MNG_CANVAS_RGB565 0x00000005L
#define MNG_CANVAS_RGBA565 0x00001005L
#define MNG_CANVAS_BGR565 0x00000006L
#define MNG_CANVAS_BGRA565 0x00001006L
#define MNG_CANVAS_BGR565_A8 0x00004006L
#define MNG_CANVAS_RGB555 0x00000007L
#define MNG_CANVAS_BGR555 0x00000008L
#define MNG_CANVAS_PIXELTYPE(C) (C & 0x000000FFL)
#define MNG_CANVAS_BITDEPTH(C) (C & 0x00000100L)
#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_HASFILLER(C) (C & 0x00010000L)
#define MNG_CANVAS_RGB(C) (MNG_CANVAS_PIXELTYPE (C) == 0)
#define MNG_CANVAS_BGR(C) (MNG_CANVAS_PIXELTYPE (C) == 1)
#define MNG_CANVAS_GRAY(C) (MNG_CANVAS_PIXELTYPE (C) == 2)
#define MNG_CANVAS_DIRECTX15(C) (MNG_CANVAS_PIXELTYPE (C) == 3)
#define MNG_CANVAS_DIRECTX16(C) (MNG_CANVAS_PIXELTYPE (C) == 4)
#define MNG_CANVAS_RGB_565(C) (MNG_CANVAS_PIXELTYPE (C) == 5)
#define MNG_CANVAS_BGR_565(C) (MNG_CANVAS_PIXELTYPE (C) == 6)
#define MNG_CANVAS_8BIT(C) (!MNG_CANVAS_BITDEPTH (C))
#define MNG_CANVAS_16BIT(C) (MNG_CANVAS_BITDEPTH (C))
#define MNG_CANVAS_PIXELFIRST(C) (!MNG_CANVAS_ALPHAFIRST (C))
/* ************************************************************************** */
/* * * */
/* * Chunk names (idea adapted from libpng 1.1.0 - png.h) * */
/* * * */
/* ************************************************************************** */
#define MNG_UINT_HUH 0x40404040L
#define MNG_UINT_BACK 0x4241434bL
#define MNG_UINT_BASI 0x42415349L
#define MNG_UINT_CLIP 0x434c4950L
#define MNG_UINT_CLON 0x434c4f4eL
#define MNG_UINT_DBYK 0x4442594bL
#define MNG_UINT_DEFI 0x44454649L
#define MNG_UINT_DHDR 0x44484452L
#define MNG_UINT_DISC 0x44495343L
#define MNG_UINT_DROP 0x44524f50L
#define MNG_UINT_ENDL 0x454e444cL
#define MNG_UINT_FRAM 0x4652414dL
#define MNG_UINT_IDAT 0x49444154L
#define MNG_UINT_IEND 0x49454e44L
#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
#define MNG_UINT_ORDR 0x4f524452L
#define MNG_UINT_PAST 0x50415354L
#define MNG_UINT_PLTE 0x504c5445L
#define MNG_UINT_PPLT 0x50504c54L
#define MNG_UINT_PROM 0x50524f4dL
#define MNG_UINT_SAVE 0x53415645L
#define MNG_UINT_SEEK 0x5345454bL
#define MNG_UINT_SHOW 0x53484f57L
#define MNG_UINT_TERM 0x5445524dL
#define MNG_UINT_adAT 0x61644154L
#define MNG_UINT_ahDR 0x61684452L
#define MNG_UINT_bKGD 0x624b4744L
#define MNG_UINT_cHRM 0x6348524dL
#define MNG_UINT_eXPI 0x65585049L
#define MNG_UINT_evNT 0x65764e54L
#define MNG_UINT_fPRI 0x66505249L
#define MNG_UINT_gAMA 0x67414d41L
#define MNG_UINT_hIST 0x68495354L
#define MNG_UINT_iCCP 0x69434350L
#define MNG_UINT_iTXt 0x69545874L
#define MNG_UINT_mpNG 0x6d704e47L
#define MNG_UINT_nEED 0x6e454544L
#define MNG_UINT_oFFs 0x6f464673L
#define MNG_UINT_pCAL 0x7043414cL
#define MNG_UINT_pHYg 0x70444167L
#define MNG_UINT_pHYs 0x70485973L
#define MNG_UINT_sBIT 0x73424954L
#define MNG_UINT_sCAL 0x7343414cL
#define MNG_UINT_sPLT 0x73504c54L
#define MNG_UINT_sRGB 0x73524742L
#define MNG_UINT_tEXt 0x74455874L
#define MNG_UINT_tIME 0x74494d45L
#define MNG_UINT_tRNS 0x74524e53L
#define MNG_UINT_zTXt 0x7a545874L
/* ************************************************************************** */
/* * * */
/* * Chunk property values * */
/* * * */
/* ************************************************************************** */
#define MNG_BITDEPTH_1 1 /* IHDR, BASI, JHDR, PROM */
#define MNG_BITDEPTH_2 2
#define MNG_BITDEPTH_4 4
#define MNG_BITDEPTH_8 8 /* sPLT */
#define MNG_BITDEPTH_16 16
#define MNG_COLORTYPE_GRAY 0 /* IHDR, BASI, PROM */
#define MNG_COLORTYPE_RGB 2
#define MNG_COLORTYPE_INDEXED 3
#define MNG_COLORTYPE_GRAYA 4
#define MNG_COLORTYPE_RGBA 6
#define MNG_COMPRESSION_DEFLATE 0 /* IHDR, zTXt, iTXt, iCCP,
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) */
#ifdef FILTER192
#define MNG_FILTER_DIFFERING 0xC0
#endif
#ifdef FILTER193
#define MNG_FILTER_NOFILTER 0xC1
#endif
#define MNG_INTERLACE_NONE 0 /* IHDR, BASI, JHDR */
#define MNG_INTERLACE_ADAM7 1
#define MNG_FILTER_NONE 0 /* IDAT */
#define MNG_FILTER_SUB 1
#define MNG_FILTER_UP 2
#define MNG_FILTER_AVERAGE 3
#define MNG_FILTER_PAETH 4
#define MNG_INTENT_PERCEPTUAL 0 /* sRGB */
#define MNG_INTENT_RELATIVECOLORIMETRIC 1
#define MNG_INTENT_SATURATION 2
#define MNG_INTENT_ABSOLUTECOLORIMETRIC 3
/* tEXt, zTXt, iTXt */
#define MNG_TEXT_TITLE "Title"
#define MNG_TEXT_AUTHOR "Author"
#define MNG_TEXT_DESCRIPTION "Description"
#define MNG_TEXT_COPYRIGHT "Copyright"
#define MNG_TEXT_CREATIONTIME "Creation Time"
#define MNG_TEXT_SOFTWARE "Software"
#define MNG_TEXT_DISCLAIMER "Disclaimer"
#define MNG_TEXT_WARNING "Warning"
#define MNG_TEXT_SOURCE "Source"
#define MNG_TEXT_COMMENT "Comment"
#define MNG_FLAG_UNCOMPRESSED 0 /* iTXt */
#define MNG_FLAG_COMPRESSED 1
#define MNG_UNIT_UNKNOWN 0 /* pHYs, pHYg */
#define MNG_UNIT_METER 1
/* MHDR */
#define MNG_SIMPLICITY_VALID 0x00000001
#define MNG_SIMPLICITY_SIMPLEFEATURES 0x00000002
#define MNG_SIMPLICITY_COMPLEXFEATURES 0x00000004
#define MNG_SIMPLICITY_TRANSPARENCY 0x00000008
#define MNG_SIMPLICITY_JNG 0x00000010
#define MNG_SIMPLICITY_DELTAPNG 0x00000020
#define MNG_TERMINATION_DECODER_NC 0 /* LOOP */
#define MNG_TERMINATION_USER_NC 1
#define MNG_TERMINATION_EXTERNAL_NC 2
#define MNG_TERMINATION_DETERMINISTIC_NC 3
#define MNG_TERMINATION_DECODER_C 4
#define MNG_TERMINATION_USER_C 5
#define MNG_TERMINATION_EXTERNAL_C 6
#define MNG_TERMINATION_DETERMINISTIC_C 7
#define MNG_DONOTSHOW_VISIBLE 0 /* DEFI */
#define MNG_DONOTSHOW_NOTVISIBLE 1
#define MNG_ABSTRACT 0 /* DEFI */
#define MNG_CONCRETE 1
#define MNG_NOTVIEWABLE 0 /* BASI */
#define MNG_VIEWABLE 1
#define MNG_FULL_CLONE 0 /* CLON */
#define MNG_PARTIAL_CLONE 1
#define MNG_RENUMBER 2
#define MNG_CONCRETE_ASPARENT 0 /* CLON */
#define MNG_CONCRETE_MAKEABSTRACT 1
#define MNG_LOCATION_ABSOLUTE 0 /* CLON, MOVE */
#define MNG_LOCATION_RELATIVE 1
#ifndef MNG_SKIPCHUNK_PAST
#define MNG_TARGET_ABSOLUTE 0 /* PAST */
#define MNG_TARGET_RELATIVE_SAMEPAST 1
#define MNG_TARGET_RELATIVE_PREVPAST 2
#define MNG_COMPOSITE_OVER 0 /* PAST */
#define MNG_COMPOSITE_REPLACE 1
#define MNG_COMPOSITE_UNDER 2
#define MNG_ORIENTATION_SAME 0 /* PAST */
#define MNG_ORIENTATION_180DEG 2
#define MNG_ORIENTATION_FLIPHORZ 4
#define MNG_ORIENTATION_FLIPVERT 6
#define MNG_ORIENTATION_TILED 8
#define MNG_OFFSET_ABSOLUTE 0 /* PAST */
#define MNG_OFFSET_RELATIVE 1
#endif
#define MNG_BOUNDARY_ABSOLUTE 0 /* PAST, FRAM */
#define MNG_BOUNDARY_RELATIVE 1
#define MNG_BACKGROUNDCOLOR_MANDATORY 0x01 /* BACK */
#define MNG_BACKGROUNDIMAGE_MANDATORY 0x02 /* BACK */
#define MNG_BACKGROUNDIMAGE_NOTILE 0 /* BACK */
#define MNG_BACKGROUNDIMAGE_TILE 1
#define MNG_FRAMINGMODE_NOCHANGE 0 /* FRAM */
#define MNG_FRAMINGMODE_1 1
#define MNG_FRAMINGMODE_2 2
#define MNG_FRAMINGMODE_3 3
#define MNG_FRAMINGMODE_4 4
#define MNG_CHANGEDELAY_NO 0 /* FRAM */
#define MNG_CHANGEDELAY_NEXTSUBFRAME 1
#define MNG_CHANGEDELAY_DEFAULT 2
#define MNG_CHANGETIMOUT_NO 0 /* FRAM */
#define MNG_CHANGETIMOUT_DETERMINISTIC_1 1
#define MNG_CHANGETIMOUT_DETERMINISTIC_2 2
#define MNG_CHANGETIMOUT_DECODER_1 3
#define MNG_CHANGETIMOUT_DECODER_2 4
#define MNG_CHANGETIMOUT_USER_1 5
#define MNG_CHANGETIMOUT_USER_2 6
#define MNG_CHANGETIMOUT_EXTERNAL_1 7
#define MNG_CHANGETIMOUT_EXTERNAL_2 8
#define MNG_CHANGECLIPPING_NO 0 /* FRAM */
#define MNG_CHANGECLIPPING_NEXTSUBFRAME 1
#define MNG_CHANGECLIPPING_DEFAULT 2
#define MNG_CHANGESYNCID_NO 0 /* FRAM */
#define MNG_CHANGESYNCID_NEXTSUBFRAME 1
#define MNG_CHANGESYNCID_DEFAULT 2
#define MNG_CLIPPING_ABSOLUTE 0 /* CLIP */
#define MNG_CLIPPING_RELATIVE 1
#define MNG_SHOWMODE_0 0 /* SHOW */
#define MNG_SHOWMODE_1 1
#define MNG_SHOWMODE_2 2
#define MNG_SHOWMODE_3 3
#define MNG_SHOWMODE_4 4
#define MNG_SHOWMODE_5 5
#define MNG_SHOWMODE_6 6
#define MNG_SHOWMODE_7 7
#define MNG_TERMACTION_LASTFRAME 0 /* TERM */
#define MNG_TERMACTION_CLEAR 1
#define MNG_TERMACTION_FIRSTFRAME 2
#define MNG_TERMACTION_REPEAT 3
#define MNG_ITERACTION_LASTFRAME 0 /* TERM */
#define MNG_ITERACTION_CLEAR 1
#define MNG_ITERACTION_FIRSTFRAME 2
#define MNG_SAVEOFFSET_4BYTE 4 /* SAVE */
#define MNG_SAVEOFFSET_8BYTE 8
#define MNG_SAVEENTRY_SEGMENTFULL 0 /* SAVE */
#define MNG_SAVEENTRY_SEGMENT 1
#define MNG_SAVEENTRY_SUBFRAME 2
#define MNG_SAVEENTRY_EXPORTEDIMAGE 3
#define MNG_PRIORITY_ABSOLUTE 0 /* fPRI */
#define MNG_PRIORITY_RELATIVE 1
#ifdef MNG_INCLUDE_JNG
#define MNG_COLORTYPE_JPEGGRAY 8 /* JHDR */
#define MNG_COLORTYPE_JPEGCOLOR 10
#define MNG_COLORTYPE_JPEGGRAYA 12
#define MNG_COLORTYPE_JPEGCOLORA 14
#define MNG_BITDEPTH_JPEG8 8 /* JHDR */
#define MNG_BITDEPTH_JPEG12 12
#define MNG_BITDEPTH_JPEG8AND12 20
#define MNG_COMPRESSION_BASELINEJPEG 8 /* JHDR */
#define MNG_INTERLACE_SEQUENTIAL 0 /* JHDR */
#define MNG_INTERLACE_PROGRESSIVE 8
#endif /* MNG_INCLUDE_JNG */
#define MNG_IMAGETYPE_UNKNOWN 0 /* DHDR */
#define MNG_IMAGETYPE_PNG 1
#define MNG_IMAGETYPE_JNG 2
#define MNG_DELTATYPE_REPLACE 0 /* DHDR */
#define MNG_DELTATYPE_BLOCKPIXELADD 1
#define MNG_DELTATYPE_BLOCKALPHAADD 2
#define MNG_DELTATYPE_BLOCKCOLORADD 3
#define MNG_DELTATYPE_BLOCKPIXELREPLACE 4
#define MNG_DELTATYPE_BLOCKALPHAREPLACE 5
#define MNG_DELTATYPE_BLOCKCOLORREPLACE 6
#define MNG_DELTATYPE_NOCHANGE 7
#define MNG_FILLMETHOD_LEFTBITREPLICATE 0 /* PROM */
#define MNG_FILLMETHOD_ZEROFILL 1
#define MNG_DELTATYPE_REPLACERGB 0 /* PPLT */
#define MNG_DELTATYPE_DELTARGB 1
#define MNG_DELTATYPE_REPLACEALPHA 2
#define MNG_DELTATYPE_DELTAALPHA 3
#define MNG_DELTATYPE_REPLACERGBA 4
#define MNG_DELTATYPE_DELTARGBA 5
#define MNG_POLARITY_ONLY 0 /* DBYK */
#define MNG_POLARITY_ALLBUT 1
#define MNG_EVENT_NONE 0 /* evNT */
#define MNG_EVENT_MOUSEENTER 1
#define MNG_EVENT_MOUSEMOVE 2
#define MNG_EVENT_MOUSEEXIT 3
#define MNG_EVENT_MOUSEDOWN 4
#define MNG_EVENT_MOUSEUP 5
#define MNG_MASK_NONE 0 /* evNT */
#define MNG_MASK_BOX 1
#define MNG_MASK_OBJECT 2
#define MNG_MASK_OBJECTIX 3
#define MNG_MASK_BOXOBJECT 4
#define MNG_MASK_BOXOBJECTIX 5
/* ************************************************************************** */
/* * * */
/* * Processtext callback types * */
/* * * */
/* ************************************************************************** */
#define MNG_TYPE_TEXT 0
#define MNG_TYPE_ZTXT 1
#define MNG_TYPE_ITXT 2
/* ************************************************************************** */
/* * * */
/* * CRC processing masks * */
/* * * */
/* ************************************************************************** */
#define MNG_CRC_INPUT 0x0000000f
#define MNG_CRC_INPUT_NONE 0x00000000
#define MNG_CRC_INPUT_PRESENT 0x00000001
#define MNG_CRC_OUTPUT 0x000000f0
#define MNG_CRC_OUTPUT_NONE 0x00000000
#define MNG_CRC_OUTPUT_GENERATE 0x00000020
#define MNG_CRC_OUTPUT_DUMMY 0x00000040
#define MNG_CRC_ANCILLARY 0x00000f00
#define MNG_CRC_ANCILLARY_IGNORE 0x00000000
#define MNG_CRC_ANCILLARY_DISCARD 0x00000100
#define MNG_CRC_ANCILLARY_WARNING 0x00000200
#define MNG_CRC_ANCILLARY_ERROR 0x00000300
#define MNG_CRC_CRITICAL 0x0000f000
#define MNG_CRC_CRITICAL_IGNORE 0x00000000
#define MNG_CRC_CRITICAL_WARNING 0x00002000
#define MNG_CRC_CRITICAL_ERROR 0x00003000
#define MNG_CRC_DEFAULT 0x00002121
/* ************************************************************************** */
#ifdef __cplusplus
}
#endif
#endif /* _libmng_h_ */
/* ************************************************************************** */
/* * end of file * */
/* ************************************************************************** */
libmng-2.0.3/libmng_object_prc.h 0000644 0001750 0001750 00000103205 12005307152 016467 0 ustar glennrp glennrp /* ************************************************************************** */
/* * For conditions of distribution and use, * */
/* * see copyright notice in libmng.h * */
/* ************************************************************************** */
/* * * */
/* * project : libmng * */
/* * file : libmng_object_prc.h copyright (c) 2000-2007 G.Juyn * */
/* * version : 1.0.10 * */
/* * * */
/* * purpose : Object processing routines (definition) * */
/* * * */
/* * author : G.Juyn * */
/* * * */
/* * comment : Definition of the internal object processing routines * */
/* * * */
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
/* * - changed strict-ANSI stuff * */
/* * * */
/* * 0.5.2 - 05/24/2000 - G.Juyn * */
/* * - added support for global color-chunks in animation * */
/* * - added support for global PLTE,tRNS,bKGD in animation * */
/* * - added SAVE & SEEK animation objects * */
/* * 0.5.2 - 05/29/2000 - G.Juyn * */
/* * - changed ani_object create routines not to return the * */
/* * created object (wasn't necessary) * */
/* * - added compression/filter/interlace fields to * */
/* * object-buffer for delta-image processing * */
/* * * */
/* * 0.5.3 - 06/22/2000 - G.Juyn * */
/* * - added support for PPLT chunk * */
/* * * */
/* * 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 * */
/* * * */
/* * 1.0.5 - 08/19/2002 - G.Juyn * */
/* * - B597134 - libmng pollutes the linker namespace * */
/* * 1.0.5 - 09/13/2002 - G.Juyn * */
/* * - fixed read/write of MAGN chunk * */
/* * 1.0.5 - 09/15/2002 - G.Juyn * */
/* * - added event handling for dynamic MNG * */
/* * 1.0.5 - 09/20/2002 - G.Juyn * */
/* * - added support for PAST * */
/* * 1.0.5 - 09/23/2002 - G.Juyn * */
/* * - added in-memory color-correction of abstract images * */
/* * 1.0.5 - 10/07/2002 - G.Juyn * */
/* * - fixed DISC support * */
/* * * */
/* * 1.0.6 - 07/07/2003 - G.R-P * */
/* * - added conditionals around Delta-PNG code * */
/* * - added SKIPCHUNK feature * */
/* * 1.0.6 - 07/29/2003 - G.R-P * */
/* * - added conditionals around PAST chunk support * */
/* * * */
/* * 1.0.7 - 03/24/2004 - G.R-P * */
/* * - added more SKIPCHUNK conditionals * */
/* * * */
/* * 1.0.9 - 12/05/2004 - G.Juyn * */
/* * - added conditional MNG_OPTIMIZE_OBJCLEANUP * */
/* * * */
/* * 1.0.10 - 04/08/2007 - G.Juyn * */
/* * - added support for mPNG proposal * */
/* * 1.0.10 - 04/12/2007 - G.Juyn * */
/* * - added support for ANG proposal * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
#pragma option -A /* force ANSI-C */
#endif
#ifndef _libmng_object_prc_h_
#define _libmng_object_prc_h_
/* ************************************************************************** */
#ifdef MNG_INCLUDE_DISPLAY_PROCS
/* ************************************************************************** */
mng_retcode mng_drop_invalid_objects (mng_datap pData);
/* ************************************************************************** */
mng_retcode mng_create_imagedataobject (mng_datap pData,
mng_bool bConcrete,
mng_bool bViewable,
mng_uint32 iWidth,
mng_uint32 iHeight,
mng_uint8 iBitdepth,
mng_uint8 iColortype,
mng_uint8 iCompression,
mng_uint8 iFilter,
mng_uint8 iInterlace,
mng_imagedatap *ppObject);
mng_retcode mng_free_imagedataobject (mng_datap pData,
mng_imagedatap pImagedata);
mng_retcode mng_clone_imagedataobject (mng_datap pData,
mng_bool bConcrete,
mng_imagedatap pSource,
mng_imagedatap *ppClone);
/* ************************************************************************** */
mng_retcode mng_create_imageobject (mng_datap pData,
mng_uint16 iId,
mng_bool bConcrete,
mng_bool bVisible,
mng_bool bViewable,
mng_uint32 iWidth,
mng_uint32 iHeight,
mng_uint8 iBitdepth,
mng_uint8 iColortype,
mng_uint8 iCompression,
mng_uint8 iFilter,
mng_uint8 iInterlace,
mng_int32 iPosx,
mng_int32 iPosy,
mng_bool bClipped,
mng_int32 iClipl,
mng_int32 iClipr,
mng_int32 iClipt,
mng_int32 iClipb,
mng_imagep *ppObject);
mng_retcode mng_free_imageobject (mng_datap pData,
mng_imagep pImage);
mng_imagep mng_find_imageobject (mng_datap pData,
mng_uint16 iId);
mng_retcode mng_clone_imageobject (mng_datap pData,
mng_uint16 iId,
mng_bool bPartial,
mng_bool bVisible,
mng_bool bAbstract,
mng_bool bHasloca,
mng_uint8 iLocationtype,
mng_int32 iLocationx,
mng_int32 iLocationy,
mng_imagep pSource,
mng_imagep *ppClone);
mng_retcode mng_renum_imageobject (mng_datap pData,
mng_imagep pSource,
mng_uint16 iId,
mng_bool bVisible,
mng_bool bAbstract,
mng_bool bHasloca,
mng_uint8 iLocationtype,
mng_int32 iLocationx,
mng_int32 iLocationy);
mng_retcode mng_reset_object_details (mng_datap pData,
mng_imagep pImage,
mng_uint32 iWidth,
mng_uint32 iHeight,
mng_uint8 iBitdepth,
mng_uint8 iColortype,
mng_uint8 iCompression,
mng_uint8 iFilter,
mng_uint8 iInterlace,
mng_bool bResetall);
mng_retcode mng_promote_imageobject (mng_datap pData,
mng_imagep pImage,
mng_uint8 iBitdepth,
mng_uint8 iColortype,
mng_uint8 iFilltype);
mng_retcode mng_magnify_imageobject (mng_datap pData,
mng_imagep pImage);
mng_retcode mng_colorcorrect_object (mng_datap pData,
mng_imagep pImage);
/* ************************************************************************** */
mng_retcode mng_create_ani_image (mng_datap pData);
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_retcode mng_create_ani_plte (mng_datap pData,
mng_uint32 iEntrycount,
mng_palette8ep paEntries);
mng_retcode mng_create_ani_trns (mng_datap pData,
mng_uint32 iRawlen,
mng_uint8p pRawdata);
mng_retcode mng_create_ani_gama (mng_datap pData,
mng_bool bEmpty,
mng_uint32 iGamma);
mng_retcode mng_create_ani_chrm (mng_datap pData,
mng_bool bEmpty,
mng_uint32 iWhitepointx,
mng_uint32 iWhitepointy,
mng_uint32 iRedx,
mng_uint32 iRedy,
mng_uint32 iGreenx,
mng_uint32 iGreeny,
mng_uint32 iBluex,
mng_uint32 iBluey);
mng_retcode mng_create_ani_srgb (mng_datap pData,
mng_bool bEmpty,
mng_uint8 iRenderinginent);
mng_retcode mng_create_ani_iccp (mng_datap pData,
mng_bool bEmpty,
mng_uint32 iProfilesize,
mng_ptr pProfile);
mng_retcode mng_create_ani_bkgd (mng_datap pData,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue);
mng_retcode mng_create_ani_loop (mng_datap pData,
mng_uint8 iLevel,
mng_uint32 iRepeatcount,
mng_uint8 iTermcond,
mng_uint32 iItermin,
mng_uint32 iItermax,
mng_uint32 iCount,
mng_uint32p pSignals);
mng_retcode mng_create_ani_endl (mng_datap pData,
mng_uint8 iLevel);
mng_retcode mng_create_ani_defi (mng_datap pData);
mng_retcode mng_create_ani_basi (mng_datap pData,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue,
mng_bool bHasalpha,
mng_uint16 iAlpha,
mng_uint8 iViewable);
mng_retcode mng_create_ani_clon (mng_datap pData,
mng_uint16 iSourceid,
mng_uint16 iCloneid,
mng_uint8 iClonetype,
mng_bool bHasdonotshow,
mng_uint8 iDonotshow,
mng_uint8 iConcrete,
mng_bool bHasloca,
mng_uint8 iLocatype,
mng_int32 iLocax,
mng_int32 iLocay);
mng_retcode mng_create_ani_back (mng_datap pData,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue,
mng_uint8 iMandatory,
mng_uint16 iImageid,
mng_uint8 iTile);
mng_retcode mng_create_ani_fram (mng_datap pData,
mng_uint8 iFramemode,
mng_uint8 iChangedelay,
mng_uint32 iDelay,
mng_uint8 iChangetimeout,
mng_uint32 iTimeout,
mng_uint8 iChangeclipping,
mng_uint8 iCliptype,
mng_int32 iClipl,
mng_int32 iClipr,
mng_int32 iClipt,
mng_int32 iClipb);
mng_retcode mng_create_ani_move (mng_datap pData,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint8 iType,
mng_int32 iLocax,
mng_int32 iLocay);
mng_retcode mng_create_ani_clip (mng_datap pData,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint8 iType,
mng_int32 iClipl,
mng_int32 iClipr,
mng_int32 iClipt,
mng_int32 iClipb);
mng_retcode mng_create_ani_show (mng_datap pData,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint8 iMode);
mng_retcode mng_create_ani_term (mng_datap pData,
mng_uint8 iTermaction,
mng_uint8 iIteraction,
mng_uint32 iDelay,
mng_uint32 iItermax);
#ifndef MNG_SKIPCHUNK_SAVE
mng_retcode mng_create_ani_save (mng_datap pData);
#endif
#ifndef MNG_SKIPCHUNK_SEEK
mng_retcode mng_create_ani_seek (mng_datap pData,
mng_uint32 iSegmentnamesize,
mng_pchar zSegmentname);
#endif
#ifndef MNG_NO_DELTA_PNG
mng_retcode mng_create_ani_dhdr (mng_datap pData,
mng_uint16 iObjectid,
mng_uint8 iImagetype,
mng_uint8 iDeltatype,
mng_uint32 iBlockwidth,
mng_uint32 iBlockheight,
mng_uint32 iBlockx,
mng_uint32 iBlocky);
mng_retcode mng_create_ani_prom (mng_datap pData,
mng_uint8 iBitdepth,
mng_uint8 iColortype,
mng_uint8 iFilltype);
mng_retcode mng_create_ani_ipng (mng_datap pData);
mng_retcode mng_create_ani_ijng (mng_datap pData);
mng_retcode mng_create_ani_pplt (mng_datap pData,
mng_uint8 iType,
mng_uint32 iCount,
mng_palette8ep paIndexentries,
mng_uint8p paAlphaentries,
mng_uint8p paUsedentries);
#endif
#ifndef MNG_SKIPCHUNK_MAGN
mng_retcode mng_create_ani_magn (mng_datap pData,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint8 iMethodX,
mng_uint16 iMX,
mng_uint16 iMY,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint16 iMT,
mng_uint16 iMB,
mng_uint8 iMethodY);
#endif
#ifndef MNG_SKIPCHUNK_PAST
mng_retcode mng_create_ani_past (mng_datap pData,
mng_uint16 iTargetid,
mng_uint8 iTargettype,
mng_int32 iTargetx,
mng_int32 iTargety,
mng_uint32 iCount,
mng_ptr pSources);
#endif
#ifndef MNG_SKIPCHUNK_DISC
mng_retcode mng_create_ani_disc (mng_datap pData,
mng_uint32 iCount,
mng_uint16p pIds);
#endif
#else /* MNG_OPTIMIZE_CHUNKREADER */
mng_retcode mng_create_ani_plte (mng_datap pData);
mng_retcode mng_create_ani_trns (mng_datap pData);
mng_retcode mng_create_ani_gama (mng_datap pData,
mng_chunkp pChunk);
mng_retcode mng_create_ani_chrm (mng_datap pData,
mng_chunkp pChunk);
mng_retcode mng_create_ani_srgb (mng_datap pData,
mng_chunkp pChunk);
mng_retcode mng_create_ani_iccp (mng_datap pData,
mng_chunkp pChunk);
mng_retcode mng_create_ani_bkgd (mng_datap pData);
mng_retcode mng_create_ani_loop (mng_datap pData,
mng_chunkp pChunk);
mng_retcode mng_create_ani_endl (mng_datap pData,
mng_uint8 iLevel);
mng_retcode mng_create_ani_defi (mng_datap pData);
mng_retcode mng_create_ani_basi (mng_datap pData,
mng_chunkp pChunk);
mng_retcode mng_create_ani_clon (mng_datap pData,
mng_chunkp pChunk);
mng_retcode mng_create_ani_back (mng_datap pData);
mng_retcode mng_create_ani_fram (mng_datap pData,
mng_chunkp pChunk);
mng_retcode mng_create_ani_move (mng_datap pData,
mng_chunkp pChunk);
mng_retcode mng_create_ani_clip (mng_datap pData,
mng_chunkp pChunk);
mng_retcode mng_create_ani_show (mng_datap pData);
mng_retcode mng_create_ani_term (mng_datap pData,
mng_chunkp pChunk);
#ifndef MNG_SKIPCHUNK_SAVE
mng_retcode mng_create_ani_save (mng_datap pData);
#endif
#ifndef MNG_SKIPCHUNK_SEEK
mng_retcode mng_create_ani_seek (mng_datap pData,
mng_chunkp pChunk);
#endif
#ifndef MNG_NO_DELTA_PNG
mng_retcode mng_create_ani_dhdr (mng_datap pData,
mng_chunkp pChunk);
mng_retcode mng_create_ani_prom (mng_datap pData,
mng_chunkp pChunk);
mng_retcode mng_create_ani_ipng (mng_datap pData);
mng_retcode mng_create_ani_ijng (mng_datap pData);
mng_retcode mng_create_ani_pplt (mng_datap pData,
mng_uint8 iType,
mng_uint32 iCount,
mng_palette8ep paIndexentries,
mng_uint8p paAlphaentries,
mng_uint8p paUsedentries);
#endif
#ifndef MNG_SKIPCHUNK_MAGN
mng_retcode mng_create_ani_magn (mng_datap pData,
mng_chunkp pChunk);
#endif
#ifndef MNG_SKIPCHUNK_PAST
mng_retcode mng_create_ani_past (mng_datap pData,
mng_chunkp pChunk);
#endif
#ifndef MNG_SKIPCHUNK_DISC
mng_retcode mng_create_ani_disc (mng_datap pData,
mng_chunkp pChunk);
#endif
#endif /* MNG_OPTIMIZE_CHUNKREADER */
/* ************************************************************************** */
mng_retcode mng_free_ani_image (mng_datap pData,
mng_objectp pObject);
#ifndef MNG_OPTIMIZE_OBJCLEANUP
mng_retcode mng_free_ani_plte (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_free_ani_trns (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_free_ani_gama (mng_datap pData,
mng_objectp pObject);
#ifndef MNG_SKIPCHUNK_cHRM
mng_retcode mng_free_ani_chrm (mng_datap pData,
mng_objectp pObject);
#endif
#ifndef MNG_SKIPCHUNK_sRGB
mng_retcode mng_free_ani_srgb (mng_datap pData,
mng_objectp pObject);
#endif
#ifndef MNG_SKIPCHUNK_bKGD
mng_retcode mng_free_ani_bkgd (mng_datap pData,
mng_objectp pObject);
#endif
#ifndef MNG_SKIPCHUNK_LOOP
mng_retcode mng_free_ani_endl (mng_datap pData,
mng_objectp pObject);
#endif
mng_retcode mng_free_ani_defi (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_free_ani_basi (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_free_ani_clon (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_free_ani_back (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_free_ani_fram (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_free_ani_move (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_free_ani_clip (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_free_ani_show (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_free_ani_term (mng_datap pData,
mng_objectp pObject);
#ifndef MNG_SKIPCHUNK_SAVE
mng_retcode mng_free_ani_save (mng_datap pData,
mng_objectp pObject);
#endif
#ifndef MNG_NO_DELTA_PNG
mng_retcode mng_free_ani_dhdr (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_free_ani_prom (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_free_ani_ipng (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_free_ani_ijng (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_free_ani_pplt (mng_datap pData,
mng_objectp pObject);
#endif
#ifndef MNG_SKIPCHUNK_MAGN
mng_retcode mng_free_ani_magn (mng_datap pData,
mng_objectp pObject);
#endif
#endif /* MNG_OPTIMIZE_OBJCLEANUP */
#ifndef MNG_SKIPCHUNK_iCCP
mng_retcode mng_free_ani_iccp (mng_datap pData,
mng_objectp pObject);
#endif
#ifndef MNG_SKIPCHUNK_LOOP
mng_retcode mng_free_ani_loop (mng_datap pData,
mng_objectp pObject);
#endif
#ifndef MNG_SKIPCHUNK_SAVE
mng_retcode mng_free_ani_seek (mng_datap pData,
mng_objectp pObject);
#endif
#ifndef MNG_SKIPCHUNK_PAST
mng_retcode mng_free_ani_past (mng_datap pData,
mng_objectp pObject);
#endif
mng_retcode mng_free_ani_disc (mng_datap pData,
mng_objectp pObject);
/* ************************************************************************** */
mng_retcode mng_process_ani_image (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_process_ani_plte (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_process_ani_trns (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_process_ani_gama (mng_datap pData,
mng_objectp pObject);
#ifndef MNG_SKIPCHUNK_cHRM
mng_retcode mng_process_ani_chrm (mng_datap pData,
mng_objectp pObject);
#endif
#ifndef MNG_SKIPCHUNK_sRGB
mng_retcode mng_process_ani_srgb (mng_datap pData,
mng_objectp pObject);
#endif
#ifndef MNG_SKIPCHUNK_iCCP
mng_retcode mng_process_ani_iccp (mng_datap pData,
mng_objectp pObject);
#endif
#ifndef MNG_SKIPCHUNK_bKGD
mng_retcode mng_process_ani_bkgd (mng_datap pData,
mng_objectp pObject);
#endif
#ifndef MNG_SKIPCHUNK_LOOP
mng_retcode mng_process_ani_loop (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_process_ani_endl (mng_datap pData,
mng_objectp pObject);
#endif
mng_retcode mng_process_ani_defi (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_process_ani_basi (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_process_ani_clon (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_process_ani_back (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_process_ani_fram (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_process_ani_move (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_process_ani_clip (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_process_ani_show (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_process_ani_term (mng_datap pData,
mng_objectp pObject);
#ifndef MNG_SKIPCHUNK_SAVE
mng_retcode mng_process_ani_save (mng_datap pData,
mng_objectp pObject);
#endif
#ifndef MNG_SKIPCHUNK_SEEK
mng_retcode mng_process_ani_seek (mng_datap pData,
mng_objectp pObject);
#endif
#ifndef MNG_NO_DELTA_PNG
mng_retcode mng_process_ani_dhdr (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_process_ani_prom (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_process_ani_ipng (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_process_ani_ijng (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_process_ani_pplt (mng_datap pData,
mng_objectp pObject);
#endif
mng_retcode mng_process_ani_magn (mng_datap pData,
mng_objectp pObject);
#ifndef MNG_SKIPCHUNK_PAST
mng_retcode mng_process_ani_past (mng_datap pData,
mng_objectp pObject);
#endif
mng_retcode mng_process_ani_disc (mng_datap pData,
mng_objectp pObject);
/* ************************************************************************** */
#ifdef MNG_SUPPORT_DYNAMICMNG
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_retcode mng_create_event (mng_datap pData,
mng_uint8 iEventtype,
mng_uint8 iMasktype,
mng_int32 iLeft,
mng_int32 iRight,
mng_int32 iTop,
mng_int32 iBottom,
mng_uint16 iObjectid,
mng_uint8 iIndex,
mng_uint32 iSegmentnamesize,
mng_pchar zSegmentname);
#else
mng_retcode mng_create_event (mng_datap pData,
mng_ptr pEntry);
#endif
mng_retcode mng_free_event (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_process_event (mng_datap pData,
mng_objectp pObject);
#endif
/* ************************************************************************** */
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_retcode mng_create_mpng_obj (mng_datap pData,
mng_uint32 iFramewidth,
mng_uint32 iFrameheight,
mng_uint16 iNumplays,
mng_uint16 iTickspersec,
mng_uint32 iFramessize,
mng_ptr pFrames);
#else
mng_retcode mng_create_mpng_obj (mng_datap pData,
mng_ptr pEntry);
#endif
mng_retcode mng_free_mpng_obj (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_process_mpng_obj (mng_datap pData,
mng_objectp pObject);
#endif
/* ************************************************************************** */
#ifdef MNG_INCLUDE_ANG_PROPOSAL
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_retcode mng_create_ang_obj (mng_datap pData,
mng_uint32 iNumframes,
mng_uint32 iTickspersec,
mng_uint32 iNumplays,
mng_uint32 iTilewidth,
mng_uint32 iTileheight,
mng_uint8 iInterlace,
mng_uint8 iStillused);
#else
mng_retcode mng_create_ang_obj (mng_datap pData,
mng_ptr pEntry);
#endif
mng_retcode mng_free_ang_obj (mng_datap pData,
mng_objectp pObject);
mng_retcode mng_process_ang_obj (mng_datap pData,
mng_objectp pObject);
#endif
/* ************************************************************************** */
#endif /* MNG_INCLUDE_DISPLAY_PROCS */
/* ************************************************************************** */
#endif /* _libmng_object_prc_h_ */
/* ************************************************************************** */
/* * end of file * */
/* ************************************************************************** */
libmng-2.0.3/libmng_display.c 0000644 0001750 0001750 00001032531 12005307152 016021 0 ustar glennrp glennrp #include "config.h"
/* ************************************************************************** */
/* * For conditions of distribution and use, * */
/* * see copyright notice in libmng.h * */
/* ************************************************************************** */
/* * * */
/* * project : libmng * */
/* * file : libmng_display.c copyright (c) 2000-2007 G.Juyn * */
/* * version : 1.0.10 * */
/* * * */
/* * purpose : Display management (implementation) * */
/* * * */
/* * author : G.Juyn * */
/* * * */
/* * comment : implementation of the display management routines * */
/* * * */
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
/* * - changed strict-ANSI stuff * */
/* * 0.5.1 - 05/11/2000 - G.Juyn * */
/* * - added callback error-reporting support * */
/* * - fixed frame_delay misalignment * */
/* * 0.5.1 - 05/12/2000 - G.Juyn * */
/* * - added sanity check for frozen status * */
/* * - changed trace to macro for callback error-reporting * */
/* * 0.5.1 - 05/13/2000 - G.Juyn * */
/* * - changed display_mend to reset state to initial or SAVE * */
/* * - added eMNGma hack (will be removed in 1.0.0 !!!) * */
/* * - added TERM animation object pointer (easier reference) * */
/* * - added process_save & process_seek routines * */
/* * 0.5.1 - 05/14/2000 - G.Juyn * */
/* * - added save_state and restore_state for SAVE/SEEK/TERM * */
/* * processing * */
/* * * */
/* * 0.5.2 - 05/20/2000 - G.Juyn * */
/* * - added JNG support (JHDR/JDAT) * */
/* * 0.5.2 - 05/23/2000 - G.Juyn * */
/* * - fixed problem with DEFI clipping * */
/* * 0.5.2 - 05/30/2000 - G.Juyn * */
/* * - added delta-image support (DHDR,PROM,IPNG,IJNG) * */
/* * 0.5.2 - 05/31/2000 - G.Juyn * */
/* * - fixed pointer confusion (contributed by Tim Rowley) * */
/* * 0.5.2 - 06/03/2000 - G.Juyn * */
/* * - fixed makeup for Linux gcc compile * */
/* * 0.5.2 - 06/05/2000 - G.Juyn * */
/* * - added support for RGB8_A8 canvasstyle * */
/* * 0.5.2 - 06/09/2000 - G.Juyn * */
/* * - fixed timer-handling to run with Mozilla (Tim Rowley) * */
/* * 0.5.2 - 06/10/2000 - G.Juyn * */
/* * - fixed some compilation-warnings (contrib Jason Morris) * */
/* * * */
/* * 0.5.3 - 06/12/2000 - G.Juyn * */
/* * - fixed display of stored JNG images * */
/* * 0.5.3 - 06/13/2000 - G.Juyn * */
/* * - fixed problem with BASI-IEND as object 0 * */
/* * 0.5.3 - 06/16/2000 - G.Juyn * */
/* * - changed progressive-display processing * */
/* * 0.5.3 - 06/17/2000 - G.Juyn * */
/* * - changed delta-image processing * */
/* * 0.5.3 - 06/20/2000 - G.Juyn * */
/* * - fixed some minor stuff * */
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
/* * - added speed-modifier to timing routine * */
/* * 0.5.3 - 06/22/2000 - G.Juyn * */
/* * - added support for PPLT chunk processing * */
/* * 0.5.3 - 06/29/2000 - G.Juyn * */
/* * - swapped refresh parameters * */
/* * * */
/* * 0.9.0 - 06/30/2000 - G.Juyn * */
/* * - changed refresh parameters to 'x,y,width,height' * */
/* * * */
/* * 0.9.1 - 07/07/2000 - G.Juyn * */
/* * - implemented support for freeze/reset/resume & go_xxxx * */
/* * 0.9.1 - 07/08/2000 - G.Juyn * */
/* * - added support for improved timing * */
/* * 0.9.1 - 07/14/2000 - G.Juyn * */
/* * - changed EOF processing behavior * */
/* * - fixed TERM delay processing * */
/* * 0.9.1 - 07/15/2000 - G.Juyn * */
/* * - fixed freeze & reset processing * */
/* * 0.9.1 - 07/16/2000 - G.Juyn * */
/* * - fixed storage of images during mng_read() * */
/* * - fixed support for mng_display() after mng_read() * */
/* * 0.9.1 - 07/24/2000 - G.Juyn * */
/* * - fixed reading of still-images * */
/* * * */
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 08/07/2000 - G.Juyn * */
/* * - B111300 - fixup for improved portability * */
/* * 0.9.3 - 08/21/2000 - G.Juyn * */
/* * - fixed TERM processing delay of 0 msecs * */
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
/* * - added MAGN chunk * */
/* * 0.9.3 - 09/10/2000 - G.Juyn * */
/* * - fixed problem with no refresh after TERM * */
/* * - fixed DEFI behavior * */
/* * 0.9.3 - 09/16/2000 - G.Juyn * */
/* * - fixed timing & refresh behavior for single PNG/JNG * */
/* * 0.9.3 - 09/19/2000 - G.Juyn * */
/* * - refixed timing & refresh behavior for single PNG/JNG * */
/* * 0.9.3 - 10/02/2000 - G.Juyn * */
/* * - fixed timing again (this is getting boring...) * */
/* * - refixed problem with no refresh after TERM * */
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
/* * - added JDAA chunk * */
/* * 0.9.3 - 10/17/2000 - G.Juyn * */
/* * - fixed support for bKGD * */
/* * 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 * */
/* * 0.9.3 - 10/27/2000 - G.Juyn * */
/* * - fixed separate read() & display() processing * */
/* * * */
/* * 0.9.4 - 10/31/2000 - G.Juyn * */
/* * - fixed possible loop in display_resume() (Thanks Vova!) * */
/* * 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 * */
/* * - added restore of object 0 to TERM processing !!! * */
/* * - fixed TERM delay processing * */
/* * - fixed TERM end processing (count = 0) * */
/* * 0.9.4 - 12/16/2000 - G.Juyn * */
/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */
/* * 0.9.4 - 1/18/2001 - G.Juyn * */
/* * - removed test filter-methods 1 & 65 * */
/* * - set default level-set for filtertype=64 to all zeroes * */
/* * * */
/* * 0.9.5 - 1/20/2001 - G.Juyn * */
/* * - fixed compiler-warnings Mozilla (thanks Tim) * */
/* * 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 * */
/* * * */
/* * 1.0.2 - 06/25/2001 - G.Juyn * */
/* * - fixed memory-leak with delta-images (Thanks Michael!) * */
/* * * */
/* * 1.0.5 - 08/15/2002 - G.Juyn * */
/* * - completed PROM support * */
/* * - completed delta-image support * */
/* * 1.0.5 - 08/19/2002 - G.Juyn * */
/* * - B597134 - libmng pollutes the linker namespace * */
/* * 1.0.5 - 09/13/2002 - G.Juyn * */
/* * - fixed read/write of MAGN chunk * */
/* * 1.0.5 - 09/15/2002 - G.Juyn * */
/* * - fixed LOOP iteration=0 special case * */
/* * 1.0.5 - 09/19/2002 - G.Juyn * */
/* * - fixed color-correction for restore-background handling * */
/* * - optimized restore-background for bKGD cases * */
/* * - cleaned up some old stuff * */
/* * 1.0.5 - 09/20/2002 - G.Juyn * */
/* * - finished support for BACK image & tiling * */
/* * - added support for PAST * */
/* * 1.0.5 - 09/22/2002 - G.Juyn * */
/* * - added bgrx8 canvas (filler byte) * */
/* * 1.0.5 - 10/05/2002 - G.Juyn * */
/* * - fixed dropping mix of frozen/unfrozen objects * */
/* * 1.0.5 - 10/07/2002 - G.Juyn * */
/* * - added proposed change in handling of TERM- & if-delay * */
/* * - added another fix for misplaced TERM chunk * */
/* * - completed support for condition=2 in TERM chunk * */
/* * 1.0.5 - 10/18/2002 - G.Juyn * */
/* * - fixed clipping-problem with BACK tiling (Thanks Sakura!) * */
/* * 1.0.5 - 10/20/2002 - G.Juyn * */
/* * - fixed processing for multiple objects in MAGN * */
/* * - fixed display of visible target of PAST operation * */
/* * 1.0.5 - 10/30/2002 - G.Juyn * */
/* * - modified TERM/MEND processing for max(1, TERM_delay, * */
/* * interframe_delay) * */
/* * 1.0.5 - 11/04/2002 - G.Juyn * */
/* * - fixed layer- & frame-counting during read() * */
/* * - fixed goframe/golayer/gotime processing * */
/* * 1.0.5 - 01/19/2003 - G.Juyn * */
/* * - B654627 - fixed SEGV when no gettickcount callback * */
/* * - B664383 - fixed typo * */
/* * - finalized changes in TERM/final_delay to elected proposal* */
/* * * */
/* * 1.0.6 - 05/11/2003 - G. Juyn * */
/* * - added conditionals around canvas update routines * */
/* * 1.0.6 - 05/25/2003 - G.R-P * */
/* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */
/* * 1.0.6 - 07/07/2003 - G.R-P * */
/* * - added conditionals around some JNG-supporting code * */
/* * - added conditionals around 16-bit supporting code * */
/* * - reversed some loops to use decrementing counter * */
/* * - combined init functions into one function * */
/* * 1.0.6 - 07/10/2003 - G.R-P * */
/* * - replaced nested switches with simple init setup function * */
/* * 1.0.6 - 07/29/2003 - G.R-P * */
/* * - added conditionals around PAST chunk support * */
/* * 1.0.6 - 08/17/2003 - G.R-P * */
/* * - added conditionals around non-VLC chunk support * */
/* * * */
/* * 1.0.7 - 11/27/2003 - R.A * */
/* * - added CANVAS_RGB565 and CANVAS_BGR565 * */
/* * 1.0.7 - 12/06/2003 - R.A * */
/* * - added CANVAS_RGBA565 and CANVAS_BGRA565 * */
/* * 1.0.7 - 01/25/2004 - J.S * */
/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */
/* * * */
/* * 1.0.8 - 03/31/2004 - G.Juyn * */
/* * - fixed problem with PAST usage where source > dest * */
/* * 1.0.8 - 05/04/2004 - G.R-P. * */
/* * - fixed misplaced 16-bit conditionals * */
/* * * */
/* * 1.0.9 - 09/18/2004 - G.R-P. * */
/* * - revised some SKIPCHUNK conditionals * */
/* * 1.0.9 - 10/10/2004 - G.R-P. * */
/* * - added MNG_NO_1_2_4BIT_SUPPORT * */
/* * 1.0.9 - 10/14/2004 - G.Juyn * */
/* * - added bgr565_a8 canvas-style (thanks to J. Elvander) * */
/* * 1.0.9 - 12/11/2004 - G.Juyn * */
/* * - added conditional MNG_OPTIMIZE_DISPLAYCALLS * */
/* * 1.0.9 - 12/20/2004 - G.Juyn * */
/* * - cleaned up macro-invocations (thanks to D. Airlie) * */
/* * * */
/* * 1.0.10 - 07/06/2005 - G.R-P. * */
/* * - added more SKIPCHUNK conditionals * */
/* * 1.0.10 - 12/28/2005 - G.R-P. * */
/* * - added missing SKIPCHUNK_MAGN conditional * */
/* * 1.0.10 - 03/07/2006 - (thanks to W. Manthey) * */
/* * - added CANVAS_RGB555 and CANVAS_BGR555 * */
/* * 1.0.10 - 04/08/2007 - G.Juyn * */
/* * - fixed several compiler warnings * */
/* * 1.0.10 - 04/08/2007 - G.Juyn * */
/* * - added support for mPNG proposal * */
/* * 1.0.10 - 04/12/2007 - G.Juyn * */
/* * - added support for ANG proposal * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
#include "libmng_data.h"
#include "libmng_error.h"
#include "libmng_trace.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "libmng_chunks.h"
#include "libmng_objects.h"
#include "libmng_object_prc.h"
#include "libmng_memory.h"
#include "libmng_zlib.h"
#include "libmng_jpeg.h"
#include "libmng_cms.h"
#include "libmng_pixels.h"
#include "libmng_display.h"
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
#pragma option -A /* force ANSI-C */
#endif
/* ************************************************************************** */
#ifdef MNG_INCLUDE_DISPLAY_PROCS
/* ************************************************************************** */
MNG_LOCAL mng_retcode set_delay (mng_datap pData,
mng_uint32 iInterval)
{
if (!iInterval) /* at least 1 msec please! */
iInterval = 1;
if (pData->bRunning) /* only when really displaying */
if (!pData->fSettimer ((mng_handle)pData, iInterval))
MNG_ERROR (pData, MNG_APPTIMERERROR);
#ifdef MNG_SUPPORT_DYNAMICMNG
if ((!pData->bDynamic) || (pData->bRunning))
#else
if (pData->bRunning)
#endif
pData->bTimerset = MNG_TRUE; /* and indicate so */
return MNG_NOERROR;
}
/* ************************************************************************** */
MNG_LOCAL mng_uint32 calculate_delay (mng_datap pData,
mng_uint32 iDelay)
{
mng_uint32 iTicks = pData->iTicks;
mng_uint32 iWaitfor = 1; /* default non-MNG delay */
if (!iTicks) /* tick_count not specified ? */
if (pData->eImagetype == mng_it_mng)
iTicks = 1000;
if (iTicks)
{
switch (pData->iSpeed) /* honor speed modifier */
{
case mng_st_fast :
{
iWaitfor = (mng_uint32)(( 500 * iDelay) / iTicks);
break;
}
case mng_st_slow :
{
iWaitfor = (mng_uint32)((3000 * iDelay) / iTicks);
break;
}
case mng_st_slowest :
{
iWaitfor = (mng_uint32)((8000 * iDelay) / iTicks);
break;
}
default :
{
iWaitfor = (mng_uint32)((1000 * iDelay) / iTicks);
}
}
}
return iWaitfor;
}
/* ************************************************************************** */
/* * * */
/* * Progressive display refresh - does the call to the refresh callback * */
/* * and sets the timer to allow the app to perform the actual refresh to * */
/* * the screen (eg. process its main message-loop) * */
/* * * */
/* ************************************************************************** */
mng_retcode mng_display_progressive_refresh (mng_datap pData,
mng_uint32 iInterval)
{
{ /* let the app refresh first ? */
if ((pData->bRunning) && (!pData->bSkipping) &&
(pData->iUpdatetop < pData->iUpdatebottom) && (pData->iUpdateleft < pData->iUpdateright))
{
if (!pData->fRefresh (((mng_handle)pData),
pData->iUpdateleft, pData->iUpdatetop,
pData->iUpdateright - pData->iUpdateleft,
pData->iUpdatebottom - pData->iUpdatetop))
MNG_ERROR (pData, MNG_APPMISCERROR);
pData->iUpdateleft = 0; /* reset update-region */
pData->iUpdateright = 0;
pData->iUpdatetop = 0;
pData->iUpdatebottom = 0; /* reset refreshneeded indicator */
pData->bNeedrefresh = MNG_FALSE;
/* interval requested ? */
if ((!pData->bFreezing) && (iInterval))
{ /* setup the timer */
mng_retcode iRetcode = set_delay (pData, iInterval);
if (iRetcode) /* on error bail out */
return iRetcode;
}
}
}
return MNG_NOERROR;
}
/* ************************************************************************** */
/* * * */
/* * Generic display routines * */
/* * * */
/* ************************************************************************** */
MNG_LOCAL mng_retcode interframe_delay (mng_datap pData)
{
mng_uint32 iWaitfor = 0;
mng_uint32 iInterval;
mng_uint32 iRuninterval;
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INTERFRAME_DELAY, MNG_LC_START);
#endif
{
#ifndef MNG_SKIPCHUNK_FRAM
if (pData->iFramedelay > 0) /* real delay ? */
{ /* let the app refresh first ? */
if ((pData->bRunning) && (!pData->bSkipping) &&
(pData->iUpdatetop < pData->iUpdatebottom) && (pData->iUpdateleft < pData->iUpdateright))
if (!pData->fRefresh (((mng_handle)pData),
pData->iUpdateleft, pData->iUpdatetop,
pData->iUpdateright - pData->iUpdateleft,
pData->iUpdatebottom - pData->iUpdatetop))
MNG_ERROR (pData, MNG_APPMISCERROR);
pData->iUpdateleft = 0; /* reset update-region */
pData->iUpdateright = 0;
pData->iUpdatetop = 0;
pData->iUpdatebottom = 0; /* reset refreshneeded indicator */
pData->bNeedrefresh = MNG_FALSE;
#ifndef MNG_SKIPCHUNK_TERM
if (pData->bOnlyfirstframe) /* only processing first frame after TERM ? */
{
pData->iFramesafterTERM++;
/* did we do a frame yet ? */
if (pData->iFramesafterTERM > 1)
{ /* then that's it; just stop right here ! */
pData->pCurraniobj = MNG_NULL;
pData->bRunning = MNG_FALSE;
return MNG_NOERROR;
}
}
#endif
if (pData->fGettickcount)
{ /* get current tickcount */
pData->iRuntime = pData->fGettickcount ((mng_handle)pData);
/* calculate interval since last sync-point */
if (pData->iRuntime < pData->iSynctime)
iRuninterval = pData->iRuntime + ~pData->iSynctime + 1;
else
iRuninterval = pData->iRuntime - pData->iSynctime;
/* calculate actual run-time */
if (pData->iRuntime < pData->iStarttime)
pData->iRuntime = pData->iRuntime + ~pData->iStarttime + 1;
else
pData->iRuntime = pData->iRuntime - pData->iStarttime;
}
else
{
iRuninterval = 0;
}
iWaitfor = calculate_delay (pData, pData->iFramedelay);
if (iWaitfor > iRuninterval) /* delay necessary ? */
iInterval = iWaitfor - iRuninterval;
else
iInterval = 1; /* force app to process messageloop */
/* set the timer ? */
if (((pData->bRunning) || (pData->bSearching) || (pData->bReading)) &&
(!pData->bSkipping))
{
iRetcode = set_delay (pData, iInterval);
if (iRetcode) /* on error bail out */
return iRetcode;
}
}
if (!pData->bSkipping) /* increase frametime in advance */
pData->iFrametime = pData->iFrametime + iWaitfor;
/* setup for next delay */
pData->iFramedelay = pData->iNextdelay;
#endif
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INTERFRAME_DELAY, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
MNG_LOCAL void set_display_routine (mng_datap pData)
{ /* actively running ? */
if (((pData->bRunning) || (pData->bSearching)) && (!pData->bSkipping))
{
switch (pData->iCanvasstyle) /* determine display routine */
{
#ifndef MNG_SKIPCANVAS_RGB8
case MNG_CANVAS_RGB8 : { pData->fDisplayrow = (mng_fptr)mng_display_rgb8; break; }
#endif
#ifndef MNG_SKIPCANVAS_RGBA8
case MNG_CANVAS_RGBA8 : { pData->fDisplayrow = (mng_fptr)mng_display_rgba8; break; }
#endif
#ifndef MNG_SKIPCANVAS_RGBA8_PM
case MNG_CANVAS_RGBA8_PM: { pData->fDisplayrow = (mng_fptr)mng_display_rgba8_pm; break; }
#endif
#ifndef MNG_SKIPCANVAS_ARGB8
case MNG_CANVAS_ARGB8 : { pData->fDisplayrow = (mng_fptr)mng_display_argb8; break; }
#endif
#ifndef MNG_SKIPCANVAS_ARGB8_PM
case MNG_CANVAS_ARGB8_PM: { pData->fDisplayrow = (mng_fptr)mng_display_argb8_pm; break; }
#endif
#ifndef MNG_SKIPCANVAS_RGB8_A8
case MNG_CANVAS_RGB8_A8 : { pData->fDisplayrow = (mng_fptr)mng_display_rgb8_a8; break; }
#endif
#ifndef MNG_SKIPCANVAS_BGR8
case MNG_CANVAS_BGR8 : { pData->fDisplayrow = (mng_fptr)mng_display_bgr8; break; }
#endif
#ifndef MNG_SKIPCANVAS_BGRX8
case MNG_CANVAS_BGRX8 : { pData->fDisplayrow = (mng_fptr)mng_display_bgrx8; break; }
#endif
#ifndef MNG_SKIPCANVAS_BGRA8
case MNG_CANVAS_BGRA8 : { pData->fDisplayrow = (mng_fptr)mng_display_bgra8; break; }
#endif
#ifndef MNG_SKIPCANVAS_BGRA8_PM
case MNG_CANVAS_BGRA8_PM: { pData->fDisplayrow = (mng_fptr)mng_display_bgra8_pm; break; }
#endif
#ifndef MNG_SKIPCANVAS_ABGR8
case MNG_CANVAS_ABGR8 : { pData->fDisplayrow = (mng_fptr)mng_display_abgr8; break; }
#endif
#ifndef MNG_SKIPCANVAS_ABGR8_PM
case MNG_CANVAS_ABGR8_PM: { pData->fDisplayrow = (mng_fptr)mng_display_abgr8_pm; break; }
#endif
#ifndef MNG_SKIPCANVAS_RGB565
case MNG_CANVAS_RGB565 : { pData->fDisplayrow = (mng_fptr)mng_display_rgb565; break; }
#endif
#ifndef MNG_SKIPCANVAS_RGBA565
case MNG_CANVAS_RGBA565 : { pData->fDisplayrow = (mng_fptr)mng_display_rgba565; break; }
#endif
#ifndef MNG_SKIPCANVAS_BGR565
case MNG_CANVAS_BGR565 : { pData->fDisplayrow = (mng_fptr)mng_display_bgr565; break; }
#endif
#ifndef MNG_SKIPCANVAS_BGRA565
case MNG_CANVAS_BGRA565 : { pData->fDisplayrow = (mng_fptr)mng_display_bgra565; break; }
#endif
#ifndef MNG_SKIPCANVAS_BGR565_A8
case MNG_CANVAS_BGR565_A8 : { pData->fDisplayrow = (mng_fptr)mng_display_bgr565_a8; break; }
#endif
#ifndef MNG_SKIPCANVAS_RGB555
case MNG_CANVAS_RGB555 : { pData->fDisplayrow = (mng_fptr)mng_display_rgb555; break; }
#endif
#ifndef MNG_SKIPCANVAS_BGR555
case MNG_CANVAS_BGR555 : { pData->fDisplayrow = (mng_fptr)mng_display_bgr555; break; }
#endif
#ifndef MNG_NO_16BIT_SUPPORT
/* case MNG_CANVAS_RGB16 : { pData->fDisplayrow = (mng_fptr)mng_display_rgb16; break; } */
/* case MNG_CANVAS_RGBA16 : { pData->fDisplayrow = (mng_fptr)mng_display_rgba16; break; } */
/* case MNG_CANVAS_ARGB16 : { pData->fDisplayrow = (mng_fptr)mng_display_argb16; break; } */
/* case MNG_CANVAS_BGR16 : { pData->fDisplayrow = (mng_fptr)mng_display_bgr16; break; } */
/* case MNG_CANVAS_BGRA16 : { pData->fDisplayrow = (mng_fptr)mng_display_bgra16; break; } */
/* case MNG_CANVAS_ABGR16 : { pData->fDisplayrow = (mng_fptr)mng_display_abgr16; break; } */
#endif
/* case MNG_CANVAS_INDEX8 : { pData->fDisplayrow = (mng_fptr)mng_display_index8; break; } */
/* case MNG_CANVAS_INDEXA8 : { pData->fDisplayrow = (mng_fptr)mng_display_indexa8; break; } */
/* case MNG_CANVAS_AINDEX8 : { pData->fDisplayrow = (mng_fptr)mng_display_aindex8; break; } */
/* case MNG_CANVAS_GRAY8 : { pData->fDisplayrow = (mng_fptr)mng_display_gray8; break; } */
/* case MNG_CANVAS_AGRAY8 : { pData->fDisplayrow = (mng_fptr)mng_display_agray8; break; } */
/* case MNG_CANVAS_GRAYA8 : { pData->fDisplayrow = (mng_fptr)mng_display_graya8; break; } */
#ifndef MNG_NO_16BIT_SUPPORT
/* case MNG_CANVAS_GRAY16 : { pData->fDisplayrow = (mng_fptr)mng_display_gray16; break; } */
/* case MNG_CANVAS_GRAYA16 : { pData->fDisplayrow = (mng_fptr)mng_display_graya16; break; } */
/* case MNG_CANVAS_AGRAY16 : { pData->fDisplayrow = (mng_fptr)mng_display_agray16; break; } */
#endif
/* case MNG_CANVAS_DX15 : { pData->fDisplayrow = (mng_fptr)mng_display_dx15; break; } */
/* case MNG_CANVAS_DX16 : { pData->fDisplayrow = (mng_fptr)mng_display_dx16; break; } */
}
}
return;
}
/* ************************************************************************** */
MNG_LOCAL mng_retcode load_bkgdlayer (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_LOAD_BKGDLAYER, MNG_LC_START);
#endif
/* actively running ? */
if (((pData->bRunning) || (pData->bSearching)) && (!pData->bSkipping))
{
mng_int32 iY;
mng_retcode iRetcode;
mng_bool bColorcorr = MNG_FALSE;
/* save values */
mng_int32 iDestl = pData->iDestl;
mng_int32 iDestr = pData->iDestr;
mng_int32 iDestt = pData->iDestt;
mng_int32 iDestb = pData->iDestb;
mng_int32 iSourcel = pData->iSourcel;
mng_int32 iSourcer = pData->iSourcer;
mng_int32 iSourcet = pData->iSourcet;
mng_int32 iSourceb = pData->iSourceb;
mng_int8 iPass = pData->iPass;
mng_int32 iRow = pData->iRow;
mng_int32 iRowinc = pData->iRowinc;
mng_int32 iCol = pData->iCol;
mng_int32 iColinc = pData->iColinc;
mng_int32 iRowsamples = pData->iRowsamples;
mng_int32 iRowsize = pData->iRowsize;
mng_uint8p pPrevrow = pData->pPrevrow;
mng_uint8p pRGBArow = pData->pRGBArow;
mng_bool bIsRGBA16 = pData->bIsRGBA16;
mng_bool bIsOpaque = pData->bIsOpaque;
mng_fptr fCorrectrow = pData->fCorrectrow;
mng_fptr fDisplayrow = pData->fDisplayrow;
mng_fptr fRetrieverow = pData->fRetrieverow;
mng_objectp pCurrentobj = pData->pCurrentobj;
mng_objectp pRetrieveobj = pData->pRetrieveobj;
pData->iDestl = 0; /* determine clipping region */
pData->iDestt = 0;
pData->iDestr = pData->iWidth;
pData->iDestb = pData->iHeight;
#ifndef MNG_SKIPCHUNK_FRAM
if (pData->bFrameclipping) /* frame clipping specified ? */
{
pData->iDestl = MAX_COORD (pData->iDestl, pData->iFrameclipl);
pData->iDestt = MAX_COORD (pData->iDestt, pData->iFrameclipt);
pData->iDestr = MIN_COORD (pData->iDestr, pData->iFrameclipr);
pData->iDestb = MIN_COORD (pData->iDestb, pData->iFrameclipb);
}
#endif
/* anything to clear ? */
if ((pData->iDestr >= pData->iDestl) && (pData->iDestb >= pData->iDestt))
{
pData->iPass = -1; /* these are the object's dimensions now */
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iWidth;
pData->iRowsize = pData->iRowsamples << 2;
pData->bIsRGBA16 = MNG_FALSE; /* let's keep it simple ! */
pData->bIsOpaque = MNG_TRUE;
pData->iSourcel = 0; /* source relative to destination */
pData->iSourcer = pData->iDestr - pData->iDestl;
pData->iSourcet = 0;
pData->iSourceb = pData->iDestb - pData->iDestt;
set_display_routine (pData); /* determine display routine */
/* default restore using preset BG color */
pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_bgcolor;
#ifndef MNG_SKIPCHUNK_bKGD
if (((pData->eImagetype == mng_it_png) || (pData->eImagetype == mng_it_jng)) &&
(pData->bUseBKGD))
{ /* prefer bKGD in PNG/JNG */
if (!pData->pCurrentobj)
pData->pCurrentobj = pData->pObjzero;
if (((mng_imagep)pData->pCurrentobj)->pImgbuf->bHasBKGD)
{
pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_bkgd;
bColorcorr = MNG_TRUE;
}
}
#endif
if (pData->fGetbkgdline) /* background-canvas-access callback set ? */
{
switch (pData->iBkgdstyle)
{
#ifndef MNG_SKIPCANVAS_RGB8
case MNG_CANVAS_RGB8 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_rgb8; break; }
#endif
#ifndef MNG_SKIPCANVAS_BGR8
case MNG_CANVAS_BGR8 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_bgr8; break; }
#endif
#ifndef MNG_SKIPCANVAS_BGRX8
case MNG_CANVAS_BGRX8 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_bgrx8; break; }
#endif
#ifndef MNG_SKIPCANVAS_BGR565
case MNG_CANVAS_BGR565 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_bgr565; break; }
#endif
#ifndef MNG_SKIPCANVAS_RGB565
case MNG_CANVAS_RGB565 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_rgb565; break; }
#endif
#ifndef MNG_NO_16BIT_SUPPORT
/* case MNG_CANVAS_RGB16 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_rgb16; break; } */
/* case MNG_CANVAS_BGR16 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_bgr16; break; } */
#endif
/* case MNG_CANVAS_INDEX8 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_index8; break; } */
/* case MNG_CANVAS_GRAY8 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_gray8; break; } */
#ifndef MNG_NO_16BIT_SUPPORT
/* case MNG_CANVAS_GRAY16 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_gray16; break; } */
#endif
/* case MNG_CANVAS_DX15 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_dx15; break; } */
/* case MNG_CANVAS_DX16 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_dx16; break; } */
}
}
#ifndef MNG_SKIPCHUNK_BACK
if (pData->bHasBACK)
{ /* background image ? */
if ((pData->iBACKmandatory & 0x02) && (pData->iBACKimageid))
{
pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_backcolor;
bColorcorr = MNG_TRUE;
}
else /* background color ? */
if (pData->iBACKmandatory & 0x01)
{
pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_backcolor;
bColorcorr = MNG_TRUE;
}
}
#endif
pData->fCorrectrow = MNG_NULL; /* default no color-correction */
if (bColorcorr) /* do we have to do color-correction ? */
{
#ifdef MNG_NO_CMS
iRetcode = MNG_NOERROR;
#else
#if defined(MNG_FULL_CMS) /* determine color-management routine */
iRetcode = mng_init_full_cms (pData, MNG_TRUE, MNG_FALSE, MNG_FALSE);
#elif defined(MNG_GAMMA_ONLY)
iRetcode = mng_init_gamma_only (pData, MNG_TRUE, MNG_FALSE, MNG_FALSE);
#elif defined(MNG_APP_CMS)
iRetcode = mng_init_app_cms (pData, MNG_TRUE, MNG_FALSE, MNG_FALSE);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
#endif /* MNG_NO_CMS */
}
/* get a temporary row-buffer */
MNG_ALLOC (pData, pData->pRGBArow, pData->iRowsize);
iY = pData->iDestt; /* this is where we start */
iRetcode = MNG_NOERROR; /* so far, so good */
while ((!iRetcode) && (iY < pData->iDestb))
{ /* restore a background row */
iRetcode = ((mng_restbkgdrow)pData->fRestbkgdrow) (pData);
/* color correction ? */
if ((!iRetcode) && (pData->fCorrectrow))
iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData);
if (!iRetcode) /* so... display it */
iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData);
if (!iRetcode)
iRetcode = mng_next_row (pData);
iY++; /* and next line */
}
/* drop the temporary row-buffer */
MNG_FREE (pData, pData->pRGBArow, pData->iRowsize);
if (iRetcode) /* on error bail out */
return iRetcode;
#if defined(MNG_FULL_CMS) /* cleanup cms stuff */
if (bColorcorr) /* did we do color-correction ? */
{
iRetcode = mng_clear_cms (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
}
#endif
#ifndef MNG_SKIPCHUNK_BACK
/* background image ? */
if ((pData->bHasBACK) && (pData->iBACKmandatory & 0x02) && (pData->iBACKimageid))
{
mng_imagep pImage;
/* let's find that object then */
pData->pRetrieveobj = mng_find_imageobject (pData, pData->iBACKimageid);
pImage = (mng_imagep)pData->pRetrieveobj;
/* exists, viewable and visible ? */
if ((pImage) && (pImage->bViewable) && (pImage->bVisible))
{ /* will it fall within the target region ? */
if ((pImage->iPosx < pData->iDestr) && (pImage->iPosy < pData->iDestb) &&
((pData->iBACKtile) ||
((pImage->iPosx + (mng_int32)pImage->pImgbuf->iWidth >= pData->iDestl) &&
(pImage->iPosy + (mng_int32)pImage->pImgbuf->iHeight >= pData->iDestt) )) &&
((!pImage->bClipped) ||
((pImage->iClipl <= pImage->iClipr) && (pImage->iClipt <= pImage->iClipb) &&
(pImage->iClipl < pData->iDestr) && (pImage->iClipr >= pData->iDestl) &&
(pImage->iClipt < pData->iDestb) && (pImage->iClipb >= pData->iDestt) )))
{ /* right; we've got ourselves something to do */
if (pImage->bClipped) /* clip output region with image's clipping region ? */
{
if (pImage->iClipl > pData->iDestl)
pData->iDestl = pImage->iClipl;
if (pImage->iClipr < pData->iDestr)
pData->iDestr = pImage->iClipr;
if (pImage->iClipt > pData->iDestt)
pData->iDestt = pImage->iClipt;
if (pImage->iClipb < pData->iDestb)
pData->iDestb = pImage->iClipb;
}
/* image offset does some extra clipping too ! */
if (pImage->iPosx > pData->iDestl)
pData->iDestl = pImage->iPosx;
if (pImage->iPosy > pData->iDestt)
pData->iDestt = pImage->iPosy;
if (!pData->iBACKtile) /* without tiling further clipping is needed */
{
if (pImage->iPosx + (mng_int32)pImage->pImgbuf->iWidth < pData->iDestr)
pData->iDestr = pImage->iPosx + (mng_int32)pImage->pImgbuf->iWidth;
if (pImage->iPosy + (mng_int32)pImage->pImgbuf->iHeight < pData->iDestb)
pData->iDestb = pImage->iPosy + (mng_int32)pImage->pImgbuf->iHeight;
}
pData->iSourcel = 0; /* source relative to destination */
pData->iSourcer = pData->iDestr - pData->iDestl;
pData->iSourcet = 0;
pData->iSourceb = pData->iDestb - pData->iDestt;
/* 16-bit background ? */
#ifdef MNG_NO_16BIT_SUPPORT
pData->bIsRGBA16 = MNG_FALSE;
#else
pData->bIsRGBA16 = (mng_bool)(pImage->pImgbuf->iBitdepth > 8);
#endif
/* let restore routine know the offsets !!! */
pData->iBackimgoffsx = pImage->iPosx;
pData->iBackimgoffsy = pImage->iPosy;
pData->iBackimgwidth = pImage->pImgbuf->iWidth;
pData->iBackimgheight = pImage->pImgbuf->iHeight;
pData->iRow = 0; /* start at the top again !! */
/* determine background object retrieval routine */
switch (pImage->pImgbuf->iColortype)
{
case 0 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_fptr)mng_retrieve_g16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_g8;
pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS);
break;
}
case 2 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8;
pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS);
break;
}
case 3 : { pData->fRetrieverow = (mng_fptr)mng_retrieve_idx8;
pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS);
break;
}
case 4 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_fptr)mng_retrieve_ga16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8;
pData->bIsOpaque = MNG_FALSE;
break;
}
case 6 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8;
pData->bIsOpaque = MNG_FALSE;
break;
}
case 8 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_fptr)mng_retrieve_g16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_g8;
pData->bIsOpaque = MNG_TRUE;
break;
}
case 10 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8;
pData->bIsOpaque = MNG_TRUE;
break;
}
case 12 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_fptr)mng_retrieve_ga16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8;
pData->bIsOpaque = MNG_FALSE;
break;
}
case 14 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8;
pData->bIsOpaque = MNG_FALSE;
break;
}
}
#ifdef MNG_NO_CMS
iRetcode = MNG_NOERROR;
#else
#if defined(MNG_FULL_CMS) /* determine color-management routine */
iRetcode = mng_init_full_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE);
#elif defined(MNG_GAMMA_ONLY)
iRetcode = mng_init_gamma_only (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE);
#elif defined(MNG_APP_CMS)
iRetcode = mng_init_app_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
#endif /* MNG_NO_CMS */
/* get temporary row-buffers */
MNG_ALLOC (pData, pData->pPrevrow, pData->iRowsize);
MNG_ALLOC (pData, pData->pRGBArow, pData->iRowsize);
iY = pData->iDestt; /* this is where we start */
iRetcode = MNG_NOERROR; /* so far, so good */
while ((!iRetcode) && (iY < pData->iDestb))
{ /* restore a background row */
iRetcode = mng_restore_bkgd_backimage (pData);
/* color correction ? */
if ((!iRetcode) && (pData->fCorrectrow))
iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData);
if (!iRetcode) /* so... display it */
iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData);
if (!iRetcode)
iRetcode = mng_next_row (pData);
iY++; /* and next line */
}
/* drop temporary row-buffers */
MNG_FREE (pData, pData->pRGBArow, pData->iRowsize);
MNG_FREE (pData, pData->pPrevrow, pData->iRowsize);
if (iRetcode) /* on error bail out */
return iRetcode;
#if defined(MNG_FULL_CMS) /* cleanup cms stuff */
iRetcode = mng_clear_cms (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
#endif
}
}
}
#endif
}
pData->iDestl = iDestl; /* restore values */
pData->iDestr = iDestr;
pData->iDestt = iDestt;
pData->iDestb = iDestb;
pData->iSourcel = iSourcel;
pData->iSourcer = iSourcer;
pData->iSourcet = iSourcet;
pData->iSourceb = iSourceb;
pData->iPass = iPass;
pData->iRow = iRow;
pData->iRowinc = iRowinc;
pData->iCol = iCol;
pData->iColinc = iColinc;
pData->iRowsamples = iRowsamples;
pData->iRowsize = iRowsize;
pData->pPrevrow = pPrevrow;
pData->pRGBArow = pRGBArow;
pData->bIsRGBA16 = bIsRGBA16;
pData->bIsOpaque = bIsOpaque;
pData->fCorrectrow = fCorrectrow;
pData->fDisplayrow = fDisplayrow;
pData->fRetrieverow = fRetrieverow;
pData->pCurrentobj = pCurrentobj;
pData->pRetrieveobj = pRetrieveobj;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_LOAD_BKGDLAYER, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
MNG_LOCAL mng_retcode clear_canvas (mng_datap pData)
{
mng_int32 iY;
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_CLEAR_CANVAS, MNG_LC_START);
#endif
pData->iDestl = 0; /* clipping region is full canvas! */
pData->iDestt = 0;
pData->iDestr = pData->iWidth;
pData->iDestb = pData->iHeight;
pData->iSourcel = 0; /* source is same as destination */
pData->iSourcer = pData->iWidth;
pData->iSourcet = 0;
pData->iSourceb = pData->iHeight;
pData->iPass = -1; /* these are the object's dimensions now */
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iWidth;
pData->iRowsize = pData->iRowsamples << 2;
pData->bIsRGBA16 = MNG_FALSE; /* let's keep it simple ! */
pData->bIsOpaque = MNG_TRUE;
set_display_routine (pData); /* determine display routine */
/* get a temporary row-buffer */
/* it's transparent black by default!! */
MNG_ALLOC (pData, pData->pRGBArow, pData->iRowsize);
iY = pData->iDestt; /* this is where we start */
iRetcode = MNG_NOERROR; /* so far, so good */
while ((!iRetcode) && (iY < pData->iDestb))
{ /* clear a row then */
iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData);
if (!iRetcode)
iRetcode = mng_next_row (pData); /* adjust variables for next row */
iY++; /* and next line */
}
/* drop the temporary row-buffer */
MNG_FREE (pData, pData->pRGBArow, pData->iRowsize);
if (iRetcode) /* on error bail out */
return iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_CLEAR_CANVAS, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
MNG_LOCAL mng_retcode next_frame (mng_datap pData,
mng_uint8 iFramemode,
mng_uint8 iChangedelay,
mng_uint32 iDelay,
mng_uint8 iChangetimeout,
mng_uint32 iTimeout,
mng_uint8 iChangeclipping,
mng_uint8 iCliptype,
mng_int32 iClipl,
mng_int32 iClipr,
mng_int32 iClipt,
mng_int32 iClipb)
{
mng_retcode iRetcode = MNG_NOERROR;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_NEXT_FRAME, MNG_LC_START);
#endif
if (!pData->iBreakpoint) /* no previous break here ? */
{
#ifndef MNG_SKIPCHUNK_FRAM
mng_uint8 iOldmode = pData->iFramemode;
/* interframe delay required ? */
if ((iOldmode == 2) || (iOldmode == 4))
{
if ((pData->iFrameseq) && (iFramemode != 1) && (iFramemode != 3))
iRetcode = interframe_delay (pData);
else
pData->iFramedelay = pData->iNextdelay;
}
else
{ /* delay before inserting background layer? */
if ((pData->bFramedone) && (iFramemode == 4))
iRetcode = interframe_delay (pData);
}
if (iRetcode) /* on error bail out */
return iRetcode;
/* now we'll assume we're in the next frame! */
if (iFramemode) /* save the new framing mode ? */
{
pData->iFRAMmode = iFramemode;
pData->iFramemode = iFramemode;
}
else /* reload default */
pData->iFramemode = pData->iFRAMmode;
if (iChangedelay) /* delay changed ? */
{
pData->iNextdelay = iDelay; /* for *after* next subframe */
if ((iOldmode == 2) || (iOldmode == 4))
pData->iFramedelay = pData->iFRAMdelay;
if (iChangedelay == 2) /* also overall ? */
pData->iFRAMdelay = iDelay;
}
else
{ /* reload default */
pData->iNextdelay = pData->iFRAMdelay;
}
if (iChangetimeout) /* timeout changed ? */
{ /* for next subframe */
pData->iFrametimeout = iTimeout;
if ((iChangetimeout == 2) || /* also overall ? */
(iChangetimeout == 4) ||
(iChangetimeout == 6) ||
(iChangetimeout == 8))
pData->iFRAMtimeout = iTimeout;
}
else /* reload default */
pData->iFrametimeout = pData->iFRAMtimeout;
if (iChangeclipping) /* clipping changed ? */
{
pData->bFrameclipping = MNG_TRUE;
if (!iCliptype) /* absolute ? */
{
pData->iFrameclipl = iClipl;
pData->iFrameclipr = iClipr;
pData->iFrameclipt = iClipt;
pData->iFrameclipb = iClipb;
}
else /* relative */
{
pData->iFrameclipl = pData->iFrameclipl + iClipl;
pData->iFrameclipr = pData->iFrameclipr + iClipr;
pData->iFrameclipt = pData->iFrameclipt + iClipt;
pData->iFrameclipb = pData->iFrameclipb + iClipb;
}
if (iChangeclipping == 2) /* also overall ? */
{
pData->bFRAMclipping = MNG_TRUE;
if (!iCliptype) /* absolute ? */
{
pData->iFRAMclipl = iClipl;
pData->iFRAMclipr = iClipr;
pData->iFRAMclipt = iClipt;
pData->iFRAMclipb = iClipb;
}
else /* relative */
{
pData->iFRAMclipl = pData->iFRAMclipl + iClipl;
pData->iFRAMclipr = pData->iFRAMclipr + iClipr;
pData->iFRAMclipt = pData->iFRAMclipt + iClipt;
pData->iFRAMclipb = pData->iFRAMclipb + iClipb;
}
}
}
else
{ /* reload defaults */
pData->bFrameclipping = pData->bFRAMclipping;
pData->iFrameclipl = pData->iFRAMclipl;
pData->iFrameclipr = pData->iFRAMclipr;
pData->iFrameclipt = pData->iFRAMclipt;
pData->iFrameclipb = pData->iFRAMclipb;
}
#endif
}
if (!pData->bTimerset) /* timer still off ? */
{
if (
#ifndef MNG_SKIPCHUNK_FRAM
(pData->iFramemode == 4) || /* insert background layer after a new frame */
#endif
(!pData->iLayerseq)) /* and certainly before the very first layer */
iRetcode = load_bkgdlayer (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
pData->iFrameseq++; /* count the frame ! */
pData->bFramedone = MNG_TRUE; /* and indicate we've done one */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_NEXT_FRAME, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
MNG_LOCAL mng_retcode next_layer (mng_datap pData)
{
mng_imagep pImage;
mng_retcode iRetcode = MNG_NOERROR;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_NEXT_LAYER, MNG_LC_START);
#endif
#ifndef MNG_SKIPCHUNK_FRAM
if (!pData->iBreakpoint) /* no previous break here ? */
{ /* interframe delay required ? */
if ((pData->eImagetype == mng_it_mng) && (pData->iLayerseq) &&
((pData->iFramemode == 1) || (pData->iFramemode == 3)))
iRetcode = interframe_delay (pData);
else
pData->iFramedelay = pData->iNextdelay;
if (iRetcode) /* on error bail out */
return iRetcode;
}
#endif
if (!pData->bTimerset) /* timer still off ? */
{
if (!pData->iLayerseq) /* restore background for the very first layer ? */
{ /* wait till IDAT/JDAT for PNGs & JNGs !!! */
if ((pData->eImagetype == mng_it_png) || (pData->eImagetype == mng_it_jng))
pData->bRestorebkgd = MNG_TRUE;
else
{ /* for MNG we do it right away */
iRetcode = load_bkgdlayer (pData);
pData->iLayerseq++; /* and it counts as a layer then ! */
}
}
#ifndef MNG_SKIPCHUNK_FRAM
else
if (pData->iFramemode == 3) /* restore background for each layer ? */
iRetcode = load_bkgdlayer (pData);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
#ifndef MNG_NO_DELTA_PNG
if (pData->bHasDHDR) /* processing a delta-image ? */
pImage = (mng_imagep)pData->pDeltaImage;
else
#endif
pImage = (mng_imagep)pData->pCurrentobj;
if (!pImage) /* not an active object ? */
pImage = (mng_imagep)pData->pObjzero;
/* determine display rectangle */
pData->iDestl = MAX_COORD ((mng_int32)0, pImage->iPosx);
pData->iDestt = MAX_COORD ((mng_int32)0, pImage->iPosy);
/* is it a valid buffer ? */
if ((pImage->pImgbuf->iWidth) && (pImage->pImgbuf->iHeight))
{
pData->iDestr = MIN_COORD ((mng_int32)pData->iWidth,
pImage->iPosx + (mng_int32)pImage->pImgbuf->iWidth );
pData->iDestb = MIN_COORD ((mng_int32)pData->iHeight,
pImage->iPosy + (mng_int32)pImage->pImgbuf->iHeight);
}
else /* it's a single image ! */
{
pData->iDestr = MIN_COORD ((mng_int32)pData->iWidth,
(mng_int32)pData->iDatawidth );
pData->iDestb = MIN_COORD ((mng_int32)pData->iHeight,
(mng_int32)pData->iDataheight);
}
#ifndef MNG_SKIPCHUNK_FRAM
if (pData->bFrameclipping) /* frame clipping specified ? */
{
pData->iDestl = MAX_COORD (pData->iDestl, pData->iFrameclipl);
pData->iDestt = MAX_COORD (pData->iDestt, pData->iFrameclipt);
pData->iDestr = MIN_COORD (pData->iDestr, pData->iFrameclipr);
pData->iDestb = MIN_COORD (pData->iDestb, pData->iFrameclipb);
}
#endif
if (pImage->bClipped) /* is the image clipped itself ? */
{
pData->iDestl = MAX_COORD (pData->iDestl, pImage->iClipl);
pData->iDestt = MAX_COORD (pData->iDestt, pImage->iClipt);
pData->iDestr = MIN_COORD (pData->iDestr, pImage->iClipr);
pData->iDestb = MIN_COORD (pData->iDestb, pImage->iClipb);
}
/* determine source starting point */
pData->iSourcel = MAX_COORD ((mng_int32)0, pData->iDestl - pImage->iPosx);
pData->iSourcet = MAX_COORD ((mng_int32)0, pData->iDestt - pImage->iPosy);
if ((pImage->pImgbuf->iWidth) && (pImage->pImgbuf->iHeight))
{ /* and maximum size */
pData->iSourcer = MIN_COORD ((mng_int32)pImage->pImgbuf->iWidth,
pData->iSourcel + pData->iDestr - pData->iDestl);
pData->iSourceb = MIN_COORD ((mng_int32)pImage->pImgbuf->iHeight,
pData->iSourcet + pData->iDestb - pData->iDestt);
}
else /* it's a single image ! */
{
pData->iSourcer = pData->iSourcel + pData->iDestr - pData->iDestl;
pData->iSourceb = pData->iSourcet + pData->iDestb - pData->iDestt;
}
pData->iLayerseq++; /* count the layer ! */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_NEXT_LAYER, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_display_image (mng_datap pData,
mng_imagep pImage,
mng_bool bLayeradvanced)
{
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_IMAGE, MNG_LC_START);
#endif
/* actively running ? */
#ifndef MNG_SKIPCHUNK_MAGN
if (((pData->bRunning) || (pData->bSearching)) && (!pData->bSkipping))
{
if ( (!pData->iBreakpoint) && /* needs magnification ? */
( (pImage->iMAGN_MethodX) || (pImage->iMAGN_MethodY) ) )
{
iRetcode = mng_magnify_imageobject (pData, pImage);
if (iRetcode) /* on error bail out */
return iRetcode;
}
}
#endif
pData->pRetrieveobj = pImage; /* so retrieve-row and color-correction can find it */
if (!bLayeradvanced) /* need to advance the layer ? */
{
mng_imagep pSave = pData->pCurrentobj;
pData->pCurrentobj = pImage;
next_layer (pData); /* advance to next layer */
pData->pCurrentobj = pSave;
}
/* need to restore the background ? */
if ((!pData->bTimerset) && (pData->bRestorebkgd))
{
mng_imagep pSave = pData->pCurrentobj;
pData->pCurrentobj = pImage;
pData->bRestorebkgd = MNG_FALSE;
iRetcode = load_bkgdlayer (pData);
pData->pCurrentobj = pSave;
if (iRetcode) /* on error bail out */
return iRetcode;
pData->iLayerseq++; /* and it counts as a layer then ! */
}
/* actively running ? */
if (((pData->bRunning) || (pData->bSearching)) && (!pData->bSkipping))
{
if (!pData->bTimerset) /* all systems still go ? */
{
pData->iBreakpoint = 0; /* let's make absolutely sure... */
/* anything to display ? */
if ((pData->iDestr >= pData->iDestl) && (pData->iDestb >= pData->iDestt))
{
mng_int32 iY;
set_display_routine (pData); /* determine display routine */
/* and image-buffer retrieval routine */
switch (pImage->pImgbuf->iColortype)
{
case 0 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_fptr)mng_retrieve_g16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_g8;
pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS);
break;
}
case 2 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8;
pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS);
break;
}
case 3 : { pData->fRetrieverow = (mng_fptr)mng_retrieve_idx8;
pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS);
break;
}
case 4 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_fptr)mng_retrieve_ga16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8;
pData->bIsOpaque = MNG_FALSE;
break;
}
case 6 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8;
pData->bIsOpaque = MNG_FALSE;
break;
}
case 8 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_fptr)mng_retrieve_g16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_g8;
pData->bIsOpaque = MNG_TRUE;
break;
}
case 10 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8;
pData->bIsOpaque = MNG_TRUE;
break;
}
case 12 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_fptr)mng_retrieve_ga16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8;
pData->bIsOpaque = MNG_FALSE;
break;
}
case 14 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pImage->pImgbuf->iBitdepth > 8)
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8;
pData->bIsOpaque = MNG_FALSE;
break;
}
}
pData->iPass = -1; /* these are the object's dimensions now */
pData->iRow = pData->iSourcet;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pImage->pImgbuf->iWidth;
pData->iRowsize = pData->iRowsamples << 2;
pData->bIsRGBA16 = MNG_FALSE;
/* adjust for 16-bit object ? */
#ifndef MNG_NO_16BIT_SUPPORT
if (pImage->pImgbuf->iBitdepth > 8)
{
pData->bIsRGBA16 = MNG_TRUE;
pData->iRowsize = pData->iRowsamples << 3;
}
#endif
pData->fCorrectrow = MNG_NULL; /* default no color-correction */
#ifdef MNG_NO_CMS
iRetcode = MNG_NOERROR;
#else
#if defined(MNG_FULL_CMS) /* determine color-management routine */
iRetcode = mng_init_full_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE);
#elif defined(MNG_GAMMA_ONLY)
iRetcode = mng_init_gamma_only (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE);
#elif defined(MNG_APP_CMS)
iRetcode = mng_init_app_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
#endif /* MNG_NO_CMS */
/* get a temporary row-buffer */
MNG_ALLOC (pData, pData->pRGBArow, pData->iRowsize);
iY = pData->iSourcet; /* this is where we start */
while ((!iRetcode) && (iY < pData->iSourceb))
{ /* get a row */
iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData);
/* color correction ? */
if ((!iRetcode) && (pData->fCorrectrow))
iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData);
if (!iRetcode) /* so... display it */
iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData);
if (!iRetcode) /* adjust variables for next row */
iRetcode = mng_next_row (pData);
iY++; /* and next line */
}
/* drop the temporary row-buffer */
MNG_FREE (pData, pData->pRGBArow, pData->iRowsize);
if (iRetcode) /* on error bail out */
return iRetcode;
#if defined(MNG_FULL_CMS) /* cleanup cms stuff */
iRetcode = mng_clear_cms (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
#endif
}
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_IMAGE, MNG_LC_END);
#endif
return MNG_NOERROR; /* whehehe, this is good ! */
}
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
mng_retcode mng_execute_delta_image (mng_datap pData,
mng_imagep pTarget,
mng_imagep pDelta)
{
mng_imagedatap pBuftarget = pTarget->pImgbuf;
mng_imagedatap pBufdelta = pDelta->pImgbuf;
mng_uint32 iY;
mng_retcode iRetcode;
mng_ptr pSaveRGBA;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_EXECUTE_DELTA_IMAGE, MNG_LC_START);
#endif
/* actively running ? */
if (((pData->bRunning) || (pData->bSearching)) && (!pData->bSkipping))
{
if (pBufdelta->bHasPLTE) /* palette in delta ? */
{
mng_uint32 iX;
/* new palette larger than old one ? */
if ((!pBuftarget->bHasPLTE) || (pBuftarget->iPLTEcount < pBufdelta->iPLTEcount))
pBuftarget->iPLTEcount = pBufdelta->iPLTEcount;
/* it's definitely got a PLTE now */
pBuftarget->bHasPLTE = MNG_TRUE;
for (iX = 0; iX < pBufdelta->iPLTEcount; iX++)
{
pBuftarget->aPLTEentries[iX].iRed = pBufdelta->aPLTEentries[iX].iRed;
pBuftarget->aPLTEentries[iX].iGreen = pBufdelta->aPLTEentries[iX].iGreen;
pBuftarget->aPLTEentries[iX].iBlue = pBufdelta->aPLTEentries[iX].iBlue;
}
}
if (pBufdelta->bHasTRNS) /* cheap transparency in delta ? */
{
switch (pData->iColortype) /* drop it into the target */
{
case 0: { /* gray */
pBuftarget->iTRNSgray = pBufdelta->iTRNSgray;
pBuftarget->iTRNSred = 0;
pBuftarget->iTRNSgreen = 0;
pBuftarget->iTRNSblue = 0;
pBuftarget->iTRNScount = 0;
break;
}
case 2: { /* rgb */
pBuftarget->iTRNSgray = 0;
pBuftarget->iTRNSred = pBufdelta->iTRNSred;
pBuftarget->iTRNSgreen = pBufdelta->iTRNSgreen;
pBuftarget->iTRNSblue = pBufdelta->iTRNSblue;
pBuftarget->iTRNScount = 0;
break;
}
case 3: { /* indexed */
pBuftarget->iTRNSgray = 0;
pBuftarget->iTRNSred = 0;
pBuftarget->iTRNSgreen = 0;
pBuftarget->iTRNSblue = 0;
/* existing range smaller than new one ? */
if ((!pBuftarget->bHasTRNS) || (pBuftarget->iTRNScount < pBufdelta->iTRNScount))
pBuftarget->iTRNScount = pBufdelta->iTRNScount;
MNG_COPY (pBuftarget->aTRNSentries, pBufdelta->aTRNSentries, pBufdelta->iTRNScount);
break;
}
}
pBuftarget->bHasTRNS = MNG_TRUE; /* tell it it's got a tRNS now */
}
#ifndef MNG_SKIPCHUNK_bKGD
if (pBufdelta->bHasBKGD) /* bkgd in source ? */
{ /* drop it onto the target */
pBuftarget->bHasBKGD = MNG_TRUE;
pBuftarget->iBKGDindex = pBufdelta->iBKGDindex;
pBuftarget->iBKGDgray = pBufdelta->iBKGDgray;
pBuftarget->iBKGDred = pBufdelta->iBKGDred;
pBuftarget->iBKGDgreen = pBufdelta->iBKGDgreen;
pBuftarget->iBKGDblue = pBufdelta->iBKGDblue;
}
#endif
if (pBufdelta->bHasGAMA) /* gamma in source ? */
{
pBuftarget->bHasGAMA = MNG_TRUE; /* drop it onto the target */
pBuftarget->iGamma = pBufdelta->iGamma;
}
#ifndef MNG_SKIPCHUNK_cHRM
if (pBufdelta->bHasCHRM) /* chroma in delta ? */
{ /* drop it onto the target */
pBuftarget->bHasCHRM = MNG_TRUE;
pBuftarget->iWhitepointx = pBufdelta->iWhitepointx;
pBuftarget->iWhitepointy = pBufdelta->iWhitepointy;
pBuftarget->iPrimaryredx = pBufdelta->iPrimaryredx;
pBuftarget->iPrimaryredy = pBufdelta->iPrimaryredy;
pBuftarget->iPrimarygreenx = pBufdelta->iPrimarygreenx;
pBuftarget->iPrimarygreeny = pBufdelta->iPrimarygreeny;
pBuftarget->iPrimarybluex = pBufdelta->iPrimarybluex;
pBuftarget->iPrimarybluey = pBufdelta->iPrimarybluey;
}
#endif
#ifndef MNG_SKIPCHUNK_sRGB
if (pBufdelta->bHasSRGB) /* sRGB in delta ? */
{ /* drop it onto the target */
pBuftarget->bHasSRGB = MNG_TRUE;
pBuftarget->iRenderingintent = pBufdelta->iRenderingintent;
}
#endif
#ifndef MNG_SKIPCHUNK_iCCP
if (pBufdelta->bHasICCP) /* ICC profile in delta ? */
{
pBuftarget->bHasICCP = MNG_TRUE; /* drop it onto the target */
if (pBuftarget->pProfile) /* profile existed ? */
MNG_FREEX (pData, pBuftarget->pProfile, pBuftarget->iProfilesize);
/* allocate a buffer & copy it */
MNG_ALLOC (pData, pBuftarget->pProfile, pBufdelta->iProfilesize);
MNG_COPY (pBuftarget->pProfile, pBufdelta->pProfile, pBufdelta->iProfilesize);
/* store its length as well */
pBuftarget->iProfilesize = pBufdelta->iProfilesize;
}
#endif
/* need to execute delta pixels ? */
if ((!pData->bDeltaimmediate) && (pData->iDeltatype != MNG_DELTATYPE_NOCHANGE))
{
pData->fScalerow = MNG_NULL; /* not needed by default */
switch (pBufdelta->iBitdepth) /* determine scaling routine */
{
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case 1 : {
switch (pBuftarget->iBitdepth)
{
case 2 : { pData->fScalerow = (mng_fptr)mng_scale_g1_g2; break; }
case 4 : { pData->fScalerow = (mng_fptr)mng_scale_g1_g4; break; }
case 8 : { pData->fScalerow = (mng_fptr)mng_scale_g1_g8; break; }
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : { pData->fScalerow = (mng_fptr)mng_scale_g1_g16; break; }
#endif
}
break;
}
case 2 : {
switch (pBuftarget->iBitdepth)
{
case 1 : { pData->fScalerow = (mng_fptr)mng_scale_g2_g1; break; }
case 4 : { pData->fScalerow = (mng_fptr)mng_scale_g2_g4; break; }
case 8 : { pData->fScalerow = (mng_fptr)mng_scale_g2_g8; break; }
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : { pData->fScalerow = (mng_fptr)mng_scale_g2_g16; break; }
#endif
}
break;
}
case 4 : {
switch (pBuftarget->iBitdepth)
{
case 1 : { pData->fScalerow = (mng_fptr)mng_scale_g4_g1; break; }
case 2 : { pData->fScalerow = (mng_fptr)mng_scale_g4_g2; break; }
case 8 : { pData->fScalerow = (mng_fptr)mng_scale_g4_g8; break; }
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : { pData->fScalerow = (mng_fptr)mng_scale_g4_g16; break; }
#endif
}
break;
}
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case 8 : {
switch (pBufdelta->iColortype)
{
case 0 : ;
case 3 : ;
case 8 : {
switch (pBuftarget->iBitdepth)
{
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case 1 : { pData->fScalerow = (mng_fptr)mng_scale_g8_g1; break; }
case 2 : { pData->fScalerow = (mng_fptr)mng_scale_g8_g2; break; }
case 4 : { pData->fScalerow = (mng_fptr)mng_scale_g8_g4; break; }
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : { pData->fScalerow = (mng_fptr)mng_scale_g8_g16; break; }
#endif
}
break;
}
case 2 : ;
case 10 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pBuftarget->iBitdepth == 16)
pData->fScalerow = (mng_fptr)mng_scale_rgb8_rgb16;
#endif
break;
}
case 4 : ;
case 12 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pBuftarget->iBitdepth == 16)
pData->fScalerow = (mng_fptr)mng_scale_ga8_ga16;
#endif
break;
}
case 6 : ;
case 14 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pBuftarget->iBitdepth == 16)
pData->fScalerow = (mng_fptr)mng_scale_rgba8_rgba16;
#endif
break;
}
}
break;
}
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : {
switch (pBufdelta->iColortype)
{
case 0 : ;
case 3 : ;
case 8 : {
switch (pBuftarget->iBitdepth)
{
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case 1 : { pData->fScalerow = (mng_fptr)mng_scale_g16_g1; break; }
case 2 : { pData->fScalerow = (mng_fptr)mng_scale_g16_g2; break; }
case 4 : { pData->fScalerow = (mng_fptr)mng_scale_g16_g4; break; }
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case 8 : { pData->fScalerow = (mng_fptr)mng_scale_g16_g8; break; }
}
break;
}
case 2 : ;
case 10 : {
if (pBuftarget->iBitdepth == 8)
pData->fScalerow = (mng_fptr)mng_scale_rgb16_rgb8;
break;
}
case 4 : ;
case 12 : {
if (pBuftarget->iBitdepth == 8)
pData->fScalerow = (mng_fptr)mng_scale_ga16_ga8;
break;
}
case 6 : ;
case 14 : {
if (pBuftarget->iBitdepth == 8)
pData->fScalerow = (mng_fptr)mng_scale_rgba16_rgba8;
break;
}
}
break;
}
#endif
}
pData->fDeltarow = MNG_NULL; /* let's assume there's nothing to do */
switch (pBuftarget->iColortype) /* determine delta processing routine */
{
case 0 : ;
case 8 : { /* gray */
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
{
if ((pBufdelta->iColortype == 0) || (pBufdelta->iColortype == 3) ||
(pBufdelta->iColortype == 8))
{
switch (pBuftarget->iBitdepth)
{
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case 1 : { pData->fDeltarow = (mng_fptr)mng_delta_g1_g1; break; }
case 2 : { pData->fDeltarow = (mng_fptr)mng_delta_g2_g2; break; }
case 4 : { pData->fDeltarow = (mng_fptr)mng_delta_g4_g4; break; }
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_g8_g8; break; }
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_g16_g16; break; }
#endif
}
}
}
break;
}
case 2 : ;
case 10 : { /* rgb */
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
{
if ((pBufdelta->iColortype == 2) || (pBufdelta->iColortype == 10))
{
switch (pBuftarget->iBitdepth)
{
case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_rgb8_rgb8; break; }
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_rgb16_rgb16; break; }
#endif
}
}
}
break;
}
case 3 : { /* indexed; abuse gray routines */
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
{
if ((pBufdelta->iColortype == 0) || (pBufdelta->iColortype == 3))
{
switch (pBuftarget->iBitdepth)
{
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case 1 : { pData->fDeltarow = (mng_fptr)mng_delta_g1_g1; break; }
case 2 : { pData->fDeltarow = (mng_fptr)mng_delta_g2_g2; break; }
case 4 : { pData->fDeltarow = (mng_fptr)mng_delta_g4_g4; break; }
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_g8_g8; break; }
}
}
}
break;
}
case 4 : ;
case 12 : { /* gray + alpha */
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
{
if ((pBufdelta->iColortype == 4) || (pBufdelta->iColortype == 12))
{
switch (pBuftarget->iBitdepth)
{
case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_ga8_ga8; break; }
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_ga16_ga16; break; }
#endif
}
}
}
else
if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) )
{
if ((pBufdelta->iColortype == 0) || (pBufdelta->iColortype == 3) ||
(pBufdelta->iColortype == 8))
{
switch (pBuftarget->iBitdepth)
{
case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_ga8_g8; break; }
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_ga16_g16; break; }
#endif
}
}
}
else
if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) )
{
if ((pBufdelta->iColortype == 0) || (pBufdelta->iColortype == 3))
{
switch (pBuftarget->iBitdepth)
{
case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_ga8_a8; break; }
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_ga16_a16; break; }
#endif
}
}
}
break;
}
case 6 : ;
case 14 : { /* rgb + alpha */
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
{
if ((pBufdelta->iColortype == 6) || (pBufdelta->iColortype == 14))
{
switch (pBuftarget->iBitdepth)
{
case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_rgba8_rgba8; break; }
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_rgba16_rgba16; break; }
#endif
}
}
}
else
if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) )
{
if ((pBufdelta->iColortype == 2) || (pBufdelta->iColortype == 10))
{
switch (pBuftarget->iBitdepth)
{
case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_rgba8_rgb8; break; }
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_rgba16_rgb16; break; }
#endif
}
}
}
else
if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) )
{
if ((pBufdelta->iColortype == 0) || (pBufdelta->iColortype == 3))
{
switch (pBuftarget->iBitdepth)
{
case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_rgba8_a8; break; }
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_rgba16_a16; break; }
#endif
}
}
}
break;
}
}
if (pData->fDeltarow) /* do we need to take action ? */
{
pData->iPass = -1; /* setup row dimensions and stuff */
pData->iRow = pData->iDeltaBlocky;
pData->iRowinc = 1;
pData->iCol = pData->iDeltaBlockx;
pData->iColinc = 1;
pData->iRowsamples = pBufdelta->iWidth;
pData->iRowsize = pBuftarget->iRowsize;
/* indicate where to retrieve & where to store */
pData->pRetrieveobj = (mng_objectp)pDelta;
pData->pStoreobj = (mng_objectp)pTarget;
pSaveRGBA = pData->pRGBArow; /* save current temp-buffer! */
/* get a temporary row-buffer */
MNG_ALLOC (pData, pData->pRGBArow, (pBufdelta->iRowsize << 1));
iY = 0; /* this is where we start */
iRetcode = MNG_NOERROR; /* still oke for now */
while ((!iRetcode) && (iY < pBufdelta->iHeight))
{ /* get a row */
mng_uint8p pWork = pBufdelta->pImgdata + (iY * pBufdelta->iRowsize);
MNG_COPY (pData->pRGBArow, pWork, pBufdelta->iRowsize);
if (pData->fScalerow) /* scale it (if necessary) */
iRetcode = ((mng_scalerow)pData->fScalerow) (pData);
if (!iRetcode) /* and... execute it */
iRetcode = ((mng_deltarow)pData->fDeltarow) (pData);
if (!iRetcode) /* adjust variables for next row */
iRetcode = mng_next_row (pData);
iY++; /* and next line */
}
/* drop the temporary row-buffer */
MNG_FREE (pData, pData->pRGBArow, (pBufdelta->iRowsize << 1));
pData->pRGBArow = pSaveRGBA; /* restore saved temp-buffer! */
if (iRetcode) /* on error bail out */
return iRetcode;
}
else
MNG_ERROR (pData, MNG_INVALIDDELTA);
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_EXECUTE_DELTA_IMAGE, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_DELTA_PNG */
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_SAVE
MNG_LOCAL mng_retcode save_state (mng_datap pData)
{
mng_savedatap pSave;
mng_imagep pImage;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SAVE_STATE, MNG_LC_START);
#endif
if (pData->pSavedata) /* sanity check */
MNG_ERROR (pData, MNG_INTERNALERROR);
/* get a buffer for saving */
MNG_ALLOC (pData, pData->pSavedata, sizeof (mng_savedata));
pSave = pData->pSavedata; /* address it more directly */
/* and copy global data from the main struct */
#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
pSave->bHasglobalPLTE = pData->bHasglobalPLTE;
pSave->bHasglobalTRNS = pData->bHasglobalTRNS;
pSave->bHasglobalGAMA = pData->bHasglobalGAMA;
pSave->bHasglobalCHRM = pData->bHasglobalCHRM;
pSave->bHasglobalSRGB = pData->bHasglobalSRGB;
pSave->bHasglobalICCP = pData->bHasglobalICCP;
pSave->bHasglobalBKGD = pData->bHasglobalBKGD;
#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */
#ifndef MNG_SKIPCHUNK_BACK
pSave->iBACKred = pData->iBACKred;
pSave->iBACKgreen = pData->iBACKgreen;
pSave->iBACKblue = pData->iBACKblue;
pSave->iBACKmandatory = pData->iBACKmandatory;
pSave->iBACKimageid = pData->iBACKimageid;
pSave->iBACKtile = pData->iBACKtile;
#endif
#ifndef MNG_SKIPCHUNK_FRAM
pSave->iFRAMmode = pData->iFRAMmode;
pSave->iFRAMdelay = pData->iFRAMdelay;
pSave->iFRAMtimeout = pData->iFRAMtimeout;
pSave->bFRAMclipping = pData->bFRAMclipping;
pSave->iFRAMclipl = pData->iFRAMclipl;
pSave->iFRAMclipr = pData->iFRAMclipr;
pSave->iFRAMclipt = pData->iFRAMclipt;
pSave->iFRAMclipb = pData->iFRAMclipb;
#endif
pSave->iGlobalPLTEcount = pData->iGlobalPLTEcount;
MNG_COPY (pSave->aGlobalPLTEentries, pData->aGlobalPLTEentries, sizeof (mng_rgbpaltab));
pSave->iGlobalTRNSrawlen = pData->iGlobalTRNSrawlen;
MNG_COPY (pSave->aGlobalTRNSrawdata, pData->aGlobalTRNSrawdata, 256);
pSave->iGlobalGamma = pData->iGlobalGamma;
#ifndef MNG_SKIPCHUNK_cHRM
pSave->iGlobalWhitepointx = pData->iGlobalWhitepointx;
pSave->iGlobalWhitepointy = pData->iGlobalWhitepointy;
pSave->iGlobalPrimaryredx = pData->iGlobalPrimaryredx;
pSave->iGlobalPrimaryredy = pData->iGlobalPrimaryredy;
pSave->iGlobalPrimarygreenx = pData->iGlobalPrimarygreenx;
pSave->iGlobalPrimarygreeny = pData->iGlobalPrimarygreeny;
pSave->iGlobalPrimarybluex = pData->iGlobalPrimarybluex;
pSave->iGlobalPrimarybluey = pData->iGlobalPrimarybluey;
#endif
#ifndef MNG_SKIPCHUNK_sRGB
pSave->iGlobalRendintent = pData->iGlobalRendintent;
#endif
#ifndef MNG_SKIPCHUNK_iCCP
pSave->iGlobalProfilesize = pData->iGlobalProfilesize;
if (pSave->iGlobalProfilesize) /* has a profile ? */
{ /* then copy that ! */
MNG_ALLOC (pData, pSave->pGlobalProfile, pSave->iGlobalProfilesize);
MNG_COPY (pSave->pGlobalProfile, pData->pGlobalProfile, pSave->iGlobalProfilesize);
}
#endif
#ifndef MNG_SKIPCHUNK_bKGD
pSave->iGlobalBKGDred = pData->iGlobalBKGDred;
pSave->iGlobalBKGDgreen = pData->iGlobalBKGDgreen;
pSave->iGlobalBKGDblue = pData->iGlobalBKGDblue;
#endif
/* freeze current image objects */
pImage = (mng_imagep)pData->pFirstimgobj;
while (pImage)
{ /* freeze the object AND its buffer */
pImage->bFrozen = MNG_TRUE;
pImage->pImgbuf->bFrozen = MNG_TRUE;
/* neeeext */
pImage = (mng_imagep)pImage->sHeader.pNext;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SAVE_STATE, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_reset_objzero (mng_datap pData)
{
mng_imagep pImage = (mng_imagep)pData->pObjzero;
mng_retcode iRetcode = mng_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;
#ifndef MNG_SKIPCHUNK_MAGN
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;
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
MNG_LOCAL mng_retcode restore_state (mng_datap pData)
{
#ifndef MNG_SKIPCHUNK_SAVE
mng_savedatap pSave;
#endif
mng_imagep pImage;
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RESTORE_STATE, MNG_LC_START);
#endif
/* restore object 0 status !!! */
iRetcode = mng_reset_objzero (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
/* fresh cycle; fake no frames done yet */
pData->bFramedone = MNG_FALSE;
#ifndef MNG_SKIPCHUNK_SAVE
if (pData->pSavedata) /* do we have a saved state ? */
{
pSave = pData->pSavedata; /* address it more directly */
/* and copy it back to the main struct */
#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
pData->bHasglobalPLTE = pSave->bHasglobalPLTE;
pData->bHasglobalTRNS = pSave->bHasglobalTRNS;
pData->bHasglobalGAMA = pSave->bHasglobalGAMA;
pData->bHasglobalCHRM = pSave->bHasglobalCHRM;
pData->bHasglobalSRGB = pSave->bHasglobalSRGB;
pData->bHasglobalICCP = pSave->bHasglobalICCP;
pData->bHasglobalBKGD = pSave->bHasglobalBKGD;
#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */
#ifndef MNG_SKIPCHUNK_BACK
pData->iBACKred = pSave->iBACKred;
pData->iBACKgreen = pSave->iBACKgreen;
pData->iBACKblue = pSave->iBACKblue;
pData->iBACKmandatory = pSave->iBACKmandatory;
pData->iBACKimageid = pSave->iBACKimageid;
pData->iBACKtile = pSave->iBACKtile;
#endif
#ifndef MNG_SKIPCHUNK_FRAM
pData->iFRAMmode = pSave->iFRAMmode;
/* pData->iFRAMdelay = pSave->iFRAMdelay; */
pData->iFRAMtimeout = pSave->iFRAMtimeout;
pData->bFRAMclipping = pSave->bFRAMclipping;
pData->iFRAMclipl = pSave->iFRAMclipl;
pData->iFRAMclipr = pSave->iFRAMclipr;
pData->iFRAMclipt = pSave->iFRAMclipt;
pData->iFRAMclipb = pSave->iFRAMclipb;
/* NOOOOOOOOOOOO */
/* pData->iFramemode = pSave->iFRAMmode;
pData->iFramedelay = pSave->iFRAMdelay;
pData->iFrametimeout = pSave->iFRAMtimeout;
pData->bFrameclipping = pSave->bFRAMclipping;
pData->iFrameclipl = pSave->iFRAMclipl;
pData->iFrameclipr = pSave->iFRAMclipr;
pData->iFrameclipt = pSave->iFRAMclipt;
pData->iFrameclipb = pSave->iFRAMclipb; */
/* pData->iNextdelay = pSave->iFRAMdelay; */
pData->iNextdelay = pData->iFramedelay;
#endif
pData->iGlobalPLTEcount = pSave->iGlobalPLTEcount;
MNG_COPY (pData->aGlobalPLTEentries, pSave->aGlobalPLTEentries, sizeof (mng_rgbpaltab));
pData->iGlobalTRNSrawlen = pSave->iGlobalTRNSrawlen;
MNG_COPY (pData->aGlobalTRNSrawdata, pSave->aGlobalTRNSrawdata, 256);
pData->iGlobalGamma = pSave->iGlobalGamma;
#ifndef MNG_SKIPCHUNK_cHRM
pData->iGlobalWhitepointx = pSave->iGlobalWhitepointx;
pData->iGlobalWhitepointy = pSave->iGlobalWhitepointy;
pData->iGlobalPrimaryredx = pSave->iGlobalPrimaryredx;
pData->iGlobalPrimaryredy = pSave->iGlobalPrimaryredy;
pData->iGlobalPrimarygreenx = pSave->iGlobalPrimarygreenx;
pData->iGlobalPrimarygreeny = pSave->iGlobalPrimarygreeny;
pData->iGlobalPrimarybluex = pSave->iGlobalPrimarybluex;
pData->iGlobalPrimarybluey = pSave->iGlobalPrimarybluey;
#endif
pData->iGlobalRendintent = pSave->iGlobalRendintent;
#ifndef MNG_SKIPCHUNK_iCCP
pData->iGlobalProfilesize = pSave->iGlobalProfilesize;
if (pData->iGlobalProfilesize) /* has a profile ? */
{ /* then copy that ! */
MNG_ALLOC (pData, pData->pGlobalProfile, pData->iGlobalProfilesize);
MNG_COPY (pData->pGlobalProfile, pSave->pGlobalProfile, pData->iGlobalProfilesize);
}
#endif
#ifndef MNG_SKIPCHUNK_bKGD
pData->iGlobalBKGDred = pSave->iGlobalBKGDred;
pData->iGlobalBKGDgreen = pSave->iGlobalBKGDgreen;
pData->iGlobalBKGDblue = pSave->iGlobalBKGDblue;
#endif
}
else /* no saved-data; so reset the lot */
#endif /* SKIPCHUNK_SAVE */
{
#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
pData->bHasglobalPLTE = MNG_FALSE;
pData->bHasglobalTRNS = MNG_FALSE;
pData->bHasglobalGAMA = MNG_FALSE;
pData->bHasglobalCHRM = MNG_FALSE;
pData->bHasglobalSRGB = MNG_FALSE;
pData->bHasglobalICCP = MNG_FALSE;
pData->bHasglobalBKGD = MNG_FALSE;
#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */
#ifndef MNG_SKIPCHUNK_TERM
if (!pData->bMisplacedTERM) /* backward compatible ugliness !!! */
{
pData->iBACKred = 0;
pData->iBACKgreen = 0;
pData->iBACKblue = 0;
pData->iBACKmandatory = 0;
pData->iBACKimageid = 0;
pData->iBACKtile = 0;
}
#endif
#ifndef MNG_SKIPCHUNK_FRAM
pData->iFRAMmode = 1;
/* pData->iFRAMdelay = 1; */
pData->iFRAMtimeout = 0x7fffffffl;
pData->bFRAMclipping = MNG_FALSE;
pData->iFRAMclipl = 0;
pData->iFRAMclipr = 0;
pData->iFRAMclipt = 0;
pData->iFRAMclipb = 0;
/* NOOOOOOOOOOOO */
/* pData->iFramemode = 1;
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->iNextdelay = pData->iFramedelay;
#endif
pData->iGlobalPLTEcount = 0;
pData->iGlobalTRNSrawlen = 0;
pData->iGlobalGamma = 0;
#ifndef MNG_SKIPCHUNK_cHRM
pData->iGlobalWhitepointx = 0;
pData->iGlobalWhitepointy = 0;
pData->iGlobalPrimaryredx = 0;
pData->iGlobalPrimaryredy = 0;
pData->iGlobalPrimarygreenx = 0;
pData->iGlobalPrimarygreeny = 0;
pData->iGlobalPrimarybluex = 0;
pData->iGlobalPrimarybluey = 0;
#endif
pData->iGlobalRendintent = 0;
#ifndef MNG_SKIPCHUNK_iCCP
if (pData->iGlobalProfilesize) /* free a previous profile ? */
MNG_FREE (pData, pData->pGlobalProfile, pData->iGlobalProfilesize);
pData->iGlobalProfilesize = 0;
#endif
#ifndef MNG_SKIPCHUNK_bKGD
pData->iGlobalBKGDred = 0;
pData->iGlobalBKGDgreen = 0;
pData->iGlobalBKGDblue = 0;
#endif
}
#ifndef MNG_SKIPCHUNK_TERM
if (!pData->bMisplacedTERM) /* backward compatible ugliness !!! */
{
pImage = (mng_imagep)pData->pFirstimgobj;
/* drop un-frozen image objects */
while (pImage)
{
mng_imagep pNext = (mng_imagep)pImage->sHeader.pNext;
if (!pImage->bFrozen) /* is it un-frozen ? */
{
mng_imagep pPrev = (mng_imagep)pImage->sHeader.pPrev;
if (pPrev) /* unlink it */
pPrev->sHeader.pNext = pNext;
else
pData->pFirstimgobj = pNext;
if (pNext)
pNext->sHeader.pPrev = pPrev;
else
pData->pLastimgobj = pPrev;
if (pImage->pImgbuf->bFrozen) /* buffer frozen ? */
{
if (pImage->pImgbuf->iRefcount < 2)
MNG_ERROR (pData, MNG_INTERNALERROR);
/* decrease ref counter */
pImage->pImgbuf->iRefcount--;
/* just cleanup the object then */
MNG_FREEX (pData, pImage, sizeof (mng_image));
}
else
{ /* free the image buffer */
iRetcode = mng_free_imagedataobject (pData, pImage->pImgbuf);
/* and cleanup the object */
MNG_FREEX (pData, pImage, sizeof (mng_image));
if (iRetcode) /* on error bail out */
return iRetcode;
}
}
pImage = pNext; /* neeeext */
}
}
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RESTORE_STATE, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
/* * * */
/* * General display processing routine * */
/* * * */
/* ************************************************************************** */
mng_retcode mng_process_display (mng_datap pData)
{
mng_retcode iRetcode = MNG_NOERROR;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY, MNG_LC_START);
#endif
if (!pData->iBreakpoint) /* not broken previously ? */
{
if ((pData->iRequestframe) || (pData->iRequestlayer) || (pData->iRequesttime))
{
pData->bSearching = MNG_TRUE; /* indicate we're searching */
iRetcode = clear_canvas (pData); /* make the canvas virgin black ?!? */
if (iRetcode) /* on error bail out */
return iRetcode;
/* let's start from the top, shall we */
pData->pCurraniobj = pData->pFirstaniobj;
}
}
do /* process the objects */
{
if (pData->bSearching) /* clear timer-flag when searching !!! */
pData->bTimerset = MNG_FALSE;
/* do we need to finish something first ? */
if ((pData->iBreakpoint) && (pData->iBreakpoint < 99))
{
switch (pData->iBreakpoint) /* return to broken display routine */
{
#ifndef MNG_SKIPCHUNK_FRAM
case 1 : { iRetcode = mng_process_display_fram2 (pData); break; }
#endif
#ifndef MNG_SKIPCHUNK_SHOW
case 3 : ; /* same as 4 !!! */
case 4 : { iRetcode = mng_process_display_show (pData); break; }
#endif
#ifndef MNG_SKIPCHUNK_CLON
case 5 : { iRetcode = mng_process_display_clon2 (pData); break; }
#endif
#ifndef MNG_SKIPCHUNK_MAGN
case 9 : { iRetcode = mng_process_display_magn2 (pData); break; }
case 10 : { iRetcode = mng_process_display_mend2 (pData); break; }
#endif
#ifndef MNG_SKIPCHUNK_PAST
case 11 : { iRetcode = mng_process_display_past2 (pData); break; }
#endif
default : MNG_ERROR (pData, MNG_INTERNALERROR);
}
}
else
{
if (pData->pCurraniobj)
iRetcode = ((mng_object_headerp)pData->pCurraniobj)->fProcess (pData, pData->pCurraniobj);
}
if (!pData->bTimerset) /* reset breakpoint flag ? */
pData->iBreakpoint = 0;
/* can we advance to next object ? */
if ((!iRetcode) && (pData->pCurraniobj) &&
(!pData->bTimerset) && (!pData->bSectionwait))
{
pData->pCurraniobj = ((mng_object_headerp)pData->pCurraniobj)->pNext;
/* MEND processing to be done ? */
if ((pData->eImagetype == mng_it_mng) && (!pData->pCurraniobj))
iRetcode = mng_process_display_mend (pData);
if (!pData->pCurraniobj) /* refresh after last image ? */
pData->bNeedrefresh = MNG_TRUE;
}
if (pData->bSearching) /* are we looking for something ? */
{
if ((pData->iRequestframe) && (pData->iRequestframe <= pData->iFrameseq))
{
pData->iRequestframe = 0; /* found the frame ! */
pData->bSearching = MNG_FALSE;
}
else
if ((pData->iRequestlayer) && (pData->iRequestlayer <= pData->iLayerseq))
{
pData->iRequestlayer = 0; /* found the layer ! */
pData->bSearching = MNG_FALSE;
}
else
if ((pData->iRequesttime) && (pData->iRequesttime <= pData->iFrametime))
{
pData->iRequesttime = 0; /* found the playtime ! */
pData->bSearching = MNG_FALSE;
}
}
} /* until error or a break or no more objects */
while ((!iRetcode) && (pData->pCurraniobj) &&
(((pData->bRunning) && (!pData->bTimerset)) || (pData->bSearching)) &&
(!pData->bSectionwait) && (!pData->bFreezing));
if (iRetcode) /* on error bail out */
return iRetcode;
/* refresh needed ? */
if ((!pData->bTimerset) && (pData->bNeedrefresh))
{
iRetcode = mng_display_progressive_refresh (pData, 1);
if (iRetcode) /* on error bail out */
return iRetcode;
}
/* timer break ? */
if ((pData->bTimerset) && (!pData->iBreakpoint))
pData->iBreakpoint = 99;
else
if (!pData->bTimerset)
pData->iBreakpoint = 0; /* reset if no timer break */
if ((!pData->bTimerset) && (!pData->pCurraniobj))
pData->bRunning = MNG_FALSE; /* all done now ! */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
/* * * */
/* * Chunk display processing routines * */
/* * * */
/* ************************************************************************** */
#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT
png_imgtype mng_png_imgtype(mng_uint8 colortype, mng_uint8 bitdepth)
{
png_imgtype ret;
switch (bitdepth)
{
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case 1:
{
png_imgtype imgtype[]={png_g1,png_none,png_none,png_idx1};
ret=imgtype[colortype];
break;
}
case 2:
{
png_imgtype imgtype[]={png_g2,png_none,png_none,png_idx2};
ret=imgtype[colortype];
break;
}
case 4:
{
png_imgtype imgtype[]={png_g4,png_none,png_none,png_idx4};
ret=imgtype[colortype];
break;
}
#endif
case 8:
{
png_imgtype imgtype[]={png_g8,png_none,png_rgb8,png_idx8,png_ga8,
png_none,png_rgba8};
ret=imgtype[colortype];
break;
}
#ifndef MNG_NO_16BIT_SUPPORT
case 16:
{
png_imgtype imgtype[]={png_g16,png_none,png_rgb16,png_none,png_ga16,
png_none,png_rgba16};
ret=imgtype[colortype];
break;
}
#endif
default:
ret=png_none;
break;
}
return (ret);
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */
/* ************************************************************************** */
mng_retcode mng_process_display_ihdr (mng_datap pData)
{ /* address the current "object" if any */
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IHDR, MNG_LC_START);
#endif
if (!pData->bHasDHDR)
{
pData->fInitrowproc = MNG_NULL; /* do nothing by default */
pData->fDisplayrow = MNG_NULL;
pData->fCorrectrow = MNG_NULL;
pData->fStorerow = MNG_NULL;
pData->fProcessrow = MNG_NULL;
pData->fDifferrow = MNG_NULL;
pData->pStoreobj = MNG_NULL;
}
if (!pData->iBreakpoint) /* not previously broken ? */
{
mng_retcode iRetcode = MNG_NOERROR;
#ifndef MNG_NO_DELTA_PNG
if (pData->bHasDHDR) /* is a delta-image ? */
{
if (pData->iDeltatype == MNG_DELTATYPE_REPLACE)
iRetcode = mng_reset_object_details (pData, (mng_imagep)pData->pDeltaImage,
pData->iDatawidth, pData->iDataheight,
pData->iBitdepth, pData->iColortype,
pData->iCompression, pData->iFilter,
pData->iInterlace, MNG_TRUE);
else
if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
{
((mng_imagep)pData->pDeltaImage)->pImgbuf->iPixelsampledepth = pData->iBitdepth;
((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphasampledepth = pData->iBitdepth;
}
else
if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) )
((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphasampledepth = pData->iBitdepth;
else
if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) )
((mng_imagep)pData->pDeltaImage)->pImgbuf->iPixelsampledepth = pData->iBitdepth;
if (!iRetcode)
{ /* process immediately if bitdepth & colortype are equal */
pData->bDeltaimmediate =
(mng_bool)((pData->iBitdepth == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iBitdepth ) &&
(pData->iColortype == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iColortype) );
/* be sure to reset object 0 */
iRetcode = mng_reset_object_details (pData, (mng_imagep)pData->pObjzero,
pData->iDatawidth, pData->iDataheight,
pData->iBitdepth, pData->iColortype,
pData->iCompression, pData->iFilter,
pData->iInterlace, MNG_TRUE);
}
}
else
#endif
{
if (pImage) /* update object buffer ? */
iRetcode = mng_reset_object_details (pData, pImage,
pData->iDatawidth, pData->iDataheight,
pData->iBitdepth, pData->iColortype,
pData->iCompression, pData->iFilter,
pData->iInterlace, MNG_TRUE);
else
iRetcode = mng_reset_object_details (pData, (mng_imagep)pData->pObjzero,
pData->iDatawidth, pData->iDataheight,
pData->iBitdepth, pData->iColortype,
pData->iCompression, pData->iFilter,
pData->iInterlace, MNG_TRUE);
}
if (iRetcode) /* on error bail out */
return iRetcode;
}
#ifndef MNG_NO_DELTA_PNG
if (!pData->bHasDHDR)
#endif
{
if (pImage) /* real object ? */
pData->pStoreobj = pImage; /* tell the row routines */
else /* otherwise use object 0 */
pData->pStoreobj = pData->pObjzero;
#if !defined(MNG_INCLUDE_MPNG_PROPOSAL) && !defined(MNG_INCLUDE_ANG_PROPOSAL)
if ( /* display "on-the-fly" ? */
#ifndef MNG_SKIPCHUNK_MAGN
(((mng_imagep)pData->pStoreobj)->iMAGN_MethodX == 0) &&
(((mng_imagep)pData->pStoreobj)->iMAGN_MethodY == 0) &&
#endif
( (pData->eImagetype == mng_it_png ) ||
(((mng_imagep)pData->pStoreobj)->bVisible) ) )
{
next_layer (pData); /* that's a new layer then ! */
if (pData->bTimerset) /* timer break ? */
pData->iBreakpoint = 2;
else
{
pData->iBreakpoint = 0;
/* anything to display ? */
if ((pData->iDestr > pData->iDestl) && (pData->iDestb > pData->iDestt))
set_display_routine (pData); /* then determine display routine */
}
}
#endif
}
if (!pData->bTimerset) /* no timer break ? */
{
#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT
pData->fInitrowproc = (mng_fptr)mng_init_rowproc;
pData->ePng_imgtype=mng_png_imgtype(pData->iColortype,pData->iBitdepth);
#else
switch (pData->iColortype) /* determine row initialization routine */
{
case 0 : { /* gray */
switch (pData->iBitdepth)
{
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case 1 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_g1_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_g1_i;
break;
}
case 2 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_g2_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_g2_i;
break;
}
case 4 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_g4_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_g4_i;
break;
}
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case 8 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_g8_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_g8_i;
break;
}
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_g16_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_g16_i;
break;
}
#endif
}
break;
}
case 2 : { /* rgb */
switch (pData->iBitdepth)
{
case 8 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_rgb8_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_rgb8_i;
break;
}
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_rgb16_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_rgb16_i;
break;
}
#endif
}
break;
}
case 3 : { /* indexed */
switch (pData->iBitdepth)
{
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case 1 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_idx1_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_idx1_i;
break;
}
case 2 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_idx2_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_idx2_i;
break;
}
case 4 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_idx4_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_idx4_i;
break;
}
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case 8 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_idx8_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_idx8_i;
break;
}
}
break;
}
case 4 : { /* gray+alpha */
switch (pData->iBitdepth)
{
case 8 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_ga8_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_ga8_i;
break;
}
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_ga16_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_ga16_i;
break;
}
#endif
}
break;
}
case 6 : { /* rgb+alpha */
switch (pData->iBitdepth)
{
case 8 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_rgba8_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_rgba8_i;
break;
}
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_rgba16_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_rgba16_i;
break;
}
#endif
}
break;
}
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */
pData->iFilterofs = 0; /* determine filter characteristics */
pData->iLevel0 = 0; /* default levels */
pData->iLevel1 = 0;
pData->iLevel2 = 0;
pData->iLevel3 = 0;
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
{
switch (pData->iColortype)
{
case 0 : {
if (pData->iBitdepth <= 8)
pData->iFilterofs = 1;
else
pData->iFilterofs = 2;
break;
}
case 2 : {
if (pData->iBitdepth <= 8)
pData->iFilterofs = 3;
else
pData->iFilterofs = 6;
break;
}
case 3 : {
pData->iFilterofs = 1;
break;
}
case 4 : {
if (pData->iBitdepth <= 8)
pData->iFilterofs = 2;
else
pData->iFilterofs = 4;
break;
}
case 6 : {
if (pData->iBitdepth <= 8)
pData->iFilterofs = 4;
else
pData->iFilterofs = 8;
break;
}
}
}
#endif
#ifdef FILTER193 /* no adaptive filtering ? */
if (pData->iFilter == MNG_FILTER_NOFILTER)
pData->iPixelofs = pData->iFilterofs;
else
#endif
pData->iPixelofs = pData->iFilterofs + 1;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IHDR, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
mng_retcode mng_process_display_mpng (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MPNG, MNG_LC_START);
#endif
pData->iAlphadepth = 8; /* assume transparency !! */
if (pData->fProcessheader) /* inform the app (creating the output canvas) ? */
{
pData->iWidth = ((mng_mpng_objp)pData->pMPNG)->iFramewidth;
pData->iHeight = ((mng_mpng_objp)pData->pMPNG)->iFrameheight;
if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight))
MNG_ERROR (pData, MNG_APPMISCERROR);
}
next_layer (pData); /* first mPNG layer then ! */
pData->bTimerset = MNG_FALSE;
pData->iBreakpoint = 0;
if ((pData->iDestr > pData->iDestl) && (pData->iDestb > pData->iDestt))
set_display_routine (pData); /* then determine display routine */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MPNG, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifdef MNG_INCLUDE_ANG_PROPOSAL
mng_retcode mng_process_display_ang (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_ANG, MNG_LC_START);
#endif
if (pData->fProcessheader) /* inform the app (creating the output canvas) ? */
{
if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight))
MNG_ERROR (pData, MNG_APPMISCERROR);
}
next_layer (pData); /* first mPNG layer then ! */
pData->bTimerset = MNG_FALSE;
pData->iBreakpoint = 0;
if ((pData->iDestr > pData->iDestl) && (pData->iDestb > pData->iDestt))
set_display_routine (pData); /* then determine display routine */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_ANG, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
mng_retcode mng_process_display_idat (mng_datap pData,
mng_uint32 iRawlen,
mng_uint8p pRawdata)
#else
mng_retcode mng_process_display_idat (mng_datap pData)
#endif
{
mng_retcode iRetcode = MNG_NOERROR;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IDAT, MNG_LC_START);
#endif
#if defined(MNG_INCLUDE_MPNG_PROPOSAL) || defined(MNG_INCLUDE_ANG_PROPOSAL)
if ((pData->eImagetype == mng_it_png) && (pData->iLayerseq <= 0))
{
if (pData->fProcessheader) /* inform the app (creating the output canvas) ? */
if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight))
MNG_ERROR (pData, MNG_APPMISCERROR);
next_layer (pData); /* first regular PNG layer then ! */
pData->bTimerset = MNG_FALSE;
pData->iBreakpoint = 0;
if ((pData->iDestr > pData->iDestl) && (pData->iDestb > pData->iDestt))
set_display_routine (pData); /* then determine display routine */
}
#endif
if (pData->bRestorebkgd) /* need to restore the background ? */
{
pData->bRestorebkgd = MNG_FALSE;
iRetcode = load_bkgdlayer (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
pData->iLayerseq++; /* and it counts as a layer then ! */
}
if (pData->fInitrowproc) /* need to initialize row processing? */
{
iRetcode = ((mng_initrowproc)pData->fInitrowproc) (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 */
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
iRetcode = mngzlib_inflaterows (pData, iRawlen, pRawdata);
#else
iRetcode = mngzlib_inflaterows (pData, pData->iRawlen, pData->pRawdata);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IDAT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_process_display_iend (mng_datap pData)
{
mng_retcode iRetcode, iRetcode2;
mng_bool bDodisplay = MNG_FALSE;
mng_bool bMagnify = MNG_FALSE;
mng_bool bCleanup = (mng_bool)(pData->iBreakpoint != 0);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IEND, MNG_LC_START);
#endif
#ifdef MNG_INCLUDE_JNG /* progressive+alpha JNG can be displayed now */
if ( (pData->bHasJHDR ) &&
( (pData->bJPEGprogressive) || (pData->bJPEGprogressive2)) &&
( (pData->eImagetype == mng_it_jng ) ||
(((mng_imagep)pData->pStoreobj)->bVisible) ) &&
( (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA ) ||
(pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) )
bDodisplay = MNG_TRUE;
#endif
#ifndef MNG_SKIPCHUNK_MAGN
if ( (pData->pStoreobj) && /* on-the-fly magnification ? */
( (((mng_imagep)pData->pStoreobj)->iMAGN_MethodX) ||
(((mng_imagep)pData->pStoreobj)->iMAGN_MethodY) ) )
bMagnify = MNG_TRUE;
#endif
if ((pData->bHasBASI) || /* was it a BASI stream */
(bDodisplay) || /* or should we display the JNG */
#ifndef MNG_SKIPCHUNK_MAGN
(bMagnify) || /* or should we magnify it */
#endif
/* or did we get broken here last time ? */
((pData->iBreakpoint) && (pData->iBreakpoint != 8)))
{
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
if (!pImage) /* or was it object 0 ? */
pImage = (mng_imagep)pData->pObjzero;
/* display it now then ? */
if ((pImage->bVisible) && (pImage->bViewable))
{ /* ok, so do it */
iRetcode = mng_display_image (pData, pImage, bDodisplay);
if (iRetcode) /* on error bail out */
return iRetcode;
if (pData->bTimerset) /* timer break ? */
pData->iBreakpoint = 6;
}
}
#ifndef MNG_NO_DELTA_PNG
else
if ((pData->bHasDHDR) || /* was it a DHDR stream */
(pData->iBreakpoint == 8)) /* or did we get broken here last time ? */
{
mng_imagep pImage = (mng_imagep)pData->pDeltaImage;
if (!pData->iBreakpoint)
{ /* perform the delta operations needed */
iRetcode = mng_execute_delta_image (pData, pImage, (mng_imagep)pData->pObjzero);
if (iRetcode) /* on error bail out */
return iRetcode;
}
/* display it now then ? */
if ((pImage->bVisible) && (pImage->bViewable))
{ /* ok, so do it */
iRetcode = mng_display_image (pData, pImage, MNG_FALSE);
if (iRetcode) /* on error bail out */
return iRetcode;
if (pData->bTimerset) /* timer break ? */
pData->iBreakpoint = 8;
}
}
#endif
if (!pData->bTimerset) /* can we continue ? */
{
pData->iBreakpoint = 0; /* clear this flag now ! */
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
if (pData->eImagetype == mng_it_mpng)
{
pData->pCurraniobj = pData->pFirstaniobj;
} else
#endif
#ifdef MNG_INCLUDE_ANG_PROPOSAL
if (pData->eImagetype == mng_it_ang)
{
pData->pCurraniobj = pData->pFirstaniobj;
} else
#endif
{ /* cleanup object 0 */
mng_reset_object_details (pData, (mng_imagep)pData->pObjzero,
0, 0, 0, 0, 0, 0, 0, MNG_TRUE);
}
if (pData->bInflating) /* if we've been inflating */
{ /* cleanup row-processing, */
iRetcode = mng_cleanup_rowproc (pData);
/* also cleanup inflate! */
iRetcode2 = mngzlib_inflatefree (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
if (iRetcode2)
return iRetcode2;
}
#ifdef MNG_INCLUDE_JNG
if (pData->bJPEGdecompress) /* if we've been decompressing JDAT */
{ /* cleanup row-processing, */
iRetcode = mng_cleanup_rowproc (pData);
/* also cleanup decompress! */
iRetcode2 = mngjpeg_decompressfree (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
if (iRetcode2)
return iRetcode2;
}
if (pData->bJPEGdecompress2) /* if we've been decompressing JDAA */
{ /* cleanup row-processing, */
iRetcode = mng_cleanup_rowproc (pData);
/* also cleanup decompress! */
iRetcode2 = mngjpeg_decompressfree2 (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
if (iRetcode2)
return iRetcode2;
}
#endif
if (bCleanup) /* if we got broken last time we need to cleanup */
{
pData->bHasIHDR = MNG_FALSE; /* IEND signals the end for most ... */
pData->bHasBASI = MNG_FALSE;
pData->bHasDHDR = MNG_FALSE;
#ifdef MNG_INCLUDE_JNG
pData->bHasJHDR = MNG_FALSE;
pData->bHasJSEP = MNG_FALSE;
pData->bHasJDAA = MNG_FALSE;
pData->bHasJDAT = MNG_FALSE;
#endif
pData->bHasPLTE = MNG_FALSE;
pData->bHasTRNS = MNG_FALSE;
pData->bHasGAMA = MNG_FALSE;
pData->bHasCHRM = MNG_FALSE;
pData->bHasSRGB = MNG_FALSE;
pData->bHasICCP = MNG_FALSE;
pData->bHasBKGD = MNG_FALSE;
pData->bHasIDAT = MNG_FALSE;
}
/* if the image was displayed on the fly, */
/* we'll have to make the app refresh */
if ((pData->eImagetype != mng_it_mng) && (pData->fDisplayrow))
pData->bNeedrefresh = MNG_TRUE;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IEND, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
/* change in the MNG spec with regards to TERM delay & interframe_delay
as proposed by Adam M. Costello (option 4) and finalized by official vote
during december 2002 / check the 'mng-list' archives for more details */
mng_retcode mng_process_display_mend (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MEND, MNG_LC_START);
#endif
#ifdef MNG_SUPPORT_DYNAMICMNG
if (pData->bStopafterseek) /* need to stop after this ? */
{
pData->bFreezing = MNG_TRUE; /* stop processing on this one */
pData->bRunningevent = MNG_FALSE;
pData->bStopafterseek = MNG_FALSE;
pData->bNeedrefresh = MNG_TRUE; /* make sure the last bit is displayed ! */
}
#endif
#ifndef MNG_SKIPCHUNK_TERM
/* TERM processed ? */
if ((pData->bDisplaying) && (pData->bRunning) &&
(pData->bHasTERM) && (pData->pTermaniobj))
{
mng_retcode iRetcode;
mng_ani_termp pTERM;
/* 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 */
break; /* piece of cake, that is... */
}
case 1 : { /* cease displaying anything */
/* max(1, TERM delay, interframe_delay) */
#ifndef MNG_SKIPCHUNK_FRAM
if (pTERM->iDelay > pData->iFramedelay)
pData->iFramedelay = pTERM->iDelay;
if (!pData->iFramedelay)
pData->iFramedelay = 1;
#endif
iRetcode = interframe_delay (pData);
/* no interframe_delay? then fake it */
if ((!iRetcode) && (!pData->bTimerset))
iRetcode = set_delay (pData, 1);
if (iRetcode)
return iRetcode;
pData->iBreakpoint = 10;
break;
}
case 2 : { /* show first image after TERM */
iRetcode = restore_state (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
/* notify the app ? */
if (pData->fProcessmend)
if (!pData->fProcessmend ((mng_handle)pData, pData->iIterations, 0))
MNG_ERROR (pData, MNG_APPMISCERROR);
/* show first frame after TERM chunk */
pData->pCurraniobj = pTERM;
pData->bOnlyfirstframe = MNG_TRUE;
pData->iFramesafterTERM = 0;
/* max(1, TERM delay, interframe_delay) */
#ifndef MNG_SKIPCHUNK_FRAM
if (pTERM->iDelay > pData->iFramedelay)
pData->iFramedelay = pTERM->iDelay;
if (!pData->iFramedelay)
pData->iFramedelay = 1;
#endif
break;
}
case 3 : { /* repeat */
if ((pTERM->iItermax) && (pTERM->iItermax < 0x7FFFFFFF))
pTERM->iItermax--;
if (pTERM->iItermax) /* go back to TERM ? */
{ /* restore to initial or SAVE state */
iRetcode = restore_state (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
/* notify the app ? */
if (pData->fProcessmend)
if (!pData->fProcessmend ((mng_handle)pData,
pData->iIterations, pTERM->iItermax))
MNG_ERROR (pData, MNG_APPMISCERROR);
/* restart from TERM chunk */
pData->pCurraniobj = pTERM;
if (pTERM->iDelay) /* set the delay (?) */
{
/* max(1, TERM delay, interframe_delay) */
#ifndef MNG_SKIPCHUNK_FRAM
if (pTERM->iDelay > pData->iFramedelay)
pData->iFramedelay = pTERM->iDelay;
if (!pData->iFramedelay)
pData->iFramedelay = 1;
#endif
pData->bNeedrefresh = MNG_TRUE;
}
}
else
{
switch (pTERM->iIteraction)
{
case 0 : { /* show last frame indefinitly */
break; /* piece of cake, that is... */
}
case 1 : { /* cease displaying anything */
/* max(1, TERM delay, interframe_delay) */
#ifndef MNG_SKIPCHUNK_FRAM
if (pTERM->iDelay > pData->iFramedelay)
pData->iFramedelay = pTERM->iDelay;
if (!pData->iFramedelay)
pData->iFramedelay = 1;
#endif
iRetcode = interframe_delay (pData);
/* no interframe_delay? then fake it */
if ((!iRetcode) && (!pData->bTimerset))
iRetcode = set_delay (pData, 1);
if (iRetcode)
return iRetcode;
pData->iBreakpoint = 10;
break;
}
case 2 : { /* show first image after TERM */
iRetcode = restore_state (pData);
/* on error bail out */
if (iRetcode)
return iRetcode;
/* notify the app ? */
if (pData->fProcessmend)
if (!pData->fProcessmend ((mng_handle)pData,
pData->iIterations, 0))
MNG_ERROR (pData, MNG_APPMISCERROR);
/* show first frame after TERM chunk */
pData->pCurraniobj = pTERM;
pData->bOnlyfirstframe = MNG_TRUE;
pData->iFramesafterTERM = 0;
/* max(1, TERM delay, interframe_delay) */
#ifndef MNG_SKIPCHUNK_FRAM
if (pTERM->iDelay > pData->iFramedelay)
pData->iFramedelay = pTERM->iDelay;
if (!pData->iFramedelay)
pData->iFramedelay = 1;
#endif
break;
}
}
}
break;
}
}
}
#endif /* MNG_SKIPCHUNK_TERM */
/* just reading ? */
if ((!pData->bDisplaying) && (pData->bReading))
if (pData->fProcessmend) /* inform the app ? */
if (!pData->fProcessmend ((mng_handle)pData, 0, 0))
MNG_ERROR (pData, MNG_APPMISCERROR);
if (!pData->pCurraniobj) /* always let the app refresh at the end ! */
pData->bNeedrefresh = MNG_TRUE;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MEND, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_process_display_mend2 (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MEND, MNG_LC_START);
#endif
#ifndef MNG_SKIPCHUNK_FRAM
pData->bFrameclipping = MNG_FALSE; /* nothing to do but restore the app background */
#endif
load_bkgdlayer (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MEND, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_DEFI
mng_retcode mng_process_display_defi (mng_datap pData)
{
mng_imagep pImage;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DEFI, MNG_LC_START);
#endif
if (!pData->iDEFIobjectid) /* object id=0 ? */
{
pImage = (mng_imagep)pData->pObjzero;
if (pData->bDEFIhasdonotshow)
pImage->bVisible = (mng_bool)(pData->iDEFIdonotshow == 0);
if (pData->bDEFIhasloca)
{
pImage->iPosx = pData->iDEFIlocax;
pImage->iPosy = pData->iDEFIlocay;
}
if (pData->bDEFIhasclip)
{
pImage->bClipped = pData->bDEFIhasclip;
pImage->iClipl = pData->iDEFIclipl;
pImage->iClipr = pData->iDEFIclipr;
pImage->iClipt = pData->iDEFIclipt;
pImage->iClipb = pData->iDEFIclipb;
}
pData->pCurrentobj = 0; /* not a real object ! */
}
else
{ /* already exists ? */
pImage = (mng_imagep)mng_find_imageobject (pData, pData->iDEFIobjectid);
if (!pImage) /* if not; create new */
{
mng_retcode iRetcode = mng_create_imageobject (pData, pData->iDEFIobjectid,
(mng_bool)(pData->iDEFIconcrete == 1),
(mng_bool)(pData->iDEFIdonotshow == 0),
MNG_FALSE, 0, 0, 0, 0, 0, 0, 0,
pData->iDEFIlocax, pData->iDEFIlocay,
pData->bDEFIhasclip,
pData->iDEFIclipl, pData->iDEFIclipr,
pData->iDEFIclipt, pData->iDEFIclipb,
&pImage);
if (iRetcode) /* on error bail out */
return iRetcode;
}
else
{ /* exists; then set new info */
if (pData->bDEFIhasdonotshow)
pImage->bVisible = (mng_bool)(pData->iDEFIdonotshow == 0);
pImage->bViewable = MNG_FALSE;
if (pData->bDEFIhasloca)
{
pImage->iPosx = pData->iDEFIlocax;
pImage->iPosy = pData->iDEFIlocay;
}
if (pData->bDEFIhasclip)
{
pImage->bClipped = pData->bDEFIhasclip;
pImage->iClipl = pData->iDEFIclipl;
pImage->iClipr = pData->iDEFIclipr;
pImage->iClipt = pData->iDEFIclipt;
pImage->iClipb = pData->iDEFIclipb;
}
if (pData->bDEFIhasconcrete)
pImage->pImgbuf->bConcrete = (mng_bool)(pData->iDEFIconcrete == 1);
}
pData->pCurrentobj = pImage; /* others may want to know this */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DEFI, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_BASI
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
mng_retcode mng_process_display_basi (mng_datap pData,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue,
mng_bool bHasalpha,
mng_uint16 iAlpha,
mng_uint8 iViewable)
#else
mng_retcode mng_process_display_basi (mng_datap pData)
#endif
{ /* address the current "object" if any */
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
mng_uint8p pWork;
mng_uint32 iX;
mng_imagedatap pBuf;
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_BASI, MNG_LC_START);
#endif
if (!pImage) /* or is it an "on-the-fly" image ? */
pImage = (mng_imagep)pData->pObjzero;
/* address the object-buffer */
pBuf = pImage->pImgbuf;
pData->fDisplayrow = MNG_NULL; /* do nothing by default */
pData->fCorrectrow = MNG_NULL;
pData->fStorerow = MNG_NULL;
pData->fProcessrow = MNG_NULL;
/* set parms now that they're known */
iRetcode = mng_reset_object_details (pData, pImage, pData->iDatawidth,
pData->iDataheight, pData->iBitdepth,
pData->iColortype, pData->iCompression,
pData->iFilter, pData->iInterlace, MNG_FALSE);
if (iRetcode) /* on error bail out */
return iRetcode;
/* save the viewable flag */
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
pImage->bViewable = (mng_bool)(iViewable == 1);
#else
pImage->bViewable = (mng_bool)(pData->iBASIviewable == 1);
#endif
pBuf->bViewable = pImage->bViewable;
pData->pStoreobj = pImage; /* let row-routines know which object */
pWork = pBuf->pImgdata; /* fill the object-buffer with the specified
"color" sample */
switch (pData->iColortype) /* depending on color_type & bit_depth */
{
case 0 : { /* gray */
#ifndef MNG_NO_16BIT_SUPPORT
if (pData->iBitdepth == 16)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iDatawidth * pData->iDataheight;
iX > 0;iX--)
#else
for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++)
#endif
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
mng_put_uint16 (pWork, iRed);
#else
mng_put_uint16 (pWork, pData->iBASIred);
#endif
pWork += 2;
}
}
else
#endif
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iDatawidth * pData->iDataheight;
iX > 0;iX--)
#else
for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++)
#endif
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
*pWork = (mng_uint8)iRed;
#else
*pWork = (mng_uint8)pData->iBASIred;
#endif
pWork++;
}
}
/* force tRNS ? */
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
if ((bHasalpha) && (!iAlpha))
#else
if ((pData->bBASIhasalpha) && (!pData->iBASIalpha))
#endif
{
pBuf->bHasTRNS = MNG_TRUE;
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
pBuf->iTRNSgray = iRed;
#else
pBuf->iTRNSgray = pData->iBASIred;
#endif
}
break;
}
case 2 : { /* rgb */
#ifndef MNG_NO_16BIT_SUPPORT
if (pData->iBitdepth == 16)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iDatawidth * pData->iDataheight;
iX > 0;iX--)
#else
for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++)
#endif
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
mng_put_uint16 (pWork, iRed );
mng_put_uint16 (pWork+2, iGreen);
mng_put_uint16 (pWork+4, iBlue );
#else
mng_put_uint16 (pWork, pData->iBASIred );
mng_put_uint16 (pWork+2, pData->iBASIgreen);
mng_put_uint16 (pWork+4, pData->iBASIblue );
#endif
pWork += 6;
}
}
else
#endif
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iDatawidth * pData->iDataheight;
iX > 0;iX--)
#else
for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++)
#endif
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
*pWork = (mng_uint8)iRed;
*(pWork+1) = (mng_uint8)iGreen;
*(pWork+2) = (mng_uint8)iBlue;
#else
*pWork = (mng_uint8)pData->iBASIred;
*(pWork+1) = (mng_uint8)pData->iBASIgreen;
*(pWork+2) = (mng_uint8)pData->iBASIblue;
#endif
pWork += 3;
}
}
/* force tRNS ? */
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
if ((bHasalpha) && (!iAlpha))
#else
if ((pData->bBASIhasalpha) && (!pData->iBASIalpha))
#endif
{
pBuf->bHasTRNS = MNG_TRUE;
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
pBuf->iTRNSred = iRed;
pBuf->iTRNSgreen = iGreen;
pBuf->iTRNSblue = iBlue;
#else
pBuf->iTRNSred = pData->iBASIred;
pBuf->iTRNSgreen = pData->iBASIgreen;
pBuf->iTRNSblue = pData->iBASIblue;
#endif
}
break;
}
case 3 : { /* indexed */
pBuf->bHasPLTE = MNG_TRUE;
switch (pData->iBitdepth)
{
case 1 : { pBuf->iPLTEcount = 2; break; }
case 2 : { pBuf->iPLTEcount = 4; break; }
case 4 : { pBuf->iPLTEcount = 16; break; }
case 8 : { pBuf->iPLTEcount = 256; break; }
default : { pBuf->iPLTEcount = 1; break; }
}
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
pBuf->aPLTEentries [0].iRed = (mng_uint8)iRed;
pBuf->aPLTEentries [0].iGreen = (mng_uint8)iGreen;
pBuf->aPLTEentries [0].iBlue = (mng_uint8)iBlue;
#else
pBuf->aPLTEentries [0].iRed = (mng_uint8)pData->iBASIred;
pBuf->aPLTEentries [0].iGreen = (mng_uint8)pData->iBASIgreen;
pBuf->aPLTEentries [0].iBlue = (mng_uint8)pData->iBASIblue;
#endif
for (iX = 1; iX < pBuf->iPLTEcount; iX++)
{
pBuf->aPLTEentries [iX].iRed = 0;
pBuf->aPLTEentries [iX].iGreen = 0;
pBuf->aPLTEentries [iX].iBlue = 0;
}
/* force tRNS ? */
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
if ((bHasalpha) && (iAlpha < 255))
#else
if ((pData->bBASIhasalpha) && (pData->iBASIalpha < 255))
#endif
{
pBuf->bHasTRNS = MNG_TRUE;
pBuf->iTRNScount = 1;
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
pBuf->aTRNSentries [0] = (mng_uint8)iAlpha;
#else
pBuf->aTRNSentries [0] = (mng_uint8)pData->iBASIalpha;
#endif
}
break;
}
case 4 : { /* gray+alpha */
#ifndef MNG_NO_16BIT_SUPPORT
if (pData->iBitdepth == 16)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iDatawidth * pData->iDataheight;
iX > 0;iX--)
#else
for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++)
#endif
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
mng_put_uint16 (pWork, iRed);
mng_put_uint16 (pWork+2, iAlpha);
#else
mng_put_uint16 (pWork, pData->iBASIred);
mng_put_uint16 (pWork+2, pData->iBASIalpha);
#endif
pWork += 4;
}
}
else
#endif
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iDatawidth * pData->iDataheight;
iX > 0;iX--)
#else
for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++)
#endif
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
*pWork = (mng_uint8)iRed;
*(pWork+1) = (mng_uint8)iAlpha;
#else
*pWork = (mng_uint8)pData->iBASIred;
*(pWork+1) = (mng_uint8)pData->iBASIalpha;
#endif
pWork += 2;
}
}
break;
}
case 6 : { /* rgb+alpha */
#ifndef MNG_NO_16BIT_SUPPORT
if (pData->iBitdepth == 16)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iDatawidth * pData->iDataheight;
iX > 0;iX--)
#else
for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++)
#endif
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
mng_put_uint16 (pWork, iRed);
mng_put_uint16 (pWork+2, iGreen);
mng_put_uint16 (pWork+4, iBlue);
mng_put_uint16 (pWork+6, iAlpha);
#else
mng_put_uint16 (pWork, pData->iBASIred);
mng_put_uint16 (pWork+2, pData->iBASIgreen);
mng_put_uint16 (pWork+4, pData->iBASIblue);
mng_put_uint16 (pWork+6, pData->iBASIalpha);
#endif
pWork += 8;
}
}
else
#endif
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iDatawidth * pData->iDataheight;
iX > 0;iX--)
#else
for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++)
#endif
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
*pWork = (mng_uint8)iRed;
*(pWork+1) = (mng_uint8)iGreen;
*(pWork+2) = (mng_uint8)iBlue;
*(pWork+3) = (mng_uint8)iAlpha;
#else
*pWork = (mng_uint8)pData->iBASIred;
*(pWork+1) = (mng_uint8)pData->iBASIgreen;
*(pWork+2) = (mng_uint8)pData->iBASIblue;
*(pWork+3) = (mng_uint8)pData->iBASIalpha;
#endif
pWork += 4;
}
}
break;
}
}
#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT
pData->fInitrowproc = (mng_fptr)mng_init_rowproc;
pData->ePng_imgtype=mng_png_imgtype(pData->iColortype,pData->iBitdepth);
#else
switch (pData->iColortype) /* determine row initialization routine */
{ /* just to accomodate IDAT if it arrives */
case 0 : { /* gray */
switch (pData->iBitdepth)
{
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case 1 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_g1_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_g1_i;
break;
}
case 2 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_g2_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_g2_i;
break;
}
case 4 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_g4_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_g4_i;
break;
}
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case 8 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_g8_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_g8_i;
break;
}
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_g16_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_g16_i;
break;
}
#endif
}
break;
}
case 2 : { /* rgb */
switch (pData->iBitdepth)
{
case 8 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_rgb8_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_rgb8_i;
break;
}
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_rgb16_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_rgb16_i;
break;
}
#endif
}
break;
}
case 3 : { /* indexed */
switch (pData->iBitdepth)
{
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case 1 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_idx1_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_idx1_i;
break;
}
case 2 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_idx2_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_idx2_i;
break;
}
case 4 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_idx4_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_idx4_i;
break;
}
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case 8 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_idx8_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_idx8_i;
break;
}
}
break;
}
case 4 : { /* gray+alpha */
switch (pData->iBitdepth)
{
case 8 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_ga8_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_ga8_i;
break;
}
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_ga16_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_ga16_i;
break;
}
#endif
}
break;
}
case 6 : { /* rgb+alpha */
switch (pData->iBitdepth)
{
case 8 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_rgba8_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_rgba8_i;
break;
}
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_rgba16_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_rgba16_i;
break;
}
#endif
}
break;
}
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */
pData->iFilterofs = 0; /* determine filter characteristics */
pData->iLevel0 = 0; /* default levels */
pData->iLevel1 = 0;
pData->iLevel2 = 0;
pData->iLevel3 = 0;
#ifdef FILTER192
if (pData->iFilter == 0xC0) /* leveling & differing ? */
{
switch (pData->iColortype)
{
case 0 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pData->iBitdepth <= 8)
#endif
pData->iFilterofs = 1;
#ifndef MNG_NO_16BIT_SUPPORT
else
pData->iFilterofs = 2;
#endif
break;
}
case 2 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pData->iBitdepth <= 8)
#endif
pData->iFilterofs = 3;
#ifndef MNG_NO_16BIT_SUPPORT
else
pData->iFilterofs = 6;
#endif
break;
}
case 3 : {
pData->iFilterofs = 1;
break;
}
case 4 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pData->iBitdepth <= 8)
#endif
pData->iFilterofs = 2;
#ifndef MNG_NO_16BIT_SUPPORT
else
pData->iFilterofs = 4;
#endif
break;
}
case 6 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pData->iBitdepth <= 8)
#endif
pData->iFilterofs = 4;
#ifndef MNG_NO_16BIT_SUPPORT
else
pData->iFilterofs = 8;
#endif
break;
}
}
}
#endif
#ifdef FILTER193
if (pData->iFilter == 0xC1) /* no adaptive filtering ? */
pData->iPixelofs = pData->iFilterofs;
else
#endif
pData->iPixelofs = pData->iFilterofs + 1;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_BASI, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_CLON
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
mng_retcode mng_process_display_clon (mng_datap pData,
mng_uint16 iSourceid,
mng_uint16 iCloneid,
mng_uint8 iClonetype,
mng_bool bHasdonotshow,
mng_uint8 iDonotshow,
mng_uint8 iConcrete,
mng_bool bHasloca,
mng_uint8 iLocationtype,
mng_int32 iLocationx,
mng_int32 iLocationy)
#else
mng_retcode mng_process_display_clon (mng_datap pData)
#endif
{
mng_imagep pSource, pClone;
mng_bool bVisible, bAbstract;
mng_retcode iRetcode = MNG_NOERROR;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLON, MNG_LC_START);
#endif
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
/* locate the source object first */
pSource = mng_find_imageobject (pData, iSourceid);
/* check if the clone exists */
pClone = mng_find_imageobject (pData, iCloneid);
#else
/* locate the source object first */
pSource = mng_find_imageobject (pData, pData->iCLONsourceid);
/* check if the clone exists */
pClone = mng_find_imageobject (pData, pData->iCLONcloneid);
#endif
if (!pSource) /* source must exist ! */
MNG_ERROR (pData, MNG_OBJECTUNKNOWN);
if (pClone) /* clone must not exist ! */
MNG_ERROR (pData, MNG_OBJECTEXISTS);
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
if (bHasdonotshow) /* DoNotShow flag filled ? */
bVisible = (mng_bool)(iDonotshow == 0);
else
bVisible = pSource->bVisible;
#else
if (pData->bCLONhasdonotshow) /* DoNotShow flag filled ? */
bVisible = (mng_bool)(pData->iCLONdonotshow == 0);
else
bVisible = pSource->bVisible;
#endif
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
bAbstract = (mng_bool)(iConcrete == 1);
#else
bAbstract = (mng_bool)(pData->iCLONconcrete == 1);
#endif
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
switch (iClonetype) /* determine action to take */
{
case 0 : { /* full clone */
iRetcode = mng_clone_imageobject (pData, iCloneid, MNG_FALSE,
bVisible, bAbstract, bHasloca,
iLocationtype, iLocationx, iLocationy,
pSource, &pClone);
break;
}
case 1 : { /* partial clone */
iRetcode = mng_clone_imageobject (pData, iCloneid, MNG_TRUE,
bVisible, bAbstract, bHasloca,
iLocationtype, iLocationx, iLocationy,
pSource, &pClone);
break;
}
case 2 : { /* renumber object */
iRetcode = mng_renum_imageobject (pData, pSource, iCloneid,
bVisible, bAbstract, bHasloca,
iLocationtype, iLocationx, iLocationy);
pClone = pSource;
break;
}
}
#else
switch (pData->iCLONclonetype) /* determine action to take */
{
case 0 : { /* full clone */
iRetcode = mng_clone_imageobject (pData, pData->iCLONcloneid, MNG_FALSE,
bVisible, bAbstract,
pData->bCLONhasloca, pData->iCLONlocationtype,
pData->iCLONlocationx, pData->iCLONlocationy,
pSource, &pClone);
break;
}
case 1 : { /* partial clone */
iRetcode = mng_clone_imageobject (pData, pData->iCLONcloneid, MNG_TRUE,
bVisible, bAbstract,
pData->bCLONhasloca, pData->iCLONlocationtype,
pData->iCLONlocationx, pData->iCLONlocationy,
pSource, &pClone);
break;
}
case 2 : { /* renumber object */
iRetcode = mng_renum_imageobject (pData, pSource, pData->iCLONcloneid,
bVisible, bAbstract,
pData->bCLONhasloca, pData->iCLONlocationtype,
pData->iCLONlocationx, pData->iCLONlocationy);
pClone = pSource;
break;
}
}
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* display on the fly ? */
if ((pClone->bViewable) && (pClone->bVisible))
{
pData->pLastclone = pClone; /* remember in case of timer break ! */
/* display it */
mng_display_image (pData, pClone, MNG_FALSE);
if (pData->bTimerset) /* timer break ? */
pData->iBreakpoint = 5;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLON, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_process_display_clon2 (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLON, MNG_LC_START);
#endif
/* only called after timer break ! */
mng_display_image (pData, (mng_imagep)pData->pLastclone, MNG_FALSE);
pData->iBreakpoint = 0;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLON, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_DISC
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
mng_retcode mng_process_display_disc (mng_datap pData,
mng_uint32 iCount,
mng_uint16p pIds)
#else
mng_retcode mng_process_display_disc (mng_datap pData)
#endif
{
mng_uint32 iX;
mng_imagep pImage;
mng_uint32 iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DISC, MNG_LC_START);
#endif
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
if (iCount) /* specific list ? */
#else
if (pData->iDISCcount) /* specific list ? */
#endif
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
mng_uint16p pWork = pIds;
#else
mng_uint16p pWork = pData->pDISCids;
#endif
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
#ifdef MNG_DECREMENT_LOOPS /* iterate the list */
for (iX = iCount; iX > 0; iX--)
#else
for (iX = 0; iX < iCount; iX++)
#endif
#else
#ifdef MNG_DECREMENT_LOOPS /* iterate the list */
for (iX = pData->iDISCcount; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iDISCcount; iX++)
#endif
#endif
{
pImage = mng_find_imageobject (pData, *pWork++);
if (pImage) /* found the object ? */
{ /* then drop it */
iRetcode = mng_free_imageobject (pData, pImage);
if (iRetcode) /* on error bail out */
return iRetcode;
}
}
}
else /* empty: drop all un-frozen objects */
{
mng_imagep pNext = (mng_imagep)pData->pFirstimgobj;
while (pNext) /* any left ? */
{
pImage = pNext;
pNext = pImage->sHeader.pNext;
if (!pImage->bFrozen) /* not frozen ? */
{ /* then drop it */
iRetcode = mng_free_imageobject (pData, pImage);
if (iRetcode) /* on error bail out */
return iRetcode;
}
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DISC, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_FRAM
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
mng_retcode mng_process_display_fram (mng_datap pData,
mng_uint8 iFramemode,
mng_uint8 iChangedelay,
mng_uint32 iDelay,
mng_uint8 iChangetimeout,
mng_uint32 iTimeout,
mng_uint8 iChangeclipping,
mng_uint8 iCliptype,
mng_int32 iClipl,
mng_int32 iClipr,
mng_int32 iClipt,
mng_int32 iClipb)
#else
mng_retcode mng_process_display_fram (mng_datap pData)
#endif
{
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_FRAM, MNG_LC_START);
#endif
/* advance a frame then */
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
iRetcode = next_frame (pData, iFramemode, iChangedelay, iDelay,
iChangetimeout, iTimeout, iChangeclipping,
iCliptype, iClipl, iClipr, iClipt, iClipb);
#else
iRetcode = next_frame (pData, pData->iTempFramemode, pData->iTempChangedelay,
pData->iTempDelay, pData->iTempChangetimeout,
pData->iTempTimeout, pData->iTempChangeclipping,
pData->iTempCliptype, pData->iTempClipl, pData->iTempClipr,
pData->iTempClipt, pData->iTempClipb);
#endif
if (pData->bTimerset) /* timer break ? */
pData->iBreakpoint = 1;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_FRAM, MNG_LC_END);
#endif
return iRetcode;
}
/* ************************************************************************** */
mng_retcode mng_process_display_fram2 (mng_datap pData)
{
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_FRAM, MNG_LC_START);
#endif
/* again; after the break */
iRetcode = next_frame (pData, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
pData->iBreakpoint = 0; /* not again! */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_FRAM, MNG_LC_END);
#endif
return iRetcode;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_MOVE
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
mng_retcode mng_process_display_move (mng_datap pData,
mng_uint16 iFromid,
mng_uint16 iToid,
mng_uint8 iMovetype,
mng_int32 iMovex,
mng_int32 iMovey)
#else
mng_retcode mng_process_display_move (mng_datap pData)
#endif
{
mng_uint16 iX;
mng_imagep pImage;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MOVE, MNG_LC_START);
#endif
/* iterate the list */
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
for (iX = iFromid; iX <= iToid; iX++)
#else
for (iX = pData->iMOVEfromid; iX <= pData->iMOVEtoid; iX++)
#endif
{
if (!iX) /* object id=0 ? */
pImage = (mng_imagep)pData->pObjzero;
else
pImage = mng_find_imageobject (pData, iX);
if (pImage) /* object exists ? */
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
switch (iMovetype)
#else
switch (pData->iMOVEmovetype)
#endif
{
case 0 : { /* absolute */
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
pImage->iPosx = iMovex;
pImage->iPosy = iMovey;
#else
pImage->iPosx = pData->iMOVEmovex;
pImage->iPosy = pData->iMOVEmovey;
#endif
break;
}
case 1 : { /* relative */
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
pImage->iPosx = pImage->iPosx + iMovex;
pImage->iPosy = pImage->iPosy + iMovey;
#else
pImage->iPosx = pImage->iPosx + pData->iMOVEmovex;
pImage->iPosy = pImage->iPosy + pData->iMOVEmovey;
#endif
break;
}
}
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MOVE, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_CLIP
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
mng_retcode mng_process_display_clip (mng_datap pData,
mng_uint16 iFromid,
mng_uint16 iToid,
mng_uint8 iCliptype,
mng_int32 iClipl,
mng_int32 iClipr,
mng_int32 iClipt,
mng_int32 iClipb)
#else
mng_retcode mng_process_display_clip (mng_datap pData)
#endif
{
mng_uint16 iX;
mng_imagep pImage;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLIP, MNG_LC_START);
#endif
/* iterate the list */
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
for (iX = iFromid; iX <= iToid; iX++)
#else
for (iX = pData->iCLIPfromid; iX <= pData->iCLIPtoid; iX++)
#endif
{
if (!iX) /* object id=0 ? */
pImage = (mng_imagep)pData->pObjzero;
else
pImage = mng_find_imageobject (pData, iX);
if (pImage) /* object exists ? */
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
switch (iCliptype)
#else
switch (pData->iCLIPcliptype)
#endif
{
case 0 : { /* absolute */
pImage->bClipped = MNG_TRUE;
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
pImage->iClipl = iClipl;
pImage->iClipr = iClipr;
pImage->iClipt = iClipt;
pImage->iClipb = iClipb;
#else
pImage->iClipl = pData->iCLIPclipl;
pImage->iClipr = pData->iCLIPclipr;
pImage->iClipt = pData->iCLIPclipt;
pImage->iClipb = pData->iCLIPclipb;
#endif
break;
}
case 1 : { /* relative */
pImage->bClipped = MNG_TRUE;
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
pImage->iClipl = pImage->iClipl + iClipl;
pImage->iClipr = pImage->iClipr + iClipr;
pImage->iClipt = pImage->iClipt + iClipt;
pImage->iClipb = pImage->iClipb + iClipb;
#else
pImage->iClipl = pImage->iClipl + pData->iCLIPclipl;
pImage->iClipr = pImage->iClipr + pData->iCLIPclipr;
pImage->iClipt = pImage->iClipt + pData->iCLIPclipt;
pImage->iClipb = pImage->iClipb + pData->iCLIPclipb;
#endif
break;
}
}
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLIP, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_SHOW
mng_retcode mng_process_display_show (mng_datap pData)
{
mng_int16 iX, iS, iFrom, iTo;
mng_imagep pImage;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SHOW, MNG_LC_START);
#endif
/* TODO: optimization for the cases where "abs (iTo - iFrom)" is rather high;
especially where ((iFrom==1) && (iTo==65535)); eg. an empty SHOW !!! */
if (pData->iBreakpoint == 3) /* previously broken during cycle-mode ? */
{
pImage = mng_find_imageobject (pData, pData->iSHOWnextid);
if (pImage) /* still there ? */
mng_display_image (pData, pImage, MNG_FALSE);
pData->iBreakpoint = 0; /* let's not go through this again! */
}
else
{
if (pData->iBreakpoint) /* previously broken at other point ? */
{ /* restore last parms */
iFrom = (mng_int16)pData->iSHOWfromid;
iTo = (mng_int16)pData->iSHOWtoid;
iX = (mng_int16)pData->iSHOWnextid;
iS = (mng_int16)pData->iSHOWskip;
}
else
{ /* regular sequence ? */
if (pData->iSHOWtoid >= pData->iSHOWfromid)
iS = 1;
else /* reverse sequence ! */
iS = -1;
iFrom = (mng_int16)pData->iSHOWfromid;
iTo = (mng_int16)pData->iSHOWtoid;
iX = iFrom;
pData->iSHOWfromid = (mng_uint16)iFrom;
pData->iSHOWtoid = (mng_uint16)iTo;
pData->iSHOWskip = iS;
}
/* cycle mode ? */
if ((pData->iSHOWmode == 6) || (pData->iSHOWmode == 7))
{
mng_uint16 iTrigger = 0;
mng_uint16 iFound = 0;
mng_uint16 iPass = 0;
mng_imagep pFound = 0;
do
{
iPass++; /* lets prevent endless loops when there
are no potential candidates in the list! */
if (iS > 0) /* forward ? */
{
for (iX = iFrom; iX <= iTo; iX += iS)
{
pImage = mng_find_imageobject (pData, (mng_uint16)iX);
if (pImage) /* object exists ? */
{
if (iFound) /* already found a candidate ? */
pImage->bVisible = MNG_FALSE;
else
if (iTrigger) /* found the trigger ? */
{
pImage->bVisible = MNG_TRUE;
iFound = iX;
pFound = pImage;
}
else
if (pImage->bVisible) /* ok, this is the trigger */
{
pImage->bVisible = MNG_FALSE;
iTrigger = iX;
}
}
}
}
else
{
for (iX = iFrom; iX >= iTo; iX += iS)
{
pImage = mng_find_imageobject (pData, (mng_uint16)iX);
if (pImage) /* object exists ? */
{
if (iFound) /* already found a candidate ? */
pImage->bVisible = MNG_FALSE;
else
if (iTrigger) /* found the trigger ? */
{
pImage->bVisible = MNG_TRUE;
iFound = iX;
pFound = pImage;
}
else
if (pImage->bVisible) /* ok, this is the trigger */
{
pImage->bVisible = MNG_FALSE;
iTrigger = iX;
}
}
}
}
if (!iTrigger) /* did not find a trigger ? */
iTrigger = 1; /* then fake it so the first image
gets nominated */
} /* cycle back to beginning ? */
while ((iPass < 2) && (iTrigger) && (!iFound));
pData->iBreakpoint = 0; /* just a sanity precaution */
/* display it ? */
if ((pData->iSHOWmode == 6) && (pFound))
{
mng_display_image (pData, pFound, MNG_FALSE);
if (pData->bTimerset) /* timer set ? */
{
pData->iBreakpoint = 3;
pData->iSHOWnextid = iFound; /* save it for after the break */
}
}
}
else
{
do
{
pImage = mng_find_imageobject (pData, iX);
if (pImage) /* object exists ? */
{
if (pData->iBreakpoint) /* did we get broken last time ? */
{ /* could only happen in the display routine */
mng_display_image (pData, pImage, MNG_FALSE);
pData->iBreakpoint = 0; /* only once inside this loop please ! */
}
else
{
switch (pData->iSHOWmode) /* do what ? */
{
case 0 : {
pImage->bVisible = MNG_TRUE;
mng_display_image (pData, pImage, MNG_FALSE);
break;
}
case 1 : {
pImage->bVisible = MNG_FALSE;
break;
}
case 2 : {
if (pImage->bVisible)
mng_display_image (pData, pImage, MNG_FALSE);
break;
}
case 3 : {
pImage->bVisible = MNG_TRUE;
break;
}
case 4 : {
pImage->bVisible = (mng_bool)(!pImage->bVisible);
if (pImage->bVisible)
mng_display_image (pData, pImage, MNG_FALSE);
break;
}
case 5 : {
pImage->bVisible = (mng_bool)(!pImage->bVisible);
}
}
}
}
if (!pData->bTimerset) /* next ? */
iX += iS;
} /* continue ? */
while ((!pData->bTimerset) && (((iS > 0) && (iX <= iTo)) ||
((iS < 0) && (iX >= iTo)) ));
if (pData->bTimerset) /* timer set ? */
{
pData->iBreakpoint = 4;
pData->iSHOWnextid = iX; /* save for next time */
}
else
pData->iBreakpoint = 0;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SHOW, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_SAVE
mng_retcode mng_process_display_save (mng_datap pData)
{
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SAVE, MNG_LC_START);
#endif
iRetcode = save_state (pData); /* save the current state */
if (iRetcode) /* on error bail out */
return iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SAVE, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_SEEK
mng_retcode mng_process_display_seek (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SEEK, MNG_LC_START);
#endif
#ifdef MNG_SUPPORT_DYNAMICMNG
if (pData->bStopafterseek) /* need to stop after this SEEK ? */
{
pData->bFreezing = MNG_TRUE; /* stop processing on this one */
pData->bRunningevent = MNG_FALSE;
pData->bStopafterseek = MNG_FALSE;
pData->bNeedrefresh = MNG_TRUE; /* make sure the last bit is displayed ! */
}
else
#endif
{ /* restore the initial or SAVE state */
mng_retcode iRetcode = restore_state (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
#ifdef MNG_SUPPORT_DYNAMICMNG
/* stop after next SEEK ? */
if ((pData->bDynamic) || (pData->bRunningevent))
pData->bStopafterseek = MNG_TRUE;
#endif
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SEEK, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG
mng_retcode mng_process_display_jhdr (mng_datap pData)
{ /* address the current "object" if any */
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
mng_retcode iRetcode = MNG_NOERROR;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JHDR, MNG_LC_START);
#endif
if (!pData->bHasDHDR)
{
pData->fInitrowproc = MNG_NULL; /* do nothing by default */
pData->fDisplayrow = MNG_NULL;
pData->fCorrectrow = MNG_NULL;
pData->fStorerow = MNG_NULL;
pData->fProcessrow = MNG_NULL;
pData->fDifferrow = MNG_NULL;
pData->fStorerow2 = MNG_NULL;
pData->fStorerow3 = MNG_NULL;
pData->pStoreobj = MNG_NULL; /* initialize important work-parms */
pData->iJPEGrow = 0;
pData->iJPEGalpharow = 0;
pData->iJPEGrgbrow = 0;
pData->iRowmax = 0; /* so init_rowproc does the right thing ! */
}
if (!pData->iBreakpoint) /* not previously broken ? */
{
#ifndef MNG_NO_DELTA_PNG
if (pData->bHasDHDR) /* delta-image ? */
{
if (pData->iDeltatype == MNG_DELTATYPE_REPLACE)
{
iRetcode = mng_reset_object_details (pData, (mng_imagep)pData->pDeltaImage,
pData->iDatawidth, pData->iDataheight,
pData->iJHDRimgbitdepth, pData->iJHDRcolortype,
pData->iJHDRalphacompression, pData->iJHDRalphafilter,
pData->iJHDRalphainterlace, MNG_TRUE);
((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphabitdepth = pData->iJHDRalphabitdepth;
((mng_imagep)pData->pDeltaImage)->pImgbuf->iJHDRcompression = pData->iJHDRimgcompression;
((mng_imagep)pData->pDeltaImage)->pImgbuf->iJHDRinterlace = pData->iJHDRimginterlace;
((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth;
}
else
if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
{
((mng_imagep)pData->pDeltaImage)->pImgbuf->iPixelsampledepth = pData->iJHDRimgbitdepth;
((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth;
}
else
if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) )
((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth;
else
if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) )
((mng_imagep)pData->pDeltaImage)->pImgbuf->iPixelsampledepth = pData->iJHDRimgbitdepth;
}
else
#endif /* MNG_NO_DELTA_PNG */
{
if (pImage) /* update object buffer ? */
{
iRetcode = mng_reset_object_details (pData, pImage,
pData->iDatawidth, pData->iDataheight,
pData->iJHDRimgbitdepth, pData->iJHDRcolortype,
pData->iJHDRalphacompression, pData->iJHDRalphafilter,
pData->iJHDRalphainterlace, MNG_TRUE);
pImage->pImgbuf->iAlphabitdepth = pData->iJHDRalphabitdepth;
pImage->pImgbuf->iJHDRcompression = pData->iJHDRimgcompression;
pImage->pImgbuf->iJHDRinterlace = pData->iJHDRimginterlace;
pImage->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth;
}
else /* update object 0 */
{
iRetcode = mng_reset_object_details (pData, (mng_imagep)pData->pObjzero,
pData->iDatawidth, pData->iDataheight,
pData->iJHDRimgbitdepth, pData->iJHDRcolortype,
pData->iJHDRalphacompression, pData->iJHDRalphafilter,
pData->iJHDRalphainterlace, MNG_TRUE);
((mng_imagep)pData->pObjzero)->pImgbuf->iAlphabitdepth = pData->iJHDRalphabitdepth;
((mng_imagep)pData->pObjzero)->pImgbuf->iJHDRcompression = pData->iJHDRimgcompression;
((mng_imagep)pData->pObjzero)->pImgbuf->iJHDRinterlace = pData->iJHDRimginterlace;
((mng_imagep)pData->pObjzero)->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth;
}
}
if (iRetcode) /* on error bail out */
return iRetcode;
}
if (!pData->bHasDHDR)
{ /* we're always storing a JPEG */
if (pImage) /* real object ? */
pData->pStoreobj = pImage; /* tell the row routines */
else /* otherwise use object 0 */
pData->pStoreobj = pData->pObjzero;
/* display "on-the-fly" ? */
if (
#ifndef MNG_SKIPCHUNK_MAGN
( ((mng_imagep)pData->pStoreobj)->iMAGN_MethodX == 0) &&
( ((mng_imagep)pData->pStoreobj)->iMAGN_MethodY == 0) &&
#endif
( (pData->eImagetype == mng_it_jng ) ||
(((mng_imagep)pData->pStoreobj)->bVisible) ) )
{
next_layer (pData); /* that's a new layer then ! */
pData->iBreakpoint = 0;
if (pData->bTimerset) /* timer break ? */
pData->iBreakpoint = 7;
else
if (pData->bRunning) /* still running ? */
{ /* anything to display ? */
if ((pData->iDestr > pData->iDestl) && (pData->iDestb > pData->iDestt))
{
set_display_routine (pData); /* then determine display routine */
/* display from the object we store in */
pData->pRetrieveobj = pData->pStoreobj;
}
}
}
}
if (!pData->bTimerset) /* no timer break ? */
{ /* default row initialization ! */
#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT
pData->ePng_imgtype=png_none;
#endif
pData->fInitrowproc = (mng_fptr)mng_init_rowproc;
if ((!pData->bHasDHDR) || (pData->iDeltatype == MNG_DELTATYPE_REPLACE))
{ /* 8-bit JPEG ? */
if (pData->iJHDRimgbitdepth == 8)
{ /* intermediate row is 8-bit deep */
pData->bIsRGBA16 = MNG_FALSE;
pData->iRowsamples = pData->iDatawidth;
switch (pData->iJHDRcolortype) /* determine pixel processing routines */
{
case MNG_COLORTYPE_JPEGGRAY :
{
pData->fStorerow2 = (mng_fptr)mng_store_jpeg_g8;
pData->fRetrieverow = (mng_fptr)mng_retrieve_g8;
pData->bIsOpaque = MNG_TRUE;
break;
}
case MNG_COLORTYPE_JPEGCOLOR :
{
pData->fStorerow2 = (mng_fptr)mng_store_jpeg_rgb8;
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8;
pData->bIsOpaque = MNG_TRUE;
break;
}
case MNG_COLORTYPE_JPEGGRAYA :
{
pData->fStorerow2 = (mng_fptr)mng_store_jpeg_ga8;
pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8;
pData->bIsOpaque = MNG_FALSE;
break;
}
case MNG_COLORTYPE_JPEGCOLORA :
{
pData->fStorerow2 = (mng_fptr)mng_store_jpeg_rgba8;
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8;
pData->bIsOpaque = MNG_FALSE;
break;
}
}
}
#ifndef MNG_NO_16BIT_SUPPORT
else
{
pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */
/* TODO: 12-bit JPEG */
/* TODO: 8- + 12-bit JPEG (eg. type=20) */
}
#endif
/* possible IDAT alpha-channel ? */
if (pData->iJHDRalphacompression == MNG_COMPRESSION_DEFLATE)
{
/* determine alpha processing routine */
#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT
pData->fInitrowproc = (mng_fptr)mng_init_rowproc;
#endif
switch (pData->iJHDRalphabitdepth)
{
#ifndef MNG_OPTIMIZE_FOOTPRINT_INIT
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case 1 : { pData->fInitrowproc = (mng_fptr)mng_init_jpeg_a1_ni; break; }
case 2 : { pData->fInitrowproc = (mng_fptr)mng_init_jpeg_a2_ni; break; }
case 4 : { pData->fInitrowproc = (mng_fptr)mng_init_jpeg_a4_ni; break; }
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case 8 : { pData->fInitrowproc = (mng_fptr)mng_init_jpeg_a8_ni; break; }
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : { pData->fInitrowproc = (mng_fptr)mng_init_jpeg_a16_ni; break; }
#endif
#else
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case 1 : { pData->ePng_imgtype = png_jpeg_a1; break; }
case 2 : { pData->ePng_imgtype = png_jpeg_a2; break; }
case 4 : { pData->ePng_imgtype = png_jpeg_a4; break; }
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case 8 : { pData->ePng_imgtype = png_jpeg_a8; break; }
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : { pData->ePng_imgtype = png_jpeg_a16; break; }
#endif
#endif
}
}
else /* possible JDAA alpha-channel ? */
if (pData->iJHDRalphacompression == MNG_COMPRESSION_BASELINEJPEG)
{ /* 8-bit JPEG ? */
if (pData->iJHDRimgbitdepth == 8)
{
if (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA)
pData->fStorerow3 = (mng_fptr)mng_store_jpeg_g8_alpha;
else
if (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA)
pData->fStorerow3 = (mng_fptr)mng_store_jpeg_rgb8_alpha;
}
else
{
/* TODO: 12-bit JPEG with 8-bit JDAA */
}
}
/* initialize JPEG library */
iRetcode = mngjpeg_initialize (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
}
else
{ /* must be alpha add/replace !! */
if ((pData->iDeltatype != MNG_DELTATYPE_BLOCKALPHAADD ) &&
(pData->iDeltatype != MNG_DELTATYPE_BLOCKALPHAREPLACE) )
MNG_ERROR (pData, MNG_INVDELTATYPE);
/* determine alpha processing routine */
#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT
pData->fInitrowproc = (mng_fptr)mng_init_rowproc;
#endif
switch (pData->iJHDRalphabitdepth)
{
#ifndef MNG_OPTIMIZE_FOOTPRINT_INIT
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case 1 : { pData->fInitrowproc = (mng_fptr)mng_init_g1_ni; break; }
case 2 : { pData->fInitrowproc = (mng_fptr)mng_init_g2_ni; break; }
case 4 : { pData->fInitrowproc = (mng_fptr)mng_init_g4_ni; break; }
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case 8 : { pData->fInitrowproc = (mng_fptr)mng_init_g8_ni; break; }
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : { pData->fInitrowproc = (mng_fptr)mng_init_g16_ni; break; }
#endif
#else
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case 1 : { pData->ePng_imgtype = png_jpeg_a1; break; }
case 2 : { pData->ePng_imgtype = png_jpeg_a2; break; }
case 4 : { pData->ePng_imgtype = png_jpeg_a4; break; }
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case 8 : { pData->ePng_imgtype = png_jpeg_a8; break; }
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : { pData->ePng_imgtype = png_jpeg_a16; break; }
#endif
#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */
}
}
pData->iFilterofs = 0; /* determine filter characteristics */
pData->iLevel0 = 0; /* default levels */
pData->iLevel1 = 0;
pData->iLevel2 = 0;
pData->iLevel3 = 0;
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iJHDRalphafilter == 0xC0)
{
if (pData->iJHDRalphabitdepth <= 8)
pData->iFilterofs = 1;
else
pData->iFilterofs = 2;
}
#endif
#ifdef FILTER193 /* no adaptive filtering ? */
if (pData->iJHDRalphafilter == 0xC1)
pData->iPixelofs = pData->iFilterofs;
else
#endif
pData->iPixelofs = pData->iFilterofs + 1;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JHDR, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_INCLUDE_JNG */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
mng_retcode mng_process_display_jdaa (mng_datap pData,
mng_uint32 iRawlen,
mng_uint8p pRawdata)
#else
mng_retcode mng_process_display_jdaa (mng_datap pData)
#endif
{
mng_retcode iRetcode = MNG_NOERROR;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JDAA, MNG_LC_START);
#endif
if (!pData->bJPEGdecompress2) /* if we're not decompressing already */
{
if (pData->fInitrowproc) /* initialize row-processing? */
{
iRetcode = ((mng_initrowproc)pData->fInitrowproc) (pData);
pData->fInitrowproc = MNG_NULL; /* only call this once !!! */
}
if (!iRetcode) /* initialize decompress */
iRetcode = mngjpeg_decompressinit2 (pData);
}
if (!iRetcode) /* all ok? then decompress, my man */
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
iRetcode = mngjpeg_decompressdata2 (pData, iRawlen, pRawdata);
#else
iRetcode = mngjpeg_decompressdata2 (pData, pData->iRawlen, pData->pRawdata);
#endif
if (iRetcode)
return iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JDAA, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_INCLUDE_JNG */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
mng_retcode mng_process_display_jdat (mng_datap pData,
mng_uint32 iRawlen,
mng_uint8p pRawdata)
#else
mng_retcode mng_process_display_jdat (mng_datap pData)
#endif
{
mng_retcode iRetcode = MNG_NOERROR;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JDAT, MNG_LC_START);
#endif
if (pData->bRestorebkgd) /* need to restore the background ? */
{
pData->bRestorebkgd = MNG_FALSE;
iRetcode = load_bkgdlayer (pData);
pData->iLayerseq++; /* and it counts as a layer then ! */
if (iRetcode) /* on error bail out */
return iRetcode;
}
if (!pData->bJPEGdecompress) /* if we're not decompressing already */
{
if (pData->fInitrowproc) /* initialize row-processing? */
{
iRetcode = ((mng_initrowproc)pData->fInitrowproc) (pData);
pData->fInitrowproc = MNG_NULL; /* only call this once !!! */
}
if (!iRetcode) /* initialize decompress */
iRetcode = mngjpeg_decompressinit (pData);
}
if (!iRetcode) /* all ok? then decompress, my man */
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
iRetcode = mngjpeg_decompressdata (pData, iRawlen, pRawdata);
#else
iRetcode = mngjpeg_decompressdata (pData, pData->iRawlen, pData->pRawdata);
#endif
if (iRetcode)
return iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JDAT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_INCLUDE_JNG */
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
mng_retcode mng_process_display_dhdr (mng_datap pData,
mng_uint16 iObjectid,
mng_uint8 iImagetype,
mng_uint8 iDeltatype,
mng_uint32 iBlockwidth,
mng_uint32 iBlockheight,
mng_uint32 iBlockx,
mng_uint32 iBlocky)
#else
mng_retcode mng_process_display_dhdr (mng_datap pData)
#endif
{
mng_imagep pImage;
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DHDR, MNG_LC_START);
#endif
pData->fInitrowproc = MNG_NULL; /* do nothing by default */
pData->fDisplayrow = MNG_NULL;
pData->fCorrectrow = MNG_NULL;
pData->fStorerow = MNG_NULL;
pData->fProcessrow = MNG_NULL;
pData->pStoreobj = MNG_NULL;
pData->fDeltagetrow = MNG_NULL;
pData->fDeltaaddrow = MNG_NULL;
pData->fDeltareplacerow = MNG_NULL;
pData->fDeltaputrow = MNG_NULL;
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
pImage = mng_find_imageobject (pData, iObjectid);
#else
pImage = mng_find_imageobject (pData, pData->iDHDRobjectid);
#endif
if (pImage) /* object exists ? */
{
if (pImage->pImgbuf->bConcrete) /* is it concrete ? */
{ /* previous magnification to be done ? */
#ifndef MNG_SKIPCHUNK_MAGN
if ((pImage->iMAGN_MethodX) || (pImage->iMAGN_MethodY))
{
iRetcode = mng_magnify_imageobject (pData, pImage);
if (iRetcode) /* on error bail out */
return iRetcode;
}
#endif
/* save delta fields */
pData->pDeltaImage = (mng_ptr)pImage;
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
pData->iDeltaImagetype = iImagetype;
pData->iDeltatype = iDeltatype;
pData->iDeltaBlockwidth = iBlockwidth;
pData->iDeltaBlockheight = iBlockheight;
pData->iDeltaBlockx = iBlockx;
pData->iDeltaBlocky = iBlocky;
#else
pData->iDeltaImagetype = pData->iDHDRimagetype;
pData->iDeltatype = pData->iDHDRdeltatype;
pData->iDeltaBlockwidth = pData->iDHDRblockwidth;
pData->iDeltaBlockheight = pData->iDHDRblockheight;
pData->iDeltaBlockx = pData->iDHDRblockx;
pData->iDeltaBlocky = pData->iDHDRblocky;
#endif
/* restore target-object fields */
pData->iDatawidth = pImage->pImgbuf->iWidth;
pData->iDataheight = pImage->pImgbuf->iHeight;
pData->iBitdepth = pImage->pImgbuf->iBitdepth;
pData->iColortype = pImage->pImgbuf->iColortype;
pData->iCompression = pImage->pImgbuf->iCompression;
pData->iFilter = pImage->pImgbuf->iFilter;
pData->iInterlace = pImage->pImgbuf->iInterlace;
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
if ((iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) ||
(iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
pData->iBitdepth = pImage->pImgbuf->iPixelsampledepth;
else
if ((iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) ||
(iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) )
pData->iBitdepth = pImage->pImgbuf->iAlphasampledepth;
else
if ((iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) ||
(iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) )
pData->iBitdepth = pImage->pImgbuf->iPixelsampledepth;
#else
if ((pData->iDHDRdeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) ||
(pData->iDHDRdeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
pData->iBitdepth = pImage->pImgbuf->iPixelsampledepth;
else
if ((pData->iDHDRdeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) ||
(pData->iDHDRdeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) )
pData->iBitdepth = pImage->pImgbuf->iAlphasampledepth;
else
if ((pData->iDHDRdeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) ||
(pData->iDHDRdeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) )
pData->iBitdepth = pImage->pImgbuf->iPixelsampledepth;
#endif
#ifdef MNG_INCLUDE_JNG
pData->iJHDRimgbitdepth = pImage->pImgbuf->iBitdepth;
pData->iJHDRcolortype = pImage->pImgbuf->iColortype;
pData->iJHDRimgcompression = pImage->pImgbuf->iJHDRcompression;
pData->iJHDRimginterlace = pImage->pImgbuf->iJHDRinterlace;
pData->iJHDRalphacompression = pImage->pImgbuf->iCompression;
pData->iJHDRalphafilter = pImage->pImgbuf->iFilter;
pData->iJHDRalphainterlace = pImage->pImgbuf->iInterlace;
pData->iJHDRalphabitdepth = pImage->pImgbuf->iAlphabitdepth;
#endif
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
/* block size specified ? */
if (iDeltatype != MNG_DELTATYPE_NOCHANGE)
{ /* block entirely within target ? */
if (iDeltatype != MNG_DELTATYPE_REPLACE)
{
if (((iBlockx + iBlockwidth ) > pData->iDatawidth ) ||
((iBlocky + iBlockheight) > pData->iDataheight) )
MNG_ERROR (pData, MNG_INVALIDBLOCK);
}
pData->iDatawidth = iBlockwidth;
pData->iDataheight = iBlockheight;
}
#else
/* block size specified ? */
if (pData->iDHDRdeltatype != MNG_DELTATYPE_NOCHANGE)
{ /* block entirely within target ? */
if (pData->iDHDRdeltatype != MNG_DELTATYPE_REPLACE)
{
if (((pData->iDHDRblockx + pData->iDHDRblockwidth ) > pData->iDatawidth ) ||
((pData->iDHDRblocky + pData->iDHDRblockheight) > pData->iDataheight) )
MNG_ERROR (pData, MNG_INVALIDBLOCK);
}
pData->iDatawidth = pData->iDHDRblockwidth;
pData->iDataheight = pData->iDHDRblockheight;
}
#endif
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
switch (iDeltatype) /* determine nr of delta-channels */
#else
switch (pData->iDHDRdeltatype) /* determine nr of delta-channels */
#endif
{
case MNG_DELTATYPE_BLOCKALPHAADD : ;
case MNG_DELTATYPE_BLOCKALPHAREPLACE :
{
#ifdef MNG_INCLUDE_JNG
if ((pData->iColortype == MNG_COLORTYPE_GRAYA ) ||
(pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA) )
{
pData->iColortype = MNG_COLORTYPE_GRAY;
pData->iJHDRcolortype = MNG_COLORTYPE_JPEGGRAY;
}
else
if ((pData->iColortype == MNG_COLORTYPE_RGBA ) ||
(pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) )
{
pData->iColortype = MNG_COLORTYPE_GRAY;
pData->iJHDRcolortype = MNG_COLORTYPE_JPEGGRAY;
}
#else
if (pData->iColortype == MNG_COLORTYPE_GRAYA)
pData->iColortype = MNG_COLORTYPE_GRAY;
else
if (pData->iColortype == MNG_COLORTYPE_RGBA)
pData->iColortype = MNG_COLORTYPE_GRAY;
#endif
else /* target has no alpha; that sucks! */
MNG_ERROR (pData, MNG_TARGETNOALPHA);
break;
}
case MNG_DELTATYPE_BLOCKCOLORADD : ;
case MNG_DELTATYPE_BLOCKCOLORREPLACE :
{
#ifdef MNG_INCLUDE_JNG
if ((pData->iColortype == MNG_COLORTYPE_GRAYA ) ||
(pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA) )
{
pData->iColortype = MNG_COLORTYPE_GRAY;
pData->iJHDRcolortype = MNG_COLORTYPE_JPEGGRAY;
}
else
if ((pData->iColortype == MNG_COLORTYPE_RGBA ) ||
(pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) )
{
pData->iColortype = MNG_COLORTYPE_RGB;
pData->iJHDRcolortype = MNG_COLORTYPE_JPEGCOLOR;
}
#else
if (pData->iColortype == MNG_COLORTYPE_GRAYA)
pData->iColortype = MNG_COLORTYPE_GRAY;
else
if (pData->iColortype == MNG_COLORTYPE_RGBA)
pData->iColortype = MNG_COLORTYPE_RGB;
#endif
else /* target has no alpha; that sucks! */
MNG_ERROR (pData, MNG_TARGETNOALPHA);
break;
}
}
/* full image replace ? */
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
if (iDeltatype == MNG_DELTATYPE_REPLACE)
#else
if (pData->iDHDRdeltatype == MNG_DELTATYPE_REPLACE)
#endif
{
iRetcode = mng_reset_object_details (pData, pImage,
pData->iDatawidth, pData->iDataheight,
pData->iBitdepth, pData->iColortype,
pData->iCompression, pData->iFilter,
pData->iInterlace, MNG_FALSE);
if (iRetcode) /* on error bail out */
return iRetcode;
pData->pStoreobj = pImage; /* and store straight into this object */
}
else
{
mng_imagedatap pBufzero, pBuf;
/* we store in object 0 and process it later */
pData->pStoreobj = pData->pObjzero;
/* make sure to initialize object 0 then */
iRetcode = mng_reset_object_details (pData, (mng_imagep)pData->pObjzero,
pData->iDatawidth, pData->iDataheight,
pData->iBitdepth, pData->iColortype,
pData->iCompression, pData->iFilter,
pData->iInterlace, MNG_TRUE);
if (iRetcode) /* on error bail out */
return iRetcode;
pBuf = pImage->pImgbuf; /* copy possible palette & cheap transparency */
pBufzero = ((mng_imagep)pData->pObjzero)->pImgbuf;
pBufzero->bHasPLTE = pBuf->bHasPLTE;
pBufzero->bHasTRNS = pBuf->bHasTRNS;
if (pBufzero->bHasPLTE) /* copy palette ? */
{
mng_uint32 iX;
pBufzero->iPLTEcount = pBuf->iPLTEcount;
for (iX = 0; iX < pBuf->iPLTEcount; iX++)
{
pBufzero->aPLTEentries [iX].iRed = pBuf->aPLTEentries [iX].iRed;
pBufzero->aPLTEentries [iX].iGreen = pBuf->aPLTEentries [iX].iGreen;
pBufzero->aPLTEentries [iX].iBlue = pBuf->aPLTEentries [iX].iBlue;
}
}
if (pBufzero->bHasTRNS) /* copy cheap transparency ? */
{
pBufzero->iTRNSgray = pBuf->iTRNSgray;
pBufzero->iTRNSred = pBuf->iTRNSred;
pBufzero->iTRNSgreen = pBuf->iTRNSgreen;
pBufzero->iTRNSblue = pBuf->iTRNSblue;
pBufzero->iTRNScount = pBuf->iTRNScount;
MNG_COPY (pBufzero->aTRNSentries, pBuf->aTRNSentries,
sizeof (pBufzero->aTRNSentries));
}
/* process immediately if bitdepth & colortype are equal */
pData->bDeltaimmediate =
(mng_bool)((pData->bDisplaying) && (!pData->bSkipping) &&
((pData->bRunning) || (pData->bSearching)) &&
(pData->iBitdepth == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iBitdepth ) &&
(pData->iColortype == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iColortype) );
}
#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT
pData->fInitrowproc = (mng_fptr)mng_init_rowproc;
pData->ePng_imgtype = mng_png_imgtype (pData->iColortype, pData->iBitdepth);
#else
switch (pData->iColortype) /* determine row initialization routine */
{
case 0 : { /* gray */
switch (pData->iBitdepth)
{
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case 1 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_g1_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_g1_i;
break;
}
case 2 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_g2_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_g2_i;
break;
}
case 4 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_g4_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_g4_i;
break;
}
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case 8 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_g8_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_g8_i;
break;
}
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_g16_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_g16_i;
break;
}
#endif
}
break;
}
case 2 : { /* rgb */
switch (pData->iBitdepth)
{
case 8 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_rgb8_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_rgb8_i;
break;
}
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_rgb16_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_rgb16_i;
break;
}
#endif
}
break;
}
case 3 : { /* indexed */
switch (pData->iBitdepth)
{
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case 1 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_idx1_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_idx1_i;
break;
}
case 2 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_idx2_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_idx2_i;
break;
}
case 4 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_idx4_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_idx4_i;
break;
}
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case 8 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_idx8_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_idx8_i;
break;
}
}
break;
}
case 4 : { /* gray+alpha */
switch (pData->iBitdepth)
{
case 8 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_ga8_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_ga8_i;
break;
}
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_ga16_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_ga16_i;
break;
}
#endif
}
break;
}
case 6 : { /* rgb+alpha */
switch (pData->iBitdepth)
{
case 8 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_rgba8_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_rgba8_i;
break;
}
#ifndef MNG_NO_16BIT_SUPPORT
case 16 : {
if (!pData->iInterlace)
pData->fInitrowproc = (mng_fptr)mng_init_rgba16_ni;
else
pData->fInitrowproc = (mng_fptr)mng_init_rgba16_i;
break;
}
#endif
}
break;
}
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */
}
else
MNG_ERROR (pData, MNG_OBJNOTCONCRETE);
}
else
MNG_ERROR (pData, MNG_OBJECTUNKNOWN);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DHDR, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
mng_retcode mng_process_display_prom (mng_datap pData,
mng_uint8 iBitdepth,
mng_uint8 iColortype,
mng_uint8 iFilltype)
#else
mng_retcode mng_process_display_prom (mng_datap pData)
#endif
{
mng_imagep pImage;
mng_imagedatap pBuf;
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PROM, MNG_LC_START);
#endif
if (!pData->pDeltaImage) /* gotta have this now! */
MNG_ERROR (pData, MNG_INVALIDDELTA);
pImage = (mng_imagep)pData->pDeltaImage;
pBuf = pImage->pImgbuf;
/* can't demote bitdepth! */
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
if (iBitdepth < pBuf->iBitdepth)
MNG_ERROR (pData, MNG_INVALIDBITDEPTH);
if ( ((pBuf->iColortype == MNG_COLORTYPE_GRAY ) &&
(iColortype != MNG_COLORTYPE_GRAY ) &&
(iColortype != MNG_COLORTYPE_GRAYA ) &&
(iColortype != MNG_COLORTYPE_RGB ) &&
(iColortype != MNG_COLORTYPE_RGBA ) ) ||
((pBuf->iColortype == MNG_COLORTYPE_GRAYA ) &&
(iColortype != MNG_COLORTYPE_GRAYA ) &&
(iColortype != MNG_COLORTYPE_RGBA ) ) ||
((pBuf->iColortype == MNG_COLORTYPE_RGB ) &&
(iColortype != MNG_COLORTYPE_RGB ) &&
(iColortype != MNG_COLORTYPE_RGBA ) ) ||
((pBuf->iColortype == MNG_COLORTYPE_RGBA ) &&
(iColortype != MNG_COLORTYPE_RGBA ) ) ||
#ifdef MNG_INCLUDE_JNG
((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY ) &&
(iColortype != MNG_COLORTYPE_JPEGGRAY ) &&
(iColortype != MNG_COLORTYPE_JPEGCOLOR ) &&
(iColortype != MNG_COLORTYPE_JPEGGRAYA ) &&
(iColortype != MNG_COLORTYPE_JPEGCOLORA) ) ||
((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLOR ) &&
(iColortype != MNG_COLORTYPE_JPEGCOLOR ) &&
(iColortype != MNG_COLORTYPE_JPEGCOLORA) ) ||
((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAYA ) &&
(iColortype != MNG_COLORTYPE_JPEGGRAYA ) &&
(iColortype != MNG_COLORTYPE_JPEGCOLORA) ) ||
((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLORA) &&
(iColortype != MNG_COLORTYPE_JPEGCOLORA) ) ||
#endif
((pBuf->iColortype == MNG_COLORTYPE_INDEXED ) &&
(iColortype != MNG_COLORTYPE_INDEXED ) &&
(iColortype != MNG_COLORTYPE_RGB ) &&
(iColortype != MNG_COLORTYPE_RGBA ) ) )
MNG_ERROR (pData, MNG_INVALIDCOLORTYPE);
iRetcode = mng_promote_imageobject (pData, pImage, iBitdepth, iColortype, iFilltype);
#else
if (pData->iPROMbitdepth < pBuf->iBitdepth)
MNG_ERROR (pData, MNG_INVALIDBITDEPTH);
if ( ((pBuf->iColortype == MNG_COLORTYPE_GRAY ) &&
(pData->iPROMcolortype != MNG_COLORTYPE_GRAY ) &&
(pData->iPROMcolortype != MNG_COLORTYPE_GRAYA ) &&
(pData->iPROMcolortype != MNG_COLORTYPE_RGB ) &&
(pData->iPROMcolortype != MNG_COLORTYPE_RGBA ) ) ||
((pBuf->iColortype == MNG_COLORTYPE_GRAYA ) &&
(pData->iPROMcolortype != MNG_COLORTYPE_GRAYA ) &&
(pData->iPROMcolortype != MNG_COLORTYPE_RGBA ) ) ||
((pBuf->iColortype == MNG_COLORTYPE_RGB ) &&
(pData->iPROMcolortype != MNG_COLORTYPE_RGB ) &&
(pData->iPROMcolortype != MNG_COLORTYPE_RGBA ) ) ||
((pBuf->iColortype == MNG_COLORTYPE_RGBA ) &&
(pData->iPROMcolortype != MNG_COLORTYPE_RGBA ) ) ||
#ifdef MNG_INCLUDE_JNG
((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY ) &&
(pData->iPROMcolortype != MNG_COLORTYPE_JPEGGRAY ) &&
(pData->iPROMcolortype != MNG_COLORTYPE_JPEGCOLOR ) &&
(pData->iPROMcolortype != MNG_COLORTYPE_JPEGGRAYA ) &&
(pData->iPROMcolortype != MNG_COLORTYPE_JPEGCOLORA) ) ||
((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLOR ) &&
(pData->iPROMcolortype != MNG_COLORTYPE_JPEGCOLOR ) &&
(pData->iPROMcolortype != MNG_COLORTYPE_JPEGCOLORA) ) ||
((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAYA ) &&
(pData->iPROMcolortype != MNG_COLORTYPE_JPEGGRAYA ) &&
(pData->iPROMcolortype != MNG_COLORTYPE_JPEGCOLORA) ) ||
((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLORA) &&
(pData->iPROMcolortype != MNG_COLORTYPE_JPEGCOLORA) ) ||
#endif
((pBuf->iColortype == MNG_COLORTYPE_INDEXED ) &&
(pData->iPROMcolortype != MNG_COLORTYPE_INDEXED ) &&
(pData->iPROMcolortype != MNG_COLORTYPE_RGB ) &&
(pData->iPROMcolortype != MNG_COLORTYPE_RGBA ) ) )
MNG_ERROR (pData, MNG_INVALIDCOLORTYPE);
iRetcode = mng_promote_imageobject (pData, pImage, pData->iPROMbitdepth,
pData->iPROMcolortype, pData->iPROMfilltype);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PROM, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
mng_retcode mng_process_display_ipng (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IPNG, MNG_LC_START);
#endif
/* indicate it for what it is now */
pData->iDeltaImagetype = MNG_IMAGETYPE_PNG;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IPNG, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
#ifdef MNG_INCLUDE_JNG
mng_retcode mng_process_display_ijng (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IJNG, MNG_LC_START);
#endif
/* indicate it for what it is now */
pData->iDeltaImagetype = MNG_IMAGETYPE_JNG;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IJNG, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
mng_retcode mng_process_display_pplt (mng_datap pData,
mng_uint8 iType,
mng_uint32 iCount,
mng_palette8ep paIndexentries,
mng_uint8p paAlphaentries,
mng_uint8p paUsedentries)
#else
mng_retcode mng_process_display_pplt (mng_datap pData)
#endif
{
mng_uint32 iX;
mng_imagep pImage = (mng_imagep)pData->pObjzero;
mng_imagedatap pBuf = pImage->pImgbuf;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PPLT, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
iX = iCount;
#else
iX = pData->iPPLTcount;
#endif
#endif
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
switch (iType)
#else
switch (pData->iPPLTtype)
#endif
{
case MNG_DELTATYPE_REPLACERGB :
{
#ifdef MNG_DECREMENT_LOOPS
for (; iX > 0;iX--)
#else
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
for (iX = 0; iX < iCount; iX++)
#else
for (iX = 0; iX < pData->iPPLTcount; iX++)
#endif
#endif
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
if (paUsedentries [iX])
{
pBuf->aPLTEentries [iX].iRed = paIndexentries [iX].iRed;
pBuf->aPLTEentries [iX].iGreen = paIndexentries [iX].iGreen;
pBuf->aPLTEentries [iX].iBlue = paIndexentries [iX].iBlue;
}
#else
if (pData->paPPLTusedentries [iX])
{
pBuf->aPLTEentries [iX].iRed = pData->paPPLTindexentries [iX].iRed;
pBuf->aPLTEentries [iX].iGreen = pData->paPPLTindexentries [iX].iGreen;
pBuf->aPLTEentries [iX].iBlue = pData->paPPLTindexentries [iX].iBlue;
}
#endif
}
break;
}
case MNG_DELTATYPE_DELTARGB :
{
#ifdef MNG_DECREMENT_LOOPS
for (; iX > 0;iX--)
#else
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
for (iX = 0; iX < iCount; iX++)
#else
for (iX = 0; iX < pData->iPPLTcount; iX++)
#endif
#endif
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
if (paUsedentries [iX])
{
pBuf->aPLTEentries [iX].iRed =
(mng_uint8)(pBuf->aPLTEentries [iX].iRed +
paIndexentries [iX].iRed );
pBuf->aPLTEentries [iX].iGreen =
(mng_uint8)(pBuf->aPLTEentries [iX].iGreen +
paIndexentries [iX].iGreen);
pBuf->aPLTEentries [iX].iBlue =
(mng_uint8)(pBuf->aPLTEentries [iX].iBlue +
paIndexentries [iX].iBlue );
}
#else
if (pData->paPPLTusedentries [iX])
{
pBuf->aPLTEentries [iX].iRed =
(mng_uint8)(pBuf->aPLTEentries [iX].iRed +
pData->paPPLTindexentries [iX].iRed );
pBuf->aPLTEentries [iX].iGreen =
(mng_uint8)(pBuf->aPLTEentries [iX].iGreen +
pData->paPPLTindexentries [iX].iGreen);
pBuf->aPLTEentries [iX].iBlue =
(mng_uint8)(pBuf->aPLTEentries [iX].iBlue +
pData->paPPLTindexentries [iX].iBlue );
}
#endif
}
break;
}
case MNG_DELTATYPE_REPLACEALPHA :
{
#ifdef MNG_DECREMENT_LOOPS
for (; iX > 0;iX--)
#else
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
for (iX = 0; iX < iCount; iX++)
#else
for (iX = 0; iX < pData->iPPLTcount; iX++)
#endif
#endif
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
if (paUsedentries [iX])
pBuf->aTRNSentries [iX] = paAlphaentries [iX];
}
#else
if (pData->paPPLTusedentries [iX])
pBuf->aTRNSentries [iX] = pData->paPPLTalphaentries [iX];
}
#endif
break;
}
case MNG_DELTATYPE_DELTAALPHA :
{
#ifdef MNG_DECREMENT_LOOPS
for (; iX > 0;iX--)
#else
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
for (iX = 0; iX < iCount; iX++)
#else
for (iX = 0; iX < pData->iPPLTcount; iX++)
#endif
#endif
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
if (paUsedentries [iX])
pBuf->aTRNSentries [iX] =
(mng_uint8)(pBuf->aTRNSentries [iX] +
paAlphaentries [iX]);
#else
if (pData->paPPLTusedentries [iX])
pBuf->aTRNSentries [iX] =
(mng_uint8)(pBuf->aTRNSentries [iX] +
pData->paPPLTalphaentries [iX]);
#endif
}
break;
}
case MNG_DELTATYPE_REPLACERGBA :
{
#ifdef MNG_DECREMENT_LOOPS
for (; iX > 0;iX--)
#else
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
for (iX = 0; iX < iCount; iX++)
#else
for (iX = 0; iX < pData->iPPLTcount; iX++)
#endif
#endif
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
if (paUsedentries [iX])
{
pBuf->aPLTEentries [iX].iRed = paIndexentries [iX].iRed;
pBuf->aPLTEentries [iX].iGreen = paIndexentries [iX].iGreen;
pBuf->aPLTEentries [iX].iBlue = paIndexentries [iX].iBlue;
pBuf->aTRNSentries [iX] = paAlphaentries [iX];
}
#else
if (pData->paPPLTusedentries [iX])
{
pBuf->aPLTEentries [iX].iRed = pData->paPPLTindexentries [iX].iRed;
pBuf->aPLTEentries [iX].iGreen = pData->paPPLTindexentries [iX].iGreen;
pBuf->aPLTEentries [iX].iBlue = pData->paPPLTindexentries [iX].iBlue;
pBuf->aTRNSentries [iX] = pData->paPPLTalphaentries [iX];
}
#endif
}
break;
}
case MNG_DELTATYPE_DELTARGBA :
{
#ifdef MNG_DECREMENT_LOOPS
for (; iX > 0;iX--)
#else
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
for (iX = 0; iX < iCount; iX++)
#else
for (iX = 0; iX < pData->iPPLTcount; iX++)
#endif
#endif
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
if (paUsedentries [iX])
{
pBuf->aPLTEentries [iX].iRed =
(mng_uint8)(pBuf->aPLTEentries [iX].iRed +
paIndexentries [iX].iRed );
pBuf->aPLTEentries [iX].iGreen =
(mng_uint8)(pBuf->aPLTEentries [iX].iGreen +
paIndexentries [iX].iGreen);
pBuf->aPLTEentries [iX].iBlue =
(mng_uint8)(pBuf->aPLTEentries [iX].iBlue +
paIndexentries [iX].iBlue );
pBuf->aTRNSentries [iX] =
(mng_uint8)(pBuf->aTRNSentries [iX] +
paAlphaentries [iX]);
}
#else
if (pData->paPPLTusedentries [iX])
{
pBuf->aPLTEentries [iX].iRed =
(mng_uint8)(pBuf->aPLTEentries [iX].iRed +
pData->paPPLTindexentries [iX].iRed );
pBuf->aPLTEentries [iX].iGreen =
(mng_uint8)(pBuf->aPLTEentries [iX].iGreen +
pData->paPPLTindexentries [iX].iGreen);
pBuf->aPLTEentries [iX].iBlue =
(mng_uint8)(pBuf->aPLTEentries [iX].iBlue +
pData->paPPLTindexentries [iX].iBlue );
pBuf->aTRNSentries [iX] =
(mng_uint8)(pBuf->aTRNSentries [iX] +
pData->paPPLTalphaentries [iX]);
}
#endif
}
break;
}
}
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
if ((iType != MNG_DELTATYPE_REPLACERGB) && (iType != MNG_DELTATYPE_DELTARGB))
#else
if ((pData->iPPLTtype != MNG_DELTATYPE_REPLACERGB) &&
(pData->iPPLTtype != MNG_DELTATYPE_DELTARGB ) )
#endif
{
if (pBuf->bHasTRNS)
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
if (iCount > pBuf->iTRNScount)
pBuf->iTRNScount = iCount;
#else
if (pData->iPPLTcount > pBuf->iTRNScount)
pBuf->iTRNScount = pData->iPPLTcount;
#endif
}
else
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
pBuf->iTRNScount = iCount;
pBuf->bHasTRNS = MNG_TRUE;
#else
pBuf->iTRNScount = pData->iPPLTcount;
pBuf->bHasTRNS = MNG_TRUE;
#endif
}
}
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
if ((iType != MNG_DELTATYPE_REPLACEALPHA) && (iType != MNG_DELTATYPE_DELTAALPHA))
#else
if ((pData->iPPLTtype != MNG_DELTATYPE_REPLACEALPHA) &&
(pData->iPPLTtype != MNG_DELTATYPE_DELTAALPHA ) )
#endif
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
if (iCount > pBuf->iPLTEcount)
pBuf->iPLTEcount = iCount;
#else
if (pData->iPPLTcount > pBuf->iPLTEcount)
pBuf->iPLTEcount = pData->iPPLTcount;
#endif
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PPLT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_MAGN
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
mng_retcode mng_process_display_magn (mng_datap pData,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint8 iMethodX,
mng_uint16 iMX,
mng_uint16 iMY,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint16 iMT,
mng_uint16 iMB,
mng_uint8 iMethodY)
#else
mng_retcode mng_process_display_magn (mng_datap pData)
#endif
{
mng_uint16 iX;
mng_imagep pImage;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MAGN, MNG_LC_START);
#endif
/* iterate the object-ids */
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
for (iX = iFirstid; iX <= iLastid; iX++)
#else
for (iX = pData->iMAGNfirstid; iX <= pData->iMAGNlastid; iX++)
#endif
{
if (iX == 0) /* process object 0 ? */
{
pImage = (mng_imagep)pData->pObjzero;
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
pImage->iMAGN_MethodX = iMethodX;
pImage->iMAGN_MethodY = iMethodY;
pImage->iMAGN_MX = iMX;
pImage->iMAGN_MY = iMY;
pImage->iMAGN_ML = iML;
pImage->iMAGN_MR = iMR;
pImage->iMAGN_MT = iMT;
pImage->iMAGN_MB = iMB;
#else
pImage->iMAGN_MethodX = pData->iMAGNmethodX;
pImage->iMAGN_MethodY = pData->iMAGNmethodY;
pImage->iMAGN_MX = pData->iMAGNmX;
pImage->iMAGN_MY = pData->iMAGNmY;
pImage->iMAGN_ML = pData->iMAGNmL;
pImage->iMAGN_MR = pData->iMAGNmR;
pImage->iMAGN_MT = pData->iMAGNmT;
pImage->iMAGN_MB = pData->iMAGNmB;
#endif
}
else
{
pImage = mng_find_imageobject (pData, iX);
/* object exists & is not frozen ? */
if ((pImage) && (!pImage->bFrozen))
{ /* previous magnification to be done ? */
if ((pImage->iMAGN_MethodX) || (pImage->iMAGN_MethodY))
{
mng_retcode iRetcode = mng_magnify_imageobject (pData, pImage);
if (iRetcode) /* on error bail out */
return iRetcode;
}
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
pImage->iMAGN_MethodX = iMethodX;
pImage->iMAGN_MethodY = iMethodY;
pImage->iMAGN_MX = iMX;
pImage->iMAGN_MY = iMY;
pImage->iMAGN_ML = iML;
pImage->iMAGN_MR = iMR;
pImage->iMAGN_MT = iMT;
pImage->iMAGN_MB = iMB;
#else
pImage->iMAGN_MethodX = pData->iMAGNmethodX;
pImage->iMAGN_MethodY = pData->iMAGNmethodY;
pImage->iMAGN_MX = pData->iMAGNmX;
pImage->iMAGN_MY = pData->iMAGNmY;
pImage->iMAGN_ML = pData->iMAGNmL;
pImage->iMAGN_MR = pData->iMAGNmR;
pImage->iMAGN_MT = pData->iMAGNmT;
pImage->iMAGN_MB = pData->iMAGNmB;
#endif
}
}
}
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
pData->iMAGNfromid = iFirstid;
pData->iMAGNtoid = iLastid;
iX = iFirstid;
#else
pData->iMAGNfromid = pData->iMAGNfirstid;
pData->iMAGNtoid = pData->iMAGNlastid;
iX = pData->iMAGNfirstid;
#endif
/* iterate again for showing */
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
while ((iX <= iLastid) && (!pData->bTimerset))
#else
while ((iX <= pData->iMAGNlastid) && (!pData->bTimerset))
#endif
{
pData->iMAGNcurrentid = iX;
if (iX) /* only real objects ! */
{
pImage = mng_find_imageobject (pData, iX);
/* object exists & is not frozen &
is visible & is viewable ? */
if ((pImage) && (!pImage->bFrozen) &&
(pImage->bVisible) && (pImage->bViewable))
{
mng_retcode iRetcode = mng_display_image (pData, pImage, MNG_FALSE);
if (iRetcode)
return iRetcode;
}
}
iX++;
}
if (pData->bTimerset) /* broken ? */
pData->iBreakpoint = 9;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MAGN, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_process_display_magn2 (mng_datap pData)
{
mng_uint16 iX;
mng_imagep pImage;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MAGN, MNG_LC_START);
#endif
iX = pData->iMAGNcurrentid;
/* iterate again for showing */
while ((iX <= pData->iMAGNtoid) && (!pData->bTimerset))
{
pData->iMAGNcurrentid = iX;
if (iX) /* only real objects ! */
{
pImage = mng_find_imageobject (pData, iX);
/* object exists & is not frozen &
is visible & is viewable ? */
if ((pImage) && (!pImage->bFrozen) &&
(pImage->bVisible) && (pImage->bViewable))
{
mng_retcode iRetcode = mng_display_image (pData, pImage, MNG_FALSE);
if (iRetcode)
return iRetcode;
}
}
iX++;
}
if (pData->bTimerset) /* broken ? */
pData->iBreakpoint = 9;
else
pData->iBreakpoint = 0; /* not again ! */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MAGN, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_PAST
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
mng_retcode mng_process_display_past (mng_datap pData,
mng_uint16 iTargetid,
mng_uint8 iTargettype,
mng_int32 iTargetx,
mng_int32 iTargety,
mng_uint32 iCount,
mng_ptr pSources)
#else
mng_retcode mng_process_display_past (mng_datap pData)
#endif
{
mng_retcode iRetcode = MNG_NOERROR;
mng_imagep pTargetimg;
mng_imagep pSourceimg;
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
mng_past_sourcep pSource = (mng_past_sourcep)pSources;
#else
mng_past_sourcep pSource = (mng_past_sourcep)pData->pPASTsources;
#endif
mng_uint32 iX = 0;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PAST, MNG_LC_START);
#endif
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
if (iTargetid) /* a real destination object ? */
#else
if (pData->iPASTtargetid) /* a real destination object ? */
#endif
{ /* let's find it then */
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
pTargetimg = (mng_imagep)mng_find_imageobject (pData, iTargetid);
#else
pTargetimg = (mng_imagep)mng_find_imageobject (pData, pData->iPASTtargetid);
#endif
if (!pTargetimg) /* if it doesn't exists; do a barf */
MNG_ERROR (pData, MNG_OBJECTUNKNOWN);
/* it's gotta be abstract !!! */
if (pTargetimg->pImgbuf->bConcrete)
MNG_ERROR (pData, MNG_OBJNOTABSTRACT);
/* we want 32-/64-bit RGBA to play with ! */
if ((pTargetimg->pImgbuf->iBitdepth <= MNG_BITDEPTH_8) ||
(pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_GRAY) ||
(pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_RGB) ||
(pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_INDEXED) ||
(pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_GRAYA) )
iRetcode = mng_promote_imageobject (pData, pTargetimg, MNG_BITDEPTH_8,
MNG_COLORTYPE_RGBA,
MNG_FILLMETHOD_LEFTBITREPLICATE);
else
if ((pTargetimg->pImgbuf->iBitdepth > MNG_BITDEPTH_8) &&
((pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_GRAY) ||
(pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_RGB) ||
(pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_GRAYA) ) )
iRetcode = mng_promote_imageobject (pData, pTargetimg, MNG_BITDEPTH_16,
MNG_COLORTYPE_RGBA,
MNG_FILLMETHOD_LEFTBITREPLICATE);
#ifdef MNG_INCLUDE_JNG
else
if ((pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_JPEGGRAY) ||
(pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_JPEGCOLOR) ||
(pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_JPEGGRAYA) )
iRetcode = mng_promote_imageobject (pData, pTargetimg,
pTargetimg->pImgbuf->iBitdepth,
MNG_COLORTYPE_JPEGCOLORA,
MNG_FILLMETHOD_LEFTBITREPLICATE);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* make it really abstract ? */
if (!pTargetimg->pImgbuf->bCorrected)
{
iRetcode = mng_colorcorrect_object (pData, pTargetimg);
if (iRetcode) /* on error bail out */
return iRetcode;
}
}
else
{ /* pasting into object 0 !!! */
pTargetimg = (mng_imagep)pData->pObjzero;
/* is it usable ??? */
if ((pTargetimg->bClipped) &&
(pTargetimg->iClipr > pTargetimg->iPosx) &&
(pTargetimg->iClipb > pTargetimg->iPosy))
{
/* make it 32-bit RGBA please !!! */
iRetcode = mng_reset_object_details (pData, pTargetimg,
pTargetimg->iClipr - pTargetimg->iPosx,
pTargetimg->iClipb - pTargetimg->iPosy,
MNG_BITDEPTH_8, MNG_COLORTYPE_RGBA,
0, 0, 0, MNG_FALSE);
if (iRetcode) /* on error bail out */
return iRetcode;
}
else
pTargetimg = MNG_NULL; /* clipped beyond visibility ! */
}
if (pTargetimg) /* usable destination ? */
{
mng_int32 iSourceY;
mng_int32 iSourceYinc;
mng_int32 iSourcerowsize;
mng_int32 iSourcesamples;
mng_bool bSourceRGBA16;
mng_int32 iTargetY;
mng_int32 iTargetrowsize;
mng_int32 iTargetsamples;
mng_bool bTargetRGBA16 = MNG_FALSE;
mng_int32 iTemprowsize;
mng_imagedatap pBuf;
#ifndef MNG_SKIPCHUNK_MAGN
/* needs magnification ? */
if ((pTargetimg->iMAGN_MethodX) || (pTargetimg->iMAGN_MethodY))
iRetcode = mng_magnify_imageobject (pData, pTargetimg);
#endif
if (!iRetcode) /* still ok ? */
{
bTargetRGBA16 = (mng_bool)(pTargetimg->pImgbuf->iBitdepth > 8);
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
switch (iTargettype) /* determine target x/y */
#else
switch (pData->iPASTtargettype) /* determine target x/y */
#endif
{
case 0 : {
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
pData->iPastx = iTargetx;
pData->iPasty = iTargety;
#else
pData->iPastx = pData->iPASTtargetx;
pData->iPasty = pData->iPASTtargety;
#endif
break;
}
case 1 : {
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
pData->iPastx = pTargetimg->iPastx + iTargetx;
pData->iPasty = pTargetimg->iPasty + iTargety;
#else
pData->iPastx = pTargetimg->iPastx + pData->iPASTtargetx;
pData->iPasty = pTargetimg->iPasty + pData->iPASTtargety;
#endif
break;
}
case 2 : {
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
pData->iPastx += iTargetx;
pData->iPasty += iTargety;
#else
pData->iPastx += pData->iPASTtargetx;
pData->iPasty += pData->iPASTtargety;
#endif
break;
}
}
/* save for next time ... */
pTargetimg->iPastx = pData->iPastx;
pTargetimg->iPasty = pData->iPasty;
/* address destination for row-routines */
pData->pStoreobj = (mng_objectp)pTargetimg;
pData->pStorebuf = (mng_objectp)pTargetimg->pImgbuf;
}
/* process the sources one by one */
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
while ((!iRetcode) && (iX < iCount))
#else
while ((!iRetcode) && (iX < pData->iPASTcount))
#endif
{ /* find the little bastards first */
pSourceimg = (mng_imagep)mng_find_imageobject (pData, pSource->iSourceid);
/* exists and viewable? */
if ((pSourceimg) && (pSourceimg->bViewable))
{ /* needs magnification ? */
#ifndef MNG_SKIPCHUNK_MAGN
if ((pSourceimg->iMAGN_MethodX) || (pSourceimg->iMAGN_MethodY))
iRetcode = mng_magnify_imageobject (pData, pSourceimg);
#endif
if (!iRetcode) /* still ok ? */
{
pBuf = (mng_imagedatap)pSourceimg->pImgbuf;
/* address source for row-routines */
pData->pRetrieveobj = (mng_objectp)pSourceimg;
pData->iPass = -1; /* init row-processing variables */
pData->iRowinc = 1;
pData->iColinc = 1;
pData->iPixelofs = 0;
iSourcesamples = (mng_int32)pBuf->iWidth;
iSourcerowsize = pBuf->iRowsize;
bSourceRGBA16 = (mng_bool)(pBuf->iBitdepth > 8);
/* make sure the delta-routines do the right thing */
pData->iDeltatype = MNG_DELTATYPE_BLOCKPIXELREPLACE;
switch (pBuf->iColortype)
{
case 0 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (bSourceRGBA16)
pData->fRetrieverow = (mng_fptr)mng_retrieve_g16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_g8;
pData->bIsOpaque = (mng_bool)(!pBuf->bHasTRNS);
break;
}
case 2 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (bSourceRGBA16)
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8;
pData->bIsOpaque = (mng_bool)(!pBuf->bHasTRNS);
break;
}
case 3 : { pData->fRetrieverow = (mng_fptr)mng_retrieve_idx8;
pData->bIsOpaque = (mng_bool)(!pBuf->bHasTRNS);
break;
}
case 4 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (bSourceRGBA16)
pData->fRetrieverow = (mng_fptr)mng_retrieve_ga16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8;
pData->bIsOpaque = MNG_FALSE;
break;
}
case 6 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (bSourceRGBA16)
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8;
pData->bIsOpaque = MNG_FALSE;
break;
}
case 8 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (bSourceRGBA16)
pData->fRetrieverow = (mng_fptr)mng_retrieve_g16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_g8;
pData->bIsOpaque = MNG_TRUE;
break;
}
case 10 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (bSourceRGBA16)
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8;
pData->bIsOpaque = MNG_TRUE;
break;
}
case 12 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (bSourceRGBA16)
pData->fRetrieverow = (mng_fptr)mng_retrieve_ga16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8;
pData->bIsOpaque = MNG_FALSE;
break;
}
case 14 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (bSourceRGBA16)
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16;
else
#endif
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8;
pData->bIsOpaque = MNG_FALSE;
break;
}
}
/* determine scaling */
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_NO_DELTA_PNG
if ((!bSourceRGBA16) && (bTargetRGBA16))
pData->fScalerow = (mng_fptr)mng_scale_rgba8_rgba16;
else
if ((bSourceRGBA16) && (!bTargetRGBA16))
pData->fScalerow = (mng_fptr)mng_scale_rgba16_rgba8;
else
#endif
#endif
pData->fScalerow = MNG_NULL;
/* default no color-correction */
pData->fCorrectrow = MNG_NULL;
#if defined(MNG_FULL_CMS) /* determine color-management routine */
iRetcode = mng_init_full_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE);
#elif defined(MNG_GAMMA_ONLY)
iRetcode = mng_init_gamma_only (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE);
#elif defined(MNG_APP_CMS)
iRetcode = mng_init_app_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE);
#endif
}
if (!iRetcode) /* still ok ? */
{
pData->fFliprow = MNG_NULL; /* no flipping or tiling by default */
pData->fTilerow = MNG_NULL;
/* but perhaps we do have to ... */
switch (pSource->iOrientation)
{
case 2 : ;
case 4 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (bTargetRGBA16)
pData->fFliprow = (mng_fptr)mng_flip_rgba16;
else
#endif
pData->fFliprow = (mng_fptr)mng_flip_rgba8;
break;
}
case 8 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (bTargetRGBA16)
pData->fTilerow = (mng_fptr)mng_tile_rgba16;
else
#endif
pData->fTilerow = (mng_fptr)mng_tile_rgba8;
break;
}
}
/* determine composition routine */
/* note that we're abusing the delta-routine setup !!! */
switch (pSource->iComposition)
{
case 0 : { /* composite over */
#ifndef MNG_NO_16BIT_SUPPORT
if (bTargetRGBA16)
pData->fDeltarow = (mng_fptr)mng_composeover_rgba16;
else
#endif
pData->fDeltarow = (mng_fptr)mng_composeover_rgba8;
break;
}
case 1 : { /* replace */
#ifndef MNG_NO_16BIT_SUPPORT
if (bTargetRGBA16)
pData->fDeltarow = (mng_fptr)mng_delta_rgba16_rgba16;
else
#endif
pData->fDeltarow = (mng_fptr)mng_delta_rgba8_rgba8;
break;
}
case 2 : { /* composite under */
#ifndef MNG_NO_16BIT_SUPPORT
if (bTargetRGBA16)
pData->fDeltarow = (mng_fptr)mng_composeunder_rgba16;
else
#endif
pData->fDeltarow = (mng_fptr)mng_composeunder_rgba8;
break;
}
}
/* determine offsets & clipping */
if (pSource->iOffsettype == 1)
{
pData->iDestl = pData->iPastx + pSource->iOffsetx;
pData->iDestt = pData->iPasty + pSource->iOffsety;
}
else
{
pData->iDestl = pSource->iOffsetx;
pData->iDestt = pSource->iOffsety;
}
pData->iDestr = (mng_int32)pTargetimg->pImgbuf->iWidth;
pData->iDestb = (mng_int32)pTargetimg->pImgbuf->iHeight;
/* take the source dimension into account ? */
if (pSource->iOrientation != 8)
{
pData->iDestr = MIN_COORD (pData->iDestr, pData->iDestl + (mng_int32)pBuf->iWidth);
pData->iDestb = MIN_COORD (pData->iDestb, pData->iDestt + (mng_int32)pBuf->iHeight);
}
/* source clipping */
if (pSource->iBoundarytype == 1)
{
if (pData->iDestl < pData->iPastx + pSource->iBoundaryl)
pData->iSourcel = pData->iPastx + pSource->iBoundaryl - pData->iDestl;
else
pData->iSourcel = 0;
if (pData->iDestt < pData->iPasty + pSource->iBoundaryt)
pData->iSourcet = pData->iPasty + pSource->iBoundaryt - pData->iDestt;
else
pData->iSourcet = 0;
pData->iDestl = MAX_COORD (pData->iDestl, pData->iPastx + pSource->iBoundaryl);
pData->iDestt = MAX_COORD (pData->iDestt, pData->iPasty + pSource->iBoundaryt);
pData->iDestr = MIN_COORD (pData->iDestr, pData->iPastx + pSource->iBoundaryr);
pData->iDestb = MIN_COORD (pData->iDestb, pData->iPasty + pSource->iBoundaryb);
}
else
{
if (pData->iDestl < pSource->iBoundaryl)
pData->iSourcel = pSource->iBoundaryl - pData->iDestl;
else
pData->iSourcel = 0;
if (pData->iDestt < pSource->iBoundaryt)
pData->iSourcet = pSource->iBoundaryt - pData->iDestt;
else
pData->iSourcet = 0;
pData->iDestl = MAX_COORD (pData->iDestl, pSource->iBoundaryl);
pData->iDestt = MAX_COORD (pData->iDestt, pSource->iBoundaryt);
pData->iDestr = MIN_COORD (pData->iDestr, pSource->iBoundaryr);
pData->iDestb = MIN_COORD (pData->iDestb, pSource->iBoundaryb);
}
if (pData->iSourcel) /* indent source ? */
{
#ifndef MNG_NO_16BIT_SUPPORT
if (bTargetRGBA16) /* abuse tiling routine to shift source-pixels */
pData->fTilerow = (mng_fptr)mng_tile_rgba16;
else
#endif
pData->fTilerow = (mng_fptr)mng_tile_rgba8;
}
/* anything to display ? */
if ((pData->iDestl <= pData->iDestr) && (pData->iDestt <= pData->iDestb))
{ /* init variables for the loop */
if ((pSource->iOrientation == 2) || (pSource->iOrientation == 6))
{
iSourceY = (mng_int32)pBuf->iHeight - 1 - pData->iSourcet;
iSourceYinc = -1;
}
else
{
iSourceY = pData->iSourcet;
iSourceYinc = 1;
}
iTargetY = pData->iDestt;
pData->iCol = pData->iDestl;
iTargetsamples = pData->iDestr - pData->iDestl;
#ifndef MNG_NO_16BIT_SUPPORT
if (bTargetRGBA16)
iTargetrowsize = (iTargetsamples << 3);
else
#endif
iTargetrowsize = (iTargetsamples << 2);
/* get temporary work-buffers */
if (iSourcerowsize > iTargetrowsize)
iTemprowsize = iSourcerowsize << 1;
else
iTemprowsize = iTargetrowsize << 1;
MNG_ALLOC (pData, pData->pRGBArow, iTemprowsize);
MNG_ALLOC (pData, pData->pWorkrow, iTemprowsize);
while ((!iRetcode) && (iTargetY < pData->iDestb))
{ /* get a row */
pData->iRow = iSourceY;
pData->iRowsamples = iSourcesamples;
pData->iRowsize = iSourcerowsize;
pData->bIsRGBA16 = bSourceRGBA16;
iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData);
/* scale it (if necessary) */
if ((!iRetcode) && (pData->fScalerow))
iRetcode = ((mng_scalerow)pData->fScalerow) (pData);
pData->bIsRGBA16 = bTargetRGBA16;
/* color correction (if necessary) */
if ((!iRetcode) && (pData->fCorrectrow))
iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData);
/* flipping (if necessary) */
if ((!iRetcode) && (pData->fFliprow))
iRetcode = ((mng_fliprow)pData->fFliprow) (pData);
/* tiling (if necessary) */
if ((!iRetcode) && (pData->fTilerow))
iRetcode = ((mng_tilerow)pData->fTilerow) (pData);
if (!iRetcode) /* and paste..... */
{
pData->iRow = iTargetY;
pData->iRowsamples = iTargetsamples;
pData->iRowsize = iTargetrowsize;
iRetcode = ((mng_deltarow)pData->fDeltarow) (pData);
}
iSourceY += iSourceYinc; /* and next line */
if (iSourceY < 0)
iSourceY = (mng_int32)pBuf->iHeight - 1;
else
if (iSourceY >= (mng_int32)pBuf->iHeight)
iSourceY = 0;
iTargetY++;
}
/* drop the temporary row-buffer */
MNG_FREEX (pData, pData->pWorkrow, iTemprowsize);
MNG_FREEX (pData, pData->pRGBArow, iTemprowsize);
}
#if defined(MNG_FULL_CMS) /* cleanup cms stuff */
if (!iRetcode)
iRetcode = mng_clear_cms (pData);
#endif
}
pSource++; /* neeeeext */
iX++;
}
}
if (iRetcode) /* on error bail out */
return iRetcode;
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
if (!iTargetid) /* did we paste into object 0 ? */
#else
if (!pData->iPASTtargetid) /* did we paste into object 0 ? */
#endif
{ /* display it then ! */
iRetcode = mng_display_image (pData, pTargetimg, MNG_FALSE);
if (iRetcode) /* on error bail out */
return iRetcode;
}
else
{ /* target is visible & viewable ? */
if ((pTargetimg->bVisible) && (pTargetimg->bViewable))
{
iRetcode = mng_display_image (pData, pTargetimg, MNG_FALSE);
if (iRetcode)
return iRetcode;
}
}
}
if (pData->bTimerset) /* broken ? */
{
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
pData->iPASTid = iTargetid;
#else
pData->iPASTid = pData->iPASTtargetid;
#endif
pData->iBreakpoint = 11;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PAST, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_SKIPCHUNK_PAST */
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_PAST
mng_retcode mng_process_display_past2 (mng_datap pData)
{
mng_retcode iRetcode;
mng_imagep pTargetimg;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PAST, MNG_LC_START);
#endif
if (pData->iPASTid) /* a real destination object ? */
pTargetimg = (mng_imagep)mng_find_imageobject (pData, pData->iPASTid);
else /* otherwise object 0 */
pTargetimg = (mng_imagep)pData->pObjzero;
iRetcode = mng_display_image (pData, pTargetimg, MNG_FALSE);
if (iRetcode)
return iRetcode;
pData->iBreakpoint = 0; /* only once */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PAST, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_SKIPCHUNK_PAST */
/* ************************************************************************** */
#endif /* MNG_INCLUDE_DISPLAY_PROCS */
/* ************************************************************************** */
/* * end of file * */
/* ************************************************************************** */
libmng-2.0.3/libmng_jpeg.c 0000644 0001750 0001750 00000126671 12005307152 015311 0 ustar glennrp glennrp #include "config.h"
/* ************************************************************************** */
/* * For conditions of distribution and use, * */
/* * see copyright notice in libmng.h * */
/* ************************************************************************** */
/* * * */
/* * project : libmng * */
/* * file : libmng_jpeg.c copyright (c) 2000-2004 G.Juyn * */
/* * version : 1.0.9 * */
/* * * */
/* * purpose : JPEG library interface (implementation) * */
/* * * */
/* * author : G.Juyn * */
/* * * */
/* * comment : implementation of the JPEG library interface * */
/* * * */
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
/* * - changed strict-ANSI stuff * */
/* * * */
/* * 0.5.2 - 05/22/2000 - G.Juyn * */
/* * - implemented all the JNG routines * */
/* * * */
/* * 0.5.3 - 06/17/2000 - G.Juyn * */
/* * - added tracing of JPEG calls * */
/* * 0.5.3 - 06/24/2000 - G.Juyn * */
/* * - fixed inclusion of IJG read/write code * */
/* * 0.5.3 - 06/29/2000 - G.Juyn * */
/* * - fixed some 64-bit warnings * */
/* * * */
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 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!) * */
/* * * */
/* * 1.0.4 - 06/22/2002 - G.Juyn * */
/* * - B526138 - returned IJGSRC6B calling convention to * */
/* * default for MSVC * */
/* * * */
/* * 1.0.5 - 24/02/2003 - G.Juyn * */
/* * - B683152 - libjpeg suspension not always honored correctly* */
/* * * */
/* * 1.0.6 - 03/04/2003 - G.Juyn * */
/* * - fixed some compiler-warnings * */
/* * * */
/* * 1.0.8 - 08/01/2004 - G.Juyn * */
/* * - added support for 3+byte pixelsize for JPEG's * */
/* * * */
/* * 1.0.9 - 12/20/2004 - G.Juyn * */
/* * - cleaned up macro-invocations (thanks to D. Airlie) * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
#include "libmng_data.h"
#include "libmng_error.h"
#include "libmng_trace.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "libmng_memory.h"
#include "libmng_pixels.h"
#include "libmng_jpeg.h"
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
#pragma option -A /* force ANSI-C */
#endif
/* ************************************************************************** */
#if defined(MNG_INCLUDE_JNG) && defined(MNG_INCLUDE_DISPLAY_PROCS)
/* ************************************************************************** */
/* * * */
/* * Local IJG callback routines (source-manager, error-manager and such) * */
/* * * */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_IJG6B
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
#ifdef MNG_DEFINE_JPEG_STDCALL
void MNG_DECL mng_init_source (j_decompress_ptr cinfo)
#else
void mng_init_source (j_decompress_ptr cinfo)
#endif
{
return; /* nothing needed */
}
#endif /* MNG_INCLUDE_JNG_READ */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
#ifdef MNG_DEFINE_JPEG_STDCALL
boolean MNG_DECL mng_fill_input_buffer (j_decompress_ptr cinfo)
#else
boolean mng_fill_input_buffer (j_decompress_ptr cinfo)
#endif
{
return FALSE; /* force IJG routine to return to caller */
}
#endif /* MNG_INCLUDE_JNG_READ */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
#ifdef MNG_DEFINE_JPEG_STDCALL
void MNG_DECL mng_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
#else
void mng_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
#endif
{
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->pJPEGdinfo->src;
/* problem scenario ? */
if (pSrc->bytes_in_buffer < (size_t)num_bytes)
{ /* tell the boss we need to skip some data! */
pData->iJPEGtoskip = (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
#ifdef MNG_DEFINE_JPEG_STDCALL
void MNG_DECL mng_skip_input_data2 (j_decompress_ptr cinfo, long num_bytes)
#else
void mng_skip_input_data2 (j_decompress_ptr cinfo, long num_bytes)
#endif
{
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
#ifdef MNG_DEFINE_JPEG_STDCALL
void MNG_DECL mng_term_source (j_decompress_ptr cinfo)
#else
void mng_term_source (j_decompress_ptr cinfo)
#endif
{
return; /* nothing needed */
}
#endif /* MNG_INCLUDE_JNG_READ */
/* ************************************************************************** */
#ifdef MNG_USE_SETJMP
#ifdef MNG_DEFINE_JPEG_STDCALL
void MNG_DECL mng_error_exit (j_common_ptr cinfo)
#else
void mng_error_exit (j_common_ptr cinfo)
#endif
{ /* address my generic structure */
mng_datap pData = (mng_datap)cinfo->client_data;
#ifdef MNG_ERROR_TELLTALE /* fill the message text ??? */
(*cinfo->err->output_message) (cinfo);
#endif
/* return to the point of no return... */
longjmp (pData->sErrorbuf, cinfo->err->msg_code);
}
#endif /* MNG_USE_SETJMP */
/* ************************************************************************** */
#ifdef MNG_USE_SETJMP
#ifdef MNG_DEFINE_JPEG_STDCALL
void MNG_DECL mng_output_message (j_common_ptr cinfo)
#else
void mng_output_message (j_common_ptr cinfo)
#endif
{
return; /* just do nothing ! */
}
#endif /* MNG_USE_SETJMP */
/* ************************************************************************** */
#endif /* MNG_INCLUDE_IJG6B */
/* ************************************************************************** */
/* * * */
/* * Global JPEG routines * */
/* * * */
/* ************************************************************************** */
mng_retcode mngjpeg_initialize (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_INITIALIZE, MNG_LC_START);
#endif
/* allocate space for JPEG structures if necessary */
#ifdef MNG_INCLUDE_JNG_READ
if (pData->pJPEGderr == MNG_NULL)
MNG_ALLOC (pData, pData->pJPEGderr, sizeof (mngjpeg_error ));
if (pData->pJPEGdsrc == MNG_NULL)
MNG_ALLOC (pData, pData->pJPEGdsrc, sizeof (mngjpeg_source));
if (pData->pJPEGdinfo == MNG_NULL)
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
if (pData->pJPEGcerr == MNG_NULL)
MNG_ALLOC (pData, pData->pJPEGcerr, sizeof (mngjpeg_error ));
if (pData->pJPEGcinfo == MNG_NULL)
MNG_ALLOC (pData, pData->pJPEGcinfo, sizeof (mngjpeg_comp ));
/* enable reverse addressing */
pData->pJPEGcinfo->client_data = pData;
#endif
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;
pData->pJPEGrow = MNG_NULL;
pData->iJPEGrowlen = 0;
pData->iJPEGtoskip = 0;
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->bJPEGscanending = 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;
pData->iJPEGdisprow = 0;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_INITIALIZE, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mngjpeg_cleanup (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_CLEANUP, 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
#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
if (pData->bJPEGcompress) /* still compressing something ? */
jpeg_destroy_compress (pData->pJPEGcinfo);
#endif
#endif /* MNG_INCLUDE_IJG6B */
/* cleanup temporary buffers */
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));
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
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;
pData->bJPEGdecompress = MNG_FALSE;
pData->bJPEGhasheader = MNG_FALSE;
pData->bJPEGdecostarted = MNG_FALSE;
pData->bJPEGscanstarted = MNG_FALSE;
pData->bJPEGscanending = 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
return MNG_NOERROR;
}
/* ************************************************************************** */
/* * * */
/* * JPEG decompression routines (JDAT) * */
/* * * */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
mng_retcode mngjpeg_decompressinit (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->pJPEGdinfo->err = jpeg_std_error (pData->pJPEGderr);
#ifdef MNG_USE_SETJMP /* setup local JPEG error-routines */
pData->pJPEGderr->error_exit = mng_error_exit;
pData->pJPEGderr->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->pJPEGdinfo);
pData->bJPEGdecompress = 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->pJPEGdinfo->src = pData->pJPEGdsrc;
/* use the default handler */
pData->pJPEGdinfo->src->resync_to_restart = jpeg_resync_to_restart;
/* setup local source routine & parms */
pData->pJPEGdinfo->src->init_source = mng_init_source;
pData->pJPEGdinfo->src->fill_input_buffer = mng_fill_input_buffer;
pData->pJPEGdinfo->src->skip_input_data = mng_skip_input_data;
pData->pJPEGdinfo->src->term_source = mng_term_source;
pData->pJPEGdinfo->src->next_input_byte = pData->pJPEGcurrent;
pData->pJPEGdinfo->src->bytes_in_buffer = pData->iJPEGbufremain;
#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_decompressdata (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->iJPEGtoskip) /* JPEG-lib told us to skip some more data ? */
{
if (iRemain > pData->iJPEGtoskip) /* enough data in this buffer ? */
{
iRemain -= pData->iJPEGtoskip; /* skip enough to access the next byte */
pWork += pData->iJPEGtoskip;
pData->iJPEGtoskip = 0; /* no more to skip then */
}
else
{
pData->iJPEGtoskip -= iRemain; /* skip all data in the buffer */
iRemain = 0; /* and indicate this accordingly */
}
/* the skip set current-pointer to NULL ! */
pData->pJPEGcurrent = pData->pJPEGbuf;
}
while (iRemain) /* repeat until no more input-bytes */
{ /* need to shift anything ? */
if ((pData->pJPEGcurrent > pData->pJPEGbuf) &&
(pData->pJPEGcurrent - pData->pJPEGbuf + pData->iJPEGbufremain + iRemain > pData->iJPEGbufmax))
{
if (pData->iJPEGbufremain > 0) /* then do so */
MNG_COPY (pData->pJPEGbuf, pData->pJPEGcurrent, pData->iJPEGbufremain);
pData->pJPEGcurrent = pData->pJPEGbuf;
}
/* does the remaining input fit into the buffer ? */
if (pData->iJPEGbufremain + iRemain <= pData->iJPEGbufmax)
{ /* move the lot */
MNG_COPY ((pData->pJPEGcurrent + pData->iJPEGbufremain), pWork, iRemain);
pData->iJPEGbufremain += iRemain;/* adjust remaining_bytes counter */
iRemain = 0; /* and indicate there's no input left */
}
else
{ /* calculate what does fit */
mng_uint32 iFits = pData->iJPEGbufmax - pData->iJPEGbufremain;
if (iFits <= 0) /* no space is just bugger 'm all */
MNG_ERROR (pData, MNG_JPEGBUFTOOSMALL);
/* move that */
MNG_COPY ((pData->pJPEGcurrent + pData->iJPEGbufremain), pWork, iFits);
pData->iJPEGbufremain += iFits; /* adjust remain_bytes counter */
iRemain -= iFits; /* and the input-parms */
pWork += iFits;
}
#ifdef MNG_INCLUDE_IJG6B
pData->pJPEGdinfo->src->next_input_byte = pData->pJPEGcurrent;
pData->pJPEGdinfo->src->bytes_in_buffer = pData->iJPEGbufremain;
if (!pData->bJPEGhasheader) /* 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->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);
if ( ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAY ) ||
(pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA) ) &&
(pData->pJPEGdinfo->jpeg_color_space != JCS_GRAYSCALE ) )
MNG_ERROR (pData, MNG_JPEGPARMSERR);
if ( ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLOR ) ||
(pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) &&
(pData->pJPEGdinfo->jpeg_color_space != JCS_YCbCr ) )
MNG_ERROR (pData, MNG_JPEGPARMSERR);
/* indicate whether or not it's progressive */
pData->bJPEGprogressive = (mng_bool)jpeg_has_multiple_scans (pData->pJPEGdinfo);
/* progressive+alpha can't display "on-the-fly"!! */
if ((pData->bJPEGprogressive) &&
((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA ) ||
(pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ))
pData->fDisplayrow = MNG_NULL;
/* allocate a row of JPEG-samples */
if (pData->pJPEGdinfo->jpeg_color_space == JCS_YCbCr)
pData->iJPEGrowlen = pData->pJPEGdinfo->image_width * RGB_PIXELSIZE;
else
pData->iJPEGrowlen = pData->pJPEGdinfo->image_width;
MNG_ALLOC (pData, pData->pJPEGrow, pData->iJPEGrowlen);
pData->iJPEGrgbrow = 0; /* quite empty up to now */
}
pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte;
pData->iJPEGbufremain = (mng_uint32)pData->pJPEGdinfo->src->bytes_in_buffer;
}
/* decompress not started ? */
if ((pData->bJPEGhasheader) && (!pData->bJPEGdecostarted))
{
/* set parameters for decompression */
if (pData->bJPEGprogressive) /* progressive display ? */
pData->pJPEGdinfo->buffered_image = TRUE;
/* jpeg_start_decompress(...); */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_START_DECOMPRESS)
#endif
if (jpeg_start_decompress (pData->pJPEGdinfo) == TRUE)
/* indicate it started */
pData->bJPEGdecostarted = MNG_TRUE;
pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte;
pData->iJPEGbufremain = (mng_uint32)pData->pJPEGdinfo->src->bytes_in_buffer;
}
/* process some scanlines ? */
if ((pData->bJPEGhasheader) && (pData->bJPEGdecostarted) &&
((!jpeg_input_complete (pData->pJPEGdinfo)) ||
(pData->pJPEGdinfo->output_scanline < pData->pJPEGdinfo->output_height) ||
((pData->bJPEGprogressive) && (pData->bJPEGscanending))))
{
mng_int32 iLines = 0;
/* for (each output pass) */
do
{ /* address the row output buffer */
JSAMPROW pRow = (JSAMPROW)pData->pJPEGrow;
/* init new pass ? */
if ((pData->bJPEGprogressive) && (!pData->bJPEGscanstarted))
{
pData->bJPEGscanstarted = 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->pJPEGdinfo, pData->pJPEGdinfo->input_scan_number);
pData->iJPEGrow = 0; /* start at row 0 in the image again */
}
/* while (scan lines remain to be read) */
if ((!pData->bJPEGprogressive) || (!pData->bJPEGscanending))
{
do
{
/* jpeg_read_scanlines(...); */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_READ_SCANLINES)
#endif
iLines = jpeg_read_scanlines (pData->pJPEGdinfo, (JSAMPARRAY)&pRow, 1);
pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte;
pData->iJPEGbufremain = (mng_uint32)pData->pJPEGdinfo->src->bytes_in_buffer;
if (iLines > 0) /* got something ? */
{
if (pData->fStorerow2) /* store in object ? */
{
iRetcode = ((mng_storerow)pData->fStorerow2) (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
}
}
}
while ((pData->pJPEGdinfo->output_scanline < pData->pJPEGdinfo->output_height) &&
(iLines > 0)); /* until end-of-image or not enough input-data */
}
/* terminate output pass */
if ((pData->bJPEGprogressive) &&
(pData->pJPEGdinfo->output_scanline >= pData->pJPEGdinfo->output_height))
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_FINISH_OUTPUT)
#endif
if (jpeg_finish_output (pData->pJPEGdinfo) != JPEG_SUSPENDED)
{ /* this scan has ended */
pData->bJPEGscanstarted = MNG_FALSE;
pData->bJPEGscanending = MNG_FALSE;
}
else
{
pData->bJPEGscanending = MNG_TRUE;
}
}
}
while ((!jpeg_input_complete (pData->pJPEGdinfo)) &&
(iLines > 0) && (!pData->bJPEGscanending));
}
/* end of image ? */
if ((pData->bJPEGhasheader) && (pData->bJPEGdecostarted) &&
(!pData->bJPEGscanending) && (jpeg_input_complete (pData->pJPEGdinfo)) &&
(pData->pJPEGdinfo->input_scan_number == pData->pJPEGdinfo->output_scan_number))
{
/* jpeg_finish_decompress(...); */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_FINISH_DECOMPRESS)
#endif
if (jpeg_finish_decompress (pData->pJPEGdinfo) == TRUE)
{ /* indicate it's done */
pData->bJPEGhasheader = MNG_FALSE;
pData->bJPEGdecostarted = MNG_FALSE;
pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte;
pData->iJPEGbufremain = (mng_uint32)pData->pJPEGdinfo->src->bytes_in_buffer;
/* remaining fluff is an error ! */
if ((pData->iJPEGbufremain > 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_decompressfree (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
/* free the row of JPEG-samples*/
MNG_FREE (pData, pData->pJPEGrow, pData->iJPEGrowlen);
/* release the JPEG decompression object */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_JPEG_DESTROY_DECOMPRESS)
#endif
jpeg_destroy_decompress (pData->pJPEGdinfo);
pData->bJPEGdecompress = MNG_FALSE; /* indicate it's done */
#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 */
/* ************************************************************************** */
/* * * */
/* * 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 * RGB_PIXELSIZE;
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
if (jpeg_finish_output (pData->pJPEGdinfo2) == JPEG_SUSPENDED)
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
/* free the row of JPEG-samples*/
MNG_FREE (pData, pData->pJPEGrow2, pData->iJPEGrowlen2);
/* 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 && MNG_INCLUDE_DISPLAY_PROCS */
/* ************************************************************************** */
/* * end of file * */
/* ************************************************************************** */
libmng-2.0.3/libmng_cms.h 0000644 0001750 0001750 00000012140 12005307152 015134 0 ustar glennrp glennrp /* ************************************************************************** */
/* * For conditions of distribution and use, * */
/* * see copyright notice in libmng.h * */
/* ************************************************************************** */
/* * * */
/* * project : libmng * */
/* * file : libmng_cms.h copyright (c) 2000-2003 G.Juyn * */
/* * version : 1.0.6 * */
/* * * */
/* * purpose : color management routines (definition) * */
/* * * */
/* * author : G.Juyn * */
/* * * */
/* * comment : Definition of color management routines * */
/* * * */
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
/* * - changed strict-ANSI stuff * */
/* * 0.5.1 - 05/11/2000 - G.Juyn * */
/* * - added creatememprofile * */
/* * * */
/* * 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!) * */
/* * * */
/* * 1.0.5 - 08/19/2002 - G.Juyn * */
/* * - B597134 - libmng pollutes the linker namespace * */
/* * 1.0.5 - 09/19/2002 - G.Juyn * */
/* * - optimized color-correction routines * */
/* * * */
/* * 1.0.6 - 04/11/2003 - G.Juyn * */
/* * - B719420 - fixed several MNG_APP_CMS problems * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
#pragma option -A /* force ANSI-C */
#endif
#ifndef _libmng_cms_h_
#define _libmng_cms_h_
/* ************************************************************************** */
#ifdef MNG_INCLUDE_LCMS
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
/* ************************************************************************** */
#ifdef MNG_FULL_CMS
mng_retcode mng_init_full_cms (mng_datap pData,
mng_bool bGlobal,
mng_bool bObject,
mng_bool bRetrobj);
mng_retcode mng_correct_full_cms (mng_datap pData);
#endif
#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS)
mng_retcode mng_init_gamma_only (mng_datap pData,
mng_bool bGlobal,
mng_bool bObject,
mng_bool bRetrobj);
mng_retcode mng_correct_gamma_only (mng_datap pData);
#endif
#ifdef MNG_APP_CMS
mng_retcode mng_init_app_cms (mng_datap pData,
mng_bool bGlobal,
mng_bool bObject,
mng_bool bRetrobj);
mng_retcode mng_correct_app_cms (mng_datap pData);
#endif
/* ************************************************************************** */
#endif /* _libmng_cms_h_ */
/* ************************************************************************** */
/* * end of file * */
/* ************************************************************************** */
libmng-2.0.3/BUILD/ 0000755 0001750 0001750 00000000000 12115353245 013520 5 ustar glennrp glennrp libmng-2.0.3/README 0000644 0001750 0001750 00000001253 12005307152 013534 0 ustar glennrp glennrp libmng 1.0.10
-------------
Added provisional ANG and anIM support, and made some minor bugfixes.
libmng 1.0.9
------------
A number of optimizations in the chunk handling and reader/writer code.
This saves over 20KB on binary footprint!
Also several bugfixes and a couple of patches bring it another step
closer to perfection.... :-)
See CHANGELOG for details.
Y.T.
Gerard
For more information please visit:
The official libmng web-site:
http://www.libmng.com/
Libmng's community on SourceForge:
https://sourceforge.net/project/?group_id=5635
The official MNG homepage:
http://www.libpng.org/pub/mng/
The official PNG homepage:
http://www.libpng.org/pub/png/
libmng-2.0.3/aclocal.m4 0000644 0001750 0001750 00000107460 12115360515 014527 0 ustar glennrp glennrp # generated automatically by aclocal 1.13.1 -*- Autoconf -*-
# Copyright (C) 1996-2012 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
[m4_warning([this file was generated for autoconf 2.69.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.13'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.13.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
# _AM_AUTOCONF_VERSION(VERSION)
# -----------------------------
# aclocal traces this macro to find the Autoconf version.
# This is a private macro too. Using m4_define simplifies
# the logic in aclocal, which can simply ignore this definition.
m4_define([_AM_AUTOCONF_VERSION], [])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.13.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
# therefore $ac_aux_dir as well) can be either absolute or relative,
# depending on how configure is run. This is pretty annoying, since
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
# source directory, any form will work fine, but in subdirectories a
# relative path needs to be adjusted first.
#
# $ac_aux_dir/missing
# fails when called from a subdirectory if $ac_aux_dir is relative
# $top_srcdir/$ac_aux_dir/missing
# fails if $ac_aux_dir is absolute,
# fails when called from a subdirectory in a VPATH build with
# a relative $ac_aux_dir
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is '.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
# and then we would define $MISSING as
# MISSING="\${SHELL} $am_aux_dir/missing"
# This will work as long as MISSING is not called from configure, because
# unfortunately $(top_srcdir) has no meaning in configure.
# However there are other variables, like CC, which are often used in
# configure, and could therefore not use this "fixed" $ac_aux_dir.
#
# Another solution, used here, is to always expand $ac_aux_dir to an
# absolute PATH. The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
[dnl Rely on autoconf to set up CDPATH properly.
AC_PREREQ([2.50])dnl
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
])
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ([2.52])dnl
m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])dnl
AC_SUBST([$1_FALSE])dnl
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
m4_define([_AM_COND_VALUE_$1], [$2])dnl
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
# dependency, and given that the user is not expected to run this macro,
# just rely on AC_PROG_CC.
AC_DEFUN([_AM_DEPENDENCIES],
[AC_REQUIRE([AM_SET_DEPDIR])dnl
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
m4_if([$1], [CC], [depcc="$CC" am_compiler_list=],
[$1], [CXX], [depcc="$CXX" am_compiler_list=],
[$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
[$1], [UPC], [depcc="$UPC" am_compiler_list=],
[$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named 'D' -- because '-MD' means "put the output
# in D".
rm -rf conftest.dir
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_$1_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
am__universal=false
m4_case([$1], [CC],
[case " $depcc " in #(
*\ -arch\ *\ -arch\ *) am__universal=true ;;
esac],
[CXX],
[case " $depcc " in #(
*\ -arch\ *\ -arch\ *) am__universal=true ;;
esac])
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
# Solaris 10 /bin/sh.
echo '/* dummy */' > sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
# We check with '-c' and '-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle '-M -o', and we need to detect this. Also, some Intel
# versions had trouble with output in subdirs.
am__obj=sub/conftest.${OBJEXT-o}
am__minus_obj="-o $am__obj"
case $depmode in
gcc)
# This depmode causes a compiler race in universal mode.
test "$am__universal" = false || continue
;;
nosideeffect)
# After this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested.
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
msvc7 | msvc7msys | msvisualcpp | msvcmsys)
# This compiler won't grok '-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted.
am__obj=conftest.${OBJEXT-o}
am__minus_obj=
;;
none) break ;;
esac
if depmode=$depmode \
source=sub/conftest.c object=$am__obj \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_$1_dependencies_compiler_type=none
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
])
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE([dependency-tracking], [dnl
AS_HELP_STRING(
[--enable-dependency-tracking],
[do not reject slow dependency extractors])
AS_HELP_STRING(
[--disable-dependency-tracking],
[speeds up one-time build])])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
am__nodep='_no'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])dnl
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
AC_SUBST([am__nodep])dnl
_AM_SUBST_NOTMAKE([am__nodep])dnl
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[{
# Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting.
case $CONFIG_FILES in
*\'*) eval set x "$CONFIG_FILES" ;;
*) set x $CONFIG_FILES ;;
esac
shift
for mf
do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named 'Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running 'make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
}
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
# AM_OUTPUT_DEPENDENCY_COMMANDS
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each '.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
# The call with PACKAGE and VERSION arguments is the old style
# call (pre autoconf-2.50), which is being phased out. PACKAGE
# and VERSION should now be passed to AC_INIT and removed from
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition. After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.65])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
if test "`cd $srcdir && pwd`" != "`pwd`"; then
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
# is not polluted with repeated "-I."
AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
# test to see if srcdir already configured
if test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[AC_DIAGNOSE([obsolete],
[$0: two- and three-arguments forms are deprecated.])
m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
m4_if(
m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
[ok:ok],,
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
AM_MISSING_PROG([AUTOCONF], [autoconf])
AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
AM_MISSING_PROG([AUTOHEADER], [autoheader])
AM_MISSING_PROG([MAKEINFO], [makeinfo])
AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
# For better backward compatibility. To be removed once Automake 1.9.x
# dies out for good. For more background, see:
#
#
AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES([CC])],
[m4_define([AC_PROG_CC],
m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES([CXX])],
[m4_define([AC_PROG_CXX],
m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
[_AM_DEPENDENCIES([OBJC])],
[m4_define([AC_PROG_OBJC],
m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
[_AM_DEPENDENCIES([OBJCXX])],
[m4_define([AC_PROG_OBJCXX],
m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
])
AC_REQUIRE([AM_SILENT_RULES])dnl
dnl The testsuite driver may need to know about EXEEXT, so add the
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
AC_CONFIG_COMMANDS_PRE(dnl
[m4_provide_if([_AM_COMPILER_EXEEXT],
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
])
dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
dnl mangled by Autoconf and run in a shell conditional statement.
m4_define([_AC_COMPILER_EXEEXT],
m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[# Compute $1's index in $config_headers.
_am_arg=$1
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$_am_arg | $_am_arg:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
if test x"${install_sh}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
*)
install_sh="\${SHELL} $am_aux_dir/install-sh"
esac
fi
AC_SUBST([install_sh])])
# Copyright (C) 2003-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
[rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
am__doit:
@echo this is the am__doit target
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# Ignore all kinds of additional output from 'make'.
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=include
am__quote=
_am_result=GNU
;;
esac
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=.include
am__quote="\""
_am_result=BSD
;;
esac
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
[AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
# AM_MISSING_HAS_RUN
# ------------------
# Define MISSING if not defined so far and test if it is modern enough.
# If it is, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
if test x"${MISSING+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
*)
MISSING="\${SHELL} $am_aux_dir/missing" ;;
esac
fi
# Use eval to expand $SHELL
if eval "$MISSING --is-lightweight"; then
am_missing_run="$MISSING "
else
am_missing_run=
AC_MSG_WARN(['missing' script is too old or missing])
fi
])
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
# --------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
# _AM_SET_OPTIONS(OPTIONS)
# ------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Reject unsafe characters in $srcdir or the absolute working directory
# name. Accept space and tab only in the latter.
am_lf='
'
case `pwd` in
*[[\\\"\#\$\&\'\`$am_lf]]*)
AC_MSG_ERROR([unsafe absolute working directory name]);;
esac
case $srcdir in
*[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
esac
# Do 'set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
am_has_slept=no
for am_try in 1 2; do
echo "timestamp, slept: $am_has_slept" > conftest.file
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t "$srcdir/configure" conftest.file`
fi
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
if test "$[2]" = conftest.file || test $am_try -eq 2; then
break
fi
# Just in case.
sleep 1
am_has_slept=yes
done
test "$[2]" = conftest.file
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT([yes])
# If we didn't sleep, we still need to ensure time stamps of config.status and
# generated files are strictly newer.
am_sleep_pid=
if grep 'slept: no' conftest.file >/dev/null 2>&1; then
( sleep 1 ) &
am_sleep_pid=$!
fi
AC_CONFIG_COMMANDS_PRE(
[AC_MSG_CHECKING([that generated files are newer than configure])
if test -n "$am_sleep_pid"; then
# Hide warnings about reused PIDs.
wait $am_sleep_pid 2>/dev/null
fi
AC_MSG_RESULT([done])])
rm -f conftest.file
])
# Copyright (C) 2009-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_SILENT_RULES([DEFAULT])
# --------------------------
# Enable less verbose build rules; with the default set to DEFAULT
# ("yes" being less verbose, "no" or empty being verbose).
AC_DEFUN([AM_SILENT_RULES],
[AC_ARG_ENABLE([silent-rules], [dnl
AS_HELP_STRING(
[--enable-silent-rules],
[less verbose build output (undo: "make V=1")])
AS_HELP_STRING(
[--disable-silent-rules],
[verbose build output (undo: "make V=0")])dnl
])
case $enable_silent_rules in @%:@ (((
yes) AM_DEFAULT_VERBOSITY=0;;
no) AM_DEFAULT_VERBOSITY=1;;
*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
esac
dnl
dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
dnl do not support nested variable expansions.
dnl See automake bug#9928 and bug#10237.
am_make=${MAKE-make}
AC_CACHE_CHECK([whether $am_make supports nested variables],
[am_cv_make_support_nested_variables],
[if AS_ECHO([['TRUE=$(BAR$(V))
BAR0=false
BAR1=true
V=1
am__doit:
@$(TRUE)
.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
am_cv_make_support_nested_variables=yes
else
am_cv_make_support_nested_variables=no
fi])
if test $am_cv_make_support_nested_variables = yes; then
dnl Using '$V' instead of '$(V)' breaks IRIX make.
AM_V='$(V)'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
else
AM_V=$AM_DEFAULT_VERBOSITY
AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
fi
AC_SUBST([AM_V])dnl
AM_SUBST_NOTMAKE([AM_V])dnl
AC_SUBST([AM_DEFAULT_V])dnl
AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
AM_BACKSLASH='\'
AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_STRIP
# ---------------------
# One issue with vendor 'install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in "make install-strip", and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using 'strip' when the user
# run "make install-strip". However 'strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the 'STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
# This macro is traced by Automake.
AC_DEFUN([_AM_SUBST_NOTMAKE])
# AM_SUBST_NOTMAKE(VARIABLE)
# --------------------------
# Public sister of _AM_SUBST_NOTMAKE.
AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_PROG_TAR(FORMAT)
# --------------------
# Check how to create a tarball in format FORMAT.
# FORMAT should be one of 'v7', 'ustar', or 'pax'.
#
# Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory
# $tardir.
# tardir=directory && $(am__tar) > result.tar
#
# Substitute a variable $(am__untar) that extract such
# a tarball read from stdin.
# $(am__untar) < result.tar
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility. Yes, it's still used
# in the wild :-( We should find a proper way to deprecate it ...
AC_SUBST([AMTAR], ['$${TAR-tar}'])
m4_if([$1], [v7],
[am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
[m4_case([$1], [ustar],, [pax],,
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
# Loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
# Do not fold the above two line into one, because Tru64 sh and
# Solaris sh will not grok spaces in the rhs of '-'.
for _am_tool in $_am_tools
do
case $_am_tool in
gnutar)
for _am_tar in tar gnutar gtar;
do
AM_RUN_LOG([$_am_tar --version]) && break
done
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
am__untar="$_am_tar -xf -"
;;
plaintar)
# Must skip GNU tar: if it does not support --format= it doesn't create
# ustar tarball either.
(tar --version) >/dev/null 2>&1 && continue
am__tar='tar chf - "$$tardir"'
am__tar_='tar chf - "$tardir"'
am__untar='tar xf -'
;;
pax)
am__tar='pax -L -x $1 -w "$$tardir"'
am__tar_='pax -L -x $1 -w "$tardir"'
am__untar='pax -r'
;;
cpio)
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
am__untar='cpio -i -H $1 -d'
;;
none)
am__tar=false
am__tar_=false
am__untar=false
;;
esac
# If the value was cached, stop now. We just wanted to have am__tar
# and am__untar set.
test -n "${am_cv_prog_tar_$1}" && break
# tar/untar a dummy directory, and stop if the command works
rm -rf conftest.dir
mkdir conftest.dir
echo GrepMe > conftest.dir/file
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
rm -rf conftest.dir
if test -s conftest.tar; then
AM_RUN_LOG([$am__untar /dev/null 2>&1 && break
fi
done
rm -rf conftest.dir
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([m4/libtool.m4])
m4_include([m4/ltoptions.m4])
m4_include([m4/ltsugar.m4])
m4_include([m4/ltversion.m4])
m4_include([m4/lt~obsolete.m4])
libmng-2.0.3/libmng_write.c 0000644 0001750 0001750 00000020537 12005307152 015510 0 ustar glennrp glennrp #include "config.h"
/* ************************************************************************** */
/* * For conditions of distribution and use, * */
/* * see copyright notice in libmng.h * */
/* ************************************************************************** */
/* * * */
/* * project : libmng * */
/* * file : libmng_write.c copyright (c) 2000-2004 G.Juyn * */
/* * version : 1.0.9 * */
/* * * */
/* * purpose : Write management (implementation) * */
/* * * */
/* * author : G.Juyn * */
/* * * */
/* * comment : implementation of the write management routines * */
/* * * */
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
/* * - changed strict-ANSI stuff * */
/* * 0.5.1 - 05/12/2000 - G.Juyn * */
/* * - changed trace to macro for callback error-reporting * */
/* * 0.5.1 - 05/16/2000 - G.Juyn * */
/* * - moved the actual write_graphic functionality from * */
/* * mng_hlapi to its appropriate function here * */
/* * * */
/* * 0.9.1 - 07/19/2000 - G.Juyn * */
/* * - fixed writing of signature * */
/* * * */
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 1.0.5 - 08/19/2002 - G.Juyn * */
/* * - B597134 - libmng pollutes the linker namespace * */
/* * * */
/* * 1.0.8 - 07/06/2004 - G.R-P * */
/* * - added conditionals around openstream/closestream * */
/* * - defend against using undefined Open/Closestream function * */
/* * 1.0.8 - 08/02/2004 - G.Juyn * */
/* * - added conditional to allow easier writing of large MNG's * */
/* * * */
/* * 1.0.9 - 09/25/2004 - G.Juyn * */
/* * - replaced MNG_TWEAK_LARGE_FILES with permanent solution * */
/* * 1.0.9 - 12/20/2004 - G.Juyn * */
/* * - cleaned up macro-invocations (thanks to D. Airlie) * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
#include "libmng_data.h"
#include "libmng_error.h"
#include "libmng_trace.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "libmng_memory.h"
#include "libmng_chunks.h"
#include "libmng_chunk_io.h"
#include "libmng_write.h"
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
#pragma option -A /* force ANSI-C */
#endif
/* ************************************************************************** */
#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
mng_retcode mng_drop_chunks (mng_datap pData)
{
mng_chunkp pChunk;
mng_chunkp pNext;
mng_cleanupchunk fCleanup;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DROP_CHUNKS, MNG_LC_START);
#endif
pChunk = pData->pFirstchunk; /* and get first stored chunk (if any) */
while (pChunk) /* more chunks to discard ? */
{
pNext = ((mng_chunk_headerp)pChunk)->pNext;
/* call appropriate cleanup */
fCleanup = ((mng_chunk_headerp)pChunk)->fCleanup;
fCleanup (pData, pChunk);
pChunk = pNext; /* neeeext */
}
pData->pFirstchunk = MNG_NULL;
pData->pLastchunk = MNG_NULL;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DROP_CHUNKS, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_WRITE_PROCS
/* ************************************************************************** */
mng_retcode mng_write_graphic (mng_datap pData)
{
mng_chunkp pChunk;
mng_retcode iRetcode;
mng_uint32 iWritten;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_WRITE_GRAPHIC, MNG_LC_START);
#endif
pChunk = pData->pFirstchunk; /* we'll start with the first, thank you */
if (pChunk) /* is there anything to write ? */
{ /* open the file */
if (!pData->bWriting)
{
#ifndef MNG_NO_OPEN_CLOSE_STREAM
if (pData->fOpenstream && !pData->fOpenstream ((mng_handle)pData))
MNG_ERROR (pData, MNG_APPIOERROR);
#endif
{
pData->bWriting = MNG_TRUE; /* indicate writing */
pData->iWritebufsize = 32768; /* get a temporary write buffer */
/* reserve 12 bytes for length, chunkname & crc */
MNG_ALLOC (pData, pData->pWritebuf, pData->iWritebufsize+12);
/* write the signature */
if (((mng_chunk_headerp)pChunk)->iChunkname == MNG_UINT_IHDR)
mng_put_uint32 (pData->pWritebuf, PNG_SIG);
else
if (((mng_chunk_headerp)pChunk)->iChunkname == MNG_UINT_JHDR)
mng_put_uint32 (pData->pWritebuf, JNG_SIG);
else
mng_put_uint32 (pData->pWritebuf, MNG_SIG);
mng_put_uint32 (pData->pWritebuf+4, POST_SIG);
if (!pData->fWritedata ((mng_handle)pData, pData->pWritebuf, 8, &iWritten))
{
MNG_FREE (pData, pData->pWritebuf, pData->iWritebufsize+12);
MNG_ERROR (pData, MNG_APPIOERROR);
}
if (iWritten != 8) /* disk full ? */
{
MNG_FREE (pData, pData->pWritebuf, pData->iWritebufsize+12);
MNG_ERROR (pData, MNG_OUTPUTERROR);
}
}
}
while (pChunk) /* so long as there's something to write */
{ /* let's call its output routine */
iRetcode = ((mng_chunk_headerp)pChunk)->fWrite (pData, pChunk);
if (iRetcode) /* on error bail out */
return iRetcode;
/* neeeext */
pChunk = ((mng_chunk_headerp)pChunk)->pNext;
}
if (!pData->bCreating)
{ /* free the temporary buffer */
MNG_FREE (pData, pData->pWritebuf, pData->iWritebufsize+12);
pData->bWriting = MNG_FALSE; /* done writing */
/* close the stream now */
#ifndef MNG_NO_OPEN_CLOSE_STREAM
if (pData->fClosestream && !pData->fClosestream ((mng_handle)pData))
MNG_ERROR (pData, MNG_APPIOERROR);
#endif
} else {
/* cleanup the written chunks */
iRetcode = mng_drop_chunks (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_WRITE_GRAPHIC, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#endif /* MNG_INCLUDE_WRITE_PROCS */
/* ************************************************************************** */
/* * end of file * */
/* ************************************************************************** */
libmng-2.0.3/libmng_chunks.h 0000644 0001750 0001750 00000112775 12005307152 015664 0 ustar glennrp glennrp /* ************************************************************************** */
/* * For conditions of distribution and use, * */
/* * see copyright notice in libmng.h * */
/* ************************************************************************** */
/* * * */
/* * project : libmng * */
/* * file : libmng_chunks.h copyright (c) 2000-2007 G.Juyn * */
/* * version : 1.0.10 * */
/* * * */
/* * purpose : Chunk structures (definition) * */
/* * * */
/* * author : G.Juyn * */
/* * * */
/* * comment : Definition of known chunk structures * */
/* * * */
/* * changes : 0.5.1 - 05/04/2000 - G.Juyn * */
/* * - put in some extra comments * */
/* * 0.5.1 - 05/06/2000 - G.Juyn * */
/* * - fixed layout for sBIT, PPLT * */
/* * 0.5.1 - 05/08/2000 - G.Juyn * */
/* * - changed write callback definition * */
/* * - changed strict-ANSI stuff * */
/* * 0.5.1 - 05/11/2000 - G.Juyn * */
/* * - fixed layout for PPLT again (missed deltatype ?!?) * */
/* * * */
/* * 0.5.2 - 05/31/2000 - G.Juyn * */
/* * - removed useless definition (contributed by Tim Rowley) * */
/* * 0.5.2 - 06/03/2000 - G.Juyn * */
/* * - fixed makeup for Linux gcc compile * */
/* * * */
/* * 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 * */
/* * * */
/* * 1.0.5 - 08/19/2002 - G.Juyn * */
/* * - added HLAPI function to copy chunks * */
/* * 1.0.5 - 09/14/2002 - G.Juyn * */
/* * - added event handling for dynamic MNG * */
/* * 1.0.5 - 11/28/2002 - G.Juyn * */
/* * - fixed definition of iMethodX/Y for MAGN chunk * */
/* * * */
/* * 1.0.6 - 05/25/2003 - G.R-P * */
/* * added MNG_SKIPCHUNK_cHNK footprint optimizations * */
/* * 1.0.6 - 07/29/2003 - G.R-P * */
/* * - added conditionals around PAST chunk support * */
/* * * */
/* * 1.0.7 - 03/24/2004 - G.R-P * */
/* * - added conditional around MNG_NO_DELTA_PNG support * */
/* * * */
/* * 1.0.9 - 12/05/2004 - G.Juyn * */
/* * - added conditional MNG_OPTIMIZE_CHUNKINITFREE * */
/* * 1.0.9 - 12/06/2004 - G.Juyn * */
/* * - added conditional MNG_OPTIMIZE_CHUNKREADER * */
/* * * */
/* * 1.0.10 - 04/08/2007 - G.Juyn * */
/* * - added support for mPNG proposal * */
/* * 1.0.10 - 04/12/2007 - G.Juyn * */
/* * - added support for ANG proposal * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
#pragma option -A /* force ANSI-C */
#endif
#ifndef _libmng_chunks_h_
#define _libmng_chunks_h_
/* ************************************************************************** */
#ifdef MNG_SWAP_ENDIAN
#define PNG_SIG 0x474e5089L
#define JNG_SIG 0x474e4a8bL
#define MNG_SIG 0x474e4d8aL
#define POST_SIG 0x0a1a0a0dL
#else
#define PNG_SIG 0x89504e47L
#define JNG_SIG 0x8b4a4e47L
#define MNG_SIG 0x8a4d4e47L
#define POST_SIG 0x0d0a1a0aL
#endif
/* ************************************************************************** */
#ifdef MNG_OPTIMIZE_CHUNKREADER
typedef mng_retcode (*mng_f_specialfunc) (mng_datap pData,
mng_chunkp pChunk,
mng_uint32* piRawlen,
mng_uint8p* ppRawdata);
typedef mng_retcode (*mng_c_specialfunc) (mng_datap pData,
mng_chunkp pChunk);
#define MNG_FIELD_OPTIONAL 0x0001
#define MNG_FIELD_TERMINATOR 0x0002
#define MNG_FIELD_REPETITIVE 0x0004
#define MNG_FIELD_DEFLATED 0x0008
#define MNG_FIELD_IFIMGTYPES 0x01F0 /* image-type mask */
#define MNG_FIELD_IFIMGTYPE0 0x0010
#define MNG_FIELD_IFIMGTYPE2 0x0020
#define MNG_FIELD_IFIMGTYPE3 0x0040
#define MNG_FIELD_IFIMGTYPE4 0x0080
#define MNG_FIELD_IFIMGTYPE6 0x0100
#define MNG_FIELD_PUTIMGTYPE 0x0200
#define MNG_FIELD_NOHIGHBIT 0x0400
#define MNG_FIELD_GROUPMASK 0x7000
#define MNG_FIELD_GROUP1 0x1000
#define MNG_FIELD_GROUP2 0x2000
#define MNG_FIELD_GROUP3 0x3000
#define MNG_FIELD_GROUP4 0x4000
#define MNG_FIELD_GROUP5 0x5000
#define MNG_FIELD_GROUP6 0x6000
#define MNG_FIELD_GROUP7 0x7000
#define MNG_FIELD_INT 0x8000
typedef struct { /* chunk-field descriptor */
mng_f_specialfunc pSpecialfunc;
mng_uint16 iFlags;
mng_uint16 iMinvalue;
mng_uint16 iMaxvalue;
mng_uint16 iLengthmin;
mng_uint16 iLengthmax;
mng_uint16 iOffsetchunk;
mng_uint16 iOffsetchunkind;
mng_uint16 iOffsetchunklen;
} mng_field_descriptor;
typedef mng_field_descriptor * mng_field_descp;
#define MNG_DESCR_GLOBAL 0x0001
#define MNG_DESCR_EMPTY 0x0002
#define MNG_DESCR_EMPTYEMBED 0x0006
#define MNG_DESCR_EMPTYGLOBAL 0x000A
#define MNG_DESCR_GenHDR 0x0001 /* IHDR/JHDR/BASI/DHDR */
#define MNG_DESCR_JngHDR 0x0002 /* JHDR/DHDR */
#define MNG_DESCR_MHDR 0x0004
#define MNG_DESCR_IHDR 0x0008
#define MNG_DESCR_JHDR 0x0010
#define MNG_DESCR_DHDR 0x0020
#define MNG_DESCR_LOOP 0x0040
#define MNG_DESCR_PLTE 0x0080
#define MNG_DESCR_SAVE 0x0100
#define MNG_DESCR_NOIHDR 0x0001
#define MNG_DESCR_NOJHDR 0x0002
#define MNG_DESCR_NOBASI 0x0004
#define MNG_DESCR_NODHDR 0x0008
#define MNG_DESCR_NOIDAT 0x0010
#define MNG_DESCR_NOJDAT 0x0020
#define MNG_DESCR_NOJDAA 0x0040
#define MNG_DESCR_NOPLTE 0x0080
#define MNG_DESCR_NOJSEP 0x0100
#define MNG_DESCR_NOMHDR 0x0200
#define MNG_DESCR_NOTERM 0x0400
#define MNG_DESCR_NOLOOP 0x0800
#define MNG_DESCR_NOSAVE 0x1000
typedef struct { /* chunk descriptor */
mng_imgtype eImgtype;
mng_createobjtype eCreateobject;
mng_uint16 iObjsize;
mng_uint16 iOffsetempty;
mng_ptr pObjcleanup;
mng_ptr pObjprocess;
mng_c_specialfunc pSpecialfunc;
mng_field_descp pFielddesc;
mng_uint16 iFielddesc;
mng_uint16 iAllowed;
mng_uint16 iMusthaves;
mng_uint16 iMustNOThaves;
} mng_chunk_descriptor;
typedef mng_chunk_descriptor * mng_chunk_descp;
#endif /* MNG_OPTIMIZE_CHUNKREADER */
/* ************************************************************************** */
typedef mng_retcode (*mng_createchunk) (mng_datap pData,
mng_chunkp pHeader,
mng_chunkp* ppChunk);
typedef mng_retcode (*mng_cleanupchunk) (mng_datap pData,
mng_chunkp pHeader);
typedef mng_retcode (*mng_readchunk) (mng_datap pData,
mng_chunkp pHeader,
mng_uint32 iRawlen,
mng_uint8p pRawdata,
mng_chunkp* pChunk);
typedef mng_retcode (*mng_writechunk) (mng_datap pData,
mng_chunkp pChunk);
typedef mng_retcode (*mng_assignchunk) (mng_datap pData,
mng_chunkp pChunkto,
mng_chunkp pChunkfrom);
/* ************************************************************************** */
typedef struct { /* generic header */
mng_chunkid iChunkname;
mng_createchunk fCreate;
mng_cleanupchunk fCleanup;
mng_readchunk fRead;
mng_writechunk fWrite;
mng_assignchunk fAssign;
mng_chunkp pNext; /* for double-linked list */
mng_chunkp pPrev;
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
mng_size_t iChunksize;
#endif
#ifdef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_descp pChunkdescr;
#endif
} mng_chunk_header;
typedef mng_chunk_header * mng_chunk_headerp;
/* ************************************************************************** */
typedef struct { /* IHDR */
mng_chunk_header sHeader;
mng_uint32 iWidth;
mng_uint32 iHeight;
mng_uint8 iBitdepth;
mng_uint8 iColortype;
mng_uint8 iCompression;
mng_uint8 iFilter;
mng_uint8 iInterlace;
} mng_ihdr;
typedef mng_ihdr * mng_ihdrp;
/* ************************************************************************** */
typedef struct { /* PLTE */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_uint32 iEntrycount;
mng_rgbpaltab aEntries;
} mng_plte;
typedef mng_plte * mng_pltep;
/* ************************************************************************** */
typedef struct { /* IDAT */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_uint32 iDatasize;
mng_ptr pData;
} mng_idat;
typedef mng_idat * mng_idatp;
/* ************************************************************************** */
typedef struct { /* IEND */
mng_chunk_header sHeader;
} mng_iend;
typedef mng_iend * mng_iendp;
/* ************************************************************************** */
typedef struct { /* tRNS */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_bool bGlobal;
mng_uint8 iType; /* colortype (0,2,3) */
mng_uint32 iCount;
mng_uint8arr aEntries;
mng_uint16 iGray;
mng_uint16 iRed;
mng_uint16 iGreen;
mng_uint16 iBlue;
mng_uint32 iRawlen;
mng_uint8arr aRawdata;
} mng_trns;
typedef mng_trns * mng_trnsp;
/* ************************************************************************** */
typedef struct { /* gAMA */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_uint32 iGamma;
} mng_gama;
typedef mng_gama * mng_gamap;
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_cHRM
typedef struct { /* cHRM */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_uint32 iWhitepointx;
mng_uint32 iWhitepointy;
mng_uint32 iRedx;
mng_uint32 iRedy;
mng_uint32 iGreenx;
mng_uint32 iGreeny;
mng_uint32 iBluex;
mng_uint32 iBluey;
} mng_chrm;
typedef mng_chrm * mng_chrmp;
#endif
/* ************************************************************************** */
typedef struct { /* sRGB */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_uint8 iRenderingintent;
} mng_srgb;
typedef mng_srgb * mng_srgbp;
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_iCCP
typedef struct { /* iCCP */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_uint32 iNamesize;
mng_pchar zName;
mng_uint8 iCompression;
mng_uint32 iProfilesize;
mng_ptr pProfile;
} mng_iccp;
typedef mng_iccp * mng_iccpp;
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_tEXt
typedef struct { /* tEXt */
mng_chunk_header sHeader;
mng_uint32 iKeywordsize;
mng_pchar zKeyword;
mng_uint32 iTextsize;
mng_pchar zText;
} mng_text;
typedef mng_text * mng_textp;
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_zTXt
typedef struct { /* zTXt */
mng_chunk_header sHeader;
mng_uint32 iKeywordsize;
mng_pchar zKeyword;
mng_uint8 iCompression;
mng_uint32 iTextsize;
mng_pchar zText;
} mng_ztxt;
typedef mng_ztxt * mng_ztxtp;
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_iTXt
typedef struct { /* iTXt */
mng_chunk_header sHeader;
mng_uint32 iKeywordsize;
mng_pchar zKeyword;
mng_uint8 iCompressionflag;
mng_uint8 iCompressionmethod;
mng_uint32 iLanguagesize;
mng_pchar zLanguage;
mng_uint32 iTranslationsize;
mng_pchar zTranslation;
mng_uint32 iTextsize;
mng_pchar zText;
} mng_itxt;
typedef mng_itxt * mng_itxtp;
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_bKGD
typedef struct { /* bKGD */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_uint8 iType; /* 3=indexed, 0=gray, 2=rgb */
mng_uint8 iIndex;
mng_uint16 iGray;
mng_uint16 iRed;
mng_uint16 iGreen;
mng_uint16 iBlue;
} mng_bkgd;
typedef mng_bkgd * mng_bkgdp;
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_pHYs
typedef struct { /* pHYs */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_uint32 iSizex;
mng_uint32 iSizey;
mng_uint8 iUnit;
} mng_phys;
typedef mng_phys * mng_physp;
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_sBIT
typedef struct { /* sBIT */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_uint8 iType; /* colortype (0,2,3,4,6,10,12,14,16) */
mng_uint8arr4 aBits;
} mng_sbit;
typedef mng_sbit * mng_sbitp;
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_sPLT
typedef struct { /* sPLT */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_uint32 iNamesize;
mng_pchar zName;
mng_uint8 iSampledepth;
mng_uint32 iEntrycount;
mng_ptr pEntries;
} mng_splt;
typedef mng_splt * mng_spltp;
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_hIST
typedef struct { /* hIST */
mng_chunk_header sHeader;
mng_uint32 iEntrycount;
mng_uint16arr aEntries;
} mng_hist;
typedef mng_hist * mng_histp;
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_tIME
typedef struct { /* tIME */
mng_chunk_header sHeader;
mng_uint16 iYear;
mng_uint8 iMonth;
mng_uint8 iDay;
mng_uint8 iHour;
mng_uint8 iMinute;
mng_uint8 iSecond;
} mng_time;
typedef mng_time * mng_timep;
#endif
/* ************************************************************************** */
typedef struct { /* MHDR */
mng_chunk_header sHeader;
mng_uint32 iWidth;
mng_uint32 iHeight;
mng_uint32 iTicks;
mng_uint32 iLayercount;
mng_uint32 iFramecount;
mng_uint32 iPlaytime;
mng_uint32 iSimplicity;
} mng_mhdr;
typedef mng_mhdr * mng_mhdrp;
/* ************************************************************************** */
typedef struct { /* MEND */
mng_chunk_header sHeader;
} mng_mend;
typedef mng_mend * mng_mendp;
/* ************************************************************************** */
typedef struct { /* LOOP */
mng_chunk_header sHeader;
mng_uint8 iLevel;
mng_uint32 iRepeat;
mng_uint8 iTermination;
mng_uint32 iItermin;
mng_uint32 iItermax;
mng_uint32 iCount;
mng_uint32p pSignals;
} mng_loop;
typedef mng_loop * mng_loopp;
/* ************************************************************************** */
typedef struct { /* ENDL */
mng_chunk_header sHeader;
mng_uint8 iLevel;
} mng_endl;
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;
mng_int32 iYlocation;
mng_bool bHasclip;
mng_int32 iLeftcb;
mng_int32 iRightcb;
mng_int32 iTopcb;
mng_int32 iBottomcb;
} mng_defi;
typedef mng_defi * mng_defip;
/* ************************************************************************** */
typedef struct { /* BASI */
mng_chunk_header sHeader;
mng_uint32 iWidth;
mng_uint32 iHeight;
mng_uint8 iBitdepth;
mng_uint8 iColortype;
mng_uint8 iCompression;
mng_uint8 iFilter;
mng_uint8 iInterlace;
mng_uint16 iRed;
mng_uint16 iGreen;
mng_uint16 iBlue;
#ifdef MNG_OPTIMIZE_CHUNKREADER
mng_bool bHasalpha;
#endif
mng_uint16 iAlpha;
mng_uint8 iViewable;
} mng_basi;
typedef mng_basi * mng_basip;
/* ************************************************************************** */
typedef struct { /* CLON */
mng_chunk_header sHeader;
mng_uint16 iSourceid;
mng_uint16 iCloneid;
mng_uint8 iClonetype;
#ifdef MNG_OPTIMIZE_CHUNKREADER
mng_bool bHasdonotshow;
#endif
mng_uint8 iDonotshow;
mng_uint8 iConcrete;
mng_bool bHasloca;
mng_uint8 iLocationtype;
mng_int32 iLocationx;
mng_int32 iLocationy;
} mng_clon;
typedef mng_clon * mng_clonp;
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_PAST
typedef struct { /* PAST source */
mng_uint16 iSourceid;
mng_uint8 iComposition;
mng_uint8 iOrientation;
mng_uint8 iOffsettype;
mng_int32 iOffsetx;
mng_int32 iOffsety;
mng_uint8 iBoundarytype;
mng_int32 iBoundaryl;
mng_int32 iBoundaryr;
mng_int32 iBoundaryt;
mng_int32 iBoundaryb;
} mng_past_source;
typedef mng_past_source * mng_past_sourcep;
typedef struct { /* PAST */
mng_chunk_header sHeader;
mng_uint16 iDestid;
mng_uint8 iTargettype;
mng_int32 iTargetx;
mng_int32 iTargety;
mng_uint32 iCount;
mng_past_sourcep pSources;
} mng_past;
typedef mng_past * mng_pastp;
#endif
/* ************************************************************************** */
typedef struct { /* DISC */
mng_chunk_header sHeader;
mng_uint32 iCount;
mng_uint16p pObjectids;
} mng_disc;
typedef mng_disc * mng_discp;
/* ************************************************************************** */
typedef struct { /* BACK */
mng_chunk_header sHeader;
mng_uint16 iRed;
mng_uint16 iGreen;
mng_uint16 iBlue;
mng_uint8 iMandatory;
mng_uint16 iImageid;
mng_uint8 iTile;
} mng_back;
typedef mng_back * mng_backp;
/* ************************************************************************** */
typedef struct { /* FRAM */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_uint8 iMode;
mng_uint32 iNamesize;
mng_pchar zName;
mng_uint8 iChangedelay;
mng_uint8 iChangetimeout;
mng_uint8 iChangeclipping;
mng_uint8 iChangesyncid;
mng_uint32 iDelay;
mng_uint32 iTimeout;
mng_uint8 iBoundarytype;
mng_int32 iBoundaryl;
mng_int32 iBoundaryr;
mng_int32 iBoundaryt;
mng_int32 iBoundaryb;
mng_uint32 iCount;
mng_uint32p pSyncids;
} mng_fram;
typedef mng_fram * mng_framp;
/* ************************************************************************** */
typedef struct { /* MOVE */
mng_chunk_header sHeader;
mng_uint16 iFirstid;
mng_uint16 iLastid;
mng_uint8 iMovetype;
mng_int32 iMovex;
mng_int32 iMovey;
} mng_move;
typedef mng_move * mng_movep;
/* ************************************************************************** */
typedef struct { /* CLIP */
mng_chunk_header sHeader;
mng_uint16 iFirstid;
mng_uint16 iLastid;
mng_uint8 iCliptype;
mng_int32 iClipl;
mng_int32 iClipr;
mng_int32 iClipt;
mng_int32 iClipb;
} mng_clip;
typedef mng_clip * mng_clipp;
/* ************************************************************************** */
typedef struct { /* SHOW */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_uint16 iFirstid;
#ifdef MNG_OPTIMIZE_CHUNKREADER
mng_bool bHaslastid;
#endif
mng_uint16 iLastid;
mng_uint8 iMode;
} mng_show;
typedef mng_show * mng_showp;
/* ************************************************************************** */
typedef struct { /* TERM */
mng_chunk_header sHeader;
mng_uint8 iTermaction;
mng_uint8 iIteraction;
mng_uint32 iDelay;
mng_uint32 iItermax;
} mng_term;
typedef mng_term * mng_termp;
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_SAVE
typedef struct { /* SAVE entry */
mng_uint8 iEntrytype;
mng_uint32arr2 iOffset; /* 0=MSI, 1=LSI */
mng_uint32arr2 iStarttime; /* 0=MSI, 1=LSI */
mng_uint32 iLayernr;
mng_uint32 iFramenr;
mng_uint32 iNamesize;
mng_pchar zName;
} mng_save_entry;
typedef mng_save_entry * mng_save_entryp;
typedef struct { /* SAVE */
mng_chunk_header sHeader;
mng_bool bEmpty;
mng_uint8 iOffsettype;
mng_uint32 iCount;
mng_save_entryp pEntries;
} mng_save;
typedef mng_save * mng_savep;
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_SEEK
typedef struct { /* SEEK */
mng_chunk_header sHeader;
mng_uint32 iNamesize;
mng_pchar zName;
} mng_seek;
typedef mng_seek * mng_seekp;
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_eXPI
typedef struct { /* eXPI */
mng_chunk_header sHeader;
mng_uint16 iSnapshotid;
mng_uint32 iNamesize;
mng_pchar zName;
} mng_expi;
typedef mng_expi * mng_expip;
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_fPRI
typedef struct { /* fPRI */
mng_chunk_header sHeader;
mng_uint8 iDeltatype;
mng_uint8 iPriority;
} mng_fpri;
typedef mng_fpri * mng_fprip;
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_nEED
typedef struct { /* nEED */
mng_chunk_header sHeader;
mng_uint32 iKeywordssize;
mng_pchar zKeywords;
} mng_need;
typedef mng_need * mng_needp;
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_pHYg
typedef mng_phys mng_phyg; /* pHYg */
typedef mng_phyg * mng_phygp;
#endif
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG
typedef struct { /* JHDR */
mng_chunk_header sHeader;
mng_uint32 iWidth;
mng_uint32 iHeight;
mng_uint8 iColortype;
mng_uint8 iImagesampledepth;
mng_uint8 iImagecompression;
mng_uint8 iImageinterlace;
mng_uint8 iAlphasampledepth;
mng_uint8 iAlphacompression;
mng_uint8 iAlphafilter;
mng_uint8 iAlphainterlace;
} mng_jhdr;
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;
/* ************************************************************************** */
typedef struct { /* JSEP */
mng_chunk_header sHeader;
} mng_jsep;
typedef mng_jsep * mng_jsepp;
#endif /* MNG_INCLUDE_JNG */
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
typedef struct { /* DHDR */
mng_chunk_header sHeader;
mng_uint16 iObjectid;
mng_uint8 iImagetype;
mng_uint8 iDeltatype;
#ifdef MNG_OPTIMIZE_CHUNKREADER
mng_bool bHasblocksize;
#endif
mng_uint32 iBlockwidth;
mng_uint32 iBlockheight;
#ifdef MNG_OPTIMIZE_CHUNKREADER
mng_bool bHasblockloc;
#endif
mng_uint32 iBlockx;
mng_uint32 iBlocky;
} mng_dhdr;
typedef mng_dhdr * mng_dhdrp;
/* ************************************************************************** */
typedef struct { /* PROM */
mng_chunk_header sHeader;
mng_uint8 iColortype;
mng_uint8 iSampledepth;
mng_uint8 iFilltype;
} mng_prom;
typedef mng_prom * mng_promp;
/* ************************************************************************** */
typedef struct { /* IPNG */
mng_chunk_header sHeader;
} mng_ipng;
typedef mng_ipng *mng_ipngp;
/* ************************************************************************** */
typedef struct { /* PPLT entry */
mng_uint8 iRed;
mng_uint8 iGreen;
mng_uint8 iBlue;
mng_uint8 iAlpha;
mng_bool bUsed;
} mng_pplt_entry;
typedef mng_pplt_entry * mng_pplt_entryp;
typedef struct { /* PPLT */
mng_chunk_header sHeader;
mng_uint8 iDeltatype;
mng_uint32 iCount;
mng_pplt_entry aEntries [256];
} mng_pplt;
typedef mng_pplt * mng_ppltp;
/* ************************************************************************** */
typedef struct { /* IJNG */
mng_chunk_header sHeader;
} mng_ijng;
typedef mng_ijng *mng_ijngp;
/* ************************************************************************** */
typedef struct { /* DROP */
mng_chunk_header sHeader;
mng_uint32 iCount;
mng_chunkidp pChunknames;
} mng_drop;
typedef mng_drop * mng_dropp;
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_DBYK
typedef struct { /* DBYK */
mng_chunk_header sHeader;
mng_chunkid iChunkname;
mng_uint8 iPolarity;
mng_uint32 iKeywordssize;
mng_pchar zKeywords;
} mng_dbyk;
typedef mng_dbyk * mng_dbykp;
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_ORDR
typedef struct { /* ORDR entry */
mng_chunkid iChunkname;
mng_uint8 iOrdertype;
} mng_ordr_entry;
typedef mng_ordr_entry * mng_ordr_entryp;
typedef struct mng_ordr_struct { /* ORDR */
mng_chunk_header sHeader;
mng_uint32 iCount;
mng_ordr_entryp pEntries;
} mng_ordr;
typedef mng_ordr * mng_ordrp;
#endif
#endif /* MNG_NO_DELTA_PNG */
/* ************************************************************************** */
typedef struct { /* MAGN */
mng_chunk_header sHeader;
mng_uint16 iFirstid;
mng_uint16 iLastid;
mng_uint8 iMethodX;
mng_uint16 iMX;
mng_uint16 iMY;
mng_uint16 iML;
mng_uint16 iMR;
mng_uint16 iMT;
mng_uint16 iMB;
mng_uint8 iMethodY;
} mng_magn;
typedef mng_magn * mng_magnp;
/* ************************************************************************** */
typedef struct { /* evNT entry */
mng_uint8 iEventtype;
mng_uint8 iMasktype;
mng_int32 iLeft;
mng_int32 iRight;
mng_int32 iTop;
mng_int32 iBottom;
mng_uint16 iObjectid;
mng_uint8 iIndex;
mng_uint32 iSegmentnamesize;
mng_pchar zSegmentname;
} mng_evnt_entry;
typedef mng_evnt_entry * mng_evnt_entryp;
typedef struct { /* evNT */
mng_chunk_header sHeader;
mng_uint32 iCount;
mng_evnt_entryp pEntries;
} mng_evnt;
typedef mng_evnt * mng_evntp;
/* ************************************************************************** */
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
typedef struct { /* mpNG frame */
mng_uint32 iX;
mng_uint32 iY;
mng_uint32 iWidth;
mng_uint32 iHeight;
mng_int32 iXoffset;
mng_int32 iYoffset;
mng_uint16 iTicks;
} mng_mpng_frame;
typedef mng_mpng_frame * mng_mpng_framep;
typedef struct { /* mpNG */
mng_chunk_header sHeader;
mng_uint32 iFramewidth;
mng_uint32 iFrameheight;
mng_uint16 iNumplays;
mng_uint16 iTickspersec;
mng_uint8 iCompressionmethod;
mng_uint32 iFramessize;
mng_mpng_framep pFrames;
} mng_mpng;
typedef mng_mpng * mng_mpngp;
#endif
/* ************************************************************************** */
#ifdef MNG_INCLUDE_ANG_PROPOSAL
typedef struct { /* ahDR */
mng_chunk_header sHeader;
mng_uint32 iNumframes;
mng_uint32 iTickspersec;
mng_uint32 iNumplays;
mng_uint32 iTilewidth;
mng_uint32 iTileheight;
mng_uint8 iInterlace;
mng_uint8 iStillused;
} mng_ahdr;
typedef mng_ahdr * mng_ahdrp;
typedef struct { /* adAT tile */
mng_uint32 iTicks;
mng_int32 iXoffset;
mng_int32 iYoffset;
mng_uint8 iTilesource;
} mng_adat_tile;
typedef mng_adat_tile * mng_adat_tilep;
typedef struct { /* adAT */
mng_chunk_header sHeader;
mng_uint32 iTilessize;
mng_adat_tilep pTiles;
} mng_adat;
typedef mng_adat * mng_adatp;
#endif
/* ************************************************************************** */
typedef struct { /* unknown chunk */
mng_chunk_header sHeader;
mng_uint32 iDatasize;
mng_ptr pData;
} mng_unknown_chunk;
typedef mng_unknown_chunk * mng_unknown_chunkp;
/* ************************************************************************** */
#endif /* _libmng_chunks_h_ */
/* ************************************************************************** */
/* * end of file * */
/* ************************************************************************** */
libmng-2.0.3/stamp-h1 0000644 0001750 0001750 00000000027 12115373260 014234 0 ustar glennrp glennrp timestamp for config.h
libmng-2.0.3/libmng_pixels.c 0000644 0001750 0001750 00003100301 12005307152 015651 0 ustar glennrp glennrp #include "config.h"
/* ************************************************************************** */
/* * For conditions of distribution and use, * */
/* * see copyright notice in libmng.h * */
/* ************************************************************************** */
/* * * */
/* * project : libmng * */
/* * file : libmng_pixels.c copyright (c) 2000-2005 G.Juyn * */
/* * version : 1.0.10 * */
/* * * */
/* * purpose : Pixel-row management routines (implementation) * */
/* * * */
/* * author : G.Juyn * */
/* * * */
/* * comment : implementation of the pixel-row management routines * */
/* * * */
/* * the dual alpha-composing for RGBA/BGRA/etc output-canvas' * */
/* * is based on the Note on Compositing chapter of the * */
/* * DOH-3 draft, noted to me by Adam M. Costello * */
/* * * */
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
/* * - changed strict-ANSI stuff * */
/* * 0.5.1 - 05/11/2000 - G.Juyn * */
/* * - added callback error-reporting support * */
/* * 0.5.1 - 05/12/2000 - G.Juyn * */
/* * - changed trace to macro for callback error-reporting * */
/* * * */
/* * 0.5.2 - 05/22/2000 - G.Juyn * */
/* * - added JNG support * */
/* * 0.5.2 - 05/30/2000 - G.Juyn * */
/* * - fixed minor bugs 16-bit pixel-handling * */
/* * - added delta-image row-processing routines * */
/* * 0.5.2 - 06/02/2000 - G.Juyn * */
/* * - fixed endian support (hopefully) * */
/* * 0.5.2 - 06/03/2000 - G.Juyn * */
/* * - fixed makeup for Linux gcc compile * */
/* * 0.5.2 - 06/05/2000 - G.Juyn * */
/* * - implemented app bkgd restore routines * */
/* * - implemented RGBA8, ARGB8, BGRA8 & ABGR8 display routines * */
/* * - added support for RGB8_A8 canvasstyle * */
/* * 0.5.2 - 06/09/2000 - G.Juyn * */
/* * - fixed alpha-handling for alpha canvasstyles * */
/* * * */
/* * 0.5.3 - 06/16/2000 - G.Juyn * */
/* * - changed progressive-display processing * */
/* * 0.5.3 - 06/17/2000 - G.Juyn * */
/* * - changed to support delta-images * */
/* * - optimized some store_xxx routines * */
/* * 0.5.3 - 06/20/2000 - G.Juyn * */
/* * - fixed nasty bug with embedded PNG after delta-image * */
/* * 0.5.3 - 06/24/2000 - G.Juyn * */
/* * - fixed problem with 16-bit GA format * */
/* * 0.5.3 - 06/25/2000 - G.Juyn * */
/* * - fixed problem with cheap transparency for 4-bit gray * */
/* * - fixed display_xxxx routines for interlaced images * */
/* * 0.5.3 - 06/28/2000 - G.Juyn * */
/* * - fixed compiler-warning for non-initialized iB variable * */
/* * * */
/* * 0.9.1 - 07/05/2000 - G.Juyn * */
/* * - fixed mandatory BACK color to be opaque * */
/* * * */
/* * 0.9.2 - 07/31/2000 - G.Juyn * */
/* * - B110547 - fixed bug in interlace code * */
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - changed file-prefixes * */
/* * * */
/* * 0.9.3 - 08/20/2000 - G.Juyn * */
/* * - fixed app-supplied background restore * */
/* * 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/30/2000 - G.Juyn * */
/* * - fixed MAGN rounding errors (thanks Matthias!) * */
/* * 0.9.3 - 10/10/2000 - G.Juyn * */
/* * - fixed alpha-blending for RGBA canvasstyle * */
/* * 0.9.3 - 10/11/2000 - G.Juyn * */
/* * - fixed alpha-blending for other alpha-canvasstyles * */
/* * 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 * */
/* * - fixed support for bKGD * */
/* * 0.9.3 - 10/19/2000 - G.Juyn * */
/* * - implemented delayed delta-processing * */
/* * 0.9.3 - 10/28/2000 - G.Juyn * */
/* * - fixed tRNS processing for gray-image < 8-bits * */
/* * * */
/* * 0.9.4 - 12/16/2000 - G.Juyn * */
/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */
/* * 0.9.4 - 1/18/2001 - G.Juyn * */
/* * - removed "old" MAGN methods 3 & 4 * */
/* * - 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 * */
/* * * */
/* * 1.0.2 - 06/25/2001 - G.Juyn * */
/* * - added option to turn off progressive refresh * */
/* * * */
/* * 1.0.4 - 11/04/2001 - G.Juyn * */
/* * - fixed possible compile-problem in cleanup_rowproc * */
/* * 1.0.4 - 06/22/2002 - G.Juyn * */
/* * - B558212 - off by one error * */
/* * - MNG subimage alpha composite wrong for rgba8 images * */
/* * * */
/* * 1.0.5 - 08/07/2002 - G.Juyn * */
/* * - added test-option for PNG filter method 193 (=no filter) * */
/* * 1.0.5 - 08/15/2002 - G.Juyn * */
/* * - completed PROM support * */
/* * - completed delta-image support * */
/* * 1.0.5 - 08/16/2002 - G.Juyn * */
/* * - completed MAGN support (16-bit functions) * */
/* * 1.0.5 - 08/19/2002 - G.Juyn * */
/* * - B597134 - libmng pollutes the linker namespace * */
/* * 1.0.5 - 09/19/2002 - G.Juyn * */
/* * - optimized restore-background for bKGD cases * */
/* * 1.0.5 - 09/20/2002 - G.Juyn * */
/* * - finished support for BACK image & tiling * */
/* * 1.0.5 - 09/22/2002 - G.Juyn * */
/* * - added bgrx8 canvas (filler byte) * */
/* * 1.0.5 - 09/23/2002 - G.Juyn * */
/* * - added compose over/under routines for PAST processing * */
/* * - added flip & tile routines for PAST processing * */
/* * * */
/* * 1.0.6 - 03/09/2003 - G.Juyn * */
/* * - hiding 12-bit JPEG stuff * */
/* * 1.0.6 - 05/11/2003 - Glenn RP * */
/* * - added size-optimization COMPOSE routine usage * */
/* * 1.0.6 - 05/11/2003 - G. Juyn * */
/* * - added conditionals around canvas update routines * */
/* * 1.0.6 - 05/25/2003 - Glenn RP * */
/* * - added size-optimization DIV255B8 routine usage * */
/* * 1.0.6 - 06/09/2003 - G. R-P * */
/* * - added conditionals around 8-bit magn routines * */
/* * 1.0.6 - 07/07/2003 - G. R-P * */
/* * - removed conditionals around 8-bit magn routines * */
/* * - added MNG_NO_16BIT_SUPPORT and MNG_NO_DELTA_PNG * */
/* * conditionals * */
/* * - reversed many loops to use decrementing counter * */
/* * - combined init functions * */
/* * - converted some switches to array references * */
/* * 1.0.6 - 07/29/2003 - G.Juyn * */
/* * - fixed duplicate for-loop * */
/* * 1.0.6 - 07/29/2003 - G.R-P * */
/* * - added SKIPCHUNK conditionals around PAST chunk support * */
/* * - fixed "FOOTPRINT_COMPOSEIV" typo (now "FOOTPRINT_DIV") * */
/* * 1.0.6 - 08/17/2003 - G.R-P * */
/* * - added more conditionals around "promote" functions * */
/* * * */
/* * 1.0.7 - 11/27/2003 - R.A * */
/* * - added CANVAS_RGB565 and CANVAS_BGR565 * */
/* * 1.0.7 - 12/06/2003 - R.A * */
/* * - added CANVAS_RGBA565 and CANVAS_BGRA565 * */
/* * 1.0.7 - 01/25/2004 - J.S * */
/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */
/* * 1.0.7 - 03/08/2004 - G.R-P * */
/* * - added more conditionals around 16-bit-supporting code * */
/* * 1.0.7 - 03/09/2004 - G.Juyn * */
/* * - fixed bug in promote_g8_g8 with 16bit support off * */
/* * 1.0.7 - 03/09/2004 - G.R-P * */
/* * - more optimizations with 16bit support off * */
/* * 1.0.7 - 03/10/2004 - G.Juyn * */
/* * - fixed some warnings for 16bit optimizations * */
/* * 1.0.7 - 03/21/2004 - G.Juyn * */
/* * - fixed some 64-bit platform compiler warnings * */
/* * * */
/* * 1.0.8 - 06/20/2004 - G.Juyn * */
/* * - some speed optimizations (thanks to John Stiles) * */
/* * 1.0.8 - 08/01/2004 - G.Juyn * */
/* * - added support for 3+byte pixelsize for JPEG's * */
/* * * */
/* * 1.0.9 - 10/10/2004 - G.R-P. * */
/* * - added MNG_NO_1_2_4BIT_SUPPORT * */
/* * 1.0.9 - 10/14/2004 - G.Juyn * */
/* * - added bgr565_a8 canvas-style (thanks to J. Elvander) * */
/* * 1.0.9 - 12/05/2004 - G.Juyn * */
/* * - added LITTLEENDIAN/BIGENDIAN fixtures (thanks J.Stiles) * */
/* * - fixed MNG_NO_1_2_4BIT_SUPPORT for TBBN1G04.PNG * */
/* * 1.0.9 - 12/31/2004 - G.R-P. * */
/* * - fixed warnings about C++ style (//) comments * */
/* * * */
/* * 1.0.10 - 07/06/2005 - G.R-P. * */
/* * - added MORE MNG_NO_1_2_4BIT_SUPPORT * */
/* * 1.0.10 - 10/06/2005 - G.R-P. * */
/* * - alloc more memory for MNG_NO_1_2_4BIT_SUPPORT * */
/* * 1.0.10 - 12/07/2005 - G.R-P. * */
/* * - optimized footprint of 16bit support * */
/* * 1.0.10 - 03/07/2006 - (thanks to W. Manthey) * */
/* * - added CANVAS_RGB555 and CANVAS_BGR555 * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
#include "libmng_data.h"
#include "libmng_error.h"
#include "libmng_trace.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "libmng_objects.h"
#include "libmng_object_prc.h"
#include "libmng_memory.h"
#include "libmng_cms.h"
#include "libmng_filter.h"
#include "libmng_pixels.h"
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
#pragma option -A /* force ANSI-C */
#endif
/* ************************************************************************** */
#ifdef MNG_INCLUDE_DISPLAY_PROCS
/* TODO: magnification & canvas-positioning/-clipping */
/* TODO: major optimization of pixel-loops by using assembler (?) */
/* ************************************************************************** */
/* * * */
/* * Interlace tables * */
/* * * */
/* ************************************************************************** */
MNG_LOCAL mng_uint32 const interlace_row [7] = { 0, 0, 4, 0, 2, 0, 1 };
MNG_LOCAL mng_uint32 const interlace_rowskip [7] = { 8, 8, 8, 4, 4, 2, 2 };
MNG_LOCAL mng_uint32 const interlace_col [7] = { 0, 4, 0, 2, 0, 1, 0 };
MNG_LOCAL mng_uint32 const interlace_colskip [7] = { 8, 8, 4, 4, 2, 2, 1 };
MNG_LOCAL mng_uint32 const interlace_roundoff [7] = { 7, 7, 3, 3, 1, 1, 0 };
MNG_LOCAL mng_uint32 const interlace_divider [7] = { 3, 3, 2, 2, 1, 1, 0 };
/* ************************************************************************** */
/* * * */
/* * Alpha composing macros * */
/* * the code below is slightly modified from the libpng package * */
/* * the original was last optimized by Greg Roelofs & Mark Adler * */
/* * * */
/* ************************************************************************** */
#define MNG_COMPOSE8(RET,FG,ALPHA,BG) { \
mng_uint16 iH = (mng_uint16)((mng_uint16)(FG) * (mng_uint16)(ALPHA) \
+ (mng_uint16)(BG)*(mng_uint16)(255 - \
(mng_uint16)(ALPHA)) + (mng_uint16)128); \
(RET) = (mng_uint8)((iH + (iH >> 8)) >> 8); }
#define MNG_COMPOSE16(RET,FG,ALPHA,BG) { \
mng_uint32 iH = (mng_uint32)((mng_uint32)(FG) * (mng_uint32)(ALPHA) \
+ (mng_uint32)(BG)*(mng_uint32)(65535L - \
(mng_uint32)(ALPHA)) + (mng_uint32)32768L); \
(RET) = (mng_uint16)((iH + (iH >> 16)) >> 16); }
/* ************************************************************************** */
/* * * */
/* * Alpha blending macros * */
/* * this code is based on Adam Costello's "Note on Compositing" from the * */
/* * mng-list which gives the following formula: * */
/* * * */
/* * top pixel = (Rt, Gt, Bt, At) * */
/* * bottom pixel = (Rb, Gb, Bb, Ab) * */
/* * composite pixel = (Rc, Gc, Bc, Ac) * */
/* * * */
/* * all values in the range 0..1 * */
/* * * */
/* * Ac = 1 - (1 - At)(1 - Ab) * */
/* * s = At / Ac * */
/* * t = (1 - At) Ab / Ac * */
/* * Rc = s Rt + t Rb * */
/* * Gc = s Gt + t Gb * */
/* * Bc = s Bt + t Bb * */
/* * * */
/* * (I just hope I coded it correctly in integer arithmetic...) * */
/* * * */
/* ************************************************************************** */
#define MNG_BLEND8(RT, GT, BT, AT, RB, GB, BB, AB, RC, GC, BC, AC) { \
mng_uint32 S, T; \
(AC) = (mng_uint8)((mng_uint32)255 - \
((((mng_uint32)255 - (mng_uint32)(AT)) * \
((mng_uint32)255 - (mng_uint32)(AB)) ) >> 8)); \
S = (mng_uint32)(((mng_uint32)(AT) << 8) / \
(mng_uint32)(AC)); \
T = (mng_uint32)(((mng_uint32)255 - (mng_uint32)(AT)) * \
(mng_uint32)(AB) / (mng_uint32)(AC)); \
(RC) = (mng_uint8)((S * (mng_uint32)(RT) + \
T * (mng_uint32)(RB) + (mng_uint32)127) >> 8); \
(GC) = (mng_uint8)((S * (mng_uint32)(GT) + \
T * (mng_uint32)(GB) + (mng_uint32)127) >> 8); \
(BC) = (mng_uint8)((S * (mng_uint32)(BT) + \
T * (mng_uint32)(BB) + (mng_uint32)127) >> 8); }
#define MNG_BLEND16(RT, GT, BT, AT, RB, GB, BB, AB, RC, GC, BC, AC) { \
mng_uint32 S, T; \
(AC) = (mng_uint16)((mng_uint32)65535 - \
((((mng_uint32)65535 - (mng_uint32)(AT)) * \
((mng_uint32)65535 - (mng_uint32)(AB)) ) >> 16)); \
S = (mng_uint32)(((mng_uint32)(AT) << 16) / \
(mng_uint32)(AC)); \
T = (mng_uint32)(((mng_uint32)65535 - (mng_uint32)(AT)) * \
(mng_uint32)(AB) / (mng_uint32)(AC)); \
(RC) = (mng_uint16)((S * (mng_uint32)(RT) + \
T * (mng_uint32)(RB) + (mng_uint32)32767) >> 16); \
(GC) = (mng_uint16)((S * (mng_uint32)(GT) + \
T * (mng_uint32)(GB) + (mng_uint32)32767) >> 16); \
(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 * */
/* * in order & indicates so * */
/* * * */
/* * The routine is called after a call to one of the display_xxx routines * */
/* * if appropriate * */
/* * * */
/* * The refresh is warrented in the read_chunk routine (mng_read.c) * */
/* * and only during read&display processing, since there's not much point * */
/* * doing it from memory! * */
/* * * */
/* ************************************************************************** */
mng_retcode mng_display_progressive_check (mng_datap pData)
{
if ((pData->bDoProgressive) && /* need progressive display? */
((pData->eImagetype != mng_it_mng) || (pData->iDataheight > 300)) &&
(pData->iDestb - pData->iDestt > 50) && (!pData->pCurraniobj))
{
mng_int32 iC = pData->iRow + pData->iDestt - pData->iSourcet;
if (iC % 20 == 0) /* every 20th line */
pData->bNeedrefresh = MNG_TRUE;
}
return MNG_NOERROR;
}
/* ************************************************************************** */
/* * * */
/* * Display routines - convert rowdata (which is already color-corrected) * */
/* * to the output canvas, respecting the opacity information * */
/* * * */
/* ************************************************************************** */
MNG_LOCAL void check_update_region (mng_datap pData)
{ /* determine actual canvas row */
mng_int32 iRow = pData->iRow + pData->iDestt - pData->iSourcet;
/* check for change in update-region */
if ((pData->iDestl < (mng_int32)pData->iUpdateleft) || (pData->iUpdateright == 0))
pData->iUpdateleft = pData->iDestl;
if (pData->iDestr > (mng_int32)pData->iUpdateright)
pData->iUpdateright = pData->iDestr;
if ((iRow < (mng_int32)pData->iUpdatetop) || (pData->iUpdatebottom == 0))
pData->iUpdatetop = iRow;
if (iRow+1 > (mng_int32)pData->iUpdatebottom)
pData->iUpdatebottom = iRow+1;
return;
}
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_RGB8
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
mng_retcode mng_display_rgb8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint16 iA16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint8 iA8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8, 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 * 3) + (pData->iDestl * 3);
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 */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *(pDataline+4);
pScanline += (pData->iColinc * 3);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *(pDataline+2);
pScanline += (pData->iColinc * 3);
pDataline += 4;
}
}
}
else
{
if (pData->bIsRGBA16) /* 16-bit input row ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA16 = mng_get_uint16 (pDataline+6);
if (iA16) /* any opacity at all ? */
{
if (iA16 == 0xFFFF) /* fully opaque ? */
{ /* scale down by dropping the LSB */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *(pDataline+4);
}
else
{ /* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGr16 = (mng_uint16)(*pScanline );
iBGg16 = (mng_uint16)(*(pScanline+1));
iBGb16 = (mng_uint16)(*(pScanline+2));
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16);
/* and return the composed values */
*pScanline = (mng_uint8)(iFGr16 >> 8);
*(pScanline+1) = (mng_uint8)(iFGg16 >> 8);
*(pScanline+2) = (mng_uint8)(iFGb16 >> 8);
}
}
pScanline += (pData->iColinc * 3);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *(pDataline+2);
}
else
{ /* do alpha composing */
MNG_COMPOSE8 (*pScanline, *pDataline, iA8, *pScanline );
MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iA8, *(pScanline+1));
MNG_COMPOSE8 (*(pScanline+2), *(pDataline+2), iA8, *(pScanline+2));
}
}
pScanline += (pData->iColinc * 3);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
mng_retcode mng_display_rgb8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint16 iA16;
mng_uint16 iFGg16;
mng_uint16 iBGg16;
mng_uint8 iA8;
mng_uint8 iBps;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8, MNG_LC_START);
#endif
iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1);
/* 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 * 3) + (pData->iDestl * 3);
pDataline = pData->pRGBArow; /* address source row */
/* adjust source row starting-point */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1));
if (pData->bIsOpaque) /* forget about transparency ? */
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* scale down by dropping the LSB */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+iBps);
*(pScanline+2) = *(pDataline+2*iBps);
pScanline += (pData->iColinc * 3);
pDataline += 4*iBps;
}
}
}
else
{
if (pData->bIsRGBA16) /* 16-bit input row ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA16 = mng_get_uint16 (pDataline+6);
if (iA16) /* any opacity at all ? */
{
if (iA16 == 0xFFFF) /* fully opaque ? */
{ /* scale down by dropping the LSB */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *(pDataline+4);
}
else
{ /* get the proper values */
int i;
for (i=2; i >= 0; i--)
{
iFGg16 = mng_get_uint16 (pDataline+i+i);
/* scale background up */
iBGg16 = (mng_uint16)(*(pScanline+i));
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
/* now compose */
MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16);
/* and return the composed values */
*(pScanline+i) = (mng_uint8)(iFGg16 >> 8);
}
}
}
pScanline += (pData->iColinc * 3);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *(pDataline+2);
}
else
{ /* do alpha composing */
int i;
for (i=2; i >= 0; i--)
{
MNG_COMPOSE8 (*(pScanline+i), *(pDataline+i), iA8, *(pScanline+i));
}
}
}
pScanline += (pData->iColinc * 3);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
#else /* MNG_NO_16BIT_SUPPORT */
mng_retcode mng_display_rgb8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iA8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8, 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 * 3) + (pData->iDestl * 3);
pDataline = pData->pRGBArow; /* address source row */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2);
if (pData->bIsOpaque) /* forget about transparency ? */
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *(pDataline+2);
pScanline += (pData->iColinc * 3);
pDataline += 4;
}
}
}
else
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *(pDataline+2);
}
else
{ /* do alpha composing */
#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
int i;
for (i=2; i >= 0; i--)
{
MNG_COMPOSE8 (*(pScanline+i), *(pDataline+i), iA8, *(pScanline+i));
}
#else
MNG_COMPOSE8 (*pScanline, *pDataline, iA8, *pScanline );
MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iA8, *(pScanline+1));
MNG_COMPOSE8 (*(pScanline+2), *(pDataline+2), iA8, *(pScanline+2));
#endif
}
}
pScanline += (pData->iColinc * 3);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_16BIT_SUPPORT */
#endif /* MNG_SKIPCANVAS_RGB8 */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_RGBA8
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
mng_retcode mng_display_rgba8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint16 iFGa16, iBGa16, iCa16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint16 iCr16, iCg16, iCb16;
mng_uint8 iCr8, iCg8, iCb8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8, 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 */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *(pDataline+4);
*(pScanline+3) = *(pDataline+6);
pScanline += (pData->iColinc << 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *(pDataline+2);
*(pScanline+3) = *(pDataline+3);
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 */
iFGa16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*(pScanline+3));
iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16;
if (iFGa16) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa16 == 0xFFFF) || (iBGa16 == 0))
{ /* plain copy it */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *(pDataline+4);
*(pScanline+3) = *(pDataline+6);
}
else
{
if (iBGa16 == 0xFFFF) /* background fully opaque ? */
{ /* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGr16 = (mng_uint16)(*pScanline );
iBGg16 = (mng_uint16)(*(pScanline+1));
iBGb16 = (mng_uint16)(*(pScanline+2));
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16);
/* and return the composed values */
*pScanline = (mng_uint8)(iFGr16 >> 8);
*(pScanline+1) = (mng_uint8)(iFGg16 >> 8);
*(pScanline+2) = (mng_uint8)(iFGb16 >> 8);
/* alpha remains fully opaque !!! */
}
else
{ /* scale background up */
iBGr16 = (mng_uint16)(*pScanline );
iBGg16 = (mng_uint16)(*(pScanline+1));
iBGb16 = (mng_uint16)(*(pScanline+2));
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* let's blend */
MNG_BLEND16 (mng_get_uint16 (pDataline ),
mng_get_uint16 (pDataline+2),
mng_get_uint16 (pDataline+4), iFGa16,
iBGr16, iBGg16, iBGb16, iBGa16,
iCr16, iCg16, iCb16, iCa16);
/* and return the composed values */
*pScanline = (mng_uint8)(iCr16 >> 8);
*(pScanline+1) = (mng_uint8)(iCg16 >> 8);
*(pScanline+2) = (mng_uint8)(iCb16 >> 8);
*(pScanline+3) = (mng_uint8)(iCa16 >> 8);
}
}
}
pScanline += (pData->iColinc << 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *(pScanline+3);
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *(pDataline+2);
*(pScanline+3) = *(pDataline+3);
}
else
{
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do alpha composing */
MNG_COMPOSE8 (*pScanline, *pDataline, iFGa8, *pScanline );
MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iFGa8, *(pScanline+1));
MNG_COMPOSE8 (*(pScanline+2), *(pDataline+2), iFGa8, *(pScanline+2));
/* alpha remains fully opaque !!! */
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
*pScanline, *(pScanline+1), *(pScanline+2), iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = iCr8;
*(pScanline+1) = iCg8;
*(pScanline+2) = iCb8;
*(pScanline+3) = iCa8;
}
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
mng_retcode mng_display_rgba8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint16 iFGa16, iBGa16, iCa16;
mng_uint16 iFGg16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint16 iCr16, iCg16, iCb16;
mng_uint8 iCr8, iCg8, iCb8;
mng_uint8 iBps;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8, MNG_LC_START);
#endif
iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1);
/* 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 */
/* adjust source row starting-point */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1));
if (pData->bIsOpaque) /* forget about transparency ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* scale down by dropping the LSB */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+iBps);
*(pScanline+2) = *(pDataline+2*iBps);
*(pScanline+3) = *(pDataline+3*iBps);
pScanline += (pData->iColinc << 2);
pDataline += 4*iBps;
}
}
else
{
if (pData->bIsRGBA16) /* 16-bit input row ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* get alpha values */
iFGa16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*(pScanline+3));
iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16;
if (iFGa16) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa16 == 0xFFFF) || (iBGa16 == 0))
{ /* plain copy it */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *(pDataline+4);
*(pScanline+3) = *(pDataline+6);
}
else
{
if (iBGa16 == 0xFFFF) /* background fully opaque ? */
{ /* get the proper values */
int i;
for (i=2; i >= 0; i--)
{
iFGg16 = mng_get_uint16 (pDataline+i+i);
/* scale background up */
iBGg16 = (mng_uint16)(*(pScanline+i));
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
/* now compose */
MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16);
/* and return the composed values */
*(pScanline+i) = (mng_uint8)(iFGg16 >> 8);
/* alpha remains fully opaque !!! */
}
}
else
{ /* scale background up */
iBGr16 = (mng_uint16)(*pScanline );
iBGg16 = (mng_uint16)(*(pScanline+1));
iBGb16 = (mng_uint16)(*(pScanline+2));
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* let's blend */
MNG_BLEND16 (mng_get_uint16 (pDataline ),
mng_get_uint16 (pDataline+2),
mng_get_uint16 (pDataline+4), iFGa16,
iBGr16, iBGg16, iBGb16, iBGa16,
iCr16, iCg16, iCb16, iCa16);
/* and return the composed values */
*pScanline = (mng_uint8)(iCr16 >> 8);
*(pScanline+1) = (mng_uint8)(iCg16 >> 8);
*(pScanline+2) = (mng_uint8)(iCb16 >> 8);
*(pScanline+3) = (mng_uint8)(iCa16 >> 8);
}
}
}
pScanline += (pData->iColinc << 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *(pScanline+3);
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *(pDataline+2);
*(pScanline+3) = *(pDataline+3);
}
else
{
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do alpha composing */
int i;
for (i=2; i >= 0; i--)
{
MNG_COMPOSE8 (*(pScanline+i), *(pDataline+i), iFGa8, *(pScanline+i));
}
/* alpha remains fully opaque !!! */
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
*pScanline, *(pScanline+1), *(pScanline+2), iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = iCr8;
*(pScanline+1) = iCg8;
*(pScanline+2) = iCb8;
*(pScanline+3) = iCa8;
}
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
#else /* MNG_NO_16BIT_SUPPORT */
mng_retcode mng_display_rgba8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint8 iCr8, iCg8, iCb8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8, 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 */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2);
if (pData->bIsOpaque) /* forget about transparency ? */
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *(pDataline+2);
*(pScanline+3) = *(pDataline+3);
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
else
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *(pScanline+3);
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *(pDataline+2);
*(pScanline+3) = *(pDataline+3);
}
else
{
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do alpha composing */
#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
int i;
for (i=2; i >= 0; i--)
{
MNG_COMPOSE8 (*(pScanline+i), *(pDataline+i), iFGa8, *(pScanline+i));
}
#else
MNG_COMPOSE8 (*pScanline, *pDataline, iFGa8, *pScanline );
MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iFGa8, *(pScanline+1));
MNG_COMPOSE8 (*(pScanline+2), *(pDataline+2), iFGa8, *(pScanline+2));
#endif
/* alpha remains fully opaque !!! */
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
*pScanline, *(pScanline+1), *(pScanline+2), iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = iCr8;
*(pScanline+1) = iCg8;
*(pScanline+2) = iCb8;
*(pScanline+3) = iCa8;
}
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_16BIT_SUPPORT */
#endif /* MNG_SKIPCANVAS_RGBA8 */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_RGBA8_PM
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
mng_retcode mng_display_rgba8_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_RGBA8_PM, 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[0];
pScanline[1] = pDataline[2];
pScanline[2] = pDataline[4];
pScanline[3] = 255;
}
else
{
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
int i;
for (i=2; i >= 0; i--)
{
pScanline[2-i] = DIV255B8(s * pDataline[4-i-i]);
}
#else
pScanline[0] = DIV255B8(s * pDataline[0]);
pScanline[1] = DIV255B8(s * pDataline[2]);
pScanline[2] = DIV255B8(s * pDataline[4]);
#endif
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)
{
#ifdef MNG_BIGENDIAN_SUPPORTED
*(mng_uint32*)pScanline = (*(mng_uint32*)pDataline) | 0x000000FF;
#else
pScanline[0] = pDataline[0];
pScanline[1] = pDataline[1];
pScanline[2] = pDataline[2];
pScanline[3] = 255;
#endif
}
else
{
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
int i;
for (i=2; i >= 0; i--)
{
pScanline[2-i] = DIV255B8(s * pDataline[2-i]);
}
#else
pScanline[0] = DIV255B8(s * pDataline[0]);
pScanline[1] = DIV255B8(s * pDataline[1]);
pScanline[2] = DIV255B8(s * pDataline[2]);
#endif
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[0];
pScanline[1] = pDataline[2];
pScanline[2] = pDataline[4];
pScanline[3] = 255;
}
else
{ /* now blend (premultiplied) */
t = 255 - s;
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[2-i] = DIV255B8(s * pDataline[4-i-i] + t *
pScanline[2-i]);
}
}
#else
pScanline[0] = DIV255B8(s * pDataline[0] + t * pScanline[0]);
pScanline[1] = DIV255B8(s * pDataline[2] + t * pScanline[1]);
pScanline[2] = DIV255B8(s * pDataline[4] + t * pScanline[2]);
#endif
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 */
#ifdef MNG_BIGENDIAN_SUPPORTED
*(mng_uint32*)pScanline = (*(mng_uint32*)pDataline) | 0x000000FF;
#else
pScanline[0] = pDataline[0];
pScanline[1] = pDataline[1];
pScanline[2] = pDataline[2];
pScanline[3] = 255;
#endif
}
else
{ /* now blend (premultiplied) */
t = 255 - s;
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[2-i] = DIV255B8(s * pDataline[2-i] + t *
pScanline[2-i]);
}
}
#else
pScanline[0] = DIV255B8(s * pDataline[0] + t * pScanline[0]);
pScanline[1] = DIV255B8(s * pDataline[1] + t * pScanline[1]);
pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]);
#endif
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_RGBA8_PM, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
mng_retcode mng_display_rgba8_pm (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint32 s, t;
mng_uint8 iBps;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8_PM, MNG_LC_START);
#endif
iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1);
/* 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 */
/* adjust source row starting-point */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1));
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[0];
pScanline[1] = pDataline[2];
pScanline[2] = pDataline[4];
pScanline[3] = 255;
}
else
{
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
int i;
for (i=2; i >= 0; i--)
{
pScanline[2-i] = DIV255B8(s * pDataline[4-i-i]);
}
#else
pScanline[0] = DIV255B8(s * pDataline[0]);
pScanline[1] = DIV255B8(s * pDataline[2]);
pScanline[2] = DIV255B8(s * pDataline[4]);
#endif
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)
{
#ifdef MNG_BIGENDIAN_SUPPORTED
*(mng_uint32*)pScanline = (*(mng_uint32*)pDataline) | 0x000000FF;
#else
pScanline[0] = pDataline[0];
pScanline[1] = pDataline[1];
pScanline[2] = pDataline[2];
pScanline[3] = 255;
#endif
}
else
{
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
int i;
for (i=2; i >= 0; i--)
{
pScanline[2-i] = DIV255B8(s * pDataline[2-i]);
}
#else
pScanline[0] = DIV255B8(s * pDataline[0]);
pScanline[1] = DIV255B8(s * pDataline[1]);
pScanline[2] = DIV255B8(s * pDataline[2]);
#endif
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[0];
pScanline[1] = pDataline[2];
pScanline[2] = pDataline[4];
pScanline[3] = 255;
}
else
{ /* now blend (premultiplied) */
t = 255 - s;
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[2-i] = DIV255B8(s * pDataline[4-i-i] + t *
pScanline[2-i]);
}
}
#else
pScanline[0] = DIV255B8(s * pDataline[0] + t * pScanline[0]);
pScanline[1] = DIV255B8(s * pDataline[2] + t * pScanline[1]);
pScanline[2] = DIV255B8(s * pDataline[4] + t * pScanline[2]);
#endif
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 */
#ifdef MNG_BIGENDIAN_SUPPORTED
*(mng_uint32*)pScanline = (*(mng_uint32*)pDataline) | 0x000000FF;
#else
pScanline[0] = pDataline[0];
pScanline[1] = pDataline[1];
pScanline[2] = pDataline[2];
pScanline[3] = 255;
#endif
}
else
{ /* now blend (premultiplied) */
t = 255 - s;
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[2-i] = DIV255B8(s * pDataline[2-i] + t *
pScanline[2-i]);
}
}
#else
pScanline[0] = DIV255B8(s * pDataline[0] + t * pScanline[0]);
pScanline[1] = DIV255B8(s * pDataline[1] + t * pScanline[1]);
pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]);
#endif
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_RGBA8_PM, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
#else /* MNG_NO_16BIT_SUPPORT */
mng_retcode mng_display_rgba8_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_RGBA8_PM, 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 */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2);
if (pData->bIsOpaque) /* forget about transparency ? */
{
{
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)
{
#ifdef MNG_BIGENDIAN_SUPPORTED
*(mng_uint32*)pScanline = (*(mng_uint32*)pDataline) | 0x000000FF;
#else
pScanline[0] = pDataline[0];
pScanline[1] = pDataline[1];
pScanline[2] = pDataline[2];
pScanline[3] = 255;
#endif
}
else
{
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
int i;
for (i=2; i >= 0; i--)
{
pScanline[2-i] = DIV255B8(s * pDataline[2-i]);
}
#else
pScanline[0] = DIV255B8(s * pDataline[0]);
pScanline[1] = DIV255B8(s * pDataline[1]);
pScanline[2] = DIV255B8(s * pDataline[2]);
#endif
pScanline[3] = (mng_uint8)s;
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
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 */
#ifdef MNG_BIGENDIAN_SUPPORTED
*(mng_uint32*)pScanline = (*(mng_uint32*)pDataline) | 0x000000FF;
#else
pScanline[0] = pDataline[0];
pScanline[1] = pDataline[1];
pScanline[2] = pDataline[2];
pScanline[3] = 255;
#endif
}
else
{ /* now blend (premultiplied) */
t = 255 - s;
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[2-i] = DIV255B8(s * pDataline[2-i] + t *
pScanline[2-i]);
}
}
#else
pScanline[0] = DIV255B8(s * pDataline[0] + t * pScanline[0]);
pScanline[1] = DIV255B8(s * pDataline[1] + t * pScanline[1]);
pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]);
#endif
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_RGBA8_PM, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_16BIT_SUPPORT */
#endif /* MNG_SKIPCANVAS_RGBA8_PM */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_ARGB8
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
mng_retcode mng_display_argb8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint16 iFGa16, iBGa16, iCa16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint16 iCr16, iCg16, iCb16;
mng_uint8 iCr8, iCg8, iCb8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8, 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 */
*pScanline = *(pDataline+6);
*(pScanline+1) = *pDataline;
*(pScanline+2) = *(pDataline+2);
*(pScanline+3) = *(pDataline+4);
pScanline += (pData->iColinc << 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*pScanline = *(pDataline+3);
*(pScanline+1) = *pDataline;
*(pScanline+2) = *(pDataline+1);
*(pScanline+3) = *(pDataline+2);
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 */
iFGa16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*pScanline);
iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16;
if (iFGa16) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa16 == 0xFFFF) || (iBGa16 == 0))
{ /* plain copy it */
*pScanline = *(pDataline+6);
*(pScanline+1) = *pDataline;
*(pScanline+2) = *(pDataline+2);
*(pScanline+3) = *(pDataline+4);
}
else
{
if (iBGa16 == 0xFFFF) /* background fully opaque ? */
{ /* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGr16 = (mng_uint16)(*(pScanline+1));
iBGg16 = (mng_uint16)(*(pScanline+2));
iBGb16 = (mng_uint16)(*(pScanline+3));
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16);
/* and return the composed values */
/* alpha remains fully opaque !!! */
*(pScanline+1) = (mng_uint8)(iFGr16 >> 8);
*(pScanline+2) = (mng_uint8)(iFGg16 >> 8);
*(pScanline+3) = (mng_uint8)(iFGb16 >> 8);
}
else
{ /* scale background up */
iBGr16 = (mng_uint16)(*(pScanline+1));
iBGg16 = (mng_uint16)(*(pScanline+2));
iBGb16 = (mng_uint16)(*(pScanline+3));
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* let's blend */
MNG_BLEND16 (mng_get_uint16 (pDataline ),
mng_get_uint16 (pDataline+2),
mng_get_uint16 (pDataline+4), iFGa16,
iBGr16, iBGg16, iBGb16, iBGa16,
iCr16, iCg16, iCb16, iCa16);
/* and return the composed values */
*pScanline = (mng_uint8)(iCa16 >> 8);
*(pScanline+1) = (mng_uint8)(iCr16 >> 8);
*(pScanline+2) = (mng_uint8)(iCg16 >> 8);
*(pScanline+3) = (mng_uint8)(iCb16 >> 8);
}
}
}
pScanline += (pData->iColinc << 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *pScanline;
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*pScanline = *(pDataline+3);
*(pScanline+1) = *pDataline;
*(pScanline+2) = *(pDataline+1);
*(pScanline+3) = *(pDataline+2);
}
else
{
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do simple alpha composing */
/* alpha itself remains fully opaque !!! */
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
*(pScanline+1), *(pScanline+2), *(pScanline+3), iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = iCa8;
*(pScanline+1) = iCr8;
*(pScanline+2) = iCg8;
*(pScanline+3) = iCb8;
}
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
mng_retcode mng_display_argb8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint16 iFGa16, iBGa16, iCa16;
mng_uint16 iFGg16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint16 iCr16, iCg16, iCb16;
mng_uint8 iCr8, iCg8, iCb8;
mng_uint8 iBps;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8, MNG_LC_START);
#endif
iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1);
/* 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 */
/* adjust source row starting-point */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1));
if (pData->bIsOpaque) /* forget about transparency ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* scale down by dropping the LSB */
*pScanline = *(pDataline+3*iBps);
*(pScanline+1) = *pDataline;
*(pScanline+2) = *(pDataline+iBps);
*(pScanline+3) = *(pDataline+2*iBps);
pScanline += (pData->iColinc << 2);
pDataline += 4*iBps;
}
}
else
{
if (pData->bIsRGBA16) /* 16-bit input row ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* get alpha values */
iFGa16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*pScanline);
iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16;
if (iFGa16) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa16 == 0xFFFF) || (iBGa16 == 0))
{ /* plain copy it */
*pScanline = *(pDataline+6);
*(pScanline+1) = *pDataline;
*(pScanline+2) = *(pDataline+2);
*(pScanline+3) = *(pDataline+4);
}
else
{
if (iBGa16 == 0xFFFF) /* background fully opaque ? */
{ /* get the proper values */
int i;
for (i=2; i >= 0; i--)
{
iFGg16 = mng_get_uint16 (pDataline+i+i);
/* scale background up */
iBGg16 = (mng_uint16)(*(pScanline+i+1));
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
/* now compose */
MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16);
/* and return the composed values */
/* alpha remains fully opaque !!! */
*(pScanline+i+1) = (mng_uint8)(iFGg16 >> 8);
}
}
else
{ /* scale background up */
iBGr16 = (mng_uint16)(*(pScanline+1));
iBGg16 = (mng_uint16)(*(pScanline+2));
iBGb16 = (mng_uint16)(*(pScanline+3));
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* let's blend */
MNG_BLEND16 (mng_get_uint16 (pDataline ),
mng_get_uint16 (pDataline+2),
mng_get_uint16 (pDataline+4), iFGa16,
iBGr16, iBGg16, iBGb16, iBGa16,
iCr16, iCg16, iCb16, iCa16);
/* and return the composed values */
*pScanline = (mng_uint8)(iCa16 >> 8);
*(pScanline+1) = (mng_uint8)(iCr16 >> 8);
*(pScanline+2) = (mng_uint8)(iCg16 >> 8);
*(pScanline+3) = (mng_uint8)(iCb16 >> 8);
}
}
}
pScanline += (pData->iColinc << 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *pScanline;
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*pScanline = *(pDataline+3);
*(pScanline+1) = *pDataline;
*(pScanline+2) = *(pDataline+1);
*(pScanline+3) = *(pDataline+2);
}
else
{
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do simple alpha composing */
/* alpha itself remains fully opaque !!! */
int i;
for (i=2; i >= 0; i--)
{
MNG_COMPOSE8 (*(pScanline+i+1), *(pDataline+i), iFGa8, *(pScanline+i+1));
}
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
*(pScanline+1), *(pScanline+2), *(pScanline+3), iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = iCa8;
*(pScanline+1) = iCr8;
*(pScanline+2) = iCg8;
*(pScanline+3) = iCb8;
}
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
#else /* MNG_NO_16BIT_SUPPORT */
mng_retcode mng_display_argb8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint8 iCr8, iCg8, iCb8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8, 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 */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2);
if (pData->bIsOpaque) /* forget about transparency ? */
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*pScanline = *(pDataline+3);
*(pScanline+1) = *pDataline;
*(pScanline+2) = *(pDataline+1);
*(pScanline+3) = *(pDataline+2);
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
else
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *pScanline;
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*pScanline = *(pDataline+3);
*(pScanline+1) = *pDataline;
*(pScanline+2) = *(pDataline+1);
*(pScanline+3) = *(pDataline+2);
}
else
{
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do simple alpha composing */
/* alpha itself remains fully opaque !!! */
#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
int i;
for (i=2; i >= 0; i--)
{
MNG_COMPOSE8 (*(pScanline+i+1), *(pDataline+i), iFGa8, *(pScanline+i+1));
}
#else
MNG_COMPOSE8 (*(pScanline+1), *pDataline, iFGa8, *(pScanline+1));
MNG_COMPOSE8 (*(pScanline+2), *(pDataline+1), iFGa8, *(pScanline+2));
MNG_COMPOSE8 (*(pScanline+3), *(pDataline+2), iFGa8, *(pScanline+3));
#endif
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
*(pScanline+1), *(pScanline+2), *(pScanline+3), iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = iCa8;
*(pScanline+1) = iCr8;
*(pScanline+2) = iCg8;
*(pScanline+3) = iCb8;
}
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_16BIT_SUPPORT */
#endif /* MNG_SKIPCANVAS_ARGB8 */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_ARGB8_PM
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
mng_retcode mng_display_argb8_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_ARGB8_PM, 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] = 255;
pScanline[1] = pDataline[0];
pScanline[2] = pDataline[2];
pScanline[3] = pDataline[4];
}
else
{
pScanline[0] = (mng_uint8)s;
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[3-i] = DIV255B8(s * pDataline[4-i-i]);
}
}
#else
pScanline[1] = DIV255B8(s * pDataline[0]);
pScanline[2] = DIV255B8(s * pDataline[2]);
pScanline[3] = DIV255B8(s * pDataline[4]);
#endif
}
}
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] = 255;
pScanline[1] = pDataline[0];
pScanline[2] = pDataline[1];
pScanline[3] = pDataline[2];
}
else
{
pScanline[0] = (mng_uint8)s;
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[3-i] = DIV255B8(s * pDataline[2-i]);
}
}
#else
pScanline[1] = DIV255B8(s * pDataline[0]);
pScanline[2] = DIV255B8(s * pDataline[1]);
pScanline[3] = DIV255B8(s * pDataline[2]);
#endif
}
}
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] = 255;
pScanline[1] = pDataline[0];
pScanline[2] = pDataline[2];
pScanline[3] = pDataline[4];
}
else
{ /* now blend (premultiplied) */
t = 255 - s;
pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0])));
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[3-i] = DIV255B8(s * pDataline[4-i-i] + t *
pScanline[3-i]);
}
}
#else
pScanline[1] = DIV255B8(s * pDataline[0] + t * pScanline[1]);
pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]);
pScanline[3] = DIV255B8(s * pDataline[4] + t * pScanline[3]);
#endif
}
}
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] = 255;
pScanline[1] = pDataline[0];
pScanline[2] = pDataline[1];
pScanline[3] = pDataline[2];
}
else
{ /* now blend (premultiplied) */
t = 255 - s;
pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0])));
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[3-i] = DIV255B8(s * pDataline[2-i] + t *
pScanline[3-i]);
}
}
#else
pScanline[1] = DIV255B8(s * pDataline[0] + t * pScanline[1]);
pScanline[2] = DIV255B8(s * pDataline[1] + t * pScanline[2]);
pScanline[3] = DIV255B8(s * pDataline[2] + t * pScanline[3]);
#endif
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8_PM, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
mng_retcode mng_display_argb8_pm (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint32 s, t;
mng_uint8 iBps;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8_PM, MNG_LC_START);
#endif
iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1);
/* 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 */
/* adjust source row starting-point */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1));
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] = 255;
pScanline[1] = pDataline[0];
pScanline[2] = pDataline[2];
pScanline[3] = pDataline[4];
}
else
{
pScanline[0] = (mng_uint8)s;
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[3-i] = DIV255B8(s * pDataline[4-i-i]);
}
}
#else
pScanline[1] = DIV255B8(s * pDataline[0]);
pScanline[2] = DIV255B8(s * pDataline[2]);
pScanline[3] = DIV255B8(s * pDataline[4]);
#endif
}
}
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] = 255;
pScanline[1] = pDataline[0];
pScanline[2] = pDataline[1];
pScanline[3] = pDataline[2];
}
else
{
pScanline[0] = (mng_uint8)s;
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[3-i] = DIV255B8(s * pDataline[2-i]);
}
}
#else
pScanline[1] = DIV255B8(s * pDataline[0]);
pScanline[2] = DIV255B8(s * pDataline[1]);
pScanline[3] = DIV255B8(s * pDataline[2]);
#endif
}
}
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] = 255;
pScanline[1] = pDataline[0];
pScanline[2] = pDataline[2];
pScanline[3] = pDataline[4];
}
else
{ /* now blend (premultiplied) */
t = 255 - s;
pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0])));
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[3-i] = DIV255B8(s * pDataline[4-i-i] + t *
pScanline[3-i]);
}
}
#else
pScanline[1] = DIV255B8(s * pDataline[0] + t * pScanline[1]);
pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]);
pScanline[3] = DIV255B8(s * pDataline[4] + t * pScanline[3]);
#endif
}
}
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] = 255;
pScanline[1] = pDataline[0];
pScanline[2] = pDataline[1];
pScanline[3] = pDataline[2];
}
else
{ /* now blend (premultiplied) */
t = 255 - s;
pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0])));
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[3-i] = DIV255B8(s * pDataline[2-i] + t *
pScanline[3-i]);
}
}
#else
pScanline[1] = DIV255B8(s * pDataline[0] + t * pScanline[1]);
pScanline[2] = DIV255B8(s * pDataline[1] + t * pScanline[2]);
pScanline[3] = DIV255B8(s * pDataline[2] + t * pScanline[3]);
#endif
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8_PM, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
#else /* MNG_NO_16BIT_SUPPORT */
mng_retcode mng_display_argb8_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_ARGB8_PM, 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 */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2);
if (pData->bIsOpaque) /* forget about transparency ? */
{
{
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] = 255;
pScanline[1] = pDataline[0];
pScanline[2] = pDataline[1];
pScanline[3] = pDataline[2];
}
else
{
pScanline[0] = (mng_uint8)s;
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[3-i] = DIV255B8(s * pDataline[2-i]);
}
}
#else
pScanline[1] = DIV255B8(s * pDataline[0]);
pScanline[2] = DIV255B8(s * pDataline[1]);
pScanline[3] = DIV255B8(s * pDataline[2]);
#endif
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
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] = 255;
pScanline[1] = pDataline[0];
pScanline[2] = pDataline[1];
pScanline[3] = pDataline[2];
}
else
{ /* now blend (premultiplied) */
t = 255 - s;
pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0])));
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[3-i] = DIV255B8(s * pDataline[2-i] + t *
pScanline[3-i]);
}
}
#else
pScanline[1] = DIV255B8(s * pDataline[0] + t * pScanline[1]);
pScanline[2] = DIV255B8(s * pDataline[1] + t * pScanline[2]);
pScanline[3] = DIV255B8(s * pDataline[2] + t * pScanline[3]);
#endif
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8_PM, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_16BIT_SUPPORT */
#endif /* MNG_SKIPCANVAS_ARGB8_PM */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_RGB8_A8
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
mng_retcode mng_display_rgb8_a8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pAlphaline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint16 iFGa16, iBGa16, iCa16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint16 iCr16, iCg16, iCb16;
mng_uint8 iCr8, iCg8, iCb8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8_A8, MNG_LC_START);
#endif
/* viewable row ? */
if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb))
{ /* address destination rows */
pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData),
pData->iRow + pData->iDestt -
pData->iSourcet);
pAlphaline = (mng_uint8p)pData->fGetalphaline (((mng_handle)pData),
pData->iRow + pData->iDestt -
pData->iSourcet);
/* adjust destination rows starting-point */
pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3);
pAlphaline = pAlphaline + pData->iCol + pData->iDestl;
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 */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *(pDataline+4);
*pAlphaline = *(pDataline+6);
pScanline += (pData->iColinc * 3);
pAlphaline += pData->iColinc;
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *(pDataline+2);
*pAlphaline = *(pDataline+3);
pScanline += (pData->iColinc * 3);
pAlphaline += pData->iColinc;
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 */
iFGa16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*pAlphaline);
iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16;
if (iFGa16) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa16 == 0xFFFF) || (iBGa16 == 0))
{ /* plain copy it */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *(pDataline+4);
*pAlphaline = *(pDataline+6);
}
else
{
if (iBGa16 == 0xFFFF) /* background fully opaque ? */
{ /* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGr16 = (mng_uint16)(*pScanline );
iBGg16 = (mng_uint16)(*(pScanline+1));
iBGb16 = (mng_uint16)(*(pScanline+2));
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16);
/* and return the composed values */
*pScanline = (mng_uint8)(iFGr16 >> 8);
*(pScanline+1) = (mng_uint8)(iFGg16 >> 8);
*(pScanline+2) = (mng_uint8)(iFGb16 >> 8);
/* alpha remains fully opaque !!! */
}
else
{ /* scale background up */
iBGr16 = (mng_uint16)(*pScanline );
iBGg16 = (mng_uint16)(*(pScanline+1));
iBGb16 = (mng_uint16)(*(pScanline+2));
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* let's blend */
MNG_BLEND16 (mng_get_uint16 (pDataline ),
mng_get_uint16 (pDataline+2),
mng_get_uint16 (pDataline+4), iFGa16,
iBGr16, iBGg16, iBGb16, iBGa16,
iCr16, iCg16, iCb16, iCa16);
/* and return the composed values */
*pScanline = (mng_uint8)(iCr16 >> 8);
*(pScanline+1) = (mng_uint8)(iCg16 >> 8);
*(pScanline+2) = (mng_uint8)(iCb16 >> 8);
*pAlphaline = (mng_uint8)(iCa16 >> 8);
}
}
}
pScanline += (pData->iColinc * 3);
pAlphaline += pData->iColinc;
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *pAlphaline;
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *(pDataline+2);
*pAlphaline = *(pDataline+3);
}
else
{
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do alpha composing */
MNG_COMPOSE8 (*pScanline, *pDataline, iFGa8, *pScanline );
MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iFGa8, *(pScanline+1));
MNG_COMPOSE8 (*(pScanline+2), *(pDataline+2), iFGa8, *(pScanline+2));
/* alpha remains fully opaque !!! */
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
*pScanline, *(pScanline+1), *(pScanline+2), iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = iCr8;
*(pScanline+1) = iCg8;
*(pScanline+2) = iCb8;
*pAlphaline = iCa8;
}
}
}
pScanline += (pData->iColinc * 3);
pAlphaline += pData->iColinc;
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8_A8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
mng_retcode mng_display_rgb8_a8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pAlphaline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint16 iFGa16, iBGa16, iCa16;
mng_uint16 iFGg16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint16 iCr16, iCg16, iCb16;
mng_uint8 iCr8, iCg8, iCb8;
mng_uint8 iBps;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8_A8, MNG_LC_START);
#endif
iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1);
/* viewable row ? */
if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb))
{ /* address destination rows */
pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData),
pData->iRow + pData->iDestt -
pData->iSourcet);
pAlphaline = (mng_uint8p)pData->fGetalphaline (((mng_handle)pData),
pData->iRow + pData->iDestt -
pData->iSourcet);
/* adjust destination rows starting-point */
pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3);
pAlphaline = pAlphaline + pData->iCol + pData->iDestl;
pDataline = pData->pRGBArow; /* address source row */
/* adjust source row starting-point */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1));
if (pData->bIsOpaque) /* forget about transparency ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* scale down by dropping the LSB */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+iBps);
*(pScanline+2) = *(pDataline+2*iBps);
*pAlphaline = *(pDataline+3*iBps);
pScanline += (pData->iColinc * 3);
pAlphaline += pData->iColinc;
pDataline += 4*iBps;
}
}
else
{
if (pData->bIsRGBA16) /* 16-bit input row ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* get alpha values */
iFGa16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*pAlphaline);
iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16;
if (iFGa16) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa16 == 0xFFFF) || (iBGa16 == 0))
{ /* plain copy it */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *(pDataline+4);
*pAlphaline = *(pDataline+6);
}
else
{
if (iBGa16 == 0xFFFF) /* background fully opaque ? */
{ /* get the proper values */
int i;
for (i=2; i >= 0; i--)
{
iFGg16 = mng_get_uint16 (pDataline+i+i);
/* scale background up */
iBGg16 = (mng_uint16)(*(pScanline+i));
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
/* now compose */
MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16);
/* and return the composed values */
*(pScanline+i) = (mng_uint8)(iFGg16 >> 8);
/* alpha remains fully opaque !!! */
}
}
else
{ /* scale background up */
iBGr16 = (mng_uint16)(*pScanline );
iBGg16 = (mng_uint16)(*(pScanline+1));
iBGb16 = (mng_uint16)(*(pScanline+2));
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* let's blend */
MNG_BLEND16 (mng_get_uint16 (pDataline ),
mng_get_uint16 (pDataline+2),
mng_get_uint16 (pDataline+4), iFGa16,
iBGr16, iBGg16, iBGb16, iBGa16,
iCr16, iCg16, iCb16, iCa16);
/* and return the composed values */
*pScanline = (mng_uint8)(iCr16 >> 8);
*(pScanline+1) = (mng_uint8)(iCg16 >> 8);
*(pScanline+2) = (mng_uint8)(iCb16 >> 8);
*pAlphaline = (mng_uint8)(iCa16 >> 8);
}
}
}
pScanline += (pData->iColinc * 3);
pAlphaline += pData->iColinc;
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *pAlphaline;
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *(pDataline+2);
*pAlphaline = *(pDataline+3);
}
else
{
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do alpha composing */
int i;
for (i=2; i >= 0; i--)
{
MNG_COMPOSE8 (*(pScanline+i), *(pDataline+i), iFGa8, *(pScanline+i));
}
/* alpha remains fully opaque !!! */
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
*pScanline, *(pScanline+1), *(pScanline+2), iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = iCr8;
*(pScanline+1) = iCg8;
*(pScanline+2) = iCb8;
*pAlphaline = iCa8;
}
}
}
pScanline += (pData->iColinc * 3);
pAlphaline += pData->iColinc;
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8_A8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
#else /* MNG_NO_16BIT_SUPPORT */
mng_retcode mng_display_rgb8_a8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pAlphaline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint8 iCr8, iCg8, iCb8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8_A8, MNG_LC_START);
#endif
/* viewable row ? */
if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb))
{ /* address destination rows */
pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData),
pData->iRow + pData->iDestt -
pData->iSourcet);
pAlphaline = (mng_uint8p)pData->fGetalphaline (((mng_handle)pData),
pData->iRow + pData->iDestt -
pData->iSourcet);
/* adjust destination rows starting-point */
pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3);
pAlphaline = pAlphaline + pData->iCol + pData->iDestl;
pDataline = pData->pRGBArow; /* address source row */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2);
if (pData->bIsOpaque) /* forget about transparency ? */
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *(pDataline+2);
*pAlphaline = *(pDataline+3);
pScanline += (pData->iColinc * 3);
pAlphaline += pData->iColinc;
pDataline += 4;
}
}
}
else
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *pAlphaline;
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*pScanline = *pDataline;
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *(pDataline+2);
*pAlphaline = *(pDataline+3);
}
else
{
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do alpha composing */
#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
int i;
for (i=2; i >= 0; i--)
{
MNG_COMPOSE8 (*(pScanline+i), *(pDataline+i), iFGa8, *(pScanline+i));
}
#else
MNG_COMPOSE8 (*pScanline, *pDataline, iFGa8, *pScanline );
MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iFGa8, *(pScanline+1));
MNG_COMPOSE8 (*(pScanline+2), *(pDataline+2), iFGa8, *(pScanline+2));
#endif
/* alpha remains fully opaque !!! */
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
*pScanline, *(pScanline+1), *(pScanline+2), iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = iCr8;
*(pScanline+1) = iCg8;
*(pScanline+2) = iCb8;
*pAlphaline = iCa8;
}
}
}
pScanline += (pData->iColinc * 3);
pAlphaline += pData->iColinc;
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8_A8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_16BIT_SUPPORT */
#endif /* MNG_SKIPCANVAS_RGB8_A8 */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_BGR8
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
mng_retcode mng_display_bgr8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint16 iA16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint8 iA8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR8, 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 * 3) + (pData->iDestl * 3);
pDataline = pData->pRGBArow; /* address source row */
if (pData->bIsRGBA16) /* adjust source row starting-point */
pDataline = pDataline + (pData->iSourcel / pData->iColinc) * 8;
else
pDataline = pDataline + (pData->iSourcel / pData->iColinc) * 4;
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 */
*pScanline = *(pDataline+4);
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *pDataline;
pScanline += (pData->iColinc * 3);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*pScanline = *(pDataline+2);
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *pDataline;
pScanline += (pData->iColinc * 3);
pDataline += 4;
}
}
}
else
{
if (pData->bIsRGBA16) /* 16-bit input row ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* get alpha value */
iA16 = mng_get_uint16 (pDataline+6);
if (iA16) /* any opacity at all ? */
{
if (iA16 == 0xFFFF) /* fully opaque ? */
{ /* scale down by dropping the LSB */
*pScanline = *(pDataline+4);
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *pDataline;
}
else
{ /* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGr16 = (mng_uint16)(*(pScanline+2));
iBGg16 = (mng_uint16)(*(pScanline+1));
iBGb16 = (mng_uint16)(*pScanline );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16);
/* and return the composed values */
*pScanline = (mng_uint8)(iFGb16 >> 8);
*(pScanline+1) = (mng_uint8)(iFGg16 >> 8);
*(pScanline+2) = (mng_uint8)(iFGr16 >> 8);
}
}
pScanline += (pData->iColinc * 3);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*pScanline = *(pDataline+2);
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *pDataline;
}
else
{ /* do alpha composing */
MNG_COMPOSE8 (*pScanline, *(pDataline+2), iA8, *pScanline );
MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iA8, *(pScanline+1));
MNG_COMPOSE8 (*(pScanline+2), *pDataline, iA8, *(pScanline+2));
}
}
pScanline += (pData->iColinc * 3);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
mng_retcode mng_display_bgr8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint16 iA16;
mng_uint16 iFGg16;
mng_uint16 iBGg16;
mng_uint8 iA8;
mng_uint8 iBps;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR8, MNG_LC_START);
#endif
iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1);
/* 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 * 3) + (pData->iDestl * 3);
pDataline = pData->pRGBArow; /* address source row */
/* adjust source row starting-point */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1));
if (pData->bIsOpaque) /* forget about transparency ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* scale down by dropping the LSB */
*pScanline = *(pDataline+2*iBps);
*(pScanline+1) = *(pDataline+iBps);
*(pScanline+2) = *pDataline;
pScanline += (pData->iColinc * 3);
pDataline += 4*iBps;
}
}
else
{
if (pData->bIsRGBA16) /* 16-bit input row ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* get alpha value */
iA16 = mng_get_uint16 (pDataline+6);
if (iA16) /* any opacity at all ? */
{
if (iA16 == 0xFFFF) /* fully opaque ? */
{ /* scale down by dropping the LSB */
*pScanline = *(pDataline+4);
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *pDataline;
}
else
{ /* get the proper values */
int i;
for (i=2; i >= 0; i--)
{
iFGg16 = mng_get_uint16 (pDataline+i+i);
/* scale background up */
iBGg16 = (mng_uint16)(*(pScanline+2-i));
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
/* now compose */
MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16);
/* and return the composed values */
*(pScanline+2-i) = (mng_uint8)(iFGg16 >> 8);
}
}
}
pScanline += (pData->iColinc * 3);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*pScanline = *(pDataline+2);
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *pDataline;
}
else
{ /* do alpha composing */
int i;
for (i=2; i >= 0; i--)
{
MNG_COMPOSE8 (*(pScanline+i), *(pDataline+2-i), iA8, *(pScanline+i));
}
}
}
pScanline += (pData->iColinc * 3);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
#else /* MNG_NO_16BIT_SUPPORT */
mng_retcode mng_display_bgr8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iA8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR8, 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 * 3) + (pData->iDestl * 3);
pDataline = pData->pRGBArow; /* address source row */
pDataline = pDataline + (pData->iSourcel / pData->iColinc) * 4;
if (pData->bIsOpaque) /* forget about transparency ? */
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*pScanline = *(pDataline+2);
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *pDataline;
pScanline += (pData->iColinc * 3);
pDataline += 4;
}
}
}
else
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*pScanline = *(pDataline+2);
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *pDataline;
}
else
{ /* do alpha composing */
#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
int i;
for (i=2; i >= 0; i--)
{
MNG_COMPOSE8 (*(pScanline+i), *(pDataline+2-i), iA8, *(pScanline+i));
}
#else
MNG_COMPOSE8 (*pScanline, *(pDataline+2), iA8, *pScanline );
MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iA8, *(pScanline+1));
MNG_COMPOSE8 (*(pScanline+2), *pDataline, iA8, *(pScanline+2));
#endif
}
}
pScanline += (pData->iColinc * 3);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_16BIT_SUPPORT */
#endif /* MNG_SKIPCANVAS_BGR8 */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_BGRX8
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
mng_retcode mng_display_bgrx8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint16 iA16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint8 iA8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRX8, 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) * 8;
else
pDataline = pDataline + (pData->iSourcel / pData->iColinc) * 4;
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 */
*pScanline = *(pDataline+4);
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *pDataline;
*(pScanline+3) = 0xFF; /* filler byte */
pScanline += (pData->iColinc << 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*pScanline = *(pDataline+2);
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *pDataline;
*(pScanline+3) = 0xFF; /* filler byte */
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 value */
iA16 = mng_get_uint16 (pDataline+6);
if (iA16) /* any opacity at all ? */
{
if (iA16 == 0xFFFF) /* fully opaque ? */
{ /* scale down by dropping the LSB */
*pScanline = *(pDataline+4);
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *pDataline;
*(pScanline+3) = 0xFF; /* filler byte */
}
else
{ /* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGr16 = (mng_uint16)(*(pScanline+2));
iBGg16 = (mng_uint16)(*(pScanline+1));
iBGb16 = (mng_uint16)(*pScanline );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16);
/* and return the composed values */
*pScanline = (mng_uint8)(iFGb16 >> 8);
*(pScanline+1) = (mng_uint8)(iFGg16 >> 8);
*(pScanline+2) = (mng_uint8)(iFGr16 >> 8);
*(pScanline+3) = 0xFF; /* filler byte */
}
}
pScanline += (pData->iColinc << 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*pScanline = *(pDataline+2);
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *pDataline;
*(pScanline+3) = 0xFF; /* filler byte */
}
else
{ /* do alpha composing */
MNG_COMPOSE8 (*pScanline, *(pDataline+2), iA8, *pScanline );
MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iA8, *(pScanline+1));
MNG_COMPOSE8 (*(pScanline+2), *pDataline, iA8, *(pScanline+2));
*(pScanline+3) = 0xFF; /* filler byte */
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRX8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
mng_retcode mng_display_bgrx8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint16 iA16;
mng_uint16 iFGg16;
mng_uint16 iBGg16;
mng_uint8 iA8;
mng_uint8 iBps;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRX8, MNG_LC_START);
#endif
iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1);
/* 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 */
/* adjust source row starting-point */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1));
if (pData->bIsOpaque) /* forget about transparency ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* scale down by dropping the LSB */
*pScanline = *(pDataline+2*iBps);
*(pScanline+1) = *(pDataline+iBps);
*(pScanline+2) = *pDataline;
*(pScanline+3) = 0xFF; /* filler byte */
pScanline += (pData->iColinc << 2);
pDataline += 4*iBps;
}
}
else
{
if (pData->bIsRGBA16) /* 16-bit input row ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* get alpha value */
iA16 = mng_get_uint16 (pDataline+6);
if (iA16) /* any opacity at all ? */
{
if (iA16 == 0xFFFF) /* fully opaque ? */
{ /* scale down by dropping the LSB */
*pScanline = *(pDataline+4);
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *pDataline;
*(pScanline+3) = 0xFF; /* filler byte */
}
else
{ /* get the proper values */
int i;
for (i=2; i >= 0; i--)
{
iFGg16 = mng_get_uint16 (pDataline+i+i);
/* scale background up */
iBGg16 = (mng_uint16)(*(pScanline+2-i));
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
/* now compose */
MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16);
/* and return the composed values */
*(pScanline+2-i) = (mng_uint8)(iFGg16 >> 8);
}
*(pScanline+3) = 0xFF; /* filler byte */
}
}
pScanline += (pData->iColinc << 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*pScanline = *(pDataline+2);
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *pDataline;
*(pScanline+3) = 0xFF; /* filler byte */
}
else
{ /* do alpha composing */
int i;
for (i=2; i >= 0; i--)
{
MNG_COMPOSE8 (*(pScanline+i), *(pDataline+2-i), iA8, *(pScanline+i));
}
*(pScanline+3) = 0xFF; /* filler byte */
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRX8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
#else /* MNG_NO_16BIT_SUPPORT */
mng_retcode mng_display_bgrx8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iA8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRX8, 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 */
pDataline = pDataline + (pData->iSourcel / pData->iColinc) * 4;
if (pData->bIsOpaque) /* forget about transparency ? */
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*pScanline = *(pDataline+2);
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *pDataline;
*(pScanline+3) = 0xFF; /* filler byte */
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
else
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*pScanline = *(pDataline+2);
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *pDataline;
*(pScanline+3) = 0xFF; /* filler byte */
}
else
{ /* do alpha composing */
#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
int i;
for (i=2; i >= 0; i--)
{
MNG_COMPOSE8 (*(pScanline+i), *(pDataline+2-i), iA8, *(pScanline+i));
}
#else
MNG_COMPOSE8 (*pScanline, *(pDataline+2), iA8, *pScanline );
MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iA8, *(pScanline+1));
MNG_COMPOSE8 (*(pScanline+2), *pDataline, iA8, *(pScanline+2));
#endif
*(pScanline+3) = 0xFF; /* filler byte */
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRX8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_16BIT_SUPPORT */
#endif /* MNG_SKIPCANVAS_BGRX8 */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_BGRA8
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
mng_retcode mng_display_bgra8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint16 iFGa16, iBGa16, iCa16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint16 iCr16, iCg16, iCb16;
mng_uint8 iCr8, iCg8, iCb8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8, 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 */
*pScanline = *(pDataline+4);
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *pDataline;
*(pScanline+3) = *(pDataline+6);
pScanline += (pData->iColinc << 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*pScanline = *(pDataline+2);
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *pDataline;
*(pScanline+3) = *(pDataline+3);
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 */
iFGa16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*(pScanline+3));
iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16;
if (iFGa16) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa16 == 0xFFFF) || (iBGa16 == 0))
{ /* plain copy it */
*pScanline = *(pDataline+4);
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *pDataline;
*(pScanline+3) = *(pDataline+6);
}
else
{
if (iBGa16 == 0xFFFF) /* background fully opaque ? */
{ /* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGr16 = (mng_uint16)(*(pScanline+2));
iBGg16 = (mng_uint16)(*(pScanline+1));
iBGb16 = (mng_uint16)(*pScanline );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16);
/* and return the composed values */
*pScanline = (mng_uint8)(iFGb16 >> 8);
*(pScanline+1) = (mng_uint8)(iFGg16 >> 8);
*(pScanline+2) = (mng_uint8)(iFGr16 >> 8);
/* alpha remains fully opaque !!! */
}
else
{ /* scale background up */
iBGr16 = (mng_uint16)(*(pScanline+2));
iBGg16 = (mng_uint16)(*(pScanline+1));
iBGb16 = (mng_uint16)(*pScanline );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* let's blend */
MNG_BLEND16 (mng_get_uint16 (pDataline ),
mng_get_uint16 (pDataline+2),
mng_get_uint16 (pDataline+4), iFGa16,
iBGr16, iBGg16, iBGb16, iBGa16,
iCr16, iCg16, iCb16, iCa16);
/* and return the composed values */
*pScanline = (mng_uint8)(iCb16 >> 8);
*(pScanline+1) = (mng_uint8)(iCg16 >> 8);
*(pScanline+2) = (mng_uint8)(iCr16 >> 8);
*(pScanline+3) = (mng_uint8)(iCa16 >> 8);
}
}
}
pScanline += (pData->iColinc << 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *(pScanline+3);
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*pScanline = *(pDataline+2);
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *pDataline;
*(pScanline+3) = *(pDataline+3);
}
else
{
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do alpha composing */
MNG_COMPOSE8 (*pScanline, *(pDataline+2), iFGa8, *pScanline );
MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iFGa8, *(pScanline+1));
MNG_COMPOSE8 (*(pScanline+2), *pDataline, iFGa8, *(pScanline+2));
/* alpha remains fully opaque !!! */
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
*(pScanline+2), *(pScanline+1), *pScanline, iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = iCb8;
*(pScanline+1) = iCg8;
*(pScanline+2) = iCr8;
*(pScanline+3) = iCa8;
}
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
mng_retcode mng_display_bgra8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint16 iFGa16, iBGa16, iCa16;
mng_uint16 iFGg16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint16 iCr16, iCg16, iCb16;
mng_uint8 iCr8, iCg8, iCb8;
mng_uint8 iBps;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8, MNG_LC_START);
#endif
iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1);
/* 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 */
/* adjust source row starting-point */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1));
if (pData->bIsOpaque) /* forget about transparency ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* scale down by dropping the LSB */
*pScanline = *(pDataline+2*iBps);
*(pScanline+1) = *(pDataline+iBps);
*(pScanline+2) = *pDataline;
*(pScanline+3) = *(pDataline+3*iBps);
pScanline += (pData->iColinc << 2);
pDataline += 4*iBps;
}
}
else
{
if (pData->bIsRGBA16) /* 16-bit input row ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* get alpha values */
iFGa16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*(pScanline+3));
iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16;
if (iFGa16) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa16 == 0xFFFF) || (iBGa16 == 0))
{ /* plain copy it */
*pScanline = *(pDataline+4);
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *pDataline;
*(pScanline+3) = *(pDataline+6);
}
else
{
if (iBGa16 == 0xFFFF) /* background fully opaque ? */
{ /* get the proper values */
int i;
for (i=2; i >= 0; i--)
{
iFGg16 = mng_get_uint16 (pDataline+i+i);
/* scale background up */
iBGg16 = (mng_uint16)(*(pScanline+2-i));
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
/* now compose */
MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16);
/* and return the composed values */
*(pScanline+2-i) = (mng_uint8)(iFGg16 >> 8);
/* alpha remains fully opaque !!! */
}
}
else
{ /* scale background up */
iBGr16 = (mng_uint16)(*(pScanline+2));
iBGg16 = (mng_uint16)(*(pScanline+1));
iBGb16 = (mng_uint16)(*pScanline );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* let's blend */
MNG_BLEND16 (mng_get_uint16 (pDataline ),
mng_get_uint16 (pDataline+2),
mng_get_uint16 (pDataline+4), iFGa16,
iBGr16, iBGg16, iBGb16, iBGa16,
iCr16, iCg16, iCb16, iCa16);
/* and return the composed values */
*pScanline = (mng_uint8)(iCb16 >> 8);
*(pScanline+1) = (mng_uint8)(iCg16 >> 8);
*(pScanline+2) = (mng_uint8)(iCr16 >> 8);
*(pScanline+3) = (mng_uint8)(iCa16 >> 8);
}
}
}
pScanline += (pData->iColinc << 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *(pScanline+3);
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*pScanline = *(pDataline+2);
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *pDataline;
*(pScanline+3) = *(pDataline+3);
}
else
{
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do alpha composing */
int i;
for (i=2; i >= 0; i--)
{
MNG_COMPOSE8 (*(pScanline+i), *(pDataline+2-i), iFGa8, *(pScanline+i));
}
/* alpha remains fully opaque !!! */
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
*(pScanline+2), *(pScanline+1), *pScanline, iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = iCb8;
*(pScanline+1) = iCg8;
*(pScanline+2) = iCr8;
*(pScanline+3) = iCa8;
}
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
#else /* MNG_NO_16BIT_SUPPORT */
mng_retcode mng_display_bgra8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint8 iCr8, iCg8, iCb8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8, 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 */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2);
if (pData->bIsOpaque) /* forget about transparency ? */
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*pScanline = *(pDataline+2);
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *pDataline;
*(pScanline+3) = *(pDataline+3);
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
else
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *(pScanline+3);
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*pScanline = *(pDataline+2);
*(pScanline+1) = *(pDataline+1);
*(pScanline+2) = *pDataline;
*(pScanline+3) = *(pDataline+3);
}
else
{
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do alpha composing */
#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
int i;
for (i=2; i >= 0; i--)
{
MNG_COMPOSE8 (*(pScanline+i), *(pDataline+2-i), iFGa8, *(pScanline+i));
}
#else
MNG_COMPOSE8 (*pScanline, *(pDataline+2), iFGa8, *pScanline );
MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iFGa8, *(pScanline+1));
MNG_COMPOSE8 (*(pScanline+2), *pDataline, iFGa8, *(pScanline+2));
#endif
/* alpha remains fully opaque !!! */
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
*(pScanline+2), *(pScanline+1), *pScanline, iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = iCb8;
*(pScanline+1) = iCg8;
*(pScanline+2) = iCr8;
*(pScanline+3) = iCa8;
}
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_16BIT_SUPPORT */
#endif /* MNG_SKIPCANVAS_BGRA8 */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_BGRA8_PM
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
mng_retcode mng_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;
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[i] = DIV255B8(s * pDataline[4-i-i] + t *
pScanline[i]);
}
}
#else
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]);
#endif
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;
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[i] = DIV255B8(s * pDataline[2-i] + t *
pScanline[i]);
}
}
#else
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]);
#endif
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;
}
#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
mng_retcode mng_display_bgra8_pm (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint32 s, t;
mng_uint8 iBps;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8PM, MNG_LC_START);
#endif
iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1);
/* 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 */
/* adjust source row starting-point */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1));
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
{
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
int i;
for (i=2; i >= 0; i--)
{
pScanline[i] = DIV255B8(s * pDataline[4-i-i]);
}
#else
pScanline[0] = DIV255B8(s * pDataline[4]);
pScanline[1] = DIV255B8(s * pDataline[2]);
pScanline[2] = DIV255B8(s * pDataline[0]);
#endif
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
{
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
int i;
for (i=2; i >= 0; i--)
{
pScanline[i] = DIV255B8(s * pDataline[2-i]);
}
#else
pScanline[0] = DIV255B8(s * pDataline[2]);
pScanline[1] = DIV255B8(s * pDataline[1]);
pScanline[2] = DIV255B8(s * pDataline[0]);
#endif
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;
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[i] = DIV255B8(s * pDataline[4-i-i] + t *
pScanline[i]);
}
}
#else
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]);
#endif
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;
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[i] = DIV255B8(s * pDataline[2-i] + t *
pScanline[i]);
}
}
#else
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]);
#endif
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;
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
#else /* MNG_NO_16BIT_SUPPORT */
mng_retcode mng_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 */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2);
if (pData->bIsOpaque) /* forget about transparency ? */
{
{
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
{
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
int i;
for (i=2; i >= 0; i--)
{
pScanline[i] = DIV255B8(s * pDataline[2-i]);
}
#else
pScanline[0] = DIV255B8(s * pDataline[2]);
pScanline[1] = DIV255B8(s * pDataline[1]);
pScanline[2] = DIV255B8(s * pDataline[0]);
#endif
pScanline[3] = (mng_uint8)s;
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
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;
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[i] = DIV255B8(s * pDataline[2-i] + t *
pScanline[i]);
}
}
#else
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]);
#endif
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;
}
#endif /* MNG_NO_16BIT_SUPPORT */
#endif /* MNG_SKIPCANVAS_BGRA8_PM */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_ABGR8
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
mng_retcode mng_display_abgr8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint16 iFGa16, iBGa16, iCa16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint16 iCr16, iCg16, iCb16;
mng_uint8 iCr8, iCg8, iCb8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8, 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 */
*pScanline = *(pDataline+6);
*(pScanline+1) = *(pDataline+4);
*(pScanline+2) = *(pDataline+2);
*(pScanline+3) = *pDataline;
pScanline += (pData->iColinc << 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*pScanline = *(pDataline+3);
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *(pDataline+1);
*(pScanline+3) = *pDataline;
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 */
iFGa16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*pScanline);
iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16;
if (iFGa16) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa16 == 0xFFFF) || (iBGa16 == 0))
{ /* plain copy it */
*pScanline = *(pDataline+6);
*(pScanline+1) = *(pDataline+4);
*(pScanline+2) = *(pDataline+2);
*(pScanline+3) = *pDataline;
}
else
{
if (iBGa16 == 0xFFFF) /* background fully opaque ? */
{ /* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGr16 = (mng_uint16)(*(pScanline+3));
iBGg16 = (mng_uint16)(*(pScanline+2));
iBGb16 = (mng_uint16)(*(pScanline+1));
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16);
/* and return the composed values */
/* alpha itself remains fully opaque !!! */
*(pScanline+1) = (mng_uint8)(iFGb16 >> 8);
*(pScanline+2) = (mng_uint8)(iFGg16 >> 8);
*(pScanline+3) = (mng_uint8)(iFGr16 >> 8);
}
else
{ /* scale background up */
iBGr16 = (mng_uint16)(*(pScanline+3));
iBGg16 = (mng_uint16)(*(pScanline+2));
iBGb16 = (mng_uint16)(*(pScanline+1));
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* let's blend */
MNG_BLEND16 (mng_get_uint16 (pDataline ),
mng_get_uint16 (pDataline+2),
mng_get_uint16 (pDataline+4), iFGa16,
iBGr16, iBGg16, iBGb16, iBGa16,
iCr16, iCg16, iCb16, iCa16);
/* and return the composed values */
*pScanline = (mng_uint8)(iCa16 >> 8);
*(pScanline+1) = (mng_uint8)(iCb16 >> 8);
*(pScanline+2) = (mng_uint8)(iCg16 >> 8);
*(pScanline+3) = (mng_uint8)(iCr16 >> 8);
}
}
}
pScanline += (pData->iColinc << 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *pScanline;
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*pScanline = *(pDataline+3);
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *(pDataline+1);
*(pScanline+3) = *pDataline;
}
else
{
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do simple alpha composing */
/* alpha itself remains fully opaque !!! */
MNG_COMPOSE8 (*(pScanline+1), *(pDataline+2), iFGa8, *(pScanline+1));
MNG_COMPOSE8 (*(pScanline+2), *(pDataline+1), iFGa8, *(pScanline+2));
MNG_COMPOSE8 (*(pScanline+3), *pDataline, iFGa8, *(pScanline+3));
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
*(pScanline+3), *(pScanline+2), *(pScanline+1), iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = iCa8;
*(pScanline+1) = iCb8;
*(pScanline+2) = iCg8;
*(pScanline+3) = iCr8;
}
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
mng_retcode mng_display_abgr8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint16 iFGa16, iBGa16, iCa16;
mng_uint16 iFGg16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint16 iCr16, iCg16, iCb16;
mng_uint8 iCr8, iCg8, iCb8;
mng_uint8 iBps;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8, MNG_LC_START);
#endif
iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1);
/* 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 */
/* adjust source row starting-point */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1));
if (pData->bIsOpaque) /* forget about transparency ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* scale down by dropping the LSB */
*pScanline = *(pDataline+3*iBps);
*(pScanline+1) = *(pDataline+2*iBps);
*(pScanline+2) = *(pDataline+iBps);
*(pScanline+3) = *pDataline;
pScanline += (pData->iColinc << 2);
pDataline += 4*iBps;
}
}
else
{
if (pData->bIsRGBA16) /* 16-bit input row ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* get alpha values */
iFGa16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*pScanline);
iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16;
if (iFGa16) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa16 == 0xFFFF) || (iBGa16 == 0))
{ /* plain copy it */
*pScanline = *(pDataline+6);
*(pScanline+1) = *(pDataline+4);
*(pScanline+2) = *(pDataline+2);
*(pScanline+3) = *pDataline;
}
else
{
if (iBGa16 == 0xFFFF) /* background fully opaque ? */
{ /* get the proper values */
int i;
for (i=2; i >= 0; i--)
{
iFGg16 = mng_get_uint16 (pDataline+i+i);
/* scale background up */
iBGg16 = (mng_uint16)(*(pScanline+3-i));
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
/* now compose */
MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16);
/* and return the composed values */
/* alpha itself remains fully opaque !!! */
*(pScanline+3-i) = (mng_uint8)(iFGg16 >> 8);
}
}
else
{ /* scale background up */
iBGr16 = (mng_uint16)(*(pScanline+3));
iBGg16 = (mng_uint16)(*(pScanline+2));
iBGb16 = (mng_uint16)(*(pScanline+1));
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* let's blend */
MNG_BLEND16 (mng_get_uint16 (pDataline ),
mng_get_uint16 (pDataline+2),
mng_get_uint16 (pDataline+4), iFGa16,
iBGr16, iBGg16, iBGb16, iBGa16,
iCr16, iCg16, iCb16, iCa16);
/* and return the composed values */
*pScanline = (mng_uint8)(iCa16 >> 8);
*(pScanline+1) = (mng_uint8)(iCb16 >> 8);
*(pScanline+2) = (mng_uint8)(iCg16 >> 8);
*(pScanline+3) = (mng_uint8)(iCr16 >> 8);
}
}
}
pScanline += (pData->iColinc << 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *pScanline;
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*pScanline = *(pDataline+3);
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *(pDataline+1);
*(pScanline+3) = *pDataline;
}
else
{
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do simple alpha composing */
/* alpha itself remains fully opaque !!! */
int i;
for (i=2; i >= 0; i--)
{
MNG_COMPOSE8 (*(pScanline+i+1), *(pDataline+2-i), iFGa8, *(pScanline+i+1));
}
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
*(pScanline+3), *(pScanline+2), *(pScanline+1), iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = iCa8;
*(pScanline+1) = iCb8;
*(pScanline+2) = iCg8;
*(pScanline+3) = iCr8;
}
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
#else /* MNG_NO_16BIT_SUPPORT */
mng_retcode mng_display_abgr8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint8 iCr8, iCg8, iCb8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8, 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 */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2);
if (pData->bIsOpaque) /* forget about transparency ? */
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*pScanline = *(pDataline+3);
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *(pDataline+1);
*(pScanline+3) = *pDataline;
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
else
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *pScanline;
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*pScanline = *(pDataline+3);
*(pScanline+1) = *(pDataline+2);
*(pScanline+2) = *(pDataline+1);
*(pScanline+3) = *pDataline;
}
else
{
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do simple alpha composing */
/* alpha itself remains fully opaque !!! */
#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
int i;
for (i=2; i >= 0; i--)
{
MNG_COMPOSE8 (*(pScanline+i+1), *(pDataline+2-i), iFGa8, *(pScanline+i+1));
}
#else
MNG_COMPOSE8 (*(pScanline+1), *(pDataline+2), iFGa8, *(pScanline+1));
MNG_COMPOSE8 (*(pScanline+2), *(pDataline+1), iFGa8, *(pScanline+2));
MNG_COMPOSE8 (*(pScanline+3), *pDataline, iFGa8, *(pScanline+3));
#endif
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
*(pScanline+3), *(pScanline+2), *(pScanline+1), iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = iCa8;
*(pScanline+1) = iCb8;
*(pScanline+2) = iCg8;
*(pScanline+3) = iCr8;
}
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_16BIT_SUPPORT */
#endif /* MNG_SKIPCANVAS_ABGR8 */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_ABGR8_PM
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
mng_retcode mng_display_abgr8_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_ABGR8_PM, 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] = 255;
pScanline[1] = pDataline[4];
pScanline[2] = pDataline[2];
pScanline[3] = pDataline[0];
}
else
{
pScanline[0] = (mng_uint8)s;
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[i+1] = DIV255B8(s * pDataline[4-i-i]);
}
}
#else
pScanline[1] = DIV255B8(s * pDataline[4]);
pScanline[2] = DIV255B8(s * pDataline[2]);
pScanline[3] = DIV255B8(s * pDataline[0]);
#endif
}
}
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] = 255;
pScanline[1] = pDataline[2];
pScanline[2] = pDataline[1];
pScanline[3] = pDataline[0];
}
else
{
pScanline[0] = (mng_uint8)s;
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[i+1] = DIV255B8(s * pDataline[2-i]);
}
}
#else
pScanline[1] = DIV255B8(s * pDataline[2]);
pScanline[2] = DIV255B8(s * pDataline[1]);
pScanline[3] = DIV255B8(s * pDataline[0]);
#endif
}
}
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] = 255;
pScanline[1] = pDataline[4];
pScanline[2] = pDataline[2];
pScanline[3] = pDataline[0];
}
else
{ /* now blend (premultiplied) */
t = 255 - s;
pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0])));
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[i+1] = DIV255B8(s * pDataline[4-i-i] + t *
pScanline[i+1]);
}
}
#else
pScanline[1] = DIV255B8(s * pDataline[4] + t * pScanline[1]);
pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]);
pScanline[3] = DIV255B8(s * pDataline[0] + t * pScanline[3]);
#endif
}
}
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] = 255;
pScanline[1] = pDataline[2];
pScanline[2] = pDataline[1];
pScanline[3] = pDataline[0];
}
else
{ /* now blend (premultiplied) */
t = 255 - s;
pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0])));
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[i+1] = DIV255B8(s * pDataline[2-i] + t *
pScanline[i+1]);
}
}
#else
pScanline[1] = DIV255B8(s * pDataline[2] + t * pScanline[1]);
pScanline[2] = DIV255B8(s * pDataline[1] + t * pScanline[2]);
pScanline[3] = DIV255B8(s * pDataline[0] + t * pScanline[3]);
#endif
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8_PM, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
mng_retcode mng_display_abgr8_pm (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint32 s, t;
mng_uint8 iBps;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8_PM, MNG_LC_START);
#endif
iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1);
/* 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 */
/* adjust source row starting-point */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1));
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] = 255;
pScanline[1] = pDataline[4];
pScanline[2] = pDataline[2];
pScanline[3] = pDataline[0];
}
else
{
pScanline[0] = (mng_uint8)s;
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[i+1] = DIV255B8(s * pDataline[4-i-i]);
}
}
#else
pScanline[1] = DIV255B8(s * pDataline[4]);
pScanline[2] = DIV255B8(s * pDataline[2]);
pScanline[3] = DIV255B8(s * pDataline[0]);
#endif
}
}
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] = 255;
pScanline[1] = pDataline[2];
pScanline[2] = pDataline[1];
pScanline[3] = pDataline[0];
}
else
{
pScanline[0] = (mng_uint8)s;
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[i+1] = DIV255B8(s * pDataline[2-i]);
}
}
#else
pScanline[1] = DIV255B8(s * pDataline[2]);
pScanline[2] = DIV255B8(s * pDataline[1]);
pScanline[3] = DIV255B8(s * pDataline[0]);
#endif
}
}
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] = 255;
pScanline[1] = pDataline[4];
pScanline[2] = pDataline[2];
pScanline[3] = pDataline[0];
}
else
{ /* now blend (premultiplied) */
t = 255 - s;
pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0])));
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[i+1] = DIV255B8(s * pDataline[4-i-i] + t *
pScanline[i+1]);
}
}
#else
pScanline[1] = DIV255B8(s * pDataline[4] + t * pScanline[1]);
pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]);
pScanline[3] = DIV255B8(s * pDataline[0] + t * pScanline[3]);
#endif
}
}
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] = 255;
pScanline[1] = pDataline[2];
pScanline[2] = pDataline[1];
pScanline[3] = pDataline[0];
}
else
{ /* now blend (premultiplied) */
t = 255 - s;
pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0])));
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[i+1] = DIV255B8(s * pDataline[2-i] + t *
pScanline[i+1]);
}
}
#else
pScanline[1] = DIV255B8(s * pDataline[2] + t * pScanline[1]);
pScanline[2] = DIV255B8(s * pDataline[1] + t * pScanline[2]);
pScanline[3] = DIV255B8(s * pDataline[0] + t * pScanline[3]);
#endif
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8_PM, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
#else /* MNG_NO_16BIT_SUPPORT */
mng_retcode mng_display_abgr8_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_ABGR8_PM, 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 */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2);
if (pData->bIsOpaque) /* forget about transparency ? */
{
{
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] = 255;
pScanline[1] = pDataline[2];
pScanline[2] = pDataline[1];
pScanline[3] = pDataline[0];
}
else
{
pScanline[0] = (mng_uint8)s;
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[i+1] = DIV255B8(s * pDataline[2-i]);
}
}
#else
pScanline[1] = DIV255B8(s * pDataline[2]);
pScanline[2] = DIV255B8(s * pDataline[1]);
pScanline[3] = DIV255B8(s * pDataline[0]);
#endif
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
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] = 255;
pScanline[1] = pDataline[2];
pScanline[2] = pDataline[1];
pScanline[3] = pDataline[0];
}
else
{ /* now blend (premultiplied) */
t = 255 - s;
pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0])));
#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV
{
int i;
for (i=2; i >= 0; i--)
{
pScanline[i+1] = DIV255B8(s * pDataline[2-i] + t *
pScanline[i+1]);
}
}
#else
pScanline[1] = DIV255B8(s * pDataline[2] + t * pScanline[1]);
pScanline[2] = DIV255B8(s * pDataline[1] + t * pScanline[2]);
pScanline[3] = DIV255B8(s * pDataline[0] + t * pScanline[3]);
#endif
}
}
pScanline += (pData->iColinc << 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8_PM, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_16BIT_SUPPORT */
#endif /* MNG_SKIPCANVAS_ABGR8_PM */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_BGR565
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
mng_retcode mng_display_bgr565 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint16 iA16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint8 iA8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565, 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 */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ( (*(pDataline+2)>>5) ) );
*pScanline = (mng_uint8)( ( (*(pDataline+4)) >>3) | ( (*(pDataline+2)&0xFC) << 3) );
pScanline += (pData->iColinc * 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ( (*(pDataline+1)>>5 ) ) );
*pScanline = (mng_uint8)( ( *(pDataline+2) >>3 ) | ( (*(pDataline+1)&0xFC ) << 3) );
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)
{
iA16 = mng_get_uint16 (pDataline+6);
if (iA16) /* any opacity at all ? */
{
if (iA16 == 0xFFFF) /* fully opaque ? */
{ /* scale down by dropping the LSB */
*(pScanline+1) = (mng_uint8)( (*(pDataline))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) );
*pScanline = (mng_uint8)( (*(pDataline+4)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3);
}
else
{ /* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 );
iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) );
iBGr16 = (mng_uint16)( (*(pScanline )) << 3 );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16);
/* and return the composed values */
*(pScanline+1) = (mng_uint8) ( ( (iFGr16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) );
*pScanline = (mng_uint8) ( ( (iFGb16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) );
}
}
pScanline += (pData->iColinc * 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) );
*pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) );
}
else
{ /* do alpha composing */
mng_uint8 iRed, iGreen, iBlue;
iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 );
iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) );
iBlue = (mng_uint8) ( (*pScanline << 3) );
MNG_COMPOSE8 (iRed, *pDataline, iA8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue );
*(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) );
*pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) );
}
}
pScanline += (pData->iColinc * 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
mng_retcode mng_display_bgr565 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint16 iA16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint8 iA8;
mng_uint8 iBps;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565, MNG_LC_START);
#endif
iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1);
/* 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 */
/* adjust source row starting-point */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1));
if (pData->bIsOpaque) /* forget about transparency ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* scale down by dropping the LSB */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) |
( (*(pDataline+iBps)>>5) ) );
*pScanline = (mng_uint8)( ( (*(pDataline+2*iBps)) >>3) |
( (*(pDataline+iBps)&0xFC) << 3) );
pScanline += (pData->iColinc * 2);
pDataline += 4*iBps;
}
}
else
{
if (pData->bIsRGBA16) /* 16-bit input row ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA16 = mng_get_uint16 (pDataline+6);
if (iA16) /* any opacity at all ? */
{
if (iA16 == 0xFFFF) /* fully opaque ? */
{ /* scale down by dropping the LSB */
*(pScanline+1) = (mng_uint8)( (*(pDataline))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) );
*pScanline = (mng_uint8)( (*(pDataline+4)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3);
}
else
{ /* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 );
iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) );
iBGr16 = (mng_uint16)( (*(pScanline )) << 3 );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16);
/* and return the composed values */
*(pScanline+1) = (mng_uint8) ( ( (iFGr16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) );
*pScanline = (mng_uint8) ( ( (iFGb16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) );
}
}
pScanline += (pData->iColinc * 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) );
*pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) );
}
else
{ /* do alpha composing */
mng_uint8 iRed, iGreen, iBlue;
iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 );
iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) );
iBlue = (mng_uint8) ( (*pScanline << 3) );
MNG_COMPOSE8 (iRed, *pDataline, iA8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue );
*(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) );
*pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) );
}
}
pScanline += (pData->iColinc * 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
#else /* MNG_NO_16BIT_SUPPORT */
mng_retcode mng_display_bgr565 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iA8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565, 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 */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2);
if (pData->bIsOpaque) /* forget about transparency ? */
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ( (*(pDataline+1)>>5 ) ) );
*pScanline = (mng_uint8)( ( *(pDataline+2) >>3 ) | ( (*(pDataline+1)&0xFC ) << 3) );
pScanline += (pData->iColinc * 2);
pDataline += 4;
}
}
}
else
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) );
*pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) );
}
else
{ /* do alpha composing */
mng_uint8 iRed, iGreen, iBlue;
iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 );
iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) );
iBlue = (mng_uint8) ( (*pScanline << 3) );
MNG_COMPOSE8 (iRed, *pDataline, iA8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue );
*(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) );
*pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) );
}
}
pScanline += (pData->iColinc * 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_16BIT_SUPPORT */
#endif /* MNG_SKIPCANVAS_BGR565 */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_RGB565
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
mng_retcode mng_display_rgb565 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint16 iA16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint8 iA8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB565, 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 */
*(pScanline+1) = (mng_uint8)( ( ( *(pDataline+4)) & 0xF8) | (*(pDataline+2) >> 5 ) );
*pScanline = (mng_uint8)( ( ( *(pDataline )) >> 3 ) | ((*(pDataline+2) & 0xFC) << 3) );
pScanline += (pData->iColinc * 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) & 0xF8) | (*(pDataline+1) >> 5 ) );
*pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xFC) << 3) );
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)
{
iA16 = mng_get_uint16 (pDataline+6);
if (iA16) /* any opacity at all ? */
{
if (iA16 == 0xFFFF) /* fully opaque ? */
{ /* scale down by dropping the LSB */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline+4)) & 0xF8) | (*(pDataline+2)>>5) );
*pScanline = (mng_uint8)( ( (*(pDataline )) >> 3 ) | ((*(pDataline+2)&0xFC) << 3) );
}
else
{ /* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGr16 = (mng_uint8)( *(pScanline+1) & 0xF8 );
iBGg16 = (mng_uint8)( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0) >> 3 ) );
iBGb16 = (mng_uint8)( *(pScanline ) << 3 );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16);
/* and return the composed values */
*(pScanline+1) = (mng_uint8)( (mng_uint8)((iFGb16 >> 8) &0xF8) | ( (mng_uint8)(iFGg16 >> 8) >> 5 ) );
*pScanline = (mng_uint8)( (mng_uint8) (iFGr16 >>11) | ( ( (mng_uint8)(iFGg16 >> 8) & 0xFC) << 3) );
}
}
pScanline += (pData->iColinc * 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) & 0xF8) | ( *(pDataline+1) >> 5 ) );
*pScanline = (mng_uint8)( ( (*(pDataline )) >> 3 ) | ( (*(pDataline+1) & 0xFC) << 3 ) );
}
else
{ /* do alpha composing */
mng_uint8 iRed, iGreen, iBlue;
iRed = (mng_uint8)( *(pScanline+1) & 0xF8);
iGreen = (mng_uint8)( ( *(pScanline+1) << 5 ) | ( ( (*pScanline)&0xE0)>>3 ) );
iBlue = (mng_uint8)( *(pScanline ) << 3 );
MNG_COMPOSE8 (iRed, *(pDataline+2), iA8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+0), iA8, iBlue );
*(pScanline+1) = (mng_uint8)( ( iRed & 0xF8) | ( iGreen >> 5 ) );
*pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) );
}
}
pScanline += (pData->iColinc * 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB565, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
mng_retcode mng_display_rgb565 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint16 iA16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint8 iA8;
mng_uint8 iBps;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB565, MNG_LC_START);
#endif
iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1);
/* 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 */
/* adjust source row starting-point */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1));
if (pData->bIsOpaque) /* forget about transparency ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* scale down by dropping the LSB */
*(pScanline+1) = (mng_uint8)( ( ( *(pDataline+2*iBps)) & 0xF8) |
(*(pDataline+iBps) >> 5 ) );
*pScanline = (mng_uint8)( ( ( *(pDataline )) >> 3 ) |
((*(pDataline+iBps) & 0xFC) << 3) );
pScanline += (pData->iColinc * 2);
pDataline += 4*iBps;
}
}
else
{
if (pData->bIsRGBA16) /* 16-bit input row ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA16 = mng_get_uint16 (pDataline+6);
if (iA16) /* any opacity at all ? */
{
if (iA16 == 0xFFFF) /* fully opaque ? */
{ /* scale down by dropping the LSB */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline+4)) & 0xF8) | (*(pDataline+2)>>5) );
*pScanline = (mng_uint8)( ( (*(pDataline )) >> 3 ) | ((*(pDataline+2)&0xFC) << 3) );
}
else
{ /* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGr16 = (mng_uint8)( *(pScanline+1) & 0xF8 );
iBGg16 = (mng_uint8)( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0) >> 3 ) );
iBGb16 = (mng_uint8)( *(pScanline ) << 3 );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16);
/* and return the composed values */
*(pScanline+1) = (mng_uint8)( (mng_uint8)((iFGb16 >> 8) &0xF8) | ( (mng_uint8)(iFGg16 >> 8) >> 5 ) );
*pScanline = (mng_uint8)( (mng_uint8) (iFGr16 >>11) | ( ( (mng_uint8)(iFGg16 >> 8) & 0xFC) << 3) );
}
}
pScanline += (pData->iColinc * 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) & 0xF8) | ( *(pDataline+1) >> 5 ) );
*pScanline = (mng_uint8)( ( (*(pDataline )) >> 3 ) | ( (*(pDataline+1) & 0xFC) << 3 ) );
}
else
{ /* do alpha composing */
mng_uint8 iRed, iGreen, iBlue;
iRed = (mng_uint8)( *(pScanline+1) & 0xF8);
iGreen = (mng_uint8)( ( *(pScanline+1) << 5 ) | ( ( (*pScanline)&0xE0)>>3 ) );
iBlue = (mng_uint8)( *(pScanline ) << 3 );
MNG_COMPOSE8 (iRed, *(pDataline+2), iA8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+0), iA8, iBlue );
*(pScanline+1) = (mng_uint8)( ( iRed & 0xF8) | ( iGreen >> 5 ) );
*pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) );
}
}
pScanline += (pData->iColinc * 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB565, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
#else /* MNG_NO_16BIT_SUPPORT */
mng_retcode mng_display_rgb565 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iA8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB565, 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 */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2);
if (pData->bIsOpaque) /* forget about transparency ? */
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) & 0xF8) | (*(pDataline+1) >> 5 ) );
*pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xFC) << 3) );
pScanline += (pData->iColinc * 2);
pDataline += 4;
}
}
}
else
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) & 0xF8) | ( *(pDataline+1) >> 5 ) );
*pScanline = (mng_uint8)( ( (*(pDataline )) >> 3 ) | ( (*(pDataline+1) & 0xFC) << 3 ) );
}
else
{ /* do alpha composing */
mng_uint8 iRed, iGreen, iBlue;
iRed = (mng_uint8)( *(pScanline+1) & 0xF8);
iGreen = (mng_uint8)( ( *(pScanline+1) << 5 ) | ( ( (*pScanline)&0xE0)>>3 ) );
iBlue = (mng_uint8)( *(pScanline ) << 3 );
MNG_COMPOSE8 (iRed, *(pDataline+2), iA8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+0), iA8, iBlue );
*(pScanline+1) = (mng_uint8)( ( iRed & 0xF8) | ( iGreen >> 5 ) );
*pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) );
}
}
pScanline += (pData->iColinc * 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB565, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_16BIT_SUPPORT */
#endif /* MNG_SKIPCANVAS_RGB565 */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_BGRA565
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
mng_retcode mng_display_bgra565 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint16 iFGa16, iBGa16, iCa16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint16 iCr16, iCg16, iCb16;
mng_uint8 iCr8, iCg8, iCb8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA565, 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 * 3);
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 */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ( (*(pDataline+2)>>5) ) );
*pScanline = (mng_uint8)( ( (*(pDataline+4)) >>3) | ( (*(pDataline+2)&0xFC) << 3) );
*(pScanline+2) = *(pDataline+6);
pScanline += (pData->iColinc * 3);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ( (*(pDataline+1)>>5 ) ) );
*pScanline = (mng_uint8)( ( *(pDataline+2) >>3 ) | ( (*(pDataline+1)&0xFC ) << 3) );
*(pScanline+2) = *(pDataline+3);
pScanline += (pData->iColinc * 3);
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 */
iFGa16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*(pScanline+2));
iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16;
if (iFGa16) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa16 == 0xFFFF) || (iBGa16 == 0))
{ /* plain copy it */
*(pScanline+1) = (mng_uint8)( (*(pDataline))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) );
*pScanline = (mng_uint8)( (*(pDataline+4)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3);
*(pScanline+2) = *(pDataline+6);
}
else
{
if (iBGa16 == 0xFFFF) /* background fully opaque ? */
{ /* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 );
iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) );
iBGr16 = (mng_uint16)( (*(pScanline )) << 3 );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16);
/* and return the composed values */
*(pScanline+1) = (mng_uint8) ( ( (iFGr16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) );
*pScanline = (mng_uint8) ( ( (iFGb16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) );
}
else
{ /* scale background up */
iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 );
iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) );
iBGr16 = (mng_uint16)( (*(pScanline )) << 3 );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* let's blend */
MNG_BLEND16 (mng_get_uint16 (pDataline ),
mng_get_uint16 (pDataline+2),
mng_get_uint16 (pDataline+4), iFGa16,
iBGr16, iBGg16, iBGb16, iBGa16,
iCr16, iCg16, iCb16, iCa16);
/* and return the composed values */
*(pScanline+1) = (mng_uint8) ( ( (iCr16 >> 8) & 0xF8 ) | ( (mng_uint8)(iCg16 >> 8) >> 5 ) );
*pScanline = (mng_uint8) ( ( (iCb16 >> 11) ) | (((mng_uint8)(iCg16 >> 8) & 0xFC) << 3) );
*(pScanline+2) = (mng_uint8)(iCa16 >> 8);
}
}
}
pScanline += (pData->iColinc * 3);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *(pScanline+2);
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) );
*pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) );
*(pScanline+2) = *(pDataline+3);
}
else
{
mng_uint8 iRed, iGreen, iBlue;
iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 );
iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) );
iBlue = (mng_uint8) ( (*pScanline << 3) );
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do alpha composing */
MNG_COMPOSE8 (iRed, *pDataline, iFGa8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iFGa8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+2), iFGa8, iBlue );
/* alpha remains fully opaque !!! */
*(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) );
*pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) );
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
iRed , iGreen , iBlue , iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = (mng_uint8) ( ( iCb8 >> 3 ) | ( (iCg8 & 0xFC) << 3) );
*(pScanline+1) = (mng_uint8) ( ( iCr8 & 0xF8 ) | (iCg8>>5) );
*(pScanline+2) = (mng_uint8) iCa8;
}
}
}
pScanline += (pData->iColinc *3);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA565, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
mng_retcode mng_display_bgra565 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint16 iFGa16, iBGa16, iCa16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint16 iCr16, iCg16, iCb16;
mng_uint8 iCr8, iCg8, iCb8;
mng_uint8 iBps;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA565, MNG_LC_START);
#endif
iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1);
/* 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 * 3);
pDataline = pData->pRGBArow; /* address source row */
/* adjust source row starting-point */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1));
if (pData->bIsOpaque) /* forget about transparency ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* scale down by dropping the LSB */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) |
( (*(pDataline+iBps)>>5) ) );
*pScanline = (mng_uint8)( ( (*(pDataline+2*iBps)) >>3) |
( (*(pDataline+iBps)&0xFC) << 3) );
*(pScanline+2) = *(pDataline+3*iBps);
pScanline += (pData->iColinc * 3);
pDataline += 4*iBps;
}
}
else
{
if (pData->bIsRGBA16) /* 16-bit input row ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* get alpha values */
iFGa16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*(pScanline+2));
iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16;
if (iFGa16) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa16 == 0xFFFF) || (iBGa16 == 0))
{ /* plain copy it */
*(pScanline+1) = (mng_uint8)( (*(pDataline))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) );
*pScanline = (mng_uint8)( (*(pDataline+4)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3);
*(pScanline+2) = *(pDataline+6);
}
else
{
if (iBGa16 == 0xFFFF) /* background fully opaque ? */
{ /* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 );
iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) );
iBGr16 = (mng_uint16)( (*(pScanline )) << 3 );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16);
/* and return the composed values */
*(pScanline+1) = (mng_uint8) ( ( (iFGr16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) );
*pScanline = (mng_uint8) ( ( (iFGb16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) );
}
else
{ /* scale background up */
iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 );
iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) );
iBGr16 = (mng_uint16)( (*(pScanline )) << 3 );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* let's blend */
MNG_BLEND16 (mng_get_uint16 (pDataline ),
mng_get_uint16 (pDataline+2),
mng_get_uint16 (pDataline+4), iFGa16,
iBGr16, iBGg16, iBGb16, iBGa16,
iCr16, iCg16, iCb16, iCa16);
/* and return the composed values */
*(pScanline+1) = (mng_uint8) ( ( (iCr16 >> 8) & 0xF8 ) | ( (mng_uint8)(iCg16 >> 8) >> 5 ) );
*pScanline = (mng_uint8) ( ( (iCb16 >> 11) ) | (((mng_uint8)(iCg16 >> 8) & 0xFC) << 3) );
*(pScanline+2) = (mng_uint8)(iCa16 >> 8);
}
}
}
pScanline += (pData->iColinc * 3);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *(pScanline+2);
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) );
*pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) );
*(pScanline+2) = *(pDataline+3);
}
else
{
mng_uint8 iRed, iGreen, iBlue;
iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 );
iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) );
iBlue = (mng_uint8) ( (*pScanline << 3) );
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do alpha composing */
MNG_COMPOSE8 (iRed, *pDataline, iFGa8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iFGa8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+2), iFGa8, iBlue );
/* alpha remains fully opaque !!! */
*(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) );
*pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) );
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
iRed , iGreen , iBlue , iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = (mng_uint8) ( ( iCb8 >> 3 ) | ( (iCg8 & 0xFC) << 3) );
*(pScanline+1) = (mng_uint8) ( ( iCr8 & 0xF8 ) | (iCg8>>5) );
*(pScanline+2) = (mng_uint8) iCa8;
}
}
}
pScanline += (pData->iColinc *3);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA565, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
#else /* MNG_NO_16BIT_SUPPORT */
mng_retcode mng_display_bgra565 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint8 iCr8, iCg8, iCb8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA565, 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 * 3);
pDataline = pData->pRGBArow; /* address source row */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2);
if (pData->bIsOpaque) /* forget about transparency ? */
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ( (*(pDataline+1)>>5 ) ) );
*pScanline = (mng_uint8)( ( *(pDataline+2) >>3 ) | ( (*(pDataline+1)&0xFC ) << 3) );
*(pScanline+2) = *(pDataline+3);
pScanline += (pData->iColinc * 3);
pDataline += 4;
}
}
}
else
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *(pScanline+2);
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) );
*pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) );
*(pScanline+2) = *(pDataline+3);
}
else
{
mng_uint8 iRed, iGreen, iBlue;
iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 );
iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) );
iBlue = (mng_uint8) ( (*pScanline << 3) );
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do alpha composing */
MNG_COMPOSE8 (iRed, *pDataline, iFGa8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iFGa8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+2), iFGa8, iBlue );
/* alpha remains fully opaque !!! */
*(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) );
*pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) );
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
iRed , iGreen , iBlue , iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = (mng_uint8) ( ( iCb8 >> 3 ) | ( (iCg8 & 0xFC) << 3) );
*(pScanline+1) = (mng_uint8) ( ( iCr8 & 0xF8 ) | (iCg8>>5) );
*(pScanline+2) = (mng_uint8) iCa8;
}
}
}
pScanline += (pData->iColinc *3);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA565, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_16BIT_SUPPORT */
#endif /* MNG_SKIPCANVAS_BGRA565 */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_RGBA565
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
mng_retcode mng_display_rgba565 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint16 iFGa16, iBGa16, iCa16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint16 iCr16, iCg16, iCb16;
mng_uint8 iCr8, iCg8, iCb8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA565, 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 * 3);
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 */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline+4))&0xF8 ) | ( (*(pDataline+2)>>5) ) );
*pScanline = (mng_uint8)( ( (*(pDataline)) >>3) | ( (*(pDataline+2)&0xFC) << 3) );
*(pScanline+2) = *(pDataline+6);
pScanline += (pData->iColinc * 3);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline+2))&0xF8 ) | ( (*(pDataline+1)>>5 ) ) );
*pScanline = (mng_uint8)( ( *(pDataline) >>3 ) | ( (*(pDataline+1)&0xFC ) << 3) );
*(pScanline+2) = *(pDataline+3);
pScanline += (pData->iColinc * 3);
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 */
iFGa16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*(pScanline+2));
iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16;
if (iFGa16) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa16 == 0xFFFF) || (iBGa16 == 0))
{ /* plain copy it */
*(pScanline+1) = (mng_uint8)( (*(pDataline+4))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) );
*pScanline = (mng_uint8)( (*(pDataline)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3);
*(pScanline+2) = *(pDataline+6);
}
else
{
if (iBGa16 == 0xFFFF) /* background fully opaque ? */
{ /* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGr16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 );
iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) );
iBGb16 = (mng_uint16)( (*(pScanline )) << 3 );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16);
/* and return the composed values */
*(pScanline+1) = (mng_uint8) ( ( (iFGb16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) );
*pScanline = (mng_uint8) ( ( (iFGr16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) );
}
else
{ /* scale background up */
iBGr16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 );
iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) );
iBGb16 = (mng_uint16)( (*(pScanline )) << 3 );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* let's blend */
MNG_BLEND16 (mng_get_uint16 (pDataline ),
mng_get_uint16 (pDataline+2),
mng_get_uint16 (pDataline+4), iFGa16,
iBGr16, iBGg16, iBGb16, iBGa16,
iCr16, iCg16, iCb16, iCa16);
/* and return the composed values */
*(pScanline+1) = (mng_uint8) ( ( (iCb16 >> 8) & 0xF8 ) | ( (mng_uint8)(iCg16 >> 8) >> 5 ) );
*pScanline = (mng_uint8) ( ( (iCr16 >> 11) ) | (((mng_uint8)(iCg16 >> 8) & 0xFC) << 3) );
*(pScanline+2) = (mng_uint8)(iCa16 >> 8);
}
}
}
pScanline += (pData->iColinc * 3);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *(pScanline+2);
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) &0xF8 ) | (*(pDataline+1) >>5 ) );
*pScanline = (mng_uint8)( ( ((*(pDataline))>>3) ) | ((*(pDataline+1)&0xFC) << 3) );
*(pScanline+2) = *(pDataline+3);
}
else
{
mng_uint8 iRed, iGreen, iBlue;
iBlue = (mng_uint8) ( *(pScanline+1) & 0xF8 );
iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) );
iRed = (mng_uint8) ( (*pScanline << 3) );
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do alpha composing */
MNG_COMPOSE8 (iRed, *pDataline, iFGa8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iFGa8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+2), iFGa8, iBlue );
/* alpha remains fully opaque !!! */
*(pScanline+1) = (mng_uint8) ( ( iBlue & 0xF8 ) | (iGreen>>5) );
*pScanline = (mng_uint8) ( ( iRed >> 3 ) | ( (iGreen & 0xFC) << 3) );
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
iRed , iGreen , iBlue , iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = (mng_uint8) ( ( iCr8 >> 3 ) | ( (iCg8 & 0xFC) << 3) );
*(pScanline+1) = (mng_uint8) ( ( iCb8 & 0xF8 ) | (iCg8>>5) );
*(pScanline+2) = (mng_uint8) iCa8;
}
}
}
pScanline += (pData->iColinc *3);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA565, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
mng_retcode mng_display_rgba565 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint16 iFGa16, iBGa16, iCa16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint16 iCr16, iCg16, iCb16;
mng_uint8 iCr8, iCg8, iCb8;
mng_uint8 iBps;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA565, MNG_LC_START);
#endif
iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1);
/* 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 * 3);
pDataline = pData->pRGBArow; /* address source row */
/* adjust source row starting-point */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1));
if (pData->bIsOpaque) /* forget about transparency ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* scale down by dropping the LSB */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline+2*iBps))&0xF8 ) |
( (*(pDataline+iBps)>>5) ) );
*pScanline = (mng_uint8)( ( (*(pDataline)) >>3) |
( (*(pDataline+iBps)&0xFC) << 3) );
*(pScanline+2) = *(pDataline+3*iBps);
pScanline += (pData->iColinc * 3);
pDataline += 4*iBps;
}
}
else
{
if (pData->bIsRGBA16) /* 16-bit input row ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* get alpha values */
iFGa16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*(pScanline+2));
iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16;
if (iFGa16) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa16 == 0xFFFF) || (iBGa16 == 0))
{ /* plain copy it */
*(pScanline+1) = (mng_uint8)( (*(pDataline+4))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) );
*pScanline = (mng_uint8)( (*(pDataline)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3);
*(pScanline+2) = *(pDataline+6);
}
else
{
if (iBGa16 == 0xFFFF) /* background fully opaque ? */
{ /* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGr16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 );
iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) );
iBGb16 = (mng_uint16)( (*(pScanline )) << 3 );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16);
/* and return the composed values */
*(pScanline+1) = (mng_uint8) ( ( (iFGb16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) );
*pScanline = (mng_uint8) ( ( (iFGr16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) );
}
else
{ /* scale background up */
iBGr16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 );
iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) );
iBGb16 = (mng_uint16)( (*(pScanline )) << 3 );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* let's blend */
MNG_BLEND16 (mng_get_uint16 (pDataline ),
mng_get_uint16 (pDataline+2),
mng_get_uint16 (pDataline+4), iFGa16,
iBGr16, iBGg16, iBGb16, iBGa16,
iCr16, iCg16, iCb16, iCa16);
/* and return the composed values */
*(pScanline+1) = (mng_uint8) ( ( (iCb16 >> 8) & 0xF8 ) | ( (mng_uint8)(iCg16 >> 8) >> 5 ) );
*pScanline = (mng_uint8) ( ( (iCr16 >> 11) ) | (((mng_uint8)(iCg16 >> 8) & 0xFC) << 3) );
*(pScanline+2) = (mng_uint8)(iCa16 >> 8);
}
}
}
pScanline += (pData->iColinc * 3);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *(pScanline+2);
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) &0xF8 ) | (*(pDataline+1) >>5 ) );
*pScanline = (mng_uint8)( ( ((*(pDataline))>>3) ) | ((*(pDataline+1)&0xFC) << 3) );
*(pScanline+2) = *(pDataline+3);
}
else
{
mng_uint8 iRed, iGreen, iBlue;
iBlue = (mng_uint8) ( *(pScanline+1) & 0xF8 );
iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) );
iRed = (mng_uint8) ( (*pScanline << 3) );
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do alpha composing */
MNG_COMPOSE8 (iRed, *pDataline, iFGa8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iFGa8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+2), iFGa8, iBlue );
/* alpha remains fully opaque !!! */
*(pScanline+1) = (mng_uint8) ( ( iBlue & 0xF8 ) | (iGreen>>5) );
*pScanline = (mng_uint8) ( ( iRed >> 3 ) | ( (iGreen & 0xFC) << 3) );
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
iRed , iGreen , iBlue , iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = (mng_uint8) ( ( iCr8 >> 3 ) | ( (iCg8 & 0xFC) << 3) );
*(pScanline+1) = (mng_uint8) ( ( iCb8 & 0xF8 ) | (iCg8>>5) );
*(pScanline+2) = (mng_uint8) iCa8;
}
}
}
pScanline += (pData->iColinc *3);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA565, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
#else /* MNG_NO_16BIT_SUPPORT */
mng_retcode mng_display_rgba565 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8, iCa8;
mng_uint8 iCr8, iCg8, iCb8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA565, 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 * 3);
pDataline = pData->pRGBArow; /* address source row */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2);
if (pData->bIsOpaque) /* forget about transparency ? */
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline+2))&0xF8 ) | ( (*(pDataline+1)>>5 ) ) );
*pScanline = (mng_uint8)( ( *(pDataline) >>3 ) | ( (*(pDataline+1)&0xFC ) << 3) );
*(pScanline+2) = *(pDataline+3);
pScanline += (pData->iColinc * 3);
pDataline += 4;
}
}
}
else
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *(pScanline+2);
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) &0xF8 ) | (*(pDataline+1) >>5 ) );
*pScanline = (mng_uint8)( ( ((*(pDataline))>>3) ) | ((*(pDataline+1)&0xFC) << 3) );
*(pScanline+2) = *(pDataline+3);
}
else
{
mng_uint8 iRed, iGreen, iBlue;
iBlue = (mng_uint8) ( *(pScanline+1) & 0xF8 );
iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) );
iRed = (mng_uint8) ( (*pScanline << 3) );
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do alpha composing */
MNG_COMPOSE8 (iRed, *pDataline, iFGa8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iFGa8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+2), iFGa8, iBlue );
/* alpha remains fully opaque !!! */
*(pScanline+1) = (mng_uint8) ( ( iBlue & 0xF8 ) | (iGreen>>5) );
*pScanline = (mng_uint8) ( ( iRed >> 3 ) | ( (iGreen & 0xFC) << 3) );
}
else
{ /* now blend */
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8,
iRed , iGreen , iBlue , iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pScanline = (mng_uint8) ( ( iCr8 >> 3 ) | ( (iCg8 & 0xFC) << 3) );
*(pScanline+1) = (mng_uint8) ( ( iCb8 & 0xF8 ) | (iCg8>>5) );
*(pScanline+2) = (mng_uint8) iCa8;
}
}
}
pScanline += (pData->iColinc *3);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA565, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_16BIT_SUPPORT */
#endif /* MNG_SKIPCANVAS_RGBA565 */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_BGR565_A8
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
mng_retcode mng_display_bgr565_a8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pAlphaline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint16 iA16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16, iBGa16;
mng_uint16 iCr16, iCg16, iCb16, iCa16;
mng_uint8 iA8, iBGa8, iCa8;
mng_uint8 iCr8, iCg8, iCb8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565_A8, 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);
pAlphaline = (mng_uint8p)pData->fGetalphaline (((mng_handle)pData),
pData->iRow + pData->iDestt -
pData->iSourcet);
/* adjust destination row
starting-point */
pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2);
pAlphaline = pAlphaline + pData->iCol + pData->iDestl;
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 */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ((*(pDataline+2)>>5) ) );
*pScanline = (mng_uint8)( ( (*(pDataline+4)) >>3) | ((*(pDataline+2)&0xFC) << 3) );
*pAlphaline = (mng_uint8)(*(pDataline+6));
pScanline += (pData->iColinc * 2);
pAlphaline += pData->iColinc;
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ((*(pDataline+1)>>5 ) ) );
*pScanline = (mng_uint8)( ( *(pDataline+2) >>3 ) | ((*(pDataline+1)&0xFC ) << 3) );
*pAlphaline = (mng_uint8)(*(pDataline+3));
pScanline += (pData->iColinc * 2);
pAlphaline += pData->iColinc;
pDataline += 4;
}
}
}
else /* Not fully opaque */
{
if (pData->bIsRGBA16) /* 16-bit input row ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*pAlphaline);
iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16;
if (iA16) /* any opacity at all ? */
{
if ((iA16 == 0xFFFF) || (iBGa16 == 0)) /* fully opaque or background fully transparent ? */
{ /* scale down by dropping the LSB */
*(pScanline+1) = (mng_uint8)( (*(pDataline))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) );
*pScanline = (mng_uint8)( (*(pDataline+4)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3);
*pAlphaline = *(pDataline+6);
}
else
{
if (iBGa16 == 0xFFFF) /* background fully opaque ? */
{
/* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 );
iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) );
iBGr16 = (mng_uint16)( (*(pScanline )) << 3 );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16);
/* and return the composed values */
*(pScanline+1) = (mng_uint8) ( ( (iFGr16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) );
*pScanline = (mng_uint8) ( ( (iFGb16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) );
*pAlphaline = (mng_uint8)(iA16>>8);
}
else /* background is not fully opaque */
{ /* scale background up */
iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 );
iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) );
iBGr16 = (mng_uint16)( (*(pScanline )) << 3 );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* let's blend */
MNG_BLEND16 (mng_get_uint16 (pDataline ),
mng_get_uint16 (pDataline+2),
mng_get_uint16 (pDataline+4), iA16,
iBGr16, iBGg16, iBGb16, iBGa16,
iCr16, iCg16, iCb16, iCa16);
/* and return the composed values */
*(pScanline+1) = (mng_uint8) ( ( (iCr16 >> 8)&0xF8 ) | ( (mng_uint8)(iCg16>>8) >> 5) );
*pScanline = (mng_uint8) ( ( (iCb16>>11) ) | (((mng_uint8)(iCg16>>8)&0xFC) << 3) );
*pAlphaline = (mng_uint8)(iCa16 >> 8);
}
}
}
pScanline += (pData->iColinc * 2);
pAlphaline += pData->iColinc;
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
iBGa8 = *pAlphaline;
if (iA8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iA8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) );
*pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) );
*pAlphaline = *(pDataline+3);
}
else
{
if (iBGa8 == 0xFF) /* background fully opaque ? */
{
/* do alpha composing */
mng_uint8 iRed, iGreen, iBlue;
iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 );
iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | (((*pScanline) & 0xE0)>>3 ) );
iBlue = (mng_uint8) ( (*pScanline << 3) );
MNG_COMPOSE8 (iRed, *pDataline, iA8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue );
*(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) );
*pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ((iGreen & 0xFC) << 3) );
*pAlphaline = iA8;
}
else /* background not fully opaque */
{
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iA8,
*pScanline, *(pScanline+1), *(pScanline+2), iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*(pScanline+1) = (mng_uint8) ( ( iCr8 & 0xF8 ) | (iCg8>>5) );
*pScanline = (mng_uint8) ( ( iCb8 >> 3 ) | ((iCg8 & 0xFC) << 3) );
*pAlphaline = iCa8;
}
}
}
pScanline += (pData->iColinc * 2);
pAlphaline += pData->iColinc;
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565_A8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
mng_retcode mng_display_bgr565_a8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pAlphaline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint16 iA16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16, iBGa16;
mng_uint16 iCr16, iCg16, iCb16, iCa16;
mng_uint8 iA8, iBGa8, iCa8;
mng_uint8 iCr8, iCg8, iCb8;
mng_uint8 iBps;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565_A8, MNG_LC_START);
#endif
iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1);
/* 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);
pAlphaline = (mng_uint8p)pData->fGetalphaline (((mng_handle)pData),
pData->iRow + pData->iDestt -
pData->iSourcet);
/* adjust destination row
starting-point */
pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2);
pAlphaline = pAlphaline + pData->iCol + pData->iDestl;
pDataline = pData->pRGBArow; /* address source row */
/* adjust source row starting-point */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1));
if (pData->bIsOpaque) /* forget about transparency ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* scale down by dropping the LSB */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) |
((*(pDataline+iBps)>>5) ) );
*pScanline = (mng_uint8)( ( (*(pDataline+2*iBps)) >>3) |
((*(pDataline+iBps)&0xFC) << 3) );
*pAlphaline = (mng_uint8)(*(pDataline+6));
pScanline += (pData->iColinc * 2);
pAlphaline += pData->iColinc;
pDataline += 8;
}
}
else /* Not fully opaque */
{
if (pData->bIsRGBA16) /* 16-bit input row ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*pAlphaline);
iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16;
if (iA16) /* any opacity at all ? */
{
if ((iA16 == 0xFFFF) || (iBGa16 == 0)) /* fully opaque or background fully transparent ? */
{ /* scale down by dropping the LSB */
*(pScanline+1) = (mng_uint8)( (*(pDataline))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) );
*pScanline = (mng_uint8)( (*(pDataline+4)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3);
*pAlphaline = *(pDataline+6);
}
else
{
if (iBGa16 == 0xFFFF) /* background fully opaque ? */
{
/* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 );
iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) );
iBGr16 = (mng_uint16)( (*(pScanline )) << 3 );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16);
/* and return the composed values */
*(pScanline+1) = (mng_uint8) ( ( (iFGr16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) );
*pScanline = (mng_uint8) ( ( (iFGb16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) );
*pAlphaline = (mng_uint8)(iA16>>8);
}
else /* background is not fully opaque */
{ /* scale background up */
iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 );
iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) );
iBGr16 = (mng_uint16)( (*(pScanline )) << 3 );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* let's blend */
MNG_BLEND16 (mng_get_uint16 (pDataline ),
mng_get_uint16 (pDataline+2),
mng_get_uint16 (pDataline+4), iA16,
iBGr16, iBGg16, iBGb16, iBGa16,
iCr16, iCg16, iCb16, iCa16);
/* and return the composed values */
*(pScanline+1) = (mng_uint8) ( ( (iCr16 >> 8)&0xF8 ) | ( (mng_uint8)(iCg16>>8) >> 5) );
*pScanline = (mng_uint8) ( ( (iCb16>>11) ) | (((mng_uint8)(iCg16>>8)&0xFC) << 3) );
*pAlphaline = (mng_uint8)(iCa16 >> 8);
}
}
}
pScanline += (pData->iColinc * 2);
pAlphaline += pData->iColinc;
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
iBGa8 = *pAlphaline;
if (iA8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iA8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) );
*pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) );
*pAlphaline = *(pDataline+3);
}
else
{
if (iBGa8 == 0xFF) /* background fully opaque ? */
{
/* do alpha composing */
mng_uint8 iRed, iGreen, iBlue;
iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 );
iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | (((*pScanline) & 0xE0)>>3 ) );
iBlue = (mng_uint8) ( (*pScanline << 3) );
MNG_COMPOSE8 (iRed, *pDataline, iA8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue );
*(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) );
*pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ((iGreen & 0xFC) << 3) );
*pAlphaline = iA8;
}
else /* background not fully opaque */
{
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iA8,
*pScanline, *(pScanline+1), *(pScanline+2), iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*(pScanline+1) = (mng_uint8) ( ( iCr8 & 0xF8 ) | (iCg8>>5) );
*pScanline = (mng_uint8) ( ( iCb8 >> 3 ) | ((iCg8 & 0xFC) << 3) );
*pAlphaline = iCa8;
}
}
}
pScanline += (pData->iColinc * 2);
pAlphaline += pData->iColinc;
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565_A8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
#else /* MNG_NO_16BIT_SUPPORT */
mng_retcode mng_display_bgr565_a8 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pAlphaline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iA8, iBGa8, iCa8;
mng_uint8 iCr8, iCg8, iCb8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565_A8, 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);
pAlphaline = (mng_uint8p)pData->fGetalphaline (((mng_handle)pData),
pData->iRow + pData->iDestt -
pData->iSourcet);
/* adjust destination row
starting-point */
pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2);
pAlphaline = pAlphaline + pData->iCol + pData->iDestl;
pDataline = pData->pRGBArow; /* address source row */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2);
if (pData->bIsOpaque) /* forget about transparency ? */
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ((*(pDataline+1)>>5 ) ) );
*pScanline = (mng_uint8)( ( *(pDataline+2) >>3 ) | ((*(pDataline+1)&0xFC ) << 3) );
*pAlphaline = (mng_uint8)(*(pDataline+3));
pScanline += (pData->iColinc * 2);
pAlphaline += pData->iColinc;
pDataline += 4;
}
}
}
else /* Not fully opaque */
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
iBGa8 = *pAlphaline;
if (iA8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iA8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) );
*pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) );
*pAlphaline = *(pDataline+3);
}
else
{
if (iBGa8 == 0xFF) /* background fully opaque ? */
{
/* do alpha composing */
mng_uint8 iRed, iGreen, iBlue;
iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 );
iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | (((*pScanline) & 0xE0)>>3 ) );
iBlue = (mng_uint8) ( (*pScanline << 3) );
MNG_COMPOSE8 (iRed, *pDataline, iA8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue );
*(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) );
*pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ((iGreen & 0xFC) << 3) );
*pAlphaline = iA8;
}
else /* background not fully opaque */
{
MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iA8,
*pScanline, *(pScanline+1), *(pScanline+2), iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*(pScanline+1) = (mng_uint8) ( ( iCr8 & 0xF8 ) | (iCg8>>5) );
*pScanline = (mng_uint8) ( ( iCb8 >> 3 ) | ((iCg8 & 0xFC) << 3) );
*pAlphaline = iCa8;
}
}
}
pScanline += (pData->iColinc * 2);
pAlphaline += pData->iColinc;
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565_A8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_16BIT_SUPPORT */
#endif /* MNG_SKIPCANVAS_BGR565_A8 */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_RGB555
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
mng_retcode mng_display_rgb555 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint16 iA16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint8 iA8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB555, 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 */
*(pScanline+1) = (mng_uint8)( ((*(pDataline+4) & 0xF8) >> 1 ) | (*(pDataline+2) >> 6 ) );
*pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+2) & 0xF8) << 2 ) );
pScanline += (pData->iColinc * 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*(pScanline+1) = (mng_uint8)( ((*(pDataline+2) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) );
*pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) );
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)
{
iA16 = mng_get_uint16 (pDataline+6);
if (iA16) /* any opacity at all ? */
{
if (iA16 == 0xFFFF) /* fully opaque ? */
{ /* scale down by dropping the LSB */
*(pScanline+1) = (mng_uint8)( ((*(pDataline+4) & 0xF8) >> 1 ) | (*(pDataline+2) >> 6 ) );
*pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+2) & 0xF8) << 2 ) );
}
else
{ /* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGr16 = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 );
iBGg16 = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) );
iBGb16 = (mng_uint8)( *(pScanline ) << 3 );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16);
/* and return the composed values */
*(pScanline+1) = (mng_uint8)( (mng_uint8)(((iFGb16 >> 8) & 0xF8) >> 1 ) | ( (mng_uint8)(iFGg16 >> 8) >> 6 ) );
*pScanline = (mng_uint8)( (mng_uint8) ((iFGr16 >>11) >> 3 ) | ( ( (mng_uint8)(iFGg16 >> 8) & 0xF8) << 2 ) );
}
}
pScanline += (pData->iColinc * 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ((*(pDataline+2) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) );
*pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) );
}
else
{ /* do alpha composing */
mng_uint8 iRed, iGreen, iBlue;
iRed = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 );
iGreen = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) );
iBlue = (mng_uint8)( *(pScanline ) << 3 );
MNG_COMPOSE8 (iRed, *(pDataline+2), iA8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+0), iA8, iBlue );
*(pScanline+1) = (mng_uint8)( ( (iRed & 0xF8) >> 1 ) | ( iGreen >> 6 ) );
*pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xF8) << 2 ) );
}
}
pScanline += (pData->iColinc * 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB555, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
mng_retcode mng_display_rgb555 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint16 iA16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint8 iA8;
mng_uint8 iBps;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB555, MNG_LC_START);
#endif
iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1);
/* 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 */
/* adjust source row starting-point */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1));
if (pData->bIsOpaque) /* forget about transparency ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* scale down by dropping the LSB */
*(pScanline+1) = (mng_uint8)( ((*(pDataline+2*iBps) & 0xF8) >> 1 ) | (*(pDataline+iBps) >> 6 ) );
*pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+iBps) & 0xF8) << 2 ) );
pScanline += (pData->iColinc * 2);
pDataline += 4*iBps;
}
}
else
{
if (pData->bIsRGBA16) /* 16-bit input row ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA16 = mng_get_uint16 (pDataline+6);
if (iA16) /* any opacity at all ? */
{
if (iA16 == 0xFFFF) /* fully opaque ? */
{ /* scale down by dropping the LSB */
*(pScanline+1) = (mng_uint8)( ((*(pDataline+4) & 0xF8) >> 1 ) | (*(pDataline+2) >> 6 ) );
*pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+2) & 0xF8) << 2 ) );
}
else
{ /* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGr16 = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 );
iBGg16 = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) );
iBGb16 = (mng_uint8)( *(pScanline ) << 3 );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16);
/* and return the composed values */
*(pScanline+1) = (mng_uint8)( (mng_uint8)(((iFGb16 >> 8) & 0xF8) >> 1 ) | ( (mng_uint8)(iFGg16 >> 8) >> 6 ) );
*pScanline = (mng_uint8)( (mng_uint8) ((iFGr16 >>11) >> 3 ) | ( ( (mng_uint8)(iFGg16 >> 8) & 0xF8) << 2 ) );
}
}
pScanline += (pData->iColinc * 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ((*(pDataline+2) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) );
*pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) );
}
else
{ /* do alpha composing */
mng_uint8 iRed, iGreen, iBlue;
iRed = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 );
iGreen = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) );
iBlue = (mng_uint8)( *(pScanline ) << 3 );
MNG_COMPOSE8 (iRed, *(pDataline+2), iA8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+0), iA8, iBlue );
*(pScanline+1) = (mng_uint8)( ( (iRed & 0xF8) >> 1 ) | ( iGreen >> 6 ) );
*pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xF8) << 2 ) );
}
}
pScanline += (pData->iColinc * 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB555, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
#else /* MNG_NO_16BIT_SUPPORT */
mng_retcode mng_display_rgb555 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iA8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB555, 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 */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2);
if (pData->bIsOpaque) /* forget about transparency ? */
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*(pScanline+1) = (mng_uint8)( ((*(pDataline+2) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) );
*pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) );
pScanline += (pData->iColinc * 2);
pDataline += 4;
}
}
}
else
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ((*(pDataline+2) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) );
*pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) );
}
else
{ /* do alpha composing */
mng_uint8 iRed, iGreen, iBlue;
iRed = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 );
iGreen = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) );
iBlue = (mng_uint8)( *(pScanline ) << 3 );
MNG_COMPOSE8 (iRed, *(pDataline+2), iA8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+0), iA8, iBlue );
*(pScanline+1) = (mng_uint8)( ( (iRed & 0xF8) >> 1 ) | ( iGreen >> 6 ) );
*pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xF8) << 2 ) );
}
}
pScanline += (pData->iColinc * 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_RGB555, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_16BIT_SUPPORT */
#endif /* MNG_SKIPCANVAS_RGB555 */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_BGR555
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
mng_retcode mng_display_bgr555 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint16 iA16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint8 iA8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR555, 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 */
*(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+2) >> 6 ) );
*pScanline = (mng_uint8)( ( *(pDataline+4) >> 3 ) | ((*(pDataline+2) & 0xF8) << 2 ) );
pScanline += (pData->iColinc * 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) );
*pScanline = (mng_uint8)( ( *(pDataline+2) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) );
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)
{
iA16 = mng_get_uint16 (pDataline+6);
if (iA16) /* any opacity at all ? */
{
if (iA16 == 0xFFFF) /* fully opaque ? */
{ /* scale down by dropping the LSB */
*(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+2) >> 6 ) );
*pScanline = (mng_uint8)( ( *(pDataline+4) >> 3 ) | ((*(pDataline+2) & 0xF8) << 2 ) );
}
else
{ /* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGb16 = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 );
iBGg16 = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) );
iBGr16 = (mng_uint8)( *(pScanline ) << 3 );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16);
/* and return the composed values */
*(pScanline+1) = (mng_uint8)( (mng_uint8)(((iFGr16 >> 8) & 0xF8) >> 1 ) | ( (mng_uint8)(iFGg16 >> 8) >> 6 ) );
*pScanline = (mng_uint8)( (mng_uint8) ((iFGb16 >>11) >> 3 ) | ( ( (mng_uint8)(iFGg16 >> 8) & 0xF8) << 2 ) );
}
}
pScanline += (pData->iColinc * 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) );
*pScanline = (mng_uint8)( ( *(pDataline+2) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) );
}
else
{ /* do alpha composing */
mng_uint8 iRed, iGreen, iBlue;
iRed = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 );
iGreen = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) );
iBlue = (mng_uint8)( *(pScanline ) << 3 );
MNG_COMPOSE8 (iRed, *(pDataline+0), iA8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue );
*(pScanline+1) = (mng_uint8)( ( (iRed & 0xF8) >> 1 ) | ( iGreen >> 6 ) );
*pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xF8) << 2 ) );
}
}
pScanline += (pData->iColinc * 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR555, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
mng_retcode mng_display_bgr555 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint16 iA16;
mng_uint16 iFGr16, iFGg16, iFGb16;
mng_uint16 iBGr16, iBGg16, iBGb16;
mng_uint8 iA8;
mng_uint8 iBps;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR555, MNG_LC_START);
#endif
iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1);
/* 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 */
/* adjust source row starting-point */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1));
if (pData->bIsOpaque) /* forget about transparency ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* scale down by dropping the LSB */
*(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+iBps) >> 6 ) );
*pScanline = (mng_uint8)( ( *(pDataline+2*iBps) >> 3 ) | ((*(pDataline+iBps) & 0xF8) << 2 ) );
pScanline += (pData->iColinc * 2);
pDataline += 4*iBps;
}
}
else
{
if (pData->bIsRGBA16) /* 16-bit input row ? */
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA16 = mng_get_uint16 (pDataline+6);
if (iA16) /* any opacity at all ? */
{
if (iA16 == 0xFFFF) /* fully opaque ? */
{ /* scale down by dropping the LSB */
*(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+2) >> 6 ) );
*pScanline = (mng_uint8)( ( *(pDataline+4) >> 3 ) | ((*(pDataline+2) & 0xF8) << 2 ) );
}
else
{ /* get the proper values */
iFGr16 = mng_get_uint16 (pDataline );
iFGg16 = mng_get_uint16 (pDataline+2);
iFGb16 = mng_get_uint16 (pDataline+4);
/* scale background up */
iBGb16 = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 );
iBGg16 = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) );
iBGr16 = (mng_uint8)( *(pScanline ) << 3 );
iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16;
iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16;
iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16;
/* now compose */
MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16);
MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16);
MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16);
/* and return the composed values */
*(pScanline+1) = (mng_uint8)( (mng_uint8)(((iFGr16 >> 8) & 0xF8) >> 1 ) | ( (mng_uint8)(iFGg16 >> 8) >> 6 ) );
*pScanline = (mng_uint8)( (mng_uint8) ((iFGb16 >>11) >> 3 ) | ( ( (mng_uint8)(iFGg16 >> 8) & 0xF8) << 2 ) );
}
}
pScanline += (pData->iColinc * 2);
pDataline += 8;
}
}
else
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) );
*pScanline = (mng_uint8)( ( *(pDataline+2) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) );
}
else
{ /* do alpha composing */
mng_uint8 iRed, iGreen, iBlue;
iRed = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 );
iGreen = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) );
iBlue = (mng_uint8)( *(pScanline ) << 3 );
MNG_COMPOSE8 (iRed, *(pDataline+0), iA8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue );
*(pScanline+1) = (mng_uint8)( ( (iRed & 0xF8) >> 1 ) | ( iGreen >> 6 ) );
*pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xF8) << 2 ) );
}
}
pScanline += (pData->iColinc * 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR555, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */
#else /* MNG_NO_16BIT_SUPPORT */
mng_retcode mng_display_bgr555 (mng_datap pData)
{
mng_uint8p pScanline;
mng_uint8p pDataline;
mng_int32 iX;
mng_uint8 iA8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR555, 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 */
pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2);
if (pData->bIsOpaque) /* forget about transparency ? */
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{ /* copy the values */
*(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) );
*pScanline = (mng_uint8)( ( *(pDataline+2) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) );
pScanline += (pData->iColinc * 2);
pDataline += 4;
}
}
}
else
{
{
for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer;
iX += pData->iColinc)
{
iA8 = *(pDataline+3); /* get alpha value */
if (iA8) /* any opacity at all ? */
{
if (iA8 == 0xFF) /* fully opaque ? */
{ /* then simply copy the values */
*(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) );
*pScanline = (mng_uint8)( ( *(pDataline+2) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) );
}
else
{ /* do alpha composing */
mng_uint8 iRed, iGreen, iBlue;
iRed = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 );
iGreen = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) );
iBlue = (mng_uint8)( *(pScanline ) << 3 );
MNG_COMPOSE8 (iRed, *(pDataline+0), iA8, iRed );
MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen );
MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue );
*(pScanline+1) = (mng_uint8)( ( (iRed & 0xF8) >> 1 ) | ( iGreen >> 6 ) );
*pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xF8) << 2 ) );
}
}
pScanline += (pData->iColinc * 2);
pDataline += 4;
}
}
}
}
check_update_region (pData);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_BGR555, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_16BIT_SUPPORT */
#endif /* MNG_SKIPCANVAS_BGR555 */
#ifndef MNG_SKIPCHUNK_BACK
/* ************************************************************************** */
/* * * */
/* * Background restore routines - restore the background with info from * */
/* * the BACK and/or bKGD chunk or the app's background canvas * */
/* * * */
/* ************************************************************************** */
mng_retcode mng_restore_bkgd_backimage (mng_datap pData)
{
/* save some stuff */
mng_uint8p pRGBArow = pData->pRGBArow;
mng_int32 iRow = pData->iRow;
mng_int32 iRowsamples = pData->iRowsamples;
mng_retcode iRetcode; /* work variables */
mng_uint8p pTemp;
mng_uint8p pWork = pRGBArow;
mng_uint32 iX;
mng_int32 iZ;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RESTORE_BACKIMAGE, MNG_LC_START);
#endif
/* determine row to retrieve */
pData->iRow = pData->iDestt + iRow + pData->iBackimgoffsy;
while (pData->iRow >= (mng_int32)pData->iBackimgheight)
pData->iRow -= (mng_int32)pData->iBackimgheight;
/* set width to that of background image */
pData->iRowsamples = pData->iBackimgwidth;
/* retrieve into alternate buffer ! */
pData->pRGBArow = pData->pPrevrow;
/* get it then */
iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData);
if (iRetcode) /* on error; bail out */
return iRetcode;
/* we got the full row; but now need to
paste it into the proper location */
iX = pData->iDestl - pData->iBackimgoffsx;
while (iX >= pData->iBackimgwidth)
iX -= pData->iBackimgwidth;
#ifndef MNG_NO_16BIT_SUPPORT
if (pData->bIsRGBA16) /* 16-bit buffer ? */
{
pTemp = pData->pPrevrow + (iX << 3);
for (iZ = (pData->iDestr - pData->iDestl); iZ > 0; iZ--)
{
MNG_COPY (pWork, pTemp, 8);
pWork += 8;
pTemp += 8;
iX++;
/* reached end of bkgd-image line ? */
if (iX >= pData->iBackimgwidth)
{
iX = 0;
pTemp = pData->pPrevrow;
}
}
}
else
#endif
{
pTemp = pData->pPrevrow + (iX << 2);
for (iZ = (pData->iDestr - pData->iDestl); iZ > 0; iZ--)
{
MNG_COPY (pWork, pTemp, 4);
pWork += 4;
pTemp += 4;
iX++;
/* reached end of bkgd-image line ? */
if (iX >= pData->iBackimgwidth)
{
iX = 0;
pTemp = pData->pPrevrow;
}
}
}
pData->pRGBArow = pRGBArow; /* restore original values */
pData->iRow = iRow;
pData->iRowsamples = iRowsamples;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RESTORE_BACKIMAGE, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_restore_bkgd_backcolor (mng_datap pData)
{
mng_int32 iX;
mng_uint32p pWork32 = (mng_uint32p)pData->pRGBArow;
mng_uint32 iWrite;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RESTORE_BACKCOLOR, MNG_LC_START);
#endif
#ifdef MNG_BIGENDIAN_SUPPORTED
/* fast way for big endian */
iWrite = (((mng_uint8)(pData->iBACKred >> 8)) << 24) |
(((mng_uint8)(pData->iBACKgreen >> 8)) << 16) |
(((mng_uint8)(pData->iBACKblue >> 8)) << 8) |
( 0xFF );
#elif defined(MNG_LITTLEENDIAN_SUPPORTED)
/* fast way for little endian */
iWrite = ( 0xFF << 24) |
(((mng_uint8)(pData->iBACKblue >> 8)) << 16) |
(((mng_uint8)(pData->iBACKgreen >> 8)) << 8) |
(((mng_uint8)(pData->iBACKred >> 8)) );
#else
/* generic way, works on all platforms */
/* put the data in memory in the correct order */
{
mng_uint8 aBytes[4];
aBytes[0] = (mng_uint8)(pData->iBACKred >> 8);
aBytes[1] = (mng_uint8)(pData->iBACKgreen >> 8);
aBytes[2] = (mng_uint8)(pData->iBACKblue >> 8);
aBytes[3] = 0xFF;
/* load that data into a register */
iWrite = *(mng_uint32*) aBytes;
}
#endif
/* ok; drop the background-color in there */
for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--)
*pWork32++ = iWrite;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RESTORE_BACKCOLOR, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_bKGD
mng_retcode mng_restore_bkgd_bkgd (mng_datap pData)
{
mng_int32 iX;
mng_uint8p pWork = pData->pRGBArow;
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
mng_imagedatap pBuf = pImage->pImgbuf;
mng_uint8 iRed = 0;
mng_uint8 iGreen = 0;
mng_uint8 iBlue = 0;
mng_uint32p pWork32 = (mng_uint32p)pWork;
mng_uint32 iWrite;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RESTORE_BKGD, MNG_LC_START);
#endif
switch (pBuf->iColortype)
{
case 0 : ; /* gray types */
case 4 : {
mng_uint8 iGray;
#ifndef MNG_NO_16BIT_SUPPORT
if (pBuf->iBitdepth > 8)
iGray = (mng_uint8)(pBuf->iBKGDgray >> 8);
else
#endif
{
#ifndef MNG_NO_1_2_4BIT_SUPPORT
/* LBR scaling */
mng_uint8 multiplier[]={0,255,85,0,17,0,0,0,1};
iGray = (mng_uint8)(multiplier[pBuf->iBitdepth] * pBuf->iBKGDgray);
#else
iGray = (mng_uint8)pBuf->iBKGDgray;
#endif
}
iRed = iGray;
iGreen = iGray;
iBlue = iGray;
break;
}
case 3 : { /* indexed type */
iRed = pBuf->aPLTEentries [pBuf->iBKGDindex].iRed;
iGreen = pBuf->aPLTEentries [pBuf->iBKGDindex].iGreen;
iBlue = pBuf->aPLTEentries [pBuf->iBKGDindex].iBlue;
break;
}
case 2 : ; /* rgb types */
case 6 : {
#ifndef MNG_NO_16BIT_SUPPORT
if (pBuf->iBitdepth > 8)
{
iRed = (mng_uint8)(pBuf->iBKGDred >> 8);
iGreen = (mng_uint8)(pBuf->iBKGDgreen >> 8);
iBlue = (mng_uint8)(pBuf->iBKGDblue >> 8);
}
else
#endif
{
iRed = (mng_uint8)(pBuf->iBKGDred );
iGreen = (mng_uint8)(pBuf->iBKGDgreen);
iBlue = (mng_uint8)(pBuf->iBKGDblue );
}
break;
}
}
#ifdef MNG_BIGENDIAN_SUPPORTED
/* fast way for big endian */
iWrite = (iRed << 24) |
(iGreen << 16) |
(iBlue << 8);
#elif defined(MNG_LITTLEENDIAN_SUPPORTED)
/* fast way for little endian */
iWrite = (iBlue << 16) |
(iGreen << 8) |
(iRed );
#else
/* generic way, works on all platforms */
/* put the data in memory in the correct order */
{
mng_uint8 aBytes[4];
aBytes[0] = (mng_uint8)(iRed);
aBytes[1] = (mng_uint8)(iGreen);
aBytes[2] = (mng_uint8)(iBlue);
aBytes[3] = 0x00;
/* load that data into a register */
iWrite = *(mng_uint32*) aBytes;
}
#endif
/* ok; drop it in there */
for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--)
*pWork32++ = iWrite;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RESTORE_BKGD, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_restore_bkgd_bgcolor (mng_datap pData)
{
mng_int32 iX;
mng_uint32p pWork32 = (mng_uint32p)pData->pRGBArow;
mng_uint32 iWrite;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RESTORE_BGCOLOR, MNG_LC_START);
#endif
#ifdef MNG_BIGENDIAN_SUPPORTED
/* fast way for big endian */
iWrite = (((mng_uint8)(pData->iBGred >> 8)) << 24) |
(((mng_uint8)(pData->iBGgreen >> 8)) << 16) |
(((mng_uint8)(pData->iBGblue >> 8)) << 8);
#elif defined(MNG_LITTLEENDIAN_SUPPORTED)
/* fast way for little endian */
iWrite = (((mng_uint8)(pData->iBGblue >> 8)) << 16) |
(((mng_uint8)(pData->iBGgreen >> 8)) << 8) |
(((mng_uint8)(pData->iBGred >> 8)) );
#else
/* generic way, works on all platforms */
/* put the data in memory in the correct order */
{
mng_uint8 aBytes[4];
aBytes[0] = (mng_uint8)(pData->iBGred >> 8);
aBytes[1] = (mng_uint8)(pData->iBGgreen >> 8);
aBytes[2] = (mng_uint8)(pData->iBGblue >> 8);
aBytes[3] = 0x00;
/* load that data into a register */
iWrite = *(mng_uint32*) aBytes;
}
#endif
/* ok; drop the background-color in there */
for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--)
*pWork32++ = iWrite;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RESTORE_BGCOLOR, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_RGB8
mng_retcode mng_restore_bkgd_rgb8 (mng_datap pData)
{
mng_int32 iX;
mng_uint8p pBkgd;
mng_uint8p pWork = pData->pRGBArow;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RESTORE_RGB8, MNG_LC_START);
#endif
if (pData->fGetbkgdline) /* can we access the background ? */
{ /* point to the right pixel then */
pBkgd = (mng_uint8p)pData->fGetbkgdline ((mng_handle)pData,
pData->iRow + pData->iDestt) +
(3 * pData->iDestl);
for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--)
{
*pWork = *pBkgd; /* ok; copy the pixel */
*(pWork+1) = *(pBkgd+1);
*(pWork+2) = *(pBkgd+2);
*(pWork+3) = 0x00; /* transparant for alpha-canvasses */
pWork += 4;
pBkgd += 3;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RESTORE_RGB8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_SKIPCANVAS_RGB8 */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_BGR8
mng_retcode mng_restore_bkgd_bgr8 (mng_datap pData)
{
mng_int32 iX;
mng_uint8p pBkgd;
mng_uint8p pWork = pData->pRGBArow;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RESTORE_BGR8, MNG_LC_START);
#endif
if (pData->fGetbkgdline) /* can we access the background ? */
{ /* point to the right pixel then */
pBkgd = (mng_uint8p)pData->fGetbkgdline ((mng_handle)pData,
pData->iRow + pData->iDestt) +
(3 * pData->iDestl);
for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--)
{
*pWork = *(pBkgd+2); /* ok; copy the pixel */
*(pWork+1) = *(pBkgd+1);
*(pWork+2) = *pBkgd;
*(pWork+3) = 0x00; /* transparant for alpha-canvasses */
pWork += 4;
pBkgd += 3;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RESTORE_BGR8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_SKIPCANVAS_BGR8 */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_BGRX8
mng_retcode mng_restore_bkgd_bgrx8 (mng_datap pData)
{
mng_int32 iX;
mng_uint8p pBkgd;
mng_uint8p pWork = pData->pRGBArow;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RESTORE_BGRX8, MNG_LC_START);
#endif
if (pData->fGetbkgdline) /* can we access the background ? */
{ /* point to the right pixel then */
pBkgd = (mng_uint8p)pData->fGetbkgdline ((mng_handle)pData,
pData->iRow + pData->iDestt) +
(3 * pData->iDestl);
for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--)
{
*pWork = *(pBkgd+2); /* ok; copy the pixel */
*(pWork+1) = *(pBkgd+1);
*(pWork+2) = *pBkgd;
*(pWork+3) = 0x00; /* transparant for alpha-canvasses */
pWork += 4;
pBkgd += 4;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RESTORE_BGRX8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_SKIPCANVAS_BGRX8 */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_BGR565
mng_retcode mng_restore_bkgd_bgr565 (mng_datap pData)
{
mng_int32 iX;
mng_uint8p pBkgd;
mng_uint8p pWork = pData->pRGBArow;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RESTORE_BGR565, MNG_LC_START);
#endif
if (pData->fGetbkgdline) /* can we access the background ? */
{ /* point to the right pixel then */
pBkgd = (mng_uint8p)pData->fGetbkgdline ((mng_handle)pData,
pData->iRow + pData->iDestt) +
(3 * pData->iDestl);
for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--)
{
*pWork = (mng_uint8)( *(pBkgd+1) & 0xF8); /* ok; copy the pixel */
*(pWork+1) = (mng_uint8)( (*(pBkgd+1) << 5 ) | ( ((*pBkgd)&0xE0)>>3 ) );
*(pWork+2) = (mng_uint8)( *(pBkgd) << 3 );
*(pWork+3) = 0x00; /* transparant for alpha-canvasses */
pWork += 4;
pBkgd += 2;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RESTORE_BGR565, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_SKIPCANVAS_BGR565 */
/* ************************************************************************** */
#ifndef MNG_SKIPCANVAS_RGB565
mng_retcode mng_restore_bkgd_rgb565 (mng_datap pData)
{
mng_int32 iX;
mng_uint8p pBkgd;
mng_uint8p pWork = pData->pRGBArow;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RESTORE_RGB565, MNG_LC_START);
#endif
if (pData->fGetbkgdline) /* can we access the background ? */
{ /* point to the right pixel then */
pBkgd = (mng_uint8p)pData->fGetbkgdline ((mng_handle)pData,
pData->iRow + pData->iDestt) +
(3 * pData->iDestl);
for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--)
{
*pWork = (mng_uint8)( *(pBkgd)&0xF8); /* ok; copy the pixel */
*(pWork+1) = (mng_uint8)( (*(pBkgd+1) << 5) | ( ((*pBkgd)&0xE0)>>3 ) );
*(pWork+2) = (mng_uint8)( *(pBkgd+1) << 3);
*(pWork+3) = 0x00; /* transparant for alpha-canvasses */
pWork += 4;
pBkgd += 2;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RESTORE_RGB565, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_SKIPCANVAS_RBB565 */
/* ************************************************************************** */
/* * * */
/* * Row retrieval routines - retrieve processed & uncompressed row-data * */
/* * from the current "object" * */
/* * * */
/* ************************************************************************** */
/* TODO: a serious optimization is to retrieve only those pixels that will
actually be displayed; this would require changes in
the "display_image" routine (in mng_display.c) &
all the "retrieve_xxx" routines below &
the "display_xxx" routines above !!!!!
NOTE that "correct_xxx" routines would not require modification */
mng_retcode mng_retrieve_g8 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
mng_int32 iX;
mng_uint8 iG;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RETRIEVE_G8, MNG_LC_START);
#endif
pRGBArow = pData->pRGBArow; /* temporary work pointers */
pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize);
if (pBuf->bHasTRNS) /* tRNS in buffer ? */
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iG = *pWorkrow; /* get the gray-value */
/* is it transparent ? */
if ((mng_uint16)iG == pBuf->iTRNSgray)
{
*pRGBArow = 0x00; /* nuttin to display */
*(pRGBArow+1) = 0x00;
*(pRGBArow+2) = 0x00;
*(pRGBArow+3) = 0x00;
}
else
{
#ifndef MNG_NO_1_2_4BIT_SUPPORT
mng_uint8 multiplier[]={0,255,85,0,17,0,0,0,1};
iG = (mng_uint8)(iG * multiplier[pBuf->iBitdepth]);
#endif
*pRGBArow = iG; /* put in intermediate row */
*(pRGBArow+1) = iG;
*(pRGBArow+2) = iG;
*(pRGBArow+3) = 0xFF;
}
pWorkrow++; /* next pixel */
pRGBArow += 4;
}
}
else
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
#ifndef MNG_NO_1_2_4BIT_SUPPORT
mng_uint8 multiplier[]={0,255,85,0,17,0,0,0,1}; /* LBR scaling */
iG = (mng_uint8)(multiplier[pBuf->iBitdepth] * *pWorkrow);
#else
iG = *pWorkrow; /* get the gray-value */
#endif
*pRGBArow = iG; /* put in intermediate row */
*(pRGBArow+1) = iG;
*(pRGBArow+2) = iG;
*(pRGBArow+3) = 0xFF;
pWorkrow++; /* next pixel */
pRGBArow += 4;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RETRIEVE_G8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_retrieve_g16 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
mng_int32 iX;
mng_uint16 iG;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RETRIEVE_G16, MNG_LC_START);
#endif
/* temporary work pointers */
pRGBArow = pData->pRGBArow;
pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize);
if (pBuf->bHasTRNS) /* tRNS in buffer ? */
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iG = mng_get_uint16 (pWorkrow); /* get the gray-value */
/* is it transparent ? */
if (iG == pBuf->iTRNSgray)
{ /* nuttin to display */
mng_put_uint16 (pRGBArow, 0x0000);
mng_put_uint16 (pRGBArow+2, 0x0000);
mng_put_uint16 (pRGBArow+4, 0x0000);
mng_put_uint16 (pRGBArow+6, 0x0000);
}
else
{ /* put in intermediate row */
mng_put_uint16 (pRGBArow, iG);
mng_put_uint16 (pRGBArow+2, iG);
mng_put_uint16 (pRGBArow+4, iG);
mng_put_uint16 (pRGBArow+6, 0xFFFF);
}
pWorkrow += 2; /* next pixel */
pRGBArow += 8;
}
}
else
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iG = mng_get_uint16 (pWorkrow); /* get the gray-value */
mng_put_uint16 (pRGBArow, iG); /* and put in intermediate row */
mng_put_uint16 (pRGBArow+2, iG);
mng_put_uint16 (pRGBArow+4, iG);
mng_put_uint16 (pRGBArow+6, 0xFFFF);
pWorkrow += 2; /* next pixel */
pRGBArow += 8;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RETRIEVE_G16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_retrieve_rgb8 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
mng_int32 iX;
mng_uint8 iR, iG, iB;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RETRIEVE_RGB8, MNG_LC_START);
#endif
pRGBArow = pData->pRGBArow; /* temporary work pointers */
pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize);
if (pBuf->bHasTRNS) /* tRNS in buffer ? */
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iR = *pWorkrow; /* get the rgb-values */
iG = *(pWorkrow+1);
iB = *(pWorkrow+2);
/* is it transparent ? */
if (((mng_uint16)iR == pBuf->iTRNSred ) &&
((mng_uint16)iG == pBuf->iTRNSgreen) &&
((mng_uint16)iB == pBuf->iTRNSblue ) )
{
*pRGBArow = 0x00; /* nothing to display */
*(pRGBArow+1) = 0x00;
*(pRGBArow+2) = 0x00;
*(pRGBArow+3) = 0x00;
}
else
{
*pRGBArow = iR; /* put in intermediate row */
*(pRGBArow+1) = iG;
*(pRGBArow+2) = iB;
*(pRGBArow+3) = 0xFF;
}
pWorkrow += 3; /* next pixel */
pRGBArow += 4;
}
}
else
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pRGBArow = *pWorkrow; /* just copy the pixel */
*(pRGBArow+1) = *(pWorkrow+1);
*(pRGBArow+2) = *(pWorkrow+2);
*(pRGBArow+3) = 0xFF;
pWorkrow += 3; /* next pixel */
pRGBArow += 4;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RETRIEVE_RGB8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_retrieve_rgb16 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
mng_int32 iX;
mng_uint16 iR, iG, iB;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RETRIEVE_RGB16, MNG_LC_START);
#endif
/* temporary work pointers */
pRGBArow = pData->pRGBArow;
pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize);
if (pBuf->bHasTRNS) /* tRNS in buffer ? */
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iR = mng_get_uint16 (pWorkrow); /* get the rgb-values */
iG = mng_get_uint16 (pWorkrow+2);
iB = mng_get_uint16 (pWorkrow+4);
/* is it transparent ? */
if ((iR == pBuf->iTRNSred ) &&
(iG == pBuf->iTRNSgreen) &&
(iB == pBuf->iTRNSblue ) )
{ /* nothing to display */
mng_put_uint16 (pRGBArow, 0x0000);
mng_put_uint16 (pRGBArow+2, 0x0000);
mng_put_uint16 (pRGBArow+4, 0x0000);
mng_put_uint16 (pRGBArow+6, 0x0000);
}
else
{ /* put in intermediate row */
mng_put_uint16 (pRGBArow, iR);
mng_put_uint16 (pRGBArow+2, iG);
mng_put_uint16 (pRGBArow+4, iB);
mng_put_uint16 (pRGBArow+6, 0xFFFF);
}
pWorkrow += 6; /* next pixel */
pRGBArow += 8;
}
}
else
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{ /* just copy the pixel */
mng_put_uint16 (pRGBArow, mng_get_uint16 (pWorkrow ));
mng_put_uint16 (pRGBArow+2, mng_get_uint16 (pWorkrow+2));
mng_put_uint16 (pRGBArow+4, mng_get_uint16 (pWorkrow+4));
mng_put_uint16 (pRGBArow+6, 0xFFFF);
pWorkrow += 6; /* next pixel */
pRGBArow += 8;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RETRIEVE_RGB16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_retrieve_idx8 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
mng_int32 iX;
mng_uint8 iQ;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RETRIEVE_IDX8, MNG_LC_START);
#endif
pRGBArow = pData->pRGBArow; /* temporary work pointers */
pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize);
if (pBuf->bHasTRNS) /* tRNS in buffer ? */
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iQ = *pWorkrow; /* get the index */
/* is it valid ? */
if ((mng_uint32)iQ < pBuf->iPLTEcount)
{ /* put in intermediate row */
*pRGBArow = pBuf->aPLTEentries [iQ].iRed;
*(pRGBArow+1) = pBuf->aPLTEentries [iQ].iGreen;
*(pRGBArow+2) = pBuf->aPLTEentries [iQ].iBlue;
/* transparency for this index ? */
if ((mng_uint32)iQ < pBuf->iTRNScount)
*(pRGBArow+3) = pBuf->aTRNSentries [iQ];
else
*(pRGBArow+3) = 0xFF;
}
else
MNG_ERROR (pData, MNG_PLTEINDEXERROR);
pWorkrow++; /* next pixel */
pRGBArow += 4;
}
}
else
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iQ = *pWorkrow; /* get the index */
/* is it valid ? */
if ((mng_uint32)iQ < pBuf->iPLTEcount)
{ /* put in intermediate row */
*pRGBArow = pBuf->aPLTEentries [iQ].iRed;
*(pRGBArow+1) = pBuf->aPLTEentries [iQ].iGreen;
*(pRGBArow+2) = pBuf->aPLTEentries [iQ].iBlue;
*(pRGBArow+3) = 0xFF;
}
else
MNG_ERROR (pData, MNG_PLTEINDEXERROR);
pWorkrow++; /* next pixel */
pRGBArow += 4;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RETRIEVE_IDX8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_retrieve_ga8 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
mng_int32 iX;
mng_uint8 iG;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RETRIEVE_GA8, MNG_LC_START);
#endif
pRGBArow = pData->pRGBArow; /* temporary work pointers */
pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize);
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iG = *pWorkrow; /* get the gray-value */
*pRGBArow = iG; /* put in intermediate row */
*(pRGBArow+1) = iG;
*(pRGBArow+2) = iG;
*(pRGBArow+3) = *(pWorkrow+1);
pWorkrow += 2; /* next pixel */
pRGBArow += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RETRIEVE_GA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_retrieve_ga16 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
mng_int32 iX;
mng_uint16 iG;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RETRIEVE_GA16, MNG_LC_START);
#endif
/* temporary work pointers */
pRGBArow = pData->pRGBArow;
pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize);
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iG = mng_get_uint16 (pWorkrow); /* get the gray-value */
mng_put_uint16 (pRGBArow, iG); /* and put in intermediate row */
mng_put_uint16 (pRGBArow+2, iG);
mng_put_uint16 (pRGBArow+4, iG);
mng_put_uint16 (pRGBArow+6, mng_get_uint16 (pWorkrow+2));
pWorkrow += 4; /* next pixel */
pRGBArow += 8;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RETRIEVE_GA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_retrieve_rgba8 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RETRIEVE_RGBA8, MNG_LC_START);
#endif
pRGBArow = pData->pRGBArow; /* temporary work pointers */
pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize);
/* can't be easier than this ! */
MNG_COPY (pRGBArow, pWorkrow, pBuf->iRowsize);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RETRIEVE_RGBA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_retrieve_rgba16 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RETRIEVE_RGBA16, MNG_LC_START);
#endif
/* temporary work pointers */
pRGBArow = pData->pRGBArow;
pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize);
/* can't be easier than this ! */
MNG_COPY (pRGBArow, pWorkrow, pBuf->iRowsize);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_RETRIEVE_RGBA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
/* * * */
/* * Row storage routines - store processed & uncompressed row-data * */
/* * into the current "object" * */
/* * * */
/* ************************************************************************** */
#ifndef MNG_NO_1_2_4BIT_SUPPORT
mng_retcode mng_store_g1 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_G1, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
iM = 0; /* start at pixel 0 */
iB = 0;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0x80;
}
if (iB & iM) /* is it white ? */
*pOutrow = 0x01; /* white */
else
*pOutrow = 0x00; /* black */
pOutrow += pData->iColinc; /* next pixel */
iM >>= 1;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_G1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_store_g2 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
mng_uint32 iS;
mng_uint8 iQ;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_G2, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
iM = 0; /* start at pixel 0 */
iB = 0;
iS = 0;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xC0;
iS = 6;
}
iQ = (mng_uint8)((iB & iM) >> iS); /* get the gray level */
*pOutrow = iQ; /* put in object buffer */
pOutrow += pData->iColinc; /* next pixel */
iM >>= 2;
iS -= 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_G2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_store_g4 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
mng_uint32 iS;
mng_uint8 iQ;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_G4, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
iM = 0; /* start at pixel 0 */
iB = 0;
iS = 0;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xF0;
iS = 4;
}
iQ = (mng_uint8)((iB & iM) >> iS); /* get the gray level */
*pOutrow = iQ; /* put in object buffer */
pOutrow += pData->iColinc; /* next pixel */
iM >>= 4;
iS -= 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_G4, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_store_g8 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_G8, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* put in object buffer */
pOutrow += pData->iColinc; /* next pixel */
pWorkrow++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_G8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_store_g16 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_G16, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{ /* copy into object buffer */
mng_put_uint16 (pOutrow, mng_get_uint16 (pWorkrow));
pOutrow += (pData->iColinc << 1); /* next pixel */
pWorkrow += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_G16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_store_rgb8 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_RGB8, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* copy the RGB bytes */
*(pOutrow+1) = *(pWorkrow+1);
*(pOutrow+2) = *(pWorkrow+2);
pWorkrow += 3; /* next pixel */
pOutrow += (pData->iColinc * 3);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_RGB8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_store_rgb16 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_RGB16, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
MNG_COPY (pOutrow, pWorkrow, 6); /* copy the RGB bytes */
pWorkrow += 6; /* next pixel */
pOutrow += (pData->iColinc * 6);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_RGB16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_1_2_4BIT_SUPPORT
mng_retcode mng_store_idx1 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_IDX1, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
iM = 0; /* start at pixel 0 */
iB = 0;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0x80;
}
if (iB & iM) /* store the index */
*pOutrow = 0x01;
else
*pOutrow = 0x00;
pOutrow += pData->iColinc; /* next pixel */
iM >>= 1;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_IDX1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_store_idx2 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
mng_uint32 iS;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_IDX2, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
iM = 0; /* start at pixel 0 */
iB = 0;
iS = 0;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xC0;
iS = 6;
}
/* store the index */
*pOutrow = (mng_uint8)((iB & iM) >> iS);
pOutrow += pData->iColinc; /* next pixel */
iM >>= 2;
iS -= 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_IDX2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_store_idx4 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
mng_uint32 iS;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_IDX4, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
iM = 0; /* start at pixel 0 */
iB = 0;
iS = 0;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xF0;
iS = 4;
}
/* store the index */
*pOutrow = (mng_uint8)((iB & iM) >> iS);
pOutrow += pData->iColinc; /* next pixel */
iM >>= 4;
iS -= 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_IDX4, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_store_idx8 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_IDX8, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* put in object buffer */
pOutrow += pData->iColinc; /* next pixel */
pWorkrow++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_IDX8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_store_ga8 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_GA8, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* copy the GA bytes */
*(pOutrow+1) = *(pWorkrow+1);
pWorkrow += 2; /* next pixel */
pOutrow += (pData->iColinc << 1);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_GA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_store_ga16 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_GA16, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
MNG_COPY (pOutrow, pWorkrow, 4); /* copy the GA bytes */
pWorkrow += 4; /* next pixel */
pOutrow += (pData->iColinc << 2);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_GA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_store_rgba8 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_RGBA8, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* copy the RGBA bytes */
*(pOutrow+1) = *(pWorkrow+1);
*(pOutrow+2) = *(pWorkrow+2);
*(pOutrow+3) = *(pWorkrow+3);
pWorkrow += 4; /* next pixel */
pOutrow += (pData->iColinc << 2);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_RGBA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_store_rgba16 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_RGBA16, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
MNG_COPY (pOutrow, pWorkrow, 8); /* copy the RGBA bytes */
pWorkrow += 8; /* next pixel */
pOutrow += (pData->iColinc << 3);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_RGBA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
/* * * */
/* * Row storage routines (JPEG) - store processed & uncompressed row-data * */
/* * into the current "object" * */
/* * * */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG
/* ************************************************************************** */
mng_retcode mng_store_jpeg_g8 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8, MNG_LC_START);
#endif
pWorkrow = pData->pJPEGrow; /* temporary work pointers */
pOutrow = pBuf->pImgdata + (pData->iJPEGrow * pBuf->iRowsize);
/* easy as pie ... */
MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8, MNG_LC_END);
#endif
return mng_next_jpeg_row (pData); /* we've got one more row of gray-samples */
}
/* ************************************************************************** */
mng_retcode mng_store_jpeg_rgb8 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
#if RGB_PIXELSIZE != 3
mng_int32 iX;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8, MNG_LC_START);
#endif
pWorkrow = pData->pJPEGrow; /* temporary work pointers */
pOutrow = pBuf->pImgdata + (pData->iJPEGrow * pBuf->iRowsize);
#if RGB_PIXELSIZE == 3
/* easy as pie ... */
MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples * 3);
#else
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* copy pixel into object buffer */
*(pOutrow+1) = *(pWorkrow+1);
*(pOutrow+2) = *(pWorkrow+2);
pOutrow += 3; /* next pixel */
pWorkrow += RGB_PIXELSIZE;
}
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8, MNG_LC_END);
#endif
return mng_next_jpeg_row (pData); /* we've got one more row of rgb-samples */
}
/* ************************************************************************** */
mng_retcode mng_store_jpeg_ga8 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_GA8, MNG_LC_START);
#endif
pWorkrow = pData->pJPEGrow; /* temporary work pointers */
pOutrow = pBuf->pImgdata + (pData->iJPEGrow * pBuf->iRowsize);
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* copy into object buffer */
pOutrow += 2; /* next pixel */
pWorkrow++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_GA8, MNG_LC_END);
#endif
return mng_next_jpeg_row (pData); /* we've got one more row of gray-samples */
}
/* ************************************************************************** */
mng_retcode mng_store_jpeg_rgba8 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGBA8, MNG_LC_START);
#endif
pWorkrow = pData->pJPEGrow; /* temporary work pointers */
pOutrow = pBuf->pImgdata + (pData->iJPEGrow * pBuf->iRowsize);
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* copy pixel into object buffer */
*(pOutrow+1) = *(pWorkrow+1);
*(pOutrow+2) = *(pWorkrow+2);
pOutrow += 4; /* next pixel */
pWorkrow += RGB_PIXELSIZE;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGBA8, MNG_LC_END);
#endif
return mng_next_jpeg_row (pData); /* we've got one more row of rgb-samples */
}
/* ************************************************************************** */
mng_retcode mng_store_jpeg_g8_alpha (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_ALPHA, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pJPEGrow2;
pOutrow = pBuf->pImgdata + (pData->iJPEGalpharow * pBuf->iRowsize) + 1;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* put in object buffer */
pOutrow += 2; /* next pixel */
pWorkrow++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_ALPHA, MNG_LC_END);
#endif
/* we've got one more row of alpha-samples */
return mng_next_jpeg_alpharow (pData);
}
/* ************************************************************************** */
mng_retcode mng_store_jpeg_rgb8_alpha (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_ALPHA, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pJPEGrow2;
pOutrow = pBuf->pImgdata + (pData->iJPEGalpharow * pBuf->iRowsize) + 3;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* put in object buffer */
pOutrow += 4; /* next pixel */
pWorkrow++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_ALPHA, MNG_LC_END);
#endif
/* we've got one more row of alpha-samples */
return mng_next_jpeg_alpharow (pData);
}
/* ************************************************************************** */
#ifndef MNG_NO_1_2_4BIT_SUPPORT
mng_retcode mng_store_jpeg_g8_a1 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A1, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) + 1;
iM = 0; /* start at pixel 0 */
iB = 0;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0x80;
}
if (iB & iM) /* is it opaque ? */
*pOutrow = 0xFF; /* opaque */
else
*pOutrow = 0x00; /* transparent */
pOutrow += 2; /* next pixel */
iM >>= 1;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A1, MNG_LC_END);
#endif
/* we've got one more row of alpha-samples */
return mng_next_jpeg_alpharow (pData);
}
/* ************************************************************************** */
mng_retcode mng_store_jpeg_g8_a2 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
mng_uint32 iS;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A2, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) + 1;
iM = 0; /* start at pixel 0 */
iB = 0;
iS = 0;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xC0;
iS = 6;
}
#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH
{
const mng_uint8 alpha_level[4] = { 0x00, 0x55, 0xAA, 0xFF};
*pOutrow = alpha_level[((iB & iM) >> iS)] ;
}
#else
switch ((iB & iM) >> iS) /* determine the alpha level */
{
case 0x03 : { *pOutrow = 0xFF; break; }
case 0x02 : { *pOutrow = 0xAA; break; }
case 0x01 : { *pOutrow = 0x55; break; }
default : { *pOutrow = 0x00; }
}
#endif
pOutrow += 2; /* next pixel */
iM >>= 2;
iS -= 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A2, MNG_LC_END);
#endif
/* we've got one more row of alpha-samples */
return mng_next_jpeg_alpharow (pData);
}
/* ************************************************************************** */
mng_retcode mng_store_jpeg_g8_a4 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
mng_uint32 iS;
mng_uint8 iQ;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A4, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) + 1;
iM = 0; /* start at pixel 0 */
iB = 0;
iS = 0;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xF0;
iS = 4;
}
/* get the alpha level */
iQ = (mng_uint8)((iB & iM) >> iS);
iQ = (mng_uint8)(iQ + (iQ << 4)); /* expand to 8-bit by replication */
*pOutrow = iQ; /* put in object buffer */
pOutrow += 2; /* next pixel */
iM >>= 4;
iS -= 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A4, MNG_LC_END);
#endif
/* we've got one more row of alpha-samples */
return mng_next_jpeg_alpharow (pData);
}
#endif
/* ************************************************************************** */
mng_retcode mng_store_jpeg_g8_a8 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A8, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) + 1;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* put in object buffer */
pOutrow += 2; /* next pixel */
pWorkrow++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A8, MNG_LC_END);
#endif
/* we've got one more row of alpha-samples */
return mng_next_jpeg_alpharow (pData);
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_store_jpeg_g8_a16 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A16, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) + 1;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* only high-order byte! */
pOutrow += 2; /* next pixel */
pWorkrow += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A16, MNG_LC_END);
#endif
/* we've got one more row of alpha-samples */
return mng_next_jpeg_alpharow (pData);
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_1_2_4BIT_SUPPORT
mng_retcode mng_store_jpeg_rgb8_a1 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A1, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) + 3;
iM = 0; /* start at pixel 0 */
iB = 0;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0x80;
}
if (iB & iM) /* is it opaque ? */
*pOutrow = 0xFF; /* opaque */
else
*pOutrow = 0x00; /* transparent */
pOutrow += 4; /* next pixel */
iM >>= 1;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A1, MNG_LC_END);
#endif
/* we've got one more row of alpha-samples */
return mng_next_jpeg_alpharow (pData);
}
/* ************************************************************************** */
mng_retcode mng_store_jpeg_rgb8_a2 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
mng_uint32 iS;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A2, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) + 3;
iM = 0; /* start at pixel 0 */
iB = 0;
iS = 0;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xC0;
iS = 6;
}
#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH
{
const mng_uint8 alpha_level[4] = { 0x00, 0x55, 0xAA, 0xFF};
*pOutrow = alpha_level[((iB & iM) >> iS)] ;
}
#else
switch ((iB & iM) >> iS) /* determine the alpha level */
{
case 0x03 : { *pOutrow = 0xFF; break; }
case 0x02 : { *pOutrow = 0xAA; break; }
case 0x01 : { *pOutrow = 0x55; break; }
default : { *pOutrow = 0x00; }
}
#endif
pOutrow += 4; /* next pixel */
iM >>= 2;
iS -= 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A2, MNG_LC_END);
#endif
/* we've got one more row of alpha-samples */
return mng_next_jpeg_alpharow (pData);
}
/* ************************************************************************** */
mng_retcode mng_store_jpeg_rgb8_a4 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
mng_uint32 iS;
mng_uint8 iQ;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A4, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) + 3;
iM = 0; /* start at pixel 0 */
iB = 0;
iS = 0;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xF0;
iS = 4;
}
/* get the alpha level */
iQ = (mng_uint8)((iB & iM) >> iS);
iQ = (mng_uint8)(iQ + (iQ << 4)); /* expand to 8-bit by replication */
*pOutrow = iQ; /* put in object buffer */
pOutrow += 4; /* next pixel */
iM >>= 4;
iS -= 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A4, MNG_LC_END);
#endif
/* we've got one more row of alpha-samples */
return mng_next_jpeg_alpharow (pData);
}
#endif
/* ************************************************************************** */
mng_retcode mng_store_jpeg_rgb8_a8 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A8, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) + 3;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* put in buffer */
pOutrow += 4; /* next pixel */
pWorkrow++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A8, MNG_LC_END);
#endif
/* we've got one more row of alpha-samples */
return mng_next_jpeg_alpharow (pData);
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_store_jpeg_rgb8_a16 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A16, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) + 3;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* only high-order byte */
pOutrow += 4; /* next pixel */
pWorkrow += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A16, MNG_LC_END);
#endif
/* we've got one more row of alpha-samples */
return mng_next_jpeg_alpharow (pData);
}
#endif
/* ************************************************************************** */
#ifdef MNG_SUPPORT_JPEG12
mng_retcode mng_store_jpeg_g12_a1 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A1, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) + 2;
iM = 0; /* start at pixel 0 */
iB = 0;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0x80;
}
if (iB & iM) /* opaque ? */
mng_put_uint16 (pOutrow, 0xFFFF);/* opaque */
else
mng_put_uint16 (pOutrow, 0x0000);/* transparent */
pOutrow += 4; /* next pixel */
iM >>= 1;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A1, MNG_LC_END);
#endif
/* we've got one more row of alpha-samples */
return mng_next_jpeg_alpharow (pData);
}
#endif /* MNG_SUPPORT_JPEG12 */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_JPEG12
mng_retcode mng_store_jpeg_g12_a2 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
mng_uint32 iS;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A2, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) + 2;
iM = 0; /* start at pixel 0 */
iB = 0;
iS = 0;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xC0;
iS = 6;
}
#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH
{
const mng_uint16 gray_level[4] = { 0x0000, 0x5555, 0xAAAA, 0xFFFF};
mng_put_uint16 (pOutrow, gray_level[((iB & iM) >> iS)]) ;
}
#else
switch ((iB & iM) >> iS) /* determine the gray level */
{
case 0x03 : { mng_put_uint16 (pOutrow, 0xFFFF); break; }
case 0x02 : { mng_put_uint16 (pOutrow, 0xAAAA); break; }
case 0x01 : { mng_put_uint16 (pOutrow, 0x5555); break; }
default : { mng_put_uint16 (pOutrow, 0x0000); }
}
#endif
pOutrow += 4; /* next pixel */
iM >>= 2;
iS -= 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A2, MNG_LC_END);
#endif
/* we've got one more row of alpha-samples */
return mng_next_jpeg_alpharow (pData);
}
#endif /* MNG_SUPPORT_JPEG12 */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_JPEG12
mng_retcode mng_store_jpeg_g12_a4 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
mng_uint32 iS;
mng_uint16 iQ;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A4, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) + 2;
iM = 0; /* start at pixel 0 */
iB = 0;
iS = 0;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xF0;
iS = 4;
}
/* get the gray level */
iQ = (mng_uint16)((iB & iM) >> iS);
iQ = (mng_uint16)(iQ + (iQ << 4)); /* expand to 16-bit by replication */
iQ = (mng_uint16)(iQ + (iQ << 8));
/* put in object buffer */
mng_put_uint16 (pOutrow, iQ);
pOutrow += 4; /* next pixel */
iM >>= 4;
iS -= 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A4, MNG_LC_END);
#endif
/* we've got one more row of alpha-samples */
return mng_next_jpeg_alpharow (pData);
}
#endif /* MNG_SUPPORT_JPEG12 */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_JPEG12
mng_retcode mng_store_jpeg_g12_a8 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint16 iW;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A8, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) + 2;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iW = (mng_uint16)(*pWorkrow); /* get input byte */
iW = (mng_uint16)(iW + (iW << 8)); /* expand to 16-bit by replication */
mng_put_uint16 (pOutrow, iW); /* put in object buffer */
pOutrow += 4; /* next pixel */
pWorkrow++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A8, MNG_LC_END);
#endif
/* we've got one more row of alpha-samples */
return mng_next_jpeg_alpharow (pData);
}
#endif /* MNG_SUPPORT_JPEG12 */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_JPEG12
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_store_jpeg_g12_a16 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A16, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) + 2;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{ /* copy it */
mng_put_uint16 (pOutrow, mng_get_uint16 (pWorkrow));
pOutrow += 4; /* next pixel */
pWorkrow += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A16, MNG_LC_END);
#endif
/* we've got one more row of alpha-samples */
return mng_next_jpeg_alpharow (pData);
}
#endif
#endif /* MNG_SUPPORT_JPEG12 */
/* ************************************************************************** */
#endif /* MNG_INCLUDE_JNG */
#ifndef MNG_NO_DELTA_PNG
/* ************************************************************************** */
/* * * */
/* * Delta-image row routines - apply the processed & uncompressed row-data * */
/* * onto the target "object" * */
/* * * */
/* ************************************************************************** */
#ifndef MNG_NO_1_2_4BIT_SUPPORT
mng_retcode mng_delta_g1 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_G1, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iDeltaBlocky * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) +
(pData->iDeltaBlockx * pBuf->iSamplesize);
iM = 0; /* start at pixel 0 */
iB = 0;
/* pixel replace ? */
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0x80;
}
if (iB & iM) /* is it white ? */
*pOutrow = 0xFF; /* white */
else
*pOutrow = 0x00; /* black */
pOutrow += pData->iColinc; /* next pixel */
iM >>= 1;
}
}
else
{ /* pixel add ! */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0x80;
}
if (iB & iM) /* invert if it is white ? */
*pOutrow = (mng_uint8)(*pOutrow ^ 0xFF);
pOutrow += pData->iColinc; /* next pixel */
iM >>= 1;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_G1, MNG_LC_END);
#endif
return mng_store_g1 (pData);
}
/* ************************************************************************** */
mng_retcode mng_delta_g2 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
mng_uint32 iS;
#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH
const mng_uint8 level[4] = { 0x00, 0x55, 0xAA, 0xFF};
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_G2, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iDeltaBlocky * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) +
(pData->iDeltaBlockx * pBuf->iSamplesize);
iM = 0; /* start at pixel 0 */
iB = 0;
iS = 0;
/* pixel replace ? */
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xC0;
iS = 6;
}
#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH
*pOutrow = level[((iB & iM) >> iS)] ;
#else
switch ((iB & iM) >> iS) /* determine the alpha level */
{
case 0x03 : { *pOutrow = 0xFF; break; }
case 0x02 : { *pOutrow = 0xAA; break; }
case 0x01 : { *pOutrow = 0x55; break; }
default : { *pOutrow = 0x00; }
}
#endif
pOutrow += pData->iColinc; /* next pixel */
iM >>= 2;
iS -= 2;
}
}
else
{ /* pixel add ! */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xC0;
iS = 6;
}
#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH
*pOutrow = level[((*pOutrow >> 6) + ((iB & iM) >> iS)) & 0x03] ;
#else
switch (((*pOutrow >> 6) + ((iB & iM) >> iS)) & 0x03)
{
case 0x03 : { *pOutrow = 0xFF; break; }
case 0x02 : { *pOutrow = 0xAA; break; }
case 0x01 : { *pOutrow = 0x55; break; }
default : { *pOutrow = 0x00; }
}
#endif
pOutrow += pData->iColinc; /* next pixel */
iM >>= 2;
iS -= 2;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_G2, MNG_LC_END);
#endif
return mng_store_g2 (pData);
}
/* ************************************************************************** */
mng_retcode mng_delta_g4 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
mng_uint32 iS;
mng_uint8 iQ;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_G4, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iDeltaBlocky * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) +
(pData->iDeltaBlockx * pBuf->iSamplesize);
iM = 0; /* start at pixel 0 */
iB = 0;
iS = 0;
/* pixel replace ? */
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xF0;
iS = 4;
}
/* get the gray level */
iQ = (mng_uint8)((iB & iM) >> iS);
/* expand to 8-bit by replication */
iQ = (mng_uint8)(iQ + (iQ << 4));
*pOutrow = iQ; /* put in object buffer */
pOutrow += pData->iColinc; /* next pixel */
iM >>= 4;
iS -= 4;
}
}
else
{ /* pixel add ! */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xF0;
iS = 4;
}
/* get the gray level */
iQ = (mng_uint8)(((*pOutrow >> 4) + ((iB & iM) >> iS)) & 0x0F);
/* expand to 8-bit by replication */
iQ = (mng_uint8)(iQ + (iQ << 4));
*pOutrow = iQ; /* put in object buffer */
pOutrow += pData->iColinc; /* next pixel */
iM >>= 4;
iS -= 4;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_G4, MNG_LC_END);
#endif
return mng_store_g4 (pData);
}
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
/* ************************************************************************** */
mng_retcode mng_delta_g8 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_G8, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iDeltaBlocky * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) +
(pData->iDeltaBlockx * pBuf->iSamplesize);
/* pixel replace ? */
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* put in object buffer */
pOutrow += pData->iColinc; /* next pixel */
pWorkrow++;
}
}
else
{ /* pixel add ! */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{ /* add to object buffer */
*pOutrow = (mng_uint8)(*pOutrow + *pWorkrow);
pOutrow += pData->iColinc; /* next pixel */
pWorkrow++;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_G8, MNG_LC_END);
#endif
return mng_store_g8 (pData);
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_delta_g16 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_G16, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iDeltaBlocky * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) +
(pData->iDeltaBlockx * pBuf->iSamplesize);
/* pixel replace ? */
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* put in object buffer */
*(pOutrow+1) = *(pWorkrow+1);
/* next pixel */
pOutrow += (pData->iColinc << 1);
pWorkrow += 2;
}
}
else
{ /* pixel add ! */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{ /* add to object buffer */
mng_put_uint16 (pOutrow, (mng_uint16)(mng_get_uint16 (pOutrow ) +
mng_get_uint16 (pWorkrow) ));
/* next pixel */
pOutrow += (pData->iColinc << 1);
pWorkrow += 2;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_G16, MNG_LC_END);
#endif
return mng_store_g16 (pData);
}
#endif
/* ************************************************************************** */
mng_retcode mng_delta_rgb8 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGB8, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iDeltaBlocky * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) +
(pData->iDeltaBlockx * pBuf->iSamplesize);
/* pixel replace ? */
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* put in object buffer */
*(pOutrow+1) = *(pWorkrow+1);
*(pOutrow+2) = *(pWorkrow+2);
/* next pixel */
pOutrow += (pData->iColinc * 3);
pWorkrow += 3;
}
}
else
{ /* pixel add ! */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{ /* add to object buffer */
*pOutrow = (mng_uint8)(*pOutrow + *pWorkrow );
*(pOutrow+1) = (mng_uint8)(*(pOutrow+1) + *(pWorkrow+1));
*(pOutrow+2) = (mng_uint8)(*(pOutrow+2) + *(pWorkrow+2));
/* next pixel */
pOutrow += (pData->iColinc * 3);
pWorkrow += 3;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGB8, MNG_LC_END);
#endif
return mng_store_rgb8 (pData);
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_delta_rgb16 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGB16, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iDeltaBlocky * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) +
(pData->iDeltaBlockx * pBuf->iSamplesize);
/* pixel replace ? */
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* put in object buffer */
*(pOutrow+1) = *(pWorkrow+1);
*(pOutrow+2) = *(pWorkrow+2);
*(pOutrow+3) = *(pWorkrow+3);
*(pOutrow+4) = *(pWorkrow+4);
*(pOutrow+5) = *(pWorkrow+5);
/* next pixel */
pOutrow += (pData->iColinc * 6);
pWorkrow += 6;
}
}
else
{ /* pixel add ! */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{ /* add to object buffer */
mng_put_uint16 (pOutrow, (mng_uint16)(mng_get_uint16 (pOutrow ) +
mng_get_uint16 (pWorkrow ) ));
mng_put_uint16 (pOutrow+2, (mng_uint16)(mng_get_uint16 (pOutrow+2 ) +
mng_get_uint16 (pWorkrow+2) ));
mng_put_uint16 (pOutrow+4, (mng_uint16)(mng_get_uint16 (pOutrow+4 ) +
mng_get_uint16 (pWorkrow+4) ));
/* next pixel */
pOutrow += (pData->iColinc * 6);
pWorkrow += 6;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGB16, MNG_LC_END);
#endif
return mng_store_rgb16 (pData);
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_1_2_4BIT_SUPPORT
mng_retcode mng_delta_idx1 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_IDX1, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iDeltaBlocky * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) +
(pData->iDeltaBlockx * pBuf->iSamplesize);
iM = 0; /* start at pixel 0 */
iB = 0;
/* pixel replace ? */
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0x80;
}
if (iB & iM) /* put the right index value */
*pOutrow = 1;
else
*pOutrow = 0;
pOutrow += pData->iColinc; /* next pixel */
iM >>= 1;
}
}
else
{ /* pixel add ! */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0x80;
}
if (iB & iM) /* invert if it is non-zero index */
*pOutrow = (mng_uint8)(*pOutrow ^ 0x01);
pOutrow += pData->iColinc; /* next pixel */
iM >>= 1;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_IDX1, MNG_LC_END);
#endif
return mng_store_idx1 (pData);
}
/* ************************************************************************** */
mng_retcode mng_delta_idx2 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
mng_uint32 iS;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_IDX2, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iDeltaBlocky * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) +
(pData->iDeltaBlockx * pBuf->iSamplesize);
iM = 0; /* start at pixel 0 */
iB = 0;
iS = 0;
/* pixel replace ? */
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xC0;
iS = 6;
}
/* put the index */
*pOutrow = (mng_uint8)((iB & iM) >> iS);
pOutrow += pData->iColinc; /* next pixel */
iM >>= 2;
iS -= 2;
}
}
else
{ /* pixel add ! */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xC0;
iS = 6;
}
/* calculate the index */
*pOutrow = (mng_uint8)((*pOutrow + ((iB & iM) >> iS)) & 0x03);
pOutrow += pData->iColinc; /* next pixel */
iM >>= 2;
iS -= 2;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_IDX2, MNG_LC_END);
#endif
return mng_store_idx2 (pData);
}
/* ************************************************************************** */
mng_retcode mng_delta_idx4 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
mng_uint32 iS;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_IDX4, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iDeltaBlocky * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) +
(pData->iDeltaBlockx * pBuf->iSamplesize);
iM = 0; /* start at pixel 0 */
iB = 0;
iS = 0;
/* pixel replace ? */
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xF0;
iS = 4;
}
/* put the index */
*pOutrow = (mng_uint8)((iB & iM) >> iS);
pOutrow += pData->iColinc; /* next pixel */
iM >>= 4;
iS -= 4;
}
}
else
{ /* pixel add ! */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xF0;
iS = 4;
}
/* calculate the index */
*pOutrow = (mng_uint8)((*pOutrow + ((iB & iM) >> iS)) & 0x0F);
pOutrow += pData->iColinc; /* next pixel */
iM >>= 4;
iS -= 4;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_IDX4, MNG_LC_END);
#endif
return mng_store_idx4 (pData);
}
#endif
/* ************************************************************************** */
mng_retcode mng_delta_idx8 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_IDX8, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iDeltaBlocky * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) +
(pData->iDeltaBlockx * pBuf->iSamplesize);
/* pixel replace ? */
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* put in object buffer */
pOutrow += pData->iColinc; /* next pixel */
pWorkrow++;
}
}
else
{ /* pixel add ! */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{ /* add to object buffer */
*pOutrow = (mng_uint8)(*pOutrow + *pWorkrow);
pOutrow += pData->iColinc; /* next pixel */
pWorkrow++;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_IDX8, MNG_LC_END);
#endif
return mng_store_idx8 (pData);
}
/* ************************************************************************** */
mng_retcode mng_delta_ga8 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_GA8, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iDeltaBlocky * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) +
(pData->iDeltaBlockx * pBuf->iSamplesize);
/* pixel replace ? */
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* put in object buffer */
*(pOutrow+1) = *(pWorkrow+1);
/* next pixel */
pOutrow += (pData->iColinc << 1);
pWorkrow += 2;
}
}
else
{ /* pixel add ! */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{ /* add to object buffer */
*pOutrow = (mng_uint8)(*pOutrow + *pWorkrow );
*(pOutrow+1) = (mng_uint8)(*(pOutrow+1) + *(pWorkrow+1));
/* next pixel */
pOutrow += (pData->iColinc << 1);
pWorkrow += 2;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_GA8, MNG_LC_END);
#endif
return mng_store_ga8 (pData);
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_delta_ga16 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_GA16, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iDeltaBlocky * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) +
(pData->iDeltaBlockx * pBuf->iSamplesize);
/* pixel replace ? */
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* put in object buffer */
*(pOutrow+1) = *(pWorkrow+1);
*(pOutrow+2) = *(pWorkrow+2);
*(pOutrow+3) = *(pWorkrow+3);
/* next pixel */
pOutrow += (pData->iColinc << 2);
pWorkrow += 4;
}
}
else
{ /* pixel add ! */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{ /* add to object buffer */
mng_put_uint16 (pOutrow, (mng_uint16)(mng_get_uint16 (pOutrow ) +
mng_get_uint16 (pWorkrow ) ));
mng_put_uint16 (pOutrow+2, (mng_uint16)(mng_get_uint16 (pOutrow+2 ) +
mng_get_uint16 (pWorkrow+2) ));
/* next pixel */
pOutrow += (pData->iColinc << 2);
pWorkrow += 4;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_GA16, MNG_LC_END);
#endif
return mng_store_ga16 (pData);
}
#endif
/* ************************************************************************** */
mng_retcode mng_delta_rgba8 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGBA8, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iDeltaBlocky * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) +
(pData->iDeltaBlockx * pBuf->iSamplesize);
/* pixel replace ? */
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow; /* put in object buffer */
*(pOutrow+1) = *(pWorkrow+1);
*(pOutrow+2) = *(pWorkrow+2);
*(pOutrow+3) = *(pWorkrow+3);
/* next pixel */
pOutrow += (pData->iColinc << 2);
pWorkrow += 4;
}
}
else
{ /* pixel add ! */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{ /* add to object buffer */
*pOutrow = (mng_uint8)(*pOutrow + *pWorkrow );
*(pOutrow+1) = (mng_uint8)(*(pOutrow+1) + *(pWorkrow+1));
*(pOutrow+2) = (mng_uint8)(*(pOutrow+2) + *(pWorkrow+2));
*(pOutrow+3) = (mng_uint8)(*(pOutrow+3) + *(pWorkrow+3));
/* next pixel */
pOutrow += (pData->iColinc << 2);
pWorkrow += 4;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGBA8, MNG_LC_END);
#endif
return mng_store_rgba8 (pData);
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_delta_rgba16 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGBA16, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iDeltaBlocky * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) +
(pData->iDeltaBlockx * pBuf->iSamplesize);
/* pixel replace ? */
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
MNG_COPY (pOutrow, pWorkrow, 8); /* put in object buffer */
/* next pixel */
pOutrow += (pData->iColinc << 3);
pWorkrow += 8;
}
}
else
{ /* pixel add ! */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{ /* add to object buffer */
mng_put_uint16 (pOutrow, (mng_uint16)(mng_get_uint16 (pOutrow ) +
mng_get_uint16 (pWorkrow ) ));
mng_put_uint16 (pOutrow+2, (mng_uint16)(mng_get_uint16 (pOutrow+2 ) +
mng_get_uint16 (pWorkrow+2) ));
mng_put_uint16 (pOutrow+4, (mng_uint16)(mng_get_uint16 (pOutrow+4 ) +
mng_get_uint16 (pWorkrow+4) ));
mng_put_uint16 (pOutrow+6, (mng_uint16)(mng_get_uint16 (pOutrow+6 ) +
mng_get_uint16 (pWorkrow+6) ));
/* next pixel */
pOutrow += (pData->iColinc << 3);
pWorkrow += 8;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGBA16, MNG_LC_END);
#endif
return mng_store_rgba16 (pData);
}
#endif
/* ************************************************************************** */
/* * * */
/* * Delta-image row routines - apply the source row onto the target * */
/* * * */
/* ************************************************************************** */
#ifndef MNG_NO_1_2_4BIT_SUPPORT
mng_retcode mng_delta_g1_g1 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_G1_G1, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
{
MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples);
}
else
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = (mng_uint8)(((mng_uint16)*pOutrow +
(mng_uint16)*pWorkrow) & 0x01);
pOutrow++;
pWorkrow++;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_G1_G1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_delta_g2_g2 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_G2_G2, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
{
MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples);
}
else
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = (mng_uint8)(((mng_uint16)*pOutrow +
(mng_uint16)*pWorkrow) & 0x03);
pOutrow++;
pWorkrow++;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_G2_G2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_delta_g4_g4 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_G4_G4, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
{
MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples);
}
else
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = (mng_uint8)(((mng_uint16)*pOutrow +
(mng_uint16)*pWorkrow) & 0x0F);
pOutrow++;
pWorkrow++;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_G4_G4, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_delta_g8_g8 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_G8_G8, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
{
MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples);
}
else
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = (mng_uint8)(((mng_uint16)*pOutrow +
(mng_uint16)*pWorkrow) & 0xFF);
pOutrow++;
pWorkrow++;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_G8_G8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_delta_g16_g16 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_G16_G16, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
{
MNG_COPY (pOutrow, pWorkrow, (pData->iRowsamples << 1));
}
else
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
mng_put_uint16 (pOutrow, (mng_uint16)((mng_get_uint16 (pOutrow) +
mng_get_uint16 (pWorkrow)) & 0xFFFF));
pOutrow += 2;
pWorkrow += 2;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_G16_G16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
#endif /* MNG_NO_DELTA_PNG */
/* ************************************************************************** */
mng_retcode mng_delta_rgb8_rgb8 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGB8_RGB8, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
{
MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples * 3);
}
else
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples*3; iX > 0; iX--)
#else
for (iX = 0; iX < (pData->iRowsamples * 3); iX++)
#endif
{
*pOutrow = (mng_uint8)(((mng_uint16)*pOutrow +
(mng_uint16)*pWorkrow) & 0xFF);
pOutrow++;
pWorkrow++;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGB8_RGB8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_delta_rgb16_rgb16 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGB16_RGB16, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
{
MNG_COPY (pOutrow, pWorkrow, (pData->iRowsamples * 6));
}
else
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
mng_put_uint16 (pOutrow, (mng_uint16)((mng_get_uint16 (pOutrow ) +
mng_get_uint16 (pWorkrow )) & 0xFFFF));
mng_put_uint16 (pOutrow+2, (mng_uint16)((mng_get_uint16 (pOutrow+2) +
mng_get_uint16 (pWorkrow+2)) & 0xFFFF));
mng_put_uint16 (pOutrow+4, (mng_uint16)((mng_get_uint16 (pOutrow+4) +
mng_get_uint16 (pWorkrow+4)) & 0xFFFF));
pOutrow += 6;
pWorkrow += 6;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGB16_RGB16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
mng_retcode mng_delta_ga8_ga8 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_GA8_GA8, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
{
MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples << 1);
}
else
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = (pData->iRowsamples<<1); iX > 0; iX--)
#else
for (iX = 0; iX < (pData->iRowsamples << 1); iX++)
#endif
{
*pOutrow = (mng_uint8)(((mng_uint16)*pOutrow +
(mng_uint16)*pWorkrow) & 0xFF);
pOutrow++;
pWorkrow++;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_GA8_GA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_delta_ga8_g8 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_GA8_G8, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow;
pOutrow += 2;
pWorkrow++;
}
}
else
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = (mng_uint8)(((mng_uint16)*pOutrow +
(mng_uint16)*pWorkrow) & 0xFF);
pOutrow += 2;
pWorkrow++;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_GA8_G8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_delta_ga8_a8 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_GA8_A8, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) + 1;
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow;
pOutrow += 2;
pWorkrow++;
}
}
else
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = (mng_uint8)(((mng_uint16)*pOutrow +
(mng_uint16)*pWorkrow) & 0xFF);
pOutrow += 2;
pWorkrow++;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_GA8_A8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_delta_ga16_ga16 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_GA16_GA16, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
{
MNG_COPY (pOutrow, pWorkrow, (pData->iRowsamples << 2));
}
else
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
mng_put_uint16 (pOutrow, (mng_uint16)((mng_get_uint16 (pOutrow ) +
mng_get_uint16 (pWorkrow )) & 0xFFFF));
mng_put_uint16 (pOutrow+2, (mng_uint16)((mng_get_uint16 (pOutrow+2) +
mng_get_uint16 (pWorkrow+2)) & 0xFFFF));
pOutrow += 4;
pWorkrow += 4;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_GA16_GA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_delta_ga16_g16 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_GA16_G16, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
mng_put_uint16 (pOutrow, mng_get_uint16 (pWorkrow));
pOutrow += 4;
pWorkrow += 2;
}
}
else
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
mng_put_uint16 (pOutrow, (mng_uint16)((mng_get_uint16 (pOutrow) +
mng_get_uint16 (pWorkrow)) & 0xFFFF));
pOutrow += 4;
pWorkrow += 2;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_GA16_G16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_delta_ga16_a16 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_GA16_A16, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
mng_put_uint16 (pOutrow+2, mng_get_uint16 (pWorkrow));
pOutrow += 4;
pWorkrow += 2;
}
}
else
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
mng_put_uint16 (pOutrow+2, (mng_uint16)((mng_get_uint16 (pOutrow+2) +
mng_get_uint16 (pWorkrow)) & 0xFFFF));
pOutrow += 4;
pWorkrow += 2;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_GA16_A16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
#endif /* MNG_NO_DELTA_PNG */
/* ************************************************************************** */
mng_retcode mng_delta_rgba8_rgba8 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGBA8_RGBA8, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
{
MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples << 2);
}
else
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = (pData->iRowsamples << 2); iX > 0; iX--)
#else
for (iX = 0; iX < (pData->iRowsamples << 2); iX++)
#endif
{
*pOutrow = (mng_uint8)(((mng_uint16)*pOutrow +
(mng_uint16)*pWorkrow) & 0xFF);
pOutrow++;
pWorkrow++;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGBA8_RGBA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
mng_retcode mng_delta_rgba8_rgb8 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGBA8_RGB8, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow;
*(pOutrow+1) = *(pWorkrow+1);
*(pOutrow+2) = *(pWorkrow+2);
pOutrow += 4;
pWorkrow += 3;
}
}
else
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = (mng_uint8)(((mng_uint16)*pOutrow +
(mng_uint16)*pWorkrow ) & 0xFF);
*(pOutrow+1) = (mng_uint8)(((mng_uint16)*(pOutrow+1) +
(mng_uint16)*(pWorkrow+1)) & 0xFF);
*(pOutrow+2) = (mng_uint8)(((mng_uint16)*(pOutrow+2) +
(mng_uint16)*(pWorkrow+2)) & 0xFF);
pOutrow += 4;
pWorkrow += 3;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGBA8_RGB8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_delta_rgba8_a8 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGBA8_A8, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize) + 3;
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = *pWorkrow;
pOutrow += 4;
pWorkrow++;
}
}
else
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = (mng_uint8)(((mng_uint16)*pOutrow +
(mng_uint16)*pWorkrow) & 0xFF);
pOutrow += 4;
pWorkrow++;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGBA8_A8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_DELTA_PNG */
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_delta_rgba16_rgba16 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGBA16_RGBA16, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
{
MNG_COPY (pOutrow, pWorkrow, (pData->iRowsamples << 3));
}
else
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
mng_put_uint16 (pOutrow, (mng_uint16)((mng_get_uint16 (pOutrow ) +
mng_get_uint16 (pWorkrow )) & 0xFFFF));
mng_put_uint16 (pOutrow+2, (mng_uint16)((mng_get_uint16 (pOutrow+2) +
mng_get_uint16 (pWorkrow+2)) & 0xFFFF));
mng_put_uint16 (pOutrow+4, (mng_uint16)((mng_get_uint16 (pOutrow+4) +
mng_get_uint16 (pWorkrow+4)) & 0xFFFF));
mng_put_uint16 (pOutrow+6, (mng_uint16)((mng_get_uint16 (pOutrow+6) +
mng_get_uint16 (pWorkrow+6)) & 0xFFFF));
pOutrow += 8;
pWorkrow += 8;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGBA16_RGBA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_delta_rgba16_rgb16 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGBA16_RGB16, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
mng_put_uint16 (pOutrow, mng_get_uint16 (pWorkrow ));
mng_put_uint16 (pOutrow+2, mng_get_uint16 (pWorkrow+2));
mng_put_uint16 (pOutrow+4, mng_get_uint16 (pWorkrow+4));
pOutrow += 8;
pWorkrow += 6;
}
}
else
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
mng_put_uint16 (pOutrow, (mng_uint16)((mng_get_uint16 (pOutrow ) +
mng_get_uint16 (pWorkrow )) & 0xFFFF));
mng_put_uint16 (pOutrow+2, (mng_uint16)((mng_get_uint16 (pOutrow+2) +
mng_get_uint16 (pWorkrow+2)) & 0xFFFF));
mng_put_uint16 (pOutrow+4, (mng_uint16)((mng_get_uint16 (pOutrow+4) +
mng_get_uint16 (pWorkrow+4)) & 0xFFFF));
pOutrow += 8;
pWorkrow += 6;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGBA16_RGB16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_delta_rgba16_a16 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGBA16_A16, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
mng_put_uint16 (pOutrow+6, mng_get_uint16 (pWorkrow));
pOutrow += 8;
pWorkrow += 2;
}
}
else
if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD)
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
mng_put_uint16 (pOutrow+6, (mng_uint16)((mng_get_uint16 (pOutrow+6) +
mng_get_uint16 (pWorkrow)) & 0xFFFF));
pOutrow += 8;
pWorkrow += 2;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DELTA_RGBA16_A16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
#endif /* MNG_NO_DELTA_PNG */
/* ************************************************************************** */
/* * * */
/* * Delta-image row routines - scale the delta to bitdepth of target * */
/* * * */
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
#ifndef MNG_NO_1_2_4BIT_SUPPORT
mng_retcode mng_scale_g1_g2 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G1_G2, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pWorkrow = (mng_uint8)(*pWorkrow << 1);
pWorkrow++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G1_G2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_scale_g1_g4 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G1_G4, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pWorkrow = (mng_uint8)(*pWorkrow << 3);
pWorkrow++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G1_G4, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_scale_g1_g8 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G1_G8, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pWorkrow = (mng_uint8)(*pWorkrow << 7);
pWorkrow++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G1_G8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_scale_g1_g16 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_uint8p pOutrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G1_G16, MNG_LC_START);
#endif
pWorkrow = pWorkrow + (pData->iRowsamples - 1);
pOutrow = pOutrow + ((pData->iRowsamples - 1) << 1);
/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + pData->iRowsamples - 1); */
/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + ((pData->iRowsamples - 1) << 1)); */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*(pOutrow+1) = 0;
*pOutrow = (mng_uint8)(*pWorkrow << 7);
pWorkrow--;
pOutrow -= 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G1_G16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_scale_g2_g4 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G2_G4, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pWorkrow = (mng_uint8)(*pWorkrow << 2);
pWorkrow++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G2_G4, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_scale_g2_g8 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G2_G8, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pWorkrow = (mng_uint8)(*pWorkrow << 6);
pWorkrow++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G2_G8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_scale_g2_g16 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_uint8p pOutrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G2_G16, MNG_LC_START);
#endif
pWorkrow = pWorkrow + (pData->iRowsamples - 1);
pOutrow = pOutrow + ((pData->iRowsamples - 1) << 1);
/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + pData->iRowsamples - 1); */
/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + ((pData->iRowsamples - 1) << 1)); */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*(pOutrow+1) = 0;
*pOutrow = (mng_uint8)(*pWorkrow << 6);
pWorkrow--;
pOutrow -= 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G2_G16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_scale_g4_g8 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G4_G8, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pWorkrow = (mng_uint8)(*pWorkrow << 4);
pWorkrow++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G4_G8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_scale_g4_g16 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_uint8p pOutrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G4_G16, MNG_LC_START);
#endif
pWorkrow = pWorkrow + (pData->iRowsamples - 1);
pOutrow = pOutrow + ((pData->iRowsamples - 1) << 1);
/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + pData->iRowsamples - 1); */
/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + ((pData->iRowsamples - 1) << 1)); */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*(pOutrow+1) = 0;
*pOutrow = (mng_uint8)(*pWorkrow << 4);
pWorkrow--;
pOutrow -= 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G4_G16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_scale_g8_g16 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_uint8p pOutrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G8_G16, MNG_LC_START);
#endif
pWorkrow = pWorkrow + (pData->iRowsamples - 1);
pOutrow = pOutrow + ((pData->iRowsamples - 1) << 1);
/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + pData->iRowsamples - 1); */
/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + ((pData->iRowsamples - 1) << 1)); */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*(pOutrow+1) = 0;
*pOutrow = *pWorkrow;
pWorkrow--;
pOutrow -= 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G8_G16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_scale_ga8_ga16 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_uint8p pOutrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_GA8_GA16, MNG_LC_START);
#endif
pWorkrow = pWorkrow + ((pData->iRowsamples - 1) << 1);
pOutrow = pOutrow + ((pData->iRowsamples - 1) << 2);
/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + ((pData->iRowsamples - 1) << 1)); */
/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + ((pData->iRowsamples - 1) << 2)); */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*(pOutrow+3) = 0;
*(pOutrow+2) = *(pWorkrow+1);
*(pOutrow+1) = 0;
*pOutrow = *pWorkrow;
pWorkrow -= 2;
pOutrow -= 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_GA8_GA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_scale_rgb8_rgb16 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_uint8p pOutrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_RGB8_RGB16, MNG_LC_START);
#endif
pWorkrow = pWorkrow + (3 * (pData->iRowsamples - 1));
pOutrow = pOutrow + (6 * (pData->iRowsamples - 1));
/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + 3 * (pData->iRowsamples - 1)); */
/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + 6 * (pData->iRowsamples - 1)); */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*(pOutrow+5) = 0;
*(pOutrow+4) = *(pWorkrow+2);
*(pOutrow+3) = 0;
*(pOutrow+2) = *(pWorkrow+1);
*(pOutrow+1) = 0;
*pOutrow = *pWorkrow;
pWorkrow -= 3;
pOutrow -= 6;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_RGB8_RGB16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_scale_rgba8_rgba16 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_uint8p pOutrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_RGBA8_RGBA16, MNG_LC_START);
#endif
pWorkrow = pWorkrow + ((pData->iRowsamples - 1) << 2);
pOutrow = pOutrow + ((pData->iRowsamples - 1) << 3);
/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + ((pData->iRowsamples - 1) << 2)); */
/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + ((pData->iRowsamples - 1) << 3)); */
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*(pOutrow+7) = 0;
*(pOutrow+6) = *(pWorkrow+3);
*(pOutrow+5) = 0;
*(pOutrow+4) = *(pWorkrow+2);
*(pOutrow+3) = 0;
*(pOutrow+2) = *(pWorkrow+1);
*(pOutrow+1) = 0;
*pOutrow = *pWorkrow;
pWorkrow -= 4;
pOutrow -= 8;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_RGBA8_RGBA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_1_2_4BIT_SUPPORT
mng_retcode mng_scale_g2_g1 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G2_G1, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pWorkrow = (mng_uint8)(*pWorkrow >> 1);
pWorkrow++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G2_G1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_scale_g4_g1 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G4_G1, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pWorkrow = (mng_uint8)(*pWorkrow >> 3);
pWorkrow++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G4_G1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_scale_g8_g1 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G8_G1, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pWorkrow = (mng_uint8)(*pWorkrow >> 7);
pWorkrow++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G8_G1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_scale_g16_g1 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_uint8p pOutrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G16_G1, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 15);
pOutrow++;
pWorkrow += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G16_G1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_scale_g4_g2 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G4_G2, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pWorkrow = (mng_uint8)(*pWorkrow >> 2);
pWorkrow++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G4_G2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_scale_g8_g2 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G8_G2, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pWorkrow = (mng_uint8)(*pWorkrow >> 6);
pWorkrow++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G8_G2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_scale_g16_g2 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_uint8p pOutrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G16_G2, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 14);
pOutrow++;
pWorkrow += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G16_G2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_scale_g8_g4 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G8_G4, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pWorkrow = (mng_uint8)(*pWorkrow >> 4);
pWorkrow++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G8_G4, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_scale_g16_g4 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_uint8p pOutrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G16_G4, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 12);
pOutrow++;
pWorkrow += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G16_G4, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
#endif /* NO_1_2_4BIT_SUPPORT */
/* ************************************************************************** */
mng_retcode mng_scale_g16_g8 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_uint8p pOutrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G16_G8, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8);
pOutrow++;
pWorkrow += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_G16_G8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_scale_ga16_ga8 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_uint8p pOutrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_GA16_GA8, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8);
pOutrow++;
pWorkrow += 2;
*pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8);
pOutrow++;
pWorkrow += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_GA16_GA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_scale_rgb16_rgb8 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_uint8p pOutrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_RGB16_RGB8, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8);
pOutrow++;
pWorkrow += 2;
*pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8);
pOutrow++;
pWorkrow += 2;
*pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8);
pOutrow++;
pWorkrow += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_RGB16_RGB8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_scale_rgba16_rgba8 (mng_datap pData)
{
mng_uint8p pWorkrow = pData->pRGBArow;
mng_uint8p pOutrow = pData->pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_RGBA16_RGBA8, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8);
pOutrow++;
pWorkrow += 2;
*pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8);
pOutrow++;
pWorkrow += 2;
*pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8);
pOutrow++;
pWorkrow += 2;
*pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8);
pOutrow++;
pWorkrow += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_SCALE_RGBA16_RGBA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
/* * * */
/* * Delta-image bit routines - promote bit_depth * */
/* * * */
/* ************************************************************************** */
#ifndef MNG_NO_1_2_4BIT_SUPPORT
mng_uint8 mng_promote_replicate_1_2 (mng_uint8 iB)
{
return (mng_uint8)((iB << 1) | iB);
}
/* ************************************************************************** */
mng_uint8 mng_promote_replicate_1_4 (mng_uint8 iB)
{
iB = (mng_uint8)((iB << 1) + iB);
return (mng_uint8)((iB << 2) + iB);
}
/* ************************************************************************** */
mng_uint8 mng_promote_replicate_1_8 (mng_uint8 iB)
{
iB = (mng_uint8)((iB << 1) + iB);
iB = (mng_uint8)((iB << 2) + iB);
return (mng_uint8)((iB << 4) + iB);
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_uint16 mng_promote_replicate_1_16 (mng_uint8 iB)
{
iB = (mng_uint8)((iB << 1) + iB);
iB = (mng_uint8)((iB << 2) + iB);
iB = (mng_uint8)((iB << 4) + iB);
return (mng_uint16)(((mng_uint16)iB << 8) + (mng_uint16)iB);
}
#endif
/* ************************************************************************** */
mng_uint8 mng_promote_replicate_2_4 (mng_uint8 iB)
{
return (mng_uint8)((iB << 2) + iB);
}
/* ************************************************************************** */
mng_uint8 mng_promote_replicate_2_8 (mng_uint8 iB)
{
iB = (mng_uint8)((iB << 2) + iB);
return (mng_uint8)((iB << 4) + iB);
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_uint16 mng_promote_replicate_2_16 (mng_uint8 iB)
{
iB = (mng_uint8)((iB << 2) + iB);
iB = (mng_uint8)((iB << 4) + iB);
return (mng_uint16)(((mng_uint16)iB << 8) + (mng_uint16)iB);
}
#endif
/* ************************************************************************** */
mng_uint8 mng_promote_replicate_4_8 (mng_uint8 iB)
{
return (mng_uint8)((iB << 4) + iB);
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_uint16 mng_promote_replicate_4_16 (mng_uint8 iB)
{
iB = (mng_uint8)((iB << 4) + iB);
return (mng_uint16)(((mng_uint16)iB << 8) + (mng_uint16)iB);
}
#endif
#endif /* NO_1_2_4BIT_SUPPORT */
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_uint16 mng_promote_replicate_8_16 (mng_uint8 iB)
{
return (mng_uint16)(((mng_uint16)iB << 8) + (mng_uint16)iB);
}
#endif
/* ************************************************************************** */
#if !defined(MNG_NO_DELTA_PNG)
#ifndef MNG_NO_1_2_4BIT_SUPPORT
mng_uint8 mng_promote_zerofill_1_2 (mng_uint8 iB)
{
return (mng_uint8)(iB << 1);
}
/* ************************************************************************** */
mng_uint8 mng_promote_zerofill_1_4 (mng_uint8 iB)
{
return (mng_uint8)(iB << 3);
}
/* ************************************************************************** */
mng_uint8 mng_promote_zerofill_1_8 (mng_uint8 iB)
{
return (mng_uint8)(iB << 7);
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_uint16 mng_promote_zerofill_1_16 (mng_uint8 iB)
{
return (mng_uint16)((mng_uint16)iB << 15);
}
#endif
/* ************************************************************************** */
mng_uint8 mng_promote_zerofill_2_4 (mng_uint8 iB)
{
return (mng_uint8)(iB << 2);
}
/* ************************************************************************** */
mng_uint8 mng_promote_zerofill_2_8 (mng_uint8 iB)
{
return (mng_uint8)(iB << 6);
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_uint16 mng_promote_zerofill_2_16 (mng_uint8 iB)
{
return (mng_uint16)((mng_uint16)iB << 14);
}
#endif
/* ************************************************************************** */
mng_uint8 mng_promote_zerofill_4_8 (mng_uint8 iB)
{
return (mng_uint8)(iB << 4);
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_uint16 mng_promote_zerofill_4_16 (mng_uint8 iB)
{
return (mng_uint16)((mng_uint16)iB << 12);
}
#endif
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_uint16 mng_promote_zerofill_8_16 (mng_uint8 iB)
{
return (mng_uint16)((mng_uint16)iB << 8);
}
#endif
#endif /* MNG_NO_DELTA_PNG */
/* ************************************************************************** */
/* * * */
/* * Delta-image row routines - promote color_type * */
/* * * */
/* ************************************************************************** */
#if !defined(MNG_NO_DELTA_PNG) || !defined(MNG_SKIPCHUNK_PAST) || !defined(MNG_SKIPCHUNK_MAGN)
mng_retcode mng_promote_g8_g8 (mng_datap pData)
{
mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc;
mng_uint8p pDstline = (mng_uint8p)pData->pPromDst;
mng_uint32 iX;
mng_uint8 iB;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G8_G8, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iB = *pSrcline;
if (pData->fPromBitdepth) /* bitdepth promoted ? */
iB = ((mng_bitdepth_8)pData->fPromBitdepth) (iB);
*pDstline = iB;
pSrcline++;
pDstline++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G8_G8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_promote_g8_g16 (mng_datap pData)
{
mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc;
mng_uint8p pDstline = (mng_uint8p)pData->pPromDst;
mng_uint32 iX;
mng_uint16 iW;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G8_G16, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iW = ((mng_bitdepth_16)pData->fPromBitdepth) (*pSrcline);
*pDstline = (mng_uint8)(iW >> 8);
*(pDstline+1) = (mng_uint8)(iW && 0xFF);
pSrcline++;
pDstline += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G8_G16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_promote_g16_g16 (mng_datap pData)
{
mng_uint16p pSrcline = (mng_uint16p)pData->pPromSrc;
mng_uint16p pDstline = (mng_uint16p)pData->pPromDst;
mng_uint32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G16_G16, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
*pDstline = *pSrcline;
pSrcline++;
pDstline++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G16_G16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_promote_g8_ga8 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf;
mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc;
mng_uint8p pDstline = (mng_uint8p)pData->pPromDst;
mng_uint32 iX;
mng_uint8 iB;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G8_GA8, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iB = *pSrcline;
/* no cheap transparency ? */
if ((!pBuf->bHasTRNS) || ((mng_uint16)iB != pBuf->iTRNSgray))
*(pDstline+1) = 0xFF;
if (pData->fPromBitdepth) /* bitdepth promoted ? */
iB = ((mng_bitdepth_8)pData->fPromBitdepth) (iB);
*pDstline = iB;
pSrcline++;
pDstline += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G8_GA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_promote_g8_ga16 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf;
mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc;
mng_uint8p pDstline = (mng_uint8p)pData->pPromDst;
mng_uint32 iX;
mng_uint8 iB;
mng_uint16 iW;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G8_GA16, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iB = *pSrcline;
/* no cheap transparency ? */
if ((!pBuf->bHasTRNS) || ((mng_uint16)iB != pBuf->iTRNSgray))
{
*(pDstline+2) = 0xFF;
*(pDstline+3) = 0xFF;
}
iW = ((mng_bitdepth_16)pData->fPromBitdepth) (iB);
*pDstline = (mng_uint8)(iW >> 8);
*(pDstline+1) = (mng_uint8)(iW && 0xFF);
pSrcline++;
pDstline += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G8_GA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_promote_g16_ga16 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf;
mng_uint16p pSrcline = (mng_uint16p)pData->pPromSrc;
mng_uint16p pDstline = (mng_uint16p)pData->pPromDst;
mng_uint32 iX;
mng_uint16 iW;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G16_GA16, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iW = *pSrcline;
/* no cheap transparency ? */
if ((!pBuf->bHasTRNS) || ((mng_uint16)iW != pBuf->iTRNSgray))
*(pDstline+1) = 0xFFFF;
*pDstline = iW;
pSrcline++;
pDstline += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G16_GA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_promote_g8_rgb8 (mng_datap pData)
{
mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc;
mng_uint8p pDstline = (mng_uint8p)pData->pPromDst;
mng_uint32 iX;
mng_uint8 iB;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGB8, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iB = *pSrcline;
if (pData->fPromBitdepth) /* bitdepth promoted ? */
iB = ((mng_bitdepth_8)pData->fPromBitdepth) (iB);
*pDstline = iB;
*(pDstline+1) = iB;
*(pDstline+2) = iB;
pSrcline++;
pDstline += 3;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGB8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_promote_g8_rgb16 (mng_datap pData)
{
mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc;
mng_uint8p pDstline = (mng_uint8p)pData->pPromDst;
mng_uint32 iX;
mng_uint8 iB;
mng_uint16 iW;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGB16, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iB = *pSrcline;
iW = ((mng_bitdepth_16)pData->fPromBitdepth) (iB);
iB = (mng_uint8)(iW >> 8);
*pDstline = iB;
*(pDstline+2) = iB;
*(pDstline+4) = iB;
iB = (mng_uint8)(iW && 0xFF);
*(pDstline+1) = iB;
*(pDstline+3) = iB;
*(pDstline+5) = iB;
pSrcline++;
pDstline += 6;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGB16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_promote_g16_rgb16 (mng_datap pData)
{
mng_uint16p pSrcline = (mng_uint16p)pData->pPromSrc;
mng_uint16p pDstline = (mng_uint16p)pData->pPromDst;
mng_uint32 iX;
mng_uint16 iW;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G16_RGB16, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iW = *pSrcline;
*pDstline = iW;
*(pDstline+1) = iW;
*(pDstline+2) = iW;
pSrcline++;
pDstline += 3;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G16_RGB16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_promote_g8_rgba8 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf;
mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc;
mng_uint8p pDstline = (mng_uint8p)pData->pPromDst;
mng_uint32 iX;
mng_uint8 iB;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGBA8, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iB = *pSrcline;
/* no cheap transparency ? */
if ((!pBuf->bHasTRNS) || ((mng_uint16)iB != pBuf->iTRNSgray))
*(pDstline+3) = 0xFF;
if (pData->fPromBitdepth) /* bitdepth promoted ? */
iB = ((mng_bitdepth_8)pData->fPromBitdepth) (iB);
*pDstline = iB;
*(pDstline+1) = iB;
*(pDstline+2) = iB;
pSrcline++;
pDstline += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGBA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_promote_g8_rgba16 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf;
mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc;
mng_uint8p pDstline = (mng_uint8p)pData->pPromDst;
mng_uint32 iX;
mng_uint8 iB;
mng_uint16 iW;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGBA16, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iB = *pSrcline;
/* no cheap transparency ? */
if ((!pBuf->bHasTRNS) || ((mng_uint16)iB != pBuf->iTRNSgray))
{
*(pDstline+6) = 0xFF;
*(pDstline+7) = 0xFF;
}
iW = ((mng_bitdepth_16)pData->fPromBitdepth) (iB);
iB = (mng_uint8)(iW >> 8);
*pDstline = iB;
*(pDstline+2) = iB;
*(pDstline+4) = iB;
iB = (mng_uint8)(iW && 0xFF);
*(pDstline+1) = iB;
*(pDstline+3) = iB;
*(pDstline+5) = iB;;
pSrcline++;
pDstline += 8;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGBA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_promote_g16_rgba16 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf;
mng_uint16p pSrcline = (mng_uint16p)pData->pPromSrc;
mng_uint16p pDstline = (mng_uint16p)pData->pPromDst;
mng_uint32 iX;
mng_uint16 iW;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G16_RGBA16, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iW = *pSrcline;
/* no cheap transparency ? */
if ((!pBuf->bHasTRNS) || (iW != pBuf->iTRNSgray))
*(pDstline+3) = 0xFFFF;
*pDstline = iW;
*(pDstline+1) = iW;
*(pDstline+2) = iW;
pSrcline++;
pDstline += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_G16_RGBA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_promote_ga8_ga16 (mng_datap pData)
{
mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc;
mng_uint8p pDstline = (mng_uint8p)pData->pPromDst;
mng_uint32 iX;
mng_uint16 iW;
mng_uint16 iA;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_GA8_GA16, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iW = ((mng_bitdepth_16)pData->fPromBitdepth) (*pSrcline);
iA = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+1));
*pDstline = (mng_uint8)(iW >> 8);
*(pDstline+1) = (mng_uint8)(iW && 0xFF);
*(pDstline+2) = (mng_uint8)(iA >> 8);
*(pDstline+3) = (mng_uint8)(iA && 0xFF);
pSrcline += 2;
pDstline += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_GA8_GA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_promote_ga8_rgba8 (mng_datap pData)
{
mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc;
mng_uint8p pDstline = (mng_uint8p)pData->pPromDst;
mng_uint32 iX;
mng_uint8 iB;
mng_uint8 iA;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_GA8_RGBA8, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iB = *pSrcline;
iA = *(pSrcline+1);
*pDstline = iB;
*(pDstline+1) = iB;
*(pDstline+2) = iB;
*(pDstline+3) = iA;
pSrcline += 2;
pDstline += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_GA8_RGBA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_promote_ga8_rgba16 (mng_datap pData)
{
mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc;
mng_uint8p pDstline = (mng_uint8p)pData->pPromDst;
mng_uint32 iX;
mng_uint8 iB;
mng_uint16 iW;
mng_uint16 iA;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_GA8_RGBA16, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iW = ((mng_bitdepth_16)pData->fPromBitdepth) (*pSrcline);
iA = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+1));
iB = (mng_uint8)(iW >> 8);
*pDstline = iB;
*(pDstline+2) = iB;
*(pDstline+4) = iB;
iB = (mng_uint8)(iW && 0xFF);
*(pDstline+1) = iB;
*(pDstline+3) = iB;
*(pDstline+5) = iB;
*(pDstline+6) = (mng_uint8)(iA >> 8);
*(pDstline+7) = (mng_uint8)(iA && 0xFF);
pSrcline += 2;
pDstline += 8;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_GA8_RGBA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_promote_ga16_rgba16 (mng_datap pData)
{
mng_uint16p pSrcline = (mng_uint16p)pData->pPromSrc;
mng_uint16p pDstline = (mng_uint16p)pData->pPromDst;
mng_uint32 iX;
mng_uint16 iW;
mng_uint16 iA;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_GA16_RGBA16, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iW = *pSrcline;
iA = *(pSrcline+1);
*pDstline = iW;
*(pDstline+1) = iW;
*(pDstline+2) = iW;
*(pDstline+3) = iA;
pSrcline += 2;
pDstline += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_GA16_RGBA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_promote_rgb8_rgb16 (mng_datap pData)
{
mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc;
mng_uint8p pDstline = (mng_uint8p)pData->pPromDst;
mng_uint32 iX;
mng_uint16 iR;
mng_uint16 iG;
mng_uint16 iB;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_RGB8_RGB16, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iR = ((mng_bitdepth_16)pData->fPromBitdepth) (*pSrcline);
iG = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+1));
iB = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+2));
*pDstline = (mng_uint8)(iR >> 8);
*(pDstline+1) = (mng_uint8)(iR && 0xFF);
*(pDstline+2) = (mng_uint8)(iG >> 8);
*(pDstline+3) = (mng_uint8)(iG && 0xFF);
*(pDstline+4) = (mng_uint8)(iB >> 8);
*(pDstline+5) = (mng_uint8)(iB && 0xFF);
pSrcline += 3;
pDstline += 6;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_RGB8_RGB16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_promote_rgb8_rgba8 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf;
mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc;
mng_uint8p pDstline = (mng_uint8p)pData->pPromDst;
mng_uint32 iX;
mng_uint8 iR;
mng_uint8 iG;
mng_uint8 iB;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_RGB8_RGBA8, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iR = *pSrcline;
iG = *(pSrcline+1);
iB = *(pSrcline+2);
/* no cheap transparency ? */
if ((!pBuf->bHasTRNS) || ((mng_uint16)iR != pBuf->iTRNSred) ||
((mng_uint16)iG != pBuf->iTRNSgreen) || ((mng_uint16)iB != pBuf->iTRNSblue))
*(pDstline+3) = 0xFF;
*pDstline = iR;
*(pDstline+1) = iG;
*(pDstline+2) = iB;
pSrcline += 3;
pDstline += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_RGB8_RGBA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_promote_rgb8_rgba16 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf;
mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc;
mng_uint8p pDstline = (mng_uint8p)pData->pPromDst;
mng_uint32 iX;
mng_uint8 iR;
mng_uint8 iG;
mng_uint8 iB;
mng_uint16 iRw;
mng_uint16 iGw;
mng_uint16 iBw;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_RGB8_RGBA16, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iR = *pSrcline;
iG = *(pSrcline+1);
iB = *(pSrcline+2);
/* no cheap transparency ? */
if ((!pBuf->bHasTRNS) || ((mng_uint16)iR != pBuf->iTRNSred) ||
((mng_uint16)iG != pBuf->iTRNSgreen) || ((mng_uint16)iB != pBuf->iTRNSblue))
{
*(pDstline+6) = 0xFF;
*(pDstline+7) = 0xFF;
}
iRw = ((mng_bitdepth_16)pData->fPromBitdepth) (iR);
iGw = ((mng_bitdepth_16)pData->fPromBitdepth) (iG);
iBw = ((mng_bitdepth_16)pData->fPromBitdepth) (iB);
*pDstline = (mng_uint8)(iRw >> 8);
*(pDstline+1) = (mng_uint8)(iRw && 0xFF);
*(pDstline+2) = (mng_uint8)(iGw >> 8);
*(pDstline+3) = (mng_uint8)(iGw && 0xFF);
*(pDstline+4) = (mng_uint8)(iBw >> 8);
*(pDstline+5) = (mng_uint8)(iBw && 0xFF);
pSrcline += 3;
pDstline += 8;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_RGB8_RGBA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_promote_rgb16_rgba16 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf;
mng_uint16p pSrcline = (mng_uint16p)pData->pPromSrc;
mng_uint16p pDstline = (mng_uint16p)pData->pPromDst;
mng_uint32 iX;
mng_uint16 iR;
mng_uint16 iG;
mng_uint16 iB;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_RGB16_RGBA16, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iR = *pSrcline;
iG = *(pSrcline+1);
iB = *(pSrcline+2);
/* no cheap transparency ? */
if ((!pBuf->bHasTRNS) || (iR != pBuf->iTRNSred) ||
(iG != pBuf->iTRNSgreen) || (iB != pBuf->iTRNSblue))
*(pDstline+3) = 0xFFFF;
*pDstline = iR;
*(pDstline+1) = iG;
*(pDstline+2) = iB;
pSrcline += 3;
pDstline += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_RGB16_RGBA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_promote_idx8_rgb8 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf;
mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc;
mng_uint8p pDstline = (mng_uint8p)pData->pPromDst;
mng_uint32 iX;
mng_uint8 iB;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGB8, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
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;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGB8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_promote_idx8_rgb16 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf;
mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc;
mng_uint8p pDstline = (mng_uint8p)pData->pPromDst;
mng_uint32 iX;
mng_uint8 iN;
mng_uint16 iR;
mng_uint16 iG;
mng_uint16 iB;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGB16, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iN = *pSrcline;
if ((mng_uint32)iN < pBuf->iPLTEcount)
{
iR = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aPLTEentries [iN].iRed);
iG = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aPLTEentries [iN].iGreen);
iB = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aPLTEentries [iN].iBlue);
*pDstline = (mng_uint8)(iR >> 8);
*(pDstline+1) = (mng_uint8)(iR && 0xFF);
*(pDstline+2) = (mng_uint8)(iG >> 8);
*(pDstline+3) = (mng_uint8)(iG && 0xFF);
*(pDstline+4) = (mng_uint8)(iB >> 8);
*(pDstline+5) = (mng_uint8)(iB && 0xFF);
}
pSrcline++;
pDstline += 6;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGB16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_promote_idx8_rgba8 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf;
mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc;
mng_uint8p pDstline = (mng_uint8p)pData->pPromDst;
mng_uint32 iX;
mng_uint8 iB;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGBA8, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
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 ((pBuf->bHasTRNS) && ((mng_uint32)iB < pBuf->iTRNScount))
*(pDstline+3) = pBuf->aTRNSentries [iB];
else
*(pDstline+3) = 0xFF;
}
pSrcline++;
pDstline += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGBA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_promote_idx8_rgba16 (mng_datap pData)
{
mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf;
mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc;
mng_uint8p pDstline = (mng_uint8p)pData->pPromDst;
mng_uint32 iX;
mng_uint8 iN;
mng_uint16 iR;
mng_uint16 iG;
mng_uint16 iB;
mng_uint16 iA;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGBA16, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iN = *pSrcline;
if ((mng_uint32)iN < pBuf->iPLTEcount)
{
iR = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aPLTEentries [iN].iRed);
iG = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aPLTEentries [iN].iGreen);
iB = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aPLTEentries [iN].iBlue);
if ((pBuf->bHasTRNS) && ((mng_uint32)iN < pBuf->iTRNScount))
iA = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aTRNSentries [iN]);
else
iA = 0xFFFF;
*pDstline = (mng_uint8)(iR >> 8);
*(pDstline+1) = (mng_uint8)(iR && 0xFF);
*(pDstline+2) = (mng_uint8)(iG >> 8);
*(pDstline+3) = (mng_uint8)(iG && 0xFF);
*(pDstline+4) = (mng_uint8)(iB >> 8);
*(pDstline+5) = (mng_uint8)(iB && 0xFF);
*(pDstline+6) = (mng_uint8)(iA >> 8);
*(pDstline+7) = (mng_uint8)(iA && 0xFF);
}
pSrcline++;
pDstline += 8;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGBA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_promote_rgba8_rgba16 (mng_datap pData)
{
mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc;
mng_uint8p pDstline = (mng_uint8p)pData->pPromDst;
mng_uint32 iX;
mng_uint16 iR;
mng_uint16 iG;
mng_uint16 iB;
mng_uint16 iA;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_RGBA8_RGBA16, MNG_LC_START);
#endif
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPromWidth; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPromWidth; iX++)
#endif
{
iR = ((mng_bitdepth_16)pData->fPromBitdepth) (*pSrcline);
iG = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+1));
iB = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+2));
iA = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+3));
*pDstline = (mng_uint8)(iR >> 8);
*(pDstline+1) = (mng_uint8)(iR && 0xFF);
*(pDstline+2) = (mng_uint8)(iG >> 8);
*(pDstline+3) = (mng_uint8)(iG && 0xFF);
*(pDstline+4) = (mng_uint8)(iB >> 8);
*(pDstline+5) = (mng_uint8)(iB && 0xFF);
*(pDstline+6) = (mng_uint8)(iA >> 8);
*(pDstline+7) = (mng_uint8)(iA && 0xFF);
pSrcline += 4;
pDstline += 8;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROMOTE_RGBA8_RGBA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
#endif /* !defined(MNG_NO_DELTA_PNG) || !defined(MNG_SKIPCHUNK_PAST) || !defined(MNG_SKIPCHUNK_MAGN) */
/* ************************************************************************** */
/* * * */
/* * Row processing routines - convert uncompressed data from zlib to * */
/* * managable row-data which serves as input to the color-management * */
/* * routines * */
/* * * */
/* ************************************************************************** */
#ifndef MNG_NO_1_2_4BIT_SUPPORT
mng_retcode mng_process_g1 (mng_datap pData)
{
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_G1, MNG_LC_START);
#endif
if (!pBuf) /* no object? then use obj 0 */
pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf;
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pRGBArow = pData->pRGBArow;
iM = 0; /* start at pixel 0 */
iB = 0;
if (pBuf->bHasTRNS) /* tRNS encountered ? */
{
if (pBuf->iTRNSgray) /* white transparent ? */
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0x80;
}
if (iB & iM) /* is it white ? */
/* transparent ! */
mng_put_uint32 (pRGBArow, 0x00000000);
else /* opaque black */
mng_put_uint32 (pRGBArow, 0x000000FF);
pRGBArow += 4; /* next pixel */
iM >>= 1;
}
}
else /* black transparent */
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0x80;
}
if (iB & iM) /* is it white ? */
/* opaque white */
mng_put_uint32 (pRGBArow, 0xFFFFFFFF);
else /* transparent */
mng_put_uint32 (pRGBArow, 0x00000000);
pRGBArow += 4; /* next pixel */
iM >>= 1;
}
}
pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */
}
else /* no transparency */
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0x80;
}
if (iB & iM) /* is it white ? */
/* opaque white */
mng_put_uint32 (pRGBArow, 0xFFFFFFFF);
else /* opaque black */
mng_put_uint32 (pRGBArow, 0x000000FF);
pRGBArow += 4; /* next pixel */
iM >>= 1;
}
pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_G1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_process_g2 (mng_datap pData)
{
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
mng_uint32 iS;
mng_uint8 iQ;
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH
const mng_uint32 level[4] = { 0x000000FF, 0x555555FF,
0xAAAAAAFF, 0xFFFFFFFF};
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_G2, MNG_LC_START);
#endif
if (!pBuf) /* no object? then use obj 0 */
pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf;
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pRGBArow = pData->pRGBArow;
iM = 0; /* start at pixel 0 */
iB = 0;
iS = 0;
if (pBuf->bHasTRNS) /* tRNS encountered ? */
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xC0;
iS = 6;
}
/* determine gray level */
iQ = (mng_uint8)((iB & iM) >> iS);
if (iQ == pBuf->iTRNSgray) /* transparent ? */
mng_put_uint32 (pRGBArow, 0x00000000);
else
{
#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH
mng_put_uint32 (pRGBArow, level[iQ]);
#else
switch (iQ) /* determine the gray level */
{
case 0x03 : { mng_put_uint32 (pRGBArow, 0xFFFFFFFF); break; }
case 0x02 : { mng_put_uint32 (pRGBArow, 0xAAAAAAFF); break; }
case 0x01 : { mng_put_uint32 (pRGBArow, 0x555555FF); break; }
default : { mng_put_uint32 (pRGBArow, 0x000000FF); }
}
#endif
}
pRGBArow += 4; /* next pixel */
iM >>= 2;
iS -= 2;
}
pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */
}
else
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xC0;
iS = 6;
}
#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH
mng_put_uint32 (pRGBArow, level[((iB & iM) >> iS)] );
#else
switch ((iB & iM) >> iS) /* determine the gray level */
{
case 0x03 : { mng_put_uint32 (pRGBArow, 0xFFFFFFFF); break; }
case 0x02 : { mng_put_uint32 (pRGBArow, 0xAAAAAAFF); break; }
case 0x01 : { mng_put_uint32 (pRGBArow, 0x555555FF); break; }
default : { mng_put_uint32 (pRGBArow, 0x000000FF); }
}
#endif
pRGBArow += 4; /* next pixel */
iM >>= 2;
iS -= 2;
}
pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_G2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_process_g4 (mng_datap pData)
{
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
mng_uint32 iS;
mng_uint8 iQ;
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_G4, MNG_LC_START);
#endif
if (!pBuf) /* no object? then use obj 0 */
pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf;
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pRGBArow = pData->pRGBArow;
iM = 0; /* start at pixel 0 */
iB = 0;
iS = 0;
if (pBuf->bHasTRNS) /* tRNS encountered ? */
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xF0;
iS = 4;
}
/* get the gray level */
iQ = (mng_uint8)((iB & iM) >> iS);
if (iQ == pBuf->iTRNSgray) /* transparent ? */
{
*pRGBArow = 0; /* put in intermediate row */
*(pRGBArow+1) = 0;
*(pRGBArow+2) = 0;
*(pRGBArow+3) = 0;
}
else
{ /* expand to 8-bit by replication */
iQ = (mng_uint8)(iQ + (iQ << 4));
*pRGBArow = iQ; /* put in intermediate row */
*(pRGBArow+1) = iQ;
*(pRGBArow+2) = iQ;
*(pRGBArow+3) = 0xFF;
}
pRGBArow += 4; /* next pixel */
iM >>= 4;
iS -= 4;
}
pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */
}
else
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xF0;
iS = 4;
}
/* get the gray level */
iQ = (mng_uint8)((iB & iM) >> iS);
iQ = (mng_uint8)(iQ + (iQ << 4));/* expand to 8-bit by replication */
*pRGBArow = iQ; /* put in intermediate row */
*(pRGBArow+1) = iQ;
*(pRGBArow+2) = iQ;
*(pRGBArow+3) = 0xFF;
pRGBArow += 4; /* next pixel */
iM >>= 4;
iS -= 4;
}
pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_G4, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
/* ************************************************************************** */
mng_retcode mng_process_g8 (mng_datap pData)
{
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
mng_int32 iX;
mng_uint8 iB;
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_G8, MNG_LC_START);
#endif
if (!pBuf) /* no object? then use obj 0 */
pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf;
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pRGBArow = pData->pRGBArow;
if (pBuf->bHasTRNS) /* tRNS encountered ? */
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iB = *pWorkrow; /* get next input-byte */
if (iB == pBuf->iTRNSgray) /* transparent ? */
{
*pRGBArow = 0; /* put in intermediate row */
*(pRGBArow+1) = 0;
*(pRGBArow+2) = 0;
*(pRGBArow+3) = 0;
}
else
{
*pRGBArow = iB; /* put in intermediate row */
*(pRGBArow+1) = iB;
*(pRGBArow+2) = iB;
*(pRGBArow+3) = 0xFF;
}
pRGBArow += 4; /* next pixel */
pWorkrow++;
}
pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */
}
else
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iB = *pWorkrow; /* get next input-byte */
*pRGBArow = iB; /* put in intermediate row */
*(pRGBArow+1) = iB;
*(pRGBArow+2) = iB;
*(pRGBArow+3) = 0xFF;
pRGBArow += 4; /* next pixel */
pWorkrow++;
}
pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_G8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_process_g16 (mng_datap pData)
{
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
mng_int32 iX;
mng_uint16 iW;
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_G16, MNG_LC_START);
#endif
if (!pBuf) /* no object? then use obj 0 */
pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf;
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pRGBArow = pData->pRGBArow;
if (pBuf->bHasTRNS) /* tRNS encountered ? */
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iW = mng_get_uint16 (pWorkrow); /* get input */
if (iW == pBuf->iTRNSgray) /* transparent ? */
{ /* put in intermediate row */
mng_put_uint16 (pRGBArow, 0);
mng_put_uint16 (pRGBArow+2, 0);
mng_put_uint16 (pRGBArow+4, 0);
mng_put_uint16 (pRGBArow+6, 0);
}
else
{ /* put in intermediate row */
mng_put_uint16 (pRGBArow, iW);
mng_put_uint16 (pRGBArow+2, iW);
mng_put_uint16 (pRGBArow+4, iW);
mng_put_uint16 (pRGBArow+6, 0xFFFF);
}
pRGBArow += 8; /* next pixel */
pWorkrow += 2;
}
pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */
}
else
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iW = mng_get_uint16 (pWorkrow); /* get input */
mng_put_uint16 (pRGBArow, iW); /* and put in intermediate row */
mng_put_uint16 (pRGBArow+2, iW);
mng_put_uint16 (pRGBArow+4, iW);
mng_put_uint16 (pRGBArow+6, 0xFFFF);
pRGBArow += 8; /* next pixel */
pWorkrow += 2;
}
pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_G16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_process_rgb8 (mng_datap pData)
{
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
mng_int32 iX;
mng_uint8 iR, iG, iB;
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_RGB8, MNG_LC_START);
#endif
if (!pBuf) /* no object? then use obj 0 */
pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf;
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pRGBArow = pData->pRGBArow;
if (pBuf->bHasTRNS) /* tRNS encountered ? */
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iR = *pWorkrow; /* get the RGB values */
iG = *(pWorkrow+1);
iB = *(pWorkrow+2);
/* transparent ? */
if ((iR == pBuf->iTRNSred) && (iG == pBuf->iTRNSgreen) &&
(iB == pBuf->iTRNSblue))
{
*pRGBArow = 0; /* this pixel is transparent ! */
*(pRGBArow+1) = 0;
*(pRGBArow+2) = 0;
*(pRGBArow+3) = 0;
}
else
{
*pRGBArow = iR; /* copy the RGB values */
*(pRGBArow+1) = iG;
*(pRGBArow+2) = iB;
*(pRGBArow+3) = 0xFF; /* this one isn't transparent */
}
pWorkrow += 3; /* next pixel */
pRGBArow += 4;
}
pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */
}
else
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pRGBArow = *pWorkrow; /* copy the RGB bytes */
*(pRGBArow+1) = *(pWorkrow+1);
*(pRGBArow+2) = *(pWorkrow+2);
*(pRGBArow+3) = 0xFF; /* no alpha; so always fully opaque */
pWorkrow += 3; /* next pixel */
pRGBArow += 4;
}
pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_RGB8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_process_rgb16 (mng_datap pData)
{
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
mng_int32 iX;
mng_uint16 iR, iG, iB;
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_RGB16, MNG_LC_START);
#endif
if (!pBuf) /* no object? then use obj 0 */
pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf;
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pRGBArow = pData->pRGBArow;
if (pBuf->bHasTRNS) /* tRNS encountered ? */
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iR = mng_get_uint16 (pWorkrow); /* get the RGB values */
iG = mng_get_uint16 (pWorkrow+2);
iB = mng_get_uint16 (pWorkrow+4);
/* transparent ? */
if ((iR == pBuf->iTRNSred) && (iG == pBuf->iTRNSgreen) &&
(iB == pBuf->iTRNSblue))
{ /* transparent then */
mng_put_uint16 (pRGBArow, 0);
mng_put_uint16 (pRGBArow+2, 0);
mng_put_uint16 (pRGBArow+4, 0);
mng_put_uint16 (pRGBArow+6, 0);
}
else
{ /* put in intermediate row */
mng_put_uint16 (pRGBArow, iR);
mng_put_uint16 (pRGBArow+2, iG);
mng_put_uint16 (pRGBArow+4, iB);
mng_put_uint16 (pRGBArow+6, 0xFFFF);
}
pWorkrow += 6; /* next pixel */
pRGBArow += 8;
}
pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */
}
else
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{ /* copy the RGB values */
mng_put_uint16 (pRGBArow, mng_get_uint16 (pWorkrow ));
mng_put_uint16 (pRGBArow+2, mng_get_uint16 (pWorkrow+2));
mng_put_uint16 (pRGBArow+4, mng_get_uint16 (pWorkrow+4));
mng_put_uint16 (pRGBArow+6, 0xFFFF);
pWorkrow += 6; /* next pixel */
pRGBArow += 8;
}
pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_RGB16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_1_2_4BIT_SUPPORT
mng_retcode mng_process_idx1 (mng_datap pData)
{
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
mng_uint32 iS;
mng_uint8 iQ;
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_IDX1, MNG_LC_START);
#endif
if (!pBuf) /* no object? then use obj 0 */
pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf;
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pRGBArow = pData->pRGBArow;
iM = 0; /* start at pixel 0 */
iB = 0;
iS = 0;
if (pBuf->bHasTRNS) /* tRNS encountered ? */
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0x80;
iS = 7;
}
/* get the index */
iQ = (mng_uint8)((iB & iM) >> iS);
/* index valid ? */
if ((mng_uint32)iQ < pBuf->iPLTEcount)
{ /* put in intermediate row */
*pRGBArow = pBuf->aPLTEentries [iQ].iRed;
*(pRGBArow+1) = pBuf->aPLTEentries [iQ].iGreen;
*(pRGBArow+2) = pBuf->aPLTEentries [iQ].iBlue;
/* transparency for this index ? */
if ((mng_uint32)iQ < pBuf->iTRNScount)
*(pRGBArow+3) = pBuf->aTRNSentries [iQ];
else
*(pRGBArow+3) = 0xFF;
}
else
MNG_ERROR (pData, MNG_PLTEINDEXERROR);
pRGBArow += 4; /* next pixel */
iM >>= 1;
iS -= 1;
}
pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */
}
else
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0x80;
iS = 7;
}
/* get the index */
iQ = (mng_uint8)((iB & iM) >> iS);
/* index valid ? */
if ((mng_uint32)iQ < pBuf->iPLTEcount)
{ /* put in intermediate row */
*pRGBArow = pBuf->aPLTEentries [iQ].iRed;
*(pRGBArow+1) = pBuf->aPLTEentries [iQ].iGreen;
*(pRGBArow+2) = pBuf->aPLTEentries [iQ].iBlue;
*(pRGBArow+3) = 0xFF;
}
else
MNG_ERROR (pData, MNG_PLTEINDEXERROR);
pRGBArow += 4; /* next pixel */
iM >>= 1;
iS -= 1;
}
pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_IDX1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_process_idx2 (mng_datap pData)
{
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
mng_uint32 iS;
mng_uint8 iQ;
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_IDX2, MNG_LC_START);
#endif
if (!pBuf) /* no object? then use obj 0 */
pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf;
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pRGBArow = pData->pRGBArow;
iM = 0; /* start at pixel 0 */
iB = 0;
iS = 0;
if (pBuf->bHasTRNS) /* tRNS encountered ? */
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xC0;
iS = 6;
}
/* get the index */
iQ = (mng_uint8)((iB & iM) >> iS);
/* index valid ? */
if ((mng_uint32)iQ < pBuf->iPLTEcount)
{ /* put in intermediate row */
*pRGBArow = pBuf->aPLTEentries [iQ].iRed;
*(pRGBArow+1) = pBuf->aPLTEentries [iQ].iGreen;
*(pRGBArow+2) = pBuf->aPLTEentries [iQ].iBlue;
/* transparency for this index ? */
if ((mng_uint32)iQ < pBuf->iTRNScount)
*(pRGBArow+3) = pBuf->aTRNSentries [iQ];
else
*(pRGBArow+3) = 0xFF;
}
else
MNG_ERROR (pData, MNG_PLTEINDEXERROR);
pRGBArow += 4; /* next pixel */
iM >>= 2;
iS -= 2;
}
pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */
}
else
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = *pWorkrow; /* get next input-byte */
pWorkrow++;
iM = 0xC0;
iS = 6;
}
/* get the index */
iQ = (mng_uint8)((iB & iM) >> iS);
/* index valid ? */
if ((mng_uint32)iQ < pBuf->iPLTEcount)
{ /* put in intermediate row */
*pRGBArow = pBuf->aPLTEentries [iQ].iRed;
*(pRGBArow+1) = pBuf->aPLTEentries [iQ].iGreen;
*(pRGBArow+2) = pBuf->aPLTEentries [iQ].iBlue;
*(pRGBArow+3) = 0xFF;
}
else
MNG_ERROR (pData, MNG_PLTEINDEXERROR);
pRGBArow += 4; /* next pixel */
iM >>= 2;
iS -= 2;
}
pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_IDX2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_process_idx4 (mng_datap pData)
{
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
mng_int32 iX;
mng_uint8 iB;
mng_uint8 iM;
mng_uint32 iS;
mng_uint8 iQ;
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_IDX4, MNG_LC_START);
#endif
if (!pBuf) /* no object? then use obj 0 */
pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf;
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pRGBArow = pData->pRGBArow;
iM = 0; /* start at pixel 0 */
iB = 0;
iS = 0;
if (pBuf->bHasTRNS) /* tRNS encountered ? */
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = pWorkrow [0]; /* get next input-byte */
pWorkrow++;
iM = 0xF0;
iS = 4;
}
/* get the index */
iQ = (mng_uint8)((iB & iM) >> iS);
/* index valid ? */
if ((mng_uint32)iQ < pBuf->iPLTEcount)
{ /* put in intermediate row */
pRGBArow [0] = pBuf->aPLTEentries [iQ].iRed;
pRGBArow [1] = pBuf->aPLTEentries [iQ].iGreen;
pRGBArow [2] = pBuf->aPLTEentries [iQ].iBlue;
/* transparency for this index ? */
if ((mng_uint32)iQ < pBuf->iTRNScount)
pRGBArow [3] = pBuf->aTRNSentries [iQ];
else
pRGBArow [3] = 0xFF;
}
else
MNG_ERROR (pData, MNG_PLTEINDEXERROR);
pRGBArow += 4; /* next pixel */
iM >>= 4;
iS -= 4;
}
pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */
}
else
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
if (!iM) /* mask underflow ? */
{
iB = pWorkrow [0]; /* get next input-byte */
pWorkrow++;
iM = 0xF0;
iS = 4;
}
/* get the index */
iQ = (mng_uint8)((iB & iM) >> iS);
/* index valid ? */
if ((mng_uint32)iQ < pBuf->iPLTEcount)
{ /* put in intermediate row */
pRGBArow [0] = pBuf->aPLTEentries [iQ].iRed;
pRGBArow [1] = pBuf->aPLTEentries [iQ].iGreen;
pRGBArow [2] = pBuf->aPLTEentries [iQ].iBlue;
pRGBArow [3] = 0xFF;
}
else
MNG_ERROR (pData, MNG_PLTEINDEXERROR);
pRGBArow += 4; /* next pixel */
iM >>= 4;
iS -= 4;
}
pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_IDX4, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
/* ************************************************************************** */
mng_retcode mng_process_idx8 (mng_datap pData)
{
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
mng_int32 iX;
mng_uint8 iQ;
mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_IDX8, MNG_LC_START);
#endif
if (!pBuf) /* no object? then use obj 0 */
pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf;
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pRGBArow = pData->pRGBArow;
if (pBuf->bHasTRNS) /* tRNS encountered ? */
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iQ = *pWorkrow; /* get input byte */
/* index valid ? */
if ((mng_uint32)iQ < pBuf->iPLTEcount)
{ /* put in intermediate row */
pRGBArow [0] = pBuf->aPLTEentries [iQ].iRed;
pRGBArow [1] = pBuf->aPLTEentries [iQ].iGreen;
pRGBArow [2] = pBuf->aPLTEentries [iQ].iBlue;
/* transparency for this index ? */
if ((mng_uint32)iQ < pBuf->iTRNScount)
pRGBArow [3] = pBuf->aTRNSentries [iQ];
else
pRGBArow [3] = 0xFF;
}
else
MNG_ERROR (pData, MNG_PLTEINDEXERROR);
pRGBArow += 4; /* next pixel */
pWorkrow++;
}
pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */
}
else
{
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iQ = *pWorkrow; /* get input byte */
/* index valid ? */
if ((mng_uint32)iQ < pBuf->iPLTEcount)
{ /* put in intermediate row */
pRGBArow [0] = pBuf->aPLTEentries [iQ].iRed;
pRGBArow [1] = pBuf->aPLTEentries [iQ].iGreen;
pRGBArow [2] = pBuf->aPLTEentries [iQ].iBlue;
pRGBArow [3] = 0xFF;
}
else
MNG_ERROR (pData, MNG_PLTEINDEXERROR);
pRGBArow += 4; /* next pixel */
pWorkrow++;
}
pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_IDX8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_process_ga8 (mng_datap pData)
{
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_GA8, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pRGBArow = pData->pRGBArow;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
*pRGBArow = *pWorkrow; /* copy the gray value */
*(pRGBArow+1) = *pWorkrow;
*(pRGBArow+2) = *pWorkrow;
*(pRGBArow+3) = *(pWorkrow+1); /* copy the alpha value */
pWorkrow += 2; /* next pixel */
pRGBArow += 4;
}
pData->bIsOpaque = MNG_FALSE; /* it's definitely not fully opaque */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_GA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_process_ga16 (mng_datap pData)
{
mng_uint8p pWorkrow;
mng_uint8p pRGBArow;
mng_int32 iX;
mng_uint16 iW;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_GA16, MNG_LC_START);
#endif
/* temporary work pointers */
pWorkrow = pData->pWorkrow + pData->iPixelofs;
pRGBArow = pData->pRGBArow;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iW = mng_get_uint16 (pWorkrow); /* copy the gray value */
mng_put_uint16 (pRGBArow, iW);
mng_put_uint16 (pRGBArow+2, iW);
mng_put_uint16 (pRGBArow+4, iW);
/* copy the alpha value */
mng_put_uint16 (pRGBArow+6, mng_get_uint16 (pWorkrow+2));
pWorkrow += 4; /* next pixel */
pRGBArow += 8;
}
pData->bIsOpaque = MNG_FALSE; /* it's definitely not fully opaque */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_GA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_process_rgba8 (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_RGBA8, MNG_LC_START);
#endif
/* this is the easiest transform */
MNG_COPY (pData->pRGBArow, pData->pWorkrow + pData->iPixelofs, pData->iRowsize);
pData->bIsOpaque = MNG_FALSE; /* it's definitely not fully opaque */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_RGBA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_process_rgba16 (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_RGBA16, MNG_LC_START);
#endif
/* this is the easiest transform */
MNG_COPY (pData->pRGBArow, pData->pWorkrow + pData->iPixelofs, pData->iRowsize);
pData->bIsOpaque = MNG_FALSE; /* it's definitely not fully opaque */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_PROCESS_RGBA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
/* * * */
/* * Row processing initialization routines - set up the variables needed * */
/* * to process uncompressed row-data * */
/* * * */
/* ************************************************************************** */
#ifndef MNG_OPTIMIZE_FOOTPRINT_INIT
#ifndef MNG_NO_1_2_4BIT_SUPPORT
mng_retcode mng_init_g1_ni (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_G1_NI, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_g1;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_g1;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_g1;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_g1;
#endif
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
pData->iSamplemul = 1;
pData->iSampleofs = 7;
pData->iSamplediv = 3;
pData->iRowsize = (pData->iRowsamples + 7) >> 3;
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
pData->iFilterbpp = 1;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_G1_NI, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
mng_retcode mng_init_g1_i (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_G1_I, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_g1;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_g1;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_g1;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_g1;
#endif
pData->iPass = 0; /* from 0..6; is 1..7 in specifications */
pData->iRow = interlace_row [0];
pData->iRowinc = interlace_rowskip [0];
pData->iCol = interlace_col [0];
pData->iColinc = interlace_colskip [0];
pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0];
pData->iSamplemul = 1;
pData->iSampleofs = 7;
pData->iSamplediv = 3;
pData->iRowsize = ((pData->iRowsamples + 7) >> 3);
pData->iRowmax = ((pData->iDatawidth + 7) >> 3) + pData->iPixelofs;
pData->iFilterbpp = 1;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_G1_I, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
mng_retcode mng_init_g2_ni (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_G2_NI, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_g2;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_g2;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_g2;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_g2;
#endif
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
pData->iSamplemul = 1;
pData->iSampleofs = 3;
pData->iSamplediv = 2;
pData->iRowsize = (pData->iRowsamples + 3) >> 2;
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
pData->iFilterbpp = 1;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_G2_NI, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
mng_retcode mng_init_g2_i (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_G2_I, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_g2;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_g2;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_g2;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_g2;
#endif
pData->iPass = 0; /* from 0..6; is 1..7 in specifications */
pData->iRow = interlace_row [0];
pData->iRowinc = interlace_rowskip [0];
pData->iCol = interlace_col [0];
pData->iColinc = interlace_colskip [0];
pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0];
pData->iSamplemul = 1;
pData->iSampleofs = 3;
pData->iSamplediv = 2;
pData->iRowsize = ((pData->iRowsamples + 3) >> 2);
pData->iRowmax = ((pData->iDatawidth + 3) >> 2) + pData->iPixelofs;
pData->iFilterbpp = 1;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_G2_I, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
mng_retcode mng_init_g4_ni (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_G4_NI, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_g4;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_g4;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_g4;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_g4;
#endif
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
pData->iSamplemul = 1;
pData->iSampleofs = 1;
pData->iSamplediv = 1;
pData->iRowsize = (pData->iRowsamples + 1) >> 1;
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
pData->iFilterbpp = 1;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_G4_NI, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
mng_retcode mng_init_g4_i (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_G4_I, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_g4;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_g4;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_g4;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_g4;
#endif
pData->iPass = 0; /* from 0..6; is 1..7 in specifications */
pData->iRow = interlace_row [0];
pData->iRowinc = interlace_rowskip [0];
pData->iCol = interlace_col [0];
pData->iColinc = interlace_colskip [0];
pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0];
pData->iSamplemul = 1;
pData->iSampleofs = 1;
pData->iSamplediv = 1;
pData->iRowsize = ((pData->iRowsamples + 1) >> 1);
pData->iRowmax = ((pData->iDatawidth + 1) >> 1) + pData->iPixelofs;
pData->iFilterbpp = 1;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_G4_I, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
/* ************************************************************************** */
mng_retcode mng_init_g8_ni (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_G8_NI, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_g8;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_g8;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_g8;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_g8;
#endif
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
pData->iSamplemul = 1;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = pData->iRowsamples;
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
pData->iFilterbpp = 1;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_G8_NI, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
mng_retcode mng_init_g8_i (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_G8_I, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_g8;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_g8;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_g8;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_g8;
#endif
pData->iPass = 0; /* from 0..6; is 1..7 in specifications */
pData->iRow = interlace_row [0];
pData->iRowinc = interlace_rowskip [0];
pData->iCol = interlace_col [0];
pData->iColinc = interlace_colskip [0];
pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0];
pData->iSamplemul = 1;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = pData->iRowsamples;
pData->iRowmax = pData->iDatawidth + pData->iPixelofs;
pData->iFilterbpp = 1;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_G8_I, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_init_g16_ni (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_G16_NI, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_g16;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_g16;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_g16;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_g16;
#endif
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
pData->iSamplemul = 2;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = pData->iRowsamples << 1;
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
pData->iFilterbpp = 2;
pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_G16_NI, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_init_g16_i (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_G16_I, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_g16;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_g16;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_g16;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_g16;
#endif
pData->iPass = 0; /* from 0..6; is 1..7 in specifications */
pData->iRow = interlace_row [0];
pData->iRowinc = interlace_rowskip [0];
pData->iCol = interlace_col [0];
pData->iColinc = interlace_colskip [0];
pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0];
pData->iSamplemul = 2;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = pData->iRowsamples << 1;
pData->iRowmax = (pData->iDatawidth << 1) + pData->iPixelofs;
pData->iFilterbpp = 2;
pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_G16_I, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
#endif
/* ************************************************************************** */
mng_retcode mng_init_rgb8_ni (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_RGB8_NI, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_rgb8;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_rgb8;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_rgb8;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_rgb8;
#endif
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
pData->iSamplemul = 3;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = pData->iRowsamples * 3;
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
pData->iFilterbpp = 3;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_RGB8_NI, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
mng_retcode mng_init_rgb8_i (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_RGB8_I, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_rgb8;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_rgb8;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_rgb8;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_rgb8;
#endif
pData->iPass = 0; /* from 0..6; is 1..7 in specifications */
pData->iRow = interlace_row [0];
pData->iRowinc = interlace_rowskip [0];
pData->iCol = interlace_col [0];
pData->iColinc = interlace_colskip [0];
pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0];
pData->iSamplemul = 3;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = pData->iRowsamples * 3;
pData->iRowmax = (pData->iDatawidth * 3) + pData->iPixelofs;
pData->iFilterbpp = 3;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_RGB8_I, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_init_rgb16_ni (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_RGB16_NI, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_rgb16;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_rgb16;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_rgb16;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_rgb16;
#endif
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
pData->iSamplemul = 6;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = pData->iRowsamples * 6;
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
pData->iFilterbpp = 6;
pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_RGB16_NI, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_init_rgb16_i (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_RGB16_I, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_rgb16;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_rgb16;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_rgb16;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_rgb16;
#endif
pData->iPass = 0; /* from 0..6; is 1..7 in specifications */
pData->iRow = interlace_row [0];
pData->iRowinc = interlace_rowskip [0];
pData->iCol = interlace_col [0];
pData->iColinc = interlace_colskip [0];
pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0];
pData->iSamplemul = 6;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = pData->iRowsamples * 6;
pData->iRowmax = (pData->iDatawidth * 6) + pData->iPixelofs;
pData->iFilterbpp = 6;
pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_RGB16_I, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_1_2_4BIT_SUPPORT
mng_retcode mng_init_idx1_ni (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_IDX1_NI, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_idx1;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_idx1;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_idx1;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_idx1;
#endif
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
pData->iSamplemul = 1;
pData->iSampleofs = 7;
pData->iSamplediv = 3;
pData->iRowsize = (pData->iRowsamples + 7) >> 3;
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
pData->iFilterbpp = 1;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_IDX1_NI, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
mng_retcode mng_init_idx1_i (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_IDX1_I, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_idx1;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_idx1;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_idx1;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_idx1;
#endif
pData->iPass = 0; /* from 0..6; is 1..7 in specifications */
pData->iRow = interlace_row [0];
pData->iRowinc = interlace_rowskip [0];
pData->iCol = interlace_col [0];
pData->iColinc = interlace_colskip [0];
pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0];
pData->iSamplemul = 1;
pData->iSampleofs = 7;
pData->iSamplediv = 3;
pData->iRowsize = (pData->iRowsamples + 7) >> 3;
pData->iRowmax = ((pData->iDatawidth + 7) >> 3) + pData->iPixelofs;
pData->iFilterbpp = 1;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_IDX1_I, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
mng_retcode mng_init_idx2_ni (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_IDX2_NI, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_idx2;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_idx2;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_idx2;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_idx2;
#endif
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
pData->iSamplemul = 1;
pData->iSampleofs = 3;
pData->iSamplediv = 2;
pData->iRowsize = (pData->iRowsamples + 3) >> 2;
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
pData->iFilterbpp = 1;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_IDX2_NI, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
mng_retcode mng_init_idx2_i (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_IDX2_I, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_idx2;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_idx2;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_idx2;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_idx2;
#endif
pData->iPass = 0; /* from 0..6; is 1..7 in specifications */
pData->iRow = interlace_row [0];
pData->iRowinc = interlace_rowskip [0];
pData->iCol = interlace_col [0];
pData->iColinc = interlace_colskip [0];
pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0];
pData->iSamplemul = 1;
pData->iSampleofs = 3;
pData->iSamplediv = 2;
pData->iRowsize = (pData->iRowsamples + 3) >> 2;
pData->iRowmax = ((pData->iDatawidth + 3) >> 2) + pData->iPixelofs;
pData->iFilterbpp = 1;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_IDX2_I, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
mng_retcode mng_init_idx4_ni (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_IDX4_NI, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_idx4;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_idx4;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_idx4;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_idx4;
#endif
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
pData->iSamplemul = 1;
pData->iSampleofs = 1;
pData->iSamplediv = 1;
pData->iRowsize = (pData->iRowsamples + 1) >> 1;
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
pData->iFilterbpp = 1;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_IDX4_NI, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
mng_retcode mng_init_idx4_i (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_IDX4_I, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_idx4;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_idx4;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_idx4;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_idx4;
#endif
pData->iPass = 0; /* from 0..6; is 1..7 in specifications */
pData->iRow = interlace_row [0];
pData->iRowinc = interlace_rowskip [0];
pData->iCol = interlace_col [0];
pData->iColinc = interlace_colskip [0];
pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0];
pData->iSamplemul = 1;
pData->iSampleofs = 1;
pData->iSamplediv = 1;
pData->iRowsize = (pData->iRowsamples + 1) >> 1;
pData->iRowmax = ((pData->iDatawidth + 1) >> 1) + pData->iPixelofs;
pData->iFilterbpp = 1;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_IDX4_I, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
/* ************************************************************************** */
mng_retcode mng_init_idx8_ni (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_IDX8_NI, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_idx8;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_idx8;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_idx8;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_idx8;
#endif
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
pData->iSamplemul = 1;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = pData->iRowsamples;
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
pData->iFilterbpp = 1;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_IDX8_NI, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
mng_retcode mng_init_idx8_i (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_IDX8_I, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_idx8;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_idx8;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_idx8;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_idx8;
#endif
pData->iPass = 0; /* from 0..6; is 1..7 in specifications */
pData->iRow = interlace_row [0];
pData->iRowinc = interlace_rowskip [0];
pData->iCol = interlace_col [0];
pData->iColinc = interlace_colskip [0];
pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0];
pData->iSamplemul = 1;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = pData->iRowsamples;
pData->iRowmax = pData->iDatawidth + pData->iPixelofs;
pData->iFilterbpp = 1;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_IDX8_I, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
mng_retcode mng_init_ga8_ni (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_GA8_NI, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_ga8;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_ga8;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_ga8;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_ga8;
#endif
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
pData->iSamplemul = 2;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = pData->iRowsamples << 1;
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
pData->iFilterbpp = 2;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_GA8_NI, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
mng_retcode mng_init_ga8_i (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_GA8_I, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_ga8;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_ga8;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_ga8;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_ga8;
#endif
pData->iPass = 0; /* from 0..6; is 1..7 in specifications */
pData->iRow = interlace_row [0];
pData->iRowinc = interlace_rowskip [0];
pData->iCol = interlace_col [0];
pData->iColinc = interlace_colskip [0];
pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0];
pData->iSamplemul = 2;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = pData->iRowsamples << 1;
pData->iRowmax = (pData->iDatawidth << 1) + pData->iPixelofs;
pData->iFilterbpp = 2;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_GA8_I, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_init_ga16_ni (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_GA16_NI, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_ga16;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_ga16;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_ga16;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_ga16;
#endif
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
pData->iSamplemul = 4;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = pData->iRowsamples << 2;
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
pData->iFilterbpp = 4;
pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_GA16_NI, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_init_ga16_i (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_GA16_I, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_ga16;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_ga16;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_ga16;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_ga16;
#endif
pData->iPass = 0; /* from 0..6; is 1..7 in specifications */
pData->iRow = interlace_row [0];
pData->iRowinc = interlace_rowskip [0];
pData->iCol = interlace_col [0];
pData->iColinc = interlace_colskip [0];
pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0];
pData->iSamplemul = 4;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = pData->iRowsamples << 2;
pData->iRowmax = (pData->iDatawidth << 2) + pData->iPixelofs;
pData->iFilterbpp = 4;
pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_GA16_I, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
#endif
/* ************************************************************************** */
mng_retcode mng_init_rgba8_ni (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_RGBA8_NI, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_rgba8;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_rgba8;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_rgba8;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_rgba8;
#endif
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
pData->iSamplemul = 4;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = pData->iRowsamples << 2;
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
pData->iFilterbpp = 4;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_RGBA8_NI, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
mng_retcode mng_init_rgba8_i (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_RGBA8_I, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_rgba8;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_rgba8;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_rgba8;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_rgba8;
#endif
pData->iPass = 0; /* from 0..6; is 1..7 in specifications */
pData->iRow = interlace_row [0];
pData->iRowinc = interlace_rowskip [0];
pData->iCol = interlace_col [0];
pData->iColinc = interlace_colskip [0];
pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0];
pData->iSamplemul = 4;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = pData->iRowsamples << 2;
pData->iRowmax = (pData->iDatawidth << 2) + pData->iPixelofs;
pData->iFilterbpp = 4;
pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_RGBA8_I, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_init_rgba16_ni (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_RGBA16_NI, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_rgba16;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_rgba16;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_rgba16;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_rgba16;
#endif
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
pData->iSamplemul = 8;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = pData->iRowsamples << 3;
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
pData->iFilterbpp = 8;
pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_RGBA16_NI, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_init_rgba16_i (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_RGBA16_I, MNG_LC_START);
#endif
if (pData->fDisplayrow)
pData->fProcessrow = (mng_fptr)mng_process_rgba16;
if (pData->pStoreobj) /* store in object too ? */
{ /* immediate delta ? */
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
pData->fStorerow = (mng_fptr)mng_delta_rgba16;
else
#endif
pData->fStorerow = (mng_fptr)mng_store_rgba16;
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_rgba16;
#endif
pData->iPass = 0; /* from 0..6; (1..7 in specification) */
pData->iRow = interlace_row [0];
pData->iRowinc = interlace_rowskip [0];
pData->iCol = interlace_col [0];
pData->iColinc = interlace_colskip [0];
pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0];
pData->iSamplemul = 8;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = pData->iRowsamples << 3;
pData->iRowmax = (pData->iDatawidth << 3) + pData->iPixelofs;
pData->iFilterbpp = 8;
pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_RGBA16_I, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
#endif
/* ************************************************************************** */
/* * * */
/* * Row processing initialization routines (JPEG) - set up the variables * */
/* * needed to process uncompressed row-data * */
/* * * */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG
/* ************************************************************************** */
#ifndef MNG_NO_1_2_4BIT_SUPPORT
mng_retcode mng_init_jpeg_a1_ni (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_JPEG_A1_NI, MNG_LC_START);
#endif
if (pData->pStoreobj) /* store in object too ? */
{
if (pData->iJHDRimgbitdepth == 8)
{
switch (pData->iJHDRcolortype)
{
case 12 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a1; break; }
case 14 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a1; break; }
}
}
/* TODO: bitdepth 12 & 20 */
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_g1;
#endif
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
pData->iSamplemul = 1;
pData->iSampleofs = 7;
pData->iSamplediv = 3;
pData->iRowsize = (pData->iRowsamples + 7) >> 3;
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
pData->iFilterbpp = 1;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_JPEG_A1_NI, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
mng_retcode mng_init_jpeg_a2_ni (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_JPEG_A2_NI, MNG_LC_START);
#endif
if (pData->pStoreobj) /* store in object too ? */
{
if (pData->iJHDRimgbitdepth == 8)
{
switch (pData->iJHDRcolortype)
{
case 12 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a2; break; }
case 14 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a2; break; }
}
}
/* TODO: bitdepth 12 & 20 */
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_g2;
#endif
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
pData->iSamplemul = 1;
pData->iSampleofs = 3;
pData->iSamplediv = 2;
pData->iRowsize = (pData->iRowsamples + 3) >> 2;
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
pData->iFilterbpp = 1;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_JPEG_A2_NI, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
mng_retcode mng_init_jpeg_a4_ni (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_JPEG_A4_NI, MNG_LC_START);
#endif
if (pData->pStoreobj) /* store in object too ? */
{
if (pData->iJHDRimgbitdepth == 8)
{
switch (pData->iJHDRcolortype)
{
case 12 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a4; break; }
case 14 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a4; break; }
}
}
/* TODO: bitdepth 12 & 20 */
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_g4;
#endif
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
pData->iSamplemul = 1;
pData->iSampleofs = 1;
pData->iSamplediv = 1;
pData->iRowsize = (pData->iRowsamples + 1) >> 1;
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
pData->iFilterbpp = 1;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_JPEG_A4_NI, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
/* ************************************************************************** */
mng_retcode mng_init_jpeg_a8_ni (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_JPEG_A8_NI, MNG_LC_START);
#endif
if (pData->pStoreobj) /* store in object too ? */
{
if (pData->iJHDRimgbitdepth == 8)
{
switch (pData->iJHDRcolortype)
{
case 12 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a8; break; }
case 14 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a8; break; }
}
}
/* TODO: bitdepth 12 & 20 */
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_g8;
#endif
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
pData->iSamplemul = 1;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = pData->iRowsamples;
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
pData->iFilterbpp = 1;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_JPEG_A8_NI, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_init_jpeg_a16_ni (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_JPEG_A16_NI, MNG_LC_START);
#endif
if (pData->pStoreobj) /* store in object too ? */
{
if (pData->iJHDRimgbitdepth == 8)
{
switch (pData->iJHDRcolortype)
{
case 12 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a16; break; }
case 14 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a16; break; }
}
}
/* TODO: bitdepth 12 & 20 */
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
pData->fDifferrow = (mng_fptr)mng_differ_g16;
#endif
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
pData->iSamplemul = 2;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = pData->iRowsamples << 1;
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
pData->iFilterbpp = 2;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_JPEG_A16_NI, MNG_LC_END);
#endif
return mng_init_rowproc (pData);
}
#endif
/* ************************************************************************** */
#endif /* MNG_INCLUDE_JNG */
#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */
/* ************************************************************************** */
/* * * */
/* * Generic row processing initialization & cleanup routines * */
/* * - initialize the buffers used by the row processing routines * */
/* * - cleanup the buffers used by the row processing routines * */
/* * * */
/* ************************************************************************** */
mng_retcode mng_init_rowproc (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_ROWPROC, MNG_LC_START);
#endif
#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT
if (pData->ePng_imgtype != png_none)
{
if (pData->fDisplayrow)
switch (pData->ePng_imgtype)
{
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case png_g1:
pData->fProcessrow = (mng_fptr)mng_process_g1;
break;
case png_g2:
pData->fProcessrow = (mng_fptr)mng_process_g2;
break;
case png_g4:
pData->fProcessrow = (mng_fptr)mng_process_g4;
break;
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case png_g8:
pData->fProcessrow = (mng_fptr)mng_process_g8;
break;
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case png_idx1:
pData->fProcessrow = (mng_fptr)mng_process_idx1;
break;
case png_idx2:
pData->fProcessrow = (mng_fptr)mng_process_idx2;
break;
case png_idx4:
pData->fProcessrow = (mng_fptr)mng_process_idx4;
break;
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case png_idx8:
pData->fProcessrow = (mng_fptr)mng_process_idx8;
break;
case png_ga8:
pData->fProcessrow = (mng_fptr)mng_process_ga8;
break;
case png_rgb8:
pData->fProcessrow = (mng_fptr)mng_process_rgb8;
break;
case png_rgba8:
pData->fProcessrow = (mng_fptr)mng_process_rgba8;
break;
#ifndef MNG_NO_16BIT_SUPPORT
case png_g16:
pData->fProcessrow = (mng_fptr)mng_process_g16;
break;
case png_ga16:
pData->fProcessrow = (mng_fptr)mng_process_ga16;
break;
case png_rgb16:
pData->fProcessrow = (mng_fptr)mng_process_rgb16;
break;
case png_rgba16:
pData->fProcessrow = (mng_fptr)mng_process_rgba16;
break;
#endif
default:
break;
}
if (pData->pStoreobj) /* store in object too ? */
{
#ifndef MNG_NO_DELTA_PNG
if ((pData->bHasDHDR) && (pData->bDeltaimmediate))
switch (pData->ePng_imgtype)
{
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case png_g1:
pData->fStorerow = (mng_fptr)mng_delta_g1;
break;
case png_g2:
pData->fStorerow = (mng_fptr)mng_delta_g2;
break;
case png_g4:
pData->fStorerow = (mng_fptr)mng_delta_g4;
break;
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case png_g8:
pData->fStorerow = (mng_fptr)mng_delta_g8;
break;
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case png_idx1:
pData->fStorerow = (mng_fptr)mng_delta_idx1;
break;
case png_idx2:
pData->fStorerow = (mng_fptr)mng_delta_idx2;
break;
case png_idx4:
pData->fStorerow = (mng_fptr)mng_delta_idx4;
break;
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case png_idx8:
pData->fStorerow = (mng_fptr)mng_delta_idx8;
break;
case png_ga8:
pData->fStorerow = (mng_fptr)mng_delta_ga8;
break;
case png_rgb8:
pData->fStorerow = (mng_fptr)mng_delta_rgb8;
break;
case png_rgba8:
pData->fStorerow = (mng_fptr)mng_delta_rgba8;
break;
#ifndef MNG_NO_16BIT_SUPPORT
case png_g16:
pData->fStorerow = (mng_fptr)mng_delta_g16;
break;
case png_ga16:
pData->fStorerow = (mng_fptr)mng_delta_ga16;
break;
case png_rgb16:
pData->fStorerow = (mng_fptr)mng_delta_rgb16;
break;
case png_rgba16:
pData->fStorerow = (mng_fptr)mng_delta_rgba16;
break;
#endif
default:
break;
}
else
#endif /* MNG_NO_DELTA_PNG */
switch (pData->ePng_imgtype)
{
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case png_g1:
pData->fStorerow = (mng_fptr)mng_store_g1;
break;
case png_g2:
pData->fStorerow = (mng_fptr)mng_store_g2;
break;
case png_g4:
pData->fStorerow = (mng_fptr)mng_store_g4;
break;
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case png_g8:
pData->fStorerow = (mng_fptr)mng_store_g8;
break;
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case png_idx1:
pData->fStorerow = (mng_fptr)mng_store_idx1;
break;
case png_idx2:
pData->fStorerow = (mng_fptr)mng_store_idx2;
break;
case png_idx4:
pData->fStorerow = (mng_fptr)mng_store_idx4;
break;
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case png_idx8:
pData->fStorerow = (mng_fptr)mng_store_idx8;
break;
case png_ga8:
pData->fStorerow = (mng_fptr)mng_store_ga8;
break;
case png_rgb8:
pData->fStorerow = (mng_fptr)mng_store_rgb8;
break;
case png_rgba8:
pData->fStorerow = (mng_fptr)mng_store_rgba8;
break;
#ifndef MNG_NO_16BIT_SUPPORT
case png_g16:
pData->fStorerow = (mng_fptr)mng_store_g16;
break;
case png_ga16:
pData->fStorerow = (mng_fptr)mng_store_ga16;
break;
case png_rgb16:
pData->fStorerow = (mng_fptr)mng_store_rgb16;
break;
case png_rgba16:
pData->fStorerow = (mng_fptr)mng_store_rgba16;
break;
#endif
#ifdef MNG_INCLUDE_JNG
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case png_jpeg_a1:
/* if (pData->iJHDRimgbitdepth == 8) */
{
switch (pData->iJHDRcolortype)
{
case 12 :
{ pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a1; break; }
case 14 :
{ pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a1; break; }
}
}
/* TODO: bitdepth 12 & 20 */
break;
case png_jpeg_a2:
/* if (pData->iJHDRimgbitdepth == 8) */
{
switch (pData->iJHDRcolortype)
{
case 12 :
{ pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a2; break; }
case 14 :
{ pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a2; break; }
}
}
break;
/* TODO: bitdepth 12 & 20 */
case png_jpeg_a4:
/* if (pData->iJHDRimgbitdepth == 8) */
{
switch (pData->iJHDRcolortype)
{
case 12 :
{ pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a4; break; }
case 14 :
{ pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a4; break; }
}
}
break;
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
/* TODO: bitdepth 12 & 20 */
case png_jpeg_a8:
/* if (pData->iJHDRimgbitdepth == 8) */
{
switch (pData->iJHDRcolortype)
{
case 12 :
{ pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a8; break; }
case 14 :
{ pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a8; break; }
}
}
break;
/* TODO: bitdepth 12 & 20 */
#ifndef MNG_NO_16BIT_SUPPORT
case png_jpeg_a16:
/* if (pData->iJHDRimgbitdepth == 8) */
{
switch (pData->iJHDRcolortype)
{
case 12 :
{ pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a16; break; }
case 14 :
{ pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a16; break; }
}
}
break;
/* TODO: bitdepth 12 & 20 */
#endif
#endif /* MNG_INCLUDE_JNG */
default:
break;
}
}
#ifdef FILTER192 /* leveling & differing ? */
if (pData->iFilter == MNG_FILTER_DIFFERING)
switch (pData->ePng_imgtype)
{
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case png_g1:
#ifdef MNG_INCLUDE_JNG
case png_jpeg_a1:
#endif
pData->fDifferrow = (mng_fptr)mng_differ_g1;
break;
case png_g2:
#ifdef MNG_INCLUDE_JNG
case png_jpeg_a2:
#endif
pData->fDifferrow = (mng_fptr)mng_differ_g2;
break;
case png_g4:
#ifdef MNG_INCLUDE_JNG
case png_jpeg_a4:
#endif
pData->fDifferrow = (mng_fptr)mng_differ_g4;
break;
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case png_g8:
#ifdef MNG_INCLUDE_JNG
case png_jpeg_a8:
#endif
pData->fDifferrow = (mng_fptr)mng_differ_g8;
break;
case png_rgb8:
pData->fDifferrow = (mng_fptr)mng_differ_rgb8;
break;
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case png_idx1:
pData->fDifferrow = (mng_fptr)mng_differ_idx1;
break;
case png_idx2:
pData->fDifferrow = (mng_fptr)mng_differ_idx2;
break;
case png_idx4:
pData->fDifferrow = (mng_fptr)mng_differ_idx4;
break;
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case png_idx8:
pData->fDifferrow = (mng_fptr)mng_differ_idx8;
break;
case png_ga8:
pData->fDifferrow = (mng_fptr)mng_differ_ga8;
break;
case png_rgb8:
pData->fDifferrow = (mng_fptr)mng_differ_rgb8;
break;
case png_rgba8:
pData->fDifferrow = (mng_fptr)mng_differ_rgba8;
break;
#ifndef MNG_NO_16BIT_SUPPORT
case png_g16:
#ifdef MNG_INCLUDE_JNG
case png_jpeg_a16:
#endif
pData->fDifferrow = (mng_fptr)mng_differ_g16;
break;
case png_ga16:
pData->fDifferrow = (mng_fptr)mng_differ_ga16;
break;
case png_rgb16:
pData->fDifferrow = (mng_fptr)mng_differ_rgb16;
break;
case png_rgba16:
pData->fDifferrow = (mng_fptr)mng_differ_rgba16;
break;
#endif
default:
break;
}
#endif
switch (pData->ePng_imgtype)
{
#ifndef MNG_NO_1_2_4BIT_SUPPORT
case png_g1:
case png_idx1:
#ifdef MNG_INCLUDE_JNG
case png_jpeg_a1:
#endif
pData->iSamplemul = 1;
pData->iSampleofs = 7;
pData->iSamplediv = 3;
pData->iFilterbpp = 1;
break;
case png_g2:
case png_idx2:
#ifdef MNG_INCLUDE_JNG
case png_jpeg_a2:
#endif
pData->iSamplemul = 1;
pData->iSampleofs = 3;
pData->iSamplediv = 2;
pData->iFilterbpp = 1;
break;
case png_g4:
case png_idx4:
#ifdef MNG_INCLUDE_JNG
case png_jpeg_a4:
#endif
pData->iSamplemul = 1;
pData->iSampleofs = 1;
pData->iSamplediv = 1;
pData->iFilterbpp = 1;
break;
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
case png_g8:
case png_idx8:
#ifdef MNG_INCLUDE_JNG
case png_jpeg_a8:
#endif
pData->iSamplemul = 1;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iFilterbpp = 1;
break;
case png_ga8:
#ifndef MNG_NO_16BIT_SUPPORT
case png_g16:
#ifdef MNG_INCLUDE_JNG
case png_jpeg_a16:
#endif
#endif
pData->iSamplemul = 2;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iFilterbpp = 2;
break;
case png_rgb8:
pData->iSamplemul = 3;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iFilterbpp = 3;
break;
#ifndef MNG_NO_16BIT_SUPPORT
case png_ga16:
#endif
case png_rgba8:
pData->iSamplemul = 4;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iFilterbpp = 4;
break;
#ifndef MNG_NO_16BIT_SUPPORT
case png_rgb16:
pData->iSamplemul = 6;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iFilterbpp = 6;
break;
case png_rgba16:
pData->iSamplemul = 8;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iFilterbpp = 8;
break;
#endif
default:
break;
}
if (pData->iInterlace) /* noninterlaced */
{
pData->iPass = 0; /* from 0..6; (1..7 in specification) */
pData->iRow = interlace_row [0];
pData->iRowinc = interlace_rowskip [0];
pData->iCol = interlace_col [0];
pData->iColinc = interlace_colskip [0];
pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >>
interlace_divider [0];
pData->iRowmax = ((pData->iDatawidth * pData->iSamplemul +
pData->iSampleofs) >> pData->iSamplediv) + pData->iPixelofs;
}
else /* interlaced */
{
pData->iPass = -1;
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = pData->iDatawidth;
}
if (pData->iSamplediv > 0)
pData->iRowsize = (pData->iRowsamples + pData->iSampleofs) >>
pData->iSamplediv;
else
pData->iRowsize = (pData->iRowsamples * pData->iSamplemul);
if (!pData->iInterlace) /* noninterlaced */
pData->iRowmax = pData->iRowsize + pData->iPixelofs;
#ifdef MNG_NO_16BIT_SUPPORT
pData->bIsRGBA16 = MNG_FALSE;
#else
switch (pData->ePng_imgtype)
{
case png_g16:
case png_ga16:
case png_rgb16:
case png_rgba16:
pData->bIsRGBA16 = MNG_TRUE;
break;
default:
pData->bIsRGBA16 = MNG_FALSE;
break;
}
#endif
}
#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */
if (pData->pStoreobj) /* storage object selected ? */
{
pData->pStorebuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
/* and so it becomes viewable ! */
((mng_imagep)pData->pStoreobj)->bViewable = MNG_TRUE;
((mng_imagedatap)pData->pStorebuf)->bViewable = MNG_TRUE;
}
/* allocate the buffers; the individual init routines have already
calculated the required maximum size; except in the case of a JNG
without alpha!!! */
if (pData->iRowmax)
{
#if defined(MNG_NO_16BIT_SUPPORT) || defined (MNG_NO_1_2_4BIT_SUPPORT)
mng_uint8 iRowadd = 0;
#ifdef MNG_NO_1_2_4BIT_SUPPORT
if (pData->iPNGdepth < 8)
iRowadd=(pData->iPNGdepth*pData->iRowmax+7)/8;
#endif
#ifdef MNG_NO_16BIT_SUPPORT
if (pData->iPNGdepth > 8)
iRowadd=pData->iRowmax;
#endif
MNG_ALLOC (pData, pData->pWorkrow, pData->iRowmax+iRowadd);
MNG_ALLOC (pData, pData->pPrevrow, pData->iRowmax+iRowadd);
#else
MNG_ALLOC (pData, pData->pWorkrow, pData->iRowmax);
MNG_ALLOC (pData, pData->pPrevrow, pData->iRowmax);
#endif
}
/* allocate an RGBA16 row for intermediate processing */
MNG_ALLOC (pData, pData->pRGBArow, (pData->iDatawidth << 3));
#ifndef MNG_NO_CMS
if (pData->fDisplayrow) /* display "on-the-fly" ? */
{
#if defined(MNG_FULL_CMS) /* determine color-management initialization */
mng_retcode iRetcode = mng_init_full_cms (pData, MNG_TRUE, MNG_TRUE, MNG_FALSE);
#elif defined(MNG_GAMMA_ONLY)
mng_retcode iRetcode = mng_init_gamma_only (pData, MNG_TRUE, MNG_TRUE, MNG_FALSE);
#elif defined(MNG_APP_CMS)
mng_retcode iRetcode = mng_init_app_cms (pData, MNG_TRUE, MNG_TRUE, MNG_FALSE);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
}
#endif /* !MNG_NO_CMS */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_INIT_ROWPROC, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_next_row (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_NEXT_ROW, MNG_LC_START);
#endif
pData->iRow += pData->iRowinc; /* increase the row counter */
if (pData->iPass >= 0) /* interlaced ? */
{
while ((pData->iPass < 7) && /* went 'outside' the image ? */
((pData->iRow >= (mng_int32)pData->iDataheight) ||
(pData->iCol >= (mng_int32)pData->iDatawidth ) ))
{
pData->iPass++; /* next pass ! */
if (pData->iPass < 7) /* there's only 7 passes ! */
{
pData->iRow = interlace_row [pData->iPass];
pData->iRowinc = interlace_rowskip [pData->iPass];
pData->iCol = interlace_col [pData->iPass];
pData->iColinc = interlace_colskip [pData->iPass];
pData->iRowsamples = (pData->iDatawidth - pData->iCol + interlace_roundoff [pData->iPass])
>> interlace_divider [pData->iPass];
if (pData->iSamplemul > 1) /* recalculate row dimension */
pData->iRowsize = pData->iRowsamples * pData->iSamplemul;
else
if (pData->iSamplediv > 0)
pData->iRowsize = (pData->iRowsamples + pData->iSampleofs) >> pData->iSamplediv;
else
pData->iRowsize = pData->iRowsamples;
}
if ((pData->iPass < 7) && /* reset previous row to zeroes ? */
(pData->iRow < (mng_int32)pData->iDataheight) &&
(pData->iCol < (mng_int32)pData->iDatawidth ) )
{ /* making sure the filters will work properly! */
mng_int32 iX;
mng_uint8p pTemp = pData->pPrevrow;
#ifdef MNG_NO_16BIT_SUPPORT
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iPNGmult*pData->iRowsize; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iPNGmult*pData->iRowsize; iX++)
#endif
#else
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsize; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsize; iX++)
#endif
#endif
{
*pTemp = 0;
pTemp++;
}
}
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_NEXT_ROW, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_cleanup_rowproc (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_CLEANUP_ROWPROC, MNG_LC_START);
#endif
#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->pRGBArow) /* cleanup buffer for intermediate row */
MNG_FREEX (pData, pData->pRGBArow, (pData->iDatawidth << 3));
if (pData->pPrevrow) /* cleanup buffer for previous row */
MNG_FREEX (pData, pData->pPrevrow, pData->iRowmax);
if (pData->pWorkrow) /* cleanup buffer for working row */
MNG_FREEX (pData, pData->pWorkrow, pData->iRowmax);
pData->pWorkrow = MNG_NULL; /* propogate uninitialized buffers */
pData->pPrevrow = MNG_NULL;
pData->pRGBArow = MNG_NULL;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_CLEANUP_ROWPROC, MNG_LC_END);
#endif
return MNG_NOERROR; /* woohiii */
}
/* ************************************************************************** */
/* * * */
/* * Generic row processing routines for JNG * */
/* * * */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG
/* ************************************************************************** */
mng_retcode mng_display_jpeg_rows (mng_datap pData)
{
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_JPEG_ROWS, MNG_LC_START);
#endif
/* any completed rows ? */
if ((pData->iJPEGrow > pData->iJPEGdisprow) &&
(pData->iJPEGalpharow > pData->iJPEGdisprow) )
{
mng_uint32 iX, iMax;
mng_uint32 iSaverow = pData->iRow; /* save alpha decompression row-count */
/* determine the highest complete(!) row */
if (pData->iJPEGrow > pData->iJPEGalpharow)
iMax = pData->iJPEGalpharow;
else
iMax = pData->iJPEGrow;
/* display the rows */
for (iX = pData->iJPEGdisprow; iX < iMax; iX++)
{
pData->iRow = iX; /* make sure we all know which row to handle */
/* makeup an intermediate row from the buffer */
iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData);
/* color-correct it if necessary */
if ((!iRetcode) && (pData->fCorrectrow))
iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData);
if (!iRetcode) /* and display it */
{
iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData);
if (!iRetcode) /* check progressive display refresh */
iRetcode = mng_display_progressive_check (pData);
}
if (iRetcode) /* on error bail out */
return iRetcode;
}
pData->iJPEGdisprow = iMax; /* keep track of the last displayed row */
pData->iRow = iSaverow; /* restore alpha decompression row-count */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DISPLAY_JPEG_ROWS, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_next_jpeg_alpharow (mng_datap pData)
{
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_NEXT_JPEG_ALPHAROW, MNG_LC_START);
#endif
pData->iJPEGalpharow++; /* count the row */
if (pData->fDisplayrow) /* display "on-the-fly" ? */
{ /* try to display what you can */
iRetcode = mng_display_jpeg_rows (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_NEXT_JPEG_ALPHAROW, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_next_jpeg_row (mng_datap pData)
{
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_NEXT_JPEG_ROW, MNG_LC_START);
#endif
pData->iJPEGrow++; /* increase the row-counter */
if (pData->fDisplayrow) /* display "on-the-fly" ? */
{ /* has alpha channel ? */
if ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA ) ||
(pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) )
{ /* try to display what you can */
iRetcode = mng_display_jpeg_rows (pData);
}
else
{ /* make sure we all know which row to handle */
pData->iRow = pData->iJPEGrow - 1;
/* makeup an intermediate row from the buffer */
iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData);
/* color-correct it if necessary */
if ((!iRetcode) && (pData->fCorrectrow))
iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData);
if (!iRetcode) /* and display it */
{
iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData);
if (!iRetcode) /* check progressive display refresh */
iRetcode = mng_display_progressive_check (pData);
}
}
if (iRetcode) /* on error bail out */
return iRetcode;
}
/* surpassed last filled row ? */
if (pData->iJPEGrow > pData->iJPEGrgbrow)
pData->iJPEGrgbrow = pData->iJPEGrow;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_NEXT_JPEG_ROW, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#endif /* MNG_INCLUDE_JNG */
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_MAGN
#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN
#ifndef MNG_NO_GRAY_SUPPORT
mng_retcode mng_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_uint32 iX, iS, iM;
mng_uint8p pTempsrc1;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_X1, MNG_LC_START);
#endif
pTempsrc1 = pSrcline; /* initialize pixel-loop */
pTempdst = pDstline;
for (iX = 0; iX < iWidth; iX++)
{
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
if (iX == 0) /* first interval ? */
iM = iML;
else
if (iX == (iWidth - 1)) /* last interval ? */
iM = iMR;
else
iM = iMX;
for (iS = 1; iS < iM; iS++) /* fill interval */
{
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
}
pTempsrc1++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_X1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_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_uint32 iX;
mng_int32 iS, iM;
mng_uint8p pTempsrc1;
mng_uint8p pTempsrc2;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_X2, MNG_LC_START);
#endif
pTempsrc1 = pSrcline; /* initialize pixel-loop */
pTempdst = pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 1;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = iMR;
else
iM = iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{ /* is it same as first ? */
if (*pTempsrc1 == *pTempsrc2)
{
for (iS = 1; iS < iM; iS++) /* then just repeat the first */
{
*pTempdst = *pTempsrc1;
pTempdst++;
}
}
else
{
for (iS = 1; iS < iM; iS++) /* calculate the distances */
{
*pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2)) + (mng_int32)(*pTempsrc1) );
pTempdst++;
}
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
}
}
}
pTempsrc1++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_X2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_g8_x3 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_int32 iS, iM, iH;
mng_uint8p pTempsrc1;
mng_uint8p pTempsrc2;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_X3, MNG_LC_START);
#endif
pTempsrc1 = pSrcline; /* initialize pixel-loop */
pTempdst = pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 1;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = iMR;
else
iM = iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{ /* is it same as first ? */
if (*pTempsrc1 == *pTempsrc2)
{
for (iS = 1; iS < iM; iS++) /* then just repeat the first */
{
*pTempdst = *pTempsrc1;
pTempdst++;
}
}
else
{
iH = (iM+1) / 2; /* calculate halfway point */
for (iS = 1; iS < iH; iS++) /* replicate first half */
{
*pTempdst = *pTempsrc1;
pTempdst++;
}
for (iS = iH; iS < iM; iS++) /* replicate second half */
{
*pTempdst = *pTempsrc2;
pTempdst++;
}
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
}
}
}
pTempsrc1++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_X3, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_GRAY_SUPPORT */
/* ************************************************************************** */
mng_retcode mng_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_uint32 iX, iS, iM;
mng_uint8p pTempsrc1;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_X1, MNG_LC_START);
#endif
pTempsrc1 = pSrcline; /* initialize pixel-loop */
pTempdst = pDstline;
for (iX = 0; iX < iWidth; iX++)
{
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
if (iX == 0) /* first interval ? */
iM = iML;
else
if (iX == (iWidth - 1)) /* last interval ? */
iM = iMR;
else
iM = iMX;
for (iS = 1; iS < iM; iS++) /* fill interval */
{
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
}
pTempsrc1 += 3;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_X1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_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_uint32 iX;
mng_int32 iS, iM;
mng_uint8p pTempsrc1;
mng_uint8p pTempsrc2;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_X2, MNG_LC_START);
#endif
pTempsrc1 = pSrcline; /* initialize pixel-loop */
pTempdst = pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 3;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = (mng_int32)iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = (mng_int32)iMR;
else
iM = (mng_int32)iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{
for (iS = 1; iS < iM; iS++)
{
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1; /* just repeat the first */
else /* calculate the distance */
*pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2)) + (mng_int32)(*pTempsrc1) );
pTempdst++;
if (*(pTempsrc1+1) == *(pTempsrc2+1))
*pTempdst = *(pTempsrc1+1);
else
*pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) -
(mng_int32)(*(pTempsrc1+1)) ) + iM) /
(iM * 2)) + (mng_int32)(*(pTempsrc1+1)) );
pTempdst++;
if (*(pTempsrc1+2) == *(pTempsrc2+2))
*pTempdst = *(pTempsrc1+2);
else
*pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+2)) -
(mng_int32)(*(pTempsrc1+2)) ) + iM) /
(iM * 2)) + (mng_int32)(*(pTempsrc1+2)) );
pTempdst++;
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
}
}
}
pTempsrc1 += 3;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_X2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_rgb8_x3 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_int32 iS, iM, iH;
mng_uint8p pTempsrc1;
mng_uint8p pTempsrc2;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_X3, MNG_LC_START);
#endif
pTempsrc1 = pSrcline; /* initialize pixel-loop */
pTempdst = pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 3;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = (mng_int32)iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = (mng_int32)iMR;
else
iM = (mng_int32)iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{
iH = (iM+1) / 2; /* calculate halfway point */
for (iS = 1; iS < iH; iS++) /* replicate first half */
{
*pTempdst = *pTempsrc1;
*(pTempdst+1) = *(pTempsrc1+1);
*(pTempdst+2) = *(pTempsrc1+2);
pTempdst += 3;
}
for (iS = iH; iS < iM; iS++) /* replicate second half */
{
*pTempdst = *pTempsrc2;
*(pTempdst+1) = *(pTempsrc2+1);
*(pTempdst+2) = *(pTempsrc2+2);
pTempdst += 3;
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
}
}
}
pTempsrc1 += 3;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_X3, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_GRAY_SUPPORT
mng_retcode mng_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_uint32 iX, iS, iM;
mng_uint8p pTempsrc1;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X1, MNG_LC_START);
#endif
pTempsrc1 = pSrcline; /* initialize pixel-loop */
pTempdst = pDstline;
for (iX = 0; iX < iWidth; iX++)
{
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
if (iX == 0) /* first interval ? */
iM = iML;
else
if (iX == (iWidth - 1)) /* last interval ? */
iM = iMR;
else
iM = iMX;
for (iS = 1; iS < iM; iS++) /* fill interval */
{
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
}
pTempsrc1 += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_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_uint32 iX;
mng_int32 iS, iM;
mng_uint8p pTempsrc1;
mng_uint8p pTempsrc2;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X2, MNG_LC_START);
#endif
pTempsrc1 = pSrcline; /* initialize pixel-loop */
pTempdst = pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 2;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = iMR;
else
iM = iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{
for (iS = 1; iS < iM; iS++)
{
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1; /* just repeat the first */
else /* calculate the distance */
*pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2)) + (mng_int32)(*pTempsrc1) );
pTempdst++;
if (*(pTempsrc1+1) == *(pTempsrc2+1))
*pTempdst = *(pTempsrc1+1);
else
*pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) -
(mng_int32)(*(pTempsrc1+1)) ) + iM) /
(iM * 2)) + (mng_int32)(*(pTempsrc1+1)) );
pTempdst++;
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
}
}
}
pTempsrc1 += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_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_uint32 iX;
mng_int32 iS, iM, iH;
mng_uint8p pTempsrc1;
mng_uint8p pTempsrc2;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X3, MNG_LC_START);
#endif
pTempsrc1 = pSrcline; /* initialize pixel-loop */
pTempdst = pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 2;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = iMR;
else
iM = iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{
iH = (iM+1) / 2; /* calculate halfway point */
for (iS = 1; iS < iH; iS++) /* replicate first half */
{
*pTempdst = *pTempsrc1;
*(pTempdst+1) = *(pTempsrc1+1);
pTempdst += 2;
}
for (iS = iH; iS < iM; iS++) /* replicate second half */
{
*pTempdst = *pTempsrc2;
*(pTempdst+1) = *(pTempsrc2+1);
pTempdst += 2;
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
}
}
}
pTempsrc1 += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X3, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_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_uint32 iX;
mng_int32 iS, iM, iH;
mng_uint8p pTempsrc1;
mng_uint8p pTempsrc2;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X4, MNG_LC_START);
#endif
pTempsrc1 = pSrcline; /* initialize pixel-loop */
pTempdst = pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 2;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = iMR;
else
iM = iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{
iH = (iM+1) / 2; /* calculate halfway point */
for (iS = 1; iS < iH; iS++) /* first half */
{
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1; /* just repeat the first */
else /* calculate the distance */
*pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2)) + (mng_int32)(*pTempsrc1) );
pTempdst++;
*pTempdst = *(pTempsrc1+1); /* replicate alpha from left */
pTempdst++;
}
for (iS = iH; iS < iM; iS++) /* second half */
{
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1; /* just repeat the first */
else /* calculate the distance */
*pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2)) + (mng_int32)(*pTempsrc1) );
pTempdst++;
*pTempdst = *(pTempsrc2+1); /* replicate alpha from right */
pTempdst++;
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
}
}
}
pTempsrc1 += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X4, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_ga8_x5 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_int32 iS, iM, iH;
mng_uint8p pTempsrc1;
mng_uint8p pTempsrc2;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X5, MNG_LC_START);
#endif
pTempsrc1 = pSrcline; /* initialize pixel-loop */
pTempdst = pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 2;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = iMR;
else
iM = iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{
iH = (iM+1) / 2; /* calculate halfway point */
for (iS = 1; iS < iH; iS++) /* first half */
{
*pTempdst = *pTempsrc1; /* replicate gray from left */
pTempdst++;
if (*(pTempsrc1+1) == *(pTempsrc2+1))
*pTempdst = *(pTempsrc1+1);/* just repeat the first */
else /* calculate the distance */
*pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) -
(mng_int32)(*(pTempsrc1+1)) ) + iM) /
(iM * 2)) + (mng_int32)(*(pTempsrc1+1)) );
pTempdst++;
}
for (iS = iH; iS < iM; iS++) /* second half */
{
*pTempdst = *pTempsrc2; /* replicate gray from right */
pTempdst++;
if (*(pTempsrc1+1) == *(pTempsrc2+1))
*pTempdst = *(pTempsrc1+1);/* just repeat the first */
else /* calculate the distance */
*pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) -
(mng_int32)(*(pTempsrc1+1)) ) + iM) /
(iM * 2)) + (mng_int32)(*(pTempsrc1+1)) );
pTempdst++;
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
}
}
}
pTempsrc1 += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X5, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_GRAY_SUPPORT */
#endif /* MNG_OPTIMIZE_FOOTPRINT_MAGN */
/* ************************************************************************** */
mng_retcode mng_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_uint32 iX, iS, iM;
mng_uint8p pTempsrc1;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X1, MNG_LC_START);
#endif
pTempsrc1 = pSrcline; /* initialize pixel-loop */
pTempdst = pDstline;
for (iX = 0; iX < iWidth; iX++)
{
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
*pTempdst = *(pTempsrc1+3);
pTempdst++;
if (iX == 0) /* first interval ? */
iM = iML;
else
if (iX == (iWidth - 1)) /* last interval ? */
iM = iMR;
else
iM = iMX;
for (iS = 1; iS < iM; iS++) /* fill interval */
{
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
*pTempdst = *(pTempsrc1+3);
pTempdst++;
}
pTempsrc1 += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_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_uint32 iX;
mng_int32 iS, iM;
mng_uint8p pTempsrc1;
mng_uint8p pTempsrc2;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X2, MNG_LC_START);
#endif
pTempsrc1 = pSrcline; /* initialize pixel-loop */
pTempdst = pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 4;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
*pTempdst = *(pTempsrc1+3);
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = (mng_int32)iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = (mng_int32)iMR;
else
iM = (mng_int32)iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{
for (iS = 1; iS < iM; iS++)
{
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1; /* just repeat the first */
else /* calculate the distance */
*pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2)) + (mng_int32)(*pTempsrc1) );
pTempdst++;
if (*(pTempsrc1+1) == *(pTempsrc2+1))
*pTempdst = *(pTempsrc1+1);
else
*pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) -
(mng_int32)(*(pTempsrc1+1)) ) + iM) /
(iM * 2)) + (mng_int32)(*(pTempsrc1+1)) );
pTempdst++;
if (*(pTempsrc1+2) == *(pTempsrc2+2))
*pTempdst = *(pTempsrc1+2);
else
*pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+2)) -
(mng_int32)(*(pTempsrc1+2)) ) + iM) /
(iM * 2)) + (mng_int32)(*(pTempsrc1+2)) );
pTempdst++;
if (*(pTempsrc1+3) == *(pTempsrc2+3))
*pTempdst = *(pTempsrc1+3);
else
*pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+3)) -
(mng_int32)(*(pTempsrc1+3)) ) + iM) /
(iM * 2)) + (mng_int32)(*(pTempsrc1+3)) );
pTempdst++;
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
*pTempdst = *(pTempsrc1+3);
pTempdst++;
}
}
}
pTempsrc1 += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_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_uint32 iX;
mng_int32 iS, iM, iH;
mng_uint8p pTempsrc1;
mng_uint8p pTempsrc2;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X3, MNG_LC_START);
#endif
pTempsrc1 = pSrcline; /* initialize pixel-loop */
pTempdst = pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 4;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
*pTempdst = *(pTempsrc1+3);
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = (mng_int32)iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = (mng_int32)iMR;
else
iM = (mng_int32)iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{
iH = (iM+1) / 2; /* calculate halfway point */
for (iS = 1; iS < iH; iS++) /* replicate first half */
{
*pTempdst = *pTempsrc1;
*(pTempdst+1) = *(pTempsrc1+1);
*(pTempdst+2) = *(pTempsrc1+2);
*(pTempdst+3) = *(pTempsrc1+3);
pTempdst += 4;
}
for (iS = iH; iS < iM; iS++) /* replicate second half */
{
*pTempdst = *pTempsrc2;
*(pTempdst+1) = *(pTempsrc2+1);
*(pTempdst+2) = *(pTempsrc2+2);
*(pTempdst+3) = *(pTempsrc2+3);
pTempdst += 4;
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
*pTempdst = *(pTempsrc1+3);
pTempdst++;
}
}
}
pTempsrc1 += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X3, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_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_uint32 iX;
mng_int32 iS, iM, iH;
mng_uint8p pTempsrc1;
mng_uint8p pTempsrc2;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X4, MNG_LC_START);
#endif
pTempsrc1 = pSrcline; /* initialize pixel-loop */
pTempdst = pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 4;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
*pTempdst = *(pTempsrc1+3);
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = (mng_int32)iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = (mng_int32)iMR;
else
iM = (mng_int32)iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{
iH = (iM+1) / 2; /* calculate halfway point */
for (iS = 1; iS < iH; iS++) /* first half */
{
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1; /* just repeat the first */
else /* calculate the distance */
*pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2)) + (mng_int32)(*pTempsrc1) );
pTempdst++;
if (*(pTempsrc1+1) == *(pTempsrc2+1))
*pTempdst = *(pTempsrc1+1);
else
*pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) -
(mng_int32)(*(pTempsrc1+1)) ) + iM) /
(iM * 2)) + (mng_int32)(*(pTempsrc1+1)) );
pTempdst++;
if (*(pTempsrc1+2) == *(pTempsrc2+2))
*pTempdst = *(pTempsrc1+2);
else
*pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+2)) -
(mng_int32)(*(pTempsrc1+2)) ) + iM) /
(iM * 2)) + (mng_int32)(*(pTempsrc1+2)) );
pTempdst++;
/* replicate alpha from left */
*pTempdst = *(pTempsrc1+3);
pTempdst++;
}
for (iS = iH; iS < iM; iS++) /* second half */
{
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1; /* just repeat the first */
else /* calculate the distance */
*pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2)) + (mng_int32)(*pTempsrc1) );
pTempdst++;
if (*(pTempsrc1+1) == *(pTempsrc2+1))
*pTempdst = *(pTempsrc1+1);
else
*pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) -
(mng_int32)(*(pTempsrc1+1)) ) + iM) /
(iM * 2)) + (mng_int32)(*(pTempsrc1+1)) );
pTempdst++;
if (*(pTempsrc1+2) == *(pTempsrc2+2))
*pTempdst = *(pTempsrc1+2);
else
*pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+2)) -
(mng_int32)(*(pTempsrc1+2)) ) + iM) /
(iM * 2)) + (mng_int32)(*(pTempsrc1+2)) );
pTempdst++;
/* replicate alpha from right */
*pTempdst = *(pTempsrc2+3);
pTempdst++;
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
*pTempdst = *(pTempsrc1+3);
pTempdst++;
}
}
}
pTempsrc1 += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X4, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_rgba8_x5 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_int32 iS, iM, iH;
mng_uint8p pTempsrc1;
mng_uint8p pTempsrc2;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X5, MNG_LC_START);
#endif
pTempsrc1 = pSrcline; /* initialize pixel-loop */
pTempdst = pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 4;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
*pTempdst = *(pTempsrc1+3);
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = (mng_int32)iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = (mng_int32)iMR;
else
iM = (mng_int32)iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{
iH = (iM+1) / 2; /* calculate halfway point */
for (iS = 1; iS < iH; iS++) /* first half */
{
*pTempdst = *pTempsrc1; /* replicate color from left */
*(pTempdst+1) = *(pTempsrc1+1);
*(pTempdst+2) = *(pTempsrc1+2);
if (*(pTempsrc1+3) == *(pTempsrc2+3))
*(pTempdst+3) = *(pTempsrc1+3);
else
*(pTempdst+3) = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+3)) -
(mng_int32)(*(pTempsrc1+3)) ) + iM) /
(iM * 2)) + (mng_int32)(*(pTempsrc1+3)) );
pTempdst += 4;
}
for (iS = iH; iS < iM; iS++) /* second half */
{
*pTempdst = *pTempsrc2; /* replicate color from right */
*(pTempdst+1) = *(pTempsrc2+1);
*(pTempdst+2) = *(pTempsrc2+2);
if (*(pTempsrc1+3) == *(pTempsrc2+3))
*(pTempdst+3) = *(pTempsrc1+3);
else
*(pTempdst+3) = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+3)) -
(mng_int32)(*(pTempsrc1+3)) ) + iM) /
(iM * 2)) + (mng_int32)(*(pTempsrc1+3)) );
pTempdst += 4;
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
*pTempdst = *(pTempsrc1+3);
pTempdst++;
}
}
}
pTempsrc1 += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X4, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN
#ifndef MNG_NO_GRAY_SUPPORT
mng_retcode mng_magnify_g8_y1 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_Y1, MNG_LC_START);
#endif
MNG_COPY (pDstline, pSrcline1, iWidth);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_Y1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_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_uint32 iX;
mng_uint8p pTempsrc1;
mng_uint8p pTempsrc2;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_Y2, MNG_LC_START);
#endif
pTempsrc1 = pSrcline1; /* initialize pixel-loop */
pTempsrc2 = pSrcline2;
pTempdst = pDstline;
if (pTempsrc2) /* do we have a second line ? */
{
for (iX = 0; iX < iWidth; iX++)
{ /* calculate the distances */
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
}
}
else
{ /* just repeat the entire line */
MNG_COPY (pTempdst, pTempsrc1, iWidth);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_Y2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_g8_y3 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_Y3, MNG_LC_START);
#endif
if (pSrcline2) /* do we have a second line ? */
{
if (iS < (iM+1) / 2) /* top half ? */
MNG_COPY (pDstline, pSrcline1, iWidth)
else
MNG_COPY (pDstline, pSrcline2, iWidth);
}
else
{ /* just repeat the entire line */
MNG_COPY (pDstline, pSrcline1, iWidth);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_Y3, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_GRAY_SUPPORT */
/* ************************************************************************** */
mng_retcode mng_magnify_rgb8_y1 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_Y1, MNG_LC_START);
#endif
MNG_COPY (pDstline, pSrcline1, iWidth * 3);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_Y1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_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_uint32 iX;
mng_uint8p pTempsrc1;
mng_uint8p pTempsrc2;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_Y2, MNG_LC_START);
#endif
pTempsrc1 = pSrcline1; /* initialize pixel-loop */
pTempsrc2 = pSrcline2;
pTempdst = pDstline;
if (pTempsrc2) /* do we have a second line ? */
{
for (iX = 0; iX < iWidth; iX++)
{ /* calculate the distances */
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
}
}
else
{ /* just repeat the entire line */
MNG_COPY (pTempdst, pTempsrc1, iWidth * 3);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_Y2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_rgb8_y3 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_Y3, MNG_LC_START);
#endif
if (pSrcline2) /* do we have a second line ? */
{
if (iS < (iM+1) / 2) /* top half ? */
MNG_COPY (pDstline, pSrcline1, iWidth * 3)
else
MNG_COPY (pDstline, pSrcline2, iWidth * 3);
}
else
{ /* just repeat the entire line */
MNG_COPY (pDstline, pSrcline1, iWidth * 3);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_Y3, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_GRAY_SUPPORT
mng_retcode mng_magnify_ga8_y1 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y1, MNG_LC_START);
#endif
MNG_COPY (pDstline, pSrcline1, iWidth << 1);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_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_uint32 iX;
mng_uint8p pTempsrc1;
mng_uint8p pTempsrc2;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y2, MNG_LC_START);
#endif
pTempsrc1 = pSrcline1; /* initialize pixel-loop */
pTempsrc2 = pSrcline2;
pTempdst = pDstline;
if (pTempsrc2) /* do we have a second line ? */
{
for (iX = 0; iX < iWidth; iX++)
{ /* calculate the distances */
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
}
}
else
{ /* just repeat the entire line */
MNG_COPY (pTempdst, pTempsrc1, iWidth << 1);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_ga8_y3 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y3, MNG_LC_START);
#endif
if (pSrcline2) /* do we have a second line ? */
{
if (iS < (iM+1) / 2) /* top half ? */
MNG_COPY (pDstline, pSrcline1, iWidth << 1)
else
MNG_COPY (pDstline, pSrcline2, iWidth << 1);
}
else
{ /* just repeat the entire line */
MNG_COPY (pDstline, pSrcline1, iWidth << 1);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_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_uint32 iX;
mng_uint8p pTempsrc1;
mng_uint8p pTempsrc2;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y4, MNG_LC_START);
#endif
pTempsrc1 = pSrcline1; /* initialize pixel-loop */
pTempsrc2 = pSrcline2;
pTempdst = pDstline;
if (pTempsrc2) /* do we have a second line ? */
{
if (iS < (iM+1) / 2) /* top half ? */
{
for (iX = 0; iX < iWidth; iX++)
{ /* calculate the distances */
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1++;
pTempsrc2 += 2;
*pTempdst++ = *pTempsrc1++; /* replicate alpha from top */
}
}
else
{
for (iX = 0; iX < iWidth; iX++)
{ /* calculate the distances */
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1 += 2;
pTempsrc2++;
*pTempdst++ = *pTempsrc2++; /* replicate alpha from bottom */
}
}
}
else
{ /* just repeat the entire line */
MNG_COPY (pTempdst, pTempsrc1, iWidth << 1);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y4, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_ga8_y5 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_uint8p pTempsrc1;
mng_uint8p pTempsrc2;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y5, MNG_LC_START);
#endif
pTempsrc1 = pSrcline1; /* initialize pixel-loop */
pTempsrc2 = pSrcline2;
pTempdst = pDstline;
if (pTempsrc2) /* do we have a second line ? */
{
if (iS < (iM+1) / 2) /* top half ? */
{
for (iX = 0; iX < iWidth; iX++)
{
*pTempdst = *pTempsrc1; /* replicate gray from top */
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
}
}
else
{
for (iX = 0; iX < iWidth; iX++)
{
*pTempdst = *pTempsrc2; /* replicate gray from bottom */
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
}
}
}
else
{ /* just repeat the entire line */
MNG_COPY (pTempdst, pTempsrc1, iWidth << 1);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y5, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_GRAY_SUPPORT */
#endif /* MNG_OPTIMIZE_FOOTPRINT_MAGN */
/* ************************************************************************** */
mng_retcode mng_magnify_rgba8_y1 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y1, MNG_LC_START);
#endif
MNG_COPY (pDstline, pSrcline1, iWidth << 2);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_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_uint32 iX;
mng_uint8p pTempsrc1;
mng_uint8p pTempsrc2;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y2, MNG_LC_START);
#endif
pTempsrc1 = pSrcline1; /* initialize pixel-loop */
pTempsrc2 = pSrcline2;
pTempdst = pDstline;
if (pTempsrc2) /* do we have a second line ? */
{
for (iX = 0; iX < iWidth; iX++)
{ /* calculate the distances */
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
}
}
else
{ /* just repeat the entire line */
MNG_COPY (pTempdst, pTempsrc1, iWidth << 2);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_rgba8_y3 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y3, MNG_LC_START);
#endif
if (pSrcline2) /* do we have a second line ? */
{
if (iS < (iM+1) / 2) /* top half ? */
MNG_COPY (pDstline, pSrcline1, iWidth << 2)
else
MNG_COPY (pDstline, pSrcline2, iWidth << 2);
}
else
{ /* just repeat the entire line */
MNG_COPY (pDstline, pSrcline1, iWidth << 2);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_rgba8_y4 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_uint8p pTempsrc1;
mng_uint8p pTempsrc2;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y4, MNG_LC_START);
#endif
pTempsrc1 = pSrcline1; /* initialize pixel-loop */
pTempsrc2 = pSrcline2;
pTempdst = pDstline;
if (pTempsrc2) /* do we have a second line ? */
{
if (iS < (iM+1) / 2) /* top half ? */
{
for (iX = 0; iX < iWidth; iX++)
{ /* calculate the distances */
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1++;
pTempsrc2 += 2;
*pTempdst++ = *pTempsrc1++; /* replicate alpha from top */
}
}
else
{
for (iX = 0; iX < iWidth; iX++)
{ /* calculate the distances */
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1 += 2;
pTempsrc2++;
*pTempdst++ = *pTempsrc2++; /* replicate alpha from bottom */
}
}
}
else
{ /* just repeat the entire line */
MNG_COPY (pTempdst, pTempsrc1, iWidth << 2);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y4, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_rgba8_y5 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_uint8p pTempsrc1;
mng_uint8p pTempsrc2;
mng_uint8p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y5, MNG_LC_START);
#endif
pTempsrc1 = pSrcline1; /* initialize pixel-loop */
pTempsrc2 = pSrcline2;
pTempdst = pDstline;
if (pTempsrc2) /* do we have a second line ? */
{
if (iS < (iM+1) / 2) /* top half ? */
{
for (iX = 0; iX < iWidth; iX++)
{
*pTempdst++ = *pTempsrc1++; /* replicate color from top */
*pTempdst++ = *pTempsrc1++;
*pTempdst++ = *pTempsrc1++;
pTempsrc2 += 3;
if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
}
}
else
{
for (iX = 0; iX < iWidth; iX++)
{
*pTempdst++ = *pTempsrc2++; /* replicate color from bottom */
*pTempdst++ = *pTempsrc2++;
*pTempdst++ = *pTempsrc2++;
pTempsrc1 += 3;
if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */
*pTempdst = *pTempsrc1;
else
*pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) -
(mng_int32)(*pTempsrc1) ) + iM) /
(iM * 2) ) + (mng_int32)(*pTempsrc1) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
}
}
}
else
{ /* just repeat the entire line */
MNG_COPY (pTempdst, pTempsrc1, iWidth << 2);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y5, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN
#ifndef MNG_NO_16BIT_SUPPORT
#ifndef MNG_NO_GRAY_SUPPORT
mng_retcode mng_magnify_g16_x1 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline)
{
mng_uint32 iX, iS, iM;
mng_uint16p pTempsrc1;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_X1, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */
pTempdst = (mng_uint16p)pDstline;
for (iX = 0; iX < iWidth; iX++)
{
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
if (iX == 0) /* first interval ? */
iM = iML;
else
if (iX == (iWidth - 1)) /* last interval ? */
iM = iMR;
else
iM = iMX;
for (iS = 1; iS < iM; iS++) /* fill interval */
{
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
}
pTempsrc1++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_X1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_g16_x2 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_int32 iS, iM;
mng_uint16p pTempsrc1;
mng_uint16p pTempsrc2;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_X2, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */
pTempdst = (mng_uint16p)pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 1;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = iMR;
else
iM = iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{ /* is it same as first ? */
if (*pTempsrc1 == *pTempsrc2)
{
for (iS = 1; iS < iM; iS++) /* then just repeat the first */
{
*pTempdst = *pTempsrc1;
pTempdst++;
}
}
else
{
for (iS = 1; iS < iM; iS++) /* calculate the distances */
{
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ));
pTempdst++;
}
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
}
}
}
pTempsrc1++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_X2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_g16_x3 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_int32 iS, iM, iH;
mng_uint16p pTempsrc1;
mng_uint16p pTempsrc2;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_X3, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */
pTempdst = (mng_uint16p)pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 1;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = iMR;
else
iM = iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{ /* is it same as first ? */
if (*pTempsrc1 == *pTempsrc2)
{
for (iS = 1; iS < iM; iS++) /* then just repeat the first */
{
*pTempdst = *pTempsrc1;
pTempdst++;
}
}
else
{
iH = (iM+1) / 2; /* calculate halfway point */
for (iS = 1; iS < iH; iS++) /* replicate first half */
{
*pTempdst = *pTempsrc1;
pTempdst++;
}
for (iS = iH; iS < iM; iS++) /* replicate second half */
{
*pTempdst = *pTempsrc2;
pTempdst++;
}
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
}
}
}
pTempsrc1++;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_X3, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_GRAY_SUPPORT */
/* ************************************************************************** */
mng_retcode mng_magnify_rgb16_x1 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline)
{
mng_uint32 iX, iS, iM;
mng_uint16p pTempsrc1;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_X1, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */
pTempdst = (mng_uint16p)pDstline;
for (iX = 0; iX < iWidth; iX++)
{
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
if (iX == 0) /* first interval ? */
iM = iML;
else
if (iX == (iWidth - 1)) /* last interval ? */
iM = iMR;
else
iM = iMX;
for (iS = 1; iS < iM; iS++) /* fill interval */
{
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
}
pTempsrc1 += 3;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_X1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_rgb16_x2 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_int32 iS, iM;
mng_uint16p pTempsrc1;
mng_uint16p pTempsrc2;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_X2, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */
pTempdst = (mng_uint16p)pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 3;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = (mng_int32)iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = (mng_int32)iMR;
else
iM = (mng_int32)iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{
for (iS = 1; iS < iM; iS++)
{
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1; /* just repeat the first */
else /* calculate the distance */
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
if (*(pTempsrc1+1) == *(pTempsrc2+1))
*pTempdst = *(pTempsrc1+1);
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) );
pTempdst++;
if (*(pTempsrc1+2) == *(pTempsrc2+2))
*pTempdst = *(pTempsrc1+2);
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+2))) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) );
pTempdst++;
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
}
}
}
pTempsrc1 += 3;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_X2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_rgb16_x3 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_int32 iS, iM, iH;
mng_uint16p pTempsrc1;
mng_uint16p pTempsrc2;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_X3, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */
pTempdst = (mng_uint16p)pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 3;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = (mng_int32)iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = (mng_int32)iMR;
else
iM = (mng_int32)iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{
iH = (iM+1) / 2; /* calculate halfway point */
for (iS = 1; iS < iH; iS++) /* replicate first half */
{
*pTempdst = *pTempsrc1;
*(pTempdst+1) = *(pTempsrc1+1);
*(pTempdst+2) = *(pTempsrc1+2);
pTempdst += 3;
}
for (iS = iH; iS < iM; iS++) /* replicate second half */
{
*pTempdst = *pTempsrc2;
*(pTempdst+1) = *(pTempsrc2+1);
*(pTempdst+2) = *(pTempsrc2+2);
pTempdst += 3;
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
}
}
}
pTempsrc1 += 3;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_X3, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_GRAY_SUPPORT
mng_retcode mng_magnify_ga16_x1 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline)
{
mng_uint32 iX, iS, iM;
mng_uint16p pTempsrc1;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X1, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p) pSrcline; /* initialize pixel-loop */
pTempdst = (mng_uint16p)pDstline;
for (iX = 0; iX < iWidth; iX++)
{
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
if (iX == 0) /* first interval ? */
iM = iML;
else
if (iX == (iWidth - 1)) /* last interval ? */
iM = iMR;
else
iM = iMX;
for (iS = 1; iS < iM; iS++) /* fill interval */
{
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
}
pTempsrc1 += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_ga16_x2 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_int32 iS, iM;
mng_uint16p pTempsrc1;
mng_uint16p pTempsrc2;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X2, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */
pTempdst = (mng_uint16p)pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 2;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = iMR;
else
iM = iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{
for (iS = 1; iS < iM; iS++)
{
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1; /* just repeat the first */
else /* calculate the distance */
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
if (*(pTempsrc1+1) == *(pTempsrc2+1))
*pTempdst = *(pTempsrc1+1);
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) );
pTempdst++;
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
}
}
}
pTempsrc1 += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_ga16_x3 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_int32 iS, iM, iH;
mng_uint16p pTempsrc1;
mng_uint16p pTempsrc2;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X3, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */
pTempdst = (mng_uint16p)pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 2;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = iMR;
else
iM = iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{
iH = (iM+1) / 2; /* calculate halfway point */
for (iS = 1; iS < iH; iS++) /* replicate first half */
{
*pTempdst = *pTempsrc1;
*(pTempdst+1) = *(pTempsrc1+1);
pTempdst += 2;
}
for (iS = iH; iS < iM; iS++) /* replicate second half */
{
*pTempdst = *pTempsrc2;
*(pTempdst+1) = *(pTempsrc2+1);
pTempdst += 2;
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
}
}
}
pTempsrc1 += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X3, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_ga16_x4 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_int32 iS, iM, iH;
mng_uint16p pTempsrc1;
mng_uint16p pTempsrc2;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X4, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */
pTempdst = (mng_uint16p)pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 2;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = iMR;
else
iM = iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{
iH = (iM+1) / 2; /* calculate halfway point */
for (iS = 1; iS < iH; iS++) /* first half */
{
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1; /* just repeat the first */
else /* calculate the distance */
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
*pTempdst = *(pTempsrc1+1); /* replicate alpha from left */
pTempdst++;
}
for (iS = iH; iS < iM; iS++) /* second half */
{
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1; /* just repeat the first */
else /* calculate the distance */
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
*pTempdst = *(pTempsrc2+1); /* replicate alpha from right */
pTempdst++;
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
}
}
}
pTempsrc1 += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X4, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_ga16_x5 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_int32 iS, iM, iH;
mng_uint16p pTempsrc1;
mng_uint16p pTempsrc2;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X5, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */
pTempdst = (mng_uint16p)pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 2;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = iMR;
else
iM = iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{
iH = (iM+1) / 2; /* calculate halfway point */
for (iS = 1; iS < iH; iS++) /* first half */
{
*pTempdst = *pTempsrc1; /* replicate gray from left */
pTempdst++;
if (*(pTempsrc1+1) == *(pTempsrc2+1))
*pTempdst = *(pTempsrc1+1);/* just repeat the first */
else /* calculate the distance */
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) );
pTempdst++;
}
for (iS = iH; iS < iM; iS++) /* second half */
{
*pTempdst = *pTempsrc2; /* replicate gray from right */
pTempdst++;
if (*(pTempsrc1+1) == *(pTempsrc2+1))
*pTempdst = *(pTempsrc1+1);/* just repeat the first */
else /* calculate the distance */
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) );
pTempdst++;
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
}
}
}
pTempsrc1 += 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X5, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_GRAY_SUPPORT */
/* ************************************************************************** */
mng_retcode mng_magnify_rgba16_x1 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline)
{
mng_uint32 iX, iS, iM;
mng_uint16p pTempsrc1;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X1, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */
pTempdst = (mng_uint16p)pDstline;
for (iX = 0; iX < iWidth; iX++)
{
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
*pTempdst = *(pTempsrc1+3);
pTempdst++;
if (iX == 0) /* first interval ? */
iM = iML;
else
if (iX == (iWidth - 1)) /* last interval ? */
iM = iMR;
else
iM = iMX;
for (iS = 1; iS < iM; iS++) /* fill interval */
{
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
*pTempdst = *(pTempsrc1+3);
pTempdst++;
}
pTempsrc1 += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_rgba16_x2 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_int32 iS, iM;
mng_uint16p pTempsrc1;
mng_uint16p pTempsrc2;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X2, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */
pTempdst = (mng_uint16p)pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 4;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
*pTempdst = *(pTempsrc1+3);
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = (mng_int32)iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = (mng_int32)iMR;
else
iM = (mng_int32)iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{
for (iS = 1; iS < iM; iS++)
{
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1; /* just repeat the first */
else /* calculate the distance */
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
if (*(pTempsrc1+1) == *(pTempsrc2+1))
*pTempdst = *(pTempsrc1+1);
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) );
pTempdst++;
if (*(pTempsrc1+2) == *(pTempsrc2+2))
*pTempdst = *(pTempsrc1+2);
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+2))) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) );
pTempdst++;
if (*(pTempsrc1+3) == *(pTempsrc2+3))
*pTempdst = *(pTempsrc1+3);
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+3))) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+3))) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+3))) ) );
pTempdst++;
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
*pTempdst = *(pTempsrc1+3);
pTempdst++;
}
}
}
pTempsrc1 += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_rgba16_x3 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_int32 iS, iM, iH;
mng_uint16p pTempsrc1;
mng_uint16p pTempsrc2;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X3, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */
pTempdst = (mng_uint16p)pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 4;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
*pTempdst = *(pTempsrc1+3);
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = (mng_int32)iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = (mng_int32)iMR;
else
iM = (mng_int32)iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{
iH = (iM+1) / 2; /* calculate halfway point */
for (iS = 1; iS < iH; iS++) /* replicate first half */
{
*pTempdst = *pTempsrc1;
*(pTempdst+1) = *(pTempsrc1+1);
*(pTempdst+2) = *(pTempsrc1+2);
*(pTempdst+3) = *(pTempsrc1+3);
pTempdst += 4;
}
for (iS = iH; iS < iM; iS++) /* replicate second half */
{
*pTempdst = *pTempsrc2;
*(pTempdst+1) = *(pTempsrc2+1);
*(pTempdst+2) = *(pTempsrc2+2);
*(pTempdst+3) = *(pTempsrc2+3);
pTempdst += 4;
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
*pTempdst = *(pTempsrc1+3);
pTempdst++;
}
}
}
pTempsrc1 += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X3, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_rgba16_x4 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_int32 iS, iM, iH;
mng_uint16p pTempsrc1;
mng_uint16p pTempsrc2;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X4, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */
pTempdst = (mng_uint16p)pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 4;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
*pTempdst = *(pTempsrc1+3);
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = (mng_int32)iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = (mng_int32)iMR;
else
iM = (mng_int32)iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{
iH = (iM+1) / 2; /* calculate halfway point */
for (iS = 1; iS < iH; iS++) /* first half */
{
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1; /* just repeat the first */
else /* calculate the distance */
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
if (*(pTempsrc1+1) == *(pTempsrc2+1))
*pTempdst = *(pTempsrc1+1);
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) );
pTempdst++;
if (*(pTempsrc1+2) == *(pTempsrc2+2))
*pTempdst = *(pTempsrc1+2);
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+2))) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) );
pTempdst++;
/* replicate alpha from left */
*pTempdst = *(pTempsrc1+3);
pTempdst++;
}
for (iS = iH; iS < iM; iS++) /* second half */
{
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1; /* just repeat the first */
else /* calculate the distance */
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
if (*(pTempsrc1+1) == *(pTempsrc2+1))
*pTempdst = *(pTempsrc1+1);
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) );
pTempdst++;
if (*(pTempsrc1+2) == *(pTempsrc2+2))
*pTempdst = *(pTempsrc1+2);
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+2))) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) );
pTempdst++;
/* replicate alpha from right */
*pTempdst = *(pTempsrc2+3);
pTempdst++;
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
*pTempdst = *(pTempsrc1+3);
pTempdst++;
}
}
}
pTempsrc1 += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X4, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_rgba16_x5 (mng_datap pData,
mng_uint16 iMX,
mng_uint16 iML,
mng_uint16 iMR,
mng_uint32 iWidth,
mng_uint8p pSrcline,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_int32 iS, iM, iH;
mng_uint16p pTempsrc1;
mng_uint16p pTempsrc2;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X5, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */
pTempdst = (mng_uint16p)pDstline;
for (iX = 0; iX < iWidth; iX++)
{
pTempsrc2 = pTempsrc1 + 4;
*pTempdst = *pTempsrc1; /* copy original source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
*pTempdst = *(pTempsrc1+3);
pTempdst++;
if (iX == 0) /* first interval ? */
{
if (iWidth == 1) /* single pixel ? */
pTempsrc2 = MNG_NULL;
iM = (mng_int32)iML;
}
else
if (iX == (iWidth - 2)) /* last interval ? */
iM = (mng_int32)iMR;
else
iM = (mng_int32)iMX;
/* fill interval ? */
if ((iX < iWidth - 1) || (iWidth == 1))
{
if (pTempsrc2) /* do we have the second pixel ? */
{
iH = (iM+1) / 2; /* calculate halfway point */
for (iS = 1; iS < iH; iS++) /* first half */
{
*pTempdst = *pTempsrc1; /* replicate color from left */
*(pTempdst+1) = *(pTempsrc1+1);
*(pTempdst+2) = *(pTempsrc1+2);
if (*(pTempsrc1+3) == *(pTempsrc2+3))
*(pTempdst+3) = *(pTempsrc1+3);
else
mng_put_uint16 ((mng_uint8p)(pTempdst+3),
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+3))) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+3))) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+3))) ) );
pTempdst += 4;
}
for (iS = iH; iS < iM; iS++) /* second half */
{
*pTempdst = *pTempsrc2; /* replicate color from right */
*(pTempdst+1) = *(pTempsrc2+1);
*(pTempdst+2) = *(pTempsrc2+2);
if (*(pTempsrc1+3) == *(pTempsrc2+3))
*(pTempdst+3) = *(pTempsrc1+3);
else
mng_put_uint16 ((mng_uint8p)(pTempdst+3),
(mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+3))) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+3))) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+3))) ) );
pTempdst += 4;
}
}
else
{
for (iS = 1; iS < iM; iS++)
{
*pTempdst = *pTempsrc1; /* repeat first source pixel */
pTempdst++;
*pTempdst = *(pTempsrc1+1);
pTempdst++;
*pTempdst = *(pTempsrc1+2);
pTempdst++;
*pTempdst = *(pTempsrc1+3);
pTempdst++;
}
}
}
pTempsrc1 += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X4, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_GRAY_SUPPORT
mng_retcode mng_magnify_g16_y1 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_Y1, MNG_LC_START);
#endif
MNG_COPY (pDstline, pSrcline1, (iWidth << 1));
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_Y1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_g16_y2 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_uint16p pTempsrc1;
mng_uint16p pTempsrc2;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_Y2, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */
pTempsrc2 = (mng_uint16p)pSrcline2;
pTempdst = (mng_uint16p)pDstline;
if (pTempsrc2) /* do we have a second line ? */
{
for (iX = 0; iX < iWidth; iX++)
{ /* calculate the distances */
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
}
}
else
{ /* just repeat the entire line */
MNG_COPY (pTempdst, pTempsrc1, (iWidth << 1));
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_Y2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_g16_y3 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_Y3, MNG_LC_START);
#endif
if (pSrcline2) /* do we have a second line ? */
{
if (iS < (iM+1) / 2) /* top half ? */
MNG_COPY (pDstline, pSrcline1, (iWidth << 1))
else
MNG_COPY (pDstline, pSrcline2, (iWidth << 1));
}
else
{ /* just repeat the entire line */
MNG_COPY (pDstline, pSrcline1, (iWidth << 1));
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_Y3, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_GRAY_SUPPORT */
/* ************************************************************************** */
mng_retcode mng_magnify_rgb16_y1 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_Y1, MNG_LC_START);
#endif
MNG_COPY (pDstline, pSrcline1, iWidth * 6);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_Y1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_rgb16_y2 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_uint16p pTempsrc1;
mng_uint16p pTempsrc2;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_Y2, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */
pTempsrc2 = (mng_uint16p)pSrcline2;
pTempdst = (mng_uint16p)pDstline;
if (pTempsrc2) /* do we have a second line ? */
{
for (iX = 0; iX < iWidth; iX++)
{ /* calculate the distances */
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
}
}
else
{ /* just repeat the entire line */
MNG_COPY (pTempdst, pTempsrc1, iWidth * 6);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_Y2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_rgb16_y3 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_Y3, MNG_LC_START);
#endif
if (pSrcline2) /* do we have a second line ? */
{
if (iS < (iM+1) / 2) /* top half ? */
MNG_COPY (pDstline, pSrcline1, iWidth * 6)
else
MNG_COPY (pDstline, pSrcline2, iWidth * 6);
}
else
{ /* just repeat the entire line */
MNG_COPY (pDstline, pSrcline1, iWidth * 6);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_Y3, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_GRAY_SUPPORT
mng_retcode mng_magnify_ga16_y1 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y1, MNG_LC_START);
#endif
MNG_COPY (pDstline, pSrcline1, (iWidth << 2));
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_ga16_y2 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_uint16p pTempsrc1;
mng_uint16p pTempsrc2;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y2, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */
pTempsrc2 = (mng_uint16p)pSrcline2;
pTempdst = (mng_uint16p)pDstline;
if (pTempsrc2) /* do we have a second line ? */
{
for (iX = 0; iX < iWidth; iX++)
{ /* calculate the distances */
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
}
}
else
{ /* just repeat the entire line */
MNG_COPY (pTempdst, pTempsrc1, (iWidth << 2));
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_ga16_y3 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y3, MNG_LC_START);
#endif
if (pSrcline2) /* do we have a second line ? */
{
if (iS < (iM+1) / 2) /* top half ? */
MNG_COPY (pDstline, pSrcline1, (iWidth << 2))
else
MNG_COPY (pDstline, pSrcline2, (iWidth << 2));
}
else
{ /* just repeat the entire line */
MNG_COPY (pDstline, pSrcline1, (iWidth << 2));
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_ga16_y4 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_uint16p pTempsrc1;
mng_uint16p pTempsrc2;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y4, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */
pTempsrc2 = (mng_uint16p)pSrcline2;
pTempdst = (mng_uint16p)pDstline;
if (pTempsrc2) /* do we have a second line ? */
{
if (iS < (iM+1) / 2) /* top half ? */
{
for (iX = 0; iX < iWidth; iX++)
{ /* calculate the distances */
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1++;
pTempsrc2 += 2;
*pTempdst++ = *pTempsrc1++; /* replicate alpha from top */
}
}
else
{
for (iX = 0; iX < iWidth; iX++)
{ /* calculate the distances */
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1 += 2;
pTempsrc2++;
*pTempdst++ = *pTempsrc2++; /* replicate alpha from bottom */
}
}
}
else
{ /* just repeat the entire line */
MNG_COPY (pTempdst, pTempsrc1, (iWidth << 2));
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y4, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_ga16_y5 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_uint16p pTempsrc1;
mng_uint16p pTempsrc2;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y5, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */
pTempsrc2 = (mng_uint16p)pSrcline2;
pTempdst = (mng_uint16p)pDstline;
if (pTempsrc2) /* do we have a second line ? */
{
if (iS < (iM+1) / 2) /* top half ? */
{
for (iX = 0; iX < iWidth; iX++)
{
*pTempdst = *pTempsrc1; /* replicate gray from top */
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
}
}
else
{
for (iX = 0; iX < iWidth; iX++)
{
*pTempdst = *pTempsrc2; /* replicate gray from bottom */
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
}
}
}
else
{ /* just repeat the entire line */
MNG_COPY (pTempdst, pTempsrc1, (iWidth << 2));
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y5, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_GRAY_SUPPORT */
/* ************************************************************************** */
mng_retcode mng_magnify_rgba16_y1 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y1, MNG_LC_START);
#endif
MNG_COPY (pDstline, pSrcline1, (iWidth << 3));
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y1, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_rgba16_y2 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_uint16p pTempsrc1;
mng_uint16p pTempsrc2;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y2, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */
pTempsrc2 = (mng_uint16p)pSrcline2;
pTempdst = (mng_uint16p)pDstline;
if (pTempsrc2) /* do we have a second line ? */
{
for (iX = 0; iX < iWidth; iX++)
{ /* calculate the distances */
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
}
}
else
{ /* just repeat the entire line */
MNG_COPY (pTempdst, pTempsrc1, (iWidth << 3));
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_rgba16_y3 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y3, MNG_LC_START);
#endif
if (pSrcline2) /* do we have a second line ? */
{
if (iS < (iM+1) / 2) /* top half ? */
MNG_COPY (pDstline, pSrcline1, (iWidth << 3))
else
MNG_COPY (pDstline, pSrcline2, (iWidth << 3));
}
else
{ /* just repeat the entire line */
MNG_COPY (pDstline, pSrcline1, (iWidth << 3));
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y2, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_rgba16_y4 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_uint16p pTempsrc1;
mng_uint16p pTempsrc2;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y4, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */
pTempsrc2 = (mng_uint16p)pSrcline2;
pTempdst = (mng_uint16p)pDstline;
if (pTempsrc2) /* do we have a second line ? */
{
if (iS < (iM+1) / 2) /* top half ? */
{
for (iX = 0; iX < iWidth; iX++)
{ /* calculate the distances */
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1++;
pTempsrc2 += 2;
*pTempdst++ = *pTempsrc1++; /* replicate alpha from top */
}
}
else
{
for (iX = 0; iX < iWidth; iX++)
{ /* calculate the distances */
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
if (*pTempsrc1 == *pTempsrc2)
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1 += 2;
pTempsrc2++;
*pTempdst++ = *pTempsrc2++; /* replicate alpha from bottom */
}
}
}
else
{ /* just repeat the entire line */
MNG_COPY (pTempdst, pTempsrc1, (iWidth << 3));
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y4, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode mng_magnify_rgba16_y5 (mng_datap pData,
mng_int32 iS,
mng_int32 iM,
mng_uint32 iWidth,
mng_uint8p pSrcline1,
mng_uint8p pSrcline2,
mng_uint8p pDstline)
{
mng_uint32 iX;
mng_uint16p pTempsrc1;
mng_uint16p pTempsrc2;
mng_uint16p pTempdst;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y5, MNG_LC_START);
#endif
pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */
pTempsrc2 = (mng_uint16p)pSrcline2;
pTempdst = (mng_uint16p)pDstline;
if (pTempsrc2) /* do we have a second line ? */
{
if (iS < (iM+1) / 2) /* top half ? */
{
for (iX = 0; iX < iWidth; iX++)
{
*pTempdst++ = *pTempsrc1++; /* replicate color from top */
*pTempdst++ = *pTempsrc1++;
*pTempdst++ = *pTempsrc1++;
pTempsrc2 += 3;
if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
}
}
else
{
for (iX = 0; iX < iWidth; iX++)
{
*pTempdst++ = *pTempsrc2++; /* replicate color from bottom */
*pTempdst++ = *pTempsrc2++;
*pTempdst++ = *pTempsrc2++;
pTempsrc1 += 3;
if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */
*pTempdst = *pTempsrc1;
else
mng_put_uint16 ((mng_uint8p)pTempdst,
(mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) -
(mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) /
(iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) );
pTempdst++;
pTempsrc1++;
pTempsrc2++;
}
}
}
else
{ /* just repeat the entire line */
MNG_COPY (pTempdst, pTempsrc1, (iWidth << 3));
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y5, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_NO_16BIT_SUPPORT */
#endif /* MNG_OPTIMIZE_FOOTPRINT_MAGN */
#endif /* MNG_SKIPCHUNK_MAGN */
/* ************************************************************************** */
/* * * */
/* * PAST composition routines - compose over/under with a target object * */
/* * * */
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_PAST
mng_retcode mng_composeover_rgba8 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8;
mng_uint8 iCr8, iCg8, iCb8, iCa8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_COMPOSEOVER_RGBA8, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iFGa8 = *(pWorkrow+3); /* get alpha values */
iBGa8 = *(pOutrow+3);
if (iFGa8) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa8 == 0xFF) || (iBGa8 == 0))
{ /* then simply copy the values */
*pOutrow = *pWorkrow;
*(pOutrow+1) = *(pWorkrow+1);
*(pOutrow+2) = *(pWorkrow+2);
*(pOutrow+3) = iFGa8;
}
else
{
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do alpha composing */
#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
int i;
for (i=2; i >= 0; i--)
{
MNG_COMPOSE8 (*(pOutrow+i), *(pWorkrow+i), iFGa8, *(pOutrow+i));
}
#else
MNG_COMPOSE8 (*pOutrow, *pWorkrow, iFGa8, *pOutrow );
MNG_COMPOSE8 (*(pOutrow+1), *(pWorkrow+1), iFGa8, *(pOutrow+1));
MNG_COMPOSE8 (*(pOutrow+2), *(pWorkrow+2), iFGa8, *(pOutrow+2));
#endif
/* alpha remains fully opaque !!! */
}
else
{ /* here we'll have to blend */
MNG_BLEND8 (*pWorkrow, *(pWorkrow+1), *(pWorkrow+2), iFGa8,
*pOutrow, *(pOutrow+1), *(pOutrow+2), iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pOutrow = iCr8;
*(pOutrow+1) = iCg8;
*(pOutrow+2) = iCb8;
*(pOutrow+3) = iCa8;
}
}
}
pOutrow += 4;
pWorkrow += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_COMPOSEOVER_RGBA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_composeover_rgba16 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint16p pWorkrow;
mng_uint16p pOutrow;
mng_int32 iX;
mng_uint16 iFGa16, iFGr16, iFGg16, iFGb16;
mng_uint16 iBGa16, iBGr16, iBGg16, iBGb16;
mng_uint16 iCr16, iCg16, iCb16, iCa16;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_COMPOSEOVER_RGBA16, MNG_LC_START);
#endif
pWorkrow = (mng_uint16p)pData->pRGBArow;
pOutrow = (mng_uint16p)(pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize));
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{ /* get alpha values */
iFGa16 = mng_get_uint16 ((mng_uint8p)(pWorkrow+3));
iBGa16 = mng_get_uint16 ((mng_uint8p)(pOutrow+3));
if (iFGa16) /* any opacity at all ? */
{ /* fully opaque or background fully transparent ? */
if ((iFGa16 == 0xFFFF) || (iBGa16 == 0))
{ /* then simply copy the values */
*pOutrow = *pWorkrow;
*(pOutrow+1) = *(pWorkrow+1);
*(pOutrow+2) = *(pWorkrow+2);
*(pOutrow+3) = *(pWorkrow+3);
}
else
{ /* get color values */
iFGr16 = mng_get_uint16 ((mng_uint8p)pWorkrow);
iFGg16 = mng_get_uint16 ((mng_uint8p)(pWorkrow+1));
iFGb16 = mng_get_uint16 ((mng_uint8p)(pWorkrow+2));
iBGr16 = mng_get_uint16 ((mng_uint8p)pOutrow);
iBGg16 = mng_get_uint16 ((mng_uint8p)(pOutrow+1));
iBGb16 = mng_get_uint16 ((mng_uint8p)(pOutrow+2));
if (iBGa16 == 0xFFFF) /* background fully opaque ? */
{ /* do alpha composing */
MNG_COMPOSE16 (iFGr16, iFGr16, iFGa16, iBGr16);
MNG_COMPOSE16 (iFGg16, iFGg16, iFGa16, iBGg16);
MNG_COMPOSE16 (iFGb16, iFGb16, iFGa16, iBGb16);
mng_put_uint16 ((mng_uint8p)pOutrow, iFGr16);
mng_put_uint16 ((mng_uint8p)(pOutrow+1), iFGg16);
mng_put_uint16 ((mng_uint8p)(pOutrow+2), iFGb16);
/* alpha remains fully opaque !!! */
}
else
{ /* here we'll have to blend */
MNG_BLEND16 (iFGr16, iFGg16, iFGb16, iFGa16,
iBGr16, iBGg16, iBGb16, iBGa16,
iCr16, iCg16, iCb16, iCa16);
/* and return the composed values */
mng_put_uint16 ((mng_uint8p)pOutrow, iCr16);
mng_put_uint16 ((mng_uint8p)(pOutrow+1), iCg16);
mng_put_uint16 ((mng_uint8p)(pOutrow+2), iCb16);
mng_put_uint16 ((mng_uint8p)(pOutrow+3), iCa16);
}
}
}
pOutrow += 4;
pWorkrow += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_COMPOSEOVER_RGBA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_composeunder_rgba8 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint8p pWorkrow;
mng_uint8p pOutrow;
mng_int32 iX;
mng_uint8 iFGa8, iBGa8;
mng_uint8 iCr8, iCg8, iCb8, iCa8;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_COMPOSEUNDER_RGBA8, MNG_LC_START);
#endif
pWorkrow = pData->pRGBArow;
pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize);
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{
iFGa8 = *(pOutrow+3); /* get alpha values */
iBGa8 = *(pWorkrow+3);
/* anything to do at all ? */
if ((iBGa8) && (iFGa8 != 0xFF))
{
if (iBGa8 == 0xFF) /* background fully opaque ? */
{ /* do alpha composing */
#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE
int i;
for (i=2; i >= 0; i--)
{
MNG_COMPOSE8 (*(pOutrow+i), *(pOutrow+i), iFGa8, *(pWorkrow+i));
}
#else
MNG_COMPOSE8 (*pOutrow, *pOutrow, iFGa8, *pWorkrow );
MNG_COMPOSE8 (*(pOutrow+1), *(pOutrow+1), iFGa8, *(pWorkrow+1));
MNG_COMPOSE8 (*(pOutrow+2), *(pOutrow+2), iFGa8, *(pWorkrow+2));
#endif
*(pOutrow+3) = 0xFF; /* alpha becomes fully opaque !!! */
}
else
{ /* here we'll have to blend */
MNG_BLEND8 (*pOutrow, *(pOutrow+1), *(pOutrow+2), iFGa8,
*pWorkrow, *(pWorkrow+1), *(pWorkrow+2), iBGa8,
iCr8, iCg8, iCb8, iCa8);
/* and return the composed values */
*pOutrow = iCr8;
*(pOutrow+1) = iCg8;
*(pOutrow+2) = iCb8;
*(pOutrow+3) = iCa8;
}
}
pOutrow += 4;
pWorkrow += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_COMPOSEUNDER_RGBA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_composeunder_rgba16 (mng_datap pData)
{
mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf;
mng_uint16p pWorkrow;
mng_uint16p pOutrow;
mng_int32 iX;
mng_uint16 iFGa16, iFGr16, iFGg16, iFGb16;
mng_uint16 iBGa16, iBGr16, iBGg16, iBGb16;
mng_uint16 iCr16, iCg16, iCb16, iCa16;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_COMPOSEUNDER_RGBA16, MNG_LC_START);
#endif
pWorkrow = (mng_uint16p)pData->pRGBArow;
pOutrow = (mng_uint16p)(pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) +
(pData->iCol * pBuf->iSamplesize));
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{ /* get alpha values */
iFGa16 = mng_get_uint16 ((mng_uint8p)(pOutrow+3));
iBGa16 = mng_get_uint16 ((mng_uint8p)(pWorkrow+3));
/* anything to do at all ? */
if ((iBGa16) && (iFGa16 != 0xFFFF))
{
iFGr16 = mng_get_uint16 ((mng_uint8p)pOutrow);
iFGg16 = mng_get_uint16 ((mng_uint8p)(pOutrow+1));
iFGb16 = mng_get_uint16 ((mng_uint8p)(pOutrow+2));
iBGr16 = mng_get_uint16 ((mng_uint8p)pWorkrow);
iBGg16 = mng_get_uint16 ((mng_uint8p)(pWorkrow+1));
iBGb16 = mng_get_uint16 ((mng_uint8p)(pWorkrow+2));
if (iBGa16 == 0xFFFF) /* background fully opaque ? */
{ /* do alpha composing */
MNG_COMPOSE16 (iFGr16, iFGr16, iFGa16, iBGr16);
MNG_COMPOSE16 (iFGg16, iFGg16, iFGa16, iBGg16);
MNG_COMPOSE16 (iFGb16, iFGb16, iFGa16, iBGb16);
mng_put_uint16 ((mng_uint8p)pOutrow, iFGr16);
mng_put_uint16 ((mng_uint8p)(pOutrow+1), iFGg16);
mng_put_uint16 ((mng_uint8p)(pOutrow+2), iFGb16);
*(pOutrow+3) = 0xFFFF; /* alpha becomes fully opaque !!! */
}
else
{ /* here we'll have to blend */
MNG_BLEND16 (iFGr16, iFGg16, iFGb16, iFGa16,
iBGr16, iBGg16, iBGb16, iBGa16,
iCr16, iCg16, iCb16, iCa16);
/* and return the composed values */
mng_put_uint16 ((mng_uint8p)pOutrow, iCr16);
mng_put_uint16 ((mng_uint8p)(pOutrow+1), iCg16);
mng_put_uint16 ((mng_uint8p)(pOutrow+2), iCb16);
mng_put_uint16 ((mng_uint8p)(pOutrow+3), iCa16);
}
}
pOutrow += 4;
pWorkrow += 4;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_COMPOSEUNDER_RGBA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
#endif
/* ************************************************************************** */
/* * * */
/* * PAST flip & tile routines - flip or tile a row of pixels * */
/* * * */
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_PAST
mng_retcode mng_flip_rgba8 (mng_datap pData)
{
mng_uint32p pWorkrow;
mng_uint32p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_FLIP_RGBA8, MNG_LC_START);
#endif
/* setup temp pointers */
pWorkrow = (mng_uint32p)pData->pRGBArow + pData->iRowsamples - 1;
pOutrow = (mng_uint32p)pData->pWorkrow;
/* swap original buffers */
pData->pWorkrow = pData->pRGBArow;
pData->pRGBArow = (mng_uint8p)pOutrow;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{ /* let's flip */
*pOutrow = *pWorkrow;
pOutrow++;
pWorkrow--;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_FLIP_RGBA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_flip_rgba16 (mng_datap pData)
{
mng_uint32p pWorkrow;
mng_uint32p pOutrow;
mng_int32 iX;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_FLIP_RGBA16, MNG_LC_START);
#endif
/* setup temp pointers */
pWorkrow = (mng_uint32p)pData->pRGBArow + ((pData->iRowsamples - 1) << 1);
pOutrow = (mng_uint32p)pData->pWorkrow;
/* swap original buffers */
pData->pWorkrow = pData->pRGBArow;
pData->pRGBArow = (mng_uint8p)pOutrow;
#ifdef MNG_DECREMENT_LOOPS
for (iX = pData->iRowsamples; iX > 0; iX--)
#else
for (iX = 0; iX < pData->iRowsamples; iX++)
#endif
{ /* let's flip */
*pOutrow = *pWorkrow;
*(pOutrow + 1) = *(pWorkrow + 1);
pOutrow += 2;
pWorkrow -= 2;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_FLIP_RGBA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode mng_tile_rgba8 (mng_datap pData)
{
mng_uint32p pWorkrow;
mng_uint32p pOutrow;
mng_int32 iX;
mng_uint32 iZ, iMax;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_TILE_RGBA8, MNG_LC_START);
#endif
iZ = pData->iSourcel; /* indent ? */
/* what's our source-length */
iMax = ((mng_imagep)pData->pRetrieveobj)->pImgbuf->iWidth;
/* setup temp pointers */
pWorkrow = (mng_uint32p)pData->pRGBArow + iZ;
pOutrow = (mng_uint32p)pData->pWorkrow;
/* swap original buffers */
pData->pWorkrow = pData->pRGBArow;
pData->pRGBArow = (mng_uint8p)pOutrow;
for (iX = pData->iDestl; iX < pData->iDestr; iX++)
{ /* tiiiile */
*pOutrow = *pWorkrow;
pWorkrow++;
pOutrow++;
iZ++;
if (iZ >= iMax) /* end of source ? */
{
iZ = 0;
pWorkrow = (mng_uint32p)pData->pWorkrow;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_TILE_RGBA8, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_NO_16BIT_SUPPORT
mng_retcode mng_tile_rgba16 (mng_datap pData)
{
mng_uint32p pWorkrow;
mng_uint32p pOutrow;
mng_int32 iX;
mng_uint32 iZ, iMax;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_TILE_RGBA16, MNG_LC_START);
#endif
iZ = pData->iSourcel; /* indent ? */
/* what's our source-length */
iMax = ((mng_imagep)pData->pRetrieveobj)->pImgbuf->iWidth;
/* setup temp pointers */
pWorkrow = (mng_uint32p)pData->pRGBArow + (iZ << 1);
pOutrow = (mng_uint32p)pData->pWorkrow;
/* swap original buffers */
pData->pWorkrow = pData->pRGBArow;
pData->pRGBArow = (mng_uint8p)pOutrow;
for (iX = pData->iDestl; iX < pData->iDestr; iX++)
{ /* tiiiile */
*pOutrow = *pWorkrow;
*(pOutrow + 1) = *(pWorkrow + 1);
pWorkrow += 2;
pOutrow += 2;
iZ++;
if (iZ >= iMax) /* end of source ? */
{
iZ = 0;
pWorkrow = (mng_uint32p)pData->pWorkrow;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_TILE_RGBA16, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
#endif /* MNG_SKIPCHUNK_PAST */
/* ************************************************************************** */
#endif /* MNG_INCLUDE_DISPLAY_PROCS */
/* ************************************************************************** */
/* * end of file * */
/* ************************************************************************** */
libmng-2.0.3/Configure.libmng 0000644 0001750 0001750 00000000123 12076666316 016004 0 ustar glennrp glennrp do_configure:
./configure \
--prefix=/usr \
--libdir=/usr/lib64 \
--with-lcms2
libmng-2.0.3/libmng_trace.h 0000644 0001750 0001750 00000177237 12005307152 015473 0 ustar glennrp glennrp /* ************************************************************************** */
/* * For conditions of distribution and use, * */
/* * see copyright notice in libmng.h * */
/* ************************************************************************** */
/* * * */
/* * project : libmng * */
/* * file : libmng_trace.h copyright (c) 2000-2007 G.Juyn * */
/* * version : 1.0.10 * */
/* * * */
/* * purpose : Trace functions (definition) * */
/* * * */
/* * author : G.Juyn * */
/* * * */
/* * comment : Definition of the trace functions * */
/* * * */
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
/* * - added chunk-access function trace-codes * */
/* * - changed strict-ANSI stuff * */
/* * 0.5.1 - 05/12/2000 - G.Juyn * */
/* * - changed trace to macro for callback error-reporting * */
/* * 0.5.1 - 05/13/2000 - G.Juyn * */
/* * - added save_state & restore_state trace-codes * */
/* * 0.5.1 - 05/15/2000 - G.Juyn * */
/* * - added getimgdata & putimgdata trace-codes * */
/* * * */
/* * 0.5.2 - 05/20/2000 - G.Juyn * */
/* * - added JNG tracecodes * */
/* * 0.5.2 - 05/23/2000 - G.Juyn * */
/* * - added trace-table entry definition * */
/* * 0.5.2 - 05/24/2000 - G.Juyn * */
/* * - added tracecodes for global animation color-chunks * */
/* * - added tracecodes for get/set of default ZLIB/IJG parms * */
/* * - added tracecodes for global PLTE,tRNS,bKGD * */
/* * 0.5.2 - 05/30/2000 - G.Juyn * */
/* * - added tracecodes for image-object promotion * */
/* * - added tracecodes for delta-image processing * */
/* * 0.5.2 - 06/02/2000 - G.Juyn * */
/* * - added tracecodes for getalphaline callback * */
/* * 0.5.2 - 06/05/2000 - G.Juyn * */
/* * - added tracecode for RGB8_A8 canvasstyle * */
/* * 0.5.2 - 06/06/2000 - G.Juyn * */
/* * - added tracecode for mng_read_resume HLAPI function * */
/* * * */
/* * 0.5.3 - 06/06/2000 - G.Juyn * */
/* * - added tracecodes for tracing JPEG progression * */
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
/* * - added tracecodes for get/set speedtype * */
/* * - added tracecodes for get imagelevel * */
/* * 0.5.3 - 06/22/2000 - G.Juyn * */
/* * - added tracecode for delta-image processing * */
/* * - added tracecodes for PPLT chunk processing * */
/* * * */
/* * 0.9.1 - 07/07/2000 - G.Juyn * */
/* * - added tracecodes for special display processing * */
/* * 0.9.1 - 07/08/2000 - G.Juyn * */
/* * - added tracecode for get/set suspensionmode * */
/* * - added tracecodes for get/set display variables * */
/* * - added tracecode for read_databuffer (I/O-suspension) * */
/* * 0.9.1 - 07/15/2000 - G.Juyn * */
/* * - added tracecodes for SAVE/SEEK callbacks * */
/* * - added tracecodes for get/set sectionbreaks * */
/* * - added tracecode for special error routine * */
/* * 0.9.1 - 07/19/2000 - G.Juyn * */
/* * - added tracecode for updatemngheader * */
/* * * */
/* * 0.9.2 - 07/31/2000 - G.Juyn * */
/* * - added tracecodes for status_xxxxx functions * */
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - 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 * */
/* * * */
/* * 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!) * */
/* * * */
/* * 1.0.2 - 06/23/2001 - G.Juyn * */
/* * - added optimization option for MNG-video playback * */
/* * - added processterm callback * */
/* * 1.0.2 - 06/25/2001 - G.Juyn * */
/* * - added option to turn off progressive refresh * */
/* * * */
/* * 1.0.3 - 08/06/2001 - G.Juyn * */
/* * - added get function for last processed BACK chunk * */
/* * * */
/* * 1.0.5 - 08/15/2002 - G.Juyn * */
/* * - completed PROM support * */
/* * - completed delta-image support * */
/* * 1.0.5 - 08/19/2002 - G.Juyn * */
/* * - B597134 - libmng pollutes the linker namespace * */
/* * - added HLAPI function to copy chunks * */
/* * 1.0.5 - 09/14/2002 - G.Juyn * */
/* * - added event handling for dynamic MNG * */
/* * 1.0.5 - 09/20/2002 - G.Juyn * */
/* * - added support for PAST * */
/* * 1.0.5 - 09/22/2002 - G.Juyn * */
/* * - added bgrx8 canvas (filler byte) * */
/* * 1.0.5 - 09/23/2002 - G.Juyn * */
/* * - added in-memory color-correction of abstract images * */
/* * - added compose over/under routines for PAST processing * */
/* * - added flip & tile routines for PAST processing * */
/* * 1.0.5 - 10/09/2002 - G.Juyn * */
/* * - fixed trace-constants for PAST chunk * */
/* * 1.0.5 - 11/07/2002 - G.Juyn * */
/* * - added support to get totals after mng_read() * */
/* * * */
/* * 1.0.6 - 07/14/2003 - G.Randers-Pehrson * */
/* * - added conditionals around rarely used features * */
/* * * */
/* * 1.0.7 - 11/27/2003 - R.A * */
/* * - added CANVAS_RGB565 and CANVAS_BGR565 * */
/* * 1.0.7 - 01/25/2004 - J.S * */
/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */
/* * 1.0.7 - 03/10/2004 - G.R-P * */
/* * - added conditionals around openstream/closestream * */
/* * * */
/* * 1.0.8 - 04/02/2004 - G.Juyn * */
/* * - added CRC existence & checking flags * */
/* * 1.0.8 - 04/11/2004 - G.Juyn * */
/* * - added data-push mechanisms for specialized decoders * */
/* * * */
/* * 1.0.9 - 10/03/2004 - G.Juyn * */
/* * - added function to retrieve current FRAM delay * */
/* * 1.0.9 - 10/14/2004 - G.Juyn * */
/* * - added bgr565_a8 canvas-style (thanks to J. Elvander) * */
/* * * */
/* * 1.0.10 - 04/08/2007 - G.Juyn * */
/* * - added support for mPNG proposal * */
/* * 1.0.10 - 07/06/2007 - G.R-P bugfix by Lucas Quintana * */
/* * * */
/* ************************************************************************** */
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
#pragma option -A /* force ANSI-C */
#endif
#ifndef _libmng_trace_h_
#define _libmng_trace_h_
/* ************************************************************************** */
#ifdef MNG_INCLUDE_TRACE_PROCS
/* ************************************************************************** */
/* TODO: add a trace-mask so certain functions can be excluded */
mng_retcode mng_trace (mng_datap pData,
mng_uint32 iFunction,
mng_uint32 iLocation);
/* ************************************************************************** */
#define MNG_TRACE(D,F,L) { mng_retcode iR = mng_trace (D,F,L); \
if (iR) return iR; }
#define MNG_TRACEB(D,F,L) { if (mng_trace (D,F,L)) return MNG_FALSE; }
#define MNG_TRACEX(D,F,L) { if (mng_trace (D,F,L)) return 0; }
/* ************************************************************************** */
#define MNG_LC_START 1
#define MNG_LC_END 2
#define MNG_LC_INITIALIZE 3
#define MNG_LC_CLEANUP 4
/* ************************************************************************** */
#define MNG_LC_JPEG_CREATE_DECOMPRESS 101
#define MNG_LC_JPEG_READ_HEADER 102
#define MNG_LC_JPEG_START_DECOMPRESS 103
#define MNG_LC_JPEG_START_OUTPUT 104
#define MNG_LC_JPEG_READ_SCANLINES 105
#define MNG_LC_JPEG_FINISH_OUTPUT 106
#define MNG_LC_JPEG_FINISH_DECOMPRESS 107
#define MNG_LC_JPEG_DESTROY_DECOMPRESS 108
/* ************************************************************************** */
#define MNG_FN_INITIALIZE 1
#define MNG_FN_RESET 2
#define MNG_FN_CLEANUP 3
#define MNG_FN_READ 4
#define MNG_FN_WRITE 5
#define MNG_FN_CREATE 6
#define MNG_FN_READDISPLAY 7
#define MNG_FN_DISPLAY 8
#define MNG_FN_DISPLAY_RESUME 9
#define MNG_FN_DISPLAY_FREEZE 10
#define MNG_FN_DISPLAY_RESET 11
#ifndef MNG_NO_DISPLAY_GO_SUPPORTED
#define MNG_FN_DISPLAY_GOFRAME 12
#define MNG_FN_DISPLAY_GOLAYER 13
#define MNG_FN_DISPLAY_GOTIME 14
#endif
#define MNG_FN_GETLASTERROR 15
#define MNG_FN_READ_RESUME 16
#define MNG_FN_TRAPEVENT 17
#define MNG_FN_READ_PUSHDATA 18
#define MNG_FN_READ_PUSHSIG 19
#define MNG_FN_READ_PUSHCHUNK 20
#define MNG_FN_SETCB_MEMALLOC 101
#define MNG_FN_SETCB_MEMFREE 102
#define MNG_FN_SETCB_READDATA 103
#define MNG_FN_SETCB_WRITEDATA 104
#define MNG_FN_SETCB_ERRORPROC 105
#define MNG_FN_SETCB_TRACEPROC 106
#define MNG_FN_SETCB_PROCESSHEADER 107
#define MNG_FN_SETCB_PROCESSTEXT 108
#define MNG_FN_SETCB_GETCANVASLINE 109
#define MNG_FN_SETCB_GETBKGDLINE 110
#define MNG_FN_SETCB_REFRESH 111
#define MNG_FN_SETCB_GETTICKCOUNT 112
#define MNG_FN_SETCB_SETTIMER 113
#define MNG_FN_SETCB_PROCESSGAMMA 114
#define MNG_FN_SETCB_PROCESSCHROMA 115
#define MNG_FN_SETCB_PROCESSSRGB 116
#define MNG_FN_SETCB_PROCESSICCP 117
#define MNG_FN_SETCB_PROCESSAROW 118
#ifndef MNG_NO_OPEN_CLOSE_STREAM
#define MNG_FN_SETCB_OPENSTREAM 119
#define MNG_FN_SETCB_CLOSESTREAM 120
#endif
#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_SETCB_PROCESSMEND 126
#define MNG_FN_SETCB_PROCESSTERM 127
#define MNG_FN_SETCB_RELEASEDATA 128
#define MNG_FN_GETCB_MEMALLOC 201
#define MNG_FN_GETCB_MEMFREE 202
#define MNG_FN_GETCB_READDATA 203
#define MNG_FN_GETCB_WRITEDATA 204
#define MNG_FN_GETCB_ERRORPROC 205
#define MNG_FN_GETCB_TRACEPROC 206
#define MNG_FN_GETCB_PROCESSHEADER 207
#define MNG_FN_GETCB_PROCESSTEXT 208
#define MNG_FN_GETCB_GETCANVASLINE 209
#define MNG_FN_GETCB_GETBKGDLINE 210
#define MNG_FN_GETCB_REFRESH 211
#define MNG_FN_GETCB_GETTICKCOUNT 212
#define MNG_FN_GETCB_SETTIMER 213
#define MNG_FN_GETCB_PROCESSGAMMA 214
#define MNG_FN_GETCB_PROCESSCHROMA 215
#define MNG_FN_GETCB_PROCESSSRGB 216
#define MNG_FN_GETCB_PROCESSICCP 217
#define MNG_FN_GETCB_PROCESSAROW 218
#ifndef MNG_NO_OPEN_CLOSE_STREAM
#define MNG_FN_GETCB_OPENSTREAM 219
#define MNG_FN_GETCB_CLOSESTREAM 220
#endif
#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_GETCB_PROCESSMEND 226
#define MNG_FN_GETCB_PROCESSTERM 227
#define MNG_FN_GETCB_RELEASEDATA 228
#define MNG_FN_SET_USERDATA 301
#define MNG_FN_SET_CANVASSTYLE 302
#define MNG_FN_SET_BKGDSTYLE 303
#define MNG_FN_SET_BGCOLOR 304
#define MNG_FN_SET_STORECHUNKS 305
#define MNG_FN_SET_VIEWGAMMA 306
#define MNG_FN_SET_DISPLAYGAMMA 307
#define MNG_FN_SET_DFLTIMGGAMMA 308
#define MNG_FN_SET_SRGB 309
#define MNG_FN_SET_OUTPUTPROFILE 310
#define MNG_FN_SET_SRGBPROFILE 311
#define MNG_FN_SET_MAXCANVASWIDTH 312
#define MNG_FN_SET_MAXCANVASHEIGHT 313
#define MNG_FN_SET_MAXCANVASSIZE 314
#define MNG_FN_SET_ZLIB_LEVEL 315
#define MNG_FN_SET_ZLIB_METHOD 316
#define MNG_FN_SET_ZLIB_WINDOWBITS 317
#define MNG_FN_SET_ZLIB_MEMLEVEL 318
#define MNG_FN_SET_ZLIB_STRATEGY 319
#define MNG_FN_SET_ZLIB_MAXIDAT 320
#define MNG_FN_SET_JPEG_DCTMETHOD 321
#define MNG_FN_SET_JPEG_QUALITY 322
#define MNG_FN_SET_JPEG_SMOOTHING 323
#define MNG_FN_SET_JPEG_PROGRESSIVE 324
#define MNG_FN_SET_JPEG_OPTIMIZED 325
#define MNG_FN_SET_JPEG_MAXJDAT 326
#define MNG_FN_SET_SPEED 327
#define MNG_FN_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_SET_CACHEPLAYBACK 335
#define MNG_FN_SET_DOPROGRESSIVE 336
#define MNG_FN_SET_CRCMODE 337
#define MNG_FN_GET_USERDATA 401
#define MNG_FN_GET_SIGTYPE 402
#define MNG_FN_GET_IMAGETYPE 403
#define MNG_FN_GET_IMAGEWIDTH 404
#define MNG_FN_GET_IMAGEHEIGHT 405
#define MNG_FN_GET_TICKS 406
#define MNG_FN_GET_FRAMECOUNT 407
#define MNG_FN_GET_LAYERCOUNT 408
#define MNG_FN_GET_PLAYTIME 409
#define MNG_FN_GET_SIMPLICITY 410
#define MNG_FN_GET_CANVASSTYLE 411
#define MNG_FN_GET_BKGDSTYLE 412
#define MNG_FN_GET_BGCOLOR 413
#define MNG_FN_GET_STORECHUNKS 414
#define MNG_FN_GET_VIEWGAMMA 415
#define MNG_FN_GET_DISPLAYGAMMA 416
#define MNG_FN_GET_DFLTIMGGAMMA 417
#define MNG_FN_GET_SRGB 418
#define MNG_FN_GET_MAXCANVASWIDTH 419
#define MNG_FN_GET_MAXCANVASHEIGHT 420
#define MNG_FN_GET_ZLIB_LEVEL 421
#define MNG_FN_GET_ZLIB_METHOD 422
#define MNG_FN_GET_ZLIB_WINDOWBITS 423
#define MNG_FN_GET_ZLIB_MEMLEVEL 424
#define MNG_FN_GET_ZLIB_STRATEGY 425
#define MNG_FN_GET_ZLIB_MAXIDAT 426
#define MNG_FN_GET_JPEG_DCTMETHOD 427
#define MNG_FN_GET_JPEG_QUALITY 428
#define MNG_FN_GET_JPEG_SMOOTHING 429
#define MNG_FN_GET_JPEG_PROGRESSIVE 430
#define MNG_FN_GET_JPEG_OPTIMIZED 431
#define MNG_FN_GET_JPEG_MAXJDAT 432
#define MNG_FN_GET_SPEED 433
#define MNG_FN_GET_IMAGELEVEL 434
#define MNG_FN_GET_SUSPENSIONMODE 435
#define MNG_FN_GET_STARTTIME 436
#define MNG_FN_GET_RUNTIME 437
#define MNG_FN_GET_CURRENTFRAME 438
#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_GET_CACHEPLAYBACK 454
#define MNG_FN_GET_DOPROGRESSIVE 455
#define MNG_FN_GET_LASTBACKCHUNK 456
#define MNG_FN_GET_LASTSEEKNAME 457
#define MNG_FN_GET_TOTALFRAMES 458
#define MNG_FN_GET_TOTALLAYERS 459
#define MNG_FN_GET_TOTALPLAYTIME 460
#define MNG_FN_GET_CRCMODE 461
#define MNG_FN_GET_CURRFRAMDELAY 462
#define MNG_FN_STATUS_ERROR 481
#define MNG_FN_STATUS_READING 482
#define MNG_FN_STATUS_SUSPENDBREAK 483
#define MNG_FN_STATUS_CREATING 484
#define MNG_FN_STATUS_WRITING 485
#define MNG_FN_STATUS_DISPLAYING 486
#define MNG_FN_STATUS_RUNNING 487
#define MNG_FN_STATUS_TIMERBREAK 488
#define MNG_FN_STATUS_DYNAMIC 489
#define MNG_FN_STATUS_RUNNINGEVENT 490
/* ************************************************************************** */
#define MNG_FN_ITERATE_CHUNKS 601
#define MNG_FN_COPY_CHUNK 602
#define MNG_FN_GETCHUNK_IHDR 701
#define MNG_FN_GETCHUNK_PLTE 702
#define MNG_FN_GETCHUNK_IDAT 703
#define MNG_FN_GETCHUNK_IEND 704
#define MNG_FN_GETCHUNK_TRNS 705
#define MNG_FN_GETCHUNK_GAMA 706
#define MNG_FN_GETCHUNK_CHRM 707
#define MNG_FN_GETCHUNK_SRGB 708
#define MNG_FN_GETCHUNK_ICCP 709
#define MNG_FN_GETCHUNK_TEXT 710
#define MNG_FN_GETCHUNK_ZTXT 711
#define MNG_FN_GETCHUNK_ITXT 712
#define MNG_FN_GETCHUNK_BKGD 713
#define MNG_FN_GETCHUNK_PHYS 714
#define MNG_FN_GETCHUNK_SBIT 715
#define MNG_FN_GETCHUNK_SPLT 716
#define MNG_FN_GETCHUNK_HIST 717
#define MNG_FN_GETCHUNK_TIME 718
#define MNG_FN_GETCHUNK_MHDR 719
#define MNG_FN_GETCHUNK_MEND 720
#define MNG_FN_GETCHUNK_LOOP 721
#define MNG_FN_GETCHUNK_ENDL 722
#define MNG_FN_GETCHUNK_DEFI 723
#define MNG_FN_GETCHUNK_BASI 724
#define MNG_FN_GETCHUNK_CLON 725
#define MNG_FN_GETCHUNK_PAST 726
#define MNG_FN_GETCHUNK_DISC 727
#define MNG_FN_GETCHUNK_BACK 728
#define MNG_FN_GETCHUNK_FRAM 729
#define MNG_FN_GETCHUNK_MOVE 730
#define MNG_FN_GETCHUNK_CLIP 731
#define MNG_FN_GETCHUNK_SHOW 732
#define MNG_FN_GETCHUNK_TERM 733
#define MNG_FN_GETCHUNK_SAVE 734
#define MNG_FN_GETCHUNK_SEEK 735
#define MNG_FN_GETCHUNK_EXPI 736
#define MNG_FN_GETCHUNK_FPRI 737
#define MNG_FN_GETCHUNK_NEED 738
#define MNG_FN_GETCHUNK_PHYG 739
#define MNG_FN_GETCHUNK_JHDR 740
#define MNG_FN_GETCHUNK_JDAT 741
#define MNG_FN_GETCHUNK_JSEP 742
#define MNG_FN_GETCHUNK_DHDR 743
#define MNG_FN_GETCHUNK_PROM 744
#define MNG_FN_GETCHUNK_IPNG 745
#define MNG_FN_GETCHUNK_PPLT 746
#define MNG_FN_GETCHUNK_IJNG 747
#define MNG_FN_GETCHUNK_DROP 748
#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_EVNT 754
#define MNG_FN_GETCHUNK_MPNG 755
#define MNG_FN_GETCHUNK_PAST_SRC 781
#define MNG_FN_GETCHUNK_SAVE_ENTRY 782
#define MNG_FN_GETCHUNK_PPLT_ENTRY 783
#define MNG_FN_GETCHUNK_ORDR_ENTRY 784
#define MNG_FN_GETCHUNK_EVNT_ENTRY 785
#define MNG_FN_GETCHUNK_MPNG_FRAME 786
#define MNG_FN_PUTCHUNK_IHDR 801
#define MNG_FN_PUTCHUNK_PLTE 802
#define MNG_FN_PUTCHUNK_IDAT 803
#define MNG_FN_PUTCHUNK_IEND 804
#define MNG_FN_PUTCHUNK_TRNS 805
#define MNG_FN_PUTCHUNK_GAMA 806
#define MNG_FN_PUTCHUNK_CHRM 807
#define MNG_FN_PUTCHUNK_SRGB 808
#define MNG_FN_PUTCHUNK_ICCP 809
#define MNG_FN_PUTCHUNK_TEXT 810
#define MNG_FN_PUTCHUNK_ZTXT 811
#define MNG_FN_PUTCHUNK_ITXT 812
#define MNG_FN_PUTCHUNK_BKGD 813
#define MNG_FN_PUTCHUNK_PHYS 814
#define MNG_FN_PUTCHUNK_SBIT 815
#define MNG_FN_PUTCHUNK_SPLT 816
#define MNG_FN_PUTCHUNK_HIST 817
#define MNG_FN_PUTCHUNK_TIME 818
#define MNG_FN_PUTCHUNK_MHDR 819
#define MNG_FN_PUTCHUNK_MEND 820
#define MNG_FN_PUTCHUNK_LOOP 821
#define MNG_FN_PUTCHUNK_ENDL 822
#define MNG_FN_PUTCHUNK_DEFI 823
#define MNG_FN_PUTCHUNK_BASI 824
#define MNG_FN_PUTCHUNK_CLON 825
#define MNG_FN_PUTCHUNK_PAST 826
#define MNG_FN_PUTCHUNK_DISC 827
#define MNG_FN_PUTCHUNK_BACK 828
#define MNG_FN_PUTCHUNK_FRAM 829
#define MNG_FN_PUTCHUNK_MOVE 830
#define MNG_FN_PUTCHUNK_CLIP 831
#define MNG_FN_PUTCHUNK_SHOW 832
#define MNG_FN_PUTCHUNK_TERM 833
#define MNG_FN_PUTCHUNK_SAVE 834
#define MNG_FN_PUTCHUNK_SEEK 835
#define MNG_FN_PUTCHUNK_EXPI 836
#define MNG_FN_PUTCHUNK_FPRI 837
#define MNG_FN_PUTCHUNK_NEED 838
#define MNG_FN_PUTCHUNK_PHYG 839
#define MNG_FN_PUTCHUNK_JHDR 840
#define MNG_FN_PUTCHUNK_JDAT 841
#define MNG_FN_PUTCHUNK_JSEP 842
#define MNG_FN_PUTCHUNK_DHDR 843
#define MNG_FN_PUTCHUNK_PROM 844
#define MNG_FN_PUTCHUNK_IPNG 845
#define MNG_FN_PUTCHUNK_PPLT 846
#define MNG_FN_PUTCHUNK_IJNG 847
#define MNG_FN_PUTCHUNK_DROP 848
#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_EVNT 854
#define MNG_FN_PUTCHUNK_MPNG 855
#define MNG_FN_PUTCHUNK_PAST_SRC 881
#define MNG_FN_PUTCHUNK_SAVE_ENTRY 882
#define MNG_FN_PUTCHUNK_PPLT_ENTRY 883
#define MNG_FN_PUTCHUNK_ORDR_ENTRY 884
#define MNG_FN_PUTCHUNK_EVNT_ENTRY 885
#define MNG_FN_PUTCHUNK_MPNG_FRAME 886
/* ************************************************************************** */
#define MNG_FN_GETIMGDATA_SEQ 901
#define MNG_FN_GETIMGDATA_CHUNKSEQ 902
#define MNG_FN_GETIMGDATA_CHUNK 903
#define MNG_FN_PUTIMGDATA_IHDR 951
#define MNG_FN_PUTIMGDATA_JHDR 952
#define MNG_FN_PUTIMGDATA_BASI 953
#define MNG_FN_PUTIMGDATA_DHDR 954
#define MNG_FN_UPDATEMNGHEADER 981
#define MNG_FN_UPDATEMNGSIMPLICITY 982
/* ************************************************************************** */
#define MNG_FN_PROCESS_RAW_CHUNK 1001
#define MNG_FN_READ_GRAPHIC 1002
#define MNG_FN_DROP_CHUNKS 1003
#define MNG_FN_PROCESS_ERROR 1004
#define MNG_FN_CLEAR_CMS 1005
#define MNG_FN_DROP_OBJECTS 1006
#define MNG_FN_READ_CHUNK 1007
#define MNG_FN_LOAD_BKGDLAYER 1008
#define MNG_FN_NEXT_FRAME 1009
#define MNG_FN_NEXT_LAYER 1010
#define MNG_FN_INTERFRAME_DELAY 1011
#define MNG_FN_DISPLAY_IMAGE 1012
#define MNG_FN_DROP_IMGOBJECTS 1013
#define MNG_FN_DROP_ANIOBJECTS 1014
#define MNG_FN_INFLATE_BUFFER 1015
#define MNG_FN_DEFLATE_BUFFER 1016
#define MNG_FN_WRITE_RAW_CHUNK 1017
#define MNG_FN_WRITE_GRAPHIC 1018
#define MNG_FN_SAVE_STATE 1019
#define MNG_FN_RESTORE_STATE 1020
#define MNG_FN_DROP_SAVEDATA 1021
#define MNG_FN_EXECUTE_DELTA_IMAGE 1022
#define MNG_FN_PROCESS_DISPLAY 1023
#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
#define MNG_FN_RELEASE_PUSHDATA 1028
#define MNG_FN_READ_DATA 1029
#define MNG_FN_READ_CHUNK_CRC 1030
#define MNG_FN_RELEASE_PUSHCHUNK 1031
/* ************************************************************************** */
#define MNG_FN_DISPLAY_RGB8 1101
#define MNG_FN_DISPLAY_RGBA8 1102
#define MNG_FN_DISPLAY_ARGB8 1103
#define MNG_FN_DISPLAY_BGR8 1104
#define MNG_FN_DISPLAY_BGRA8 1105
#define MNG_FN_DISPLAY_ABGR8 1106
#define MNG_FN_DISPLAY_RGB16 1107
#define MNG_FN_DISPLAY_RGBA16 1108
#define MNG_FN_DISPLAY_ARGB16 1109
#define MNG_FN_DISPLAY_BGR16 1110
#define MNG_FN_DISPLAY_BGRA16 1111
#define MNG_FN_DISPLAY_ABGR16 1112
#define MNG_FN_DISPLAY_INDEX8 1113
#define MNG_FN_DISPLAY_INDEXA8 1114
#define MNG_FN_DISPLAY_AINDEX8 1115
#define MNG_FN_DISPLAY_GRAY8 1116
#define MNG_FN_DISPLAY_GRAY16 1117
#define MNG_FN_DISPLAY_GRAYA8 1118
#define MNG_FN_DISPLAY_GRAYA16 1119
#define MNG_FN_DISPLAY_AGRAY8 1120
#define MNG_FN_DISPLAY_AGRAY16 1121
#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
#define MNG_FN_DISPLAY_BGRX8 1126
#define MNG_FN_DISPLAY_RGB565 1127
#define MNG_FN_DISPLAY_RGBA565 1128
#define MNG_FN_DISPLAY_BGR565 1129
#define MNG_FN_DISPLAY_BGRA565 1130
#define MNG_FN_DISPLAY_RGBA8_PM 1131
#define MNG_FN_DISPLAY_ARGB8_PM 1132
#define MNG_FN_DISPLAY_ABGR8_PM 1133
#define MNG_FN_DISPLAY_BGR565_A8 1134
#define MNG_FN_DISPLAY_RGB555 1135
#define MNG_FN_DISPLAY_BGR555 1136
/* ************************************************************************** */
#define MNG_FN_INIT_FULL_CMS 1201
#define MNG_FN_CORRECT_FULL_CMS 1202
#define MNG_FN_INIT_GAMMA_ONLY 1204
#define MNG_FN_CORRECT_GAMMA_ONLY 1205
#define MNG_FN_CORRECT_APP_CMS 1206
#define MNG_FN_INIT_FULL_CMS_OBJ 1207
#define MNG_FN_INIT_GAMMA_ONLY_OBJ 1208
#define MNG_FN_INIT_APP_CMS 1209
#define MNG_FN_INIT_APP_CMS_OBJ 1210
/* ************************************************************************** */
#define MNG_FN_PROCESS_G1 1301
#define MNG_FN_PROCESS_G2 1302
#define MNG_FN_PROCESS_G4 1303
#define MNG_FN_PROCESS_G8 1304
#define MNG_FN_PROCESS_G16 1305
#define MNG_FN_PROCESS_RGB8 1306
#define MNG_FN_PROCESS_RGB16 1307
#define MNG_FN_PROCESS_IDX1 1308
#define MNG_FN_PROCESS_IDX2 1309
#define MNG_FN_PROCESS_IDX4 1310
#define MNG_FN_PROCESS_IDX8 1311
#define MNG_FN_PROCESS_GA8 1312
#define MNG_FN_PROCESS_GA16 1313
#define MNG_FN_PROCESS_RGBA8 1314
#define MNG_FN_PROCESS_RGBA16 1315
/* ************************************************************************** */
#define MNG_FN_INIT_G1_NI 1401
#define MNG_FN_INIT_G1_I 1402
#define MNG_FN_INIT_G2_NI 1403
#define MNG_FN_INIT_G2_I 1404
#define MNG_FN_INIT_G4_NI 1405
#define MNG_FN_INIT_G4_I 1406
#define MNG_FN_INIT_G8_NI 1407
#define MNG_FN_INIT_G8_I 1408
#define MNG_FN_INIT_G16_NI 1409
#define MNG_FN_INIT_G16_I 1410
#define MNG_FN_INIT_RGB8_NI 1411
#define MNG_FN_INIT_RGB8_I 1412
#define MNG_FN_INIT_RGB16_NI 1413
#define MNG_FN_INIT_RGB16_I 1414
#define MNG_FN_INIT_IDX1_NI 1415
#define MNG_FN_INIT_IDX1_I 1416
#define MNG_FN_INIT_IDX2_NI 1417
#define MNG_FN_INIT_IDX2_I 1418
#define MNG_FN_INIT_IDX4_NI 1419
#define MNG_FN_INIT_IDX4_I 1420
#define MNG_FN_INIT_IDX8_NI 1421
#define MNG_FN_INIT_IDX8_I 1422
#define MNG_FN_INIT_GA8_NI 1423
#define MNG_FN_INIT_GA8_I 1424
#define MNG_FN_INIT_GA16_NI 1425
#define MNG_FN_INIT_GA16_I 1426
#define MNG_FN_INIT_RGBA8_NI 1427
#define MNG_FN_INIT_RGBA8_I 1428
#define MNG_FN_INIT_RGBA16_NI 1429
#define MNG_FN_INIT_RGBA16_I 1430
#define MNG_FN_INIT_ROWPROC 1497
#define MNG_FN_NEXT_ROW 1498
#define MNG_FN_CLEANUP_ROWPROC 1499
/* ************************************************************************** */
#define MNG_FN_FILTER_A_ROW 1501
#define MNG_FN_FILTER_SUB 1502
#define MNG_FN_FILTER_UP 1503
#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
#define MNG_FN_FREE_IMGDATAOBJECT 1602
#define MNG_FN_CLONE_IMGDATAOBJECT 1603
#define MNG_FN_CREATE_IMGOBJECT 1604
#define MNG_FN_FREE_IMGOBJECT 1605
#define MNG_FN_FIND_IMGOBJECT 1606
#define MNG_FN_CLONE_IMGOBJECT 1607
#define MNG_FN_RESET_OBJECTDETAILS 1608
#define MNG_FN_RENUM_IMGOBJECT 1609
#define MNG_FN_PROMOTE_IMGOBJECT 1610
#define MNG_FN_MAGNIFY_IMGOBJECT 1611
#define MNG_FN_COLORCORRECT_OBJECT 1612
/* ************************************************************************** */
#define MNG_FN_STORE_G1 1701
#define MNG_FN_STORE_G2 1702
#define MNG_FN_STORE_G4 1703
#define MNG_FN_STORE_G8 1704
#define MNG_FN_STORE_G16 1705
#define MNG_FN_STORE_RGB8 1706
#define MNG_FN_STORE_RGB16 1707
#define MNG_FN_STORE_IDX1 1708
#define MNG_FN_STORE_IDX2 1709
#define MNG_FN_STORE_IDX4 1710
#define MNG_FN_STORE_IDX8 1711
#define MNG_FN_STORE_GA8 1712
#define MNG_FN_STORE_GA16 1713
#define MNG_FN_STORE_RGBA8 1714
#define MNG_FN_STORE_RGBA16 1715
#define MNG_FN_RETRIEVE_G8 1751
#define MNG_FN_RETRIEVE_G16 1752
#define MNG_FN_RETRIEVE_RGB8 1753
#define MNG_FN_RETRIEVE_RGB16 1754
#define MNG_FN_RETRIEVE_IDX8 1755
#define MNG_FN_RETRIEVE_GA8 1756
#define MNG_FN_RETRIEVE_GA16 1757
#define MNG_FN_RETRIEVE_RGBA8 1758
#define MNG_FN_RETRIEVE_RGBA16 1759
#define MNG_FN_DELTA_G1 1771
#define MNG_FN_DELTA_G2 1772
#define MNG_FN_DELTA_G4 1773
#define MNG_FN_DELTA_G8 1774
#define MNG_FN_DELTA_G16 1775
#define MNG_FN_DELTA_RGB8 1776
#define MNG_FN_DELTA_RGB16 1777
#define MNG_FN_DELTA_IDX1 1778
#define MNG_FN_DELTA_IDX2 1779
#define MNG_FN_DELTA_IDX4 1780
#define MNG_FN_DELTA_IDX8 1781
#define MNG_FN_DELTA_GA8 1782
#define MNG_FN_DELTA_GA16 1783
#define MNG_FN_DELTA_RGBA8 1784
#define MNG_FN_DELTA_RGBA16 1785
/* ************************************************************************** */
#define MNG_FN_CREATE_ANI_LOOP 1801
#define MNG_FN_CREATE_ANI_ENDL 1802
#define MNG_FN_CREATE_ANI_DEFI 1803
#define MNG_FN_CREATE_ANI_BASI 1804
#define MNG_FN_CREATE_ANI_CLON 1805
#define MNG_FN_CREATE_ANI_PAST 1806
#define MNG_FN_CREATE_ANI_DISC 1807
#define MNG_FN_CREATE_ANI_BACK 1808
#define MNG_FN_CREATE_ANI_FRAM 1809
#define MNG_FN_CREATE_ANI_MOVE 1810
#define MNG_FN_CREATE_ANI_CLIP 1811
#define MNG_FN_CREATE_ANI_SHOW 1812
#define MNG_FN_CREATE_ANI_TERM 1813
#define MNG_FN_CREATE_ANI_SAVE 1814
#define MNG_FN_CREATE_ANI_SEEK 1815
#define MNG_FN_CREATE_ANI_GAMA 1816
#define MNG_FN_CREATE_ANI_CHRM 1817
#define MNG_FN_CREATE_ANI_SRGB 1818
#define MNG_FN_CREATE_ANI_ICCP 1819
#define MNG_FN_CREATE_ANI_PLTE 1820
#define MNG_FN_CREATE_ANI_TRNS 1821
#define MNG_FN_CREATE_ANI_BKGD 1822
#define MNG_FN_CREATE_ANI_DHDR 1823
#define MNG_FN_CREATE_ANI_PROM 1824
#define MNG_FN_CREATE_ANI_IPNG 1825
#define MNG_FN_CREATE_ANI_IJNG 1826
#define MNG_FN_CREATE_ANI_PPLT 1827
#define MNG_FN_CREATE_ANI_MAGN 1828
#define MNG_FN_CREATE_ANI_IMAGE 1891
#define MNG_FN_CREATE_EVENT 1892
/* ************************************************************************** */
#define MNG_FN_FREE_ANI_LOOP 1901
#define MNG_FN_FREE_ANI_ENDL 1902
#define MNG_FN_FREE_ANI_DEFI 1903
#define MNG_FN_FREE_ANI_BASI 1904
#define MNG_FN_FREE_ANI_CLON 1905
#define MNG_FN_FREE_ANI_PAST 1906
#define MNG_FN_FREE_ANI_DISC 1907
#define MNG_FN_FREE_ANI_BACK 1908
#define MNG_FN_FREE_ANI_FRAM 1909
#define MNG_FN_FREE_ANI_MOVE 1910
#define MNG_FN_FREE_ANI_CLIP 1911
#define MNG_FN_FREE_ANI_SHOW 1912
#define MNG_FN_FREE_ANI_TERM 1913
#define MNG_FN_FREE_ANI_SAVE 1914
#define MNG_FN_FREE_ANI_SEEK 1915
#define MNG_FN_FREE_ANI_GAMA 1916
#define MNG_FN_FREE_ANI_CHRM 1917
#define MNG_FN_FREE_ANI_SRGB 1918
#define MNG_FN_FREE_ANI_ICCP 1919
#define MNG_FN_FREE_ANI_PLTE 1920
#define MNG_FN_FREE_ANI_TRNS 1921
#define MNG_FN_FREE_ANI_BKGD 1922
#define MNG_FN_FREE_ANI_DHDR 1923
#define MNG_FN_FREE_ANI_PROM 1924
#define MNG_FN_FREE_ANI_IPNG 1925
#define MNG_FN_FREE_ANI_IJNG 1926
#define MNG_FN_FREE_ANI_PPLT 1927
#define MNG_FN_FREE_ANI_MAGN 1928
#define MNG_FN_FREE_ANI_IMAGE 1991
#define MNG_FN_FREE_EVENT 1992
/* ************************************************************************** */
#define MNG_FN_PROCESS_ANI_LOOP 2001
#define MNG_FN_PROCESS_ANI_ENDL 2002
#define MNG_FN_PROCESS_ANI_DEFI 2003
#define MNG_FN_PROCESS_ANI_BASI 2004
#define MNG_FN_PROCESS_ANI_CLON 2005
#define MNG_FN_PROCESS_ANI_PAST 2006
#define MNG_FN_PROCESS_ANI_DISC 2007
#define MNG_FN_PROCESS_ANI_BACK 2008
#define MNG_FN_PROCESS_ANI_FRAM 2009
#define MNG_FN_PROCESS_ANI_MOVE 2010
#define MNG_FN_PROCESS_ANI_CLIP 2011
#define MNG_FN_PROCESS_ANI_SHOW 2012
#define MNG_FN_PROCESS_ANI_TERM 2013
#define MNG_FN_PROCESS_ANI_SAVE 2014
#define MNG_FN_PROCESS_ANI_SEEK 2015
#define MNG_FN_PROCESS_ANI_GAMA 2016
#define MNG_FN_PROCESS_ANI_CHRM 2017
#define MNG_FN_PROCESS_ANI_SRGB 2018
#define MNG_FN_PROCESS_ANI_ICCP 2019
#define MNG_FN_PROCESS_ANI_PLTE 2020
#define MNG_FN_PROCESS_ANI_TRNS 2021
#define MNG_FN_PROCESS_ANI_BKGD 2022
#define MNG_FN_PROCESS_ANI_DHDR 2023
#define MNG_FN_PROCESS_ANI_PROM 2024
#define MNG_FN_PROCESS_ANI_IPNG 2025
#define MNG_FN_PROCESS_ANI_IJNG 2026
#define MNG_FN_PROCESS_ANI_PPLT 2027
#define MNG_FN_PROCESS_ANI_MAGN 2028
#define MNG_FN_PROCESS_ANI_IMAGE 2091
#define MNG_FN_PROCESS_EVENT 2092
/* ************************************************************************** */
#define MNG_FN_RESTORE_BACKIMAGE 2101
#define MNG_FN_RESTORE_BACKCOLOR 2102
#define MNG_FN_RESTORE_BGCOLOR 2103
#define MNG_FN_RESTORE_RGB8 2104
#define MNG_FN_RESTORE_BGR8 2105
#define MNG_FN_RESTORE_BKGD 2106
#define MNG_FN_RESTORE_BGRX8 2107
#define MNG_FN_RESTORE_RGB565 2108
#define MNG_FN_RESTORE_BGR565 2109
/* ************************************************************************** */
#define MNG_FN_INIT_IHDR 2201
#define MNG_FN_INIT_PLTE 2202
#define MNG_FN_INIT_IDAT 2203
#define MNG_FN_INIT_IEND 2204
#define MNG_FN_INIT_TRNS 2205
#define MNG_FN_INIT_GAMA 2206
#define MNG_FN_INIT_CHRM 2207
#define MNG_FN_INIT_SRGB 2208
#define MNG_FN_INIT_ICCP 2209
#define MNG_FN_INIT_TEXT 2210
#define MNG_FN_INIT_ZTXT 2211
#define MNG_FN_INIT_ITXT 2212
#define MNG_FN_INIT_BKGD 2213
#define MNG_FN_INIT_PHYS 2214
#define MNG_FN_INIT_SBIT 2215
#define MNG_FN_INIT_SPLT 2216
#define MNG_FN_INIT_HIST 2217
#define MNG_FN_INIT_TIME 2218
#define MNG_FN_INIT_MHDR 2219
#define MNG_FN_INIT_MEND 2220
#define MNG_FN_INIT_LOOP 2221
#define MNG_FN_INIT_ENDL 2222
#define MNG_FN_INIT_DEFI 2223
#define MNG_FN_INIT_BASI 2224
#define MNG_FN_INIT_CLON 2225
#define MNG_FN_INIT_PAST 2226
#define MNG_FN_INIT_DISC 2227
#define MNG_FN_INIT_BACK 2228
#define MNG_FN_INIT_FRAM 2229
#define MNG_FN_INIT_MOVE 2230
#define MNG_FN_INIT_CLIP 2231
#define MNG_FN_INIT_SHOW 2232
#define MNG_FN_INIT_TERM 2233
#define MNG_FN_INIT_SAVE 2234
#define MNG_FN_INIT_SEEK 2235
#define MNG_FN_INIT_EXPI 2236
#define MNG_FN_INIT_FPRI 2237
#define MNG_FN_INIT_NEED 2238
#define MNG_FN_INIT_PHYG 2239
#define MNG_FN_INIT_JHDR 2240
#define MNG_FN_INIT_JDAT 2241
#define MNG_FN_INIT_JSEP 2242
#define MNG_FN_INIT_DHDR 2243
#define MNG_FN_INIT_PROM 2244
#define MNG_FN_INIT_IPNG 2245
#define MNG_FN_INIT_PPLT 2246
#define MNG_FN_INIT_IJNG 2247
#define MNG_FN_INIT_DROP 2248
#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
#define MNG_FN_INIT_EVNT 2254
#define MNG_FN_INIT_MPNG 2255
/* ************************************************************************** */
#define MNG_FN_ASSIGN_IHDR 2301
#define MNG_FN_ASSIGN_PLTE 2302
#define MNG_FN_ASSIGN_IDAT 2303
#define MNG_FN_ASSIGN_IEND 2304
#define MNG_FN_ASSIGN_TRNS 2305
#define MNG_FN_ASSIGN_GAMA 2306
#define MNG_FN_ASSIGN_CHRM 2307
#define MNG_FN_ASSIGN_SRGB 2308
#define MNG_FN_ASSIGN_ICCP 2309
#define MNG_FN_ASSIGN_TEXT 2310
#define MNG_FN_ASSIGN_ZTXT 2311
#define MNG_FN_ASSIGN_ITXT 2312
#define MNG_FN_ASSIGN_BKGD 2313
#define MNG_FN_ASSIGN_PHYS 2314
#define MNG_FN_ASSIGN_SBIT 2315
#define MNG_FN_ASSIGN_SPLT 2316
#define MNG_FN_ASSIGN_HIST 2317
#define MNG_FN_ASSIGN_TIME 2318
#define MNG_FN_ASSIGN_MHDR 2319
#define MNG_FN_ASSIGN_MEND 2320
#define MNG_FN_ASSIGN_LOOP 2321
#define MNG_FN_ASSIGN_ENDL 2322
#define MNG_FN_ASSIGN_DEFI 2323
#define MNG_FN_ASSIGN_BASI 2324
#define MNG_FN_ASSIGN_CLON 2325
#define MNG_FN_ASSIGN_PAST 2326
#define MNG_FN_ASSIGN_DISC 2327
#define MNG_FN_ASSIGN_BACK 2328
#define MNG_FN_ASSIGN_FRAM 2329
#define MNG_FN_ASSIGN_MOVE 2330
#define MNG_FN_ASSIGN_CLIP 2331
#define MNG_FN_ASSIGN_SHOW 2332
#define MNG_FN_ASSIGN_TERM 2333
#define MNG_FN_ASSIGN_SAVE 2334
#define MNG_FN_ASSIGN_SEEK 2335
#define MNG_FN_ASSIGN_EXPI 2336
#define MNG_FN_ASSIGN_FPRI 2337
#define MNG_FN_ASSIGN_NEED 2338
#define MNG_FN_ASSIGN_PHYG 2339
#define MNG_FN_ASSIGN_JHDR 2340
#define MNG_FN_ASSIGN_JDAT 2341
#define MNG_FN_ASSIGN_JSEP 2342
#define MNG_FN_ASSIGN_DHDR 2343
#define MNG_FN_ASSIGN_PROM 2344
#define MNG_FN_ASSIGN_IPNG 2345
#define MNG_FN_ASSIGN_PPLT 2346
#define MNG_FN_ASSIGN_IJNG 2347
#define MNG_FN_ASSIGN_DROP 2348
#define MNG_FN_ASSIGN_DBYK 2349
#define MNG_FN_ASSIGN_ORDR 2350
#define MNG_FN_ASSIGN_UNKNOWN 2351
#define MNG_FN_ASSIGN_MAGN 2352
#define MNG_FN_ASSIGN_JDAA 2353
#define MNG_FN_ASSIGN_EVNT 2354
#define MNG_FN_ASSIGN_MPNG 2355
/* ************************************************************************** */
#define MNG_FN_FREE_IHDR 2401
#define MNG_FN_FREE_PLTE 2402
#define MNG_FN_FREE_IDAT 2403
#define MNG_FN_FREE_IEND 2404
#define MNG_FN_FREE_TRNS 2405
#define MNG_FN_FREE_GAMA 2406
#define MNG_FN_FREE_CHRM 2407
#define MNG_FN_FREE_SRGB 2408
#define MNG_FN_FREE_ICCP 2409
#define MNG_FN_FREE_TEXT 2410
#define MNG_FN_FREE_ZTXT 2411
#define MNG_FN_FREE_ITXT 2412
#define MNG_FN_FREE_BKGD 2413
#define MNG_FN_FREE_PHYS 2414
#define MNG_FN_FREE_SBIT 2415
#define MNG_FN_FREE_SPLT 2416
#define MNG_FN_FREE_HIST 2417
#define MNG_FN_FREE_TIME 2418
#define MNG_FN_FREE_MHDR 2419
#define MNG_FN_FREE_MEND 2420
#define MNG_FN_FREE_LOOP 2421
#define MNG_FN_FREE_ENDL 2422
#define MNG_FN_FREE_DEFI 2423
#define MNG_FN_FREE_BASI 2424
#define MNG_FN_FREE_CLON 2425
#define MNG_FN_FREE_PAST 2426
#define MNG_FN_FREE_DISC 2427
#define MNG_FN_FREE_BACK 2428
#define MNG_FN_FREE_FRAM 2429
#define MNG_FN_FREE_MOVE 2430
#define MNG_FN_FREE_CLIP 2431
#define MNG_FN_FREE_SHOW 2432
#define MNG_FN_FREE_TERM 2433
#define MNG_FN_FREE_SAVE 2434
#define MNG_FN_FREE_SEEK 2435
#define MNG_FN_FREE_EXPI 2436
#define MNG_FN_FREE_FPRI 2437
#define MNG_FN_FREE_NEED 2438
#define MNG_FN_FREE_PHYG 2439
#define MNG_FN_FREE_JHDR 2440
#define MNG_FN_FREE_JDAT 2441
#define MNG_FN_FREE_JSEP 2442
#define MNG_FN_FREE_DHDR 2443
#define MNG_FN_FREE_PROM 2444
#define MNG_FN_FREE_IPNG 2445
#define MNG_FN_FREE_PPLT 2446
#define MNG_FN_FREE_IJNG 2447
#define MNG_FN_FREE_DROP 2448
#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
#define MNG_FN_FREE_EVNT 2454
#define MNG_FN_FREE_MPNG 2455
/* ************************************************************************** */
#define MNG_FN_READ_IHDR 2601
#define MNG_FN_READ_PLTE 2602
#define MNG_FN_READ_IDAT 2603
#define MNG_FN_READ_IEND 2604
#define MNG_FN_READ_TRNS 2605
#define MNG_FN_READ_GAMA 2606
#define MNG_FN_READ_CHRM 2607
#define MNG_FN_READ_SRGB 2608
#define MNG_FN_READ_ICCP 2609
#define MNG_FN_READ_TEXT 2610
#define MNG_FN_READ_ZTXT 2611
#define MNG_FN_READ_ITXT 2612
#define MNG_FN_READ_BKGD 2613
#define MNG_FN_READ_PHYS 2614
#define MNG_FN_READ_SBIT 2615
#define MNG_FN_READ_SPLT 2616
#define MNG_FN_READ_HIST 2617
#define MNG_FN_READ_TIME 2618
#define MNG_FN_READ_MHDR 2619
#define MNG_FN_READ_MEND 2620
#define MNG_FN_READ_LOOP 2621
#define MNG_FN_READ_ENDL 2622
#define MNG_FN_READ_DEFI 2623
#define MNG_FN_READ_BASI 2624
#define MNG_FN_READ_CLON 2625
#define MNG_FN_READ_PAST 2626
#define MNG_FN_READ_DISC 2627
#define MNG_FN_READ_BACK 2628
#define MNG_FN_READ_FRAM 2629
#define MNG_FN_READ_MOVE 2630
#define MNG_FN_READ_CLIP 2631
#define MNG_FN_READ_SHOW 2632
#define MNG_FN_READ_TERM 2633
#define MNG_FN_READ_SAVE 2634
#define MNG_FN_READ_SEEK 2635
#define MNG_FN_READ_EXPI 2636
#define MNG_FN_READ_FPRI 2637
#define MNG_FN_READ_NEED 2638
#define MNG_FN_READ_PHYG 2639
#define MNG_FN_READ_JHDR 2640
#define MNG_FN_READ_JDAT 2641
#define MNG_FN_READ_JSEP 2642
#define MNG_FN_READ_DHDR 2643
#define MNG_FN_READ_PROM 2644
#define MNG_FN_READ_IPNG 2645
#define MNG_FN_READ_PPLT 2646
#define MNG_FN_READ_IJNG 2647
#define MNG_FN_READ_DROP 2648
#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
#define MNG_FN_READ_EVNT 2654
#define MNG_FN_READ_MPNG 2655
/* ************************************************************************** */
#define MNG_FN_WRITE_IHDR 2801
#define MNG_FN_WRITE_PLTE 2802
#define MNG_FN_WRITE_IDAT 2803
#define MNG_FN_WRITE_IEND 2804
#define MNG_FN_WRITE_TRNS 2805
#define MNG_FN_WRITE_GAMA 2806
#define MNG_FN_WRITE_CHRM 2807
#define MNG_FN_WRITE_SRGB 2808
#define MNG_FN_WRITE_ICCP 2809
#define MNG_FN_WRITE_TEXT 2810
#define MNG_FN_WRITE_ZTXT 2811
#define MNG_FN_WRITE_ITXT 2812
#define MNG_FN_WRITE_BKGD 2813
#define MNG_FN_WRITE_PHYS 2814
#define MNG_FN_WRITE_SBIT 2815
#define MNG_FN_WRITE_SPLT 2816
#define MNG_FN_WRITE_HIST 2817
#define MNG_FN_WRITE_TIME 2818
#define MNG_FN_WRITE_MHDR 2819
#define MNG_FN_WRITE_MEND 2820
#define MNG_FN_WRITE_LOOP 2821
#define MNG_FN_WRITE_ENDL 2822
#define MNG_FN_WRITE_DEFI 2823
#define MNG_FN_WRITE_BASI 2824
#define MNG_FN_WRITE_CLON 2825
#define MNG_FN_WRITE_PAST 2826
#define MNG_FN_WRITE_DISC 2827
#define MNG_FN_WRITE_BACK 2828
#define MNG_FN_WRITE_FRAM 2829
#define MNG_FN_WRITE_MOVE 2830
#define MNG_FN_WRITE_CLIP 2831
#define MNG_FN_WRITE_SHOW 2832
#define MNG_FN_WRITE_TERM 2833
#define MNG_FN_WRITE_SAVE 2834
#define MNG_FN_WRITE_SEEK 2835
#define MNG_FN_WRITE_EXPI 2836
#define MNG_FN_WRITE_FPRI 2837
#define MNG_FN_WRITE_NEED 2838
#define MNG_FN_WRITE_PHYG 2839
#define MNG_FN_WRITE_JHDR 2840
#define MNG_FN_WRITE_JDAT 2841
#define MNG_FN_WRITE_JSEP 2842
#define MNG_FN_WRITE_DHDR 2843
#define MNG_FN_WRITE_PROM 2844
#define MNG_FN_WRITE_IPNG 2845
#define MNG_FN_WRITE_PPLT 2846
#define MNG_FN_WRITE_IJNG 2847
#define MNG_FN_WRITE_DROP 2848
#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
#define MNG_FN_WRITE_EVNT 2854
#define MNG_FN_WRITE_MPNG 2855
/* ************************************************************************** */
#define MNG_FN_ZLIB_INITIALIZE 3001
#define MNG_FN_ZLIB_CLEANUP 3002
#define MNG_FN_ZLIB_INFLATEINIT 3003
#define MNG_FN_ZLIB_INFLATEROWS 3004
#define MNG_FN_ZLIB_INFLATEDATA 3005
#define MNG_FN_ZLIB_INFLATEFREE 3006
#define MNG_FN_ZLIB_DEFLATEINIT 3007
#define MNG_FN_ZLIB_DEFLATEROWS 3008
#define MNG_FN_ZLIB_DEFLATEDATA 3009
#define MNG_FN_ZLIB_DEFLATEFREE 3010
/* ************************************************************************** */
#define MNG_FN_PROCESS_DISPLAY_IHDR 3201
#define MNG_FN_PROCESS_DISPLAY_PLTE 3202
#define MNG_FN_PROCESS_DISPLAY_IDAT 3203
#define MNG_FN_PROCESS_DISPLAY_IEND 3204
#define MNG_FN_PROCESS_DISPLAY_TRNS 3205
#define MNG_FN_PROCESS_DISPLAY_GAMA 3206
#define MNG_FN_PROCESS_DISPLAY_CHRM 3207
#define MNG_FN_PROCESS_DISPLAY_SRGB 3208
#define MNG_FN_PROCESS_DISPLAY_ICCP 3209
#define MNG_FN_PROCESS_DISPLAY_BKGD 3210
#define MNG_FN_PROCESS_DISPLAY_PHYS 3211
#define MNG_FN_PROCESS_DISPLAY_SBIT 3212
#define MNG_FN_PROCESS_DISPLAY_SPLT 3213
#define MNG_FN_PROCESS_DISPLAY_HIST 3214
#define MNG_FN_PROCESS_DISPLAY_MHDR 3215
#define MNG_FN_PROCESS_DISPLAY_MEND 3216
#define MNG_FN_PROCESS_DISPLAY_LOOP 3217
#define MNG_FN_PROCESS_DISPLAY_ENDL 3218
#define MNG_FN_PROCESS_DISPLAY_DEFI 3219
#define MNG_FN_PROCESS_DISPLAY_BASI 3220
#define MNG_FN_PROCESS_DISPLAY_CLON 3221
#define MNG_FN_PROCESS_DISPLAY_PAST 3222
#define MNG_FN_PROCESS_DISPLAY_DISC 3223
#define MNG_FN_PROCESS_DISPLAY_BACK 3224
#define MNG_FN_PROCESS_DISPLAY_FRAM 3225
#define MNG_FN_PROCESS_DISPLAY_MOVE 3226
#define MNG_FN_PROCESS_DISPLAY_CLIP 3227
#define MNG_FN_PROCESS_DISPLAY_SHOW 3228
#define MNG_FN_PROCESS_DISPLAY_TERM 3229
#define MNG_FN_PROCESS_DISPLAY_SAVE 3230
#define MNG_FN_PROCESS_DISPLAY_SEEK 3231
#define MNG_FN_PROCESS_DISPLAY_EXPI 3232
#define MNG_FN_PROCESS_DISPLAY_FPRI 3233
#define MNG_FN_PROCESS_DISPLAY_NEED 3234
#define MNG_FN_PROCESS_DISPLAY_PHYG 3235
#define MNG_FN_PROCESS_DISPLAY_JHDR 3236
#define MNG_FN_PROCESS_DISPLAY_JDAT 3237
#define MNG_FN_PROCESS_DISPLAY_JSEP 3238
#define MNG_FN_PROCESS_DISPLAY_DHDR 3239
#define MNG_FN_PROCESS_DISPLAY_PROM 3240
#define MNG_FN_PROCESS_DISPLAY_IPNG 3241
#define MNG_FN_PROCESS_DISPLAY_PPLT 3242
#define MNG_FN_PROCESS_DISPLAY_IJNG 3243
#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
/* ************************************************************************** */
#define MNG_FN_JPEG_INITIALIZE 3401
#define MNG_FN_JPEG_CLEANUP 3402
#define MNG_FN_JPEG_DECOMPRESSINIT 3403
#define MNG_FN_JPEG_DECOMPRESSDATA 3404
#define MNG_FN_JPEG_DECOMPRESSFREE 3405
#define MNG_FN_STORE_JPEG_G8 3501
#define MNG_FN_STORE_JPEG_RGB8 3502
#define MNG_FN_STORE_JPEG_G12 3503
#define MNG_FN_STORE_JPEG_RGB12 3504
#define MNG_FN_STORE_JPEG_GA8 3505
#define MNG_FN_STORE_JPEG_RGBA8 3506
#define MNG_FN_STORE_JPEG_GA12 3507
#define MNG_FN_STORE_JPEG_RGBA12 3508
#define MNG_FN_STORE_JPEG_G8_ALPHA 3509
#define MNG_FN_STORE_JPEG_RGB8_ALPHA 3510
#define MNG_FN_INIT_JPEG_A1_NI 3511
#define MNG_FN_INIT_JPEG_A2_NI 3512
#define MNG_FN_INIT_JPEG_A4_NI 3513
#define MNG_FN_INIT_JPEG_A8_NI 3514
#define MNG_FN_INIT_JPEG_A16_NI 3515
#define MNG_FN_STORE_JPEG_G8_A1 3521
#define MNG_FN_STORE_JPEG_G8_A2 3522
#define MNG_FN_STORE_JPEG_G8_A4 3523
#define MNG_FN_STORE_JPEG_G8_A8 3524
#define MNG_FN_STORE_JPEG_G8_A16 3525
#define MNG_FN_STORE_JPEG_RGB8_A1 3531
#define MNG_FN_STORE_JPEG_RGB8_A2 3532
#define MNG_FN_STORE_JPEG_RGB8_A4 3533
#define MNG_FN_STORE_JPEG_RGB8_A8 3534
#define MNG_FN_STORE_JPEG_RGB8_A16 3535
#define MNG_FN_STORE_JPEG_G12_A1 3541
#define MNG_FN_STORE_JPEG_G12_A2 3542
#define MNG_FN_STORE_JPEG_G12_A4 3543
#define MNG_FN_STORE_JPEG_G12_A8 3544
#define MNG_FN_STORE_JPEG_G12_A16 3545
#define MNG_FN_STORE_JPEG_RGB12_A1 3551
#define MNG_FN_STORE_JPEG_RGB12_A2 3552
#define MNG_FN_STORE_JPEG_RGB12_A4 3553
#define MNG_FN_STORE_JPEG_RGB12_A8 3554
#define MNG_FN_STORE_JPEG_RGB12_A16 3555
#define MNG_FN_NEXT_JPEG_ALPHAROW 3591
#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_X3 3713
#define MNG_FN_MAGNIFY_RGB8_X3 3714
#define MNG_FN_MAGNIFY_GA8_X5 3715
#define MNG_FN_MAGNIFY_RGBA8_X5 3716
#define MNG_FN_MAGNIFY_G16_X1 3725
#define MNG_FN_MAGNIFY_G16_X2 3726
#define MNG_FN_MAGNIFY_RGB16_X1 3727
#define MNG_FN_MAGNIFY_RGB16_X2 3728
#define MNG_FN_MAGNIFY_GA16_X1 3729
#define MNG_FN_MAGNIFY_GA16_X2 3730
#define MNG_FN_MAGNIFY_GA16_X3 3731
#define MNG_FN_MAGNIFY_GA16_X4 3732
#define MNG_FN_MAGNIFY_RGBA16_X1 3733
#define MNG_FN_MAGNIFY_RGBA16_X2 3734
#define MNG_FN_MAGNIFY_RGBA16_X3 3735
#define MNG_FN_MAGNIFY_RGBA16_X4 3736
#define MNG_FN_MAGNIFY_G16_X3 3737
#define MNG_FN_MAGNIFY_RGB16_X3 3738
#define MNG_FN_MAGNIFY_GA16_X5 3739
#define MNG_FN_MAGNIFY_RGBA16_X5 3740
#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_MAGNIFY_G8_Y3 3763
#define MNG_FN_MAGNIFY_RGB8_Y3 3764
#define MNG_FN_MAGNIFY_GA8_Y5 3765
#define MNG_FN_MAGNIFY_RGBA8_Y5 3766
#define MNG_FN_MAGNIFY_G16_Y1 3775
#define MNG_FN_MAGNIFY_G16_Y2 3776
#define MNG_FN_MAGNIFY_RGB16_Y1 3777
#define MNG_FN_MAGNIFY_RGB16_Y2 3778
#define MNG_FN_MAGNIFY_GA16_Y1 3779
#define MNG_FN_MAGNIFY_GA16_Y2 3780
#define MNG_FN_MAGNIFY_GA16_Y3 3781
#define MNG_FN_MAGNIFY_GA16_Y4 3782
#define MNG_FN_MAGNIFY_RGBA16_Y1 3783
#define MNG_FN_MAGNIFY_RGBA16_Y2 3784
#define MNG_FN_MAGNIFY_RGBA16_Y3 3785
#define MNG_FN_MAGNIFY_RGBA16_Y4 3786
#define MNG_FN_MAGNIFY_G16_Y3 3787
#define MNG_FN_MAGNIFY_RGB16_Y3 3788
#define MNG_FN_MAGNIFY_GA16_Y5 3789
#define MNG_FN_MAGNIFY_RGBA16_Y5 3790
/* ************************************************************************** */
#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
#define MNG_FN_PROMOTE_G8_G8 3901
#define MNG_FN_PROMOTE_G8_G16 3902
#define MNG_FN_PROMOTE_G16_G16 3903
#define MNG_FN_PROMOTE_G8_GA8 3904
#define MNG_FN_PROMOTE_G8_GA16 3905
#define MNG_FN_PROMOTE_G16_GA16 3906
#define MNG_FN_PROMOTE_G8_RGB8 3907
#define MNG_FN_PROMOTE_G8_RGB16 3908
#define MNG_FN_PROMOTE_G16_RGB16 3909
#define MNG_FN_PROMOTE_G8_RGBA8 3910
#define MNG_FN_PROMOTE_G8_RGBA16 3911
#define MNG_FN_PROMOTE_G16_RGBA16 3912
#define MNG_FN_PROMOTE_GA8_GA16 3913
#define MNG_FN_PROMOTE_GA8_RGBA8 3914
#define MNG_FN_PROMOTE_GA8_RGBA16 3915
#define MNG_FN_PROMOTE_GA16_RGBA16 3916
#define MNG_FN_PROMOTE_RGB8_RGB16 3917
#define MNG_FN_PROMOTE_RGB8_RGBA8 3918
#define MNG_FN_PROMOTE_RGB8_RGBA16 3919
#define MNG_FN_PROMOTE_RGB16_RGBA16 3920
#define MNG_FN_PROMOTE_RGBA8_RGBA16 3921
#define MNG_FN_PROMOTE_IDX8_RGB8 3922
#define MNG_FN_PROMOTE_IDX8_RGB16 3923
#define MNG_FN_PROMOTE_IDX8_RGBA8 3924
#define MNG_FN_PROMOTE_IDX8_RGBA16 3925
#define MNG_FN_SCALE_G1_G2 4001
#define MNG_FN_SCALE_G1_G4 4002
#define MNG_FN_SCALE_G1_G8 4003
#define MNG_FN_SCALE_G1_G16 4004
#define MNG_FN_SCALE_G2_G4 4005
#define MNG_FN_SCALE_G2_G8 4006
#define MNG_FN_SCALE_G2_G16 4007
#define MNG_FN_SCALE_G4_G8 4008
#define MNG_FN_SCALE_G4_G16 4009
#define MNG_FN_SCALE_G8_G16 4010
#define MNG_FN_SCALE_GA8_GA16 4011
#define MNG_FN_SCALE_RGB8_RGB16 4012
#define MNG_FN_SCALE_RGBA8_RGBA16 4013
#define MNG_FN_SCALE_G2_G1 4021
#define MNG_FN_SCALE_G4_G1 4022
#define MNG_FN_SCALE_G8_G1 4023
#define MNG_FN_SCALE_G16_G1 4024
#define MNG_FN_SCALE_G4_G2 4025
#define MNG_FN_SCALE_G8_G2 4026
#define MNG_FN_SCALE_G16_G2 4027
#define MNG_FN_SCALE_G8_G4 4028
#define MNG_FN_SCALE_G16_G4 4029
#define MNG_FN_SCALE_G16_G8 4030
#define MNG_FN_SCALE_GA16_GA8 4031
#define MNG_FN_SCALE_RGB16_RGB8 4032
#define MNG_FN_SCALE_RGBA16_RGBA8 4033
#define MNG_FN_COMPOSEOVER_RGBA8 4501
#define MNG_FN_COMPOSEOVER_RGBA16 4502
#define MNG_FN_COMPOSEUNDER_RGBA8 4503
#define MNG_FN_COMPOSEUNDER_RGBA16 4504
#define MNG_FN_FLIP_RGBA8 4521
#define MNG_FN_FLIP_RGBA16 4522
#define MNG_FN_TILE_RGBA8 4523
#define MNG_FN_TILE_RGBA16 4524
/* ************************************************************************** */
/* * * */
/* * Trace string-table entry * */
/* * * */
/* ************************************************************************** */
typedef struct {
mng_uint32 iFunction;
mng_pchar zTracetext;
} mng_trace_entry;
typedef mng_trace_entry const * mng_trace_entryp;
/* ************************************************************************** */
#endif /* MNG_INCLUDE_TRACE_PROCS */
/* ************************************************************************** */
#endif /* _libmng_trace_h_ */
/* ************************************************************************** */
/* * end of file * */
/* ************************************************************************** */
libmng-2.0.3/libmng_hlapi.c 0000644 0001750 0001750 00000330174 12005307152 015454 0 ustar glennrp glennrp #include "config.h"
/* ************************************************************************** */
/* * For conditions of distribution and use, * */
/* * see copyright notice in libmng.h * */
/* ************************************************************************** */
/* * * */
/* * project : libmng * */
/* * file : libmng_hlapi.c copyright (c) 2000-2007 G.Juyn * */
/* * version : 1.0.10 * */
/* * * */
/* * purpose : high-level application API (implementation) * */
/* * * */
/* * author : G.Juyn * */
/* * * */
/* * comment : implementation of the high-level function interface * */
/* * for applications. * */
/* * * */
/* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */
/* * - added init of iPLTEcount * */
/* * 0.5.1 - 05/08/2000 - G.Juyn * */
/* * - changed calling-convention definition * */
/* * - changed status-handling of display-routines * */
/* * - added versioning-control routines * */
/* * - filled the write routine * */
/* * - changed strict-ANSI stuff * */
/* * 0.5.1 - 05/11/2000 - G.Juyn * */
/* * - added callback error-reporting support * */
/* * 0.5.1 - 05/12/2000 - G.Juyn * */
/* * - changed trace to macro for callback error-reporting * */
/* * 0.5.1 - 05/13/2000 - G.Juyn * */
/* * - added eMNGma hack (will be removed in 1.0.0 !!!) * */
/* * - added TERM animation object pointer (easier reference) * */
/* * 0.5.1 - 05/14/2000 - G.Juyn * */
/* * - added cleanup of saved-data (SAVE/SEEK processing) * */
/* * 0.5.1 - 05/16/2000 - G.Juyn * */
/* * - moved the actual write_graphic functionality from here * */
/* * to its appropriate function in the mng_write module * */
/* * * */
/* * 0.5.2 - 05/19/2000 - G.Juyn * */
/* * - cleaned up some code regarding mixed support * */
/* * - added JNG support * */
/* * 0.5.2 - 05/24/2000 - G.Juyn * */
/* * - moved init of default zlib parms here from "mng_zlib.c" * */
/* * - added init of default IJG parms * */
/* * 0.5.2 - 05/29/2000 - G.Juyn * */
/* * - fixed inconsistancy with freeing global iCCP profile * */
/* * 0.5.2 - 05/30/2000 - G.Juyn * */
/* * - added delta-image field initialization * */
/* * 0.5.2 - 06/06/2000 - G.Juyn * */
/* * - added initialization of the buffer-suspend parameter * */
/* * * */
/* * 0.5.3 - 06/16/2000 - G.Juyn * */
/* * - added initialization of update-region for refresh * */
/* * - added initialization of Needrefresh parameter * */
/* * 0.5.3 - 06/17/2000 - G.Juyn * */
/* * - added initialization of Deltaimmediate * */
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
/* * - added initialization of Speed * */
/* * - added initialization of Imagelevel * */
/* * 0.5.3 - 06/26/2000 - G.Juyn * */
/* * - changed userdata variable to mng_ptr * */
/* * 0.5.3 - 06/29/2000 - G.Juyn * */
/* * - fixed initialization routine for new mng_handle type * */
/* * * */
/* * 0.9.1 - 07/06/2000 - G.Juyn * */
/* * - changed mng_display_resume to allow to be called after * */
/* * a suspension return with MNG_NEEDMOREDATA * */
/* * - added returncode MNG_NEEDTIMERWAIT for timer breaks * */
/* * 0.9.1 - 07/07/2000 - G.Juyn * */
/* * - implemented support for freeze/reset/resume & go_xxxx * */
/* * 0.9.1 - 07/08/2000 - G.Juyn * */
/* * - added support for improved timing * */
/* * - added support for improved I/O-suspension * */
/* * 0.9.1 - 07/14/2000 - G.Juyn * */
/* * - changed EOF processing behavior * */
/* * 0.9.1 - 07/15/2000 - G.Juyn * */
/* * - added callbacks for SAVE/SEEK processing * */
/* * - added variable for NEEDSECTIONWAIT breaks * */
/* * - added variable for freeze & reset processing * */
/* * 0.9.1 - 07/17/2000 - G.Juyn * */
/* * - added error cleanup processing * */
/* * - fixed support for mng_display_reset() * */
/* * - fixed suspension-buffering for 32K+ chunks * */
/* * * */
/* * 0.9.2 - 07/29/2000 - G.Juyn * */
/* * - fixed small bugs in display processing * */
/* * 0.9.2 - 07/31/2000 - G.Juyn * */
/* * - fixed wrapping of suspension parameters * */
/* * 0.9.2 - 08/04/2000 - G.Juyn * */
/* * - B111096 - fixed large-buffer read-suspension * */
/* * 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 separate 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 * */
/* * * */
/* * 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 * */
/* * * */
/* * 1.0.2 - 06/23/2001 - G.Juyn * */
/* * - added optimization option for MNG-video playback * */
/* * - added processterm callback * */
/* * 1.0.2 - 06/25/2001 - G.Juyn * */
/* * - added option to turn off progressive refresh * */
/* * * */
/* * 1.0.5 - 07/08/2002 - G.Juyn * */
/* * - B578572 - removed eMNGma hack (thanks Dimitri!) * */
/* * 1.0.5 - 07/16/2002 - G.Juyn * */
/* * - B581625 - large chunks fail with suspension reads * */
/* * 1.0.5 - 08/19/2002 - G.Juyn * */
/* * - B597134 - libmng pollutes the linker namespace * */
/* * 1.0.5 - 09/15/2002 - G.Juyn * */
/* * - fixed LOOP iteration=0 special case * */
/* * 1.0.5 - 10/07/2002 - G.Juyn * */
/* * - added another fix for misplaced TERM chunk * */
/* * - completed support for condition=2 in TERM chunk * */
/* * - added beta version function & constant * */
/* * 1.0.5 - 10/11/2002 - G.Juyn * */
/* * - added mng_status_dynamic to supports function * */
/* * 1.0.5 - 11/04/2002 - G.Juyn * */
/* * - changed FRAMECOUNT/LAYERCOUNT/PLAYTIME error to warning * */
/* * 1.0.5 - 11/07/2002 - G.Juyn * */
/* * - added support to get totals after mng_read() * */
/* * 1.0.5 - 11/29/2002 - G.Juyn * */
/* * - fixed goxxxxx() support for zero values * */
/* * * */
/* * 1.0.6 - 05/25/2003 - G.R-P * */
/* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */
/* * 1.0.6 - 07/11/2003 - G.R-P * */
/* * - added conditionals zlib and jpeg property accessors * */
/* * 1.0.6 - 07/14/2003 - G.R-P * */
/* * - added conditionals around "mng_display_go*" and other * */
/* * unused functions * */
/* * 1.0.6 - 07/29/2003 - G.R-P * */
/* * - added conditionals around PAST chunk support * */
/* * * */
/* * 1.0.7 - 03/07/2004 - G. Randers-Pehrson * */
/* * - put gamma, cms-related declarations inside #ifdef * */
/* * 1.0.7 - 03/10/2004 - G.R-P * */
/* * - added conditionals around openstream/closestream * */
/* * 1.0.7 - 03/24/2004 - G.R-P * */
/* * - fixed zTXT -> zTXt typo * */
/* * * */
/* * 1.0.8 - 04/02/2004 - G.Juyn * */
/* * - added CRC existence & checking flags * */
/* * 1.0.8 - 04/10/2004 - G.Juyn * */
/* * - added data-push mechanisms for specialized decoders * */
/* * 1.0.8 - 07/06/2004 - G.R-P * */
/* * - defend against using undefined openstream function * */
/* * 1.0.8 - 08/02/2004 - G.Juyn * */
/* * - added conditional to allow easier writing of large MNG's * */
/* * * */
/* * 1.0.9 - 08/17/2004 - G.R-P * */
/* * - added more SKIPCHUNK conditionals * */
/* * 1.0.9 - 09/25/2004 - G.Juyn * */
/* * - replaced MNG_TWEAK_LARGE_FILES with permanent solution * */
/* * 1.0.9 - 10/03/2004 - G.Juyn * */
/* * - added function to retrieve current FRAM delay * */
/* * 1.0.9 - 12/20/2004 - G.Juyn * */
/* * - cleaned up macro-invocations (thanks to D. Airlie) * */
/* * * */
/* * 1.0.10 - 07/06/2005 - G.R-P * */
/* * - added more SKIPCHUNK conditionals * */
/* * 1.0.10 - 04/08/2007 - G.Juyn * */
/* * - added support for mPNG proposal * */
/* * 1.0.10 - 04/12/2007 - G.Juyn * */
/* * - added support for ANG proposal * */
/* * 1.0.10 - 07/06/2007 - G.R-P bugfix by Lucas Quintana * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
#include "libmng_data.h"
#include "libmng_error.h"
#include "libmng_trace.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "libmng_objects.h"
#include "libmng_object_prc.h"
#include "libmng_chunks.h"
#include "libmng_memory.h"
#include "libmng_read.h"
#include "libmng_write.h"
#include "libmng_display.h"
#include "libmng_zlib.h"
#include "libmng_jpeg.h"
#include "libmng_cms.h"
#include "libmng_pixels.h"
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
#pragma option -A /* force ANSI-C */
#endif
/* ************************************************************************** */
/* * * */
/* * local routines * */
/* * * */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_DISPLAY
MNG_LOCAL mng_retcode mng_drop_objects (mng_datap pData,
mng_bool bDropaniobj)
{
mng_objectp pObject;
mng_objectp pNext;
mng_cleanupobject fCleanup;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DROP_OBJECTS, MNG_LC_START);
#endif
pObject = pData->pFirstimgobj; /* get first stored image-object (if any) */
while (pObject) /* more objects to discard ? */
{
pNext = ((mng_object_headerp)pObject)->pNext;
/* call appropriate cleanup */
fCleanup = ((mng_object_headerp)pObject)->fCleanup;
fCleanup (pData, pObject);
pObject = pNext; /* neeeext */
}
pData->pFirstimgobj = MNG_NULL; /* clean this up!!! */
pData->pLastimgobj = MNG_NULL;
if (bDropaniobj) /* drop animation objects ? */
{
pObject = pData->pFirstaniobj; /* get first stored animation-object (if any) */
while (pObject) /* more objects to discard ? */
{
pNext = ((mng_object_headerp)pObject)->pNext;
/* call appropriate cleanup */
fCleanup = ((mng_object_headerp)pObject)->fCleanup;
fCleanup (pData, pObject);
pObject = pNext; /* neeeext */
}
pData->pFirstaniobj = MNG_NULL; /* clean this up!!! */
pData->pLastaniobj = MNG_NULL;
#ifdef MNG_SUPPORT_DYNAMICMNG
pObject = pData->pFirstevent; /* get first event-object (if any) */
while (pObject) /* more objects to discard ? */
{
pNext = ((mng_object_headerp)pObject)->pNext;
/* call appropriate cleanup */
fCleanup = ((mng_object_headerp)pObject)->fCleanup;
fCleanup (pData, pObject);
pObject = pNext; /* neeeext */
}
pData->pFirstevent = MNG_NULL; /* clean this up!!! */
pData->pLastevent = MNG_NULL;
#endif
}
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
if (pData->pMPNG) /* drop MPNG data (if any) */
{
fCleanup = ((mng_object_headerp)pData->pMPNG)->fCleanup;
fCleanup (pData, pData->pMPNG);
pData->pMPNG = MNG_NULL;
}
#endif
#ifdef MNG_INCLUDE_ANG_PROPOSAL
if (pData->pANG) /* drop ANG data (if any) */
{
fCleanup = ((mng_object_headerp)pData->pANG)->fCleanup;
fCleanup (pData, pData->pANG);
pData->pANG = MNG_NULL;
}
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DROP_OBJECTS, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_SUPPORT_DISPLAY */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_DISPLAY
#ifndef MNG_SKIPCHUNK_SAVE
MNG_LOCAL mng_retcode mng_drop_savedata (mng_datap pData)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DROP_SAVEDATA, MNG_LC_START);
#endif
if (pData->pSavedata) /* sanity check */
{ /* address it more directly */
mng_savedatap pSave = pData->pSavedata;
if (pSave->iGlobalProfilesize) /* cleanup the profile ? */
MNG_FREEX (pData, pSave->pGlobalProfile, pSave->iGlobalProfilesize);
/* cleanup the save structure */
MNG_FREE (pData, pData->pSavedata, sizeof (mng_savedata));
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (pData, MNG_FN_DROP_SAVEDATA, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
#endif /* MNG_SUPPORT_DISPLAY */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_DISPLAY
MNG_LOCAL mng_retcode mng_reset_rundata (mng_datap pData)
{
mng_drop_invalid_objects (pData); /* drop invalidly stored objects */
#ifndef MNG_SKIPCHUNK_SAVE
mng_drop_savedata (pData); /* drop stored savedata */
#endif
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->bSkipping = MNG_FALSE;
#ifdef MNG_SUPPORT_DYNAMICMNG
pData->bRunningevent = MNG_FALSE;
pData->bStopafterseek = MNG_FALSE;
pData->iEventx = 0;
pData->iEventy = 0;
pData->pLastmousemove = MNG_NULL;
#endif
pData->iRequestframe = 0;
pData->iRequestlayer = 0;
pData->iRequesttime = 0;
pData->bSearching = MNG_FALSE;
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->bOnlyfirstframe = MNG_FALSE;
pData->iFramesafterTERM = 0;
pData->iIterations = 0;
/* start of animation objects! */
pData->pCurraniobj = MNG_NULL;
pData->iUpdateleft = 0; /* reset region */
pData->iUpdateright = 0;
pData->iUpdatetop = 0;
pData->iUpdatebottom = 0;
pData->iPLTEcount = 0; /* reset PLTE data */
#ifndef MNG_SKIPCHUNK_DEFI
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;
#endif
#ifndef MNG_SKIPCHUNK_BACK
pData->iBACKred = 0; /* reset BACK data */
pData->iBACKgreen = 0;
pData->iBACKblue = 0;
pData->iBACKmandatory = 0;
pData->iBACKimageid = 0;
pData->iBACKtile = 0;
#endif
#ifndef MNG_SKIPCHUNK_FRAM
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;
#endif
#ifndef MNG_SKIPCHUNK_SHOW
pData->iSHOWmode = 0; /* reset SHOW data */
pData->iSHOWfromid = 0;
pData->iSHOWtoid = 0;
pData->iSHOWnextid = 0;
pData->iSHOWskip = 0;
#endif
pData->iGlobalPLTEcount = 0; /* reset global PLTE data */
pData->iGlobalTRNSrawlen = 0; /* reset global tRNS data */
pData->iGlobalGamma = 0; /* reset global gAMA data */
#ifndef MNG_SKIPCHUNK_cHRM
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;
#endif
#ifndef MNG_SKIPCHUNK_sRGB
pData->iGlobalRendintent = 0; /* reset global sRGB data */
#endif
#ifndef MNG_SKIPCHUNK_iCCP
if (pData->iGlobalProfilesize) /* drop global profile (if any) */
MNG_FREE (pData, pData->pGlobalProfile, pData->iGlobalProfilesize);
pData->iGlobalProfilesize = 0;
#endif
#ifndef MNG_SKIPCHUNK_bKGD
pData->iGlobalBKGDred = 0; /* reset global bKGD data */
pData->iGlobalBKGDgreen = 0;
pData->iGlobalBKGDblue = 0;
#endif
#ifndef MNG_NO_DELTA_PNG
/* 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;
pData->fDeltagetrow = MNG_NULL;
pData->fDeltaaddrow = MNG_NULL;
pData->fDeltareplacerow = MNG_NULL;
pData->fDeltaputrow = MNG_NULL;
pData->fPromoterow = MNG_NULL;
pData->fPromBitdepth = MNG_NULL;
pData->pPromBuf = MNG_NULL;
pData->iPromColortype = 0;
pData->iPromBitdepth = 0;
pData->iPromFilltype = 0;
pData->iPromWidth = 0;
pData->pPromSrc = MNG_NULL;
pData->pPromDst = MNG_NULL;
#endif
#ifndef MNG_SKIPCHUNK_MAGN
pData->iMAGNfromid = 0;
pData->iMAGNtoid = 0;
#endif
#ifndef MNG_SKIPCHUNK_PAST
pData->iPastx = 0;
pData->iPasty = 0;
#endif
pData->pLastseek = MNG_NULL;
return MNG_NOERROR;
}
#endif /* MNG_SUPPORT_DISPLAY */
/* ************************************************************************** */
MNG_LOCAL void cleanup_errors (mng_datap pData)
{
pData->iErrorcode = MNG_NOERROR;
pData->iSeverity = 0;
pData->iErrorx1 = 0;
pData->iErrorx2 = 0;
pData->zErrortext = MNG_NULL;
return;
}
/* ************************************************************************** */
#ifdef MNG_SUPPORT_READ
MNG_LOCAL mng_retcode make_pushbuffer (mng_datap pData,
mng_ptr pPushdata,
mng_size_t iLength,
mng_bool bTakeownership,
mng_pushdatap * pPush)
{
mng_pushdatap pTemp;
MNG_ALLOC (pData, pTemp, sizeof(mng_pushdata));
pTemp->pNext = MNG_NULL;
if (bTakeownership) /* are we going to own the buffer? */
{ /* then just copy the pointer */
pTemp->pData = (mng_uint8p)pPushdata;
}
else
{ /* otherwise create new buffer */
MNG_ALLOCX (pData, pTemp->pData, iLength);
if (!pTemp->pData) /* succeeded? */
{
MNG_FREEX (pData, pTemp, sizeof(mng_pushdata));
MNG_ERROR (pData, MNG_OUTOFMEMORY);
}
/* and copy the bytes across */
MNG_COPY (pTemp->pData, pPushdata, iLength);
}
pTemp->iLength = iLength;
pTemp->bOwned = bTakeownership;
pTemp->pDatanext = pTemp->pData;
pTemp->iRemaining = iLength;
*pPush = pTemp; /* return it */
return MNG_NOERROR; /* and all's well */
}
#endif
#ifdef MNG_VERSION_QUERY_SUPPORT
/* ************************************************************************** */
/* * * */
/* * Versioning control * */
/* * * */
/* ************************************************************************** */
mng_pchar MNG_DECL mng_version_text (void)
{
return MNG_VERSION_TEXT;
}
/* ************************************************************************** */
mng_uint8 MNG_DECL mng_version_so (void)
{
return MNG_VERSION_SO;
}
/* ************************************************************************** */
mng_uint8 MNG_DECL mng_version_dll (void)
{
return MNG_VERSION_DLL;
}
/* ************************************************************************** */
mng_uint8 MNG_DECL mng_version_major (void)
{
return MNG_VERSION_MAJOR;
}
/* ************************************************************************** */
mng_uint8 MNG_DECL mng_version_minor (void)
{
return MNG_VERSION_MINOR;
}
/* ************************************************************************** */
mng_uint8 MNG_DECL mng_version_release (void)
{
return MNG_VERSION_RELEASE;
}
/* ************************************************************************** */
mng_bool MNG_DECL mng_version_beta (void)
{
return MNG_VERSION_BETA;
}
#endif
/* ************************************************************************** */
/* * * */
/* * 'supports' function * */
/* * * */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_FUNCQUERY
typedef struct {
mng_pchar zFunction;
mng_uint8 iMajor; /* Major == 0 means not implemented ! */
mng_uint8 iMinor;
mng_uint8 iRelease;
} mng_func_entry;
typedef mng_func_entry const * mng_func_entryp;
MNG_LOCAL mng_func_entry const func_table [] =
{ /* keep it alphabetically sorted !!!!! */
{"mng_cleanup", 1, 0, 0},
{"mng_copy_chunk", 1, 0, 5},
{"mng_create", 1, 0, 0},
{"mng_display", 1, 0, 0},
{"mng_display_freeze", 1, 0, 0},
#ifndef MNG_NO_DISPLAY_GO_SUPPORTED
{"mng_display_goframe", 1, 0, 0},
{"mng_display_golayer", 1, 0, 0},
{"mng_display_gotime", 1, 0, 0},
#endif
{"mng_display_reset", 1, 0, 0},
{"mng_display_resume", 1, 0, 0},
{"mng_get_alphabitdepth", 1, 0, 0},
{"mng_get_alphacompression", 1, 0, 0},
{"mng_get_alphadepth", 1, 0, 0},
{"mng_get_alphafilter", 1, 0, 0},
{"mng_get_alphainterlace", 1, 0, 0},
{"mng_get_bgcolor", 1, 0, 0},
{"mng_get_bitdepth", 1, 0, 0},
{"mng_get_bkgdstyle", 1, 0, 0},
{"mng_get_cacheplayback", 1, 0, 2},
{"mng_get_canvasstyle", 1, 0, 0},
{"mng_get_colortype", 1, 0, 0},
{"mng_get_compression", 1, 0, 0},
#ifndef MNG_NO_CURRENT_INFO
{"mng_get_currentframe", 1, 0, 0},
{"mng_get_currentlayer", 1, 0, 0},
{"mng_get_currentplaytime", 1, 0, 0},
#endif
{"mng_get_currframdelay", 1, 0, 9},
#ifndef MNG_NO_DFLT_INFO
{"mng_get_dfltimggamma", 1, 0, 0},
{"mng_get_dfltimggammaint", 1, 0, 0},
#endif
{"mng_get_displaygamma", 1, 0, 0},
{"mng_get_displaygammaint", 1, 0, 0},
{"mng_get_doprogressive", 1, 0, 2},
{"mng_get_filter", 1, 0, 0},
{"mng_get_framecount", 1, 0, 0},
{"mng_get_imageheight", 1, 0, 0},
{"mng_get_imagelevel", 1, 0, 0},
{"mng_get_imagetype", 1, 0, 0},
{"mng_get_imagewidth", 1, 0, 0},
{"mng_get_interlace", 1, 0, 0},
#ifdef MNG_ACCESS_JPEG
{"mng_get_jpeg_dctmethod", 1, 0, 0},
{"mng_get_jpeg_maxjdat", 1, 0, 0},
{"mng_get_jpeg_optimized", 1, 0, 0},
{"mng_get_jpeg_progressive", 1, 0, 0},
{"mng_get_jpeg_quality", 1, 0, 0},
{"mng_get_jpeg_smoothing", 1, 0, 0},
#endif
{"mng_get_lastbackchunk", 1, 0, 3},
{"mng_get_lastseekname", 1, 0, 5},
{"mng_get_layercount", 1, 0, 0},
#ifndef MNG_SKIP_MAXCANVAS
{"mng_get_maxcanvasheight", 1, 0, 0},
{"mng_get_maxcanvaswidth", 1, 0, 0},
#endif
{"mng_get_playtime", 1, 0, 0},
{"mng_get_refreshpass", 1, 0, 0},
{"mng_get_runtime", 1, 0, 0},
{"mng_get_sectionbreaks", 1, 0, 0},
{"mng_get_sigtype", 1, 0, 0},
{"mng_get_simplicity", 1, 0, 0},
{"mng_get_speed", 1, 0, 0},
{"mng_get_srgb", 1, 0, 0},
{"mng_get_starttime", 1, 0, 0},
{"mng_get_storechunks", 1, 0, 0},
{"mng_get_suspensionmode", 1, 0, 0},
{"mng_get_ticks", 1, 0, 0},
#ifndef MNG_NO_CURRENT_INFO
{"mng_get_totalframes", 1, 0, 5},
{"mng_get_totallayers", 1, 0, 5},
{"mng_get_totalplaytime", 1, 0, 5},
#endif
{"mng_get_usebkgd", 1, 0, 0},
{"mng_get_userdata", 1, 0, 0},
#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS)
{"mng_get_viewgamma", 1, 0, 0},
{"mng_get_viewgammaint", 1, 0, 0},
#endif
#ifdef MNG_ACCESS_ZLIB
{"mng_get_zlib_level", 1, 0, 0},
{"mng_get_zlib_maxidat", 1, 0, 0},
{"mng_get_zlib_memlevel", 1, 0, 0},
{"mng_get_zlib_method", 1, 0, 0},
{"mng_get_zlib_strategy", 1, 0, 0},
{"mng_get_zlib_windowbits", 1, 0, 0},
#endif
#ifndef MNG_NO_OPEN_CLOSE_STREAM
{"mng_getcb_closestream", 1, 0, 0},
#endif
{"mng_getcb_errorproc", 1, 0, 0},
{"mng_getcb_getalphaline", 1, 0, 0},
{"mng_getcb_getbkgdline", 1, 0, 0},
{"mng_getcb_getcanvasline", 1, 0, 0},
{"mng_getcb_gettickcount", 1, 0, 0},
{"mng_getcb_memalloc", 1, 0, 0},
{"mng_getcb_memfree", 1, 0, 0},
#ifndef MNG_NO_OPEN_CLOSE_STREAM
{"mng_getcb_openstream", 1, 0, 0},
#endif
{"mng_getcb_processarow", 1, 0, 0},
{"mng_getcb_processchroma", 1, 0, 0},
{"mng_getcb_processgamma", 1, 0, 0},
{"mng_getcb_processheader", 1, 0, 0},
{"mng_getcb_processiccp", 1, 0, 0},
{"mng_getcb_processmend", 1, 0, 1},
{"mng_getcb_processneed", 1, 0, 0},
{"mng_getcb_processsave", 1, 0, 0},
{"mng_getcb_processseek", 1, 0, 0},
{"mng_getcb_processsrgb", 1, 0, 0},
{"mng_getcb_processterm", 1, 0, 2},
{"mng_getcb_processtext", 1, 0, 0},
{"mng_getcb_processunknown", 1, 0, 0},
{"mng_getcb_readdata", 1, 0, 0},
{"mng_getcb_refresh", 1, 0, 0},
{"mng_getcb_releasedata", 1, 0, 8},
{"mng_getcb_settimer", 1, 0, 0},
{"mng_getcb_traceproc", 1, 0, 0},
{"mng_getcb_writedata", 1, 0, 0},
{"mng_getchunk_back", 1, 0, 0},
{"mng_getchunk_basi", 1, 0, 0},
#ifndef MNG_SKIPCHUNK_bKGD
{"mng_getchunk_bkgd", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_cHRM
{"mng_getchunk_chrm", 1, 0, 0},
#endif
{"mng_getchunk_clip", 1, 0, 0},
{"mng_getchunk_clon", 1, 0, 0},
#ifndef MNG_NO_DELTA_PNG
#ifndef MNG_SKIPCHUNK_dBYK
{"mng_getchunk_dbyk", 1, 0, 0},
#endif
#endif
{"mng_getchunk_defi", 1, 0, 0},
#ifndef MNG_NO_DELTA_PNG
{"mng_getchunk_dhdr", 1, 0, 0},
#endif
{"mng_getchunk_disc", 1, 0, 0},
#ifndef MNG_NO_DELTA_PNG
{"mng_getchunk_drop", 1, 0, 0},
#endif
{"mng_getchunk_endl", 1, 0, 0},
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
{"mng_getchunk_mpng", 1, 0, 10},
{"mng_getchunk_mpng_frame", 1, 0, 10},
#endif
#ifndef MNG_SKIPCHUNK_evNT
{"mng_getchunk_evnt", 1, 0, 5},
{"mng_getchunk_evnt_entry", 1, 0, 5},
#endif
#ifndef MNG_SKIPCHUNK_eXPI
{"mng_getchunk_expi", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_fPRI
{"mng_getchunk_fpri", 1, 0, 0},
#endif
{"mng_getchunk_fram", 1, 0, 0},
{"mng_getchunk_gama", 1, 0, 0},
#ifndef MNG_SKIPCHUNK_hIST
{"mng_getchunk_hist", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_iCCP
{"mng_getchunk_iccp", 1, 0, 0},
#endif
{"mng_getchunk_idat", 1, 0, 0},
{"mng_getchunk_iend", 1, 0, 0},
{"mng_getchunk_ihdr", 1, 0, 0},
#ifndef MNG_NO_DELTA_PNG
#ifdef MNG_INCLUDE_JNG
{"mng_getchunk_ijng", 1, 0, 0},
#endif
{"mng_getchunk_ipng", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_iTXt
{"mng_getchunk_itxt", 1, 0, 0},
#endif
#ifdef MNG_INCLUDE_JNG
{"mng_getchunk_jdaa", 1, 0, 0},
{"mng_getchunk_jdat", 1, 0, 0},
{"mng_getchunk_jhdr", 1, 0, 0},
{"mng_getchunk_jsep", 1, 0, 0},
#endif
{"mng_getchunk_loop", 1, 0, 0},
#ifndef MNG_SKIPCHUNK_MAGN
{"mng_getchunk_magn", 1, 0, 0},
#endif
{"mng_getchunk_mend", 1, 0, 0},
{"mng_getchunk_mhdr", 1, 0, 0},
{"mng_getchunk_move", 1, 0, 0},
#ifndef MNG_SKIPCHUNK_nEED
{"mng_getchunk_need", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_ORDR
#ifndef MNG_NO_DELTA_PNG
{"mng_getchunk_ordr", 1, 0, 0},
{"mng_getchunk_ordr_entry", 1, 0, 0},
#endif
#endif
#ifndef MNG_SKIPCHUNK_PAST
{"mng_getchunk_past", 1, 0, 0},
{"mng_getchunk_past_src", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_pHYg
{"mng_getchunk_phyg", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_pHYs
{"mng_getchunk_phys", 1, 0, 0},
#endif
#ifndef MNG_NO_DELTA_PNG
{"mng_getchunk_plte", 1, 0, 0},
{"mng_getchunk_pplt", 1, 0, 0},
{"mng_getchunk_pplt_entry", 1, 0, 0},
{"mng_getchunk_prom", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_SAVE
{"mng_getchunk_save", 1, 0, 0},
{"mng_getchunk_save_entry", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_sBIT
{"mng_getchunk_sbit", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_SEEK
{"mng_getchunk_seek", 1, 0, 0},
#endif
{"mng_getchunk_show", 1, 0, 0},
#ifndef MNG_SKIPCHUNK_sPLT
{"mng_getchunk_splt", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_sRGB
{"mng_getchunk_srgb", 1, 0, 0},
#endif
{"mng_getchunk_term", 1, 0, 0},
#ifndef MNG_SKIPCHUNK_tEXt
{"mng_getchunk_text", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_tIME
{"mng_getchunk_time", 1, 0, 0},
#endif
{"mng_getchunk_trns", 1, 0, 0},
{"mng_getchunk_unkown", 1, 0, 0},
#ifndef MNG_SKIPCHUNK_zTXt
{"mng_getchunk_ztxt", 1, 0, 0},
#endif
{"mng_getimgdata_chunk", 0, 0, 0},
{"mng_getimgdata_chunkseq", 0, 0, 0},
{"mng_getimgdata_seq", 0, 0, 0},
{"mng_getlasterror", 1, 0, 0},
{"mng_initialize", 1, 0, 0},
{"mng_iterate_chunks", 1, 0, 0},
{"mng_putchunk_back", 1, 0, 0},
#ifndef MNG_SKIPCHUNK_BASI
{"mng_putchunk_basi", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_bKGD
{"mng_putchunk_bkgd", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_cHRM
{"mng_putchunk_chrm", 1, 0, 0},
#endif
{"mng_putchunk_clip", 1, 0, 0},
{"mng_putchunk_clon", 1, 0, 0},
#ifndef MNG_NO_DELTA_PNG
#ifndef MNG_SKIPCHUNK_DBYK
{"mng_putchunk_dbyk", 1, 0, 0},
#endif
#endif
{"mng_putchunk_defi", 1, 0, 0},
#ifndef MNG_NO_DELTA_PNG
{"mng_putchunk_dhdr", 1, 0, 0},
#endif
{"mng_putchunk_disc", 1, 0, 0},
#ifndef MNG_NO_DELTA_PNG
{"mng_putchunk_drop", 1, 0, 0},
#endif
{"mng_putchunk_endl", 1, 0, 0},
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
{"mng_putchunk_mpng", 1, 0, 10},
{"mng_putchunk_mpng_frame", 1, 0, 10},
#endif
#ifndef MNG_SKIPCHUNK_evNT
{"mng_putchunk_evnt", 1, 0, 5},
{"mng_putchunk_evnt_entry", 1, 0, 5},
#endif
#ifndef MNG_SKIPCHUNK_eXPI
{"mng_putchunk_expi", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_fPRI
{"mng_putchunk_fpri", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_FRAM
{"mng_putchunk_fram", 1, 0, 0},
#endif
{"mng_putchunk_gama", 1, 0, 0},
#ifndef MNG_SKIPCHUNK_hIST
{"mng_putchunk_hist", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_iCCP
{"mng_putchunk_iccp", 1, 0, 0},
#endif
{"mng_putchunk_idat", 1, 0, 0},
{"mng_putchunk_iend", 1, 0, 0},
{"mng_putchunk_ihdr", 1, 0, 0},
#ifndef MNG_NO_DELTA_PNG
#ifdef MNG_INCLUDE_JNG
{"mng_putchunk_ijng", 1, 0, 0},
#endif
{"mng_putchunk_ipng", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_iTXt
{"mng_putchunk_itxt", 1, 0, 0},
#endif
#ifdef MNG_INCLUDE_JNG
{"mng_putchunk_jdaa", 1, 0, 0},
{"mng_putchunk_jdat", 1, 0, 0},
{"mng_putchunk_jhdr", 1, 0, 0},
{"mng_putchunk_jsep", 1, 0, 0},
#endif
{"mng_putchunk_loop", 1, 0, 0},
#ifndef MNG_SKIPCHUNK_MAGN
{"mng_putchunk_magn", 1, 0, 0},
#endif
{"mng_putchunk_mend", 1, 0, 0},
{"mng_putchunk_mhdr", 1, 0, 0},
{"mng_putchunk_move", 1, 0, 0},
#ifndef MNG_SKIPCHUNK_nEED
{"mng_putchunk_need", 1, 0, 0},
#endif
#ifndef MNG_NO_DELTA_PNG
#ifndef MNG_SKIPCHUNK_ORDR
{"mng_putchunk_ordr", 1, 0, 0},
{"mng_putchunk_ordr_entry", 1, 0, 0},
#endif
#endif
#ifndef MNG_SKIPCHUNK_PAST
{"mng_putchunk_past", 1, 0, 0},
{"mng_putchunk_past_src", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_pHYg
{"mng_putchunk_phyg", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_pHYs
{"mng_putchunk_phys", 1, 0, 0},
#endif
#ifndef MNG_NO_DELTA_PNG
{"mng_putchunk_plte", 1, 0, 0},
{"mng_putchunk_pplt", 1, 0, 0},
{"mng_putchunk_pplt_entry", 1, 0, 0},
{"mng_putchunk_prom", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_SAVE
{"mng_putchunk_save", 1, 0, 0},
{"mng_putchunk_save_entry", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_sBIT
{"mng_putchunk_sbit", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_SEEK
{"mng_putchunk_seek", 1, 0, 0},
#endif
{"mng_putchunk_show", 1, 0, 0},
#ifndef MNG_SKIPCHUNK_sPLT
{"mng_putchunk_splt", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_sRGB
{"mng_putchunk_srgb", 1, 0, 0},
#endif
{"mng_putchunk_term", 1, 0, 0},
#ifndef MNG_SKIPCHUNK_tEXt
{"mng_putchunk_text", 1, 0, 0},
#endif
#ifndef MNG_SKIPCHUNK_tIME
{"mng_putchunk_time", 1, 0, 0},
#endif
{"mng_putchunk_trns", 1, 0, 0},
{"mng_putchunk_unkown", 1, 0, 0},
#ifndef MNG_SKIPCHUNK_zTXt
{"mng_putchunk_ztxt", 1, 0, 0},
#endif
{"mng_putimgdata_ihdr", 0, 0, 0},
{"mng_putimgdata_jhdr", 0, 0, 0},
{"mng_reset", 1, 0, 0},
{"mng_read", 1, 0, 0},
{"mng_read_pushchunk", 1, 0, 8},
{"mng_read_pushdata", 1, 0, 8},
{"mng_read_pushsig", 1, 0, 8},
{"mng_read_resume", 1, 0, 0},
{"mng_readdisplay", 1, 0, 0},
{"mng_set_bgcolor", 1, 0, 0},
{"mng_set_bkgdstyle", 1, 0, 0},
{"mng_set_cacheplayback", 1, 0, 2},
{"mng_set_canvasstyle", 1, 0, 0},
{"mng_set_dfltimggamma", 1, 0, 0},
#ifndef MNG_NO_DFLT_INFO
{"mng_set_dfltimggammaint", 1, 0, 0},
#endif
{"mng_set_displaygamma", 1, 0, 0},
{"mng_set_displaygammaint", 1, 0, 0},
{"mng_set_doprogressive", 1, 0, 2},
#ifdef MNG_ACCESS_JPEG
{"mng_set_jpeg_dctmethod", 1, 0, 0},
{"mng_set_jpeg_maxjdat", 1, 0, 0},
{"mng_set_jpeg_optimized", 1, 0, 0},
{"mng_set_jpeg_progressive", 1, 0, 0},
{"mng_set_jpeg_quality", 1, 0, 0},
{"mng_set_jpeg_smoothing", 1, 0, 0},
#endif
#ifndef MNG_SKIP_MAXCANVAS
{"mng_set_maxcanvasheight", 1, 0, 0},
{"mng_set_maxcanvassize", 1, 0, 0},
{"mng_set_maxcanvaswidth", 1, 0, 0},
#endif
{"mng_set_outputprofile", 1, 0, 0},
{"mng_set_outputprofile2", 1, 0, 0},
{"mng_set_outputsrgb", 1, 0, 1},
{"mng_set_sectionbreaks", 1, 0, 0},
{"mng_set_speed", 1, 0, 0},
{"mng_set_srgb", 1, 0, 0},
{"mng_set_srgbimplicit", 1, 0, 1},
{"mng_set_srgbprofile", 1, 0, 0},
{"mng_set_srgbprofile2", 1, 0, 0},
{"mng_set_storechunks", 1, 0, 0},
{"mng_set_suspensionmode", 1, 0, 0},
{"mng_set_usebkgd", 1, 0, 0},
{"mng_set_userdata", 1, 0, 0},
#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS)
{"mng_set_viewgamma", 1, 0, 0},
{"mng_set_viewgammaint", 1, 0, 0},
#endif
#ifdef MNG_ACCESS_ZLIB
{"mng_set_zlib_level", 1, 0, 0},
{"mng_set_zlib_maxidat", 1, 0, 0},
{"mng_set_zlib_memlevel", 1, 0, 0},
{"mng_set_zlib_method", 1, 0, 0},
{"mng_set_zlib_strategy", 1, 0, 0},
{"mng_set_zlib_windowbits", 1, 0, 0},
#endif
#ifndef MNG_NO_OPEN_CLOSE_STREAM
{"mng_setcb_closestream", 1, 0, 0},
#endif
{"mng_setcb_errorproc", 1, 0, 0},
{"mng_setcb_getalphaline", 1, 0, 0},
{"mng_setcb_getbkgdline", 1, 0, 0},
{"mng_setcb_getcanvasline", 1, 0, 0},
{"mng_setcb_gettickcount", 1, 0, 0},
{"mng_setcb_memalloc", 1, 0, 0},
{"mng_setcb_memfree", 1, 0, 0},
#ifndef MNG_NO_OPEN_CLOSE_STREAM
{"mng_setcb_openstream", 1, 0, 0},
#endif
{"mng_setcb_processarow", 1, 0, 0},
{"mng_setcb_processchroma", 1, 0, 0},
{"mng_setcb_processgamma", 1, 0, 0},
{"mng_setcb_processheader", 1, 0, 0},
{"mng_setcb_processiccp", 1, 0, 0},
{"mng_setcb_processmend", 1, 0, 1},
{"mng_setcb_processneed", 1, 0, 0},
{"mng_setcb_processsave", 1, 0, 0},
{"mng_setcb_processseek", 1, 0, 0},
{"mng_setcb_processsrgb", 1, 0, 0},
{"mng_setcb_processterm", 1, 0, 2},
{"mng_setcb_processtext", 1, 0, 0},
{"mng_setcb_processunknown", 1, 0, 0},
{"mng_setcb_readdata", 1, 0, 0},
{"mng_setcb_refresh", 1, 0, 0},
{"mng_setcb_releasedata", 1, 0, 8},
{"mng_setcb_settimer", 1, 0, 0},
{"mng_setcb_traceproc", 1, 0, 0},
{"mng_setcb_writedata", 1, 0, 0},
{"mng_status_creating", 1, 0, 0},
{"mng_status_displaying", 1, 0, 0},
{"mng_status_dynamic", 1, 0, 5},
{"mng_status_error", 1, 0, 0},
{"mng_status_reading", 1, 0, 0},
{"mng_status_running", 1, 0, 0},
{"mng_status_runningevent", 1, 0, 5},
{"mng_status_suspendbreak", 1, 0, 0},
{"mng_status_timerbreak", 1, 0, 0},
{"mng_status_writing", 1, 0, 0},
{"mng_supports_func", 1, 0, 5},
{"mng_trapevent", 1, 0, 5},
{"mng_updatemngheader", 1, 0, 0},
{"mng_updatemngsimplicity", 1, 0, 0},
{"mng_version_beta", 1, 0, 5},
{"mng_version_dll", 1, 0, 0},
{"mng_version_major", 1, 0, 0},
{"mng_version_minor", 1, 0, 0},
{"mng_version_release", 1, 0, 0},
{"mng_version_so", 1, 0, 0},
{"mng_version_text", 1, 0, 0},
{"mng_write", 1, 0, 0},
};
mng_bool MNG_DECL mng_supports_func (mng_pchar zFunction,
mng_uint8* iMajor,
mng_uint8* iMinor,
mng_uint8* iRelease)
{
mng_int32 iTop, iLower, iUpper, iMiddle;
mng_func_entryp pEntry; /* pointer to found entry */
/* determine max index of table */
iTop = (sizeof (func_table) / sizeof (func_table [0])) - 1;
iLower = 0; /* initialize binary search */
iMiddle = iTop >> 1; /* start in the middle */
iUpper = iTop;
pEntry = 0; /* no goods yet! */
do /* the binary search itself */
{
mng_int32 iRslt = strcmp(func_table [iMiddle].zFunction, zFunction);
if (iRslt < 0)
iLower = iMiddle + 1;
else if (iRslt > 0)
iUpper = iMiddle - 1;
else
{
pEntry = &func_table [iMiddle];
break;
};
iMiddle = (iLower + iUpper) >> 1;
}
while (iLower <= iUpper);
if (pEntry) /* found it ? */
{
*iMajor = pEntry->iMajor;
*iMinor = pEntry->iMinor;
*iRelease = pEntry->iRelease;
return MNG_TRUE;
}
else
{
*iMajor = 0;
*iMinor = 0;
*iRelease = 0;
return MNG_FALSE;
}
}
#endif
/* ************************************************************************** */
/* * * */
/* * HLAPI routines * */
/* * * */
/* ************************************************************************** */
mng_handle MNG_DECL mng_initialize (mng_ptr pUserdata,
mng_memalloc fMemalloc,
mng_memfree fMemfree,
mng_traceproc fTraceproc)
{
mng_datap pData;
#ifdef MNG_SUPPORT_DISPLAY
mng_retcode iRetcode;
mng_imagep pImage;
#endif
#ifdef MNG_INTERNAL_MEMMNGMT /* allocate the main datastruc */
pData = (mng_datap)calloc (1, sizeof (mng_data));
#else
pData = (mng_datap)fMemalloc (sizeof (mng_data));
#endif
if (!pData)
return MNG_NULL; /* error: out of memory?? */
/* validate the structure */
pData->iMagic = MNG_MAGIC;
/* save userdata field */
pData->pUserdata = pUserdata;
/* remember trace callback */
pData->fTraceproc = fTraceproc;
#ifdef MNG_SUPPORT_TRACE
if (mng_trace (pData, MNG_FN_INITIALIZE, MNG_LC_INITIALIZE))
{
MNG_FREEX (pData, pData, sizeof (mng_data));
return MNG_NULL;
}
#endif
/* default canvas styles are 8-bit RGB */
pData->iCanvasstyle = MNG_CANVAS_RGB8;
pData->iBkgdstyle = MNG_CANVAS_RGB8;
pData->iBGred = 0; /* black */
pData->iBGgreen = 0;
pData->iBGblue = 0;
pData->bUseBKGD = MNG_TRUE;
#ifdef MNG_FULL_CMS
pData->bIssRGB = MNG_TRUE;
pData->hProf1 = 0; /* no profiles yet */
pData->hProf2 = 0;
pData->hProf3 = 0;
pData->hTrans = 0;
#endif
pData->dViewgamma = 1.0;
pData->dDisplaygamma = 2.2;
pData->dDfltimggamma = 0.45455;
/* initially remember chunks */
pData->bStorechunks = MNG_TRUE;
/* no breaks at section-borders */
pData->bSectionbreaks = MNG_FALSE;
/* initially cache playback info */
pData->bCacheplayback = MNG_TRUE;
/* progressive refresh for large images */
pData->bDoProgressive = MNG_TRUE;
/* crc exists; should check; error for
critical chunks; warning for ancillery;
generate crc for output */
pData->iCrcmode = MNG_CRC_DEFAULT;
/* normal animation-speed ! */
pData->iSpeed = mng_st_normal;
/* initial image limits */
pData->iMaxwidth = 10000;
pData->iMaxheight = 10000;
#ifdef MNG_INTERNAL_MEMMNGMT /* internal management */
pData->fMemalloc = MNG_NULL;
pData->fMemfree = MNG_NULL;
#else /* keep callbacks */
pData->fMemalloc = fMemalloc;
pData->fMemfree = fMemfree;
#endif
/* no value (yet) */
pData->fReleasedata = MNG_NULL;
#ifndef MNG_NO_OPEN_CLOSE_STREAM
pData->fOpenstream = MNG_NULL;
pData->fClosestream = MNG_NULL;
#endif
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->fProcessmend = MNG_NULL;
pData->fProcessunknown = MNG_NULL;
pData->fProcessterm = 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 */
#endif
#ifdef MNG_SUPPORT_DISPLAY /* create object 0 */
iRetcode = mng_create_imageobject (pData, 0, MNG_TRUE, MNG_TRUE, MNG_TRUE,
0, 0, 0, 0, 0, 0, 0, 0, 0, MNG_FALSE,
0, 0, 0, 0, &pImage);
if (iRetcode) /* on error drop out */
{
MNG_FREEX (pData, pData, sizeof (mng_data));
return MNG_NULL;
}
pData->pObjzero = pImage;
#endif
#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_INCLUDE_LCMS)
mnglcms_initlibrary (); /* init lcms particulars */
#endif
#ifdef MNG_SUPPORT_READ
pData->bSuspensionmode = MNG_FALSE;
pData->iSuspendbufsize = 0;
pData->pSuspendbuf = MNG_NULL;
pData->pSuspendbufnext = MNG_NULL;
pData->iSuspendbufleft = 0;
pData->iChunklen = 0;
pData->pReadbufnext = MNG_NULL;
pData->pLargebufnext = MNG_NULL;
pData->pFirstpushchunk = MNG_NULL;
pData->pLastpushchunk = MNG_NULL;
pData->pFirstpushdata = MNG_NULL;
pData->pLastpushdata = MNG_NULL;
#endif
#ifdef MNG_INCLUDE_ZLIB
mngzlib_initialize (pData); /* initialize zlib structures and such */
/* default zlib compression parameters */
pData->iZlevel = MNG_ZLIB_LEVEL;
pData->iZmethod = MNG_ZLIB_METHOD;
pData->iZwindowbits = MNG_ZLIB_WINDOWBITS;
pData->iZmemlevel = MNG_ZLIB_MEMLEVEL;
pData->iZstrategy = MNG_ZLIB_STRATEGY;
/* default maximum IDAT data size */
pData->iMaxIDAT = MNG_MAX_IDAT_SIZE;
#endif
#ifdef MNG_INCLUDE_JNG /* default IJG compression parameters */
pData->eJPEGdctmethod = MNG_JPEG_DCT;
pData->iJPEGquality = MNG_JPEG_QUALITY;
pData->iJPEGsmoothing = MNG_JPEG_SMOOTHING;
pData->bJPEGcompressprogr = MNG_JPEG_PROGRESSIVE;
pData->bJPEGcompressopt = MNG_JPEG_OPTIMIZED;
/* default maximum JDAT data size */
pData->iMaxJDAT = MNG_MAX_JDAT_SIZE;
#endif
mng_reset ((mng_handle)pData);
#ifdef MNG_SUPPORT_TRACE
if (mng_trace (pData, MNG_FN_INITIALIZE, MNG_LC_END))
{
MNG_FREEX (pData, pData, sizeof (mng_data));
return MNG_NULL;
}
#endif
return (mng_handle)pData; /* if we get here, we're in business */
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_reset (mng_handle hHandle)
{
mng_datap pData;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_RESET, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = ((mng_datap)(hHandle)); /* address main structure */
#ifdef MNG_SUPPORT_DISPLAY
#ifndef MNG_SKIPCHUNK_SAVE
mng_drop_savedata (pData); /* cleanup saved-data from SAVE/SEEK */
#endif
#endif
#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_FULL_CMS)
mng_clear_cms (pData); /* cleanup left-over cms stuff if any */
#endif
#if defined(MNG_SUPPORT_DISPLAY) && defined(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
mng_cleanup_rowproc (pData); /* cleanup row-processing, */
#endif
mngzlib_inflatefree (pData); /* cleanup inflate! */
}
#endif /* MNG_INCLUDE_ZLIB */
#ifdef MNG_SUPPORT_READ
if ((pData->bReading) && (!pData->bEOF))
mng_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);
while (pData->pFirstpushdata) /* release any pushed data & chunks */
mng_release_pushdata (pData);
while (pData->pFirstpushchunk)
mng_release_pushchunk (pData);
#endif
#ifdef MNG_SUPPORT_WRITE /* cleanup default write buffer */
MNG_FREE (pData, pData->pWritebuf, pData->iWritebufsize);
#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) */
#ifndef MNG_SKIPCHUNK_iCCP
if (pData->iGlobalProfilesize) /* drop global profile (if any) */
MNG_FREEX (pData, pData->pGlobalProfile, pData->iGlobalProfilesize);
#endif
#endif
pData->eSigtype = mng_it_unknown;
pData->eImagetype = mng_it_unknown;
pData->iWidth = 0; /* these are unknown yet */
pData->iHeight = 0;
pData->iTicks = 0;
pData->iLayercount = 0;
pData->iFramecount = 0;
pData->iPlaytime = 0;
pData->iSimplicity = 0;
pData->iAlphadepth = 16; /* assume the worst! */
pData->iImagelevel = 0; /* no image encountered */
pData->iMagnify = 0; /* 1-to-1 display */
pData->iOffsetx = 0; /* no offsets */
pData->iOffsety = 0;
pData->iCanvaswidth = 0; /* let the app decide during processheader */
pData->iCanvasheight = 0;
/* so far, so good */
pData->iErrorcode = MNG_NOERROR;
pData->iSeverity = 0;
pData->iErrorx1 = 0;
pData->iErrorx2 = 0;
pData->zErrortext = MNG_NULL;
#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
/* let's assume the best scenario */
#ifndef MNG_NO_OLD_VERSIONS
pData->bPreDraft48 = MNG_FALSE;
#endif
/* the unknown chunk */
pData->iChunkname = MNG_UINT_HUH;
pData->iChunkseq = 0;
pData->pFirstchunk = MNG_NULL;
pData->pLastchunk = MNG_NULL;
/* nothing processed yet */
pData->bHasheader = MNG_FALSE;
pData->bHasMHDR = MNG_FALSE;
pData->bHasIHDR = MNG_FALSE;
pData->bHasBASI = MNG_FALSE;
pData->bHasDHDR = MNG_FALSE;
#ifdef MNG_INCLUDE_JNG
pData->bHasJHDR = MNG_FALSE;
pData->bHasJSEP = MNG_FALSE;
pData->bHasJDAA = MNG_FALSE;
pData->bHasJDAT = MNG_FALSE;
#endif
pData->bHasPLTE = MNG_FALSE;
pData->bHasTRNS = MNG_FALSE;
pData->bHasGAMA = MNG_FALSE;
pData->bHasCHRM = MNG_FALSE;
pData->bHasSRGB = MNG_FALSE;
pData->bHasICCP = MNG_FALSE;
pData->bHasBKGD = MNG_FALSE;
pData->bHasIDAT = MNG_FALSE;
pData->bHasSAVE = MNG_FALSE;
pData->bHasBACK = MNG_FALSE;
pData->bHasFRAM = MNG_FALSE;
pData->bHasTERM = MNG_FALSE;
pData->bHasLOOP = MNG_FALSE;
/* there's no global stuff yet either */
pData->bHasglobalPLTE = MNG_FALSE;
pData->bHasglobalTRNS = MNG_FALSE;
pData->bHasglobalGAMA = MNG_FALSE;
pData->bHasglobalCHRM = MNG_FALSE;
pData->bHasglobalSRGB = MNG_FALSE;
pData->bHasglobalICCP = MNG_FALSE;
pData->iDatawidth = 0; /* no IHDR/BASI/DHDR done yet */
pData->iDataheight = 0;
pData->iBitdepth = 0;
pData->iColortype = 0;
pData->iCompression = 0;
pData->iFilter = 0;
pData->iInterlace = 0;
#ifdef MNG_INCLUDE_JNG
pData->iJHDRcolortype = 0; /* no JHDR data */
pData->iJHDRimgbitdepth = 0;
pData->iJHDRimgcompression = 0;
pData->iJHDRimginterlace = 0;
pData->iJHDRalphabitdepth = 0;
pData->iJHDRalphacompression = 0;
pData->iJHDRalphafilter = 0;
pData->iJHDRalphainterlace = 0;
#endif
#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */
#ifdef MNG_SUPPORT_READ /* no reading done */
pData->bReading = MNG_FALSE;
pData->bHavesig = MNG_FALSE;
pData->bEOF = MNG_FALSE;
pData->iReadbufsize = 0;
pData->pReadbuf = MNG_NULL;
pData->iLargebufsize = 0;
pData->pLargebuf = MNG_NULL;
pData->iSuspendtime = 0;
pData->bSuspended = MNG_FALSE;
pData->iSuspendpoint = 0;
pData->pSuspendbufnext = pData->pSuspendbuf;
pData->iSuspendbufleft = 0;
#endif /* MNG_SUPPORT_READ */
#ifdef MNG_SUPPORT_WRITE /* no creating/writing done */
pData->bCreating = MNG_FALSE;
pData->bWriting = MNG_FALSE;
pData->iFirstchunkadded = 0;
pData->iWritebufsize = 0;
pData->pWritebuf = MNG_NULL;
#endif /* MNG_SUPPORT_WRITE */
#ifdef MNG_SUPPORT_DISPLAY /* done nuttin' yet */
pData->bDisplaying = MNG_FALSE;
pData->iFrameseq = 0;
pData->iLayerseq = 0;
pData->iFrametime = 0;
pData->iTotallayers = 0;
pData->iTotalframes = 0;
pData->iTotalplaytime = 0;
pData->bSkipping = MNG_FALSE;
#ifdef MNG_SUPPORT_DYNAMICMNG
pData->bDynamic = MNG_FALSE;
pData->bRunningevent = MNG_FALSE;
pData->bStopafterseek = MNG_FALSE;
pData->iEventx = 0;
pData->iEventy = 0;
pData->pLastmousemove = MNG_NULL;
#endif
pData->iRequestframe = 0;
pData->iRequestlayer = 0;
pData->iRequesttime = 0;
pData->bSearching = MNG_FALSE;
pData->bRestorebkgd = MNG_FALSE;
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->bMisplacedTERM = MNG_FALSE;
pData->bOnlyfirstframe = MNG_FALSE;
pData->iFramesafterTERM = 0;
/* 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;
pData->iUpdateleft = 0; /* no region updated yet */
pData->iUpdateright = 0;
pData->iUpdatetop = 0;
pData->iUpdatebottom = 0;
pData->iPass = -1; /* interlacing stuff and temp buffers */
pData->iRow = 0;
pData->iRowinc = 1;
pData->iCol = 0;
pData->iColinc = 1;
pData->iRowsamples = 0;
pData->iSamplemul = 0;
pData->iSampleofs = 0;
pData->iSamplediv = 0;
pData->iRowsize = 0;
pData->iRowmax = 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 = MNG_NULL;
pData->bIsRGBA16 = MNG_TRUE;
pData->bIsOpaque = MNG_TRUE;
pData->iFilterbpp = 1;
pData->iSourcel = 0; /* always initialized just before */
pData->iSourcer = 0; /* compositing the next layer */
pData->iSourcet = 0;
pData->iSourceb = 0;
pData->iDestl = 0;
pData->iDestr = 0;
pData->iDestt = 0;
pData->iDestb = 0;
/* lists are empty */
pData->pFirstimgobj = MNG_NULL;
pData->pLastimgobj = MNG_NULL;
pData->pFirstaniobj = MNG_NULL;
pData->pLastaniobj = MNG_NULL;
#ifdef MNG_SUPPORT_DYNAMICMNG
pData->pFirstevent = MNG_NULL;
pData->pLastevent = MNG_NULL;
#endif
/* 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->fScalerow = MNG_NULL;
pData->fDeltarow = MNG_NULL;
#ifndef MNG_SKIPCHUNK_PAST
pData->fFliprow = MNG_NULL;
pData->fTilerow = MNG_NULL;
#endif
pData->fInitrowproc = MNG_NULL;
pData->iPLTEcount = 0; /* no PLTE data */
#ifndef MNG_SKIPCHUNK_DEFI
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;
pData->iDEFIlocay = 0;
pData->bDEFIhasclip = MNG_FALSE;
pData->iDEFIclipl = 0;
pData->iDEFIclipr = 0;
pData->iDEFIclipt = 0;
pData->iDEFIclipb = 0;
#endif
#ifndef MNG_SKIPCHUNK_BACK
pData->iBACKred = 0; /* no BACK data */
pData->iBACKgreen = 0;
pData->iBACKblue = 0;
pData->iBACKmandatory = 0;
pData->iBACKimageid = 0;
pData->iBACKtile = 0;
#endif
#ifndef MNG_SKIPCHUNK_FRAM
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;
#endif
#ifndef MNG_SKIPCHUNK_SHOW
pData->iSHOWmode = 0; /* no SHOW data */
pData->iSHOWfromid = 0;
pData->iSHOWtoid = 0;
pData->iSHOWnextid = 0;
pData->iSHOWskip = 0;
#endif
pData->iGlobalPLTEcount = 0; /* no global PLTE data */
pData->iGlobalTRNSrawlen = 0; /* no global tRNS data */
pData->iGlobalGamma = 0; /* no global gAMA data */
#ifndef MNG_SKIPCHUNK_cHRM
pData->iGlobalWhitepointx = 0; /* no global cHRM data */
pData->iGlobalWhitepointy = 0;
pData->iGlobalPrimaryredx = 0;
pData->iGlobalPrimaryredy = 0;
pData->iGlobalPrimarygreenx = 0;
pData->iGlobalPrimarygreeny = 0;
pData->iGlobalPrimarybluex = 0;
pData->iGlobalPrimarybluey = 0;
#endif
pData->iGlobalRendintent = 0; /* no global sRGB data */
#ifndef MNG_SKIPCHUNK_iCCP
pData->iGlobalProfilesize = 0; /* no global iCCP data */
pData->pGlobalProfile = MNG_NULL;
#endif
#ifndef MNG_SKIPCHUNK_bKGD
pData->iGlobalBKGDred = 0; /* no global bKGD data */
pData->iGlobalBKGDgreen = 0;
pData->iGlobalBKGDblue = 0;
#endif
/* no delta-image */
#ifndef MNG_NO_DELTA_PNG
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;
pData->fDeltagetrow = MNG_NULL;
pData->fDeltaaddrow = MNG_NULL;
pData->fDeltareplacerow = MNG_NULL;
pData->fDeltaputrow = MNG_NULL;
pData->fPromoterow = MNG_NULL;
pData->fPromBitdepth = MNG_NULL;
pData->pPromBuf = MNG_NULL;
pData->iPromColortype = 0;
pData->iPromBitdepth = 0;
pData->iPromFilltype = 0;
pData->iPromWidth = 0;
pData->pPromSrc = MNG_NULL;
pData->pPromDst = MNG_NULL;
#endif
#ifndef MNG_SKIPCHUNK_MAGN
pData->iMAGNfromid = 0;
pData->iMAGNtoid = 0;
#endif
#ifndef MNG_SKIPCHUNK_PAST
pData->iPastx = 0;
pData->iPasty = 0;
#endif
pData->pLastseek = MNG_NULL;
#endif
#ifdef MNG_INCLUDE_ZLIB
pData->bInflating = 0; /* no inflating or deflating */
pData->bDeflating = 0; /* going on at the moment */
#endif
#ifdef MNG_SUPPORT_DISPLAY /* reset object 0 */
mng_reset_objzero (pData);
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_RESET, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_cleanup (mng_handle* hHandle)
{
mng_datap pData; /* local vars */
#ifndef MNG_INTERNAL_MEMMNGMT
mng_memfree fFree;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)*hHandle), MNG_FN_CLEANUP, MNG_LC_START);
#endif
MNG_VALIDHANDLE (*hHandle) /* check validity handle */
pData = ((mng_datap)(*hHandle)); /* and address main structure */
mng_reset (*hHandle); /* do an implicit reset to cleanup most stuff */
#ifdef MNG_SUPPORT_DISPLAY /* drop object 0 */
mng_free_imageobject (pData, (mng_imagep)pData->pObjzero);
#endif
#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_FULL_CMS)
if (pData->hProf2) /* output profile defined ? */
mnglcms_freeprofile (pData->hProf2);
if (pData->hProf3) /* sRGB profile defined ? */
mnglcms_freeprofile (pData->hProf3);
#endif
#ifdef MNG_INCLUDE_ZLIB
mngzlib_cleanup (pData); /* cleanup zlib stuff */
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)*hHandle), MNG_FN_CLEANUP, MNG_LC_CLEANUP)
#endif
pData->iMagic = 0; /* invalidate the actual memory */
#ifdef MNG_INTERNAL_MEMMNGMT
free ((void *)*hHandle); /* cleanup the data-structure */
#else
fFree = ((mng_datap)*hHandle)->fMemfree;
fFree ((mng_ptr)*hHandle, sizeof (mng_data));
#endif
*hHandle = 0; /* wipe pointer to inhibit future use */
return MNG_NOERROR; /* and we're done */
}
/* ************************************************************************** */
#ifdef MNG_SUPPORT_READ
mng_retcode MNG_DECL mng_read (mng_handle hHandle)
{
mng_datap pData; /* local vars */
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle and callbacks */
pData = ((mng_datap)hHandle); /* and make it addressable */
#ifndef MNG_INTERNAL_MEMMNGMT
MNG_VALIDCB (hHandle, fMemalloc)
MNG_VALIDCB (hHandle, fMemfree)
#endif
#ifndef MNG_NO_OPEN_CLOSE_STREAM
MNG_VALIDCB (hHandle, fOpenstream)
MNG_VALIDCB (hHandle, fClosestream)
#endif
MNG_VALIDCB (hHandle, fReaddata)
#ifdef MNG_SUPPORT_DISPLAY /* valid at this point ? */
if ((pData->bReading) || (pData->bDisplaying))
#else
if (pData->bReading)
#endif
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
#ifdef MNG_SUPPORT_WRITE
if ((pData->bWriting) || (pData->bCreating))
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
#endif
if (!pData->bCacheplayback) /* must store playback info to work!! */
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
cleanup_errors (pData); /* cleanup previous errors */
pData->bReading = MNG_TRUE; /* read only! */
#ifndef MNG_NO_OPEN_CLOSE_STREAM
if (pData->fOpenstream && !pData->fOpenstream (hHandle))
/* open it and start reading */
iRetcode = MNG_APPIOERROR;
else
#endif
iRetcode = mng_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;
if (pData->bSuspended) /* read suspension ? */
{
iRetcode = MNG_NEEDMOREDATA;
pData->iSuspendtime = pData->fGettickcount ((mng_handle)pData);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ, MNG_LC_END);
#endif
return iRetcode;
}
#endif /* MNG_SUPPORT_READ */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_READ
mng_retcode MNG_DECL mng_read_pushdata (mng_handle hHandle,
mng_ptr pData,
mng_size_t iLength,
mng_bool bTakeownership)
{
mng_datap pMyData; /* local vars */
mng_pushdatap pPush;
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_PUSHDATA, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pMyData = ((mng_datap)hHandle); /* and make it addressable */
/* create a containing buffer */
iRetcode = make_pushbuffer (pMyData, pData, iLength, bTakeownership, &pPush);
if (iRetcode)
return iRetcode;
if (pMyData->pLastpushdata) /* and update the buffer chain */
pMyData->pLastpushdata->pNext = pPush;
else
pMyData->pFirstpushdata = pPush;
pMyData->pLastpushdata = pPush;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_PUSHDATA, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_SUPPORT_READ */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_READ
mng_retcode MNG_DECL mng_read_pushsig (mng_handle hHandle,
mng_imgtype eSigtype)
{
mng_datap pData; /* local vars */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_PUSHSIG, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = ((mng_datap)hHandle); /* and make it addressable */
if (pData->bHavesig) /* can we expect this call ? */
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
pData->eSigtype = eSigtype;
pData->bHavesig = MNG_TRUE;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_PUSHSIG, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_SUPPORT_READ */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_READ
mng_retcode MNG_DECL mng_read_pushchunk (mng_handle hHandle,
mng_ptr pChunk,
mng_size_t iLength,
mng_bool bTakeownership)
{
mng_datap pMyData; /* local vars */
mng_pushdatap pPush;
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_PUSHCHUNK, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pMyData = ((mng_datap)hHandle); /* and make it addressable */
/* create a containing buffer */
iRetcode = make_pushbuffer (pMyData, pChunk, iLength, bTakeownership, &pPush);
if (iRetcode)
return iRetcode;
if (pMyData->pLastpushchunk) /* and update the buffer chain */
pMyData->pLastpushchunk->pNext = pPush;
else
pMyData->pFirstpushchunk = pPush;
pMyData->pLastpushchunk = pPush;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_PUSHCHUNK, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_SUPPORT_READ */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_READ
mng_retcode MNG_DECL mng_read_resume (mng_handle hHandle)
{
mng_datap pData; /* local vars */
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_RESUME, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = ((mng_datap)hHandle); /* and make it addressable */
/* can we expect this call ? */
if ((!pData->bReading) || (!pData->bSuspended))
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
cleanup_errors (pData); /* cleanup previous errors */
pData->bSuspended = MNG_FALSE; /* reset the flag */
#ifdef MNG_SUPPORT_DISPLAY /* re-synchronize ? */
if ((pData->bDisplaying) && (pData->bRunning))
pData->iSynctime = pData->iSynctime - pData->iSuspendtime +
pData->fGettickcount (hHandle);
#endif
iRetcode = mng_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;
if (pData->bSuspended) /* read suspension ? */
{
iRetcode = MNG_NEEDMOREDATA;
pData->iSuspendtime = pData->fGettickcount ((mng_handle)pData);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_RESUME, MNG_LC_END);
#endif
return iRetcode;
}
#endif /* MNG_SUPPORT_READ */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_WRITE
mng_retcode MNG_DECL mng_write (mng_handle hHandle)
{
mng_datap pData;
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_WRITE, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle and callbacks */
pData = ((mng_datap)hHandle); /* and make it addressable */
#ifndef MNG_INTERNAL_MEMMNGMT
MNG_VALIDCB (hHandle, fMemalloc)
MNG_VALIDCB (hHandle, fMemfree)
#endif
#ifndef MNG_NO_OPEN_CLOSE_STREAM
MNG_VALIDCB (hHandle, fOpenstream)
MNG_VALIDCB (hHandle, fClosestream)
#endif
MNG_VALIDCB (hHandle, fWritedata)
#ifdef MNG_SUPPORT_READ
if (pData->bReading) /* valid at this point ? */
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
#endif
cleanup_errors (pData); /* cleanup previous errors */
iRetcode = mng_write_graphic (pData);/* do the write */
if (iRetcode) /* on error bail out */
return iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_WRITE, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_SUPPORT_WRITE */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_WRITE
mng_retcode MNG_DECL mng_create (mng_handle hHandle)
{
mng_datap pData;
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_CREATE, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle and callbacks */
pData = ((mng_datap)hHandle); /* and make it addressable */
#ifndef MNG_INTERNAL_MEMMNGMT
MNG_VALIDCB (hHandle, fMemalloc)
MNG_VALIDCB (hHandle, fMemfree)
#endif
#ifdef MNG_SUPPORT_READ
if (pData->bReading) /* valid at this point ? */
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
#endif
if ((pData->bWriting) || (pData->bCreating))
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
cleanup_errors (pData); /* cleanup previous errors */
iRetcode = mng_reset (hHandle); /* clear any previous stuff */
if (iRetcode) /* on error bail out */
return iRetcode;
pData->bCreating = MNG_TRUE; /* indicate we're creating a new file */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_CREATE, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_SUPPORT_WRITE */
/* ************************************************************************** */
#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_SUPPORT_READ)
mng_retcode MNG_DECL mng_readdisplay (mng_handle hHandle)
{
mng_datap pData; /* local vars */
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_READDISPLAY, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle and callbacks */
pData = ((mng_datap)hHandle); /* and make it addressable */
#ifndef MNG_INTERNAL_MEMMNGMT
MNG_VALIDCB (hHandle, fMemalloc)
MNG_VALIDCB (hHandle, fMemfree)
#endif
MNG_VALIDCB (hHandle, fReaddata)
MNG_VALIDCB (hHandle, fGetcanvasline)
MNG_VALIDCB (hHandle, fRefresh)
MNG_VALIDCB (hHandle, fGettickcount)
MNG_VALIDCB (hHandle, fSettimer)
/* valid at this point ? */
if ((pData->bReading) || (pData->bDisplaying))
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
#ifdef MNG_SUPPORT_WRITE
if ((pData->bWriting) || (pData->bCreating))
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
#endif
cleanup_errors (pData); /* cleanup previous errors */
pData->bReading = MNG_TRUE; /* read & display! */
pData->bDisplaying = MNG_TRUE;
pData->bRunning = MNG_TRUE;
pData->iFrameseq = 0;
pData->iLayerseq = 0;
pData->iFrametime = 0;
pData->iRequestframe = 0;
pData->iRequestlayer = 0;
pData->iRequesttime = 0;
pData->bSearching = MNG_FALSE;
pData->iRuntime = 0;
pData->iSynctime = pData->fGettickcount (hHandle);
pData->iSuspendtime = 0;
pData->iStarttime = pData->iSynctime;
pData->iEndtime = 0;
#ifndef MNG_NO_OPEN_CLOSE_STREAM
if (pData->fOpenstream && !pData->fOpenstream (hHandle))
/* open it and start reading */
iRetcode = MNG_APPIOERROR;
else
#endif
iRetcode = mng_read_graphic (pData);
if (pData->bEOF) /* already at EOF ? */
{
pData->bReading = MNG_FALSE; /* then we're no longer reading */
mng_drop_invalid_objects (pData); /* drop invalidly stored objects */
}
if (iRetcode) /* on error bail out */
return iRetcode;
if (pData->bSuspended) /* read suspension ? */
{
iRetcode = MNG_NEEDMOREDATA;
pData->iSuspendtime = pData->fGettickcount ((mng_handle)pData);
}
else
if (pData->bTimerset) /* indicate timer break ? */
iRetcode = MNG_NEEDTIMERWAIT;
else
if (pData->bSectionwait) /* indicate section break ? */
iRetcode = MNG_NEEDSECTIONWAIT;
else
{ /* no breaks = end of run */
pData->bRunning = MNG_FALSE;
if (pData->bFreezing) /* dynamic MNG reached SEEK ? */
pData->bFreezing = MNG_FALSE; /* reset it ! */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_READDISPLAY, MNG_LC_END);
#endif
return iRetcode;
}
#endif /* MNG_SUPPORT_DISPLAY && MNG_SUPPORT_READ */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_DISPLAY
mng_retcode MNG_DECL mng_display (mng_handle hHandle)
{
mng_datap pData; /* local vars */
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle and callbacks */
pData = ((mng_datap)hHandle); /* and make it addressable */
#ifndef MNG_INTERNAL_MEMMNGMT
MNG_VALIDCB (hHandle, fMemalloc)
MNG_VALIDCB (hHandle, fMemfree)
#endif
MNG_VALIDCB (hHandle, fGetcanvasline)
MNG_VALIDCB (hHandle, fRefresh)
MNG_VALIDCB (hHandle, fGettickcount)
MNG_VALIDCB (hHandle, fSettimer)
if (pData->bDisplaying) /* valid at this point ? */
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
#ifdef MNG_SUPPORT_READ
if (pData->bReading)
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
#endif
#ifdef MNG_SUPPORT_WRITE
if ((pData->bWriting) || (pData->bCreating))
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
#endif
cleanup_errors (pData); /* cleanup previous errors */
pData->bDisplaying = MNG_TRUE; /* display! */
pData->bRunning = MNG_TRUE;
pData->iFrameseq = 0;
pData->iLayerseq = 0;
pData->iFrametime = 0;
pData->iRequestframe = 0;
pData->iRequestlayer = 0;
pData->iRequesttime = 0;
pData->bSearching = MNG_FALSE;
pData->iRuntime = 0;
pData->iSynctime = pData->fGettickcount (hHandle);
#ifdef MNG_SUPPORT_READ
pData->iSuspendtime = 0;
#endif
pData->iStarttime = pData->iSynctime;
pData->iEndtime = 0;
pData->pCurraniobj = pData->pFirstaniobj;
/* go do it */
iRetcode = mng_process_display (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
if (pData->bTimerset) /* indicate timer break ? */
iRetcode = MNG_NEEDTIMERWAIT;
else
{ /* no breaks = end of run */
pData->bRunning = MNG_FALSE;
if (pData->bFreezing) /* dynamic MNG reached SEEK ? */
pData->bFreezing = MNG_FALSE; /* reset it ! */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY, MNG_LC_END);
#endif
return iRetcode;
}
#endif /* MNG_SUPPORT_DISPLAY */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_DISPLAY
mng_retcode MNG_DECL mng_display_resume (mng_handle hHandle)
{
mng_datap pData; /* local vars */
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_RESUME, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = ((mng_datap)hHandle); /* and make it addressable */
if (!pData->bDisplaying) /* can we expect this call ? */
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
cleanup_errors (pData); /* cleanup previous errors */
/* was it running ? */
if ((pData->bRunning) || (pData->bReading))
{ /* are we expecting this call ? */
if ((pData->bTimerset) || (pData->bSuspended) || (pData->bSectionwait))
{
pData->bTimerset = MNG_FALSE; /* reset the flags */
pData->bSectionwait = MNG_FALSE;
#ifdef MNG_SUPPORT_READ
if (pData->bReading) /* set during read&display ? */
{
if (pData->bSuspended) /* calculate proper synchronization */
pData->iSynctime = pData->iSynctime - pData->iSuspendtime +
pData->fGettickcount (hHandle);
else
pData->iSynctime = pData->fGettickcount (hHandle);
pData->bSuspended = MNG_FALSE; /* now reset this flag */
/* and continue reading */
iRetcode = mng_read_graphic (pData);
if (pData->bEOF) /* already at EOF ? */
{
pData->bReading = MNG_FALSE; /* then we're no longer reading */
/* drop invalidly stored objects */
mng_drop_invalid_objects (pData);
}
}
else
#endif /* MNG_SUPPORT_READ */
{ /* synchronize timing */
pData->iSynctime = pData->fGettickcount (hHandle);
/* resume display processing */
iRetcode = mng_process_display (pData);
}
}
else
{
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
}
}
else
{ /* synchronize timing */
pData->iSynctime = pData->fGettickcount (hHandle);
pData->bRunning = MNG_TRUE; /* it's restarted again ! */
/* resume display processing */
iRetcode = mng_process_display (pData);
}
if (iRetcode) /* on error bail out */
return iRetcode;
if (pData->bSuspended) /* read suspension ? */
{
iRetcode = MNG_NEEDMOREDATA;
pData->iSuspendtime = pData->fGettickcount ((mng_handle)pData);
}
else
if (pData->bTimerset) /* indicate timer break ? */
iRetcode = MNG_NEEDTIMERWAIT;
else
if (pData->bSectionwait) /* indicate section break ? */
iRetcode = MNG_NEEDSECTIONWAIT;
else
{ /* no breaks = end of run */
pData->bRunning = MNG_FALSE;
if (pData->bFreezing) /* trying to freeze ? */
pData->bFreezing = MNG_FALSE; /* then we're there */
if (pData->bResetting) /* trying to reset as well ? */
{ /* full stop!!! */
pData->bDisplaying = MNG_FALSE;
iRetcode = mng_reset_rundata (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_RESUME, MNG_LC_END);
#endif
return iRetcode;
}
#endif /* MNG_SUPPORT_DISPLAY */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_DISPLAY
mng_retcode MNG_DECL mng_display_freeze (mng_handle hHandle)
{
mng_datap pData;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_FREEZE, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = ((mng_datap)hHandle); /* and make it addressable */
/* can we expect this call ? */
if ((!pData->bDisplaying) || (pData->bReading))
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
cleanup_errors (pData); /* cleanup previous errors */
if (pData->bRunning) /* is it running ? */
{
mng_retcode iRetcode;
pData->bFreezing = MNG_TRUE; /* indicate we need to freeze */
/* continue "normal" processing */
iRetcode = mng_display_resume (hHandle);
if (iRetcode) /* on error bail out */
return iRetcode;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_FREEZE, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_SUPPORT_DISPLAY */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_DISPLAY
mng_retcode MNG_DECL mng_display_reset (mng_handle hHandle)
{
mng_datap pData;
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_RESET, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = ((mng_datap)hHandle); /* and make it addressable */
/* can we expect this call ? */
if ((!pData->bDisplaying) || (pData->bReading))
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
if (!pData->bCacheplayback) /* must store playback info to work!! */
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
cleanup_errors (pData); /* cleanup previous errors */
if (pData->bRunning) /* is it running ? */
{
pData->bFreezing = MNG_TRUE; /* indicate we need to freeze */
pData->bResetting = MNG_TRUE; /* indicate we're about to reset too */
/* continue normal processing ? */
iRetcode = mng_display_resume (hHandle);
if (iRetcode) /* on error bail out */
return iRetcode;
}
else
{ /* full stop!!! */
pData->bDisplaying = MNG_FALSE;
iRetcode = mng_reset_rundata (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_RESET, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_SUPPORT_DISPLAY */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_DISPLAY
#ifndef MNG_NO_DISPLAY_GO_SUPPORTED
mng_retcode MNG_DECL mng_display_goframe (mng_handle hHandle,
mng_uint32 iFramenr)
{
mng_datap pData;
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_GOFRAME, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = ((mng_datap)hHandle); /* and make it addressable */
if (pData->eImagetype != mng_it_mng) /* is it an animation ? */
MNG_ERROR (pData, MNG_NOTANANIMATION);
/* can we expect this call ? */
if ((!pData->bDisplaying) || (pData->bRunning))
MNG_ERROR ((mng_datap)hHandle, MNG_FUNCTIONINVALID);
if (!pData->bCacheplayback) /* must store playback info to work!! */
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
if (iFramenr > pData->iTotalframes) /* is the parameter within bounds ? */
MNG_ERROR (pData, MNG_FRAMENRTOOHIGH);
/* within MHDR bounds ? */
if ((pData->iFramecount) && (iFramenr > pData->iFramecount))
MNG_WARNING (pData, MNG_FRAMENRTOOHIGH);
cleanup_errors (pData); /* cleanup previous errors */
if (pData->iFrameseq > iFramenr) /* search from current or go back to start ? */
{
iRetcode = mng_reset_rundata (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
}
if (iFramenr)
{
pData->iRequestframe = iFramenr; /* go find the requested frame then */
iRetcode = mng_process_display (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
pData->bTimerset = MNG_FALSE; /* reset just to be safe */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_GOFRAME, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
#endif /* MNG_SUPPORT_DISPLAY */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_DISPLAY
#ifndef MNG_NO_DISPLAY_GO_SUPPORTED
mng_retcode MNG_DECL mng_display_golayer (mng_handle hHandle,
mng_uint32 iLayernr)
{
mng_datap pData;
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_GOLAYER, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = ((mng_datap)hHandle); /* and make it addressable */
if (pData->eImagetype != mng_it_mng) /* is it an animation ? */
MNG_ERROR (pData, MNG_NOTANANIMATION);
/* can we expect this call ? */
if ((!pData->bDisplaying) || (pData->bRunning))
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
if (!pData->bCacheplayback) /* must store playback info to work!! */
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
if (iLayernr > pData->iTotallayers) /* is the parameter within bounds ? */
MNG_ERROR (pData, MNG_LAYERNRTOOHIGH);
/* within MHDR bounds ? */
if ((pData->iLayercount) && (iLayernr > pData->iLayercount))
MNG_WARNING (pData, MNG_LAYERNRTOOHIGH);
cleanup_errors (pData); /* cleanup previous errors */
if (pData->iLayerseq > iLayernr) /* search from current or go back to start ? */
{
iRetcode = mng_reset_rundata (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
}
if (iLayernr)
{
pData->iRequestlayer = iLayernr; /* go find the requested layer then */
iRetcode = mng_process_display (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
pData->bTimerset = MNG_FALSE; /* reset just to be safe */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_GOLAYER, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
#endif /* MNG_SUPPORT_DISPLAY */
/* ************************************************************************** */
#ifdef MNG_SUPPORT_DISPLAY
#ifndef MNG_NO_DISPLAY_GO_SUPPORTED
mng_retcode MNG_DECL mng_display_gotime (mng_handle hHandle,
mng_uint32 iPlaytime)
{
mng_datap pData;
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_GOTIME, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = ((mng_datap)hHandle); /* and make it addressable */
if (pData->eImagetype != mng_it_mng) /* is it an animation ? */
MNG_ERROR (pData, MNG_NOTANANIMATION);
/* can we expect this call ? */
if ((!pData->bDisplaying) || (pData->bRunning))
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
if (!pData->bCacheplayback) /* must store playback info to work!! */
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
/* is the parameter within bounds ? */
if (iPlaytime > pData->iTotalplaytime)
MNG_ERROR (pData, MNG_PLAYTIMETOOHIGH);
/* within MHDR bounds ? */
if ((pData->iPlaytime) && (iPlaytime > pData->iPlaytime))
MNG_WARNING (pData, MNG_PLAYTIMETOOHIGH);
cleanup_errors (pData); /* cleanup previous errors */
if (pData->iFrametime > iPlaytime) /* search from current or go back to start ? */
{
iRetcode = mng_reset_rundata (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
}
if (iPlaytime)
{
pData->iRequesttime = iPlaytime; /* go find the requested playtime then */
iRetcode = mng_process_display (pData);
if (iRetcode) /* on error bail out */
return iRetcode;
pData->bTimerset = MNG_FALSE; /* reset just to be safe */
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_GOTIME, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
#endif /* MNG_SUPPORT_DISPLAY */
/* ************************************************************************** */
#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_SUPPORT_DYNAMICMNG)
mng_retcode MNG_DECL mng_trapevent (mng_handle hHandle,
mng_uint8 iEventtype,
mng_int32 iX,
mng_int32 iY)
{
mng_datap pData;
mng_eventp pEvent;
mng_bool bFound = MNG_FALSE;
mng_retcode iRetcode;
mng_imagep pImage;
mng_uint8p pPixel;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_TRAPEVENT, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = ((mng_datap)hHandle); /* and make it addressable */
if (pData->eImagetype != mng_it_mng) /* is it an animation ? */
MNG_ERROR (pData, MNG_NOTANANIMATION);
if (!pData->bDisplaying) /* can we expect this call ? */
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
if (!pData->bCacheplayback) /* must store playback info to work!! */
MNG_ERROR (pData, MNG_FUNCTIONINVALID);
/* let's find a matching event object */
pEvent = (mng_eventp)pData->pFirstevent;
while ((pEvent) && (!bFound))
{ /* matching eventtype ? */
if (pEvent->iEventtype == iEventtype)
{
switch (pEvent->iMasktype) /* check X/Y on basis of masktype */
{
case MNG_MASK_NONE : /* no mask is easy */
{
bFound = MNG_TRUE;
break;
}
case MNG_MASK_BOX : /* inside the given box ? */
{ /* right- and bottom-border don't count ! */
if ((iX >= pEvent->iLeft) && (iX < pEvent->iRight) &&
(iY >= pEvent->iTop) && (iY < pEvent->iBottom))
bFound = MNG_TRUE;
break;
}
case MNG_MASK_OBJECT : /* non-zero pixel in the image object ? */
{
pImage = mng_find_imageobject (pData, pEvent->iObjectid);
/* valid image ? */
if ((pImage) && (pImage->pImgbuf->iBitdepth <= 8) &&
((pImage->pImgbuf->iColortype == 0) || (pImage->pImgbuf->iColortype == 3)) &&
((mng_int32)pImage->pImgbuf->iWidth > iX) &&
((mng_int32)pImage->pImgbuf->iHeight > iY))
{
pPixel = pImage->pImgbuf->pImgdata + ((pImage->pImgbuf->iWidth * iY) + iX);
if (*pPixel) /* non-zero ? */
bFound = MNG_TRUE;
}
break;
}
case MNG_MASK_OBJECTIX : /* pixel in the image object matches index ? */
{
pImage = mng_find_imageobject (pData, pEvent->iObjectid);
/* valid image ? */
if ((pImage) && (pImage->pImgbuf->iBitdepth <= 8) &&
((pImage->pImgbuf->iColortype == 0) || (pImage->pImgbuf->iColortype == 3)) &&
((mng_int32)pImage->pImgbuf->iWidth > iX) && (iX >= 0) &&
((mng_int32)pImage->pImgbuf->iHeight > iY) && (iY >= 0))
{
pPixel = pImage->pImgbuf->pImgdata + ((pImage->pImgbuf->iWidth * iY) + iX);
/* matching index ? */
if (*pPixel == pEvent->iIndex)
bFound = MNG_TRUE;
}
break;
}
case MNG_MASK_BOXOBJECT : /* non-zero pixel in the image object ? */
{
mng_int32 iTempx = iX - pEvent->iLeft;
mng_int32 iTempy = iY - pEvent->iTop;
pImage = mng_find_imageobject (pData, pEvent->iObjectid);
/* valid image ? */
if ((pImage) && (pImage->pImgbuf->iBitdepth <= 8) &&
((pImage->pImgbuf->iColortype == 0) || (pImage->pImgbuf->iColortype == 3)) &&
(iTempx < (mng_int32)pImage->pImgbuf->iWidth) &&
(iTempx >= 0) && (iX < pEvent->iRight) &&
(iTempy < (mng_int32)pImage->pImgbuf->iHeight) &&
(iTempy >= 0) && (iY < pEvent->iBottom))
{
pPixel = pImage->pImgbuf->pImgdata + ((pImage->pImgbuf->iWidth * iTempy) + iTempx);
if (*pPixel) /* non-zero ? */
bFound = MNG_TRUE;
}
break;
}
case MNG_MASK_BOXOBJECTIX : /* pixel in the image object matches index ? */
{
mng_int32 iTempx = iX - pEvent->iLeft;
mng_int32 iTempy = iY - pEvent->iTop;
pImage = mng_find_imageobject (pData, pEvent->iObjectid);
/* valid image ? */
if ((pImage) && (pImage->pImgbuf->iBitdepth <= 8) &&
((pImage->pImgbuf->iColortype == 0) || (pImage->pImgbuf->iColortype == 3)) &&
(iTempx < (mng_int32)pImage->pImgbuf->iWidth) &&
(iTempx >= 0) && (iX < pEvent->iRight) &&
(iTempy < (mng_int32)pImage->pImgbuf->iHeight) &&
(iTempy >= 0) && (iY < pEvent->iBottom))
{
pPixel = pImage->pImgbuf->pImgdata + ((pImage->pImgbuf->iWidth * iTempy) + iTempx);
/* matching index ? */
if (*pPixel == pEvent->iIndex)
bFound = MNG_TRUE;
}
break;
}
}
}
if (!bFound) /* try the next one */
pEvent = (mng_eventp)pEvent->sHeader.pNext;
}
/* found one that's not the last mousemove ? */
if ((pEvent) && ((mng_objectp)pEvent != pData->pLastmousemove))
{ /* can we start an event process now ? */
if ((!pData->bReading) && (!pData->bRunning))
{
pData->iEventx = iX; /* save coordinates */
pData->iEventy = iY;
/* do it then ! */
iRetcode = pEvent->sHeader.fProcess (pData, pEvent);
if (iRetcode) /* on error bail out */
return iRetcode;
/* remember last mousemove event */
if (pEvent->iEventtype == MNG_EVENT_MOUSEMOVE)
pData->pLastmousemove = (mng_objectp)pEvent;
else
pData->pLastmousemove = MNG_NULL;
}
else
{
/* TODO: store unprocessed events or not ??? */
}
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_TRAPEVENT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode MNG_DECL mng_getlasterror (mng_handle hHandle,
mng_int8* iSeverity,
mng_chunkid* iChunkname,
mng_uint32* iChunkseq,
mng_int32* iExtra1,
mng_int32* iExtra2,
mng_pchar* zErrortext)
{
mng_datap pData; /* local vars */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETLASTERROR, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = ((mng_datap)hHandle); /* and make it addressable */
*iSeverity = pData->iSeverity; /* return the appropriate fields */
#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
*iChunkname = pData->iChunkname;
*iChunkseq = pData->iChunkseq;
#else
*iChunkname = MNG_UINT_HUH;
*iChunkseq = 0;
#endif
*iExtra1 = pData->iErrorx1;
*iExtra2 = pData->iErrorx2;
*zErrortext = pData->zErrortext;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETLASTERROR, MNG_LC_END);
#endif
return pData->iErrorcode; /* and the errorcode */
}
/* ************************************************************************** */
/* * end of file * */
/* ************************************************************************** */
libmng-2.0.3/libmng_chunk_xs.c 0000644 0001750 0001750 00000767600 12005307152 016211 0 ustar glennrp glennrp #include "config.h"
/* ************************************************************************** */
/* * For conditions of distribution and use, * */
/* * see copyright notice in libmng.h * */
/* ************************************************************************** */
/* * * */
/* * project : libmng * */
/* * file : libmng_chunk_xs.c copyright (c) 2000-2007 G.Juyn * */
/* * version : 1.0.10 * */
/* * * */
/* * purpose : chunk access functions (implementation) * */
/* * * */
/* * author : G.Juyn * */
/* * * */
/* * comment : implementation of the chunk access functions * */
/* * * */
/* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */
/* * - changed and filled iterate-chunk function * */
/* * 0.5.1 - 05/08/2000 - G.Juyn * */
/* * - fixed calling convention * */
/* * - added getchunk functions * */
/* * - added putchunk functions * */
/* * - changed strict-ANSI stuff * */
/* * 0.5.1 - 05/11/2000 - G.Juyn * */
/* * - added empty-chunk put-routines * */
/* * 0.5.1 - 05/12/2000 - G.Juyn * */
/* * - changed trace to macro for callback error-reporting * */
/* * 0.5.1 - 05/15/2000 - G.Juyn * */
/* * - added getimgdata & putimgdata functions * */
/* * * */
/* * 0.5.2 - 05/19/2000 - G.Juyn * */
/* * - B004 - fixed problem with MNG_SUPPORT_WRITE not defined * */
/* * also for MNG_SUPPORT_WRITE without MNG_INCLUDE_JNG * */
/* * - Cleaned up some code regarding mixed support * */
/* * * */
/* * 0.9.1 - 07/19/2000 - G.Juyn * */
/* * - fixed creation-code * */
/* * * */
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
/* * - 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 * */
/* * * */
/* * 0.9.5 - 01/25/2001 - G.Juyn * */
/* * - fixed some small compiler warnings (thanks Nikki) * */
/* * * */
/* * 1.0.5 - 09/07/2002 - G.Juyn * */
/* * - B578940 - unimplemented functions return errorcode * */
/* * 1.0.5 - 08/19/2002 - G.Juyn * */
/* * - B597134 - libmng pollutes the linker namespace * */
/* * - added HLAPI function to copy chunks * */
/* * 1.0.5 - 09/14/2002 - G.Juyn * */
/* * - added event handling for dynamic MNG * */
/* * 1.0.5 - 10/07/2002 - G.Juyn * */
/* * - added check for TERM placement during create/write * */
/* * 1.0.5 - 11/28/2002 - G.Juyn * */
/* * - fixed definition of iMethodX/Y for MAGN chunk * */
/* * * */
/* * 1.0.6 - 05/25/2003 - G.R-P * */
/* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */
/* * 1.0.6 - 07/07/2003 - G.R-P * */
/* * - added MNG_NO_DELTA_PNG reduction and more SKIPCHUNK * */
/* * optimizations * */
/* * 1.0.6 - 07/29/2003 - G.R-P * */
/* * - added conditionals around PAST chunk support * */
/* * 1.0.6 - 08/17/2003 - G.R-P * */
/* * - added conditionals around non-VLC chunk support * */
/* * * */
/* * 1.0.8 - 04/01/2004 - G.Juyn * */
/* * - added missing get-/put-chunk-jdaa * */
/* * 1.0.8 - 08/02/2004 - G.Juyn * */
/* * - added conditional to allow easier writing of large MNG's * */
/* * * */
/* * 1.0.9 - 09/17/2004 - G.R-P * */
/* * - added two more conditionals * */
/* * 1.0.9 - 09/25/2004 - G.Juyn * */
/* * - replaced MNG_TWEAK_LARGE_FILES with permanent solution * */
/* * 1.0.9 - 17/14/2004 - G.Juyn * */
/* * - fixed PPLT getchunk/putchunk routines * */
/* * 1.0.9 - 12/05/2004 - G.Juyn * */
/* * - added conditional MNG_OPTIMIZE_CHUNKINITFREE * */
/* * 1.0.9 - 12/20/2004 - G.Juyn * */
/* * - cleaned up macro-invocations (thanks to D. Airlie) * */
/* * * */
/* * 1.0.10 - 04/08/2007 - G.Juyn * */
/* * - added support for mPNG proposal * */
/* * * */
/* ************************************************************************** */
#include "libmng.h"
#include "libmng_data.h"
#include "libmng_error.h"
#include "libmng_trace.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "libmng_memory.h"
#include "libmng_chunks.h"
#ifdef MNG_OPTIMIZE_CHUNKREADER
#include "libmng_chunk_descr.h"
#endif
#include "libmng_chunk_prc.h"
#include "libmng_chunk_io.h"
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
#pragma option -A /* force ANSI-C */
#endif
/* ************************************************************************** */
#ifdef MNG_ACCESS_CHUNKS
/* ************************************************************************** */
mng_retcode MNG_DECL mng_iterate_chunks (mng_handle hHandle,
mng_uint32 iChunkseq,
mng_iteratechunk fProc)
{
mng_uint32 iSeq;
mng_chunkid iChunkname;
mng_datap pData;
mng_chunkp pChunk;
mng_bool bCont;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_ITERATE_CHUNKS, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = ((mng_datap)hHandle); /* and make it addressable */
iSeq = 0;
bCont = MNG_TRUE;
pChunk = pData->pFirstchunk; /* get the first chunk */
/* as long as there are some more */
while ((pChunk) && (bCont)) /* and the app didn't signal a stop */
{
if (iSeq >= iChunkseq) /* reached the first target ? */
{ /* then call this and next ones back in... */
iChunkname = ((mng_chunk_headerp)pChunk)->iChunkname;
bCont = fProc (hHandle, (mng_handle)pChunk, iChunkname, iSeq);
}
iSeq++; /* next one */
pChunk = ((mng_chunk_headerp)pChunk)->pNext;
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_ITERATE_CHUNKS, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifdef MNG_SUPPORT_WRITE
mng_retcode MNG_DECL mng_copy_chunk (mng_handle hHandle,
mng_handle hChunk,
mng_handle hHandleOut)
{
mng_datap pDataOut;
mng_chunkp pChunk;
mng_chunkp pChunkOut;
mng_retcode iRetcode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_COPY_CHUNK, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handles */
MNG_VALIDHANDLE (hHandleOut)
pDataOut = (mng_datap)hHandleOut; /* make outhandle addressable */
pChunk = (mng_chunkp)hChunk; /* address the chunk */
if (!pDataOut->bCreating) /* aren't we creating a new file ? */
MNG_ERROR (pDataOut, MNG_FUNCTIONINVALID)
/* create a new chunk */
iRetcode = ((mng_createchunk)((mng_chunk_headerp)pChunk)->fCreate)
(pDataOut, ((mng_chunk_headerp)pChunk), &pChunkOut);
if (!iRetcode) /* assign the chunk-specific data */
iRetcode = ((mng_assignchunk)((mng_chunk_headerp)pChunk)->fAssign)
(pDataOut, pChunkOut, pChunk);
if (iRetcode) /* on error bail out */
return iRetcode;
mng_add_chunk (pDataOut, pChunkOut); /* and put it in the output-stream */
/* could it be the end of the chain ? */
if (((mng_chunk_headerp)pChunkOut)->iChunkname == MNG_UINT_IEND)
{
#ifdef MNG_INCLUDE_JNG
if ((pDataOut->iFirstchunkadded == MNG_UINT_IHDR) ||
(pDataOut->iFirstchunkadded == MNG_UINT_JHDR) )
#else
if (pDataOut->iFirstchunkadded == MNG_UINT_IHDR)
#endif
pDataOut->bCreating = MNG_FALSE; /* right; this should be the last chunk !!! */
}
if (((mng_chunk_headerp)pChunkOut)->iChunkname == MNG_UINT_MEND)
pDataOut->bCreating = MNG_FALSE; /* definitely this should be the last !!! */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_COPY_CHUNK, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_SUPPORT_WRITE */
/* ************************************************************************** */
mng_retcode MNG_DECL mng_getchunk_ihdr (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iWidth,
mng_uint32 *iHeight,
mng_uint8 *iBitdepth,
mng_uint8 *iColortype,
mng_uint8 *iCompression,
mng_uint8 *iFilter,
mng_uint8 *iInterlace)
{
mng_datap pData;
mng_ihdrp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_IHDR, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_ihdrp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_IHDR)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iWidth = pChunk->iWidth; /* fill the fields */
*iHeight = pChunk->iHeight;
*iBitdepth = pChunk->iBitdepth;
*iColortype = pChunk->iColortype;
*iCompression = pChunk->iCompression;
*iFilter = pChunk->iFilter;
*iInterlace = pChunk->iInterlace;
/* fill the chunk */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_IHDR, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_getchunk_plte (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iCount,
mng_palette8 *aPalette)
{
mng_datap pData;
mng_pltep pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PLTE, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_pltep)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_PLTE)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iCount = pChunk->iEntrycount; /* fill the fields */
MNG_COPY (*aPalette, pChunk->aEntries, sizeof (mng_palette8));
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PLTE, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_getchunk_idat (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iRawlen,
mng_ptr *pRawdata)
{
mng_datap pData;
mng_idatp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_IDAT, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_idatp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_IDAT)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iRawlen = pChunk->iDatasize; /* fill the fields */
*pRawdata = pChunk->pData;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_IDAT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_getchunk_trns (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_bool *bGlobal,
mng_uint8 *iType,
mng_uint32 *iCount,
mng_uint8arr *aAlphas,
mng_uint16 *iGray,
mng_uint16 *iRed,
mng_uint16 *iGreen,
mng_uint16 *iBlue,
mng_uint32 *iRawlen,
mng_uint8arr *aRawdata)
{
mng_datap pData;
mng_trnsp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TRNS, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_trnsp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_tRNS)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*bEmpty = pChunk->bEmpty; /* fill the fields */
*bGlobal = pChunk->bGlobal;
*iType = pChunk->iType;
*iCount = pChunk->iCount;
*iGray = pChunk->iGray;
*iRed = pChunk->iRed;
*iGreen = pChunk->iGreen;
*iBlue = pChunk->iBlue;
*iRawlen = pChunk->iRawlen;
MNG_COPY (*aAlphas, pChunk->aEntries, sizeof (mng_uint8arr));
MNG_COPY (*aRawdata, pChunk->aRawdata, sizeof (mng_uint8arr));
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TRNS, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_gAMA
mng_retcode MNG_DECL mng_getchunk_gama (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint32 *iGamma)
{
mng_datap pData;
mng_gamap pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_GAMA, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_gamap)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_gAMA)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*bEmpty = pChunk->bEmpty; /* fill the fields */
*iGamma = pChunk->iGamma;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_GAMA, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_cHRM
mng_retcode MNG_DECL mng_getchunk_chrm (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint32 *iWhitepointx,
mng_uint32 *iWhitepointy,
mng_uint32 *iRedx,
mng_uint32 *iRedy,
mng_uint32 *iGreenx,
mng_uint32 *iGreeny,
mng_uint32 *iBluex,
mng_uint32 *iBluey)
{
mng_datap pData;
mng_chrmp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CHRM, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_chrmp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_cHRM)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*bEmpty = pChunk->bEmpty; /* fill the fields */
*iWhitepointx = pChunk->iWhitepointx;
*iWhitepointy = pChunk->iWhitepointy;
*iRedx = pChunk->iRedx;
*iRedy = pChunk->iRedy;
*iGreenx = pChunk->iGreenx;
*iGreeny = pChunk->iGreeny;
*iBluex = pChunk->iBluex;
*iBluey = pChunk->iBluey;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CHRM, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_sRGB
mng_retcode MNG_DECL mng_getchunk_srgb (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint8 *iRenderingintent)
{
mng_datap pData;
mng_srgbp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SRGB, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_srgbp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_sRGB)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*bEmpty = pChunk->bEmpty; /* fill the fields */
*iRenderingintent = pChunk->iRenderingintent;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SRGB, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_iCCP
mng_retcode MNG_DECL mng_getchunk_iccp (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint32 *iNamesize,
mng_pchar *zName,
mng_uint8 *iCompression,
mng_uint32 *iProfilesize,
mng_ptr *pProfile)
{
mng_datap pData;
mng_iccpp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ICCP, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_iccpp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_iCCP)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*bEmpty = pChunk->bEmpty; /* fill the fields */
*iNamesize = pChunk->iNamesize;
*zName = pChunk->zName;
*iCompression = pChunk->iCompression;
*iProfilesize = pChunk->iProfilesize;
*pProfile = pChunk->pProfile;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ICCP, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_tEXt
mng_retcode MNG_DECL mng_getchunk_text (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iKeywordsize,
mng_pchar *zKeyword,
mng_uint32 *iTextsize,
mng_pchar *zText)
{
mng_datap pData;
mng_textp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TEXT, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_textp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_tEXt)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
/* fill the fields */
*iKeywordsize = pChunk->iKeywordsize;
*zKeyword = pChunk->zKeyword;
*iTextsize = pChunk->iTextsize;
*zText = pChunk->zText;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TEXT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_zTXt
mng_retcode MNG_DECL mng_getchunk_ztxt (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iKeywordsize,
mng_pchar *zKeyword,
mng_uint8 *iCompression,
mng_uint32 *iTextsize,
mng_pchar *zText)
{
mng_datap pData;
mng_ztxtp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ZTXT, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_ztxtp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_zTXt)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
/* fill the fields */
*iKeywordsize = pChunk->iKeywordsize;
*zKeyword = pChunk->zKeyword;
*iCompression = pChunk->iCompression;
*iTextsize = pChunk->iTextsize;
*zText = pChunk->zText;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ZTXT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_iTXt
mng_retcode MNG_DECL mng_getchunk_itxt (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iKeywordsize,
mng_pchar *zKeyword,
mng_uint8 *iCompressionflag,
mng_uint8 *iCompressionmethod,
mng_uint32 *iLanguagesize,
mng_pchar *zLanguage,
mng_uint32 *iTranslationsize,
mng_pchar *zTranslation,
mng_uint32 *iTextsize,
mng_pchar *zText)
{
mng_datap pData;
mng_itxtp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ITXT, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_itxtp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_iTXt)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
/* fill the fields */
*iKeywordsize = pChunk->iKeywordsize;
*zKeyword = pChunk->zKeyword;
*iCompressionflag = pChunk->iCompressionflag;
*iCompressionmethod = pChunk->iCompressionmethod;
*iLanguagesize = pChunk->iLanguagesize;
*zLanguage = pChunk->zLanguage;
*iTranslationsize = pChunk->iTranslationsize;
*zTranslation = pChunk->zTranslation;
*iTextsize = pChunk->iTextsize;
*zText = pChunk->zText;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ITXT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_bKGD
mng_retcode MNG_DECL mng_getchunk_bkgd (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint8 *iType,
mng_uint8 *iIndex,
mng_uint16 *iGray,
mng_uint16 *iRed,
mng_uint16 *iGreen,
mng_uint16 *iBlue)
{
mng_datap pData;
mng_bkgdp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BKGD, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_bkgdp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_bKGD)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*bEmpty = pChunk->bEmpty; /* fill the fields */
*iType = pChunk->iType;
*iIndex = pChunk->iIndex;
*iGray = pChunk->iGray;
*iRed = pChunk->iRed;
*iGreen = pChunk->iGreen;
*iBlue = pChunk->iBlue;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BKGD, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_pHYs
mng_retcode MNG_DECL mng_getchunk_phys (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint32 *iSizex,
mng_uint32 *iSizey,
mng_uint8 *iUnit)
{
mng_datap pData;
mng_physp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PHYS, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_physp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_pHYs)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*bEmpty = pChunk->bEmpty; /* fill the fields */
*iSizex = pChunk->iSizex;
*iSizey = pChunk->iSizey;
*iUnit = pChunk->iUnit;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PHYS, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_sBIT
mng_retcode MNG_DECL mng_getchunk_sbit (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint8 *iType,
mng_uint8arr4 *aBits)
{
mng_datap pData;
mng_sbitp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SBIT, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_sbitp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_sBIT)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*bEmpty = pChunk->bEmpty;
*iType = pChunk->iType;
(*aBits)[0] = pChunk->aBits[0];
(*aBits)[1] = pChunk->aBits[1];
(*aBits)[2] = pChunk->aBits[2];
(*aBits)[3] = pChunk->aBits[3];
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SBIT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_sPLT
mng_retcode MNG_DECL mng_getchunk_splt (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint32 *iNamesize,
mng_pchar *zName,
mng_uint8 *iSampledepth,
mng_uint32 *iEntrycount,
mng_ptr *pEntries)
{
mng_datap pData;
mng_spltp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SPLT, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_spltp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_sPLT)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*bEmpty = pChunk->bEmpty; /* fill the fields */
*iNamesize = pChunk->iNamesize;
*zName = pChunk->zName;
*iSampledepth = pChunk->iSampledepth;
*iEntrycount = pChunk->iEntrycount;
*pEntries = pChunk->pEntries;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SPLT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_hIST
mng_retcode MNG_DECL mng_getchunk_hist (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iEntrycount,
mng_uint16arr *aEntries)
{
mng_datap pData;
mng_histp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_HIST, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_histp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_hIST)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iEntrycount = pChunk->iEntrycount; /* fill the fields */
MNG_COPY (*aEntries, pChunk->aEntries, sizeof (mng_uint16arr));
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_HIST, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_tIME
mng_retcode MNG_DECL mng_getchunk_time (mng_handle hHandle,
mng_handle hChunk,
mng_uint16 *iYear,
mng_uint8 *iMonth,
mng_uint8 *iDay,
mng_uint8 *iHour,
mng_uint8 *iMinute,
mng_uint8 *iSecond)
{
mng_datap pData;
mng_timep pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TIME, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_timep)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_tIME)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iYear = pChunk->iYear; /* fill the fields */
*iMonth = pChunk->iMonth;
*iDay = pChunk->iDay;
*iHour = pChunk->iHour;
*iMinute = pChunk->iMinute;
*iSecond = pChunk->iSecond;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TIME, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode MNG_DECL mng_getchunk_mhdr (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iWidth,
mng_uint32 *iHeight,
mng_uint32 *iTicks,
mng_uint32 *iLayercount,
mng_uint32 *iFramecount,
mng_uint32 *iPlaytime,
mng_uint32 *iSimplicity)
{
mng_datap pData;
mng_mhdrp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MHDR, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_mhdrp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_MHDR)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iWidth = pChunk->iWidth; /* fill the fields */
*iHeight = pChunk->iHeight;
*iTicks = pChunk->iTicks;
*iLayercount = pChunk->iLayercount;
*iFramecount = pChunk->iFramecount;
*iPlaytime = pChunk->iPlaytime;
*iSimplicity = pChunk->iSimplicity;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MHDR, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_LOOP
mng_retcode MNG_DECL mng_getchunk_loop (mng_handle hHandle,
mng_handle hChunk,
mng_uint8 *iLevel,
mng_uint32 *iRepeat,
mng_uint8 *iTermination,
mng_uint32 *iItermin,
mng_uint32 *iItermax,
mng_uint32 *iCount,
mng_uint32p *pSignals)
{
mng_datap pData;
mng_loopp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_LOOP, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_loopp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_LOOP)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iLevel = pChunk->iLevel; /* fill teh fields */
*iRepeat = pChunk->iRepeat;
*iTermination = pChunk->iTermination;
*iItermin = pChunk->iItermin;
*iItermax = pChunk->iItermax;
*iCount = pChunk->iCount;
*pSignals = pChunk->pSignals;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_LOOP, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_getchunk_endl (mng_handle hHandle,
mng_handle hChunk,
mng_uint8 *iLevel)
{
mng_datap pData;
mng_endlp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ENDL, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_endlp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_ENDL)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iLevel = pChunk->iLevel; /* fill the field */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ENDL, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_DEFI
mng_retcode MNG_DECL mng_getchunk_defi (mng_handle hHandle,
mng_handle hChunk,
mng_uint16 *iObjectid,
mng_uint8 *iDonotshow,
mng_uint8 *iConcrete,
mng_bool *bHasloca,
mng_int32 *iXlocation,
mng_int32 *iYlocation,
mng_bool *bHasclip,
mng_int32 *iLeftcb,
mng_int32 *iRightcb,
mng_int32 *iTopcb,
mng_int32 *iBottomcb)
{
mng_datap pData;
mng_defip pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DEFI, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_defip)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_DEFI)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iObjectid = pChunk->iObjectid; /* fill the fields */
*iDonotshow = pChunk->iDonotshow;
*iConcrete = pChunk->iConcrete;
*bHasloca = pChunk->bHasloca;
*iXlocation = pChunk->iXlocation;
*iYlocation = pChunk->iYlocation;
*bHasclip = pChunk->bHasclip;
*iLeftcb = pChunk->iLeftcb;
*iRightcb = pChunk->iRightcb;
*iTopcb = pChunk->iTopcb;
*iBottomcb = pChunk->iBottomcb;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DEFI, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_BASI
mng_retcode MNG_DECL mng_getchunk_basi (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iWidth,
mng_uint32 *iHeight,
mng_uint8 *iBitdepth,
mng_uint8 *iColortype,
mng_uint8 *iCompression,
mng_uint8 *iFilter,
mng_uint8 *iInterlace,
mng_uint16 *iRed,
mng_uint16 *iGreen,
mng_uint16 *iBlue,
mng_uint16 *iAlpha,
mng_uint8 *iViewable)
{
mng_datap pData;
mng_basip pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BASI, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_basip)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_BASI)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iWidth = pChunk->iWidth; /* fill the fields */
*iHeight = pChunk->iHeight;
*iBitdepth = pChunk->iBitdepth;
*iColortype = pChunk->iColortype;
*iCompression = pChunk->iCompression;
*iFilter = pChunk->iFilter;
*iInterlace = pChunk->iInterlace;
*iRed = pChunk->iRed;
*iGreen = pChunk->iGreen;
*iBlue = pChunk->iBlue;
*iAlpha = pChunk->iAlpha;
*iViewable = pChunk->iViewable;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BASI, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_CLON
mng_retcode MNG_DECL mng_getchunk_clon (mng_handle hHandle,
mng_handle hChunk,
mng_uint16 *iSourceid,
mng_uint16 *iCloneid,
mng_uint8 *iClonetype,
mng_uint8 *iDonotshow,
mng_uint8 *iConcrete,
mng_bool *bHasloca,
mng_uint8 *iLocationtype,
mng_int32 *iLocationx,
mng_int32 *iLocationy)
{
mng_datap pData;
mng_clonp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CLON, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_clonp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_CLON)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iSourceid = pChunk->iSourceid; /* fill the fields */
*iCloneid = pChunk->iCloneid;
*iClonetype = pChunk->iClonetype;
*iDonotshow = pChunk->iDonotshow;
*iConcrete = pChunk->iConcrete;
*bHasloca = pChunk->bHasloca;
*iLocationtype = pChunk->iLocationtype;
*iLocationx = pChunk->iLocationx;
*iLocationy = pChunk->iLocationy;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CLON, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_PAST
mng_retcode MNG_DECL mng_getchunk_past (mng_handle hHandle,
mng_handle hChunk,
mng_uint16 *iDestid,
mng_uint8 *iTargettype,
mng_int32 *iTargetx,
mng_int32 *iTargety,
mng_uint32 *iCount)
{
mng_datap pData;
mng_pastp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PAST, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_pastp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_PAST)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iDestid = pChunk->iDestid; /* fill the fields */
*iTargettype = pChunk->iTargettype;
*iTargetx = pChunk->iTargetx;
*iTargety = pChunk->iTargety;
*iCount = pChunk->iCount;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PAST, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_PAST
mng_retcode MNG_DECL mng_getchunk_past_src (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 iEntry,
mng_uint16 *iSourceid,
mng_uint8 *iComposition,
mng_uint8 *iOrientation,
mng_uint8 *iOffsettype,
mng_int32 *iOffsetx,
mng_int32 *iOffsety,
mng_uint8 *iBoundarytype,
mng_int32 *iBoundaryl,
mng_int32 *iBoundaryr,
mng_int32 *iBoundaryt,
mng_int32 *iBoundaryb)
{
mng_datap pData;
mng_pastp pChunk;
mng_past_sourcep pEntry;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PAST_SRC, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_pastp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_PAST)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
if (iEntry >= pChunk->iCount) /* valid index ? */
MNG_ERROR (pData, MNG_INVALIDENTRYIX)
/* address the entry */
pEntry = pChunk->pSources + iEntry;
*iSourceid = pEntry->iSourceid; /* fill the fields */
*iComposition = pEntry->iComposition;
*iOrientation = pEntry->iOrientation;
*iOffsettype = pEntry->iOffsettype;
*iOffsetx = pEntry->iOffsetx;
*iOffsety = pEntry->iOffsety;
*iBoundarytype = pEntry->iBoundarytype;
*iBoundaryl = pEntry->iBoundaryl;
*iBoundaryr = pEntry->iBoundaryr;
*iBoundaryt = pEntry->iBoundaryt;
*iBoundaryb = pEntry->iBoundaryb;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PAST_SRC, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_DISC
mng_retcode MNG_DECL mng_getchunk_disc (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iCount,
mng_uint16p *pObjectids)
{
mng_datap pData;
mng_discp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DISC, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_discp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_DISC)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iCount = pChunk->iCount; /* fill the fields */
*pObjectids = pChunk->pObjectids;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DISC, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_BACK
mng_retcode MNG_DECL mng_getchunk_back (mng_handle hHandle,
mng_handle hChunk,
mng_uint16 *iRed,
mng_uint16 *iGreen,
mng_uint16 *iBlue,
mng_uint8 *iMandatory,
mng_uint16 *iImageid,
mng_uint8 *iTile)
{
mng_datap pData;
mng_backp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BACK, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_backp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_BACK)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iRed = pChunk->iRed; /* fill the fields */
*iGreen = pChunk->iGreen;
*iBlue = pChunk->iBlue;
*iMandatory = pChunk->iMandatory;
*iImageid = pChunk->iImageid;
*iTile = pChunk->iTile;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BACK, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_FRAM
mng_retcode MNG_DECL mng_getchunk_fram (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint8 *iMode,
mng_uint32 *iNamesize,
mng_pchar *zName,
mng_uint8 *iChangedelay,
mng_uint8 *iChangetimeout,
mng_uint8 *iChangeclipping,
mng_uint8 *iChangesyncid,
mng_uint32 *iDelay,
mng_uint32 *iTimeout,
mng_uint8 *iBoundarytype,
mng_int32 *iBoundaryl,
mng_int32 *iBoundaryr,
mng_int32 *iBoundaryt,
mng_int32 *iBoundaryb,
mng_uint32 *iCount,
mng_uint32p *pSyncids)
{
mng_datap pData;
mng_framp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_FRAM, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_framp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_FRAM)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*bEmpty = pChunk->bEmpty; /* fill the fields */
*iMode = pChunk->iMode;
*iNamesize = pChunk->iNamesize;
*zName = pChunk->zName;
*iChangedelay = pChunk->iChangedelay;
*iChangetimeout = pChunk->iChangetimeout;
*iChangeclipping = pChunk->iChangeclipping;
*iChangesyncid = pChunk->iChangesyncid;
*iDelay = pChunk->iDelay;
*iTimeout = pChunk->iTimeout;
*iBoundarytype = pChunk->iBoundarytype;
*iBoundaryl = pChunk->iBoundaryl;
*iBoundaryr = pChunk->iBoundaryr;
*iBoundaryt = pChunk->iBoundaryt;
*iBoundaryb = pChunk->iBoundaryb;
*iCount = pChunk->iCount;
*pSyncids = pChunk->pSyncids;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_FRAM, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_MOVE
mng_retcode MNG_DECL mng_getchunk_move (mng_handle hHandle,
mng_handle hChunk,
mng_uint16 *iFirstid,
mng_uint16 *iLastid,
mng_uint8 *iMovetype,
mng_int32 *iMovex,
mng_int32 *iMovey)
{
mng_datap pData;
mng_movep pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MOVE, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_movep)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_MOVE)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iFirstid = pChunk->iFirstid; /* fill the fields */
*iLastid = pChunk->iLastid;
*iMovetype = pChunk->iMovetype;
*iMovex = pChunk->iMovex;
*iMovey = pChunk->iMovey;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MOVE, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_CLIP
mng_retcode MNG_DECL mng_getchunk_clip (mng_handle hHandle,
mng_handle hChunk,
mng_uint16 *iFirstid,
mng_uint16 *iLastid,
mng_uint8 *iCliptype,
mng_int32 *iClipl,
mng_int32 *iClipr,
mng_int32 *iClipt,
mng_int32 *iClipb)
{
mng_datap pData;
mng_clipp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CLIP, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_clipp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_CLIP)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iFirstid = pChunk->iFirstid; /* fill the fields */
*iLastid = pChunk->iLastid;
*iCliptype = pChunk->iCliptype;
*iClipl = pChunk->iClipl;
*iClipr = pChunk->iClipr;
*iClipt = pChunk->iClipt;
*iClipb = pChunk->iClipb;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CLIP, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_SHOW
mng_retcode MNG_DECL mng_getchunk_show (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint16 *iFirstid,
mng_uint16 *iLastid,
mng_uint8 *iMode)
{
mng_datap pData;
mng_showp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SHOW, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_showp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_SHOW)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*bEmpty = pChunk->bEmpty; /* fill the fields */
*iFirstid = pChunk->iFirstid;
*iLastid = pChunk->iLastid;
*iMode = pChunk->iMode;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SHOW, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_TERM
mng_retcode MNG_DECL mng_getchunk_term (mng_handle hHandle,
mng_handle hChunk,
mng_uint8 *iTermaction,
mng_uint8 *iIteraction,
mng_uint32 *iDelay,
mng_uint32 *iItermax)
{
mng_datap pData;
mng_termp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TERM, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_termp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_TERM)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iTermaction = pChunk->iTermaction; /* fill the fields */
*iIteraction = pChunk->iIteraction;
*iDelay = pChunk->iDelay;
*iItermax = pChunk->iItermax;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TERM, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_SAVE
mng_retcode MNG_DECL mng_getchunk_save (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint8 *iOffsettype,
mng_uint32 *iCount)
{
mng_datap pData;
mng_savep pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SAVE, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_savep)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_SAVE)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*bEmpty = pChunk->bEmpty; /* fill the fields */
*iOffsettype = pChunk->iOffsettype;
*iCount = pChunk->iCount;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SAVE, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_getchunk_save_entry (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 iEntry,
mng_uint8 *iEntrytype,
mng_uint32arr2 *iOffset,
mng_uint32arr2 *iStarttime,
mng_uint32 *iLayernr,
mng_uint32 *iFramenr,
mng_uint32 *iNamesize,
mng_pchar *zName)
{
mng_datap pData;
mng_savep pChunk;
mng_save_entryp pEntry;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SAVE_ENTRY, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_savep)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_SAVE)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
if (iEntry >= pChunk->iCount) /* valid index ? */
MNG_ERROR (pData, MNG_INVALIDENTRYIX)
pEntry = pChunk->pEntries + iEntry; /* address the entry */
/* fill the fields */
*iEntrytype = pEntry->iEntrytype;
(*iOffset)[0] = pEntry->iOffset[0];
(*iOffset)[1] = pEntry->iOffset[1];
(*iStarttime)[0] = pEntry->iStarttime[0];
(*iStarttime)[1] = pEntry->iStarttime[1];
*iLayernr = pEntry->iLayernr;
*iFramenr = pEntry->iFramenr;
*iNamesize = pEntry->iNamesize;
*zName = pEntry->zName;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SAVE_ENTRY, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_SEEK
mng_retcode MNG_DECL mng_getchunk_seek (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iNamesize,
mng_pchar *zName)
{
mng_datap pData;
mng_seekp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SEEK, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_seekp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_SEEK)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iNamesize = pChunk->iNamesize; /* fill the fields */
*zName = pChunk->zName;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SEEK, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_eXPI
mng_retcode MNG_DECL mng_getchunk_expi (mng_handle hHandle,
mng_handle hChunk,
mng_uint16 *iSnapshotid,
mng_uint32 *iNamesize,
mng_pchar *zName)
{
mng_datap pData;
mng_expip pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EXPI, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_expip)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_eXPI)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iSnapshotid = pChunk->iSnapshotid; /* fill the fields */
*iNamesize = pChunk->iNamesize;
*zName = pChunk->zName;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EXPI, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_fPRI
mng_retcode MNG_DECL mng_getchunk_fpri (mng_handle hHandle,
mng_handle hChunk,
mng_uint8 *iDeltatype,
mng_uint8 *iPriority)
{
mng_datap pData;
mng_fprip pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_FPRI, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_fprip)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_fPRI)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iDeltatype = pChunk->iDeltatype; /* fill the fields */
*iPriority = pChunk->iPriority;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_FPRI, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_nEED
mng_retcode MNG_DECL mng_getchunk_need (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iKeywordssize,
mng_pchar *zKeywords)
{
mng_datap pData;
mng_needp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_NEED, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_needp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_nEED)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
/* fill the fields */
*iKeywordssize = pChunk->iKeywordssize;
*zKeywords = pChunk->zKeywords;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_NEED, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_pHYg
mng_retcode MNG_DECL mng_getchunk_phyg (mng_handle hHandle,
mng_handle hChunk,
mng_bool *bEmpty,
mng_uint32 *iSizex,
mng_uint32 *iSizey,
mng_uint8 *iUnit)
{
mng_datap pData;
mng_phygp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PHYG, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_phygp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_pHYg)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*bEmpty = pChunk->bEmpty; /* fill the fields */
*iSizex = pChunk->iSizex;
*iSizey = pChunk->iSizey;
*iUnit = pChunk->iUnit;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PHYG, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG
mng_retcode MNG_DECL mng_getchunk_jhdr (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iWidth,
mng_uint32 *iHeight,
mng_uint8 *iColortype,
mng_uint8 *iImagesampledepth,
mng_uint8 *iImagecompression,
mng_uint8 *iImageinterlace,
mng_uint8 *iAlphasampledepth,
mng_uint8 *iAlphacompression,
mng_uint8 *iAlphafilter,
mng_uint8 *iAlphainterlace)
{
mng_datap pData;
mng_jhdrp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JHDR, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_jhdrp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_JHDR)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iWidth = pChunk->iWidth; /* fill the fields */
*iHeight = pChunk->iHeight;
*iColortype = pChunk->iColortype;
*iImagesampledepth = pChunk->iImagesampledepth;
*iImagecompression = pChunk->iImagecompression;
*iImageinterlace = pChunk->iImageinterlace;
*iAlphasampledepth = pChunk->iAlphasampledepth;
*iAlphacompression = pChunk->iAlphacompression;
*iAlphafilter = pChunk->iAlphafilter;
*iAlphainterlace = pChunk->iAlphainterlace;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JHDR, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_INCLUDE_JNG */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG
mng_retcode MNG_DECL mng_getchunk_jdat (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iRawlen,
mng_ptr *pRawdata)
{
mng_datap pData;
mng_jdatp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JDAT, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_jdatp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_JDAT)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iRawlen = pChunk->iDatasize; /* fill the fields */
*pRawdata = pChunk->pData;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JDAT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_INCLUDE_JNG */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG
mng_retcode MNG_DECL mng_getchunk_jdaa (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iRawlen,
mng_ptr *pRawdata)
{
mng_datap pData;
mng_jdaap pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JDAA, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_jdaap)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_JDAA)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iRawlen = pChunk->iDatasize; /* fill the fields */
*pRawdata = pChunk->pData;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JDAA, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_INCLUDE_JNG */
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
mng_retcode MNG_DECL mng_getchunk_dhdr (mng_handle hHandle,
mng_handle hChunk,
mng_uint16 *iObjectid,
mng_uint8 *iImagetype,
mng_uint8 *iDeltatype,
mng_uint32 *iBlockwidth,
mng_uint32 *iBlockheight,
mng_uint32 *iBlockx,
mng_uint32 *iBlocky)
{
mng_datap pData;
mng_dhdrp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DHDR, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_dhdrp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_DHDR)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iObjectid = pChunk->iObjectid; /* fill the fields */
*iImagetype = pChunk->iImagetype;
*iDeltatype = pChunk->iDeltatype;
*iBlockwidth = pChunk->iBlockwidth;
*iBlockheight = pChunk->iBlockheight;
*iBlockx = pChunk->iBlockx;
*iBlocky = pChunk->iBlocky;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DHDR, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
mng_retcode MNG_DECL mng_getchunk_prom (mng_handle hHandle,
mng_handle hChunk,
mng_uint8 *iColortype,
mng_uint8 *iSampledepth,
mng_uint8 *iFilltype)
{
mng_datap pData;
mng_promp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PROM, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_promp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_PROM)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iColortype = pChunk->iColortype; /* fill the fields */
*iSampledepth = pChunk->iSampledepth;
*iFilltype = pChunk->iFilltype;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PROM, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
mng_retcode MNG_DECL mng_getchunk_pplt (mng_handle hHandle,
mng_handle hChunk,
mng_uint8 *iDeltatype,
mng_uint32 *iCount)
{
mng_datap pData;
mng_ppltp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PPLT, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_ppltp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_PPLT)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iDeltatype = pChunk->iDeltatype; /* fill the fields */
*iCount = pChunk->iCount;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PPLT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
mng_retcode MNG_DECL mng_getchunk_pplt_entry (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 iEntry,
mng_uint16 *iRed,
mng_uint16 *iGreen,
mng_uint16 *iBlue,
mng_uint16 *iAlpha,
mng_bool *bUsed)
{
mng_datap pData;
mng_ppltp pChunk;
mng_pplt_entryp pEntry;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PPLT_ENTRY, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_ppltp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_PPLT)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
if (iEntry >= pChunk->iCount) /* valid index ? */
MNG_ERROR (pData, MNG_INVALIDENTRYIX)
pEntry = &pChunk->aEntries[iEntry]; /* address the entry */
*iRed = pEntry->iRed; /* fill the fields */
*iGreen = pEntry->iGreen;
*iBlue = pEntry->iBlue;
*iAlpha = pEntry->iAlpha;
*bUsed = pEntry->bUsed;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PPLT_ENTRY, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
mng_retcode MNG_DECL mng_getchunk_drop (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iCount,
mng_chunkidp *pChunknames)
{
mng_datap pData;
mng_dropp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DROP, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_dropp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_DROP)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iCount = pChunk->iCount; /* fill the fields */
*pChunknames = pChunk->pChunknames;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DROP, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
#ifndef MNG_SKIPCHUNK_DBYK
mng_retcode MNG_DECL mng_getchunk_dbyk (mng_handle hHandle,
mng_handle hChunk,
mng_chunkid *iChunkname,
mng_uint8 *iPolarity,
mng_uint32 *iKeywordssize,
mng_pchar *zKeywords)
{
mng_datap pData;
mng_dbykp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DBYK, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_dbykp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_DBYK)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iChunkname = pChunk->iChunkname; /* fill the fields */
*iPolarity = pChunk->iPolarity;
*iKeywordssize = pChunk->iKeywordssize;
*zKeywords = pChunk->zKeywords;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DBYK, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
#ifndef MNG_SKIPCHUNK_ORDR
mng_retcode MNG_DECL mng_getchunk_ordr (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iCount)
{
mng_datap pData;
mng_ordrp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ORDR, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_ordrp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_ORDR)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iCount = pChunk->iCount; /* fill the field */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ORDR, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
#ifndef MNG_SKIPCHUNK_ORDR
mng_retcode MNG_DECL mng_getchunk_ordr_entry (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 iEntry,
mng_chunkid *iChunkname,
mng_uint8 *iOrdertype)
{
mng_datap pData;
mng_ordrp pChunk;
mng_ordr_entryp pEntry;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ORDR_ENTRY, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_ordrp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_ORDR)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
if (iEntry >= pChunk->iCount) /* valid index ? */
MNG_ERROR (pData, MNG_INVALIDENTRYIX)
pEntry = pChunk->pEntries + iEntry; /* address the proper entry */
*iChunkname = pEntry->iChunkname; /* fill the fields */
*iOrdertype = pEntry->iOrdertype;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ORDR_ENTRY, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_MAGN
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 = (mng_uint16)pChunk->iMethodX;
*iMX = pChunk->iMX;
*iMY = pChunk->iMY;
*iML = pChunk->iML;
*iMR = pChunk->iMR;
*iMT = pChunk->iMT;
*iMB = pChunk->iMB;
*iMethodY = (mng_uint16)pChunk->iMethodY;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MAGN, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
MNG_EXT mng_retcode MNG_DECL mng_getchunk_mpng (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iFramewidth,
mng_uint32 *iFrameheight,
mng_uint16 *iNumplays,
mng_uint16 *iTickspersec,
mng_uint8 *iCompressionmethod,
mng_uint32 *iCount)
{
mng_datap pData;
mng_mpngp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MPNG, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_mpngp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_mpNG)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
/* fill the fields */
*iFramewidth = pChunk->iFramewidth;
*iFrameheight = pChunk->iFrameheight;
*iNumplays = pChunk->iNumplays;
*iTickspersec = pChunk->iTickspersec;
*iCompressionmethod = pChunk->iCompressionmethod;
*iCount = pChunk->iFramessize / sizeof (mng_mpng_frame);
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MPNG, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
MNG_EXT mng_retcode MNG_DECL mng_getchunk_mpng_frame (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 iEntry,
mng_uint32 *iX,
mng_uint32 *iY,
mng_uint32 *iWidth,
mng_uint32 *iHeight,
mng_int32 *iXoffset,
mng_int32 *iYoffset,
mng_uint16 *iTicks)
{
mng_datap pData;
mng_mpngp pChunk;
mng_mpng_framep pFrame;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MPNG_FRAME, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_mpngp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_mpNG)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
/* valid index ? */
if (iEntry >= (pChunk->iFramessize / sizeof (mng_mpng_frame)))
MNG_ERROR (pData, MNG_INVALIDENTRYIX)
pFrame = pChunk->pFrames + iEntry; /* address the entry */
/* fill the fields */
*iX = pFrame->iX;
*iY = pFrame->iY;
*iWidth = pFrame->iWidth;
*iHeight = pFrame->iHeight;
*iXoffset = pFrame->iXoffset;
*iYoffset = pFrame->iYoffset;
*iTicks = pFrame->iTicks;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MPNG_FRAME, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_evNT
mng_retcode MNG_DECL mng_getchunk_evnt (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 *iCount)
{
mng_datap pData;
mng_evntp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EVNT, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_evntp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_evNT)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
*iCount = pChunk->iCount; /* fill the fields */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EVNT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_getchunk_evnt_entry (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 iEntry,
mng_uint8 *iEventtype,
mng_uint8 *iMasktype,
mng_int32 *iLeft,
mng_int32 *iRight,
mng_int32 *iTop,
mng_int32 *iBottom,
mng_uint16 *iObjectid,
mng_uint8 *iIndex,
mng_uint32 *iSegmentnamesize,
mng_pchar *zSegmentname)
{
mng_datap pData;
mng_evntp pChunk;
mng_evnt_entryp pEntry;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EVNT_ENTRY, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_evntp)hChunk; /* address the chunk */
if (pChunk->sHeader.iChunkname != MNG_UINT_evNT)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
if (iEntry >= pChunk->iCount) /* valid index ? */
MNG_ERROR (pData, MNG_INVALIDENTRYIX)
pEntry = pChunk->pEntries + iEntry; /* address the entry */
/* fill the fields */
*iEventtype = pEntry->iEventtype;
*iMasktype = pEntry->iMasktype;
*iLeft = pEntry->iLeft;
*iRight = pEntry->iRight;
*iTop = pEntry->iTop;
*iBottom = pEntry->iBottom;
*iObjectid = pEntry->iObjectid;
*iIndex = pEntry->iIndex;
*iSegmentnamesize = pEntry->iSegmentnamesize;
*zSegmentname = pEntry->zSegmentname;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EVNT_ENTRY, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode MNG_DECL mng_getchunk_unknown (mng_handle hHandle,
mng_handle hChunk,
mng_chunkid *iChunkname,
mng_uint32 *iRawlen,
mng_ptr *pRawdata)
{
mng_datap pData;
mng_unknown_chunkp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_UNKNOWN, MNG_LC_START);
#endif
MNG_VALIDHANDLE (hHandle) /* check validity handle */
pData = (mng_datap)hHandle; /* and make it addressable */
pChunk = (mng_unknown_chunkp)hChunk; /* address the chunk */
if (pChunk->sHeader.fCleanup != mng_free_unknown)
MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */
/* fill the fields */
*iChunkname = pChunk->sHeader.iChunkname;
*iRawlen = pChunk->iDatasize;
*pRawdata = pChunk->pData;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_UNKNOWN, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_WRITE_PROCS
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_TERM
MNG_LOCAL mng_bool check_term (mng_datap pData,
mng_chunkid iChunkname)
{
mng_chunk_headerp pChunk = (mng_chunk_headerp)pData->pLastchunk;
if (!pChunk) /* nothing added yet ? */
return MNG_TRUE;
/* last added chunk is TERM ? */
if (pChunk->iChunkname != MNG_UINT_TERM)
return MNG_TRUE;
/* previous to last is MHDR ? */
if ((pChunk->pPrev) && (((mng_chunk_headerp)pChunk->pPrev)->iChunkname == MNG_UINT_MHDR))
return MNG_TRUE;
if (iChunkname == MNG_UINT_SEEK) /* new chunk to be added is SEEK ? */
return MNG_TRUE;
return MNG_FALSE;
}
#endif
/* ************************************************************************** */
mng_retcode MNG_DECL mng_putchunk_ihdr (mng_handle hHandle,
mng_uint32 iWidth,
mng_uint32 iHeight,
mng_uint8 iBitdepth,
mng_uint8 iColortype,
mng_uint8 iCompression,
mng_uint8 iFilter,
mng_uint8 iInterlace)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_IHDR, mng_init_general, mng_free_general, mng_read_ihdr, mng_write_ihdr, mng_assign_general, 0, 0, sizeof(mng_ihdr)};
#else
{MNG_UINT_IHDR, mng_init_ihdr, mng_free_ihdr, mng_read_ihdr, mng_write_ihdr, mng_assign_ihdr, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IHDR, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_IHDR))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_ihdr (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_IHDR, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
((mng_ihdrp)pChunk)->iWidth = iWidth;
((mng_ihdrp)pChunk)->iHeight = iHeight;
((mng_ihdrp)pChunk)->iBitdepth = iBitdepth;
((mng_ihdrp)pChunk)->iColortype = iColortype;
((mng_ihdrp)pChunk)->iCompression = iCompression;
((mng_ihdrp)pChunk)->iFilter = iFilter;
((mng_ihdrp)pChunk)->iInterlace = iInterlace;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IHDR, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_putchunk_plte (mng_handle hHandle,
mng_uint32 iCount,
mng_palette8 aPalette)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_PLTE, mng_init_general, mng_free_general, mng_read_plte, mng_write_plte, mng_assign_general, 0, 0, sizeof(mng_plte)};
#else
{MNG_UINT_PLTE, mng_init_plte, mng_free_plte, mng_read_plte, mng_write_plte, mng_assign_plte, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PLTE, 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 header first! */
if (pData->iFirstchunkadded == 0)
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_PLTE))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_plte (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_PLTE, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
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));
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PLTE, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_putchunk_idat (mng_handle hHandle,
mng_uint32 iRawlen,
mng_ptr pRawdata)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_IDAT, mng_init_general, mng_free_idat, mng_read_idat, mng_write_idat, mng_assign_idat, 0, 0, sizeof(mng_idat)};
#else
{MNG_UINT_IDAT, mng_init_idat, mng_free_idat, mng_read_idat, mng_write_idat, mng_assign_idat, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IDAT, 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 header first! */
if (pData->iFirstchunkadded == 0)
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_IDAT))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_idat (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_IDAT, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_idatp)pChunk)->bEmpty = (mng_bool)(iRawlen == 0);
((mng_idatp)pChunk)->iDatasize = iRawlen;
if (iRawlen)
{
MNG_ALLOC (pData, ((mng_idatp)pChunk)->pData, iRawlen);
MNG_COPY (((mng_idatp)pChunk)->pData, pRawdata, iRawlen);
}
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IDAT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_putchunk_iend (mng_handle hHandle)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_IEND, mng_init_general, mng_free_general, mng_read_iend, mng_write_iend, mng_assign_general, 0, 0, sizeof(mng_iend)};
#else
{MNG_UINT_IEND, mng_init_iend, mng_free_iend, mng_read_iend, mng_write_iend, mng_assign_iend, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IEND, 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 header first! */
if (pData->iFirstchunkadded == 0)
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_IEND))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_iend (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_IEND, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_INCLUDE_JNG
if ((pData->iFirstchunkadded == MNG_UINT_IHDR) ||
(pData->iFirstchunkadded == MNG_UINT_JHDR) )
#else
if (pData->iFirstchunkadded == MNG_UINT_IHDR)
#endif
pData->bCreating = MNG_FALSE; /* should be last chunk !!! */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IEND, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_putchunk_trns (mng_handle hHandle,
mng_bool bEmpty,
mng_bool bGlobal,
mng_uint8 iType,
mng_uint32 iCount,
mng_uint8arr aAlphas,
mng_uint16 iGray,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue,
mng_uint32 iRawlen,
mng_uint8arr aRawdata)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_tRNS, mng_init_general, mng_free_general, mng_read_trns, mng_write_trns, mng_assign_general, 0, 0, sizeof(mng_trns)};
#else
{MNG_UINT_tRNS, mng_init_trns, mng_free_trns, mng_read_trns, mng_write_trns, mng_assign_trns, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TRNS, 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 header first! */
if (pData->iFirstchunkadded == 0)
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_tRNS))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_trns (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_tRNS, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_trnsp)pChunk)->bEmpty = bEmpty;
((mng_trnsp)pChunk)->bGlobal = bGlobal;
((mng_trnsp)pChunk)->iType = iType;
((mng_trnsp)pChunk)->iCount = iCount;
((mng_trnsp)pChunk)->iGray = iGray;
((mng_trnsp)pChunk)->iRed = iRed;
((mng_trnsp)pChunk)->iGreen = iGreen;
((mng_trnsp)pChunk)->iBlue = iBlue;
((mng_trnsp)pChunk)->iRawlen = iRawlen;
MNG_COPY (((mng_trnsp)pChunk)->aEntries, aAlphas, sizeof (mng_uint8arr));
MNG_COPY (((mng_trnsp)pChunk)->aRawdata, aRawdata, sizeof (mng_uint8arr));
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TRNS, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_gAMA
mng_retcode MNG_DECL mng_putchunk_gama (mng_handle hHandle,
mng_bool bEmpty,
mng_uint32 iGamma)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_gAMA, mng_init_general, mng_free_general, mng_read_gama, mng_write_gama, mng_assign_general, 0, 0, sizeof(mng_gama)};
#else
{MNG_UINT_gAMA, mng_init_gama, mng_free_gama, mng_read_gama, mng_write_gama, mng_assign_gama, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_GAMA, 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 header first! */
if (pData->iFirstchunkadded == 0)
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_gAMA))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_gama (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_gAMA, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_gamap)pChunk)->bEmpty = bEmpty;
((mng_gamap)pChunk)->iGamma = iGamma;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_GAMA, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_cHRM
mng_retcode MNG_DECL mng_putchunk_chrm (mng_handle hHandle,
mng_bool bEmpty,
mng_uint32 iWhitepointx,
mng_uint32 iWhitepointy,
mng_uint32 iRedx,
mng_uint32 iRedy,
mng_uint32 iGreenx,
mng_uint32 iGreeny,
mng_uint32 iBluex,
mng_uint32 iBluey)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_cHRM, mng_init_general, mng_free_general, mng_read_chrm, mng_write_chrm, mng_assign_general, 0, 0, sizeof(mng_chrm)};
#else
{MNG_UINT_cHRM, mng_init_chrm, mng_free_chrm, mng_read_chrm, mng_write_chrm, mng_assign_chrm, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CHRM, 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 header first! */
if (pData->iFirstchunkadded == 0)
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_cHRM))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_chrm (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_cHRM, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_chrmp)pChunk)->bEmpty = bEmpty;
((mng_chrmp)pChunk)->iWhitepointx = iWhitepointx;
((mng_chrmp)pChunk)->iWhitepointy = iWhitepointy;
((mng_chrmp)pChunk)->iRedx = iRedx;
((mng_chrmp)pChunk)->iRedy = iRedy;
((mng_chrmp)pChunk)->iGreenx = iGreenx;
((mng_chrmp)pChunk)->iGreeny = iGreeny;
((mng_chrmp)pChunk)->iBluex = iBluex;
((mng_chrmp)pChunk)->iBluey = iBluey;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CHRM, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_sRGB
mng_retcode MNG_DECL mng_putchunk_srgb (mng_handle hHandle,
mng_bool bEmpty,
mng_uint8 iRenderingintent)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_sRGB, mng_init_general, mng_free_general, mng_read_srgb, mng_write_srgb, mng_assign_general, 0, 0, sizeof(mng_srgb)};
#else
{MNG_UINT_sRGB, mng_init_srgb, mng_free_srgb, mng_read_srgb, mng_write_srgb, mng_assign_srgb, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SRGB, 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 header first! */
if (pData->iFirstchunkadded == 0)
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_sRGB))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_srgb (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_sRGB, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_srgbp)pChunk)->bEmpty = bEmpty;
((mng_srgbp)pChunk)->iRenderingintent = iRenderingintent;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SRGB, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_iCCP
mng_retcode MNG_DECL mng_putchunk_iccp (mng_handle hHandle,
mng_bool bEmpty,
mng_uint32 iNamesize,
mng_pchar zName,
mng_uint8 iCompression,
mng_uint32 iProfilesize,
mng_ptr pProfile)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_iCCP, mng_init_general, mng_free_iccp, mng_read_iccp, mng_write_iccp, mng_assign_iccp, 0, 0, sizeof(mng_iccp)};
#else
{MNG_UINT_iCCP, mng_init_iccp, mng_free_iccp, mng_read_iccp, mng_write_iccp, mng_assign_iccp, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ICCP, 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 header first! */
if (pData->iFirstchunkadded == 0)
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_iCCP))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_iccp (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_iCCP, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_iccpp)pChunk)->bEmpty = bEmpty;
((mng_iccpp)pChunk)->iNamesize = iNamesize;
((mng_iccpp)pChunk)->iCompression = iCompression;
((mng_iccpp)pChunk)->iProfilesize = iProfilesize;
if (iNamesize)
{
MNG_ALLOC (pData, ((mng_iccpp)pChunk)->zName, iNamesize + 1);
MNG_COPY (((mng_iccpp)pChunk)->zName, zName, iNamesize);
}
if (iProfilesize)
{
MNG_ALLOC (pData, ((mng_iccpp)pChunk)->pProfile, iProfilesize);
MNG_COPY (((mng_iccpp)pChunk)->pProfile, pProfile, iProfilesize);
}
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ICCP, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_tEXt
mng_retcode MNG_DECL mng_putchunk_text (mng_handle hHandle,
mng_uint32 iKeywordsize,
mng_pchar zKeyword,
mng_uint32 iTextsize,
mng_pchar zText)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_tEXt, mng_init_general, mng_free_text, mng_read_text, mng_write_text, mng_assign_text, 0, 0, sizeof(mng_text)};
#else
{MNG_UINT_tEXt, mng_init_text, mng_free_text, mng_read_text, mng_write_text, mng_assign_text, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TEXT, 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 header first! */
if (pData->iFirstchunkadded == 0)
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_tEXt))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_text (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_tEXt, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_textp)pChunk)->iKeywordsize = iKeywordsize;
((mng_textp)pChunk)->iTextsize = iTextsize;
if (iKeywordsize)
{
MNG_ALLOC (pData, ((mng_textp)pChunk)->zKeyword, iKeywordsize + 1);
MNG_COPY (((mng_textp)pChunk)->zKeyword, zKeyword, iKeywordsize);
}
if (iTextsize)
{
MNG_ALLOC (pData, ((mng_textp)pChunk)->zText, iTextsize + 1);
MNG_COPY (((mng_textp)pChunk)->zText, zText, iTextsize);
}
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TEXT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_zTXt
mng_retcode MNG_DECL mng_putchunk_ztxt (mng_handle hHandle,
mng_uint32 iKeywordsize,
mng_pchar zKeyword,
mng_uint8 iCompression,
mng_uint32 iTextsize,
mng_pchar zText)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_zTXt, mng_init_general, mng_free_ztxt, mng_read_ztxt, mng_write_ztxt, mng_assign_ztxt, 0, 0, sizeof(mng_ztxt)};
#else
{MNG_UINT_zTXt, mng_init_ztxt, mng_free_ztxt, mng_read_ztxt, mng_write_ztxt, mng_assign_ztxt, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ZTXT, 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 header first! */
if (pData->iFirstchunkadded == 0)
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_zTXt))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_ztxt (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_zTXt, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_ztxtp)pChunk)->iKeywordsize = iKeywordsize;
((mng_ztxtp)pChunk)->iCompression = iCompression;
((mng_ztxtp)pChunk)->iTextsize = iTextsize;
if (iKeywordsize)
{
MNG_ALLOC (pData, ((mng_ztxtp)pChunk)->zKeyword, iKeywordsize + 1);
MNG_COPY (((mng_ztxtp)pChunk)->zKeyword, zKeyword, iKeywordsize);
}
if (iTextsize)
{
MNG_ALLOC (pData, ((mng_ztxtp)pChunk)->zText, iTextsize + 1);
MNG_COPY (((mng_ztxtp)pChunk)->zText, zText, iTextsize);
}
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ZTXT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_iTXt
mng_retcode MNG_DECL mng_putchunk_itxt (mng_handle hHandle,
mng_uint32 iKeywordsize,
mng_pchar zKeyword,
mng_uint8 iCompressionflag,
mng_uint8 iCompressionmethod,
mng_uint32 iLanguagesize,
mng_pchar zLanguage,
mng_uint32 iTranslationsize,
mng_pchar zTranslation,
mng_uint32 iTextsize,
mng_pchar zText)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_iTXt, mng_init_general, mng_free_itxt, mng_read_itxt, mng_write_itxt, mng_assign_itxt, 0, 0, sizeof(mng_itxt)};
#else
{MNG_UINT_iTXt, mng_init_itxt, mng_free_itxt, mng_read_itxt, mng_write_itxt, mng_assign_itxt, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ITXT, 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 header first! */
if (pData->iFirstchunkadded == 0)
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_iTXt))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_itxt (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_iTXt, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_itxtp)pChunk)->iKeywordsize = iKeywordsize;
((mng_itxtp)pChunk)->iCompressionflag = iCompressionflag;
((mng_itxtp)pChunk)->iCompressionmethod = iCompressionmethod;
((mng_itxtp)pChunk)->iLanguagesize = iLanguagesize;
((mng_itxtp)pChunk)->iTranslationsize = iTranslationsize;
((mng_itxtp)pChunk)->iTextsize = iTextsize;
if (iKeywordsize)
{
MNG_ALLOC (pData, ((mng_itxtp)pChunk)->zKeyword, iKeywordsize + 1);
MNG_COPY (((mng_itxtp)pChunk)->zKeyword, zKeyword, iKeywordsize);
}
if (iLanguagesize)
{
MNG_ALLOC (pData, ((mng_itxtp)pChunk)->zLanguage, iLanguagesize + 1);
MNG_COPY (((mng_itxtp)pChunk)->zLanguage, zLanguage, iLanguagesize);
}
if (iTranslationsize)
{
MNG_ALLOC (pData, ((mng_itxtp)pChunk)->zTranslation, iTranslationsize + 1);
MNG_COPY (((mng_itxtp)pChunk)->zTranslation, zTranslation, iTranslationsize);
}
if (iTextsize)
{
MNG_ALLOC (pData, ((mng_itxtp)pChunk)->zText, iTextsize + 1);
MNG_COPY (((mng_itxtp)pChunk)->zText, zText, iTextsize);
}
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ITXT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_bKGD
mng_retcode MNG_DECL mng_putchunk_bkgd (mng_handle hHandle,
mng_bool bEmpty,
mng_uint8 iType,
mng_uint8 iIndex,
mng_uint16 iGray,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_bKGD, mng_init_general, mng_free_general, mng_read_bkgd, mng_write_bkgd, mng_assign_general, 0, 0, sizeof(mng_bkgd)};
#else
{MNG_UINT_bKGD, mng_init_bkgd, mng_free_bkgd, mng_read_bkgd, mng_write_bkgd, mng_assign_bkgd, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BKGD, 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 header first! */
if (pData->iFirstchunkadded == 0)
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_bKGD))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_bkgd (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_bKGD, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_bkgdp)pChunk)->bEmpty = bEmpty;
((mng_bkgdp)pChunk)->iType = iType;
((mng_bkgdp)pChunk)->iIndex = iIndex;
((mng_bkgdp)pChunk)->iGray = iGray;
((mng_bkgdp)pChunk)->iRed = iRed;
((mng_bkgdp)pChunk)->iGreen = iGreen;
((mng_bkgdp)pChunk)->iBlue = iBlue;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BKGD, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_pHYs
mng_retcode MNG_DECL mng_putchunk_phys (mng_handle hHandle,
mng_bool bEmpty,
mng_uint32 iSizex,
mng_uint32 iSizey,
mng_uint8 iUnit)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_pHYs, mng_init_general, mng_free_general, mng_read_phys, mng_write_phys, mng_assign_general, 0, 0, sizeof(mng_phys)};
#else
{MNG_UINT_pHYs, mng_init_phys, mng_free_phys, mng_read_phys, mng_write_phys, mng_assign_phys, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PHYS, 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 header first! */
if (pData->iFirstchunkadded == 0)
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_pHYs))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_phys (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_pHYs, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_physp)pChunk)->bEmpty = bEmpty;
((mng_physp)pChunk)->iSizex = iSizex;
((mng_physp)pChunk)->iSizey = iSizey;
((mng_physp)pChunk)->iUnit = iUnit;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PHYS, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_sBIT
mng_retcode MNG_DECL mng_putchunk_sbit (mng_handle hHandle,
mng_bool bEmpty,
mng_uint8 iType,
mng_uint8arr4 aBits)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_sBIT, mng_init_general, mng_free_general, mng_read_sbit, mng_write_sbit, mng_assign_general, 0, 0, sizeof(mng_sbit)};
#else
{MNG_UINT_sBIT, mng_init_sbit, mng_free_sbit, mng_read_sbit, mng_write_sbit, mng_assign_sbit, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SBIT, 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 header first! */
if (pData->iFirstchunkadded == 0)
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_sBIT))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_sbit (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_sBIT, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_sbitp)pChunk)->bEmpty = bEmpty;
((mng_sbitp)pChunk)->iType = iType;
((mng_sbitp)pChunk)->aBits[0] = aBits[0];
((mng_sbitp)pChunk)->aBits[1] = aBits[1];
((mng_sbitp)pChunk)->aBits[2] = aBits[2];
((mng_sbitp)pChunk)->aBits[3] = aBits[3];
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SBIT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_sPLT
mng_retcode MNG_DECL mng_putchunk_splt (mng_handle hHandle,
mng_bool bEmpty,
mng_uint32 iNamesize,
mng_pchar zName,
mng_uint8 iSampledepth,
mng_uint32 iEntrycount,
mng_ptr pEntries)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_sPLT, mng_init_general, mng_free_splt, mng_read_splt, mng_write_splt, mng_assign_splt, 0, 0, sizeof(mng_splt)};
#else
{MNG_UINT_sPLT, mng_init_splt, mng_free_splt, mng_read_splt, mng_write_splt, mng_assign_splt, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SPLT, 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 header first! */
if (pData->iFirstchunkadded == 0)
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_sPLT))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_splt (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_sPLT, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_spltp)pChunk)->bEmpty = bEmpty;
((mng_spltp)pChunk)->iNamesize = iNamesize;
((mng_spltp)pChunk)->iSampledepth = iSampledepth;
((mng_spltp)pChunk)->iEntrycount = iEntrycount;
if (iNamesize)
{
MNG_ALLOC (pData, ((mng_spltp)pChunk)->zName, iNamesize + 1);
MNG_COPY (((mng_spltp)pChunk)->zName, zName, iNamesize);
}
if (iEntrycount)
{
mng_uint32 iSize = iEntrycount * ((iSampledepth >> 1) + 2);
MNG_ALLOC (pData, ((mng_spltp)pChunk)->pEntries, iSize);
MNG_COPY (((mng_spltp)pChunk)->pEntries, pEntries, iSize);
}
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SPLT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_hIST
mng_retcode MNG_DECL mng_putchunk_hist (mng_handle hHandle,
mng_uint32 iEntrycount,
mng_uint16arr aEntries)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_hIST, mng_init_general, mng_free_general, mng_read_hist, mng_write_hist, mng_assign_general, 0, 0, sizeof(mng_hist)};
#else
{MNG_UINT_hIST, mng_init_hist, mng_free_hist, mng_read_hist, mng_write_hist, mng_assign_hist, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_HIST, 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 header first! */
if (pData->iFirstchunkadded == 0)
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_hIST))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_hist (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_hIST, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_histp)pChunk)->iEntrycount = iEntrycount;
MNG_COPY (((mng_histp)pChunk)->aEntries, aEntries, sizeof (mng_uint16arr));
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_HIST, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_tIME
mng_retcode MNG_DECL mng_putchunk_time (mng_handle hHandle,
mng_uint16 iYear,
mng_uint8 iMonth,
mng_uint8 iDay,
mng_uint8 iHour,
mng_uint8 iMinute,
mng_uint8 iSecond)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_tIME, mng_init_general, mng_free_general, mng_read_time, mng_write_time, mng_assign_general, 0, 0, sizeof(mng_time)};
#else
{MNG_UINT_tIME, mng_init_time, mng_free_time, mng_read_time, mng_write_time, mng_assign_time, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TIME, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_tIME))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* must have had a header first! */
if (pData->iFirstchunkadded == 0)
MNG_ERROR (pData, MNG_NOHEADER)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_time (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_tIME, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_timep)pChunk)->iYear = iYear;
((mng_timep)pChunk)->iMonth = iMonth;
((mng_timep)pChunk)->iDay = iDay;
((mng_timep)pChunk)->iHour = iHour;
((mng_timep)pChunk)->iMinute = iMinute;
((mng_timep)pChunk)->iSecond = iSecond;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TIME, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode MNG_DECL mng_putchunk_mhdr (mng_handle hHandle,
mng_uint32 iWidth,
mng_uint32 iHeight,
mng_uint32 iTicks,
mng_uint32 iLayercount,
mng_uint32 iFramecount,
mng_uint32 iPlaytime,
mng_uint32 iSimplicity)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_MHDR, mng_init_general, mng_free_general, mng_read_mhdr, mng_write_mhdr, mng_assign_general, 0, 0, sizeof(mng_mhdr)};
#else
{MNG_UINT_MHDR, mng_init_mhdr, mng_free_mhdr, mng_read_mhdr, mng_write_mhdr, mng_assign_mhdr, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MHDR, 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 be very first! */
if (pData->iFirstchunkadded != 0)
MNG_ERROR (pData, MNG_SEQUENCEERROR)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_MHDR))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_mhdr (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_MHDR, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_mhdrp)pChunk)->iWidth = iWidth;
((mng_mhdrp)pChunk)->iHeight = iHeight;
((mng_mhdrp)pChunk)->iTicks = iTicks;
((mng_mhdrp)pChunk)->iLayercount = iLayercount;
((mng_mhdrp)pChunk)->iFramecount = iFramecount;
((mng_mhdrp)pChunk)->iPlaytime = iPlaytime;
((mng_mhdrp)pChunk)->iSimplicity = iSimplicity;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MHDR, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_putchunk_mend (mng_handle hHandle)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_MEND, mng_init_general, mng_free_general, mng_read_mend, mng_write_mend, mng_assign_general, 0, 0, sizeof(mng_mend)};
#else
{MNG_UINT_MEND, mng_init_mend, mng_free_mend, mng_read_mend, mng_write_mend, mng_assign_mend, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MEND, 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 header first! */
if (pData->iFirstchunkadded == 0)
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_MEND))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_mend (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_MEND, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
mng_add_chunk (pData, pChunk); /* add it to the list */
pData->bCreating = MNG_FALSE; /* should be last chunk !!! */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MEND, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_LOOP
mng_retcode MNG_DECL mng_putchunk_loop (mng_handle hHandle,
mng_uint8 iLevel,
mng_uint32 iRepeat,
mng_uint8 iTermination,
mng_uint32 iItermin,
mng_uint32 iItermax,
mng_uint32 iCount,
mng_uint32p pSignals)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_LOOP, mng_init_general, mng_free_loop, mng_read_loop, mng_write_loop, mng_assign_loop, 0, 0, sizeof(mng_loop)};
#else
{MNG_UINT_LOOP, mng_init_loop, mng_free_loop, mng_read_loop, mng_write_loop, mng_assign_loop, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_LOOP, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_LOOP))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_loop (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_LOOP, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_loopp)pChunk)->iLevel = iLevel;
((mng_loopp)pChunk)->iRepeat = iRepeat;
((mng_loopp)pChunk)->iTermination = iTermination;
((mng_loopp)pChunk)->iItermin = iItermin;
((mng_loopp)pChunk)->iItermax = iItermax;
((mng_loopp)pChunk)->iCount = iCount;
((mng_loopp)pChunk)->pSignals = pSignals;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_LOOP, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_putchunk_endl (mng_handle hHandle,
mng_uint8 iLevel)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_ENDL, mng_init_general, mng_free_general, mng_read_endl, mng_write_endl, mng_assign_general, 0, 0, sizeof(mng_endl)};
#else
{MNG_UINT_ENDL, mng_init_endl, mng_free_endl, mng_read_endl, mng_write_endl, mng_assign_endl, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ENDL, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_ENDL))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_endl (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_ENDL, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_endlp)pChunk)->iLevel = iLevel;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ENDL, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_DEFI
mng_retcode MNG_DECL mng_putchunk_defi (mng_handle hHandle,
mng_uint16 iObjectid,
mng_uint8 iDonotshow,
mng_uint8 iConcrete,
mng_bool bHasloca,
mng_int32 iXlocation,
mng_int32 iYlocation,
mng_bool bHasclip,
mng_int32 iLeftcb,
mng_int32 iRightcb,
mng_int32 iTopcb,
mng_int32 iBottomcb)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_DEFI, mng_init_general, mng_free_general, mng_read_defi, mng_write_defi, mng_assign_general, 0, 0, sizeof(mng_defi)};
#else
{MNG_UINT_DEFI, mng_init_defi, mng_free_defi, mng_read_defi, mng_write_defi, mng_assign_defi, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DEFI, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_DEFI))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_defi (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_DEFI, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_defip)pChunk)->iObjectid = iObjectid;
((mng_defip)pChunk)->iDonotshow = iDonotshow;
((mng_defip)pChunk)->iConcrete = iConcrete;
((mng_defip)pChunk)->bHasloca = bHasloca;
((mng_defip)pChunk)->iXlocation = iXlocation;
((mng_defip)pChunk)->iYlocation = iYlocation;
((mng_defip)pChunk)->bHasclip = bHasclip;
((mng_defip)pChunk)->iLeftcb = iLeftcb;
((mng_defip)pChunk)->iRightcb = iRightcb;
((mng_defip)pChunk)->iTopcb = iTopcb;
((mng_defip)pChunk)->iBottomcb = iBottomcb;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DEFI, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_BASI
mng_retcode MNG_DECL mng_putchunk_basi (mng_handle hHandle,
mng_uint32 iWidth,
mng_uint32 iHeight,
mng_uint8 iBitdepth,
mng_uint8 iColortype,
mng_uint8 iCompression,
mng_uint8 iFilter,
mng_uint8 iInterlace,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue,
mng_uint16 iAlpha,
mng_uint8 iViewable)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_BASI, mng_init_general, mng_free_general, mng_read_basi, mng_write_basi, mng_assign_general, 0, 0, sizeof(mng_basi)};
#else
{MNG_UINT_BASI, mng_init_basi, mng_free_basi, mng_read_basi, mng_write_basi, mng_assign_basi, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BASI, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_BASI))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_basi (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_BASI, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_basip)pChunk)->iWidth = iWidth;
((mng_basip)pChunk)->iHeight = iHeight;
((mng_basip)pChunk)->iBitdepth = iBitdepth;
((mng_basip)pChunk)->iColortype = iColortype;
((mng_basip)pChunk)->iCompression = iCompression;
((mng_basip)pChunk)->iFilter = iFilter;
((mng_basip)pChunk)->iInterlace = iInterlace;
((mng_basip)pChunk)->iRed = iRed;
((mng_basip)pChunk)->iGreen = iGreen;
((mng_basip)pChunk)->iBlue = iBlue;
((mng_basip)pChunk)->iAlpha = iAlpha;
((mng_basip)pChunk)->iViewable = iViewable;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BASI, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_CLON
mng_retcode MNG_DECL mng_putchunk_clon (mng_handle hHandle,
mng_uint16 iSourceid,
mng_uint16 iCloneid,
mng_uint8 iClonetype,
mng_uint8 iDonotshow,
mng_uint8 iConcrete,
mng_bool bHasloca,
mng_uint8 iLocationtype,
mng_int32 iLocationx,
mng_int32 iLocationy)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_CLON, mng_init_general, mng_free_general, mng_read_clon, mng_write_clon, mng_assign_general, 0, 0, sizeof(mng_clon)};
#else
{MNG_UINT_CLON, mng_init_clon, mng_free_clon, mng_read_clon, mng_write_clon, mng_assign_clon, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CLON, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_CLON))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_clon (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_CLON, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_clonp)pChunk)->iSourceid = iSourceid;
((mng_clonp)pChunk)->iCloneid = iCloneid;
((mng_clonp)pChunk)->iClonetype = iClonetype;
((mng_clonp)pChunk)->iDonotshow = iDonotshow;
((mng_clonp)pChunk)->iConcrete = iConcrete;
((mng_clonp)pChunk)->bHasloca = bHasloca;
((mng_clonp)pChunk)->iLocationtype = iLocationtype;
((mng_clonp)pChunk)->iLocationx = iLocationx;
((mng_clonp)pChunk)->iLocationy = iLocationy;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CLON, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_PAST
mng_retcode MNG_DECL mng_putchunk_past (mng_handle hHandle,
mng_uint16 iDestid,
mng_uint8 iTargettype,
mng_int32 iTargetx,
mng_int32 iTargety,
mng_uint32 iCount)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_PAST, mng_init_general, mng_free_past, mng_read_past, mng_write_past, mng_assign_past, 0, 0, sizeof(mng_past)};
#else
{MNG_UINT_PAST, mng_init_past, mng_free_past, mng_read_past, mng_write_past, mng_assign_past, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PAST, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_PAST))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_past (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_PAST, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_pastp)pChunk)->iDestid = iDestid;
((mng_pastp)pChunk)->iTargettype = iTargettype;
((mng_pastp)pChunk)->iTargetx = iTargetx;
((mng_pastp)pChunk)->iTargety = iTargety;
((mng_pastp)pChunk)->iCount = iCount;
if (iCount)
MNG_ALLOC (pData, ((mng_pastp)pChunk)->pSources, iCount * sizeof (mng_past_source));
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PAST, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_PAST
mng_retcode MNG_DECL mng_putchunk_past_src (mng_handle hHandle,
mng_uint32 iEntry,
mng_uint16 iSourceid,
mng_uint8 iComposition,
mng_uint8 iOrientation,
mng_uint8 iOffsettype,
mng_int32 iOffsetx,
mng_int32 iOffsety,
mng_uint8 iBoundarytype,
mng_int32 iBoundaryl,
mng_int32 iBoundaryr,
mng_int32 iBoundaryt,
mng_int32 iBoundaryb)
{
mng_datap pData;
mng_chunkp pChunk;
mng_past_sourcep pEntry;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PAST_SRC, 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)
pChunk = pData->pLastchunk; /* last one must have been PAST ! */
if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_PAST)
MNG_ERROR (pData, MNG_NOCORRCHUNK)
/* index out of bounds ? */
if (iEntry >= ((mng_pastp)pChunk)->iCount)
MNG_ERROR (pData, MNG_INVALIDENTRYIX)
/* address proper entry */
pEntry = ((mng_pastp)pChunk)->pSources + iEntry;
pEntry->iSourceid = iSourceid; /* fill entry */
pEntry->iComposition = iComposition;
pEntry->iOrientation = iOrientation;
pEntry->iOffsettype = iOffsettype;
pEntry->iOffsetx = iOffsetx;
pEntry->iOffsety = iOffsety;
pEntry->iBoundarytype = iBoundarytype;
pEntry->iBoundaryl = iBoundaryl;
pEntry->iBoundaryr = iBoundaryr;
pEntry->iBoundaryt = iBoundaryt;
pEntry->iBoundaryb = iBoundaryb;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PAST_SRC, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_DISC
mng_retcode MNG_DECL mng_putchunk_disc (mng_handle hHandle,
mng_uint32 iCount,
mng_uint16p pObjectids)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_DISC, mng_init_general, mng_free_disc, mng_read_disc, mng_write_disc, mng_assign_disc, 0, 0, sizeof(mng_disc)};
#else
{MNG_UINT_DISC, mng_init_disc, mng_free_disc, mng_read_disc, mng_write_disc, mng_assign_disc, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DISC, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_DISC))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_disc (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_DISC, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_discp)pChunk)->iCount = iCount;
if (iCount)
{
mng_uint32 iSize = iCount * sizeof (mng_uint32);
MNG_ALLOC (pData, ((mng_discp)pChunk)->pObjectids, iSize);
MNG_COPY (((mng_discp)pChunk)->pObjectids, pObjectids, iSize);
}
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DISC, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_BACK
mng_retcode MNG_DECL mng_putchunk_back (mng_handle hHandle,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue,
mng_uint8 iMandatory,
mng_uint16 iImageid,
mng_uint8 iTile)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_BACK, mng_init_general, mng_free_general, mng_read_back, mng_write_back, mng_assign_general, 0, 0, sizeof(mng_back)};
#else
{MNG_UINT_BACK, mng_init_back, mng_free_back, mng_read_back, mng_write_back, mng_assign_back, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BACK, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_BACK))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_back (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_BACK, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_backp)pChunk)->iRed = iRed;
((mng_backp)pChunk)->iGreen = iGreen;
((mng_backp)pChunk)->iBlue = iBlue;
((mng_backp)pChunk)->iMandatory = iMandatory;
((mng_backp)pChunk)->iImageid = iImageid;
((mng_backp)pChunk)->iTile = iTile;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BACK, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_FRAM
mng_retcode MNG_DECL mng_putchunk_fram (mng_handle hHandle,
mng_bool bEmpty,
mng_uint8 iMode,
mng_uint32 iNamesize,
mng_pchar zName,
mng_uint8 iChangedelay,
mng_uint8 iChangetimeout,
mng_uint8 iChangeclipping,
mng_uint8 iChangesyncid,
mng_uint32 iDelay,
mng_uint32 iTimeout,
mng_uint8 iBoundarytype,
mng_int32 iBoundaryl,
mng_int32 iBoundaryr,
mng_int32 iBoundaryt,
mng_int32 iBoundaryb,
mng_uint32 iCount,
mng_uint32p pSyncids)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_FRAM, mng_init_general, mng_free_fram, mng_read_fram, mng_write_fram, mng_assign_fram, 0, 0, sizeof(mng_fram)};
#else
{MNG_UINT_FRAM, mng_init_fram, mng_free_fram, mng_read_fram, mng_write_fram, mng_assign_fram, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_FRAM, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_FRAM))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_fram (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_FRAM, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_framp)pChunk)->bEmpty = bEmpty;
((mng_framp)pChunk)->iMode = iMode;
((mng_framp)pChunk)->iNamesize = iNamesize;
((mng_framp)pChunk)->iChangedelay = iChangedelay;
((mng_framp)pChunk)->iChangetimeout = iChangetimeout;
((mng_framp)pChunk)->iChangeclipping = iChangeclipping;
((mng_framp)pChunk)->iChangesyncid = iChangesyncid;
((mng_framp)pChunk)->iDelay = iDelay;
((mng_framp)pChunk)->iTimeout = iTimeout;
((mng_framp)pChunk)->iBoundarytype = iBoundarytype;
((mng_framp)pChunk)->iBoundaryl = iBoundaryl;
((mng_framp)pChunk)->iBoundaryr = iBoundaryr;
((mng_framp)pChunk)->iBoundaryt = iBoundaryt;
((mng_framp)pChunk)->iBoundaryb = iBoundaryb;
((mng_framp)pChunk)->iCount = iCount;
if (iNamesize)
{
MNG_ALLOC (pData, ((mng_framp)pChunk)->zName, iNamesize + 1);
MNG_COPY (((mng_framp)pChunk)->zName, zName, iNamesize);
}
if (iCount)
{
mng_uint32 iSize = iCount * sizeof (mng_uint32);
MNG_ALLOC (pData, ((mng_framp)pChunk)->pSyncids, iSize);
MNG_COPY (((mng_framp)pChunk)->pSyncids, pSyncids, iSize);
}
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_FRAM, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_MOVE
mng_retcode MNG_DECL mng_putchunk_move (mng_handle hHandle,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint8 iMovetype,
mng_int32 iMovex,
mng_int32 iMovey)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_MOVE, mng_init_general, mng_free_general, mng_read_move, mng_write_move, mng_assign_general, 0, 0, sizeof(mng_move)};
#else
{MNG_UINT_MOVE, mng_init_move, mng_free_move, mng_read_move, mng_write_move, mng_assign_move, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MOVE, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_MOVE))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_move (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_MOVE, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_movep)pChunk)->iFirstid = iFirstid;
((mng_movep)pChunk)->iLastid = iLastid;
((mng_movep)pChunk)->iMovetype = iMovetype;
((mng_movep)pChunk)->iMovex = iMovex;
((mng_movep)pChunk)->iMovey = iMovey;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MOVE, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_CLIP
mng_retcode MNG_DECL mng_putchunk_clip (mng_handle hHandle,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint8 iCliptype,
mng_int32 iClipl,
mng_int32 iClipr,
mng_int32 iClipt,
mng_int32 iClipb)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_CLIP, mng_init_general, mng_free_general, mng_read_clip, mng_write_clip, mng_assign_general, 0, 0, sizeof(mng_clip)};
#else
{MNG_UINT_CLIP, mng_init_clip, mng_free_clip, mng_read_clip, mng_write_clip, mng_assign_clip, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CLIP, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_CLIP))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_clip (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_CLIP, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_clipp)pChunk)->iFirstid = iFirstid;
((mng_clipp)pChunk)->iLastid = iLastid;
((mng_clipp)pChunk)->iCliptype = iCliptype;
((mng_clipp)pChunk)->iClipl = iClipl;
((mng_clipp)pChunk)->iClipr = iClipr;
((mng_clipp)pChunk)->iClipt = iClipt;
((mng_clipp)pChunk)->iClipb = iClipb;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CLIP, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_SHOW
mng_retcode MNG_DECL mng_putchunk_show (mng_handle hHandle,
mng_bool bEmpty,
mng_uint16 iFirstid,
mng_uint16 iLastid,
mng_uint8 iMode)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_SHOW, mng_init_general, mng_free_general, mng_read_show, mng_write_show, mng_assign_general, 0, 0, sizeof(mng_show)};
#else
{MNG_UINT_SHOW, mng_init_show, mng_free_show, mng_read_show, mng_write_show, mng_assign_show, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SHOW, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_SHOW))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_show (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_SHOW, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_showp)pChunk)->bEmpty = bEmpty;
((mng_showp)pChunk)->iFirstid = iFirstid;
((mng_showp)pChunk)->iLastid = iLastid;
((mng_showp)pChunk)->iMode = iMode;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SHOW, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_TERM
mng_retcode MNG_DECL mng_putchunk_term (mng_handle hHandle,
mng_uint8 iTermaction,
mng_uint8 iIteraction,
mng_uint32 iDelay,
mng_uint32 iItermax)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_TERM, mng_init_general, mng_free_general, mng_read_term, mng_write_term, mng_assign_general, 0, 0, sizeof(mng_term)};
#else
{MNG_UINT_TERM, mng_init_term, mng_free_term, mng_read_term, mng_write_term, mng_assign_term, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TERM, 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 */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_term (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_TERM, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_termp)pChunk)->iTermaction = iTermaction;
((mng_termp)pChunk)->iIteraction = iIteraction;
((mng_termp)pChunk)->iDelay = iDelay;
((mng_termp)pChunk)->iItermax = iItermax;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TERM, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_SAVE
mng_retcode MNG_DECL mng_putchunk_save (mng_handle hHandle,
mng_bool bEmpty,
mng_uint8 iOffsettype,
mng_uint32 iCount)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_SAVE, mng_init_general, mng_free_save, mng_read_save, mng_write_save, mng_assign_save, 0, 0, sizeof(mng_save)};
#else
{MNG_UINT_SAVE, mng_init_save, mng_free_save, mng_read_save, mng_write_save, mng_assign_save, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SAVE, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_SAVE))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_save (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_SAVE, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_savep)pChunk)->bEmpty = bEmpty;
((mng_savep)pChunk)->iOffsettype = iOffsettype;
((mng_savep)pChunk)->iCount = iCount;
if (iCount)
MNG_ALLOC (pData, ((mng_savep)pChunk)->pEntries, iCount * sizeof (mng_save_entry));
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SAVE, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_putchunk_save_entry (mng_handle hHandle,
mng_uint32 iEntry,
mng_uint8 iEntrytype,
mng_uint32arr2 iOffset,
mng_uint32arr2 iStarttime,
mng_uint32 iLayernr,
mng_uint32 iFramenr,
mng_uint32 iNamesize,
mng_pchar zName)
{
mng_datap pData;
mng_chunkp pChunk;
mng_save_entryp pEntry;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SAVE_ENTRY, 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)
pChunk = pData->pLastchunk; /* last one must have been SAVE ! */
if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_SAVE)
MNG_ERROR (pData, MNG_NOCORRCHUNK)
/* index out of bounds ? */
if (iEntry >= ((mng_savep)pChunk)->iCount)
MNG_ERROR (pData, MNG_INVALIDENTRYIX)
/* address proper entry */
pEntry = ((mng_savep)pChunk)->pEntries + iEntry;
pEntry->iEntrytype = iEntrytype; /* fill entry */
pEntry->iOffset[0] = iOffset[0];
pEntry->iOffset[1] = iOffset[1];
pEntry->iStarttime[0] = iStarttime[0];
pEntry->iStarttime[1] = iStarttime[1];
pEntry->iLayernr = iLayernr;
pEntry->iFramenr = iFramenr;
pEntry->iNamesize = iNamesize;
if (iNamesize)
{
MNG_ALLOC (pData, pEntry->zName, iNamesize + 1);
MNG_COPY (pEntry->zName, zName, iNamesize);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SAVE_ENTRY, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_SEEK
mng_retcode MNG_DECL mng_putchunk_seek (mng_handle hHandle,
mng_uint32 iNamesize,
mng_pchar zName)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_SEEK, mng_init_general, mng_free_seek, mng_read_seek, mng_write_seek, mng_assign_seek, 0, 0, sizeof(mng_seek)};
#else
{MNG_UINT_SEEK, mng_init_seek, mng_free_seek, mng_read_seek, mng_write_seek, mng_assign_seek, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SEEK, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_SEEK))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_seek (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_SEEK, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_seekp)pChunk)->iNamesize = iNamesize;
if (iNamesize)
{
MNG_ALLOC (pData, ((mng_seekp)pChunk)->zName, iNamesize + 1);
MNG_COPY (((mng_seekp)pChunk)->zName, zName, iNamesize);
}
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SEEK, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_eXPI
mng_retcode MNG_DECL mng_putchunk_expi (mng_handle hHandle,
mng_uint16 iSnapshotid,
mng_uint32 iNamesize,
mng_pchar zName)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_eXPI, mng_init_general, mng_free_expi, mng_read_expi, mng_write_expi, mng_assign_general, 0, 0, sizeof(mng_expi)};
#else
{MNG_UINT_eXPI, mng_init_expi, mng_free_expi, mng_read_expi, mng_write_expi, mng_assign_expi, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EXPI, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_eXPI))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_expi (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_eXPI, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_expip)pChunk)->iSnapshotid = iSnapshotid;
((mng_expip)pChunk)->iNamesize = iNamesize;
if (iNamesize)
{
MNG_ALLOC (pData, ((mng_expip)pChunk)->zName, iNamesize + 1);
MNG_COPY (((mng_expip)pChunk)->zName, zName, iNamesize);
}
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EXPI, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_fPRI
mng_retcode MNG_DECL mng_putchunk_fpri (mng_handle hHandle,
mng_uint8 iDeltatype,
mng_uint8 iPriority)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_fPRI, mng_init_general, mng_free_general, mng_read_fpri, mng_write_fpri, mng_assign_general, 0, 0, sizeof(mng_fpri)};
#else
{MNG_UINT_fPRI, mng_init_fpri, mng_free_fpri, mng_read_fpri, mng_write_fpri, mng_assign_fpri, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_FPRI, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_fPRI))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_fpri (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_fPRI, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_fprip)pChunk)->iDeltatype = iDeltatype;
((mng_fprip)pChunk)->iPriority = iPriority;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_FPRI, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_nEED
mng_retcode MNG_DECL mng_putchunk_need (mng_handle hHandle,
mng_uint32 iKeywordssize,
mng_pchar zKeywords)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_nEED, mng_init_general, mng_free_need, mng_read_need, mng_write_need, mng_assign_need, 0, 0, sizeof(mng_need)};
#else
{MNG_UINT_nEED, mng_init_need, mng_free_need, mng_read_need, mng_write_need, mng_assign_need, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_NEED, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_nEED))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_need (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_nEED, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_needp)pChunk)->iKeywordssize = iKeywordssize;
if (iKeywordssize)
{
MNG_ALLOC (pData, ((mng_needp)pChunk)->zKeywords, iKeywordssize + 1);
MNG_COPY (((mng_needp)pChunk)->zKeywords, zKeywords, iKeywordssize);
}
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_NEED, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_pHYg
mng_retcode MNG_DECL mng_putchunk_phyg (mng_handle hHandle,
mng_bool bEmpty,
mng_uint32 iSizex,
mng_uint32 iSizey,
mng_uint8 iUnit)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_pHYg, mng_init_general, mng_free_general, mng_read_phyg, mng_write_phyg, mng_assign_general, 0, 0, sizeof(mng_phyg)};
#else
{MNG_UINT_pHYg, mng_init_phyg, mng_free_phyg, mng_read_phyg, mng_write_phyg, mng_assign_phyg, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PHYG, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_pHYg))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_phyg (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_pHYg, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_phygp)pChunk)->bEmpty = bEmpty;
((mng_phygp)pChunk)->iSizex = iSizex;
((mng_phygp)pChunk)->iSizey = iSizey;
((mng_phygp)pChunk)->iUnit = iUnit;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PHYG, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG
mng_retcode MNG_DECL mng_putchunk_jhdr (mng_handle hHandle,
mng_uint32 iWidth,
mng_uint32 iHeight,
mng_uint8 iColortype,
mng_uint8 iImagesampledepth,
mng_uint8 iImagecompression,
mng_uint8 iImageinterlace,
mng_uint8 iAlphasampledepth,
mng_uint8 iAlphacompression,
mng_uint8 iAlphafilter,
mng_uint8 iAlphainterlace)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_JHDR, mng_init_general, mng_free_general, mng_read_jhdr, mng_write_jhdr, mng_assign_general, 0, 0, sizeof(mng_jhdr)};
#else
{MNG_UINT_JHDR, mng_init_jhdr, mng_free_jhdr, mng_read_jhdr, mng_write_jhdr, mng_assign_jhdr, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JHDR, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_JHDR))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_jhdr (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_JHDR, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_jhdrp)pChunk)->iWidth = iWidth;
((mng_jhdrp)pChunk)->iHeight = iHeight;
((mng_jhdrp)pChunk)->iColortype = iColortype;
((mng_jhdrp)pChunk)->iImagesampledepth = iImagesampledepth;
((mng_jhdrp)pChunk)->iImagecompression = iImagecompression;
((mng_jhdrp)pChunk)->iImageinterlace = iImageinterlace;
((mng_jhdrp)pChunk)->iAlphasampledepth = iAlphasampledepth;
((mng_jhdrp)pChunk)->iAlphacompression = iAlphacompression;
((mng_jhdrp)pChunk)->iAlphafilter = iAlphafilter;
((mng_jhdrp)pChunk)->iAlphainterlace = iAlphainterlace;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JHDR, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_INCLUDE_JNG */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG
mng_retcode MNG_DECL mng_putchunk_jdat (mng_handle hHandle,
mng_uint32 iRawlen,
mng_ptr pRawdata)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_JDAT, mng_init_general, mng_free_jdat, mng_read_jdat, mng_write_jdat, mng_assign_jdat, 0, 0, sizeof(mng_jdat)};
#else
{MNG_UINT_JDAT, mng_init_jdat, mng_free_jdat, mng_read_jdat, mng_write_jdat, mng_assign_jdat, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JDAT, 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 or JHDR first! */
if ((pData->iFirstchunkadded != MNG_UINT_MHDR) &&
(pData->iFirstchunkadded != MNG_UINT_JHDR) )
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_JDAT))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_jdat (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_JDAT, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_jdatp)pChunk)->iDatasize = iRawlen;
if (iRawlen)
{
MNG_ALLOC (pData, ((mng_jdatp)pChunk)->pData, iRawlen);
MNG_COPY (((mng_jdatp)pChunk)->pData, pRawdata, iRawlen);
}
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JDAT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_INCLUDE_JNG */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG
mng_retcode MNG_DECL mng_putchunk_jdaa (mng_handle hHandle,
mng_uint32 iRawlen,
mng_ptr pRawdata)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_JDAA, mng_init_general, mng_free_jdaa, mng_read_jdaa, mng_write_jdaa, mng_assign_jdaa, 0, 0, sizeof(mng_jdaa)};
#else
{MNG_UINT_JDAA, mng_init_jdaa, mng_free_jdaa, mng_read_jdaa, mng_write_jdaa, mng_assign_jdaa, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JDAA, 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 or JHDR first! */
if ((pData->iFirstchunkadded != MNG_UINT_MHDR) &&
(pData->iFirstchunkadded != MNG_UINT_JHDR) )
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_JDAA))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_jdaa (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_JDAA, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_jdaap)pChunk)->iDatasize = iRawlen;
if (iRawlen)
{
MNG_ALLOC (pData, ((mng_jdaap)pChunk)->pData, iRawlen);
MNG_COPY (((mng_jdaap)pChunk)->pData, pRawdata, iRawlen);
}
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JDAA, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_INCLUDE_JNG */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG
mng_retcode MNG_DECL mng_putchunk_jsep (mng_handle hHandle)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_JSEP, mng_init_general, mng_free_general, mng_read_jsep, mng_write_jsep, mng_assign_general, 0, 0, sizeof(mng_jsep)};
#else
{MNG_UINT_JSEP, mng_init_jsep, mng_free_jsep, mng_read_jsep, mng_write_jsep, mng_assign_jsep, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JSEP, 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 or JHDR first! */
if ((pData->iFirstchunkadded != MNG_UINT_MHDR) &&
(pData->iFirstchunkadded != MNG_UINT_JHDR) )
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_JSEP))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_jsep (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_JSEP, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JSEP, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif /* MNG_INCLUDE_JNG */
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
mng_retcode MNG_DECL mng_putchunk_dhdr (mng_handle hHandle,
mng_uint16 iObjectid,
mng_uint8 iImagetype,
mng_uint8 iDeltatype,
mng_uint32 iBlockwidth,
mng_uint32 iBlockheight,
mng_uint32 iBlockx,
mng_uint32 iBlocky)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_DHDR, mng_init_general, mng_free_general, mng_read_dhdr, mng_write_dhdr, mng_assign_general, 0, 0, sizeof(mng_dhdr)};
#else
{MNG_UINT_DHDR, mng_init_dhdr, mng_free_dhdr, mng_read_dhdr, mng_write_dhdr, mng_assign_dhdr, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DHDR, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_DHDR))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_dhdr (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_DHDR, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_dhdrp)pChunk)->iObjectid = iObjectid;
((mng_dhdrp)pChunk)->iImagetype = iImagetype;
((mng_dhdrp)pChunk)->iDeltatype = iDeltatype;
((mng_dhdrp)pChunk)->iBlockwidth = iBlockwidth;
((mng_dhdrp)pChunk)->iBlockheight = iBlockheight;
((mng_dhdrp)pChunk)->iBlockx = iBlockx;
((mng_dhdrp)pChunk)->iBlocky = iBlocky;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DHDR, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
mng_retcode MNG_DECL mng_putchunk_prom (mng_handle hHandle,
mng_uint8 iColortype,
mng_uint8 iSampledepth,
mng_uint8 iFilltype)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_PROM, mng_init_general, mng_free_general, mng_read_prom, mng_write_prom, mng_assign_general, 0, 0, sizeof(mng_prom)};
#else
{MNG_UINT_PROM, mng_init_prom, mng_free_prom, mng_read_prom, mng_write_prom, mng_assign_prom, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PROM, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_PROM))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_prom (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_PROM, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_promp)pChunk)->iColortype = iColortype;
((mng_promp)pChunk)->iSampledepth = iSampledepth;
((mng_promp)pChunk)->iFilltype = iFilltype;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PROM, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
mng_retcode MNG_DECL mng_putchunk_ipng (mng_handle hHandle)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_IPNG, mng_init_general, mng_free_general, mng_read_ipng, mng_write_ipng, mng_assign_general, 0, 0, sizeof(mng_ipng)};
#else
{MNG_UINT_IPNG, mng_init_ipng, mng_free_ipng, mng_read_ipng, mng_write_ipng, mng_assign_ipng, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IPNG, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_IPNG))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_ipng (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_IPNG, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IPNG, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
mng_retcode MNG_DECL mng_putchunk_pplt (mng_handle hHandle,
mng_uint8 iDeltatype,
mng_uint32 iCount)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_PPLT, mng_init_general, mng_free_general, mng_read_pplt, mng_write_pplt, mng_assign_general, 0, 0, sizeof(mng_pplt)};
#else
{MNG_UINT_PPLT, mng_init_pplt, mng_free_pplt, mng_read_pplt, mng_write_pplt, mng_assign_pplt, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PPLT, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_PPLT))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_pplt (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_PPLT, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_ppltp)pChunk)->iDeltatype = iDeltatype;
((mng_ppltp)pChunk)->iCount = iCount;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PPLT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
mng_retcode MNG_DECL mng_putchunk_pplt_entry (mng_handle hHandle,
mng_uint32 iEntry,
mng_uint16 iRed,
mng_uint16 iGreen,
mng_uint16 iBlue,
mng_uint16 iAlpha)
{
mng_datap pData;
mng_chunkp pChunk;
mng_pplt_entryp pEntry;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PPLT_ENTRY, 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)
pChunk = pData->pLastchunk; /* last one must have been PPLT ! */
if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_PPLT)
MNG_ERROR (pData, MNG_NOCORRCHUNK)
/* index out of bounds ? */
if (iEntry >= ((mng_ppltp)pChunk)->iCount)
MNG_ERROR (pData, MNG_INVALIDENTRYIX)
/* address proper entry */
pEntry = (mng_pplt_entryp)(((mng_ppltp)pChunk)->aEntries) + iEntry;
pEntry->iRed = (mng_uint8)iRed; /* fill the entry */
pEntry->iGreen = (mng_uint8)iGreen;
pEntry->iBlue = (mng_uint8)iBlue;
pEntry->iAlpha = (mng_uint8)iAlpha;
pEntry->bUsed = MNG_TRUE;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PPLT_ENTRY, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
#ifdef MNG_INCLUDE_JNG
mng_retcode MNG_DECL mng_putchunk_ijng (mng_handle hHandle)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_IJNG, mng_init_general, mng_free_general, mng_read_ijng, mng_write_ijng, mng_assign_general, 0, 0, sizeof(mng_ijng)};
#else
{MNG_UINT_IJNG, mng_init_ijng, mng_free_ijng, mng_read_ijng, mng_write_ijng, mng_assign_ijng, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IJNG, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_IJNG))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_ijng (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_IJNG, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IJNG, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
mng_retcode MNG_DECL mng_putchunk_drop (mng_handle hHandle,
mng_uint32 iCount,
mng_chunkidp pChunknames)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_DROP, mng_init_general, mng_free_drop, mng_read_drop, mng_write_drop, mng_assign_drop, 0, 0, sizeof(mng_drop)};
#else
{MNG_UINT_DROP, mng_init_drop, mng_free_drop, mng_read_drop, mng_write_drop, mng_assign_drop, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DROP, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_DROP))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_drop (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_DROP, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_dropp)pChunk)->iCount = iCount;
if (iCount)
{
mng_uint32 iSize = iCount * sizeof (mng_chunkid);
MNG_ALLOC (pData, ((mng_dropp)pChunk)->pChunknames, iSize);
MNG_COPY (((mng_dropp)pChunk)->pChunknames, pChunknames, iSize);
}
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DROP, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
#ifndef MNG_SKIPCHUNK_DBYK
mng_retcode MNG_DECL mng_putchunk_dbyk (mng_handle hHandle,
mng_chunkid iChunkname,
mng_uint8 iPolarity,
mng_uint32 iKeywordssize,
mng_pchar zKeywords)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_DBYK, mng_init_general, mng_free_dbyk, mng_read_dbyk, mng_write_dbyk, mng_assign_dbyk, 0, 0, sizeof(mng_dbyk)};
#else
{MNG_UINT_DBYK, mng_init_dbyk, mng_free_dbyk, mng_read_dbyk, mng_write_dbyk, mng_assign_dbyk, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DBYK, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_DBYK))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_dbyk (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_DBYK, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_dbykp)pChunk)->iChunkname = iChunkname;
((mng_dbykp)pChunk)->iPolarity = iPolarity;
((mng_dbykp)pChunk)->iKeywordssize = iKeywordssize;
if (iKeywordssize)
{
MNG_ALLOC (pData, ((mng_dbykp)pChunk)->zKeywords, iKeywordssize + 1);
MNG_COPY (((mng_dbykp)pChunk)->zKeywords, zKeywords, iKeywordssize);
}
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DBYK, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
#ifndef MNG_SKIPCHUNK_ORDR
mng_retcode MNG_DECL mng_putchunk_ordr (mng_handle hHandle,
mng_uint32 iCount)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_ORDR, mng_init_general, mng_free_ordr, mng_read_ordr, mng_write_ordr, mng_assign_ordr, 0, 0, sizeof(mng_ordr)};
#else
{MNG_UINT_ORDR, mng_init_ordr, mng_free_ordr, mng_read_ordr, mng_write_ordr, mng_assign_ordr, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ORDR, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_ORDR))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_ordr (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_ORDR, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_ordrp)pChunk)->iCount = iCount;
if (iCount)
MNG_ALLOC (pData, ((mng_ordrp)pChunk)->pEntries, iCount * sizeof (mng_ordr_entry));
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ORDR, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
#endif
/* ************************************************************************** */
#ifndef MNG_NO_DELTA_PNG
#ifndef MNG_SKIPCHUNK_ORDR
mng_retcode MNG_DECL mng_putchunk_ordr_entry (mng_handle hHandle,
mng_uint32 iEntry,
mng_chunkid iChunkname,
mng_uint8 iOrdertype)
{
mng_datap pData;
mng_chunkp pChunk;
mng_ordr_entryp pEntry;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ORDR_ENTRY, 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)
pChunk = pData->pLastchunk; /* last one must have been ORDR ! */
if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_ORDR)
MNG_ERROR (pData, MNG_NOCORRCHUNK)
/* index out of bounds ? */
if (iEntry >= ((mng_ordrp)pChunk)->iCount)
MNG_ERROR (pData, MNG_INVALIDENTRYIX)
/* address proper entry */
pEntry = ((mng_ordrp)pChunk)->pEntries + iEntry;
pEntry->iChunkname = iChunkname; /* fill the entry */
pEntry->iOrdertype = iOrdertype;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ORDR_ENTRY, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_MAGN
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;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_MAGN, mng_init_general, mng_free_general, mng_read_magn, mng_write_magn, mng_assign_general, 0, 0, sizeof(mng_magn)};
#else
{MNG_UINT_MAGN, mng_init_magn, mng_free_magn, mng_read_magn, mng_write_magn, mng_assign_magn, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_MAGN))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_magn (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_MAGN, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
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 = (mng_uint8)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 = (mng_uint8)iMethodY;
mng_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;
}
#endif
/* ************************************************************************** */
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
MNG_EXT mng_retcode MNG_DECL mng_putchunk_mpng (mng_handle hHandle,
mng_uint32 iFramewidth,
mng_uint32 iFrameheight,
mng_uint16 iNumplays,
mng_uint16 iTickspersec,
mng_uint8 iCompressionmethod,
mng_uint32 iCount)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_mpNG, mng_init_general, mng_free_mpng, mng_read_mpng, mng_write_mpng, mng_assign_mpng, 0, 0, sizeof(mng_mpng)};
#else
{MNG_UINT_mpNG, mng_init_mpng, mng_free_mpng, mng_read_mpng, mng_write_mpng, mng_assign_mpng, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MPNG, 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 IHDR first! */
if (pData->iFirstchunkadded != MNG_UINT_IHDR)
MNG_ERROR (pData, MNG_NOHEADER)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_mpng (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_mpNG, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_mpngp)pChunk)->iFramewidth = iFramewidth;
((mng_mpngp)pChunk)->iFrameheight = iFrameheight;
((mng_mpngp)pChunk)->iNumplays = iNumplays;
((mng_mpngp)pChunk)->iTickspersec = iTickspersec;
((mng_mpngp)pChunk)->iCompressionmethod = iCompressionmethod;
((mng_mpngp)pChunk)->iFramessize = iCount * sizeof (mng_mpng_frame);
if (iCount)
MNG_ALLOC (pData, ((mng_mpngp)pChunk)->pFrames, ((mng_mpngp)pChunk)->iFramessize);
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MPNG, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
MNG_EXT mng_retcode MNG_DECL mng_putchunk_mpng_frame (mng_handle hHandle,
mng_uint32 iEntry,
mng_uint32 iX,
mng_uint32 iY,
mng_uint32 iWidth,
mng_uint32 iHeight,
mng_int32 iXoffset,
mng_int32 iYoffset,
mng_uint16 iTicks)
{
mng_datap pData;
mng_chunkp pChunk;
mng_mpng_framep pFrame;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MPNG_FRAME, 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 IHDR first! */
if (pData->iFirstchunkadded != MNG_UINT_IHDR)
MNG_ERROR (pData, MNG_NOHEADER)
pChunk = pData->pLastchunk; /* last one must have been mpNG ! */
if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_mpNG)
MNG_ERROR (pData, MNG_NOCORRCHUNK)
/* index out of bounds ? */
if (iEntry >= (((mng_mpngp)pChunk)->iFramessize / sizeof (mng_mpng_frame)))
MNG_ERROR (pData, MNG_INVALIDENTRYIX)
/* address proper entry */
pFrame = ((mng_mpngp)pChunk)->pFrames + iEntry;
/* fill entry */
pFrame->iX = iX;
pFrame->iY = iY;
pFrame->iWidth = iWidth;
pFrame->iHeight = iHeight;
pFrame->iXoffset = iXoffset;
pFrame->iYoffset = iYoffset;
pFrame->iTicks = iTicks;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MPNG_FRAME, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
#ifndef MNG_SKIPCHUNK_evNT
mng_retcode MNG_DECL mng_putchunk_evnt (mng_handle hHandle,
mng_uint32 iCount)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_evNT, mng_init_general, mng_free_evnt, mng_read_evnt, mng_write_evnt, mng_assign_evnt, 0, 0, sizeof(mng_evnt)};
#else
{MNG_UINT_evNT, mng_init_evnt, mng_free_evnt, mng_read_evnt, mng_write_evnt, mng_assign_evnt, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EVNT, 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)
/* prevent misplaced TERM ! */
if (!check_term (pData, MNG_UINT_evNT))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_evnt (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_evNT, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_evntp)pChunk)->iCount = iCount;
if (iCount)
MNG_ALLOC (pData, ((mng_evntp)pChunk)->pEntries, iCount * sizeof (mng_evnt_entry));
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EVNT, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_putchunk_evnt_entry (mng_handle hHandle,
mng_uint32 iEntry,
mng_uint8 iEventtype,
mng_uint8 iMasktype,
mng_int32 iLeft,
mng_int32 iRight,
mng_int32 iTop,
mng_int32 iBottom,
mng_uint16 iObjectid,
mng_uint8 iIndex,
mng_uint32 iSegmentnamesize,
mng_pchar zSegmentname)
{
mng_datap pData;
mng_chunkp pChunk;
mng_evnt_entryp pEntry;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EVNT_ENTRY, 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)
pChunk = pData->pLastchunk; /* last one must have been evNT ! */
if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_evNT)
MNG_ERROR (pData, MNG_NOCORRCHUNK)
/* index out of bounds ? */
if (iEntry >= ((mng_evntp)pChunk)->iCount)
MNG_ERROR (pData, MNG_INVALIDENTRYIX)
/* address proper entry */
pEntry = ((mng_evntp)pChunk)->pEntries + iEntry;
/* fill entry */
pEntry->iEventtype = iEventtype;
pEntry->iMasktype = iMasktype;
pEntry->iLeft = iLeft;
pEntry->iRight = iRight;
pEntry->iTop = iTop;
pEntry->iBottom = iBottom;
pEntry->iObjectid = iObjectid;
pEntry->iIndex = iIndex;
pEntry->iSegmentnamesize = iSegmentnamesize;
if (iSegmentnamesize)
{
MNG_ALLOC (pData, pEntry->zSegmentname, iSegmentnamesize + 1);
MNG_COPY (pEntry->zSegmentname, zSegmentname, iSegmentnamesize);
}
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EVNT_ENTRY, MNG_LC_END);
#endif
return MNG_NOERROR;
}
#endif
/* ************************************************************************** */
mng_retcode MNG_DECL mng_putchunk_unknown (mng_handle hHandle,
mng_chunkid iChunkname,
mng_uint32 iRawlen,
mng_ptr pRawdata)
{
mng_datap pData;
mng_chunkp pChunk;
mng_retcode iRetcode;
#ifndef MNG_OPTIMIZE_CHUNKREADER
mng_chunk_header sChunkheader =
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
{MNG_UINT_HUH, mng_init_general, mng_free_unknown, mng_read_unknown, mng_write_unknown, mng_assign_unknown, 0, 0, sizeof(mng_unknown_chunk)};
#else
{MNG_UINT_HUH, mng_init_unknown, mng_free_unknown, mng_read_unknown, mng_write_unknown, mng_assign_unknown, 0, 0};
#endif
#else
mng_chunk_header sChunkheader;
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_UNKNOWN, 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 header first! */
if (pData->iFirstchunkadded == 0)
MNG_ERROR (pData, MNG_NOHEADER)
/* prevent misplaced TERM ! */
if (!check_term (pData, iChunkname))
MNG_ERROR (pData, MNG_TERMSEQERROR)
/* create the chunk */
#ifndef MNG_OPTIMIZE_CHUNKREADER
#ifdef MNG_OPTIMIZE_CHUNKINITFREE
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#else
iRetcode = mng_init_unknown (pData, &sChunkheader, &pChunk);
#endif
#else
mng_get_chunkheader(MNG_UINT_HUH, &sChunkheader);
iRetcode = mng_init_general (pData, &sChunkheader, &pChunk);
#endif
if (iRetcode) /* on error bail out */
return iRetcode;
/* fill the chunk */
((mng_unknown_chunkp)pChunk)->sHeader.iChunkname = iChunkname;
((mng_unknown_chunkp)pChunk)->iDatasize = iRawlen;
if (iRawlen)
{
MNG_ALLOC (pData, ((mng_unknown_chunkp)pChunk)->pData, iRawlen);
MNG_COPY (((mng_unknown_chunkp)pChunk)->pData, pRawdata, iRawlen);
}
mng_add_chunk (pData, pChunk); /* add it to the list */
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_UNKNOWN, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#endif /* MNG_INCLUDE_WRITE_PROCS */
/* ************************************************************************** */
/* ************************************************************************** */
mng_retcode MNG_DECL mng_getimgdata_seq (mng_handle hHandle,
mng_uint32 iSeqnr,
mng_uint32 iCanvasstyle,
mng_getcanvasline fGetcanvasline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_SEQ, MNG_LC_START);
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_SEQ, MNG_LC_END);
#endif
return MNG_FNNOTIMPLEMENTED;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_getimgdata_chunkseq (mng_handle hHandle,
mng_uint32 iSeqnr,
mng_uint32 iCanvasstyle,
mng_getcanvasline fGetcanvasline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_CHUNKSEQ, MNG_LC_START);
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_CHUNKSEQ, MNG_LC_END);
#endif
return MNG_FNNOTIMPLEMENTED;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_getimgdata_chunk (mng_handle hHandle,
mng_handle hChunk,
mng_uint32 iCanvasstyle,
mng_getcanvasline fGetcanvasline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_CHUNK, MNG_LC_START);
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_CHUNK, MNG_LC_END);
#endif
return MNG_FNNOTIMPLEMENTED;
}
/* ************************************************************************** */
/* ************************************************************************** */
#ifdef MNG_INCLUDE_WRITE_PROCS
/* ************************************************************************** */
mng_retcode MNG_DECL mng_putimgdata_ihdr (mng_handle hHandle,
mng_uint32 iWidth,
mng_uint32 iHeight,
mng_uint8 iColortype,
mng_uint8 iBitdepth,
mng_uint8 iCompression,
mng_uint8 iFilter,
mng_uint8 iInterlace,
mng_uint32 iCanvasstyle,
mng_getcanvasline fGetcanvasline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTIMGDATA_IHDR, MNG_LC_START);
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTIMGDATA_IHDR, MNG_LC_END);
#endif
return MNG_FNNOTIMPLEMENTED;
}
/* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG
mng_retcode MNG_DECL mng_putimgdata_jhdr (mng_handle hHandle,
mng_uint32 iWidth,
mng_uint32 iHeight,
mng_uint8 iColortype,
mng_uint8 iBitdepth,
mng_uint8 iCompression,
mng_uint8 iInterlace,
mng_uint8 iAlphaBitdepth,
mng_uint8 iAlphaCompression,
mng_uint8 iAlphaFilter,
mng_uint8 iAlphaInterlace,
mng_uint32 iCanvasstyle,
mng_getcanvasline fGetcanvasline)
{
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTIMGDATA_JHDR, MNG_LC_START);
#endif
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTIMGDATA_JHDR, MNG_LC_END);
#endif
return MNG_FNNOTIMPLEMENTED;
}
#endif
/* ************************************************************************** */
mng_retcode MNG_DECL mng_updatemngheader (mng_handle hHandle,
mng_uint32 iFramecount,
mng_uint32 iLayercount,
mng_uint32 iPlaytime)
{
mng_datap pData;
mng_chunkp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_UPDATEMNGHEADER, 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 be a MNG animation! */
if ((pData->eImagetype != mng_it_mng) || (pData->iFirstchunkadded != MNG_UINT_MHDR))
MNG_ERROR (pData, MNG_NOMHDR)
pChunk = pData->pFirstchunk; /* get the first chunk */
/* and update the variables */
((mng_mhdrp)pChunk)->iFramecount = iFramecount;
((mng_mhdrp)pChunk)->iLayercount = iLayercount;
((mng_mhdrp)pChunk)->iPlaytime = iPlaytime;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_UPDATEMNGHEADER, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
mng_retcode MNG_DECL mng_updatemngsimplicity (mng_handle hHandle,
mng_uint32 iSimplicity)
{
mng_datap pData;
mng_chunkp pChunk;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_UPDATEMNGSIMPLICITY, 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 be a MNG animation! */
if ((pData->eImagetype != mng_it_mng) || (pData->iFirstchunkadded != MNG_UINT_MHDR))
MNG_ERROR (pData, MNG_NOMHDR)
pChunk = pData->pFirstchunk; /* get the first chunk */
/* and update the variable */
((mng_mhdrp)pChunk)->iSimplicity = iSimplicity;
#ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_UPDATEMNGSIMPLICITY, MNG_LC_END);
#endif
return MNG_NOERROR;
}
/* ************************************************************************** */
#endif /* MNG_INCLUDE_WRITE_PROCS */
/* ************************************************************************** */
#endif /* MNG_ACCESS_CHUNKS */
/* ************************************************************************** */
/* * end of file * */
/* ************************************************************************** */
libmng-2.0.3/missing 0000755 0001750 0001750 00000015331 12115360516 014262 0 ustar glennrp glennrp #! /bin/sh
# Common wrapper for a few potentially missing GNU programs.
scriptversion=2012-06-26.16; # UTC
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard , 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try '$0 --help' for more information"
exit 1
fi
case $1 in
--is-lightweight)
# Used by our autoconf macros to check whether the available missing
# script is modern enough.
exit 0
;;
--run)
# Back-compat with the calling convention used by older automake.
shift
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
to PROGRAM being missing or too old.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
Supported PROGRAM values:
aclocal autoconf autoheader autom4te automake makeinfo
bison yacc flex lex help2man
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
'g' are ignored when checking the name.
Send bug reports to ."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: unknown '$1' option"
echo 1>&2 "Try '$0 --help' for more information"
exit 1
;;
esac
# Run the given program, remember its exit status.
"$@"; st=$?
# If it succeeded, we are done.
test $st -eq 0 && exit 0
# Also exit now if we it failed (or wasn't found), and '--version' was
# passed; such an option is passed most likely to detect whether the
# program is present and works.
case $2 in --version|--help) exit $st;; esac
# Exit code 63 means version mismatch. This often happens when the user
# tries to use an ancient version of a tool on a file that requires a
# minimum version.
if test $st -eq 63; then
msg="probably too old"
elif test $st -eq 127; then
# Program was missing.
msg="missing on your system"
else
# Program was found and executed, but failed. Give up.
exit $st
fi
perl_URL=http://www.perl.org/
flex_URL=http://flex.sourceforge.net/
gnu_software_URL=http://www.gnu.org/software
program_details ()
{
case $1 in
aclocal|automake)
echo "The '$1' program is part of the GNU Automake package:"
echo "<$gnu_software_URL/automake>"
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/autoconf>"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
autoconf|autom4te|autoheader)
echo "The '$1' program is part of the GNU Autoconf package:"
echo "<$gnu_software_URL/autoconf/>"
echo "It also requires GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
esac
}
give_advice ()
{
# Normalize program name to check for.
normalized_program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
printf '%s\n' "'$1' is $msg."
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
case $normalized_program in
autoconf*)
echo "You should only need it if you modified 'configure.ac',"
echo "or m4 files included by it."
program_details 'autoconf'
;;
autoheader*)
echo "You should only need it if you modified 'acconfig.h' or"
echo "$configure_deps."
program_details 'autoheader'
;;
automake*)
echo "You should only need it if you modified 'Makefile.am' or"
echo "$configure_deps."
program_details 'automake'
;;
aclocal*)
echo "You should only need it if you modified 'acinclude.m4' or"
echo "$configure_deps."
program_details 'aclocal'
;;
autom4te*)
echo "You might have modified some maintainer files that require"
echo "the 'automa4te' program to be rebuilt."
program_details 'autom4te'
;;
bison*|yacc*)
echo "You should only need it if you modified a '.y' file."
echo "You may want to install the GNU Bison package:"
echo "<$gnu_software_URL/bison/>"
;;
lex*|flex*)
echo "You should only need it if you modified a '.l' file."
echo "You may want to install the Fast Lexical Analyzer package:"
echo "<$flex_URL>"
;;
help2man*)
echo "You should only need it if you modified a dependency" \
"of a man page."
echo "You may want to install the GNU Help2man package:"
echo "<$gnu_software_URL/help2man/>"
;;
makeinfo*)
echo "You should only need it if you modified a '.texi' file, or"
echo "any other file indirectly affecting the aspect of the manual."
echo "You might want to install the Texinfo package:"
echo "<$gnu_software_URL/texinfo/>"
echo "The spurious makeinfo call might also be the consequence of"
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
echo "want to install GNU make:"
echo "<$gnu_software_URL/make/>"
;;
*)
echo "You might have modified some files without having the proper"
echo "tools for further handling them. Check the 'README' file, it"
echo "often tells you about the needed prerequisites for installing"
echo "this package. You may also peek at any GNU archive site, in"
echo "case some other package contains this missing '$1' program."
;;
esac
}
give_advice "$1" | sed -e '1s/^/WARNING: /' \
-e '2,$s/^/ /' >&2
# Propagate the correct exit status (expected to be 127 for a program
# not found, 63 for a program that failed due to version mismatch).
exit $st
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
libmng-2.0.3/doc/ 0000755 0001750 0001750 00000000000 12115376074 013433 5 ustar glennrp glennrp libmng-2.0.3/doc/rpm/ 0000755 0001750 0001750 00000000000 12115376074 014231 5 ustar glennrp glennrp libmng-2.0.3/doc/Plan2.png 0000644 0001750 0001750 00000021221 12005307152 015100 0 ustar glennrp glennrp ‰PNG
IHDR X Ú¯BÔ PLTE ÿÿÿ ÿÿ ô™3ª tRNSÿÿÿÿ û¶S ",IDATxÚíÙ¢¥ªE“åÿÿs=ÔVAz¹uëÔn\'ÃÐG´ƒÉª…lU
Ùt»~RýB:x¢âþ×¼ŒŸèï÷«\ëœke/äRÜ}Šä’ϨHA!"*"Ráq‰ˆˆŠ<ö$$Ñæ…<Фè˱…T,Sã…ˆŠªüQ±×;Õã?º×Ÿ¿ÞUHOÞRˆ˜–ùå#OŠ_õ̓ش…ä©~"J
Iðä?Þç¯_›ô—ÒÇ“€ão1ãà'1ì¸.RÅíñ¸j¼btÆ×Š,]È¿DÛ‰¹…œo•O$·¾yן7¡WYBÎæG´ý¡¿nµ£å;5Rˆç˽$=ÉCËòDv×ùgÿ «™RÈñö7—R¿-|y„o³1ï.}ã´…üuìw×þx‹'RÏIzwÍÿ¸|ﮤVÓSO†5$dBö† $cÚ[x'£gC"ì‰ £5^¡jF{éxŒwa”Ê•¤ÇuãÉÙêImHÄaôޙ؅”ÍÕ‰ñE=–ÿãÂmIšíæËõ
Ùš²E<Ù¶mÛ¶êžl›þ}êòšT/d3íæËegL—)äEÝx\«òëUÈï×Òýý÷ó
9ZµOnJ²¯¿»™¶ÂKB€±M!V/HDŽÑ>‚lýTEФ]!ÕfeÑdÞBÄ~ä‰3"ÎàÅ9“±†&Æ…3¼¨’:¾(V!ÞÏYáqÍÊB|y!rƒÖÃBÎ9Ä~ëœÚh©IÚ§;Û_þÊð¯*»y3<ö$ÐËf¡'Á—¿X·k«¨ÌýîÊn0ñî*}wy/%™ù<‘êžÈòÂWŸ•Æ*UøÊžˆVaÑŠKÆêzñVC?½!QàgYøÕˆ'FK.!‘£xúôœdÆøö³²¼»ü¶-[Èßièg-<Ùú<®%kWάlO^#I; qäqm?—hl(RÝ‘m€¥8ò{ƒfû%hñŸ¶³›»úsdßPþûÝ,)£DWG¤¨«˜èHZ_ª†"ÒV‘›‡xÙ[8²jûG·ŽÔvÄîkä€ngÉKú[«M£Ñ8²¯—"õq‡ƒŽ¤LÉmÇÊ9¹Ä×±2vçK¼ÂŒªZéŽx’´x³Á‡é‡ƒê:’¦H Uç™›ª‡øš®.}ö3 ¾Ã¦qd+ü)Ž4wÄÚj1³#ÿO`ݲ9ŒÝ¬“ie˜[ð¼Ž[™6#›»÷¦¯Z1G€G>qGtÑõ9voÛâŽì¡zÛZùÒ©j½Ç`Ç‘$rçÛ—ÿªÈþŠ^ÞÖZÝ÷`9—-'ÜÕYÓþãHSïgq¤8ÏFÞ]½Æ‘ưËGŽ|~2ìâ[¡—áˆLãˆoúûaÕÒÑŽ‹Ú¼kµq¤&ì¯qd¡ŸâŽ´þéü7ƒ#gÜ?÷9«ÎDâœ&¤ÎQ;î!Üb<$’qÒÿsE|¥ÔÎ}:e¬Ê2ò9â8ØÕ‘ëº01²gŸíŠDG¬¦^G€GpGVq¤d`³à§í†5êvæˆàŽàHGFE÷:âŒ/¬ˆsBíyv&º\Û2ׂä¯|IØkŽèƒ´lµ1æ"ì{§C/—sOìKs“tuwÄØÑçqDŒ„^cáõ;›#çðœ›ýîdăó…‘ì,íϱ’ìrDŸd.î™y9ÇI}•GV-}#8òRGŸ0вlQpGpäîWì£LUŠÒªÏáÈñé‘@Õº_C×þô“4GœêsÓ\]Ư#±³bgq$ò+î™Øâ=IïÓŽHð¸Äë1NâÞ“õ½ä8rÿšJuÄ8²×y[bý?5WŽˆì]IcD½Œ[ÊTæpD9b0â!´Êʇ”9ĨÛÖO/kܬÃbÄû,ý¸IfuqdIG˜gOКý×z#[³ŸâޤýÔ“pGp$åVÿ§utn.‹‘ÍþÆ G¶móe×L¼ÖÍn9T‘MÍÄÖOÏ´Ž[È‘mGb?=ït[ö×8BdÇ‘/;M¹UòS:V‚ H‡WÕ»lA¾Q»AfäìÿïŸÿÞdˆ »Û‘ªû”AF²Ù„ìÿBb‚ ‚¬,† Kòã9La?YY’\*y1Já³²9VžÿÿAF
¢ÇÿŽÿ ‚”<óœXQ‘å_Y† ¿eÑóè^YSoÔ7ôXQuá\]`+KÄÞGiÔF!†$u.Ò]ëI©ý>Uw^…~HâN-ùˆ¤ú%/CÅÒå8K~A&ϪãÐI þ+^;½ \‹ ÂCí,Hÿwêº×>{Vý&¨¾&ÈC›@ žüv—ù8†_;AÚæc"ˆÙSÕpÇÕtÝ?P#ÆPûùQFªzµŽEò©—²íkÃE_
EwX"C-Då%‚\B?÷DJ
Õ,’0¨éœ+&êû< ¦J¼ÐwÄ‚:‚ ‚ ‚ ‚ ÖÚdjAJFs±‚ôgb‚ ØYq¥É»ùNß㉠ƹ÷‚ #ñN"ÅS#‚<|¨âCýîÚËDšzeÅæè: œCU¹{¨î¥ášu¹6:sk§^úZPw‘h;Oý‚‚è—I.+ø„î0\k_ê_ @³—fÈã‡*ù‚H¹/!ƒú8Ç3'AÝêR#¨KQP—.‚Ìd’Û c™Z/uAYE‚L-ÈÂ3m/dÝw/‚ ‚ H© áY5A‚„7sгR÷sŠ°á‚ØGE>¸R«m±õ]^AâÖÞ½Ü,†Ôú¼¥Ï:‰r_#H_A‚²ÿDük‡Ô<Óø$Arɽ?ZçIƒ;`*2NcåŽÓû
â¹7¹?ÒãÑîišzçTÀa"õCä¡ F]y(Èþ¢~&Èåê‰4ø$|hL´8k®
KxBë¢OùRi÷Ê
pçA]î)6-ÃÎ~^Ü÷ˆ¿#ObÈÜAA²Ñ"AôÂØ/¿‡A½dmXÚµßd© Ž ‚ «òQC×
R{]ÖG×yU¤iO½Õ- ‚ ‚¤t[“ñNßy ˆ“- ‰ÒÖeEÆ Îé`y*ȃuY)‚‚CA
^Yö²+97„g¯í¬!¨?Œ!êêÆÂ¬'‚(A=_“‚ žñ¸„‚ ‚ ‚ Ê‚` ‚Ìt’3†ºêv„ÇAé+ˆ?Ïo ±\À¯Ý§þ\øÐ¬:»ÜW-»'‹£– ƒ‹ßÞ°“$ˆ
¢×¹á·r—€ƒ¦äÜqþAΙ›Ì‡*÷AÍ+Kr_YÒ"†˜“ŒÙ3†Á$5@x¨¡—ñýéÚ‘
î”Ü>†h@ÍÄCÔú¨‚w7H È倦‚ nLC–õä¬Aák)é¼"¥¯¬tÙ§¾RPÏ]‹ Uù`P_I#"My£MCR2uAA¯ ²˜!Ȭ‚`K¿e1yjÛ|íË)¸dе‚ ‚ õꦺm¡ÏE‚lÂ+ëÅ‚|Ûß>íÙöR7£Ô
AþžÍCA¼Òf
b–ºmRôÚ1«¹ñ‡WÖ‚(‚L!ˆ÷
‡ ´²AAó‚ † ‚!‚`Ë
²}ÄÖä•AAA–ÄXY{|gC‚x&½ýS2JE‘1äºA
²)„Ì.ˆC7{·¡Ml¡‚ ‚ ‚ Ò[&¨æCÁ*
òÃæ0弬©A«&Hï”L+Zé³Ê¤ ÷‘¦\ñ¦– ?ýE…A‚üþþ¯úûí!ÈHBŽñÿ*‚ ‚¼I çAQ‚ˆ•/NAFη`+Ëä‡ Ã wædAÖ$D® cßCHVk%˜|sT³Wú5A™[cád=srG:
ýñš‚ˆ¹¢Ð\ÔæYóÿîÊ
ÏÕcFT®OíR¤œËäËA4.ˆ}õûÑAœ£ç³Ùé¸DMA|PùQ ÆÕò˜…WW Æ;Aö½?š€ FØrcˆ„bH¸h·ÐÕ[YöÂtIiÎDÖ²'-ÐÛ·V-,ȗפà’Õ†ÜA¤¶ ÆæA‚X›òÌ€ƒ’¤¹ —]NŠ rn@B©ûP}ÛÏî®
l@ì/ˆ½µîº¯k rÙ¯vý‡›˜àð@|™ Ì\·§«Bi×VÖ]‚š‚„w]:ÙZ|ûš½‚hŠ 7ÛLG 2A?Ä÷hô¹ úTg30‚ˆ¹É€ $íëVU±ÒEä"Æ¡Ÿ$¹¬ÈÙ@·©Ú‚×Z—ú-b,‹±,AYN‚Sä$[)ˆm¯ke Ãé;†C1Û¼âë‡Üe…;†šßS‡{Azv-5:u'ÚŽP¥§ž^oœÕÛsc«2“Eò ~§Ù;· ì‡ ‚ ‚ ‚ ‚Ô„íØ† ‚!Ȫ‚¬ß)ÈÂÍEAAAAAA‚Hðá‚ô$˜0Rœ”€*ׂ‚|TµQ™‹Ý—ÉÆ‹«56¶ÚDW’ —à,7A=°©>'MiVÛjSÁ^A¢5=–È·b³A’E)Që(™è•%©‚Hh'1‚d rœƒ7àœzfÖbï²y$Hî
ÄÛ½N¿A
¢zîÍSïá2ˆ w—"ïi¹ë‰&]|éã5ÄCŽ-—g#¯ ·«ØCu·ÕY‡ÑÜ]:›Ï½º æ-H —?ª•Ä©³/¤o?DJQsŸt¶ ñq¯^B«!mšh»VøÊ’焨”b]½ˆ ‘ÇhTÕŒ žÞž¨zfWâµkb·Yhö"ÈgÙŸ¾\{û‚ ZYÁSn¾»äON+ óZ•ÈN»¡A?Äj¯Y]ÛcÇGd¯Í›k<òÿúëÕWAf2zêŸä²Þ"Y¹ ’#Èåj©Aˆ¢â!r®‚œ«Ë$‰#†X‹?C¬öÚÓžzÁ™]‰§kN¥ú!‚ ‚ ‚ ‚ õa;6ƒ!‚`òEAªOP}ôüz‚T¾ä«'C ‚ ‚ ‚ ‚Ì ˆ HÖç`NÄ·³×ŸáAÜO5—wˆŽ!=õo¢¡~HæX–%ˆÒ1œ¸§NÇð± ÇÉתO0K;ŠA