Compare commits
99 Commits
tags/IMGSH
...
tags/Cache
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
758075df86 | ||
|
|
76159a2caf | ||
|
|
1988cb05b5 | ||
|
|
dd8c6b3bed | ||
|
|
bc64749366 | ||
|
|
2e9287bd58 | ||
|
|
0f2274a140 | ||
|
|
957fa10cac | ||
|
|
e603146886 | ||
|
|
cb698a0df1 | ||
|
|
1b918d9ef0 | ||
|
|
6407144c9f | ||
|
|
2ed563a178 | ||
|
|
4becc0b508 | ||
|
|
7d5427ea31 | ||
|
|
99904bcc48 | ||
|
|
bcb56c9593 | ||
|
|
f18bc8e6cd | ||
|
|
7d14c5669a | ||
|
|
c0dd3df02e | ||
|
|
e5cc84978f | ||
|
|
5694537330 | ||
|
|
297c5ceba3 | ||
|
|
e0311312f7 | ||
|
|
cf3dc77b02 | ||
|
|
dd2506a737 | ||
|
|
b1bee1f21c | ||
|
|
48ecc5625b | ||
|
|
1b791685e6 | ||
|
|
dc94d1d6e2 | ||
|
|
f5b437ade3 | ||
|
|
8c0b4b3e4a | ||
|
|
fb640ab144 | ||
|
|
106e263b33 | ||
|
|
85045a8552 | ||
|
|
a2279be132 | ||
|
|
0ce702d402 | ||
|
|
f14d03cd67 | ||
|
|
b91343fdf6 | ||
|
|
2c517489b5 | ||
|
|
ae57da58eb | ||
|
|
8d4586dd65 | ||
|
|
9b473ad9be | ||
|
|
2ad227a994 | ||
|
|
94d8da33c1 | ||
|
|
81c05809fd | ||
|
|
e30547b2b2 | ||
|
|
257f9cfaaa | ||
|
|
96e2654e43 | ||
|
|
3b023433be | ||
|
|
1b89716afe | ||
|
|
ad02058877 | ||
|
|
fa8a3196e7 | ||
|
|
5c2c543e58 | ||
|
|
c588721cc0 | ||
|
|
0b049b17ba | ||
|
|
854ef4631d | ||
|
|
051c558653 | ||
|
|
37a04adb09 | ||
|
|
c823c04b45 | ||
|
|
03cbd000eb | ||
|
|
a91e91a1c7 | ||
|
|
be7a5a48b6 | ||
|
|
b2bc7468e8 | ||
|
|
9692dfd994 | ||
|
|
f3edd4cfb5 | ||
|
|
33403345c1 | ||
|
|
20c850de23 | ||
|
|
e8b619cd02 | ||
|
|
eed396bb92 | ||
|
|
41d44c070b | ||
|
|
698ba42268 | ||
|
|
1a0fd23991 | ||
|
|
67dded330b | ||
|
|
936ff4777a | ||
|
|
96c55e42f7 | ||
|
|
82fa0cf06a | ||
|
|
98c8285334 | ||
|
|
bad4b683f4 | ||
|
|
cb5269a28a | ||
|
|
74712f3635 | ||
|
|
9f8ea739db | ||
|
|
97a10dd7c6 | ||
|
|
85a132fac0 | ||
|
|
e594eee877 | ||
|
|
9148eee3d6 | ||
|
|
b5989a8382 | ||
|
|
2b861f60d9 | ||
|
|
87db050b37 | ||
|
|
ffe483cf95 | ||
|
|
52aa17a1c3 | ||
|
|
5fdb3aa69e | ||
|
|
8cae473bc0 | ||
|
|
0719303755 | ||
|
|
90d3e40858 | ||
|
|
c792b2d35c | ||
|
|
7a4377d840 | ||
|
|
a5fa416010 | ||
|
|
49d00db5e2 |
@@ -1,36 +0,0 @@
|
||||
Imglib Decoders as Components:
|
||||
|
||||
Basic description:
|
||||
|
||||
I have 4 new subdirectories to make below mozilla/modules/libimg.
|
||||
Some of the files in mozilla/modules/libimg/src and libimg/public
|
||||
have been moved to one of the new directories or 'retired'.
|
||||
|
||||
I have new exports in libimg/public and libimg/public_com.
|
||||
I have a few new files that should go into the new directories.
|
||||
|
||||
------------------------------
|
||||
The old structure:
|
||||
|
||||
libimg/
|
||||
/src
|
||||
/public
|
||||
/png
|
||||
------------------------------
|
||||
The new structure:
|
||||
|
||||
libimg/
|
||||
/src
|
||||
new:
|
||||
|
||||
old
|
||||
/public
|
||||
/public_com
|
||||
/gifcom
|
||||
/jpgcom
|
||||
/pngcom
|
||||
------------------------------
|
||||
******************************************************
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,31 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
|
||||
/* gif.h */
|
||||
|
||||
extern PRBool il_gif_init(il_container *ic);
|
||||
extern int il_gif_write(il_container *, const PRUint8 *, int32);
|
||||
extern void il_gif_complete(il_container *ic);
|
||||
extern PRUint8 il_gif_write_ready(il_container *ic);
|
||||
extern void il_gif_abort(il_container *ic);
|
||||
extern void gif_delay_time_callback(void *closure);
|
||||
@@ -1,98 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
|
||||
#
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Makefile to build the IMGLIB LIB
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
!ifdef MOZ_JAVA
|
||||
LOCAL_JMC_SUBDIR = .
|
||||
!endif
|
||||
|
||||
|
||||
LIBRARY_NAME = nsgif
|
||||
|
||||
#
|
||||
# Make sure we have MOZILLA_CLIENT defined so we get the
|
||||
# proper JS includes
|
||||
#
|
||||
LCFLAGS = $(LCFLAGS) -DMOZILLA_CLIENT
|
||||
|
||||
!ifdef BUILD_DEBUG_GC
|
||||
LCFLAGS = $(LCFLAGS) -DDEBUG_GC
|
||||
!endif
|
||||
|
||||
LCFLAGS = $(LCFLAGS) /TP
|
||||
|
||||
LLIBS= $(LIBNSPR) \
|
||||
$(DIST)\lib\util.lib \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
!ifdef NU_CACHE
|
||||
$(DIST)\lib\cache.lib \
|
||||
!endif
|
||||
$(NULL)
|
||||
|
||||
LIBRARY= .\$(OBJDIR)\$(LIBNAME).lib
|
||||
LIBRARY_SUFFIX = $(MOZ_BITS)$(VERSION_NUMBER)
|
||||
|
||||
MAKE_OBJ_TYPE=DLL
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DLLNAME=nsgif
|
||||
DLL1NAME=nsgif
|
||||
PDBFILE=$(DLLNAME).pdb
|
||||
MAPFILE=$(DLLNAME).map
|
||||
DEFFILE=nsgif.def
|
||||
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...)
|
||||
#// (these must be defined before the common makefiles are included)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DLL=.\$(OBJDIR)\$(DLLNAME).dll
|
||||
MAPFILE= $(DLLNAME).map
|
||||
|
||||
|
||||
|
||||
MODULE=img
|
||||
DEPTH=..\..\..
|
||||
|
||||
LINCS=-I$(DEPTH)/dist/public/xpcom -I. -I$(DEPTH)/dist/public/raptor
|
||||
CPPSRCS= nsGIFModule.cpp nsGIFDecoder.cpp gif.cpp
|
||||
CPP_OBJS= .\$(OBJDIR)\nsGIFModule.obj .\$(OBJDIR)\nsGIFDecoder.obj \
|
||||
.\$(OBJDIR)\gif.obj
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/*
|
||||
* nsGIFDecoder.cpp --- interface to gif decoder
|
||||
*/
|
||||
|
||||
#include "nsGIFDecoder.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// GIF Decoder Implementation
|
||||
|
||||
NS_IMPL_ISUPPORTS1(GIFDecoder, nsIImgDecoder);
|
||||
|
||||
GIFDecoder::GIFDecoder(il_container* aContainer)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
ilContainer = aContainer;
|
||||
}
|
||||
|
||||
GIFDecoder::~GIFDecoder(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NS_METHOD
|
||||
GIFDecoder::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
if (aOuter) return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
il_container *ic = new il_container();
|
||||
if (!ic) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
GIFDecoder *decoder = new GIFDecoder(ic);
|
||||
if (!decoder) {
|
||||
delete ic;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_ADDREF(decoder);
|
||||
rv = decoder->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(decoder);
|
||||
|
||||
/* why are we creating and destroying this object for no reason? */
|
||||
delete ic; /* is a place holder */
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
GIFDecoder::ImgDInit()
|
||||
{
|
||||
PRBool ret=PR_FALSE;
|
||||
|
||||
if(ilContainer != NULL) {
|
||||
ret=il_gif_init(ilContainer);
|
||||
}
|
||||
if(ret)
|
||||
return NS_OK;
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
GIFDecoder::ImgDWriteReady(PRUint32 *max_read)
|
||||
{
|
||||
|
||||
if(ilContainer != NULL) {
|
||||
*max_read = il_gif_write_ready(ilContainer);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GIFDecoder::ImgDWrite(const unsigned char *buf, int32 len)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if( ilContainer != NULL ) {
|
||||
ret = il_gif_write(ilContainer, buf,len);
|
||||
if(ret != 0)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GIFDecoder::ImgDComplete()
|
||||
{
|
||||
if( ilContainer != NULL ) {
|
||||
il_gif_complete(ilContainer);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GIFDecoder::ImgDAbort()
|
||||
{
|
||||
if( ilContainer != NULL ) {
|
||||
il_gif_abort(ilContainer);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/* -*- Mode: C; tab-width: 4 -*-
|
||||
* nsGIFDecoder.cpp --- interface to gif decoder
|
||||
*/
|
||||
#ifndef _nsGIFDec_h
|
||||
#define _nsGIFDec_h
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIImgDecoder.h"
|
||||
#include "gif.h"
|
||||
|
||||
#define NS_GIFDECODER_CID \
|
||||
{ 0x0d471b70, 0xbaf5, 0x11d2, \
|
||||
{ 0x80, 0x2c, 0x00, 0x60, 0x08, 0x8f, 0x91, 0xa3 } }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// GIF Decoder Definition
|
||||
|
||||
class GIFDecoder : public nsIImgDecoder
|
||||
{
|
||||
public:
|
||||
GIFDecoder(il_container* aContainer);
|
||||
virtual ~GIFDecoder();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
static NS_METHOD Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
/* stream */
|
||||
NS_IMETHOD ImgDInit();
|
||||
|
||||
NS_IMETHOD ImgDWriteReady(PRUint32 *max_read);
|
||||
NS_IMETHOD ImgDWrite(const unsigned char *buf, int32 len);
|
||||
NS_IMETHOD ImgDComplete();
|
||||
NS_IMETHOD ImgDAbort();
|
||||
|
||||
NS_IMETHOD_(il_container *) SetContainer(il_container *ic){ilContainer = ic; return ic;}
|
||||
NS_IMETHOD_(il_container *) GetContainer() {return ilContainer;}
|
||||
|
||||
|
||||
private:
|
||||
il_container* ilContainer;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,40 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsGIFDecoder.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
static NS_DEFINE_CID(kGIFDecoderCID, NS_GIFDECODER_CID);
|
||||
|
||||
static nsModuleComponentInfo components[] =
|
||||
{
|
||||
{ "GIF Decoder",
|
||||
NS_GIFDECODER_CID,
|
||||
"@mozilla.org/image/decoder;1?type=image/gif",
|
||||
GIFDecoder::Create }
|
||||
};
|
||||
|
||||
NS_IMPL_NSGETMODULE(nsGIFModule, components)
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
;
|
||||
; temp def file for nsgif dll
|
||||
;
|
||||
|
||||
LIBRARY nsgif.dll
|
||||
DESCRIPTION 'test dll'
|
||||
|
||||
EXPORTS
|
||||
ImgDInit @1002 PRIVATE
|
||||
ImgDWrite @1003 PRIVATE
|
||||
ImgDWriteReady @1004 PRIVATE
|
||||
ImgDComplete @1005 PRIVATE
|
||||
ImgDAbort @1006 PRIVATE
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
?il_gif_write@@YAHPAUil_container_struct@@PBEJ@Z ; 43937
|
||||
?il_BACat@@YAPADPAPADIPBDI@Z ; 42718
|
||||
?gif_delay_time_callback@@YAXPAX@Z ; 41012
|
||||
?ImgDWrite@GIFDecoder@@UAGIPBEJ@Z ; 2925
|
||||
?il_gif_write_ready@@YAEPAUil_container_struct@@@Z ; 2820
|
||||
?ImgDWriteReady@GIFDecoder@@UAGIPAI@Z ; 2820
|
||||
?AddRef@GIFDecoder@@UAGKXZ ; 2814
|
||||
?Release@GIFDecoder@@UAGKXZ ; 2776
|
||||
?il_gif_abort@@YAXPAUil_container_struct@@@Z ; 1486
|
||||
?SetContainer@GIFDecoder@@UAGPAUil_container_struct@@PAU2@@Z ; 1474
|
||||
?QueryInterface@GIFDecoder@@UAGIABUnsID@@PAPAX@Z ; 1407
|
||||
??0GIFDecoder@@QAE@PAUil_container_struct@@@Z ; 1407
|
||||
?ImgDComplete@GIFDecoder@@UAGIXZ ; 1407
|
||||
?ImgDInit@GIFDecoder@@UAGIXZ ; 1407
|
||||
?il_gif_init@@YAHPAUil_container_struct@@@Z ; 1407
|
||||
?Create@GIFDecoder@@SGIPAVnsISupports@@ABUnsID@@PAPAX@Z ; 1407
|
||||
?il_gif_complete@@YAXPAUil_container_struct@@@Z ; 1407
|
||||
??1GIFDecoder@@UAE@XZ ; 1369
|
||||
??_GGIFDecoder@@UAEPAXI@Z ; 1369
|
||||
?ImgDAbort@GIFDecoder@@UAGIXZ ; 136
|
||||
_NSGetModule ; 1
|
||||
@@ -1,61 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
LIBRARY_NAME = nsjpg
|
||||
EXPORT_LIBRARY = 1
|
||||
IS_COMPONENT = 1
|
||||
REQUIRES = xpcom string img util layout locale jpeg unicharutil
|
||||
|
||||
CPPSRCS = \
|
||||
jpeg.cpp \
|
||||
nsJPGDecoder.cpp \
|
||||
nsJPGModule.cpp \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_INCLUDES = -I$(srcdir)
|
||||
|
||||
EXTRA_DSO_LDOPTS = $(JPEG_LIBS) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_LIBS = $(NSPR_LIBS)
|
||||
|
||||
ifndef MOZ_JAVA
|
||||
LOCAL_JMC_SUBDIR = .
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifeq ($(OS_ARCH)$(OS_RELEASE),SunOS5)
|
||||
ifeq ($(shell uname -r),5.3)
|
||||
# In this special case (jpeg.cpp), the compiler has to know
|
||||
# the OS version to a finer granularity than normal.
|
||||
DEFINES += -DOSMINOR=3
|
||||
endif
|
||||
endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,34 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* jpeg.h */
|
||||
|
||||
|
||||
extern int il_jpeg_init(il_container *ic);
|
||||
extern int il_jpeg_write(il_container *, const PRUint8 *, int32);
|
||||
extern void il_jpeg_complete(il_container *ic);
|
||||
//extern unsigned int il_jpeg_write_ready(il_container *ic);
|
||||
extern void il_jpeg_abort(il_container *ic);
|
||||
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
|
||||
#
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Makefile to build the IMGLIB LIB
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
!ifdef MOZ_JAVA
|
||||
LOCAL_JMC_SUBDIR = .
|
||||
!endif
|
||||
|
||||
|
||||
LIBRARY_NAME = nsjpg
|
||||
|
||||
#
|
||||
# Make sure we have MOZILLA_CLIENT defined so we get the
|
||||
# proper JS includes
|
||||
#
|
||||
LCFLAGS = $(LCFLAGS) -DMOZILLA_CLIENT
|
||||
|
||||
!ifdef BUILD_DEBUG_GC
|
||||
LCFLAGS = $(LCFLAGS) -DDEBUG_GC
|
||||
!endif
|
||||
|
||||
LCFLAGS = $(LCFLAGS) /TP
|
||||
|
||||
LLIBS= $(LIBNSPR) \
|
||||
$(DIST)\lib\util.lib \
|
||||
$(DIST)\lib\jpeg3250.lib \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
!ifdef NU_CACHE
|
||||
$(DIST)\lib\cache.lib \
|
||||
!endif
|
||||
$(NULL)
|
||||
|
||||
LIBRARY= .\$(OBJDIR)\$(LIBNAME).lib
|
||||
LIBRARY_SUFFIX = $(MOZ_BITS)$(VERSION_NUMBER)
|
||||
|
||||
MAKE_OBJ_TYPE=DLL
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DLLNAME=nsjpg
|
||||
DLL1NAME=nsjpg
|
||||
PDBFILE=$(DLLNAME).pdb
|
||||
MAPFILE=$(DLLNAME).map
|
||||
DEFFILE=nsjpg.def
|
||||
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...)
|
||||
#// (these must be defined before the common makefiles are included)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DLL=.\$(OBJDIR)\$(DLLNAME).dll
|
||||
MAPFILE= $(DLLNAME).map
|
||||
|
||||
|
||||
|
||||
MODULE=img
|
||||
DEPTH=..\..\..
|
||||
|
||||
LINCS=-I$(DEPTH)/dist/public/xpcom -I. -I$(DEPTH)/dist/public/raptor -I$(DEPTH)/dist/public/jpeg
|
||||
CPPSRCS= nsJPGDecoder.cpp nsJPGModule.cpp jpeg.cpp
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsJPGDecoder.obj \
|
||||
.\$(OBJDIR)\nsJPGModule.obj \
|
||||
.\$(OBJDIR)\jpeg.obj \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/* -*- Mode: C; tab-width: 4 -*-
|
||||
* nsJPGDecoder.cpp --- interface to JPG decoder
|
||||
*/
|
||||
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsJPGDecoder.h"
|
||||
#include "jpeg.h"
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// JPG Decoder Implementation
|
||||
|
||||
NS_IMPL_ISUPPORTS1(JPGDecoder, nsIImgDecoder);
|
||||
|
||||
JPGDecoder::JPGDecoder(il_container* aContainer)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
ilContainer = aContainer;
|
||||
}
|
||||
|
||||
JPGDecoder::~JPGDecoder(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NS_METHOD
|
||||
JPGDecoder::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
if (aOuter) return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
il_container *ic = new il_container();
|
||||
if (!ic) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
JPGDecoder *decoder = new JPGDecoder(ic);
|
||||
if (!decoder) {
|
||||
delete ic;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_ADDREF(decoder);
|
||||
rv = decoder->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(decoder);
|
||||
|
||||
/* why are we creating and destroying this object for no reason? */
|
||||
delete ic; /* is a place holder */
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------*/
|
||||
/* api functions
|
||||
*/
|
||||
/*------------------------------------------------------*/
|
||||
NS_IMETHODIMP
|
||||
JPGDecoder::ImgDInit()
|
||||
{
|
||||
int ret;
|
||||
|
||||
if( ilContainer != NULL ) {
|
||||
ret = il_jpeg_init(ilContainer);
|
||||
if(ret != 1)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
JPGDecoder::ImgDWriteReady(PRUint32 *max_read)
|
||||
{
|
||||
/* dummy return needed */
|
||||
*max_read = 2048;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
JPGDecoder::ImgDWrite(const unsigned char *buf, int32 len)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if( ilContainer != NULL ) {
|
||||
ret = il_jpeg_write(ilContainer, buf,len);
|
||||
if(ret != 0)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
JPGDecoder::ImgDComplete()
|
||||
{
|
||||
if( ilContainer != NULL ) {
|
||||
il_jpeg_complete(ilContainer);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
JPGDecoder::ImgDAbort()
|
||||
{
|
||||
if( ilContainer != NULL ) {
|
||||
il_jpeg_abort(ilContainer);
|
||||
}
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsJPGDecoder_h___
|
||||
#define nsJPGDecoder_h___
|
||||
|
||||
#include "nsIImgDecoder.h"
|
||||
|
||||
/* 1b0e6b90-d68a-11d2-802e-0060088f91a3 */
|
||||
#define NS_JPGDECODER_CID \
|
||||
{ 0x1b0e6b90, 0xd68a, 0x11d2, \
|
||||
{ 0x80, 0x2c, 0x00, 0x60, 0x08, 0x8f, 0x91, 0xa3 } }
|
||||
|
||||
class JPGDecoder : public nsIImgDecoder
|
||||
{
|
||||
public:
|
||||
JPGDecoder(il_container* aContainer);
|
||||
virtual ~JPGDecoder();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
static NS_METHOD Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
/* stream */
|
||||
NS_IMETHOD ImgDInit();
|
||||
|
||||
NS_IMETHOD ImgDWriteReady(PRUint32 *max_read);
|
||||
NS_IMETHOD ImgDWrite(const unsigned char *buf, int32 len);
|
||||
NS_IMETHOD ImgDComplete();
|
||||
NS_IMETHOD ImgDAbort();
|
||||
|
||||
NS_IMETHOD_(il_container *) SetContainer(il_container *ic){ilContainer = ic; return ic;}
|
||||
NS_IMETHOD_(il_container *) GetContainer() {return ilContainer;}
|
||||
|
||||
|
||||
private:
|
||||
il_container* ilContainer;
|
||||
};
|
||||
|
||||
#endif /* nsJPGDecoder_h___ */
|
||||
@@ -1,49 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsJPGModule_h___
|
||||
#define nsJPGModule_h___
|
||||
|
||||
#include "nsIModule.h"
|
||||
|
||||
class nsJPGModule : public nsIModule
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// Construction, Init and desstruction
|
||||
nsJPGModule();
|
||||
virtual ~nsJPGModule();
|
||||
|
||||
// nsIModule Interfaces
|
||||
NS_DECL_NSIMODULE
|
||||
|
||||
// Facility for counting object instances
|
||||
int IncrementObjCount() { if (mObjCount == -1) mObjCount = 0; return ++mObjCount; }
|
||||
int DecrementObjCount() { if (mObjCount == -1) mObjCount = 0; return --mObjCount; }
|
||||
int GetObjCount() { return mObjCount; }
|
||||
|
||||
private:
|
||||
int mObjCount;
|
||||
nsISupports* mClassObject;
|
||||
};
|
||||
|
||||
#endif /* nsJPGModule_h___ */
|
||||
@@ -1,14 +0,0 @@
|
||||
;
|
||||
; temp def file for nsjpg dll
|
||||
;
|
||||
|
||||
LIBRARY nsjpg.dll
|
||||
DESCRIPTION 'test dll'
|
||||
|
||||
EXPORTS
|
||||
ImgDInit @1002 PRIVATE
|
||||
ImgDWrite @1003 PRIVATE
|
||||
ImgDWriteReady @1004 PRIVATE
|
||||
ImgDComplete @1005 PRIVATE
|
||||
ImgDAbort @1006 PRIVATE
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
?fill_input_buffer@@YAEPAUjpeg_decompress_struct@@@Z ; 53
|
||||
?ImgDWrite@JPGDecoder@@UAGIPBEJ@Z ; 45
|
||||
?il_jpeg_write@@YAHPAUil_container_struct@@PBEJ@Z ; 45
|
||||
?ImgDWriteReady@JPGDecoder@@UAGIPAI@Z ; 44
|
||||
?output_jpeg_scanlines@@YAHPAUil_container_struct@@H@Z ; 4
|
||||
?init_source@@YAXPAUjpeg_decompress_struct@@@Z ; 2
|
||||
?AddRef@JPGDecoder@@UAGKXZ ; 2
|
||||
?Release@JPGDecoder@@UAGKXZ ; 2
|
||||
?skip_input_data@@YAXPAUjpeg_decompress_struct@@J@Z ; 2
|
||||
?SetContainer@JPGDecoder@@UAGPAUil_container_struct@@PAU2@@Z ; 2
|
||||
?il_jpeg_abort@@YAXPAUil_container_struct@@@Z ; 2
|
||||
_NSGetModule ; 1
|
||||
?il_jpeg_COM_handler@@YAEPAUjpeg_decompress_struct@@@Z ; 1
|
||||
?il_jpeg_init@@YAHPAUil_container_struct@@@Z ; 1
|
||||
?setup_jpeg_src@@YAHPAUjpeg_decompress_struct@@PAUjpeg_struct@@@Z ; 1
|
||||
?ImgDInit@JPGDecoder@@UAGIXZ ; 1
|
||||
?QueryInterface@JPGDecoder@@UAGIABUnsID@@PAPAX@Z ; 1
|
||||
??_GJPGDecoder@@UAEPAXI@Z ; 1
|
||||
??0JPGDecoder@@QAE@PAUil_container_struct@@@Z ; 1
|
||||
?Create@JPGDecoder@@SGIPAVnsISupports@@ABUnsID@@PAPAX@Z ; 1
|
||||
??1JPGDecoder@@UAE@XZ ; 1
|
||||
?ImgDAbort@JPGDecoder@@UAGIXZ ; 1
|
||||
?ImgDComplete@JPGDecoder@@UAGIXZ ; 1
|
||||
?il_jpeg_complete@@YAXPAUil_container_struct@@@Z ; 1
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,760 +0,0 @@
|
||||
-----------------------------------------------------------
|
||||
|
||||
1.0.1 (May 2nd 2001)
|
||||
--------------------
|
||||
|
||||
in short:
|
||||
|
||||
Maintenance release.
|
||||
Fixed several memory-leaks with the help of Gregg Kelly, added/fixed some CMS
|
||||
handling, exported JPEG functions from standard DLL, and some other minor fixes.
|
||||
|
||||
The CMS fix now makes libmng automagically work in MNG_FULL_CMS mode as a
|
||||
sRGB compliant system. YOU WILL NEED TO CHANGE THIS IF YOU ARE NOT ON AN sRGB
|
||||
COMPLIANT SYSTEM AND WANT TO USE CMS!!!!
|
||||
(look in libmng.h for the proper function-calls)
|
||||
|
||||
-------------------
|
||||
|
||||
bugfixes:
|
||||
|
||||
core:
|
||||
- added MEND processing callback
|
||||
- fixed first FRAM_MODE=4 timing problem
|
||||
- added handle status-copy function (use with care)
|
||||
- exported JPEG functions from standard DLL
|
||||
- added BGRA8 canvas with premultiplied alpha (contrib by Gregg Kelly)
|
||||
- fixed problem with display_reset/display_resume (Thanks Gregg!)
|
||||
- fixed several memory-leaks (Thanks Gregg!)
|
||||
- fixed reset_rundata to drop all objects (Thanks again, Gregg!)
|
||||
- fixed problem with cms profile being created multiple times when both
|
||||
iCCP & cHRM/gAMA are present (And again... Gregg)
|
||||
- moved mng_clear_cms to libmng_cms
|
||||
- added "default" sRGB generation (Thanks Marti!)
|
||||
|
||||
samples:
|
||||
|
||||
contrib:
|
||||
|
||||
doc:
|
||||
|
||||
makefiles:
|
||||
|
||||
autoconf:
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
1.0.0 (Feb 6th 2001)
|
||||
--------------------
|
||||
|
||||
in short:
|
||||
|
||||
First public release. Finally(!)
|
||||
|
||||
This is the 0.9.5 CVS version, which will never be released, because I feel it
|
||||
is now ready for a public release. So apart from the version-numbers here and
|
||||
there, all other changes are listed under 0.9.5.
|
||||
|
||||
This library will work with every MNG/JNG known and available to me. Note that
|
||||
there are still parts that need to be coded, and that MNG support is around
|
||||
90-95% (JNG at 100%). It is however compliant with the latest and greatest
|
||||
MNG 1.0 specification.
|
||||
|
||||
I hope to dedicate a bit more time this year to finish up full support and fill
|
||||
in the remaining blanks. But this is coming out of my spare time. And extra
|
||||
help is always appreciated.
|
||||
|
||||
Please enjoy!
|
||||
|
||||
Gerard
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
0.9.5 (no release)
|
||||
------------------
|
||||
|
||||
in short:
|
||||
|
||||
intermediate CVS
|
||||
|
||||
-------------------
|
||||
|
||||
bugfixes:
|
||||
B129681 - fixed compiler warnings SGI/Irix (thanks Dimitri)
|
||||
|
||||
core:
|
||||
- fixed compiler-warnings Mozilla (thanks Tim)
|
||||
- fixed timing-problem with switching framing_modes
|
||||
- fixed some small compiler warnings (thanks Nikki)
|
||||
|
||||
samples:
|
||||
|
||||
contrib:
|
||||
- fixed library-paths for MSVC DLL project (thanks Chad)
|
||||
|
||||
doc:
|
||||
|
||||
makefiles:
|
||||
- added makefile for DJGPP (thanks Silvio)
|
||||
|
||||
autoconf:
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
0.9.4 (Jan 19th 2001)
|
||||
----------------------
|
||||
|
||||
in short:
|
||||
|
||||
Now that the MNG spec is at 1.0, this should be the last beta. There's a few
|
||||
small changes to make it inline with the spec, and a couple of bug-fixes.
|
||||
This is a serious release-candidate for libmng-1.0!!
|
||||
Please... test test test test!!
|
||||
|
||||
-------------------
|
||||
|
||||
bugfixes:
|
||||
B123314 - fixed number of TERM related problems
|
||||
B123322 - fixed unwanted repetition in mng_readdisplay()
|
||||
B123443 - fixed by Ralph
|
||||
B124910 - fixed definition for WIN32_LEAN_AND_MEAN (thanks Chad)
|
||||
B125750 - fixed by Ralph
|
||||
B125756 - fixed mixup of data- & function-pointers (thanks Dimitri)
|
||||
B127517 - changed inclusion of the lcms header file for non-windows platforms
|
||||
|
||||
core:
|
||||
- version numbers
|
||||
- fixed possible loop in display_resume() (Thanks Vova!)
|
||||
- fixed unwanted repetition in mng_readdisplay()
|
||||
- changed inclusion of the lcms header file for non-windows platforms
|
||||
- changed IHDR filter_method check for PNGs
|
||||
- moved restore of object 0 to libmng_display
|
||||
- added restore of object 0 to TERM processing (B123314)
|
||||
- fixed TERM delay processing (B123314)
|
||||
- fixed TERM end processing when count = 0 (B123314)
|
||||
- changed callback convention for MSVC (Thanks Chad)
|
||||
- fixed mixup of data- & function-pointers (thanks Dimitri)
|
||||
- added support for "nEED MNG-1.0"
|
||||
- added errorcode for MAGN methods
|
||||
- added errorchecking for MAGN methods
|
||||
- removed "old" MAGN methods 3 & 4
|
||||
- added "new" MAGN methods 3, 4 & 5
|
||||
- removed test filter-methods 1 & 65
|
||||
- set default level-set for filtertype=64 to all zeroes
|
||||
|
||||
samples:
|
||||
|
||||
contrib:
|
||||
- added GTK mng-view example by Vova Babin
|
||||
- added MSVC MNGview sample by Nikolaus Brennig
|
||||
- updated Jason Summer's mngplg to version 0.9.2
|
||||
(that's mngplg-0.9.2 based on libmng-0.9.3 !!!)
|
||||
- rearranged contrib directory slightly
|
||||
- added MSVC project to build libmng.dll by Chad Austin
|
||||
|
||||
doc:
|
||||
- added README.dll
|
||||
- added README.config
|
||||
|
||||
makefiles:
|
||||
- added a makefile for MS Visual C++ (Thanks to Atsushi Matsuda)
|
||||
|
||||
autoconf:
|
||||
- fixed configure.in for lcms (FreeBSD port by Mikhail Teterin)
|
||||
- by default configure includes CMS support if lcms is present
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
0.9.3 (October 29th 2000)
|
||||
-------------------------
|
||||
|
||||
in short:
|
||||
|
||||
Another beta release. The number of changes in the MNG specification have
|
||||
resulted in a lot of new code and some changed code. At the same time I saw
|
||||
no need to withhold some new functionality as it was pretty clear there was
|
||||
going to be another beta-round. If things go well, I'm going to try to release
|
||||
libmng 1.0.0 very shortly after this one.
|
||||
|
||||
Many thanks to a lot of people for helping out, sending contributions, making
|
||||
suggestions and testing this little baby. This would get nowhere without YOU!!!
|
||||
|
||||
- fixed bug 111300/117103
|
||||
- added workaround for faulty PhotoShop iCCP chunk
|
||||
- added MAGN/JDAA chunks
|
||||
- added support for new filter_types
|
||||
- added PNG/MNG spec version indicators
|
||||
- added BCB mngview contribution by Andy Protano
|
||||
- added BCB mngdump; a GUI-based MNG dumping utility (Andy Protano)
|
||||
- implemented support for nEED "draft nn"
|
||||
- implemented app-defined support for bKGD for PNG images
|
||||
- removed trace-options from default SO/DLL builds (!!!)
|
||||
- raised initial maximum canvas size to 10000x10000 (!!!)
|
||||
(an App that wants to protect from overly large images should call
|
||||
mng_set_maxcanvassize() with appropriate values)
|
||||
- fixed other assorted stuff
|
||||
|
||||
-------------------
|
||||
|
||||
bugfixes:
|
||||
B111300 - fixup for improved portability
|
||||
B117103 - fixed compilation errors on *nix with lcms (thanks Ralph!)
|
||||
|
||||
core:
|
||||
- fixed compiler-warnings from Mozilla
|
||||
- added check for simplicity-bits in MHDR
|
||||
- added workaround for faulty PhotoShop iCCP chunk
|
||||
- fixed app-supplied background restore
|
||||
- fixed TERM processing delay of 0 msecs
|
||||
- fixed write-code for zTXt & iTXt
|
||||
- fixed read-code for iTXt
|
||||
- added MAGN chunk
|
||||
- fixed sRGB precedence for gamma_only corection
|
||||
- added support for new filter_types
|
||||
- fixed problem with no refresh after TERM
|
||||
- fixed DEFI behavior
|
||||
- fixed inclusion parameters to make the external libs work together
|
||||
- added export of zlib functions from windows dll
|
||||
- fixed timing & refresh behavior for single PNG/JNG
|
||||
- removed trace-options from default SO/DLL builds (!!!)
|
||||
- fixed MAGN rounding errors (thanks Matthias!)
|
||||
- fixed small timing problem when FRAM delay = 0
|
||||
- fixed simplicity-check in compliance with draft 81/0.98a
|
||||
- fixed alpha-blending for all alpha-canvasstyles
|
||||
- added support for alpha-depth prediction
|
||||
- fixed processing of unknown critical chunks
|
||||
- removed test-MaGN
|
||||
- added PNG/MNG spec version indicators
|
||||
- implemented support for nEED
|
||||
- added support for JDAA
|
||||
- added functions to retrieve PNG/JNG specific header-info
|
||||
- added optional support for bKGD for PNG images
|
||||
- raised initial maximum canvas size to 10000x10000
|
||||
- added support for delta-JNG
|
||||
- added callback to process non-critical unknown chunks
|
||||
- fixed support for delta-images during read() / display()
|
||||
- added closestream() processing for mng_cleanup()
|
||||
- fixed delta-processing behavior
|
||||
- added storage for pixel-/alpha-sampledepth for delta's
|
||||
- implemented delayed delta-processing
|
||||
- fixed putchunk_plte() to set bEmpty parameter (thanks Ben!)
|
||||
- added errorcode for delayed delta-processing
|
||||
- added get/set for bKGD preference setting
|
||||
- added get function for interlace/progressive display
|
||||
- fixed bug in empty PLTE handling
|
||||
- fixed seperate read() & display() processing
|
||||
- fixed tRNS processing for gray-image < 8-bits
|
||||
|
||||
samples:
|
||||
- added BCB mngview contribution by Andy Protano
|
||||
|
||||
contrib:
|
||||
- added BCB mngdump; a GUI-based MNG dumping utility (Andy Protano)
|
||||
|
||||
doc:
|
||||
- updated RPM spec-file by MATSUURA Takanori
|
||||
- updated README.contrib
|
||||
|
||||
makefiles:
|
||||
- fixed some stuff in automake/autoconf/libtool
|
||||
- fixed auto* for bug B117103
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
0.9.2 (August 7th 2000)
|
||||
-----------------------
|
||||
|
||||
in short:
|
||||
|
||||
Third beta release! Last one???
|
||||
|
||||
!!IMPORTANT!! All file-names are now prefixed with "libmng_" !!IMPORTANT!!
|
||||
|
||||
Many thanks to Albert Chin-A-Young for his contribution of the
|
||||
autoconf/automake/libtool stuff and to Ralph Giles for helping me
|
||||
put it in the right places.
|
||||
|
||||
There's a special README.autoconf so please read it!
|
||||
|
||||
- fixed bug 110320/110546/110547/111096
|
||||
- added several status retrieval functions
|
||||
- fixed other small bugs in display processing
|
||||
- fixed number of small problems and documentation typos
|
||||
- added autoconf/automake/libtool
|
||||
- added latest MNG plugin (0.9.0) by Jason Summers
|
||||
|
||||
-------------------
|
||||
|
||||
bugfixes:
|
||||
B110320 - fixed GCC warning about mix-sized pointer math
|
||||
B110546 - fixed for improperly returning UNEXPECTEDEOF
|
||||
B110547 - fixed bug in interlace code
|
||||
B111096 - fixed large-buffer read-suspension
|
||||
|
||||
core:
|
||||
- version numbers
|
||||
- fixed small bugs in display processing
|
||||
- removed Nextbackxxx fields (no longer used)
|
||||
- fixed problem with trace-functions improperly wrapped
|
||||
- put specific code in add_chunk() inside MNG_SUPPORT_WRITE wrapper
|
||||
- fixed documentation typos
|
||||
- fixed wrapping of suspension parameters
|
||||
- added status_xxxx functions
|
||||
- added trace-codes/-strings for status_xxxxx functions
|
||||
- changed file-prefixes
|
||||
- added function to set simplicity field
|
||||
- added trace-code/-string for updatemngsimplicity
|
||||
- fixed putchunk_unknown() function
|
||||
|
||||
samples:
|
||||
|
||||
contrib:
|
||||
- added latest MNG plugin (0.9.0) by Jason Summers
|
||||
|
||||
doc:
|
||||
- version numbers
|
||||
- added autoconf readme
|
||||
- version numbers in RPM stuff
|
||||
|
||||
makefiles:
|
||||
- fixed for new file-prefix
|
||||
- added autoconf/automake/libtool
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
0.9.1 (July 26th 2000)
|
||||
----------------------
|
||||
|
||||
in short:
|
||||
|
||||
Second beta release.
|
||||
|
||||
Given the enormous amount of bug-reports (not ;-), this will most likely
|
||||
be one of the last betas. If things remain upright, the first public release
|
||||
(1.0.0) is fairly eminent in the weeks to come...
|
||||
|
||||
- added SDL mng player by Ralph Giles to contributions
|
||||
- fixed timing and added internal buffering for I/O-suspension scenarios
|
||||
- added get routines for internal display-state variables (frame/layer/playtime)
|
||||
- changed read-processing for improved I/O-suspension (internal buffering)
|
||||
- fixed several problems with create- & write-support
|
||||
- added a load of documentation
|
||||
- lots of small stuff
|
||||
|
||||
-------------------
|
||||
|
||||
bugfixes:
|
||||
|
||||
core:
|
||||
- fixed mandatory BACK color to be opaque
|
||||
- changed mng_display_resume to allow to be called after a suspension
|
||||
return with MNG_NEEDMOREDATA
|
||||
- changed comments to indicate modified behavior for timer & suspension breaks
|
||||
- added variables for go_xxxx processing
|
||||
- implemented support for freeze/reset/resume & go_xxxx
|
||||
- added trace-codes/-strings for special display processing
|
||||
- added variables for improved timing support
|
||||
- added support for improved timing
|
||||
- added get routines for internal display variables
|
||||
- added get/set routines for suspensionmode variable
|
||||
- added trace-code/-string for get/set suspensionmode
|
||||
- added trace-codes/-strings for get/set display variables
|
||||
- added support for improved I/O-suspension
|
||||
- changed read-processing for improved I/O-suspension
|
||||
- added trace-code/-string for read_databuffer (I/O-suspension)
|
||||
- added suspendbuffer constants
|
||||
- changed EOF processing behavior
|
||||
- fixed TERM delay processing
|
||||
- changed pre-draft48 frame_mode=3 to frame_mode=1
|
||||
- added callbacks for SAVE/SEEK processing
|
||||
- added trace-codes/-strings for SAVE/SEEK callbacks
|
||||
- added variable for NEEDSECTIONWAIT breaks
|
||||
- added trace-codes/-strings for get/set sectionbreaks
|
||||
- added NEEDSECTIONWAIT error-code/-string
|
||||
- added macro + routine to set returncode without calling error callback
|
||||
- added trace-code/-string for special error routine
|
||||
- changed default readbuffer size from 1024 to 4200
|
||||
- added variable for freeze & reset processing
|
||||
- fixed storage of images during mng_read()
|
||||
- fixed support for mng_display() after mng_read()
|
||||
- added error cleanup processing
|
||||
- fixed support for mng_display_reset()
|
||||
- fixed suspension-buffering for 32K+ chunks
|
||||
- added function to set frame-/layer-count & playtime
|
||||
- added trace-code/-string for updatemngheader
|
||||
- added error-code/-string for updatemngheader if not a MNG
|
||||
- fixed creation-code
|
||||
- fixed writing of signature
|
||||
- fixed several chunk-writing routines
|
||||
|
||||
samples:
|
||||
- fixed the libmng.pas module in line with libmng.h
|
||||
|
||||
contrib:
|
||||
- added the SDL based mngplay viewer by Ralph Giles
|
||||
|
||||
doc:
|
||||
- extended the RPM contribution by MATSUURA Takanori
|
||||
- added libmng.txt, a full description of the library and its usage
|
||||
- added man-pages for mng(5), jng(5) and libmng(3)
|
||||
|
||||
makefiles:
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
0.9.0 (June 30th 2000)
|
||||
----------------------
|
||||
|
||||
in short:
|
||||
|
||||
This is the first beta!!! Yippee!!!
|
||||
|
||||
Thanks to all the people who helped to guide me in the right direction.
|
||||
You know who you are!
|
||||
|
||||
A special thanks to the guys with early implementations, who stood by and
|
||||
put up with my whims :-)
|
||||
|
||||
changes over 0.5.3:
|
||||
|
||||
- updated mngplg to 0.4.1 (the latest & greatest)
|
||||
- changed refresh parameters to 'x,y,width,height'
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
0.5.3 (never released)
|
||||
----------------------
|
||||
|
||||
in short:
|
||||
|
||||
This is a working version only; the next release will be 0.9.0 (first Beta!)
|
||||
|
||||
There are a few incompatible changes with previous versions. The userdata
|
||||
variable has been changed from mng_uint32 to mng_ptr to accomodate 64-bit
|
||||
systems. For the same reason memory allocation size parameters have been
|
||||
changed to a mng_size_t type which is a typedef of size_t.
|
||||
|
||||
Thanks to Aleks Jakulin for helping to iron out some 64-bit platform issues!
|
||||
|
||||
- implemented the update-region parameters of the refresh callback
|
||||
- added support for most common delta-image options
|
||||
- added an animation-speed modifier
|
||||
- added an image-level parameter for the processtext callback
|
||||
- updated mngplg to 0.4.0 (supports JNG, full CMS, and other enhancements!)
|
||||
- fixed a lot of small things
|
||||
- added support for PPLT chunk
|
||||
- fixed to support 64-bit platforms
|
||||
|
||||
-------------------
|
||||
|
||||
bugfixes:
|
||||
|
||||
core:
|
||||
- added processing of color-info on delta-image
|
||||
- fixed handling of empty SAVE chunk
|
||||
- fixed display of stored JNG images
|
||||
- fixed problem with BASI-IEND as object 0
|
||||
- changed the version parameters (obviously)
|
||||
- added update-region parms for refresh calback
|
||||
- added Needrefresh parameter
|
||||
- added initialization of update-region for refresh
|
||||
- added initialization of Needrefresh parameter
|
||||
- changed progressive-display processing
|
||||
- added tracecodes for tracing JPEG progression
|
||||
- added tracing of JPEG calls
|
||||
- added Deltaimmediate parm for faster delta-processing
|
||||
- added extra checks for delta-images
|
||||
- many changes to support delta-images
|
||||
- optimized some store_xxx routines
|
||||
- fixed some small things (as precaution)
|
||||
- fixed possible trouble if IEND display-processing got broken up
|
||||
- fixed nasty bug with embedded PNG after delta-image
|
||||
- added processing of PLTE & tRNS for delta-images
|
||||
- added processing of PLTE/tRNS & color-info for delta-images in the
|
||||
ani_objects chain
|
||||
- fixed problem with color-correction for stored images
|
||||
- added get/set for speedtype to facilitate testing
|
||||
- added trace-codes & -strings for get/set speedtype
|
||||
- added speed-modifier to timing routine
|
||||
- added get-routine of imagelevel for processtext callback
|
||||
- added trace-code & -string for get imagelevel
|
||||
- added administration of imagelevel parameter
|
||||
- added support for PPLT chunk
|
||||
- added trace-codes & -strings for PPLT chunk processing
|
||||
- fixed problem with incorrect gamma-correction
|
||||
- fixed inclusion of IJG read/write code
|
||||
- fixed problem with 16-bit GA format
|
||||
- fixed problem with cheap transparency for 4-bit gray
|
||||
- fixed display_xxxx routines for interlaced images
|
||||
- added precaution against faulty iCCP chunks from PS
|
||||
- changed userdata variable to mng_ptr
|
||||
- added typedef for mng_size_t
|
||||
- changed size parameter for memory allocation to mng_size_t
|
||||
- fixed compiler-warning for non-initialized iB variable
|
||||
- changed definition for 32-bit ints (64-bit platforms)
|
||||
- changed definition for mng_handle (64-bit platforms)
|
||||
- swapped refresh parameters
|
||||
- fixed initialization routine for new mng_handle type
|
||||
- added inclusion of stdlib.h for abs()
|
||||
- fixed some 64-bit warnings
|
||||
- fixed incompatible return-types
|
||||
|
||||
samples:
|
||||
|
||||
contrib:
|
||||
- updated mngplg to 0.3.0 (supports JNG & full color-correction!)
|
||||
- updated mngplg to 0.4.0 (Jason is picking up the pace ;-)
|
||||
|
||||
doc:
|
||||
- added rpm directory with rpm spec-file (contributed by MATSUURA Takanori)
|
||||
|
||||
makefiles:
|
||||
- changed makefile.linux to reflect versionnr for shared-lib
|
||||
- changed makefile.linux to depend on mng_conf.h & mng_types.h
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
0.5.2 (June 10th 2000)
|
||||
----------------------
|
||||
|
||||
in short:
|
||||
|
||||
This is the third release for developers
|
||||
Another milestone since JNG is now fully supported
|
||||
The next release will most likely be numbered 0.9.0 as the first Beta!!
|
||||
|
||||
Fixed bug 106017 & 106019
|
||||
Added many constants regarding chunk-property values
|
||||
Implemented full JNG support
|
||||
Added all the error- & trace-strings
|
||||
Added get/set routines for default ZLIB/IJG parameters
|
||||
Added a generic makefile for Unix platforms (contributed by Tim Rowley)
|
||||
Added canvasstyle for separate RGB + A canvas (eg. mozilla-style)
|
||||
Separated configuration-options into a separate file: "mng_conf.h"
|
||||
Fixed stuff for generic Unix compilation (contributed by Tim Rowley)
|
||||
Upgraded to lcms1.0.6 (now supports 16-bit endian-peculiarities)
|
||||
Added a makefile for Linux ELF & fixed some code-issues to go along with gcc
|
||||
Added support for suspended input-buffer processing
|
||||
Implemented the display-routines for RGBA/ARGB/BGRA/ABGR canvasstyles
|
||||
Implemented the application background-restore functionality
|
||||
Fixed & tested the mngtree Unix-sample (runs on Linux-RH6.2 with libmng.so)
|
||||
Upgraded mngplg to v0.2.2 (based on the latest code including JNG)
|
||||
Fixed a lot of other assorted stuff
|
||||
|
||||
-------------------
|
||||
|
||||
bugfixes:
|
||||
B003(106017) - fixed problem with <mem.h> being proprietary to BCB
|
||||
B004(106019) - fixed problem when MNG_SUPPORT_WRITE not defined
|
||||
|
||||
core:
|
||||
- bumped version-numbers up to 0.5.2 (yeah, really)
|
||||
- fixed support for IJGSRC6B
|
||||
- cleaned up some code regarding mixed support-options
|
||||
- complemented constants for chunk-property values
|
||||
- fixed MNG_UINT_pHYg value
|
||||
- implemented JNG support
|
||||
- fixed problem with DEFI clipping
|
||||
- added error telltale strings & support
|
||||
- added trace telltale strings & support
|
||||
- added support for global color-chunks inside TERM/LOOP
|
||||
- added support for global PLTE,tRNS,bKGD inside TERM/LOOP
|
||||
- added default IJG compression parameters and such
|
||||
- moved init of default zlib parms to "mng_hlapi.c"
|
||||
- added init of default IJG parms
|
||||
- added support for get/set of zlib/IJG default parms
|
||||
- added tracestrings for global animation color-chunks
|
||||
- added tracestrings for get/set of default ZLIB/IJG parms
|
||||
- added tracestrings for global PLTE,tRNS,bKGD
|
||||
- added framenr/layernr/playtime to object header
|
||||
- added initialization of framenr/layernr/playtime
|
||||
- changed ani_create calls not returning object pointer
|
||||
- create ani objects always (not just inside TERM/LOOP)
|
||||
- fixed inconsistancy with freeing global iCCP profile
|
||||
- fixed minor bugs 16-bit pixel-handling
|
||||
- added object promotion routine (PROM handling)
|
||||
- added trace-codes & -strings for image-object promotion
|
||||
- added trace-codes & -strings for delta-image processing
|
||||
- added error-codes & -strings for delta-image processing
|
||||
- added support for delta-image processing
|
||||
- added ani-object routines for delta-image processing
|
||||
- added delta-image fields
|
||||
- added compression/filter/interlace fields to object-buffer for
|
||||
delta-image processing
|
||||
- added delta-image row-processing routines
|
||||
- fixed up punctuation in several files (contributed by Tim Rowley)
|
||||
- removed useless definition in "mng_chunks.h" (contributed by Tim Rowley)
|
||||
- fixed pointer confusion in "mng_display.c" (contributed by Tim Rowley)
|
||||
- fixed inclusion for memcpy (contributed by Tim Rowley)
|
||||
- added mng_int32p (contributed by Tim Rowley)
|
||||
- added internal delta-image processing callbacks
|
||||
- separated configuration-options into "mng_conf.h"
|
||||
- changed to most likely configuration
|
||||
- added RGB8_A8 canvasstyle
|
||||
- added getalphaline callback for RGB8_A8 canvasstyle
|
||||
- fixed some makeup for Linux gcc compile
|
||||
- implemented app bkgd restore routines
|
||||
- implemented RGBA8, ARGB8, BGRA8 & ABGR8 display routines
|
||||
- added support for RGB8_A8 canvasstyle
|
||||
- added support for suspended input-buffer processing
|
||||
- added mng_read_resume HLAPI function to support read-suspension
|
||||
- fixed timer-handling to run with Mozilla (Tim Rowley)
|
||||
- fixed alpha-handling for alpha canvasstyles
|
||||
- fixed some compilation-warnings (contrib Jason Morris)
|
||||
|
||||
samples:
|
||||
- fixed mngview(delphi) to work with the new core
|
||||
- synchronized libmng.pas(delphi) with the new libmng.h header
|
||||
- removed the error- & trace-strings from libmng.pas(delphi)
|
||||
- fixed mngtree(Unix) to compile on Linux (runs with libmng.so)
|
||||
- added makefile.linux for mngtree(Unix) (tested on RedHat6.2)
|
||||
|
||||
contrib:
|
||||
- updated mngplg to 0.2.2 (based on latest code; supports JNG!)
|
||||
|
||||
doc:
|
||||
- this file obviously
|
||||
- added Tim Rowley as contributing author
|
||||
- changed the examples.readme doc
|
||||
- updated the design-schematics in line with the current code
|
||||
|
||||
makefiles:
|
||||
- changed the directory to "makefiles" to avoid name-conflicts
|
||||
- added generic Unix makefile (thanks to Tim Rowley)
|
||||
- added Linux ELF makefile (tested on RedHat6.2)
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
0.5.1 May 16th 2000
|
||||
-------------------
|
||||
|
||||
in short:
|
||||
|
||||
This is the second release for developers
|
||||
It's a bit of a milestone since all the chunk functionality is in place and
|
||||
functioning (read, examine, create & write)
|
||||
This version is incompatible with 0.5.0 since some of the callback prototypes
|
||||
have changed (should be the last time that happens!)
|
||||
There are a few more samples and even a real contribution!
|
||||
|
||||
Fixed bug 105795 & 105797
|
||||
Fixed a mis-alignment in animation-timing
|
||||
Added chunk-access functions
|
||||
Finished all chunk-storage routine-bits
|
||||
Finished all chunk-write routines
|
||||
Changed the callback prototypes to allow error-reporting back to the library
|
||||
Fixed some routines to allow for callback error-reporting
|
||||
Added version-control functions & constants
|
||||
Added two functions to set display- & sRGB-profile from memory
|
||||
Moved CRC table to dynamic structure (for improved thread-safety)
|
||||
Added SAVE & SEEK save&restore functionality
|
||||
Finished the application-based CMS-callbacks
|
||||
Fixed a few BCB specifics
|
||||
Changed the Win32 DLL and samples to use __stdcall
|
||||
Did some more assorted little changes
|
||||
Added 2 BCB samples
|
||||
Added 1 Unix sample
|
||||
Added the MNG plugin by Jason Summers in the contrib section
|
||||
Changed some documents to reflect these changes
|
||||
|
||||
-------------------
|
||||
|
||||
bugfixes:
|
||||
B001(105795) - fixed wrong lcms call & memory-leak for gammatables
|
||||
B002(105797) - fixed problem with missing sRGB profile
|
||||
|
||||
core:
|
||||
- changed chunk iteration function
|
||||
- added chunk access functions
|
||||
- added version control constants & functions
|
||||
- changed strict-ANSI stuff
|
||||
- added set_outputprofile2 & set_srgbprofile2
|
||||
- added empty-chunk put-routines
|
||||
- added version_dll & VERSION_DLL (for consistency)
|
||||
- added version control explanatory text & samples
|
||||
- added iteratechunk callback definition
|
||||
- improved definitions for DLL support
|
||||
- added 8-bit palette definition
|
||||
- added general array definitions
|
||||
- added MNG_NULL definition
|
||||
- changed most callback prototypes to allow the app
|
||||
to report errors during callback processing
|
||||
- added CRC table to main structure (for thread-safety)
|
||||
- added iPLTEentries for checking hIST-length
|
||||
- changed palette definition to exported palette-type
|
||||
- removed frozen indicator
|
||||
- added create/write indicators
|
||||
- added eMNGma hack (will be removed in 1.0.0 !!!)
|
||||
- added TERM animation object pointer (easier reference)
|
||||
- added saved-data structure for SAVE/SEEK processing
|
||||
- added some errorcodes
|
||||
- added application errorcodes (used with callbacks)
|
||||
- moved chunk-access errorcodes to severity 5
|
||||
- added chunk-access function trace-codes
|
||||
- changed trace to macro for callback error-reporting
|
||||
- added save_state & restore_state trace-codes
|
||||
- put in some extra comments
|
||||
- fixed layout for sBIT, PPLT
|
||||
- changed write callback definition
|
||||
- fixed layout for PPLT again (missed deltatype ?!?)
|
||||
- cleaned up left-over teststuff in the BACK chunk routine
|
||||
- changed CRC initialization to use dynamic structure
|
||||
(wasn't thread-safe the old way !)
|
||||
- filled in many missing sequence&length checks
|
||||
- filled in many missing chunk-store snippets
|
||||
- added checks for running animations
|
||||
- filled remaining write routines
|
||||
- fixed read_pplt with regard to deltatype
|
||||
- added callback error-reporting support
|
||||
- added pre-draft48 support (short MHDR, frame_mode, LOOP)
|
||||
- fixed chunk-storage bit in several routines
|
||||
- supplemented the SAVE & SEEK display processing
|
||||
- added init of iPLTEcount
|
||||
- changed calling-convention definition
|
||||
- changed status-handling of display-routines
|
||||
- added versioning-control routines
|
||||
- filled the write routine
|
||||
- fixed frame_delay misalignment
|
||||
- added sanity check for frozen status
|
||||
- changed display_mend to reset state to initial or SAVE
|
||||
- added save_state and restore_state for SAVE/SEEK/TERM
|
||||
processing
|
||||
- added process_save & process_seek routines
|
||||
- changed and filled iterate-chunk function
|
||||
- added getchunk functions
|
||||
- added putchunk functions
|
||||
- added empty-chunk put-routines
|
||||
- filled application-based color-management routines
|
||||
- added creatememprofile
|
||||
- filled the deflatedata routine
|
||||
- added cleanup of saved-data (SAVE/SEEK processing)
|
||||
- moved the actual write_graphic functionality from mng_hlapi.c
|
||||
to it's appropriate function in the mng_write.c module
|
||||
- moved standard header includes into mng_types.h
|
||||
(stdlib/mem for mem-mngmt & math for fp gamma-calc)
|
||||
- added getimgdata & putimgdata functions
|
||||
|
||||
samples:
|
||||
- fixed mngview(delphi) to work with the new core
|
||||
- synchronized libmng.pas(delphi) with the new libmng.h header
|
||||
- added mngtree(bcb) sample
|
||||
- added bogus(bcb) sample
|
||||
- added mngtree(unix) sample
|
||||
|
||||
contrib:
|
||||
- added mngplg 0.1.0 / a MNG plugin for Win32 by Jason Summers
|
||||
|
||||
doc:
|
||||
- added this changes.readme file
|
||||
- changed the samples.readme doc accordingly
|
||||
- changed the contrib.readme doc accordingly
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
0.5.0 May 1st 2000
|
||||
------------------
|
||||
|
||||
in short:
|
||||
|
||||
This is the first developers release.
|
||||
It's roughly about 60% done.
|
||||
@@ -1,56 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * COPYRIGHT NOTICE: * */
|
||||
/* * * */
|
||||
/* * Copyright (c) 2000 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 * */
|
||||
/* * * */
|
||||
/* * 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) * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
@@ -1,7 +0,0 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist directory
|
||||
#
|
||||
|
||||
libmng.h
|
||||
libmng_conf.h
|
||||
libmng_types.h
|
||||
@@ -1,69 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = mng
|
||||
LIBRARY_NAME = mozmng
|
||||
EXPORT_LIBRARY = 1
|
||||
|
||||
REQUIRES = jpeg
|
||||
|
||||
CSRCS = \
|
||||
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 \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = libmng.h libmng_conf.h libmng_types.h
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
LOCAL_INCLUDES = -I$(srcdir)
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
|
||||
EXTRA_DSO_LDOPTS = $(JPEG_LIBS) $(ZLIB_LIBS)
|
||||
else
|
||||
FORCE_STATIC_LIB = 1
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
libmng 1.0.1
|
||||
------------
|
||||
|
||||
First maintenance release!
|
||||
|
||||
There's been some changes in the CMS profile handling, that should make it
|
||||
easier for sRGB-compliant systems. Non-sRGB compliant systems will still need
|
||||
some extra work if they want to use MNG_FULL_CMS with lcms. But this has always
|
||||
been so, so it's not an extra step anyway.
|
||||
(Many thanks to Marti, Ivan & Warwick for their help & comments!)
|
||||
|
||||
Gregg Kelly has been helpful in locating a couple of memory-leaks, and make
|
||||
the library even better.
|
||||
|
||||
The default Windows DLL that's part of the Windows zip-files now also exports
|
||||
the JPEG library function calls (ijgsrc6b). Note that there's a new Delphi
|
||||
component (TNGImage) that makes it a snap to work with PNG/JNG & MNG images
|
||||
within Delphi.
|
||||
|
||||
Please enjoy!
|
||||
|
||||
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
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,295 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_chunk_io.h copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : Chunk I/O routines (definition) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * comment : Definition of the chunk input/output routines * */
|
||||
/* * * */
|
||||
/* * changes : 0.5.1 - 05/04/2000 - G.Juyn * */
|
||||
/* * - changed CRC initializtion to use dynamic structure * */
|
||||
/* * (wasn't thread-safe the old way !) * */
|
||||
/* * 0.5.1 - 05/08/2000 - G.Juyn * */
|
||||
/* * - changed write routines definition * */
|
||||
/* * - changed strict-ANSI stuff * */
|
||||
/* * * */
|
||||
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
|
||||
/* * - changed file-prefixes * */
|
||||
/* * * */
|
||||
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
|
||||
/* * - added MAGN chunk * */
|
||||
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
|
||||
/* * - added support for JDAA * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* force ANSI-C */
|
||||
#endif
|
||||
|
||||
#ifndef _libmng_chunk_io_h_
|
||||
#define _libmng_chunk_io_h_
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_uint32 crc (mng_datap pData,
|
||||
mng_uint8p buf,
|
||||
mng_int32 len);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifdef MNG_INCLUDE_READ_PROCS
|
||||
|
||||
#define READ_CHUNK(n) mng_retcode n (mng_datap pData, \
|
||||
mng_chunkp pHeader, \
|
||||
mng_uint32 iRawlen, \
|
||||
mng_uint8p pRawdata, \
|
||||
mng_chunkp* ppChunk)
|
||||
|
||||
READ_CHUNK (read_ihdr) ;
|
||||
READ_CHUNK (read_plte) ;
|
||||
READ_CHUNK (read_idat) ;
|
||||
READ_CHUNK (read_iend) ;
|
||||
READ_CHUNK (read_trns) ;
|
||||
READ_CHUNK (read_gama) ;
|
||||
READ_CHUNK (read_chrm) ;
|
||||
READ_CHUNK (read_srgb) ;
|
||||
READ_CHUNK (read_iccp) ;
|
||||
READ_CHUNK (read_text) ;
|
||||
READ_CHUNK (read_ztxt) ;
|
||||
READ_CHUNK (read_itxt) ;
|
||||
READ_CHUNK (read_bkgd) ;
|
||||
READ_CHUNK (read_phys) ;
|
||||
READ_CHUNK (read_sbit) ;
|
||||
READ_CHUNK (read_splt) ;
|
||||
READ_CHUNK (read_hist) ;
|
||||
READ_CHUNK (read_time) ;
|
||||
READ_CHUNK (read_mhdr) ;
|
||||
READ_CHUNK (read_mend) ;
|
||||
READ_CHUNK (read_loop) ;
|
||||
READ_CHUNK (read_endl) ;
|
||||
READ_CHUNK (read_defi) ;
|
||||
READ_CHUNK (read_basi) ;
|
||||
READ_CHUNK (read_clon) ;
|
||||
READ_CHUNK (read_past) ;
|
||||
READ_CHUNK (read_disc) ;
|
||||
READ_CHUNK (read_back) ;
|
||||
READ_CHUNK (read_fram) ;
|
||||
READ_CHUNK (read_move) ;
|
||||
READ_CHUNK (read_clip) ;
|
||||
READ_CHUNK (read_show) ;
|
||||
READ_CHUNK (read_term) ;
|
||||
READ_CHUNK (read_save) ;
|
||||
READ_CHUNK (read_seek) ;
|
||||
READ_CHUNK (read_expi) ;
|
||||
READ_CHUNK (read_fpri) ;
|
||||
READ_CHUNK (read_phyg) ;
|
||||
READ_CHUNK (read_jhdr) ;
|
||||
READ_CHUNK (read_jdaa) ;
|
||||
READ_CHUNK (read_jdat) ;
|
||||
READ_CHUNK (read_jsep) ;
|
||||
READ_CHUNK (read_dhdr) ;
|
||||
READ_CHUNK (read_prom) ;
|
||||
READ_CHUNK (read_ipng) ;
|
||||
READ_CHUNK (read_pplt) ;
|
||||
READ_CHUNK (read_ijng) ;
|
||||
READ_CHUNK (read_drop) ;
|
||||
READ_CHUNK (read_dbyk) ;
|
||||
READ_CHUNK (read_ordr) ;
|
||||
READ_CHUNK (read_magn) ;
|
||||
READ_CHUNK (read_need) ;
|
||||
READ_CHUNK (read_unknown) ;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#else /* MNG_INCLUDE_READ_PROCS */
|
||||
#define read_ihdr 0
|
||||
#define read_plte 0
|
||||
#define read_idat 0
|
||||
#define read_iend 0
|
||||
#define read_trns 0
|
||||
#define read_gama 0
|
||||
#define read_chrm 0
|
||||
#define read_srgb 0
|
||||
#define read_iccp 0
|
||||
#define read_text 0
|
||||
#define read_ztxt 0
|
||||
#define read_itxt 0
|
||||
#define read_bkgd 0
|
||||
#define read_phys 0
|
||||
#define read_sbit 0
|
||||
#define read_splt 0
|
||||
#define read_hist 0
|
||||
#define read_time 0
|
||||
#define read_mhdr 0
|
||||
#define read_mend 0
|
||||
#define read_loop 0
|
||||
#define read_endl 0
|
||||
#define read_defi 0
|
||||
#define read_basi 0
|
||||
#define read_clon 0
|
||||
#define read_past 0
|
||||
#define read_disc 0
|
||||
#define read_back 0
|
||||
#define read_fram 0
|
||||
#define read_move 0
|
||||
#define read_clip 0
|
||||
#define read_show 0
|
||||
#define read_term 0
|
||||
#define read_save 0
|
||||
#define read_seek 0
|
||||
#define read_expi 0
|
||||
#define read_fpri 0
|
||||
#define read_phyg 0
|
||||
#define read_jhdr 0
|
||||
#define read_jdaa 0
|
||||
#define read_jdat 0
|
||||
#define read_jsep 0
|
||||
#define read_dhdr 0
|
||||
#define read_prom 0
|
||||
#define read_ipng 0
|
||||
#define read_pplt 0
|
||||
#define read_ijng 0
|
||||
#define read_drop 0
|
||||
#define read_dbyk 0
|
||||
#define read_ordr 0
|
||||
#define read_magn 0
|
||||
#define read_need 0
|
||||
#define read_unknown 0
|
||||
#endif /* MNG_INCLUDE_READ_PROCS */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifdef MNG_INCLUDE_WRITE_PROCS
|
||||
|
||||
#define WRITE_CHUNK(n) mng_retcode n (mng_datap pData, \
|
||||
mng_chunkp pChunk)
|
||||
|
||||
WRITE_CHUNK (write_ihdr) ;
|
||||
WRITE_CHUNK (write_plte) ;
|
||||
WRITE_CHUNK (write_idat) ;
|
||||
WRITE_CHUNK (write_iend) ;
|
||||
WRITE_CHUNK (write_trns) ;
|
||||
WRITE_CHUNK (write_gama) ;
|
||||
WRITE_CHUNK (write_chrm) ;
|
||||
WRITE_CHUNK (write_srgb) ;
|
||||
WRITE_CHUNK (write_iccp) ;
|
||||
WRITE_CHUNK (write_text) ;
|
||||
WRITE_CHUNK (write_ztxt) ;
|
||||
WRITE_CHUNK (write_itxt) ;
|
||||
WRITE_CHUNK (write_bkgd) ;
|
||||
WRITE_CHUNK (write_phys) ;
|
||||
WRITE_CHUNK (write_sbit) ;
|
||||
WRITE_CHUNK (write_splt) ;
|
||||
WRITE_CHUNK (write_hist) ;
|
||||
WRITE_CHUNK (write_time) ;
|
||||
WRITE_CHUNK (write_mhdr) ;
|
||||
WRITE_CHUNK (write_mend) ;
|
||||
WRITE_CHUNK (write_loop) ;
|
||||
WRITE_CHUNK (write_endl) ;
|
||||
WRITE_CHUNK (write_defi) ;
|
||||
WRITE_CHUNK (write_basi) ;
|
||||
WRITE_CHUNK (write_clon) ;
|
||||
WRITE_CHUNK (write_past) ;
|
||||
WRITE_CHUNK (write_disc) ;
|
||||
WRITE_CHUNK (write_back) ;
|
||||
WRITE_CHUNK (write_fram) ;
|
||||
WRITE_CHUNK (write_move) ;
|
||||
WRITE_CHUNK (write_clip) ;
|
||||
WRITE_CHUNK (write_show) ;
|
||||
WRITE_CHUNK (write_term) ;
|
||||
WRITE_CHUNK (write_save) ;
|
||||
WRITE_CHUNK (write_seek) ;
|
||||
WRITE_CHUNK (write_expi) ;
|
||||
WRITE_CHUNK (write_fpri) ;
|
||||
WRITE_CHUNK (write_phyg) ;
|
||||
WRITE_CHUNK (write_jhdr) ;
|
||||
WRITE_CHUNK (write_jdaa) ;
|
||||
WRITE_CHUNK (write_jdat) ;
|
||||
WRITE_CHUNK (write_jsep) ;
|
||||
WRITE_CHUNK (write_dhdr) ;
|
||||
WRITE_CHUNK (write_prom) ;
|
||||
WRITE_CHUNK (write_ipng) ;
|
||||
WRITE_CHUNK (write_pplt) ;
|
||||
WRITE_CHUNK (write_ijng) ;
|
||||
WRITE_CHUNK (write_drop) ;
|
||||
WRITE_CHUNK (write_dbyk) ;
|
||||
WRITE_CHUNK (write_ordr) ;
|
||||
WRITE_CHUNK (write_magn) ;
|
||||
WRITE_CHUNK (write_need) ;
|
||||
WRITE_CHUNK (write_unknown) ;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#else /* MNG_INCLUDE_WRITE_PROCS */
|
||||
#define write_ihdr 0
|
||||
#define write_plte 0
|
||||
#define write_idat 0
|
||||
#define write_iend 0
|
||||
#define write_trns 0
|
||||
#define write_gama 0
|
||||
#define write_chrm 0
|
||||
#define write_srgb 0
|
||||
#define write_iccp 0
|
||||
#define write_text 0
|
||||
#define write_ztxt 0
|
||||
#define write_itxt 0
|
||||
#define write_bkgd 0
|
||||
#define write_phys 0
|
||||
#define write_sbit 0
|
||||
#define write_splt 0
|
||||
#define write_hist 0
|
||||
#define write_time 0
|
||||
#define write_mhdr 0
|
||||
#define write_mend 0
|
||||
#define write_loop 0
|
||||
#define write_endl 0
|
||||
#define write_defi 0
|
||||
#define write_basi 0
|
||||
#define write_clon 0
|
||||
#define write_past 0
|
||||
#define write_disc 0
|
||||
#define write_back 0
|
||||
#define write_fram 0
|
||||
#define write_move 0
|
||||
#define write_clip 0
|
||||
#define write_show 0
|
||||
#define write_term 0
|
||||
#define write_save 0
|
||||
#define write_seek 0
|
||||
#define write_expi 0
|
||||
#define write_fpri 0
|
||||
#define write_phyg 0
|
||||
#define write_jhdr 0
|
||||
#define write_jdaa 0
|
||||
#define write_jdat 0
|
||||
#define write_jsep 0
|
||||
#define write_dhdr 0
|
||||
#define write_prom 0
|
||||
#define write_ipng 0
|
||||
#define write_pplt 0
|
||||
#define write_ijng 0
|
||||
#define write_drop 0
|
||||
#define write_dbyk 0
|
||||
#define write_ordr 0
|
||||
#define write_magn 0
|
||||
#define write_need 0
|
||||
#define write_unknown 0
|
||||
#endif /* MNG_INCLUDE_WRITE_PROCS */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* _libmng_chunk_io_h_ */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,168 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_chunk_prc.h copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : Chunk initialization & cleanup (definition) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * comment : definition of the chunk initialization & cleanup 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 * */
|
||||
/* * * */
|
||||
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
|
||||
/* * - added MAGN chunk * */
|
||||
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
|
||||
/* * - added support for JDAA * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* force ANSI-C */
|
||||
#endif
|
||||
|
||||
#ifndef _libmng_chunk_prc_h_
|
||||
#define _libmng_chunk_prc_h_
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
void add_chunk (mng_datap pData,
|
||||
mng_chunkp pChunk);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#define INIT_CHUNK_HDR(n) mng_retcode n (mng_datap pData, \
|
||||
mng_chunkp pHeader, \
|
||||
mng_chunkp* ppChunk)
|
||||
|
||||
INIT_CHUNK_HDR (init_ihdr) ;
|
||||
INIT_CHUNK_HDR (init_plte) ;
|
||||
INIT_CHUNK_HDR (init_idat) ;
|
||||
INIT_CHUNK_HDR (init_iend) ;
|
||||
INIT_CHUNK_HDR (init_trns) ;
|
||||
INIT_CHUNK_HDR (init_gama) ;
|
||||
INIT_CHUNK_HDR (init_chrm) ;
|
||||
INIT_CHUNK_HDR (init_srgb) ;
|
||||
INIT_CHUNK_HDR (init_iccp) ;
|
||||
INIT_CHUNK_HDR (init_text) ;
|
||||
INIT_CHUNK_HDR (init_ztxt) ;
|
||||
INIT_CHUNK_HDR (init_itxt) ;
|
||||
INIT_CHUNK_HDR (init_bkgd) ;
|
||||
INIT_CHUNK_HDR (init_phys) ;
|
||||
INIT_CHUNK_HDR (init_sbit) ;
|
||||
INIT_CHUNK_HDR (init_splt) ;
|
||||
INIT_CHUNK_HDR (init_hist) ;
|
||||
INIT_CHUNK_HDR (init_time) ;
|
||||
INIT_CHUNK_HDR (init_mhdr) ;
|
||||
INIT_CHUNK_HDR (init_mend) ;
|
||||
INIT_CHUNK_HDR (init_loop) ;
|
||||
INIT_CHUNK_HDR (init_endl) ;
|
||||
INIT_CHUNK_HDR (init_defi) ;
|
||||
INIT_CHUNK_HDR (init_basi) ;
|
||||
INIT_CHUNK_HDR (init_clon) ;
|
||||
INIT_CHUNK_HDR (init_past) ;
|
||||
INIT_CHUNK_HDR (init_disc) ;
|
||||
INIT_CHUNK_HDR (init_back) ;
|
||||
INIT_CHUNK_HDR (init_fram) ;
|
||||
INIT_CHUNK_HDR (init_move) ;
|
||||
INIT_CHUNK_HDR (init_clip) ;
|
||||
INIT_CHUNK_HDR (init_show) ;
|
||||
INIT_CHUNK_HDR (init_term) ;
|
||||
INIT_CHUNK_HDR (init_save) ;
|
||||
INIT_CHUNK_HDR (init_seek) ;
|
||||
INIT_CHUNK_HDR (init_expi) ;
|
||||
INIT_CHUNK_HDR (init_fpri) ;
|
||||
INIT_CHUNK_HDR (init_need) ;
|
||||
INIT_CHUNK_HDR (init_phyg) ;
|
||||
INIT_CHUNK_HDR (init_jhdr) ;
|
||||
INIT_CHUNK_HDR (init_jdaa) ;
|
||||
INIT_CHUNK_HDR (init_jdat) ;
|
||||
INIT_CHUNK_HDR (init_jsep) ;
|
||||
INIT_CHUNK_HDR (init_dhdr) ;
|
||||
INIT_CHUNK_HDR (init_prom) ;
|
||||
INIT_CHUNK_HDR (init_ipng) ;
|
||||
INIT_CHUNK_HDR (init_pplt) ;
|
||||
INIT_CHUNK_HDR (init_ijng) ;
|
||||
INIT_CHUNK_HDR (init_drop) ;
|
||||
INIT_CHUNK_HDR (init_dbyk) ;
|
||||
INIT_CHUNK_HDR (init_ordr) ;
|
||||
INIT_CHUNK_HDR (init_magn) ;
|
||||
INIT_CHUNK_HDR (init_unknown) ;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#define FREE_CHUNK_HDR(n) mng_retcode n (mng_datap pData, \
|
||||
mng_chunkp pHeader)
|
||||
|
||||
FREE_CHUNK_HDR (free_ihdr) ;
|
||||
FREE_CHUNK_HDR (free_plte) ;
|
||||
FREE_CHUNK_HDR (free_idat) ;
|
||||
FREE_CHUNK_HDR (free_iend) ;
|
||||
FREE_CHUNK_HDR (free_trns) ;
|
||||
FREE_CHUNK_HDR (free_gama) ;
|
||||
FREE_CHUNK_HDR (free_chrm) ;
|
||||
FREE_CHUNK_HDR (free_srgb) ;
|
||||
FREE_CHUNK_HDR (free_iccp) ;
|
||||
FREE_CHUNK_HDR (free_text) ;
|
||||
FREE_CHUNK_HDR (free_ztxt) ;
|
||||
FREE_CHUNK_HDR (free_itxt) ;
|
||||
FREE_CHUNK_HDR (free_bkgd) ;
|
||||
FREE_CHUNK_HDR (free_phys) ;
|
||||
FREE_CHUNK_HDR (free_sbit) ;
|
||||
FREE_CHUNK_HDR (free_splt) ;
|
||||
FREE_CHUNK_HDR (free_hist) ;
|
||||
FREE_CHUNK_HDR (free_time) ;
|
||||
FREE_CHUNK_HDR (free_mhdr) ;
|
||||
FREE_CHUNK_HDR (free_mend) ;
|
||||
FREE_CHUNK_HDR (free_loop) ;
|
||||
FREE_CHUNK_HDR (free_endl) ;
|
||||
FREE_CHUNK_HDR (free_defi) ;
|
||||
FREE_CHUNK_HDR (free_basi) ;
|
||||
FREE_CHUNK_HDR (free_clon) ;
|
||||
FREE_CHUNK_HDR (free_past) ;
|
||||
FREE_CHUNK_HDR (free_disc) ;
|
||||
FREE_CHUNK_HDR (free_back) ;
|
||||
FREE_CHUNK_HDR (free_fram) ;
|
||||
FREE_CHUNK_HDR (free_move) ;
|
||||
FREE_CHUNK_HDR (free_clip) ;
|
||||
FREE_CHUNK_HDR (free_show) ;
|
||||
FREE_CHUNK_HDR (free_term) ;
|
||||
FREE_CHUNK_HDR (free_save) ;
|
||||
FREE_CHUNK_HDR (free_seek) ;
|
||||
FREE_CHUNK_HDR (free_expi) ;
|
||||
FREE_CHUNK_HDR (free_fpri) ;
|
||||
FREE_CHUNK_HDR (free_need) ;
|
||||
FREE_CHUNK_HDR (free_phyg) ;
|
||||
FREE_CHUNK_HDR (free_jhdr) ;
|
||||
FREE_CHUNK_HDR (free_jdaa) ;
|
||||
FREE_CHUNK_HDR (free_jdat) ;
|
||||
FREE_CHUNK_HDR (free_jsep) ;
|
||||
FREE_CHUNK_HDR (free_dhdr) ;
|
||||
FREE_CHUNK_HDR (free_prom) ;
|
||||
FREE_CHUNK_HDR (free_ipng) ;
|
||||
FREE_CHUNK_HDR (free_pplt) ;
|
||||
FREE_CHUNK_HDR (free_ijng) ;
|
||||
FREE_CHUNK_HDR (free_drop) ;
|
||||
FREE_CHUNK_HDR (free_dbyk) ;
|
||||
FREE_CHUNK_HDR (free_ordr) ;
|
||||
FREE_CHUNK_HDR (free_magn) ;
|
||||
FREE_CHUNK_HDR (free_unknown) ;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* _libmng_chunk_prc_h_ */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,759 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_chunks.h copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : Chunk structures (definition) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * 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 * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#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
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
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 struct { /* generic header */
|
||||
mng_chunkid iChunkname;
|
||||
mng_createchunk fCreate;
|
||||
mng_cleanupchunk fCleanup;
|
||||
mng_readchunk fRead;
|
||||
mng_writechunk fWrite;
|
||||
mng_chunkp pNext; /* for double-linked list */
|
||||
mng_chunkp pPrev;
|
||||
} 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;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
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;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* sRGB */
|
||||
mng_chunk_header sHeader;
|
||||
mng_bool bEmpty;
|
||||
mng_uint8 iRenderingintent;
|
||||
} mng_srgb;
|
||||
typedef mng_srgb * mng_srgbp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
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;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
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;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
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;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
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;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
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;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
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;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
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;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
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;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* hIST */
|
||||
mng_chunk_header sHeader;
|
||||
mng_uint32 iEntrycount;
|
||||
mng_uint16arr aEntries;
|
||||
} mng_hist;
|
||||
typedef mng_hist * mng_histp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
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;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
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;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
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;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* SEEK */
|
||||
mng_chunk_header sHeader;
|
||||
mng_uint32 iNamesize;
|
||||
mng_pchar zName;
|
||||
} mng_seek;
|
||||
typedef mng_seek * mng_seekp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* eXPI */
|
||||
mng_chunk_header sHeader;
|
||||
mng_uint16 iSnapshotid;
|
||||
mng_uint32 iNamesize;
|
||||
mng_pchar zName;
|
||||
} mng_expi;
|
||||
typedef mng_expi * mng_expip;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* fPRI */
|
||||
mng_chunk_header sHeader;
|
||||
mng_uint8 iDeltatype;
|
||||
mng_uint8 iPriority;
|
||||
} mng_fpri;
|
||||
typedef mng_fpri * mng_fprip;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* nEED */
|
||||
mng_chunk_header sHeader;
|
||||
mng_uint32 iKeywordssize;
|
||||
mng_pchar zKeywords;
|
||||
} mng_need;
|
||||
typedef mng_need * mng_needp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef mng_phys mng_phyg; /* pHYg */
|
||||
typedef mng_phyg * mng_phygp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#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 */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* DHDR */
|
||||
mng_chunk_header sHeader;
|
||||
mng_uint16 iObjectid;
|
||||
mng_uint8 iImagetype;
|
||||
mng_uint8 iDeltatype;
|
||||
mng_uint32 iBlockwidth;
|
||||
mng_uint32 iBlockheight;
|
||||
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;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
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;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
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;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* MAGN */
|
||||
mng_chunk_header sHeader;
|
||||
mng_uint16 iFirstid;
|
||||
mng_uint16 iLastid;
|
||||
mng_uint16 iMethodX;
|
||||
mng_uint16 iMX;
|
||||
mng_uint16 iMY;
|
||||
mng_uint16 iML;
|
||||
mng_uint16 iMR;
|
||||
mng_uint16 iMT;
|
||||
mng_uint16 iMB;
|
||||
mng_uint16 iMethodY;
|
||||
} mng_magn;
|
||||
typedef mng_magn * mng_magnp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* unknown chunk */
|
||||
mng_chunk_header sHeader;
|
||||
mng_uint32 iDatasize;
|
||||
mng_ptr pData;
|
||||
} mng_unknown_chunk;
|
||||
typedef mng_unknown_chunk * mng_unknown_chunkp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* _libmng_chunks_h_ */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
@@ -1,928 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_cms.c copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.1 * */
|
||||
/* * * */
|
||||
/* * purpose : color management routines (implementation) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * comment : implementation of the color management routines * */
|
||||
/* * * */
|
||||
/* * changes : 0.5.1 - 05/01/2000 - G.Juyn * */
|
||||
/* * - B001(105795) - fixed a typo and misconception about * */
|
||||
/* * freeing allocated gamma-table. (reported by Marti Maria) * */
|
||||
/* * 0.5.1 - 05/08/2000 - G.Juyn * */
|
||||
/* * - changed strict-ANSI stuff * */
|
||||
/* * 0.5.1 - 05/09/2000 - G.Juyn * */
|
||||
/* * - filled application-based color-management routines * */
|
||||
/* * 0.5.1 - 05/11/2000 - G.Juyn * */
|
||||
/* * - added creatememprofile * */
|
||||
/* * - added callback error-reporting support * */
|
||||
/* * 0.5.1 - 05/12/2000 - G.Juyn * */
|
||||
/* * - changed trace to macro for callback error-reporting * */
|
||||
/* * * */
|
||||
/* * 0.5.2 - 06/10/2000 - G.Juyn * */
|
||||
/* * - fixed some compilation-warnings (contrib Jason Morris) * */
|
||||
/* * * */
|
||||
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
|
||||
/* * - fixed problem with color-correction for stored images * */
|
||||
/* * 0.5.3 - 06/23/2000 - G.Juyn * */
|
||||
/* * - fixed problem with incorrect gamma-correction * */
|
||||
/* * * */
|
||||
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
|
||||
/* * - changed file-prefixes * */
|
||||
/* * * */
|
||||
/* * 0.9.3 - 08/31/2000 - G.Juyn * */
|
||||
/* * - fixed sRGB precedence for gamma_only corection * */
|
||||
/* * * */
|
||||
/* * 0.9.4 - 12/16/2000 - G.Juyn * */
|
||||
/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */
|
||||
/* * * */
|
||||
/* * 1.0.1 - 03/31/2001 - G.Juyn * */
|
||||
/* * - ignore gamma=0 (see png-list for more info) * */
|
||||
/* * 1.0.1 - 04/25/2001 - G.Juyn (reported by Gregg Kelly) * */
|
||||
/* * - fixed problem with cms profile being created multiple * */
|
||||
/* * times when both iCCP & cHRM/gAMA are present * */
|
||||
/* * 1.0.1 - 04/25/2001 - G.Juyn * */
|
||||
/* * - moved mng_clear_cms to libmng_cms * */
|
||||
/* * 1.0.1 - 05/02/2001 - G.Juyn * */
|
||||
/* * - added "default" sRGB generation (Thanks Marti!) * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libmng.h"
|
||||
#include "libmng_data.h"
|
||||
#include "libmng_error.h"
|
||||
#include "libmng_trace.h"
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
#include "libmng_objects.h"
|
||||
#include "libmng_cms.h"
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* force ANSI-C */
|
||||
#endif
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifdef MNG_INCLUDE_DISPLAY_PROCS
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Little CMS helper routines * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifdef MNG_INCLUDE_LCMS
|
||||
|
||||
#define MNG_CMS_FLAGS 0
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
void mnglcms_initlibrary ()
|
||||
{
|
||||
cmsErrorAction (LCMS_ERROR_IGNORE); /* LCMS should ignore errors! */
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_cmsprof mnglcms_createfileprofile (mng_pchar zFilename)
|
||||
{
|
||||
return cmsOpenProfileFromFile (zFilename, "r");
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_cmsprof mnglcms_creatememprofile (mng_uint32 iProfilesize,
|
||||
mng_ptr pProfile)
|
||||
{
|
||||
return cmsOpenProfileFromMem (pProfile, iProfilesize);
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_cmsprof mnglcms_createsrgbprofile (void)
|
||||
{
|
||||
cmsCIExyY D65;
|
||||
cmsCIExyYTRIPLE Rec709Primaries = {
|
||||
{0.6400, 0.3300, 1.0},
|
||||
{0.3000, 0.6000, 1.0},
|
||||
{0.1500, 0.0600, 1.0}
|
||||
};
|
||||
LPGAMMATABLE Gamma24[3];
|
||||
mng_cmsprof hsRGB;
|
||||
|
||||
cmsWhitePointFromTemp(6504, &D65);
|
||||
Gamma24[0] = Gamma24[1] = Gamma24[2] = cmsBuildGamma(256, 2.4);
|
||||
hsRGB = cmsCreateRGBProfile(&D65, &Rec709Primaries, Gamma24);
|
||||
cmsFreeGamma(Gamma24[0]);
|
||||
|
||||
return hsRGB;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
void mnglcms_freeprofile (mng_cmsprof hProf)
|
||||
{
|
||||
cmsCloseProfile (hProf);
|
||||
return;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
void mnglcms_freetransform (mng_cmstrans hTrans)
|
||||
{
|
||||
/* B001 start */
|
||||
cmsDeleteTransform (hTrans);
|
||||
/* B001 end */
|
||||
return;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode mng_clear_cms (mng_datap pData)
|
||||
{
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_CLEAR_CMS, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
if (pData->hTrans) /* transformation still active ? */
|
||||
mnglcms_freetransform (pData->hTrans);
|
||||
|
||||
pData->hTrans = 0;
|
||||
|
||||
if (pData->hProf1) /* file profile still active ? */
|
||||
mnglcms_freeprofile (pData->hProf1);
|
||||
|
||||
pData->hProf1 = 0;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_CLEAR_CMS, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* MNG_INCLUDE_LCMS */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Color-management initialization & correction routines * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifdef MNG_INCLUDE_LCMS
|
||||
|
||||
mng_retcode init_full_cms (mng_datap pData)
|
||||
{
|
||||
mng_cmsprof hProf;
|
||||
mng_cmstrans hTrans;
|
||||
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
|
||||
mng_imagedatap pBuf;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_INIT_FULL_CMS, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
if (!pImage) /* no current object? then use object 0 */
|
||||
pImage = (mng_imagep)pData->pObjzero;
|
||||
|
||||
pBuf = pImage->pImgbuf; /* address the buffer */
|
||||
|
||||
if ((pBuf->bHasICCP) || (pData->bHasglobalICCP))
|
||||
{
|
||||
if (!pData->hProf2) /* output profile not defined ? */
|
||||
{ /* then assume sRGB !! */
|
||||
pData->hProf2 = mnglcms_createsrgbprofile ();
|
||||
|
||||
if (!pData->hProf2) /* handle error ? */
|
||||
MNG_ERRORL (pData, MNG_LCMS_NOHANDLE)
|
||||
}
|
||||
|
||||
if (pBuf->bHasICCP) /* generate a profile handle */
|
||||
hProf = cmsOpenProfileFromMem (pBuf->pProfile, pBuf->iProfilesize);
|
||||
else
|
||||
hProf = cmsOpenProfileFromMem (pData->pGlobalProfile, pData->iGlobalProfilesize);
|
||||
|
||||
pData->hProf1 = hProf; /* save for future use */
|
||||
|
||||
if (!hProf) /* handle error ? */
|
||||
MNG_ERRORL (pData, MNG_LCMS_NOHANDLE)
|
||||
|
||||
if (pData->bIsRGBA16) /* 16-bit intermediates ? */
|
||||
hTrans = cmsCreateTransform (hProf, TYPE_RGBA_16_SE,
|
||||
pData->hProf2, TYPE_RGBA_16_SE,
|
||||
INTENT_PERCEPTUAL, MNG_CMS_FLAGS);
|
||||
else
|
||||
hTrans = cmsCreateTransform (hProf, TYPE_RGBA_8,
|
||||
pData->hProf2, TYPE_RGBA_8,
|
||||
INTENT_PERCEPTUAL, MNG_CMS_FLAGS);
|
||||
|
||||
pData->hTrans = hTrans; /* save for future use */
|
||||
|
||||
if (!hTrans) /* handle error ? */
|
||||
MNG_ERRORL (pData, MNG_LCMS_NOTRANS)
|
||||
/* load color-correction routine */
|
||||
pData->fCorrectrow = (mng_fptr)correct_full_cms;
|
||||
|
||||
return MNG_NOERROR; /* and done */
|
||||
}
|
||||
else
|
||||
if ((pBuf->bHasSRGB) || (pData->bHasglobalSRGB))
|
||||
{
|
||||
mng_uint8 iIntent;
|
||||
|
||||
if (pData->bIssRGB) /* sRGB system ? */
|
||||
return MNG_NOERROR; /* no conversion required */
|
||||
|
||||
if (!pData->hProf3) /* sRGB profile not defined ? */
|
||||
{ /* then create it implicitly !! */
|
||||
pData->hProf3 = mnglcms_createsrgbprofile ();
|
||||
|
||||
if (!pData->hProf3) /* handle error ? */
|
||||
MNG_ERRORL (pData, MNG_LCMS_NOHANDLE)
|
||||
}
|
||||
|
||||
hProf = pData->hProf3; /* convert from sRGB profile */
|
||||
|
||||
if (pBuf->bHasSRGB) /* determine rendering intent */
|
||||
iIntent = pBuf->iRenderingintent;
|
||||
else
|
||||
iIntent = pData->iGlobalRendintent;
|
||||
|
||||
if (pData->bIsRGBA16) /* 16-bit intermediates ? */
|
||||
hTrans = cmsCreateTransform (hProf, TYPE_RGBA_16_SE,
|
||||
pData->hProf2, TYPE_RGBA_16_SE,
|
||||
iIntent, MNG_CMS_FLAGS);
|
||||
else
|
||||
hTrans = cmsCreateTransform (hProf, TYPE_RGBA_8,
|
||||
pData->hProf2, TYPE_RGBA_8,
|
||||
iIntent, MNG_CMS_FLAGS);
|
||||
|
||||
pData->hTrans = hTrans; /* save for future use */
|
||||
|
||||
if (!hTrans) /* handle error ? */
|
||||
MNG_ERRORL (pData, MNG_LCMS_NOTRANS)
|
||||
/* load color-correction routine */
|
||||
pData->fCorrectrow = (mng_fptr)correct_full_cms;
|
||||
|
||||
return MNG_NOERROR; /* and done */
|
||||
}
|
||||
else
|
||||
if ( ((pBuf->bHasCHRM) || (pData->bHasglobalCHRM)) &&
|
||||
( ((pBuf->bHasGAMA) && (pBuf->iGamma > 0)) ||
|
||||
((pData->bHasglobalGAMA) && (pData->iGlobalGamma > 0)) ))
|
||||
{
|
||||
mng_CIExyY sWhitepoint;
|
||||
mng_CIExyYTRIPLE sPrimaries;
|
||||
mng_gammatabp pGammatable[3];
|
||||
mng_float dGamma;
|
||||
|
||||
if (!pData->hProf2) /* output profile not defined ? */
|
||||
{ /* then assume sRGB !! */
|
||||
pData->hProf2 = mnglcms_createsrgbprofile ();
|
||||
|
||||
if (!pData->hProf2) /* handle error ? */
|
||||
MNG_ERRORL (pData, MNG_LCMS_NOHANDLE)
|
||||
}
|
||||
|
||||
if (pBuf->bHasCHRM) /* local cHRM ? */
|
||||
{
|
||||
sWhitepoint.x = (mng_float)pBuf->iWhitepointx / 100000;
|
||||
sWhitepoint.y = (mng_float)pBuf->iWhitepointy / 100000;
|
||||
sPrimaries.Red.x = (mng_float)pBuf->iPrimaryredx / 100000;
|
||||
sPrimaries.Red.y = (mng_float)pBuf->iPrimaryredy / 100000;
|
||||
sPrimaries.Green.x = (mng_float)pBuf->iPrimarygreenx / 100000;
|
||||
sPrimaries.Green.y = (mng_float)pBuf->iPrimarygreeny / 100000;
|
||||
sPrimaries.Blue.x = (mng_float)pBuf->iPrimarybluex / 100000;
|
||||
sPrimaries.Blue.y = (mng_float)pBuf->iPrimarybluey / 100000;
|
||||
}
|
||||
else
|
||||
{
|
||||
sWhitepoint.x = (mng_float)pData->iGlobalWhitepointx / 100000;
|
||||
sWhitepoint.y = (mng_float)pData->iGlobalWhitepointy / 100000;
|
||||
sPrimaries.Red.x = (mng_float)pData->iGlobalPrimaryredx / 100000;
|
||||
sPrimaries.Red.y = (mng_float)pData->iGlobalPrimaryredy / 100000;
|
||||
sPrimaries.Green.x = (mng_float)pData->iGlobalPrimarygreenx / 100000;
|
||||
sPrimaries.Green.y = (mng_float)pData->iGlobalPrimarygreeny / 100000;
|
||||
sPrimaries.Blue.x = (mng_float)pData->iGlobalPrimarybluex / 100000;
|
||||
sPrimaries.Blue.y = (mng_float)pData->iGlobalPrimarybluey / 100000;
|
||||
}
|
||||
|
||||
sWhitepoint.Y = /* Y component is always 1.0 */
|
||||
sPrimaries.Red.Y =
|
||||
sPrimaries.Green.Y =
|
||||
sPrimaries.Blue.Y = 1.0;
|
||||
|
||||
if (pBuf->bHasGAMA) /* get the gamma value */
|
||||
dGamma = (mng_float)pBuf->iGamma / 100000;
|
||||
else
|
||||
dGamma = (mng_float)pData->iGlobalGamma / 100000;
|
||||
|
||||
/* dGamma = pData->dViewgamma / (dGamma * pData->dDisplaygamma); ??? */
|
||||
dGamma = pData->dViewgamma / dGamma;
|
||||
|
||||
pGammatable [0] = /* and build the lookup tables */
|
||||
pGammatable [1] =
|
||||
pGammatable [2] = cmsBuildGamma (256, dGamma);
|
||||
|
||||
/* B001 start */
|
||||
if (!pGammatable [0]) /* enough memory ? */
|
||||
/* B001 end */
|
||||
MNG_ERRORL (pData, MNG_LCMS_NOMEM)
|
||||
/* create the profile */
|
||||
hProf = cmsCreateRGBProfile (&sWhitepoint, &sPrimaries, pGammatable);
|
||||
|
||||
/* B001 start */
|
||||
cmsFreeGamma (pGammatable [0]); /* free the temporary gamma tables ? */
|
||||
/* yes! but just the one! */
|
||||
/* B001 end */
|
||||
|
||||
pData->hProf1 = hProf; /* save for future use */
|
||||
|
||||
if (!hProf) /* handle error ? */
|
||||
MNG_ERRORL (pData, MNG_LCMS_NOHANDLE)
|
||||
|
||||
if (pData->bIsRGBA16) /* 16-bit intermediates ? */
|
||||
hTrans = cmsCreateTransform (hProf, TYPE_RGBA_16_SE,
|
||||
pData->hProf2, TYPE_RGBA_16_SE,
|
||||
INTENT_PERCEPTUAL, MNG_CMS_FLAGS);
|
||||
else
|
||||
hTrans = cmsCreateTransform (hProf, TYPE_RGBA_8,
|
||||
pData->hProf2, TYPE_RGBA_8,
|
||||
INTENT_PERCEPTUAL, MNG_CMS_FLAGS);
|
||||
|
||||
pData->hTrans = hTrans; /* save for future use */
|
||||
|
||||
if (!hTrans) /* handle error ? */
|
||||
MNG_ERRORL (pData, MNG_LCMS_NOTRANS)
|
||||
/* load color-correction routine */
|
||||
pData->fCorrectrow = (mng_fptr)correct_full_cms;
|
||||
|
||||
return MNG_NOERROR; /* and done */
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_INIT_FULL_CMS, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return init_gamma_only (pData); /* if we get here, we'll only do gamma */
|
||||
}
|
||||
#endif /* MNG_INCLUDE_LCMS */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifdef MNG_INCLUDE_LCMS
|
||||
|
||||
mng_retcode init_full_cms_object (mng_datap pData)
|
||||
{
|
||||
mng_cmsprof hProf;
|
||||
mng_cmstrans hTrans;
|
||||
mng_imagedatap pBuf;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_INIT_FULL_CMS_OBJ, MNG_LC_START)
|
||||
#endif
|
||||
/* address the object-buffer */
|
||||
pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf;
|
||||
|
||||
if (pBuf->bHasICCP)
|
||||
{
|
||||
if (!pData->hProf2) /* output profile not defined ? */
|
||||
{ /* then assume sRGB !! */
|
||||
pData->hProf2 = mnglcms_createsrgbprofile ();
|
||||
|
||||
if (!pData->hProf2) /* handle error ? */
|
||||
MNG_ERRORL (pData, MNG_LCMS_NOHANDLE)
|
||||
}
|
||||
/* generate a profile handle */
|
||||
hProf = cmsOpenProfileFromMem (pBuf->pProfile, pBuf->iProfilesize);
|
||||
|
||||
pData->hProf1 = hProf; /* save for future use */
|
||||
|
||||
if (!hProf) /* handle error ? */
|
||||
MNG_ERRORL (pData, MNG_LCMS_NOHANDLE)
|
||||
|
||||
if (pData->bIsRGBA16) /* 16-bit intermediates ? */
|
||||
hTrans = cmsCreateTransform (hProf, TYPE_RGBA_16_SE,
|
||||
pData->hProf2, TYPE_RGBA_16_SE,
|
||||
INTENT_PERCEPTUAL, MNG_CMS_FLAGS);
|
||||
else
|
||||
hTrans = cmsCreateTransform (hProf, TYPE_RGBA_8,
|
||||
pData->hProf2, TYPE_RGBA_8,
|
||||
INTENT_PERCEPTUAL, MNG_CMS_FLAGS);
|
||||
|
||||
pData->hTrans = hTrans; /* save for future use */
|
||||
|
||||
if (!hTrans) /* handle error ? */
|
||||
MNG_ERRORL (pData, MNG_LCMS_NOTRANS)
|
||||
/* load color-correction routine */
|
||||
pData->fCorrectrow = (mng_fptr)correct_full_cms;
|
||||
|
||||
return MNG_NOERROR; /* and done */
|
||||
}
|
||||
else
|
||||
if (pBuf->bHasSRGB)
|
||||
{
|
||||
if (pData->bIssRGB) /* sRGB system ? */
|
||||
return MNG_NOERROR; /* no conversion required */
|
||||
|
||||
if (!pData->hProf3) /* sRGB profile not defined ? */
|
||||
{ /* then create it implicitly !! */
|
||||
pData->hProf3 = mnglcms_createsrgbprofile ();
|
||||
|
||||
if (!pData->hProf3) /* handle error ? */
|
||||
MNG_ERRORL (pData, MNG_LCMS_NOHANDLE)
|
||||
}
|
||||
|
||||
hProf = pData->hProf3; /* convert from sRGB profile */
|
||||
|
||||
if (pData->bIsRGBA16) /* 16-bit intermediates ? */
|
||||
hTrans = cmsCreateTransform (hProf, TYPE_RGBA_16_SE,
|
||||
pData->hProf2, TYPE_RGBA_16_SE,
|
||||
pBuf->iRenderingintent, MNG_CMS_FLAGS);
|
||||
else
|
||||
hTrans = cmsCreateTransform (hProf, TYPE_RGBA_8,
|
||||
pData->hProf2, TYPE_RGBA_8,
|
||||
pBuf->iRenderingintent, MNG_CMS_FLAGS);
|
||||
|
||||
pData->hTrans = hTrans; /* save for future use */
|
||||
|
||||
if (!hTrans) /* handle error ? */
|
||||
MNG_ERRORL (pData, MNG_LCMS_NOTRANS)
|
||||
/* load color-correction routine */
|
||||
pData->fCorrectrow = (mng_fptr)correct_full_cms;
|
||||
|
||||
return MNG_NOERROR; /* and done */
|
||||
}
|
||||
else
|
||||
if ((pBuf->bHasCHRM) && (pBuf->bHasGAMA) && (pBuf->iGamma > 0))
|
||||
{
|
||||
mng_CIExyY sWhitepoint;
|
||||
mng_CIExyYTRIPLE sPrimaries;
|
||||
mng_gammatabp pGammatable[3];
|
||||
mng_float dGamma;
|
||||
|
||||
if (!pData->hProf2) /* output profile not defined ? */
|
||||
{ /* then assume sRGB !! */
|
||||
pData->hProf2 = mnglcms_createsrgbprofile ();
|
||||
|
||||
if (!pData->hProf2) /* handle error ? */
|
||||
MNG_ERRORL (pData, MNG_LCMS_NOHANDLE)
|
||||
}
|
||||
|
||||
sWhitepoint.x = (mng_float)pBuf->iWhitepointx / 100000;
|
||||
sWhitepoint.y = (mng_float)pBuf->iWhitepointy / 100000;
|
||||
sPrimaries.Red.x = (mng_float)pBuf->iPrimaryredx / 100000;
|
||||
sPrimaries.Red.y = (mng_float)pBuf->iPrimaryredy / 100000;
|
||||
sPrimaries.Green.x = (mng_float)pBuf->iPrimarygreenx / 100000;
|
||||
sPrimaries.Green.y = (mng_float)pBuf->iPrimarygreeny / 100000;
|
||||
sPrimaries.Blue.x = (mng_float)pBuf->iPrimarybluex / 100000;
|
||||
sPrimaries.Blue.y = (mng_float)pBuf->iPrimarybluey / 100000;
|
||||
|
||||
sWhitepoint.Y = /* Y component is always 1.0 */
|
||||
sPrimaries.Red.Y =
|
||||
sPrimaries.Green.Y =
|
||||
sPrimaries.Blue.Y = 1.0;
|
||||
|
||||
dGamma = (mng_float)pBuf->iGamma / 100000;
|
||||
|
||||
/* dGamma = pData->dViewgamma / (dGamma * pData->dDisplaygamma); ??? */
|
||||
dGamma = pData->dViewgamma / dGamma;
|
||||
|
||||
pGammatable [0] = /* and build the lookup tables */
|
||||
pGammatable [1] =
|
||||
pGammatable [2] = cmsBuildGamma (256, dGamma);
|
||||
|
||||
/* B001 start */
|
||||
if (!pGammatable [0]) /* enough memory ? */
|
||||
/* B001 end */
|
||||
MNG_ERRORL (pData, MNG_LCMS_NOMEM)
|
||||
|
||||
/* create the profile */
|
||||
hProf = cmsCreateRGBProfile (&sWhitepoint, &sPrimaries, pGammatable);
|
||||
|
||||
/* B001 start */
|
||||
cmsFreeGamma (pGammatable [0]); /* free the temporary gamma tables ? */
|
||||
/* yes! but just the one! */
|
||||
/* B001 end */
|
||||
|
||||
pData->hProf1 = hProf; /* save for future use */
|
||||
|
||||
if (!hProf) /* handle error ? */
|
||||
MNG_ERRORL (pData, MNG_LCMS_NOHANDLE)
|
||||
|
||||
if (pData->bIsRGBA16) /* 16-bit intermediates ? */
|
||||
hTrans = cmsCreateTransform (hProf, TYPE_RGBA_16_SE,
|
||||
pData->hProf2, TYPE_RGBA_16_SE,
|
||||
INTENT_PERCEPTUAL, MNG_CMS_FLAGS);
|
||||
else
|
||||
hTrans = cmsCreateTransform (hProf, TYPE_RGBA_8,
|
||||
pData->hProf2, TYPE_RGBA_8,
|
||||
INTENT_PERCEPTUAL, MNG_CMS_FLAGS);
|
||||
|
||||
pData->hTrans = hTrans; /* save for future use */
|
||||
|
||||
if (!hTrans) /* handle error ? */
|
||||
MNG_ERRORL (pData, MNG_LCMS_NOTRANS)
|
||||
/* load color-correction routine */
|
||||
pData->fCorrectrow = (mng_fptr)correct_full_cms;
|
||||
|
||||
return MNG_NOERROR; /* and done */
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_INIT_FULL_CMS_OBJ, MNG_LC_END)
|
||||
#endif
|
||||
/* if we get here, we'll only do gamma */
|
||||
return init_gamma_only_object (pData);
|
||||
}
|
||||
#endif /* MNG_INCLUDE_LCMS */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifdef MNG_INCLUDE_LCMS
|
||||
mng_retcode correct_full_cms (mng_datap pData)
|
||||
{
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_CORRECT_FULL_CMS, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
cmsDoTransform (pData->hTrans, pData->pRGBArow, pData->pRGBArow, pData->iRowsamples);
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_CORRECT_FULL_CMS, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
#endif /* MNG_INCLUDE_LCMS */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS)
|
||||
mng_retcode init_gamma_only (mng_datap pData)
|
||||
{
|
||||
mng_float dGamma;
|
||||
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
|
||||
mng_imagedatap pBuf;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_INIT_GAMMA_ONLY, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
if (!pImage) /* no current object? then use object 0 */
|
||||
pImage = (mng_imagep)pData->pObjzero;
|
||||
|
||||
pBuf = pImage->pImgbuf; /* address the buffer */
|
||||
|
||||
if (pBuf->bHasSRGB) /* get the gamma value */
|
||||
dGamma = 0.45455;
|
||||
else
|
||||
if (pBuf->bHasGAMA)
|
||||
dGamma = (mng_float)pBuf->iGamma / 100000;
|
||||
else
|
||||
if (pData->bHasglobalSRGB)
|
||||
dGamma = 0.45455;
|
||||
else
|
||||
if (pData->bHasglobalGAMA)
|
||||
dGamma = (mng_float)pData->iGlobalGamma / 100000;
|
||||
else
|
||||
dGamma = pData->dDfltimggamma;
|
||||
|
||||
if (dGamma > 0) /* ignore gamma=0 */
|
||||
{
|
||||
dGamma = pData->dViewgamma / (dGamma * pData->dDisplaygamma);
|
||||
|
||||
if (dGamma != pData->dLastgamma) /* lookup table needs to be computed ? */
|
||||
{
|
||||
mng_int32 iX;
|
||||
|
||||
pData->aGammatab [0] = 0;
|
||||
|
||||
for (iX = 1; iX <= 255; iX++)
|
||||
pData->aGammatab [iX] = (mng_uint8)(pow (iX / 255.0, dGamma) * 255 + 0.5);
|
||||
|
||||
pData->dLastgamma = dGamma; /* keep for next time */
|
||||
}
|
||||
/* load color-correction routine */
|
||||
pData->fCorrectrow = (mng_fptr)correct_gamma_only;
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_INIT_GAMMA_ONLY, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
#endif /* MNG_GAMMA_ONLY || MNG_FULL_CMS */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS)
|
||||
mng_retcode init_gamma_only_object (mng_datap pData)
|
||||
{
|
||||
mng_float dGamma;
|
||||
mng_imagedatap pBuf;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_INIT_GAMMA_ONLY_OBJ, MNG_LC_START)
|
||||
#endif
|
||||
/* address the object-buffer */
|
||||
pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf;
|
||||
|
||||
if (pBuf->bHasSRGB) /* get the gamma value */
|
||||
dGamma = 0.45455;
|
||||
else
|
||||
if (pBuf->bHasGAMA)
|
||||
dGamma = (mng_float)pBuf->iGamma / 100000;
|
||||
else
|
||||
dGamma = pData->dDfltimggamma;
|
||||
|
||||
if (dGamma) /* lets not divide by zero, shall we... */
|
||||
dGamma = pData->dViewgamma / (dGamma * pData->dDisplaygamma);
|
||||
|
||||
if (dGamma != pData->dLastgamma) /* lookup table needs to be computed ? */
|
||||
{
|
||||
mng_int32 iX;
|
||||
|
||||
pData->aGammatab [0] = 0;
|
||||
|
||||
for (iX = 1; iX <= 255; iX++)
|
||||
pData->aGammatab [iX] = (mng_uint8)(pow (iX / 255.0, dGamma) * 255 + 0.5);
|
||||
|
||||
pData->dLastgamma = dGamma; /* keep for next time */
|
||||
}
|
||||
/* load color-correction routine */
|
||||
pData->fCorrectrow = (mng_fptr)correct_gamma_only;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_INIT_GAMMA_ONLY_OBJ, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
#endif /* MNG_GAMMA_ONLY || MNG_FULL_CMS */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS)
|
||||
mng_retcode correct_gamma_only (mng_datap pData)
|
||||
{
|
||||
mng_uint8p pWork;
|
||||
mng_int32 iX;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_CORRECT_GAMMA_ONLY, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
pWork = pData->pRGBArow; /* address intermediate row */
|
||||
|
||||
if (pData->bIsRGBA16) /* 16-bit intermediate row ? */
|
||||
{
|
||||
|
||||
|
||||
/* TODO: 16-bit precision gamma processing */
|
||||
/* we'll just do the high-order byte for now */
|
||||
|
||||
|
||||
/* convert all samples in the row */
|
||||
for (iX = 0; iX < pData->iRowsamples; iX++)
|
||||
{ /* using the precalculated gamma lookup table */
|
||||
*pWork = pData->aGammatab [*pWork];
|
||||
*(pWork+2) = pData->aGammatab [*(pWork+2)];
|
||||
*(pWork+4) = pData->aGammatab [*(pWork+4)];
|
||||
|
||||
pWork += 8;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ /* convert all samples in the row */
|
||||
for (iX = 0; iX < pData->iRowsamples; iX++)
|
||||
{ /* using the precalculated gamma lookup table */
|
||||
*pWork = pData->aGammatab [*pWork];
|
||||
*(pWork+1) = pData->aGammatab [*(pWork+1)];
|
||||
*(pWork+2) = pData->aGammatab [*(pWork+2)];
|
||||
|
||||
pWork += 4;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_CORRECT_GAMMA_ONLY, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
#endif /* MNG_GAMMA_ONLY || MNG_FULL_CMS */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifdef MNG_APP_CMS
|
||||
mng_retcode init_app_cms (mng_datap pData)
|
||||
{
|
||||
mng_imagedatap pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_INIT_APP_CMS, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
if ( (pData->fProcessiccp) &&
|
||||
((pBuf->bHasICCP) || (pData->bHasglobalICCP)) )
|
||||
{
|
||||
mng_uint32 iProfilesize;
|
||||
mng_ptr pProfile;
|
||||
|
||||
if (pBuf->bHasICCP) /* get the right profile */
|
||||
{
|
||||
iProfilesize = pBuf->iProfilesize;
|
||||
pProfile = pBuf->pProfile;
|
||||
}
|
||||
else
|
||||
{
|
||||
iProfilesize = pData->iGlobalProfilesize;
|
||||
pProfile = pData->pGlobalProfile;
|
||||
}
|
||||
/* inform the app */
|
||||
if (!pData->fProcessiccp ((mng_handle)pData, iProfilesize, pProfile))
|
||||
MNG_ERROR (pData, MNG_APPCMSERROR)
|
||||
/* load color-correction routine */
|
||||
pData->fCorrectrow = (mng_fptr)correct_app_cms;
|
||||
}
|
||||
|
||||
if ( (pData->fProcesssrgb) &&
|
||||
((pBuf->bHasSRGB) || (pData->bHasglobalSRGB)) )
|
||||
{
|
||||
mng_uint8 iIntent;
|
||||
|
||||
if (pBuf->bHasSRGB) /* determine rendering intent */
|
||||
iIntent = pBuf->iRenderingintent;
|
||||
else
|
||||
iIntent = pData->iGlobalRendintent;
|
||||
/* inform the app */
|
||||
if (!pData->fProcesssrgb ((mng_handle)pData, iIntent))
|
||||
MNG_ERROR (pData, MNG_APPCMSERROR)
|
||||
/* load color-correction routine */
|
||||
pData->fCorrectrow = (mng_fptr)correct_app_cms;
|
||||
}
|
||||
|
||||
if ( (pData->fProcesschroma) &&
|
||||
( ((pBuf->bHasCHRM) || (pData->bHasglobalCHRM)) ) )
|
||||
{
|
||||
mng_uint32 iWhitepointx, iWhitepointy;
|
||||
mng_uint32 iPrimaryredx, iPrimaryredy;
|
||||
mng_uint32 iPrimarygreenx, iPrimarygreeny;
|
||||
mng_uint32 iPrimarybluex, iPrimarybluey;
|
||||
|
||||
if (pBuf->bHasCHRM) /* local cHRM ? */
|
||||
{
|
||||
iWhitepointx = pBuf->iWhitepointx;
|
||||
iWhitepointy = pBuf->iWhitepointy;
|
||||
iPrimaryredx = pBuf->iPrimaryredx;
|
||||
iPrimaryredy = pBuf->iPrimaryredy;
|
||||
iPrimarygreenx = pBuf->iPrimarygreenx;
|
||||
iPrimarygreeny = pBuf->iPrimarygreeny;
|
||||
iPrimarybluex = pBuf->iPrimarybluex;
|
||||
iPrimarybluey = pBuf->iPrimarybluey;
|
||||
}
|
||||
else
|
||||
{
|
||||
iWhitepointx = pData->iGlobalWhitepointx;
|
||||
iWhitepointy = pData->iGlobalWhitepointy;
|
||||
iPrimaryredx = pData->iGlobalPrimaryredx;
|
||||
iPrimaryredy = pData->iGlobalPrimaryredy;
|
||||
iPrimarygreenx = pData->iGlobalPrimarygreenx;
|
||||
iPrimarygreeny = pData->iGlobalPrimarygreeny;
|
||||
iPrimarybluex = pData->iGlobalPrimarybluex;
|
||||
iPrimarybluey = pData->iGlobalPrimarybluey;
|
||||
}
|
||||
/* inform the app */
|
||||
if (!pData->fProcesschroma ((mng_handle)pData, iWhitepointx, iWhitepointy,
|
||||
iPrimaryredx, iPrimaryredy,
|
||||
iPrimarygreenx, iPrimarygreeny,
|
||||
iPrimarybluex, iPrimarybluey))
|
||||
MNG_ERROR (pData, MNG_APPCMSERROR)
|
||||
/* load color-correction routine */
|
||||
pData->fCorrectrow = (mng_fptr)correct_app_cms;
|
||||
}
|
||||
|
||||
if ( (pData->fProcessgamma) &&
|
||||
((pBuf->bHasGAMA) || (pData->bHasglobalGAMA)) )
|
||||
{
|
||||
mng_uint32 iGamma;
|
||||
|
||||
if (pBuf->bHasGAMA) /* get the gamma value */
|
||||
iGamma = pBuf->iGamma;
|
||||
else
|
||||
iGamma = pData->iGlobalGamma;
|
||||
/* inform the app */
|
||||
if (!pData->fProcessgamma ((mng_handle)pData, iGamma))
|
||||
MNG_ERROR (pData, MNG_APPCMSERROR)
|
||||
/* load color-correction routine */
|
||||
pData->fCorrectrow = (mng_fptr)correct_app_cms;
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_INIT_APP_CMS, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
#endif /* MNG_APP_CMS */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifdef MNG_APP_CMS
|
||||
mng_retcode init_app_cms_object (mng_datap pData)
|
||||
{
|
||||
mng_imagedatap pBuf = ((mng_imagep)pData->pCurrentobj)->pImgbuf;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_INIT_APP_CMS_OBJ, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
if ((pData->fProcessiccp) && (pBuf->bHasICCP))
|
||||
{ /* inform the app */
|
||||
if (!pData->fProcessiccp ((mng_handle)pData, pBuf->iProfilesize, pBuf->pProfile))
|
||||
MNG_ERROR (pData, MNG_APPCMSERROR)
|
||||
/* load color-correction routine */
|
||||
pData->fCorrectrow = (mng_fptr)correct_app_cms;
|
||||
}
|
||||
|
||||
if ((pData->fProcesssrgb) && (pBuf->bHasSRGB))
|
||||
{ /* inform the app */
|
||||
if (!pData->fProcesssrgb ((mng_handle)pData, pBuf->iRenderingintent))
|
||||
MNG_ERROR (pData, MNG_APPCMSERROR)
|
||||
/* load color-correction routine */
|
||||
pData->fCorrectrow = (mng_fptr)correct_app_cms;
|
||||
}
|
||||
|
||||
if ((pData->fProcesschroma) && (pBuf->bHasCHRM))
|
||||
{ /* inform the app */
|
||||
if (!pData->fProcesschroma ((mng_handle)pData, pBuf->iWhitepointx, pBuf->iWhitepointy,
|
||||
pBuf->iPrimaryredx, pBuf->iPrimaryredy,
|
||||
pBuf->iPrimarygreenx, pBuf->iPrimarygreeny,
|
||||
pBuf->iPrimarybluex, pBuf->iPrimarybluey))
|
||||
MNG_ERROR (pData, MNG_APPCMSERROR)
|
||||
/* load color-correction routine */
|
||||
pData->fCorrectrow = (mng_fptr)correct_app_cms;
|
||||
}
|
||||
|
||||
if ((pData->fProcessgamma) && (pBuf->bHasGAMA))
|
||||
{ /* inform the app */
|
||||
if (!pData->fProcessgamma ((mng_handle)pData, pBuf->iGamma))
|
||||
MNG_ERROR (pData, MNG_APPCMSERROR)
|
||||
/* load color-correction routine */
|
||||
pData->fCorrectrow = (mng_fptr)correct_app_cms;
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_INIT_APP_CMS_OBJ, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
#endif /* MNG_APP_CMS */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifdef MNG_APP_CMS
|
||||
mng_retcode correct_app_cms (mng_datap pData)
|
||||
{
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_CORRECT_APP_CMS, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
if (pData->fProcessarow) /* let the app do something with our row */
|
||||
if (!pData->fProcessarow ((mng_handle)pData, pData->iRowsamples,
|
||||
pData->bIsRGBA16, pData->pRGBArow))
|
||||
MNG_ERROR (pData, MNG_APPCMSERROR)
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_CORRECT_APP_CMS, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
#endif /* MNG_APP_CMS */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* MNG_INCLUDE_DISPLAY_PROCS */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_cms.h copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.1 * */
|
||||
/* * * */
|
||||
/* * purpose : color management routines (definition) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * 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!) * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#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 init_full_cms (mng_datap pData);
|
||||
mng_retcode init_full_cms_object (mng_datap pData);
|
||||
mng_retcode correct_full_cms (mng_datap pData);
|
||||
#endif
|
||||
|
||||
#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY)
|
||||
mng_retcode init_gamma_only (mng_datap pData);
|
||||
mng_retcode init_gamma_only_object (mng_datap pData);
|
||||
mng_retcode correct_gamma_only (mng_datap pData);
|
||||
#endif
|
||||
|
||||
#ifdef MNG_APP_CMS
|
||||
mng_retcode init_app_cms (mng_datap pData);
|
||||
mng_retcode init_app_cms_object (mng_datap pData);
|
||||
mng_retcode correct_app_cms (mng_datap pData);
|
||||
#endif
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* _libmng_cms_h_ */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
@@ -1,209 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_conf.h copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : main configuration file * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * comment : The configuration file. Change this to include/exclude * */
|
||||
/* * the options you want or do not want in libmng. * */
|
||||
/* * * */
|
||||
/* * changes : 0.5.2 - 06/02/2000 - G.Juyn * */
|
||||
/* * - separated configuration-options into this file * */
|
||||
/* * - changed to most likely configuration (?) * */
|
||||
/* * 0.5.2 - 06/03/2000 - G.Juyn * */
|
||||
/* * - changed options to create a standard so-library * */
|
||||
/* * with everything enabled * */
|
||||
/* * 0.5.2 - 06/04/2000 - G.Juyn * */
|
||||
/* * - changed options to create a standard win32-dll * */
|
||||
/* * with everything enabled * */
|
||||
/* * * */
|
||||
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
|
||||
/* * - changed file-prefixes * */
|
||||
/* * * */
|
||||
/* * 0.9.3 - 08/12/2000 - G.Juyn * */
|
||||
/* * - added workaround for faulty PhotoShop iCCP chunk * */
|
||||
/* * 0.9.3 - 09/16/2000 - G.Juyn * */
|
||||
/* * - removed trace-options from default SO/DLL builds * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* force ANSI-C */
|
||||
#endif
|
||||
|
||||
#ifndef _libmng_conf_h_
|
||||
#define _libmng_conf_h_
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * User-selectable compile-time options * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
/* enable exactly one(1) of the MNG-(sub)set selectors */
|
||||
/* use this to select which (sub)set of the MNG specification you wish
|
||||
to support */
|
||||
/* generally you'll want full support as the library provides it automatically
|
||||
for you! if you're really strung on memory-requirements you can opt
|
||||
to enable less support (but it's just NOT a good idea!) */
|
||||
/* NOTE that this isn't actually implemented yet */
|
||||
|
||||
#if !defined(MNG_SUPPORT_FULL) && !defined(MNG_SUPPORT_LC) && !defined(MNG_SUPPORT_VLC)
|
||||
#define MNG_SUPPORT_FULL
|
||||
/* #define MNG_SUPPORT_LC */
|
||||
/* #define MNG_SUPPORT_VLC */
|
||||
#endif
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
/* enable JPEG support if required */
|
||||
/* use this to enable the JNG support routines */
|
||||
/* this requires an external jpeg package;
|
||||
currently only IJG's jpgsrc6b is supported! */
|
||||
/* NOTE that the IJG code can be either 8- or 12-bit (eg. not both);
|
||||
so choose the one you've defined in jconfig.h; if you don't know what
|
||||
the heck I'm talking about, just leave it at 8-bit support (thank you!) */
|
||||
|
||||
#ifdef MNG_SUPPORT_FULL /* full support includes JNG */
|
||||
#define MNG_SUPPORT_IJG6B
|
||||
#endif
|
||||
|
||||
#ifndef MNG_SUPPORT_IJG6B
|
||||
#if defined(MNG_BUILD_SO) || defined(MNG_USE_SO) || defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL)
|
||||
#define MNG_SUPPORT_IJG6B
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MNG_SUPPORT_IJG6B) && !defined(MNG_SUPPORT_JPEG8) && !defined(MNG_SUPPORT_JPEG12)
|
||||
#define MNG_SUPPORT_JPEG8
|
||||
/* #define MNG_SUPPORT_JPEG12 */
|
||||
#endif
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
/* enable required high-level functions */
|
||||
/* use this to select the high-level functions you require */
|
||||
/* if you only need to display a MNG, disable write support! */
|
||||
/* if you only need to examine a MNG, disable write & display support! */
|
||||
/* if you only need to copy a MNG, disable display support! */
|
||||
/* if you only need to create a MNG, disable read & display support! */
|
||||
/* NOTE that turning all options off will be very unuseful! */
|
||||
|
||||
#if !defined(MNG_SUPPORT_READ) && !defined(MNG_SUPPORT_WRITE) && !defined(MNG_SUPPORT_DISPLAY)
|
||||
#define MNG_SUPPORT_READ
|
||||
#if defined(MNG_BUILD_SO) || defined(MNG_USE_SO) || defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL)
|
||||
#define MNG_SUPPORT_WRITE
|
||||
#endif
|
||||
#define MNG_SUPPORT_DISPLAY
|
||||
#endif
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
/* enable chunk access functions */
|
||||
/* use this to select whether you need access to the individual chunks */
|
||||
/* useful if you want to examine a read MNG (you'll also need MNG_STORE_CHUNKS !)*/
|
||||
/* required if you need to create & write a new MNG! */
|
||||
|
||||
#ifndef MNG_ACCESS_CHUNKS
|
||||
#if defined(MNG_BUILD_SO) || defined(MNG_USE_SO) || defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL)
|
||||
#define MNG_ACCESS_CHUNKS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
/* enable exactly one of the color-management-functionality selectors */
|
||||
/* use this to select the level of automatic color support */
|
||||
/* MNG_FULL_CMS requires the lcms (little cms) external package ! */
|
||||
/* if you want your own app (or the OS) to handle color-management
|
||||
select MNG_APP_CMS */
|
||||
|
||||
#if !defined(MNG_FULL_CMS) && !defined(MNG_GAMMA_ONLY) && !defined(MNG_NO_CMS) && !defined(MNG_APP_CMS)
|
||||
#if defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL)
|
||||
#define MNG_FULL_CMS
|
||||
#else
|
||||
#define MNG_GAMMA_ONLY
|
||||
#endif
|
||||
/* #define MNG_NO_CMS */
|
||||
/* #define MNG_APP_CMS */
|
||||
#endif
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
/* enable automatic dithering */
|
||||
/* use this if you need dithering support to convert high-resolution
|
||||
images to a low-resolution output-device */
|
||||
/* NOTE that this is not supported yet */
|
||||
|
||||
/* #define MNG_AUTO_DITHER */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
/* enable whether chunks should be stored for reference later */
|
||||
/* use this if you need to examine the chunks of a MNG you have read,
|
||||
or (re-)write a MNG you have read */
|
||||
/* turn this off if you want to reduce memory-consumption */
|
||||
|
||||
#ifndef MNG_STORE_CHUNKS
|
||||
#if defined(MNG_BUILD_SO) || defined(MNG_USE_SO) || defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL)
|
||||
#define MNG_STORE_CHUNKS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
/* enable internal memory management (if your compiler supports it) */
|
||||
/* use this if your compiler supports the 'standard' memory functions
|
||||
(calloc & free), and you want the library to use these functions and not
|
||||
bother your app with memory-callbacks */
|
||||
|
||||
/* #define MNG_INTERNAL_MEMMNGMT */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
/* enable internal tracing-functionality (manual debugging purposes) */
|
||||
/* use this if you have trouble location bugs or problems */
|
||||
/* NOTE that you'll need to specify the trace callback function! */
|
||||
|
||||
/* #define MNG_SUPPORT_TRACE */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
/* enable extended error- and trace-telltaling */
|
||||
/* use this if you need explanatory messages with errors and/or tracing */
|
||||
|
||||
#if !defined(MNG_ERROR_TELLTALE) && !defined(MNG_TRACE_TELLTALE)
|
||||
#if defined(MNG_BUILD_SO) || defined(MNG_USE_SO) || defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL)
|
||||
#define MNG_ERROR_TELLTALE
|
||||
#define MNG_TRACE_TELLTALE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
/* enable big-endian support */
|
||||
/* enable this if you're on an architecture that supports big-endian reads
|
||||
and writes that aren't word-aligned */
|
||||
/* according to reliable sources this only works for PowerPC (bigendian mode)
|
||||
and 680x0 */
|
||||
|
||||
/* #define MNG_BIGENDIAN_SUPPORTED */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * End of user-selectable compile-time options * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* _libmng_conf_h_ */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -1,759 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_data.h copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.1 * */
|
||||
/* * * */
|
||||
/* * purpose : main data structure definition * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * comment : Definition of the library main data structure * */
|
||||
/* * * */
|
||||
/* * changes : 0.5.1 - 05/04/2000 - G.Juyn * */
|
||||
/* * - added CRC table to main structure (for thread-safety) * */
|
||||
/* * 0.5.1 - 05/06/2000 - G.Juyn * */
|
||||
/* * - added iPLTEentries for checking hIST-length * */
|
||||
/* * 0.5.1 - 05/08/2000 - G.Juyn * */
|
||||
/* * - changed palette definition to exported palette-type * */
|
||||
/* * - removed frozen indicator * */
|
||||
/* * - added create/write indicators * */
|
||||
/* * - changed strict-ANSI stuff * */
|
||||
/* * 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) * */
|
||||
/* * - added saved-data structure for SAVE/SEEK processing * */
|
||||
/* * * */
|
||||
/* * 0.5.2 - 05/18/2000 - G.Juyn * */
|
||||
/* * - added fields for JNG support (IJG-based) * */
|
||||
/* * 0.5.2 - 05/24/2000 - G.Juyn * */
|
||||
/* * - changed global tRNS definition * */
|
||||
/* * 0.5.2 - 05/30/2000 - G.Juyn * */
|
||||
/* * - added delta-image fields * */
|
||||
/* * 0.5.2 - 06/01/2000 - G.Juyn * */
|
||||
/* * - added internal delta-image processing callbacks * */
|
||||
/* * 0.5.2 - 06/02/2000 - G.Juyn * */
|
||||
/* * - changed SWAP_ENDIAN to BIGENDIAN_SUPPORTED * */
|
||||
/* * (contributed by Tim Rowley) * */
|
||||
/* * - added getalphaline callback for RGB8_A8 canvasstyle * */
|
||||
/* * 0.5.2 - 06/06/2000 - G.Juyn * */
|
||||
/* * - added parameter for delayed buffer-processing * */
|
||||
/* * * */
|
||||
/* * 0.5.3 - 06/16/2000 - G.Juyn * */
|
||||
/* * - added update-region parms for refresh calback * */
|
||||
/* * - added Needrefresh parameter * */
|
||||
/* * 0.5.3 - 06/17/2000 - G.Juyn * */
|
||||
/* * - added Deltaimmediate parm for faster delta-processing * */
|
||||
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
|
||||
/* * - added Speed parameter to facilitate testing * */
|
||||
/* * - added Imagelevel parameter for processtext callback * */
|
||||
/* * 0.5.3 - 06/26/2000 - G.Juyn * */
|
||||
/* * - changed userdata variable to mng_ptr * */
|
||||
/* * * */
|
||||
/* * 0.9.1 - 07/07/2000 - G.Juyn * */
|
||||
/* * - added variables for go_xxxx processing * */
|
||||
/* * 0.9.1 - 07/08/2000 - G.Juyn * */
|
||||
/* * - added variables for improved timing support * */
|
||||
/* * 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 * */
|
||||
/* * - fixed suspension-buffering for 32K+ chunks * */
|
||||
/* * * */
|
||||
/* * 0.9.2 - 07/29/2000 - G.Juyn * */
|
||||
/* * - removed Nextbackxxx fields (no longer used) * */
|
||||
/* * 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 - 08/26/2000 - G.Juyn * */
|
||||
/* * - added MAGN chunk * */
|
||||
/* * 0.9.3 - 09/07/2000 - G.Juyn * */
|
||||
/* * - added support for new filter_types * */
|
||||
/* * 0.9.3 - 09/10/2000 - G.Juyn * */
|
||||
/* * - fixed DEFI behavior * */
|
||||
/* * 0.9.3 - 10/10/2000 - G.Juyn * */
|
||||
/* * - added support for alpha-depth prediction * */
|
||||
/* * 0.9.3 - 10/11/2000 - G.Juyn * */
|
||||
/* * - added support for nEED * */
|
||||
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
|
||||
/* * - added optional support for bKGD for PNG images * */
|
||||
/* * - added support for JDAA * */
|
||||
/* * 0.9.3 - 10/17/2000 - G.Juyn * */
|
||||
/* * - added callback to process non-critical unknown chunks * */
|
||||
/* * - fixed support for bKGD * */
|
||||
/* * 0.9.3 - 10/19/2000 - G.Juyn * */
|
||||
/* * - implemented delayed delta-processing * */
|
||||
/* * 0.9.4 - 12/16/2000 - G.Juyn * */
|
||||
/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */
|
||||
/* * * */
|
||||
/* * 1.0.1 - 02/08/2001 - G.Juyn * */
|
||||
/* * - added MEND processing callback * */
|
||||
/* * 1.0.1 - 02/13/2001 - G.Juyn * */
|
||||
/* * - fixed first FRAM_MODE=4 timing problem * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* force ANSI-C */
|
||||
#endif
|
||||
|
||||
#ifndef _libmng_data_h_
|
||||
#define _libmng_data_h_
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#define MNG_MAGIC 0x52530a0aL
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Internal structures * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef mng_palette8 mng_rgbpaltab;
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * The saved_data structure * */
|
||||
/* * * */
|
||||
/* * This contains the saved data after a SAVE chunk has been processed. * */
|
||||
/* * The data is saved from the main data structure during SAVE processing, * */
|
||||
/* * and restored to the main data structure during SEEK processing. * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct mng_savedata_struct {
|
||||
|
||||
#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
|
||||
mng_bool bHasglobalPLTE; /* global PLTE chunk processed */
|
||||
mng_bool bHasglobalTRNS; /* global tRNS chunk processed */
|
||||
mng_bool bHasglobalGAMA; /* global gAMA chunk processed */
|
||||
mng_bool bHasglobalCHRM; /* global cHRM chunk processed */
|
||||
mng_bool bHasglobalSRGB; /* global sRGB chunk processed */
|
||||
mng_bool bHasglobalICCP; /* global iCCP chunk processed */
|
||||
mng_bool bHasglobalBKGD; /* global bKGD chunk processed */
|
||||
#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */
|
||||
|
||||
#ifdef MNG_SUPPORT_DISPLAY
|
||||
mng_uint16 iBACKred; /* BACK fields */
|
||||
mng_uint16 iBACKgreen;
|
||||
mng_uint16 iBACKblue;
|
||||
mng_uint8 iBACKmandatory;
|
||||
mng_uint16 iBACKimageid;
|
||||
mng_uint8 iBACKtile;
|
||||
|
||||
mng_uint8 iFRAMmode; /* FRAM fields (global) */
|
||||
mng_uint32 iFRAMdelay;
|
||||
mng_uint32 iFRAMtimeout;
|
||||
mng_bool bFRAMclipping;
|
||||
mng_int32 iFRAMclipl;
|
||||
mng_int32 iFRAMclipr;
|
||||
mng_int32 iFRAMclipt;
|
||||
mng_int32 iFRAMclipb;
|
||||
|
||||
mng_uint32 iGlobalPLTEcount; /* global PLTE fields */
|
||||
mng_rgbpaltab aGlobalPLTEentries;
|
||||
|
||||
mng_uint32 iGlobalTRNSrawlen; /* global tRNS fields */
|
||||
mng_uint8arr aGlobalTRNSrawdata;
|
||||
|
||||
mng_uint32 iGlobalGamma; /* global gAMA fields */
|
||||
|
||||
mng_uint32 iGlobalWhitepointx; /* global cHRM fields */
|
||||
mng_uint32 iGlobalWhitepointy;
|
||||
mng_uint32 iGlobalPrimaryredx;
|
||||
mng_uint32 iGlobalPrimaryredy;
|
||||
mng_uint32 iGlobalPrimarygreenx;
|
||||
mng_uint32 iGlobalPrimarygreeny;
|
||||
mng_uint32 iGlobalPrimarybluex;
|
||||
mng_uint32 iGlobalPrimarybluey;
|
||||
|
||||
mng_uint8 iGlobalRendintent; /* global sRGB fields */
|
||||
|
||||
mng_uint32 iGlobalProfilesize; /* global iCCP fields */
|
||||
mng_ptr pGlobalProfile;
|
||||
|
||||
mng_uint16 iGlobalBKGDred; /* global bKGD fields */
|
||||
mng_uint16 iGlobalBKGDgreen;
|
||||
mng_uint16 iGlobalBKGDblue;
|
||||
#endif /* MNG_SUPPORT_DISPLAY */
|
||||
|
||||
} mng_savedata;
|
||||
|
||||
typedef mng_savedata * mng_savedatap;
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * The main libmng data structure * */
|
||||
/* * * */
|
||||
/* * The handle used in all functions points to this structure which * */
|
||||
/* * contains all volatile data necessary to process the network graphic. * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct mng_data_struct {
|
||||
|
||||
mng_uint32 iMagic; /* magic number to validate
|
||||
a given handle */
|
||||
mng_ptr pUserdata; /* application workdata */
|
||||
|
||||
mng_imgtype eSigtype; /* image information */
|
||||
mng_imgtype eImagetype; /* initially zeroed */
|
||||
mng_uint32 iWidth; /* filled after header is processed */
|
||||
mng_uint32 iHeight;
|
||||
mng_uint32 iTicks; /* these only after MHDR */
|
||||
mng_uint32 iLayercount;
|
||||
mng_uint32 iFramecount;
|
||||
mng_uint32 iPlaytime;
|
||||
mng_uint32 iSimplicity;
|
||||
mng_uint8 iAlphadepth; /* indicates expected alpha-depth */
|
||||
|
||||
mng_uint32 iImagelevel; /* level an image inside a stream */
|
||||
|
||||
mng_uint32 iCanvasstyle; /* layout of the drawing-canvas */
|
||||
mng_uint32 iBkgdstyle; /* layout of the background-canvas */
|
||||
|
||||
mng_int8 iMagnify; /* magnification factor (not used yet) */
|
||||
mng_uint32 iOffsetx; /* x-offset for extremely large image */
|
||||
mng_uint32 iOffsety; /* y-offset for extremely large image */
|
||||
mng_uint32 iCanvaswidth; /* real canvas size */
|
||||
mng_uint32 iCanvasheight; /* must be set by processheader callback */
|
||||
|
||||
mng_uint16 iBGred; /* default background color */
|
||||
mng_uint16 iBGgreen; /* initially "black" */
|
||||
mng_uint16 iBGblue;
|
||||
mng_bool bUseBKGD; /* preferred use of bKGD for PNG */
|
||||
|
||||
mng_bool bIssRGB; /* indicates sRGB system */
|
||||
|
||||
#ifdef MNG_FULL_CMS /* little CMS variables */
|
||||
mng_cmsprof hProf1; /* image input profile */
|
||||
mng_cmsprof hProf2; /* default output profile */
|
||||
mng_cmsprof hProf3; /* default sRGB profile */
|
||||
mng_cmstrans hTrans; /* current transformation handle */
|
||||
#endif
|
||||
|
||||
mng_float dViewgamma; /* gamma calculation variables */
|
||||
mng_float dDisplaygamma; /* initially set for sRGB conditions */
|
||||
mng_float dDfltimggamma;
|
||||
|
||||
mng_bool bStorechunks; /* switch for storing chunkdata */
|
||||
mng_bool bSectionbreaks; /* indicate NEEDSECTIONWAIT breaks */
|
||||
|
||||
mng_speedtype iSpeed; /* speed-modifier for animations */
|
||||
|
||||
mng_uint32 iMaxwidth; /* maximum canvas size */
|
||||
mng_uint32 iMaxheight; /* initially set to 1024 x 1024 */
|
||||
|
||||
mng_int32 iErrorcode; /* error reporting fields */
|
||||
mng_int8 iSeverity;
|
||||
mng_int32 iErrorx1;
|
||||
mng_int32 iErrorx2;
|
||||
mng_pchar zErrortext;
|
||||
|
||||
mng_memalloc fMemalloc; /* callback pointers */
|
||||
mng_memfree fMemfree; /* initially nulled */
|
||||
mng_openstream fOpenstream;
|
||||
mng_closestream fClosestream;
|
||||
mng_readdata fReaddata;
|
||||
mng_writedata fWritedata;
|
||||
mng_errorproc fErrorproc;
|
||||
mng_traceproc fTraceproc;
|
||||
mng_processheader fProcessheader;
|
||||
mng_processtext fProcesstext;
|
||||
mng_processsave fProcesssave;
|
||||
mng_processseek fProcessseek;
|
||||
mng_processneed fProcessneed;
|
||||
mng_processmend fProcessmend;
|
||||
mng_processunknown fProcessunknown;
|
||||
mng_getcanvasline fGetcanvasline;
|
||||
mng_getbkgdline fGetbkgdline;
|
||||
mng_getalphaline fGetalphaline;
|
||||
mng_refresh fRefresh;
|
||||
mng_gettickcount fGettickcount;
|
||||
mng_settimer fSettimer;
|
||||
mng_processgamma fProcessgamma;
|
||||
mng_processchroma fProcesschroma;
|
||||
mng_processsrgb fProcesssrgb;
|
||||
mng_processiccp fProcessiccp;
|
||||
mng_processarow fProcessarow;
|
||||
|
||||
#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
|
||||
mng_bool bPreDraft48; /* flags ancient style draft */
|
||||
|
||||
mng_chunkid iChunkname; /* read/write-state variables */
|
||||
mng_uint32 iChunkseq;
|
||||
mng_chunkp pFirstchunk; /* double-linked list of */
|
||||
mng_chunkp pLastchunk; /* stored chunk-structures */
|
||||
|
||||
mng_bool bHasheader; /* first header chunk processed */
|
||||
mng_bool bHasMHDR; /* inside a MHDR-MEND sequence */
|
||||
mng_bool bHasIHDR; /* inside a IHDR-IEND sequence */
|
||||
mng_bool bHasBASI; /* inside a BASI-IEND sequence */
|
||||
mng_bool bHasDHDR; /* inside a DHDR-IEND sequence */
|
||||
#ifdef MNG_INCLUDE_JNG
|
||||
mng_bool bHasJHDR; /* inside a JHDR-IEND sequence */
|
||||
mng_bool bHasJSEP; /* passed the JSEP separator */
|
||||
mng_bool bHasJDAA; /* at least 1 JDAA processed */
|
||||
mng_bool bHasJDAT; /* at least 1 JDAT processed */
|
||||
#endif
|
||||
mng_bool bHasPLTE; /* PLTE chunk processed */
|
||||
mng_bool bHasTRNS; /* tRNS chunk processed */
|
||||
mng_bool bHasGAMA; /* gAMA chunk processed */
|
||||
mng_bool bHasCHRM; /* cHRM chunk processed */
|
||||
mng_bool bHasSRGB; /* sRGB chunk processed */
|
||||
mng_bool bHasICCP; /* iCCP chunk processed */
|
||||
mng_bool bHasBKGD; /* bKGD chunk processed */
|
||||
mng_bool bHasIDAT; /* at least 1 IDAT processed */
|
||||
|
||||
mng_bool bHasSAVE; /* SAVE chunk processed */
|
||||
mng_bool bHasBACK; /* BACK chunk processed */
|
||||
mng_bool bHasFRAM; /* FRAM chunk processed */
|
||||
mng_bool bHasTERM; /* TERM chunk processed */
|
||||
mng_bool bHasLOOP; /* at least 1 LOOP open */
|
||||
|
||||
mng_bool bHasglobalPLTE; /* global PLTE chunk processed */
|
||||
mng_bool bHasglobalTRNS; /* global tRNS chunk processed */
|
||||
mng_bool bHasglobalGAMA; /* global gAMA chunk processed */
|
||||
mng_bool bHasglobalCHRM; /* global cHRM chunk processed */
|
||||
mng_bool bHasglobalSRGB; /* global sRGB chunk processed */
|
||||
mng_bool bHasglobalICCP; /* global iCCP chunk processed */
|
||||
mng_bool bHasglobalBKGD; /* global bKGD chunk processed */
|
||||
|
||||
mng_uint32 iDatawidth; /* IHDR/BASI/DHDR fields */
|
||||
mng_uint32 iDataheight; /* valid if inside IHDR-IEND, */
|
||||
mng_uint8 iBitdepth; /* BASI-IEND or DHDR-IEND */
|
||||
mng_uint8 iColortype;
|
||||
mng_uint8 iCompression;
|
||||
mng_uint8 iFilter;
|
||||
mng_uint8 iInterlace;
|
||||
|
||||
mng_uint32 iPLTEcount; /* PLTE fields */
|
||||
|
||||
mng_bool bEMNGMAhack; /* TODO: to be removed in 1.0.0 !!! */
|
||||
|
||||
#ifdef MNG_INCLUDE_JNG
|
||||
mng_uint8 iJHDRcolortype; /* JHDR fields */
|
||||
mng_uint8 iJHDRimgbitdepth; /* valid if inside JHDR-IEND */
|
||||
mng_uint8 iJHDRimgcompression;
|
||||
mng_uint8 iJHDRimginterlace;
|
||||
mng_uint8 iJHDRalphabitdepth;
|
||||
mng_uint8 iJHDRalphacompression;
|
||||
mng_uint8 iJHDRalphafilter;
|
||||
mng_uint8 iJHDRalphainterlace;
|
||||
#endif
|
||||
|
||||
#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */
|
||||
|
||||
#ifdef MNG_SUPPORT_READ
|
||||
mng_bool bReading; /* read processing variables */
|
||||
mng_bool bHavesig;
|
||||
mng_bool bEOF;
|
||||
mng_uint32 iReadbufsize;
|
||||
mng_uint8p pReadbuf;
|
||||
|
||||
mng_uint32 iLargebufsize; /* temp for very large chunks */
|
||||
mng_uint8p pLargebuf;
|
||||
|
||||
mng_uint32 iSuspendtime; /* tickcount at last suspension */
|
||||
mng_bool bSuspended; /* input-reading has been suspended;
|
||||
we're expecting a call to
|
||||
mng_read_resume! */
|
||||
mng_uint8 iSuspendpoint; /* indicates at which point the flow
|
||||
was broken to suspend input-reading */
|
||||
|
||||
mng_bool bSuspensionmode; /* I/O-suspension variables */
|
||||
mng_uint32 iSuspendbufsize;
|
||||
mng_uint8p pSuspendbuf;
|
||||
mng_uint8p pSuspendbufnext;
|
||||
mng_uint32 iSuspendbufleft;
|
||||
mng_uint32 iChunklen; /* chunk length */
|
||||
mng_uint8p pReadbufnext; /* 32K+ suspension-processing */
|
||||
#endif /* MNG_SUPPORT_READ */
|
||||
|
||||
#ifdef MNG_SUPPORT_WRITE
|
||||
mng_bool bCreating; /* create/write processing variables */
|
||||
mng_bool bWriting;
|
||||
mng_chunkid iFirstchunkadded;
|
||||
mng_uint32 iWritebufsize;
|
||||
mng_uint8p pWritebuf;
|
||||
#endif
|
||||
|
||||
#ifdef MNG_SUPPORT_DISPLAY
|
||||
mng_bool bDisplaying; /* display-state variables */
|
||||
mng_bool bFramedone;
|
||||
mng_uint32 iFrameseq;
|
||||
mng_uint32 iLayerseq;
|
||||
mng_uint32 iFrametime; /* millisecs */
|
||||
|
||||
mng_uint32 iRequestframe; /* go_xxxx variables */
|
||||
mng_uint32 iRequestlayer;
|
||||
mng_uint32 iRequesttime;
|
||||
mng_bool bSearching;
|
||||
|
||||
mng_bool bRestorebkgd; /* flags restore required before IDAT/JDAT */
|
||||
|
||||
mng_uint32 iRuntime; /* millisecs since start */
|
||||
mng_uint32 iSynctime; /* tickcount at last framesync */
|
||||
mng_uint32 iStarttime; /* tickcount at start */
|
||||
mng_uint32 iEndtime; /* tickcount at end */
|
||||
mng_bool bRunning; /* animation is active */
|
||||
mng_bool bTimerset; /* the timer has been set;
|
||||
we're expecting a call to
|
||||
mng_display_resume! */
|
||||
mng_uint8 iBreakpoint; /* indicates at which point the
|
||||
flow was broken to run the timer */
|
||||
mng_bool bSectionwait; /* indicates a section break */
|
||||
mng_bool bFreezing; /* indicates app requested a freeze */
|
||||
mng_bool bResetting; /* indicates app requested a reset */
|
||||
mng_bool bNeedrefresh; /* indicates screen-refresh is needed */
|
||||
mng_objectp pCurrentobj; /* current "object" */
|
||||
mng_objectp pCurraniobj; /* current animation object
|
||||
"to be"/"being" processed */
|
||||
mng_objectp pTermaniobj; /* TERM animation object */
|
||||
mng_uint32 iIterations; /* TERM/MEND iteration count */
|
||||
mng_objectp pObjzero; /* "on-the-fly" image (object = 0) */
|
||||
mng_objectp pLastclone; /* last clone */
|
||||
mng_objectp pStoreobj; /* current store object for row routines */
|
||||
mng_objectp pStorebuf; /* current store object-buffer for row routines */
|
||||
mng_objectp pRetrieveobj; /* current retrieve object for row routines */
|
||||
mng_savedatap pSavedata; /* pointer to saved data (after SAVE) */
|
||||
|
||||
mng_uint32 iUpdateleft; /* update region for refresh */
|
||||
mng_uint32 iUpdateright;
|
||||
mng_uint32 iUpdatetop;
|
||||
mng_uint32 iUpdatebottom;
|
||||
|
||||
mng_int8 iPass; /* current interlacing pass;
|
||||
negative value means no interlace */
|
||||
mng_int32 iRow; /* current row counter */
|
||||
mng_int32 iRowinc; /* row increment for this pass */
|
||||
mng_int32 iCol; /* current starting column */
|
||||
mng_int32 iColinc; /* column increment for this pass */
|
||||
mng_int32 iRowsamples; /* nr. of samples in current workrow */
|
||||
mng_int32 iSamplemul; /* needed to calculate rowsize */
|
||||
mng_int32 iSampleofs; /* from rowsamples */
|
||||
mng_int32 iSamplediv;
|
||||
mng_int32 iRowsize; /* size of actual data in work row */
|
||||
mng_int32 iRowmax; /* maximum size of data in work row */
|
||||
mng_int32 iFilterofs; /* offset to filter-byte in work row */
|
||||
mng_int32 iPixelofs; /* offset to pixel-bytes in work row */
|
||||
mng_uint32 iLevel0; /* leveling variables */
|
||||
mng_uint32 iLevel1;
|
||||
mng_uint32 iLevel2;
|
||||
mng_uint32 iLevel3;
|
||||
mng_uint8p pWorkrow; /* working row of pixel-data */
|
||||
mng_uint8p pPrevrow; /* previous row of pixel-data */
|
||||
mng_uint8p pRGBArow; /* intermediate row of RGBA8 or RGBA16 data */
|
||||
mng_bool bIsRGBA16; /* indicates intermediate row is RGBA16 */
|
||||
mng_bool bIsOpaque; /* indicates intermediate row is fully opaque */
|
||||
mng_int32 iFilterbpp; /* bpp index for filtering routines */
|
||||
|
||||
mng_int32 iSourcel; /* variables for showing objects */
|
||||
mng_int32 iSourcer;
|
||||
mng_int32 iSourcet;
|
||||
mng_int32 iSourceb;
|
||||
mng_int32 iDestl;
|
||||
mng_int32 iDestr;
|
||||
mng_int32 iDestt;
|
||||
mng_int32 iDestb;
|
||||
|
||||
mng_objectp pFirstimgobj; /* double-linked list of */
|
||||
mng_objectp pLastimgobj; /* image-object structures */
|
||||
mng_objectp pFirstaniobj; /* double-linked list of */
|
||||
mng_objectp pLastaniobj; /* animation-object structures */
|
||||
|
||||
#if defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS)
|
||||
mng_uint8 aGammatab[256]; /* precomputed gamma lookup table */
|
||||
mng_float dLastgamma; /* last gamma used to compute table */
|
||||
#endif
|
||||
|
||||
mng_fptr fDisplayrow; /* internal callback to display an
|
||||
uncompressed/unfiltered/
|
||||
color-corrected row */
|
||||
mng_fptr fRestbkgdrow; /* internal callback for restore-
|
||||
background processing of a row */
|
||||
mng_fptr fCorrectrow; /* internal callback to color-correct an
|
||||
uncompressed/unfiltered row */
|
||||
mng_fptr fRetrieverow; /* internal callback to retrieve an
|
||||
uncompressed/unfiltered row of data */
|
||||
mng_fptr fStorerow; /* internal callback to store an
|
||||
uncompressed/unfiltered row of data */
|
||||
mng_fptr fProcessrow; /* internal callback to process an
|
||||
uncompressed row of data */
|
||||
mng_fptr fDifferrow; /* internal callback to perform
|
||||
added filter leveling and
|
||||
differing on an unfiltered row */
|
||||
mng_fptr fScalerow; /* internal callback to scale a
|
||||
delta-row to the bitdepth of its target */
|
||||
mng_fptr fDeltarow; /* internal callback to execute a
|
||||
delta-row onto a target */
|
||||
mng_fptr fInitrowproc; /* internal callback to initialize
|
||||
the row processing */
|
||||
|
||||
mng_uint16 iDEFIobjectid; /* DEFI fields */
|
||||
mng_bool bDEFIhasdonotshow;
|
||||
mng_uint8 iDEFIdonotshow;
|
||||
mng_bool bDEFIhasconcrete;
|
||||
mng_uint8 iDEFIconcrete;
|
||||
mng_bool bDEFIhasloca;
|
||||
mng_int32 iDEFIlocax;
|
||||
mng_int32 iDEFIlocay;
|
||||
mng_bool bDEFIhasclip;
|
||||
mng_int32 iDEFIclipl;
|
||||
mng_int32 iDEFIclipr;
|
||||
mng_int32 iDEFIclipt;
|
||||
mng_int32 iDEFIclipb;
|
||||
|
||||
mng_uint16 iBACKred; /* BACK fields */
|
||||
mng_uint16 iBACKgreen;
|
||||
mng_uint16 iBACKblue;
|
||||
mng_uint8 iBACKmandatory;
|
||||
mng_uint16 iBACKimageid;
|
||||
mng_uint8 iBACKtile;
|
||||
|
||||
mng_uint8 iFRAMmode; /* FRAM fields (global) */
|
||||
mng_uint32 iFRAMdelay;
|
||||
mng_uint32 iFRAMtimeout;
|
||||
mng_bool bFRAMclipping;
|
||||
mng_int32 iFRAMclipl;
|
||||
mng_int32 iFRAMclipr;
|
||||
mng_int32 iFRAMclipt;
|
||||
mng_int32 iFRAMclipb;
|
||||
|
||||
mng_uint8 iFramemode; /* current subframe variables */
|
||||
mng_uint32 iFramedelay;
|
||||
mng_uint32 iFrametimeout;
|
||||
mng_bool bFrameclipping;
|
||||
mng_int32 iFrameclipl;
|
||||
mng_int32 iFrameclipr;
|
||||
mng_int32 iFrameclipt;
|
||||
mng_int32 iFrameclipb;
|
||||
|
||||
mng_uint32 iNextdelay; /* delay for *after* next image */
|
||||
|
||||
mng_uint8 iSHOWmode; /* SAVE fields */
|
||||
mng_uint16 iSHOWfromid;
|
||||
mng_uint16 iSHOWtoid;
|
||||
mng_uint16 iSHOWnextid;
|
||||
mng_int16 iSHOWskip;
|
||||
|
||||
mng_uint32 iGlobalPLTEcount; /* global PLTE fields */
|
||||
mng_rgbpaltab aGlobalPLTEentries;
|
||||
|
||||
mng_uint32 iGlobalTRNSrawlen; /* global tRNS fields */
|
||||
mng_uint8arr aGlobalTRNSrawdata;
|
||||
|
||||
mng_uint32 iGlobalGamma; /* global gAMA fields */
|
||||
|
||||
mng_uint32 iGlobalWhitepointx; /* global cHRM fields */
|
||||
mng_uint32 iGlobalWhitepointy;
|
||||
mng_uint32 iGlobalPrimaryredx;
|
||||
mng_uint32 iGlobalPrimaryredy;
|
||||
mng_uint32 iGlobalPrimarygreenx;
|
||||
mng_uint32 iGlobalPrimarygreeny;
|
||||
mng_uint32 iGlobalPrimarybluex;
|
||||
mng_uint32 iGlobalPrimarybluey;
|
||||
|
||||
mng_uint8 iGlobalRendintent; /* global sRGB fields */
|
||||
|
||||
mng_uint32 iGlobalProfilesize; /* global iCCP fields */
|
||||
mng_ptr pGlobalProfile;
|
||||
|
||||
mng_uint16 iGlobalBKGDred; /* global bKGD fields */
|
||||
mng_uint16 iGlobalBKGDgreen;
|
||||
mng_uint16 iGlobalBKGDblue;
|
||||
|
||||
mng_ptr pDeltaImage; /* delta-image fields */
|
||||
mng_uint8 iDeltaImagetype;
|
||||
mng_uint8 iDeltatype;
|
||||
mng_uint32 iDeltaBlockwidth;
|
||||
mng_uint32 iDeltaBlockheight;
|
||||
mng_uint32 iDeltaBlockx;
|
||||
mng_uint32 iDeltaBlocky;
|
||||
mng_bool bDeltaimmediate;
|
||||
|
||||
mng_fptr fDeltagetrow; /* internal delta-proc callbacks */
|
||||
mng_fptr fDeltaaddrow;
|
||||
mng_fptr fDeltareplacerow;
|
||||
mng_fptr fDeltaputrow;
|
||||
|
||||
mng_uint16 iMAGNfromid;
|
||||
mng_uint16 iMAGNtoid;
|
||||
#endif /* MNG_SUPPORT_DISPLAY */
|
||||
|
||||
#ifdef MNG_INCLUDE_ZLIB
|
||||
z_stream sZlib; /* zlib (de)compression variables */
|
||||
|
||||
mng_int32 iZlevel; /* zlib compression parameters */
|
||||
mng_int32 iZmethod;
|
||||
mng_int32 iZwindowbits;
|
||||
mng_int32 iZmemlevel;
|
||||
mng_int32 iZstrategy;
|
||||
|
||||
mng_uint32 iMaxIDAT; /* maximum size of IDAT data */
|
||||
|
||||
mng_bool bInflating; /* indicates "inflate" in progress */
|
||||
mng_bool bDeflating; /* indicates "deflate" in progress */
|
||||
#endif /* MNG_INCLUDE_ZLIB */
|
||||
|
||||
#ifdef MNG_INCLUDE_JNG
|
||||
mngjpeg_dctmethod eJPEGdctmethod; /* IJG compression variables */
|
||||
mng_int32 iJPEGquality;
|
||||
mng_int32 iJPEGsmoothing;
|
||||
mng_bool bJPEGcompressprogr;
|
||||
mng_bool bJPEGcompressopt;
|
||||
|
||||
mng_uint32 iMaxJDAT; /* maximum size of JDAT/JDAA data */
|
||||
|
||||
mngjpeg_compp pJPEGcinfo; /* compression structure */
|
||||
mngjpeg_errorp pJPEGcerr; /* error-manager compress */
|
||||
|
||||
mngjpeg_decompp pJPEGdinfo; /* decompression structure (JDAT) */
|
||||
mngjpeg_errorp pJPEGderr; /* error-manager decompress (JDAT) */
|
||||
mngjpeg_sourcep pJPEGdsrc; /* source-manager decompress (JDAT) */
|
||||
|
||||
mngjpeg_decompp pJPEGdinfo2; /* decompression structure (JDAA) */
|
||||
mngjpeg_errorp pJPEGderr2; /* error-manager decompress (JDAA) */
|
||||
mngjpeg_sourcep pJPEGdsrc2; /* source-manager decompress (JDAA) */
|
||||
|
||||
mng_uint8p pJPEGbuf; /* buffer for JPEG (de)compression (JDAT) */
|
||||
mng_uint32 iJPEGbufmax; /* allocated space for buffer (JDAT) */
|
||||
mng_uint8p pJPEGcurrent; /* current pointer into buffer (JDAT) */
|
||||
mng_uint32 iJPEGbufremain; /* remaining bytes in buffer (JDAT) */
|
||||
mng_uint32 iJPEGtoskip; /* bytes to skip on next input-block (JDAT) */
|
||||
|
||||
mng_uint8p pJPEGbuf2; /* buffer for JPEG (de)compression (JDAA) */
|
||||
mng_uint32 iJPEGbufmax2; /* allocated space for buffer (JDAA) */
|
||||
mng_uint8p pJPEGcurrent2; /* current pointer into buffer (JDAA) */
|
||||
mng_uint32 iJPEGbufremain2; /* remaining bytes in buffer (JDAA) */
|
||||
mng_uint32 iJPEGtoskip2; /* bytes to skip on next input-block (JDAA) */
|
||||
|
||||
mng_uint8p pJPEGrow; /* buffer for a JPEG row of samples (JDAT) */
|
||||
mng_uint32 iJPEGrowlen;
|
||||
|
||||
mng_uint8p pJPEGrow2; /* buffer for a JPEG row of samples (JDAA) */
|
||||
mng_uint32 iJPEGrowlen2;
|
||||
|
||||
mng_bool bJPEGcompress; /* indicates "compress" initialized */
|
||||
|
||||
mng_bool bJPEGdecompress; /* indicates "decompress" initialized (JDAT) */
|
||||
mng_bool bJPEGhasheader; /* indicates "readheader" succeeded (JDAT) */
|
||||
mng_bool bJPEGdecostarted; /* indicates "decompress" started (JDAT) */
|
||||
mng_bool bJPEGscanstarted; /* indicates "first scan" started (JDAT) */
|
||||
mng_bool bJPEGprogressive; /* indicates a progressive image (JDAT) */
|
||||
|
||||
mng_bool bJPEGdecompress2; /* indicates "decompress" initialized (JDAA) */
|
||||
mng_bool bJPEGhasheader2; /* indicates "readheader" succeeded (JDAA) */
|
||||
mng_bool bJPEGdecostarted2; /* indicates "decompress" started (JDAA) */
|
||||
mng_bool bJPEGscanstarted2; /* indicates "first scan" started (JDAA) */
|
||||
mng_bool bJPEGprogressive2; /* indicates a progressive image (JDAA) */
|
||||
|
||||
mng_fptr fStorerow2; /* internal callback to store an
|
||||
uncompressed/unfiltered row of JPEG-data (JDAT) */
|
||||
|
||||
mng_fptr fStorerow3; /* internal callback to store an
|
||||
uncompressed/unfiltered row of JPEG-data (JDAA) */
|
||||
|
||||
mng_uint32 iJPEGrow; /* row-number for current JPEG row */
|
||||
mng_uint32 iJPEGalpharow; /* nr. of rows filled with alpha */
|
||||
mng_uint32 iJPEGrgbrow; /* nr. of rows filled with 'color'-info */
|
||||
mng_uint32 iJPEGdisprow; /* nr. of rows already displayed "on-the-fly" */
|
||||
|
||||
#if defined(MNG_USE_SETJMP) && defined (MNG_INCLUDE_IJG6B)
|
||||
jmp_buf sErrorbuf; /* setjmp/longjmp buffer (error-recovery) */
|
||||
#endif
|
||||
|
||||
#endif /* MNG_INCLUDE_JNG */
|
||||
|
||||
mng_uint32 aCRCtable [256]; /* CRC prefab table */
|
||||
mng_bool bCRCcomputed; /* "has been build" indicator */
|
||||
|
||||
} mng_data;
|
||||
|
||||
typedef mng_data * mng_datap;
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Internal Callback-Function prototypes * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef mng_retcode(*mng_displayrow) (mng_datap pData);
|
||||
typedef mng_retcode(*mng_restbkgdrow) (mng_datap pData);
|
||||
typedef mng_retcode(*mng_correctrow) (mng_datap pData);
|
||||
typedef mng_retcode(*mng_retrieverow) (mng_datap pData);
|
||||
typedef mng_retcode(*mng_storerow) (mng_datap pData);
|
||||
typedef mng_retcode(*mng_processrow) (mng_datap pData);
|
||||
typedef mng_retcode(*mng_initrowproc) (mng_datap pData);
|
||||
typedef mng_retcode(*mng_differrow) (mng_datap pData);
|
||||
typedef mng_retcode(*mng_scalerow) (mng_datap pData);
|
||||
typedef mng_retcode(*mng_deltarow) (mng_datap pData);
|
||||
|
||||
typedef mng_retcode(*mng_magnify_x) (mng_datap pData,
|
||||
mng_uint16 iMX,
|
||||
mng_uint16 iML,
|
||||
mng_uint16 iMR,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p iSrcline,
|
||||
mng_uint8p iDstline);
|
||||
typedef mng_retcode(*mng_magnify_y) (mng_datap pData,
|
||||
mng_int32 iM,
|
||||
mng_int32 iS,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p iSrcline1,
|
||||
mng_uint8p iSrcline2,
|
||||
mng_uint8p iDstline);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Routines for swapping byte-order from and to graphic files * */
|
||||
/* * (This code is adapted from the libpng package) * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef MNG_BIGENDIAN_SUPPORTED
|
||||
mng_uint32 mng_get_uint32 (mng_uint8p pBuf);
|
||||
mng_int32 mng_get_int32 (mng_uint8p pBuf);
|
||||
mng_uint16 mng_get_uint16 (mng_uint8p pBuf);
|
||||
void mng_put_uint32 (mng_uint8p pBuf,
|
||||
mng_uint32 i);
|
||||
void mng_put_int32 (mng_uint8p pBuf,
|
||||
mng_int32 i);
|
||||
void mng_put_uint16 (mng_uint8p pBuf,
|
||||
mng_uint16 i);
|
||||
#else /* MNG_BIGENDIAN_SUPPORTED */
|
||||
#define mng_get_uint32(P) *(mng_uint32p)(P)
|
||||
#define mng_get_int32(P) *(mng_int32p)(P)
|
||||
#define mng_get_uint16(P) *(mng_uint16p)(P)
|
||||
#define mng_put_uint32(P,I) *(mng_uint32p)(P) = (I)
|
||||
#define mng_put_int32(P,I) *(mng_int32p)(P) = (I)
|
||||
#define mng_put_uint16(P,I) *(mng_uint16p)(P) = (I)
|
||||
#endif /* MNG_BIGENDIAN_SUPPORTED */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Some handy(?) macro definitions * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#define MAX_COORD(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define MIN_COORD(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* _libmng_data_h_ */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,195 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_display.h copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : Display management (definition) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * comment : Definition of the display managament routines * */
|
||||
/* * * */
|
||||
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
|
||||
/* * - changed strict-ANSI stuff * */
|
||||
/* * * */
|
||||
/* * 0.5.2 - 05/20/2000 - G.Juyn * */
|
||||
/* * - added JNG support stuff * */
|
||||
/* * * */
|
||||
/* * 0.5.3 - 06/16/2000 - G.Juyn * */
|
||||
/* * - changed progressive-display processing * */
|
||||
/* * 0.5.3 - 06/22/2000 - G.Juyn * */
|
||||
/* * - added support for delta-image processing * */
|
||||
/* * - added support for PPLT chunk processing * */
|
||||
/* * * */
|
||||
/* * 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/26/2000 - G.Juyn * */
|
||||
/* * - added MAGN chunk * */
|
||||
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
|
||||
/* * - added JDAA chunk * */
|
||||
/* * * */
|
||||
/* * 0.9.4 - 11/24/2000 - G.Juyn * */
|
||||
/* * - moved restore of object 0 to libmng_display * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* force ANSI-C */
|
||||
#endif
|
||||
|
||||
#ifndef _libmng_display_h_
|
||||
#define _libmng_display_h_
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode display_progressive_refresh (mng_datap pData,
|
||||
mng_uint32 iInterval);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode mng_reset_objzero (mng_datap pData);
|
||||
|
||||
mng_retcode display_image (mng_datap pData,
|
||||
mng_imagep pImage,
|
||||
mng_bool bLayeradvanced);
|
||||
|
||||
mng_retcode execute_delta_image (mng_datap pData,
|
||||
mng_imagep pTarget,
|
||||
mng_imagep pDelta);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode process_display (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode process_display_ihdr (mng_datap pData);
|
||||
|
||||
mng_retcode process_display_idat (mng_datap pData,
|
||||
mng_uint32 iRawlen,
|
||||
mng_uint8p pRawdata);
|
||||
|
||||
mng_retcode process_display_iend (mng_datap pData);
|
||||
mng_retcode process_display_mend (mng_datap pData);
|
||||
mng_retcode process_display_defi (mng_datap pData);
|
||||
|
||||
mng_retcode process_display_basi (mng_datap pData,
|
||||
mng_uint16 iRed,
|
||||
mng_uint16 iGreen,
|
||||
mng_uint16 iBlue,
|
||||
mng_bool bHasalpha,
|
||||
mng_uint16 iAlpha,
|
||||
mng_uint8 iViewable);
|
||||
|
||||
mng_retcode process_display_clon (mng_datap pData,
|
||||
mng_uint16 iSourceid,
|
||||
mng_uint16 iCloneid,
|
||||
mng_uint8 iClonetype,
|
||||
mng_bool bHasdonotshow,
|
||||
mng_uint8 iDonotshow,
|
||||
mng_uint8 iConcrete,
|
||||
mng_bool bHasloca,
|
||||
mng_uint8 iLocationtype,
|
||||
mng_int32 iLocationx,
|
||||
mng_int32 iLocationy);
|
||||
mng_retcode process_display_clon2 (mng_datap pData);
|
||||
|
||||
mng_retcode process_display_disc (mng_datap pData,
|
||||
mng_uint32 iCount,
|
||||
mng_uint16p pIds);
|
||||
|
||||
mng_retcode process_display_fram (mng_datap pData,
|
||||
mng_uint8 iFramemode,
|
||||
mng_uint8 iChangedelay,
|
||||
mng_uint32 iDelay,
|
||||
mng_uint8 iChangetimeout,
|
||||
mng_uint32 iTimeout,
|
||||
mng_uint8 iChangeclipping,
|
||||
mng_uint8 iCliptype,
|
||||
mng_int32 iClipl,
|
||||
mng_int32 iClipr,
|
||||
mng_int32 iClipt,
|
||||
mng_int32 iClipb);
|
||||
mng_retcode process_display_fram2 (mng_datap pData);
|
||||
|
||||
mng_retcode process_display_move (mng_datap pData,
|
||||
mng_uint16 iFromid,
|
||||
mng_uint16 iToid,
|
||||
mng_uint8 iMovetype,
|
||||
mng_int32 iMovex,
|
||||
mng_int32 iMovey);
|
||||
|
||||
mng_retcode process_display_clip (mng_datap pData,
|
||||
mng_uint16 iFromid,
|
||||
mng_uint16 iToid,
|
||||
mng_uint8 iCliptype,
|
||||
mng_int32 iClipl,
|
||||
mng_int32 iClipr,
|
||||
mng_int32 iClipt,
|
||||
mng_int32 iClipb);
|
||||
|
||||
mng_retcode process_display_show (mng_datap pData);
|
||||
mng_retcode process_display_save (mng_datap pData);
|
||||
mng_retcode process_display_seek (mng_datap pData);
|
||||
mng_retcode process_display_jhdr (mng_datap pData);
|
||||
|
||||
mng_retcode process_display_jdaa (mng_datap pData,
|
||||
mng_uint32 iRawlen,
|
||||
mng_uint8p pRawdata);
|
||||
|
||||
mng_retcode process_display_jdat (mng_datap pData,
|
||||
mng_uint32 iRawlen,
|
||||
mng_uint8p pRawdata);
|
||||
|
||||
mng_retcode process_display_dhdr (mng_datap pData,
|
||||
mng_uint16 iObjectid,
|
||||
mng_uint8 iImagetype,
|
||||
mng_uint8 iDeltatype,
|
||||
mng_uint32 iBlockwidth,
|
||||
mng_uint32 iBlockheight,
|
||||
mng_uint32 iBlockx,
|
||||
mng_uint32 iBlocky);
|
||||
|
||||
mng_retcode process_display_prom (mng_datap pData,
|
||||
mng_uint8 iBitdepth,
|
||||
mng_uint8 iColortype,
|
||||
mng_uint8 iFilltype);
|
||||
|
||||
mng_retcode process_display_ipng (mng_datap pData);
|
||||
mng_retcode process_display_ijng (mng_datap pData);
|
||||
|
||||
mng_retcode process_display_pplt (mng_datap pData,
|
||||
mng_uint8 iType,
|
||||
mng_uint32 iCount,
|
||||
mng_palette8ep paIndexentries,
|
||||
mng_uint8p paAlphaentries,
|
||||
mng_uint8p paUsedentries);
|
||||
|
||||
mng_retcode process_display_magn (mng_datap pData,
|
||||
mng_uint16 iFirstid,
|
||||
mng_uint16 iLastid,
|
||||
mng_uint16 iMethodX,
|
||||
mng_uint16 iMX,
|
||||
mng_uint16 iMY,
|
||||
mng_uint16 iML,
|
||||
mng_uint16 iMR,
|
||||
mng_uint16 iMT,
|
||||
mng_uint16 iMB,
|
||||
mng_uint16 iMethodY);
|
||||
mng_retcode process_display_magn2 (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* _libmng_display_h_ */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
@@ -1,54 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_dither.c copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : Dithering routines (implementation) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * comment : implementation of the dithering 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 * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libmng.h"
|
||||
#include "libmng_data.h"
|
||||
#include "libmng_error.h"
|
||||
#include "libmng_trace.h"
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
#include "libmng_dither.h"
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* force ANSI-C */
|
||||
#endif
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode dither_a_row (mng_datap pData,
|
||||
mng_uint8p pRow)
|
||||
{
|
||||
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_dither.h copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : Dithering routines (definition) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * comment : Definition of the dithering 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 * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* force ANSI-C */
|
||||
#endif
|
||||
|
||||
#ifndef _libmng_dither_h_
|
||||
#define _libmng_dither_h_
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode dither_a_row (mng_datap pData,
|
||||
mng_uint8p pRow);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* _libmng_dither_h_ */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
@@ -1,267 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_error.c copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : Error routines (implementation) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * comment : implementation of the general error handling routines * */
|
||||
/* * * */
|
||||
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
|
||||
/* * - changed strict-ANSI stuff * */
|
||||
/* * * */
|
||||
/* * 0.5.2 - 05/23/2000 - G.Juyn * */
|
||||
/* * - added error telltaling * */
|
||||
/* * 0.5.2 - 05/30/2000 - G.Juyn * */
|
||||
/* * - added errorstrings for delta-image processing * */
|
||||
/* * 0.5.2 - 05/31/2000 - G.Juyn * */
|
||||
/* * - fixed up punctuation (contributed by Tim Rowley) * */
|
||||
/* * 0.5.2 - 06/06/2000 - G.Juyn * */
|
||||
/* * - added errorstring for delayed buffer-processing * */
|
||||
/* * * */
|
||||
/* * 0.9.1 - 07/06/2000 - G.Juyn * */
|
||||
/* * - added MNG_NEEDTIMERWAIT errorstring * */
|
||||
/* * 0.9.1 - 07/15/2000 - G.Juyn * */
|
||||
/* * - added NEEDSECTIONWAIT errorstring * */
|
||||
/* * - added macro + routine to set returncode without * */
|
||||
/* * calling error callback * */
|
||||
/* * 0.9.1 - 07/19/2000 - G.Juyn * */
|
||||
/* * - added errorstring for updatemngheader if not a MNG * */
|
||||
/* * * */
|
||||
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
|
||||
/* * - changed file-prefixes * */
|
||||
/* * * */
|
||||
/* * 0.9.3 - 08/09/2000 - G.Juyn * */
|
||||
/* * - added check for simplicity-bits in MHDR * */
|
||||
/* * 0.9.3 - 10/11/2000 - G.Juyn * */
|
||||
/* * - fixed processing of unknown critical chunks * */
|
||||
/* * - added support for nEED * */
|
||||
/* * 0.9.3 - 10/20/2000 - G.Juyn * */
|
||||
/* * - added errorcode for delayed delta-processing * */
|
||||
/* * * */
|
||||
/* * 0.9.4 - 1/18/2001 - G.Juyn * */
|
||||
/* * - added errorcode for MAGN methods * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#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_ERROR_STRINGS
|
||||
mng_error_entry error_table [] =
|
||||
{
|
||||
{MNG_NOERROR, "No error"},
|
||||
{MNG_OUTOFMEMORY, "Out of memory"},
|
||||
{MNG_INVALIDHANDLE, "The handle is invalid"},
|
||||
{MNG_NOCALLBACK, "A required callback is not defined"},
|
||||
{MNG_UNEXPECTEDEOF, "Encountered unexpected end-of-file"},
|
||||
{MNG_ZLIBERROR, "zlib encountered an error"},
|
||||
{MNG_JPEGERROR, "ijgsrc6b encountered an error"},
|
||||
{MNG_LCMSERROR, "lcms encountered an error"},
|
||||
{MNG_NOOUTPUTPROFILE, "No output-profile defined for CMS"},
|
||||
{MNG_NOSRGBPROFILE, "No sRGB-profile defined for CMS"},
|
||||
{MNG_BUFOVERFLOW, "Internal buffer-overflow"},
|
||||
{MNG_FUNCTIONINVALID, "Function is invalid at this point"},
|
||||
{MNG_OUTPUTERROR, "Writing was unsuccessful; disk full?"},
|
||||
{MNG_JPEGBUFTOOSMALL, "Internal buffer for JPEG processing too small"},
|
||||
{MNG_NEEDMOREDATA, "Reading suspended; waiting for I/O to catch up"},
|
||||
{MNG_NEEDTIMERWAIT, "Timer suspension; normal animation delay"},
|
||||
{MNG_NEEDSECTIONWAIT, "SEEK suspension; application decides"},
|
||||
|
||||
{MNG_APPIOERROR, "Application signalled I/O error"},
|
||||
{MNG_APPTIMERERROR, "Application signalled timing error"},
|
||||
{MNG_APPCMSERROR, "Application signalled CMS error"},
|
||||
{MNG_APPMISCERROR, "Application signalled an error"},
|
||||
{MNG_APPTRACEABORT, "Application signalled error during trace-callback"},
|
||||
|
||||
{MNG_INTERNALERROR, "Internal error in libmng"},
|
||||
|
||||
{MNG_INVALIDSIG, "The signature is invalid"},
|
||||
{MNG_INVALIDCRC, "The CRC for this chunk is invalid"},
|
||||
{MNG_INVALIDLENGTH, "Chunk-length is invalid"},
|
||||
{MNG_SEQUENCEERROR, "Chunk out of sequence"},
|
||||
{MNG_CHUNKNOTALLOWED, "Chunk not allowed at this point"},
|
||||
{MNG_MULTIPLEERROR, "Chunk cannot occur multiple times"},
|
||||
{MNG_PLTEMISSING, "Missing PLTE chunk"},
|
||||
{MNG_IDATMISSING, "Missing IDAT chunk(s)"},
|
||||
{MNG_CANNOTBEEMPTY, "Chunk cannot be empty"},
|
||||
{MNG_GLOBALLENGTHERR, "Global data length invalid"},
|
||||
{MNG_INVALIDBITDEPTH, "The bit_depth is invalid"},
|
||||
{MNG_INVALIDCOLORTYPE, "The color_type is invalid"},
|
||||
{MNG_INVALIDCOMPRESS, "The compression_method is invalid"},
|
||||
{MNG_INVALIDFILTER, "The filter_method or filter_type is invalid"},
|
||||
{MNG_INVALIDINTERLACE, "The interlace_method is invalid"},
|
||||
{MNG_NOTENOUGHIDAT, "There is not enough data in the IDAT chunk(s)"},
|
||||
{MNG_PLTEINDEXERROR, "Palette-index out of bounds"},
|
||||
{MNG_NULLNOTFOUND, "NULL separator not found"},
|
||||
{MNG_KEYWORDNULL, "Keyword cannot be zero-length"},
|
||||
{MNG_OBJECTUNKNOWN, "Object does not exist"},
|
||||
{MNG_OBJECTEXISTS, "Object already exists"},
|
||||
{MNG_TOOMUCHIDAT, "Too much data in IDAT chunk(s)"},
|
||||
{MNG_INVSAMPLEDEPTH, "The sample_depth is invalid"},
|
||||
{MNG_INVOFFSETSIZE, "The offset_type is invalid"},
|
||||
{MNG_INVENTRYTYPE, "The entry_type is invalid"},
|
||||
{MNG_ENDWITHNULL, "Chunk must not end with NULL byte"},
|
||||
{MNG_INVIMAGETYPE, "The image_type is invalid"},
|
||||
{MNG_INVDELTATYPE, "The delta_type is invalid"},
|
||||
{MNG_INVALIDINDEX, "Index-value out of bounds"},
|
||||
{MNG_TOOMUCHJDAT, "Too much data in JDAT chunk(s)"},
|
||||
{MNG_JPEGPARMSERR, "JHDR parameters & JFIF-data do not match"},
|
||||
{MNG_INVFILLMETHOD, "The fill_method is invalid"},
|
||||
{MNG_OBJNOTCONCRETE, "Target object for DHDR must be concrete"},
|
||||
{MNG_TARGETNOALPHA, "Target object must have alpha-channel"},
|
||||
{MNG_MNGTOOCOMPLEX, "MHDR simplicity indicates unsupported feature(s)"},
|
||||
{MNG_UNKNOWNCRITICAL, "Unknown critical chunk encountered"},
|
||||
{MNG_UNSUPPORTEDNEED, "Requested nEED resources are not supported"},
|
||||
{MNG_INVALIDDELTA, "The delta operation is invalid (mismatched color_types?)"},
|
||||
{MNG_INVALIDMETHOD, "Method is invalid"},
|
||||
|
||||
{MNG_INVALIDCNVSTYLE, "Canvas_style is invalid"},
|
||||
{MNG_WRONGCHUNK, "Attempt to access the wrong chunk"},
|
||||
{MNG_INVALIDENTRYIX, "Attempt to access an non-existing entry"},
|
||||
{MNG_NOHEADER, "No valid header-chunk"},
|
||||
{MNG_NOCORRCHUNK, "Parent chunk not found"},
|
||||
{MNG_NOMHDR, "No MNG header (MHDR) found"},
|
||||
|
||||
{MNG_IMAGETOOLARGE, "Image is larger than defined maximum"},
|
||||
{MNG_NOTANANIMATION, "Image is not an animation"},
|
||||
{MNG_FRAMENRTOOHIGH, "Framenr out of bounds"},
|
||||
{MNG_LAYERNRTOOHIGH, "Layernr out of bounds"},
|
||||
{MNG_PLAYTIMETOOHIGH, "Playtime out of bounds"},
|
||||
{MNG_FNNOTIMPLEMENTED, "Function not yet implemented"},
|
||||
{MNG_IMAGEFROZEN, "Image is frozen"},
|
||||
|
||||
{MNG_LCMS_NOHANDLE, "Handle could not be initialized"},
|
||||
{MNG_LCMS_NOMEM, "No memory for gamma-table(s)"},
|
||||
{MNG_LCMS_NOTRANS, "Transformation could not be initialized"},
|
||||
};
|
||||
#endif /* MNG_INCLUDE_ERROR_STRINGS */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_bool mng_store_error (mng_datap pData,
|
||||
mng_retcode iError,
|
||||
mng_retcode iExtra1,
|
||||
mng_retcode iExtra2)
|
||||
{
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACEB (pData, MNG_FN_STORE_ERROR, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
if (pData != 0)
|
||||
{
|
||||
pData->iErrorcode = iError; /* save also for getlasterror */
|
||||
pData->iErrorx1 = iExtra1;
|
||||
pData->iErrorx2 = iExtra2;
|
||||
|
||||
#ifdef MNG_INCLUDE_ERROR_STRINGS
|
||||
{ /* binary search variables */
|
||||
mng_int32 iTop, iLower, iUpper, iMiddle;
|
||||
mng_error_entryp pEntry; /* pointer to found entry */
|
||||
/* determine max index of table */
|
||||
iTop = (sizeof (error_table) / sizeof (error_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 (error_table [iMiddle].iError < iError)
|
||||
iLower = iMiddle + 1;
|
||||
else if (error_table [iMiddle].iError > iError)
|
||||
iUpper = iMiddle - 1;
|
||||
else
|
||||
{
|
||||
pEntry = &error_table [iMiddle];
|
||||
break;
|
||||
}
|
||||
|
||||
iMiddle = (iLower + iUpper) >> 1;
|
||||
}
|
||||
while (iLower <= iUpper);
|
||||
|
||||
if (pEntry) /* found it ? */
|
||||
pData->zErrortext = pEntry->zErrortext;
|
||||
else
|
||||
pData->zErrortext = "Unknown error";
|
||||
}
|
||||
#else
|
||||
pData->zErrortext = 0;
|
||||
#endif /* mng_error_telltale */
|
||||
|
||||
if (iError == 0) /* no error is not severe ! */
|
||||
{
|
||||
pData->iSeverity = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (iError&0x3C00) /* determine the severity */
|
||||
{
|
||||
case 0x0800 : { pData->iSeverity = 5; break; }
|
||||
case 0x1000 : { pData->iSeverity = 2; break; }
|
||||
case 0x2000 : { pData->iSeverity = 1; break; }
|
||||
default : { pData->iSeverity = 9; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACEB (pData, MNG_FN_STORE_ERROR, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_TRUE;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_bool mng_process_error (mng_datap pData,
|
||||
mng_retcode iError,
|
||||
mng_retcode iExtra1,
|
||||
mng_retcode iExtra2)
|
||||
{
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACEB (pData, MNG_FN_PROCESS_ERROR, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
mng_store_error (pData, iError, iExtra1, iExtra2);
|
||||
|
||||
if (pData != 0)
|
||||
{
|
||||
if (pData->fErrorproc) /* callback defined ? */
|
||||
return pData->fErrorproc (((mng_handle)pData), iError, pData->iSeverity,
|
||||
pData->iChunkname, pData->iChunkseq,
|
||||
pData->iErrorx1, pData->iErrorx2, pData->zErrortext);
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACEB (pData, MNG_FN_PROCESS_ERROR, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_FALSE; /* automatic failure */
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_error.h copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : Error functions (definition) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * comment : Definition of the generic error-codes and functions * */
|
||||
/* * * */
|
||||
/* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */
|
||||
/* * - added some errorcodes * */
|
||||
/* * 0.5.1 - 05/08/2000 - G.Juyn * */
|
||||
/* * - added some errorcodes * */
|
||||
/* * - changed strict-ANSI stuff * */
|
||||
/* * 0.5.1 - 05/11/2000 - G.Juyn * */
|
||||
/* * - added application errorcodes (used with callbacks) * */
|
||||
/* * - moved chunk-access errorcodes to severity 5 * */
|
||||
/* * * */
|
||||
/* * 0.5.2 - 05/20/2000 - G.Juyn * */
|
||||
/* * - added JNG errorcodes * */
|
||||
/* * 0.5.2 - 05/23/2000 - G.Juyn * */
|
||||
/* * - added error tell-tale definition * */
|
||||
/* * 0.5.2 - 05/30/2000 - G.Juyn * */
|
||||
/* * - added errorcodes for delta-image processing * */
|
||||
/* * 0.5.2 - 06/06/2000 - G.Juyn * */
|
||||
/* * - added errorcode for delayed buffer-processing * */
|
||||
/* * - moved errorcodes to "libmng.h" * */
|
||||
/* * * */
|
||||
/* * 0.9.1 - 07/15/2000 - G.Juyn * */
|
||||
/* * - added macro + routine to set returncode without * */
|
||||
/* * calling error callback * */
|
||||
/* * * */
|
||||
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
|
||||
/* * - changed file-prefixes * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* force ANSI-C */
|
||||
#endif
|
||||
|
||||
#ifndef _libmng_error_h_
|
||||
#define _libmng_error_h_
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Default error routines * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_bool mng_store_error (mng_datap pData,
|
||||
mng_retcode iError,
|
||||
mng_retcode iExtra1,
|
||||
mng_retcode iExtra2);
|
||||
|
||||
mng_bool mng_process_error (mng_datap pData,
|
||||
mng_retcode iError,
|
||||
mng_retcode iExtra1,
|
||||
mng_retcode iExtra2);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Error handling macros * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#define MNG_ERROR(D,C) { mng_process_error (D, C, 0, 0); return C; }
|
||||
#define MNG_ERRORZ(D,Z) { mng_process_error (D, MNG_ZLIBERROR, Z, 0); return MNG_ZLIBERROR; }
|
||||
#define MNG_ERRORJ(D,J) { mng_process_error (D, MNG_JPEGERROR, J, 0); return MNG_JPEGERROR; }
|
||||
#define MNG_ERRORL(D,L) { mng_process_error (D, MNG_LCMSERROR, L, 0); return MNG_LCMSERROR; }
|
||||
|
||||
#define MNG_RETURN(D,C) { mng_store_error (D, C, 0, 0); return C; }
|
||||
|
||||
#define MNG_WARNING(D,C) { if (!mng_process_error (D, C, 0, 0)) return C; }
|
||||
|
||||
#define MNG_VALIDHANDLE(H) { if ((H == 0) || (((mng_datap)H)->iMagic != MNG_MAGIC)) \
|
||||
return MNG_INVALIDHANDLE; }
|
||||
#define MNG_VALIDHANDLEX(H) { if ((H == 0) || (((mng_datap)H)->iMagic != MNG_MAGIC)) \
|
||||
return 0; }
|
||||
#define MNG_VALIDCB(D,C) { if (!((mng_datap)D)->C) \
|
||||
MNG_ERROR (((mng_datap)D), MNG_NOCALLBACK) }
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Error string-table entry * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct {
|
||||
mng_retcode iError;
|
||||
mng_pchar zErrortext;
|
||||
} mng_error_entry;
|
||||
typedef mng_error_entry * mng_error_entryp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* _libmng_error_h_ */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
@@ -1,890 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_filter.c copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : Filtering routines (implementation) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * comment : implementation of the filtering 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.9.2 - 08/05/2000 - G.Juyn * */
|
||||
/* * - changed file-prefixes * */
|
||||
/* * * */
|
||||
/* * 0.9.3 - 09/07/2000 - G.Juyn * */
|
||||
/* * - added support for new filter_types * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libmng.h"
|
||||
#include "libmng_data.h"
|
||||
#include "libmng_error.h"
|
||||
#include "libmng_trace.h"
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
#include "libmng_filter.h"
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* force ANSI-C */
|
||||
#endif
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifdef MNG_INCLUDE_FILTERS
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode filter_a_row (mng_datap pData)
|
||||
{
|
||||
mng_retcode iRetcode;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_FILTER_A_ROW, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
switch (*(pData->pWorkrow + pData->iFilterofs))
|
||||
{
|
||||
case 1 : {
|
||||
iRetcode = filter_sub (pData);
|
||||
break;
|
||||
}
|
||||
case 2 : {
|
||||
iRetcode = filter_up (pData);
|
||||
break;
|
||||
}
|
||||
case 3 : {
|
||||
iRetcode = filter_average (pData);
|
||||
break;
|
||||
}
|
||||
case 4 : {
|
||||
iRetcode = filter_paeth (pData);
|
||||
break;
|
||||
}
|
||||
|
||||
default : iRetcode = MNG_INVALIDFILTER;
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_FILTER_A_ROW, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return iRetcode;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode filter_sub (mng_datap pData)
|
||||
{
|
||||
mng_uint32 iBpp;
|
||||
mng_uint8p pRawx;
|
||||
mng_uint8p pRawx_prev;
|
||||
mng_int32 iX;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_FILTER_SUB, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
iBpp = pData->iFilterbpp;
|
||||
pRawx = pData->pWorkrow + pData->iPixelofs + iBpp;
|
||||
pRawx_prev = pData->pWorkrow + pData->iPixelofs;
|
||||
|
||||
for (iX = iBpp; iX < pData->iRowsize; iX++)
|
||||
{
|
||||
*pRawx = (mng_uint8)(*pRawx + *pRawx_prev);
|
||||
pRawx++;
|
||||
pRawx_prev++;
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_FILTER_SUB, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode filter_up (mng_datap pData)
|
||||
{
|
||||
mng_uint8p pRawx;
|
||||
mng_uint8p pPriorx;
|
||||
mng_int32 iX;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_FILTER_UP, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
pRawx = pData->pWorkrow + pData->iPixelofs;
|
||||
pPriorx = pData->pPrevrow + pData->iPixelofs;
|
||||
|
||||
for (iX = 0; iX < pData->iRowsize; iX++)
|
||||
{
|
||||
*pRawx = (mng_uint8)(*pRawx + *pPriorx);
|
||||
pRawx++;
|
||||
pPriorx++;
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_FILTER_UP, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode filter_average (mng_datap pData)
|
||||
{
|
||||
mng_int32 iBpp;
|
||||
mng_uint8p pRawx;
|
||||
mng_uint8p pRawx_prev;
|
||||
mng_uint8p pPriorx;
|
||||
mng_int32 iX;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_FILTER_AVERAGE, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
iBpp = pData->iFilterbpp;
|
||||
pRawx = pData->pWorkrow + pData->iPixelofs;
|
||||
pPriorx = pData->pPrevrow + pData->iPixelofs;
|
||||
pRawx_prev = pData->pWorkrow + pData->iPixelofs;
|
||||
|
||||
for (iX = 0; iX < iBpp; iX++)
|
||||
{
|
||||
*pRawx = (mng_uint8)(*pRawx + ((*pPriorx) >> 1));
|
||||
pRawx++;
|
||||
pPriorx++;
|
||||
}
|
||||
|
||||
for (iX = iBpp; iX < pData->iRowsize; iX++)
|
||||
{
|
||||
*pRawx = (mng_uint8)(*pRawx + ((*pRawx_prev + *pPriorx) >> 1));
|
||||
pRawx++;
|
||||
pPriorx++;
|
||||
pRawx_prev++;
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_FILTER_AVERAGE, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode filter_paeth (mng_datap pData)
|
||||
{
|
||||
mng_int32 iBpp;
|
||||
mng_uint8p pRawx;
|
||||
mng_uint8p pRawx_prev;
|
||||
mng_uint8p pPriorx;
|
||||
mng_uint8p pPriorx_prev;
|
||||
mng_int32 iX;
|
||||
mng_uint32 iA, iB, iC;
|
||||
mng_uint32 iP;
|
||||
mng_uint32 iPa, iPb, iPc;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_FILTER_PAETH, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
iBpp = pData->iFilterbpp;
|
||||
pRawx = pData->pWorkrow + pData->iPixelofs;
|
||||
pPriorx = pData->pPrevrow + pData->iPixelofs;
|
||||
pRawx_prev = pData->pWorkrow + pData->iPixelofs;
|
||||
pPriorx_prev = pData->pPrevrow + pData->iPixelofs;
|
||||
|
||||
for (iX = 0; iX < iBpp; iX++)
|
||||
{
|
||||
*pRawx = (mng_uint8)(*pRawx + *pPriorx);
|
||||
|
||||
pRawx++;
|
||||
pPriorx++;
|
||||
}
|
||||
|
||||
for (iX = iBpp; iX < pData->iRowsize; iX++)
|
||||
{
|
||||
iA = (mng_uint32)*pRawx_prev;
|
||||
iB = (mng_uint32)*pPriorx;
|
||||
iC = (mng_uint32)*pPriorx_prev;
|
||||
iP = iA + iB - iC;
|
||||
iPa = abs (iP - iA);
|
||||
iPb = abs (iP - iB);
|
||||
iPc = abs (iP - iC);
|
||||
|
||||
if ((iPa <= iPb) && (iPa <= iPc))
|
||||
*pRawx = (mng_uint8)(*pRawx + iA);
|
||||
else
|
||||
if (iPb <= iPc)
|
||||
*pRawx = (mng_uint8)(*pRawx + iB);
|
||||
else
|
||||
*pRawx = (mng_uint8)(*pRawx + iC);
|
||||
|
||||
pRawx++;
|
||||
pPriorx++;
|
||||
pRawx_prev++;
|
||||
pPriorx_prev++;
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_FILTER_PAETH, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode init_rowdiffering (mng_datap pData)
|
||||
{
|
||||
mng_uint8p pRawi, pRawo;
|
||||
mng_int32 iX;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_INIT_ROWDIFFERING, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
if (pData->iFilter & 0x40) /* has leveling parameters ? */
|
||||
{
|
||||
switch (pData->iColortype) /* salvage leveling parameters */
|
||||
{
|
||||
case 0 : { /* gray */
|
||||
if (pData->iBitdepth <= 8)
|
||||
pData->iLevel0 = (mng_uint16)*pData->pWorkrow;
|
||||
else
|
||||
pData->iLevel0 = mng_get_uint16 (pData->pWorkrow);
|
||||
|
||||
break;
|
||||
}
|
||||
case 2 : { /* rgb */
|
||||
if (pData->iBitdepth <= 8)
|
||||
{
|
||||
pData->iLevel0 = (mng_uint16)*pData->pWorkrow;
|
||||
pData->iLevel1 = (mng_uint16)*(pData->pWorkrow+1);
|
||||
pData->iLevel2 = (mng_uint16)*(pData->pWorkrow+2);
|
||||
}
|
||||
else
|
||||
{
|
||||
pData->iLevel0 = mng_get_uint16 (pData->pWorkrow);
|
||||
pData->iLevel1 = mng_get_uint16 (pData->pWorkrow+2);
|
||||
pData->iLevel2 = mng_get_uint16 (pData->pWorkrow+4);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 3 : { /* indexed */
|
||||
pData->iLevel0 = (mng_uint16)*pData->pWorkrow;
|
||||
break;
|
||||
}
|
||||
case 4 : { /* gray+alpha */
|
||||
if (pData->iBitdepth <= 8)
|
||||
{
|
||||
pData->iLevel0 = (mng_uint16)*pData->pWorkrow;
|
||||
pData->iLevel1 = (mng_uint16)*(pData->pWorkrow+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
pData->iLevel0 = mng_get_uint16 (pData->pWorkrow);
|
||||
pData->iLevel1 = mng_get_uint16 (pData->pWorkrow+2);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 6 : { /* rgb+alpha */
|
||||
if (pData->iBitdepth <= 8)
|
||||
{
|
||||
pData->iLevel0 = (mng_uint16)*pData->pWorkrow;
|
||||
pData->iLevel1 = (mng_uint16)*(pData->pWorkrow+1);
|
||||
pData->iLevel2 = (mng_uint16)*(pData->pWorkrow+2);
|
||||
pData->iLevel3 = (mng_uint16)*(pData->pWorkrow+3);
|
||||
}
|
||||
else
|
||||
{
|
||||
pData->iLevel0 = mng_get_uint16 (pData->pWorkrow);
|
||||
pData->iLevel1 = mng_get_uint16 (pData->pWorkrow+2);
|
||||
pData->iLevel2 = mng_get_uint16 (pData->pWorkrow+4);
|
||||
pData->iLevel3 = mng_get_uint16 (pData->pWorkrow+6);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* shift the entire row back in place */
|
||||
pRawi = pData->pWorkrow + pData->iFilterofs;
|
||||
pRawo = pData->pWorkrow;
|
||||
|
||||
for (iX = 0; iX < pData->iRowsize + pData->iPixelofs - pData->iFilterofs; iX++)
|
||||
*pRawo++ = *pRawi++;
|
||||
|
||||
pData->iFilterofs = 0; /* indicate so ! */
|
||||
|
||||
if (pData->iFilter & 0x01) /* no adaptive filtering ? */
|
||||
pData->iPixelofs = pData->iFilterofs;
|
||||
else
|
||||
pData->iPixelofs = pData->iFilterofs + 1;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_INIT_ROWDIFFERING, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode differ_g1 (mng_datap pData)
|
||||
{
|
||||
mng_uint8p pRawi, pRawo;
|
||||
mng_int32 iX;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_G1, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
if (pData->iLevel0 & 0x01) /* is it uneven level ? */
|
||||
{
|
||||
pRawi = pData->pWorkrow + pData->iPixelofs;
|
||||
pRawo = pData->pPrevrow + pData->iPixelofs;
|
||||
/* just invert every bit */
|
||||
for (iX = 0; iX < pData->iRowsize; iX++)
|
||||
*pRawo++ = (mng_uint8)(~(*pRawi++));
|
||||
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_G1, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode differ_g2 (mng_datap pData)
|
||||
{
|
||||
mng_uint8p pRawi, pRawo;
|
||||
mng_int32 iX;
|
||||
mng_int32 iC, iS;
|
||||
mng_uint8 iB, iN, iQ;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_G2, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
pRawi = pData->pWorkrow + pData->iPixelofs;
|
||||
pRawo = pData->pPrevrow + pData->iPixelofs;
|
||||
iC = 0;
|
||||
iB = 0;
|
||||
iN = 0;
|
||||
iS = 0;
|
||||
|
||||
for (iX = 0; iX < pData->iRowsamples; iX++)
|
||||
{
|
||||
if (!iC)
|
||||
{
|
||||
iC = 4;
|
||||
iB = *pRawi++;
|
||||
iN = 0;
|
||||
iS = 8;
|
||||
}
|
||||
|
||||
iS -= 2;
|
||||
iQ = (mng_uint8)(((iB >> iS) + pData->iLevel0) & 0x03);
|
||||
iN = (mng_uint8)((iN << 2) + iQ);
|
||||
iC--;
|
||||
|
||||
if (!iC)
|
||||
*pRawo++ = iN;
|
||||
|
||||
}
|
||||
|
||||
if (iC)
|
||||
*pRawo = (mng_uint8)(iN << iS);
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_G2, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode differ_g4 (mng_datap pData)
|
||||
{
|
||||
mng_uint8p pRawi, pRawo;
|
||||
mng_int32 iX;
|
||||
mng_int32 iC, iS;
|
||||
mng_uint8 iB, iN, iQ;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_G4, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
pRawi = pData->pWorkrow + pData->iPixelofs;
|
||||
pRawo = pData->pPrevrow + pData->iPixelofs;
|
||||
iC = 0;
|
||||
iB = 0;
|
||||
iN = 0;
|
||||
iS = 0;
|
||||
|
||||
for (iX = 0; iX < pData->iRowsamples; iX++)
|
||||
{
|
||||
if (!iC)
|
||||
{
|
||||
iC = 2;
|
||||
iB = *pRawi++;
|
||||
iN = 0;
|
||||
iS = 8;
|
||||
}
|
||||
|
||||
iS -= 4;
|
||||
iQ = (mng_uint8)(((iB >> iS) + pData->iLevel0) & 0x0F);
|
||||
iN = (mng_uint8)((iN << 4) + iQ);
|
||||
iC--;
|
||||
|
||||
if (!iC)
|
||||
*pRawo++ = iN;
|
||||
|
||||
}
|
||||
|
||||
if (iC)
|
||||
*pRawo = (mng_uint8)(iN << iS);
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_G4, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode differ_g8 (mng_datap pData)
|
||||
{
|
||||
mng_uint8p pRawi, pRawo;
|
||||
mng_int32 iX;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_G8, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
pRawi = pData->pWorkrow + pData->iPixelofs;
|
||||
pRawo = pData->pPrevrow + pData->iPixelofs;
|
||||
|
||||
for (iX = 0; iX < pData->iRowsamples; iX++)
|
||||
{
|
||||
*pRawo++ = (mng_uint8)(((mng_uint16)*pRawi + pData->iLevel0) & 0xFF);
|
||||
|
||||
pRawi++;
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_G8, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode differ_g16 (mng_datap pData)
|
||||
{
|
||||
mng_uint16p pRawi, pRawo;
|
||||
mng_int32 iX;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_G16, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
pRawi = (mng_uint16p)(pData->pWorkrow + pData->iPixelofs);
|
||||
pRawo = (mng_uint16p)(pData->pPrevrow + pData->iPixelofs);
|
||||
|
||||
for (iX = 0; iX < pData->iRowsamples; iX++)
|
||||
{
|
||||
*pRawo++ = (mng_uint16)(((mng_uint32)*pRawi + (mng_uint32)pData->iLevel0) & 0xFFFF);
|
||||
|
||||
pRawi++;
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_G16, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode differ_rgb8 (mng_datap pData)
|
||||
{
|
||||
mng_uint8p pRawi, pRawo;
|
||||
mng_int32 iX;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_RGB8, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
pRawi = pData->pWorkrow + pData->iPixelofs;
|
||||
pRawo = pData->pPrevrow + pData->iPixelofs;
|
||||
|
||||
for (iX = 0; iX < pData->iRowsamples; iX++)
|
||||
{
|
||||
*(pRawo+1) = (mng_uint8)(((mng_uint16)*(pRawi+1) + pData->iLevel1) & 0xFF);
|
||||
*pRawo = (mng_uint8)(((mng_uint16)*pRawi + pData->iLevel0 +
|
||||
(mng_uint16)*(pRawo+1)) & 0xFF);
|
||||
*(pRawo+2) = (mng_uint8)(((mng_uint16)*(pRawi+2) + pData->iLevel2 +
|
||||
(mng_uint16)*(pRawo+1)) & 0xFF);
|
||||
|
||||
pRawi += 3;
|
||||
pRawo += 3;
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_RGB8, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode differ_rgb16 (mng_datap pData)
|
||||
{
|
||||
mng_uint16p pRawi, pRawo;
|
||||
mng_int32 iX;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_RGB16, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
pRawi = (mng_uint16p)(pData->pWorkrow + pData->iPixelofs);
|
||||
pRawo = (mng_uint16p)(pData->pPrevrow + pData->iPixelofs);
|
||||
|
||||
for (iX = 0; iX < pData->iRowsamples; iX++)
|
||||
{
|
||||
*(pRawo+1) = (mng_uint16)(((mng_uint32)*(pRawi+1) + (mng_uint32)pData->iLevel1) & 0xFFFF);
|
||||
*pRawo = (mng_uint16)(((mng_uint32)*pRawi + (mng_uint32)pData->iLevel0 +
|
||||
(mng_uint32)*(pRawo+1)) & 0xFFFF);
|
||||
*(pRawo+2) = (mng_uint16)(((mng_uint32)*(pRawi+2) + (mng_uint32)pData->iLevel2 +
|
||||
(mng_uint32)*(pRawo+1)) & 0xFFFF);
|
||||
|
||||
pRawi += 3;
|
||||
pRawo += 3;
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_RGB16, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode differ_idx1 (mng_datap pData)
|
||||
{
|
||||
mng_uint8p pRawi, pRawo;
|
||||
mng_int32 iX;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_IDX1, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
if (pData->iLevel0 & 0x01) /* is it uneven level ? */
|
||||
{
|
||||
pRawi = pData->pWorkrow + pData->iPixelofs;
|
||||
pRawo = pData->pPrevrow + pData->iPixelofs;
|
||||
/* just invert every bit */
|
||||
for (iX = 0; iX < pData->iRowsize; iX++)
|
||||
*pRawo++ = (mng_uint8)(~(*pRawi++));
|
||||
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_IDX1, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode differ_idx2 (mng_datap pData)
|
||||
{
|
||||
mng_uint8p pRawi, pRawo;
|
||||
mng_int32 iX;
|
||||
mng_int32 iC, iS;
|
||||
mng_uint8 iB, iN, iQ;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_IDX2, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
pRawi = pData->pWorkrow + pData->iPixelofs;
|
||||
pRawo = pData->pPrevrow + pData->iPixelofs;
|
||||
iC = 0;
|
||||
iB = 0;
|
||||
iN = 0;
|
||||
iS = 0;
|
||||
|
||||
for (iX = 0; iX < pData->iRowsamples; iX++)
|
||||
{
|
||||
if (!iC)
|
||||
{
|
||||
iC = 4;
|
||||
iB = *pRawi++;
|
||||
iN = 0;
|
||||
iS = 8;
|
||||
}
|
||||
|
||||
iS -= 2;
|
||||
iQ = (mng_uint8)(((iB >> iS) + pData->iLevel0) & 0x03);
|
||||
iN = (mng_uint8)((iN << 2) + iQ);
|
||||
iC--;
|
||||
|
||||
if (!iC)
|
||||
*pRawo++ = iN;
|
||||
|
||||
}
|
||||
|
||||
if (iC)
|
||||
*pRawo = (mng_uint8)(iN << iS);
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_IDX2, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode differ_idx4 (mng_datap pData)
|
||||
{
|
||||
mng_uint8p pRawi, pRawo;
|
||||
mng_int32 iX;
|
||||
mng_int32 iC, iS;
|
||||
mng_uint8 iB, iN, iQ;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_IDX4, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
pRawi = pData->pWorkrow + pData->iPixelofs;
|
||||
pRawo = pData->pPrevrow + pData->iPixelofs;
|
||||
iC = 0;
|
||||
iB = 0;
|
||||
iN = 0;
|
||||
iS = 0;
|
||||
|
||||
for (iX = 0; iX < pData->iRowsamples; iX++)
|
||||
{
|
||||
if (!iC)
|
||||
{
|
||||
iC = 2;
|
||||
iB = *pRawi++;
|
||||
iN = 0;
|
||||
iS = 8;
|
||||
}
|
||||
|
||||
iS -= 4;
|
||||
iQ = (mng_uint8)(((iB >> iS) + pData->iLevel0) & 0x0F);
|
||||
iN = (mng_uint8)((iN << 4) + iQ);
|
||||
iC--;
|
||||
|
||||
if (!iC)
|
||||
*pRawo++ = iN;
|
||||
|
||||
}
|
||||
|
||||
if (iC)
|
||||
*pRawo = (mng_uint8)(iN << iS);
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_IDX4, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode differ_idx8 (mng_datap pData)
|
||||
{
|
||||
mng_uint8p pRawi, pRawo;
|
||||
mng_int32 iX;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_IDX8, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
pRawi = pData->pWorkrow + pData->iPixelofs;
|
||||
pRawo = pData->pPrevrow + pData->iPixelofs;
|
||||
|
||||
for (iX = 0; iX < pData->iRowsamples; iX++)
|
||||
{
|
||||
*pRawo++ = (mng_uint8)(((mng_uint16)*pRawi + pData->iLevel0) & 0xFF);
|
||||
|
||||
pRawi++;
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_IDX8, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode differ_ga8 (mng_datap pData)
|
||||
{
|
||||
mng_uint8p pRawi, pRawo;
|
||||
mng_int32 iX;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_GA8, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
pRawi = pData->pWorkrow + pData->iPixelofs;
|
||||
pRawo = pData->pPrevrow + pData->iPixelofs;
|
||||
|
||||
for (iX = 0; iX < pData->iRowsamples; iX++)
|
||||
{
|
||||
*pRawo = (mng_uint8)(((mng_uint16)*pRawi + pData->iLevel0) & 0xFF);
|
||||
*(pRawo+1) = (mng_uint8)(((mng_uint16)*(pRawi+1) + pData->iLevel1) & 0xFF);
|
||||
|
||||
pRawi += 2;
|
||||
pRawo += 2;
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_GA8, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode differ_ga16 (mng_datap pData)
|
||||
{
|
||||
mng_uint16p pRawi, pRawo;
|
||||
mng_int32 iX;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_GA16, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
pRawi = (mng_uint16p)(pData->pWorkrow + pData->iPixelofs);
|
||||
pRawo = (mng_uint16p)(pData->pPrevrow + pData->iPixelofs);
|
||||
|
||||
for (iX = 0; iX < pData->iRowsamples; iX++)
|
||||
{
|
||||
*pRawo = (mng_uint16)(((mng_uint32)*pRawi + (mng_uint32)pData->iLevel0) & 0xFFFF);
|
||||
*(pRawo+1) = (mng_uint16)(((mng_uint32)*(pRawi+1) + (mng_uint32)pData->iLevel1) & 0xFFFF);
|
||||
|
||||
pRawi += 2;
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_GA16, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode differ_rgba8 (mng_datap pData)
|
||||
{
|
||||
mng_uint8p pRawi, pRawo;
|
||||
mng_int32 iX;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_RGBA8, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
pRawi = pData->pWorkrow + pData->iPixelofs;
|
||||
pRawo = pData->pPrevrow + pData->iPixelofs;
|
||||
|
||||
for (iX = 0; iX < pData->iRowsamples; iX++)
|
||||
{
|
||||
*(pRawo+1) = (mng_uint8)(((mng_uint16)*(pRawi+1) + pData->iLevel1) & 0xFF);
|
||||
*pRawo = (mng_uint8)(((mng_uint16)*pRawi + pData->iLevel0 +
|
||||
(mng_uint16)*(pRawo+1)) & 0xFF);
|
||||
*(pRawo+2) = (mng_uint8)(((mng_uint16)*(pRawi+2) + pData->iLevel2 +
|
||||
(mng_uint16)*(pRawo+1)) & 0xFF);
|
||||
*(pRawo+3) = (mng_uint8)(((mng_uint16)*(pRawi+3) + pData->iLevel3) & 0xFF);
|
||||
|
||||
pRawi += 4;
|
||||
pRawo += 4;
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_RGBA8, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode differ_rgba16 (mng_datap pData)
|
||||
{
|
||||
mng_uint16p pRawi, pRawo;
|
||||
mng_int32 iX;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_RGBA16, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
pRawi = (mng_uint16p)(pData->pWorkrow + pData->iPixelofs);
|
||||
pRawo = (mng_uint16p)(pData->pPrevrow + pData->iPixelofs);
|
||||
|
||||
for (iX = 0; iX < pData->iRowsamples; iX++)
|
||||
{
|
||||
*(pRawo+1) = (mng_uint16)(((mng_uint32)*(pRawi+1) + (mng_uint32)pData->iLevel1) & 0xFFFF);
|
||||
*pRawo = (mng_uint16)(((mng_uint32)*pRawi + (mng_uint32)pData->iLevel0 +
|
||||
(mng_uint32)*(pRawo+1)) & 0xFFFF);
|
||||
*(pRawo+2) = (mng_uint16)(((mng_uint32)*(pRawi+2) + (mng_uint32)pData->iLevel2 +
|
||||
(mng_uint32)*(pRawo+1)) & 0xFFFF);
|
||||
*(pRawo+3) = (mng_uint16)(((mng_uint32)*(pRawi+3) + (mng_uint32)pData->iLevel3) & 0xFFFF);
|
||||
|
||||
pRawi += 4;
|
||||
pRawo += 4;
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_DIFFER_RGBA16, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* MNG_INCLUDE_FILTERS */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_filter.h copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : Filtering routines (definition) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * comment : Definition of the filtering 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 * */
|
||||
/* * * */
|
||||
/* * 0.9.3 - 09/07/2000 - G.Juyn * */
|
||||
/* * - added support for new filter_types * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* force ANSI-C */
|
||||
#endif
|
||||
|
||||
#ifndef _libmng_filter_h_
|
||||
#define _libmng_filter_h_
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode filter_a_row (mng_datap pData);
|
||||
|
||||
mng_retcode filter_sub (mng_datap pData);
|
||||
mng_retcode filter_up (mng_datap pData);
|
||||
mng_retcode filter_average (mng_datap pData);
|
||||
mng_retcode filter_paeth (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode init_rowdiffering (mng_datap pData);
|
||||
|
||||
mng_retcode differ_g1 (mng_datap pData);
|
||||
mng_retcode differ_g2 (mng_datap pData);
|
||||
mng_retcode differ_g4 (mng_datap pData);
|
||||
mng_retcode differ_g8 (mng_datap pData);
|
||||
mng_retcode differ_g16 (mng_datap pData);
|
||||
mng_retcode differ_rgb8 (mng_datap pData);
|
||||
mng_retcode differ_rgb16 (mng_datap pData);
|
||||
mng_retcode differ_idx1 (mng_datap pData);
|
||||
mng_retcode differ_idx2 (mng_datap pData);
|
||||
mng_retcode differ_idx4 (mng_datap pData);
|
||||
mng_retcode differ_idx8 (mng_datap pData);
|
||||
mng_retcode differ_ga8 (mng_datap pData);
|
||||
mng_retcode differ_ga16 (mng_datap pData);
|
||||
mng_retcode differ_rgba8 (mng_datap pData);
|
||||
mng_retcode differ_rgba16 (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* _libmng_filter_h_ */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,59 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_jpeg.h copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : JPEG library interface (definition) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * comment : Definition of the JPEG library interface * */
|
||||
/* * * */
|
||||
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
|
||||
/* * - changed strict-ANSI stuff * */
|
||||
/* * * */
|
||||
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
|
||||
/* * - changed file-prefixes * */
|
||||
/* * * */
|
||||
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
|
||||
/* * - added support for JDAA * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* force ANSI-C */
|
||||
#endif
|
||||
|
||||
#ifndef _libmng_jpeg_h_
|
||||
#define _libmng_jpeg_h_
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode mngjpeg_initialize (mng_datap pData);
|
||||
mng_retcode mngjpeg_cleanup (mng_datap pData);
|
||||
|
||||
mng_retcode mngjpeg_decompressinit (mng_datap pData);
|
||||
mng_retcode mngjpeg_decompressdata (mng_datap pData,
|
||||
mng_uint32 iRawsize,
|
||||
mng_uint8p pRawdata);
|
||||
mng_retcode mngjpeg_decompressfree (mng_datap pData);
|
||||
|
||||
mng_retcode mngjpeg_decompressinit2 (mng_datap pData);
|
||||
mng_retcode mngjpeg_decompressdata2 (mng_datap pData,
|
||||
mng_uint32 iRawsize,
|
||||
mng_uint8p pRawdata);
|
||||
mng_retcode mngjpeg_decompressfree2 (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* _libmng_jpeg_h_ */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
@@ -1,66 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_memory.h copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : Memory management (definition) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * comment : Definition of memory management functions * */
|
||||
/* * * */
|
||||
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
|
||||
/* * - changed strict-ANSI stuff * */
|
||||
/* * * */
|
||||
/* * 0.5.3 - 06/12/2000 - G.Juyn * */
|
||||
/* * - swapped MNG_COPY parameter-names * */
|
||||
/* * 0.5.3 - 06/27/2000 - G.Juyn * */
|
||||
/* * - changed size parameter to mng_size_t * */
|
||||
/* * * */
|
||||
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
|
||||
/* * - changed file-prefixes * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* force ANSI-C */
|
||||
#endif
|
||||
|
||||
#ifndef _libmng_memory_h_
|
||||
#define _libmng_memory_h_
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Generic memory manager macros * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifdef MNG_INTERNAL_MEMMNGMT
|
||||
#define MNG_ALLOC(H,P,L) { P = calloc (1, (mng_size_t)(L)); \
|
||||
if (P == 0) { MNG_ERROR (H, MNG_OUTOFMEMORY) } }
|
||||
#define MNG_ALLOCX(H,P,L) { P = calloc (1, (mng_size_t)(L)); }
|
||||
#define MNG_FREE(H,P,L) { if (P) { free (P); P = 0; } }
|
||||
#define MNG_FREEX(H,P,L) { if (P) free (P); }
|
||||
#else
|
||||
#define MNG_ALLOC(H,P,L) { P = H->fMemalloc ((mng_size_t)(L)); \
|
||||
if (P == 0) { MNG_ERROR (H, MNG_OUTOFMEMORY) } }
|
||||
#define MNG_ALLOCX(H,P,L) { P = H->fMemalloc ((mng_size_t)(L)); }
|
||||
#define MNG_FREE(H,P,L) { if (P) { H->fMemfree (P, (mng_size_t)(L)); P = 0; } }
|
||||
#define MNG_FREEX(H,P,L) { if (P) { H->fMemfree (P, (mng_size_t)(L)); } }
|
||||
#endif /* mng_internal_memmngmt */
|
||||
|
||||
#define MNG_COPY(D,S,L) { memcpy (D, S, (mng_size_t)(L)); }
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* _libmng_memory_h_ */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,432 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_object_prc.h copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : Object processing routines (definition) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * 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 * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* force ANSI-C */
|
||||
#endif
|
||||
|
||||
#ifndef _libmng_object_prc_h_
|
||||
#define _libmng_object_prc_h_
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode drop_invalid_objects (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode 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 free_imagedataobject (mng_datap pData,
|
||||
mng_imagedatap pImagedata);
|
||||
|
||||
mng_retcode clone_imagedataobject (mng_datap pData,
|
||||
mng_bool bConcrete,
|
||||
mng_imagedatap pSource,
|
||||
mng_imagedatap *ppClone);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode 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 free_imageobject (mng_datap pData,
|
||||
mng_imagep pImage);
|
||||
|
||||
mng_imagep find_imageobject (mng_datap pData,
|
||||
mng_uint16 iId);
|
||||
|
||||
mng_retcode 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 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 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 promote_imageobject (mng_datap pData,
|
||||
mng_imagep pImage,
|
||||
mng_uint8 iBitdepth,
|
||||
mng_uint8 iColortype,
|
||||
mng_uint8 iFilltype);
|
||||
|
||||
mng_retcode magnify_imageobject (mng_datap pData,
|
||||
mng_imagep pImage);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode create_ani_image (mng_datap pData);
|
||||
|
||||
mng_retcode create_ani_plte (mng_datap pData,
|
||||
mng_uint32 iEntrycount,
|
||||
mng_palette8ep paEntries);
|
||||
|
||||
mng_retcode create_ani_trns (mng_datap pData,
|
||||
mng_uint32 iRawlen,
|
||||
mng_uint8p pRawdata);
|
||||
|
||||
mng_retcode create_ani_gama (mng_datap pData,
|
||||
mng_bool bEmpty,
|
||||
mng_uint32 iGamma);
|
||||
|
||||
mng_retcode create_ani_chrm (mng_datap pData,
|
||||
mng_bool bEmpty,
|
||||
mng_uint32 iWhitepointx,
|
||||
mng_uint32 iWhitepointy,
|
||||
mng_uint32 iRedx,
|
||||
mng_uint32 iRedy,
|
||||
mng_uint32 iGreenx,
|
||||
mng_uint32 iGreeny,
|
||||
mng_uint32 iBluex,
|
||||
mng_uint32 iBluey);
|
||||
|
||||
mng_retcode create_ani_srgb (mng_datap pData,
|
||||
mng_bool bEmpty,
|
||||
mng_uint8 iRenderinginent);
|
||||
|
||||
mng_retcode create_ani_iccp (mng_datap pData,
|
||||
mng_bool bEmpty,
|
||||
mng_uint32 iProfilesize,
|
||||
mng_ptr pProfile);
|
||||
|
||||
mng_retcode create_ani_bkgd (mng_datap pData,
|
||||
mng_uint16 iRed,
|
||||
mng_uint16 iGreen,
|
||||
mng_uint16 iBlue);
|
||||
|
||||
mng_retcode create_ani_loop (mng_datap pData,
|
||||
mng_uint8 iLevel,
|
||||
mng_uint32 iRepeatcount,
|
||||
mng_uint8 iTermcond,
|
||||
mng_uint32 iItermin,
|
||||
mng_uint32 iItermax,
|
||||
mng_uint32 iCount,
|
||||
mng_uint32p pSignals);
|
||||
|
||||
mng_retcode create_ani_endl (mng_datap pData,
|
||||
mng_uint8 iLevel);
|
||||
|
||||
mng_retcode create_ani_defi (mng_datap pData);
|
||||
|
||||
mng_retcode create_ani_basi (mng_datap pData,
|
||||
mng_uint16 iRed,
|
||||
mng_uint16 iGreen,
|
||||
mng_uint16 iBlue,
|
||||
mng_bool bHasalpha,
|
||||
mng_uint16 iAlpha,
|
||||
mng_uint8 iViewable);
|
||||
|
||||
mng_retcode create_ani_clon (mng_datap pData,
|
||||
mng_uint16 iCloneid,
|
||||
mng_uint16 iSourceid,
|
||||
mng_uint8 iClonetype,
|
||||
mng_bool bHasdonotshow,
|
||||
mng_uint8 iDonotshow,
|
||||
mng_uint8 iConcrete,
|
||||
mng_bool bHasloca,
|
||||
mng_uint8 iLocatype,
|
||||
mng_int32 iLocax,
|
||||
mng_int32 iLocay);
|
||||
|
||||
mng_retcode create_ani_back (mng_datap pData,
|
||||
mng_uint16 iRed,
|
||||
mng_uint16 iGreen,
|
||||
mng_uint16 iBlue,
|
||||
mng_uint8 iMandatory,
|
||||
mng_uint16 iImageid,
|
||||
mng_uint8 iTile);
|
||||
|
||||
mng_retcode create_ani_fram (mng_datap pData,
|
||||
mng_uint8 iFramemode,
|
||||
mng_uint8 iChangedelay,
|
||||
mng_uint32 iDelay,
|
||||
mng_uint8 iChangetimeout,
|
||||
mng_uint32 iTimeout,
|
||||
mng_uint8 iChangeclipping,
|
||||
mng_uint8 iCliptype,
|
||||
mng_int32 iClipl,
|
||||
mng_int32 iClipr,
|
||||
mng_int32 iClipt,
|
||||
mng_int32 iClipb);
|
||||
|
||||
mng_retcode create_ani_move (mng_datap pData,
|
||||
mng_uint16 iFirstid,
|
||||
mng_uint16 iLastid,
|
||||
mng_uint8 iType,
|
||||
mng_int32 iLocax,
|
||||
mng_int32 iLocay);
|
||||
|
||||
mng_retcode create_ani_clip (mng_datap pData,
|
||||
mng_uint16 iFirstid,
|
||||
mng_uint16 iLastid,
|
||||
mng_uint8 iType,
|
||||
mng_int32 iClipl,
|
||||
mng_int32 iClipr,
|
||||
mng_int32 iClipt,
|
||||
mng_int32 iClipb);
|
||||
|
||||
mng_retcode create_ani_show (mng_datap pData,
|
||||
mng_uint16 iFirstid,
|
||||
mng_uint16 iLastid,
|
||||
mng_uint8 iMode);
|
||||
|
||||
mng_retcode create_ani_term (mng_datap pData,
|
||||
mng_uint8 iTermaction,
|
||||
mng_uint8 iIteraction,
|
||||
mng_uint32 iDelay,
|
||||
mng_uint32 iItermax);
|
||||
|
||||
mng_retcode create_ani_save (mng_datap pData);
|
||||
mng_retcode create_ani_seek (mng_datap pData);
|
||||
|
||||
mng_retcode create_ani_dhdr (mng_datap pData,
|
||||
mng_uint16 iObjectid,
|
||||
mng_uint8 iImagetype,
|
||||
mng_uint8 iDeltatype,
|
||||
mng_uint32 iBlockwidth,
|
||||
mng_uint32 iBlockheight,
|
||||
mng_uint32 iBlockx,
|
||||
mng_uint32 iBlocky);
|
||||
|
||||
mng_retcode create_ani_prom (mng_datap pData,
|
||||
mng_uint8 iBitdepth,
|
||||
mng_uint8 iColortype,
|
||||
mng_uint8 iFilltype);
|
||||
|
||||
mng_retcode create_ani_ipng (mng_datap pData);
|
||||
mng_retcode create_ani_ijng (mng_datap pData);
|
||||
|
||||
mng_retcode create_ani_pplt (mng_datap pData,
|
||||
mng_uint8 iType,
|
||||
mng_uint32 iCount,
|
||||
mng_palette8ep paIndexentries,
|
||||
mng_uint8p paAlphaentries,
|
||||
mng_uint8p paUsedentries);
|
||||
|
||||
mng_retcode create_ani_magn (mng_datap pData,
|
||||
mng_uint16 iFirstid,
|
||||
mng_uint16 iLastid,
|
||||
mng_uint16 iMethodX,
|
||||
mng_uint16 iMX,
|
||||
mng_uint16 iMY,
|
||||
mng_uint16 iML,
|
||||
mng_uint16 iMR,
|
||||
mng_uint16 iMT,
|
||||
mng_uint16 iMB,
|
||||
mng_uint16 iMethodY);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode free_ani_image (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
|
||||
mng_retcode free_ani_plte (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_trns (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_gama (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_chrm (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_srgb (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_iccp (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_bkgd (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_loop (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_endl (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_defi (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_basi (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_clon (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_back (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_fram (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_move (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_clip (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_show (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_term (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_save (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_seek (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_dhdr (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_prom (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_ipng (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_ijng (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_pplt (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode free_ani_magn (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode process_ani_image (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
|
||||
mng_retcode process_ani_plte (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_trns (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_gama (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_chrm (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_srgb (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_iccp (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_bkgd (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_loop (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_endl (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_defi (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_basi (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_clon (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_back (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_fram (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_move (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_clip (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_show (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_term (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_save (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_seek (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_dhdr (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_prom (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_ipng (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_ijng (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_pplt (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
mng_retcode process_ani_magn (mng_datap pData,
|
||||
mng_objectp pObject);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* _libmng_object_prc_h_ */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
@@ -1,509 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_objects.h copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : Internal object structures (definition) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * comment : Definition of the internal object structures * */
|
||||
/* * * */
|
||||
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
|
||||
/* * - changed strict-ANSI stuff * */
|
||||
/* * * */
|
||||
/* * 0.5.2 - 05/23/2000 - G.Juyn * */
|
||||
/* * - changed inclusion to DISPLAY_PROCS * */
|
||||
/* * 0.5.2 - 05/24/2000 - G.Juyn * */
|
||||
/* * - added global color-chunks for animations * */
|
||||
/* * - added global PLTE,tRNS,bKGD chunks for animation * */
|
||||
/* * - added SAVE & SEEK animation objects * */
|
||||
/* * 0.5.2 - 05/29/2000 - G.Juyn * */
|
||||
/* * - added framenr/layernr/playtime to object header * */
|
||||
/* * 0.5.2 - 05/30/2000 - G.Juyn * */
|
||||
/* * - added ani-objects for delta-image processing * */
|
||||
/* * - added compression/filter/interlace fields to * */
|
||||
/* * object-buffer for delta-image processing * */
|
||||
/* * * */
|
||||
/* * 0.5.3 - 06/17/2000 - G.Juyn * */
|
||||
/* * - changed definition of aTRNSentries * */
|
||||
/* * 0.5.3 - 06/22/2000 - G.Juyn * */
|
||||
/* * - added definition for PPLT animation-processing * */
|
||||
/* * * */
|
||||
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
|
||||
/* * - changed file-prefixes * */
|
||||
/* * * */
|
||||
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
|
||||
/* * - added MAGN chunk * */
|
||||
/* * 0.9.3 - 09/10/2000 - G.Juyn * */
|
||||
/* * - fixed DEFI behavior * */
|
||||
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
|
||||
/* * - added support for delta-JNG * */
|
||||
/* * 0.9.3 - 10/17/2000 - G.Juyn * */
|
||||
/* * - added valid-flag to stored objects for read() / display()* */
|
||||
/* * 0.9.3 - 10/19/2000 - G.Juyn * */
|
||||
/* * - added storage for pixel-/alpha-sampledepth for delta's * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* force ANSI-C */
|
||||
#endif
|
||||
|
||||
#ifndef _libmng_objects_h_
|
||||
#define _libmng_objects_h_
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifdef MNG_INCLUDE_DISPLAY_PROCS
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef mng_retcode (*mng_cleanupobject) (mng_datap pData,
|
||||
mng_objectp pHeader);
|
||||
|
||||
typedef mng_retcode (*mng_processobject) (mng_datap pData,
|
||||
mng_objectp pHeader);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct {
|
||||
mng_cleanupobject fCleanup;
|
||||
mng_processobject fProcess;
|
||||
mng_objectp pNext; /* for double-linked list */
|
||||
mng_objectp pPrev;
|
||||
mng_uint32 iFramenr;
|
||||
mng_uint32 iLayernr;
|
||||
mng_uint32 iPlaytime;
|
||||
} mng_object_header;
|
||||
typedef mng_object_header * mng_object_headerp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* MNG specification "object-buffer" */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_uint32 iRefcount; /* reference counter */
|
||||
mng_bool bFrozen; /* frozen flag */
|
||||
mng_bool bConcrete; /* concrete flag */
|
||||
mng_bool bViewable; /* viewable flag */
|
||||
mng_uint32 iWidth; /* image specifics */
|
||||
mng_uint32 iHeight;
|
||||
mng_uint8 iBitdepth;
|
||||
mng_uint8 iColortype;
|
||||
mng_uint8 iCompression;
|
||||
mng_uint8 iFilter;
|
||||
mng_uint8 iInterlace;
|
||||
|
||||
mng_uint8 iAlphabitdepth; /* used only for JNG images */
|
||||
mng_uint8 iJHDRcompression;
|
||||
mng_uint8 iJHDRinterlace;
|
||||
|
||||
mng_uint8 iPixelsampledepth; /* used with delta-images */
|
||||
mng_uint8 iAlphasampledepth;
|
||||
|
||||
mng_bool bHasPLTE; /* PLTE chunk present */
|
||||
mng_bool bHasTRNS; /* tRNS chunk present */
|
||||
mng_bool bHasGAMA; /* gAMA chunk present */
|
||||
mng_bool bHasCHRM; /* cHRM chunk present */
|
||||
mng_bool bHasSRGB; /* sRGB chunk present */
|
||||
mng_bool bHasICCP; /* iCCP chunk present */
|
||||
mng_bool bHasBKGD; /* bKGD chunk present */
|
||||
|
||||
mng_uint32 iPLTEcount; /* PLTE fields */
|
||||
mng_rgbpaltab aPLTEentries;
|
||||
|
||||
mng_uint16 iTRNSgray; /* tRNS fields */
|
||||
mng_uint16 iTRNSred;
|
||||
mng_uint16 iTRNSgreen;
|
||||
mng_uint16 iTRNSblue;
|
||||
mng_uint32 iTRNScount;
|
||||
mng_uint8arr aTRNSentries;
|
||||
|
||||
mng_uint32 iGamma; /* gAMA fields */
|
||||
|
||||
mng_uint32 iWhitepointx; /* cHRM fields */
|
||||
mng_uint32 iWhitepointy;
|
||||
mng_uint32 iPrimaryredx;
|
||||
mng_uint32 iPrimaryredy;
|
||||
mng_uint32 iPrimarygreenx;
|
||||
mng_uint32 iPrimarygreeny;
|
||||
mng_uint32 iPrimarybluex;
|
||||
mng_uint32 iPrimarybluey;
|
||||
|
||||
mng_uint8 iRenderingintent; /* sRGB fields */
|
||||
|
||||
mng_uint32 iProfilesize; /* iCCP fields */
|
||||
mng_ptr pProfile;
|
||||
|
||||
mng_uint8 iBKGDindex; /* bKGD fields */
|
||||
mng_uint16 iBKGDgray;
|
||||
mng_uint16 iBKGDred;
|
||||
mng_uint16 iBKGDgreen;
|
||||
mng_uint16 iBKGDblue;
|
||||
|
||||
mng_uint32 iSamplesize; /* size of a sample */
|
||||
mng_uint32 iRowsize; /* size of a row of samples */
|
||||
mng_uint32 iImgdatasize; /* size of the sample data buffer */
|
||||
mng_uint8p pImgdata; /* actual sample data buffer */
|
||||
|
||||
} mng_imagedata;
|
||||
typedef mng_imagedata * mng_imagedatap;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* MNG specification "object" */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_uint16 iId; /* object-id */
|
||||
mng_bool bFrozen; /* frozen flag */
|
||||
mng_bool bVisible; /* potential visibility flag */
|
||||
mng_bool bViewable; /* viewable flag */
|
||||
mng_bool bValid; /* marks invalid when only reading */
|
||||
mng_int32 iPosx; /* location fields */
|
||||
mng_int32 iPosy;
|
||||
mng_bool bClipped; /* clipping fields */
|
||||
mng_int32 iClipl;
|
||||
mng_int32 iClipr;
|
||||
mng_int32 iClipt;
|
||||
mng_int32 iClipb;
|
||||
mng_uint16 iMAGN_MethodX; /* magnification (MAGN) */
|
||||
mng_uint16 iMAGN_MethodY;
|
||||
mng_uint16 iMAGN_MX;
|
||||
mng_uint16 iMAGN_MY;
|
||||
mng_uint16 iMAGN_ML;
|
||||
mng_uint16 iMAGN_MR;
|
||||
mng_uint16 iMAGN_MT;
|
||||
mng_uint16 iMAGN_MB;
|
||||
mng_imagedatap pImgbuf; /* the image-data buffer */
|
||||
} mng_image;
|
||||
typedef mng_image * mng_imagep;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
/* "on-the-fly" image (= object 0) */
|
||||
typedef mng_image mng_ani_image; /* let's (ab)use the general "object" */
|
||||
typedef mng_ani_image * mng_ani_imagep; /* that's actualy crucial, so don't change it! */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* global PLTE object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_uint32 iEntrycount;
|
||||
mng_rgbpaltab aEntries;
|
||||
} mng_ani_plte;
|
||||
typedef mng_ani_plte * mng_ani_pltep;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* global tRNS object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_uint32 iRawlen;
|
||||
mng_uint8arr aRawdata;
|
||||
} mng_ani_trns;
|
||||
typedef mng_ani_trns * mng_ani_trnsp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* global gAMA object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_bool bEmpty;
|
||||
mng_uint32 iGamma;
|
||||
} mng_ani_gama;
|
||||
typedef mng_ani_gama * mng_ani_gamap;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* global gCRM object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
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_ani_chrm;
|
||||
typedef mng_ani_chrm * mng_ani_chrmp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* global sRGB object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_bool bEmpty;
|
||||
mng_uint8 iRenderingintent;
|
||||
} mng_ani_srgb;
|
||||
typedef mng_ani_srgb * mng_ani_srgbp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* global iCCP object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_bool bEmpty;
|
||||
mng_uint32 iProfilesize;
|
||||
mng_ptr pProfile;
|
||||
} mng_ani_iccp;
|
||||
typedef mng_ani_iccp * mng_ani_iccpp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* global bKGD object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_uint16 iRed;
|
||||
mng_uint16 iGreen;
|
||||
mng_uint16 iBlue;
|
||||
} mng_ani_bkgd;
|
||||
typedef mng_ani_bkgd * mng_ani_bkgdp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* LOOP object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_uint8 iLevel;
|
||||
mng_uint32 iRepeatcount;
|
||||
mng_uint8 iTermcond;
|
||||
mng_uint32 iItermin;
|
||||
mng_uint32 iItermax;
|
||||
mng_uint32 iCount;
|
||||
mng_uint32p pSignals;
|
||||
|
||||
mng_uint32 iRunningcount; /* running counter */
|
||||
} mng_ani_loop;
|
||||
typedef mng_ani_loop * mng_ani_loopp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* ENDL object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_uint8 iLevel;
|
||||
|
||||
mng_ani_loopp pLOOP; /* matching LOOP */
|
||||
} mng_ani_endl;
|
||||
typedef mng_ani_endl * mng_ani_endlp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* DEFI object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_uint16 iId;
|
||||
mng_bool bHasdonotshow;
|
||||
mng_uint8 iDonotshow;
|
||||
mng_bool bHasconcrete;
|
||||
mng_uint8 iConcrete;
|
||||
mng_bool bHasloca;
|
||||
mng_int32 iLocax;
|
||||
mng_int32 iLocay;
|
||||
mng_bool bHasclip;
|
||||
mng_int32 iClipl;
|
||||
mng_int32 iClipr;
|
||||
mng_int32 iClipt;
|
||||
mng_int32 iClipb;
|
||||
} mng_ani_defi;
|
||||
typedef mng_ani_defi * mng_ani_defip;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* BASI object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_uint16 iRed;
|
||||
mng_uint16 iGreen;
|
||||
mng_uint16 iBlue;
|
||||
mng_bool bHasalpha;
|
||||
mng_uint16 iAlpha;
|
||||
mng_uint8 iViewable;
|
||||
} mng_ani_basi;
|
||||
typedef mng_ani_basi * mng_ani_basip;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* CLON object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_uint16 iCloneid;
|
||||
mng_uint16 iSourceid;
|
||||
mng_uint8 iClonetype;
|
||||
mng_bool bHasdonotshow;
|
||||
mng_uint8 iDonotshow;
|
||||
mng_uint8 iConcrete;
|
||||
mng_bool bHasloca;
|
||||
mng_uint8 iLocatype;
|
||||
mng_int32 iLocax;
|
||||
mng_int32 iLocay;
|
||||
} mng_ani_clon;
|
||||
typedef mng_ani_clon * mng_ani_clonp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* BACK object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_uint16 iRed;
|
||||
mng_uint16 iGreen;
|
||||
mng_uint16 iBlue;
|
||||
mng_uint8 iMandatory;
|
||||
mng_uint16 iImageid;
|
||||
mng_uint8 iTile;
|
||||
} mng_ani_back;
|
||||
typedef mng_ani_back * mng_ani_backp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* FRAM object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
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_ani_fram;
|
||||
typedef mng_ani_fram * mng_ani_framp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* MOVE object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_uint16 iFirstid;
|
||||
mng_uint16 iLastid;
|
||||
mng_uint8 iType;
|
||||
mng_int32 iLocax;
|
||||
mng_int32 iLocay;
|
||||
} mng_ani_move;
|
||||
typedef mng_ani_move * mng_ani_movep;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* CLIP object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_uint16 iFirstid;
|
||||
mng_uint16 iLastid;
|
||||
mng_uint8 iType;
|
||||
mng_int32 iClipl;
|
||||
mng_int32 iClipr;
|
||||
mng_int32 iClipt;
|
||||
mng_int32 iClipb;
|
||||
} mng_ani_clip;
|
||||
typedef mng_ani_clip * mng_ani_clipp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* SHOW object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_uint16 iFirstid;
|
||||
mng_uint16 iLastid;
|
||||
mng_uint8 iMode;
|
||||
} mng_ani_show;
|
||||
typedef mng_ani_show * mng_ani_showp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* TERM object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_uint8 iTermaction;
|
||||
mng_uint8 iIteraction;
|
||||
mng_uint32 iDelay;
|
||||
mng_uint32 iItermax;
|
||||
} mng_ani_term;
|
||||
typedef mng_ani_term * mng_ani_termp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* SAVE object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
} mng_ani_save;
|
||||
typedef mng_ani_save * mng_ani_savep;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* SEEK object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
} mng_ani_seek;
|
||||
typedef mng_ani_seek * mng_ani_seekp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* DHDR object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_uint16 iObjectid;
|
||||
mng_uint8 iImagetype;
|
||||
mng_uint8 iDeltatype;
|
||||
mng_uint32 iBlockwidth;
|
||||
mng_uint32 iBlockheight;
|
||||
mng_uint32 iBlockx;
|
||||
mng_uint32 iBlocky;
|
||||
} mng_ani_dhdr;
|
||||
typedef mng_ani_dhdr * mng_ani_dhdrp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* PROM object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_uint8 iBitdepth;
|
||||
mng_uint8 iColortype;
|
||||
mng_uint8 iFilltype;
|
||||
} mng_ani_prom;
|
||||
typedef mng_ani_prom * mng_ani_promp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* IPNG object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
} mng_ani_ipng;
|
||||
typedef mng_ani_ipng * mng_ani_ipngp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* IJNG object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
} mng_ani_ijng;
|
||||
typedef mng_ani_ijng * mng_ani_ijngp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* PPLT object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_uint8 iType;
|
||||
mng_uint32 iCount;
|
||||
mng_rgbpaltab aIndexentries;
|
||||
mng_uint8arr aAlphaentries;
|
||||
mng_uint8arr aUsedentries;
|
||||
} mng_ani_pplt;
|
||||
typedef mng_ani_pplt * mng_ani_ppltp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct { /* MAGN object */
|
||||
mng_object_header sHeader; /* default header (DO NOT REMOVE) */
|
||||
mng_uint16 iFirstid;
|
||||
mng_uint16 iLastid;
|
||||
mng_uint16 iMethodX;
|
||||
mng_uint16 iMX;
|
||||
mng_uint16 iMY;
|
||||
mng_uint16 iML;
|
||||
mng_uint16 iMR;
|
||||
mng_uint16 iMT;
|
||||
mng_uint16 iMB;
|
||||
mng_uint16 iMethodY;
|
||||
} mng_ani_magn;
|
||||
typedef mng_ani_magn * mng_ani_magnp;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* MNG_INCLUDE_DISPLAY_PROCS */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* _libmng_objects_h_ */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,570 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_pixels.h copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.1 * */
|
||||
/* * * */
|
||||
/* * purpose : Pixel-row management routines (definition) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * comment : Definition of the pixel-row management routines * */
|
||||
/* * * */
|
||||
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
|
||||
/* * - changed strict-ANSI stuff * */
|
||||
/* * * */
|
||||
/* * 0.5.2 - 05/22/2000 - G.Juyn * */
|
||||
/* * - added some JNG definitions * */
|
||||
/* * - added delta-image row-processing routines * */
|
||||
/* * 0.5.2 - 06/05/2000 - G.Juyn * */
|
||||
/* * - added support for RGB8_A8 canvasstyle * */
|
||||
/* * * */
|
||||
/* * 0.5.3 - 06/16/2000 - G.Juyn * */
|
||||
/* * - changed progressive-display processing * */
|
||||
/* * * */
|
||||
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
|
||||
/* * - changed file-prefixes * */
|
||||
/* * * */
|
||||
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
|
||||
/* * - added MAGN support * */
|
||||
/* * 0.9.3 - 09/07/2000 - G.Juyn * */
|
||||
/* * - added support for new filter_types * */
|
||||
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
|
||||
/* * - added optional support for bKGD for PNG images * */
|
||||
/* * - added support for JDAA * */
|
||||
/* * 0.9.3 - 10/19/2000 - G.Juyn * */
|
||||
/* * - implemented delayed delta-processing * */
|
||||
/* * * */
|
||||
/* * 0.9.4 - 1/18/2001 - G.Juyn * */
|
||||
/* * - added "new" MAGN methods 3, 4 & 5 * */
|
||||
/* * * */
|
||||
/* * 1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly) * */
|
||||
/* * - added BGRA8 canvas with premultiplied alpha * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* force ANSI-C */
|
||||
#endif
|
||||
|
||||
#ifndef _libmng_pixels_h_
|
||||
#define _libmng_pixels_h_
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Progressive display check - checks to see if progressive display is * */
|
||||
/* * in order & indicates so * */
|
||||
/* * * */
|
||||
/* * The routine is called after a call to one of the display_xxx routines * */
|
||||
/* * if appropriate * */
|
||||
/* * * */
|
||||
/* * The refresh is warrented in the read_chunk routine (mng_read.c) * */
|
||||
/* * and only during read&display processing, since there's not much point * */
|
||||
/* * doing it from memory! * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode display_progressive_check (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Display routines - convert rowdata (which is already color-corrected) * */
|
||||
/* * to the output canvas, respecting any transparency information * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode display_rgb8 (mng_datap pData);
|
||||
mng_retcode display_rgba8 (mng_datap pData);
|
||||
mng_retcode display_argb8 (mng_datap pData);
|
||||
mng_retcode display_rgb8_a8 (mng_datap pData);
|
||||
mng_retcode display_bgr8 (mng_datap pData);
|
||||
mng_retcode display_bgra8 (mng_datap pData);
|
||||
mng_retcode display_bgra8_pm (mng_datap pData);
|
||||
mng_retcode display_abgr8 (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Background restore routines - restore the background with info from * */
|
||||
/* * the BACK and/or bKGD chunk and/or the app's background canvas * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode restore_bkgd_backimage (mng_datap pData);
|
||||
mng_retcode restore_bkgd_backcolor (mng_datap pData);
|
||||
mng_retcode restore_bkgd_bkgd (mng_datap pData);
|
||||
mng_retcode restore_bkgd_bgcolor (mng_datap pData);
|
||||
mng_retcode restore_bkgd_rgb8 (mng_datap pData);
|
||||
mng_retcode restore_bkgd_bgr8 (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Row retrieval routines - retrieve processed & uncompressed row-data * */
|
||||
/* * from the current "object" * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode retrieve_g8 (mng_datap pData);
|
||||
mng_retcode retrieve_g16 (mng_datap pData);
|
||||
mng_retcode retrieve_rgb8 (mng_datap pData);
|
||||
mng_retcode retrieve_rgb16 (mng_datap pData);
|
||||
mng_retcode retrieve_idx8 (mng_datap pData);
|
||||
mng_retcode retrieve_ga8 (mng_datap pData);
|
||||
mng_retcode retrieve_ga16 (mng_datap pData);
|
||||
mng_retcode retrieve_rgba8 (mng_datap pData);
|
||||
mng_retcode retrieve_rgba16 (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Row storage routines - store processed & uncompressed row-data * */
|
||||
/* * into the current "object" * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode store_g1 (mng_datap pData);
|
||||
mng_retcode store_g2 (mng_datap pData);
|
||||
mng_retcode store_g4 (mng_datap pData);
|
||||
mng_retcode store_g8 (mng_datap pData);
|
||||
mng_retcode store_g16 (mng_datap pData);
|
||||
mng_retcode store_rgb8 (mng_datap pData);
|
||||
mng_retcode store_rgb16 (mng_datap pData);
|
||||
mng_retcode store_idx1 (mng_datap pData);
|
||||
mng_retcode store_idx2 (mng_datap pData);
|
||||
mng_retcode store_idx4 (mng_datap pData);
|
||||
mng_retcode store_idx8 (mng_datap pData);
|
||||
mng_retcode store_ga8 (mng_datap pData);
|
||||
mng_retcode store_ga16 (mng_datap pData);
|
||||
mng_retcode store_rgba8 (mng_datap pData);
|
||||
mng_retcode store_rgba16 (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Row storage routines (JPEG) - store processed & uncompressed row-data * */
|
||||
/* * into the current "object" * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode store_jpeg_g8 (mng_datap pData);
|
||||
mng_retcode store_jpeg_rgb8 (mng_datap pData);
|
||||
mng_retcode store_jpeg_ga8 (mng_datap pData);
|
||||
mng_retcode store_jpeg_rgba8 (mng_datap pData);
|
||||
|
||||
mng_retcode store_jpeg_g12 (mng_datap pData);
|
||||
mng_retcode store_jpeg_rgb12 (mng_datap pData);
|
||||
mng_retcode store_jpeg_ga12 (mng_datap pData);
|
||||
mng_retcode store_jpeg_rgba12 (mng_datap pData);
|
||||
|
||||
mng_retcode store_jpeg_g8_alpha (mng_datap pData);
|
||||
mng_retcode store_jpeg_rgb8_alpha (mng_datap pData);
|
||||
|
||||
mng_retcode store_jpeg_g8_a1 (mng_datap pData);
|
||||
mng_retcode store_jpeg_g8_a2 (mng_datap pData);
|
||||
mng_retcode store_jpeg_g8_a4 (mng_datap pData);
|
||||
mng_retcode store_jpeg_g8_a8 (mng_datap pData);
|
||||
mng_retcode store_jpeg_g8_a16 (mng_datap pData);
|
||||
|
||||
mng_retcode store_jpeg_rgb8_a1 (mng_datap pData);
|
||||
mng_retcode store_jpeg_rgb8_a2 (mng_datap pData);
|
||||
mng_retcode store_jpeg_rgb8_a4 (mng_datap pData);
|
||||
mng_retcode store_jpeg_rgb8_a8 (mng_datap pData);
|
||||
mng_retcode store_jpeg_rgb8_a16 (mng_datap pData);
|
||||
|
||||
mng_retcode store_jpeg_g12_a1 (mng_datap pData);
|
||||
mng_retcode store_jpeg_g12_a2 (mng_datap pData);
|
||||
mng_retcode store_jpeg_g12_a4 (mng_datap pData);
|
||||
mng_retcode store_jpeg_g12_a8 (mng_datap pData);
|
||||
mng_retcode store_jpeg_g12_a16 (mng_datap pData);
|
||||
|
||||
mng_retcode store_jpeg_rgb12_a1 (mng_datap pData);
|
||||
mng_retcode store_jpeg_rgb12_a2 (mng_datap pData);
|
||||
mng_retcode store_jpeg_rgb12_a4 (mng_datap pData);
|
||||
mng_retcode store_jpeg_rgb12_a8 (mng_datap pData);
|
||||
mng_retcode store_jpeg_rgb12_a16 (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Delta-image row routines - apply the processed & uncompressed row-data * */
|
||||
/* * onto the target "object" * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode delta_g1 (mng_datap pData);
|
||||
mng_retcode delta_g2 (mng_datap pData);
|
||||
mng_retcode delta_g4 (mng_datap pData);
|
||||
mng_retcode delta_g8 (mng_datap pData);
|
||||
mng_retcode delta_g16 (mng_datap pData);
|
||||
mng_retcode delta_rgb8 (mng_datap pData);
|
||||
mng_retcode delta_rgb16 (mng_datap pData);
|
||||
mng_retcode delta_idx1 (mng_datap pData);
|
||||
mng_retcode delta_idx2 (mng_datap pData);
|
||||
mng_retcode delta_idx4 (mng_datap pData);
|
||||
mng_retcode delta_idx8 (mng_datap pData);
|
||||
mng_retcode delta_ga8 (mng_datap pData);
|
||||
mng_retcode delta_ga16 (mng_datap pData);
|
||||
mng_retcode delta_rgba8 (mng_datap pData);
|
||||
mng_retcode delta_rgba16 (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Delta-image row routines - apply the source row onto the target * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode delta_g1_g1 (mng_datap pData);
|
||||
mng_retcode delta_g2_g2 (mng_datap pData);
|
||||
mng_retcode delta_g4_g4 (mng_datap pData);
|
||||
mng_retcode delta_g8_g8 (mng_datap pData);
|
||||
mng_retcode delta_g16_g16 (mng_datap pData);
|
||||
mng_retcode delta_rgb8_rgb8 (mng_datap pData);
|
||||
mng_retcode delta_rgb16_rgb16 (mng_datap pData);
|
||||
mng_retcode delta_ga8_ga8 (mng_datap pData);
|
||||
mng_retcode delta_ga8_g8 (mng_datap pData);
|
||||
mng_retcode delta_ga8_a8 (mng_datap pData);
|
||||
mng_retcode delta_ga16_ga16 (mng_datap pData);
|
||||
mng_retcode delta_ga16_g16 (mng_datap pData);
|
||||
mng_retcode delta_ga16_a16 (mng_datap pData);
|
||||
mng_retcode delta_rgba8_rgba8 (mng_datap pData);
|
||||
mng_retcode delta_rgba8_rgb8 (mng_datap pData);
|
||||
mng_retcode delta_rgba8_a8 (mng_datap pData);
|
||||
mng_retcode delta_rgba16_rgba16 (mng_datap pData);
|
||||
mng_retcode delta_rgba16_rgb16 (mng_datap pData);
|
||||
mng_retcode delta_rgba16_a16 (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Delta-image row routines - scale the source to bitdepth of target * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Row processing routines - convert uncompressed data from zlib to * */
|
||||
/* * managable row-data which serves as input to the color-management * */
|
||||
/* * routines * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode process_g1 (mng_datap pData);
|
||||
mng_retcode process_g2 (mng_datap pData);
|
||||
mng_retcode process_g4 (mng_datap pData);
|
||||
mng_retcode process_g8 (mng_datap pData);
|
||||
mng_retcode process_g16 (mng_datap pData);
|
||||
mng_retcode process_rgb8 (mng_datap pData);
|
||||
mng_retcode process_rgb16 (mng_datap pData);
|
||||
mng_retcode process_idx1 (mng_datap pData);
|
||||
mng_retcode process_idx2 (mng_datap pData);
|
||||
mng_retcode process_idx4 (mng_datap pData);
|
||||
mng_retcode process_idx8 (mng_datap pData);
|
||||
mng_retcode process_ga8 (mng_datap pData);
|
||||
mng_retcode process_ga16 (mng_datap pData);
|
||||
mng_retcode process_rgba8 (mng_datap pData);
|
||||
mng_retcode process_rgba16 (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Row processing initialization routines - set up the variables needed * */
|
||||
/* * to process uncompressed row-data * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode init_g1_ni (mng_datap pData);
|
||||
mng_retcode init_g1_i (mng_datap pData);
|
||||
mng_retcode init_g2_ni (mng_datap pData);
|
||||
mng_retcode init_g2_i (mng_datap pData);
|
||||
mng_retcode init_g4_ni (mng_datap pData);
|
||||
mng_retcode init_g4_i (mng_datap pData);
|
||||
mng_retcode init_g8_ni (mng_datap pData);
|
||||
mng_retcode init_g8_i (mng_datap pData);
|
||||
mng_retcode init_g16_ni (mng_datap pData);
|
||||
mng_retcode init_g16_i (mng_datap pData);
|
||||
mng_retcode init_rgb8_ni (mng_datap pData);
|
||||
mng_retcode init_rgb8_i (mng_datap pData);
|
||||
mng_retcode init_rgb16_ni (mng_datap pData);
|
||||
mng_retcode init_rgb16_i (mng_datap pData);
|
||||
mng_retcode init_idx1_ni (mng_datap pData);
|
||||
mng_retcode init_idx1_i (mng_datap pData);
|
||||
mng_retcode init_idx2_ni (mng_datap pData);
|
||||
mng_retcode init_idx2_i (mng_datap pData);
|
||||
mng_retcode init_idx4_ni (mng_datap pData);
|
||||
mng_retcode init_idx4_i (mng_datap pData);
|
||||
mng_retcode init_idx8_ni (mng_datap pData);
|
||||
mng_retcode init_idx8_i (mng_datap pData);
|
||||
mng_retcode init_ga8_ni (mng_datap pData);
|
||||
mng_retcode init_ga8_i (mng_datap pData);
|
||||
mng_retcode init_ga16_ni (mng_datap pData);
|
||||
mng_retcode init_ga16_i (mng_datap pData);
|
||||
mng_retcode init_rgba8_ni (mng_datap pData);
|
||||
mng_retcode init_rgba8_i (mng_datap pData);
|
||||
mng_retcode init_rgba16_ni (mng_datap pData);
|
||||
mng_retcode init_rgba16_i (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Row processing initialization routines (JPEG) - set up the variables * */
|
||||
/* * needed to process uncompressed row-data * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode init_jpeg_a1_ni (mng_datap pData);
|
||||
mng_retcode init_jpeg_a2_ni (mng_datap pData);
|
||||
mng_retcode init_jpeg_a4_ni (mng_datap pData);
|
||||
mng_retcode init_jpeg_a8_ni (mng_datap pData);
|
||||
mng_retcode init_jpeg_a16_ni (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * General row processing routines * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode init_rowproc (mng_datap pData);
|
||||
mng_retcode next_row (mng_datap pData);
|
||||
mng_retcode next_jpeg_alpharow (mng_datap pData);
|
||||
mng_retcode next_jpeg_row (mng_datap pData);
|
||||
mng_retcode cleanup_rowproc (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Magnification row routines - apply magnification transforms * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode magnify_g8_x1 (mng_datap pData,
|
||||
mng_uint16 iMX,
|
||||
mng_uint16 iML,
|
||||
mng_uint16 iMR,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_g8_x2 (mng_datap pData,
|
||||
mng_uint16 iMX,
|
||||
mng_uint16 iML,
|
||||
mng_uint16 iMR,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_g8_x3 (mng_datap pData,
|
||||
mng_uint16 iMX,
|
||||
mng_uint16 iML,
|
||||
mng_uint16 iMR,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_rgb8_x1 (mng_datap pData,
|
||||
mng_uint16 iMX,
|
||||
mng_uint16 iML,
|
||||
mng_uint16 iMR,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_rgb8_x2 (mng_datap pData,
|
||||
mng_uint16 iMX,
|
||||
mng_uint16 iML,
|
||||
mng_uint16 iMR,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_rgb8_x3 (mng_datap pData,
|
||||
mng_uint16 iMX,
|
||||
mng_uint16 iML,
|
||||
mng_uint16 iMR,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_ga8_x1 (mng_datap pData,
|
||||
mng_uint16 iMX,
|
||||
mng_uint16 iML,
|
||||
mng_uint16 iMR,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_ga8_x2 (mng_datap pData,
|
||||
mng_uint16 iMX,
|
||||
mng_uint16 iML,
|
||||
mng_uint16 iMR,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_ga8_x3 (mng_datap pData,
|
||||
mng_uint16 iMX,
|
||||
mng_uint16 iML,
|
||||
mng_uint16 iMR,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_ga8_x4 (mng_datap pData,
|
||||
mng_uint16 iMX,
|
||||
mng_uint16 iML,
|
||||
mng_uint16 iMR,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_ga8_x5 (mng_datap pData,
|
||||
mng_uint16 iMX,
|
||||
mng_uint16 iML,
|
||||
mng_uint16 iMR,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_rgba8_x1 (mng_datap pData,
|
||||
mng_uint16 iMX,
|
||||
mng_uint16 iML,
|
||||
mng_uint16 iMR,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_rgba8_x2 (mng_datap pData,
|
||||
mng_uint16 iMX,
|
||||
mng_uint16 iML,
|
||||
mng_uint16 iMR,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_rgba8_x3 (mng_datap pData,
|
||||
mng_uint16 iMX,
|
||||
mng_uint16 iML,
|
||||
mng_uint16 iMR,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_rgba8_x4 (mng_datap pData,
|
||||
mng_uint16 iMX,
|
||||
mng_uint16 iML,
|
||||
mng_uint16 iMR,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_rgba8_x5 (mng_datap pData,
|
||||
mng_uint16 iMX,
|
||||
mng_uint16 iML,
|
||||
mng_uint16 iMR,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline,
|
||||
mng_uint8p pDstline);
|
||||
|
||||
mng_retcode magnify_g8_y1 (mng_datap pData,
|
||||
mng_int32 iS,
|
||||
mng_int32 iM,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline1,
|
||||
mng_uint8p pSrcline2,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_g8_y2 (mng_datap pData,
|
||||
mng_int32 iS,
|
||||
mng_int32 iM,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline1,
|
||||
mng_uint8p pSrcline2,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_g8_y3 (mng_datap pData,
|
||||
mng_int32 iS,
|
||||
mng_int32 iM,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline1,
|
||||
mng_uint8p pSrcline2,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_rgb8_y1 (mng_datap pData,
|
||||
mng_int32 iS,
|
||||
mng_int32 iM,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline1,
|
||||
mng_uint8p pSrcline2,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_rgb8_y2 (mng_datap pData,
|
||||
mng_int32 iS,
|
||||
mng_int32 iM,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline1,
|
||||
mng_uint8p pSrcline2,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_rgb8_y3 (mng_datap pData,
|
||||
mng_int32 iS,
|
||||
mng_int32 iM,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline1,
|
||||
mng_uint8p pSrcline2,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_ga8_y1 (mng_datap pData,
|
||||
mng_int32 iS,
|
||||
mng_int32 iM,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline1,
|
||||
mng_uint8p pSrcline2,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_ga8_y2 (mng_datap pData,
|
||||
mng_int32 iS,
|
||||
mng_int32 iM,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline1,
|
||||
mng_uint8p pSrcline2,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_ga8_y3 (mng_datap pData,
|
||||
mng_int32 iS,
|
||||
mng_int32 iM,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline1,
|
||||
mng_uint8p pSrcline2,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_ga8_y4 (mng_datap pData,
|
||||
mng_int32 iS,
|
||||
mng_int32 iM,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline1,
|
||||
mng_uint8p pSrcline2,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_ga8_y5 (mng_datap pData,
|
||||
mng_int32 iS,
|
||||
mng_int32 iM,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline1,
|
||||
mng_uint8p pSrcline2,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_rgba8_y1 (mng_datap pData,
|
||||
mng_int32 iS,
|
||||
mng_int32 iM,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline1,
|
||||
mng_uint8p pSrcline2,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_rgba8_y2 (mng_datap pData,
|
||||
mng_int32 iS,
|
||||
mng_int32 iM,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline1,
|
||||
mng_uint8p pSrcline2,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_rgba8_y3 (mng_datap pData,
|
||||
mng_int32 iS,
|
||||
mng_int32 iM,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline1,
|
||||
mng_uint8p pSrcline2,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_rgba8_y4 (mng_datap pData,
|
||||
mng_int32 iS,
|
||||
mng_int32 iM,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline1,
|
||||
mng_uint8p pSrcline2,
|
||||
mng_uint8p pDstline);
|
||||
mng_retcode magnify_rgba8_y5 (mng_datap pData,
|
||||
mng_int32 iS,
|
||||
mng_int32 iM,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint8p pSrcline1,
|
||||
mng_uint8p pSrcline2,
|
||||
mng_uint8p pDstline);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* _libmng_pixels_h_ */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,693 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_read.c copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : Read logic (implementation) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * comment : implementation of the high-level read logic * */
|
||||
/* * * */
|
||||
/* * 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/19/2000 - G.Juyn * */
|
||||
/* * - cleaned up some code regarding mixed support * */
|
||||
/* * 0.5.2 - 05/20/2000 - G.Juyn * */
|
||||
/* * - added support for JNG * */
|
||||
/* * 0.5.2 - 05/31/2000 - G.Juyn * */
|
||||
/* * - fixed up punctuation (contribution by Tim Rowley) * */
|
||||
/* * * */
|
||||
/* * 0.5.3 - 06/16/2000 - G.Juyn * */
|
||||
/* * - changed progressive-display processing * */
|
||||
/* * * */
|
||||
/* * 0.9.1 - 07/08/2000 - G.Juyn * */
|
||||
/* * - changed read-processing for improved I/O-suspension * */
|
||||
/* * 0.9.1 - 07/14/2000 - G.Juyn * */
|
||||
/* * - changed EOF processing behavior * */
|
||||
/* * 0.9.1 - 07/14/2000 - G.Juyn * */
|
||||
/* * - changed default readbuffer size from 1024 to 4200 * */
|
||||
/* * * */
|
||||
/* * 0.9.2 - 07/27/2000 - G.Juyn * */
|
||||
/* * - B110320 - fixed GCC warning about mix-sized pointer math * */
|
||||
/* * 0.9.2 - 07/31/2000 - G.Juyn * */
|
||||
/* * - B110546 - fixed for improperly returning UNEXPECTEDEOF * */
|
||||
/* * 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 - 08/26/2000 - G.Juyn * */
|
||||
/* * - added MAGN chunk * */
|
||||
/* * 0.9.3 - 10/11/2000 - G.Juyn * */
|
||||
/* * - removed test-MaGN * */
|
||||
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
|
||||
/* * - added support for JDAA * */
|
||||
/* * * */
|
||||
/* * 0.9.5 - 1/23/2001 - G.Juyn * */
|
||||
/* * - fixed timing-problem with switching framing_modes * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#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_objects.h"
|
||||
#include "libmng_object_prc.h"
|
||||
#include "libmng_chunks.h"
|
||||
#include "libmng_chunk_prc.h"
|
||||
#include "libmng_chunk_io.h"
|
||||
#include "libmng_display.h"
|
||||
#include "libmng_read.h"
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* force ANSI-C */
|
||||
#endif
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifdef MNG_INCLUDE_READ_PROCS
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode process_eof (mng_datap pData)
|
||||
{
|
||||
if (!pData->bEOF) /* haven't closed the stream yet ? */
|
||||
{
|
||||
pData->bEOF = MNG_TRUE; /* now we do! */
|
||||
|
||||
if (!pData->fClosestream ((mng_handle)pData))
|
||||
MNG_ERROR (pData, MNG_APPIOERROR)
|
||||
}
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode read_databuffer (mng_datap pData,
|
||||
mng_uint8p pBuf,
|
||||
mng_uint32 iSize,
|
||||
mng_uint32 * iRead)
|
||||
{
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_READ_DATABUFFER, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
if (pData->bSuspensionmode)
|
||||
{
|
||||
mng_uint8p pTemp;
|
||||
mng_uint32 iTemp;
|
||||
|
||||
*iRead = 0; /* let's be negative about the outcome */
|
||||
|
||||
if (!pData->pSuspendbuf) /* need to create a suspension buffer ? */
|
||||
{
|
||||
pData->iSuspendbufsize = MNG_SUSPENDBUFFERSIZE;
|
||||
/* so, create it */
|
||||
MNG_ALLOC (pData, pData->pSuspendbuf, pData->iSuspendbufsize)
|
||||
|
||||
pData->iSuspendbufleft = 0; /* make sure to fill it first time */
|
||||
pData->pSuspendbufnext = pData->pSuspendbuf;
|
||||
}
|
||||
/* more than our buffer can hold ? */
|
||||
if (iSize > pData->iSuspendbufsize)
|
||||
{
|
||||
mng_uint32 iRemain;
|
||||
|
||||
if (!pData->pReadbufnext) /* first time ? */
|
||||
{
|
||||
if (pData->iSuspendbufleft) /* do we have some data left ? */
|
||||
{ /* then copy it */
|
||||
MNG_COPY (pBuf, pData->pSuspendbufnext, pData->iSuspendbufleft)
|
||||
/* fixup variables */
|
||||
pData->pReadbufnext = pBuf + pData->iSuspendbufleft;
|
||||
pData->pSuspendbufnext = pData->pSuspendbuf;
|
||||
pData->iSuspendbufleft = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pData->pReadbufnext = pBuf;
|
||||
}
|
||||
}
|
||||
/* calculate how much to get */
|
||||
iRemain = iSize - (mng_uint32)(pData->pReadbufnext - pBuf);
|
||||
/* let's go get it */
|
||||
if (!pData->fReaddata (((mng_handle)pData), pData->pReadbufnext, iRemain, &iTemp))
|
||||
MNG_ERROR (pData, MNG_APPIOERROR);
|
||||
/* first read after suspension return 0 means EOF */
|
||||
if ((pData->iSuspendpoint) && (iTemp == 0))
|
||||
{ /* that makes it final */
|
||||
mng_retcode iRetcode = process_eof (pData);
|
||||
|
||||
if (iRetcode) /* on error bail out */
|
||||
return iRetcode;
|
||||
/* indicate the source is depleted */
|
||||
*iRead = iSize - iRemain + iTemp;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iTemp < iRemain) /* suspension required ? */
|
||||
{
|
||||
pData->pReadbufnext = pData->pReadbufnext + iTemp;
|
||||
pData->bSuspended = MNG_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
*iRead = iSize; /* got it all now ! */
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ /* need to read some more ? */
|
||||
while ((!pData->bSuspended) && (!pData->bEOF) && (iSize > pData->iSuspendbufleft))
|
||||
{ /* not enough space left in buffer ? */
|
||||
if (pData->iSuspendbufsize - pData->iSuspendbufleft -
|
||||
(mng_uint32)(pData->pSuspendbufnext - pData->pSuspendbuf) <
|
||||
MNG_SUSPENDREQUESTSIZE)
|
||||
{
|
||||
if (pData->iSuspendbufleft) /* then lets shift (if there's anything left) */
|
||||
MNG_COPY (pData->pSuspendbuf, pData->pSuspendbufnext, pData->iSuspendbufleft)
|
||||
/* adjust running pointer */
|
||||
pData->pSuspendbufnext = pData->pSuspendbuf;
|
||||
}
|
||||
/* still not enough room ? */
|
||||
if (pData->iSuspendbufsize - pData->iSuspendbufleft < MNG_SUSPENDREQUESTSIZE)
|
||||
MNG_ERROR (pData, MNG_INTERNALERROR)
|
||||
/* now read some more data */
|
||||
pTemp = pData->pSuspendbufnext + pData->iSuspendbufleft;
|
||||
|
||||
if (!pData->fReaddata (((mng_handle)pData), pTemp, MNG_SUSPENDREQUESTSIZE, &iTemp))
|
||||
MNG_ERROR (pData, MNG_APPIOERROR);
|
||||
/* adjust fill-counter */
|
||||
pData->iSuspendbufleft += iTemp;
|
||||
/* first read after suspension returning 0 means EOF */
|
||||
if ((pData->iSuspendpoint) && (iTemp == 0))
|
||||
{ /* that makes it final */
|
||||
mng_retcode iRetcode = process_eof (pData);
|
||||
|
||||
if (iRetcode) /* on error bail out */
|
||||
return iRetcode;
|
||||
|
||||
if (pData->iSuspendbufleft) /* return the leftover scraps */
|
||||
MNG_COPY (pBuf, pData->pSuspendbufnext, pData->iSuspendbufleft)
|
||||
/* and indicate so */
|
||||
*iRead = pData->iSuspendbufleft;
|
||||
pData->pSuspendbufnext = pData->pSuspendbuf;
|
||||
pData->iSuspendbufleft = 0;
|
||||
}
|
||||
else
|
||||
{ /* suspension required ? */
|
||||
if ((iSize > pData->iSuspendbufleft) && (iTemp < MNG_SUSPENDREQUESTSIZE))
|
||||
pData->bSuspended = MNG_TRUE;
|
||||
|
||||
}
|
||||
|
||||
pData->iSuspendpoint = 0; /* reset it here in case we loop back */
|
||||
}
|
||||
|
||||
if ((!pData->bSuspended) && (!pData->bEOF))
|
||||
{ /* return the data ! */
|
||||
MNG_COPY (pBuf, pData->pSuspendbufnext, iSize)
|
||||
|
||||
*iRead = iSize; /* returned it all */
|
||||
/* adjust suspension-buffer variables */
|
||||
pData->pSuspendbufnext += iSize;
|
||||
pData->iSuspendbufleft -= iSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!pData->fReaddata (((mng_handle)pData), (mng_ptr)pBuf, iSize, iRead))
|
||||
{
|
||||
if (iRead == 0) /* suspension required ? */
|
||||
pData->bSuspended = MNG_TRUE;
|
||||
else
|
||||
MNG_ERROR (pData, MNG_APPIOERROR);
|
||||
}
|
||||
}
|
||||
|
||||
pData->iSuspendpoint = 0; /* safely reset it here ! */
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_READ_DATABUFFER, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode process_raw_chunk (mng_datap pData,
|
||||
mng_uint8p pBuf,
|
||||
mng_uint32 iBuflen)
|
||||
{
|
||||
/* the table-idea & binary search code was adapted from
|
||||
libpng 1.1.0 (pngread.c) */
|
||||
/* NOTE1: the table must remain sorted by chunkname, otherwise the binary
|
||||
search will break !!! */
|
||||
/* NOTE2: the layout must remain equal to the header part of all the
|
||||
chunk-structures (yes, that means even the pNext and pPrev fields;
|
||||
it's wasting a bit of space, but hey, the code is a lot easier) */
|
||||
|
||||
mng_chunk_header chunk_unknown = {MNG_UINT_HUH, init_unknown, free_unknown,
|
||||
read_unknown, write_unknown, 0, 0};
|
||||
|
||||
mng_chunk_header chunk_table [] =
|
||||
{
|
||||
{MNG_UINT_BACK, init_back, free_back, read_back, write_back, 0, 0},
|
||||
{MNG_UINT_BASI, init_basi, free_basi, read_basi, write_basi, 0, 0},
|
||||
{MNG_UINT_CLIP, init_clip, free_clip, read_clip, write_clip, 0, 0},
|
||||
{MNG_UINT_CLON, init_clon, free_clon, read_clon, write_clon, 0, 0},
|
||||
{MNG_UINT_DBYK, init_dbyk, free_dbyk, read_dbyk, write_dbyk, 0, 0},
|
||||
{MNG_UINT_DEFI, init_defi, free_defi, read_defi, write_defi, 0, 0},
|
||||
{MNG_UINT_DHDR, init_dhdr, free_dhdr, read_dhdr, write_dhdr, 0, 0},
|
||||
{MNG_UINT_DISC, init_disc, free_disc, read_disc, write_disc, 0, 0},
|
||||
{MNG_UINT_DROP, init_drop, free_drop, read_drop, write_drop, 0, 0},
|
||||
{MNG_UINT_ENDL, init_endl, free_endl, read_endl, write_endl, 0, 0},
|
||||
{MNG_UINT_FRAM, init_fram, free_fram, read_fram, write_fram, 0, 0},
|
||||
{MNG_UINT_IDAT, init_idat, free_idat, read_idat, write_idat, 0, 0}, /* 12-th element! */
|
||||
{MNG_UINT_IEND, init_iend, free_iend, read_iend, write_iend, 0, 0},
|
||||
{MNG_UINT_IHDR, init_ihdr, free_ihdr, read_ihdr, write_ihdr, 0, 0},
|
||||
{MNG_UINT_IJNG, init_ijng, free_ijng, read_ijng, write_ijng, 0, 0},
|
||||
{MNG_UINT_IPNG, init_ipng, free_ipng, read_ipng, write_ipng, 0, 0},
|
||||
#ifdef MNG_INCLUDE_JNG
|
||||
{MNG_UINT_JDAA, init_jdaa, free_jdaa, read_jdaa, write_jdaa, 0, 0},
|
||||
{MNG_UINT_JDAT, init_jdat, free_jdat, read_jdat, write_jdat, 0, 0},
|
||||
{MNG_UINT_JHDR, init_jhdr, free_jhdr, read_jhdr, write_jhdr, 0, 0},
|
||||
{MNG_UINT_JSEP, init_jsep, free_jsep, read_jsep, write_jsep, 0, 0},
|
||||
{MNG_UINT_JdAA, init_jdaa, free_jdaa, read_jdaa, write_jdaa, 0, 0},
|
||||
#endif
|
||||
{MNG_UINT_LOOP, init_loop, free_loop, read_loop, write_loop, 0, 0},
|
||||
{MNG_UINT_MAGN, init_magn, free_magn, read_magn, write_magn, 0, 0},
|
||||
{MNG_UINT_MEND, init_mend, free_mend, read_mend, write_mend, 0, 0},
|
||||
{MNG_UINT_MHDR, init_mhdr, free_mhdr, read_mhdr, write_mhdr, 0, 0},
|
||||
{MNG_UINT_MOVE, init_move, free_move, read_move, write_move, 0, 0},
|
||||
{MNG_UINT_ORDR, init_ordr, free_ordr, read_ordr, write_ordr, 0, 0},
|
||||
{MNG_UINT_PAST, init_past, free_past, read_past, write_past, 0, 0},
|
||||
{MNG_UINT_PLTE, init_plte, free_plte, read_plte, write_plte, 0, 0},
|
||||
{MNG_UINT_PPLT, init_pplt, free_pplt, read_pplt, write_pplt, 0, 0},
|
||||
{MNG_UINT_PROM, init_prom, free_prom, read_prom, write_prom, 0, 0},
|
||||
{MNG_UINT_SAVE, init_save, free_save, read_save, write_save, 0, 0},
|
||||
{MNG_UINT_SEEK, init_seek, free_seek, read_seek, write_seek, 0, 0},
|
||||
{MNG_UINT_SHOW, init_show, free_show, read_show, write_show, 0, 0},
|
||||
{MNG_UINT_TERM, init_term, free_term, read_term, write_term, 0, 0},
|
||||
{MNG_UINT_bKGD, init_bkgd, free_bkgd, read_bkgd, write_bkgd, 0, 0},
|
||||
{MNG_UINT_cHRM, init_chrm, free_chrm, read_chrm, write_chrm, 0, 0},
|
||||
{MNG_UINT_eXPI, init_expi, free_expi, read_expi, write_expi, 0, 0},
|
||||
{MNG_UINT_fPRI, init_fpri, free_fpri, read_fpri, write_fpri, 0, 0},
|
||||
{MNG_UINT_gAMA, init_gama, free_gama, read_gama, write_gama, 0, 0},
|
||||
{MNG_UINT_hIST, init_hist, free_hist, read_hist, write_hist, 0, 0},
|
||||
{MNG_UINT_iCCP, init_iccp, free_iccp, read_iccp, write_iccp, 0, 0},
|
||||
{MNG_UINT_iTXt, init_itxt, free_itxt, read_itxt, write_itxt, 0, 0},
|
||||
{MNG_UINT_nEED, init_need, free_need, read_need, write_need, 0, 0},
|
||||
/* TODO: {MNG_UINT_oFFs, 0, 0, 0, 0, 0, 0}, */
|
||||
/* TODO: {MNG_UINT_pCAL, 0, 0, 0, 0, 0, 0}, */
|
||||
{MNG_UINT_pHYg, init_phyg, free_phyg, read_phyg, write_phyg, 0, 0},
|
||||
{MNG_UINT_pHYs, init_phys, free_phys, read_phys, write_phys, 0, 0},
|
||||
{MNG_UINT_sBIT, init_sbit, free_sbit, read_sbit, write_sbit, 0, 0},
|
||||
/* TODO: {MNG_UINT_sCAL, 0, 0, 0, 0, 0, 0}, */
|
||||
{MNG_UINT_sPLT, init_splt, free_splt, read_splt, write_splt, 0, 0},
|
||||
{MNG_UINT_sRGB, init_srgb, free_srgb, read_srgb, write_srgb, 0, 0},
|
||||
{MNG_UINT_tEXt, init_text, free_text, read_text, write_text, 0, 0},
|
||||
{MNG_UINT_tIME, init_time, free_time, read_time, write_time, 0, 0},
|
||||
{MNG_UINT_tRNS, init_trns, free_trns, read_trns, write_trns, 0, 0},
|
||||
{MNG_UINT_zTXt, init_ztxt, free_ztxt, read_ztxt, write_ztxt, 0, 0},
|
||||
};
|
||||
/* binary search variables */
|
||||
mng_int32 iTop, iLower, iUpper, iMiddle;
|
||||
mng_chunk_headerp pEntry; /* pointer to found entry */
|
||||
mng_chunkid iChunkname; /* the chunk's tag */
|
||||
mng_chunkp pChunk; /* chunk structure (if #define MNG_STORE_CHUNKS) */
|
||||
mng_retcode iRetcode; /* temporary error-code */
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_PROCESS_RAW_CHUNK, MNG_LC_START)
|
||||
#endif
|
||||
/* get the chunkname */
|
||||
iChunkname = (mng_chunkid)(mng_get_uint32 (pBuf));
|
||||
|
||||
pBuf += sizeof (mng_chunkid); /* adjust the buffer */
|
||||
iBuflen -= sizeof (mng_chunkid);
|
||||
/* determine max index of table */
|
||||
iTop = (sizeof (chunk_table) / sizeof (chunk_table [0])) - 1;
|
||||
|
||||
/* binary search; with 52 chunks, worst-case is 7 comparisons */
|
||||
iLower = 0;
|
||||
iMiddle = 11; /* start with the IDAT entry */
|
||||
iUpper = iTop;
|
||||
pEntry = 0; /* no goods yet! */
|
||||
pChunk = 0;
|
||||
|
||||
do /* the binary search itself */
|
||||
{
|
||||
if (chunk_table [iMiddle].iChunkname < iChunkname)
|
||||
iLower = iMiddle + 1;
|
||||
else if (chunk_table [iMiddle].iChunkname > iChunkname)
|
||||
iUpper = iMiddle - 1;
|
||||
else
|
||||
{
|
||||
pEntry = &chunk_table [iMiddle];
|
||||
break;
|
||||
}
|
||||
|
||||
iMiddle = (iLower + iUpper) >> 1;
|
||||
}
|
||||
while (iLower <= iUpper);
|
||||
|
||||
if (!pEntry) /* unknown chunk ? */
|
||||
pEntry = &chunk_unknown; /* make it so! */
|
||||
|
||||
pData->iChunkname = iChunkname; /* keep track of where we are */
|
||||
pData->iChunkseq++;
|
||||
|
||||
if (pEntry->fRead) /* read-callback available ? */
|
||||
{
|
||||
iRetcode = pEntry->fRead (pData, pEntry, iBuflen, (mng_ptr)pBuf, &pChunk);
|
||||
|
||||
if (!iRetcode) /* everything oke ? */
|
||||
{ /* remember unknown chunk's id */
|
||||
if ((pChunk) && (pEntry == &chunk_unknown))
|
||||
((mng_chunk_headerp)pChunk)->iChunkname = iChunkname;
|
||||
}
|
||||
}
|
||||
else
|
||||
iRetcode = MNG_NOERROR;
|
||||
|
||||
if (pChunk) /* store this chunk ? */
|
||||
add_chunk (pData, pChunk); /* do it */
|
||||
|
||||
#ifdef MNG_INCLUDE_JNG /* implicit EOF ? */
|
||||
if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && (!pData->bHasJHDR))
|
||||
#else
|
||||
if ((!pData->bHasMHDR) && (!pData->bHasIHDR))
|
||||
#endif
|
||||
iRetcode = process_eof (pData); /* then do some EOF processing */
|
||||
|
||||
if (iRetcode) /* on error bail out */
|
||||
return iRetcode;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_PROCESS_RAW_CHUNK, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode read_chunk (mng_datap pData)
|
||||
{
|
||||
mng_uint32 iBufmax = pData->iReadbufsize;
|
||||
mng_uint8p pBuf = pData->pReadbuf;
|
||||
mng_uint32 iBuflen = 0; /* number of bytes requested */
|
||||
mng_uint32 iRead = 0; /* number of bytes read */
|
||||
mng_uint32 iCrc; /* calculated CRC */
|
||||
mng_retcode iRetcode = MNG_NOERROR;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_READ_CHUNK, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
#ifdef MNG_SUPPORT_DISPLAY
|
||||
if (pData->pCurraniobj) /* processing an animation object ? */
|
||||
{
|
||||
do /* process it then */
|
||||
{
|
||||
iRetcode = ((mng_object_headerp)pData->pCurraniobj)->fProcess (pData, pData->pCurraniobj);
|
||||
/* refresh needed ? */
|
||||
/* if ((!iRetcode) && (!pData->bTimerset) && (pData->bNeedrefresh))
|
||||
iRetcode = display_progressive_refresh (pData, 1); */
|
||||
/* can we advance to next object ? */
|
||||
if ((!iRetcode) && (pData->pCurraniobj) &&
|
||||
(!pData->bTimerset) && (!pData->bSectionwait))
|
||||
{
|
||||
pData->pCurraniobj = ((mng_object_headerp)pData->pCurraniobj)->pNext;
|
||||
/* TERM processing to be done ? */
|
||||
if ((!pData->pCurraniobj) && (pData->bHasTERM) && (!pData->bHasMHDR))
|
||||
iRetcode = process_display_mend (pData);
|
||||
}
|
||||
} /* until error or a break or no more objects */
|
||||
while ((!iRetcode) && (pData->pCurraniobj) &&
|
||||
(!pData->bTimerset) && (!pData->bSectionwait) && (!pData->bFreezing));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pData->iBreakpoint) /* do we need to finish something first ? */
|
||||
{
|
||||
switch (pData->iBreakpoint) /* return to broken display routine */
|
||||
{
|
||||
case 1 : { iRetcode = process_display_fram2 (pData); break; }
|
||||
case 2 : { iRetcode = process_display_ihdr (pData); break; }
|
||||
case 3 : ; /* same as 4 !!! */
|
||||
case 4 : { iRetcode = process_display_show (pData); break; }
|
||||
case 5 : { iRetcode = process_display_clon2 (pData); break; }
|
||||
#ifdef MNG_INCLUDE_JNG
|
||||
case 7 : { iRetcode = process_display_jhdr (pData); break; }
|
||||
#endif
|
||||
case 6 : ; /* same as 8 !!! */
|
||||
case 8 : { iRetcode = process_display_iend (pData); break; }
|
||||
case 9 : { iRetcode = process_display_magn2 (pData); break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (iRetcode) /* on error bail out */
|
||||
return iRetcode;
|
||||
|
||||
#endif /* MNG_SUPPORT_DISPLAY */
|
||||
/* can we continue processing now, or do we */
|
||||
/* need to wait for the timer to finish (again) ? */
|
||||
#ifdef MNG_SUPPORT_DISPLAY
|
||||
if ((!pData->bTimerset) && (!pData->bSectionwait) && (!pData->bEOF))
|
||||
#else
|
||||
if (!pData->bEOF)
|
||||
#endif
|
||||
{ /* freezing in progress ? */
|
||||
if ((pData->bFreezing) && (pData->iSuspendpoint == 0))
|
||||
pData->bRunning = MNG_FALSE; /* then this is the right moment to do it */
|
||||
|
||||
if (pData->iSuspendpoint <= 2)
|
||||
{
|
||||
iBuflen = sizeof (mng_uint32); /* read length */
|
||||
iRetcode = read_databuffer (pData, pBuf, iBuflen, &iRead);
|
||||
|
||||
if (iRetcode) /* bail on errors */
|
||||
return iRetcode;
|
||||
|
||||
if (pData->bSuspended) /* suspended ? */
|
||||
pData->iSuspendpoint = 2;
|
||||
else /* save the length */
|
||||
pData->iChunklen = mng_get_uint32 (pBuf);
|
||||
|
||||
}
|
||||
|
||||
if (!pData->bSuspended) /* still going ? */
|
||||
{ /* previously suspended or not eof ? */
|
||||
if ((pData->iSuspendpoint > 2) || (iRead == iBuflen))
|
||||
{ /* determine length chunkname + data + crc */
|
||||
iBuflen = pData->iChunklen + (mng_uint32)(sizeof (mng_chunkid) + sizeof (iCrc));
|
||||
|
||||
if (iBuflen < iBufmax) /* does it fit in default buffer ? */
|
||||
{ /* note that we don't use the full size
|
||||
so there's always a zero-byte at the
|
||||
very end !!! */
|
||||
iRetcode = read_databuffer (pData, pBuf, iBuflen, &iRead);
|
||||
|
||||
if (iRetcode) /* bail on errors */
|
||||
return iRetcode;
|
||||
|
||||
if (pData->bSuspended) /* suspended ? */
|
||||
pData->iSuspendpoint = 3;
|
||||
else
|
||||
{
|
||||
if (iRead != iBuflen) /* did we get all the data ? */
|
||||
iRetcode = MNG_UNEXPECTEDEOF;
|
||||
else
|
||||
{
|
||||
mng_uint32 iL = iBuflen - (mng_uint32)(sizeof (iCrc));
|
||||
/* calculate the crc */
|
||||
iCrc = crc (pData, pBuf, iL);
|
||||
/* and check it */
|
||||
if (!(iCrc == mng_get_uint32 (pBuf + iL)))
|
||||
iRetcode = MNG_INVALIDCRC;
|
||||
else
|
||||
iRetcode = process_raw_chunk (pData, pBuf, iL);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!pData->iSuspendpoint) /* create additional large buffer ? */
|
||||
{ /* again reserve space for the last zero-byte */
|
||||
pData->iLargebufsize = iBuflen + 1;
|
||||
MNG_ALLOC (pData, pData->pLargebuf, pData->iLargebufsize)
|
||||
}
|
||||
|
||||
iRetcode = read_databuffer (pData, pData->pLargebuf, iBuflen, &iRead);
|
||||
|
||||
if (iRetcode)
|
||||
return iRetcode;
|
||||
|
||||
if (pData->bSuspended) /* suspended ? */
|
||||
pData->iSuspendpoint = 4;
|
||||
else
|
||||
{
|
||||
if (iRead != iBuflen) /* did we get all the data ? */
|
||||
iRetcode = MNG_UNEXPECTEDEOF;
|
||||
else
|
||||
{
|
||||
mng_uint32 iL = iBuflen - (mng_uint32)(sizeof (iCrc));
|
||||
/* calculate the crc */
|
||||
iCrc = crc (pData, pData->pLargebuf, iL);
|
||||
/* and check it */
|
||||
if (!(iCrc == mng_get_uint32 (pData->pLargebuf + iL)))
|
||||
iRetcode = MNG_INVALIDCRC;
|
||||
else
|
||||
iRetcode = process_raw_chunk (pData, pData->pLargebuf, iL);
|
||||
}
|
||||
/* cleanup additional large buffer */
|
||||
MNG_FREE (pData, pData->pLargebuf, pData->iLargebufsize)
|
||||
}
|
||||
}
|
||||
|
||||
if (iRetcode) /* on error bail out */
|
||||
return iRetcode;
|
||||
|
||||
}
|
||||
else
|
||||
{ /* that's final */
|
||||
iRetcode = process_eof (pData);
|
||||
|
||||
if (iRetcode) /* on error bail out */
|
||||
return iRetcode;
|
||||
|
||||
if ((iRead != 0) || /* did we get an unexpected eof ? */
|
||||
#ifdef MNG_INCLUDE_JNG
|
||||
(pData->bHasIHDR || pData->bHasMHDR || pData->bHasJHDR))
|
||||
#else
|
||||
(pData->bHasIHDR || pData->bHasMHDR))
|
||||
#endif
|
||||
MNG_ERROR (pData, MNG_UNEXPECTEDEOF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_DISPLAY /* refresh needed ? */
|
||||
if ((!pData->bTimerset) && (!pData->bSuspended) && (pData->bNeedrefresh))
|
||||
{
|
||||
iRetcode = display_progressive_refresh (pData, 1);
|
||||
|
||||
if (iRetcode) /* on error bail out */
|
||||
return iRetcode;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_READ_CHUNK, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode read_graphic (mng_datap pData)
|
||||
{
|
||||
mng_uint32 iBuflen; /* number of bytes requested */
|
||||
mng_uint32 iRead; /* number of bytes read */
|
||||
mng_retcode iRetcode; /* temporary error-code */
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_READ_GRAPHIC, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
if (!pData->pReadbuf) /* buffer allocated ? */
|
||||
{
|
||||
pData->iReadbufsize = 4200; /* allocate a default read buffer */
|
||||
MNG_ALLOC (pData, pData->pReadbuf, pData->iReadbufsize)
|
||||
}
|
||||
/* haven't processed the signature ? */
|
||||
if ((!pData->bHavesig) || (pData->iSuspendpoint == 1))
|
||||
{
|
||||
iBuflen = 2 * sizeof (mng_uint32); /* read signature */
|
||||
|
||||
iRetcode = read_databuffer (pData, pData->pReadbuf, iBuflen, &iRead);
|
||||
|
||||
if (iRetcode)
|
||||
return iRetcode;
|
||||
|
||||
if (pData->bSuspended) /* input suspension ? */
|
||||
pData->iSuspendpoint = 1;
|
||||
else
|
||||
{
|
||||
if (iRead != iBuflen) /* full signature received ? */
|
||||
MNG_ERROR (pData, MNG_UNEXPECTEDEOF);
|
||||
/* is it a valid signature ? */
|
||||
if (mng_get_uint32 (pData->pReadbuf) == PNG_SIG)
|
||||
pData->eSigtype = mng_it_png;
|
||||
else
|
||||
if (mng_get_uint32 (pData->pReadbuf) == JNG_SIG)
|
||||
pData->eSigtype = mng_it_jng;
|
||||
else
|
||||
if (mng_get_uint32 (pData->pReadbuf) == MNG_SIG)
|
||||
pData->eSigtype = mng_it_mng;
|
||||
else
|
||||
MNG_ERROR (pData, MNG_INVALIDSIG);
|
||||
/* all of it ? */
|
||||
if (mng_get_uint32 (pData->pReadbuf+4) != POST_SIG)
|
||||
MNG_ERROR (pData, MNG_INVALIDSIG);
|
||||
|
||||
pData->bHavesig = MNG_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pData->bSuspended) /* still going ? */
|
||||
{
|
||||
do
|
||||
{
|
||||
iRetcode = read_chunk (pData); /* process a chunk */
|
||||
|
||||
if (iRetcode) /* on error bail out */
|
||||
return iRetcode;
|
||||
}
|
||||
#ifdef MNG_SUPPORT_DISPLAY /* until EOF or a break-request */
|
||||
while (((!pData->bEOF) || (pData->pCurraniobj)) && (!pData->bSuspended) &&
|
||||
(!pData->bTimerset) && (!pData->bSectionwait));
|
||||
#else
|
||||
while ((!pData->bEOF) && (!pData->bSuspended));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACE (pData, MNG_FN_READ_GRAPHIC, MNG_LC_END)
|
||||
#endif
|
||||
|
||||
return MNG_NOERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* MNG_INCLUDE_READ_PROCS */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_read.h copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : Read management (definition) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * comment : Definition of the read 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 * */
|
||||
/* * * */
|
||||
/* * 0.9.3 - 10/18/2000 - G.Juyn * */
|
||||
/* * - added closestream() processing for mng_cleanup() * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* force ANSI-C */
|
||||
#endif
|
||||
|
||||
#ifndef _libmng_read_h_
|
||||
#define _libmng_read_h_
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode process_eof (mng_datap pData);
|
||||
|
||||
mng_retcode read_graphic (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* _libmng_read_h_ */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,486 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_types.h copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.1 * */
|
||||
/* * * */
|
||||
/* * purpose : type specifications * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * comment : Specification of the types used by the library * */
|
||||
/* * Creates platform-independant structure * */
|
||||
/* * * */
|
||||
/* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */
|
||||
/* * - added iteratechunk callback definition * */
|
||||
/* * 0.5.1 - 05/08/2000 - G.Juyn * */
|
||||
/* * - improved definitions for DLL support * */
|
||||
/* * - added 8-bit palette definition * */
|
||||
/* * - added general array definitions * */
|
||||
/* * - added MNG_NULL definition * */
|
||||
/* * - changed strict-ANSI stuff * */
|
||||
/* * 0.5.1 - 05/11/2000 - G.Juyn * */
|
||||
/* * - changed most callback prototypes to allow the app * */
|
||||
/* * to report errors during callback processing * */
|
||||
/* * 0.5.1 - 05/16/2000 - G.Juyn * */
|
||||
/* * - moved standard header includes into this file * */
|
||||
/* * (stdlib/mem for mem-mngmt & math for fp gamma-calc) * */
|
||||
/* * * */
|
||||
/* * 0.5.2 - 05/18/2000 - G.Juyn * */
|
||||
/* * - B003 - fixed problem with <mem.h> being proprietary * */
|
||||
/* * to Borland platform * */
|
||||
/* * - added helper definitions for JNG (IJG-based) * */
|
||||
/* * - fixed support for IJGSRC6B * */
|
||||
/* * 0.5.2 - 05/24/2000 - G.Juyn * */
|
||||
/* * - added default IJG compression parameters and such * */
|
||||
/* * 0.5.2 - 05/31/2000 - G.Juyn * */
|
||||
/* * - fixed inclusion for memcpy (contributed by Tim Rowley) * */
|
||||
/* * - added mng_int32p (contributed by Tim Rowley) * */
|
||||
/* * 0.5.2 - 06/02/2000 - G.Juyn * */
|
||||
/* * - removed SWAP_ENDIAN reference (contributed by Tim Rowley)* */
|
||||
/* * - added getalphaline callback for RGB8_A8 canvasstyle * */
|
||||
/* * * */
|
||||
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
|
||||
/* * - added speedtype to facilitate testing * */
|
||||
/* * 0.5.3 - 06/27/2000 - G.Juyn * */
|
||||
/* * - added typedef for mng_size_t * */
|
||||
/* * - changed size parameter for memory callbacks to * */
|
||||
/* * mng_size_t * */
|
||||
/* * 0.5.3 - 06/28/2000 - G.Juyn * */
|
||||
/* * - changed definition of 32-bit ints (64-bit platforms) * */
|
||||
/* * - changed definition of mng_handle (64-bit platforms) * */
|
||||
/* * 0.5.3 - 06/29/2000 - G.Juyn * */
|
||||
/* * - changed definition of mng_handle (again) * */
|
||||
/* * - swapped refresh parameters * */
|
||||
/* * - added inclusion of stdlib.h for abs() * */
|
||||
/* * * */
|
||||
/* * 0.9.0 - 06/30/2000 - G.Juyn * */
|
||||
/* * - changed refresh parameters to 'x,y,width,height' * */
|
||||
/* * 0.9.1 - 07/10/2000 - G.Juyn * */
|
||||
/* * - added suspendbuffer constants * */
|
||||
/* * 0.9.1 - 07/15/2000 - G.Juyn * */
|
||||
/* * - added callbacks for SAVE/SEEK processing * */
|
||||
/* * * */
|
||||
/* * 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/12/2000 - G.Juyn * */
|
||||
/* * - added workaround for faulty PhotoShop iCCP chunk * */
|
||||
/* * 0.9.3 - 09/11/2000 - G.Juyn * */
|
||||
/* * - added export of zlib functions from windows dll * */
|
||||
/* * - fixed inclusion parameters once again to make those * */
|
||||
/* * external libs work together * */
|
||||
/* * - re-fixed fixed inclusion parameters * */
|
||||
/* * (these freeking libraries make me mad) * */
|
||||
/* * 0.9.3 - 10/11/2000 - G.Juyn * */
|
||||
/* * - added support for nEED * */
|
||||
/* * 0.9.3 - 10/17/2000 - G.Juyn * */
|
||||
/* * - added callback to process non-critical unknown chunks * */
|
||||
/* * * */
|
||||
/* * 0.9.4 - 11/20/2000 - R.Giles * */
|
||||
/* * - fixed inclusion of lcms header for non-windows platforms * */
|
||||
/* * 0.9.4 - 12/12/2000 - G.Juyn * */
|
||||
/* * - changed callback convention for MSVC (Thanks Chad) * */
|
||||
/* * 0.9.4 - 12/16/2000 - G.Juyn * */
|
||||
/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */
|
||||
/* * * */
|
||||
/* * 1.0.1 - 02/08/2001 - G.Juyn * */
|
||||
/* * - added MEND processing callback * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef _libmng_types_h_
|
||||
#define _libmng_types_h_
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma option -AT /* turn off strict ANSI-C for the moment */
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
#if defined(_WIN32) || defined(__WIN32__) || defined(_Windows) || defined(_WINDOWS)
|
||||
#define WIN32 /* gather them into a single define */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Here's where the external & standard libs are embedded * */
|
||||
/* * * */
|
||||
/* * (it can be a bit of a pain in the lower-back to get them to work * */
|
||||
/* * together) * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifdef WIN32 /* only include needed stuff */
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MNG_USE_DLL
|
||||
#ifdef MNG_SKIP_ZLIB
|
||||
#undef MNG_INCLUDE_ZLIB
|
||||
#endif
|
||||
#ifdef MNG_SKIP_LCMS
|
||||
#undef MNG_INCLUDE_LCMS
|
||||
#endif
|
||||
#ifdef MNG_SKIP_IJG6B
|
||||
#undef MNG_INCLUDE_IJG6B
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MNG_INCLUDE_ZLIB /* zlib by Mark Adler & Jean-loup Gailly */
|
||||
#include "zlib.h"
|
||||
#endif
|
||||
|
||||
#ifdef MNG_INCLUDE_LCMS /* little cms by Marti Maria Saguer */
|
||||
#ifndef ZLIB_DLL
|
||||
#undef FAR
|
||||
#endif
|
||||
#ifdef WIN32 /* different header locations */
|
||||
#include "lcms.h"
|
||||
#else
|
||||
#include "lcms/lcms.h"
|
||||
#endif
|
||||
#endif /* MNG_INCLUDE_LCMS */
|
||||
|
||||
#ifdef MNG_INCLUDE_IJG6B /* IJG's jpgsrc6b */
|
||||
#include <stdio.h>
|
||||
#ifdef MNG_USE_SETJMP
|
||||
#include <setjmp.h> /* needed for error-recovery (blergh) */
|
||||
#else
|
||||
#ifdef WIN32
|
||||
#define USE_WINDOWS_MESSAGEBOX /* display a messagebox under Windoze */
|
||||
#endif
|
||||
#endif /* MNG_USE_SETJMP */
|
||||
#ifdef FAR
|
||||
#undef FAR /* possibly defined by zlib or lcms */
|
||||
#endif
|
||||
#include "jpeglib.h" /* all that for JPEG support :-) */
|
||||
#endif /* MNG_INCLUDE_IJG6B */
|
||||
|
||||
#if defined(MNG_INTERNAL_MEMMNGMT) || defined(MNG_INCLUDE_FILTERS)
|
||||
#include <stdlib.h> /* "calloc" & "free" & "abs" */
|
||||
#endif
|
||||
|
||||
#include <limits.h> /* get proper integer widths */
|
||||
|
||||
#ifdef WIN32
|
||||
/* B003 */
|
||||
#if defined __BORLANDC__
|
||||
#include <mem.h> /* defines "memcpy" for BCB */
|
||||
#else
|
||||
#include <memory.h> /* defines "memcpy" for other win32 platforms */
|
||||
#endif
|
||||
/* B003 */
|
||||
#ifdef MNG_CHECK_BAD_ICCP
|
||||
#include <string.h> /* strncmp() */
|
||||
#endif
|
||||
#else
|
||||
#ifdef BSD
|
||||
#include <strings.h> /* defines "memcpy" for BSD (?) */
|
||||
#else
|
||||
#include <string.h> /* defines "memcpy" for all others (???) */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY)
|
||||
#include <math.h> /* fp gamma-calculation */
|
||||
#endif
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Platform-dependant stuff * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
/* TODO: this may require some elaboration for other platforms;
|
||||
only works with BCB for now */
|
||||
|
||||
#ifndef MNG_DLL
|
||||
#if defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL)
|
||||
#define MNG_DLL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MNG_DLL) && defined(WIN32) /* setup DLL calling conventions */
|
||||
#define MNG_DECL __stdcall
|
||||
#if defined(MNG_BUILD_DLL)
|
||||
#define MNG_EXT __declspec(dllexport)
|
||||
#elif defined(MNG_USE_DLL)
|
||||
#define MNG_EXT __declspec(dllimport)
|
||||
#else
|
||||
#define MNG_EXT
|
||||
#endif
|
||||
#ifdef MNG_STRICT_ANSI
|
||||
#undef MNG_STRICT_ANSI /* can't do strict-ANSI with this DLL-stuff */
|
||||
#endif
|
||||
#else
|
||||
#define MNG_DECL /* dummies for non-DLL */
|
||||
#define MNG_EXT
|
||||
#endif /* MNG_DLL && WIN32 */
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* now force ANSI-C from here on */
|
||||
#endif
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if USHRT_MAX == 0xffffffffU /* get the proper 32-bit width !!! */
|
||||
typedef unsigned short mng_uint32;
|
||||
typedef signed short mng_int32;
|
||||
#elif UINT_MAX == 0xffffffffU
|
||||
typedef unsigned int mng_uint32;
|
||||
typedef signed int mng_int32;
|
||||
#elif ULONG_MAX == 0xffffffffU
|
||||
typedef unsigned long mng_uint32;
|
||||
typedef signed long mng_int32;
|
||||
#else
|
||||
#error "Sorry, I can't find any 32-bit integers on this platform."
|
||||
#endif
|
||||
|
||||
typedef signed short mng_int16; /* other basic integers */
|
||||
typedef unsigned short mng_uint16;
|
||||
typedef signed char mng_int8;
|
||||
typedef unsigned char mng_uint8;
|
||||
|
||||
typedef double mng_float; /* basic float */
|
||||
|
||||
typedef size_t mng_size_t; /* size field for memory allocation */
|
||||
|
||||
typedef char * mng_pchar; /* string */
|
||||
typedef void * mng_ptr; /* generic pointer */
|
||||
typedef void (*mng_fptr) (void); /* generic function pointer */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * Platform-independant from here * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef mng_uint32 * mng_uint32p; /* pointer to unsigned longs */
|
||||
typedef mng_int32 * mng_int32p; /* pointer to longs */
|
||||
typedef mng_uint16 * mng_uint16p; /* pointer to unsigned words */
|
||||
typedef mng_uint8 * mng_uint8p; /* pointer to unsigned bytes */
|
||||
|
||||
typedef mng_int8 mng_bool; /* booleans */
|
||||
|
||||
struct mng_data_struct;
|
||||
typedef struct mng_data_struct * mng_handle; /* generic handle */
|
||||
|
||||
typedef mng_int32 mng_retcode; /* generic return code */
|
||||
typedef mng_int32 mng_chunkid; /* 4-byte chunkname identifier */
|
||||
typedef mng_ptr mng_chunkp; /* pointer to a chunk-structure */
|
||||
typedef mng_ptr mng_objectp; /* pointer to an object-structure */
|
||||
|
||||
typedef mng_chunkid * mng_chunkidp; /* pointer to chunkid */
|
||||
|
||||
typedef struct { /* 8-bit palette element */
|
||||
mng_uint8 iRed;
|
||||
mng_uint8 iGreen;
|
||||
mng_uint8 iBlue;
|
||||
} mng_palette8e;
|
||||
typedef mng_palette8e mng_palette8[256]; /* 8-bit palette */
|
||||
typedef mng_palette8e * mng_palette8ep;
|
||||
|
||||
typedef mng_uint8 mng_uint8arr[256]; /* generic arrays */
|
||||
typedef mng_uint8 mng_uint8arr4[4];
|
||||
typedef mng_uint16 mng_uint16arr[256];
|
||||
typedef mng_uint32 mng_uint32arr2[2];
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#define MNG_FALSE 0
|
||||
#define MNG_TRUE 1
|
||||
#define MNG_NULL 0
|
||||
|
||||
#define MNG_SUSPENDBUFFERSIZE 32768
|
||||
#define MNG_SUSPENDREQUESTSIZE 1024
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifdef MNG_INCLUDE_ZLIB
|
||||
|
||||
/* size of temporary zlib buffer for deflate processing */
|
||||
#define MNG_ZLIB_MAXBUF 8192
|
||||
|
||||
/* default zlib compression parameters for deflateinit2 */
|
||||
#define MNG_ZLIB_LEVEL 9 /* level */
|
||||
#define MNG_ZLIB_METHOD Z_DEFLATED /* method */
|
||||
#define MNG_ZLIB_WINDOWBITS 15 /* window size */
|
||||
#define MNG_ZLIB_MEMLEVEL 9 /* memory level */
|
||||
#define MNG_ZLIB_STRATEGY Z_DEFAULT_STRATEGY /* strategy */
|
||||
|
||||
#define MNG_MAX_IDAT_SIZE 4096 /* maximum size of IDAT data */
|
||||
|
||||
#endif /* MNG_INCLUDE_ZLIB */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifdef MNG_INCLUDE_JNG
|
||||
|
||||
#ifdef MNG_INCLUDE_IJG6B /* IJG helper defs */
|
||||
typedef struct jpeg_compress_struct mngjpeg_comp;
|
||||
typedef struct jpeg_decompress_struct mngjpeg_decomp;
|
||||
typedef struct jpeg_error_mgr mngjpeg_error;
|
||||
typedef struct jpeg_source_mgr mngjpeg_source;
|
||||
|
||||
typedef mngjpeg_comp * mngjpeg_compp;
|
||||
typedef mngjpeg_decomp * mngjpeg_decompp;
|
||||
typedef mngjpeg_error * mngjpeg_errorp;
|
||||
typedef mngjpeg_source * mngjpeg_sourcep;
|
||||
|
||||
typedef J_DCT_METHOD mngjpeg_dctmethod;
|
||||
|
||||
/* default IJG parameters for compression */
|
||||
#define MNG_JPEG_DCT JDCT_DEFAULT /* DCT algorithm (JDCT_ISLOW) */
|
||||
#define MNG_JPEG_QUALITY 100 /* quality 0..100; 100=best */
|
||||
#define MNG_JPEG_SMOOTHING 0 /* default no smoothing */
|
||||
#define MNG_JPEG_PROGRESSIVE MNG_FALSE /* default is just baseline */
|
||||
#define MNG_JPEG_OPTIMIZED MNG_FALSE /* default is not optimized */
|
||||
#endif /* MNG_INCLUDE_IJG6B */
|
||||
|
||||
#define MNG_JPEG_MAXBUF 65500 /* max size of temp JPEG buffer */
|
||||
#define MNG_MAX_JDAT_SIZE 4096 /* maximum size of JDAT data */
|
||||
|
||||
#endif /* MNG_INCLUDE_JNG */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifdef MNG_INCLUDE_LCMS
|
||||
typedef cmsHPROFILE mng_cmsprof; /* little CMS helper defs */
|
||||
typedef cmsHTRANSFORM mng_cmstrans;
|
||||
typedef cmsCIExyY mng_CIExyY;
|
||||
typedef cmsCIExyYTRIPLE mng_CIExyYTRIPLE;
|
||||
typedef LPGAMMATABLE mng_gammatabp;
|
||||
#endif /* MNG_INCLUDE_LCMS */
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
/* enumeration of known graphics types */
|
||||
enum mng_imgtypes {mng_it_unknown, mng_it_png, mng_it_mng, mng_it_jng};
|
||||
typedef enum mng_imgtypes mng_imgtype;
|
||||
|
||||
/* enumeration of animation speed-types */
|
||||
enum mng_speedtypes {mng_st_normal, mng_st_fast, mng_st_slow, mng_st_slowest};
|
||||
typedef enum mng_speedtypes mng_speedtype;
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
/* memory management callbacks */
|
||||
typedef mng_ptr (MNG_DECL *mng_memalloc) (mng_size_t iLen);
|
||||
typedef void (MNG_DECL *mng_memfree) (mng_ptr iPtr,
|
||||
mng_size_t iLen);
|
||||
|
||||
/* I/O management callbacks */
|
||||
typedef mng_bool (MNG_DECL *mng_openstream) (mng_handle hHandle);
|
||||
typedef mng_bool (MNG_DECL *mng_closestream) (mng_handle hHandle);
|
||||
typedef mng_bool (MNG_DECL *mng_readdata) (mng_handle hHandle,
|
||||
mng_ptr pBuf,
|
||||
mng_uint32 iBuflen,
|
||||
mng_uint32p pRead);
|
||||
typedef mng_bool (MNG_DECL *mng_writedata) (mng_handle hHandle,
|
||||
mng_ptr pBuf,
|
||||
mng_uint32 iBuflen,
|
||||
mng_uint32p pWritten);
|
||||
|
||||
/* error & trace processing callbacks */
|
||||
typedef mng_bool (MNG_DECL *mng_errorproc) (mng_handle hHandle,
|
||||
mng_int32 iErrorcode,
|
||||
mng_int8 iSeverity,
|
||||
mng_chunkid iChunkname,
|
||||
mng_uint32 iChunkseq,
|
||||
mng_int32 iExtra1,
|
||||
mng_int32 iExtra2,
|
||||
mng_pchar zErrortext);
|
||||
typedef mng_bool (MNG_DECL *mng_traceproc) (mng_handle hHandle,
|
||||
mng_int32 iFuncnr,
|
||||
mng_int32 iFuncseq,
|
||||
mng_pchar zFuncname);
|
||||
|
||||
/* read processing callbacks */
|
||||
typedef mng_bool (MNG_DECL *mng_processheader) (mng_handle hHandle,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint32 iHeight);
|
||||
typedef mng_bool (MNG_DECL *mng_processtext) (mng_handle hHandle,
|
||||
mng_uint8 iType,
|
||||
mng_pchar zKeyword,
|
||||
mng_pchar zText,
|
||||
mng_pchar zLanguage,
|
||||
mng_pchar zTranslation);
|
||||
typedef mng_bool (MNG_DECL *mng_processsave) (mng_handle hHandle);
|
||||
typedef mng_bool (MNG_DECL *mng_processseek) (mng_handle hHandle,
|
||||
mng_pchar zName);
|
||||
typedef mng_bool (MNG_DECL *mng_processneed) (mng_handle hHandle,
|
||||
mng_pchar zKeyword);
|
||||
typedef mng_bool (MNG_DECL *mng_processmend) (mng_handle hHandle,
|
||||
mng_uint32 iIterationsdone,
|
||||
mng_uint32 iIterationsleft);
|
||||
typedef mng_bool (MNG_DECL *mng_processunknown) (mng_handle hHandle,
|
||||
mng_chunkid iChunkid,
|
||||
mng_uint32 iRawlen,
|
||||
mng_ptr pRawdata);
|
||||
|
||||
/* display processing callbacks */
|
||||
typedef mng_ptr (MNG_DECL *mng_getcanvasline) (mng_handle hHandle,
|
||||
mng_uint32 iLinenr);
|
||||
typedef mng_ptr (MNG_DECL *mng_getbkgdline) (mng_handle hHandle,
|
||||
mng_uint32 iLinenr);
|
||||
typedef mng_ptr (MNG_DECL *mng_getalphaline) (mng_handle hHandle,
|
||||
mng_uint32 iLinenr);
|
||||
typedef mng_bool (MNG_DECL *mng_refresh) (mng_handle hHandle,
|
||||
mng_uint32 iX,
|
||||
mng_uint32 iY,
|
||||
mng_uint32 iWidth,
|
||||
mng_uint32 iHeight);
|
||||
|
||||
/* timer management callbacks */
|
||||
typedef mng_uint32 (MNG_DECL *mng_gettickcount) (mng_handle hHandle);
|
||||
typedef mng_bool (MNG_DECL *mng_settimer) (mng_handle hHandle,
|
||||
mng_uint32 iMsecs);
|
||||
|
||||
/* color management callbacks */
|
||||
typedef mng_bool (MNG_DECL *mng_processgamma) (mng_handle hHandle,
|
||||
mng_uint32 iGamma);
|
||||
typedef mng_bool (MNG_DECL *mng_processchroma) (mng_handle hHandle,
|
||||
mng_uint32 iWhitepointx,
|
||||
mng_uint32 iWhitepointy,
|
||||
mng_uint32 iRedx,
|
||||
mng_uint32 iRedy,
|
||||
mng_uint32 iGreenx,
|
||||
mng_uint32 iGreeny,
|
||||
mng_uint32 iBluex,
|
||||
mng_uint32 iBluey);
|
||||
typedef mng_bool (MNG_DECL *mng_processsrgb) (mng_handle hHandle,
|
||||
mng_uint8 iRenderingintent);
|
||||
typedef mng_bool (MNG_DECL *mng_processiccp) (mng_handle hHandle,
|
||||
mng_uint32 iProfilesize,
|
||||
mng_ptr pProfile);
|
||||
typedef mng_bool (MNG_DECL *mng_processarow) (mng_handle hHandle,
|
||||
mng_uint32 iRowsamples,
|
||||
mng_bool bIsRGBA16,
|
||||
mng_ptr pRow);
|
||||
|
||||
/* chunk access callback(s) */
|
||||
typedef mng_bool (MNG_DECL *mng_iteratechunk) (mng_handle hHandle,
|
||||
mng_handle hChunk,
|
||||
mng_chunkid iChunkid,
|
||||
mng_uint32 iChunkseq);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* _libmng_types_h_ */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_write.c copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : Write management (implementation) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * 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 it's 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 * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#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
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifdef MNG_INCLUDE_WRITE_PROCS
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode 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->fOpenstream ((mng_handle)pData))
|
||||
MNG_ERROR (pData, MNG_APPIOERROR)
|
||||
else
|
||||
{
|
||||
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 it's output routine */
|
||||
iRetcode = ((mng_chunk_headerp)pChunk)->fWrite (pData, pChunk);
|
||||
|
||||
if (iRetcode) /* on error bail out */
|
||||
{
|
||||
MNG_FREE (pData, pData->pWritebuf, pData->iWritebufsize+12)
|
||||
return iRetcode;
|
||||
}
|
||||
/* neeeext */
|
||||
pChunk = ((mng_chunk_headerp)pChunk)->pNext;
|
||||
}
|
||||
/* free the temporary buffer */
|
||||
MNG_FREE (pData, pData->pWritebuf, pData->iWritebufsize+12)
|
||||
|
||||
pData->bWriting = MNG_FALSE; /* done writing */
|
||||
/* close the stream now */
|
||||
if (!pData->fClosestream ((mng_handle)pData))
|
||||
MNG_ERROR (pData, MNG_APPIOERROR)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#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 * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_write.h copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : Write management (definition) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * 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 * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* force ANSI-C */
|
||||
#endif
|
||||
|
||||
#ifndef _libmng_write_h_
|
||||
#define _libmng_write_h_
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode write_graphic (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* _libmng_write_h_ */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
@@ -1,451 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_zlib.c copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : ZLIB library interface (implementation) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * 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 * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
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))
|
||||
{ /* shouldn't we be at the end ? */
|
||||
if (pData->iRow >= (mng_int32)pData->iDataheight)
|
||||
/* MNG_ERROR (pData, MNG_TOOMUCHIDAT) */ ; /* TODO: check this!!! */
|
||||
else
|
||||
{ /* has leveling info ? */
|
||||
/* if (pData->iFilterofs)
|
||||
iRslt = init_rowdiffering (pData);
|
||||
else
|
||||
iRslt = MNG_NOERROR; */
|
||||
/* filter the row if necessary */
|
||||
/* if ((!iRslt) && (pData->iFilterofs < pData->iPixelofs ) &&
|
||||
(*(pData->pWorkrow + pData->iFilterofs)) ) */
|
||||
if (*(pData->pWorkrow + pData->iFilterofs))
|
||||
iRslt = filter_a_row (pData);
|
||||
else
|
||||
iRslt = MNG_NOERROR;
|
||||
/* additonal 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 = 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 = 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);
|
||||
}
|
||||
} /* until some error or EOI */
|
||||
while ((iZrslt == Z_OK) && (pData->sZlib.avail_in > 0));
|
||||
/* 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_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 it's 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 it's 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 * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* * For conditions of distribution and use, * */
|
||||
/* * see copyright notice in libmng.h * */
|
||||
/* ************************************************************************** */
|
||||
/* * * */
|
||||
/* * project : libmng * */
|
||||
/* * file : libmng_zlib.h copyright (c) 2000 G.Juyn * */
|
||||
/* * version : 1.0.0 * */
|
||||
/* * * */
|
||||
/* * purpose : ZLIB package interface (definition) * */
|
||||
/* * * */
|
||||
/* * author : G.Juyn * */
|
||||
/* * web : http://www.3-t.com * */
|
||||
/* * email : mailto:info@3-t.com * */
|
||||
/* * * */
|
||||
/* * comment : Definition of the ZLIB package interface * */
|
||||
/* * * */
|
||||
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
|
||||
/* * - changed strict-ANSI stuff * */
|
||||
/* * * */
|
||||
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
|
||||
/* * - changed file-prefixes * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
||||
#pragma option -A /* force ANSI-C */
|
||||
#endif
|
||||
|
||||
#ifndef _libmng_zlib_h_
|
||||
#define _libmng_zlib_h_
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
mng_retcode mngzlib_initialize (mng_datap pData);
|
||||
mng_retcode mngzlib_cleanup (mng_datap pData);
|
||||
|
||||
mng_retcode mngzlib_inflateinit (mng_datap pData);
|
||||
mng_retcode mngzlib_inflaterows (mng_datap pData,
|
||||
mng_uint32 iInlen,
|
||||
mng_uint8p pIndata);
|
||||
mng_retcode mngzlib_inflatedata (mng_datap pData,
|
||||
mng_uint32 iInlen,
|
||||
mng_uint8p pIndata);
|
||||
mng_retcode mngzlib_inflatefree (mng_datap pData);
|
||||
|
||||
mng_retcode mngzlib_deflateinit (mng_datap pData);
|
||||
mng_retcode mngzlib_deflaterows (mng_datap pData,
|
||||
mng_uint32 iInlen,
|
||||
mng_uint8p pIndata);
|
||||
mng_retcode mngzlib_deflatedata (mng_datap pData,
|
||||
mng_uint32 iInlen,
|
||||
mng_uint8p pIndata);
|
||||
mng_retcode mngzlib_deflatefree (mng_datap pData);
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#endif /* _libmng_zlib_h_ */
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* * end of file * */
|
||||
/* ************************************************************************** */
|
||||
@@ -1,92 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
|
||||
#
|
||||
|
||||
#-----------------------------------------
|
||||
# makefile to build libpng.lib for wintel
|
||||
#-----------------------------------------
|
||||
|
||||
MAKE_OBJ_TYPE=LIB
|
||||
|
||||
!ifdef BUILD_DEBUG_GC
|
||||
LCFLAGS = $(LCFLAGS) -DDEBUG_GC
|
||||
!endif
|
||||
|
||||
EXPORTS = libmng.h libmng_conf.h libmng_types.h
|
||||
|
||||
MODULE=mng
|
||||
DEPTH=..\..\..
|
||||
LOCAL_INCLUDES=-I.
|
||||
LIBRARY_NAME=mng
|
||||
CSRCS=\
|
||||
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 \
|
||||
$(NULL)
|
||||
C_OBJS=\
|
||||
.\$(OBJDIR)\libmng_callback_xs.obj \
|
||||
.\$(OBJDIR)\libmng_chunk_io.obj \
|
||||
.\$(OBJDIR)\libmng_chunk_prc.obj \
|
||||
.\$(OBJDIR)\libmng_chunk_xs.obj \
|
||||
.\$(OBJDIR)\libmng_cms.obj \
|
||||
.\$(OBJDIR)\libmng_display.obj \
|
||||
.\$(OBJDIR)\libmng_dither.obj \
|
||||
.\$(OBJDIR)\libmng_error.obj \
|
||||
.\$(OBJDIR)\libmng_filter.obj \
|
||||
.\$(OBJDIR)\libmng_hlapi.obj \
|
||||
.\$(OBJDIR)\libmng_jpeg.obj \
|
||||
.\$(OBJDIR)\libmng_object_prc.obj \
|
||||
.\$(OBJDIR)\libmng_pixels.obj \
|
||||
.\$(OBJDIR)\libmng_prop_xs.obj \
|
||||
.\$(OBJDIR)\libmng_read.obj \
|
||||
.\$(OBJDIR)\libmng_trace.obj \
|
||||
.\$(OBJDIR)\libmng_write.obj \
|
||||
.\$(OBJDIR)\libmng_zlib.obj \
|
||||
$(NULL)
|
||||
!if "$(MOZ_BITS)" != "16"
|
||||
LINCS=-I$(XPDIST)\public\util -I$(XPDIST)\public\nspr \
|
||||
-I$(XPDIST)\public\zlib -I$(XPDIST)\public\jpeg
|
||||
!endif
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
#export:: $(LIBRARY)
|
||||
install:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib\
|
||||
|
||||
#install:: export
|
||||
@@ -1,52 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
LIBRARY_NAME = nsmng
|
||||
EXPORT_LIBRARY = 1
|
||||
IS_COMPONENT = 1
|
||||
REQUIRES = xpcom string img layout util locale mng jpeg unicharutil
|
||||
|
||||
CPPSRCS = \
|
||||
nsMNGDecoder.cpp \
|
||||
nsMNGModule.cpp \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_INCLUDES = -I$(srcdir)
|
||||
|
||||
EXTRA_DSO_LDOPTS = $(MNG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_LIBS = $(NSPR_LIBS)
|
||||
|
||||
ifndef MOZ_JAVA
|
||||
LOCAL_JMC_SUBDIR = .
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
|
||||
#
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Makefile to build the IMGLIB LIB
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
!ifdef MOZ_JAVA
|
||||
LOCAL_JMC_SUBDIR = .
|
||||
!endif
|
||||
|
||||
|
||||
LIBRARY_NAME = nsmng
|
||||
|
||||
#
|
||||
# Make sure we have MOZILLA_CLIENT defined so we get the
|
||||
# proper JS includes
|
||||
#
|
||||
LCFLAGS = $(LCFLAGS) -DMOZILLA_CLIENT
|
||||
|
||||
!ifdef BUILD_DEBUG_GC
|
||||
LCFLAGS = $(LCFLAGS) -DDEBUG_GC
|
||||
!endif
|
||||
|
||||
LCFLAGS = $(LCFLAGS) /TP
|
||||
|
||||
LLIBS= $(LIBNSPR) \
|
||||
$(DIST)\lib\util.lib \
|
||||
$(DIST)\lib\mng.lib \
|
||||
$(DIST)\lib\jpeg3250.lib \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\zlib.lib \
|
||||
!ifdef NU_CACHE
|
||||
$(DIST)\lib\cache.lib \
|
||||
!endif
|
||||
$(NULL)
|
||||
|
||||
LIBRARY= .\$(OBJDIR)\$(LIBNAME).lib
|
||||
LIBRARY_SUFFIX = $(MOZ_BITS)$(VERSION_NUMBER)
|
||||
|
||||
MAKE_OBJ_TYPE=DLL
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DLLNAME=nsmng
|
||||
DLL1NAME=nsmng
|
||||
PDBFILE=$(DLLNAME).pdb
|
||||
MAPFILE=$(DLLNAME).map
|
||||
DEFFILE=nsmng.def
|
||||
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...)
|
||||
#// (these must be defined before the common makefiles are included)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DLL=.\$(OBJDIR)\$(DLLNAME).dll
|
||||
MAPFILE= $(DLLNAME).map
|
||||
|
||||
|
||||
|
||||
MODULE=img
|
||||
DEPTH=..\..\..
|
||||
|
||||
LINCS=-I$(DEPTH)/dist/public/xpcom -I. -I$(DEPTH)/dist/public/raptor \
|
||||
-I$(DEPTH)/dist/public/jpeg -I$(DEPTH)/dist/public/zlib -I$(DEPTH)/dist/public/img
|
||||
|
||||
CPPSRCS= nsMNGDecoder.cpp nsMNGCallback.cpp
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsMNGDecoder.obj \
|
||||
.\$(OBJDIR)\nsMNGModule.obj
|
||||
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
|
||||
|
||||
@@ -1,456 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Tim Rowley, tor@cs.brown.edu, original author
|
||||
*/
|
||||
|
||||
#include "nsMNGDecoder.h"
|
||||
#include "nsIImgDCallbk.h"
|
||||
#include "nsMemory.h"
|
||||
#include "libmng.h"
|
||||
#include "prinrval.h"
|
||||
|
||||
typedef struct imng_str {
|
||||
|
||||
mng_handle handle;
|
||||
PRUint32 width;
|
||||
PRUint32 height;
|
||||
|
||||
PRUint8 *image; /* full image buffer */
|
||||
PRUint8 *rowbuf; /* ImgDCBHaveRow is destructive. Grrr... */
|
||||
PRUint32 channels; /* How many channels (3 or 4) */
|
||||
|
||||
void *timer_id;
|
||||
|
||||
PRUint8 *writeBuffer; /* Bugzilla 41831 */
|
||||
PRUint32 bufferSize;
|
||||
PRUint32 bufferEnd;
|
||||
PRUint32 bufferPtr;
|
||||
|
||||
PRBool resumeNeeded; /* need to call display_resume? */
|
||||
|
||||
il_container *ic;
|
||||
|
||||
} imng_struct, *imng_structp;
|
||||
|
||||
|
||||
#define EXTRACT_STRUCTS \
|
||||
il_container *ic = (il_container *)mng_get_userdata(handle); \
|
||||
imng_structp imng_p = (imng_structp)ic->ds
|
||||
|
||||
#ifdef DEBUG_tor
|
||||
#define dprintf(x) fprintf x
|
||||
#else
|
||||
#define dprintf(x)
|
||||
#endif
|
||||
|
||||
// Callbacks for libmng
|
||||
//===========================================================
|
||||
|
||||
static mng_bool
|
||||
il_mng_openstream(mng_handle handle)
|
||||
{
|
||||
return MNG_TRUE;
|
||||
}
|
||||
|
||||
|
||||
static mng_bool
|
||||
il_mng_closestream(mng_handle handle)
|
||||
{
|
||||
return MNG_TRUE;
|
||||
}
|
||||
|
||||
static mng_bool
|
||||
il_mng_readdata(mng_handle handle, mng_ptr buf,
|
||||
mng_uint32 size, mng_uint32 *stored)
|
||||
{
|
||||
EXTRACT_STRUCTS;
|
||||
|
||||
dprintf((stderr, "MNG::readdata size=%d buffered=%d\n",
|
||||
size, imng_p->bufferEnd - imng_p->bufferPtr));
|
||||
|
||||
size = PR_MIN(size, imng_p->bufferEnd - imng_p->bufferPtr);
|
||||
memcpy(buf, imng_p->writeBuffer+imng_p->bufferPtr, size);
|
||||
imng_p->bufferPtr += size;
|
||||
*stored = size;
|
||||
|
||||
return MNG_TRUE;
|
||||
}
|
||||
|
||||
static mng_bool
|
||||
il_mng_processheader(mng_handle handle, mng_uint32 width, mng_uint32 height)
|
||||
{
|
||||
EXTRACT_STRUCTS;
|
||||
|
||||
imng_p->width = width;
|
||||
imng_p->height = height;
|
||||
ic->src_header->width = width;
|
||||
ic->src_header->height = height;
|
||||
|
||||
switch (mng_get_alphadepth(handle)) {
|
||||
case 0:
|
||||
dprintf((stderr, "--- MNG ALPHA NONE\n"));
|
||||
ic->image->header.alpha_bits = 0;
|
||||
mng_set_canvasstyle(imng_p->handle, MNG_CANVAS_RGB8);
|
||||
imng_p->channels = 3;
|
||||
break;
|
||||
case 1:
|
||||
dprintf((stderr, "--- MNG ALPHA THRESHHOLD\n"));
|
||||
ic->image->header.alpha_bits = 1;
|
||||
mng_set_canvasstyle(imng_p->handle, MNG_CANVAS_RGBA8);
|
||||
imng_p->channels = 4;
|
||||
break;
|
||||
default:
|
||||
dprintf((stderr, "--- MNG ALPHA 8-BIT\n"));
|
||||
ic->image->header.alpha_bits = 8;
|
||||
mng_set_canvasstyle(imng_p->handle, MNG_CANVAS_RGBA8);
|
||||
imng_p->channels = 4;
|
||||
break;
|
||||
}
|
||||
|
||||
ic->image->header.alpha_shift = 0;
|
||||
ic->image->header.is_interleaved_alpha = TRUE;
|
||||
|
||||
imng_p->image =
|
||||
(unsigned char*)nsMemory::Alloc(imng_p->channels*width*height);
|
||||
memset(imng_p->image, 0, imng_p->channels*width*height);
|
||||
|
||||
imng_p->rowbuf = (unsigned char*)nsMemory::Alloc(imng_p->channels*width);
|
||||
|
||||
ic->imgdcb->ImgDCBImageSize();
|
||||
ic->imgdcb->ImgDCBSetupColorspaceConverter();
|
||||
|
||||
return MNG_TRUE;
|
||||
}
|
||||
|
||||
static mng_ptr
|
||||
il_mng_getcanvasline(mng_handle handle, mng_uint32 iLinenr)
|
||||
{
|
||||
EXTRACT_STRUCTS;
|
||||
|
||||
return imng_p->image+imng_p->channels*imng_p->width*iLinenr;
|
||||
}
|
||||
|
||||
static mng_bool
|
||||
il_mng_refresh(mng_handle handle,
|
||||
mng_uint32 left, mng_uint32 top,
|
||||
mng_uint32 width, mng_uint32 height)
|
||||
{
|
||||
// dprintf((stderr, "=== refresh(top=%d left=%d width=%d height=%d)\n",
|
||||
// top, left, width, height));
|
||||
|
||||
EXTRACT_STRUCTS;
|
||||
|
||||
for (mng_uint32 y=top; y<top+height; y++) {
|
||||
memcpy(imng_p->rowbuf,
|
||||
imng_p->image+y*imng_p->channels*imng_p->width,
|
||||
imng_p->channels*imng_p->width);
|
||||
ic->imgdcb->ImgDCBHaveRow(0 /* color index data */,
|
||||
imng_p->rowbuf /* rgb[a] */,
|
||||
0 /* x-offset */,
|
||||
imng_p->width /* width in pixels */,
|
||||
y /* start row */,
|
||||
1 /* row duplication count */,
|
||||
ilErase /* draw mode */,
|
||||
mng_get_refreshpass(handle) /* pass */);
|
||||
}
|
||||
|
||||
if (mng_get_imagetype(handle) == mng_it_mng) {
|
||||
ic->imgdcb->ImgDCBFlushImage();
|
||||
ic->imgdcb->ImgDCBHaveImageFrame();
|
||||
}
|
||||
|
||||
return MNG_TRUE;
|
||||
}
|
||||
|
||||
|
||||
static mng_uint32
|
||||
il_mng_gettickcount(mng_handle handle)
|
||||
{
|
||||
// dprintf((stderr, "=== gettickcount()\n"));
|
||||
return PR_IntervalToMilliseconds(PR_IntervalNow());
|
||||
}
|
||||
|
||||
static void
|
||||
il_mng_timeout_func(void *data)
|
||||
{
|
||||
mng_handle handle = (mng_handle)data;
|
||||
EXTRACT_STRUCTS;
|
||||
|
||||
// dprintf((stderr, "il_mng_timeout_func\n"));
|
||||
|
||||
imng_p->timer_id = 0;
|
||||
|
||||
int ret = mng_display_resume(handle);
|
||||
if (ret == MNG_NEEDMOREDATA)
|
||||
imng_p->resumeNeeded = PR_TRUE;
|
||||
|
||||
// dprintf((stderr, "il_mng_timeout_func display_resume returned %d\n", ret));
|
||||
}
|
||||
|
||||
static mng_bool
|
||||
il_mng_settimer(mng_handle handle, mng_uint32 msec)
|
||||
{
|
||||
dprintf((stderr, "=== settimer(%d)\n", msec));
|
||||
|
||||
EXTRACT_STRUCTS;
|
||||
|
||||
imng_p->timer_id =
|
||||
ic->imgdcb->ImgDCBSetTimeout(il_mng_timeout_func,
|
||||
(void *)handle,
|
||||
msec);
|
||||
return MNG_TRUE;
|
||||
}
|
||||
|
||||
static mng_ptr
|
||||
il_mng_alloc(mng_size_t size)
|
||||
{
|
||||
void *ptr = nsMemory::Alloc(size);
|
||||
memset(ptr, 0, size);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static void
|
||||
il_mng_free(mng_ptr ptr, mng_size_t size)
|
||||
{
|
||||
nsMemory::Free(ptr);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_tor
|
||||
static mng_bool
|
||||
il_mng_trace(mng_handle handle, mng_int32 iFuncnr, mng_int32 iFuncseq,
|
||||
mng_pchar zFuncname)
|
||||
{
|
||||
dprintf((stderr, "== trace == %s %d %d\n", zFuncname, iFuncnr, iFuncseq));
|
||||
return MNG_TRUE;
|
||||
}
|
||||
|
||||
static mng_bool
|
||||
il_mng_error(mng_handle hHandle, mng_int32 iErrorcode, mng_int8 iSeverity,
|
||||
mng_chunkid iChunkname, mng_uint32 iChunkseq, mng_int32 iExtra1,
|
||||
mng_int32 iExtra2, mng_pchar zErrortext)
|
||||
{
|
||||
dprintf((stderr, "== error == %s\n", zErrortext));
|
||||
return MNG_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Boilerplate methods... *yawn*
|
||||
//===========================================================
|
||||
|
||||
MNGDecoder::MNGDecoder(il_container* aContainer)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
ilContainer = aContainer;
|
||||
}
|
||||
|
||||
|
||||
MNGDecoder::~MNGDecoder(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS1(MNGDecoder, nsIImgDecoder)
|
||||
|
||||
|
||||
NS_METHOD
|
||||
MNGDecoder::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
if (aOuter) return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
il_container *ic = new il_container();
|
||||
if (!ic) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
MNGDecoder *decoder = new MNGDecoder(ic);
|
||||
if (!decoder) {
|
||||
delete ic;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_ADDREF(decoder);
|
||||
rv = decoder->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(decoder);
|
||||
|
||||
/* why are we creating and destroying this object for no reason? */
|
||||
delete ic; /* is a place holder */
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Hooking mozilla and libmng together...
|
||||
//===========================================================
|
||||
|
||||
NS_IMETHODIMP
|
||||
MNGDecoder::ImgDInit()
|
||||
{
|
||||
if( ilContainer != NULL ) {
|
||||
imng_structp imng_p;
|
||||
imng_p = (imng_structp) nsMemory::Alloc(sizeof(imng_struct));
|
||||
if (!imng_p)
|
||||
return PR_FALSE;
|
||||
memset(imng_p, 0, sizeof(imng_struct));
|
||||
|
||||
imng_p->writeBuffer = (PRUint8 *)nsMemory::Alloc(4096);
|
||||
imng_p->bufferSize = 4096;
|
||||
|
||||
ilContainer->image->header.width = ilContainer->dest_width;
|
||||
ilContainer->image->header.height = ilContainer->dest_height;
|
||||
ilContainer->ds = imng_p;
|
||||
imng_p->ic = ilContainer;
|
||||
|
||||
/* Initialize the container's source image header. */
|
||||
/* Always decode to 24 bit pixdepth */
|
||||
|
||||
NI_ColorSpace *src_color_space = ilContainer->src_header->color_space;
|
||||
src_color_space->type = NI_TrueColor;
|
||||
src_color_space->pixmap_depth = 24;
|
||||
src_color_space->bit_alloc.index_depth = 0;
|
||||
|
||||
/* pass ic as user data */
|
||||
imng_p->handle =
|
||||
mng_initialize(ilContainer, il_mng_alloc, il_mng_free, NULL);
|
||||
|
||||
////////////
|
||||
// Gamma correction - gross hack, but it's what mozilla's PNG
|
||||
// decoder does and nobody has complained yet...
|
||||
double LUT_exponent, CRT_exponent = 2.2, display_exponent;
|
||||
|
||||
/* set up gamma correction for Mac, Unix and (Win32 and everything else)
|
||||
* using educated guesses for display-system exponents; do preferences
|
||||
* later */
|
||||
|
||||
#if defined(XP_MAC)
|
||||
LUT_exponent = 1.8 / 2.61;
|
||||
#elif defined(XP_UNIX)
|
||||
# if defined(__sgi)
|
||||
LUT_exponent = 1.0 / 1.7; /* typical default for SGI console */
|
||||
# elif defined(NeXT)
|
||||
LUT_exponent = 1.0 / 2.2; /* typical default for NeXT cube */
|
||||
# else
|
||||
LUT_exponent = 1.0; /* default for most other Unix workstations */
|
||||
# endif
|
||||
#else
|
||||
LUT_exponent = 1.0; /* virtually all PCs and most other systems */
|
||||
#endif
|
||||
|
||||
/* (alternatively, could check for SCREEN_GAMMA environment variable) */
|
||||
display_exponent = LUT_exponent * CRT_exponent;
|
||||
mng_set_dfltimggamma(imng_p->handle, 0.45455);
|
||||
mng_set_displaygamma(imng_p->handle, display_exponent);
|
||||
////////////
|
||||
|
||||
mng_setcb_openstream(imng_p->handle, il_mng_openstream);
|
||||
mng_setcb_closestream(imng_p->handle, il_mng_closestream);
|
||||
mng_setcb_readdata(imng_p->handle, il_mng_readdata);
|
||||
mng_setcb_processheader(imng_p->handle, il_mng_processheader);
|
||||
mng_setcb_getcanvasline(imng_p->handle, il_mng_getcanvasline);
|
||||
mng_setcb_refresh(imng_p->handle, il_mng_refresh);
|
||||
mng_setcb_gettickcount(imng_p->handle, il_mng_gettickcount);
|
||||
mng_setcb_settimer(imng_p->handle, il_mng_settimer);
|
||||
mng_setcb_memalloc(imng_p->handle, il_mng_alloc);
|
||||
mng_setcb_memfree(imng_p->handle, il_mng_free);
|
||||
mng_set_suspensionmode(imng_p->handle, MNG_TRUE);
|
||||
|
||||
if (mng_readdisplay(imng_p->handle) == MNG_NEEDMOREDATA)
|
||||
imng_p->resumeNeeded = PR_TRUE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
MNGDecoder::ImgDWriteReady(PRUint32 *max_read)
|
||||
{
|
||||
dprintf((stderr, "MNG::ImgDWriteReady() = "));
|
||||
|
||||
imng_structp imng_p = (imng_structp)ilContainer->ds;
|
||||
|
||||
/* add a bit, because libimg actually believes us if max_read==0 */
|
||||
*max_read = imng_p->bufferSize - imng_p->bufferEnd + 1024;
|
||||
|
||||
dprintf((stderr, "%d\n", *max_read));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
MNGDecoder::ImgDWrite(const unsigned char *buf, int32 len)
|
||||
{
|
||||
dprintf((stderr, "MNG::ImgDWrite(%d)\n", len));
|
||||
|
||||
if (ilContainer != NULL) {
|
||||
imng_structp imng_p = (imng_structp)ilContainer->ds;
|
||||
|
||||
if (imng_p->bufferEnd+len > imng_p->bufferSize) {
|
||||
imng_p->bufferSize *= 2;
|
||||
imng_p->writeBuffer = (PRUint8 *)
|
||||
nsMemory::Realloc(imng_p->writeBuffer, imng_p->bufferSize);
|
||||
}
|
||||
|
||||
memcpy(imng_p->writeBuffer+imng_p->bufferEnd, buf, len);
|
||||
imng_p->bufferEnd += len;
|
||||
|
||||
if (imng_p->resumeNeeded) {
|
||||
// dprintf((stderr, "MNG::ImgDWrite display_resume\n"));
|
||||
imng_p->resumeNeeded = PR_FALSE;
|
||||
int ret = mng_display_resume(imng_p->handle);
|
||||
if (ret == MNG_NEEDMOREDATA)
|
||||
imng_p->resumeNeeded = PR_TRUE;
|
||||
// dprintf((stderr, "MNG::ImgDWrite display_resume returned %d\n", ret));
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
MNGDecoder::ImgDComplete()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
MNGDecoder::ImgDAbort()
|
||||
{
|
||||
if( ilContainer != NULL ) {
|
||||
imng_structp imng_p = (imng_structp)ilContainer->ds;
|
||||
|
||||
if (!imng_p)
|
||||
return NS_OK;
|
||||
|
||||
if (imng_p->timer_id) {
|
||||
ilContainer->imgdcb->ImgDCBClearTimeout(imng_p->timer_id);
|
||||
imng_p->timer_id = 0;
|
||||
}
|
||||
|
||||
mng_display_freeze(imng_p->handle);
|
||||
mng_cleanup(&imng_p->handle);
|
||||
nsMemory::Free(imng_p->writeBuffer);
|
||||
nsMemory::Free(imng_p->image);
|
||||
nsMemory::Free(imng_p->rowbuf);
|
||||
nsMemory::Free(imng_p);
|
||||
imng_p = NULL;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Tim Rowley, tor@cs.brown.edu, original author
|
||||
*/
|
||||
|
||||
#ifndef nsMNGDecoder_h___
|
||||
#define nsMNGDecoder_h___
|
||||
|
||||
#include "nsIImgDecoder.h"
|
||||
|
||||
/* d73f1676-1dd1-11b2-ba33-aabc09e02d10 */
|
||||
|
||||
#define NS_MNGDECODER_CID \
|
||||
{ 0xd73f1676, 0x1dd1, 0x11b2, \
|
||||
{ 0xba, 0x33, 0xaa, 0xbc, 0x09, 0xe0, 0x2d, 0x10 } }
|
||||
|
||||
class MNGDecoder : public nsIImgDecoder
|
||||
{
|
||||
public:
|
||||
MNGDecoder(il_container* aContainer);
|
||||
virtual ~MNGDecoder();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
static NS_METHOD Create(nsISupports *aOuter, const nsIID &aIID, void **aResult);
|
||||
|
||||
/* stream */
|
||||
NS_IMETHOD ImgDInit();
|
||||
|
||||
NS_IMETHOD ImgDWriteReady(PRUint32 *max_read);
|
||||
NS_IMETHOD ImgDWrite(const unsigned char *buf, int32 len);
|
||||
NS_IMETHOD ImgDComplete();
|
||||
NS_IMETHOD ImgDAbort();
|
||||
|
||||
NS_IMETHOD_(il_container *) SetContainer(il_container *ic){ilContainer = ic; return ic;}
|
||||
NS_IMETHOD_(il_container *) GetContainer() {return ilContainer;}
|
||||
|
||||
|
||||
private:
|
||||
il_container* ilContainer;
|
||||
};
|
||||
|
||||
#endif /* nsMNGDecoder_h___ */
|
||||
@@ -1,44 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Tim Rowley, tor@cs.brown.edu, original author
|
||||
*/
|
||||
|
||||
#include "nsMNGDecoder.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
static NS_DEFINE_CID(kMNGDecoderCID, NS_MNGDECODER_CID);
|
||||
|
||||
static nsModuleComponentInfo components[] =
|
||||
{
|
||||
{ "MNG Decoder",
|
||||
NS_MNGDECODER_CID,
|
||||
"@mozilla.org/image/decoder;1?type=video/x-mng",
|
||||
MNGDecoder::Create },
|
||||
{ "JNG Decoder",
|
||||
NS_MNGDECODER_CID,
|
||||
"@mozilla.org/image/decoder;1?type=image/x-jng",
|
||||
MNGDecoder::Create }
|
||||
};
|
||||
|
||||
NS_IMPL_NSGETMODULE(nsMNGModule, components)
|
||||
@@ -1,14 +0,0 @@
|
||||
;
|
||||
; temp def file for nsmng dll
|
||||
;
|
||||
|
||||
LIBRARY nsmng.dll
|
||||
DESCRIPTION 'test dll'
|
||||
|
||||
EXPORTS
|
||||
ImgDInit @1002 PRIVATE
|
||||
ImgDWrite @1003 PRIVATE
|
||||
ImgDWriteReady @1004 PRIVATE
|
||||
ImgDComplete @1005 PRIVATE
|
||||
ImgDAbort @1006 PRIVATE
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
_NSGetModule ; 1
|
||||
@@ -1,900 +0,0 @@
|
||||
CHANGES - changes for libpng
|
||||
|
||||
version 0.2
|
||||
added reader into png.h
|
||||
fixed small problems in stub file
|
||||
version 0.3
|
||||
added pull reader
|
||||
split up pngwrite.c to several files
|
||||
added pnglib.txt
|
||||
added example.c
|
||||
cleaned up writer, adding a few new tranformations
|
||||
fixed some bugs in writer
|
||||
interfaced with zlib 0.5
|
||||
added K&R support
|
||||
added check for 64 KB blocks for 16 bit machines
|
||||
version 0.4
|
||||
cleaned up code and commented code
|
||||
simplified time handling into png_time
|
||||
created png_color_16 and png_color_8 to handle color needs
|
||||
cleaned up color type defines
|
||||
fixed various bugs
|
||||
made various names more consistant
|
||||
interfaced with zlib 0.71
|
||||
cleaned up zTXt reader and writer (using zlib's Reset functions)
|
||||
split transformations into pngrtran.c and pngwtran.c
|
||||
version 0.5
|
||||
interfaced with zlib 0.8
|
||||
fixed many reading and writing bugs
|
||||
saved using 3 spaces instead of tabs
|
||||
version 0.6
|
||||
added png_large_malloc() and png_large_free()
|
||||
added png_size_t
|
||||
cleaned up some compiler warnings
|
||||
added png_start_read_image()
|
||||
version 0.7
|
||||
cleaned up lots of bugs
|
||||
finished dithering and other stuff
|
||||
added test program
|
||||
changed name from pnglib to libpng
|
||||
version 0.71 [June, 1995]
|
||||
changed pngtest.png for zlib 0.93
|
||||
fixed error in libpng.txt and example.c
|
||||
version 0.8
|
||||
cleaned up some bugs
|
||||
added png_set_filler()
|
||||
split up pngstub.c into pngmem.c, pngio.c, and pngerror.c
|
||||
added #define's to remove unwanted code
|
||||
moved png_info_init() to png.c
|
||||
added old_size into png_realloc()
|
||||
added functions to manually set filtering and compression info
|
||||
changed compression parameters based on image type
|
||||
optimized filter selection code
|
||||
added version info
|
||||
changed external functions passing floats to doubles (k&r problems?)
|
||||
put all the configurable stuff in pngconf.h
|
||||
enabled png_set_shift to work with paletted images on read
|
||||
added png_read_update_info() - updates info structure with
|
||||
transformations
|
||||
version 0.81 [August, 1995]
|
||||
incorporated Tim Wegner's medium model code (thanks, Tim)
|
||||
version 0.82 [September, 1995]
|
||||
[unspecified changes]
|
||||
version 0.85 [December, 1995]
|
||||
added more medium model code (almost everything's a far)
|
||||
added i/o, error, and memory callback functions
|
||||
fixed some bugs (16 bit, 4 bit interlaced, etc.)
|
||||
added first run progressive reader (barely tested)
|
||||
version 0.86 [January, 1996]
|
||||
fixed bugs
|
||||
improved documentation
|
||||
version 0.87 [January, 1996]
|
||||
fixed medium model bugs
|
||||
fixed other bugs introduced in 0.85 and 0.86
|
||||
added some minor documentation
|
||||
version 0.88 [January, 1996]
|
||||
fixed progressive bugs
|
||||
replaced tabs with spaces
|
||||
cleaned up documentation
|
||||
added callbacks for read/write and warning/error functions
|
||||
version 0.89 [July, 1996]
|
||||
added new initialization API to make libpng work better with shared libs
|
||||
we now have png_create_read_struct(), png_create_write_struct(),
|
||||
png_create_info_struct(), png_destroy_read_struct(), and
|
||||
png_destroy_write_struct() instead of the separate calls to
|
||||
malloc and png_read_init(), png_info_init(), and png_write_init()
|
||||
changed warning/error callback functions to fix bug - this means you
|
||||
should use the new initialization API if you were using the old
|
||||
png_set_message_fn() calls, and that the old API no longer exists
|
||||
so that people are aware that they need to change their code
|
||||
changed filter selection API to allow selection of multiple filters
|
||||
since it didn't work in previous versions of libpng anyways
|
||||
optimized filter selection code
|
||||
fixed png_set_background() to allow using an arbitrary RGB color for
|
||||
paletted images
|
||||
fixed gamma and background correction for paletted images, so
|
||||
png_correct_palette is not needed unless you are correcting an
|
||||
external palette (you will need to #define PNG_CORRECT_PALETTE_SUPPORTED
|
||||
in pngconf.h) - if nobody uses this, it may disappear in the future.
|
||||
fixed bug with Borland 64K memory allocation (Alexander Lehmann)
|
||||
fixed bug in interlace handling (Smarasderagd, I think)
|
||||
added more error checking for writing and image to reduce invalid files
|
||||
separated read and write functions so that they won't both be linked
|
||||
into a binary when only reading or writing functionality is used
|
||||
new pngtest image also has interlacing and zTXt
|
||||
updated documentation to reflect new API
|
||||
version 0.90 [January, 1997]
|
||||
made CRC errors/warnings on critical and ancillary chunks configurable
|
||||
libpng will use the zlib CRC routines by (compile-time) default
|
||||
changed DOS small/medium model memory support - needs zlib 1.04 (Tim Wegner)
|
||||
added external C++ wrapper statements to png.h (Gilles Dauphin)
|
||||
allow PNG file to be read when some or all of file signature has already
|
||||
been read from the beginning of the stream. ****This affects the size
|
||||
of info_struct and invalidates all programs that use a shared libpng****
|
||||
fixed png_filler() declarations
|
||||
fixed? background color conversions
|
||||
fixed order of error function pointers to match documentation
|
||||
current chunk name is now available in png_struct to reduce the number
|
||||
of nearly identical error messages (will simplify multi-lingual
|
||||
support when available)
|
||||
try to get ready for unknown-chunk callback functions:
|
||||
- previously read critical chunks are flagged, so the chunk handling
|
||||
routines can determine if the chunk is in the right place
|
||||
- all chunk handling routines have the same prototypes, so we will
|
||||
be able to handle all chunks via a callback mechanism
|
||||
try to fix Linux "setjmp" buffer size problems
|
||||
removed png_large_malloc, png_large_free, and png_realloc functions.
|
||||
version 0.95 [March, 1997]
|
||||
fixed bug in pngwutil.c allocating "up_row" twice and "avg_row" never
|
||||
fixed bug in PNG file signature compares when start != 0
|
||||
changed parameter type of png_set_filler(...filler...) from png_byte
|
||||
to png_uint_32
|
||||
added test for MACOS to ensure that both math.h and fp.h are not #included
|
||||
added macros for libpng to be compiled as a Windows DLL (Andreas Kupries)
|
||||
added "packswap" transformation, which changes the endianness of
|
||||
packed-pixel bytes (Kevin Bracey)
|
||||
added "strip_alpha" transformation, which removes the alpha channel of
|
||||
input images without using it (not neccesarily a good idea)
|
||||
added "swap_alpha" transformation, which puts the alpha channel in front
|
||||
of the color bytes instead of after
|
||||
removed all implicit variable tests which assume NULL == 0 (I think)
|
||||
changed several variables to "png_size_t" to show 16/32-bit limitations
|
||||
added new pCAL chunk read/write support
|
||||
added experimental filter selection weighting (Greg Roelofs)
|
||||
removed old png_set_rgbx() and png_set_xrgb() functions that have been
|
||||
obsolete for about 2 years now (use png_set_filler() instead)
|
||||
added macros to read 16- and 32-bit ints directly from buffer, to be
|
||||
used only on those systems that support it (namely PowerPC and 680x0)
|
||||
With some testing, this may become the default for MACOS/PPC systems.
|
||||
only calculate CRC on data if we are going to use it
|
||||
added macros for zTXt compression type PNG_zTXt_COMPRESSION_???
|
||||
added macros for simple libpng debugging output selectable at compile time
|
||||
removed PNG_READ_END_MODE in progressive reader (Smarasderagd)
|
||||
more description of info_struct in libpng.txt and png.h
|
||||
more instructions in example.c
|
||||
more chunk types tested in pngtest.c
|
||||
renamed pngrcb.c to pngset.c, and all png_read_<chunk> functions to be
|
||||
png_set_<chunk>. We now have corresponding png_get_<chunk>
|
||||
functions in pngget.c to get infomation in info_ptr. This isolates
|
||||
the application from the internal organization of png_info_struct
|
||||
(good for shared library implementations).
|
||||
version 0.96 [May, 1997]
|
||||
fixed serious bug with < 8bpp images introduced in 0.95
|
||||
fixed 256-color transparency bug (Greg Roelofs)
|
||||
fixed up documentation (Greg Roelofs, Laszlo Nyul)
|
||||
fixed "error" in pngconf.h for Linux setjmp() behaviour
|
||||
fixed DOS medium model support (Tim Wegner)
|
||||
fixed png_check_keyword() for case with error in static string text
|
||||
added read of CRC after IEND chunk for embedded PNGs (Laszlo Nyul)
|
||||
added typecasts to quiet compiler errors
|
||||
added more debugging info
|
||||
version 0.97 [January, 1998]
|
||||
removed PNG_USE_OWN_CRC capability
|
||||
relocated png_set_crc_action from pngrutil.c to pngrtran.c
|
||||
fixed typecasts of "new_key", etc. (Andreas Dilger)
|
||||
added RFC 1152 [sic] date support
|
||||
fixed bug in gamma handling of 4-bit grayscale
|
||||
added 2-bit grayscale gamma handling (Glenn R-P)
|
||||
added more typecasts. 65536L becomes (png_uint_32)65536L, etc. (Glenn R-P)
|
||||
minor corrections in libpng.txt
|
||||
added simple sRGB support (Glenn R-P)
|
||||
easier conditional compiling, e.g. define PNG_READ/WRITE_NOT_FULLY_SUPPORTED;
|
||||
all configurable options can be selected from command-line instead
|
||||
of having to edit pngconf.h (Glenn R-P)
|
||||
fixed memory leak in pngwrite.c (free info_ptr->text) (Glenn R-P)
|
||||
added more conditions for png_do_background, to avoid changing
|
||||
black pixels to background when a background is supplied and
|
||||
no pixels are transparent
|
||||
repaired PNG_NO_STDIO behaviour
|
||||
tested NODIV support and made it default behaviour (Greg Roelofs)
|
||||
added "-m" option and PNGTEST_DEBUG_MEMORY to pngtest (John Bowler)
|
||||
regularized version numbering scheme and bumped shared-library major
|
||||
version number to 2 to avoid problems with libpng 0.89 apps (Greg Roelofs)
|
||||
version 0.98 [January, 1998]
|
||||
cleaned up some typos in libpng.txt and in code documentation
|
||||
fixed memory leaks in pCAL chunk processing (Glenn R-P and John Bowler)
|
||||
cosmetic change "display_gamma" to "screen_gamma" in pngrtran.c
|
||||
changed recommendation about file_gamma for PC images to .51 from .45,
|
||||
in example.c and libpng.txt, added comments to distinguish between
|
||||
screen_gamma, viewing_gamma, and display_gamma.
|
||||
changed all references to RFC1152 to read RFC1123 and changed the
|
||||
PNG_TIME_RFC1152_SUPPORTED macro to PNG_TIME_RFC1123_SUPPORTED
|
||||
added png_invert_alpha capability (Glenn R-P -- suggestion by Jon Vincent)
|
||||
changed srgb_intent from png_byte to int to avoid compiler bugs
|
||||
version 0.99 [January 30, 1998]
|
||||
free info_ptr->text instead of end_info_ptr->text in pngread.c (John Bowler)
|
||||
fixed a longstanding "packswap" bug in pngtrans.c
|
||||
fixed some inconsistencies in pngconf.h that prevented compiling with
|
||||
PNG_READ_GAMMA_SUPPORTED and PNG_READ_hIST_SUPPORTED undefined
|
||||
fixed some typos and made other minor rearrangement of libpng.txt (Andreas)
|
||||
changed recommendation about file_gamma for PC images to .50 from .51 in
|
||||
example.c and libpng.txt, and changed file_gamma for sRGB images to .45
|
||||
added a number of functions to access information from the png structure
|
||||
png_get_image_height(), etc. (Glenn R-P, suggestion by Brad Pettit)
|
||||
added TARGET_MACOS similar to zlib-1.0.8
|
||||
define PNG_ALWAYS_EXTERN when __MWERKS__ && WIN32 are defined
|
||||
added type casting to all png_malloc() function calls
|
||||
version 0.99a [January 31, 1998]
|
||||
Added type casts and parentheses to all returns that return a value.(Tim W.)
|
||||
version 0.99b [February 4, 1998]
|
||||
Added type cast png_uint_32 on malloc function calls where needed.
|
||||
Changed type of num_hist from png_uint_32 to int (same as num_palette).
|
||||
Added checks for rowbytes overflow, in case png_size_t is less than 32 bits.
|
||||
Renamed makefile.elf to makefile.lnx.
|
||||
version 0.99c [February 7, 1998]
|
||||
More type casting. Removed erroneous overflow test in pngmem.c.
|
||||
Added png_buffered_memcpy() and png_buffered_memset(), apply them to rowbytes.
|
||||
Added UNIX manual pages libpng.3 (incorporating libpng.txt) and png.5.
|
||||
version 0.99d [February 11, 1998]
|
||||
Renamed "far_to_near()" "png_far_to_near()"
|
||||
Revised libpng.3
|
||||
Version 99c "buffered" operations didn't work as intended. Replaced them
|
||||
with png_memcpy_check() and png_memset_check().
|
||||
Added many "if (png_ptr == NULL) return" to quell compiler warnings about
|
||||
unused png_ptr, mostly in pngget.c and pngset.c.
|
||||
Check for overlength tRNS chunk present when indexed-color PLTE is read.
|
||||
Cleaned up spelling errors in libpng.3/libpng.txt
|
||||
Corrected a problem with png_get_tRNS() which returned undefined trans array
|
||||
version 0.99e [February 28, 1998]
|
||||
Corrected png_get_tRNS() again.
|
||||
Add parentheses for easier reading of pngget.c, fixed "||" should be "&&".
|
||||
Touched up example.c to make more of it compileable, although the entire
|
||||
file still can't be compiled (Willem van Schaik)
|
||||
Fixed a bug in png_do_shift() (Bryan Tsai)
|
||||
Added a space in png.h prototype for png_write_chunk_start()
|
||||
Replaced pngtest.png with one created with zlib 1.1.1
|
||||
Changed pngtest to report PASS even when file size is different (Jean-loup G.)
|
||||
Corrected some logic errors in png_do_invert_alpha() (Chris Patterson)
|
||||
version 0.99f [March 5, 1998]
|
||||
Corrected a bug in pngpread() introduced in version 99c (Kevin Bracey)
|
||||
Moved makefiles into a "scripts" directory, and added INSTALL instruction file
|
||||
Added makefile.os2 and pngos2.def (A. Zabolotny) and makefile.s2x (W. Sebok)
|
||||
Added pointers to "note on libpng versions" in makefile.lnx and README
|
||||
Added row callback feature when reading and writing nonprogressive rows
|
||||
and added a test of this feature in pngtest.c
|
||||
Added user transform callbacks, with test of the feature in pngtest.c
|
||||
version 0.99g [March 6, 1998, morning]
|
||||
Minor changes to pngtest.c to suppress compiler warnings.
|
||||
Removed "beta" language from documentation.
|
||||
version 0.99h [March 6, 1998, evening]
|
||||
Minor changes to previous minor changes to pngtest.c
|
||||
Changed PNG_READ_NOT_FULLY_SUPPORTED to PNG_READ_TRANSFORMS_NOT_SUPPORTED
|
||||
and added PNG_PROGRESSIVE_READ_NOT_SUPPORTED macro
|
||||
Added user transform capability
|
||||
version 1.00 [March 7, 1998]
|
||||
Changed several typedefs in pngrutil.c
|
||||
Added makefile.wat (Pawel Mrochen), updated makefile.tc3 (Willem van Schaik)
|
||||
replaced "while(1)" with "for(;;)"
|
||||
added PNGARG() to prototypes in pngtest.c and removed some prototypes
|
||||
updated some of the makefiles (Tom Lane)
|
||||
changed some typedefs (s_start, etc.) in pngrutil.c
|
||||
fixed dimensions of "short_months" array in pngwrite.c
|
||||
Replaced ansi2knr.c with the one from jpeg-v6
|
||||
version 1.0.0 [March 8, 1998]
|
||||
Changed name from 1.00 to 1.0.0 (Adam Costello)
|
||||
Added smakefile.ppc (with SCOPTIONS.ppc) for Amiga PPC (Andreas Kleinert)
|
||||
version 1.0.0a [March 9, 1998]
|
||||
Fixed three bugs in pngrtran.c to make gamma+background handling consistent
|
||||
(Greg Roelofs)
|
||||
Changed format of the PNG_LIBPNG_VER integer to xyyzz instead of xyz
|
||||
for major, minor, and bugfix releases. This is 10001. (Adam Costello,
|
||||
Tom Lane)
|
||||
Make months range from 1-12 in png_convert_to_rfc1123
|
||||
version 1.0.0b [March 13, 1998]
|
||||
Quieted compiler complaints about two empty "for" loops in pngrutil.c
|
||||
Minor changes to makefile.s2x
|
||||
Removed #ifdef/#endif around a png_free() in pngread.c
|
||||
version 1.0.1 [March 14, 1998]
|
||||
Changed makefile.s2x to reduce security risk of using a relative pathname
|
||||
Fixed some typos in the documentation (Greg).
|
||||
Fixed a problem with value of "channels" returned by png_read_update_info()
|
||||
version 1.0.1a [April 21, 1998]
|
||||
Optimized Paeth calculations by replacing abs() function calls with intrinsics
|
||||
plus other loop optimizations. Improves avg decoding speed by about 20%.
|
||||
Commented out i386istic "align" compiler flags in makefile.lnx.
|
||||
Reduced the default warning level in some makefiles, to make them consistent.
|
||||
Removed references to IJG and JPEG in the ansi2knr.c copyright statement.
|
||||
Fixed a bug in png_do_strip_filler with XXRRGGBB => RRGGBB transformation.
|
||||
Added grayscale and 16-bit capability to png_do_read_filler().
|
||||
Fixed a bug in pngset.c, introduced in version 0.99c, that sets rowbytes
|
||||
too large when writing an image with bit_depth < 8 (Bob Dellaca).
|
||||
Corrected some bugs in the experimental weighted filtering heuristics.
|
||||
Moved a misplaced pngrutil code block that truncates tRNS if it has more
|
||||
than num_palette entries -- test was done before num_palette was defined.
|
||||
Fixed a png_convert_to_rfc1123() bug that converts day 31 to 0 (Steve Eddins).
|
||||
Changed compiler flags in makefile.wat for better optimization (Pawel Mrochen).
|
||||
version 1.0.1b [May 2, 1998]
|
||||
Relocated png_do_gray_to_rgb() within png_do_read_transformations() (Greg).
|
||||
Relocated the png_composite macros from pngrtran.c to png.h (Greg).
|
||||
Added makefile.sco (contributed by Mike Hopkirk).
|
||||
Fixed two bugs (missing definitions of "istop") introduced in libpng-1.0.1a.
|
||||
Fixed a bug in pngrtran.c that would set channels=5 under some circumstances.
|
||||
More work on the Paeth-filtering, achieving imperceptible speedup (A Kleinert).
|
||||
More work on loop optimization which may help when compiled with C++ compilers.
|
||||
Added warnings when people try to use transforms they've defined out.
|
||||
Collapsed 4 "i" and "c" loops into single "i" loops in pngrtran and pngwtran.
|
||||
Revised paragraph about png_set_expand() in libpng.txt and libpng.3 (Greg)
|
||||
version 1.0.1c [May 11, 1998]
|
||||
Fixed a bug in pngrtran.c (introduced in libpng-1.0.1a) where the masks for
|
||||
filler bytes should have been 0xff instead of 0xf.
|
||||
Added max_pixel_depth=32 in pngrutil.c when using FILLER with palette images.
|
||||
Moved PNG_WRITE_WEIGHTED_FILTER_SUPPORTED and PNG_WRITE_FLUSH_SUPPORTED
|
||||
out of the PNG_WRITE_TRANSFORMS_NOT_SUPPORTED block of pngconf.h
|
||||
Added "PNG_NO_WRITE_TRANSFORMS" etc., as alternatives for *_NOT_SUPPORTED,
|
||||
for consistency, in pngconf.h
|
||||
Added individual "ifndef PNG_NO_[CAPABILITY]" in pngconf.h to make it easier
|
||||
to remove unwanted capabilities via the compile line
|
||||
Made some corrections to grammar (which, it's) in documentation (Greg).
|
||||
Corrected example.c, use of row_pointers in png_write_image().
|
||||
version 1.0.1d [May 24, 1998]
|
||||
Corrected several statements that used side effects illegally in pngrutil.c
|
||||
and pngtrans.c, that were introduced in version 1.0.1b
|
||||
Revised png_read_rows() to avoid repeated if-testing for NULL (A Kleinert)
|
||||
More corrections to example.c, use of row_pointers in png_write_image()
|
||||
and png_read_rows().
|
||||
Added pngdll.mak and pngdef.pas to scripts directory, contributed by
|
||||
Bob Dellaca, to make a png32bd.dll with Borland C++ 4.5
|
||||
Fixed error in example.c with png_set_text: num_text is 3, not 2 (Guido V.)
|
||||
Changed several loops from count-down to count-up, for consistency.
|
||||
version 1.0.1e [June 6, 1998]
|
||||
Revised libpng.txt and libpng.3 description of png_set_read|write_fn(), and
|
||||
added warnings when people try to set png_read_fn and png_write_fn in
|
||||
the same structure.
|
||||
Added a test such that png_do_gamma will be done when num_trans==0
|
||||
for truecolor images that have defined a background. This corrects an
|
||||
error that was introduced in libpng-0.90 that can cause gamma processing
|
||||
to be skipped.
|
||||
Added tests in png.h to include "trans" and "trans_values" in structures
|
||||
when PNG_READ_BACKGROUND_SUPPORTED or PNG_READ_EXPAND_SUPPORTED is defined.
|
||||
Add png_free(png_ptr->time_buffer) in png_destroy_read_struct()
|
||||
Moved png_convert_to_rfc_1123() from pngwrite.c to png.c
|
||||
Added capability for user-provided malloc_fn() and free_fn() functions,
|
||||
and revised pngtest.c to demonstrate their use, replacing the
|
||||
PNGTEST_DEBUG_MEM feature.
|
||||
Added makefile.w32, for Microsoft C++ 4.0 and later (Tim Wegner).
|
||||
version 1.0.2 [June 14, 1998]
|
||||
Fixed two bugs in makefile.bor .
|
||||
version 1.0.2a [December 30, 1998]
|
||||
Replaced and extended code that was removed from png_set_filler() in 1.0.1a.
|
||||
Fixed a bug in png_do_filler() that made it fail to write filler bytes in
|
||||
the left-most pixel of each row (Kevin Bracey).
|
||||
Changed "static pngcharp tIME_string" to "static char tIME_string[30]"
|
||||
in pngtest.c (Duncan Simpson).
|
||||
Fixed a bug in pngtest.c that caused pngtest to try to write a tIME chunk
|
||||
even when no tIME chunk was present in the source file.
|
||||
Fixed a problem in pngrutil.c: gray_to_rgb didn't always work with 16-bit.
|
||||
Fixed a problem in png_read_push_finish_row(), which would not skip some
|
||||
passes that it should skip, for images that are less than 3 pixels high.
|
||||
Interchanged the order of calls to png_do_swap() and png_do_shift()
|
||||
in pngwtran.c (John Cromer).
|
||||
Added #ifdef PNG_DEBUG/#endif surrounding use of PNG_DEBUG in png.h .
|
||||
Changed "bad adaptive filter type" from error to warning in pngrutil.c .
|
||||
Fixed a documentation error about default filtering with 8-bit indexed-color.
|
||||
Separated the PNG_NO_STDIO macro into PNG_NO_STDIO and PNG_NO_CONSOLE_IO
|
||||
(L. Peter Deutsch).
|
||||
Added png_set_rgb_to_gray() and png_get_rgb_to_gray_status() functions.
|
||||
Added png_get_copyright() and png_get_header_version() functions.
|
||||
Revised comments on png_set_progressive_read_fn() in libpng.txt and example.c
|
||||
Added information about debugging in libpng.txt and libpng.3 .
|
||||
Changed "ln -sf" to "ln -s -f" in makefile.s2x, makefile.lnx, and makefile.sco.
|
||||
Removed lines after Dynamic Dependencies" in makefile.aco .
|
||||
Revised makefile.dec to make a shared library (Jeremie Petit).
|
||||
Removed trailing blanks from all files.
|
||||
version 1.0.2a [January 6, 1999]
|
||||
Removed misplaced #endif and #ifdef PNG_NO_EXTERN near the end of png.h
|
||||
Added "if" tests to silence complaints about unused png_ptr in png.h and png.c
|
||||
Changed "check_if_png" function in example.c to return true (nonzero) if PNG.
|
||||
Changed libpng.txt to demonstrate png_sig_cmp() instead of png_check_sig()
|
||||
which is obsolete.
|
||||
version 1.0.3 [January 14, 1999]
|
||||
Added makefile.hux, for Hewlett Packard HPUX 10.20 and 11.00 (Jim Rice)
|
||||
Added a statement of Y2K compliance in png.h, libpng.3, and Y2KINFO.
|
||||
version 1.0.3a [August 12, 1999]
|
||||
Added check for PNG_READ_INTERLACE_SUPPORTED in pngread.c; issue a warning
|
||||
if an attempt is made to read an interlaced image when it's not supported.
|
||||
Added check if png_ptr->trans is defined before freeing it in pngread.c
|
||||
Modified the Y2K statement to include versions back to version 0.71
|
||||
Fixed a bug in the check for valid IHDR bit_depth/color_types in pngrutil.c
|
||||
Modified makefile.wat (added -zp8 flag, ".symbolic", changed some comments)
|
||||
Replaced leading blanks with tab characters in makefile.hux
|
||||
Changed "dworkin.wustl.edu" to "ccrc.wustl.edu" in various documents.
|
||||
Changed (float)red and (float)green to (double)red, (double)green
|
||||
in png_set_rgb_to_gray() to avoid "promotion" problems in AIX.
|
||||
Fixed a bug in pngconf.h that omitted <stdio.h> when PNG_DEBUG==0 (K Bracey).
|
||||
Reformatted libpng.3 and libpngpf.3 with proper fonts (script by J. vanZandt).
|
||||
Updated documentation to refer to the PNG-1.2 specification.
|
||||
Removed ansi2knr.c and left pointers to the latest source for ansi2knr.c
|
||||
in makefile.knr, INSTALL, and README (L. Peter Deutsch)
|
||||
Fixed bugs in calculation of the length of rowbytes when adding alpha
|
||||
channels to 16-bit images, in pngrtran.c (Chris Nokleberg)
|
||||
Added function png_set_user_transform_info() to store user_transform_ptr,
|
||||
user_depth, and user_channels into the png_struct, and a function
|
||||
png_get_user_transform_ptr() to retrieve the pointer (Chris Nokleberg)
|
||||
Added function png_set_empty_plte_permitted() to make libpng useable
|
||||
in MNG applications.
|
||||
Corrected the typedef for png_free_ptr in png.h (Jesse Jones).
|
||||
Correct gamma with srgb is 45455 instead of 45000 in pngrutil.c, to be
|
||||
consistent with PNG-1.2, and allow variance of 500 before complaining.
|
||||
Added assembler code contributed by Intel in file pngvcrd.c and modified
|
||||
makefile.w32 to use it (Nirav Chhatrapati, INTEL Corporation, Gilles Vollant)
|
||||
Changed "ln -s -f" to "ln -f -s" in the makefiles to make Solaris happy.
|
||||
Added some aliases for png_set_expand() in pngrtran.c, namely
|
||||
png_set_expand_PLTE(), png_set_expand_depth(), and png_set_expand_tRNS()
|
||||
(Greg Roelofs, in "PNG: The Definitive Guide").
|
||||
Added makefile.beo for BEOS on X86, contributed by Sander Stok.
|
||||
version 1.0.3b [August 26, 1999]
|
||||
Replaced 2147483647L several places with PNG_MAX_UINT macro, defined in png.h
|
||||
Changed leading blanks to tabs in all makefiles.
|
||||
Define PNG_USE_PNGVCRD in makefile.w32, to get MMX assembler code.
|
||||
Made alternate versions of png_set_expand() in pngrtran.c, namely
|
||||
png_set_gray_1_2_4_to_8, png_set_palette_to_rgb, and png_set_tRNS_to_alpha
|
||||
(Greg Roelofs, in "PNG: The Definitive Guide"). Deleted the 1.0.3a aliases.
|
||||
Relocated start of 'extern "C"' block in png.h so it doesn't include pngconf.h
|
||||
Revised calculation of num_blocks in pngmem.c to avoid a potentially
|
||||
negative shift distance, whose results are undefined in the C language.
|
||||
Added a check in pngset.c to prevent writing multiple tIME chunks.
|
||||
Added a check in pngwrite.c to detect invalid small window_bits sizes.
|
||||
version 1.0.3d [September 4, 1999]
|
||||
Fixed type casting of igamma in pngrutil.c
|
||||
Added new png_expand functions to scripts/pngdef.pas and pngos2.def
|
||||
Added a demo read_user_transform_fn that examines the row filters in pngtest.c
|
||||
version 1.0.4 [September 24, 1999]
|
||||
Define PNG_ALWAYS_EXTERN in pngconf.h if __STDC__ is defined
|
||||
Delete #define PNG_INTERNAL and include "png.h" from pngasmrd.h
|
||||
Made several minor corrections to pngtest.c
|
||||
Renamed the makefiles with longer but more user friendly extensions.
|
||||
Copied the PNG copyright and license to a separate LICENSE file.
|
||||
Revised documentation, png.h, and example.c to remove reference to
|
||||
"viewing_gamma" which no longer appears in the PNG specification.
|
||||
Revised pngvcrd.c to use MMX code for interlacing only on the final pass.
|
||||
Updated pngvcrd.c to use the faster C filter algorithms from libpng-1.0.1a
|
||||
Split makefile.win32vc into two versions, makefile.vcawin32 (uses MMX
|
||||
assembler code) and makefile.vcwin32 (doesn't).
|
||||
Added a CPU timing report to pngtest.c (enabled by defining PNGTEST_TIMING)
|
||||
Added a copy of pngnow.png to the distribution.
|
||||
version 1.0.4a [September 25, 1999]
|
||||
Increase max_pixel_depth in pngrutil.c if a user transform needs it.
|
||||
Changed several division operations to right-shifts in pngvcrd.c
|
||||
version 1.0.4b [September 30, 1999]
|
||||
Added parentheses in line 3732 of pngvcrd.c
|
||||
Added a comment in makefile.linux warning about buggy -O3 in pgcc 2.95.1
|
||||
version 1.0.4c [October 1, 1999]
|
||||
Added a "png_check_version" function in png.c and pngtest.c that will generate
|
||||
a helpful compiler error if an old png.h is found in the search path.
|
||||
Changed type of png_user_transform_depth|channels from int to png_byte.
|
||||
version 1.0.4d [October 6, 1999]
|
||||
Changed 0.45 to 0.45455 in png_set_sRGB()
|
||||
Removed unused PLTE entries from pngnow.png
|
||||
Re-enabled some parts of pngvcrd.c (png_combine_row) that work properly.
|
||||
version 1.0.4e [October 10, 1999]
|
||||
Fixed sign error in pngvcrd.c (Greg Roelofs)
|
||||
Replaced some instances of memcpy with simple assignments in pngvcrd (GR-P)
|
||||
version 1.0.4f [October 15, 1999]
|
||||
Surrounded example.c code with #if 0 .. #endif to prevent people from
|
||||
inadvertently trying to compile it.
|
||||
Changed png_get_header_version() from a function to a macro in png.h
|
||||
Added type casting mostly in pngrtran.c and pngwtran.c
|
||||
Removed some pointless "ptr = NULL" in pngmem.c
|
||||
Added a "contrib" directory containing the source code from Greg's book.
|
||||
version 1.0.5 [October 15, 1999]
|
||||
Minor editing of the INSTALL and README files.
|
||||
version 1.0.5a [October 23, 1999]
|
||||
Added contrib/pngsuite and contrib/pngminus (Willem van Schaik)
|
||||
Fixed a typo in the png_set_sRGB() function call in example.c (Jan Nijtmans)
|
||||
Further optimization and bugfix of pngvcrd.c
|
||||
Revised pngset.c so that it does not allocate or free memory in the user's
|
||||
text_ptr structure. Instead, it makes its own copy.
|
||||
Created separate write_end_info_struct in pngtest.c for a more severe test.
|
||||
Added code in pngwrite.c to free info_ptr->text[i].key to stop a memory leak.
|
||||
version 1.0.5b [November 23, 1999]
|
||||
Moved PNG_FLAG_HAVE_CHUNK_HEADER, PNG_FLAG_BACKGROUND_IS_GRAY and
|
||||
PNG_FLAG_WROTE_tIME from flags to mode.
|
||||
Added png_write_info_before_PLTE() function.
|
||||
Fixed some typecasting in contrib/gregbook/*.c
|
||||
Updated scripts/makevms.com and added makevms.com to contrib/gregbook
|
||||
and contrib/pngminus (Martin Zinser)
|
||||
version 1.0.5c [November 26, 1999]
|
||||
Moved png_get_header_version from png.h to png.c, to accomodate ansi2knr.
|
||||
Removed all global arrays (according to PNG_NO_GLOBAL_ARRAYS macro), to
|
||||
accomodate making DLL's: Moved usr_png_ver from global variable to function
|
||||
png_get_header_ver() in png.c. Moved png_sig to png_sig_bytes in png.c and
|
||||
eliminated use of png_sig in pngwutil.c. Moved the various png_CHNK arrays
|
||||
into pngtypes.h. Eliminated use of global png_pass arrays. Declared the
|
||||
png_CHNK and png_pass arrays to be "const". Made the global arrays
|
||||
available to applications (although none are used in libpng itself) when
|
||||
PNG_NO_GLOBAL_ARRAYS is not defined or when PNG_GLOBAL_ARRAYS is defined.
|
||||
Removed some extraneous "-I" from contrib/pngminus/makefile.std
|
||||
Changed the PNG_sRGB_INTENT macros in png.h to be consistent with PNG-1.2.
|
||||
Change PNG_SRGB_INTENT to PNG_sRGB_INTENT in libpng.txt and libpng.3
|
||||
version 1.0.5d [November 29, 1999]
|
||||
Add type cast (png_const_charp) two places in png.c
|
||||
Eliminated pngtypes.h; use macros instead to declare PNG_CHNK arrays.
|
||||
Renamed "PNG_GLOBAL_ARRAYS" to "PNG_USE_GLOBAL_ARRAYS" and made available
|
||||
to applications a macro "PNG_USE_LOCAL_ARRAYS".
|
||||
#ifdef out all the new declarations when PNG_USE_GLOBAL_ARRAYS is defined.
|
||||
Added PNG_EXPORT_VAR macro to accommodate making DLL's.
|
||||
version 1.0.5e [November 30, 1999]
|
||||
Added iCCP, iTXt, and sPLT support; added "lang" member to the png_text
|
||||
structure; refactored the inflate/deflate support to make adding new chunks
|
||||
with trailing compressed parts easier in the future, and added new functions
|
||||
png_free_iCCP, png_free_pCAL, png_free_sPLT, png_free_text, png_get_iCCP,
|
||||
png_get_spalettes, png_set_iCCP, png_set_spalettes (Eric S. Raymond).
|
||||
NOTE: Applications that write text chunks MUST define png_text->lang
|
||||
before calling png_set_text(). It must be set to NULL if you want to
|
||||
write tEXt or zTXt chunks. If you want your application to be able to
|
||||
run with older versions of libpng, use
|
||||
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
png_text[i].lang = NULL;
|
||||
#endif
|
||||
|
||||
Changed png_get_oFFs() and png_set_oFFs() to use signed rather than unsigned
|
||||
offsets (Eric S. Raymond).
|
||||
Combined PNG_READ_cHNK_SUPPORTED and PNG_WRITE_cHNK_SUPPORTED macros into
|
||||
PNG_cHNK_SUPPORTED and combined the three types of PNG_text_SUPPORTED
|
||||
macros, leaving the separate macros also available.
|
||||
Removed comments on #endifs at the end of many short, non-nested #if-blocks.
|
||||
version 1.0.5f [December 6, 1999]
|
||||
Changed makefile.solaris to issue a warning about potential problems when
|
||||
the ucb "ld" is in the path ahead of the ccs "ld".
|
||||
Removed "- [date]" from the "synopsis" line in libpng.3 and libpngpf.3.
|
||||
Added sCAL chunk support (Eric S. Raymond).
|
||||
version 1.0.5g [December 7, 1999]
|
||||
Fixed "png_free_spallettes" typo in png.h
|
||||
Added code to handle new chunks in pngpread.c
|
||||
Moved PNG_CHNK string macro definitions outside of PNG_NO_EXTERN block
|
||||
Added "translated_key" to png_text structure and png_write_iTXt().
|
||||
Added code in pngwrite.c to work around a newly discovered zlib bug.
|
||||
version 1.0.5h [December 10, 1999]
|
||||
NOTE: regarding the note for version 1.0.5e, the following must also
|
||||
be included in your code:
|
||||
png_text[i].translated_key = NULL;
|
||||
Unknown chunk handling is now supported.
|
||||
Option to eliminate all floating point support was added. Some new
|
||||
fixed-point functions such as png_set_gAMA_fixed() were added.
|
||||
Expanded tabs and removed trailing blanks in source files.
|
||||
version 1.0.5i [December 13, 1999]
|
||||
Added some type casts to silence compiler warnings.
|
||||
Renamed "png_free_spalette" to "png_free_spalettes" for consistency.
|
||||
Removed leading blanks from a #define in pngvcrd.c
|
||||
Added some parameters to the new png_set_keep_unknown_chunks() function.
|
||||
Added a test for up->location != 0 in the first instance of writing
|
||||
unknown chunks in pngwrite.c
|
||||
Changed "num" to "i" in png_free_spalettes() and png_free_unknowns() to
|
||||
prevent recursion.
|
||||
Added png_free_hIST() function.
|
||||
Various patches to fix bugs in the sCAL and integer cHRM processing,
|
||||
and to add some convenience macros for use with sCAL.
|
||||
version 1.0.5j [December 21, 1999]
|
||||
Changed "unit" parameter of png_write_sCAL from png_byte to int, to work
|
||||
around buggy compilers.
|
||||
Added new type "png_fixed_point" for integers that hold float*100000 values
|
||||
Restored backward compatibility of tEXt/zTXt chunk processing:
|
||||
Restored the first four members of png_text to the same order as v.1.0.5d.
|
||||
Added members "lang_key" and "itxt_length" to png_text struct. Set
|
||||
text_length=0 when "text" contains iTXt data. Use the "compression"
|
||||
member to distinguish among tEXt/zTXt/iTXt types. Added
|
||||
PNG_ITXT_COMPRESSION_NONE (1) and PNG_ITXT_COMPRESSION_zTXt(2) macros.
|
||||
The "Note" above, about backward incompatibility of libpng-1.0.5e, no
|
||||
longer applies.
|
||||
Fixed png_read|write_iTXt() to read|write parameters in the right order,
|
||||
and to write the iTXt chunk after IDAT if it appears in the end_ptr.
|
||||
Added pnggccrd.c, version of pngvcrd.c Intel assembler for gcc (Greg Roelofs)
|
||||
Reversed the order of trying to write floating-point and fixed-point gAMA.
|
||||
version 1.0.5k [December 27, 1999]
|
||||
Added many parentheses, e.g., "if (a && b & c)" becomes "if (a && (b & c))"
|
||||
Added png_handle_as_unknown() function (Glenn)
|
||||
Added png_free_chunk_list() function and chunk_list and num_chunk_list members
|
||||
of png_ptr.
|
||||
Eliminated erroneous warnings about multiple sPLT chunks and sPLT-after-PLTE.
|
||||
Fixed a libpng-1.0.5h bug in pngrutil.c that was issuing erroneous warnings
|
||||
about ignoring incorrect gAMA with sRGB (gAMA was in fact not ignored)
|
||||
Added png_free_tRNS(); png_set_tRNS() now malloc's its own trans array (ESR).
|
||||
Define png_get_int_32 when oFFs chunk is supported as well as when pCAL is.
|
||||
Changed type of proflen from png_int_32 to png_uint_32 in png_get_iCCP().
|
||||
version 1.0.5l [January 1, 2000]
|
||||
Added functions png_set_read_user_chunk_fn() and png_get_user_chunk_ptr()
|
||||
for setting a callback function to handle unknown chunks and for
|
||||
retrieving the associated user pointer (Glenn).
|
||||
version 1.0.5m [January 7, 2000]
|
||||
Added high-level functions png_read_png(), png_write_png(), png_free_pixels().
|
||||
version 1.0.5n [January 9, 2000]
|
||||
Added png_free_PLTE() function, and modified png_set_PLTE() to malloc its
|
||||
own memory for info_ptr->palette. This makes it safe for the calling
|
||||
application to free its copy of the palette any time after it calls
|
||||
png_set_PLTE().
|
||||
version 1.0.5o [January 20, 2000]
|
||||
Cosmetic changes only (removed some trailing blanks and TABs)
|
||||
version 1.0.5p [January 31, 2000]
|
||||
Renamed pngdll.mak to makefile.bd32
|
||||
Cosmetic changes in pngtest.c
|
||||
version 1.0.5q [February 5, 2000]
|
||||
Relocated the makefile.solaris warning about PATH problems.
|
||||
Fixed pngvcrd.c bug by pushing/popping registers in mmxsupport (Bruce Oberg)
|
||||
Revised makefile.gcmmx
|
||||
Added PNG_SETJMP_SUPPORTED, PNG_SETJMP_NOT_SUPPORTED, and PNG_ABORT() macros
|
||||
version 1.0.5r [February 7, 2000]
|
||||
Removed superfluous prototype for png_get_itxt from png.h
|
||||
Fixed a bug in pngrtran.c that improperly expanded the background color.
|
||||
Return *num_text=0 from png_get_text() when appropriate, and fix documentation
|
||||
of png_get_text() in libpng.txt/libpng.3.
|
||||
version 1.0.5s [February 18, 2000]
|
||||
Added "png_jmp_env()" macro to pngconf.h, to help people migrate to the
|
||||
new error handler that's planned for the next libpng release, and changed
|
||||
example.c, pngtest.c, and contrib programs to use this macro.
|
||||
Revised some of the DLL-export macros in pngconf.h (Greg Roelofs)
|
||||
Fixed a bug in png_read_png() that caused it to fail to expand some images
|
||||
that it should have expanded.
|
||||
Fixed some mistakes in the unused and undocumented INCH_CONVERSIONS functions
|
||||
in pngget.c
|
||||
Changed the allocation of palette, history, and trans arrays back to
|
||||
the version 1.0.5 method (linking instead of copying) which restores
|
||||
backward compatibility with version 1.0.5. Added some remarks about
|
||||
that in example.c. Added "free_me" member to info_ptr and png_ptr
|
||||
and added png_free_data() function.
|
||||
Updated makefile.linux and makefile.gccmmx to make directories conditionally.
|
||||
Made cosmetic changes to pngasmrd.h
|
||||
Added png_set_rows() and png_get_rows(), for use with png_read|write_png().
|
||||
Modified png_read_png() to allocate info_ptr->row_pointers only if it
|
||||
hasn't already been allocated.
|
||||
version 1.0.5t [March 4, 2000]
|
||||
Changed png_jmp_env() migration aiding macro to png_jmpbuf().
|
||||
Fixed "interlace" typo (should be "interlaced") in contrib/gregbook/read2-x.c
|
||||
Fixed bug with use of PNG_BEFORE_IHDR bit in png_ptr->mode, introduced when
|
||||
PNG_FLAG_HAVE_CHUNK_HEADER was moved into png_ptr->mode in version 1.0.5b
|
||||
Files in contrib/gregbook were revised to use png_jmpbuf() and to select
|
||||
a 24-bit visual if one is available, and to allow abbreviated options.
|
||||
Files in contrib/pngminus were revised to use the png_jmpbuf() macro.
|
||||
Removed spaces in makefile.linux and makefile.gcmmx, introduced in 1.0.5s
|
||||
version 1.0.5u [March 5, 2000]
|
||||
Simplified the code that detects old png.h in png.c and pngtest.c
|
||||
Renamed png_spalette (_p, _pp) to png_sPLT_t (_tp, _tpp)
|
||||
Increased precision of rgb_to_gray calculations from 8 to 15 bits and
|
||||
added png_set_rgb_to_gray_fixed() function.
|
||||
Added makefile.bc32 (32-bit Borland C++, C mode)
|
||||
version 1.0.5v [March 11, 2000]
|
||||
Added some parentheses to the png_jmpbuf macro definition.
|
||||
Updated references to the zlib home page, which has moved to freesoftware.com.
|
||||
Corrected bugs in documentation regarding png_read_row() and png_write_row().
|
||||
Updated documentation of png_rgb_to_gray calculations in libpng.3/libpng.txt.
|
||||
Renamed makefile.borland,turboc3 back to makefile.bor,tc3 as in version 1.0.3,
|
||||
revised borland makefiles; added makefile.ibmvac3 and makefile.gcc (Cosmin)
|
||||
version 1.0.6 [March 20, 2000]
|
||||
Minor revisions of makefile.bor, libpng.txt, and gregbook/rpng2-win.c
|
||||
Added makefile.sggcc (SGI IRIX with gcc)
|
||||
version 1.0.6d [April 7, 2000]
|
||||
Changed sprintf() to strcpy() in png_write_sCAL_s() to work without STDIO
|
||||
Added data_length parameter to png_decompress_chunk() function
|
||||
Revised documentation to remove reference to abandoned png_free_chnk functions
|
||||
Fixed an error in png_rgb_to_gray_fixed()
|
||||
Revised example.c, usage of png_destroy_write_struct().
|
||||
Renamed makefile.ibmvac3 to makefile.ibmc, added libpng.icc IBM project file
|
||||
Added a check for info_ptr->free_me&PNG_FREE_TEXT when freeing text in png.c
|
||||
Simplify png_sig_bytes() function to remove use of non-ISO-C strdup().
|
||||
version 1.0.6e [April 9, 2000]
|
||||
Added png_data_freer() function.
|
||||
In the code that checks for over-length tRNS chunks, added check of
|
||||
info_ptr->num_trans as well as png_ptr->num_trans (Matthias Benckmann)
|
||||
Minor revisions of libpng.txt/libpng.3.
|
||||
Check for existing data and free it if the free_me flag is set, in png_set_*()
|
||||
and png_handle_*().
|
||||
Only define PNG_WEIGHTED_FILTERS_SUPPORTED when PNG_FLOATING_POINT_SUPPORTED
|
||||
is defined.
|
||||
Changed several instances of PNG_NO_CONSOLE_ID to PNG_NO_STDIO in pngrutil.c
|
||||
and mentioned the purposes of the two macros in libpng.txt/libpng.3.
|
||||
version 1.0.6f [April 14, 2000]
|
||||
Revised png_set_iCCP() and png_set_rows() to avoid prematurely freeing data.
|
||||
Add checks in png_set_text() for NULL members of the input text structure.
|
||||
Revised libpng.txt/libpng.3.
|
||||
Removed superfluous prototype for png_set_itxt from png.h
|
||||
Removed "else" from pngread.c, after png_error(), and changed "0" to "length".
|
||||
Changed several png_errors about malformed ancillary chunks to png_warnings.
|
||||
version 1.0.6g [April 24, 2000]
|
||||
Added png_pass-* arrays to pnggccrd.c when PNG_USE_LOCAL_ARRAYS is defined.
|
||||
Relocated paragraph about png_set_background() in libpng.3/libpng.txt
|
||||
and other revisions (Matthias Benckmann)
|
||||
Relocated info_ptr->free_me, png_ptr->free_me, and other info_ptr and
|
||||
png_ptr members to restore binary compatibility with libpng-1.0.5
|
||||
(breaks compatibility with libpng-1.0.6).
|
||||
version 1.0.6h [April 24, 2000]
|
||||
Changed shared library so-number pattern from 2.x.y.z to xy.z (this builds
|
||||
libpng.so.10 & libpng.so.10.6h instead of libpng.so.2 & libpng.so.2.1.0.6h)
|
||||
This is a temporary change for test purposes.
|
||||
version 1.0.6i [May 2, 2000]
|
||||
Rearranged some members at the end of png_info and png_struct, to put
|
||||
unknown_chunks_num and free_me within the original size of the png_structs
|
||||
and free_me, png_read_user_fn, and png_free_fn within the original png_info,
|
||||
because some old applications allocate the structs directly instead of
|
||||
using png_create_*().
|
||||
Added documentation of user memory functions in libpng.txt/libpng.3
|
||||
Modified png_read_png so that it will use user_allocated row_pointers
|
||||
if present, unless free_me directs that it be freed, and added description
|
||||
of the use of png_set_rows() and png_get_rows() in libpng.txt/libpng.3.
|
||||
Added PNG_LEGACY_SUPPORTED macro, and #ifdef out all new (since version
|
||||
1.00) members of png_struct and png_info, to regain binary compatibility
|
||||
when you define this macro. Capabilities lost in this event
|
||||
are user transforms (new in version 1.0.0),the user transform pointer
|
||||
(new in version 1.0.2), rgb_to_gray (new in 1.0.5), iCCP, sCAL, sPLT,
|
||||
the high-level interface, and unknown chunks support (all new in 1.0.6).
|
||||
This was necessary because of old applications that allocate the structs
|
||||
directly as authors were instructed to do in libpng-0.88 and earlier,
|
||||
instead of using png_create_*().
|
||||
Added modes PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT which
|
||||
can be used to detect codes that directly allocate the structs, and
|
||||
code to check these modes in png_read_init() and png_write_init() and
|
||||
generate a libpng error if the modes aren't set and PNG_LEGACY_SUPPORTED
|
||||
was not defined.
|
||||
Added makefile.intel and updated makefile.watcom (Pawel Mrochen)
|
||||
version 1.0.6j [May 3, 2000]
|
||||
Overloaded png_read_init() and png_write_init() with macros that convert
|
||||
calls to png_read_init_2() or png_write_init_2() that check the version
|
||||
and structure sizes.
|
||||
version 1.0.7beta11 [May 7, 2000]
|
||||
Removed the new PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT modes
|
||||
which are no longer used.
|
||||
Eliminated the three new members of png_text when PNG_NO_iTXt_SUPPORTED
|
||||
or PNG_LEGACY_SUPPORTED is defined.
|
||||
Made PNG_NO_ITXT_SUPPORTED the default setting, to avoid memory overrun
|
||||
when old applications fill the info_ptr->text structure directly.
|
||||
Added PNGAPI macro, and added it to the definitions of all exported functions.
|
||||
Relocated version macro definitions ahead of the includes of zlib.h and
|
||||
pngconf.h in png.h.
|
||||
version 1.0.7beta12 [May 12, 2000]
|
||||
Revised pngset.c to avoid a problem with expanding the png_debug macro.
|
||||
Deleted some extraneous defines from pngconf.h
|
||||
Made PNG_NO_CONSOLE_IO the default condition when PNG_BUILD_DLL is defined.
|
||||
Use MSC _RPTn debugging instead of fprintf if _MSC_VER is defined.
|
||||
Added png_access_version_number() function.
|
||||
Check for mask&PNG_FREE_CHNK (for TEXT, SCAL, PCAL) in png_free_data().
|
||||
Expanded libpng.3/libpng.txt information about png_data_freer().
|
||||
version 1.0.7beta14 [May 17, 2000] (beta13 was not published)
|
||||
Changed pnggccrd.c and pngvcrd.c to handle bad adaptive filter types as
|
||||
warnings instead of errors, as pngrutil.c does.
|
||||
Set the PNG_INFO_IDAT valid flag in png_set_rows() so png_write_png()
|
||||
will actually write IDATs.
|
||||
Made the default PNG_USE_LOCAL_ARRAYS depend on PNG_DLL instead of WIN32.
|
||||
Make png_free_data() ignore its final parameter except when freeing data
|
||||
that can have multiple instances (text, sPLT, unknowns).
|
||||
Fixed a new bug in png_set_rows().
|
||||
Removed info_ptr->valid tests from png_free_data(), as in version 1.0.5.
|
||||
Added png_set_invalid() function.
|
||||
Fixed incorrect illustrations of png_destroy_write_struct() in example.c.
|
||||
version 1.0.7beta15 [May 30, 2000]
|
||||
Revised the deliberately erroneous Linux setjmp code in pngconf.h to produce
|
||||
fewer error messages.
|
||||
Rearranged checks for Z_OK to check the most likely path first in pngpread.c
|
||||
and pngwutil.c.
|
||||
Added checks in pngtest.c for png_create_*() returning NULL, and mentioned
|
||||
in libpng.txt/libpng.3 the need for applications to check this.
|
||||
Changed names of png_default_*() functions in pngtest to pngtest_*().
|
||||
Changed return type of png_get_x|y_offset_*() from png_uint_32 to png_int_32.
|
||||
Fixed some bugs in the unused PNG_INCH_CONVERSIONS functions in pngget.c
|
||||
Set each pointer to NULL after freeing it in png_free_data().
|
||||
Worked around a problem in pngconf.h; AIX's strings.h defines an "index"
|
||||
macro that conflicts with libpng's png_color_16.index. (Dimitri Papadapoulos)
|
||||
Added "msvc" directory with MSVC++ project files (Simon-Pierre Cadieux).
|
||||
version 1.0.7beta16 [June 4, 2000]
|
||||
Revised the workaround of AIX string.h "index" bug.
|
||||
Added a check for overlength PLTE chunk in pngrutil.c.
|
||||
Added PNG_NO_POINTER_INDEXING macro to use array-indexing instead of pointer
|
||||
indexing in pngrutil.c and pngwutil.c to accommodate a buggy compiler.
|
||||
Added a warning in png_decompress_chunk() when it runs out of data, e.g.
|
||||
when it tries to read an erroneous PhotoShop iCCP chunk.
|
||||
Added PNG_USE_DLL macro.
|
||||
Revised the copyright/disclaimer/license notice.
|
||||
Added contrib/msvctest directory
|
||||
version 1.0.7rc1 [June 9, 2000]
|
||||
Corrected the definition of PNG_TRANSFORM_INVERT_ALPHA (0x0400 not 0x0200)
|
||||
Added contrib/visupng directory (Willem van Schaik)
|
||||
version 1.0.7beta18 [June 23, 2000]
|
||||
Revised PNGAPI definition, and pngvcrd.c to work with __GCC__
|
||||
and do not redefine PNGAPI if it is passed in via a compiler directive.
|
||||
Revised visupng/PngFile.c to remove returns from within the Try block.
|
||||
Removed leading underscores from "_PNG_H" and "_PNG_SAVE_BSD_SOURCE" macros.
|
||||
Updated contrib/visupng/cexcept.h to version 1.0.0.
|
||||
Fixed bugs in pngwrite.c and pngwutil.c that prevented writing iCCP chunks.
|
||||
version 1.0.7rc2 [June 28, 2000]
|
||||
Updated license to include disclaimers required by UCITA.
|
||||
Fixed "DJBPP" typo in pnggccrd.c introduced in beta18.
|
||||
version 1.0.7 [July 1, 2000]
|
||||
Revised the definition of "trans_values" in libpng.3/libpng.txt
|
||||
version 1.0.8beta1 [July 8, 2000]
|
||||
Added png_free(png_ptr, key) two places in pngpread.c to stop memory leaks.
|
||||
Changed PNG_NO_STDIO to PNG_NO_CONSOLE_IO, several places in pngrutil.c and
|
||||
pngwutil.c.
|
||||
Changed PNG_EXPORT_VAR to use PNG_IMPEXP, in pngconf.h.
|
||||
Removed unused "#include <assert.h>" from png.c
|
||||
Added WindowsCE support.
|
||||
Revised pnggccrd.c to work with gcc-2.95.2 and in the Cygwin environment.
|
||||
version 1.0.8beta2 [July 10, 2000]
|
||||
Added project files to the wince directory and made further revisions
|
||||
of pngtest.c, pngrio.c, and pngwio.c in support of WindowsCE.
|
||||
version 1.0.8beta3 [July 11, 2000]
|
||||
Only set the PNG_FLAG_FREE_TRNS or PNG_FREE_TRNS flag in png_handle_tRNS()
|
||||
for indexed-color input files to avoid potential double-freeing trans array
|
||||
under some unusual conditions; problem was introduced in version 1.0.6f.
|
||||
Further revisions to pngtest.c and files in the wince subdirectory.
|
||||
version 1.0.8beta4 [July 14, 2000]
|
||||
Added the files pngbar.png and pngbar.jpg to the distribution.
|
||||
Added makefile.cygwin, and cygwin support in pngconf.h
|
||||
Added PNG_NO_ZALLOC_ZERO macro (makes png_zalloc skip zeroing memory)
|
||||
version 1.0.8rc1 [July 16, 2000]
|
||||
Revised png_debug() macros and statements to eliminate compiler warnings.
|
||||
version 1.0.8 [July 24, 2000]
|
||||
Added png_flush() in pngwrite.c, after png_write_IEND().
|
||||
Updated makefile.hpux to build a shared library.
|
||||
version 1.0.9beta1 [November 10, 2000]
|
||||
Fixed typo in scripts/makefile.hpux
|
||||
Updated makevms.com in scripts and contrib/* and contrib/* (Martin Zinser)
|
||||
Fixed seqence-point bug in contrib/pngminus/png2pnm (Martin Zinser)
|
||||
Changed "cdrom.com" in documentation to "libpng.org"
|
||||
Revised pnggccrd.c to get it all working, and updated makefile.gcmmx (Greg).
|
||||
Changed type of "params" from voidp to png_voidp in png_read|write_png().
|
||||
Make sure PNGAPI and PNG_IMPEXP are defined in pngconf.h.
|
||||
Revised the 3 instances of WRITEFILE in pngtest.c.
|
||||
Relocated "msvc" and "wince" project subdirectories into "dll" subdirectory.
|
||||
Updated png.rc in dll/msvc project
|
||||
Revised makefile.dec to define and use LIBPATH and INCPATH
|
||||
Increased size of global png_libpng_ver[] array from 12 to 18 chars.
|
||||
Made global png_libpng_ver[], png_sig[] and png_pass_*[] arrays const.
|
||||
Removed duplicate png_crc_finish() from png_handle_bKGD() function.
|
||||
Added a warning when application calls png_read_update_info() multiple times.
|
||||
Revised makefile.cygwin
|
||||
Fixed bugs in iCCP support in pngrutil.c and pngwutil.c.
|
||||
Replaced png_set_empty_plte_permitted() with png_permit_mng_features().
|
||||
version 1.0.9beta2 [November 19, 2000]
|
||||
Renamed the "dll" subdirectory "projects".
|
||||
Added borland project files to "projects" subdirectory.
|
||||
Set VS_FF_PRERELEASE and VS_FF_PATCHED flags in msvc/png.rc when appropriate.
|
||||
Add error message in png_set_compression_buffer_size() when malloc fails.
|
||||
version 1.0.9beta3 [November 23, 2000]
|
||||
Revised PNG_LIBPNG_BUILD_TYPE macro in png.h, used in the msvc project.
|
||||
Removed the png_flush() in pngwrite.c that crashes some applications
|
||||
that don't set png_output_flush_fn.
|
||||
Added makefile.macosx and makefile.aix to scripts directory.
|
||||
version 1.0.9beta4 [December 1, 2000]
|
||||
Change png_chunk_warning to png_warning in png_check_keyword().
|
||||
Increased the first part of msg buffer from 16 to 18 in png_chunk_error().
|
||||
version 1.0.9beta5 [December 15, 2000]
|
||||
Added support for filter method 64 (for PNG datastreams embedded in MNG).
|
||||
version 1.0.9beta6 [December 18, 2000]
|
||||
Revised png_set_filter() to accept filter method 64 when appropriate.
|
||||
Added new PNG_HAVE_PNG_SIGNATURE bit to png_ptr->mode and use it to
|
||||
help prevent applications from using MNG features in PNG datastreams.
|
||||
Added png_permit_mng_features() function.
|
||||
Revised libpng.3/libpng.txt. Changed "filter type" to "filter method".
|
||||
version 1.0.9rc1 [December 23, 2000]
|
||||
Revised test for PNG_HAVE_PNG_SIGNATURE in pngrutil.c
|
||||
Fixed error handling of unknown compression type in png_decompress_chunk().
|
||||
In pngconf.h, define __cdecl when _MSC_VER is defined.
|
||||
version 1.0.9beta7 [December 28, 2000]
|
||||
Changed PNG_TEXT_COMPRESSION_zTXt to PNG_COMPRESSION_TYPE_BASE several places.
|
||||
Revised memory management in png_set_hIST and png_handle_hIST in a backward
|
||||
compatible manner. PLTE and tRNS were revised similarly.
|
||||
Revised the iCCP chunk reader to ignore trailing garbage.
|
||||
version 1.0.9beta8 [January 12, 2001]
|
||||
Moved pngasmrd.h into pngconf.h.
|
||||
Improved handling of out-of-spec garbage iCCP chunks generated by PhotoShop.
|
||||
version 1.0.9beta9 [January 15, 2001]
|
||||
Added png_set_invalid, png_permit_mng_features, and png_mmx_supported to
|
||||
wince and msvc project module definition files.
|
||||
Minor revision of makefile.cygwin.
|
||||
Fixed bug with progressive reading of narrow interlaced images in pngpread.c
|
||||
version 1.0.9beta10 [January 16, 2001]
|
||||
Do not typedef png_FILE_p in pngconf.h when PNG_NO_STDIO is defined.
|
||||
Fixed "png_mmx_supported" typo in project definition files.
|
||||
version 1.0.9beta11 [January 19, 2001]
|
||||
Updated makefile.sgi to make shared library.
|
||||
Removed png_mmx_support() function and disabled PNG_MNG_FEATURES_SUPPORTED
|
||||
by default, for the benefit of DLL forward compatibility. These will
|
||||
be re-enabled in version 1.2.0.
|
||||
version 1.0.9rc2 [January 22, 2001]
|
||||
Revised cygwin support.
|
||||
version 1.0.9 [January 31, 2001]
|
||||
Added check of cygwin's ALL_STATIC in pngconf.h
|
||||
Added "-nommx" parameter to contrib/gregbook/rpng2-win and rpng2-x demos.
|
||||
|
||||
Send comments/corrections/commendations to
|
||||
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
||||
|
||||
Glenn R-P
|
||||
@@ -1,102 +0,0 @@
|
||||
|
||||
This copy of the libpng notices is provided for your convenience. In case of
|
||||
any discrepancy between this copy and the notices in the file png.h that is
|
||||
included in the libpng distribution, the latter shall prevail.
|
||||
|
||||
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
||||
|
||||
If you modify libpng you may insert additional notices immediately following
|
||||
this sentence.
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.0.9, January 31, 2001, are
|
||||
Copyright (c) 2000 Glenn Randers-Pehrson
|
||||
and are distributed according to the same disclaimer and license as libpng-1.0.6
|
||||
with the following individuals added to the list of Contributing Authors
|
||||
|
||||
Simon-Pierre Cadieux
|
||||
Eric S. Raymond
|
||||
Gilles Vollant
|
||||
|
||||
and with the following additions to the disclaimer:
|
||||
|
||||
There is no warranty against interference with your enjoyment of the
|
||||
library or against infringement. There is no warranty that our
|
||||
efforts or the library will fulfill any of your particular purposes
|
||||
or needs. This library is provided with all faults, and the entire
|
||||
risk of satisfactory quality, performance, accuracy, and effort is with
|
||||
the user.
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||
Copyright (c) 1998, 1999 Glenn Randers-Pehrson, and are
|
||||
distributed according to the same disclaimer and license as libpng-0.96,
|
||||
with the following individuals added to the list of Contributing Authors:
|
||||
|
||||
Tom Lane
|
||||
Glenn Randers-Pehrson
|
||||
Willem van Schaik
|
||||
|
||||
libpng versions 0.89, June 1996, through 0.96, May 1997, are
|
||||
Copyright (c) 1996, 1997 Andreas Dilger
|
||||
Distributed according to the same disclaimer and license as libpng-0.88,
|
||||
with the following individuals added to the list of Contributing Authors:
|
||||
|
||||
John Bowler
|
||||
Kevin Bracey
|
||||
Sam Bushell
|
||||
Magnus Holmgren
|
||||
Greg Roelofs
|
||||
Tom Tanner
|
||||
|
||||
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
||||
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
||||
For the purposes of this copyright and license, "Contributing Authors"
|
||||
is defined as the following set of individuals:
|
||||
|
||||
Andreas Dilger
|
||||
Dave Martindale
|
||||
Guy Eric Schalnat
|
||||
Paul Schmidt
|
||||
Tim Wegner
|
||||
|
||||
The PNG Reference Library is supplied "AS IS". The Contributing Authors
|
||||
and Group 42, Inc. disclaim all warranties, expressed or implied,
|
||||
including, without limitation, the warranties of merchantability and of
|
||||
fitness for any purpose. The Contributing Authors and Group 42, Inc.
|
||||
assume no liability for direct, indirect, incidental, special, exemplary,
|
||||
or consequential damages, which may result from the use of the PNG
|
||||
Reference 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.
|
||||
|
||||
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 and Group 42, Inc. specifically permit, without
|
||||
fee, and encourage the use of this source code as a component to
|
||||
supporting the PNG file format in commercial products. If you use this
|
||||
source code in a product, acknowledgment is not required but would be
|
||||
appreciated.
|
||||
|
||||
|
||||
A "png_get_copyright" function is available, for convenient use in "about"
|
||||
boxes and the like:
|
||||
|
||||
printf("%s",png_get_copyright(NULL));
|
||||
|
||||
Also, the PNG logo (in PNG format, of course) is supplied in the
|
||||
files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
|
||||
|
||||
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is a
|
||||
certification mark of the Open Source Initiative.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
randeg@alum.rpi.edu
|
||||
January 31, 2001
|
||||
@@ -1,6 +0,0 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist directory
|
||||
#
|
||||
|
||||
png.h
|
||||
pngconf.h
|
||||
@@ -1,69 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = png
|
||||
LIBRARY_NAME = mozpng
|
||||
EXPORT_LIBRARY = 1
|
||||
|
||||
|
||||
CSRCS = \
|
||||
png.c \
|
||||
pngerror.c \
|
||||
pngget.c \
|
||||
pngmem.c \
|
||||
pngpread.c \
|
||||
pngread.c \
|
||||
pngrio.c \
|
||||
pngrutil.c \
|
||||
pngset.c \
|
||||
pngtrans.c \
|
||||
pngwio.c \
|
||||
pngwrite.c \
|
||||
pngwtran.c \
|
||||
pngrtran.c \
|
||||
pngwutil.c \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = png.h pngconf.h
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
LOCAL_INCLUDES = -I$(srcdir)
|
||||
|
||||
ifndef MOZ_NATIVE_ZLIB
|
||||
EXTRA_DSO_LDOPTS = $(ZLIB_LIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
|
||||
EXTRA_DSO_LDOPTS = $(ZLIB_LIBS)
|
||||
else
|
||||
FORCE_STATIC_LIB = 1
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -1,244 +0,0 @@
|
||||
README for libpng 1.0.9 - January 31, 2001 (shared library 2.1)
|
||||
See the note about version numbers near the top of png.h
|
||||
|
||||
See INSTALL for instructions on how to install libpng.
|
||||
|
||||
Libpng comes in two distribution formats. Get libpng-*.tar.gz if you
|
||||
want UNIX-style line endings in the text files, or lpng*.zip if you want
|
||||
DOS-style line endings.
|
||||
|
||||
Version 0.89 was the first official release of libpng. Don't let the
|
||||
fact that it's the first release fool you. The libpng library has been in
|
||||
extensive use and testing since mid-1995. By late 1997 it had
|
||||
finally gotten to the stage where there hadn't been significant
|
||||
changes to the API in some time, and people have a bad feeling about
|
||||
libraries with versions < 1.0. Version 1.0.0 was released in
|
||||
March 1998.
|
||||
|
||||
****
|
||||
Note that some of the changes to the png_info structure render this
|
||||
version of the library binary incompatible with libpng-0.89 or
|
||||
earlier versions if you are using a shared library. The type of the
|
||||
"filler" parameter for png_set_filler() has changed from png_byte to
|
||||
png_uint_32, which will affect shared-library applications that use
|
||||
this function.
|
||||
|
||||
To avoid problems with changes to the internals of png_info_struct,
|
||||
new APIs have been made available in 0.95 to avoid direct application
|
||||
access to info_ptr. These functions are the png_set_<chunk> and
|
||||
png_get_<chunk> functions. These functions should be used when
|
||||
accessing/storing the info_struct data, rather than manipulating it
|
||||
directly, to avoid such problems in the future.
|
||||
|
||||
It is important to note that the APIs do not make current programs
|
||||
that access the info struct directly incompatible with the new
|
||||
library. However, it is strongly suggested that new programs use
|
||||
the new APIs (as shown in example.c and pngtest.c), and older programs
|
||||
be converted to the new format, to facilitate upgrades in the future.
|
||||
****
|
||||
|
||||
Additions since 0.90 include the ability to compile libpng as a
|
||||
Windows DLL, and new APIs for accessing data in the info struct.
|
||||
Experimental functions include the ability to set weighting and cost
|
||||
factors for row filter selection, direct reads of integers from buffers
|
||||
on big-endian processors that support misaligned data access, faster
|
||||
methods of doing alpha composition, and more accurate 16->8 bit color
|
||||
conversion.
|
||||
|
||||
The additions since 0.89 include the ability to read from a PNG stream
|
||||
which has had some (or all) of the signature bytes read by the calling
|
||||
application. This also allows the reading of embedded PNG streams that
|
||||
do not have the PNG file signature. As well, it is now possible to set
|
||||
the library action on the detection of chunk CRC errors. It is possible
|
||||
to set different actions based on whether the CRC error occurred in a
|
||||
critical or an ancillary chunk.
|
||||
|
||||
The changes made to the library, and bugs fixed are based on discussions
|
||||
on the PNG implementation mailing list <png-implement@ccrc.wustl.edu>
|
||||
and not on material submitted privately to Guy, Andreas, or Glenn. They will
|
||||
forward any good suggestions to the list.
|
||||
|
||||
For a detailed description on using libpng, read libpng.txt. For
|
||||
examples of libpng in a program, see example.c and pngtest.c. For usage
|
||||
information and restrictions (what little they are) on libpng, see
|
||||
png.h. For a description on using zlib (the compression library used by
|
||||
libpng) and zlib's restrictions, see zlib.h
|
||||
|
||||
I have included a general makefile, as well as several machine and
|
||||
compiler specific ones, but you may have to modify one for your own needs.
|
||||
|
||||
You should use zlib 1.0.4 or later to run this, but it MAY work with
|
||||
versions as old as zlib 0.95. Even so, there are bugs in older zlib
|
||||
versions which can cause the output of invalid compression streams for
|
||||
some images. You will definitely need zlib 1.0.4 or later if you are
|
||||
taking advantage of the MS-DOS "far" structure allocation for the small
|
||||
and medium memory models. You should also note that zlib is a
|
||||
compression library that is useful for more things than just PNG files.
|
||||
You can use zlib as a drop-in replacement for fread() and fwrite() if
|
||||
you are so inclined.
|
||||
|
||||
zlib should be available at the same place that libpng is.
|
||||
If not, it should be at ftp.uu.net in /graphics/png
|
||||
Eventually, it will be at ftp.uu.net in /pub/archiving/zip/zlib
|
||||
|
||||
You may also want a copy of the PNG specification. It is available
|
||||
as an RFC and a W3C Recommendation. Failing
|
||||
these resources you can try ftp.uu.net in the /graphics/png directory.
|
||||
|
||||
This code is currently being archived at ftp.uu.net in the
|
||||
/graphics/png directory, and on CompuServe, Lib 20 (PNG SUPPORT)
|
||||
at GO GRAPHSUP. If you can't find it in any of those places,
|
||||
e-mail me, and I'll help you find it.
|
||||
|
||||
If you have any code changes, requests, problems, etc., please e-mail
|
||||
them to me. Also, I'd appreciate any make files or project files,
|
||||
and any modifications you needed to make to get libpng to compile,
|
||||
along with a #define variable to tell what compiler/system you are on.
|
||||
If you needed to add transformations to libpng, or wish libpng would
|
||||
provide the image in a different way, drop me a note (and code, if
|
||||
possible), so I can consider supporting the transformation.
|
||||
Finally, if you get any warning messages when compiling libpng
|
||||
(note: not zlib), and they are easy to fix, I'd appreciate the
|
||||
fix. Please mention "libpng" somewhere in the subject line. Thanks.
|
||||
|
||||
This release was created and will be supported by myself (of course
|
||||
based in a large way on Guy's and Andreas' earlier work), and the PNG group.
|
||||
|
||||
randeg@alum.rpi.edu
|
||||
png-implement@ccrc.wustl.edu
|
||||
|
||||
You can't reach Guy, the original libpng author, at the addresses
|
||||
given in previous versions of this document. He and Andreas will read mail
|
||||
addressed to the png-implement list, however.
|
||||
|
||||
Please do not send general questions about PNG. Send them to
|
||||
the address in the specification (png-group@w3.org). At the same
|
||||
time, please do not send libpng questions to that address, send them to me
|
||||
or to png-implement@ccrc.wustl.edu. I'll
|
||||
get them in the end anyway. If you have a question about something
|
||||
in the PNG specification that is related to using libpng, send it
|
||||
to me. Send me any questions that start with "I was using libpng,
|
||||
and ...". If in doubt, send questions to me. I'll bounce them
|
||||
to others, if necessary.
|
||||
|
||||
Please do not send suggestions on how to change PNG. We have
|
||||
been discussing PNG for three years now, and it is official and
|
||||
finished. If you have suggestions for libpng, however, I'll
|
||||
gladly listen. Even if your suggestion is not used for version
|
||||
1.0, it may be used later.
|
||||
|
||||
Files in this distribution:
|
||||
|
||||
ANNOUNCE => Announcement of this version, with recent changes
|
||||
CHANGES => Description of changes between libpng versions
|
||||
KNOWNBUG => List of known bugs and deficiencies
|
||||
LICENSE => License to use and redistribute libpng
|
||||
README => This file
|
||||
TODO => Things not implemented in the current library
|
||||
Y2KINFO => Statement of Y2K compliance
|
||||
example.c => Example code for using libpng functions
|
||||
libpng.3 => manual page for libpng (includes libpng.txt)
|
||||
libpng.txt => Description of libpng and its functions
|
||||
libpngpf.3 => manual page for libpng's private functions
|
||||
png.5 => manual page for the PNG format
|
||||
png.c => Basic interface functions common to library
|
||||
png.h => Library function and interface declarations
|
||||
pngconf.h => System specific library configuration
|
||||
pngasmrd.h => Header file for assembler-coded functions
|
||||
pngerror.c => Error/warning message I/O functions
|
||||
pngget.c => Functions for retrieving info from struct
|
||||
pngmem.c => Memory handling functions
|
||||
pngbar.png => PNG logo, 88x31
|
||||
pngnow.png => PNG logo, 98x31
|
||||
pngpread.c => Progressive reading functions
|
||||
pngread.c => Read data/helper high-level functions
|
||||
pngrio.c => Lowest-level data read I/O functions
|
||||
pngrtran.c => Read data transformation functions
|
||||
pngrutil.c => Read data utility functions
|
||||
pngset.c => Functions for storing data into the info_struct
|
||||
pngtest.c => Library test program
|
||||
pngtest.png => Library test sample image
|
||||
pngtrans.c => Common data transformation functions
|
||||
pngwio.c => Lowest-level write I/O functions
|
||||
pngwrite.c => High-level write functions
|
||||
pngwtran.c => Write data transformations
|
||||
pngwutil.c => Write utility functions
|
||||
contrib => Contributions
|
||||
gregbook => source code for PNG reading and writing, from
|
||||
Greg Roelofs' "PNG: The Definitive Guide",
|
||||
O'Reilly, 1999
|
||||
msvctest => Builds and runs pngtest using a MSVC workspace
|
||||
pngminus => Simple pnm2png and png2pnm programs
|
||||
pngsuite => Test images
|
||||
visupng => Contains a MSVC workspace for VisualPng
|
||||
projects => Contains project files and workspaces for building DLL
|
||||
borland => Contains a Borland workspace for building libpng
|
||||
and zlib
|
||||
msvc => Contains a Microsoft Visual C++ (MSVC) workspace
|
||||
for building libpng and zlib
|
||||
wince => Contains a Microsoft Visual C++ (Windows CD Toolkit)
|
||||
workspace for building libpng and zlib on WindowsCE
|
||||
scripts => Directory containing scripts for building libpng:
|
||||
descrip.mms => VMS makefile for MMS or MMK
|
||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||
makefile.linux => Linux/ELF makefile
|
||||
(gcc, creates libpng.so.2.1.0.9)
|
||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates
|
||||
libpng.so.2.1.0.9, uses assembler code
|
||||
tuned for Intel MMX platform)
|
||||
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||
ansi2knr (Requires ansi2knr.c from
|
||||
ftp://ftp.cs.wisc.edu/ghost)
|
||||
makefile.aix => AIX makefile
|
||||
makefile.cygwin => Cygwin/gcc makefile
|
||||
makefile.dec => DEC Alpha UNIX makefile
|
||||
makefile.hpux => HPUX (10.20 and 11.00) makefile
|
||||
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
|
||||
makefile.intel => Intel C/C++ version 4.0 and later
|
||||
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
|
||||
makefile.macosx => MACOS X Makefile
|
||||
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
|
||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.9)
|
||||
makefile.sunos => Sun makefile
|
||||
makefile.solaris => Solaris 2.X makefile
|
||||
(gcc, creates libpng.so.2.1.0.9)
|
||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||
makefile.mips => MIPS makefile
|
||||
makefile.acorn => Acorn makefile
|
||||
makefile.amiga => Amiga makefile
|
||||
smakefile.ppc => AMIGA smakefile for SAS C V6.58/7.00 PPC
|
||||
compiler (Requires SCOPTIONS, copied from
|
||||
scripts/SCOPTIONS.ppc)
|
||||
makefile.atari => Atari makefile
|
||||
makefile.beos => BEOS makefile for X86
|
||||
makefile.bor => Borland makefile (uses bcc)
|
||||
makefile.bc32 => 32-bit Borland C++ (all modules compiled in C mode)
|
||||
makefile.bd32 => To make a png32bd.dll with Borland C++ 4.5
|
||||
makefile.tc3 => Turbo C 3.0 makefile
|
||||
makefile.dj2 => DJGPP 2 makefile
|
||||
makefile.msc => Microsoft C makefile
|
||||
makefile.vcawin32 => makefile for Microsoft Visual C++ 5.0 and
|
||||
later (uses assembler code tuned for Intel MMX
|
||||
platform)
|
||||
makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and
|
||||
later (does not use assembler code)
|
||||
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
|
||||
pngos2.def => OS/2 module definition file used by makefile.os2
|
||||
makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model
|
||||
makevms.com => VMS build script
|
||||
pngdef.pas => Defines for a png32bd.dll with Borland C++ 4.5
|
||||
SCOPTIONS.ppc => Used with smakefile.ppc
|
||||
|
||||
Good luck, and happy coding.
|
||||
|
||||
-Glenn Randers-Pehrson
|
||||
Internet: randeg@alum.rpi.edu
|
||||
|
||||
-Andreas Eric Dilger
|
||||
Internet: adilger@enel.ucalgary.ca
|
||||
Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/
|
||||
|
||||
-Guy Eric Schalnat
|
||||
(formerly of Group 42, Inc)
|
||||
Internet: gschal@infinet.com
|
||||
@@ -1,103 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
|
||||
#
|
||||
|
||||
#-----------------------------------------
|
||||
# makefile to build libpng.lib for wintel
|
||||
#-----------------------------------------
|
||||
|
||||
MAKE_OBJ_TYPE=LIB
|
||||
|
||||
!ifdef BUILD_DEBUG_GC
|
||||
LCFLAGS = $(LCFLAGS) -DDEBUG_GC
|
||||
!endif
|
||||
|
||||
EXPORTS = png.h pngconf.h
|
||||
|
||||
MODULE=png
|
||||
DEPTH=..\..\..
|
||||
LOCAL_INCLUDES=-I.
|
||||
LIBRARY_NAME=png
|
||||
CSRCS=png.c pngerror.c pngget.c pngmem.c pngpread.c pngread.c pngrio.c \
|
||||
pngrutil.c pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c \
|
||||
pngrtran.c pngwutil.c
|
||||
C_OBJS=.\$(OBJDIR)\png.obj .\$(OBJDIR)\pngerror.obj \
|
||||
.\$(OBJDIR)\pngget.obj .\$(OBJDIR)\pngmem.obj \
|
||||
.\$(OBJDIR)\pngpread.obj .\$(OBJDIR)\pngread.obj \
|
||||
.\$(OBJDIR)\pngrio.obj .\$(OBJDIR)\pngrutil.obj \
|
||||
.\$(OBJDIR)\pngset.obj .\$(OBJDIR)\pngtrans.obj \
|
||||
.\$(OBJDIR)\pngwio.obj .\$(OBJDIR)\pngwrite.obj \
|
||||
.\$(OBJDIR)\pngwtran.obj .\$(OBJDIR)\pngrtran.obj \
|
||||
.\$(OBJDIR)\pngwutil.obj
|
||||
!if "$(MOZ_BITS)" != "16"
|
||||
LINCS=-I$(XPDIST)\public\util -I$(XPDIST)\public\nspr \
|
||||
-I$(XPDIST)\public\zlib
|
||||
!endif
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
#export:: $(LIBRARY)
|
||||
install:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib\
|
||||
|
||||
#install:: export
|
||||
|
||||
|
||||
!if "$(MOZ_BITS)" == "16"
|
||||
#// We must turn off register optimization for release builds so interpreter.c
|
||||
#// can build. Otherwise array accesses for segmented arrays don't work. See
|
||||
#// bug report 67973 for details. (Note: normal setting for release build is
|
||||
#// -Ox -Os where -Ox = "-Ob1cegilnot -Gs" so we have removed the -Oe.)
|
||||
#//
|
||||
$(OBJDIR)\pngrtran.obj: pngrtran.c
|
||||
@$(CC) @<<$(CFGFILE)
|
||||
-c
|
||||
-Ob1cglnots -Gs -UDEBUG -DNDEBUG
|
||||
$(CFLAGS)
|
||||
$(LCFLAGS)
|
||||
$(LINCS)
|
||||
$(LINCS_1)
|
||||
$(INCS)
|
||||
-Fd$(PDBFILE)
|
||||
-Fo.\$(OBJDIR)\
|
||||
$(*B).c
|
||||
<<KEEP
|
||||
|
||||
!ifdef MOZ_DEBUG
|
||||
$(OBJDIR)\pngrutil.obj: pngrutil.c
|
||||
@$(CC) @<<$(CFGFILE)
|
||||
-c
|
||||
-Ob1cgnots -Gs -UDEBUG -DNDEBUG
|
||||
$(CFLAGS)
|
||||
$(LCFLAGS)
|
||||
$(LINCS)
|
||||
$(LINCS_1)
|
||||
$(INCS)
|
||||
-Fd$(PDBFILE)
|
||||
-Fo.\$(OBJDIR)\
|
||||
$(*B).c
|
||||
<<KEEP
|
||||
!endif
|
||||
|
||||
!endif
|
||||
#//endif moz_bits == 16
|
||||
@@ -1,711 +0,0 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* libpng version 1.0.9 - January 31, 2001
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
*/
|
||||
|
||||
#define PNG_INTERNAL
|
||||
#define PNG_NO_EXTERN
|
||||
#include "png.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef version_1_0_9 Your_png_h_is_not_version_1_0_9;
|
||||
|
||||
/* Version information for C files. This had better match the version
|
||||
* string defined in png.h. */
|
||||
|
||||
#ifdef PNG_USE_GLOBAL_ARRAYS
|
||||
/* png_libpng_ver was changed to a function in version 1.0.5c */
|
||||
const char png_libpng_ver[18] = "1.0.9";
|
||||
|
||||
/* png_sig was changed to a function in version 1.0.5c */
|
||||
/* Place to hold the signature string for a PNG file. */
|
||||
const png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
||||
|
||||
/* Invoke global declarations for constant strings for known chunk types */
|
||||
PNG_IHDR;
|
||||
PNG_IDAT;
|
||||
PNG_IEND;
|
||||
PNG_PLTE;
|
||||
PNG_bKGD;
|
||||
PNG_cHRM;
|
||||
PNG_gAMA;
|
||||
PNG_hIST;
|
||||
PNG_iCCP;
|
||||
PNG_iTXt;
|
||||
PNG_oFFs;
|
||||
PNG_pCAL;
|
||||
PNG_sCAL;
|
||||
PNG_pHYs;
|
||||
PNG_sBIT;
|
||||
PNG_sPLT;
|
||||
PNG_sRGB;
|
||||
PNG_tEXt;
|
||||
PNG_tIME;
|
||||
PNG_tRNS;
|
||||
PNG_zTXt;
|
||||
|
||||
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||
|
||||
/* start of interlace block */
|
||||
const int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
|
||||
|
||||
/* offset to next interlace block */
|
||||
const int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
|
||||
|
||||
/* start of interlace block in the y direction */
|
||||
const int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
|
||||
|
||||
/* offset to next interlace block in the y direction */
|
||||
const int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
|
||||
|
||||
/* width of interlace block (used in assembler routines only) */
|
||||
#ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
||||
const int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
|
||||
#endif
|
||||
|
||||
/* Height of interlace block. This is not currently used - if you need
|
||||
* it, uncomment it here and in png.h
|
||||
const int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
|
||||
*/
|
||||
|
||||
/* Mask to determine which pixels are valid in a pass */
|
||||
const int FARDATA png_pass_mask[] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
|
||||
|
||||
/* Mask to determine which pixels to overwrite while displaying */
|
||||
const int FARDATA png_pass_dsp_mask[]
|
||||
= {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
|
||||
|
||||
#endif
|
||||
|
||||
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
||||
* of the PNG file signature. If the PNG data is embedded into another
|
||||
* stream we can set num_bytes = 8 so that libpng will not attempt to read
|
||||
* or write any of the magic bytes before it starts on the IHDR.
|
||||
*/
|
||||
|
||||
void PNGAPI
|
||||
png_set_sig_bytes(png_structp png_ptr, int num_bytes)
|
||||
{
|
||||
png_debug(1, "in png_set_sig_bytes\n");
|
||||
if (num_bytes > 8)
|
||||
png_error(png_ptr, "Too many bytes for PNG signature.");
|
||||
|
||||
png_ptr->sig_bytes = (png_byte)(num_bytes < 0 ? 0 : num_bytes);
|
||||
}
|
||||
|
||||
/* Checks whether the supplied bytes match the PNG signature. We allow
|
||||
* checking less than the full 8-byte signature so that those apps that
|
||||
* already read the first few bytes of a file to determine the file type
|
||||
* can simply check the remaining bytes for extra assurance. Returns
|
||||
* an integer less than, equal to, or greater than zero if sig is found,
|
||||
* respectively, to be less than, to match, or be greater than the correct
|
||||
* PNG signature (this is the same behaviour as strcmp, memcmp, etc).
|
||||
*/
|
||||
int PNGAPI
|
||||
png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check)
|
||||
{
|
||||
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
||||
if (num_to_check > 8)
|
||||
num_to_check = 8;
|
||||
else if (num_to_check < 1)
|
||||
return (0);
|
||||
|
||||
if (start > 7)
|
||||
return (0);
|
||||
|
||||
if (start + num_to_check > 8)
|
||||
num_to_check = 8 - start;
|
||||
|
||||
return ((int)(png_memcmp(&sig[start], &png_signature[start], num_to_check)));
|
||||
}
|
||||
|
||||
/* (Obsolete) function to check signature bytes. It does not allow one
|
||||
* to check a partial signature. This function might be removed in the
|
||||
* future - use png_sig_cmp(). Returns true (nonzero) if the file is a PNG.
|
||||
*/
|
||||
int PNGAPI
|
||||
png_check_sig(png_bytep sig, int num)
|
||||
{
|
||||
return ((int)!png_sig_cmp(sig, (png_size_t)0, (png_size_t)num));
|
||||
}
|
||||
|
||||
/* Function to allocate memory for zlib and clear it to 0. */
|
||||
voidpf /* PRIVATE */
|
||||
png_zalloc(voidpf png_ptr, uInt items, uInt size)
|
||||
{
|
||||
png_uint_32 num_bytes = (png_uint_32)items * size;
|
||||
png_voidp ptr = (png_voidp)png_malloc((png_structp)png_ptr, num_bytes);
|
||||
|
||||
#ifndef PNG_NO_ZALLOC_ZERO
|
||||
if (num_bytes > (png_uint_32)0x8000L)
|
||||
{
|
||||
png_memset(ptr, 0, (png_size_t)0x8000L);
|
||||
png_memset((png_bytep)ptr + (png_size_t)0x8000L, 0,
|
||||
(png_size_t)(num_bytes - (png_uint_32)0x8000L));
|
||||
}
|
||||
else
|
||||
{
|
||||
png_memset(ptr, 0, (png_size_t)num_bytes);
|
||||
}
|
||||
#endif
|
||||
return ((voidpf)ptr);
|
||||
}
|
||||
|
||||
/* function to free memory for zlib */
|
||||
void /* PRIVATE */
|
||||
png_zfree(voidpf png_ptr, voidpf ptr)
|
||||
{
|
||||
png_free((png_structp)png_ptr, (png_voidp)ptr);
|
||||
}
|
||||
|
||||
/* Reset the CRC variable to 32 bits of 1's. Care must be taken
|
||||
* in case CRC is > 32 bits to leave the top bits 0.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_reset_crc(png_structp png_ptr)
|
||||
{
|
||||
png_ptr->crc = crc32(0, Z_NULL, 0);
|
||||
}
|
||||
|
||||
/* Calculate the CRC over a section of data. We can only pass as
|
||||
* much data to this routine as the largest single buffer size. We
|
||||
* also check that this data will actually be used before going to the
|
||||
* trouble of calculating it.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_calculate_crc(png_structp png_ptr, png_bytep ptr, png_size_t length)
|
||||
{
|
||||
int need_crc = 1;
|
||||
|
||||
if (png_ptr->chunk_name[0] & 0x20) /* ancillary */
|
||||
{
|
||||
if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_MASK) ==
|
||||
(PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN))
|
||||
need_crc = 0;
|
||||
}
|
||||
else /* critical */
|
||||
{
|
||||
if (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE)
|
||||
need_crc = 0;
|
||||
}
|
||||
|
||||
if (need_crc)
|
||||
png_ptr->crc = crc32(png_ptr->crc, ptr, (uInt)length);
|
||||
}
|
||||
|
||||
/* Allocate the memory for an info_struct for the application. We don't
|
||||
* really need the png_ptr, but it could potentially be useful in the
|
||||
* future. This should be used in favour of malloc(sizeof(png_info))
|
||||
* and png_info_init() so that applications that want to use a shared
|
||||
* libpng don't have to be recompiled if png_info changes size.
|
||||
*/
|
||||
png_infop PNGAPI
|
||||
png_create_info_struct(png_structp png_ptr)
|
||||
{
|
||||
png_infop info_ptr;
|
||||
|
||||
png_debug(1, "in png_create_info_struct\n");
|
||||
if(png_ptr == NULL) return (NULL);
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
if ((info_ptr = (png_infop)png_create_struct_2(PNG_STRUCT_INFO,
|
||||
png_ptr->malloc_fn)) != NULL)
|
||||
#else
|
||||
if ((info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO)) != NULL)
|
||||
#endif
|
||||
{
|
||||
png_info_init(info_ptr);
|
||||
}
|
||||
|
||||
return (info_ptr);
|
||||
}
|
||||
|
||||
/* This function frees the memory associated with a single info struct.
|
||||
* Normally, one would use either png_destroy_read_struct() or
|
||||
* png_destroy_write_struct() to free an info struct, but this may be
|
||||
* useful for some applications.
|
||||
*/
|
||||
void PNGAPI
|
||||
png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
|
||||
{
|
||||
png_infop info_ptr = NULL;
|
||||
|
||||
png_debug(1, "in png_destroy_info_struct\n");
|
||||
if (info_ptr_ptr != NULL)
|
||||
info_ptr = *info_ptr_ptr;
|
||||
|
||||
if (info_ptr != NULL)
|
||||
{
|
||||
png_info_destroy(png_ptr, info_ptr);
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
png_destroy_struct_2((png_voidp)info_ptr, png_ptr->free_fn);
|
||||
#else
|
||||
png_destroy_struct((png_voidp)info_ptr);
|
||||
#endif
|
||||
*info_ptr_ptr = (png_infop)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize the info structure. This is now an internal function (0.89)
|
||||
* and applications using it are urged to use png_create_info_struct()
|
||||
* instead.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_info_init(png_infop info_ptr)
|
||||
{
|
||||
png_debug(1, "in png_info_init\n");
|
||||
/* set everything to 0 */
|
||||
png_memset(info_ptr, 0, sizeof (png_info));
|
||||
}
|
||||
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
void PNGAPI
|
||||
png_data_freer(png_structp png_ptr, png_infop info_ptr,
|
||||
int freer, png_uint_32 mask)
|
||||
{
|
||||
png_debug(1, "in png_data_freer\n");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
if(freer == PNG_DESTROY_WILL_FREE_DATA)
|
||||
info_ptr->free_me |= mask;
|
||||
else if(freer == PNG_USER_WILL_FREE_DATA)
|
||||
info_ptr->free_me &= ~mask;
|
||||
else
|
||||
png_warning(png_ptr,
|
||||
"Unknown freer parameter in png_data_freer.");
|
||||
}
|
||||
#endif
|
||||
|
||||
void PNGAPI
|
||||
png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask, int num)
|
||||
{
|
||||
png_debug(1, "in png_free_data\n");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
#if defined(PNG_TEXT_SUPPORTED)
|
||||
/* free text item num or (if num == -1) all text items */
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if ((mask & PNG_FREE_TEXT) & info_ptr->free_me)
|
||||
#else
|
||||
if (mask & PNG_FREE_TEXT)
|
||||
#endif
|
||||
{
|
||||
if (num != -1)
|
||||
{
|
||||
if (info_ptr->text && info_ptr->text[num].key)
|
||||
{
|
||||
png_free(png_ptr, info_ptr->text[num].key);
|
||||
info_ptr->text[num].key = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < info_ptr->num_text; i++)
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_TEXT, i);
|
||||
png_free(png_ptr, info_ptr->text);
|
||||
info_ptr->text = NULL;
|
||||
info_ptr->num_text=0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_tRNS_SUPPORTED)
|
||||
/* free any tRNS entry */
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if ((mask & PNG_FREE_TRNS) & info_ptr->free_me)
|
||||
#else
|
||||
if ((mask & PNG_FREE_TRNS) && (png_ptr->flags & PNG_FLAG_FREE_TRNS))
|
||||
#endif
|
||||
{
|
||||
png_free(png_ptr, info_ptr->trans);
|
||||
info_ptr->valid &= ~PNG_INFO_tRNS;
|
||||
info_ptr->trans = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_sCAL_SUPPORTED)
|
||||
/* free any sCAL entry */
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if ((mask & PNG_FREE_SCAL) & info_ptr->free_me)
|
||||
#else
|
||||
if (mask & PNG_FREE_SCAL)
|
||||
#endif
|
||||
{
|
||||
#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED)
|
||||
png_free(png_ptr, info_ptr->scal_s_width);
|
||||
png_free(png_ptr, info_ptr->scal_s_height);
|
||||
info_ptr->scal_s_width = NULL;
|
||||
info_ptr->scal_s_height = NULL;
|
||||
#endif
|
||||
info_ptr->valid &= ~PNG_INFO_sCAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_pCAL_SUPPORTED)
|
||||
/* free any pCAL entry */
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if ((mask & PNG_FREE_PCAL) & info_ptr->free_me)
|
||||
#else
|
||||
if (mask & PNG_FREE_PCAL)
|
||||
#endif
|
||||
{
|
||||
png_free(png_ptr, info_ptr->pcal_purpose);
|
||||
png_free(png_ptr, info_ptr->pcal_units);
|
||||
info_ptr->pcal_purpose = NULL;
|
||||
info_ptr->pcal_units = NULL;
|
||||
if (info_ptr->pcal_params != NULL)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < (int)info_ptr->pcal_nparams; i++)
|
||||
{
|
||||
png_free(png_ptr, info_ptr->pcal_params[i]);
|
||||
info_ptr->pcal_params[i]=NULL;
|
||||
}
|
||||
png_free(png_ptr, info_ptr->pcal_params);
|
||||
info_ptr->pcal_params = NULL;
|
||||
}
|
||||
info_ptr->valid &= ~PNG_INFO_pCAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_iCCP_SUPPORTED)
|
||||
/* free any iCCP entry */
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if ((mask & PNG_FREE_ICCP) & info_ptr->free_me)
|
||||
#else
|
||||
if (mask & PNG_FREE_ICCP)
|
||||
#endif
|
||||
{
|
||||
png_free(png_ptr, info_ptr->iccp_name);
|
||||
png_free(png_ptr, info_ptr->iccp_profile);
|
||||
info_ptr->iccp_name = NULL;
|
||||
info_ptr->iccp_profile = NULL;
|
||||
info_ptr->valid &= ~PNG_INFO_iCCP;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_sPLT_SUPPORTED)
|
||||
/* free a given sPLT entry, or (if num == -1) all sPLT entries */
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if ((mask & PNG_FREE_SPLT) & info_ptr->free_me)
|
||||
#else
|
||||
if (mask & PNG_FREE_SPLT)
|
||||
#endif
|
||||
{
|
||||
if (num != -1)
|
||||
{
|
||||
if(info_ptr->splt_palettes)
|
||||
{
|
||||
png_free(png_ptr, info_ptr->splt_palettes[num].name);
|
||||
png_free(png_ptr, info_ptr->splt_palettes[num].entries);
|
||||
info_ptr->splt_palettes[num].name = NULL;
|
||||
info_ptr->splt_palettes[num].entries = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(info_ptr->splt_palettes_num)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < (int)info_ptr->splt_palettes_num; i++)
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_SPLT, i);
|
||||
|
||||
png_free(png_ptr, info_ptr->splt_palettes);
|
||||
info_ptr->splt_palettes = NULL;
|
||||
info_ptr->splt_palettes_num = 0;
|
||||
}
|
||||
info_ptr->valid &= ~PNG_INFO_sPLT;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if ((mask & PNG_FREE_UNKN) & info_ptr->free_me)
|
||||
#else
|
||||
if (mask & PNG_FREE_UNKN)
|
||||
#endif
|
||||
{
|
||||
if (num != -1)
|
||||
{
|
||||
if(info_ptr->unknown_chunks)
|
||||
{
|
||||
png_free(png_ptr, info_ptr->unknown_chunks[num].data);
|
||||
info_ptr->unknown_chunks[num].data = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
if(info_ptr->unknown_chunks_num)
|
||||
{
|
||||
for (i = 0; i < (int)info_ptr->unknown_chunks_num; i++)
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_UNKN, i);
|
||||
|
||||
png_free(png_ptr, info_ptr->unknown_chunks);
|
||||
info_ptr->unknown_chunks = NULL;
|
||||
info_ptr->unknown_chunks_num = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_hIST_SUPPORTED)
|
||||
/* free any hIST entry */
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if ((mask & PNG_FREE_HIST) & info_ptr->free_me)
|
||||
#else
|
||||
if ((mask & PNG_FREE_HIST) && (png_ptr->flags & PNG_FLAG_FREE_HIST))
|
||||
#endif
|
||||
{
|
||||
png_free(png_ptr, info_ptr->hist);
|
||||
info_ptr->hist = NULL;
|
||||
info_ptr->valid &= ~PNG_INFO_hIST;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* free any PLTE entry that was internally allocated */
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if ((mask & PNG_FREE_PLTE) & info_ptr->free_me)
|
||||
#else
|
||||
if ((mask & PNG_FREE_PLTE) && (png_ptr->flags & PNG_FLAG_FREE_PLTE))
|
||||
#endif
|
||||
{
|
||||
png_zfree(png_ptr, info_ptr->palette);
|
||||
info_ptr->palette = NULL;
|
||||
info_ptr->valid &= ~PNG_INFO_PLTE;
|
||||
info_ptr->num_palette = 0;
|
||||
}
|
||||
|
||||
#if defined(PNG_INFO_IMAGE_SUPPORTED)
|
||||
/* free any image bits attached to the info structure */
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if ((mask & PNG_FREE_ROWS) & info_ptr->free_me)
|
||||
#else
|
||||
if (mask & PNG_FREE_ROWS)
|
||||
#endif
|
||||
{
|
||||
if(info_ptr->row_pointers)
|
||||
{
|
||||
int row;
|
||||
for (row = 0; row < (int)info_ptr->height; row++)
|
||||
{
|
||||
png_free(png_ptr, info_ptr->row_pointers[row]);
|
||||
info_ptr->row_pointers[row]=NULL;
|
||||
}
|
||||
png_free(png_ptr, info_ptr->row_pointers);
|
||||
info_ptr->row_pointers=NULL;
|
||||
}
|
||||
info_ptr->valid &= ~PNG_INFO_IDAT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if(num == -1)
|
||||
info_ptr->free_me &= ~mask;
|
||||
else
|
||||
info_ptr->free_me &= ~(mask & ~PNG_FREE_MUL);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* This is an internal routine to free any memory that the info struct is
|
||||
* pointing to before re-using it or freeing the struct itself. Recall
|
||||
* that png_free() checks for NULL pointers for us.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_info_destroy(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
png_debug(1, "in png_info_destroy\n");
|
||||
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
|
||||
|
||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
if (png_ptr->num_chunk_list)
|
||||
{
|
||||
png_free(png_ptr, png_ptr->chunk_list);
|
||||
png_ptr->chunk_list=NULL;
|
||||
png_ptr->num_chunk_list=0;
|
||||
}
|
||||
#endif
|
||||
|
||||
png_info_init(info_ptr);
|
||||
}
|
||||
|
||||
/* This function returns a pointer to the io_ptr associated with the user
|
||||
* functions. The application should free any memory associated with this
|
||||
* pointer before png_write_destroy() or png_read_destroy() are called.
|
||||
*/
|
||||
png_voidp PNGAPI
|
||||
png_get_io_ptr(png_structp png_ptr)
|
||||
{
|
||||
return (png_ptr->io_ptr);
|
||||
}
|
||||
|
||||
#if !defined(PNG_NO_STDIO)
|
||||
/* Initialize the default input/output functions for the PNG file. If you
|
||||
* use your own read or write routines, you can call either png_set_read_fn()
|
||||
* or png_set_write_fn() instead of png_init_io(). If you have defined
|
||||
* PNG_NO_STDIO, you must use a function of your own because "FILE *" isn't
|
||||
* necessarily available.
|
||||
*/
|
||||
void PNGAPI
|
||||
png_init_io(png_structp png_ptr, png_FILE_p fp)
|
||||
{
|
||||
png_debug(1, "in png_init_io\n");
|
||||
png_ptr->io_ptr = (png_voidp)fp;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_TIME_RFC1123_SUPPORTED)
|
||||
/* Convert the supplied time into an RFC 1123 string suitable for use in
|
||||
* a "Creation Time" or other text-based time string.
|
||||
*/
|
||||
png_charp PNGAPI
|
||||
png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
||||
{
|
||||
static PNG_CONST char short_months[12][4] =
|
||||
{"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||
|
||||
if (png_ptr->time_buffer == NULL)
|
||||
{
|
||||
png_ptr->time_buffer = (png_charp)png_malloc(png_ptr, (png_uint_32)(29*
|
||||
sizeof(char)));
|
||||
}
|
||||
|
||||
#if defined(_WIN32_WCE)
|
||||
{
|
||||
wchar_t time_buf[29];
|
||||
wsprintf(time_buf, TEXT("%d %S %d %02d:%02d:%02d +0000"),
|
||||
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
||||
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
||||
ptime->second % 61);
|
||||
WideCharToMultiByte(CP_ACP, 0, time_buf, -1, png_ptr->time_buffer, 29,
|
||||
NULL, NULL);
|
||||
}
|
||||
#else
|
||||
#ifdef USE_FAR_KEYWORD
|
||||
{
|
||||
char near_time_buf[29];
|
||||
sprintf(near_time_buf, "%d %s %d %02d:%02d:%02d +0000",
|
||||
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
||||
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
||||
ptime->second % 61);
|
||||
png_memcpy(png_ptr->time_buffer, near_time_buf,
|
||||
29*sizeof(char));
|
||||
}
|
||||
#else
|
||||
sprintf(png_ptr->time_buffer, "%d %s %d %02d:%02d:%02d +0000",
|
||||
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
||||
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
||||
ptime->second % 61);
|
||||
#endif
|
||||
#endif /* _WIN32_WCE */
|
||||
return ((png_charp)png_ptr->time_buffer);
|
||||
}
|
||||
#endif /* PNG_TIME_RFC1123_SUPPORTED */
|
||||
|
||||
#if 0
|
||||
/* Signature string for a PNG file. */
|
||||
png_bytep PNGAPI
|
||||
png_sig_bytes(void)
|
||||
{
|
||||
return ((png_bytep)"\211\120\116\107\015\012\032\012");
|
||||
}
|
||||
#endif
|
||||
|
||||
png_charp PNGAPI
|
||||
png_get_copyright(png_structp png_ptr)
|
||||
{
|
||||
if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */
|
||||
return ((png_charp) "\n libpng version 1.0.9 - January 31, 2001\n\
|
||||
Copyright (c) 1998-2001 Glenn Randers-Pehrson\n\
|
||||
Copyright (c) 1996, 1997 Andreas Dilger\n\
|
||||
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n");
|
||||
return ((png_charp) "");
|
||||
}
|
||||
|
||||
/* The following return the library version as a short string in the
|
||||
* format 1.0.0 through 99.99.99zz. To get the version of *.h files used
|
||||
* with your application, print out PNG_LIBPNG_VER_STRING, which is defined
|
||||
* in png.h.
|
||||
*/
|
||||
|
||||
png_charp PNGAPI
|
||||
png_get_libpng_ver(png_structp png_ptr)
|
||||
{
|
||||
/* Version of *.c files used when building libpng */
|
||||
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
||||
return((png_charp) "1.0.9");
|
||||
return((png_charp) "1.0.9");
|
||||
}
|
||||
|
||||
png_charp PNGAPI
|
||||
png_get_header_ver(png_structp png_ptr)
|
||||
{
|
||||
/* Version of *.h files used when building libpng */
|
||||
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
||||
return((png_charp) PNG_LIBPNG_VER_STRING);
|
||||
return((png_charp) PNG_LIBPNG_VER_STRING);
|
||||
}
|
||||
|
||||
png_charp PNGAPI
|
||||
png_get_header_version(png_structp png_ptr)
|
||||
{
|
||||
/* Returns longer string containing both version and date */
|
||||
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
||||
return((png_charp) PNG_HEADER_VERSION_STRING);
|
||||
return((png_charp) PNG_HEADER_VERSION_STRING);
|
||||
}
|
||||
|
||||
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||
int /* PRIVATE */
|
||||
png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name)
|
||||
{
|
||||
/* check chunk_name and return "keep" value if it's on the list, else 0 */
|
||||
int i;
|
||||
png_bytep p;
|
||||
if((png_ptr == NULL && chunk_name == NULL) || png_ptr->num_chunk_list<=0)
|
||||
return 0;
|
||||
p=png_ptr->chunk_list+png_ptr->num_chunk_list*5-5;
|
||||
for (i = png_ptr->num_chunk_list; i; i--, p-=5)
|
||||
if (!png_memcmp(chunk_name, p, 4))
|
||||
return ((int)*(p+4));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function, added to libpng-1.0.6g, is untested. */
|
||||
int PNGAPI
|
||||
png_reset_zstream(png_structp png_ptr)
|
||||
{
|
||||
return (inflateReset(&png_ptr->zstream));
|
||||
}
|
||||
|
||||
/* This function was added to libpng-1.0.7 */
|
||||
png_uint_32 PNGAPI
|
||||
png_access_version_number(void)
|
||||
{
|
||||
/* Version of *.c files used when building libpng */
|
||||
return((png_uint_32) 10009L);
|
||||
}
|
||||
|
||||
|
||||
#if 0 /* delay this until version 1.2.0 */
|
||||
/* this function was added to libpng 1.0.9 (porting aid to libpng-1.2.0) */
|
||||
#ifndef PNG_ASSEMBLER_CODE_SUPPORTED
|
||||
int PNGAPI
|
||||
png_mmx_support(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
#endif /* 0 */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +0,0 @@
|
||||
/* pngasmrd.h - assembler version of utilities to read a PNG file
|
||||
*
|
||||
* libpng 1.0.9 - January 31, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 2001 Glenn Randers-Pehrson
|
||||
*
|
||||
*/
|
||||
|
||||
/* This file is obsolete in libpng-1.0.9 and later; its contents now appear
|
||||
* at the end of pngconf.h.
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,191 +0,0 @@
|
||||
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* libpng 1.0.9 - January 31, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
* This file provides a location for all error handling. Users who
|
||||
* need special error handling are expected to write replacement functions
|
||||
* and use png_set_error_fn() to use those functions. See the instructions
|
||||
* at each function.
|
||||
*/
|
||||
|
||||
#define PNG_INTERNAL
|
||||
#include "png.h"
|
||||
|
||||
static void /* PRIVATE */
|
||||
png_default_error PNGARG((png_structp png_ptr,
|
||||
png_const_charp message));
|
||||
static void /* PRIVATE */
|
||||
png_default_warning PNGARG((png_structp png_ptr,
|
||||
png_const_charp message));
|
||||
|
||||
/* This function is called whenever there is a fatal error. This function
|
||||
* should not be changed. If there is a need to handle errors differently,
|
||||
* you should supply a replacement error function and use png_set_error_fn()
|
||||
* to replace the error function at run-time.
|
||||
*/
|
||||
void PNGAPI
|
||||
png_error(png_structp png_ptr, png_const_charp message)
|
||||
{
|
||||
if (png_ptr->error_fn != NULL)
|
||||
(*(png_ptr->error_fn))(png_ptr, message);
|
||||
|
||||
/* if the following returns or doesn't exist, use the default function,
|
||||
which will not return */
|
||||
png_default_error(png_ptr, message);
|
||||
}
|
||||
|
||||
/* This function is called whenever there is a non-fatal error. This function
|
||||
* should not be changed. If there is a need to handle warnings differently,
|
||||
* you should supply a replacement warning function and use
|
||||
* png_set_error_fn() to replace the warning function at run-time.
|
||||
*/
|
||||
void PNGAPI
|
||||
png_warning(png_structp png_ptr, png_const_charp message)
|
||||
{
|
||||
if (png_ptr->warning_fn != NULL)
|
||||
(*(png_ptr->warning_fn))(png_ptr, message);
|
||||
else
|
||||
png_default_warning(png_ptr, message);
|
||||
}
|
||||
|
||||
/* These utilities are used internally to build an error message that relates
|
||||
* to the current chunk. The chunk name comes from png_ptr->chunk_name,
|
||||
* this is used to prefix the message. The message is limited in length
|
||||
* to 63 bytes, the name characters are output as hex digits wrapped in []
|
||||
* if the character is invalid.
|
||||
*/
|
||||
#define isnonalpha(c) ((c) < 41 || (c) > 122 || ((c) > 90 && (c) < 97))
|
||||
static PNG_CONST char png_digit[16] = {
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
|
||||
};
|
||||
|
||||
static void /* PRIVATE */
|
||||
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp message)
|
||||
{
|
||||
int iout = 0, iin = 0;
|
||||
|
||||
while (iin < 4)
|
||||
{
|
||||
int c = png_ptr->chunk_name[iin++];
|
||||
if (isnonalpha(c))
|
||||
{
|
||||
buffer[iout++] = '[';
|
||||
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
|
||||
buffer[iout++] = png_digit[c & 0x0f];
|
||||
buffer[iout++] = ']';
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer[iout++] = (png_byte)c;
|
||||
}
|
||||
}
|
||||
|
||||
if (message == NULL)
|
||||
buffer[iout] = 0;
|
||||
else
|
||||
{
|
||||
buffer[iout++] = ':';
|
||||
buffer[iout++] = ' ';
|
||||
png_memcpy(buffer+iout, message, 64);
|
||||
buffer[iout+63] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void PNGAPI
|
||||
png_chunk_error(png_structp png_ptr, png_const_charp message)
|
||||
{
|
||||
char msg[18+64];
|
||||
png_format_buffer(png_ptr, msg, message);
|
||||
png_error(png_ptr, msg);
|
||||
}
|
||||
|
||||
void PNGAPI
|
||||
png_chunk_warning(png_structp png_ptr, png_const_charp message)
|
||||
{
|
||||
char msg[16+64];
|
||||
png_format_buffer(png_ptr, msg, message);
|
||||
png_warning(png_ptr, msg);
|
||||
}
|
||||
|
||||
/* This is the default error handling function. Note that replacements for
|
||||
* this function MUST NOT RETURN, or the program will likely crash. This
|
||||
* function is used by default, or if the program supplies NULL for the
|
||||
* error function pointer in png_set_error_fn().
|
||||
*/
|
||||
static void /* PRIVATE */
|
||||
png_default_error(png_structp png_ptr, png_const_charp message)
|
||||
{
|
||||
#ifndef PNG_NO_CONSOLE_IO
|
||||
fprintf(stderr, "libpng error: %s\n", message);
|
||||
#else
|
||||
if (message)
|
||||
/* make compiler happy */ ;
|
||||
#endif
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
# ifdef USE_FAR_KEYWORD
|
||||
{
|
||||
jmp_buf jmpbuf;
|
||||
png_memcpy(jmpbuf,png_ptr->jmpbuf,sizeof(jmp_buf));
|
||||
longjmp(jmpbuf, 1);
|
||||
}
|
||||
# else
|
||||
longjmp(png_ptr->jmpbuf, 1);
|
||||
# endif
|
||||
#else
|
||||
if (png_ptr)
|
||||
/* make compiler happy */ ;
|
||||
PNG_ABORT();
|
||||
#endif
|
||||
}
|
||||
|
||||
/* This function is called when there is a warning, but the library thinks
|
||||
* it can continue anyway. Replacement functions don't have to do anything
|
||||
* here if you don't want them to. In the default configuration, png_ptr is
|
||||
* not used, but it is passed in case it may be useful.
|
||||
*/
|
||||
static void /* PRIVATE */
|
||||
png_default_warning(png_structp png_ptr, png_const_charp message)
|
||||
{
|
||||
#ifndef PNG_NO_CONSOLE_IO
|
||||
fprintf(stderr, "libpng warning: %s\n", message);
|
||||
#else
|
||||
if (message)
|
||||
/* appease compiler */ ;
|
||||
#endif
|
||||
if (png_ptr)
|
||||
return;
|
||||
}
|
||||
|
||||
/* This function is called when the application wants to use another method
|
||||
* of handling errors and warnings. Note that the error function MUST NOT
|
||||
* return to the calling routine or serious problems will occur. The return
|
||||
* method used in the default routine calls longjmp(png_ptr->jmpbuf, 1)
|
||||
*/
|
||||
void PNGAPI
|
||||
png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
||||
png_error_ptr error_fn, png_error_ptr warning_fn)
|
||||
{
|
||||
png_ptr->error_ptr = error_ptr;
|
||||
png_ptr->error_fn = error_fn;
|
||||
png_ptr->warning_fn = warning_fn;
|
||||
}
|
||||
|
||||
|
||||
/* This function returns a pointer to the error_ptr associated with the user
|
||||
* functions. The application should free any memory associated with this
|
||||
* pointer before png_write_destroy and png_read_destroy are called.
|
||||
*/
|
||||
png_voidp PNGAPI
|
||||
png_get_error_ptr(png_structp png_ptr)
|
||||
{
|
||||
return ((png_voidp)png_ptr->error_ptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,828 +0,0 @@
|
||||
|
||||
/* pngget.c - retrieval of values from info struct
|
||||
*
|
||||
* libpng 1.0.9 - January 31, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*/
|
||||
|
||||
#define PNG_INTERNAL
|
||||
#include "png.h"
|
||||
|
||||
png_uint_32 PNGAPI
|
||||
png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
return(info_ptr->valid & flag);
|
||||
else
|
||||
return(0);
|
||||
}
|
||||
|
||||
png_uint_32 PNGAPI
|
||||
png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
return(info_ptr->rowbytes);
|
||||
else
|
||||
return(0);
|
||||
}
|
||||
|
||||
#if defined(PNG_INFO_IMAGE_SUPPORTED)
|
||||
png_bytepp PNGAPI
|
||||
png_get_rows(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
return(info_ptr->row_pointers);
|
||||
else
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_EASY_ACCESS_SUPPORTED
|
||||
/* easy access to info, added in libpng-0.99 */
|
||||
png_uint_32 PNGAPI
|
||||
png_get_image_width(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
{
|
||||
return info_ptr->width;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
png_uint_32 PNGAPI
|
||||
png_get_image_height(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
{
|
||||
return info_ptr->height;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
png_byte PNGAPI
|
||||
png_get_bit_depth(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
{
|
||||
return info_ptr->bit_depth;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
png_byte PNGAPI
|
||||
png_get_color_type(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
{
|
||||
return info_ptr->color_type;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
png_byte PNGAPI
|
||||
png_get_filter_type(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
{
|
||||
return info_ptr->filter_type;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
png_byte PNGAPI
|
||||
png_get_interlace_type(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
{
|
||||
return info_ptr->interlace_type;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
png_byte PNGAPI
|
||||
png_get_compression_type(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
{
|
||||
return info_ptr->compression_type;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
png_uint_32 PNGAPI
|
||||
png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
#if defined(PNG_pHYs_SUPPORTED)
|
||||
if (info_ptr->valid & PNG_INFO_pHYs)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "png_get_x_pixels_per_meter");
|
||||
if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
|
||||
return (0);
|
||||
else return (info_ptr->x_pixels_per_unit);
|
||||
}
|
||||
#else
|
||||
return (0);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
png_uint_32 PNGAPI
|
||||
png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
#if defined(PNG_pHYs_SUPPORTED)
|
||||
if (info_ptr->valid & PNG_INFO_pHYs)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "png_get_y_pixels_per_meter");
|
||||
if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
|
||||
return (0);
|
||||
else return (info_ptr->y_pixels_per_unit);
|
||||
}
|
||||
#else
|
||||
return (0);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
png_uint_32 PNGAPI
|
||||
png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
#if defined(PNG_pHYs_SUPPORTED)
|
||||
if (info_ptr->valid & PNG_INFO_pHYs)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "png_get_pixels_per_meter");
|
||||
if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER ||
|
||||
info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit)
|
||||
return (0);
|
||||
else return (info_ptr->x_pixels_per_unit);
|
||||
}
|
||||
#else
|
||||
return (0);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
float PNGAPI
|
||||
png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
#if defined(PNG_pHYs_SUPPORTED)
|
||||
if (info_ptr->valid & PNG_INFO_pHYs)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "png_get_aspect_ratio");
|
||||
if (info_ptr->x_pixels_per_unit == 0)
|
||||
return ((float)0.0);
|
||||
else
|
||||
return ((float)((float)info_ptr->y_pixels_per_unit
|
||||
/(float)info_ptr->x_pixels_per_unit));
|
||||
}
|
||||
#else
|
||||
return (0.0);
|
||||
#endif
|
||||
return ((float)0.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
png_int_32 PNGAPI
|
||||
png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
#if defined(PNG_oFFs_SUPPORTED)
|
||||
if (info_ptr->valid & PNG_INFO_oFFs)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns");
|
||||
if(info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
|
||||
return (0);
|
||||
else return (info_ptr->x_offset);
|
||||
}
|
||||
#else
|
||||
return (0);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
png_int_32 PNGAPI
|
||||
png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
#if defined(PNG_oFFs_SUPPORTED)
|
||||
if (info_ptr->valid & PNG_INFO_oFFs)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns");
|
||||
if(info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
|
||||
return (0);
|
||||
else return (info_ptr->y_offset);
|
||||
}
|
||||
#else
|
||||
return (0);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
png_int_32 PNGAPI
|
||||
png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
#if defined(PNG_oFFs_SUPPORTED)
|
||||
if (info_ptr->valid & PNG_INFO_oFFs)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns");
|
||||
if(info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
|
||||
return (0);
|
||||
else return (info_ptr->x_offset);
|
||||
}
|
||||
#else
|
||||
return (0);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
png_int_32 PNGAPI
|
||||
png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
#if defined(PNG_oFFs_SUPPORTED)
|
||||
if (info_ptr->valid & PNG_INFO_oFFs)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns");
|
||||
if(info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
|
||||
return (0);
|
||||
else return (info_ptr->y_offset);
|
||||
}
|
||||
#else
|
||||
return (0);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED)
|
||||
png_uint_32 PNGAPI
|
||||
png_get_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
return ((png_uint_32)((float)png_get_pixels_per_meter(png_ptr, info_ptr)
|
||||
*.0254 +.5));
|
||||
}
|
||||
|
||||
png_uint_32 PNGAPI
|
||||
png_get_x_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
return ((png_uint_32)((float)png_get_x_pixels_per_meter(png_ptr, info_ptr)
|
||||
*.0254 +.5));
|
||||
}
|
||||
|
||||
png_uint_32 PNGAPI
|
||||
png_get_y_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
return ((png_uint_32)((float)png_get_y_pixels_per_meter(png_ptr, info_ptr)
|
||||
*.0254 +.5));
|
||||
}
|
||||
|
||||
float PNGAPI
|
||||
png_get_x_offset_inches(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
return ((float)png_get_x_offset_microns(png_ptr, info_ptr)
|
||||
*.00003937);
|
||||
}
|
||||
|
||||
float PNGAPI
|
||||
png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
return ((float)png_get_y_offset_microns(png_ptr, info_ptr)
|
||||
*.00003937);
|
||||
}
|
||||
|
||||
#if defined(PNG_READ_pHYs_SUPPORTED)
|
||||
png_uint_32 PNGAPI
|
||||
png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
|
||||
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
|
||||
{
|
||||
png_uint_32 retval = 0;
|
||||
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "pHYs");
|
||||
if (res_x != NULL)
|
||||
{
|
||||
*res_x = info_ptr->x_pixels_per_unit;
|
||||
retval |= PNG_INFO_pHYs;
|
||||
}
|
||||
if (res_y != NULL)
|
||||
{
|
||||
*res_y = info_ptr->y_pixels_per_unit;
|
||||
retval |= PNG_INFO_pHYs;
|
||||
}
|
||||
if (unit_type != NULL)
|
||||
{
|
||||
*unit_type = (int)info_ptr->phys_unit_type;
|
||||
retval |= PNG_INFO_pHYs;
|
||||
if(*unit_type == 1)
|
||||
{
|
||||
if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50);
|
||||
if (res_y != NULL) *res_y = (png_uint_32)(*res_y * .0254 + .50);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (retval);
|
||||
}
|
||||
#endif /* PNG_READ_pHYs_SUPPORTED */
|
||||
#endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */
|
||||
|
||||
/* png_get_channels really belongs in here, too, but it's been around longer */
|
||||
|
||||
#endif /* PNG_EASY_ACCESS_SUPPORTED */
|
||||
|
||||
png_byte PNGAPI
|
||||
png_get_channels(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
return(info_ptr->channels);
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
|
||||
png_bytep PNGAPI
|
||||
png_get_signature(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
return(info_ptr->signature);
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
#if defined(PNG_READ_bKGD_SUPPORTED)
|
||||
png_uint_32 PNGAPI
|
||||
png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
|
||||
png_color_16p *background)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD)
|
||||
&& background != NULL)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "bKGD");
|
||||
*background = &(info_ptr->background);
|
||||
return (PNG_INFO_bKGD);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_cHRM_SUPPORTED)
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
png_uint_32 PNGAPI
|
||||
png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
|
||||
double *white_x, double *white_y, double *red_x, double *red_y,
|
||||
double *green_x, double *green_y, double *blue_x, double *blue_y)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "cHRM");
|
||||
if (white_x != NULL)
|
||||
*white_x = (double)info_ptr->x_white;
|
||||
if (white_y != NULL)
|
||||
*white_y = (double)info_ptr->y_white;
|
||||
if (red_x != NULL)
|
||||
*red_x = (double)info_ptr->x_red;
|
||||
if (red_y != NULL)
|
||||
*red_y = (double)info_ptr->y_red;
|
||||
if (green_x != NULL)
|
||||
*green_x = (double)info_ptr->x_green;
|
||||
if (green_y != NULL)
|
||||
*green_y = (double)info_ptr->y_green;
|
||||
if (blue_x != NULL)
|
||||
*blue_x = (double)info_ptr->x_blue;
|
||||
if (blue_y != NULL)
|
||||
*blue_y = (double)info_ptr->y_blue;
|
||||
return (PNG_INFO_cHRM);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
png_uint_32 PNGAPI
|
||||
png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
|
||||
png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x,
|
||||
png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y,
|
||||
png_fixed_point *blue_x, png_fixed_point *blue_y)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "cHRM");
|
||||
if (white_x != NULL)
|
||||
*white_x = info_ptr->int_x_white;
|
||||
if (white_y != NULL)
|
||||
*white_y = info_ptr->int_y_white;
|
||||
if (red_x != NULL)
|
||||
*red_x = info_ptr->int_x_red;
|
||||
if (red_y != NULL)
|
||||
*red_y = info_ptr->int_y_red;
|
||||
if (green_x != NULL)
|
||||
*green_x = info_ptr->int_x_green;
|
||||
if (green_y != NULL)
|
||||
*green_y = info_ptr->int_y_green;
|
||||
if (blue_x != NULL)
|
||||
*blue_x = info_ptr->int_x_blue;
|
||||
if (blue_y != NULL)
|
||||
*blue_y = info_ptr->int_y_blue;
|
||||
return (PNG_INFO_cHRM);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_gAMA_SUPPORTED)
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
png_uint_32 PNGAPI
|
||||
png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
|
||||
&& file_gamma != NULL)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "gAMA");
|
||||
*file_gamma = (double)info_ptr->gamma;
|
||||
return (PNG_INFO_gAMA);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
png_uint_32 PNGAPI
|
||||
png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
|
||||
png_fixed_point *int_file_gamma)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
|
||||
&& int_file_gamma != NULL)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "gAMA");
|
||||
*int_file_gamma = info_ptr->int_gamma;
|
||||
return (PNG_INFO_gAMA);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_sRGB_SUPPORTED)
|
||||
png_uint_32 PNGAPI
|
||||
png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)
|
||||
&& file_srgb_intent != NULL)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "sRGB");
|
||||
*file_srgb_intent = (int)info_ptr->srgb_intent;
|
||||
return (PNG_INFO_sRGB);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_iCCP_SUPPORTED)
|
||||
png_uint_32 PNGAPI
|
||||
png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
|
||||
png_charpp name, int *compression_type,
|
||||
png_charpp profile, png_uint_32 *proflen)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)
|
||||
&& name != NULL && profile != NULL && proflen != NULL)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "iCCP");
|
||||
*name = info_ptr->iccp_name;
|
||||
*profile = info_ptr->iccp_profile;
|
||||
/* compression_type is a dummy so the API won't have to change
|
||||
if we introduce multiple compression types later. */
|
||||
*proflen = (int)info_ptr->iccp_proflen;
|
||||
*compression_type = (int)info_ptr->iccp_compression;
|
||||
return (PNG_INFO_iCCP);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_sPLT_SUPPORTED)
|
||||
png_uint_32 PNGAPI
|
||||
png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
|
||||
png_sPLT_tpp spalettes)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
|
||||
*spalettes = info_ptr->splt_palettes;
|
||||
return ((png_uint_32)info_ptr->splt_palettes_num);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_hIST_SUPPORTED)
|
||||
png_uint_32 PNGAPI
|
||||
png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)
|
||||
&& hist != NULL)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "hIST");
|
||||
*hist = info_ptr->hist;
|
||||
return (PNG_INFO_hIST);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
png_uint_32 PNGAPI
|
||||
png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
|
||||
png_uint_32 *width, png_uint_32 *height, int *bit_depth,
|
||||
int *color_type, int *interlace_type, int *compression_type,
|
||||
int *filter_type)
|
||||
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL && width != NULL && height != NULL &&
|
||||
bit_depth != NULL && color_type != NULL)
|
||||
{
|
||||
int pixel_depth, channels;
|
||||
png_uint_32 rowbytes_per_pixel;
|
||||
|
||||
png_debug1(1, "in %s retrieval function\n", "IHDR");
|
||||
*width = info_ptr->width;
|
||||
*height = info_ptr->height;
|
||||
*bit_depth = info_ptr->bit_depth;
|
||||
*color_type = info_ptr->color_type;
|
||||
if (compression_type != NULL)
|
||||
*compression_type = info_ptr->compression_type;
|
||||
if (filter_type != NULL)
|
||||
*filter_type = info_ptr->filter_type;
|
||||
if (interlace_type != NULL)
|
||||
*interlace_type = info_ptr->interlace_type;
|
||||
|
||||
/* check for potential overflow of rowbytes */
|
||||
if (*color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
channels = 1;
|
||||
else if (*color_type & PNG_COLOR_MASK_COLOR)
|
||||
channels = 3;
|
||||
else
|
||||
channels = 1;
|
||||
if (*color_type & PNG_COLOR_MASK_ALPHA)
|
||||
channels++;
|
||||
pixel_depth = *bit_depth * channels;
|
||||
rowbytes_per_pixel = (pixel_depth + 7) >> 3;
|
||||
if ((*width > PNG_MAX_UINT/rowbytes_per_pixel))
|
||||
{
|
||||
png_warning(png_ptr,
|
||||
"Width too large for libpng to process image data.");
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if defined(PNG_READ_oFFs_SUPPORTED)
|
||||
png_uint_32 PNGAPI
|
||||
png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
|
||||
png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)
|
||||
&& offset_x != NULL && offset_y != NULL && unit_type != NULL)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "oFFs");
|
||||
*offset_x = info_ptr->x_offset;
|
||||
*offset_y = info_ptr->y_offset;
|
||||
*unit_type = (int)info_ptr->offset_unit_type;
|
||||
return (PNG_INFO_oFFs);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_pCAL_SUPPORTED)
|
||||
png_uint_32 PNGAPI
|
||||
png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
|
||||
png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
|
||||
png_charp *units, png_charpp *params)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL)
|
||||
&& purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
|
||||
nparams != NULL && units != NULL && params != NULL)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "pCAL");
|
||||
*purpose = info_ptr->pcal_purpose;
|
||||
*X0 = info_ptr->pcal_X0;
|
||||
*X1 = info_ptr->pcal_X1;
|
||||
*type = (int)info_ptr->pcal_type;
|
||||
*nparams = (int)info_ptr->pcal_nparams;
|
||||
*units = info_ptr->pcal_units;
|
||||
*params = info_ptr->pcal_params;
|
||||
return (PNG_INFO_pCAL);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_sCAL_SUPPORTED) || defined(PNG_WRITE_sCAL_SUPPORTED)
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
png_uint_32 PNGAPI
|
||||
png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
|
||||
int *unit, double *width, double *height)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_sCAL))
|
||||
{
|
||||
*unit = info_ptr->scal_unit;
|
||||
*width = info_ptr->scal_pixel_width;
|
||||
*height = info_ptr->scal_pixel_height;
|
||||
return (PNG_INFO_sCAL);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
#else
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
png_uint_32 PNGAPI
|
||||
png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
|
||||
int *unit, png_charpp width, png_charpp height)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_sCAL))
|
||||
{
|
||||
*unit = info_ptr->scal_unit;
|
||||
*width = info_ptr->scal_s_width;
|
||||
*height = info_ptr->scal_s_height;
|
||||
return (PNG_INFO_sCAL);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_pHYs_SUPPORTED)
|
||||
png_uint_32 PNGAPI
|
||||
png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
|
||||
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
|
||||
{
|
||||
png_uint_32 retval = 0;
|
||||
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_pHYs))
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "pHYs");
|
||||
if (res_x != NULL)
|
||||
{
|
||||
*res_x = info_ptr->x_pixels_per_unit;
|
||||
retval |= PNG_INFO_pHYs;
|
||||
}
|
||||
if (res_y != NULL)
|
||||
{
|
||||
*res_y = info_ptr->y_pixels_per_unit;
|
||||
retval |= PNG_INFO_pHYs;
|
||||
}
|
||||
if (unit_type != NULL)
|
||||
{
|
||||
*unit_type = (int)info_ptr->phys_unit_type;
|
||||
retval |= PNG_INFO_pHYs;
|
||||
}
|
||||
}
|
||||
return (retval);
|
||||
}
|
||||
#endif
|
||||
|
||||
png_uint_32 PNGAPI
|
||||
png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
|
||||
int *num_palette)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE)
|
||||
&& palette != NULL)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "PLTE");
|
||||
*palette = info_ptr->palette;
|
||||
*num_palette = info_ptr->num_palette;
|
||||
png_debug1(3, "num_palette = %d\n", *num_palette);
|
||||
return (PNG_INFO_PLTE);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if defined(PNG_READ_sBIT_SUPPORTED)
|
||||
png_uint_32 PNGAPI
|
||||
png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)
|
||||
&& sig_bit != NULL)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "sBIT");
|
||||
*sig_bit = &(info_ptr->sig_bit);
|
||||
return (PNG_INFO_sBIT);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_TEXT_SUPPORTED)
|
||||
png_uint_32 PNGAPI
|
||||
png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
|
||||
int *num_text)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n",
|
||||
(png_ptr->chunk_name[0] == '\0' ? "text"
|
||||
: (png_const_charp)png_ptr->chunk_name));
|
||||
if (text_ptr != NULL)
|
||||
*text_ptr = info_ptr->text;
|
||||
if (num_text != NULL)
|
||||
*num_text = info_ptr->num_text;
|
||||
return ((png_uint_32)info_ptr->num_text);
|
||||
}
|
||||
if (num_text != NULL)
|
||||
*num_text = 0;
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_tIME_SUPPORTED)
|
||||
png_uint_32 PNGAPI
|
||||
png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)
|
||||
&& mod_time != NULL)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "tIME");
|
||||
*mod_time = &(info_ptr->mod_time);
|
||||
return (PNG_INFO_tIME);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_tRNS_SUPPORTED)
|
||||
png_uint_32 PNGAPI
|
||||
png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
|
||||
png_bytep *trans, int *num_trans, png_color_16p *trans_values)
|
||||
{
|
||||
png_uint_32 retval = 0;
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "tRNS");
|
||||
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
{
|
||||
if (trans != NULL)
|
||||
{
|
||||
*trans = info_ptr->trans;
|
||||
retval |= PNG_INFO_tRNS;
|
||||
}
|
||||
if (trans_values != NULL)
|
||||
*trans_values = &(info_ptr->trans_values);
|
||||
}
|
||||
else /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */
|
||||
{
|
||||
if (trans_values != NULL)
|
||||
{
|
||||
*trans_values = &(info_ptr->trans_values);
|
||||
retval |= PNG_INFO_tRNS;
|
||||
}
|
||||
if(trans != NULL)
|
||||
*trans = NULL;
|
||||
}
|
||||
if(num_trans != NULL)
|
||||
{
|
||||
*num_trans = info_ptr->num_trans;
|
||||
retval |= PNG_INFO_tRNS;
|
||||
}
|
||||
}
|
||||
return (retval);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
png_uint_32 PNGAPI
|
||||
png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
|
||||
png_unknown_chunkpp unknowns)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL)
|
||||
*unknowns = info_ptr->unknown_chunks;
|
||||
return ((png_uint_32)info_ptr->unknown_chunks_num);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
||||
png_byte PNGAPI
|
||||
png_get_rgb_to_gray_status (png_structp png_ptr)
|
||||
{
|
||||
return (png_byte)(png_ptr? png_ptr->rgb_to_gray_status : 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||
png_voidp PNGAPI
|
||||
png_get_user_chunk_ptr(png_structp png_ptr)
|
||||
{
|
||||
return (png_ptr? png_ptr->user_chunk_ptr : NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
png_uint_32 PNGAPI
|
||||
png_get_compression_buffer_size(png_structp png_ptr)
|
||||
{
|
||||
return (png_uint_32)(png_ptr? png_ptr->zbuf_size : 0L);
|
||||
}
|
||||
|
||||
@@ -1,503 +0,0 @@
|
||||
|
||||
/* pngmem.c - stub functions for memory allocation
|
||||
*
|
||||
* libpng 1.0.9 - January 31, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
* This file provides a location for all memory allocation. Users who
|
||||
* need special memory handling are expected to supply replacement
|
||||
* functions for png_malloc() and png_free(), and to use
|
||||
* png_create_read_struct_2() and png_create_write_struct_2() to
|
||||
* identify the replacement functions.
|
||||
*/
|
||||
|
||||
#define PNG_INTERNAL
|
||||
#include "png.h"
|
||||
|
||||
/* Borland DOS special memory handler */
|
||||
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
|
||||
/* if you change this, be sure to change the one in png.h also */
|
||||
|
||||
/* Allocate memory for a png_struct. The malloc and memset can be replaced
|
||||
by a single call to calloc() if this is thought to improve performance. */
|
||||
png_voidp /* PRIVATE */
|
||||
png_create_struct(int type)
|
||||
{
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
return (png_create_struct_2(type, NULL));
|
||||
}
|
||||
|
||||
/* Alternate version of png_create_struct, for use with user-defined malloc. */
|
||||
png_voidp /* PRIVATE */
|
||||
png_create_struct_2(int type, png_malloc_ptr malloc_fn)
|
||||
{
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
png_size_t size;
|
||||
png_voidp struct_ptr;
|
||||
|
||||
if (type == PNG_STRUCT_INFO)
|
||||
size = sizeof(png_info);
|
||||
else if (type == PNG_STRUCT_PNG)
|
||||
size = sizeof(png_struct);
|
||||
else
|
||||
return ((png_voidp)NULL);
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
if(malloc_fn != NULL)
|
||||
{
|
||||
if ((struct_ptr = (*(malloc_fn))(NULL, size)) != NULL)
|
||||
png_memset(struct_ptr, 0, size);
|
||||
return (struct_ptr);
|
||||
}
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
if ((struct_ptr = (png_voidp)farmalloc(size)) != NULL)
|
||||
{
|
||||
png_memset(struct_ptr, 0, size);
|
||||
}
|
||||
return (struct_ptr);
|
||||
}
|
||||
|
||||
|
||||
/* Free memory allocated by a png_create_struct() call */
|
||||
void /* PRIVATE */
|
||||
png_destroy_struct(png_voidp struct_ptr)
|
||||
{
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
png_destroy_struct_2(struct_ptr, (png_free_ptr)NULL);
|
||||
}
|
||||
|
||||
/* Free memory allocated by a png_create_struct() call */
|
||||
void /* PRIVATE */
|
||||
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn)
|
||||
{
|
||||
#endif
|
||||
if (struct_ptr != NULL)
|
||||
{
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
if(free_fn != NULL)
|
||||
{
|
||||
png_struct dummy_struct;
|
||||
png_structp png_ptr = &dummy_struct;
|
||||
(*(free_fn))(png_ptr, struct_ptr);
|
||||
return;
|
||||
}
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
farfree (struct_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate memory. For reasonable files, size should never exceed
|
||||
* 64K. However, zlib may allocate more then 64K if you don't tell
|
||||
* it not to. See zconf.h and png.h for more information. zlib does
|
||||
* need to allocate exactly 64K, so whatever you call here must
|
||||
* have the ability to do that.
|
||||
*
|
||||
* Borland seems to have a problem in DOS mode for exactly 64K.
|
||||
* It gives you a segment with an offset of 8 (perhaps to store its
|
||||
* memory stuff). zlib doesn't like this at all, so we have to
|
||||
* detect and deal with it. This code should not be needed in
|
||||
* Windows or OS/2 modes, and only in 16 bit mode. This code has
|
||||
* been updated by Alexander Lehmann for version 0.89 to waste less
|
||||
* memory.
|
||||
*
|
||||
* Note that we can't use png_size_t for the "size" declaration,
|
||||
* since on some systems a png_size_t is a 16-bit quantity, and as a
|
||||
* result, we would be truncating potentially larger memory requests
|
||||
* (which should cause a fatal error) and introducing major problems.
|
||||
*/
|
||||
png_voidp PNGAPI
|
||||
png_malloc(png_structp png_ptr, png_uint_32 size)
|
||||
{
|
||||
#ifndef PNG_USER_MEM_SUPPORTED
|
||||
png_voidp ret;
|
||||
#endif
|
||||
if (png_ptr == NULL || size == 0)
|
||||
return ((png_voidp)NULL);
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
if(png_ptr->malloc_fn != NULL)
|
||||
return ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, size));
|
||||
else
|
||||
return png_malloc_default(png_ptr, size);
|
||||
}
|
||||
|
||||
png_voidp PNGAPI
|
||||
png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
||||
{
|
||||
png_voidp ret;
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
if (size > (png_uint_32)65536L)
|
||||
png_error(png_ptr, "Cannot Allocate > 64K");
|
||||
#endif
|
||||
|
||||
if (size == (png_uint_32)65536L)
|
||||
{
|
||||
if (png_ptr->offset_table == NULL)
|
||||
{
|
||||
/* try to see if we need to do any of this fancy stuff */
|
||||
ret = farmalloc(size);
|
||||
if (ret == NULL || ((png_size_t)ret & 0xffff))
|
||||
{
|
||||
int num_blocks;
|
||||
png_uint_32 total_size;
|
||||
png_bytep table;
|
||||
int i;
|
||||
png_byte huge * hptr;
|
||||
|
||||
if (ret != NULL)
|
||||
{
|
||||
farfree(ret);
|
||||
ret = NULL;
|
||||
}
|
||||
|
||||
if(png_ptr->zlib_window_bits > 14)
|
||||
num_blocks = (int)(1 << (png_ptr->zlib_window_bits - 14));
|
||||
else
|
||||
num_blocks = 1;
|
||||
if (png_ptr->zlib_mem_level >= 7)
|
||||
num_blocks += (int)(1 << (png_ptr->zlib_mem_level - 7));
|
||||
else
|
||||
num_blocks++;
|
||||
|
||||
total_size = ((png_uint_32)65536L) * (png_uint_32)num_blocks+16;
|
||||
|
||||
table = farmalloc(total_size);
|
||||
|
||||
if (table == NULL)
|
||||
{
|
||||
png_error(png_ptr, "Out Of Memory."); /* Note "O" and "M" */
|
||||
}
|
||||
|
||||
if ((png_size_t)table & 0xfff0)
|
||||
{
|
||||
png_error(png_ptr, "Farmalloc didn't return normalized pointer");
|
||||
}
|
||||
|
||||
png_ptr->offset_table = table;
|
||||
png_ptr->offset_table_ptr = farmalloc(num_blocks *
|
||||
sizeof (png_bytep));
|
||||
|
||||
if (png_ptr->offset_table_ptr == NULL)
|
||||
{
|
||||
png_error(png_ptr, "Out Of memory.");
|
||||
}
|
||||
|
||||
hptr = (png_byte huge *)table;
|
||||
if ((png_size_t)hptr & 0xf)
|
||||
{
|
||||
hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
|
||||
hptr = hptr + 16L; /* "hptr += 16L" fails on Turbo C++ 3.0 */
|
||||
}
|
||||
for (i = 0; i < num_blocks; i++)
|
||||
{
|
||||
png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
|
||||
hptr = hptr + (png_uint_32)65536L; /* "+=" fails on TC++3.0 */
|
||||
}
|
||||
|
||||
png_ptr->offset_table_number = num_blocks;
|
||||
png_ptr->offset_table_count = 0;
|
||||
png_ptr->offset_table_count_free = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (png_ptr->offset_table_count >= png_ptr->offset_table_number)
|
||||
png_error(png_ptr, "Out of Memory.");
|
||||
|
||||
ret = png_ptr->offset_table_ptr[png_ptr->offset_table_count++];
|
||||
}
|
||||
else
|
||||
ret = farmalloc(size);
|
||||
|
||||
if (ret == NULL)
|
||||
{
|
||||
png_error(png_ptr, "Out of memory."); /* Note "o" and "m" */
|
||||
}
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/* free a pointer allocated by png_malloc(). In the default
|
||||
configuration, png_ptr is not used, but is passed in case it
|
||||
is needed. If ptr is NULL, return without taking any action. */
|
||||
void PNGAPI
|
||||
png_free(png_structp png_ptr, png_voidp ptr)
|
||||
{
|
||||
if (png_ptr == NULL || ptr == NULL)
|
||||
return;
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
if (png_ptr->free_fn != NULL)
|
||||
{
|
||||
(*(png_ptr->free_fn))(png_ptr, ptr);
|
||||
return;
|
||||
}
|
||||
else png_free_default(png_ptr, ptr);
|
||||
}
|
||||
|
||||
void PNGAPI
|
||||
png_free_default(png_structp png_ptr, png_voidp ptr)
|
||||
{
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
|
||||
if (png_ptr->offset_table != NULL)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < png_ptr->offset_table_count; i++)
|
||||
{
|
||||
if (ptr == png_ptr->offset_table_ptr[i])
|
||||
{
|
||||
ptr = NULL;
|
||||
png_ptr->offset_table_count_free++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (png_ptr->offset_table_count_free == png_ptr->offset_table_count)
|
||||
{
|
||||
farfree(png_ptr->offset_table);
|
||||
farfree(png_ptr->offset_table_ptr);
|
||||
png_ptr->offset_table = NULL;
|
||||
png_ptr->offset_table_ptr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr != NULL)
|
||||
{
|
||||
farfree(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
#else /* Not the Borland DOS special memory handler */
|
||||
|
||||
/* Allocate memory for a png_struct or a png_info. The malloc and
|
||||
memset can be replaced by a single call to calloc() if this is thought
|
||||
to improve performance noticably.*/
|
||||
png_voidp /* PRIVATE */
|
||||
png_create_struct(int type)
|
||||
{
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
return (png_create_struct_2(type, NULL));
|
||||
}
|
||||
|
||||
/* Allocate memory for a png_struct or a png_info. The malloc and
|
||||
memset can be replaced by a single call to calloc() if this is thought
|
||||
to improve performance noticably.*/
|
||||
png_voidp /* PRIVATE */
|
||||
png_create_struct_2(int type, png_malloc_ptr malloc_fn)
|
||||
{
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
png_size_t size;
|
||||
png_voidp struct_ptr;
|
||||
|
||||
if (type == PNG_STRUCT_INFO)
|
||||
size = sizeof(png_info);
|
||||
else if (type == PNG_STRUCT_PNG)
|
||||
size = sizeof(png_struct);
|
||||
else
|
||||
return ((png_voidp)NULL);
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
if(malloc_fn != NULL)
|
||||
{
|
||||
if ((struct_ptr = (*(malloc_fn))(NULL, size)) != NULL)
|
||||
png_memset(struct_ptr, 0, size);
|
||||
return (struct_ptr);
|
||||
}
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
|
||||
#if defined(__TURBOC__) && !defined(__FLAT__)
|
||||
if ((struct_ptr = (png_voidp)farmalloc(size)) != NULL)
|
||||
#else
|
||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
||||
if ((struct_ptr = (png_voidp)halloc(size,1)) != NULL)
|
||||
# else
|
||||
if ((struct_ptr = (png_voidp)malloc(size)) != NULL)
|
||||
# endif
|
||||
#endif
|
||||
{
|
||||
png_memset(struct_ptr, 0, size);
|
||||
}
|
||||
|
||||
return (struct_ptr);
|
||||
}
|
||||
|
||||
|
||||
/* Free memory allocated by a png_create_struct() call */
|
||||
void /* PRIVATE */
|
||||
png_destroy_struct(png_voidp struct_ptr)
|
||||
{
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
png_destroy_struct_2(struct_ptr, (png_free_ptr)NULL);
|
||||
}
|
||||
|
||||
/* Free memory allocated by a png_create_struct() call */
|
||||
void /* PRIVATE */
|
||||
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn)
|
||||
{
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
if (struct_ptr != NULL)
|
||||
{
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
if(free_fn != NULL)
|
||||
{
|
||||
png_struct dummy_struct;
|
||||
png_structp png_ptr = &dummy_struct;
|
||||
(*(free_fn))(png_ptr, struct_ptr);
|
||||
return;
|
||||
}
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
#if defined(__TURBOC__) && !defined(__FLAT__)
|
||||
farfree(struct_ptr);
|
||||
#else
|
||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
||||
hfree(struct_ptr);
|
||||
# else
|
||||
free(struct_ptr);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Allocate memory. For reasonable files, size should never exceed
|
||||
64K. However, zlib may allocate more then 64K if you don't tell
|
||||
it not to. See zconf.h and png.h for more information. zlib does
|
||||
need to allocate exactly 64K, so whatever you call here must
|
||||
have the ability to do that. */
|
||||
|
||||
png_voidp PNGAPI
|
||||
png_malloc(png_structp png_ptr, png_uint_32 size)
|
||||
{
|
||||
#ifndef PNG_USER_MEM_SUPPORTED
|
||||
png_voidp ret;
|
||||
#endif
|
||||
if (png_ptr == NULL || size == 0)
|
||||
return ((png_voidp)NULL);
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
if(png_ptr->malloc_fn != NULL)
|
||||
return ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, size));
|
||||
else
|
||||
return (png_malloc_default(png_ptr, size));
|
||||
}
|
||||
png_voidp /* PRIVATE */
|
||||
png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
||||
{
|
||||
png_voidp ret;
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
if (size > (png_uint_32)65536L)
|
||||
png_error(png_ptr, "Cannot Allocate > 64K");
|
||||
#endif
|
||||
|
||||
#if defined(__TURBOC__) && !defined(__FLAT__)
|
||||
ret = farmalloc(size);
|
||||
#else
|
||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
||||
ret = halloc(size, 1);
|
||||
# else
|
||||
ret = malloc((size_t)size);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
if (ret == NULL)
|
||||
{
|
||||
png_error(png_ptr, "Out of Memory");
|
||||
}
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/* Free a pointer allocated by png_malloc(). If ptr is NULL, return
|
||||
without taking any action. */
|
||||
void PNGAPI
|
||||
png_free(png_structp png_ptr, png_voidp ptr)
|
||||
{
|
||||
if (png_ptr == NULL || ptr == NULL)
|
||||
return;
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
if (png_ptr->free_fn != NULL)
|
||||
{
|
||||
(*(png_ptr->free_fn))(png_ptr, ptr);
|
||||
return;
|
||||
}
|
||||
else png_free_default(png_ptr, ptr);
|
||||
}
|
||||
void /* PRIVATE */
|
||||
png_free_default(png_structp png_ptr, png_voidp ptr)
|
||||
{
|
||||
if (png_ptr == NULL || ptr == NULL)
|
||||
return;
|
||||
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
|
||||
#if defined(__TURBOC__) && !defined(__FLAT__)
|
||||
farfree(ptr);
|
||||
#else
|
||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
||||
hfree(ptr);
|
||||
# else
|
||||
free(ptr);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* Not Borland DOS special memory handler */
|
||||
|
||||
png_voidp /* PRIVATE */
|
||||
png_memcpy_check (png_structp png_ptr, png_voidp s1, png_voidp s2,
|
||||
png_uint_32 length)
|
||||
{
|
||||
png_size_t size;
|
||||
|
||||
size = (png_size_t)length;
|
||||
if ((png_uint_32)size != length)
|
||||
png_error(png_ptr,"Overflow in png_memcpy_check.");
|
||||
|
||||
return(png_memcpy (s1, s2, size));
|
||||
}
|
||||
|
||||
png_voidp /* PRIVATE */
|
||||
png_memset_check (png_structp png_ptr, png_voidp s1, int value,
|
||||
png_uint_32 length)
|
||||
{
|
||||
png_size_t size;
|
||||
|
||||
size = (png_size_t)length;
|
||||
if ((png_uint_32)size != length)
|
||||
png_error(png_ptr,"Overflow in png_memset_check.");
|
||||
|
||||
return (png_memset (s1, value, size));
|
||||
|
||||
}
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
/* This function is called when the application wants to use another method
|
||||
* of allocating and freeing memory.
|
||||
*/
|
||||
void PNGAPI
|
||||
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
|
||||
malloc_fn, png_free_ptr free_fn)
|
||||
{
|
||||
png_ptr->mem_ptr = mem_ptr;
|
||||
png_ptr->malloc_fn = malloc_fn;
|
||||
png_ptr->free_fn = free_fn;
|
||||
}
|
||||
|
||||
/* This function returns a pointer to the mem_ptr associated with the user
|
||||
* functions. The application should free any memory associated with this
|
||||
* pointer before png_write_destroy and png_read_destroy are called.
|
||||
*/
|
||||
png_voidp PNGAPI
|
||||
png_get_mem_ptr(png_structp png_ptr)
|
||||
{
|
||||
return ((png_voidp)png_ptr->mem_ptr);
|
||||
}
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,162 +0,0 @@
|
||||
|
||||
/* pngrio.c - functions for data input
|
||||
*
|
||||
* libpng 1.0.9 - January 31, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
* This file provides a location for all input. Users who need
|
||||
* special handling are expected to write a function that has the same
|
||||
* arguments as this and performs a similar function, but that possibly
|
||||
* has a different input method. Note that you shouldn't change this
|
||||
* function, but rather write a replacement function and then make
|
||||
* libpng use it at run time with png_set_read_fn(...).
|
||||
*/
|
||||
|
||||
#define PNG_INTERNAL
|
||||
#include "png.h"
|
||||
|
||||
/* Read the data from whatever input you are using. The default routine
|
||||
reads from a file pointer. Note that this routine sometimes gets called
|
||||
with very small lengths, so you should implement some kind of simple
|
||||
buffering if you are using unbuffered reads. This should never be asked
|
||||
to read more then 64K on a 16 bit machine. */
|
||||
void /* PRIVATE */
|
||||
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
{
|
||||
png_debug1(4,"reading %d bytes\n", length);
|
||||
if (png_ptr->read_data_fn != NULL)
|
||||
(*(png_ptr->read_data_fn))(png_ptr, data, length);
|
||||
else
|
||||
png_error(png_ptr, "Call to NULL read function");
|
||||
}
|
||||
|
||||
#if !defined(PNG_NO_STDIO)
|
||||
/* This is the function that does the actual reading of data. If you are
|
||||
not reading from a standard C stream, you should create a replacement
|
||||
read_data function and use it at run time with png_set_read_fn(), rather
|
||||
than changing the library. */
|
||||
#ifndef USE_FAR_KEYWORD
|
||||
static void /* PRIVATE */
|
||||
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
{
|
||||
png_size_t check;
|
||||
|
||||
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
||||
* instead of an int, which is what fread() actually returns.
|
||||
*/
|
||||
#if defined(_WIN32_WCE)
|
||||
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
||||
check = 0;
|
||||
#else
|
||||
check = (png_size_t)fread(data, (png_size_t)1, length,
|
||||
(png_FILE_p)png_ptr->io_ptr);
|
||||
#endif
|
||||
|
||||
if (check != length)
|
||||
png_error(png_ptr, "Read Error");
|
||||
}
|
||||
#else
|
||||
/* this is the model-independent version. Since the standard I/O library
|
||||
can't handle far buffers in the medium and small models, we have to copy
|
||||
the data.
|
||||
*/
|
||||
|
||||
#define NEAR_BUF_SIZE 1024
|
||||
#define MIN(a,b) (a <= b ? a : b)
|
||||
|
||||
static void /* PRIVATE */
|
||||
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
{
|
||||
int check;
|
||||
png_byte *n_data;
|
||||
png_FILE_p io_ptr;
|
||||
|
||||
/* Check if data really is near. If so, use usual code. */
|
||||
n_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
||||
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
||||
if ((png_bytep)n_data == data)
|
||||
{
|
||||
#if defined(_WIN32_WCE)
|
||||
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
||||
check = 0;
|
||||
#else
|
||||
check = fread(n_data, 1, length, io_ptr);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
png_byte buf[NEAR_BUF_SIZE];
|
||||
png_size_t read, remaining, err;
|
||||
check = 0;
|
||||
remaining = length;
|
||||
do
|
||||
{
|
||||
read = MIN(NEAR_BUF_SIZE, remaining);
|
||||
#if defined(_WIN32_WCE)
|
||||
if ( !ReadFile((HANDLE)(io_ptr), buf, read, &err, NULL) )
|
||||
err = 0;
|
||||
#else
|
||||
err = fread(buf, (png_size_t)1, read, io_ptr);
|
||||
#endif
|
||||
png_memcpy(data, buf, read); /* copy far buffer to near buffer */
|
||||
if(err != read)
|
||||
break;
|
||||
else
|
||||
check += err;
|
||||
data += read;
|
||||
remaining -= read;
|
||||
}
|
||||
while (remaining != 0);
|
||||
}
|
||||
if ((png_uint_32)check != (png_uint_32)length)
|
||||
png_error(png_ptr, "read Error");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* This function allows the application to supply a new input function
|
||||
for libpng if standard C streams aren't being used.
|
||||
|
||||
This function takes as its arguments:
|
||||
png_ptr - pointer to a png input data structure
|
||||
io_ptr - pointer to user supplied structure containing info about
|
||||
the input functions. May be NULL.
|
||||
read_data_fn - pointer to a new input function that takes as its
|
||||
arguments a pointer to a png_struct, a pointer to
|
||||
a location where input data can be stored, and a 32-bit
|
||||
unsigned int that is the number of bytes to be read.
|
||||
To exit and output any fatal error messages the new write
|
||||
function should call png_error(png_ptr, "Error msg"). */
|
||||
void PNGAPI
|
||||
png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
||||
png_rw_ptr read_data_fn)
|
||||
{
|
||||
png_ptr->io_ptr = io_ptr;
|
||||
|
||||
#if !defined(PNG_NO_STDIO)
|
||||
if (read_data_fn != NULL)
|
||||
png_ptr->read_data_fn = read_data_fn;
|
||||
else
|
||||
png_ptr->read_data_fn = png_default_read_data;
|
||||
#else
|
||||
png_ptr->read_data_fn = read_data_fn;
|
||||
#endif
|
||||
|
||||
/* It is an error to write to a read device */
|
||||
if (png_ptr->write_data_fn != NULL)
|
||||
{
|
||||
png_ptr->write_data_fn = NULL;
|
||||
png_warning(png_ptr,
|
||||
"It's an error to set both read_data_fn and write_data_fn in the ");
|
||||
png_warning(png_ptr,
|
||||
"same structure. Resetting write_data_fn to NULL.");
|
||||
}
|
||||
|
||||
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
||||
png_ptr->output_flush_fn = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,909 +0,0 @@
|
||||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* libpng 1.0.9 - January 31, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
* The functions here are used during reads to store data from the file
|
||||
* into the info struct, and during writes to store application data
|
||||
* into the info struct for writing into the file. This abstracts the
|
||||
* info struct and allows us to change the structure in the future.
|
||||
*/
|
||||
|
||||
#define PNG_INTERNAL
|
||||
#include "png.h"
|
||||
|
||||
#if defined(PNG_bKGD_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "bKGD");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
png_memcpy(&(info_ptr->background), background, sizeof(png_color_16));
|
||||
info_ptr->valid |= PNG_INFO_bKGD;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_cHRM_SUPPORTED)
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
void PNGAPI
|
||||
png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
|
||||
double white_x, double white_y, double red_x, double red_y,
|
||||
double green_x, double green_y, double blue_x, double blue_y)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "cHRM");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
info_ptr->x_white = (float)white_x;
|
||||
info_ptr->y_white = (float)white_y;
|
||||
info_ptr->x_red = (float)red_x;
|
||||
info_ptr->y_red = (float)red_y;
|
||||
info_ptr->x_green = (float)green_x;
|
||||
info_ptr->y_green = (float)green_y;
|
||||
info_ptr->x_blue = (float)blue_x;
|
||||
info_ptr->y_blue = (float)blue_y;
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
info_ptr->int_x_white = (png_fixed_point)(white_x*100000.+0.5);
|
||||
info_ptr->int_y_white = (png_fixed_point)(white_y*100000.+0.5);
|
||||
info_ptr->int_x_red = (png_fixed_point)(red_x*100000.+0.5);
|
||||
info_ptr->int_y_red = (png_fixed_point)(red_y*100000.+0.5);
|
||||
info_ptr->int_x_green = (png_fixed_point)(green_x*100000.+0.5);
|
||||
info_ptr->int_y_green = (png_fixed_point)(green_y*100000.+0.5);
|
||||
info_ptr->int_x_blue = (png_fixed_point)(blue_x*100000.+0.5);
|
||||
info_ptr->int_y_blue = (png_fixed_point)(blue_y*100000.+0.5);
|
||||
#endif
|
||||
info_ptr->valid |= PNG_INFO_cHRM;
|
||||
}
|
||||
#endif
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
void PNGAPI
|
||||
png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
|
||||
png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x,
|
||||
png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
|
||||
png_fixed_point blue_x, png_fixed_point blue_y)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "cHRM");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
info_ptr->int_x_white = white_x;
|
||||
info_ptr->int_y_white = white_y;
|
||||
info_ptr->int_x_red = red_x;
|
||||
info_ptr->int_y_red = red_y;
|
||||
info_ptr->int_x_green = green_x;
|
||||
info_ptr->int_y_green = green_y;
|
||||
info_ptr->int_x_blue = blue_x;
|
||||
info_ptr->int_y_blue = blue_y;
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
info_ptr->x_white = (float)(white_x/100000.);
|
||||
info_ptr->y_white = (float)(white_y/100000.);
|
||||
info_ptr->x_red = (float)(red_x/100000.);
|
||||
info_ptr->y_red = (float)(red_y/100000.);
|
||||
info_ptr->x_green = (float)(green_x/100000.);
|
||||
info_ptr->y_green = (float)(green_y/100000.);
|
||||
info_ptr->x_blue = (float)(blue_x/100000.);
|
||||
info_ptr->y_blue = (float)(blue_y/100000.);
|
||||
#endif
|
||||
info_ptr->valid |= PNG_INFO_cHRM;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PNG_gAMA_SUPPORTED)
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
void PNGAPI
|
||||
png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "gAMA");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
info_ptr->gamma = (float)file_gamma;
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
info_ptr->int_gamma = (int)(file_gamma*100000.+.5);
|
||||
#endif
|
||||
info_ptr->valid |= PNG_INFO_gAMA;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
void PNGAPI
|
||||
png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
|
||||
int_gamma)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "gAMA");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
info_ptr->gamma = (float)(int_gamma/100000.);
|
||||
#endif
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
info_ptr->int_gamma = int_gamma;
|
||||
#endif
|
||||
info_ptr->valid |= PNG_INFO_gAMA;
|
||||
}
|
||||
|
||||
#if defined(PNG_hIST_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
|
||||
{
|
||||
int i;
|
||||
|
||||
png_debug1(1, "in %s storage function\n", "hIST");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
if (info_ptr->num_palette == 0)
|
||||
png_warning(png_ptr,
|
||||
"Palette size 0, hIST allocation skipped.");
|
||||
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0);
|
||||
#endif
|
||||
png_ptr->hist = (png_uint_16p)png_malloc(png_ptr,
|
||||
(png_uint_32)(info_ptr->num_palette * sizeof (png_uint_16)));
|
||||
|
||||
for (i = 0; i < info_ptr->num_palette; i++)
|
||||
png_ptr->hist[i] = hist[i];
|
||||
info_ptr->hist = png_ptr->hist;
|
||||
info_ptr->valid |= PNG_INFO_hIST;
|
||||
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
info_ptr->free_me |= PNG_FREE_HIST;
|
||||
#else
|
||||
png_ptr->flags |= PNG_FLAG_FREE_HIST;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void PNGAPI
|
||||
png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
|
||||
png_uint_32 width, png_uint_32 height, int bit_depth,
|
||||
int color_type, int interlace_type, int compression_type,
|
||||
int filter_type)
|
||||
{
|
||||
int rowbytes_per_pixel;
|
||||
png_debug1(1, "in %s storage function\n", "IHDR");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
info_ptr->width = width;
|
||||
info_ptr->height = height;
|
||||
info_ptr->bit_depth = (png_byte)bit_depth;
|
||||
info_ptr->color_type =(png_byte) color_type;
|
||||
info_ptr->compression_type = (png_byte)compression_type;
|
||||
info_ptr->filter_type = (png_byte)filter_type;
|
||||
info_ptr->interlace_type = (png_byte)interlace_type;
|
||||
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
info_ptr->channels = 1;
|
||||
else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
|
||||
info_ptr->channels = 3;
|
||||
else
|
||||
info_ptr->channels = 1;
|
||||
if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
|
||||
info_ptr->channels++;
|
||||
info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
|
||||
|
||||
/* check for overflow */
|
||||
rowbytes_per_pixel = (info_ptr->pixel_depth + 7) >> 3;
|
||||
if (( width > PNG_MAX_UINT/rowbytes_per_pixel))
|
||||
{
|
||||
png_warning(png_ptr,
|
||||
"Width too large to process image data; rowbytes will overflow.");
|
||||
info_ptr->rowbytes = (png_size_t)0;
|
||||
}
|
||||
else
|
||||
info_ptr->rowbytes = (info_ptr->width * info_ptr->pixel_depth + 7) >> 3;
|
||||
}
|
||||
|
||||
#if defined(PNG_oFFs_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_oFFs(png_structp png_ptr, png_infop info_ptr,
|
||||
png_int_32 offset_x, png_int_32 offset_y, int unit_type)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "oFFs");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
info_ptr->x_offset = offset_x;
|
||||
info_ptr->y_offset = offset_y;
|
||||
info_ptr->offset_unit_type = (png_byte)unit_type;
|
||||
info_ptr->valid |= PNG_INFO_oFFs;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_pCAL_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
|
||||
png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams,
|
||||
png_charp units, png_charpp params)
|
||||
{
|
||||
png_uint_32 length;
|
||||
int i;
|
||||
|
||||
png_debug1(1, "in %s storage function\n", "pCAL");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
length = png_strlen(purpose) + 1;
|
||||
png_debug1(3, "allocating purpose for info (%lu bytes)\n", length);
|
||||
info_ptr->pcal_purpose = (png_charp)png_malloc(png_ptr, length);
|
||||
png_memcpy(info_ptr->pcal_purpose, purpose, (png_size_t)length);
|
||||
|
||||
png_debug(3, "storing X0, X1, type, and nparams in info\n");
|
||||
info_ptr->pcal_X0 = X0;
|
||||
info_ptr->pcal_X1 = X1;
|
||||
info_ptr->pcal_type = (png_byte)type;
|
||||
info_ptr->pcal_nparams = (png_byte)nparams;
|
||||
|
||||
length = png_strlen(units) + 1;
|
||||
png_debug1(3, "allocating units for info (%lu bytes)\n", length);
|
||||
info_ptr->pcal_units = (png_charp)png_malloc(png_ptr, length);
|
||||
png_memcpy(info_ptr->pcal_units, units, (png_size_t)length);
|
||||
|
||||
info_ptr->pcal_params = (png_charpp)png_malloc(png_ptr,
|
||||
(png_uint_32)((nparams + 1) * sizeof(png_charp)));
|
||||
info_ptr->pcal_params[nparams] = NULL;
|
||||
|
||||
for (i = 0; i < nparams; i++)
|
||||
{
|
||||
length = png_strlen(params[i]) + 1;
|
||||
png_debug2(3, "allocating parameter %d for info (%lu bytes)\n", i, length);
|
||||
info_ptr->pcal_params[i] = (png_charp)png_malloc(png_ptr, length);
|
||||
png_memcpy(info_ptr->pcal_params[i], params[i], (png_size_t)length);
|
||||
}
|
||||
|
||||
info_ptr->valid |= PNG_INFO_pCAL;
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
info_ptr->free_me |= PNG_FREE_PCAL;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_sCAL_SUPPORTED) || defined(PNG_WRITE_sCAL_SUPPORTED)
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
void PNGAPI
|
||||
png_set_sCAL(png_structp png_ptr, png_infop info_ptr,
|
||||
int unit, double width, double height)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "sCAL");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
info_ptr->scal_unit = (png_byte)unit;
|
||||
info_ptr->scal_pixel_width = width;
|
||||
info_ptr->scal_pixel_height = height;
|
||||
|
||||
info_ptr->valid |= PNG_INFO_sCAL;
|
||||
}
|
||||
#else
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
void PNGAPI
|
||||
png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
|
||||
int unit, png_charp swidth, png_charp sheight)
|
||||
{
|
||||
png_uint_32 length;
|
||||
|
||||
png_debug1(1, "in %s storage function\n", "sCAL");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
info_ptr->scal_unit = (png_byte)unit;
|
||||
|
||||
length = png_strlen(swidth) + 1;
|
||||
png_debug1(3, "allocating unit for info (%d bytes)\n", length);
|
||||
info_ptr->scal_s_width = (png_charp)png_malloc(png_ptr, length);
|
||||
png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length);
|
||||
|
||||
length = png_strlen(sheight) + 1;
|
||||
png_debug1(3, "allocating unit for info (%d bytes)\n", length);
|
||||
info_ptr->scal_s_width = (png_charp)png_malloc(png_ptr, length);
|
||||
png_memcpy(info_ptr->scal_s_height, sheight, (png_size_t)length);
|
||||
|
||||
info_ptr->valid |= PNG_INFO_sCAL;
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
info_ptr->free_me |= PNG_FREE_SCAL;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PNG_pHYs_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_pHYs(png_structp png_ptr, png_infop info_ptr,
|
||||
png_uint_32 res_x, png_uint_32 res_y, int unit_type)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "pHYs");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
info_ptr->x_pixels_per_unit = res_x;
|
||||
info_ptr->y_pixels_per_unit = res_y;
|
||||
info_ptr->phys_unit_type = (png_byte)unit_type;
|
||||
info_ptr->valid |= PNG_INFO_pHYs;
|
||||
}
|
||||
#endif
|
||||
|
||||
void PNGAPI
|
||||
png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
|
||||
png_colorp palette, int num_palette)
|
||||
{
|
||||
|
||||
png_debug1(1, "in %s storage function\n", "PLTE");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
/*
|
||||
* It may not actually be necessary to set png_ptr->palette here;
|
||||
* we do it for backward compatibility with the way the png_handle_tRNS
|
||||
* function used to do the allocation.
|
||||
*/
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
|
||||
#endif
|
||||
png_ptr->palette = (png_colorp)png_zalloc(png_ptr, (uInt)num_palette,
|
||||
sizeof (png_color));
|
||||
memcpy(png_ptr->palette, palette, num_palette * sizeof (png_color));
|
||||
info_ptr->palette = png_ptr->palette;
|
||||
info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
|
||||
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
info_ptr->free_me |= PNG_FREE_PLTE;
|
||||
#else
|
||||
png_ptr->flags |= PNG_FLAG_FREE_PLTE;
|
||||
#endif
|
||||
|
||||
info_ptr->valid |= PNG_INFO_PLTE;
|
||||
}
|
||||
|
||||
#if defined(PNG_sBIT_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
|
||||
png_color_8p sig_bit)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "sBIT");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
png_memcpy(&(info_ptr->sig_bit), sig_bit, sizeof (png_color_8));
|
||||
info_ptr->valid |= PNG_INFO_sBIT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_sRGB_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "sRGB");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
info_ptr->srgb_intent = (png_byte)intent;
|
||||
info_ptr->valid |= PNG_INFO_sRGB;
|
||||
}
|
||||
|
||||
void PNGAPI
|
||||
png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
|
||||
int intent)
|
||||
{
|
||||
#if defined(PNG_gAMA_SUPPORTED)
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
float file_gamma;
|
||||
#endif
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
png_fixed_point int_file_gamma;
|
||||
#endif
|
||||
#endif
|
||||
#if defined(PNG_cHRM_SUPPORTED)
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y;
|
||||
#endif
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
|
||||
int_green_y, int_blue_x, int_blue_y;
|
||||
#endif
|
||||
#endif
|
||||
png_debug1(1, "in %s storage function\n", "sRGB_gAMA_and_cHRM");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
png_set_sRGB(png_ptr, info_ptr, intent);
|
||||
|
||||
#if defined(PNG_gAMA_SUPPORTED)
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
file_gamma = (float).45455;
|
||||
png_set_gAMA(png_ptr, info_ptr, file_gamma);
|
||||
#endif
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
int_file_gamma = 45455L;
|
||||
png_set_gAMA_fixed(png_ptr, info_ptr, int_file_gamma);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PNG_cHRM_SUPPORTED)
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
int_white_x = 31270L;
|
||||
int_white_y = 32900L;
|
||||
int_red_x = 64000L;
|
||||
int_red_y = 33000L;
|
||||
int_green_x = 30000L;
|
||||
int_green_y = 60000L;
|
||||
int_blue_x = 15000L;
|
||||
int_blue_y = 6000L;
|
||||
|
||||
png_set_cHRM_fixed(png_ptr, info_ptr,
|
||||
int_white_x, int_white_y, int_red_x, int_red_y, int_green_x, int_green_y,
|
||||
int_blue_x, int_blue_y);
|
||||
#endif
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
white_x = (float).3127;
|
||||
white_y = (float).3290;
|
||||
red_x = (float).64;
|
||||
red_y = (float).33;
|
||||
green_x = (float).30;
|
||||
green_y = (float).60;
|
||||
blue_x = (float).15;
|
||||
blue_y = (float).06;
|
||||
|
||||
png_set_cHRM(png_ptr, info_ptr,
|
||||
white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(PNG_iCCP_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
|
||||
png_charp name, int compression_type,
|
||||
png_charp profile, png_uint_32 proflen)
|
||||
{
|
||||
png_charp new_iccp_name;
|
||||
png_charp new_iccp_profile;
|
||||
|
||||
png_debug1(1, "in %s storage function\n", "iCCP");
|
||||
if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL)
|
||||
return;
|
||||
|
||||
new_iccp_name = png_malloc(png_ptr, png_strlen(name)+1);
|
||||
strcpy(new_iccp_name, name);
|
||||
new_iccp_profile = png_malloc(png_ptr, proflen);
|
||||
png_memcpy(new_iccp_profile, profile, (png_size_t)proflen);
|
||||
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, 0);
|
||||
|
||||
info_ptr->iccp_proflen = proflen;
|
||||
info_ptr->iccp_name = new_iccp_name;
|
||||
info_ptr->iccp_profile = new_iccp_profile;
|
||||
/* Compression is always zero but is here so the API and info structure
|
||||
* does not have to change if we introduce multiple compression types */
|
||||
info_ptr->iccp_compression = (png_byte)compression_type;
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
info_ptr->free_me |= PNG_FREE_ICCP;
|
||||
#endif
|
||||
info_ptr->valid |= PNG_INFO_iCCP;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_TEXT_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||
int num_text)
|
||||
{
|
||||
int i;
|
||||
|
||||
png_debug1(1, "in %s storage function\n", (png_ptr->chunk_name[0] == '\0' ?
|
||||
"text" : (png_const_charp)png_ptr->chunk_name));
|
||||
|
||||
if (png_ptr == NULL || info_ptr == NULL || num_text == 0)
|
||||
return;
|
||||
|
||||
/* Make sure we have enough space in the "text" array in info_struct
|
||||
* to hold all of the incoming text_ptr objects.
|
||||
*/
|
||||
if (info_ptr->num_text + num_text > info_ptr->max_text)
|
||||
{
|
||||
if (info_ptr->text != NULL)
|
||||
{
|
||||
png_textp old_text;
|
||||
int old_max;
|
||||
|
||||
old_max = info_ptr->max_text;
|
||||
info_ptr->max_text = info_ptr->num_text + num_text + 8;
|
||||
old_text = info_ptr->text;
|
||||
info_ptr->text = (png_textp)png_malloc(png_ptr,
|
||||
(png_uint_32)(info_ptr->max_text * sizeof (png_text)));
|
||||
png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max *
|
||||
sizeof(png_text)));
|
||||
png_free(png_ptr, old_text);
|
||||
}
|
||||
else
|
||||
{
|
||||
info_ptr->max_text = num_text + 8;
|
||||
info_ptr->num_text = 0;
|
||||
info_ptr->text = (png_textp)png_malloc(png_ptr,
|
||||
(png_uint_32)(info_ptr->max_text * sizeof (png_text)));
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
info_ptr->free_me |= PNG_FREE_TEXT;
|
||||
#endif
|
||||
}
|
||||
png_debug1(3, "allocated %d entries for info_ptr->text\n",
|
||||
info_ptr->max_text);
|
||||
}
|
||||
for (i = 0; i < num_text; i++)
|
||||
{
|
||||
png_size_t text_length,key_len;
|
||||
png_size_t lang_len,lang_key_len;
|
||||
png_textp textp = &(info_ptr->text[info_ptr->num_text]);
|
||||
|
||||
if (text_ptr[i].key == (png_charp)NULL)
|
||||
continue;
|
||||
|
||||
key_len = png_strlen(text_ptr[i].key);
|
||||
|
||||
if(text_ptr[i].compression <= 0)
|
||||
{
|
||||
lang_len = 0;
|
||||
lang_key_len = 0;
|
||||
}
|
||||
else
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
{
|
||||
/* set iTXt data */
|
||||
if (text_ptr[i].key != (png_charp)NULL)
|
||||
lang_len = png_strlen(text_ptr[i].lang);
|
||||
else
|
||||
lang_len = 0;
|
||||
if (text_ptr[i].lang_key != (png_charp)NULL)
|
||||
lang_key_len = png_strlen(text_ptr[i].lang_key);
|
||||
else
|
||||
lang_key_len = 0;
|
||||
}
|
||||
#else
|
||||
{
|
||||
png_warning(png_ptr, "iTXt chunk not supported.");
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (text_ptr[i].text == (png_charp)NULL || text_ptr[i].text[0] == '\0')
|
||||
{
|
||||
text_length = 0;
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
if(text_ptr[i].compression > 0)
|
||||
textp->compression = PNG_ITXT_COMPRESSION_NONE;
|
||||
else
|
||||
#endif
|
||||
textp->compression = PNG_TEXT_COMPRESSION_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
text_length = png_strlen(text_ptr[i].text);
|
||||
textp->compression = text_ptr[i].compression;
|
||||
}
|
||||
|
||||
textp->key = (png_charp)png_malloc(png_ptr,
|
||||
(png_uint_32)(key_len + text_length + lang_len + lang_key_len + 4));
|
||||
png_debug2(2, "Allocated %d bytes at %x in png_set_text\n",
|
||||
key_len + lang_len + lang_key_len + text_length + 4, (int)textp->key);
|
||||
|
||||
png_memcpy(textp->key, text_ptr[i].key,
|
||||
(png_size_t)(key_len));
|
||||
*(textp->key+key_len) = '\0';
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
if (text_ptr[i].compression > 0)
|
||||
{
|
||||
textp->lang=textp->key + key_len + 1;
|
||||
png_memcpy(textp->lang, text_ptr[i].lang, lang_len);
|
||||
*(textp->lang+lang_len) = '\0';
|
||||
textp->lang_key=textp->lang + lang_len + 1;
|
||||
png_memcpy(textp->lang_key, text_ptr[i].lang_key, lang_key_len);
|
||||
*(textp->lang_key+lang_key_len) = '\0';
|
||||
textp->text=textp->lang_key + lang_key_len + 1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
textp->lang=(png_charp)NULL;
|
||||
textp->lang_key=(png_charp)NULL;
|
||||
#endif
|
||||
textp->text=textp->key + key_len + 1;
|
||||
}
|
||||
if(text_length)
|
||||
png_memcpy(textp->text, text_ptr[i].text,
|
||||
(png_size_t)(text_length));
|
||||
*(textp->text+text_length) = '\0';
|
||||
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
if(textp->compression > 0)
|
||||
{
|
||||
textp->text_length = 0;
|
||||
textp->itxt_length = text_length;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
textp->text_length = text_length;
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
textp->itxt_length = 0;
|
||||
#endif
|
||||
}
|
||||
info_ptr->text[info_ptr->num_text]= *textp;
|
||||
info_ptr->num_text++;
|
||||
png_debug1(3, "transferred text chunk %d\n", info_ptr->num_text);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_tIME_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "tIME");
|
||||
if (png_ptr == NULL || info_ptr == NULL ||
|
||||
(png_ptr->mode & PNG_WROTE_tIME))
|
||||
return;
|
||||
|
||||
png_memcpy(&(info_ptr->mod_time), mod_time, sizeof (png_time));
|
||||
info_ptr->valid |= PNG_INFO_tIME;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_tRNS_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
|
||||
png_bytep trans, int num_trans, png_color_16p trans_values)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "tRNS");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
if (trans != NULL)
|
||||
{
|
||||
/*
|
||||
* It may not actually be necessary to set png_ptr->trans here;
|
||||
* we do it for backward compatibility with the way the png_handle_tRNS
|
||||
* function used to do the allocation.
|
||||
*/
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
|
||||
#endif
|
||||
png_ptr->trans = info_ptr->trans = png_malloc(png_ptr, num_trans);
|
||||
memcpy(info_ptr->trans, trans, num_trans);
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
info_ptr->free_me |= PNG_FREE_TRNS;
|
||||
#else
|
||||
png_ptr->flags |= PNG_FLAG_FREE_TRNS;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (trans_values != NULL)
|
||||
{
|
||||
png_memcpy(&(info_ptr->trans_values), trans_values,
|
||||
sizeof(png_color_16));
|
||||
if (num_trans == 0)
|
||||
num_trans = 1;
|
||||
}
|
||||
info_ptr->num_trans = (png_uint_16)num_trans;
|
||||
info_ptr->valid |= PNG_INFO_tRNS;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_sPLT_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_sPLT(png_structp png_ptr,
|
||||
png_infop info_ptr, png_sPLT_tp entries, int nentries)
|
||||
{
|
||||
png_sPLT_tp np;
|
||||
int i;
|
||||
|
||||
np = (png_sPLT_tp)png_malloc(png_ptr,
|
||||
(info_ptr->splt_palettes_num + nentries) * sizeof(png_sPLT_t));
|
||||
|
||||
png_memcpy(np, info_ptr->splt_palettes,
|
||||
info_ptr->splt_palettes_num * sizeof(png_sPLT_t));
|
||||
png_free(png_ptr, info_ptr->splt_palettes);
|
||||
info_ptr->splt_palettes=NULL;
|
||||
|
||||
for (i = 0; i < nentries; i++)
|
||||
{
|
||||
png_sPLT_tp to = np + info_ptr->splt_palettes_num + i;
|
||||
png_sPLT_tp from = entries + i;
|
||||
|
||||
to->name = (png_charp)png_malloc(png_ptr,
|
||||
png_strlen(from->name) + 1);
|
||||
png_strcpy(to->name, from->name);
|
||||
to->entries = (png_sPLT_entryp)png_malloc(png_ptr,
|
||||
from->nentries * sizeof(png_sPLT_t));
|
||||
png_memcpy(to->entries, from->entries,
|
||||
from->nentries * sizeof(png_sPLT_t));
|
||||
to->nentries = from->nentries;
|
||||
to->depth = from->depth;
|
||||
}
|
||||
|
||||
info_ptr->splt_palettes = np;
|
||||
info_ptr->splt_palettes_num += nentries;
|
||||
info_ptr->valid |= PNG_INFO_sPLT;
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
info_ptr->free_me |= PNG_FREE_SPLT;
|
||||
#endif
|
||||
}
|
||||
#endif /* PNG_sPLT_SUPPORTED */
|
||||
|
||||
#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_unknown_chunks(png_structp png_ptr,
|
||||
png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns)
|
||||
{
|
||||
png_unknown_chunkp np;
|
||||
int i;
|
||||
|
||||
if (png_ptr == NULL || info_ptr == NULL || num_unknowns == 0)
|
||||
return;
|
||||
|
||||
np = (png_unknown_chunkp)png_malloc(png_ptr,
|
||||
(info_ptr->unknown_chunks_num + num_unknowns) *
|
||||
sizeof(png_unknown_chunk));
|
||||
|
||||
png_memcpy(np, info_ptr->unknown_chunks,
|
||||
info_ptr->unknown_chunks_num * sizeof(png_unknown_chunk));
|
||||
png_free(png_ptr, info_ptr->unknown_chunks);
|
||||
info_ptr->unknown_chunks=NULL;
|
||||
|
||||
for (i = 0; i < num_unknowns; i++)
|
||||
{
|
||||
png_unknown_chunkp to = np + info_ptr->unknown_chunks_num + i;
|
||||
png_unknown_chunkp from = unknowns + i;
|
||||
|
||||
png_strcpy((png_charp)to->name, (png_charp)from->name);
|
||||
to->data = (png_bytep)png_malloc(png_ptr, from->size);
|
||||
png_memcpy(to->data, from->data, from->size);
|
||||
to->size = from->size;
|
||||
|
||||
/* note our location in the read or write sequence */
|
||||
to->location = (png_byte)(png_ptr->mode & 0xff);
|
||||
}
|
||||
|
||||
info_ptr->unknown_chunks = np;
|
||||
info_ptr->unknown_chunks_num += num_unknowns;
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
info_ptr->free_me |= PNG_FREE_UNKN;
|
||||
#endif
|
||||
}
|
||||
void PNGAPI
|
||||
png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr,
|
||||
int chunk, int location)
|
||||
{
|
||||
if(png_ptr != NULL && info_ptr != NULL && chunk >= 0 && chunk <
|
||||
(int)info_ptr->unknown_chunks_num)
|
||||
info_ptr->unknown_chunks[chunk].location = (png_byte)location;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
|
||||
defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_permit_empty_plte (png_structp png_ptr, int empty_plte_permitted)
|
||||
{
|
||||
/* This function is deprecated in favor of png_permit_mng_features()
|
||||
and will be removed from libpng-2.0.0 */
|
||||
png_debug(1, "in png_permit_empty_plte, DEPRECATED.\n");
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
png_ptr->mng_features_permitted = (png_byte)
|
||||
((png_ptr->mng_features_permitted & (~(PNG_FLAG_MNG_EMPTY_PLTE))) |
|
||||
((empty_plte_permitted & PNG_FLAG_MNG_EMPTY_PLTE)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||
png_uint_32 PNGAPI
|
||||
png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features)
|
||||
{
|
||||
png_debug(1, "in png_permit_mng_features\n");
|
||||
if (png_ptr == NULL)
|
||||
return (png_uint_32)0;
|
||||
png_ptr->mng_features_permitted =
|
||||
(png_byte)(mng_features & PNG_ALL_MNG_FEATURES);
|
||||
return (png_uint_32)png_ptr->mng_features_permitted;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
|
||||
chunk_list, int num_chunks)
|
||||
{
|
||||
png_bytep new_list, p;
|
||||
int i, old_num_chunks;
|
||||
if (num_chunks == 0)
|
||||
{
|
||||
if(keep == HANDLE_CHUNK_ALWAYS || keep == HANDLE_CHUNK_IF_SAFE)
|
||||
png_ptr->flags |= PNG_FLAG_KEEP_UNKNOWN_CHUNKS;
|
||||
else
|
||||
png_ptr->flags &= ~PNG_FLAG_KEEP_UNKNOWN_CHUNKS;
|
||||
|
||||
if(keep == HANDLE_CHUNK_ALWAYS)
|
||||
png_ptr->flags |= PNG_FLAG_KEEP_UNSAFE_CHUNKS;
|
||||
else
|
||||
png_ptr->flags &= ~PNG_FLAG_KEEP_UNSAFE_CHUNKS;
|
||||
return;
|
||||
}
|
||||
if (chunk_list == NULL)
|
||||
return;
|
||||
old_num_chunks=png_ptr->num_chunk_list;
|
||||
new_list=png_malloc(png_ptr,5*(num_chunks+old_num_chunks));
|
||||
if(png_ptr->chunk_list != (png_bytep)NULL)
|
||||
{
|
||||
png_memcpy(new_list, png_ptr->chunk_list, 5*old_num_chunks);
|
||||
png_free(png_ptr, png_ptr->chunk_list);
|
||||
png_ptr->chunk_list=NULL;
|
||||
}
|
||||
png_memcpy(new_list+5*old_num_chunks, chunk_list, 5*num_chunks);
|
||||
for (p=new_list+5*old_num_chunks+4, i=0; i<num_chunks; i++, p+=5)
|
||||
*p=(png_byte)keep;
|
||||
png_ptr->num_chunk_list=old_num_chunks+num_chunks;
|
||||
png_ptr->chunk_list=new_list;
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
png_ptr->free_me |= PNG_FREE_LIST;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr,
|
||||
png_user_chunk_ptr read_user_chunk_fn)
|
||||
{
|
||||
png_debug(1, "in png_set_read_user_chunk_fn\n");
|
||||
png_ptr->read_user_chunk_fn = read_user_chunk_fn;
|
||||
png_ptr->user_chunk_ptr = user_chunk_ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_INFO_IMAGE_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "rows");
|
||||
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
if(info_ptr->row_pointers && (info_ptr->row_pointers != row_pointers))
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0);
|
||||
info_ptr->row_pointers = row_pointers;
|
||||
if(row_pointers)
|
||||
info_ptr->valid |= PNG_INFO_IDAT;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
void PNGAPI
|
||||
png_set_compression_buffer_size(png_structp png_ptr, png_uint_32 size)
|
||||
{
|
||||
if(png_ptr->zbuf)
|
||||
png_free(png_ptr, png_ptr->zbuf);
|
||||
png_ptr->zbuf_size = (png_size_t)size;
|
||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, size);
|
||||
if(!png_ptr->zbuf)
|
||||
png_error(png_ptr,"Unable to malloc zbuf");
|
||||
png_ptr->zstream.next_out = png_ptr->zbuf;
|
||||
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
||||
}
|
||||
|
||||
void PNGAPI
|
||||
png_set_invalid(png_structp png_ptr, png_infop info_ptr, int mask)
|
||||
{
|
||||
if (png_ptr && info_ptr)
|
||||
info_ptr->valid &= ~(mask);
|
||||
}
|
||||
|
||||
@@ -1,609 +0,0 @@
|
||||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* libpng 1.0.9 - January 31, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*/
|
||||
|
||||
#define PNG_INTERNAL
|
||||
#include "png.h"
|
||||
|
||||
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
||||
/* turn on BGR-to-RGB mapping */
|
||||
void PNGAPI
|
||||
png_set_bgr(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_bgr\n");
|
||||
png_ptr->transformations |= PNG_BGR;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
||||
/* turn on 16 bit byte swapping */
|
||||
void PNGAPI
|
||||
png_set_swap(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_swap\n");
|
||||
if (png_ptr->bit_depth == 16)
|
||||
png_ptr->transformations |= PNG_SWAP_BYTES;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||
/* turn on pixel packing */
|
||||
void PNGAPI
|
||||
png_set_packing(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_packing\n");
|
||||
if (png_ptr->bit_depth < 8)
|
||||
{
|
||||
png_ptr->transformations |= PNG_PACK;
|
||||
png_ptr->usr_bit_depth = 8;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
|
||||
/* turn on packed pixel swapping */
|
||||
void PNGAPI
|
||||
png_set_packswap(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_packswap\n");
|
||||
if (png_ptr->bit_depth < 8)
|
||||
png_ptr->transformations |= PNG_PACKSWAP;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_shift(png_structp png_ptr, png_color_8p true_bits)
|
||||
{
|
||||
png_debug(1, "in png_set_shift\n");
|
||||
png_ptr->transformations |= PNG_SHIFT;
|
||||
png_ptr->shift = *true_bits;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
|
||||
defined(PNG_WRITE_INTERLACING_SUPPORTED)
|
||||
int PNGAPI
|
||||
png_set_interlace_handling(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_interlace handling\n");
|
||||
if (png_ptr->interlaced)
|
||||
{
|
||||
png_ptr->transformations |= PNG_INTERLACE;
|
||||
return (7);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
||||
/* Add a filler byte on read, or remove a filler or alpha byte on write.
|
||||
* The filler type has changed in v0.95 to allow future 2-byte fillers
|
||||
* for 48-bit input data, as well as to avoid problems with some compilers
|
||||
* that don't like bytes as parameters.
|
||||
*/
|
||||
void PNGAPI
|
||||
png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
||||
{
|
||||
png_debug(1, "in png_set_filler\n");
|
||||
png_ptr->transformations |= PNG_FILLER;
|
||||
png_ptr->filler = (png_byte)filler;
|
||||
if (filler_loc == PNG_FILLER_AFTER)
|
||||
png_ptr->flags |= PNG_FLAG_FILLER_AFTER;
|
||||
else
|
||||
png_ptr->flags &= ~PNG_FLAG_FILLER_AFTER;
|
||||
|
||||
/* This should probably go in the "do_filler" routine.
|
||||
* I attempted to do that in libpng-1.0.1a but that caused problems
|
||||
* so I restored it in libpng-1.0.2a
|
||||
*/
|
||||
|
||||
if (png_ptr->color_type == PNG_COLOR_TYPE_RGB)
|
||||
{
|
||||
png_ptr->usr_channels = 4;
|
||||
}
|
||||
|
||||
/* Also I added this in libpng-1.0.2a (what happens when we expand
|
||||
* a less-than-8-bit grayscale to GA? */
|
||||
|
||||
if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY && png_ptr->bit_depth >= 8)
|
||||
{
|
||||
png_ptr->usr_channels = 2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
|
||||
defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_swap_alpha(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_swap_alpha\n");
|
||||
png_ptr->transformations |= PNG_SWAP_ALPHA;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
|
||||
defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_invert_alpha(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_invert_alpha\n");
|
||||
png_ptr->transformations |= PNG_INVERT_ALPHA;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_invert_mono(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_invert_mono\n");
|
||||
png_ptr->transformations |= PNG_INVERT_MONO;
|
||||
}
|
||||
|
||||
/* invert monochrome grayscale data */
|
||||
void /* PRIVATE */
|
||||
png_do_invert(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
png_debug(1, "in png_do_invert\n");
|
||||
if (row_info->bit_depth == 1 &&
|
||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
||||
row != NULL && row_info != NULL &&
|
||||
#endif
|
||||
row_info->color_type == PNG_COLOR_TYPE_GRAY)
|
||||
{
|
||||
png_bytep rp = row;
|
||||
png_uint_32 i;
|
||||
png_uint_32 istop = row_info->rowbytes;
|
||||
|
||||
for (i = 0; i < istop; i++)
|
||||
{
|
||||
*rp = (png_byte)(~(*rp));
|
||||
rp++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
||||
/* swaps byte order on 16 bit depth images */
|
||||
void /* PRIVATE */
|
||||
png_do_swap(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
png_debug(1, "in png_do_swap\n");
|
||||
if (
|
||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
||||
row != NULL && row_info != NULL &&
|
||||
#endif
|
||||
row_info->bit_depth == 16)
|
||||
{
|
||||
png_bytep rp = row;
|
||||
png_uint_32 i;
|
||||
png_uint_32 istop= row_info->width * row_info->channels;
|
||||
|
||||
for (i = 0; i < istop; i++, rp += 2)
|
||||
{
|
||||
png_byte t = *rp;
|
||||
*rp = *(rp + 1);
|
||||
*(rp + 1) = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
|
||||
static png_byte onebppswaptable[256] = {
|
||||
0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0,
|
||||
0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
|
||||
0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8,
|
||||
0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8,
|
||||
0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4,
|
||||
0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4,
|
||||
0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC,
|
||||
0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC,
|
||||
0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2,
|
||||
0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2,
|
||||
0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA,
|
||||
0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA,
|
||||
0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6,
|
||||
0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6,
|
||||
0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE,
|
||||
0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE,
|
||||
0x01, 0x81, 0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1,
|
||||
0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1,
|
||||
0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9,
|
||||
0x19, 0x99, 0x59, 0xD9, 0x39, 0xB9, 0x79, 0xF9,
|
||||
0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5,
|
||||
0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5,
|
||||
0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, 0x6D, 0xED,
|
||||
0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD,
|
||||
0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3,
|
||||
0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3,
|
||||
0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB,
|
||||
0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB,
|
||||
0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7,
|
||||
0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
|
||||
0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF,
|
||||
0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF
|
||||
};
|
||||
|
||||
static png_byte twobppswaptable[256] = {
|
||||
0x00, 0x40, 0x80, 0xC0, 0x10, 0x50, 0x90, 0xD0,
|
||||
0x20, 0x60, 0xA0, 0xE0, 0x30, 0x70, 0xB0, 0xF0,
|
||||
0x04, 0x44, 0x84, 0xC4, 0x14, 0x54, 0x94, 0xD4,
|
||||
0x24, 0x64, 0xA4, 0xE4, 0x34, 0x74, 0xB4, 0xF4,
|
||||
0x08, 0x48, 0x88, 0xC8, 0x18, 0x58, 0x98, 0xD8,
|
||||
0x28, 0x68, 0xA8, 0xE8, 0x38, 0x78, 0xB8, 0xF8,
|
||||
0x0C, 0x4C, 0x8C, 0xCC, 0x1C, 0x5C, 0x9C, 0xDC,
|
||||
0x2C, 0x6C, 0xAC, 0xEC, 0x3C, 0x7C, 0xBC, 0xFC,
|
||||
0x01, 0x41, 0x81, 0xC1, 0x11, 0x51, 0x91, 0xD1,
|
||||
0x21, 0x61, 0xA1, 0xE1, 0x31, 0x71, 0xB1, 0xF1,
|
||||
0x05, 0x45, 0x85, 0xC5, 0x15, 0x55, 0x95, 0xD5,
|
||||
0x25, 0x65, 0xA5, 0xE5, 0x35, 0x75, 0xB5, 0xF5,
|
||||
0x09, 0x49, 0x89, 0xC9, 0x19, 0x59, 0x99, 0xD9,
|
||||
0x29, 0x69, 0xA9, 0xE9, 0x39, 0x79, 0xB9, 0xF9,
|
||||
0x0D, 0x4D, 0x8D, 0xCD, 0x1D, 0x5D, 0x9D, 0xDD,
|
||||
0x2D, 0x6D, 0xAD, 0xED, 0x3D, 0x7D, 0xBD, 0xFD,
|
||||
0x02, 0x42, 0x82, 0xC2, 0x12, 0x52, 0x92, 0xD2,
|
||||
0x22, 0x62, 0xA2, 0xE2, 0x32, 0x72, 0xB2, 0xF2,
|
||||
0x06, 0x46, 0x86, 0xC6, 0x16, 0x56, 0x96, 0xD6,
|
||||
0x26, 0x66, 0xA6, 0xE6, 0x36, 0x76, 0xB6, 0xF6,
|
||||
0x0A, 0x4A, 0x8A, 0xCA, 0x1A, 0x5A, 0x9A, 0xDA,
|
||||
0x2A, 0x6A, 0xAA, 0xEA, 0x3A, 0x7A, 0xBA, 0xFA,
|
||||
0x0E, 0x4E, 0x8E, 0xCE, 0x1E, 0x5E, 0x9E, 0xDE,
|
||||
0x2E, 0x6E, 0xAE, 0xEE, 0x3E, 0x7E, 0xBE, 0xFE,
|
||||
0x03, 0x43, 0x83, 0xC3, 0x13, 0x53, 0x93, 0xD3,
|
||||
0x23, 0x63, 0xA3, 0xE3, 0x33, 0x73, 0xB3, 0xF3,
|
||||
0x07, 0x47, 0x87, 0xC7, 0x17, 0x57, 0x97, 0xD7,
|
||||
0x27, 0x67, 0xA7, 0xE7, 0x37, 0x77, 0xB7, 0xF7,
|
||||
0x0B, 0x4B, 0x8B, 0xCB, 0x1B, 0x5B, 0x9B, 0xDB,
|
||||
0x2B, 0x6B, 0xAB, 0xEB, 0x3B, 0x7B, 0xBB, 0xFB,
|
||||
0x0F, 0x4F, 0x8F, 0xCF, 0x1F, 0x5F, 0x9F, 0xDF,
|
||||
0x2F, 0x6F, 0xAF, 0xEF, 0x3F, 0x7F, 0xBF, 0xFF
|
||||
};
|
||||
|
||||
static png_byte fourbppswaptable[256] = {
|
||||
0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70,
|
||||
0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0,
|
||||
0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71,
|
||||
0x81, 0x91, 0xA1, 0xB1, 0xC1, 0xD1, 0xE1, 0xF1,
|
||||
0x02, 0x12, 0x22, 0x32, 0x42, 0x52, 0x62, 0x72,
|
||||
0x82, 0x92, 0xA2, 0xB2, 0xC2, 0xD2, 0xE2, 0xF2,
|
||||
0x03, 0x13, 0x23, 0x33, 0x43, 0x53, 0x63, 0x73,
|
||||
0x83, 0x93, 0xA3, 0xB3, 0xC3, 0xD3, 0xE3, 0xF3,
|
||||
0x04, 0x14, 0x24, 0x34, 0x44, 0x54, 0x64, 0x74,
|
||||
0x84, 0x94, 0xA4, 0xB4, 0xC4, 0xD4, 0xE4, 0xF4,
|
||||
0x05, 0x15, 0x25, 0x35, 0x45, 0x55, 0x65, 0x75,
|
||||
0x85, 0x95, 0xA5, 0xB5, 0xC5, 0xD5, 0xE5, 0xF5,
|
||||
0x06, 0x16, 0x26, 0x36, 0x46, 0x56, 0x66, 0x76,
|
||||
0x86, 0x96, 0xA6, 0xB6, 0xC6, 0xD6, 0xE6, 0xF6,
|
||||
0x07, 0x17, 0x27, 0x37, 0x47, 0x57, 0x67, 0x77,
|
||||
0x87, 0x97, 0xA7, 0xB7, 0xC7, 0xD7, 0xE7, 0xF7,
|
||||
0x08, 0x18, 0x28, 0x38, 0x48, 0x58, 0x68, 0x78,
|
||||
0x88, 0x98, 0xA8, 0xB8, 0xC8, 0xD8, 0xE8, 0xF8,
|
||||
0x09, 0x19, 0x29, 0x39, 0x49, 0x59, 0x69, 0x79,
|
||||
0x89, 0x99, 0xA9, 0xB9, 0xC9, 0xD9, 0xE9, 0xF9,
|
||||
0x0A, 0x1A, 0x2A, 0x3A, 0x4A, 0x5A, 0x6A, 0x7A,
|
||||
0x8A, 0x9A, 0xAA, 0xBA, 0xCA, 0xDA, 0xEA, 0xFA,
|
||||
0x0B, 0x1B, 0x2B, 0x3B, 0x4B, 0x5B, 0x6B, 0x7B,
|
||||
0x8B, 0x9B, 0xAB, 0xBB, 0xCB, 0xDB, 0xEB, 0xFB,
|
||||
0x0C, 0x1C, 0x2C, 0x3C, 0x4C, 0x5C, 0x6C, 0x7C,
|
||||
0x8C, 0x9C, 0xAC, 0xBC, 0xCC, 0xDC, 0xEC, 0xFC,
|
||||
0x0D, 0x1D, 0x2D, 0x3D, 0x4D, 0x5D, 0x6D, 0x7D,
|
||||
0x8D, 0x9D, 0xAD, 0xBD, 0xCD, 0xDD, 0xED, 0xFD,
|
||||
0x0E, 0x1E, 0x2E, 0x3E, 0x4E, 0x5E, 0x6E, 0x7E,
|
||||
0x8E, 0x9E, 0xAE, 0xBE, 0xCE, 0xDE, 0xEE, 0xFE,
|
||||
0x0F, 0x1F, 0x2F, 0x3F, 0x4F, 0x5F, 0x6F, 0x7F,
|
||||
0x8F, 0x9F, 0xAF, 0xBF, 0xCF, 0xDF, 0xEF, 0xFF
|
||||
};
|
||||
|
||||
/* swaps pixel packing order within bytes */
|
||||
void /* PRIVATE */
|
||||
png_do_packswap(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
png_debug(1, "in png_do_packswap\n");
|
||||
if (
|
||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
||||
row != NULL && row_info != NULL &&
|
||||
#endif
|
||||
row_info->bit_depth < 8)
|
||||
{
|
||||
png_bytep rp, end, table;
|
||||
|
||||
end = row + row_info->rowbytes;
|
||||
|
||||
if (row_info->bit_depth == 1)
|
||||
table = onebppswaptable;
|
||||
else if (row_info->bit_depth == 2)
|
||||
table = twobppswaptable;
|
||||
else if (row_info->bit_depth == 4)
|
||||
table = fourbppswaptable;
|
||||
else
|
||||
return;
|
||||
|
||||
for (rp = row; rp < end; rp++)
|
||||
*rp = table[*rp];
|
||||
}
|
||||
}
|
||||
#endif /* PNG_READ_PACKSWAP_SUPPORTED or PNG_WRITE_PACKSWAP_SUPPORTED */
|
||||
|
||||
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
|
||||
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
|
||||
/* remove filler or alpha byte(s) */
|
||||
void /* PRIVATE */
|
||||
png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
||||
{
|
||||
png_debug(1, "in png_do_strip_filler\n");
|
||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
||||
if (row != NULL && row_info != NULL)
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB ||
|
||||
row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
*/
|
||||
png_bytep sp=row;
|
||||
png_bytep dp=row;
|
||||
png_uint_32 row_width=row_info->width;
|
||||
png_uint_32 i;
|
||||
|
||||
if (row_info->channels == 4)
|
||||
{
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
/* This converts from RGBX or RGBA to RGB */
|
||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
||||
{
|
||||
dp+=3; sp+=4;
|
||||
for (i = 1; i < row_width; i++)
|
||||
{
|
||||
*dp++ = *sp++;
|
||||
*dp++ = *sp++;
|
||||
*dp++ = *sp++;
|
||||
sp++;
|
||||
}
|
||||
}
|
||||
/* This converts from XRGB or ARGB to RGB */
|
||||
else
|
||||
{
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
sp++;
|
||||
*dp++ = *sp++;
|
||||
*dp++ = *sp++;
|
||||
*dp++ = *sp++;
|
||||
}
|
||||
}
|
||||
row_info->pixel_depth = 24;
|
||||
row_info->rowbytes = row_width * 3;
|
||||
}
|
||||
else /* if (row_info->bit_depth == 16) */
|
||||
{
|
||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
||||
{
|
||||
/* This converts from RRGGBBXX or RRGGBBAA to RRGGBB */
|
||||
sp += 8; dp += 6;
|
||||
for (i = 1; i < row_width; i++)
|
||||
{
|
||||
/* This could be (although memcpy is probably slower):
|
||||
png_memcpy(dp, sp, 6);
|
||||
sp += 8;
|
||||
dp += 6;
|
||||
*/
|
||||
*dp++ = *sp++;
|
||||
*dp++ = *sp++;
|
||||
*dp++ = *sp++;
|
||||
*dp++ = *sp++;
|
||||
*dp++ = *sp++;
|
||||
*dp++ = *sp++;
|
||||
sp += 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This converts from XXRRGGBB or AARRGGBB to RRGGBB */
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
/* This could be (although memcpy is probably slower):
|
||||
png_memcpy(dp, sp, 6);
|
||||
sp += 8;
|
||||
dp += 6;
|
||||
*/
|
||||
sp+=2;
|
||||
*dp++ = *sp++;
|
||||
*dp++ = *sp++;
|
||||
*dp++ = *sp++;
|
||||
*dp++ = *sp++;
|
||||
*dp++ = *sp++;
|
||||
*dp++ = *sp++;
|
||||
}
|
||||
}
|
||||
row_info->pixel_depth = 48;
|
||||
row_info->rowbytes = row_width * 6;
|
||||
}
|
||||
row_info->channels = 3;
|
||||
row_info->color_type &= ~PNG_COLOR_MASK_ALPHA;
|
||||
}
|
||||
/*
|
||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY ||
|
||||
row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
*/
|
||||
else if (row_info->channels == 2)
|
||||
{
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
/* This converts from GX or GA to G */
|
||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
||||
{
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
*dp++ = *sp++;
|
||||
sp++;
|
||||
}
|
||||
}
|
||||
/* This converts from XG or AG to G */
|
||||
else
|
||||
{
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
sp++;
|
||||
*dp++ = *sp++;
|
||||
}
|
||||
}
|
||||
row_info->pixel_depth = 8;
|
||||
row_info->rowbytes = row_width;
|
||||
}
|
||||
else /* if (row_info->bit_depth == 16) */
|
||||
{
|
||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
||||
{
|
||||
/* This converts from GGXX or GGAA to GG */
|
||||
sp += 4; dp += 2;
|
||||
for (i = 1; i < row_width; i++)
|
||||
{
|
||||
*dp++ = *sp++;
|
||||
*dp++ = *sp++;
|
||||
sp += 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This converts from XXGG or AAGG to GG */
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
sp += 2;
|
||||
*dp++ = *sp++;
|
||||
*dp++ = *sp++;
|
||||
}
|
||||
}
|
||||
row_info->pixel_depth = 16;
|
||||
row_info->rowbytes = row_width * 2;
|
||||
}
|
||||
row_info->channels = 1;
|
||||
row_info->color_type &= ~PNG_COLOR_MASK_ALPHA;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
||||
/* swaps red and blue bytes within a pixel */
|
||||
void /* PRIVATE */
|
||||
png_do_bgr(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
png_debug(1, "in png_do_bgr\n");
|
||||
if (
|
||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
||||
row != NULL && row_info != NULL &&
|
||||
#endif
|
||||
(row_info->color_type & PNG_COLOR_MASK_COLOR))
|
||||
{
|
||||
png_uint_32 row_width = row_info->width;
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||
{
|
||||
png_bytep rp;
|
||||
png_uint_32 i;
|
||||
|
||||
for (i = 0, rp = row; i < row_width; i++, rp += 3)
|
||||
{
|
||||
png_byte save = *rp;
|
||||
*rp = *(rp + 2);
|
||||
*(rp + 2) = save;
|
||||
}
|
||||
}
|
||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
{
|
||||
png_bytep rp;
|
||||
png_uint_32 i;
|
||||
|
||||
for (i = 0, rp = row; i < row_width; i++, rp += 4)
|
||||
{
|
||||
png_byte save = *rp;
|
||||
*rp = *(rp + 2);
|
||||
*(rp + 2) = save;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (row_info->bit_depth == 16)
|
||||
{
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||
{
|
||||
png_bytep rp;
|
||||
png_uint_32 i;
|
||||
|
||||
for (i = 0, rp = row; i < row_width; i++, rp += 6)
|
||||
{
|
||||
png_byte save = *rp;
|
||||
*rp = *(rp + 4);
|
||||
*(rp + 4) = save;
|
||||
save = *(rp + 1);
|
||||
*(rp + 1) = *(rp + 5);
|
||||
*(rp + 5) = save;
|
||||
}
|
||||
}
|
||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
{
|
||||
png_bytep rp;
|
||||
png_uint_32 i;
|
||||
|
||||
for (i = 0, rp = row; i < row_width; i++, rp += 8)
|
||||
{
|
||||
png_byte save = *rp;
|
||||
*rp = *(rp + 4);
|
||||
*(rp + 4) = save;
|
||||
save = *(rp + 1);
|
||||
*(rp + 1) = *(rp + 5);
|
||||
*(rp + 5) = save;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */
|
||||
|
||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
||||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
|
||||
defined(PNG_LEGACY_SUPPORTED)
|
||||
void PNGAPI
|
||||
png_set_user_transform_info(png_structp png_ptr, png_voidp
|
||||
user_transform_ptr, int user_transform_depth, int user_transform_channels)
|
||||
{
|
||||
png_debug(1, "in png_set_user_transform_info\n");
|
||||
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
png_ptr->user_transform_ptr = user_transform_ptr;
|
||||
png_ptr->user_transform_depth = (png_byte)user_transform_depth;
|
||||
png_ptr->user_transform_channels = (png_byte)user_transform_channels;
|
||||
#else
|
||||
if(user_transform_ptr || user_transform_depth || user_transform_channels)
|
||||
png_warning(png_ptr,
|
||||
"This version of libpng does not support user transform info");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function returns a pointer to the user_transform_ptr associated with
|
||||
* the user transform functions. The application should free any memory
|
||||
* associated with this pointer before png_write_destroy and png_read_destroy
|
||||
* are called.
|
||||
*/
|
||||
png_voidp PNGAPI
|
||||
png_get_user_transform_ptr(png_structp png_ptr)
|
||||
{
|
||||
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
return ((png_voidp)png_ptr->user_transform_ptr);
|
||||
#else
|
||||
if(png_ptr)
|
||||
return (NULL);
|
||||
return (NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,226 +0,0 @@
|
||||
|
||||
/* pngwio.c - functions for data output
|
||||
*
|
||||
* libpng 1.0.9 - January 31, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
* This file provides a location for all output. Users who need
|
||||
* special handling are expected to write functions that have the same
|
||||
* arguments as these and perform similar functions, but that possibly
|
||||
* use different output methods. Note that you shouldn't change these
|
||||
* functions, but rather write replacement functions and then change
|
||||
* them at run time with png_set_write_fn(...).
|
||||
*/
|
||||
|
||||
#define PNG_INTERNAL
|
||||
#include "png.h"
|
||||
|
||||
/* Write the data to whatever output you are using. The default routine
|
||||
writes to a file pointer. Note that this routine sometimes gets called
|
||||
with very small lengths, so you should implement some kind of simple
|
||||
buffering if you are using unbuffered writes. This should never be asked
|
||||
to write more than 64K on a 16 bit machine. */
|
||||
|
||||
void /* PRIVATE */
|
||||
png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
{
|
||||
if (png_ptr->write_data_fn != NULL )
|
||||
(*(png_ptr->write_data_fn))(png_ptr, data, length);
|
||||
else
|
||||
png_error(png_ptr, "Call to NULL write function");
|
||||
}
|
||||
|
||||
#if !defined(PNG_NO_STDIO)
|
||||
/* This is the function that does the actual writing of data. If you are
|
||||
not writing to a standard C stream, you should create a replacement
|
||||
write_data function and use it at run time with png_set_write_fn(), rather
|
||||
than changing the library. */
|
||||
#ifndef USE_FAR_KEYWORD
|
||||
static void /* PRIVATE */
|
||||
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
{
|
||||
png_uint_32 check;
|
||||
|
||||
#if defined(_WIN32_WCE)
|
||||
if ( !WriteFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
||||
check = 0;
|
||||
#else
|
||||
check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr));
|
||||
#endif
|
||||
if (check != length)
|
||||
png_error(png_ptr, "Write Error");
|
||||
}
|
||||
#else
|
||||
/* this is the model-independent version. Since the standard I/O library
|
||||
can't handle far buffers in the medium and small models, we have to copy
|
||||
the data.
|
||||
*/
|
||||
|
||||
#define NEAR_BUF_SIZE 1024
|
||||
#define MIN(a,b) (a <= b ? a : b)
|
||||
|
||||
static void /* PRIVATE */
|
||||
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
{
|
||||
png_uint_32 check;
|
||||
png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */
|
||||
png_FILE_p io_ptr;
|
||||
|
||||
/* Check if data really is near. If so, use usual code. */
|
||||
near_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
||||
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
||||
if ((png_bytep)near_data == data)
|
||||
{
|
||||
#if defined(_WIN32_WCE)
|
||||
if ( !WriteFile(io_ptr, near_data, length, &check, NULL) )
|
||||
check = 0;
|
||||
#else
|
||||
check = fwrite(near_data, 1, length, io_ptr);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
png_byte buf[NEAR_BUF_SIZE];
|
||||
png_size_t written, remaining, err;
|
||||
check = 0;
|
||||
remaining = length;
|
||||
do
|
||||
{
|
||||
written = MIN(NEAR_BUF_SIZE, remaining);
|
||||
png_memcpy(buf, data, written); /* copy far buffer to near buffer */
|
||||
#if defined(_WIN32_WCE)
|
||||
if ( !WriteFile(io_ptr, buf, written, &err, NULL) )
|
||||
err = 0;
|
||||
#else
|
||||
err = fwrite(buf, 1, written, io_ptr);
|
||||
#endif
|
||||
if (err != written)
|
||||
break;
|
||||
else
|
||||
check += err;
|
||||
data += written;
|
||||
remaining -= written;
|
||||
}
|
||||
while (remaining != 0);
|
||||
}
|
||||
if (check != length)
|
||||
png_error(png_ptr, "Write Error");
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* This function is called to output any data pending writing (normally
|
||||
to disk). After png_flush is called, there should be no data pending
|
||||
writing in any buffers. */
|
||||
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
||||
void /* PRIVATE */
|
||||
png_flush(png_structp png_ptr)
|
||||
{
|
||||
if (png_ptr->output_flush_fn != NULL)
|
||||
(*(png_ptr->output_flush_fn))(png_ptr);
|
||||
}
|
||||
|
||||
#if !defined(PNG_NO_STDIO)
|
||||
static void /* PRIVATE */
|
||||
png_default_flush(png_structp png_ptr)
|
||||
{
|
||||
#if !defined(_WIN32_WCE)
|
||||
png_FILE_p io_ptr;
|
||||
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
|
||||
if (io_ptr != NULL)
|
||||
fflush(io_ptr);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* This function allows the application to supply new output functions for
|
||||
libpng if standard C streams aren't being used.
|
||||
|
||||
This function takes as its arguments:
|
||||
png_ptr - pointer to a png output data structure
|
||||
io_ptr - pointer to user supplied structure containing info about
|
||||
the output functions. May be NULL.
|
||||
write_data_fn - pointer to a new output function that takes as its
|
||||
arguments a pointer to a png_struct, a pointer to
|
||||
data to be written, and a 32-bit unsigned int that is
|
||||
the number of bytes to be written. The new write
|
||||
function should call png_error(png_ptr, "Error msg")
|
||||
to exit and output any fatal error messages.
|
||||
flush_data_fn - pointer to a new flush function that takes as its
|
||||
arguments a pointer to a png_struct. After a call to
|
||||
the flush function, there should be no data in any buffers
|
||||
or pending transmission. If the output method doesn't do
|
||||
any buffering of ouput, a function prototype must still be
|
||||
supplied although it doesn't have to do anything. If
|
||||
PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
|
||||
time, output_flush_fn will be ignored, although it must be
|
||||
supplied for compatibility. */
|
||||
void PNGAPI
|
||||
png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
||||
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
|
||||
{
|
||||
png_ptr->io_ptr = io_ptr;
|
||||
|
||||
#if !defined(PNG_NO_STDIO)
|
||||
if (write_data_fn != NULL)
|
||||
png_ptr->write_data_fn = write_data_fn;
|
||||
else
|
||||
png_ptr->write_data_fn = png_default_write_data;
|
||||
#else
|
||||
png_ptr->write_data_fn = write_data_fn;
|
||||
#endif
|
||||
|
||||
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
||||
#if !defined(PNG_NO_STDIO)
|
||||
if (output_flush_fn != NULL)
|
||||
png_ptr->output_flush_fn = output_flush_fn;
|
||||
else
|
||||
png_ptr->output_flush_fn = png_default_flush;
|
||||
#else
|
||||
png_ptr->output_flush_fn = output_flush_fn;
|
||||
#endif
|
||||
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
|
||||
|
||||
/* It is an error to read while writing a png file */
|
||||
if (png_ptr->read_data_fn != NULL)
|
||||
{
|
||||
png_ptr->read_data_fn = NULL;
|
||||
png_warning(png_ptr,
|
||||
"Attempted to set both read_data_fn and write_data_fn in");
|
||||
png_warning(png_ptr,
|
||||
"the same structure. Resetting read_data_fn to NULL.");
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(USE_FAR_KEYWORD)
|
||||
#if defined(_MSC_VER)
|
||||
void *png_far_to_near(png_structp png_ptr,png_voidp ptr, int check)
|
||||
{
|
||||
void *near_ptr;
|
||||
void FAR *far_ptr;
|
||||
FP_OFF(near_ptr) = FP_OFF(ptr);
|
||||
far_ptr = (void FAR *)near_ptr;
|
||||
if(check != 0)
|
||||
if(FP_SEG(ptr) != FP_SEG(far_ptr))
|
||||
png_error(png_ptr,"segment lost in conversion");
|
||||
return(near_ptr);
|
||||
}
|
||||
# else
|
||||
void *png_far_to_near(png_structp png_ptr,png_voidp ptr, int check)
|
||||
{
|
||||
void *near_ptr;
|
||||
void FAR *far_ptr;
|
||||
near_ptr = (void FAR *)ptr;
|
||||
far_ptr = (void FAR *)near_ptr;
|
||||
if(check != 0)
|
||||
if(far_ptr != ptr)
|
||||
png_error(png_ptr,"segment lost in conversion");
|
||||
return(near_ptr);
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user