libpng.txt - A description on how to use and modify libpng
libpng version 1.2.24 - December 14, 2007
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2007 Glenn Randers-Pehrson
For conditions of distribution and use, see copyright
notice in png.h.
based on:
libpng 1.0 beta 6 version 0.96 May 28, 1997
Updated and distributed by Andreas Dilger
Copyright (c) 1996, 1997 Andreas Dilger
libpng 1.0 beta 2 - version 0.88 January 26, 1996
For conditions of distribution and use, see copyright
notice in png.h. Copyright (c) 1995, 1996 Guy Eric
Schalnat, Group 42, Inc.
Updated/rewritten per request in the libpng FAQ
Copyright (c) 1995, 1996 Frank J. T. Wojcik
December 18, 1995 & January 20, 1996
I. Introduction
This file describes how to use and modify the PNG reference library
(known as libpng) for your own use. There are five sections to this
file: introduction, structures, reading, writing, and modification and
configuration notes for various special platforms. In addition to this
file, example.c is a good starting point for using the library, as
it is heavily commented and should include everything most people
will need. We assume that libpng is already installed; see the
INSTALL file for instructions on how to install libpng.
For examples of libpng usage, see the files "example.c", "pngtest.c",
and the files in the "contrib" directory, all of which are included in the
libpng distribution.
Libpng was written as a companion to the PNG specification, as a way
of reducing the amount of time and effort it takes to support the PNG
file format in application programs.
The PNG specification (second edition), November 2003, is available as
a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2003 (E)) at
<http://www.w3.org/TR/2003/REC-PNG-20031110/
The W3C and ISO documents have identical technical content.
The PNG-1.2 specification is available at
<http://www.libpng.org/pub/png/documents/>
The PNG-1.0 specification is available
as RFC 2083 <http://www.libpng.org/pub/png/documents/> and as a
W3C Recommendation <http://www.w3.org/TR/REC.png.html>. Some
additional chunks are described in the special-purpose public chunks
documents at <http://www.libpng.org/pub/png/documents/>.
Other information
about PNG, and the latest version of libpng, can be found at the PNG home
page, <http://www.libpng.org/pub/png/>.
Most users will not have to modify the library significantly; advanced
users may want to modify it more. All attempts were made to make it as
complete as possible, while keeping the code easy to understand.
Currently, this library only supports C. Support for other languages
is being considered.
Libpng has been designed to handle multiple sessions at one time,
to be easily modifiable, to be portable to the vast majority of
machines (ANSI, K&R, 16-, 32-, and 64-bit) available, and to be easy
to use. The ultimate goal of libpng is to promote the acceptance of
the PNG file format in whatever way possible. While there is still
work to be done (see the TODO file), libpng should cover the
majority of the needs of its users.
Libpng uses zlib for its compression and decompression of PNG files.
Further information about zlib, and the latest version of zlib, can
be found at the zlib home page, <http://www.info-zip.org/pub/infozip/zlib/>.
The zlib compression utility is a general purpose utility that is
useful for more than PNG files, and can be used without libpng.
See the documentation delivered with zlib for more details.
You can usually find the source files for the zlib utility wherever you
find the libpng source files.
Libpng is thread safe, provided the threads are using different
instances of the structures. Each thread should have its own
png_struct and png_info instances, and thus its own image.
Libpng does not protect itself against two threads using the
same instance of a structure.
II. Structures
There are two main structures that are important to libpng, png_struct
and png_info. The first, png_struct, is an internal structure that
will not, for the most part, be used by a user except as the first
variable passed to every libpng function call.
The png_info structure is designed to provide information about the
PNG file. At one time, the fields of png_info were intended to be
directly accessible to the user. However, this tended to cause problems
with applications using dynamically loaded libraries, and as a result
a set of interface functions for png_info (the png_get_*() and png_set_*()
functions) was developed. The fields of png_info are still available for
older applications, but it is suggested that applications use the new
interfaces if at all possible.
Applications that do make direct access to the members of png_struct (except
for png_ptr->jmpbuf) must be recompiled whenever the library is updated,
and applications that make direct access to the members of png_info must
be recompiled if they were compiled or loaded with libpng version 1.0.6,
in which the members were in a different order. In version 1.0.7, the
members of the png_info structure reverted to the old order, as they were
in versions 0.97c through 1.0.5. Starting with version 2.0.0, both
structures are going to be hidden, and the contents of the structures will
only be accessible through the png_get/png_set functions.
The png.h header file is an invaluable reference for programming with libpng.
And while I'm on the topic, make sure you include the libpng header file:
#include <png.h>
III. Reading
We'll now walk you through the possible functions to call when reading
in a PNG file sequentially, briefly explaining the syntax and purpose
of each one. See example.c and png.h for more detail. While
progressive reading is covered in the next section, you will still
need some of the functions discussed in this section to read a PNG
file.
Setup
You will want to do the I/O initialization(*) before you get into libpng,
so if it doesn't work, you don't have much to undo. Of course, you
will also want to insure that you are, in fact, dealing with a PNG
file. Libpng provides a simple check to see if a file is a PNG file.
To use it, pass in the first 1 to 8 bytes of the file to the function
png_sig_cmp(), and it will return 0 if the bytes match the corresponding
bytes of the PNG signature, or nonzero otherwise. Of course, the more bytes
you pass in, the greater the accuracy of the prediction.
If you are intending to keep the file pointer open for use in libpng,
you must ensure you don't read more than 8 bytes from the beginning
of the file, and you also have to make a call to png_set_sig_bytes_read()
with the number of bytes you read from the beginning. Libpng will
then only check the bytes (if any) that your program didn't read.
(*): If you are not using the standard I/O functions, you will need
to replace them with custom functions. See the discussion under
Customizing libpng.
FILE *fp = fopen(file_name, "rb");
if (!fp)
{
return (ERROR);
}
fread(header, 1, number, fp);
is_png = !png_sig_cmp(header, 0, number);
if (!is_png)
{
return (NOT_PNG);
}
Next, png_struct and png_info need to be allocated and initialized. In
order to ensure that the size of these structures is correct even with a
dynamically linked libpng, there are functions to initialize and
allocate the structures. We also pass the library version, optional
pointers to error handling functions, and a pointer to a data struct for
use by the error functions, if necessary (the pointer and functions can
be NULL if the default error handlers are to be used). See the section
on Changes to Libpng below regarding the old initialization functions.
The structure allocation functions quietly return NULL if they fail to
create the structure, so your application should check for that.
png_structp png_ptr = png_create_read_struct
(PNG_LIBPNG_VER_STRING, (png_voidp)u
没有合适的资源?快使用搜索试试~ 我知道了~
开源TeamTalk(mogutt)未删减代码
共6819个文件
php:1629个
h:1336个
m:649个
5星 · 超过95%的资源 需积分: 50 124 下载量 172 浏览量
2017-10-13
09:20:41
上传
评论 5
收藏 52.56MB ZIP 举报
温馨提示
TeamTalk是一套开源的企业办公即时通讯软件,作为整套系统的组成部分之一,TTServer为TeamTalk 客户端提供用户登录,消息转发及存储等基础服务。 TTServer主要包含了以下几种服务器: LoginServer (C++): 登录服务器,分配一个负载小的MsgServer给客户端使用 MsgServer (C++): 消息服务器,提供客户端大部分信令处理功能,包括私人聊天、群组
资源推荐
资源详情
资源评论
收起资源包目录
开源TeamTalk(mogutt)未删减代码 (6819个子文件)
0010c7759338baac00a1abea32d4a44d0a2175 138B
06d3dcdd9f76178f0eb42e0f662cbec17e3caa 83B
speexenc.1 2KB
speexdec.1 1KB
105b148f8add3cd9cc821da490b14b46ea332a 54B
118877b14098b0d867a74fe9a5a6f42b74ce04 176B
118c4d9a81a232855e585b4fc9b96093fac6e0 83B
156810c086bd54d98c64fa815f93bd413ae69b 168B
15c108ef3d0fc4cdc9486ba35306ddad68d05b 1KB
15ea11fcd678e6f1852cd6b0da784ddb63bdaf 54B
16987125863be686e7b350290deb007596611b 1KB
17225e76df49a7d7ba70a6f67342dacf46fbaa 502B
18d7c5f15e3d8bfeb4dc644f4937819da6643f 2KB
22bb59117f8e854b106a0d7571d072ed4a02a5 26KB
25642e5fb27c86cc2783800c9c70753c506bed 3KB
2832d38b7f8fee5c682e3609406123e1c113d1 2KB
297aec681e044fe670cba5ba289d54df9eb75e 2KB
2b00ad063b6ff44c94eea118a1b02d80ac2c41 74B
2d627302a62e3df0459b7dfd10ef8f6c0f2930 159B
2f2e6735294958950d304cd3f01457f6d7989b 169B
308e1d060b0c387d452cf4747f89ecb9935851 18B
31a5d836f7a4e50977fede73ccc2f7cb4a4df6 86B
33d42ef61b1d96245c776713a8c540e29adaec 1KB
35ebba9df9791d592f58dd739dcfa212b04ad3 1KB
37016481fd9dbdf0ec0d9145d56358fd71feb2 55B
3a350dd18a807612e8cbb471b2dc7fb360a5bf 54B
3ae76485dd29fea1f2e15076deb7ad629aa015 2KB
3c25cdc158ce446253c638aee8c940f1ff1dc9 83B
3c83132cd312f46f7bfd5470c3bd6067b02233 1KB
3f833d0218b4a2aefb9beac62fa6a90bedd85f 3KB
3ff97d59aef5d00eca1484fbb6aa6d4d76068c 169B
41647e1e97bc2bd9f835e7952f0339ab5f35a9 1KB
45db1bd7139f58f13f1475f6719dc887d75610 169B
46dccfb67da8f25ee37c6d66302ab14712d81d 1KB
4847139f3073b4c9d86f94cda85b7fafceeea9 1KB
4a2882c91483a6996a7f55b169958d0ad117f0 268B
4b1cd24f0bed134fd9cf8b9f9244ee61d70820 54B
5085160d3447c5f4fa482c45cf3386b82f4308 84B
515dc47b0d13ec062c5954e3a87e636f9288c2 83B
51f71a56885a27891fb77c94fafcbf8303b070 3KB
5525fa0dd10f086d5378878f83ccd8aa39fb1a 83B
55fff296d8068385371e85ab448ebec7dca710 2KB
56e651a3fca9a4ea3aa231111721f824ce9d7a 13KB
57d152831af03ecfa81794c01e50edfd7f0064 169B
61ebe3c890dbd4b43610ea74adfaa0d2facbb7 84B
6259187534f52c32ac5fa0608ee255562fdc8d 75B
64bd2ce44dee8d22234f172861faa34aa1a144 2KB
67e6d6ff443852cf2079677948a855bfce9bb0 1KB
688dd6f15c6bb474ea97854ade9fb0f8895b2d 810B
69da0792707e3604072632f77fa9940a4eacbe 167B
6bff0cfa656e7e50e8f4ee68b0c5fcbbd6775a 2KB
716d0b752adf2d18a1ab6ff66391a4ff14fd4d 54B
71d4010fb4e5d0dc6a046247140d46fae0a5d4 204B
740843938743fae48f4499895844a304de96c1 95B
758409cfda2da1570a2c799b505f526b5dbac9 120B
76cdc5ee4fea423f0d178566776656b905ab63 160B
772aeded21f68289967b0827b0bc9d8ec4f9b0 53B
7d265b9a479b5b70fafeadc1d97ae7e3352e5b 2KB
82b8c2b8a890fbc4eaeb386b09c8192a4ec508 169B
8301a0dac1a3e6e15bf80005139cdc0e0e4cd3 44B
84bf42f9a05c384479813e2630cdfd5b6e680c 202B
8680f9380d225626f1364834846d8428729618 232B
86f3ec59a41d6609c40054043c4aec82357fa2 950B
89e28dd467a751169cc0a4a0b99b9548896e2f 170B
8aab604fbe8ae209232cbb709ae3f1edb4e658 54B
8c17d298d8754ed1ed5274f442bf050c73fd21 55B
90f5287f89693495139262206410f339403743 152B
92327d2dab11b5c8b352d780fe0d449be65efa 178B
9295b964961d4e8dbd9fc87dde57415fc69922 270B
929e5332cb454250d3eedbe48dbc4f580e53d3 814B
96e37a3060baa928f851cb1500214d0919ec13 300B
9a62027b91d28a1a9cfe6c3ac8361792d5b74a 227B
9c792964c8ef9ae09eb7a0d74cbfd2188ab2a5 160B
9d323ead822622d6ee714011fdcda42c3f20a6 83B
9de29bb2d1d6434b8b29ae775ad8c2e48c5391 15B
a376c54129349b4c7e7c27f391c5a0a757777c 300B
a3bd863fa7eb14d8fd745cc0a9a4df4d4a18f4 44B
a4b39aa98333b219fa8c43d88443429746e503 643B
a52845b9049304e7535af7d9854e6da71c7b41 3KB
a71fde8001237057fe63bbde75945eb9e44f13 89B
a7ad6baf3380a25e7e239800161f6e103d52a1 44B
a80d5137c79fc80623af4540824d2e7c7d86b6 269B
a930a3096930d689f6e1a8b6f32e054d297e55 1KB
aab68037d9a85fd7d4ce65fbf2052f01ae7068 1KB
ac6c0a6528732a75e8b1ccb342b3aaf814e227 142B
ad325310db9029c9d934c86a277cf6310ab284 222B
Makefile.am 2KB
Makefile.am 2KB
Makefile.am 839B
Makefile.am 667B
Makefile.am 358B
Makefile.am 358B
Makefile.am 223B
Makefile.am 223B
Makefile.am 175B
Makefile.am 73B
Makefile.am 17B
Makefile.am 17B
ANNOUNCE 2KB
AUTHORS 48B
共 6819 条
- 1
- 2
- 3
- 4
- 5
- 6
- 69
lakusasi
- 粉丝: 1
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页