Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Libpng
提交
2687fcc7
T
Third Party Libpng
项目概览
OpenHarmony
/
Third Party Libpng
接近 2 年 前同步成功
通知
4
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Libpng
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2687fcc7
编写于
1月 07, 1998
作者:
G
Glenn Randers-Pehrson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Imported from libpng-0.97c.tar
上级
70e3f543
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
259 addition
and
218 deletion
+259
-218
CHANGES
CHANGES
+9
-7
README
README
+8
-9
makefile
makefile
+0
-68
makefile.elf
makefile.elf
+39
-28
png.c
png.c
+4
-3
png.h
png.h
+31
-3
pngconf.h
pngconf.h
+5
-4
pngerror.c
pngerror.c
+4
-3
pngget.c
pngget.c
+3
-2
pngmem.c
pngmem.c
+3
-2
pngpread.c
pngpread.c
+3
-2
pngread.c
pngread.c
+3
-2
pngrio.c
pngrio.c
+3
-2
pngrtran.c
pngrtran.c
+61
-29
pngrutil.c
pngrutil.c
+59
-40
pngset.c
pngset.c
+3
-2
pngtest.c
pngtest.c
+6
-2
pngtrans.c
pngtrans.c
+3
-2
pngwio.c
pngwio.c
+3
-2
pngwrite.c
pngwrite.c
+3
-2
pngwtran.c
pngwtran.c
+3
-2
pngwutil.c
pngwutil.c
+3
-2
未找到文件。
CHANGES
浏览文件 @
2687fcc7
...
...
@@ -167,21 +167,23 @@ version 0.96 [May, 1997]
added read of CRC after IEND chunk for embedded PNGs (Laszlo Nyul)
added typecasts to quiet compiler errors
added more debugging info
version 1.00 [not distributed, but Andreas handed off to G&G]
skipped version 1.00 to avoid potential problems with shared libraries
created with version 0.89
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.
fixed typecasts of "new_key"
,
etc.
added RFC 1152 date support
version 1.00.97 [Dec 1997]
fixed bug in gamma handling of 4-bit grayscale
added more typecasts. 65536L becomes (png_uint_32)65536L, etc.
minor corrections in libpng.txt
added simple sRGB support
make it simpler to do conditional compiling
make it simpler to do conditional compiling
: PNG_READ_NOT_FULLY_SUPPORTED
fixed memory leak in pngwrite.c (free info_ptr->text)
added more conditions for png_do_background, to avoid changing
black pixels to background when a background is supplied and
no pixels are transparent
include stdio.h in pngconf.h even when PNG_NO_STDIO is defined.
repaired PNG_NO_STDIO behaviour
tested NODIV support and made it default behaviour
added "-m" option to pngtest
[anything else? 2-bit grayscale gamma bug?]
regularized version numbering scheme and bumped shared-library major
version number to 2 to avoid potential problems with libpng 0.89 apps
README
浏览文件 @
2687fcc7
README for libpng 1.10
[NOTE: this is still beta version 0.97c; the text below has already
been updated in anticipation of the imminent 1.0 release.]
This first official release of libpng. Don't let the fact that
README for libpng 1.0
This is 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 for about two years. However, it's
finally gotten to the stage where there haven't been significant
changes to the API in some time, and people have a bad feeling about
libraries with versions < 1.0.
Note that the version number is 1.10 to avoid potential problems
with shared libraries created for Linux ELF under version 0.89,
which mistakenly used 1.0.89 as the library version number in
false anticipation of an imminent 1.0 release.
****
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
which
use
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,
...
...
@@ -28,7 +27,7 @@ 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
which
access the info struct directly incompatible with the new
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 older programs be converted
to the new format, to facilitate upgrades in the future.
...
...
makefile
已删除
100644 → 0
浏览文件 @
70e3f543
# makefile for libpng
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
# For conditions of distribution and use, see copyright notice in png.h
# Where the zlib library and include files are located
#ZLIBLIB=/usr/local/lib
#ZLIBINC=/usr/local/include
ZLIBLIB
=
../zlib
ZLIBINC
=
../zlib
CC
=
cc
CFLAGS
=
-I
$(ZLIBINC)
-O
# -g -DPNG_DEBUG=1
LDFLAGS
=
-L
.
-L
$(ZLIBLIB)
-lpng
-lz
-lm
#RANLIB=echo
RANLIB
=
ranlib
# where make install puts libpng.a and png.h
prefix
=
/usr/local
OBJS
=
png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o
\
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o
\
pngwtran.o pngmem.o pngerror.o pngpread.o
all
:
libpng.a pngtest
libpng.a
:
$(OBJS)
ar rc
$@
$(OBJS)
$(RANLIB)
$@
pngtest
:
pngtest.o libpng.a
$(CC)
-o
pngtest
$(CCFLAGS)
pngtest.o
$(LDFLAGS)
test
:
pngtest
./pngtest
install
:
libpng.a
-
@mkdir
$(prefix)
/include
-
@mkdir
$(prefix)
/lib
cp
png.h
$(prefix)
/include
cp
pngconf.h
$(prefix)
/include
chmod
644
$(prefix)
/include/png.h
chmod
644
$(prefix)
/include/pngconf.h
cp
libpng.a
$(prefix)
/lib
chmod
644
$(prefix)
/lib/libpng.a
clean
:
rm
-f
*
.o libpng.a pngtest pngout.png
# DO NOT DELETE THIS LINE -- make depend depends on it.
png.o
:
png.h pngconf.h
pngerror.o
:
png.h pngconf.h
pngrio.o
:
png.h pngconf.h
pngwio.o
:
png.h pngconf.h
pngmem.o
:
png.h pngconf.h
pngset.o
:
png.h pngconf.h
pngget.o
:
png.h pngconf.h
pngread.o
:
png.h pngconf.h
pngrtran.o
:
png.h pngconf.h
pngrutil.o
:
png.h pngconf.h
pngtest.o
:
png.h pngconf.h
pngtrans.o
:
png.h pngconf.h
pngwrite.o
:
png.h pngconf.h
pngwtran.o
:
png.h pngconf.h
pngwutil.o
:
png.h pngconf.h
pngpread.o
:
png.h pngconf.h
makefile.elf
浏览文件 @
2687fcc7
# makefile for libpng on
(linux) ELF
# makefile for libpng on
Linux ELF with gcc
# Copyright (C) 1996, 1997 Andreas Dilger
# Copyright (C) 1998 Glenn Randers-Pehrson
# For conditions of distribution and use, see copyright notice in png.h
CC
=
gcc
...
...
@@ -13,14 +14,15 @@ ZLIBINC=../zlib
WARNMORE
=
-Wwrite-strings
-Wpointer-arith
-Wshadow
\
-Wmissing-declarations
-Wtraditional
-Wcast-align
\
-Wstrict-prototypes
-Wmissing-prototypes
#-Wconversion
CFLAGS
=
-I
$(ZLIBINC)
-Wall
-O3
-funroll-loops
-malign-loops
=
2
-malign-functions
=
2
-fPIC
#
$(WARNMORE)
-g
-DPNG_DEBUG
=
5
CFLAGS
=
-I
$(ZLIBINC)
-Wall
-O3
-funroll-loops
-malign-loops
=
2
\
-malign-functions
=
2
#
$(WARNMORE)
-g
-DPNG_DEBUG
=
5
LDFLAGS
=
-L
.
-Wl
,-rpath,.
-L
$(ZLIBLIB)
-Wl
,-rpath,
$(ZLIBLIB)
-lpng
-lz
-lm
RANLIB
=
ranlib
#RANLIB=echo
PNGMAJ
=
1
PNGMIN
=
1.0
PNGMAJ
=
2
PNGMIN
=
0.97
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
# where make install puts libpng.a, libpng.so*, and png.h
...
...
@@ -32,10 +34,17 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o
\
pngwtran.o pngmem.o pngerror.o pngpread.o
all
:
libpng.so pngtest
OBJSDLL
=
$(OBJS:.o=.pic.o)
.SUFFIXES
:
.c .o .pic.o
.c.pic.o
:
$(CC)
-c
$(CFLAGS)
-fPIC
-o
$@
$*
.c
all
:
libpng.a libpng.so pngtest
libpng.a
:
$(OBJS)
ar rc
$@
$(OBJS)
ar rc
$@
$(OBJS)
$(RANLIB)
$@
libpng.so
:
libpng.so.$(PNGMAJ)
...
...
@@ -44,43 +53,45 @@ libpng.so: libpng.so.$(PNGMAJ)
libpng.so.$(PNGMAJ)
:
libpng.so.$(PNGVER)
ln
-sf
libpng.so.
$(PNGVER)
libpng.so.
$(PNGMAJ)
libpng.so.$(PNGVER)
:
$(OBJS)
gcc
-shared
-Wl
,-soname,libpng.so.
$(PNGMAJ)
$(OBJS)
-o
libpng.so.
$(PNGVER)
libpng.so.$(PNGVER)
:
$(OBJSDLL)
gcc
-shared
-Wl
,-soname,libpng.so.
$(PNGMAJ)
-o
libpng.so.
$(PNGVER)
\
$(OBJSDLL)
pngtest
:
pngtest.o libpng.so
$(CC)
-o
pngtest
$(C
C
FLAGS)
pngtest.o
$(LDFLAGS)
$(CC)
-o
pngtest
$(CFLAGS)
pngtest.o
$(LDFLAGS)
test
:
pngtest
./pngtest
install
:
libpng.so.$(PNGVER)
install
:
libpng.
a libpng.
so.$(PNGVER)
-
@mkdir
$(INCPATH)
$(LIBPATH)
cp
png.h pngconf.h
$(INCPATH)
chmod
644
$(INCPATH)
/png.h
$(INCPATH)
/pngconf.h
cp
libpng.so.
$(PNGVER)
$(LIBPATH)
cp
libpng.
a libpng.
so.
$(PNGVER)
$(LIBPATH)
chmod
755
$(LIBPATH)
/libpng.so.
$(PNGVER)
-
@/bin/rm
$(LIBPATH)
/libpng.so.
$(PNGMAJ)
$(LIBPATH)
/libpng.so
-
@/bin/rm
-f
$(LIBPATH)
/libpng.so.
$(PNGMAJ)
$(LIBPATH)
/libpng.so
(
cd
$(LIBPATH)
;
ln
-sf
libpng.so.
$(PNGVER)
libpng.so.
$(PNGMAJ)
;
\
ln
-sf
libpng.so.
$(PNGMAJ)
libpng.so
)
clean
:
rm
-f
*
.o libpng.a libpng.so
*
pngtest pngout.png
/bin/
rm
-f
*
.o libpng.a libpng.so
*
pngtest pngout.png
# DO NOT DELETE THIS LINE -- make depend depends on it.
png.o
:
png.h pngconf.h
pngerror.o
:
png.h pngconf.h
pngrio.o
:
png.h pngconf.h
pngwio.o
:
png.h pngconf.h
pngmem.o
:
png.h pngconf.h
pngset.o
:
png.h pngconf.h
pngget.o
:
png.h pngconf.h
pngread.o
:
png.h pngconf.h
pngrtran.o
:
png.h pngconf.h
pngrutil.o
:
png.h pngconf.h
png.o png.pic.o
:
png.h pngconf.h
pngerror.o pngerror.pic.o
:
png.h pngconf.h
pngrio.o pngrio.pic.o
:
png.h pngconf.h
pngwio.o pngwio.pic.o
:
png.h pngconf.h
pngmem.o pngmem.pic.o
:
png.h pngconf.h
pngset.o pngset.pic.o
:
png.h pngconf.h
pngget.o pngget.pic.o
:
png.h pngconf.h
pngread.o pngread.pic.o
:
png.h pngconf.h
pngrtran.o pngrtran.pic.o
:
png.h pngconf.h
pngrutil.o pngrutil.pic.o
:
png.h pngconf.h
pngtrans.o pngtrans.pic.o
:
png.h pngconf.h
pngwrite.o pngwrite.pic.o
:
png.h pngconf.h
pngwtran.o pngwtran.pic.o
:
png.h pngconf.h
pngwutil.o pngwutil.pic.o
:
png.h pngconf.h
pngpread.o pngpread.pic.o
:
png.h pngconf.h
pngtest.o
:
png.h pngconf.h
pngtrans.o
:
png.h pngconf.h
pngwrite.o
:
png.h pngconf.h
pngwtran.o
:
png.h pngconf.h
pngwutil.o
:
png.h pngconf.h
pngpread.o
:
png.h pngconf.h
png.c
浏览文件 @
2687fcc7
/* png.c - location for general purpose libpng functions
*
* libpng
1.0
0.97
* libpng 0.97
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* May 28, 1997
* Copyright (c) 1998, Glenn Randers-Pehrson
* January 7, 1998
*/
#define PNG_INTERNAL
...
...
@@ -15,7 +16,7 @@
/* Version information for C files. This had better match the version
* string defined in png.h.
*/
char
png_libpng_ver
[]
=
"
1.0
0.97"
;
char
png_libpng_ver
[]
=
"0.97"
;
/* Place to hold the signiture string for a PNG file. */
png_byte
FARDATA
png_sig
[
8
]
=
{
137
,
80
,
78
,
71
,
13
,
10
,
26
,
10
};
...
...
png.h
浏览文件 @
2687fcc7
/* png.h - header file for PNG reference library
*
* libpng
1.00.97 beta 7
* libpng
0.97 beta
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Dec 31, 1997
* Copyright (c) 1998 Glenn Randers-Pehrson
* January 7, 1998
*
* BETA NOTICE:
* This is a beta version. It reads and writes valid files on the
...
...
@@ -93,7 +94,7 @@ extern "C" {
*/
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "
1.0
0.97"
#define PNG_LIBPNG_VER_STRING "0.97"
/* careful here. At one time, I wanted to use 082, but that would be octal.
* Version 1.0 will be 100 here, etc.
...
...
@@ -107,6 +108,33 @@ extern "C" {
*/
extern
char
png_libpng_ver
[];
/*
* Note about libpng version numbers:
*
* Due to various miscommunications, unforeseen code incompatibilities
* and occasional factors outside the authors' control, version numbering
* on the library has not always been consistent and straightforward.
* The following table summarizes matters since version 0.89c, which was
* the first widely used release:
*
* source png.h shared-lib
* version string version
* ------- ------ ----------
* 0.89c ("1.0 beta 3") 0.89 1.0.89
* 0.90 ("1.0 beta 4") 0.90 0.90 [should have been 2.0.90]
* 0.95 ("1.0 beta 5") 0.95 0.95 [should have been 2.0.95]
* 0.96 ("1.0 beta 6") 0.96 0.96 [should have been 2.0.96]
* 0.97b ("1.00.97 beta 7") 1.00.97 1.0.0 [should have been 2.0.97]
* 0.97c 0.97 2.0.97
* 0.98 0.98 2.0.98
* 0.99 0.99 2.0.99
* 1.0 1.00 2.1.0
*
* Henceforth the source version will match the shared-library minor
* and patch numbers; the shared-library major version number will be
* used for changes in backward compatibility, as it is intended.
*/
/* Structures to facilitate easy interlacing. See png.c for more details */
extern
int
FARDATA
png_pass_start
[];
extern
int
FARDATA
png_pass_inc
[];
...
...
pngconf.h
浏览文件 @
2687fcc7
/* pngconf.c - machine configurable file for libpng
*
* libpng
1.0
0.97
* libpng 0.97
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* May 28, 1997
* Copyright (c) 1998, Glenn Randers-Pehrson
* January 7, 1998
*/
/* Any machine specific code is near the front of this file, so if you
...
...
@@ -259,6 +260,7 @@ __dont__ include it again
#define PNG_READ_GRAY_TO_RGB_SUPPORTED
#define PNG_READ_SWAP_ALPHA_SUPPORTED
#define PNG_READ_STRIP_ALPHA_SUPPORTED
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED
/* well tested on Intel */
#endif
/* PNG_READ_FULLY_SUPPORTED */
#define PNG_READ_INTERLACING_SUPPORTED
...
...
@@ -274,7 +276,7 @@ __dont__ include it again
#define PNG_WRITE_FLUSH_SUPPORTED
#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
#endif
/*PNG_WRITE_FULLY_SUPPORTED */
#endif
/*
PNG_WRITE_FULLY_SUPPORTED */
#if !defined(PNG_NO_STDIO)
#define PNG_TIME_RFC1152_SUPPORTED
...
...
@@ -282,7 +284,6 @@ __dont__ include it again
/* These are currently experimental features */
#undef PNG_READ_16_TO_8_ACCURATE_SHIFT_SUPPORTED
/* very little testing */
#undef PNG_READ_COMPOSITE_NODIV_SUPPORTED
/* very little testing */
/* This is only for PowerPC big-endian and 680x0 systems */
#undef PNG_READ_BIG_ENDIAN_SUPPORTED
/* some testing */
...
...
pngerror.c
浏览文件 @
2687fcc7
/* pngerror.c - stub functions for i/o and memory allocation
*
* libpng
1.0
0.97
* libpng 0.97
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* May 28, 1997
* Copyright (c) 1998, Glenn Randers-Pehrson
* January 7, 1998
*
* This file provides a location for all error handling. Users which
* need special error handling are expected to write replacement functions
...
...
@@ -84,7 +85,7 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp message
else
{
buffer
[
iout
++
]
=
':'
;
buffer
[
iout
++
]
=
' '
;
strn
cpy
(
buffer
+
iout
,
message
,
64
);
png_mem
cpy
(
buffer
+
iout
,
message
,
64
);
buffer
[
iout
+
63
]
=
0
;
}
}
...
...
pngget.c
浏览文件 @
2687fcc7
/* pngget.c - retrieval of values from info struct
*
* libpng
1.0
0.97
* libpng 0.97
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* May 28, 1997
* Copyright (c) 1998, Glenn Randers-Pehrson
* January 7, 1998
*/
#define PNG_INTERNAL
...
...
pngmem.c
浏览文件 @
2687fcc7
/* pngmem.c - stub functions for memory allocation
*
* libpng
1.0
0.97
* libpng 0.97
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* May 28, 1997
* Copyright (c) 1998, Glenn Randers-Pehrson
* January 7, 1998
*
* This file provides a location for all memory allocation. Users which
* need special memory handling are expected to modify the code in this file
...
...
pngpread.c
浏览文件 @
2687fcc7
/* pngpread.c - read a png file in push mode
*
* libpng
1.0
0.97
* libpng 0.97
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* May 28, 1997
* Copyright (c) 1998, Glenn Randers-Pehrson
* January 7, 1998
*/
#define PNG_INTERNAL
...
...
pngread.c
浏览文件 @
2687fcc7
/* pngread.c - read a PNG file
*
* libpng
1.0
0.97
* libpng 0.97
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* May 28, 1997
* Copyright (c) 1998, Glenn Randers-Pehrson
* January 7, 1998
*
* This file contains routines that an application calls directly to
* read a PNG file or stream.
...
...
pngrio.c
浏览文件 @
2687fcc7
/* pngrio.c - functions for data input
*
* libpng
1.0
0.97
* libpng 0.97
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* May 28, 1997
* Copyright (c) 1998, Glenn Randers-Pehrson
* January 7, 1998
*
* This file provides a location for all input. Users which need
* special handling are expected to write a function which has the same
...
...
pngrtran.c
浏览文件 @
2687fcc7
/* pngrtran.c - transforms the data in a row for PNG readers
*
* libpng
1.0
0.97
* libpng 0.97
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* May 28, 1997
* Copyright (c) 1998, Glenn Randers-Pehrson
* January 7, 1998
*
* This file contains functions optionally called by an application
* in order to tell libpng how to handle data when reading a PNG.
...
...
@@ -21,35 +22,40 @@
* many machines. However, it does take more operations than the corresponding
* divide method, so it may be slower on some RISC systems. There are two
* shifts (by 8 or 16 bits) and an addition, versus a single integer divide.
* The results may also be off by one for certain values.
*
* Note that the rounding factors are NOT supposed to be the same! 128 and
* 32768 are correct for the NODIV code; 127 and 32767 are correct for the
* standard method.
*
* [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ]
*/
/* pixel and background should be in gamma 1.0 space
*/
#
define png_composite(composite, pixel, trans, background
) \
{ png_uint_16 temp = ((png_uint_16)(pixel) * (png_uint_16)(trans
) + \
(png_uint_16)(background
)*(png_uint_16)(255 - \
(png_uint_16)(trans)) + (png_uint_16)127
); \
(composite) = (png_byte)(((temp >> 8) + temp
) >> 8); }
/* pixel and background should be in gamma 1.0 space */
#define png_composite_16(composite, pixel, trans, background)
\
{ png_uint_32 temp = ((png_uint_32)(pixel) * (png_uint_32)(trans) +
\
(png_uint_32)(background)*(png_uint_32)(65535L - \
(png_uint_32)(trans)) + (png_uint_32)32767); \
(composite) = (png_uint_16)(((temp >> 16) + temp) >> 16); }
#else
/* pixel and background should be in gamma 1.0 space
*/
#
define png_composite(composite, pixel, trans, background
) \
(composite) = (png_byte)(((png_uint_16)(pixel) * (png_uint_16)(trans
) + \
(png_uint_16)(background) * (png_uint_16)(255 - (png_uint_16)(trans
)) + \
(png_uint_16)127) / 255)
/* pixel and background should be in gamma 1.0 space */
#define png_composite_16(composite, pixel, trans, background)
\
(composite) = (png_uint_16)(((png_uint_32)(pixel) * (png_uint_32)(trans) + \
(png_uint_32)(background)*(png_uint_32)(65535L - (png_uint_32)(trans)) + \
(png_uint_32)32767) / (png_uint_32)65535L)
#endif
/* fg and bg should be in `gamma 1.0' space; alpha is the opacity
*/
#
define png_composite(composite, fg, alpha, bg
) \
{ png_uint_16 temp = ((png_uint_16)(fg) * (png_uint_16)(alpha
) + \
(png_uint_16)(bg
)*(png_uint_16)(255 - \
(png_uint_16)(alpha)) + (png_uint_16)128
); \
(composite) = (png_byte)((temp + (temp >> 8)
) >> 8); }
# define png_composite_16(composite, fg, alpha, bg) \
{ png_uint_32 temp = ((png_uint_32)(fg) * (png_uint_32)(alpha) + \
(png_uint_32)(bg)*(png_uint_32)(65535L -
\
(png_uint_32)(alpha)) + (png_uint_32)32768L);
\
(composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }
#else
/* standard method using integer division */
/* fg and bg should be in `gamma 1.0' space; alpha is the opacity
*/
#
define png_composite(composite, fg, alpha, bg
) \
(composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha
) + \
(png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha
)) + \
(png_uint_16)127) / 255)
# define png_composite_16(composite, fg, alpha, bg) \
(composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \
(png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) +
\
(png_uint_32)32767) / (png_uint_32)65535L)
#endif
/* ?PNG_READ_COMPOSITE_NODIV_SUPPORTED */
/* Set the action on getting a CRC error for an ancillary or critical chunk. */
void
...
...
@@ -1344,6 +1350,16 @@ png_do_chop(png_row_infop row_info, png_bytep row)
*dp = (((((png_uint_32)(*sp) << 8) |
(png_uint_32)(*(sp + 1))) * 255 + 127) / (png_uint_32)65535L;
* GRR: no, I think this is what it really should be:
*dp = (((((png_uint_32)(*sp) << 8) |
(png_uint_32)(*(sp + 1))) + 128L) / (png_uint_32)257L;
* GRR: here's the exact calculation with shifts:
temp = (((png_uint_32)(*sp) << 8) | (png_uint_32)(*(sp + 1))) + 128L;
*dp = (temp - (temp >> 8)) >> 8;
* Approximate calculation with shift/add instead of multiply/divide:
*dp = ((((png_uint_32)(*sp) << 8) |
(png_uint_32)((int)(*(sp + 1)) - *sp)) + 128) >> 8;
...
...
@@ -2558,6 +2574,22 @@ png_do_gamma(png_row_infop row_info, png_bytep row,
}
case
PNG_COLOR_TYPE_GRAY
:
{
if
(
row_info
->
bit_depth
==
2
)
{
for
(
i
=
0
,
sp
=
row
;
i
<
row_info
->
width
;
i
+=
4
)
{
int
a
=
*
sp
&
0xc0
;
int
b
=
*
sp
&
0x30
;
int
c
=
*
sp
&
0x0c
;
int
d
=
*
sp
&
0x03
;
*
sp
=
((((
int
)
gamma_table
[
a
|
(
a
>>
2
)
|
(
a
>>
4
)
|
(
a
>>
6
)])
)
&
0xc0
)
|
((((
int
)
gamma_table
[(
b
<<
2
)
|
b
|
(
b
>>
2
)
|
(
b
>>
4
)])
>>
2
)
&
0x30
)
|
((((
int
)
gamma_table
[(
c
<<
4
)
|
(
c
<<
2
)
|
c
|
(
c
>>
2
)])
>>
4
)
&
0x0c
)
|
((((
int
)
gamma_table
[(
d
<<
6
)
|
(
d
<<
4
)
|
(
d
<<
2
)
|
d
])
>>
6
)
);
sp
++
;
}
}
if
(
row_info
->
bit_depth
==
4
)
{
for
(
i
=
0
,
sp
=
row
;
i
<
row_info
->
width
;
i
+=
2
)
...
...
pngrutil.c
浏览文件 @
2687fcc7
/* pngrutil.c - utilities to read a PNG file
*
* libpng
1.0
0.97
* libpng 0.97
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* May 28, 1997
* Copyright (c) 1998, Glenn Randers-Pehrson
* January 7, 1998
*
* This file contains routines which are only called from within
* libpng itself during the course of reading an image.
...
...
@@ -373,7 +374,12 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
else
if
(
png_ptr
->
mode
&
PNG_HAVE_PLTE
)
/* Should be an error, but we can cope with it */
png_warning
(
png_ptr
,
"Out of place gAMA chunk"
);
else
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_gAMA
)
else
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_gAMA
#if defined(PNG_READ_sRGB_SUPPORTED)
&&
!
(
info_ptr
->
valid
&
PNG_INFO_sRGB
)
#endif
)
{
png_warning
(
png_ptr
,
"Duplicate gAMA chunk"
);
png_crc_finish
(
png_ptr
,
length
);
...
...
@@ -397,21 +403,14 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return
;
#if defined(PNG_READ_sRGB_SUPPORTED)
if
((
png_ptr
->
mode
&
PNG_HAVE_sRGB
))
if
(
igamma
!=
(
png_uint_32
)
50000L
)
{
png_warning
(
png_ptr
,
"Ignoring incorrect gAMA value when sRGB is also present"
);
return
;
}
#endif
/* PNG_READ_sRGB_SUPPORTED */
#if defined(PNG_READ_sRGB_SUPPORTED)
if
(
png_ptr
->
mode
&
PNG_HAVE_sRGB
)
if
(
igamma
!=
(
png_uint_32
)
50000L
)
if
(
info_ptr
->
valid
&
PNG_INFO_sRGB
)
if
(
igamma
!=
(
png_uint_32
)
45000L
)
{
png_warning
(
png_ptr
,
"Ignoring incorrect gAMA value when sRGB is also present"
);
#ifndef PNG_NO_STDIO
fprintf
(
stderr
,
"igamma = %lu
\n
"
,
igamma
);
#endif
return
;
}
#endif
/* PNG_READ_sRGB_SUPPORTED */
...
...
@@ -506,8 +505,12 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
else
if
(
png_ptr
->
mode
&
PNG_HAVE_PLTE
)
/* Should be an error, but we can cope with it */
png_warning
(
png_ptr
,
"Missing PLTE before cHRM"
);
else
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_cHRM
&&
!
(
info_ptr
->
valid
&
PNG_INFO_sRGB
))
#if defined(PNG_READ_sRGB_SUPPORTED)
&&
!
(
info_ptr
->
valid
&
PNG_INFO_sRGB
)
#endif
)
{
png_warning
(
png_ptr
,
"Duplicate cHRM chunk"
);
png_crc_finish
(
png_ptr
,
length
);
...
...
@@ -589,7 +592,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return
;
#if defined(PNG_READ_sRGB_SUPPORTED)
if
(
png_ptr
->
mode
&
PNG_HAVE
_sRGB
)
if
(
info_ptr
->
valid
&
PNG_INFO
_sRGB
)
{
if
(
fabs
(
white_x
-
(
float
).
3127
)
>
(
float
).
001
||
fabs
(
white_y
-
(
float
).
3290
)
>
(
float
).
001
||
...
...
@@ -598,10 +601,17 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
fabs
(
green_x
-
(
float
).
3000
)
>
(
float
).
001
||
fabs
(
green_y
-
(
float
).
6000
)
>
(
float
).
001
||
fabs
(
blue_x
-
(
float
).
1500
)
>
(
float
).
001
||
fabs
(
blue_y
-
(
float
).
60
00
)
>
(
float
).
001
)
fabs
(
blue_y
-
(
float
).
06
00
)
>
(
float
).
001
)
{
png_warning
(
png_ptr
,
"Ignoring incorrect cHRM value when sRGB is also present"
);
#ifndef PNG_NO_STDIO
fprintf
(
stderr
,
"wx=%f, wy=%f, rx=%f, ry=%f
\n
"
,
white_x
,
white_y
,
red_x
,
red_y
);
fprintf
(
stderr
,
"gx=%f, gy=%f, bx=%f, by=%f
\n
"
,
green_x
,
green_y
,
blue_x
,
blue_y
);
#endif
}
return
;
}
...
...
@@ -618,8 +628,6 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
png_byte
intent
;
png_byte
buf
[
1
];
float
file_gamma
;
float
white_x
,
white_y
,
red_x
,
red_y
,
green_x
,
green_y
,
blue_x
,
blue_y
;
png_debug
(
1
,
"in png_handle_sRGB
\n
"
);
...
...
@@ -634,6 +642,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
else
if
(
png_ptr
->
mode
&
PNG_HAVE_PLTE
)
/* Should be an error, but we can cope with it */
png_warning
(
png_ptr
,
"Out of place sRGB chunk"
);
else
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_sRGB
)
{
png_warning
(
png_ptr
,
"Duplicate sRGB chunk"
);
...
...
@@ -660,28 +669,38 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return
;
}
/* if we really want to be paranoid we could check for
already defined gamma and chrm with values that are
inconsistent with sRGB -- for now, just ignore them */
file_gamma
=
(
float
)
45000
.
/
(
float
)
100000
.;
png_set_gAMA
(
png_ptr
,
info_ptr
,
file_gamma
);
white_x
=
(
float
)
31270
.
/
(
float
)
100000
.;
white_y
=
(
float
)
32900
.
/
(
float
)
100000
.;
red_x
=
(
float
)
64000
.
/
(
float
)
100000
.;
red_y
=
(
float
)
33000
.
/
(
float
)
100000
.;
green_x
=
(
float
)
30000
.
/
(
float
)
100000
.;
green_y
=
(
float
)
60000
.
/
(
float
)
100000
.;
blue_x
=
(
float
)
15000
.
/
(
float
)
100000
.;
blue_y
=
(
float
)
6000
.
/
(
float
)
100000
.;
png_set_cHRM
(
png_ptr
,
info_ptr
,
white_x
,
white_y
,
red_x
,
red_y
,
green_x
,
green_y
,
blue_x
,
blue_y
);
#ifdef PNG_READ_gAMA_SUPPORTED
if
((
info_ptr
->
valid
&
PNG_INFO_gAMA
))
if
((
png_uint_32
)(
png_ptr
->
gamma
*
(
float
)
100000
.
+
.
5
)
!=
(
png_uint_32
)
45000L
)
{
png_warning
(
png_ptr
,
"Ignoring incorrect gAMA value when sRGB is also present"
);
#ifndef PNG_NO_STDIO
fprintf
(
stderr
,
"gamma=%f
\n
"
,
png_ptr
->
gamma
);
#endif
}
#endif
/* PNG_READ_gAMA_SUPPORTED */
#ifdef PNG_READ_cHRM_SUPPORTED
if
(
info_ptr
->
valid
&
PNG_INFO_cHRM
)
if
(
fabs
(
info_ptr
->
x_white
-
(
float
).
3127
)
>
(
float
).
001
||
fabs
(
info_ptr
->
y_white
-
(
float
).
3290
)
>
(
float
).
001
||
fabs
(
info_ptr
->
x_red
-
(
float
).
6400
)
>
(
float
).
001
||
fabs
(
info_ptr
->
y_red
-
(
float
).
3300
)
>
(
float
).
001
||
fabs
(
info_ptr
->
x_green
-
(
float
).
3000
)
>
(
float
).
001
||
fabs
(
info_ptr
->
y_green
-
(
float
).
6000
)
>
(
float
).
001
||
fabs
(
info_ptr
->
x_blue
-
(
float
).
1500
)
>
(
float
).
001
||
fabs
(
info_ptr
->
y_blue
-
(
float
).
0600
)
>
(
float
).
001
)
{
png_warning
(
png_ptr
,
"Ignoring incorrect cHRM value when sRGB is also present"
);
}
#endif
/* PNG_READ_cHRM_SUPPORTED */
png_set_sRGB
(
png_ptr
,
info_ptr
,
intent
);
png_set_sRGB
_gAMA_and_cHRM
(
png_ptr
,
info_ptr
,
intent
);
}
#endif
#endif
/* PNG_READ_sRGB_SUPPORTED */
#if defined(PNG_READ_tRNS_SUPPORTED)
void
png_handle_tRNS
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_uint_32
length
)
...
...
pngset.c
浏览文件 @
2687fcc7
/* pngset.c - storage of image information into info struct
*
* libpng
1.0
0.97
* libpng 0.97
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* May 28, 1997
* Copyright (c) 1998, Glenn Randers-Pehrson
* January 7, 1998
*
* The functions here are used during reads to store data from the file
* into the info struct, and during writes to store application data
...
...
pngtest.c
浏览文件 @
2687fcc7
/* pngtest.c - a simple test program to test libpng
*
* libpng
1.0
0.97
* libpng 0.97
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* May 28, 1997
* Copyright (c) 1998, Glenn Randers-Pehrson
* January 7, 1998
*
* This program reads in a PNG image, writes it out again, and then
* compares the two files. If the files are identical, this shows that
...
...
@@ -620,7 +621,10 @@ main(int argc, char *argv[])
{
int
i
;
for
(
i
=
2
;
i
<
argc
;
++
i
)
{
fprintf
(
STDERR
,
"Testing %s:
\n
"
,
argv
[
i
]);
ierror
+=
test
(
argv
[
i
],
outname
);
}
}
else
{
...
...
pngtrans.c
浏览文件 @
2687fcc7
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
* libpng
1.0
0.97
* libpng 0.97
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* May 28, 1997
* Copyright (c) 1998, Glenn Randers-Pehrson
* January 7, 1998
*/
#define PNG_INTERNAL
...
...
pngwio.c
浏览文件 @
2687fcc7
/* pngwio.c - functions for data output
*
* libpng
1.0
0.97
* libpng 0.97
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* May 28, 1997
* Copyright (c) 1998, Glenn Randers-Pehrson
* January 7, 1998
*
* This file provides a location for all output. Users which need
* special handling are expected to write functions which have the same
...
...
pngwrite.c
浏览文件 @
2687fcc7
/* pngwrite.c - general routines to write a PNG file
*
* libpng
1.0
0.97
* libpng 0.97
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* May 28, 1997
* Copyright (c) 1998, Glenn Randers-Pehrson
* January 7, 1998
*/
/* get internal access to png.h */
...
...
pngwtran.c
浏览文件 @
2687fcc7
/* pngwtran.c - transforms the data in a row for PNG writers
*
* libpng
1.0
0.97
* libpng 0.97
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* May 28, 1997
* Copyright (c) 1998, Glenn Randers-Pehrson
* January 7, 1998
*/
#define PNG_INTERNAL
...
...
pngwutil.c
浏览文件 @
2687fcc7
/* pngwutil.c - utilities to write a PNG file
*
* libpng
1.0
0.97
* libpng 0.97
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* May 28, 1997
* Copyright (c) 1998, Glenn Randers-Pehrson
* January 7, 1998
*/
#define PNG_INTERNAL
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录