Compare commits
1580 Commits
v1.0.56
...
v1.6.0beta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c06d78468 | ||
|
|
b98681b49a | ||
|
|
53f7051b1b | ||
|
|
d099973c4f | ||
|
|
97a77a6f7b | ||
|
|
b2aba47a6d | ||
|
|
ed3ca0e3eb | ||
|
|
fd043e5d0d | ||
|
|
cc02f89eb2 | ||
|
|
14d0ca620e | ||
|
|
8010217201 | ||
|
|
702053d110 | ||
|
|
74a9c07fdd | ||
|
|
d0eef28ee1 | ||
|
|
3c1f6983c5 | ||
|
|
4a6c6df6c7 | ||
|
|
025d415838 | ||
|
|
810c99583b | ||
|
|
e9567514dd | ||
|
|
b593b3f035 | ||
|
|
0f08665bfb | ||
|
|
3744f94fd1 | ||
|
|
aa9dea57d7 | ||
|
|
ece07cfe9c | ||
|
|
dbb7e19fda | ||
|
|
e2098ba085 | ||
|
|
26849f4693 | ||
|
|
ad5a993954 | ||
|
|
6954141484 | ||
|
|
ba2dd33d9c | ||
|
|
134c5761fa | ||
|
|
865e14fd32 | ||
|
|
5d1df4fdf4 | ||
|
|
8d3453a22d | ||
|
|
4430b91363 | ||
|
|
dff6f4c4f0 | ||
|
|
432c174b64 | ||
|
|
5f5977e708 | ||
|
|
0a9f8eb272 | ||
|
|
cad0150d12 | ||
|
|
ee427ad39a | ||
|
|
01b813000a | ||
|
|
449db5a9c1 | ||
|
|
80b67e47e8 | ||
|
|
0a9f26e219 | ||
|
|
05ed18e7d1 | ||
|
|
edb3523a9b | ||
|
|
46cb5109bd | ||
|
|
5845d3eabd | ||
|
|
4a37149f66 | ||
|
|
fc58b17772 | ||
|
|
96b917056d | ||
|
|
0546e4e579 | ||
|
|
05af5cd8fb | ||
|
|
d630301d99 | ||
|
|
2ec8409046 | ||
|
|
905cc94e3d | ||
|
|
8f424b8270 | ||
|
|
cc46157421 | ||
|
|
14ca47b453 | ||
|
|
b1e7771d5e | ||
|
|
ff7b7ba060 | ||
|
|
1935d0738f | ||
|
|
04c1c078b9 | ||
|
|
8f4d67218e | ||
|
|
15f6fd3492 | ||
|
|
b45416921b | ||
|
|
040575c80b | ||
|
|
43309056ac | ||
|
|
bc2a57f657 | ||
|
|
56f22f4320 | ||
|
|
cd39adb561 | ||
|
|
b4f5c42092 | ||
|
|
e243a1fbd8 | ||
|
|
747b554a86 | ||
|
|
f229d4df3a | ||
|
|
96027d919f | ||
|
|
58f277c18e | ||
|
|
921648a997 | ||
|
|
23a30f8583 | ||
|
|
48015617d3 | ||
|
|
13a87d9682 | ||
|
|
c1217ee280 | ||
|
|
51d1e2be1b | ||
|
|
f7677a348e | ||
|
|
8fbd60ded2 | ||
|
|
b11b31aea2 | ||
|
|
51624965e2 | ||
|
|
ce9d8a3f48 | ||
|
|
eda53e5770 | ||
|
|
2bc76ffaf1 | ||
|
|
66efa24241 | ||
|
|
0c11b5f8e7 | ||
|
|
f5dcba6b9b | ||
|
|
c26d6e9aac | ||
|
|
42ed02ed9a | ||
|
|
31d66245ea | ||
|
|
d9d7a7e8f0 | ||
|
|
d15d124d6d | ||
|
|
dd6ecbe688 | ||
|
|
aa816c4444 | ||
|
|
209b3e4b79 | ||
|
|
f2715a558a | ||
|
|
845ee6af72 | ||
|
|
9ff37ea94f | ||
|
|
35f2e1768b | ||
|
|
945cb1f9be | ||
|
|
71db131882 | ||
|
|
bf7661f01b | ||
|
|
9066919600 | ||
|
|
1ffbe8c7c1 | ||
|
|
8d0215928d | ||
|
|
b5d0051dcb | ||
|
|
6038b80277 | ||
|
|
b57c1c9e6e | ||
|
|
0c98cc7023 | ||
|
|
6225b0e61e | ||
|
|
d072048925 | ||
|
|
7d4fbb2fbb | ||
|
|
42a2b556e9 | ||
|
|
e2ae0f2f2b | ||
|
|
d6cf3a3791 | ||
|
|
e741cd592e | ||
|
|
0ae4f7b705 | ||
|
|
29a6ba01a7 | ||
|
|
434801a39c | ||
|
|
79a141876a | ||
|
|
eeb1bb678d | ||
|
|
8e92cd51c6 | ||
|
|
363387c9c0 | ||
|
|
6f237b6bf0 | ||
|
|
a0ddf0b5f2 | ||
|
|
5541ea8aaf | ||
|
|
cf49919686 | ||
|
|
363ae65e2b | ||
|
|
cb129a6234 | ||
|
|
dee7577330 | ||
|
|
1c25b9b06b | ||
|
|
0a92b23c4b | ||
|
|
5408b613f8 | ||
|
|
b7e32059d3 | ||
|
|
faf38eea03 | ||
|
|
9eb125e927 | ||
|
|
203e6dd7cf | ||
|
|
16bb03b8b4 | ||
|
|
df44c4c4d9 | ||
|
|
4690b89eaa | ||
|
|
10c0693210 | ||
|
|
17ba5de88f | ||
|
|
7d5bf79d88 | ||
|
|
a4badc4b50 | ||
|
|
b0606ea043 | ||
|
|
566fb611b6 | ||
|
|
c737b7cf70 | ||
|
|
67dba43998 | ||
|
|
bce7988230 | ||
|
|
864270e18f | ||
|
|
74df4f1956 | ||
|
|
aa725a375c | ||
|
|
5578c3719e | ||
|
|
ce3c7330ba | ||
|
|
c8348f80d5 | ||
|
|
612d52afce | ||
|
|
3449169622 | ||
|
|
ead660ae1e | ||
|
|
04afaab56a | ||
|
|
781a90b358 | ||
|
|
61d7058b5b | ||
|
|
db6850b389 | ||
|
|
eda298bc01 | ||
|
|
516c9c97a6 | ||
|
|
0d4d0b4d32 | ||
|
|
5bffd6c6d5 | ||
|
|
816ff328d2 | ||
|
|
34dca8f8e8 | ||
|
|
3167541570 | ||
|
|
6437604a5e | ||
|
|
2dd49fbeae | ||
|
|
f1c0678c16 | ||
|
|
42369ccd85 | ||
|
|
572b078d8c | ||
|
|
40ca77a721 | ||
|
|
05cbe5ae28 | ||
|
|
5cdff4144e | ||
|
|
feecc898d9 | ||
|
|
3a1d63dc69 | ||
|
|
573a51143a | ||
|
|
6690011811 | ||
|
|
dde1f98626 | ||
|
|
aaf1179ec1 | ||
|
|
e044649282 | ||
|
|
a23f3dbcb6 | ||
|
|
a12d2328b4 | ||
|
|
95a8a665e4 | ||
|
|
da2194c0d5 | ||
|
|
1eb2c48458 | ||
|
|
8fb6c6a9b3 | ||
|
|
9c7f99c9cb | ||
|
|
99c7ad2904 | ||
|
|
e7b4d26ec1 | ||
|
|
c35f888c46 | ||
|
|
5635573cfc | ||
|
|
fea2a877c8 | ||
|
|
5bc90389bf | ||
|
|
2312167d51 | ||
|
|
edbcd02133 | ||
|
|
04336ba10f | ||
|
|
da1c5ca65a | ||
|
|
00c6a9a62c | ||
|
|
665031e834 | ||
|
|
0501c1c570 | ||
|
|
1531bd61a0 | ||
|
|
d9fc0622a1 | ||
|
|
6e4184249c | ||
|
|
04ab33560f | ||
|
|
0522f269e0 | ||
|
|
fcd301daed | ||
|
|
4f67e40898 | ||
|
|
f87ef8bcb5 | ||
|
|
a5bf4e3767 | ||
|
|
5d56786eff | ||
|
|
d7c22fb7ec | ||
|
|
939310bac1 | ||
|
|
29fca0d497 | ||
|
|
df477e4652 | ||
|
|
5a956a7a58 | ||
|
|
67ee8cee39 | ||
|
|
28d9339777 | ||
|
|
bc79d70965 | ||
|
|
40b2603687 | ||
|
|
ad41b8838a | ||
|
|
1d7f56ab64 | ||
|
|
3c1c95399b | ||
|
|
d332c67da7 | ||
|
|
b74fb4e49c | ||
|
|
a6f369b150 | ||
|
|
13831bc06e | ||
|
|
adf049e435 | ||
|
|
681c1fc02a | ||
|
|
ba6fbc57ba | ||
|
|
d1dceee2f7 | ||
|
|
94531034cc | ||
|
|
751a93f3ec | ||
|
|
0b3634bcc4 | ||
|
|
efaeadaa86 | ||
|
|
c4f94cbd08 | ||
|
|
26aad85204 | ||
|
|
c4081f05c8 | ||
|
|
eb26ee6602 | ||
|
|
90a87c8853 | ||
|
|
12924f33bd | ||
|
|
ec6d6fa51b | ||
|
|
1f0eaa046c | ||
|
|
6bdefdd977 | ||
|
|
405a398b3e | ||
|
|
8888ea4479 | ||
|
|
0b26ac5dee | ||
|
|
414769b415 | ||
|
|
5e934ba900 | ||
|
|
b72bc15e22 | ||
|
|
4c7e8208b6 | ||
|
|
baeb6d1e92 | ||
|
|
2ddb252d07 | ||
|
|
7455cbf47e | ||
|
|
87fadd5eee | ||
|
|
5b79cd52f4 | ||
|
|
36082cffcd | ||
|
|
e1bb124baa | ||
|
|
15ea1fa337 | ||
|
|
12fb29f951 | ||
|
|
8500b7720b | ||
|
|
e7ad104ac3 | ||
|
|
3b1f03084e | ||
|
|
680da02ade | ||
|
|
8e83631361 | ||
|
|
8501129c17 | ||
|
|
3706d730d1 | ||
|
|
925a60278e | ||
|
|
29fca795b9 | ||
|
|
bd2fa5def6 | ||
|
|
36251d3f76 | ||
|
|
d92c1fcd55 | ||
|
|
4af7710f94 | ||
|
|
7e97c182a8 | ||
|
|
e0bcbfd0fd | ||
|
|
17878c6e65 | ||
|
|
7006dc4c6a | ||
|
|
c4253c4683 | ||
|
|
4fa96a42f7 | ||
|
|
c2d8399581 | ||
|
|
18c5cfafeb | ||
|
|
36f5884359 | ||
|
|
e7acc6ac3d | ||
|
|
76b0459fdd | ||
|
|
ae41dc55a2 | ||
|
|
45bb9a62ba | ||
|
|
89c2f84287 | ||
|
|
ed9f84475d | ||
|
|
1eb188932b | ||
|
|
8596468e51 | ||
|
|
c32de8c64d | ||
|
|
6d8e090419 | ||
|
|
816e687de8 | ||
|
|
0a521d3785 | ||
|
|
d3feb52955 | ||
|
|
65f3ac192b | ||
|
|
4be12aa1e3 | ||
|
|
84b0da9c94 | ||
|
|
e6fb691c49 | ||
|
|
d4973837b2 | ||
|
|
dd81915d5b | ||
|
|
3615d03e05 | ||
|
|
e0a6c06bfd | ||
|
|
efc4b69767 | ||
|
|
7875d534cb | ||
|
|
92a1d46c8d | ||
|
|
7de02e722f | ||
|
|
61bd4f76ad | ||
|
|
8b67ee5d3d | ||
|
|
fc45f68623 | ||
|
|
a004e23a4c | ||
|
|
88bcdc269b | ||
|
|
aad7c828b2 | ||
|
|
5a9aca17df | ||
|
|
55e85c24b4 | ||
|
|
fcc0263191 | ||
|
|
1d8b75550f | ||
|
|
aff44028ba | ||
|
|
6d7705eedf | ||
|
|
d3a94802d8 | ||
|
|
2b7d730e27 | ||
|
|
bc6726bc04 | ||
|
|
1876366b17 | ||
|
|
c94b996af8 | ||
|
|
0e9f8ced1e | ||
|
|
7342fcaf92 | ||
|
|
92ef313c77 | ||
|
|
cb75699dff | ||
|
|
122a525c83 | ||
|
|
5e823c1fd5 | ||
|
|
8db19980fa | ||
|
|
ef02d563a3 | ||
|
|
b2068640d1 | ||
|
|
93254f66fc | ||
|
|
52093f1776 | ||
|
|
0654d63196 | ||
|
|
4e8aa822dc | ||
|
|
1c42276a39 | ||
|
|
c9e27d026d | ||
|
|
e7db181e5d | ||
|
|
f5c5e53bf5 | ||
|
|
ecb3ad035a | ||
|
|
fb5b3ac013 | ||
|
|
5b84901c55 | ||
|
|
57cbcf6b8f | ||
|
|
07772cba07 | ||
|
|
5c1905caae | ||
|
|
d58251b47e | ||
|
|
d3dcb463d6 | ||
|
|
3dbfd300ff | ||
|
|
ff36991ca2 | ||
|
|
5b3b54e3f6 | ||
|
|
ba55c0770b | ||
|
|
4e68aa7e40 | ||
|
|
76b62317b5 | ||
|
|
4dd0dc6399 | ||
|
|
8be28e3eb6 | ||
|
|
ac8375d000 | ||
|
|
65c0339b5c | ||
|
|
4daae30174 | ||
|
|
d5bc89ef11 | ||
|
|
fa7d7934f6 | ||
|
|
a92a212925 | ||
|
|
435cf87469 | ||
|
|
e51916c0f9 | ||
|
|
997b193f63 | ||
|
|
e29c4b9b93 | ||
|
|
8e25a61277 | ||
|
|
f573ff7792 | ||
|
|
1a16735ce7 | ||
|
|
d02d6a1c7d | ||
|
|
968c231cc8 | ||
|
|
bb5cb1476b | ||
|
|
115020d985 | ||
|
|
3e2263abf2 | ||
|
|
d71f09df4d | ||
|
|
0a456b5d16 | ||
|
|
d3261115a8 | ||
|
|
673a1166fe | ||
|
|
853afe631c | ||
|
|
fe85bafedf | ||
|
|
751561218f | ||
|
|
f0c19e6455 | ||
|
|
ccff383d44 | ||
|
|
f3f7e14727 | ||
|
|
3c2ae60f46 | ||
|
|
95ba417c82 | ||
|
|
b6e4d58e4b | ||
|
|
ef43c17bfe | ||
|
|
ad8b7b71b4 | ||
|
|
83bd94f1f4 | ||
|
|
63071acbd9 | ||
|
|
44271398bd | ||
|
|
90cd362a87 | ||
|
|
b293334e7a | ||
|
|
4ae297867d | ||
|
|
ec3ff78f70 | ||
|
|
6d62ef108a | ||
|
|
b6874f8062 | ||
|
|
8b8aacde83 | ||
|
|
bbd17bd7c4 | ||
|
|
b5cebba675 | ||
|
|
736f40f459 | ||
|
|
0c03fc6f75 | ||
|
|
e61e403d20 | ||
|
|
9d824eb166 | ||
|
|
75d5bfda5b | ||
|
|
9b979b177b | ||
|
|
7b9796539d | ||
|
|
0bc79772c8 | ||
|
|
a45ffbefb9 | ||
|
|
99ffac0838 | ||
|
|
6c98897a64 | ||
|
|
b17c75b222 | ||
|
|
d4e1ddb631 | ||
|
|
aab2aa196d | ||
|
|
03d6b482b5 | ||
|
|
4dcce66295 | ||
|
|
7a28724e6b | ||
|
|
a5bcab7854 | ||
|
|
0a007b743e | ||
|
|
e9ef47f69e | ||
|
|
0532aca928 | ||
|
|
5a77e672e1 | ||
|
|
c2891d0011 | ||
|
|
25e0f55586 | ||
|
|
ce775cc851 | ||
|
|
d0797f5b53 | ||
|
|
a5e5547679 | ||
|
|
4164c6f949 | ||
|
|
4b2237a6a4 | ||
|
|
cb47e20509 | ||
|
|
d3a0b23c1b | ||
|
|
ab38979670 | ||
|
|
628b632419 | ||
|
|
d404b6d488 | ||
|
|
38404a5996 | ||
|
|
05fc4ccd30 | ||
|
|
78bb9dafe1 | ||
|
|
4fca25504e | ||
|
|
9daf91ed5c | ||
|
|
fcd7c13ffd | ||
|
|
5bcd0a8c14 | ||
|
|
8d261262d9 | ||
|
|
c4a8214b77 | ||
|
|
4e47be74e9 | ||
|
|
314ef3e72b | ||
|
|
aee83b43d6 | ||
|
|
9a1e2232ba | ||
|
|
6da2f2d92a | ||
|
|
24145c8869 | ||
|
|
e6a8060a71 | ||
|
|
98f053edbd | ||
|
|
581d29d4c9 | ||
|
|
66b942ce16 | ||
|
|
86cf9b2e89 | ||
|
|
fb29e51dbd | ||
|
|
ab63dd0892 | ||
|
|
a7428d443c | ||
|
|
857dbbe7cc | ||
|
|
3fb7c07ea5 | ||
|
|
60d7c022e5 | ||
|
|
850769f787 | ||
|
|
5f0b9276ec | ||
|
|
733b131545 | ||
|
|
ef217b76a3 | ||
|
|
b0791f75ad | ||
|
|
039ad872fe | ||
|
|
903c64dce8 | ||
|
|
8f4edd07be | ||
|
|
be720edba7 | ||
|
|
140504b11a | ||
|
|
cd3b0cc4d9 | ||
|
|
06a9684cfa | ||
|
|
45599ad00f | ||
|
|
677819fe66 | ||
|
|
2232baa41b | ||
|
|
7dffa41643 | ||
|
|
550bab03fb | ||
|
|
413138a5ca | ||
|
|
74945f2f04 | ||
|
|
97039baa88 | ||
|
|
fd73d04515 | ||
|
|
141d9e3c20 | ||
|
|
0cb906d804 | ||
|
|
b704036531 | ||
|
|
6f55ee2ec5 | ||
|
|
6a1dc2329a | ||
|
|
59a6c379dd | ||
|
|
d2f0bc2d13 | ||
|
|
b011fe1c12 | ||
|
|
0eadc27cd6 | ||
|
|
700c55036c | ||
|
|
b2bee3374c | ||
|
|
cc2770850a | ||
|
|
fb27873021 | ||
|
|
590fb8c481 | ||
|
|
4e8d7ec5fc | ||
|
|
254a513fd1 | ||
|
|
ab1a573768 | ||
|
|
38a9d2763c | ||
|
|
07e1d34a84 | ||
|
|
36edbb5eee | ||
|
|
3fceee058f | ||
|
|
0640cc3d3a | ||
|
|
3f68453d4a | ||
|
|
0a048923ae | ||
|
|
5441e18988 | ||
|
|
db0ed3e62d | ||
|
|
8a7ec52c8b | ||
|
|
66e1b3abba | ||
|
|
cd116fa248 | ||
|
|
c261077788 | ||
|
|
55fbff358a | ||
|
|
1921e6db90 | ||
|
|
bb4f77cd95 | ||
|
|
5ca62c9f35 | ||
|
|
1591a4c9dc | ||
|
|
c36074e85a | ||
|
|
73904f52b4 | ||
|
|
0e128dfa2f | ||
|
|
9994f25733 | ||
|
|
593fc04096 | ||
|
|
cb0b29631f | ||
|
|
ed4d32baa4 | ||
|
|
d83530f45d | ||
|
|
cb3f42123f | ||
|
|
36fa2a0abd | ||
|
|
2d3fc1ca3b | ||
|
|
f70c7d02e9 | ||
|
|
d768d103cf | ||
|
|
44e26d4149 | ||
|
|
96cec0e1a3 | ||
|
|
a9b34191ae | ||
|
|
e9eeb743cb | ||
|
|
8ba34667a1 | ||
|
|
87952f0623 | ||
|
|
d12c02f020 | ||
|
|
f3d737dad1 | ||
|
|
492ef9c964 | ||
|
|
c7822514cc | ||
|
|
d273ad2d0f | ||
|
|
af855e415d | ||
|
|
6ee0edf880 | ||
|
|
00015a81dd | ||
|
|
e1018a5bbb | ||
|
|
c5bef946b1 | ||
|
|
c559bb58ed | ||
|
|
4753906826 | ||
|
|
88b77cc6f3 | ||
|
|
b3b7168077 | ||
|
|
1384c048e4 | ||
|
|
24fde6e00f | ||
|
|
33ced44f9e | ||
|
|
e6dc85bb0b | ||
|
|
20786be695 | ||
|
|
99778e17af | ||
|
|
cf78aee1c4 | ||
|
|
6cd31bbfce | ||
|
|
4bc9f8472c | ||
|
|
4a12f4a22a | ||
|
|
a1f9426399 | ||
|
|
9f1cd70774 | ||
|
|
d2795b7909 | ||
|
|
b75b24103d | ||
|
|
cb1aee2506 | ||
|
|
8d4ce1fed5 | ||
|
|
7abc130a81 | ||
|
|
5adc5a2ff8 | ||
|
|
b302c4721a | ||
|
|
537c146082 | ||
|
|
b6743ea08e | ||
|
|
61365b6d15 | ||
|
|
1b491cbda0 | ||
|
|
8abcf141fa | ||
|
|
b8e314072f | ||
|
|
6785856858 | ||
|
|
e99107b1aa | ||
|
|
f30f0e04e3 | ||
|
|
c3b3240a03 | ||
|
|
65a24d0638 | ||
|
|
a45f47c225 | ||
|
|
c683100e31 | ||
|
|
ec8296ab81 | ||
|
|
bdb0130aea | ||
|
|
5975f31ff0 | ||
|
|
205483d592 | ||
|
|
3bb8683a79 | ||
|
|
bef60dc624 | ||
|
|
8eb8833b74 | ||
|
|
b0525f83e1 | ||
|
|
ee1369b853 | ||
|
|
ea0c7b699e | ||
|
|
f83783115f | ||
|
|
ed8aab4d85 | ||
|
|
6bdea98992 | ||
|
|
4a392c74cf | ||
|
|
1ecd786d95 | ||
|
|
1345cbeea8 | ||
|
|
ab23d34dd9 | ||
|
|
907333884f | ||
|
|
6b3d50b2cd | ||
|
|
dcc3505c7b | ||
|
|
0d00d83ef0 | ||
|
|
47dc5f7b54 | ||
|
|
f2598a8b60 | ||
|
|
80de04e560 | ||
|
|
77fd083041 | ||
|
|
22b9a84314 | ||
|
|
f27592a0cd | ||
|
|
3f2339b551 | ||
|
|
eceff8b3c3 | ||
|
|
f3dd1cc51e | ||
|
|
d32a671dff | ||
|
|
ffc9e9503d | ||
|
|
38734eeb45 | ||
|
|
41b1ffdf36 | ||
|
|
eb7d7955e5 | ||
|
|
4411742328 | ||
|
|
7c969f347f | ||
|
|
d08b6bdbf7 | ||
|
|
0b5b4b456c | ||
|
|
1faed9c234 | ||
|
|
59010e53f4 | ||
|
|
cd11345693 | ||
|
|
9616ad9828 | ||
|
|
8ea598b1d1 | ||
|
|
93215674db | ||
|
|
67703b11fe | ||
|
|
a3791aabaa | ||
|
|
cad6798a8c | ||
|
|
c85f5f6db0 | ||
|
|
c36bb79352 | ||
|
|
63d059ab0b | ||
|
|
3aa94d69fb | ||
|
|
4d56296443 | ||
|
|
9b872f4cf9 | ||
|
|
5432c01ffd | ||
|
|
9c69360e97 | ||
|
|
6a6d79fc00 | ||
|
|
c83d421d9e | ||
|
|
2438825d77 | ||
|
|
a257f80d95 | ||
|
|
973c493e1b | ||
|
|
58bd925acc | ||
|
|
8625b394b5 | ||
|
|
47a007a945 | ||
|
|
3d3aae1697 | ||
|
|
2506e53400 | ||
|
|
25d2d47f86 | ||
|
|
4c0eaee5c6 | ||
|
|
cbbe9a5c01 | ||
|
|
7ccc2daf09 | ||
|
|
ef123cc005 | ||
|
|
254670338e | ||
|
|
bf3293a3cb | ||
|
|
4e7c47fb73 | ||
|
|
afea7d19e0 | ||
|
|
fca50dfab3 | ||
|
|
4e2e14addf | ||
|
|
0e15da5b94 | ||
|
|
2774238722 | ||
|
|
0012e9cd54 | ||
|
|
8d0bc0f026 | ||
|
|
81ce889435 | ||
|
|
135d17ce3e | ||
|
|
9962b84659 | ||
|
|
b0b058b767 | ||
|
|
f21a0d0eee | ||
|
|
d52cd11ed2 | ||
|
|
3bd489d315 | ||
|
|
cbabd9c7e1 | ||
|
|
f19abd6725 | ||
|
|
0a5c9c02fa | ||
|
|
155ce40218 | ||
|
|
71a10f2ca1 | ||
|
|
a861ed971e | ||
|
|
bb98bcba91 | ||
|
|
adaffe7761 | ||
|
|
cf7cce6da5 | ||
|
|
aa23159209 | ||
|
|
c63409b078 | ||
|
|
eac893b60b | ||
|
|
a63dbedead | ||
|
|
5c5db5a55f | ||
|
|
7bc25013f0 | ||
|
|
b86b4928d6 | ||
|
|
2cb633b915 | ||
|
|
47457a01f7 | ||
|
|
77c3bf17ca | ||
|
|
168a433352 | ||
|
|
1408c2afeb | ||
|
|
c9ae31c23a | ||
|
|
2ca8490a32 | ||
|
|
2368a92b2d | ||
|
|
498d19243c | ||
|
|
27bf8986f9 | ||
|
|
e03dd5bd64 | ||
|
|
5acd8fe9cb | ||
|
|
e2062f9fa0 | ||
|
|
9f45c8e6e1 | ||
|
|
00879b155a | ||
|
|
366eb49f99 | ||
|
|
4a5a1ec0b4 | ||
|
|
f3c51e4a28 | ||
|
|
b764c60a12 | ||
|
|
62e956e1dd | ||
|
|
d3edb3f27c | ||
|
|
e15a96b333 | ||
|
|
3200e1e088 | ||
|
|
033155ca21 | ||
|
|
e8edb5a809 | ||
|
|
4e230b087e | ||
|
|
a96117f52c | ||
|
|
fff1093227 | ||
|
|
9d23b40c24 | ||
|
|
5c92dec542 | ||
|
|
9dd1cdff66 | ||
|
|
20788d3b90 | ||
|
|
512cbf8ade | ||
|
|
59fa3e920c | ||
|
|
f5ea1b7095 | ||
|
|
64b863cd2a | ||
|
|
a7d604e681 | ||
|
|
977f6eba3d | ||
|
|
8f8061adba | ||
|
|
8409b8f6db | ||
|
|
f2e2833f28 | ||
|
|
332594dd06 | ||
|
|
7de3260017 | ||
|
|
e06092a24e | ||
|
|
57731529dc | ||
|
|
9830f98ff9 | ||
|
|
5aff745c15 | ||
|
|
3af77feaa3 | ||
|
|
fd20a5ae9b | ||
|
|
d3b76572c7 | ||
|
|
6e97410f66 | ||
|
|
b2888db940 | ||
|
|
56a739bf4e | ||
|
|
8f6628ed9f | ||
|
|
660c6e4d70 | ||
|
|
4c93a7cb6f | ||
|
|
9a462393e4 | ||
|
|
138142583e | ||
|
|
571db950d1 | ||
|
|
15c9be10b3 | ||
|
|
d5e3590df7 | ||
|
|
b54498edea | ||
|
|
ba851ccd9f | ||
|
|
6f1af78401 | ||
|
|
798b1613ab | ||
|
|
9fa9ebebc0 | ||
|
|
6735058024 | ||
|
|
9f044c17fa | ||
|
|
d02f246887 | ||
|
|
f1cf90238b | ||
|
|
845b74e6d4 | ||
|
|
e24196eeeb | ||
|
|
234e543afb | ||
|
|
49a56e7688 | ||
|
|
5f59c87604 | ||
|
|
23d3970929 | ||
|
|
27df3a44eb | ||
|
|
a451725242 | ||
|
|
d546f4399f | ||
|
|
38ef3a592c | ||
|
|
caed8f30ee | ||
|
|
2fe7f06a55 | ||
|
|
5b40b01319 | ||
|
|
b93e0326d2 | ||
|
|
2776d5e9e6 | ||
|
|
c3ed437d9e | ||
|
|
b3edc73afa | ||
|
|
105c416007 | ||
|
|
a581556b17 | ||
|
|
d801b3882c | ||
|
|
ed3dfbd25a | ||
|
|
ccadcae40b | ||
|
|
33893095b5 | ||
|
|
5c5f593ffb | ||
|
|
62333ba0cb | ||
|
|
c508081afc | ||
|
|
71c0dd6c4a | ||
|
|
63495a4ba4 | ||
|
|
475074dfb5 | ||
|
|
557b256b32 | ||
|
|
48854aec52 | ||
|
|
f3abb2c352 | ||
|
|
88910f5b9d | ||
|
|
a60f8a9c1f | ||
|
|
10973a581f | ||
|
|
a655407f1b | ||
|
|
a9b4f16b04 | ||
|
|
6612114f86 | ||
|
|
66676016f6 | ||
|
|
e5900f1bc9 | ||
|
|
85497d7a4b | ||
|
|
5393915bf6 | ||
|
|
f197d6d0f6 | ||
|
|
4fa1816cf6 | ||
|
|
1c91ab2586 | ||
|
|
f0eda4e8d7 | ||
|
|
a0de64f3c3 | ||
|
|
7e1fabe2f7 | ||
|
|
79b2d64a67 | ||
|
|
e34f80e5aa | ||
|
|
bc363eca41 | ||
|
|
d233287325 | ||
|
|
c127057f7d | ||
|
|
9a75d99438 | ||
|
|
e9c395a3bf | ||
|
|
4f5b846bb4 | ||
|
|
79bdad205f | ||
|
|
94b582e45e | ||
|
|
1b49a71df4 | ||
|
|
209eee579a | ||
|
|
83b4fc4af4 | ||
|
|
b0876110ca | ||
|
|
110c9367bd | ||
|
|
bab8df881a | ||
|
|
e89d33ab3d | ||
|
|
0c3fea306a | ||
|
|
a2218a4b6d | ||
|
|
4f8e7e5f41 | ||
|
|
e197cded79 | ||
|
|
bcb3aac3c5 | ||
|
|
9a5c1c180f | ||
|
|
39515c9ee0 | ||
|
|
8ca1700976 | ||
|
|
fded04fbf6 | ||
|
|
9c69091c9d | ||
|
|
4554a54a6c | ||
|
|
8c69d7bc63 | ||
|
|
0c57414490 | ||
|
|
2f70282295 | ||
|
|
55f71781d8 | ||
|
|
925d23b32a | ||
|
|
4e4876104d | ||
|
|
0717029581 | ||
|
|
a774c5de84 | ||
|
|
a041ae4cde | ||
|
|
7d3e6732fb | ||
|
|
07d9fc9478 | ||
|
|
be6f0c2c50 | ||
|
|
a7119547e2 | ||
|
|
c97cf70bc7 | ||
|
|
4f108d8af6 | ||
|
|
f45a345adb | ||
|
|
54872297d3 | ||
|
|
8c66786419 | ||
|
|
15333cd28d | ||
|
|
b5b38edf30 | ||
|
|
9b362b1e4f | ||
|
|
4befef0c18 | ||
|
|
438b3caedb | ||
|
|
9b780b8add | ||
|
|
0f21161e51 | ||
|
|
db712a93b4 | ||
|
|
f18a0ed39b | ||
|
|
92ac4fc237 | ||
|
|
21af4cc914 | ||
|
|
949d46c7ba | ||
|
|
921d91576a | ||
|
|
8c037305e4 | ||
|
|
a7866f7b95 | ||
|
|
b5a53da717 | ||
|
|
c08cae1c22 | ||
|
|
4aa2cd69ae | ||
|
|
3b5d695583 | ||
|
|
67439c4701 | ||
|
|
a313751258 | ||
|
|
11966d9c55 | ||
|
|
ea2f7e07d7 | ||
|
|
e600c51355 | ||
|
|
21b4b339d9 | ||
|
|
7de0534490 | ||
|
|
70c8d32f2e | ||
|
|
08c2e81ac2 | ||
|
|
2a718a3f53 | ||
|
|
363f96e717 | ||
|
|
9f65059a5b | ||
|
|
b757b1b5ee | ||
|
|
a85264b1fc | ||
|
|
ad18363852 | ||
|
|
836fe66e24 | ||
|
|
d4028b4373 | ||
|
|
d3a726db0d | ||
|
|
3e71719502 | ||
|
|
2c700f970c | ||
|
|
77396b63f9 | ||
|
|
21c1f06ef9 | ||
|
|
3df324d845 | ||
|
|
c27291d4e3 | ||
|
|
bdabd8f75b | ||
|
|
48dc6ebf5c | ||
|
|
4009a76e97 | ||
|
|
459432a1b8 | ||
|
|
33d8c2a1dd | ||
|
|
4eb18e9ca2 | ||
|
|
dd80757941 | ||
|
|
b4e6997999 | ||
|
|
53c7502663 | ||
|
|
1e7d7d3cbf | ||
|
|
7b81e2e747 | ||
|
|
f3d53796af | ||
|
|
0fb715a904 | ||
|
|
233357ef0e | ||
|
|
b9109e8254 | ||
|
|
6679d7c0b1 | ||
|
|
dbe0c9d8c7 | ||
|
|
f01459fd40 | ||
|
|
11a5687b72 | ||
|
|
6c47e84d2e | ||
|
|
2be8b64af2 | ||
|
|
a7a76a674f | ||
|
|
29034c5076 | ||
|
|
31aee0d0c0 | ||
|
|
d7aa6aa916 | ||
|
|
915bab5fc7 | ||
|
|
5fd46fb8f7 | ||
|
|
c182d55fc5 | ||
|
|
11a6f58528 | ||
|
|
d9d4cecaad | ||
|
|
f1202087f8 | ||
|
|
39a8bb71d3 | ||
|
|
0ee51445f6 | ||
|
|
8f9de7acbd | ||
|
|
aa4e359f62 | ||
|
|
289500ab8d | ||
|
|
73e28ef13d | ||
|
|
6cac43c974 | ||
|
|
82980f31d9 | ||
|
|
a691ca0f85 | ||
|
|
a42edec9ef | ||
|
|
a272d8fe3d | ||
|
|
a81c59a960 | ||
|
|
4db344230d | ||
|
|
821b7106b2 | ||
|
|
ef3831a1fe | ||
|
|
5feb87cd0e | ||
|
|
57d9617964 | ||
|
|
78d55454aa | ||
|
|
5b3d554e1e | ||
|
|
53c07f5909 | ||
|
|
537c1a5747 | ||
|
|
f24daf23a5 | ||
|
|
198d836483 | ||
|
|
d05f3728de | ||
|
|
2b8bef1d15 | ||
|
|
98914f74bf | ||
|
|
aa3143cf6f | ||
|
|
1f1becf87f | ||
|
|
259f12628e | ||
|
|
b621794ed5 | ||
|
|
a0b0d8b9db | ||
|
|
f10fa3c9f4 | ||
|
|
4a4de1899a | ||
|
|
cf2fd3b6ca | ||
|
|
1ce8133282 | ||
|
|
5905484c75 | ||
|
|
cb096a4f05 | ||
|
|
b7e1abe25c | ||
|
|
d24a6b5fd0 | ||
|
|
e3e8f6bf02 | ||
|
|
cd74549840 | ||
|
|
34713ce23c | ||
|
|
bb317fb0b2 | ||
|
|
deec549d9f | ||
|
|
d026f9cce6 | ||
|
|
cd01d222fb | ||
|
|
9c5beb56e3 | ||
|
|
810c2e6077 | ||
|
|
d35b878b5e | ||
|
|
5a36a3379b | ||
|
|
1ebd001fb4 | ||
|
|
18b897da9c | ||
|
|
d3bb6bb5c1 | ||
|
|
25ea204b1b | ||
|
|
7b52087998 | ||
|
|
b56e0d06f9 | ||
|
|
304a1a1754 | ||
|
|
9ee577c7f5 | ||
|
|
c3d73f4da9 | ||
|
|
1ff571914c | ||
|
|
40f7bcc3c0 | ||
|
|
9e023307b9 | ||
|
|
8b1b1219e5 | ||
|
|
5623f781bc | ||
|
|
7efdbaf320 | ||
|
|
98eb24c726 | ||
|
|
8bdfb47d8c | ||
|
|
aecef098f9 | ||
|
|
8c065ddbe6 | ||
|
|
6ff9ec81c5 | ||
|
|
9d976c0ef1 | ||
|
|
8fc3604418 | ||
|
|
bb6d66e8ef | ||
|
|
114f675bd7 | ||
|
|
c9cd65ad7a | ||
|
|
8027fed7d1 | ||
|
|
f90165b452 | ||
|
|
5e69cd2c14 | ||
|
|
5eb5cce173 | ||
|
|
725314432d | ||
|
|
98b4f0032b | ||
|
|
294e380438 | ||
|
|
862cb20ea6 | ||
|
|
3cd7cffd0c | ||
|
|
0f0a19e9ce | ||
|
|
6098807252 | ||
|
|
54ac9a918e | ||
|
|
f136155383 | ||
|
|
c2fa196d14 | ||
|
|
3e42a99cf5 | ||
|
|
92a3ef4a14 | ||
|
|
946c3f985f | ||
|
|
dd78d526d0 | ||
|
|
9ba962665d | ||
|
|
844a3c050c | ||
|
|
b07e8568ee | ||
|
|
b2eacd3e1f | ||
|
|
7e597910fd | ||
|
|
4c8f7269ff | ||
|
|
8069aeb88e | ||
|
|
c551c0dbb3 | ||
|
|
b92e2f7335 | ||
|
|
42928551cf | ||
|
|
53198fb8b1 | ||
|
|
4a215541e7 | ||
|
|
d00bbb29b8 | ||
|
|
2bc7abfaca | ||
|
|
882340c959 | ||
|
|
c44253fa0c | ||
|
|
d7da8bb121 | ||
|
|
1a0e1d27e4 | ||
|
|
a528fba7aa | ||
|
|
eae8e36ec4 | ||
|
|
69dd5f56f8 | ||
|
|
300c8aea4d | ||
|
|
d0e35cdb53 | ||
|
|
526a6ad5f6 | ||
|
|
2f7cbabfda | ||
|
|
c6fecfbaa5 | ||
|
|
632a84eff7 | ||
|
|
31f92b0ffa | ||
|
|
f70645c592 | ||
|
|
dc6182a307 | ||
|
|
f2c99bd5dc | ||
|
|
afa999d446 | ||
|
|
3919f23a69 | ||
|
|
c957b6b0a4 | ||
|
|
86f88ddd53 | ||
|
|
c17c957f95 | ||
|
|
c3cd22b404 | ||
|
|
b709c4aedc | ||
|
|
aaf377c874 | ||
|
|
e4c706af54 | ||
|
|
6f6a91a131 | ||
|
|
e8b1aa0c5a | ||
|
|
d4df36c7f0 | ||
|
|
a565f0e234 | ||
|
|
72cda2db72 | ||
|
|
16908a1d78 | ||
|
|
da30135c4c | ||
|
|
45624d6c2c | ||
|
|
4e763f1b30 | ||
|
|
7fb32a8621 | ||
|
|
3ea36758ef | ||
|
|
262d0ff047 | ||
|
|
65a223794a | ||
|
|
6c2e919c7e | ||
|
|
d259e6c570 | ||
|
|
4531ded5c1 | ||
|
|
95ca51b6e2 | ||
|
|
a24fc2e1d3 | ||
|
|
69e238b098 | ||
|
|
64af5394f5 | ||
|
|
1beadafcc7 | ||
|
|
81dab093fc | ||
|
|
6a9e480512 | ||
|
|
f98726ae98 | ||
|
|
946199e8e4 | ||
|
|
cce6521a9f | ||
|
|
63ee896ab5 | ||
|
|
9e966cadbd | ||
|
|
7a5be53631 | ||
|
|
6e283234c9 | ||
|
|
288ea702f2 | ||
|
|
ee4eb9a910 | ||
|
|
9d51afcacb | ||
|
|
389c1f20ad | ||
|
|
4748a3346e | ||
|
|
9b0956fed1 | ||
|
|
7d1f5914e5 | ||
|
|
2f84504413 | ||
|
|
42f93fb706 | ||
|
|
f97953181a | ||
|
|
3f506b788e | ||
|
|
db5f4307ca | ||
|
|
b9a78bedee | ||
|
|
f0cdbe7e03 | ||
|
|
42c4ebbea6 | ||
|
|
f1eb918dc8 | ||
|
|
3c6df196b5 | ||
|
|
0014f3de55 | ||
|
|
e00ed36d71 | ||
|
|
c40df89cef | ||
|
|
e3f3c4ea0b | ||
|
|
67a83db98d | ||
|
|
a0e0c6c8e7 | ||
|
|
a58818a079 | ||
|
|
e69b55d9ac | ||
|
|
a515d3066e | ||
|
|
45af819322 | ||
|
|
f81b50bf9d | ||
|
|
e52c7ac7a3 | ||
|
|
5ce838be40 | ||
|
|
a687af1e72 | ||
|
|
70529c3b40 | ||
|
|
dbcfb7151f | ||
|
|
6ba9088de9 | ||
|
|
7520224a42 | ||
|
|
296f64a43e | ||
|
|
d44e05a363 | ||
|
|
5265c3889c | ||
|
|
62ca98ef5e | ||
|
|
094340d287 | ||
|
|
addb84b1bc | ||
|
|
ffa8924330 | ||
|
|
0452bbcf84 | ||
|
|
7a59e1eae8 | ||
|
|
3da965ce4b | ||
|
|
f633e33632 | ||
|
|
914a7e3d4f | ||
|
|
d84af669dc | ||
|
|
451fd6c439 | ||
|
|
316152fe73 | ||
|
|
03f9b02953 | ||
|
|
ce96c3e6b7 | ||
|
|
133840ba4b | ||
|
|
e4b9fc28de | ||
|
|
5876b850b2 | ||
|
|
4cfdb3c095 | ||
|
|
b2154ccb2b | ||
|
|
5a2015e146 | ||
|
|
d23f2b2845 | ||
|
|
9d172423df | ||
|
|
ec29c6507b | ||
|
|
768429bbc1 | ||
|
|
2a087220dd | ||
|
|
bbd20f0a74 | ||
|
|
eae2cf0add | ||
|
|
ae3a70351c | ||
|
|
52f4f257c9 | ||
|
|
931400bd04 | ||
|
|
1e6ed7364b | ||
|
|
4a72ebfafa | ||
|
|
f4ea22480a | ||
|
|
eddc5af8f5 | ||
|
|
edcd6e14c6 | ||
|
|
311c8476f8 | ||
|
|
e5403da657 | ||
|
|
a7eda24870 | ||
|
|
bda72552bf | ||
|
|
a02188ae94 | ||
|
|
5b7d8ff306 | ||
|
|
cd7d63a805 | ||
|
|
9d27a1becf | ||
|
|
c00408a4e5 | ||
|
|
bb0f557859 | ||
|
|
ac18f8a706 | ||
|
|
a2aebb551e | ||
|
|
354bdb0d58 | ||
|
|
8e3389e574 | ||
|
|
0dfd8d379b | ||
|
|
3c38651e8c | ||
|
|
22ad8f0e7a | ||
|
|
76a64f4491 | ||
|
|
5741bac1c6 | ||
|
|
8590d46785 | ||
|
|
71cff967a9 | ||
|
|
b612eee957 | ||
|
|
28d4aae5b9 | ||
|
|
11313ba8e7 | ||
|
|
d708cb8360 | ||
|
|
78c419c698 | ||
|
|
3f2b6a67d1 | ||
|
|
9ef984d168 | ||
|
|
fa557347ba | ||
|
|
1c6959cfbe | ||
|
|
be199c1304 | ||
|
|
51633b7bd7 | ||
|
|
0acc99fdcd | ||
|
|
f210a05c37 | ||
|
|
9d57241790 | ||
|
|
30ec56c8d3 | ||
|
|
ce00e7de36 | ||
|
|
4e1e199da8 | ||
|
|
7336dd4a97 | ||
|
|
03c1bf96b2 | ||
|
|
ef07ed3bf8 | ||
|
|
197c2f3244 | ||
|
|
bdbade92a7 | ||
|
|
b0dd0ad7af | ||
|
|
95a15f7a83 | ||
|
|
fd10753fd8 | ||
|
|
d88da23cbd | ||
|
|
d5513a7490 | ||
|
|
3d7e15f353 | ||
|
|
ec3f949874 | ||
|
|
884297323d | ||
|
|
015289e21d | ||
|
|
17ca34034b | ||
|
|
44db6e39c3 | ||
|
|
013d1d68c0 | ||
|
|
69b0bc089a | ||
|
|
0dd4a43f49 | ||
|
|
727d3d7463 | ||
|
|
c2fb9ec3fa | ||
|
|
9a4ed98618 | ||
|
|
58c4f6b355 | ||
|
|
d29033f264 | ||
|
|
047c34b734 | ||
|
|
649f741e71 | ||
|
|
d740c8425e | ||
|
|
9038c3bc48 | ||
|
|
74b5acc35d | ||
|
|
45b8761bc8 | ||
|
|
cef4f14470 | ||
|
|
53651229b5 | ||
|
|
555126e06f | ||
|
|
163fd0a3e8 | ||
|
|
ef9c0e9b19 | ||
|
|
65d235a5db | ||
|
|
0cb46e200c | ||
|
|
3ce2146941 | ||
|
|
33023522ba | ||
|
|
d6ea40a7f0 | ||
|
|
99106deaa2 | ||
|
|
34a2ebdc4f | ||
|
|
418783e760 | ||
|
|
07def6f68b | ||
|
|
8f5846f86d | ||
|
|
f298db9762 | ||
|
|
ef29a5e827 | ||
|
|
8fe28948ca | ||
|
|
ee35abbcd0 | ||
|
|
e108e19daf | ||
|
|
733da8cc46 | ||
|
|
5df7edb6af | ||
|
|
4f25bf37c2 | ||
|
|
dfa99afe40 | ||
|
|
c1a4d64a7b | ||
|
|
a2567be084 | ||
|
|
614b91ded0 | ||
|
|
bee5836721 | ||
|
|
2f89d766fc | ||
|
|
a98aa48e57 | ||
|
|
fa0281061b | ||
|
|
ea15ec6aa2 | ||
|
|
90b878c583 | ||
|
|
132c7b03f0 | ||
|
|
c5e4cd3345 | ||
|
|
aeaae7210f | ||
|
|
b69df93ec3 | ||
|
|
0bfb58ff80 | ||
|
|
b35a745561 | ||
|
|
b91c634df1 | ||
|
|
5ade7edd7e | ||
|
|
dd66f3ed20 | ||
|
|
6076da8079 | ||
|
|
d237dacd83 | ||
|
|
398a4138d5 | ||
|
|
7ec330ddeb | ||
|
|
6564abbf26 | ||
|
|
b4f9901580 | ||
|
|
85b0237adc | ||
|
|
4071d1ed7e | ||
|
|
134bbe416d | ||
|
|
3243fea0ac | ||
|
|
216c9b00a8 | ||
|
|
67f3b485c2 | ||
|
|
b2aca215c0 | ||
|
|
e26c09529a | ||
|
|
212defee0f | ||
|
|
4e6b5e91df | ||
|
|
9bf6083375 | ||
|
|
72cbc6ee95 | ||
|
|
f74c5acf29 | ||
|
|
6bbc336c02 | ||
|
|
93fc3da348 | ||
|
|
c7dd196b04 | ||
|
|
9c1bb203e3 | ||
|
|
63a054d7d7 | ||
|
|
495e399865 | ||
|
|
36ac0b59b0 | ||
|
|
00768a2d76 | ||
|
|
bb9ff29efd | ||
|
|
5d95de74d3 | ||
|
|
5618e46179 | ||
|
|
b380515c84 | ||
|
|
9e9788497e | ||
|
|
8631250eea | ||
|
|
3d893a0804 | ||
|
|
c31d7179e5 | ||
|
|
77d0cdef02 | ||
|
|
02564cc842 | ||
|
|
d9f21ee796 | ||
|
|
0af5378d4d | ||
|
|
dbd4014239 | ||
|
|
8551d59672 | ||
|
|
10ee432860 | ||
|
|
194ca9e7bb | ||
|
|
2d7767b700 | ||
|
|
e14f98280b | ||
|
|
38e467edac | ||
|
|
5b754aac0d | ||
|
|
9d2ab7b405 | ||
|
|
21ab827567 | ||
|
|
b7e4c1c2e2 | ||
|
|
023841f4fd | ||
|
|
6d75d0c51f | ||
|
|
3dfe93776f | ||
|
|
ec323d3036 | ||
|
|
f4431031a7 | ||
|
|
0fe929e778 | ||
|
|
626afd6219 | ||
|
|
c81bb8a463 | ||
|
|
b3ce365d91 | ||
|
|
da00980433 | ||
|
|
951028949c | ||
|
|
fbd727aa11 | ||
|
|
3358a9880b | ||
|
|
3c9c3ea7ae | ||
|
|
6abea7562b | ||
|
|
866b62acdc | ||
|
|
3a054e1e96 | ||
|
|
ad81d71ecb | ||
|
|
faf49916cb | ||
|
|
bb8d8a8a4a | ||
|
|
bafb1e27c2 | ||
|
|
8568f6e3e9 | ||
|
|
dfabe7d0f8 | ||
|
|
81233967ca | ||
|
|
922ad083e6 | ||
|
|
0d6ade69e2 | ||
|
|
416976fffd | ||
|
|
bc438d3671 | ||
|
|
e2a118f81a | ||
|
|
78389d8396 | ||
|
|
1cece74438 | ||
|
|
3f705ba9a5 | ||
|
|
8f075be1e2 | ||
|
|
8cb69f0f2b | ||
|
|
97a4573885 | ||
|
|
4ace0e1530 | ||
|
|
9d8b41ea6f | ||
|
|
0b1ba8c05e | ||
|
|
12a11c521b | ||
|
|
9c90d7f4ee | ||
|
|
575d067998 | ||
|
|
ae4af5600d | ||
|
|
ee100094e4 | ||
|
|
bc7156d089 | ||
|
|
237d1fba11 | ||
|
|
99708d560f | ||
|
|
6878eb6899 | ||
|
|
cd2634b3ce | ||
|
|
bfbf86558c | ||
|
|
c332bbcd34 | ||
|
|
e0dc4c8a1e | ||
|
|
02045b57b1 | ||
|
|
037023bb31 | ||
|
|
ed82c3bb59 | ||
|
|
3e61d7985c | ||
|
|
d84748a467 | ||
|
|
668af4ef48 | ||
|
|
83fb85581d | ||
|
|
59c39b886d | ||
|
|
3b3e09075a | ||
|
|
658ea4304e | ||
|
|
33188acf8f | ||
|
|
38674ec994 | ||
|
|
8d6adb6090 | ||
|
|
d60c886ebc | ||
|
|
6c7a09ab7c | ||
|
|
7824a70c1d | ||
|
|
b5444a1779 | ||
|
|
9dcde09ac8 | ||
|
|
7aa1834c95 | ||
|
|
424c98547d | ||
|
|
37e7e0bd81 | ||
|
|
e0c505cfae | ||
|
|
d8eb62ff15 | ||
|
|
45ae51743b | ||
|
|
4bb4d01681 | ||
|
|
b205f291f6 | ||
|
|
a24b08a42a | ||
|
|
058d6f321a | ||
|
|
dbab08f936 | ||
|
|
c996d13ec3 | ||
|
|
a31c74f7ef | ||
|
|
0ab7868d8a | ||
|
|
5902059c7c | ||
|
|
580f4f5561 | ||
|
|
ee59a9f9f0 | ||
|
|
7654682c25 | ||
|
|
b1c0d33128 | ||
|
|
9a692c0769 | ||
|
|
11a3c7b50a | ||
|
|
acfe7dc475 | ||
|
|
64548deafc | ||
|
|
640b7d514d | ||
|
|
d603c89397 | ||
|
|
cdd4330edc | ||
|
|
389c655a5a | ||
|
|
31cafa0a3e | ||
|
|
3011945d6f | ||
|
|
7ecf7bdc6b | ||
|
|
4cd137127f | ||
|
|
0a2547e83d | ||
|
|
d209ec76b2 | ||
|
|
92d9534c1a | ||
|
|
1d0240500c | ||
|
|
4db4affbaf | ||
|
|
8764c2595d | ||
|
|
4ec05bf614 | ||
|
|
871f5cd155 | ||
|
|
f0a8fe0bf6 | ||
|
|
a93c942070 | ||
|
|
a6cc627446 | ||
|
|
6a9c2cefdd | ||
|
|
8fb550cc3e | ||
|
|
6917b51660 | ||
|
|
0ffb71a6af | ||
|
|
79134c69a4 | ||
|
|
4a82d69b9f | ||
|
|
1eb14e95d3 | ||
|
|
65a0992f0d | ||
|
|
5ca69e43ec | ||
|
|
d6d8075c0a | ||
|
|
35f5196386 | ||
|
|
71a3c1f821 | ||
|
|
02a5e33061 | ||
|
|
398b5a31a7 | ||
|
|
d0c40591f2 | ||
|
|
f783101c88 | ||
|
|
97a9b48789 | ||
|
|
56f6396137 | ||
|
|
a5fa5c9013 | ||
|
|
800d1e9a67 | ||
|
|
dbed41fde1 | ||
|
|
4198360421 | ||
|
|
1916f6ae42 | ||
|
|
e0784c72f4 | ||
|
|
43aaf6eb37 | ||
|
|
51650b8a65 | ||
|
|
79084216af | ||
|
|
eb58091392 | ||
|
|
895a9c97e2 | ||
|
|
72b633026b | ||
|
|
d8d7b949d9 | ||
|
|
b3ff968558 | ||
|
|
145f5c8164 | ||
|
|
a7dbcba1e8 | ||
|
|
c3f52f12bb | ||
|
|
7edd45814c | ||
|
|
701dbaa81e | ||
|
|
ae4bd5c2be | ||
|
|
6b12c08bfc | ||
|
|
3779c69674 | ||
|
|
ebd7f9a371 | ||
|
|
beb572e616 | ||
|
|
3424ee7354 | ||
|
|
e826d7e200 | ||
|
|
d120996a49 | ||
|
|
6bc53be992 | ||
|
|
f46918d129 | ||
|
|
73b064c2af | ||
|
|
b3870ab5f9 | ||
|
|
86dc981475 | ||
|
|
d60b8fab03 | ||
|
|
1721829464 | ||
|
|
f628ee2fa4 | ||
|
|
ad310547a2 | ||
|
|
629330e761 | ||
|
|
b511b60aaa | ||
|
|
77be22c09a | ||
|
|
b0270f77a9 | ||
|
|
3a5a759bb7 | ||
|
|
d5d63601b9 | ||
|
|
a7d0c94169 | ||
|
|
3a51203c48 | ||
|
|
4deeb795f6 | ||
|
|
26e47d9a71 | ||
|
|
170b70ce30 | ||
|
|
1ce0836b4a | ||
|
|
5c60b2367e | ||
|
|
b7f9593715 | ||
|
|
e64746200b | ||
|
|
c3d51c14f2 | ||
|
|
7b34df33a5 | ||
|
|
ddfebd35be | ||
|
|
9c3ab68145 | ||
|
|
917648ecb9 | ||
|
|
584b96e859 | ||
|
|
228c637527 | ||
|
|
c3dda6daea | ||
|
|
73b029f9d3 | ||
|
|
5dd2b8e208 | ||
|
|
4093607bc9 | ||
|
|
878b31e0b4 | ||
|
|
7806777139 | ||
|
|
94d9362fc5 | ||
|
|
16e11660fe | ||
|
|
250dfe1777 | ||
|
|
5b77916ecd | ||
|
|
67864af957 | ||
|
|
a4981d4ded | ||
|
|
37f116a900 | ||
|
|
8f3dd833d7 | ||
|
|
36d7bc7530 | ||
|
|
d029a75d4f | ||
|
|
dff799ef89 | ||
|
|
272489dc69 | ||
|
|
5fea36fb00 | ||
|
|
5b5dcf8b88 | ||
|
|
761bf9f06f | ||
|
|
c33ab4e8df | ||
|
|
0cc2f95a9d | ||
|
|
5ff38d3e16 | ||
|
|
865f4f073a | ||
|
|
51d9250c88 | ||
|
|
8a7df0024b | ||
|
|
859665d847 | ||
|
|
484a8a10fe | ||
|
|
2ae022da7e | ||
|
|
d020e9d826 | ||
|
|
d1e8c8694d | ||
|
|
07748d1b2c | ||
|
|
cfbed9bdf2 | ||
|
|
22f28966c4 | ||
|
|
837a3d1745 | ||
|
|
704228f7e7 | ||
|
|
299d73503c | ||
|
|
25d8224d15 | ||
|
|
03008a08d1 | ||
|
|
4fb046a52d | ||
|
|
fcbd7870e9 | ||
|
|
25228abdc1 | ||
|
|
73d57cb97b | ||
|
|
377657d1d6 | ||
|
|
c1bfe686ce | ||
|
|
c6de22da1d | ||
|
|
9c0f094b21 | ||
|
|
f50c91b7bd | ||
|
|
db3b88dad2 | ||
|
|
ae498dcff3 | ||
|
|
5cded0b4b5 | ||
|
|
3f549259b2 | ||
|
|
6c97ddbffc | ||
|
|
5a0be341ba | ||
|
|
10781048be | ||
|
|
1b8e567237 | ||
|
|
1ea0ff34fa | ||
|
|
b182893c04 | ||
|
|
8b6a889881 | ||
|
|
3097f618f2 | ||
|
|
1fd5fb33c2 |
521
ANNOUNCE
@@ -1,22 +1,513 @@
|
||||
|
||||
Libpng 1.0.12beta1 - May 14, 2001
|
||||
Libpng 1.6.0beta29 - September 4, 2012
|
||||
|
||||
This is a public release of libpng, intended for use in production codes.
|
||||
This is not intended to be a public release. It will be replaced
|
||||
within a few weeks by a public version or by another test version.
|
||||
|
||||
Changes since the last public release (1.0.11):
|
||||
Files available for download:
|
||||
|
||||
Test for Windows platform in pngconf.h when including malloc.h (Emmanuel Blot)
|
||||
Updated makefile.cygwin and handling of Cygwin's ALL_STATIC in pngconf.h
|
||||
Added some never-to-be-executed code in pnggccrd.c to quiet compiler warnings.
|
||||
Bumped DLLNUM to 2.
|
||||
Added a check for attempts to read or write PLTE in grayscale PNG datastreams.
|
||||
Eliminated the png_error about apps using png_read|write_init(). Instead,
|
||||
libpng will reallocate the png_struct and info_struct if they are too small.
|
||||
This achieves future binary compatibility for old applications written for
|
||||
libpng-0.88 and earlier.
|
||||
Modified png_create_struct so it passes user mem_ptr to user memory allocator.
|
||||
Source files with LF line endings (for Unix/Linux) and with a
|
||||
"configure" script
|
||||
|
||||
Send comments/corrections/commendations to
|
||||
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
||||
1.6.0beta29.tar.xz (LZMA-compressed, recommended)
|
||||
1.6.0beta29.tar.gz
|
||||
1.6.0beta29.tar.bz2
|
||||
|
||||
Source files with CRLF line endings (for Windows), without the
|
||||
"configure" script
|
||||
|
||||
lp160b29.7z (LZMA-compressed, recommended)
|
||||
lp160b29.zip
|
||||
|
||||
Other information:
|
||||
|
||||
1.6.0beta29-README.txt
|
||||
1.6.0beta29-LICENSE.txt
|
||||
|
||||
Changes since the last public release (1.5.7):
|
||||
|
||||
Version 1.6.0beta01 [December 15, 2011]
|
||||
Removed machine-generated configure files from the GIT repository (they will
|
||||
continue to appear in the tarball distributions).
|
||||
Restored the new 'simplified' API, which was started in libpng-1.5.7beta02
|
||||
but later deleted from libpng-1.5.7beta05.
|
||||
Added example programs for the new 'simplified' API.
|
||||
Added ANSI-C (C90) headers and require them, and take advantage of the
|
||||
change. Also fixed some of the projects/* and contrib/* files that needed
|
||||
updates for libpng16 and the move of pngvalid.c.
|
||||
With this change the required ANSI-C header files are assumed to exist: the
|
||||
implementation must provide float.h, limits.h, stdarg.h and stddef.h and
|
||||
libpng relies on limits.h and stddef.h existing and behaving as defined
|
||||
(the other two required headers aren't used). Non-ANSI systems that don't
|
||||
have stddef.h or limits.h will have to provide an appropriate fake
|
||||
containing the relevant types and #defines.
|
||||
The use of FAR/far has been eliminated and the definition of png_alloc_size_t
|
||||
is now controlled by a flag so that 'small size_t' systems can select it
|
||||
if necessary. Libpng 1.6 may not currently work on such systems -- it
|
||||
seems likely that it will ask 'malloc' for more than 65535 bytes with any
|
||||
image that has a sufficiently large row size (rather than simply failing
|
||||
to read such images).
|
||||
New tools directory containing tools used to generate libpng code.
|
||||
Fixed race conditions in parallel make builds. With higher degrees of
|
||||
parallelism during 'make' the use of the same temporary file names such
|
||||
as 'dfn*' can result in a race where a temporary file from one arm of the
|
||||
build is deleted or overwritten in another arm. This changes the
|
||||
temporary files for suffix rules to always use $* and ensures that the
|
||||
non-suffix rules use unique file names.
|
||||
|
||||
Version 1.6.0beta02 [December 21, 2011]
|
||||
Correct configure builds where build and source directories are separate.
|
||||
The include path of 'config.h' was erroneously made relative in pngvalid.c
|
||||
in libpng 1.5.7.
|
||||
|
||||
Version 1.6.0beta03 [December 22, 2011]
|
||||
Start-up code size improvements, error handler flexibility. These changes
|
||||
alter how the tricky allocation of the initial png_struct and png_info
|
||||
structures are handled. png_info is now handled in pretty much the same
|
||||
way as everything else, except that the allocations handle NULL return
|
||||
silently. png_struct is changed in a similar way on allocation and on
|
||||
deallocation a 'safety' error handler is put in place (which should never
|
||||
be required). The error handler itself is changed to permit mismatches
|
||||
in the application and libpng error buffer size; however, this means a
|
||||
silent change to the API to return the jmp_buf if the size doesn't match
|
||||
the size from the libpng compilation; libpng now allocates the memory and
|
||||
this may fail. Overall these changes result in slight code size
|
||||
reductions; however, this is a reduction in code that is always executed
|
||||
so is particularly valuable. Overall on a 64-bit system the libpng DLL
|
||||
decreases in code size by 1733 bytes. pngerror.o increases in size by
|
||||
about 465 bytes because of the new functionality.
|
||||
Added png_convert_to_rfc1123_buffer() and deprecated png_convert_to_rfc1123()
|
||||
to avoid including a spurious buffer in the png_struct.
|
||||
|
||||
Version 1.6.0beta04 [December 30, 2011]
|
||||
Regenerated configure scripts with automake-1.11.2
|
||||
Eliminated png_info_destroy(). It is now used only in png.c and only calls
|
||||
one other internal function and memset().
|
||||
Enabled png_get_sCAL_fixed() if floating point APIs are enabled. Previously
|
||||
it was disabled whenever internal fixed point arithmetic was selected,
|
||||
which meant it didn't exist even on systems where FP was available but not
|
||||
preferred.
|
||||
Added pngvalid.c compile time checks for const APIs.
|
||||
Implemented 'restrict' for png_info and png_struct. Because of the way
|
||||
libpng works both png_info and png_struct are always accessed via a
|
||||
single pointer. This means adding C99 'restrict' to the pointer gives
|
||||
the compiler some opportunity to optimize the code. This change allows
|
||||
that.
|
||||
Moved AC_MSG_CHECKING([if libraries can be versioned]) later to the proper
|
||||
location in configure.ac (Gilles Espinasse).
|
||||
Changed png_memcpy to C assignment where appropriate. Changed all those
|
||||
uses of png_memcpy that were doing a simple assignment to assignments
|
||||
(all those cases where the thing being copied is a non-array C L-value).
|
||||
Added some error checking to png_set_*() routines.
|
||||
Removed the reference to the non-exported function png_memcpy() from
|
||||
example.c.
|
||||
Fixed the Visual C 64-bit build - it requires jmp_buf to be aligned, but
|
||||
it had become misaligned.
|
||||
Revised contrib/pngminus/pnm2png.c to avoid warnings when png_uint_32
|
||||
and unsigned long are of different sizes.
|
||||
|
||||
Version 1.6.0beta05 [January 15, 2012]
|
||||
Updated manual with description of the simplified API (copied from png.h)
|
||||
Fix bug in pngerror.c: some long warnings were being improperly truncated
|
||||
(CVE-2011-3464, bug introduced in libpng-1.5.3beta05).
|
||||
|
||||
Version 1.6.0beta06 [January 24, 2012]
|
||||
Added palette support to the simplified APIs. This commit
|
||||
changes some of the macro definitions in png.h, app code
|
||||
may need corresponding changes.
|
||||
Increased the formatted warning buffer to 192 bytes.
|
||||
Added color-map support to simplified API. This is an initial version for
|
||||
review; the documentation has not yet been updated.
|
||||
Fixed Min/GW uninstall to remove libpng.dll.a
|
||||
|
||||
Version 1.6.0beta07 [January 28, 2012]
|
||||
Eliminated Intel icc/icl compiler warnings. The Intel (GCC derived)
|
||||
compiler issues slightly different warnings from those issued by the
|
||||
current vesions of GCC. This eliminates those warnings by
|
||||
adding/removing casts and small code rewrites.
|
||||
Updated configure.ac from autoupdate: added --enable-werror option.
|
||||
Also some layout regularization and removal of introduced tab characters
|
||||
(replaced with 3-character indentation). Obsolete macros identified by
|
||||
autoupdate have been removed; the replacements are all in 2.59 so
|
||||
the pre-req hasn't been changed. --enable-werror checks for support
|
||||
for -Werror (or the given argument) in the compiler. This mimics the
|
||||
gcc configure option by allowing -Werror to be turned on safely; without
|
||||
the option the tests written in configure itself fail compilation because
|
||||
they cause compiler warnings.
|
||||
Rewrote autogen.sh to run autoreconf instead of running tools one-by-one.
|
||||
Conditionalize the install rules for MINGW and CYGWIN in CMakeLists.txt and
|
||||
set CMAKE_LIBRARY_OUTPUT_DIRECTORY to "lib" on all platforms (C. Yapp).
|
||||
Freeze libtool files in the 'scripts' directory. This version of autogen.sh
|
||||
attempts to dissuade people from running it when it is not, or should not,
|
||||
be necessary. In fact, autogen.sh does not work when run in a libpng
|
||||
directory extracted from atar distribution anymore. You must run it in
|
||||
a GIT clone instead.
|
||||
Added two images to contrib/pngsuite (1-bit and 2-bit transparent grayscale),
|
||||
and renamed three whose names were inconsistent with those in
|
||||
pngsuite/README.txt.
|
||||
|
||||
Version 1.6.0beta08 [February 1, 2012]
|
||||
Fixed Image::colormap misalignment in pngstest.c
|
||||
Check libtool/libtoolize version number (2.4.2) in configure.ac
|
||||
Divide test-pngstest.sh into separate pngstest runs for basic and
|
||||
transparent images.
|
||||
Moved automake options to AM_INIT_AUTOMAKE in configure.ac
|
||||
Added color-tests, silent-rules (Not yet implemented in Makefile.am) and
|
||||
version checking to configure.ac
|
||||
Improved pngstest speed by not doing redundant tests and add const to
|
||||
the background parameter of png_image_finish_read. The --background
|
||||
option is now done automagically only when required, so that commandline
|
||||
option no longer exists.
|
||||
Cleaned up pngpriv.h to consistently declare all functions and data.
|
||||
Also eliminated PNG_CONST_DATA, which is apparently not needed but we
|
||||
can't be sure until it is gone.
|
||||
Added symbol prefixing that allows all the libpng external symbols
|
||||
to be prefixed (suggested by Reuben Hawkins).
|
||||
Updated "ftbb*.png" list in the owatcom and vstudio projects.
|
||||
Fixed 'prefix' builds on clean systems. The generation of pngprefix.h
|
||||
should not require itself.
|
||||
Updated INSTALL to explain that autogen.sh must be run in a GIT clone,
|
||||
not in a libpng directory extracted from a tar distribution.
|
||||
|
||||
Version 1.6.0beta09 [February 1, 2012]
|
||||
Reverted the prebuilt configure files to libpng-1.6.0beta05 condition.
|
||||
|
||||
Version 1.6.0beta10 [February 3, 2012]
|
||||
Added Z_SOLO for zlib-1.2.6+ and correct pngstest tests
|
||||
Updated list of test images in CMakeLists.txt
|
||||
Updated the prebuilt configure files to current condition.
|
||||
Revised INSTALL information about autogen.sh; it works in tar distributions.
|
||||
|
||||
Version 1.6.0beta11 [February 16, 2012]
|
||||
Fix character count in pngstest command in projects/owatcom/pngstest.tgt
|
||||
Revised test-pngstest.sh to report PASS/FAIL for each image.
|
||||
Updated documentation about the simplified API.
|
||||
Corrected estimate of error in libpng png_set_rgb_to_gray API. The API is
|
||||
extremely inaccurate for sRGB conversions because it uses an 8-bit
|
||||
intermediate linear value and it does not use the sRGB transform, so it
|
||||
suffers from the known instability in gamma transforms for values close
|
||||
to 0 (see Poynton). The net result is that the calculation has a maximum
|
||||
error of 14.99/255; 0.5/255^(1/2.2). pngstest now uses 15 for the
|
||||
permitted 8-bit error. This may still not be enough because of arithmetic
|
||||
error.
|
||||
Removed some unused arrays (with #ifdef) from png_read_push_finish_row().
|
||||
Fixed a memory overwrite bug in simplified read of RGB PNG with
|
||||
non-linear gamma Also bugs in the error checking in pngread.c and changed
|
||||
quite a lot of the checks in pngstest.c to be correct; either correctly
|
||||
written or not over-optimistic. The pngstest changes are insufficient to
|
||||
allow all possible RGB transforms to be passed; pngstest cmppixel needs
|
||||
to be rewritten to make it clearer which errors it allows and then changed
|
||||
to permit known inaccuracies.
|
||||
Removed tests for no-longer-used *_EMPTY_PLTE_SUPPORTED from pngstruct.h
|
||||
Fixed fixed/float API export conditionals. 1) If FIXED_POINT or
|
||||
FLOATING_POINT options were switched off, png.h ended up with lone ';'
|
||||
characters. This is not valid ANSI-C outside a function. The ';'
|
||||
characters have been moved inside the definition of PNG_FP_EXPORT and
|
||||
PNG_FIXED_EXPORT. 2) If either option was switched off, the declaration
|
||||
of the corresponding functions were completely omitted, even though some
|
||||
of them are still used internally. The result is still valid, but
|
||||
produces warnings from gcc with some warning options (including -Wall). The
|
||||
fix is to cause png.h to declare the functions with PNG_INTERNAL_FUNCTION
|
||||
when png.h is included from pngpriv.h.
|
||||
Check for invalid palette index while reading paletted PNG. When one is
|
||||
found, issue a warning and increase png_ptr->num_palette accordingly.
|
||||
Apps are responsible for checking to see if that happened.
|
||||
|
||||
Version 1.6.0beta12 [February 18, 2012]
|
||||
Do not increase num_palette on invalid_index.
|
||||
Relocated check for invalid palette index to pngrtran.c, after unpacking
|
||||
the sub-8-bit pixels.
|
||||
Fixed CVE-2011-3026 buffer overrun bug. Deal more correctly with the test
|
||||
on iCCP chunk length. Also removed spurious casts that may hide problems
|
||||
on 16-bit systems.
|
||||
|
||||
Version 1.6.0beta13 [February 24, 2012]
|
||||
Eliminated redundant png_push_read_tEXt|zTXt|iTXt|unknown code from
|
||||
pngpread.c and use the sequential png_handle_tEXt, etc., in pngrutil.c;
|
||||
now that png_ptr->buffer is inaccessible to applications, the special
|
||||
handling is no longer useful.
|
||||
Added PNG_SAFE_LIMITS feature to pnglibconf.dfa, pngpriv.h, and new
|
||||
pngusr.dfa to reset the user limits to safe ones if PNG_SAFE_LIMITS is
|
||||
defined. To enable, use "CPPFLAGS=-DPNG_SAFE_LIMITS_SUPPORTED=1" on the
|
||||
configure command or put #define PNG_SAFE_LIMITS_SUPPORTED in
|
||||
pnglibconf.h.prebuilt and pnglibconf.h.
|
||||
|
||||
Version 1.6.0beta14 [February 27, 2012]
|
||||
Added information about the new limits in the manual.
|
||||
Updated Makefile.in
|
||||
|
||||
Version 1.6.0beta15 [March 2, 2012]
|
||||
Removed unused "current_text" members of png_struct and the png_free()
|
||||
of png_ptr->current_text from pngread.c
|
||||
Rewrote pngstest.c for substantial speed improvement.
|
||||
Fixed transparent pixel and 16-bit rgb tests in pngstest and removed a
|
||||
spurious check in pngwrite.c
|
||||
Added PNG_IMAGE_FLAG_FAST for the benefit of applications that store
|
||||
intermediate files, or intermediate in-memory data, while processing
|
||||
image data with the simplified API. The option makes the files larger
|
||||
but faster to write and read. pngstest now uses this by default; this
|
||||
can be disabled with the --slow option.
|
||||
Improved pngstest fine tuning of error numbers, new test file generator.
|
||||
The generator generates images that test the full range of sample values,
|
||||
allow the error numbers in pngstest to be tuned and checked. makepng
|
||||
also allows generation of images with extra chunks, although this is
|
||||
still work-in-progress.
|
||||
Added tests for invalid palette index while reading and writing (work in
|
||||
progress, the latter isn't finished).
|
||||
Fixed some bugs in ICC profile writing. The code should now accept
|
||||
all potentially valid ICC profiles and reject obviously invalid ones.
|
||||
It now uses png_error() to do so rather than casually writing a PNG
|
||||
without the necessary color data.
|
||||
Removed whitespace from the end of lines in all source files and scripts.
|
||||
|
||||
Version 1.6.0beta16 [March 6, 2012]
|
||||
Relocated palette-index checking function from pngrutil.c to pngtrans.c
|
||||
Added palette-index checking while writing.
|
||||
Changed png_inflate() and calling routines to avoid overflow problems.
|
||||
This is an intermediate check-in that solves the immediate problems and
|
||||
introduces one performance improvement (avoiding a copy via png_ptr->zbuf.)
|
||||
Further changes will be made to make ICC profile handling more secure.
|
||||
Fixed build warnings (MSVC, GCC, GCC v3). Cygwin GCC with default options
|
||||
declares 'index' as a global, causing a warning if it is used as a local
|
||||
variable. GCC 64-bit warns about assigning a (size_t) (unsigned 64-bit)
|
||||
to an (int) (signed 32-bit). MSVC, however, warns about using the
|
||||
unary '-' operator on an unsigned value (even though it is well defined
|
||||
by ANSI-C to be ~x+1). The padding calculation was changed to use a
|
||||
different method. Removed the tests on png_ptr->pass.
|
||||
Added contrib/libtests/tarith.c to test internal arithmetic functions from
|
||||
png.c. This is a libpng maintainer program used to validate changes to the
|
||||
internal arithmetic functions.
|
||||
Made read 'inflate' handling like write 'deflate' handling. The read
|
||||
code now claims and releases png_ptr->zstream, like the write code.
|
||||
The bug whereby the progressive reader failed to release the zstream
|
||||
is now fixed, all initialization is delayed, and the code checks for
|
||||
changed parameters on deflate rather than always calling
|
||||
deflatedEnd/deflateInit.
|
||||
Validate the zTXt strings in pngvalid.
|
||||
Added code to validate the windowBits value passed to deflateInit2().
|
||||
If the call to deflateInit2() is wrong a png_warning will be issued
|
||||
(in fact this is harmless, but the PNG data produced may be sub-optimal).
|
||||
|
||||
Version 1.6.0beta17 [March 10, 2012]
|
||||
Fixed PNG_LIBPNG_BUILD_BASE_TYPE definition.
|
||||
Reject all iCCP chunks after the first, even if the first one is invalid.
|
||||
Deflate/inflate was reworked to move common zlib calls into single
|
||||
functions [rw]util.c. A new shared keyword check routine was also added
|
||||
and the 'zbuf' is no longer allocated on progressive read. It is now
|
||||
possible to call png_inflate() incrementally.
|
||||
If benign errors are disabled use maximum window on ancilliary inflate.
|
||||
This works round a bug introduced in 1.5.4 where compressed ancillary
|
||||
chunks could end up with a too-small windowBits value in the deflate
|
||||
header.
|
||||
|
||||
Version 1.6.0beta18 [March 16, 2012]
|
||||
Issue a png_benign_error() instead of png_warning() about bad palette index.
|
||||
In pngtest, treat benign errors as errors if "-strict" is present.
|
||||
Fixed an off-by-one error in the palette index checking function.
|
||||
Fixed a compiler warning under Cygwin (Windows-7, 32-bit system)
|
||||
Revised example.c to put text strings in a temporary character array
|
||||
instead of directly assigning string constants to png_textp members.
|
||||
This avoids compiler warnings when -Wwrite-strings is enabled.
|
||||
Added output flushing to aid debugging under Visual Studio. Unfortunately
|
||||
this is necessary because the VS2010 output window otherwise simply loses
|
||||
the error messages on error (they weren't flushed to the window before
|
||||
the process exited, apparently!)
|
||||
Added configuration support for benign errors and changed the read
|
||||
default. Also changed some warnings in the iCCP and sRGB handling
|
||||
from to benign errors. Configuration now makes read benign
|
||||
errors warnings and write benign errors to errors by default (thus
|
||||
changing the behavior on read). The simplified API always forces
|
||||
read benign errors to warnings (regardless of the system default, unless
|
||||
this is disabled in which case the simplified API can't be built.)
|
||||
|
||||
Version 1.6.0beta19 [March 18,2012]
|
||||
Work around for duplicate row start calls; added warning messages.
|
||||
This turns on PNG_FLAG_DETECT_UNINITIALIZED to detect app code that
|
||||
fails to call one of the 'start' routines (not enabled in libpng-1.5
|
||||
because it is technically an API change, since it did normally work
|
||||
before.) It also makes duplicate calls to png_read_start_row (an
|
||||
internal function called at the start of the image read) benign, as
|
||||
they were before changes to use png_inflate_claim. Somehow webkit is
|
||||
causing this to happen; this is probably a mis-feature in the zlib
|
||||
changes so this commit is only a work-round.
|
||||
Removed erroneous setting of DETECT_UNINITIALIZED and added more
|
||||
checks. The code now does a png_error if an attempt is made to do the
|
||||
row initialization twice; this is an application error and it has
|
||||
serious consequences because the transform data in png_struct is
|
||||
changed by each call.
|
||||
Added application error reporting and added chunk names to read
|
||||
benign errors; also added --strict to pngstest - not enabled
|
||||
yet because a warning is produced.
|
||||
Avoid the double gamma correction warning in the simplified API.
|
||||
This allows the --strict option to pass in the pngstest checks
|
||||
|
||||
Version 1.6.0beta20 [March 29, 2012]
|
||||
Changed chunk handler warnings into benign errors, incrementally load iCCP
|
||||
Added checksum-icc.c to contrib/tools
|
||||
Prevent PNG_EXPAND+PNG_SHIFT doing the shift twice.
|
||||
Recognize known sRGB ICC profiles while reading; prefer writing the
|
||||
iCCP profile over writing the sRGB chunk, controlled by the
|
||||
PNG_sRGB_PROFILE_CHECKS option.
|
||||
Revised png_set_text_2() to avoid potential memory corruption (fixes
|
||||
CVE-2011-3048, also known as CVE-2012-3425).
|
||||
|
||||
Version 1.6.0beta21 [April 27, 2012]
|
||||
Revised scripts/makefile.darwin: use system zlib; remove quotes around
|
||||
architecture list; add missing ppc architecture; add architecture options
|
||||
to shared library link; don't try to create a shared lib based on missing
|
||||
RELEASE variable.
|
||||
Enable png_set_check_for_invalid_index() for both read and write.
|
||||
Removed #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED in pngpriv.h around
|
||||
declaration of png_handle_unknown().
|
||||
Added -lssp_nonshared in a comment in scripts/makefile.freebsd
|
||||
and changed deprecated NOOBJ and NOPROFILE to NO_OBJ and NO_PROFILE.
|
||||
|
||||
Version 1.6.0beta22 [May 23, 2012]
|
||||
Removed need for -Wno-cast-align with clang. clang correctly warns on
|
||||
alignment increasing pointer casts when -Wcast-align is passed. This
|
||||
fixes the cases that clang warns about either by eliminating the
|
||||
casts from png_bytep to png_uint_16p (pngread.c), or, for pngrutil.c
|
||||
where the cast is previously verified or pngstest.c where it is OK, by
|
||||
introducing new png_aligncast macros to do the cast in a way that clang
|
||||
accepts.
|
||||
|
||||
Version 1.6.0beta23 [June 6, 2012]
|
||||
Revised CMakeLists.txt to not attempt to make a symlink under mingw.
|
||||
Made fixes for new optimization warnings from gcc 4.7.0. The compiler
|
||||
performs an optimization which is safe; however it then warns about it.
|
||||
Changing the type of 'palette_number' in pngvalid.c removes the warning.
|
||||
Do not depend upon a GCC feature macro being available for use in generating
|
||||
the linker mapfile symbol prefix.
|
||||
Improved performance of new do_check_palette_indexes() function (only
|
||||
update the value when it actually increases, move test for whether
|
||||
the check is wanted out of the function.
|
||||
|
||||
Version 1.6.0beta24 [June 7, 2012]
|
||||
Don't check palette indexes if num_palette is 0 (as it can be in MNG files).
|
||||
|
||||
Version 1.6.0beta25 [June 16, 2012]
|
||||
Revised png_set_keep_unknown_chunks() so num_chunks < 0 means ignore all
|
||||
unknown chunks and all known chunks except for IHDR, PLTE, tRNS, IDAT,
|
||||
and IEND. Previously it only meant ignore all unknown chunks, the
|
||||
same as num_chunks == 0. Revised png_image_skip_unused_chunks() to
|
||||
provide a list of chunks to be processed instead of a list of chunks to
|
||||
ignore. Revised contrib/gregbook/readpng2.c accordingly.
|
||||
|
||||
Version 1.6.0beta26 [July 10, 2012]
|
||||
Removed scripts/makefile.cegcc from the *.zip and *.7z distributions; it
|
||||
depends on configure, which is not included in those archives.
|
||||
Moved scripts/chkfmt to contrib/tools.
|
||||
Changed "a+w" to "u+w" in Makefile.in to fix CVE-2012-3386.
|
||||
|
||||
Version 1.6.0beta27 [August 11, 2012]
|
||||
Do not compile PNG_DEPRECATED, PNG_ALLOC and PNG_PRIVATE when __GNUC__ < 3.
|
||||
Do not use __restrict when GNUC is <= 3.1
|
||||
Removed references to png_zalloc() and png_zfree() from the manual.
|
||||
Fixed configurations where floating point is completely disabled. Because
|
||||
of the changes to support symbol prefixing PNG_INTERNAL_FUNCTION declares
|
||||
floating point APIs during libpng builds even if they are completely
|
||||
disabled. This requires the png floating point types (png_double*) to be
|
||||
declared even though the functions are never actually defined. This
|
||||
change provides a dummy definition so that the declarations work, yet any
|
||||
implementation will fail to compile because of an incomplete type.
|
||||
Re-eliminated the use of strcpy() in pngtest.c. An unncessary use of
|
||||
strcpy() was accidentally re-introduced in libpng16; this change replaces
|
||||
it with strncpy().
|
||||
Eliminated use of png_sizeof(); use sizeof() instead.
|
||||
Use a consistent style for (sizeof type) and (sizeof (array))
|
||||
Cleanup of png_set_filler(). This function does very different things on
|
||||
read and write. In libpng 1.6 the two cases can be distinguished and
|
||||
considerable code cleanup, and extra error checking, is possible. This
|
||||
makes calls on the write side that have no effect be ignored with a
|
||||
png_app_error(), which can be disabled in the app using
|
||||
png_set_benign_errors(), and removes the spurious use of usr_channels
|
||||
on the read side.
|
||||
Insist on autotools 1.12.1 for git builds because there are security issues
|
||||
with 1.12 and insisting on anything less would allow 1.12 to be used.
|
||||
Removed info_ptr->signature[8] from WRITE-only builds.
|
||||
Add some conditions for compiling png_fixed(). This is a small function
|
||||
but it requires "-lm" on some platforms.
|
||||
Cause pngtest --strict to fail on any warning from libpng (not just errors)
|
||||
and cause it not to fail at the comparison step if libpng lacks support
|
||||
for writing chunks that it reads from the input (currently only implemented
|
||||
for compressed text chunks).
|
||||
Make all three "make check" test programs work without READ or WRITE support.
|
||||
Now "make check" will succeed even if libpng is compiled with -DPNG_NO_READ
|
||||
or -DPNG_NO_WRITE. The tests performed are reduced, but the basic reading
|
||||
and writing of a PNG file is always tested by one or more of the tests.
|
||||
Consistently use strlen(), memset(), memcpy(), and memcmp() instead of the
|
||||
png_strlen(), png_memset(), png_memcpy(), and png_memcmp() macros.
|
||||
Removed the png_sizeof(), png_strlen(), png_memset(), png_memcpy(), and
|
||||
png_memcmp() macros.
|
||||
Work around gcc 3.x and Microsoft Visual Studio 2010 complaints. Both object
|
||||
to the split initialization of num_chunks.
|
||||
|
||||
Version 1.6.0beta28 [August 29, 2012]
|
||||
Unknown handling fixes and clean up. This adds more correct option
|
||||
control of the unknown handling, corrects the pre-existing bug where
|
||||
the per-chunk 'keep' setting is ignored and makes it possible to skip
|
||||
IDAT chunks in the sequential reader (broken in earlier 1.6 versions).
|
||||
There is a new test program, test-unknown.c, which is a work in progress
|
||||
(not currently part of the test suite). Comments in the header files now
|
||||
explain how the unknown handling works.
|
||||
Allow fine grain control of unknown chunk APIs. This change allows
|
||||
png_set_keep_unknown_chunks() to be turned off if not required and causes
|
||||
both read and write to behave appropriately (on read this is only possible
|
||||
if the user callback is used to handle unknown chunks). The change
|
||||
also removes the support for storing unknown chunks in the info_struct
|
||||
if the only unknown handling enabled is via the callback, allowing libpng
|
||||
to be configured with callback reading and none of the unnecessary code.
|
||||
Corrected fix for unknown handling in pngtest. This reinstates the
|
||||
libpng handling of unknown chunks other than vpAg and sTER (including
|
||||
unsafe-to-copy chunks which were dropped before) and eliminates the
|
||||
repositioning of vpAg and sTER in pngtest.png by changing pngtest.png
|
||||
(so the chunks are where libpng would put them).
|
||||
Added "tunknown" test and corrected a logic error in png_handle_unknown()
|
||||
when SAVE support is absent. Moved the shell test scripts for
|
||||
contrib/libtests from the libpng top directory to contrib/libtests.
|
||||
png_handle_unknown() must always read or skip the chunk, if
|
||||
SAVE_UNKNOWN_CHUNKS is turned off *and* the application does not set
|
||||
a user callback an unknown chunk will not be read, leading to a read
|
||||
error, which was revealed by the "tunknown" test.
|
||||
Cleaned up and corrected ICC profile handling.
|
||||
contrib/libtests/makepng: corrected 'rgb' and 'gray' cases. profile_error
|
||||
messages could be truncated; made a correct buffer size calculation and
|
||||
adjusted pngerror.c appropriately. png_icc_check_* checking improved;
|
||||
changed the functions to receive the correct color type of the PNG on read
|
||||
or write and check that it matches the color space of the profile (despite
|
||||
what the comments said before, there is danger in assuming the app will
|
||||
cope correctly with an RGB profile on a grayscale image and, since it
|
||||
violates the PNG spec, allowing it is certain to produce inconsistent
|
||||
app behavior and might even cause app crashes.) Check that profiles
|
||||
contain the tags needed to process the PNG (tags all required by the ICC
|
||||
spec). Removed unused PNG_STATIC from pngpriv.h.
|
||||
|
||||
Version 1.6.0beta29 [September 4, 2012]
|
||||
Fixed the simplified API example programs and improved the error message
|
||||
if the version field is not set.
|
||||
Added contrib/examples/* to the *.zip and *.7z distributions.
|
||||
Updated simplified API synopses and description of the png_image structure
|
||||
in the manual.
|
||||
Made makepng and pngtest produce identical PNGs, add "--relaxed" option
|
||||
to pngtest. The "--relaxed" option turns off the benign errors that are
|
||||
enabled by default in pre-RC builds. makepng can now write ICC profiles
|
||||
where the length has not been extended to a multiple of 4, and pngtest
|
||||
now intercepts all libpng errors, allowing the previously-introduced
|
||||
"--strict test" on no warnings to actually work.
|
||||
Improved ICC profile handling including cHRM chunk generation and fixed
|
||||
Cygwin+MSVC build errors. The ICC profile handling now includes more
|
||||
checking. Several errors that caused rejection of the profile are now
|
||||
handled with a warning in such a way that the invalid profiles will be
|
||||
read by default in release (but not pre-RC) builds but will not be
|
||||
written by default. The easy part of handling the cHRM chunk is written,
|
||||
where the ICC profile contains the required data. The more difficult
|
||||
part plus guessing a gAMA value requires code to pass selected RGB values
|
||||
through the profile.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||
to subscribe)
|
||||
or to glennrp at users.sourceforge.net
|
||||
|
||||
Glenn R-P
|
||||
|
||||
379
CMakeLists.txt
Normal file
@@ -0,0 +1,379 @@
|
||||
# CMakeLists.txt
|
||||
|
||||
# Copyright (C) 2007-2011 Glenn Randers-Pehrson
|
||||
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
# and license in png.h
|
||||
|
||||
cmake_minimum_required(VERSION 2.4.4)
|
||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
||||
|
||||
if(UNIX AND NOT DEFINED CMAKE_BUILD_TYPE)
|
||||
if(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION EQUAL 4)
|
||||
# workaround CMake 2.4.x bug
|
||||
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
|
||||
"Choose the type of build, options are:
|
||||
None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
|
||||
Debug
|
||||
Release
|
||||
RelWithDebInfo
|
||||
MinSizeRel.")
|
||||
else()
|
||||
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
|
||||
"Choose the type of build, options are:
|
||||
None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
|
||||
Debug
|
||||
Release
|
||||
RelWithDebInfo
|
||||
MinSizeRel.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
project(libpng C)
|
||||
enable_testing()
|
||||
|
||||
set(PNGLIB_MAJOR 1)
|
||||
set(PNGLIB_MINOR 6)
|
||||
set(PNGLIB_RELEASE 0)
|
||||
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
||||
|
||||
# needed packages
|
||||
find_package(ZLIB REQUIRED)
|
||||
include_directories(${ZLIB_INCLUDE_DIR})
|
||||
|
||||
if(NOT WIN32)
|
||||
find_library(M_LIBRARY
|
||||
NAMES m
|
||||
PATHS /usr/lib /usr/local/lib
|
||||
)
|
||||
if(NOT M_LIBRARY)
|
||||
message(STATUS
|
||||
"math library 'libm' not found - floating point support disabled")
|
||||
endif()
|
||||
else()
|
||||
# not needed on windows
|
||||
set(M_LIBRARY "")
|
||||
endif()
|
||||
|
||||
# COMMAND LINE OPTIONS
|
||||
if(DEFINED PNG_SHARED)
|
||||
option(PNG_SHARED "Build shared lib" ${PNG_SHARED})
|
||||
else()
|
||||
option(PNG_SHARED "Build shared lib" ON)
|
||||
endif()
|
||||
if(DEFINED PNG_STATIC)
|
||||
option(PNG_STATIC "Build static lib" ${PNG_STATIC})
|
||||
else()
|
||||
option(PNG_STATIC "Build static lib" ON)
|
||||
endif()
|
||||
|
||||
option(PNG_TESTS "Build libpng tests" YES)
|
||||
|
||||
# Many more configuration options could be added here
|
||||
option(PNG_DEBUG "Build with debug output" NO)
|
||||
option(PNGARG "Disable ANSI-C prototypes" NO)
|
||||
|
||||
# SET LIBNAME
|
||||
set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||
|
||||
# to distinguish between debug and release lib
|
||||
set(CMAKE_DEBUG_POSTFIX "d")
|
||||
|
||||
# Use the prebuilt pnglibconf.h file from the scripts folder
|
||||
# TODO: fix this by building with awk; without this no cmake build can be
|
||||
# configured directly (to do so indirectly use your local awk to build a
|
||||
# pnglibconf.h in the build directory.)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
# OUR SOURCES
|
||||
set(libpng_public_hdrs
|
||||
png.h
|
||||
pngconf.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h
|
||||
)
|
||||
set(libpng_sources
|
||||
${libpng_public_hdrs}
|
||||
pngdebug.h
|
||||
pnginfo.h
|
||||
pngpriv.h
|
||||
pngstruct.h
|
||||
png.c
|
||||
pngerror.c
|
||||
pngget.c
|
||||
pngmem.c
|
||||
pngpread.c
|
||||
pngread.c
|
||||
pngrio.c
|
||||
pngrtran.c
|
||||
pngrutil.c
|
||||
pngset.c
|
||||
pngtrans.c
|
||||
pngwio.c
|
||||
pngwrite.c
|
||||
pngwtran.c
|
||||
pngwutil.c
|
||||
)
|
||||
set(pngtest_sources
|
||||
pngtest.c
|
||||
)
|
||||
set(pngvalid_sources
|
||||
contrib/libtests/pngvalid.c
|
||||
)
|
||||
set(pngstest_sources
|
||||
contrib/libtests/pngstest.c
|
||||
)
|
||||
# SOME NEEDED DEFINITIONS
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||
endif(MSVC)
|
||||
|
||||
if(PNG_DEBUG)
|
||||
add_definitions(-DPNG_DEBUG)
|
||||
endif()
|
||||
|
||||
# NOW BUILD OUR TARGET
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR})
|
||||
|
||||
if(PNG_SHARED)
|
||||
add_library(${PNG_LIB_NAME} SHARED ${libpng_sources})
|
||||
if(MSVC)
|
||||
# msvc does not append 'lib' - do it here to have consistent name
|
||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES PREFIX "lib")
|
||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES IMPORT_PREFIX "lib")
|
||||
endif()
|
||||
target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(PNG_STATIC)
|
||||
# does not work without changing name
|
||||
set(PNG_LIB_NAME_STATIC ${PNG_LIB_NAME}_static)
|
||||
add_library(${PNG_LIB_NAME_STATIC} STATIC ${libpng_sources})
|
||||
if(MSVC)
|
||||
# msvc does not append 'lib' - do it here to have consistent name
|
||||
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib")
|
||||
endif()
|
||||
target_link_libraries(${PNG_LIB_NAME_STATIC} ${ZLIB_LIBRARY} ${M_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(PNG_SHARED AND WIN32)
|
||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
|
||||
endif()
|
||||
|
||||
if(PNG_TESTS AND PNG_SHARED)
|
||||
# does not work with msvc due to png_lib_ver issue
|
||||
add_executable(pngtest ${pngtest_sources})
|
||||
target_link_libraries(pngtest ${PNG_LIB_NAME})
|
||||
add_test(pngtest ./pngtest ${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png)
|
||||
#
|
||||
add_executable(pngvalid ${pngvalid_sources})
|
||||
target_link_libraries(pngvalid ${PNG_LIB_NAME})
|
||||
add_test(pngvalid ./pngvalid)
|
||||
add_executable(pngstest ${pngstest_sources})
|
||||
target_link_libraries(pngstest ${PNG_LIB_NAME})
|
||||
add_test(pngstest ./pngstest
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g01.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g02.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g04.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g08.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g16.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn2c08.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn2c16.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p01.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p02.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p04.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p08.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn4a08.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn4a16.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn6a08.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn6a16.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn0g01.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn0g02.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn0g04.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn2c16.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn3p08.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbgn2c16.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbgn3p08.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbrn2c08.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbwn0g16.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbwn3p08.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbyn3p08.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n0g08.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n2c08.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n3p08.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp1n3p08.png
|
||||
)
|
||||
endif()
|
||||
|
||||
# Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set
|
||||
IF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "lib")
|
||||
ENDIF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
||||
|
||||
# Set a variable with CMake code which:
|
||||
# Creates a symlink from src to dest (if possible) or alternatively
|
||||
# copies if different.
|
||||
macro(CREATE_SYMLINK SRC_FILE DEST_FILE)
|
||||
FILE(REMOVE ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
|
||||
if(WIN32 AND NOT CYGWIN AND NOT MSYS)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${SRC_FILE} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${SRC_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE}
|
||||
DEPENDS ${PNG_LIB_NAME} ${PNG_LIB_NAME_STATIC}
|
||||
)
|
||||
ADD_CUSTOM_TARGET(${DEST_FILE}_COPY ALL DEPENDS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
|
||||
else(WIN32 AND NOT CYGWIN AND NOT MSYS)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${SRC_FILE} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${SRC_FILE} ${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif(WIN32 AND NOT CYGWIN AND NOT MSYS)
|
||||
endmacro()
|
||||
|
||||
# libpng is a library so default to 'lib'
|
||||
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
set(CMAKE_INSTALL_LIBDIR lib)
|
||||
endif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
|
||||
# CREATE PKGCONFIG FILES
|
||||
# we use the same files like ./configure, so we have to set its vars
|
||||
# Only do this on Windows for Cygwin - the files don't make much sense outside
|
||||
# a UNIX look alike
|
||||
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
|
||||
set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
|
||||
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
|
||||
set(LIBS "-lz -lm")
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)
|
||||
CREATE_SYMLINK(${PNGLIB_NAME}.pc libpng.pc)
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY)
|
||||
CREATE_SYMLINK(${PNGLIB_NAME}-config libpng-config)
|
||||
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
|
||||
# SET UP LINKS
|
||||
if(PNG_SHARED)
|
||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES
|
||||
# VERSION 16.${PNGLIB_RELEASE}.1.6.0beta29
|
||||
VERSION 16.${PNGLIB_RELEASE}.0
|
||||
SOVERSION 16
|
||||
CLEAN_DIRECT_OUTPUT 1)
|
||||
endif()
|
||||
if(PNG_STATIC)
|
||||
# MSVC doesn't use a different file extension for shared vs. static
|
||||
# libs. We are able to change OUTPUT_NAME to remove the _static
|
||||
# for all other platforms.
|
||||
if(NOT MSVC)
|
||||
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES
|
||||
OUTPUT_NAME ${PNG_LIB_NAME}
|
||||
CLEAN_DIRECT_OUTPUT 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If CMake > 2.4.x, we set a variable used below to export
|
||||
# targets to an export file.
|
||||
# TODO: Use VERSION_GREATER after our cmake_minimum_required >= 2.6.2
|
||||
if(CMAKE_MAJOR_VERSION GREATER 1 AND CMAKE_MINOR_VERSION GREATER 4)
|
||||
set(PNG_EXPORT_RULE EXPORT libpng)
|
||||
elseif(CMAKE_MAJOR_VERSION GREATER 2) # future proof
|
||||
set(PNG_EXPORT_RULE EXPORT libpng)
|
||||
endif()
|
||||
|
||||
# INSTALL
|
||||
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
||||
if(PNG_SHARED)
|
||||
install(TARGETS ${PNG_LIB_NAME}
|
||||
${PNG_EXPORT_RULE}
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
# Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin
|
||||
if(CYGWIN OR MINGW)
|
||||
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
|
||||
get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME)
|
||||
CREATE_SYMLINK(${BUILD_TARGET_FILE} libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif(CYGWIN OR MINGW)
|
||||
|
||||
if(NOT WIN32)
|
||||
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
|
||||
get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME)
|
||||
CREATE_SYMLINK(${BUILD_TARGET_FILE} libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif(NOT WIN32)
|
||||
endif(PNG_SHARED)
|
||||
|
||||
if(PNG_STATIC)
|
||||
install(TARGETS ${PNG_LIB_NAME_STATIC}
|
||||
${PNG_EXPORT_RULE}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME_STATIC} LOCATION_${CMAKE_BUILD_TYPE})
|
||||
get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME)
|
||||
CREATE_SYMLINK(${BUILD_TARGET_FILE} libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
|
||||
install(FILES ${libpng_public_hdrs} DESTINATION include)
|
||||
install(FILES ${libpng_public_hdrs} DESTINATION include/${PNGLIB_NAME})
|
||||
endif()
|
||||
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
|
||||
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin)
|
||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
||||
DESTINATION bin)
|
||||
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
endif()
|
||||
|
||||
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
||||
# Install man pages
|
||||
if(NOT PNG_MAN_DIR)
|
||||
set(PNG_MAN_DIR "share/man")
|
||||
endif()
|
||||
install(FILES libpng.3 libpngpf.3 DESTINATION ${PNG_MAN_DIR}/man3)
|
||||
install(FILES png.5 DESTINATION ${PNG_MAN_DIR}/man5)
|
||||
# Install pkg-config files
|
||||
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config
|
||||
DESTINATION bin)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
||||
DESTINATION bin)
|
||||
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
endif()
|
||||
|
||||
# On versions of CMake that support it, create an export file CMake
|
||||
# users can include() to import our targets
|
||||
if(PNG_EXPORT_RULE AND NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL )
|
||||
install(EXPORT libpng DESTINATION lib/libpng FILE lib${PNG_LIB_NAME}.cmake)
|
||||
endif()
|
||||
|
||||
# what's with libpng-$VER%.txt and all the extra files?
|
||||
|
||||
# UNINSTALL
|
||||
# do we need this?
|
||||
|
||||
# DIST
|
||||
# do we need this?
|
||||
|
||||
# to create msvc import lib for mingw compiled shared lib
|
||||
# pexports libpng.dll > libpng.def
|
||||
# lib /def:libpng.def /machine:x86
|
||||
|
||||
186
INSTALL
@@ -1,17 +1,59 @@
|
||||
|
||||
Installing libpng version 1.0.12beta1 - May 14, 2001
|
||||
Installing libpng
|
||||
|
||||
Before installing libpng, you must first install zlib. zlib
|
||||
can usually be found wherever you got libpng. zlib can be
|
||||
placed in another directory, at the same level as libpng.
|
||||
Note that your system might already have a preinstalled
|
||||
zlib, but you will still need to have access to the
|
||||
zlib.h and zconf.h include files that correspond to the
|
||||
version of zlib that's installed.
|
||||
On Unix/Linux and similar systems, you can simply type
|
||||
|
||||
./configure [--prefix=/path]
|
||||
make check
|
||||
make install
|
||||
|
||||
and ignore the rest of this document.
|
||||
|
||||
If configure does not work on your system, or if you have a need to
|
||||
change configure.ac or Makefile.am, and you have a reasonably
|
||||
up-to-date set of tools, running ./autogen.sh in a git clone before
|
||||
running ./configure may fix the problem. To be really sure that you
|
||||
aren't using any of the included pre-built scripts, you can do this:
|
||||
|
||||
./configure --enable-maintainer-mode
|
||||
make maintainer-clean
|
||||
./autogen.sh --maintainer --clean
|
||||
./autogen.sh --maintainer
|
||||
./configure [--prefix=/path] [other options]
|
||||
make
|
||||
make install
|
||||
make check
|
||||
|
||||
Instead, you can use one of the custom-built makefiles in the
|
||||
"scripts" directory
|
||||
|
||||
cp scripts/makefile.system makefile
|
||||
make test
|
||||
make install
|
||||
|
||||
The files that are presently available in the scripts directory
|
||||
are listed and described in scripts/README.txt.
|
||||
|
||||
Or you can use one of the "projects" in the "projects" directory.
|
||||
|
||||
Before installing libpng, you must first install zlib, if it
|
||||
is not already on your system. zlib can usually be found
|
||||
wherever you got libpng. zlib can be placed in another directory,
|
||||
at the same level as libpng.
|
||||
|
||||
If you want to use "cmake" (see www.cmake.org), type
|
||||
|
||||
cmake . -DCMAKE_INSTALL_PREFIX=/path
|
||||
make
|
||||
make install
|
||||
|
||||
If your system already has a preinstalled zlib you will still need
|
||||
to have access to the zlib.h and zconf.h include files that
|
||||
correspond to the version of zlib that's installed.
|
||||
|
||||
You can rename the directories that you downloaded (they
|
||||
might be called "libpng-1.0.12beta1" or "lpng109" and "zlib-1.1.3"
|
||||
or "zlib113") so that you have directories called "zlib" and "libpng".
|
||||
might be called "libpng-x.y.z" or "libpngNN" and "zlib-1.2.5"
|
||||
or "zlib125") so that you have directories called "zlib" and "libpng".
|
||||
|
||||
Your directory structure should look like this:
|
||||
|
||||
@@ -21,19 +63,25 @@ Your directory structure should look like this:
|
||||
README
|
||||
*.h
|
||||
*.c
|
||||
CMakeLists.txt => "cmake" script
|
||||
configuration files:
|
||||
configure.ac, configure, Makefile.am, Makefile.in,
|
||||
autogen.sh, config.guess, ltmain.sh, missing, libpng.pc.in,
|
||||
libpng-config.in, aclocal.m4, config.h.in, config.sub,
|
||||
depcomp, install-sh, mkinstalldirs, test-pngtest.sh
|
||||
contrib
|
||||
gregbook
|
||||
msvctest
|
||||
pngminim
|
||||
pngminus
|
||||
pngsuite
|
||||
visupng
|
||||
projects
|
||||
beos
|
||||
borland
|
||||
msvc
|
||||
wince
|
||||
visualc71
|
||||
vstudio
|
||||
scripts
|
||||
makefile.*
|
||||
*.def (module definition files)
|
||||
etc.
|
||||
pngtest.png
|
||||
etc.
|
||||
zlib
|
||||
@@ -47,65 +95,13 @@ If the line endings in the files look funny, you may wish to get the other
|
||||
distribution of libpng. It is available in both tar.gz (UNIX style line
|
||||
endings) and zip (DOS style line endings) formats.
|
||||
|
||||
If you are building libpng with MSVC, you can enter the libpng\msvc directory
|
||||
and follow the instructions in msvc\README.txt. You can build libpng for
|
||||
WindowsCE by entering the libpng\wince directory and following the
|
||||
instructions in the README* files.
|
||||
If you are building libpng with MSVC, you can enter the
|
||||
libpng projects\visualc6 or visualc71 directory and follow the instructions
|
||||
in README.txt.
|
||||
|
||||
Else enter the zlib directory and follow the instructions in zlib/README,
|
||||
then come back here and choose the appropriate makefile.sys in the scripts
|
||||
directory.
|
||||
|
||||
The files that are presently available in the scripts directory
|
||||
include
|
||||
|
||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.12beta1)
|
||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.12beta1,
|
||||
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.hpgcc => HPUX makefile using gcc
|
||||
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 for IBM VisualAge/C++ version 4.0 or later
|
||||
makefile.macosx => MACOS X Makefile
|
||||
makefile.netbsd => NetBSD/cc makefile, uses PNGGCCRD
|
||||
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.12beta1)
|
||||
makefile.sunos => Sun makefile
|
||||
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.12beta1)
|
||||
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
|
||||
descrip.mms => VMS makefile for MMS or MMK
|
||||
pngdef.pas => Defines for a png32bd.dll with Borland C++ 4.5
|
||||
SCOPTIONS.ppc => Used with smakefile.ppc
|
||||
Otherwise enter the zlib directory and follow the instructions in zlib/README,
|
||||
then come back here and run "configure" or choose the appropriate
|
||||
makefile.sys in the scripts directory.
|
||||
|
||||
Copy the file (or files) that you need from the
|
||||
scripts directory into this directory, for example
|
||||
@@ -116,22 +112,44 @@ scripts directory into this directory, for example
|
||||
Read the makefile to see if you need to change any source or
|
||||
target directories to match your preferences.
|
||||
|
||||
Then read pngconf.h to see if you want to make any configuration
|
||||
Then read pnglibconf.dfa to see if you want to make any configuration
|
||||
changes.
|
||||
|
||||
Then just run "make test" which will create the libpng library in
|
||||
this directory and run a quick test that reads the "pngtest.png"
|
||||
file and writes a "pngout.png" file that should be identical to it.
|
||||
Look for "9782 zero samples" in the output of the test. For more
|
||||
confidence, you can run another test by typing "pngtest pngnow.png"
|
||||
and looking for "289 zero samples" in the output. Also, you can
|
||||
run "pngtest -m *.png" in the "contrib/pngsuite" directory and compare
|
||||
Then just run "make" which will create the libpng library in
|
||||
this directory and "make test" which will run a quick test that reads
|
||||
the "pngtest.png" file and writes a "pngout.png" file that should be
|
||||
identical to it. Look for "9782 zero samples" in the output of the
|
||||
test. For more confidence, you can run another test by typing
|
||||
"pngtest pngnow.png" and looking for "289 zero samples" in the output.
|
||||
Also, you can run "pngtest -m contrib/pngsuite/*.png" and compare
|
||||
your output with the result shown in contrib/pngsuite/README.
|
||||
|
||||
Most of the makefiles will allow you to run "make install" to
|
||||
put the library in its final resting place (if you want to
|
||||
do that, run "make install" in the zlib directory first if necessary).
|
||||
Some also allow you to run "make test-installed" after you have
|
||||
run "make install".
|
||||
|
||||
Further information can be found in the README and libpng-manual.txt
|
||||
files, in the individual makefiles, in png.h, and the manual pages
|
||||
libpng.3 and png.5.
|
||||
|
||||
Using the ./configure script -- 16 December 2002.
|
||||
=================================================
|
||||
|
||||
The ./configure script should work compatibly with what scripts/makefile.*
|
||||
did, however there are some options you might need to add to configure
|
||||
explicitly, which previously was done semi-automatically (if you didn't edit
|
||||
scripts/makefile.* yourself, that is)
|
||||
|
||||
CFLAGS="-Wall -O -funroll-loops \
|
||||
-malign-loops=2 -malign-functions=2" ./configure --prefix=/usr/include \
|
||||
--with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include
|
||||
|
||||
You can alternatively specify --includedir=/usr/include, /usr/local/include,
|
||||
/usr/include/libpng%NN%, or whatever.
|
||||
|
||||
If you find that the configure script is out-of-date or is not supporting
|
||||
your platform properly, try running autogen.sh to regenerate "configure",
|
||||
"Makefile.in", and the other configuration files. Then try configure again.
|
||||
|
||||
Further information can be found in the README and libpng.txt
|
||||
files, in the individual makefiles, in png.h, in the README files in
|
||||
subdirectories of the LIB directory, and the manual pages libpng.3 and png.5.
|
||||
|
||||
7
KNOWNBUG
@@ -1,7 +0,0 @@
|
||||
|
||||
Known bugs in libpng-1.0.11
|
||||
|
||||
1. April 22, 2001: pnggccrd.c has been reported to crash on NetBSD when
|
||||
reading interlaced PNG files, when assembler code is enabled.
|
||||
|
||||
STATUS: Under investigation.
|
||||
27
LICENSE
@@ -8,9 +8,18 @@ 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.12beta1, May 14, 2001, are
|
||||
Copyright (c) 2000, 2001 Glenn Randers-Pehrson
|
||||
and are distributed according to the same disclaimer and license as libpng-1.0.6
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.6.0beta29, September 4, 2012, are
|
||||
Copyright (c) 2004, 2006-2012 Glenn Randers-Pehrson, and are
|
||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||
with the following individual added to the list of Contributing Authors
|
||||
|
||||
Cosmin Truta
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are
|
||||
Copyright (c) 2000-2002 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
|
||||
@@ -73,11 +82,11 @@ 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.
|
||||
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.
|
||||
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
|
||||
@@ -98,5 +107,5 @@ 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
|
||||
May 14, 2001
|
||||
glennrp at users.sourceforge.net
|
||||
September 4, 2012
|
||||
|
||||
267
Makefile.am
Normal file
@@ -0,0 +1,267 @@
|
||||
# Makefile.am:
|
||||
# Source file for Makefile.in (and hence Makefile)
|
||||
#
|
||||
|
||||
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
||||
|
||||
ACLOCAL_AMFLAGS = -I scripts
|
||||
|
||||
# test programs - run on make check, make distcheck
|
||||
TESTS_ENVIRONMENT= srcdir=$(srcdir)
|
||||
check_PROGRAMS= pngtest
|
||||
pngtest_SOURCES = pngtest.c
|
||||
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
TESTS = test-pngtest.sh
|
||||
|
||||
# Only do the following if the contrib directory is present.
|
||||
check_PROGRAMS+= pngvalid pngstest pngunknown
|
||||
pngvalid_SOURCES = contrib/libtests/pngvalid.c
|
||||
pngstest_SOURCES = contrib/libtests/pngstest.c
|
||||
pngunknown_SOURCES = contrib/libtests/pngunknown.c
|
||||
pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
pngstest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
pngunknown_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
TESTS += contrib/libtests/test-pngunknown.sh\
|
||||
contrib/libtests/test-pngvalid-simple.sh\
|
||||
contrib/libtests/test-pngvalid-full.sh\
|
||||
contrib/libtests/test-pngstest.sh
|
||||
|
||||
# man pages
|
||||
dist_man_MANS= libpng.3 libpngpf.3 png.5
|
||||
|
||||
# generate the -config scripts if required
|
||||
binconfigs= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config
|
||||
EXTRA_SCRIPTS= libpng-config libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config
|
||||
bin_SCRIPTS= @binconfigs@
|
||||
|
||||
# rules to build libpng, only build the old library on request
|
||||
lib_LTLIBRARIES=libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
# EXTRA_LTLIBRARIES= libpng.la
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
|
||||
pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c\
|
||||
pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c\
|
||||
png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h pngusr.dfa
|
||||
|
||||
if PNG_ARM_NEON
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/filter_neon.S
|
||||
endif
|
||||
|
||||
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
|
||||
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
|
||||
-version-number @PNGLIB_MAJOR@@PNGLIB_MINOR@:@PNGLIB_RELEASE@:0
|
||||
|
||||
if HAVE_LD_VERSION_SCRIPT
|
||||
# Versioned symbols and restricted exports
|
||||
if HAVE_SOLARIS_LD
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,-M -Wl,libpng.vers
|
||||
else
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,--version-script=libpng.vers
|
||||
endif
|
||||
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.vers
|
||||
else
|
||||
# Only restricted exports when possible
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -export-symbols libpng.sym
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
|
||||
endif
|
||||
|
||||
#distribute headers in /usr/include/libpng/*
|
||||
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
|
||||
pkginclude_HEADERS= png.h pngconf.h
|
||||
nodist_pkginclude_HEADERS= pnglibconf.h
|
||||
|
||||
# pkg-config stuff, note that libpng.pc is always required in order
|
||||
# to get the correct library
|
||||
pkgconfigdir = @pkgconfigdir@
|
||||
pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
|
||||
|
||||
#extra source distribution files.
|
||||
EXTRA_DIST= \
|
||||
ANNOUNCE CHANGES INSTALL LICENSE README TODO \
|
||||
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
|
||||
${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
|
||||
$(TESTS) \
|
||||
CMakeLists.txt example.c libpng-manual.txt
|
||||
|
||||
SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk scripts/pnglibconf.dfn
|
||||
|
||||
CLEANFILES= *.tf? pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \
|
||||
check.new pnglibconf.* pngprefix.h symbols.new pngtest-log.txt \
|
||||
$(SCRIPT_CLEANFILES)
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
|
||||
config.sub configure depcomp install-sh ltmain.sh missing
|
||||
|
||||
# PNG_COPTS give extra options for the C compiler to be used on all compilation
|
||||
# steps (unless targe_CFLAGS is specified; that will take precedence over
|
||||
# AM_CFLAGS)
|
||||
PNG_COPTS = @PNG_COPTS@
|
||||
AM_CFLAGS = ${PNG_COPTS}
|
||||
|
||||
# DFNCPP is normally just CPP - the C preprocessor - but on Solaris and maybe
|
||||
# other operating systems (NeXT?) the C preprocessor selected by configure
|
||||
# checks input tokens for validity - effectively it performs part of the ANSI-C
|
||||
# parsing - and therefore fails with the .df files. configure.ac has special
|
||||
# checks for this and sets DFNCPP appropriately.
|
||||
DFNCPP = @DFNCPP@
|
||||
|
||||
SUFFIXES = .chk .dfn .out
|
||||
|
||||
$(PNGLIB_BASENAME).pc: libpng.pc
|
||||
cp libpng.pc $@
|
||||
|
||||
$(PNGLIB_BASENAME)-config: libpng-config
|
||||
cp libpng-config $@
|
||||
|
||||
scripts/sym.out scripts/vers.out: png.h pngconf.h pnglibconf.h
|
||||
scripts/prefix.out: png.h pngconf.h pnglibconf.out
|
||||
scripts/symbols.out: png.h pngconf.h $(srcdir)/scripts/pnglibconf.h.prebuilt
|
||||
|
||||
libpng.sym: scripts/sym.out
|
||||
rm -f $@
|
||||
cp $? $@
|
||||
libpng.vers: scripts/vers.out
|
||||
rm -f $@
|
||||
cp $? $@
|
||||
|
||||
if DO_PNG_PREFIX
|
||||
# Rename functions in scripts/prefix.out with a PNG_PREFIX prefix.
|
||||
# Rename macros in scripts/macro.lst from PNG_PREFIXpng_ to PNG_ (the actual
|
||||
# implementation of the macro).
|
||||
pnglibconf.h: pnglibconf.out scripts/prefix.out scripts/macro.lst
|
||||
rm -f $@
|
||||
$(AWK) 's==0 && NR>1{print prev}\
|
||||
s==0{prev=$$0}\
|
||||
s==1{print "#define", $$1, "@PNG_PREFIX@" $$1}\
|
||||
s==2{print "#define @PNG_PREFIX@png_" $$1, "PNG_" $$1}\
|
||||
END{print prev}' s=0 pnglibconf.out s=1 scripts/prefix.out\
|
||||
s=2 ${srcdir}/scripts/macro.lst >pnglibconf.tf8
|
||||
mv pnglibconf.tf8 $@
|
||||
|
||||
pngprefix.h: scripts/intprefix.out
|
||||
rm -f pngprefix.tf1
|
||||
$(AWK) '{print "#define", $$1, "@PNG_PREFIX@" $$1}' $? >pngprefix.tf1
|
||||
mv pngprefix.tf1 $@
|
||||
else
|
||||
pnglibconf.h: pnglibconf.out
|
||||
rm -f $@
|
||||
cp $? $@
|
||||
|
||||
pngprefix.h: # is empty
|
||||
:>$@
|
||||
endif
|
||||
|
||||
$(srcdir)/scripts/pnglibconf.h.prebuilt:
|
||||
@echo "Attempting to build $@" >&2
|
||||
@echo "This is a machine generated file, but if you want to make" >&2
|
||||
@echo "a new one simply make 'scripts/pnglibconf.out' and copy that" >&2
|
||||
@exit 1
|
||||
|
||||
# The following is necessary to ensure that the local pnglibconf.h is used, not
|
||||
# an installed one (this can happen immediately after on a clean system if
|
||||
# 'make test' is the first thing the user does.)
|
||||
contrib/libtests/pngstest.o contrib/libtests/pngvalid.o pngtest.o: pnglibconf.h
|
||||
contrib/libtests/pngunknown.o: pnglibconf.h
|
||||
|
||||
# We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually
|
||||
# be built with PNG_USE_READ_MACROS; this prevents the read macros from
|
||||
# interfering with the symbol file format.
|
||||
SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\
|
||||
-DPNGLIB_VERSION='@PNGLIB_VERSION@'\
|
||||
-DSYMBOL_PREFIX='$(SYMBOL_PREFIX)'\
|
||||
-DPNG_NO_USE_READ_MACROS -DPNG_BUILDING_SYMBOL_TABLE
|
||||
|
||||
if DO_PNG_PREFIX
|
||||
SYMBOL_CFLAGS += -DPNG_PREFIX='@PNG_PREFIX@'
|
||||
endif
|
||||
|
||||
.dfn.out:
|
||||
rm -f $@ $*.c $*.tf[123]
|
||||
test -d scripts || mkdir scripts
|
||||
echo '#include "$<"' >$*.c
|
||||
$(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)\
|
||||
$(CPPFLAGS) $(SYMBOL_CFLAGS) $*.c > $*.tf1
|
||||
$(SED) -n -e 's|^.*PNG_DEFN_MAGIC *-\(.*\)- *PNG_DEFN_END.*$$|\1|p'\
|
||||
$*.tf1 >$*.tf2
|
||||
$(SED) -e 's| *PNG_JOIN *||g' -e 's| *$$||' $*.tf2 >$*.tf3
|
||||
rm -f $*.c $*.tf[12]
|
||||
mv $*.tf3 $@
|
||||
|
||||
# The .dfn file for pnglibconf.h is machine generated
|
||||
pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa $(DFA_XTRA)
|
||||
rm -f $@ $*.tf[45]
|
||||
$(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf4 version=search\
|
||||
${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\
|
||||
${srcdir}/pngusr.dfa $(DFA_XTRA) 1>&2
|
||||
$(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf5 $*.tf4 1>&2
|
||||
rm $*.tf4
|
||||
mv $*.tf5 $@
|
||||
|
||||
# Symbol checks (.def and .out files should match)
|
||||
scripts/symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/symbols.out
|
||||
|
||||
.out.chk:
|
||||
rm -f $@ $*.new
|
||||
$(AWK) -f ${srcdir}/scripts/checksym.awk ${srcdir}/scripts/${*F}.def\
|
||||
of="$*.new" $< >&2
|
||||
mv $*.new $@
|
||||
|
||||
# used on demand to regenerate the standard header, CPPFLAGS should
|
||||
# be empty - no non-standard defines
|
||||
scripts/pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
|
||||
rm -f $@ pnglibconf.tf[67]
|
||||
test -z "$(CPPFLAGS)"
|
||||
echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\
|
||||
$(AWK) -f ${srcdir}/scripts/options.awk out=pnglibconf.tf6\
|
||||
logunsupported=1 version=search ${srcdir}/pngconf.h -\
|
||||
${srcdir}/scripts/pnglibconf.dfa 1>&2
|
||||
$(AWK) -f ${srcdir}/scripts/options.awk out=pnglibconf.tf7\
|
||||
pnglibconf.tf6 1>&2
|
||||
rm pnglibconf.tf6
|
||||
mv pnglibconf.tf7 $@
|
||||
|
||||
$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h \
|
||||
pnglibconf.h pngpriv.h pngdebug.h pnginfo.h pngstruct.h pngprefix.h
|
||||
|
||||
test: check-am
|
||||
|
||||
# Extra checks
|
||||
check: scripts/symbols.chk
|
||||
|
||||
# Don't distribute the generated script files
|
||||
dist-hook:
|
||||
cd '$(top_distdir)'; rm -f $(SCRIPT_CLEANFILES)
|
||||
|
||||
# install the .../include headers as links to the new ones
|
||||
install-data-hook:
|
||||
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h pnglibconf.h
|
||||
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/png.h png.h
|
||||
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pngconf.h \
|
||||
pngconf.h
|
||||
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pnglibconf.h \
|
||||
pnglibconf.h
|
||||
cd $(DESTDIR)$(pkgconfigdir); rm -f libpng.pc
|
||||
cd $(DESTDIR)$(pkgconfigdir); $(LN_S) $(PNGLIB_BASENAME).pc libpng.pc
|
||||
|
||||
# do evil things to libpng to cause libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ to be used
|
||||
install-exec-hook:
|
||||
cd $(DESTDIR)$(bindir); rm -f libpng-config
|
||||
cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config
|
||||
@set -x;\
|
||||
cd $(DESTDIR)$(libdir);\
|
||||
for ext in a la so so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@ sl dylib dll.a; do\
|
||||
rm -f libpng.$$ext;\
|
||||
if test -f $(PNGLIB_BASENAME).$$ext; then\
|
||||
$(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\
|
||||
fi;\
|
||||
done
|
||||
|
||||
uninstall-hook:
|
||||
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h pnglibconf.h
|
||||
rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc
|
||||
rm -f $(DESTDIR)$(bindir)/libpng-config
|
||||
rm -f $(DESTDIR)$(libdir)/libpng.a
|
||||
rm -f $(DESTDIR)$(libdir)/libpng.la
|
||||
rm -f $(DESTDIR)$(libdir)/libpng.dll.a
|
||||
151
README
@@ -1,11 +1,11 @@
|
||||
README for libpng 1.0.12beta1 - May 14, 2001 (shared library 2.1)
|
||||
README for libpng version 1.6.0beta29 - September 4, 2012 (shared library 16.0)
|
||||
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.
|
||||
Libpng comes in several distribution formats. Get libpng-*.tar.gz,
|
||||
libpng-*.tar.xz or libpng-*.tar.bz2 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
|
||||
@@ -54,11 +54,11 @@ 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.
|
||||
on the PNG-implement mailing list 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
|
||||
For a detailed description on using libpng, read libpng-manual.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
|
||||
@@ -77,16 +77,15 @@ 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
|
||||
zlib should be available at the same place that libpng is, or at.
|
||||
ftp://ftp.info-zip.org/pub/infozip/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.
|
||||
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
|
||||
these at http://www.libpng.org/pub/png/documents/
|
||||
|
||||
This code is currently being archived at ftp.uu.net in the
|
||||
/graphics/png directory, and on CompuServe, Lib 20 (PNG SUPPORT)
|
||||
This code is currently being archived at libpng.sf.net in the
|
||||
[DOWNLOAD] area, 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.
|
||||
|
||||
@@ -102,30 +101,32 @@ Finally, if you get any warning messages when compiling libpng
|
||||
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.
|
||||
based in a large way on Guy's and Andreas' earlier work), and the PNG
|
||||
development group.
|
||||
|
||||
randeg@alum.rpi.edu
|
||||
png-implement@ccrc.wustl.edu
|
||||
Send comments/corrections/commendations to png-mng-implement at
|
||||
lists.sourceforge.net (subscription required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||
to subscribe) or to glennrp at users.sourceforge.net
|
||||
|
||||
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.
|
||||
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
|
||||
png-mng-misc at lists.sf.net (subscription required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-misc to
|
||||
subscribe). 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
|
||||
been discussing PNG for sixteen 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.
|
||||
gladly listen. Even if your suggestion is not used immediately,
|
||||
it may be used later.
|
||||
|
||||
Files in this distribution:
|
||||
|
||||
@@ -137,14 +138,17 @@ Files in this distribution:
|
||||
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
|
||||
libpng.3 => manual page for libpng (includes libpng-manual.txt)
|
||||
libpng-manual.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
|
||||
png.h => Library function and interface declarations (public)
|
||||
pngpriv.h => Library function and interface declarations (private)
|
||||
pngconf.h => System specific library configuration (public)
|
||||
pngstruct.h => png_struct declaration (private)
|
||||
pnginfo.h => png_info struct declaration (private)
|
||||
pngdebug.h => debugging macros (private)
|
||||
pngerror.c => Error/warning message I/O functions
|
||||
pngget.c => Functions for retrieving info from struct
|
||||
pngmem.c => Memory handling functions
|
||||
@@ -171,77 +175,28 @@ Files in this distribution:
|
||||
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
|
||||
beos => Contains a Beos workspace for building libpng
|
||||
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
|
||||
projects => Contains project files and workspaces for
|
||||
building a DLL
|
||||
cbuilder5 => Contains a Borland workspace for building
|
||||
libpng and zlib
|
||||
visualc6 => Contains a Microsoft Visual C++ (MSVC)
|
||||
workspace for building libpng and zlib
|
||||
visualc71 => Contains a Microsoft Visual C++ (MSVC)
|
||||
workspace for building libpng and zlib
|
||||
xcode => Contains an Apple xcode
|
||||
workspace for building libpng and zlib
|
||||
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.12beta1)
|
||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates
|
||||
libpng.so.2.1.0.12beta1, 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.hpgcc => HPUX makefile using gcc
|
||||
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.netbsd => NetBSD/cc makefile, uses PNGGCCRD
|
||||
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
|
||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.12beta1)
|
||||
makefile.sunos => Sun makefile
|
||||
makefile.solaris => Solaris 2.X makefile
|
||||
(gcc, creates libpng.so.2.1.0.12beta1)
|
||||
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
|
||||
(see scripts/README.txt for the list of scripts)
|
||||
|
||||
Good luck, and happy coding.
|
||||
|
||||
-Glenn Randers-Pehrson
|
||||
Internet: randeg@alum.rpi.edu
|
||||
-Glenn Randers-Pehrson (current maintainer, since 1998)
|
||||
Internet: glennrp at users.sourceforge.net
|
||||
|
||||
-Andreas Eric Dilger
|
||||
Internet: adilger@enel.ucalgary.ca
|
||||
-Andreas Eric Dilger (former maintainer, 1996-1997)
|
||||
Internet: adilger at enel.ucalgary.ca
|
||||
Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/
|
||||
|
||||
-Guy Eric Schalnat
|
||||
-Guy Eric Schalnat (original author and former maintainer, 1995-1996)
|
||||
(formerly of Group 42, Inc)
|
||||
Internet: gschal@infinet.com
|
||||
Internet: gschal at infinet.com
|
||||
|
||||
13
TODO
@@ -1,12 +1,11 @@
|
||||
/*
|
||||
TODO - list of things to do for libpng:
|
||||
|
||||
Final bug fixes.
|
||||
Improve API by hiding the png_struct and png_info structs.
|
||||
Finish work on the no-floating-point version (including gamma compensation)
|
||||
Better C++ wrapper/full C++ implementation?
|
||||
Fix problem with C++ and EXTERN "C".
|
||||
cHRM transformation.
|
||||
Improve setjmp/longjmp usage or remove it in favor of returning error codes.
|
||||
Remove setjmp/longjmp usage in favor of returning error codes.
|
||||
Add "grayscale->palette" transformation and "palette->grayscale" detection.
|
||||
Improved dithering.
|
||||
Multi-lingual error and warning message support.
|
||||
@@ -17,8 +16,12 @@ Better filter selection
|
||||
(counting huffman bits/precompression? filter inertia? filter costs?).
|
||||
Histogram creation.
|
||||
Text conversion between different code pages (Latin-1 -> Mac and DOS).
|
||||
Should we always malloc 2^bit_depth PLTE/tRNS/hIST entries for safety?
|
||||
Build gamma tables using fixed point (and do away with floating point entirely).
|
||||
Avoid building gamma tables whenever possible.
|
||||
Use greater precision when changing to linear gamma for compositing against
|
||||
background and doing rgb-to-gray transformation.
|
||||
Investigate pre-incremented loop counters and other loop constructions.
|
||||
Add interpolated method of handling interlacing.
|
||||
Switch to the simpler zlib (zlib/libpng) license if legally possible.
|
||||
Extend pngvalid.c to validate more of the libpng transformations.
|
||||
|
||||
*/
|
||||
|
||||
55
Y2KINFO
@@ -1,55 +0,0 @@
|
||||
Y2K compliance in libpng:
|
||||
=========================
|
||||
|
||||
May 14, 2001
|
||||
|
||||
Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
|
||||
This is your unofficial assurance that libpng from version 0.71 and
|
||||
upward through 1.0.12beta1 are Y2K compliant. It is my belief that earlier
|
||||
versions were also Y2K compliant.
|
||||
|
||||
Libpng only has three year fields. One is a 2-byte unsigned integer
|
||||
that will hold years up to 65535. The other two hold the date in text
|
||||
format, and will hold years up to 9999.
|
||||
|
||||
The integer is
|
||||
"png_uint_16 year" in png_time_struct.
|
||||
|
||||
The strings are
|
||||
"png_charp time_buffer" in png_struct and
|
||||
"near_time_buffer", which is a local character string in png.c.
|
||||
|
||||
There are seven time-related functions:
|
||||
|
||||
png_convert_to_rfc_1123() in png.c
|
||||
(formerly png_convert_to_rfc_1152() in error)
|
||||
png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
|
||||
png_convert_from_time_t() in pngwrite.c
|
||||
png_get_tIME() in pngget.c
|
||||
png_handle_tIME() in pngrutil.c, called in pngread.c
|
||||
png_set_tIME() in pngset.c
|
||||
png_write_tIME() in pngwutil.c, called in pngwrite.c
|
||||
|
||||
All appear to handle dates properly in a Y2K environment. The
|
||||
png_convert_from_time_t() function calls gmtime() to convert from system
|
||||
clock time, which returns (year - 1900), which we properly convert to
|
||||
the full 4-digit year. There is a possibility that applications using
|
||||
libpng are not passing 4-digit years into the png_convert_to_rfc_1123()
|
||||
function, or that they are incorrectly passing only a 2-digit year
|
||||
instead of "year - 1900" into the png_convert_from_struct_tm() function,
|
||||
but this is not under our control. The libpng documentation has always
|
||||
stated that it works with 4-digit years, and the APIs have been
|
||||
documented as such.
|
||||
|
||||
The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned
|
||||
integer to hold the year, and can hold years as large as 65535.
|
||||
|
||||
zlib, upon which libpng depends, is also Y2K compliant. It contains
|
||||
no date-related code.
|
||||
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
libpng maintainer
|
||||
PNG Development Group
|
||||
225
arm/filter_neon.S
Normal file
@@ -0,0 +1,225 @@
|
||||
|
||||
/* filter_neon.S - NEON optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2011 Glenn Randers-Pehrson
|
||||
* Written by Mans Rullgard, 2011.
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*/
|
||||
|
||||
#if defined(__linux__) && defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
|
||||
#endif
|
||||
|
||||
#ifdef __ELF__
|
||||
# define ELF
|
||||
#else
|
||||
# define ELF @
|
||||
#endif
|
||||
|
||||
.arch armv7-a
|
||||
.fpu neon
|
||||
|
||||
.macro func name, export=0
|
||||
.macro endfunc
|
||||
ELF .size \name, . - \name
|
||||
.endfunc
|
||||
.purgem endfunc
|
||||
.endm
|
||||
.text
|
||||
.if \export
|
||||
.global \name
|
||||
.endif
|
||||
ELF .type \name, STT_FUNC
|
||||
.func \name
|
||||
\name:
|
||||
.endm
|
||||
|
||||
func png_read_filter_row_sub4_neon, export=1
|
||||
ldr r3, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
1:
|
||||
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
|
||||
vadd.u8 d0, d3, d4
|
||||
vadd.u8 d1, d0, d5
|
||||
vadd.u8 d2, d1, d6
|
||||
vadd.u8 d3, d2, d7
|
||||
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
|
||||
subs r3, r3, #16
|
||||
bgt 1b
|
||||
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
func png_read_filter_row_sub3_neon, export=1
|
||||
ldr r3, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
mov r0, r1
|
||||
mov r2, #3
|
||||
mov r12, #12
|
||||
vld1.8 {q11}, [r0], r12
|
||||
1:
|
||||
vext.8 d5, d22, d23, #3
|
||||
vadd.u8 d0, d3, d22
|
||||
vext.8 d6, d22, d23, #6
|
||||
vadd.u8 d1, d0, d5
|
||||
vext.8 d7, d23, d23, #1
|
||||
vld1.8 {q11}, [r0], r12
|
||||
vst1.32 {d0[0]}, [r1,:32], r2
|
||||
vadd.u8 d2, d1, d6
|
||||
vst1.32 {d1[0]}, [r1], r2
|
||||
vadd.u8 d3, d2, d7
|
||||
vst1.32 {d2[0]}, [r1], r2
|
||||
vst1.32 {d3[0]}, [r1], r2
|
||||
subs r3, r3, #12
|
||||
bgt 1b
|
||||
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
func png_read_filter_row_up_neon, export=1
|
||||
ldr r3, [r0, #4] @ rowbytes
|
||||
1:
|
||||
vld1.8 {q0}, [r1,:128]
|
||||
vld1.8 {q1}, [r2,:128]!
|
||||
vadd.u8 q0, q0, q1
|
||||
vst1.8 {q0}, [r1,:128]!
|
||||
subs r3, r3, #16
|
||||
bgt 1b
|
||||
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
func png_read_filter_row_avg4_neon, export=1
|
||||
ldr r12, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
1:
|
||||
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
|
||||
vld4.32 {d16[],d17[],d18[],d19[]},[r2,:128]!
|
||||
vhadd.u8 d0, d3, d16
|
||||
vadd.u8 d0, d0, d4
|
||||
vhadd.u8 d1, d0, d17
|
||||
vadd.u8 d1, d1, d5
|
||||
vhadd.u8 d2, d1, d18
|
||||
vadd.u8 d2, d2, d6
|
||||
vhadd.u8 d3, d2, d19
|
||||
vadd.u8 d3, d3, d7
|
||||
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
|
||||
subs r12, r12, #16
|
||||
bgt 1b
|
||||
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
func png_read_filter_row_avg3_neon, export=1
|
||||
push {r4,lr}
|
||||
ldr r12, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
mov r0, r1
|
||||
mov r4, #3
|
||||
mov lr, #12
|
||||
vld1.8 {q11}, [r0], lr
|
||||
1:
|
||||
vld1.8 {q10}, [r2], lr
|
||||
vext.8 d5, d22, d23, #3
|
||||
vhadd.u8 d0, d3, d20
|
||||
vext.8 d17, d20, d21, #3
|
||||
vadd.u8 d0, d0, d22
|
||||
vext.8 d6, d22, d23, #6
|
||||
vhadd.u8 d1, d0, d17
|
||||
vext.8 d18, d20, d21, #6
|
||||
vadd.u8 d1, d1, d5
|
||||
vext.8 d7, d23, d23, #1
|
||||
vld1.8 {q11}, [r0], lr
|
||||
vst1.32 {d0[0]}, [r1,:32], r4
|
||||
vhadd.u8 d2, d1, d18
|
||||
vst1.32 {d1[0]}, [r1], r4
|
||||
vext.8 d19, d21, d21, #1
|
||||
vadd.u8 d2, d2, d6
|
||||
vhadd.u8 d3, d2, d19
|
||||
vst1.32 {d2[0]}, [r1], r4
|
||||
vadd.u8 d3, d3, d7
|
||||
vst1.32 {d3[0]}, [r1], r4
|
||||
subs r12, r12, #12
|
||||
bgt 1b
|
||||
|
||||
pop {r4,pc}
|
||||
endfunc
|
||||
|
||||
.macro paeth rx, ra, rb, rc
|
||||
vaddl.u8 q12, \ra, \rb @ a + b
|
||||
vaddl.u8 q15, \rc, \rc @ 2*c
|
||||
vabdl.u8 q13, \rb, \rc @ pa
|
||||
vabdl.u8 q14, \ra, \rc @ pb
|
||||
vabd.u16 q15, q12, q15 @ pc
|
||||
vcle.u16 q12, q13, q14 @ pa <= pb
|
||||
vcle.u16 q13, q13, q15 @ pa <= pc
|
||||
vcle.u16 q14, q14, q15 @ pb <= pc
|
||||
vand q12, q12, q13 @ pa <= pb && pa <= pc
|
||||
vmovn.u16 d28, q14
|
||||
vmovn.u16 \rx, q12
|
||||
vbsl d28, \rb, \rc
|
||||
vbsl \rx, \ra, d28
|
||||
.endm
|
||||
|
||||
func png_read_filter_row_paeth4_neon, export=1
|
||||
ldr r12, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
vmov.i8 d20, #0
|
||||
1:
|
||||
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
|
||||
vld4.32 {d16[],d17[],d18[],d19[]},[r2,:128]!
|
||||
paeth d0, d3, d16, d20
|
||||
vadd.u8 d0, d0, d4
|
||||
paeth d1, d0, d17, d16
|
||||
vadd.u8 d1, d1, d5
|
||||
paeth d2, d1, d18, d17
|
||||
vadd.u8 d2, d2, d6
|
||||
paeth d3, d2, d19, d18
|
||||
vmov d20, d19
|
||||
vadd.u8 d3, d3, d7
|
||||
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
|
||||
subs r12, r12, #16
|
||||
bgt 1b
|
||||
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
func png_read_filter_row_paeth3_neon, export=1
|
||||
push {r4,lr}
|
||||
ldr r12, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
vmov.i8 d4, #0
|
||||
mov r0, r1
|
||||
mov r4, #3
|
||||
mov lr, #12
|
||||
vld1.8 {q11}, [r0], lr
|
||||
1:
|
||||
vld1.8 {q10}, [r2], lr
|
||||
paeth d0, d3, d20, d4
|
||||
vext.8 d5, d22, d23, #3
|
||||
vadd.u8 d0, d0, d22
|
||||
vext.8 d17, d20, d21, #3
|
||||
paeth d1, d0, d17, d20
|
||||
vst1.32 {d0[0]}, [r1,:32], r4
|
||||
vext.8 d6, d22, d23, #6
|
||||
vadd.u8 d1, d1, d5
|
||||
vext.8 d18, d20, d21, #6
|
||||
paeth d2, d1, d18, d17
|
||||
vext.8 d7, d23, d23, #1
|
||||
vld1.8 {q11}, [r0], lr
|
||||
vst1.32 {d1[0]}, [r1], r4
|
||||
vadd.u8 d2, d2, d6
|
||||
vext.8 d19, d21, d21, #1
|
||||
paeth d3, d2, d19, d18
|
||||
vst1.32 {d2[0]}, [r1], r4
|
||||
vmov d4, d19
|
||||
vadd.u8 d3, d3, d7
|
||||
vst1.32 {d3[0]}, [r1], r4
|
||||
subs r12, r12, #12
|
||||
bgt 1b
|
||||
|
||||
pop {r4,pc}
|
||||
endfunc
|
||||
219
autogen.sh
Executable file
@@ -0,0 +1,219 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Run 'autoreconf' to build 'configure', 'Makefile.in' and other configure
|
||||
# control files.
|
||||
#
|
||||
# The first time this is run on a GIT checkout the only files that exist are
|
||||
# configure.ac and Makefile.am; all of the autotools support scripts are
|
||||
# missing. They are instantiated with autoreconf --force --install.
|
||||
#
|
||||
# For regular ("tarball") distributions all the files should exist. We do not
|
||||
# want them to be updated *under any circumstances*. It should never be
|
||||
# necessary to rune autogen.sh because ./configure --enable-maintainer-mode says
|
||||
# what to do if Makeile.am or configure.ac are changed.
|
||||
#
|
||||
# It is *probably* OK to update the files on a GIT checkout, because they have
|
||||
# come from the local tools, but leave that to the user who is assumed to know
|
||||
# whether it is ok or required.
|
||||
#
|
||||
# This script is intended to work without arguments, there are, however, hidden
|
||||
# arguments for (a) use while testing the script and (b) to fix up systems that
|
||||
# have been broken. If (b) is required the script prompts for the correct
|
||||
# options. For this reason the options are *NOT* documented in the help; this
|
||||
# is deliberate; UTSL.
|
||||
#
|
||||
clean=
|
||||
maintainer=
|
||||
while test $# -gt 0
|
||||
do
|
||||
case "$1" in
|
||||
--maintainer)
|
||||
maintainer=1;;
|
||||
|
||||
--clean)
|
||||
clean=1;;
|
||||
|
||||
*)
|
||||
exec >&2
|
||||
echo "$0: usage: ./autogen.sh"
|
||||
if test -d .git
|
||||
then
|
||||
echo " ./autogen.sh generates the configure script and"
|
||||
echo " Makefile.in, or refreshes them after changes to Makefile.am"
|
||||
echo " or configure.ac. You may prefer to just run autoreconf."
|
||||
elif test -z "$maintainer"
|
||||
then
|
||||
echo " DO NOT RUN THIS SCRIPT."
|
||||
echo " If you need to change Makefile.am or configure.ac then you"
|
||||
echo " also need to run ./configure --enable-maintainer-mode and"
|
||||
echo " use the appropriate autotools, *NOT* this script, to update"
|
||||
echo " everything, please check the documentation of autoreconf."
|
||||
echo " WARNING: libpng is intentionally generated with a known,"
|
||||
echo " fixed, set of autotools. It is known *NOT* to work with"
|
||||
echo " the collection of autotools distributed on highly reputable"
|
||||
echo " operating systems."
|
||||
echo " Remember: autotools is GNU software, you are expected to"
|
||||
echo " pay for support."
|
||||
else
|
||||
echo " You have run autogen.sh with --maintainer enabled and you"
|
||||
echo " are not using a GIT distribution, then you have given an"
|
||||
echo " unrecognized argument. This is not good. --maintainer"
|
||||
echo " switches off any assumptions that you might not know what"
|
||||
echo " you are doing."
|
||||
fi
|
||||
exit 1;;
|
||||
esac
|
||||
|
||||
shift
|
||||
done
|
||||
#
|
||||
# First check for a set of the autotools files; if absent then this is assumed
|
||||
# to be a GIT version and the local autotools must be used. If present this
|
||||
# is a tarball distribution and the script should not be used. If partially
|
||||
# present bad things are happening.
|
||||
#
|
||||
# The autotools generated files:
|
||||
libpng_autotools_files="Makefile.in aclocal.m4 config.guess config.h.in\
|
||||
config.sub configure depcomp install-sh ltmain.sh missing"
|
||||
#
|
||||
# These are separate because 'maintainer-clean' does not remove them.
|
||||
libpng_libtool_files="scripts/libtool.m4 scripts/ltoptions.m4\
|
||||
scripts/ltsugar.m4 scripts/ltversion.m4 scripts/lt~obsolete.m4"
|
||||
|
||||
libpng_autotools_dirs="autom4te.cache" # not required
|
||||
#
|
||||
# The configure generated files:
|
||||
libpng_configure_files="Makefile config.h config.log config.status\
|
||||
libpng-config libpng.pc libtool stamp-h1"
|
||||
|
||||
libpng_configure_dirs=".deps"
|
||||
#
|
||||
# We must remove the configure generated files as well as the autotools
|
||||
# generated files if autotools are regenerated because otherwise if configure
|
||||
# has been run without "--enable-maintainer-mode" make can do a partial update
|
||||
# of Makefile. These functions do the two bits of cleaning.
|
||||
clean_autotools(){
|
||||
rm -rf $libpng_autotools_files $libpng_libtool_files $libpng_autotools_dirs
|
||||
}
|
||||
|
||||
clean_configure(){
|
||||
rm -rf $libpng_configure_files $libpng_configure_dirs
|
||||
}
|
||||
#
|
||||
# Clean: remove everything (this is to help with testing)
|
||||
if test -n "$clean"
|
||||
then
|
||||
clean_configure
|
||||
if test -n "$maintainer"
|
||||
then
|
||||
clean_autotools
|
||||
fi
|
||||
|
||||
exit 0
|
||||
fi
|
||||
#
|
||||
# Validate the distribution.
|
||||
libpng_autotools_file_found=
|
||||
libpng_autotools_file_missing=
|
||||
for file in $libpng_autotools_files
|
||||
do
|
||||
if test -f "$file"
|
||||
then
|
||||
libpng_autotools_file_found=1
|
||||
else
|
||||
libpng_autotools_file_missing=1
|
||||
fi
|
||||
done
|
||||
#
|
||||
# Presence of one of these does not *invalidate* missing, but absence
|
||||
# invalidates found.
|
||||
for file in $libpng_libtool_files
|
||||
do
|
||||
if test ! -f "$file"
|
||||
then
|
||||
libpng_autotools_file_missing=1
|
||||
fi
|
||||
done
|
||||
#
|
||||
# The cache directory doesn't matter - it will be regenerated and does not exist
|
||||
# anyway in a tarball.
|
||||
#
|
||||
# Either everything is missing or everything is there, the --maintainer option
|
||||
# just changes this so that the mode is set to generate all the files.
|
||||
mode=
|
||||
if test -z "$libpng_autotools_file_found" -o -n "$maintainer"
|
||||
then
|
||||
mode="autoreconf"
|
||||
else
|
||||
if test -n "$libpng_autotools_file_missing"
|
||||
then
|
||||
mode="broken"
|
||||
else
|
||||
mode="configure"
|
||||
fi
|
||||
fi
|
||||
#
|
||||
# So:
|
||||
case "$mode" in
|
||||
autoreconf)
|
||||
# Clean in case configure files exist
|
||||
clean_configure
|
||||
clean_autotools
|
||||
# Everything must be initialized, so use --force
|
||||
if autoreconf --warnings=all --force --install
|
||||
then
|
||||
missing=
|
||||
for file in $libpng_autotools_files
|
||||
do
|
||||
test -f "$file" || missing=1
|
||||
done
|
||||
# ignore the cache directory
|
||||
test -z "$missing" || {
|
||||
exec >&2
|
||||
echo "autoreconf was run, but did not produce all the expected"
|
||||
echo "files. It is likely that your autotools installation is"
|
||||
echo "not compatible with that expected by libpng."
|
||||
exit 1
|
||||
}
|
||||
else
|
||||
exec >&2
|
||||
echo "autoreconf failed: your version of autotools is incompatible"
|
||||
echo "with this libpng version. Please use a distributed archive"
|
||||
echo "(which includes the autotools generated files) and run configure"
|
||||
echo "instead."
|
||||
exit 1
|
||||
fi;;
|
||||
|
||||
configure)
|
||||
if test -d .git
|
||||
then
|
||||
exec >&2
|
||||
echo "ERROR: running autoreconf on an initialized sytem"
|
||||
echo " This is not necessary; it is only necessary to remake the"
|
||||
echo " autotools generated files if Makefile.am or configure.ac"
|
||||
echo " change and make does the right thing with:"
|
||||
echo
|
||||
echo " ./configure --enable-maintainer-mode."
|
||||
echo
|
||||
echo " You can run autoreconf yourself if you don't like maintainer"
|
||||
echo " mode and you can also just run autoreconf -f -i to initialize"
|
||||
echo " everything in the first place; this script is only for"
|
||||
echo " compatiblity with prior releases."
|
||||
exit 1
|
||||
else
|
||||
exec >&2
|
||||
echo "autogen.sh is intended only to generate 'configure' on systems"
|
||||
echo "that do not have it. You have a complete 'configure', if you"
|
||||
echo "need to change Makefile.am or configure.ac you also need to"
|
||||
echo "run configure with the --enable-maintainer-mode option."
|
||||
exit 1
|
||||
fi;;
|
||||
|
||||
broken)
|
||||
exec >&2
|
||||
echo "Your system has a partial set of autotools generated files."
|
||||
echo "autogen.sh is unable to proceed. The full set of files is"
|
||||
echo "contained in the libpng 'tar' distribution archive and you do"
|
||||
echo "not need to run autogen.sh if you use it."
|
||||
exit 1;;
|
||||
esac
|
||||
6
configure
vendored
@@ -1,6 +0,0 @@
|
||||
echo "
|
||||
There is no \"configure\" script for Libpng-1.0.12beta1. Instead, please
|
||||
copy the appropriate makefile for your system from the \"scripts\"
|
||||
directory. Read the INSTALL file for more details.
|
||||
"
|
||||
|
||||
256
configure.ac
Normal file
@@ -0,0 +1,256 @@
|
||||
# configure.ac
|
||||
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
dnl Minor upgrades (compatible ABI): increment the package version
|
||||
dnl (third field in two places below) and set the PNGLIB_RELEASE
|
||||
dnl variable.
|
||||
dnl
|
||||
dnl Major upgrades (incompatible ABI): increment the package major
|
||||
dnl version (second field, or first if desired), set the minor
|
||||
dnl to 0, set PNGLIB_MAJOR below *and* follow the instructions in
|
||||
dnl Makefile.am to upgrade the package name.
|
||||
|
||||
dnl This is here to prevent earlier autoconf from being used, it
|
||||
dnl should not be necessary to regenerate configure if the time
|
||||
dnl stamps are correct
|
||||
AC_PREREQ([2.68])
|
||||
|
||||
dnl Version number stuff here:
|
||||
|
||||
AC_INIT([libpng],[1.6.0beta29],[png-mng-implement@lists.sourceforge.net])
|
||||
AC_CONFIG_MACRO_DIR([scripts])
|
||||
|
||||
# libpng does not follow GNU file name conventions (hence 'foreign')
|
||||
# color-tests requires automake 1.11 or later
|
||||
# silent-rules requires automake 1.11 or later
|
||||
# dist-xz requires automake 1.11 or later
|
||||
# 1.12.2 fixes a security issue in 1.11.2 and 1.12.1
|
||||
AM_INIT_AUTOMAKE([1.12.2 foreign dist-xz dist-bzip2 color-tests silent-rules])
|
||||
# was:
|
||||
# AM_INIT_AUTOMAKE
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
dnl configure.ac and Makefile.am expect automake 1.11.2 or a compatible later
|
||||
dnl version; aclocal.m4 will generate a failure if you use a prior version of
|
||||
dnl automake, so the following is not necessary (and is not defined anyway):
|
||||
dnl AM_PREREQ([1.11.2])
|
||||
dnl stop configure from automagically running automake
|
||||
|
||||
PNGLIB_VERSION=1.6.0beta29
|
||||
PNGLIB_MAJOR=1
|
||||
PNGLIB_MINOR=6
|
||||
PNGLIB_RELEASE=0
|
||||
|
||||
dnl End of version number stuff
|
||||
|
||||
AC_CONFIG_SRCDIR([pngget.c])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
# Checks for programs.
|
||||
AC_LANG([C])
|
||||
AC_PROG_CC
|
||||
AM_PROG_AS
|
||||
LT_PATH_LD
|
||||
AC_PROG_CPP
|
||||
AC_CHECK_TOOL(SED, sed, :)
|
||||
AC_CHECK_TOOL(AWK, awk, :)
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
dnl libtool/libtoolize; version 2.4.2 is the tested version, this or any
|
||||
dnl compatible later version may be used
|
||||
LT_INIT([win32-dll])
|
||||
LT_PREREQ([2.4.2])
|
||||
|
||||
# On Solaris 10 and 12 CPP gets set to cc -E, however this still
|
||||
# does some input parsing. We need strict ANSI-C style tokenization,
|
||||
# check this:
|
||||
AC_REQUIRE_CPP
|
||||
AC_MSG_CHECKING([for a C preprocessor that does not parse its input])
|
||||
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[1.1.1 16BIT]])],
|
||||
[DFNCPP="$CPP"],
|
||||
[ DFNCPP=""
|
||||
sav_CPP="$CPP"
|
||||
for CPP in "${CC-cc} -E" "${CC-cc} -E -traditional-cpp" "/lib/cpp" "cpp"
|
||||
do
|
||||
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[1.1.1 16BIT]])],
|
||||
[DFNCPP="$CPP"]
|
||||
[break],,)
|
||||
done
|
||||
CPP="$sav_CPP"
|
||||
])
|
||||
if test -n "$DFNCPP"; then
|
||||
AC_MSG_RESULT([$DFNCPP])
|
||||
AC_SUBST(DFNCPP)
|
||||
else
|
||||
AC_MSG_FAILURE([not found], 1)
|
||||
fi
|
||||
|
||||
# -Werror cannot be passed to GCC in CFLAGS because configure will fail (it
|
||||
# checks the compiler with a program that generates a warning), add the
|
||||
# following option to deal with this
|
||||
AC_ARG_VAR(PNG_COPTS,
|
||||
[additional flags for the C compiler, use this for options that would]
|
||||
[cause configure itself to fail])
|
||||
AC_ARG_ENABLE(werror,
|
||||
AS_HELP_STRING([[[--enable-werror[=OPT]]]],
|
||||
[Pass -Werror or the given argument to the compiler if it is supported]),
|
||||
[test "$enable_werror" = "yes" && enable_werror="-Werror"
|
||||
if test "$enable_werror" != "no"; then
|
||||
sav_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$enable_werror $CFLAGS"
|
||||
AC_MSG_CHECKING([if the compiler allows $enable_werror])
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_SOURCE([
|
||||
[int main(int argc, char **argv){]
|
||||
[return argv[argc-1][0];]
|
||||
[}]])],
|
||||
AC_MSG_RESULT(yes)
|
||||
PNG_COPTS="$PNG_COPTS $enable_werror",
|
||||
AC_MSG_RESULT(no))
|
||||
CFLAGS="$sav_CFLAGS"
|
||||
fi],)
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([malloc.h stdlib.h string.h strings.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_TYPE_SIZE_T
|
||||
AC_STRUCT_TM
|
||||
AC_C_RESTRICT
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_STRTOD
|
||||
AC_CHECK_FUNCS([memset], , AC_MSG_ERROR(memset not found in libc))
|
||||
AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_MSG_ERROR(cannot find pow)) )
|
||||
AC_ARG_WITH(zlib-prefix,
|
||||
AS_HELP_STRING([[[--with-zlib-prefix]]],
|
||||
[prefix that may have been used in installed zlib]),
|
||||
[ZPREFIX=${withval}],
|
||||
[ZPREFIX='z_'])
|
||||
AC_CHECK_LIB(z, zlibVersion, ,
|
||||
AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, , AC_MSG_ERROR(zlib not installed)))
|
||||
|
||||
# The following is for pngvalid, to ensure it catches FP errors even on
|
||||
# platforms that don't enable FP exceptions, the function appears in the math
|
||||
# library (typically), it's not an error if it is not found.
|
||||
AC_CHECK_LIB([m], [feenableexcept])
|
||||
AC_CHECK_FUNCS([feenableexcept])
|
||||
|
||||
AC_MSG_CHECKING([if using Solaris linker])
|
||||
SLD=`$LD --version 2>&1 | grep Solaris`
|
||||
if test "$SLD"; then
|
||||
have_solaris_ld=yes
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
have_solaris_ld=no
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_SOLARIS_LD, test "$have_solaris_ld" = "yes")
|
||||
|
||||
AC_MSG_CHECKING([if libraries can be versioned])
|
||||
# Special case for PE/COFF platforms: ld reports
|
||||
# support for version-script, but doesn't actually
|
||||
# DO anything with it.
|
||||
case $host in
|
||||
*cygwin* | *mingw32* | *interix* )
|
||||
have_ld_version_script=no
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
* )
|
||||
|
||||
if test "$have_solaris_ld" = "yes"; then
|
||||
GLD=`$LD --help < /dev/null 2>&1 | grep 'M mapfile'`
|
||||
else
|
||||
GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
|
||||
fi
|
||||
|
||||
if test "$GLD"; then
|
||||
have_ld_version_script=yes
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
have_ld_version_script=no
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_WARN(*** You have not enabled versioned symbols.)
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
|
||||
|
||||
if test "$have_ld_version_script" = "yes"; then
|
||||
AC_MSG_CHECKING([for symbol prefix])
|
||||
SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \
|
||||
| ${CPP-${CC-gcc} -E} - 2>&1 \
|
||||
| ${EGREP-grep} "^PREFIX=" \
|
||||
| ${SED-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"`
|
||||
AC_SUBST(SYMBOL_PREFIX)
|
||||
AC_MSG_RESULT($SYMBOL_PREFIX)
|
||||
fi
|
||||
|
||||
# Substitutions for .in files
|
||||
AC_SUBST(PNGLIB_VERSION)
|
||||
AC_SUBST(PNGLIB_MAJOR)
|
||||
AC_SUBST(PNGLIB_MINOR)
|
||||
AC_SUBST(PNGLIB_RELEASE)
|
||||
|
||||
# Additional arguments (and substitutions)
|
||||
# Allow the pkg-config directory to be set
|
||||
AC_ARG_WITH(pkgconfigdir,
|
||||
AS_HELP_STRING([[[--with-pkgconfigdir]]],
|
||||
[Use the specified pkgconfig dir (default is libdir/pkgconfig)]),
|
||||
[pkgconfigdir=${withval}],
|
||||
[pkgconfigdir='${libdir}/pkgconfig'])
|
||||
|
||||
AC_SUBST([pkgconfigdir])
|
||||
AC_MSG_NOTICE([[pkgconfig directory is ${pkgconfigdir}]])
|
||||
|
||||
# Make the *-config binary config scripts optional
|
||||
AC_ARG_WITH(binconfigs,
|
||||
AS_HELP_STRING([[[--with-binconfigs]]],
|
||||
[Generate shell libpng-config scripts as well as pkg-config data]
|
||||
[@<:@default=yes@:>@]),
|
||||
[if test "${withval}" = no; then
|
||||
binconfigs=
|
||||
AC_MSG_NOTICE([[libpng-config scripts will not be built]])
|
||||
else
|
||||
binconfigs='${binconfigs}'
|
||||
fi],
|
||||
[binconfigs='${binconfigs}'])
|
||||
AC_SUBST([binconfigs])
|
||||
|
||||
# Support for prefixes to the API function names; this will generate defines
|
||||
# at the start of the build to rename exported library functions
|
||||
AC_ARG_WITH(libpng-prefix,
|
||||
AS_HELP_STRING([[[--with-libpng-prefix]]],
|
||||
[prefix libpng exported function (API) names with the given value]),
|
||||
[if test "${withval:-no}" != "no"; then
|
||||
AC_SUBST([PNG_PREFIX], [${withval}])
|
||||
fi])
|
||||
AM_CONDITIONAL([DO_PNG_PREFIX], [test "${with_libpng_prefix:-no}" != "no"])
|
||||
|
||||
# Because GCC by default assembles code with an executable stack, even though it
|
||||
# compiles C code with a non-executable stack, it is necessary to do a fixup
|
||||
# here (this may by GCC specific)
|
||||
AC_SUBST([AM_CCASFLAGS], [-Wa,--noexecstack])
|
||||
|
||||
AC_ARG_ENABLE([arm-neon],
|
||||
AS_HELP_STRING([[[--enable-arm-neon]]], [Enable ARM NEON optimizations]),
|
||||
[if test "${enableval}" = "yes"; then
|
||||
AC_DEFINE([PNG_ARM_NEON], [1], [Enable ARM NEON optimizations])
|
||||
AC_DEFINE([PNG_ALIGNED_MEMORY_SUPPORTED], [1], [Align row buffers])
|
||||
fi])
|
||||
AM_CONDITIONAL([PNG_ARM_NEON], [test "${enable_arm_neon:-no}" = yes])
|
||||
|
||||
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
|
||||
|
||||
# Config files, substituting as above
|
||||
AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in])
|
||||
AC_CONFIG_FILES([libpng-config:libpng-config.in],
|
||||
[chmod +x libpng-config])
|
||||
|
||||
AC_OUTPUT
|
||||
4
contrib/README.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
This "contrib" directory contains contributions which are not necessarily under
|
||||
the libpng license, although all are open source. They are not part of
|
||||
libpng proper and are not used for building the library.
|
||||
24
contrib/examples/README.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
This directory (contrib/examples) contains examples of libpng usage.
|
||||
|
||||
NO COPYRIGHT RIGHTS ARE CLAIMED TO ANY OF THE FILES IN THIS DIRECTORY.
|
||||
|
||||
To the extent possible under law, the authors have waived all copyright and
|
||||
related or neighboring rights to this work. This work is published from:
|
||||
United States.
|
||||
|
||||
The files may be used freely in any way. The intention is that appropriate
|
||||
parts of the files be used in other libpng-using programs without any need for
|
||||
the authors of the using code to seek copyright or license from the original
|
||||
authors.
|
||||
|
||||
The source code and comments in this directory are the original work of the
|
||||
people named below. No other person or organization has made contributions to
|
||||
the work in this directory.
|
||||
|
||||
ORIGINAL AUTHORS
|
||||
The following people have contributed to the code in this directory. None
|
||||
of the people below claim any rights with regard to the contents of this
|
||||
directory.
|
||||
|
||||
John Bowler <jbowler@acm.org>
|
||||
180
contrib/examples/iccfrompng.c
Normal file
@@ -0,0 +1,180 @@
|
||||
/*- iccfrompng
|
||||
*
|
||||
* COPYRIGHT: Written by John Cunningham Bowler, 2011.
|
||||
* To the extent possible under law, the author has waived all copyright and
|
||||
* related or neighboring rights to this work. This work is published from:
|
||||
* United States.
|
||||
*
|
||||
* Extract any icc profiles found in the given PNG files. This is a simple
|
||||
* example of a program which extracts information from the header of a PNG file
|
||||
* without processing the image. Notice that some header information may occur
|
||||
* after the image data, textual data and comments are an example; the approach
|
||||
* in this file won't work reliably for such data because it only looks for the
|
||||
* information in the section of the file that preceeds the image data.
|
||||
*
|
||||
* Compile and link against libpng and zlib, plus anything else required on the
|
||||
* system you use.
|
||||
*
|
||||
* To use supply a list of PNG files containing iCCP chunks, the chunks will be
|
||||
* extracted to a similarly named file with the extension replaced by 'icc',
|
||||
* which will be overwritten without warning.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <setjmp.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <png.h>
|
||||
|
||||
static int verbose = 1;
|
||||
static png_byte no_profile[] = "no profile";
|
||||
|
||||
static png_bytep
|
||||
extract(FILE *fp, png_uint_32 *proflen)
|
||||
{
|
||||
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0);
|
||||
png_infop info_ptr = NULL;
|
||||
png_bytep result = NULL;
|
||||
|
||||
/* Initialize for error or no profile: */
|
||||
*proflen = 0;
|
||||
|
||||
if (png_ptr == NULL)
|
||||
{
|
||||
fprintf(stderr, "iccfrompng: version library mismatch?\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
png_init_io(png_ptr, fp);
|
||||
|
||||
info_ptr = png_create_info_struct(png_ptr);
|
||||
if (info_ptr == NULL)
|
||||
png_error(png_ptr, "OOM allocating info structure");
|
||||
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
{
|
||||
png_charp name;
|
||||
int compression_type;
|
||||
png_bytep profile;
|
||||
|
||||
if (png_get_iCCP(png_ptr, info_ptr, &name, &compression_type, &profile,
|
||||
proflen) & PNG_INFO_iCCP)
|
||||
{
|
||||
result = malloc(*proflen);
|
||||
if (result != NULL)
|
||||
memcpy(result, profile, *proflen);
|
||||
|
||||
else
|
||||
png_error(png_ptr, "OOM allocating profile buffer");
|
||||
}
|
||||
|
||||
else
|
||||
result = no_profile;
|
||||
}
|
||||
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
extract_one_file(const char *filename)
|
||||
{
|
||||
int result = 0;
|
||||
FILE *fp = fopen(filename, "rb");
|
||||
|
||||
if (fp != NULL)
|
||||
{
|
||||
png_uint_32 proflen = 0;
|
||||
png_bytep profile = extract(fp, &proflen);
|
||||
|
||||
if (profile != NULL && profile != no_profile)
|
||||
{
|
||||
size_t len;
|
||||
char *output;
|
||||
|
||||
{
|
||||
const char *ep = strrchr(filename, '.');
|
||||
|
||||
if (ep != NULL)
|
||||
len = ep-filename;
|
||||
|
||||
else
|
||||
len = strlen(filename);
|
||||
}
|
||||
|
||||
output = malloc(len + 5);
|
||||
if (output != NULL)
|
||||
{
|
||||
FILE *of;
|
||||
|
||||
memcpy(output, filename, len);
|
||||
strcpy(output+len, ".icc");
|
||||
|
||||
of = fopen(output, "wb");
|
||||
if (of != NULL)
|
||||
{
|
||||
if (fwrite(profile, proflen, 1, of) == 1 &&
|
||||
fflush(of) == 0 &&
|
||||
fclose(of) == 0)
|
||||
{
|
||||
if (verbose)
|
||||
printf("%s -> %s\n", filename, output);
|
||||
/* Success return */
|
||||
result = 1;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s: error writing profile\n", output);
|
||||
if (remove(output))
|
||||
fprintf(stderr, "%s: could not remove file\n", output);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
fprintf(stderr, "%s: failed to open output file\n", output);
|
||||
|
||||
free(output);
|
||||
}
|
||||
|
||||
else
|
||||
fprintf(stderr, "%s: OOM allocating string!\n", filename);
|
||||
|
||||
free(profile);
|
||||
}
|
||||
|
||||
else if (verbose && profile == no_profile)
|
||||
printf("%s has no profile\n", filename);
|
||||
}
|
||||
|
||||
else
|
||||
fprintf(stderr, "%s: could not open file\n", filename);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
int extracted = 0;
|
||||
|
||||
for (i=1; i<argc; ++i)
|
||||
{
|
||||
if (strcmp(argv[i], "-q") == 0)
|
||||
verbose = 0;
|
||||
|
||||
else if (extract_one_file(argv[i]))
|
||||
extracted = 1;
|
||||
}
|
||||
|
||||
/* Exit code is true if any extract succeeds */
|
||||
return extracted == 0;
|
||||
}
|
||||
367
contrib/examples/pngpixel.c
Normal file
@@ -0,0 +1,367 @@
|
||||
/*- pngpixel
|
||||
*
|
||||
* COPYRIGHT: Written by John Cunningham Bowler, 2011.
|
||||
* To the extent possible under law, the author has waived all copyright and
|
||||
* related or neighboring rights to this work. This work is published from:
|
||||
* United States.
|
||||
*
|
||||
* Read a single pixel value from a PNG file.
|
||||
*
|
||||
* This code illustrates basic 'by-row' reading of a PNG file using libpng.
|
||||
* Rows are read until a particular pixel is found, the value of this pixel is
|
||||
* then printed on stdout.
|
||||
*
|
||||
* The code illustrates how to do this on interlaced as well as non-interlaced
|
||||
* images. Normally you would call png_set_interlace_handling() to have libpng
|
||||
* deal with the interlace for you, but that obliges you to buffer half of the
|
||||
* image to assemble the interlaced rows. In this code
|
||||
* png_set_interlace_handling() is not called and, instead, the code handles the
|
||||
* interlace passes directly looking for the required pixel.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <setjmp.h> /* required for error handling */
|
||||
|
||||
/* Normally use <png.h> here to get the installed libpng, but this is done to
|
||||
* ensure the code picks up the local libpng implementation:
|
||||
*/
|
||||
#include "../../png.h"
|
||||
|
||||
/* Return component 'c' of pixel 'x' from the given row. */
|
||||
static unsigned int
|
||||
component(png_const_bytep row, png_uint_32 x, unsigned int c,
|
||||
unsigned int bit_depth, unsigned int channels)
|
||||
{
|
||||
/* PNG images can be up to 2^31 pixels wide, but this means they can be up to
|
||||
* 2^37 bits wide (for a 64-bit pixel - the largest possible) and hence 2^34
|
||||
* bytes wide. Since the row fitted into memory, however, the following must
|
||||
* work:
|
||||
*/
|
||||
png_uint_32 bit_offset_hi = bit_depth * ((x >> 6) * channels + c);
|
||||
png_uint_32 bit_offset_lo = bit_depth * ((x & 0x3f) * channels + c);
|
||||
|
||||
row = (png_const_bytep)(((PNG_CONST png_byte (*)[8])row) + bit_offset_hi);
|
||||
row += bit_offset_lo >> 3;
|
||||
bit_offset_lo &= 0x07;
|
||||
|
||||
/* PNG pixels are packed into bytes to put the first pixel in the highest
|
||||
* bits of the byte and into two bytes for 16-bit values with the high 8 bits
|
||||
* first, so:
|
||||
*/
|
||||
switch (bit_depth)
|
||||
{
|
||||
case 1: return (row[0] >> (7-bit_offset_lo)) & 0x01;
|
||||
case 2: return (row[0] >> (6-bit_offset_lo)) & 0x03;
|
||||
case 4: return (row[0] >> (4-bit_offset_lo)) & 0x0f;
|
||||
case 8: return row[0];
|
||||
case 16: return (row[0] << 8) + row[1];
|
||||
default:
|
||||
/* This should never happen, it indicates a bug in this program or in
|
||||
* libpng itself:
|
||||
*/
|
||||
fprintf(stderr, "pngpixel: invalid bit depth %u\n", bit_depth);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Print a pixel from a row returned by libpng; determine the row format, find
|
||||
* the pixel, and print the relevant information to stdout.
|
||||
*/
|
||||
static void
|
||||
print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
|
||||
png_uint_32 x)
|
||||
{
|
||||
PNG_CONST unsigned int bit_depth = png_get_bit_depth(png_ptr, info_ptr);
|
||||
|
||||
switch (png_get_color_type(png_ptr, info_ptr))
|
||||
{
|
||||
case PNG_COLOR_TYPE_GRAY:
|
||||
printf("GRAY %u\n", component(row, x, 0, bit_depth, 1));
|
||||
return;
|
||||
|
||||
/* The palette case is slightly more difficult - the palette and, if
|
||||
* present, the tRNS ('transparency', though the values are really
|
||||
* opacity) data must be read to give the full picture:
|
||||
*/
|
||||
case PNG_COLOR_TYPE_PALETTE:
|
||||
{
|
||||
PNG_CONST unsigned int index = component(row, x, 0, bit_depth, 1);
|
||||
png_colorp palette = NULL;
|
||||
int num_palette = 0;
|
||||
|
||||
if ((png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette) &
|
||||
PNG_INFO_PLTE) && num_palette > 0 && palette != NULL)
|
||||
{
|
||||
png_bytep trans_alpha = NULL;
|
||||
int num_trans = 0;
|
||||
if ((png_get_tRNS(png_ptr, info_ptr, &trans_alpha, &num_trans,
|
||||
NULL) & PNG_INFO_tRNS) && num_trans > 0 &&
|
||||
trans_alpha != NULL)
|
||||
printf("INDEXED %u = %d %d %d %d\n", index,
|
||||
palette[index].red, palette[index].green,
|
||||
palette[index].blue,
|
||||
index < num_trans ? trans_alpha[index] : 255);
|
||||
|
||||
else /* no transparency */
|
||||
printf("INDEXED %u = %d %d %d\n", index,
|
||||
palette[index].red, palette[index].green,
|
||||
palette[index].blue);
|
||||
}
|
||||
|
||||
else
|
||||
printf("INDEXED %u = invalid index\n", index);
|
||||
}
|
||||
return;
|
||||
|
||||
case PNG_COLOR_TYPE_RGB:
|
||||
printf("RGB %u %u %u\n", component(row, x, 0, bit_depth, 3),
|
||||
component(row, x, 1, bit_depth, 3),
|
||||
component(row, x, 2, bit_depth, 3));
|
||||
return;
|
||||
|
||||
case PNG_COLOR_TYPE_GRAY_ALPHA:
|
||||
printf("GRAY+ALPHA %u %u\n", component(row, x, 0, bit_depth, 2),
|
||||
component(row, x, 1, bit_depth, 2));
|
||||
return;
|
||||
|
||||
case PNG_COLOR_TYPE_RGB_ALPHA:
|
||||
printf("RGBA %u %u %u %u\n", component(row, x, 0, bit_depth, 4),
|
||||
component(row, x, 1, bit_depth, 4),
|
||||
component(row, x, 2, bit_depth, 4),
|
||||
component(row, x, 3, bit_depth, 4));
|
||||
return;
|
||||
|
||||
default:
|
||||
png_error(png_ptr, "invalid color type");
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
/* This program uses the default, <setjmp.h> based, libpng error handling
|
||||
* mechanism, therefore any local variable that exists before the call to
|
||||
* setjmp and is changed after the call to setjmp returns successfully must
|
||||
* be declared with 'volatile' to ensure that their values don't get
|
||||
* destroyed by longjmp:
|
||||
*/
|
||||
volatile int result = 1/*fail*/;
|
||||
|
||||
if (argc == 4)
|
||||
{
|
||||
long x = atol(argv[1]);
|
||||
long y = atol(argv[2]);
|
||||
FILE *f = fopen(argv[3], "rb");
|
||||
volatile png_bytep row = NULL;
|
||||
|
||||
if (f != NULL)
|
||||
{
|
||||
/* libpng requires a callback function for handling errors; this
|
||||
* callback must not return. The default callback function uses a
|
||||
* stored <setjmp.h> style jmp_buf which is held in a png_struct and
|
||||
* writes error messages to stderr. Creating the png_struct is a
|
||||
* little tricky; just copy the following code.
|
||||
*/
|
||||
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
if (png_ptr != NULL)
|
||||
{
|
||||
png_infop info_ptr = png_create_info_struct(png_ptr);
|
||||
|
||||
if (info_ptr != NULL)
|
||||
{
|
||||
/* Declare stack variables to hold pointers to locally allocated
|
||||
* data.
|
||||
*/
|
||||
|
||||
/* Initialize the error control buffer: */
|
||||
if (setjmp(png_jmpbuf(png_ptr)) == 0)
|
||||
{
|
||||
png_uint_32 width, height;
|
||||
int bit_depth, color_type, interlace_method,
|
||||
compression_method, filter_method;
|
||||
png_bytep row_tmp;
|
||||
|
||||
/* Now associate the recently opened (FILE*) with the default
|
||||
* libpng initialization functions. Sometimes libpng is
|
||||
* compiled without stdio support (it can be difficult to do
|
||||
* in some environments); in that case you will have to write
|
||||
* your own read callback to read data from the (FILE*).
|
||||
*/
|
||||
png_init_io(png_ptr, f);
|
||||
|
||||
/* And read the first part of the PNG file - the header and
|
||||
* all the information up to the first pixel.
|
||||
*/
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
/* This fills in enough information to tell us the width of
|
||||
* each row in bytes, allocate the appropriate amount of
|
||||
* space. In this case png_malloc is used - it will not
|
||||
* return if memory isn't available.
|
||||
*/
|
||||
row = png_malloc(png_ptr, png_get_rowbytes(png_ptr,
|
||||
info_ptr));
|
||||
|
||||
/* To avoid the overhead of using a volatile auto copy row_tmp
|
||||
* to a local here - just use row for the png_free below.
|
||||
*/
|
||||
row_tmp = row;
|
||||
|
||||
/* All the information we need is in the header is returned by
|
||||
* png_get_IHDR, if this fails we can now use 'png_error' to
|
||||
* signal the error and return control to the setjmp above.
|
||||
*/
|
||||
if (png_get_IHDR(png_ptr, info_ptr, &width, &height,
|
||||
&bit_depth, &color_type, &interlace_method,
|
||||
&compression_method, &filter_method))
|
||||
{
|
||||
int passes, pass;
|
||||
|
||||
/* png_set_interlace_handling returns the number of
|
||||
* passes required as well as turning on libpng's
|
||||
* handling, but since we do it ourselves this is
|
||||
* necessary:
|
||||
*/
|
||||
switch (interlace_method)
|
||||
{
|
||||
case PNG_INTERLACE_NONE:
|
||||
passes = 1;
|
||||
break;
|
||||
|
||||
case PNG_INTERLACE_ADAM7:
|
||||
passes = PNG_INTERLACE_ADAM7_PASSES;
|
||||
break;
|
||||
|
||||
default:
|
||||
png_error(png_ptr, "pngpixel: unknown interlace");
|
||||
}
|
||||
|
||||
/* Now read the pixels, pass-by-pass, row-by-row: */
|
||||
png_start_read_image(png_ptr);
|
||||
|
||||
for (pass=0; pass<passes; ++pass)
|
||||
{
|
||||
png_uint_32 ystart, xstart, ystep, xstep;
|
||||
png_uint_32 py;
|
||||
|
||||
if (interlace_method == PNG_INTERLACE_ADAM7)
|
||||
{
|
||||
/* Sometimes the whole pass is empty because the
|
||||
* image is too narrow or too short. libpng
|
||||
* expects to be called for each row that is
|
||||
* present in the pass, so it may be necessary to
|
||||
* skip the loop below (over py) if the image is
|
||||
* too narrow.
|
||||
*/
|
||||
if (PNG_PASS_COLS(width, pass) == 0)
|
||||
continue;
|
||||
|
||||
/* We need the starting pixel and the offset
|
||||
* between each pixel in this pass; use the macros
|
||||
* in png.h:
|
||||
*/
|
||||
xstart = PNG_PASS_START_COL(pass);
|
||||
ystart = PNG_PASS_START_ROW(pass);
|
||||
xstep = PNG_PASS_COL_OFFSET(pass);
|
||||
ystep = PNG_PASS_ROW_OFFSET(pass);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
ystart = xstart = 0;
|
||||
ystep = xstep = 1;
|
||||
}
|
||||
|
||||
/* To find the pixel loop over 'py' for each pass
|
||||
* reading a row and then checking to see if it
|
||||
* contains the pixel.
|
||||
*/
|
||||
for (py = ystart; py < height; py += ystep)
|
||||
{
|
||||
png_uint_32 px, ppx;
|
||||
|
||||
/* png_read_row takes two pointers. When libpng
|
||||
* handles the interlace the first is filled in
|
||||
* pixel-by-pixel, the second receives the same
|
||||
* pixels but they are replicated across the
|
||||
* unwritten pixels so far for each pass. When we
|
||||
* do the interlace, however, they just contain
|
||||
* the pixels from the interlace pass - giving
|
||||
* both is wasteful and pointless.
|
||||
*/
|
||||
png_read_row(png_ptr, row_tmp, NULL);
|
||||
|
||||
/* Now find the pixel if it is in this row; there
|
||||
* are, of course, much better ways of doing this
|
||||
* than using a for loop:
|
||||
*/
|
||||
if (y == py) for (px = xstart, ppx = 0;
|
||||
px < width; px += xstep, ++ppx) if (x == px)
|
||||
{
|
||||
/* 'ppx' is the index of the pixel in the row
|
||||
* buffer.
|
||||
*/
|
||||
print_pixel(png_ptr, info_ptr, row_tmp, ppx);
|
||||
|
||||
/* Now terminate the loops early - we have
|
||||
* found and handled the required data.
|
||||
*/
|
||||
goto pass_loop_end;
|
||||
} /* x loop */
|
||||
} /* y loop */
|
||||
} /* pass loop */
|
||||
|
||||
/* Finally free the temporary buffer: */
|
||||
pass_loop_end:
|
||||
row = NULL;
|
||||
png_free(png_ptr, row_tmp);
|
||||
}
|
||||
|
||||
else
|
||||
png_error(png_ptr, "pngpixel: png_get_IHDR failed");
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* Else libpng has raised an error. An error message has
|
||||
* already been output, it is only necessary to clean up
|
||||
* locally allocated data:
|
||||
*/
|
||||
if (row != NULL)
|
||||
{
|
||||
/* The default implementation of png_free never errors out
|
||||
* (it just crashes if something goes wrong), but the safe
|
||||
* way of using it is still to clear 'row' before calling
|
||||
* png_free:
|
||||
*/
|
||||
png_bytep row_tmp = row;
|
||||
row = NULL;
|
||||
png_free(png_ptr, row_tmp);
|
||||
}
|
||||
}
|
||||
|
||||
png_destroy_info_struct(png_ptr, &info_ptr);
|
||||
}
|
||||
|
||||
else
|
||||
fprintf(stderr, "pngpixel: out of memory allocating png_info\n");
|
||||
|
||||
png_destroy_read_struct(&png_ptr, NULL, NULL);
|
||||
}
|
||||
|
||||
else
|
||||
fprintf(stderr, "pngpixel: out of memory allocating png_struct\n");
|
||||
}
|
||||
|
||||
else
|
||||
fprintf(stderr, "pngpixel: %s: could not open file\n", argv[3]);
|
||||
}
|
||||
|
||||
else
|
||||
/* Wrong number of arguments */
|
||||
fprintf(stderr, "pngpixel: usage: pngpixel x y png-file\n");
|
||||
|
||||
return result;
|
||||
}
|
||||
92
contrib/examples/pngtopng.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/*- pngtopng
|
||||
*
|
||||
* COPYRIGHT: Written by John Cunningham Bowler, 2011.
|
||||
* To the extent possible under law, the author has waived all copyright and
|
||||
* related or neighboring rights to this work. This work is published from:
|
||||
* United States.
|
||||
*
|
||||
* Read a PNG and write it out in a fixed format, using the 'simplified API'
|
||||
* that was introduced in libpng-1.6.0.
|
||||
*
|
||||
* This sample code is just the code from the top of 'example.c' with some error
|
||||
* handling added. See example.c for more comments.
|
||||
*/
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* Normally use <png.h> here to get the installed libpng, but this is done to
|
||||
* ensure the code picks up the local libpng implementation:
|
||||
*/
|
||||
#include "../../png.h"
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
int result = 1;
|
||||
|
||||
if (argc == 3)
|
||||
{
|
||||
png_image image;
|
||||
|
||||
/* Only the image structure version number needs to be set. */
|
||||
memset(&image, 0, sizeof image);
|
||||
image.version = PNG_IMAGE_VERSION;
|
||||
|
||||
if (png_image_begin_read_from_file(&image, argv[1]))
|
||||
{
|
||||
png_bytep buffer;
|
||||
|
||||
/* Change this to try different formats! If you set a colormap format
|
||||
* then you must also supply a colormap below.
|
||||
*/
|
||||
image.format = PNG_FORMAT_RGBA;
|
||||
|
||||
buffer = malloc(PNG_IMAGE_SIZE(image));
|
||||
|
||||
if (buffer != NULL)
|
||||
{
|
||||
if (png_image_finish_read(&image, NULL/*background*/, buffer,
|
||||
0/*row_stride*/, NULL/*colormap for PNG_FORMAT_FLAG_COLORMAP */))
|
||||
{
|
||||
if (png_image_write_to_file(&image, argv[2],
|
||||
0/*convert_to_8bit*/, buffer, 0/*row_stride*/,
|
||||
NULL/*colormap*/))
|
||||
result = 0;
|
||||
|
||||
else
|
||||
fprintf(stderr, "pngtopng: write %s: %s\n", argv[2],
|
||||
image.message);
|
||||
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "pngtopng: read %s: %s\n", argv[1],
|
||||
image.message);
|
||||
|
||||
/* This is the only place where a 'free' is required; libpng does
|
||||
* the cleanup on error and success, but in this case we couldn't
|
||||
* complete the read because of running out of memory.
|
||||
*/
|
||||
png_image_free(&image);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
fprintf(stderr, "pngtopng: out of memory: %lu bytes\n",
|
||||
(unsigned long)PNG_IMAGE_SIZE(image));
|
||||
}
|
||||
|
||||
else
|
||||
/* Failed to read the first argument: */
|
||||
fprintf(stderr, "pngtopng: %s: %s\n", argv[1], image.message);
|
||||
}
|
||||
|
||||
else
|
||||
/* Wrong number of arguments */
|
||||
fprintf(stderr, "pngtopng: usage: pngtopng input-file output-file\n");
|
||||
|
||||
return result;
|
||||
}
|
||||
340
contrib/gregbook/COPYING
Normal file
@@ -0,0 +1,340 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
@@ -1,12 +1,19 @@
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
|
||||
Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
be held liable for any damages arising in any way from the use of
|
||||
this software.
|
||||
|
||||
The contents of this file are DUAL-LICENSED. You may modify and/or
|
||||
redistribute this software according to the terms of one of the
|
||||
following two licenses (at your option):
|
||||
|
||||
|
||||
LICENSE 1 ("BSD-like with advertising clause"):
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute
|
||||
it freely, subject to the following restrictions:
|
||||
@@ -23,4 +30,21 @@
|
||||
and contributors for the book, "PNG: The Definitive Guide,"
|
||||
published by O'Reilly and Associates.
|
||||
|
||||
|
||||
LICENSE 2 (GNU GPL v2 or later):
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
130
contrib/gregbook/Makefile.mingw32
Normal file
@@ -0,0 +1,130 @@
|
||||
# Sample makefile for rpng-win / rpng2-win / wpng using mingw32-gcc and make.
|
||||
# Greg Roelofs
|
||||
# Last modified: 2 June 2007
|
||||
#
|
||||
# The programs built by this makefile are described in the book,
|
||||
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
|
||||
# Associates, 1999). Go buy a copy, eh? Well, OK, it's not
|
||||
# generally for sale anymore, but it's the thought that counts,
|
||||
# right? (Hint: http://www.libpng.org/pub/png/book/ )
|
||||
#
|
||||
# Invoke this makefile from a DOS-prompt window via:
|
||||
#
|
||||
# make -f Makefile.mingw32
|
||||
#
|
||||
# This makefile assumes libpng and zlib have already been built or downloaded
|
||||
# and are in subdirectories at the same level as the current subdirectory
|
||||
# (as indicated by the PNGDIR and ZDIR macros below). It makes no assumptions
|
||||
# at all about the mingw32 installation tree (W32DIR). Edit as appropriate.
|
||||
#
|
||||
# Note that the names of the dynamic and static libpng and zlib libraries
|
||||
# used below may change in later releases of the libraries. This makefile
|
||||
# builds both statically and dynamically linked executables by default.
|
||||
# (You need only one set, but for testing it can be handy to have both.)
|
||||
|
||||
|
||||
# macros --------------------------------------------------------------------
|
||||
|
||||
#PNGDIR = ../..# for libpng-x.y.z/contrib/gregbook builds
|
||||
PNGDIR = ../libpng-win32
|
||||
PNGINC = -I$(PNGDIR)
|
||||
PNGLIBd = $(PNGDIR)/libpng.dll.a # dynamically linked
|
||||
PNGLIBs = $(PNGDIR)/libpng.a # statically linked, local libpng
|
||||
|
||||
#ZDIR = ../../../zlib-win32# for libpng-x.y.z/contrib/gregbook builds
|
||||
ZDIR = ../zlib-win32
|
||||
ZINC = -I$(ZDIR)
|
||||
ZLIBd = $(ZDIR)/libzdll.a
|
||||
ZLIBs = $(ZDIR)/libz.a
|
||||
|
||||
# change this to be the path where mingw32 installs its stuff:
|
||||
W32DIR =
|
||||
#W32DIR = /usr/local/cross-tools/i386-mingw32msvc
|
||||
W32INC = -I$(W32DIR)/include
|
||||
W32LIB = $(W32DIR)/lib/libuser32.a $(W32DIR)/lib/libgdi32.a
|
||||
|
||||
CC = gcc
|
||||
#CC = i386-mingw32msvc-gcc # e.g., Linux -> Win32 cross-compilation
|
||||
LD = $(CC)
|
||||
RM = rm -f
|
||||
CFLAGS = -O -Wall $(INCS) $(MINGW_CCFLAGS)
|
||||
# [note that -Wall is a gcc-specific compilation flag ("most warnings on")]
|
||||
# [-ansi, -pedantic and -W can also be used]
|
||||
LDFLAGS = $(MINGW_LDFLAGS)
|
||||
O = .o
|
||||
E = .exe
|
||||
|
||||
INCS = $(PNGINC) $(ZINC) $(W32INC)
|
||||
RLIBSd = $(PNGLIBd) $(ZLIBd) $(W32LIB) -lm
|
||||
RLIBSs = $(PNGLIBs) $(ZLIBs) $(W32LIB) -lm
|
||||
WLIBSd = $(PNGLIBd) $(ZLIBd)
|
||||
WLIBSs = $(PNGLIBs) $(ZLIBs)
|
||||
|
||||
RPNG = rpng-win
|
||||
RPNG2 = rpng2-win
|
||||
WPNG = wpng
|
||||
|
||||
ROBJSd = $(RPNG)$(O) readpng.pic$(O)
|
||||
ROBJS2d = $(RPNG2)$(O) readpng2.pic$(O)
|
||||
WOBJSd = $(WPNG)$(O) writepng.pic$(O)
|
||||
|
||||
RPNGs = $(RPNG)-static
|
||||
RPNG2s = $(RPNG2)-static
|
||||
WPNGs = $(WPNG)-static
|
||||
|
||||
ROBJSs = $(RPNG)$(O) readpng$(O)
|
||||
ROBJS2s = $(RPNG2)$(O) readpng2$(O)
|
||||
WOBJSs = $(WPNG)$(O) writepng$(O)
|
||||
|
||||
STATIC_EXES = $(RPNGs)$(E) $(RPNG2s)$(E) $(WPNGs)$(E)
|
||||
DYNAMIC_EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
|
||||
|
||||
EXES = $(STATIC_EXES) $(DYNAMIC_EXES)
|
||||
|
||||
|
||||
# implicit make rules -------------------------------------------------------
|
||||
|
||||
.c$(O):
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
|
||||
%.pic$(O): %.c
|
||||
$(CC) -c $(CFLAGS) -DPNG_BUILD_DLL -o $@ $<
|
||||
|
||||
|
||||
# dependencies --------------------------------------------------------------
|
||||
|
||||
all: $(EXES)
|
||||
|
||||
$(RPNGs)$(E): $(ROBJSs)
|
||||
$(LD) $(LDFLAGS) -o $@ $(ROBJSs) $(RLIBSs)
|
||||
|
||||
$(RPNG)$(E): $(ROBJSd)
|
||||
$(LD) $(LDFLAGS) -o $@ $(ROBJSd) $(RLIBSd)
|
||||
|
||||
$(RPNG2s)$(E): $(ROBJS2s)
|
||||
$(LD) $(LDFLAGS) -o $@ $(ROBJS2s) $(RLIBSs)
|
||||
|
||||
$(RPNG2)$(E): $(ROBJS2d)
|
||||
$(LD) $(LDFLAGS) -o $@ $(ROBJS2d) $(RLIBSd)
|
||||
|
||||
$(WPNGs)$(E): $(WOBJSs)
|
||||
$(LD) $(LDFLAGS) -o $@ $(WOBJSs) $(WLIBSs)
|
||||
|
||||
$(WPNG)$(E): $(WOBJSd)
|
||||
$(LD) $(LDFLAGS) -o $@ $(WOBJSd) $(WLIBSd)
|
||||
|
||||
$(RPNG)$(O): $(RPNG).c readpng.h
|
||||
$(RPNG2)$(O): $(RPNG2).c readpng2.h
|
||||
$(WPNG)$(O): $(WPNG).c writepng.h
|
||||
|
||||
readpng$(O) readpng.pic$(O): readpng.c readpng.h
|
||||
readpng2$(O) readpng2.pic$(O): readpng2.c readpng2.h
|
||||
writepng$(O) writepng.pic$(O): writepng.c writepng.h
|
||||
|
||||
|
||||
# maintenance ---------------------------------------------------------------
|
||||
|
||||
clean:
|
||||
$(RM) $(EXES)
|
||||
$(RM) $(ROBJSs) $(ROBJS2s) $(WOBJSs)
|
||||
$(RM) $(ROBJSd) $(ROBJS2d) $(WOBJSd)
|
||||
@@ -1,6 +1,6 @@
|
||||
# Sample makefile for rpng-x / rpng2-x / wpng for SGI using cc and make.
|
||||
# Greg Roelofs
|
||||
# Last modified: 16 January 1000
|
||||
# Last modified: 7 March 2002
|
||||
#
|
||||
# The programs built by this makefile are described in the book,
|
||||
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
|
||||
@@ -23,9 +23,9 @@
|
||||
|
||||
# macros --------------------------------------------------------------------
|
||||
|
||||
PNGINC = -I/usr/local/include
|
||||
PNGLIB = -L/usr/local/lib -lpng # dynamically linked against libpng
|
||||
#PNGLIB = /usr/local/lib/libpng.a # statically linked against libpng
|
||||
PNGINC = -I/usr/local/include/libpng16
|
||||
PNGLIB = -L/usr/local/lib -lpng16 # dynamically linked against libpng
|
||||
#PNGLIB = /usr/local/lib/libpng16.a # statically linked against libpng
|
||||
# or:
|
||||
#PNGINC = -I../..
|
||||
#PNGLIB = -L../.. -lpng
|
||||
@@ -52,8 +52,10 @@ WLIBS = $(PNGLIB) $(ZLIB)
|
||||
CC = cc
|
||||
LD = cc
|
||||
RM = rm -f
|
||||
CFLAGS = -O -fullwarn $(INCS)
|
||||
LDFLAGS =
|
||||
# ABI must be the same as that used to build libpng.
|
||||
ABI=
|
||||
CFLAGS = $(ABI) -O -fullwarn $(INCS)
|
||||
LDFLAGS = $(ABI)
|
||||
O = .o
|
||||
E =
|
||||
|
||||
|
||||
@@ -1,73 +1,92 @@
|
||||
# Sample makefile for rpng-x / rpng2-x / wpng using gcc and make.
|
||||
# Greg Roelofs
|
||||
# Last modified: 28 February 2000
|
||||
# Last modified: 2 June 2007
|
||||
#
|
||||
# The programs built by this makefile are described in the book,
|
||||
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
|
||||
# Associates, 1999). Go buy a copy, eh? Buy some for friends
|
||||
# and family, too. (Not that this is a blatant plug or anything.)
|
||||
# Associates, 1999). Go buy a copy, eh? Well, OK, it's not
|
||||
# generally for sale anymore, but it's the thought that counts,
|
||||
# right? (Hint: http://www.libpng.org/pub/png/book/ )
|
||||
#
|
||||
# Invoke this makefile from a shell prompt in the usual way; for example:
|
||||
#
|
||||
# make -f Makefile.unx
|
||||
#
|
||||
# This makefile assumes libpng and zlib have already been built or downloaded
|
||||
# and are both installed in /usr/local/{include,lib} (as indicated by the
|
||||
# PNG* and Z* macros below). Edit as appropriate--choose only ONE each of
|
||||
# the PNGINC, PNGLIB, ZINC and ZLIB lines.
|
||||
# and are installed in /usr/local/{include,lib} or as otherwise indicated by
|
||||
# the PNG* and Z* macros below. Edit as appropriate--choose only ONE each of
|
||||
# the PNGINC, PNGLIBd, PNGLIBs, ZINC, ZLIBd and ZLIBs lines.
|
||||
#
|
||||
# This makefile builds statically linked executables (against libpng and zlib,
|
||||
# that is), but that can be changed by uncommenting the appropriate PNGLIB and
|
||||
# ZLIB lines.
|
||||
# This makefile builds both dynamically and statically linked executables
|
||||
# (against libpng and zlib, that is), but that can be changed by modifying
|
||||
# the "EXES =" line. (You need only one set, but for testing it can be handy
|
||||
# to have both.)
|
||||
|
||||
|
||||
# macros --------------------------------------------------------------------
|
||||
|
||||
PNGINC = -I/usr/local/include
|
||||
#PNGLIB = -L/usr/local/lib -lpng # dynamically linked against libpng
|
||||
PNGLIB = /usr/local/lib/libpng.a # statically linked against libpng
|
||||
#PNGDIR = /usr/local/lib
|
||||
#PNGINC = -I/usr/local/include/libpng16
|
||||
#PNGLIBd = -L$(PNGDIR) -lpng16 # dynamically linked, installed libpng
|
||||
#PNGLIBs = $(PNGDIR)/libpng16.a # statically linked, installed libpng
|
||||
# or:
|
||||
#PNGINC = -I../..
|
||||
#PNGLIB = -L../.. -lpng
|
||||
#PNGLIB = ../../libpng.a
|
||||
PNGDIR = ../..# this one is for libpng-x.y.z/contrib/gregbook builds
|
||||
#PNGDIR = ../libpng
|
||||
PNGINC = -I$(PNGDIR)
|
||||
PNGLIBd = -Wl,-rpath,$(PNGDIR) -L$(PNGDIR) -lpng16 # dynamically linked
|
||||
PNGLIBs = $(PNGDIR)/libpng.a # statically linked, local libpng
|
||||
|
||||
ZDIR = /usr/local/lib
|
||||
#ZDIR = /usr/lib64
|
||||
ZINC = -I/usr/local/include
|
||||
#ZLIB = -L/usr/local/lib -lz # dynamically linked against zlib
|
||||
ZLIB = /usr/local/lib/libz.a # statically linked against zlib
|
||||
#ZINC = -I../zlib
|
||||
#ZLIB = -L../zlib -lz
|
||||
#ZLIB = ../../../zlib/libz.a
|
||||
ZLIBd = -L$(ZDIR) -lz # dynamically linked against zlib
|
||||
ZLIBs = $(ZDIR)/libz.a # statically linked against zlib
|
||||
# or:
|
||||
#ZDIR = ../zlib
|
||||
#ZINC = -I$(ZDIR)
|
||||
#ZLIBd = -Wl,-rpath,$(ZDIR) -L$(ZDIR) -lz # -rpath allows in-place testing
|
||||
#ZLIBs = $(ZDIR)/libz.a
|
||||
|
||||
#XINC = -I/usr/include/X11 # old-style, stock X distributions
|
||||
#XLIB = -L/usr/lib/X11 -lX11
|
||||
#XINC = -I/usr/openwin/include # Sun workstations (OpenWindows)
|
||||
#XINC = -I/usr/include # old-style, stock X distributions
|
||||
#XLIB = -L/usr/lib/X11 -lX11 # (including SGI IRIX)
|
||||
#XINC = -I/usr/openwin/include # Sun workstations (OpenWindows)
|
||||
#XLIB = -L/usr/openwin/lib -lX11
|
||||
XINC = -I/usr/X11R6/include # new X distributions (XFree86, etc.)
|
||||
XINC = -I/usr/X11R6/include # new X distributions (X.org, etc.)
|
||||
XLIB = -L/usr/X11R6/lib -lX11
|
||||
#XLIB = -L/usr/X11R6/lib64 -lX11 # e.g., Red Hat on AMD64
|
||||
|
||||
INCS = $(PNGINC) $(ZINC) $(XINC)
|
||||
RLIBS = $(PNGLIB) $(ZLIB) $(XLIB) -lm
|
||||
WLIBS = $(PNGLIB) $(ZLIB)
|
||||
RLIBSd = $(PNGLIBd) $(ZLIBd) $(XLIB) -lm
|
||||
RLIBSs = $(PNGLIBs) $(ZLIBs) $(XLIB) -lm
|
||||
WLIBSd = $(PNGLIBd) $(ZLIBd) -lm
|
||||
WLIBSs = $(PNGLIBs) $(ZLIBs)
|
||||
|
||||
CC = gcc
|
||||
LD = gcc
|
||||
RM = rm -f
|
||||
CFLAGS = -O -Wall $(INCS)
|
||||
CFLAGS = -O -Wall $(INCS) -DFEATURE_LOOP
|
||||
# [note that -Wall is a gcc-specific compilation flag ("most warnings on")]
|
||||
# [-ansi, -pedantic and -W can also be used]
|
||||
LDFLAGS =
|
||||
O = .o
|
||||
E =
|
||||
|
||||
RPNG = rpng-x
|
||||
RPNG2 = rpng2-x
|
||||
WPNG = wpng
|
||||
RPNG = rpng-x
|
||||
RPNG2 = rpng2-x
|
||||
WPNG = wpng
|
||||
|
||||
RPNGs = $(RPNG)-static
|
||||
RPNG2s = $(RPNG2)-static
|
||||
WPNGs = $(WPNG)-static
|
||||
|
||||
ROBJS = $(RPNG)$(O) readpng$(O)
|
||||
ROBJS2 = $(RPNG2)$(O) readpng2$(O)
|
||||
WOBJS = $(WPNG)$(O) writepng$(O)
|
||||
|
||||
EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
|
||||
STATIC_EXES = $(RPNGs)$(E) $(RPNG2s)$(E) $(WPNGs)$(E)
|
||||
DYNAMIC_EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
|
||||
|
||||
EXES = $(STATIC_EXES) $(DYNAMIC_EXES)
|
||||
|
||||
|
||||
# implicit make rules -------------------------------------------------------
|
||||
@@ -80,14 +99,23 @@ EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
|
||||
|
||||
all: $(EXES)
|
||||
|
||||
$(RPNGs)$(E): $(ROBJS)
|
||||
$(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBSs)
|
||||
|
||||
$(RPNG)$(E): $(ROBJS)
|
||||
$(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBS)
|
||||
$(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBSd)
|
||||
|
||||
$(RPNG2s)$(E): $(ROBJS2)
|
||||
$(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBSs)
|
||||
|
||||
$(RPNG2)$(E): $(ROBJS2)
|
||||
$(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBS)
|
||||
$(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBSd)
|
||||
|
||||
$(WPNGs)$(E): $(WOBJS)
|
||||
$(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBSs)
|
||||
|
||||
$(WPNG)$(E): $(WOBJS)
|
||||
$(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBS)
|
||||
$(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBSd)
|
||||
|
||||
$(RPNG)$(O): $(RPNG).c readpng.h
|
||||
$(RPNG2)$(O): $(RPNG2).c readpng2.h
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
# Sample makefile for rpng-win / rpng2-win / wpng using MSVC and NMAKE.
|
||||
# Greg Roelofs
|
||||
# Last modified: 16 February 1999
|
||||
# Last modified: 2 June 2007
|
||||
#
|
||||
# The programs built by this makefile are described in the book,
|
||||
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
|
||||
# Associates, 1999). Go buy a copy, eh? Buy some for friends
|
||||
# and family, too. (Not that this is a blatant plug or anything.)
|
||||
# Associates, 1999). Go buy a copy, eh? Well, OK, it's not
|
||||
# generally for sale anymore, but it's the thought that counts,
|
||||
# right? (Hint: http://www.libpng.org/pub/png/book/ )
|
||||
#
|
||||
# Invoke this makefile from a DOS prompt window via:
|
||||
#
|
||||
@@ -17,7 +18,7 @@
|
||||
# "c:\windows\command.com /e:4096" as the program command line and set the
|
||||
# working directory to this directory. Then double-click to open the new
|
||||
# DOS-prompt window with a bigger environment and retry the commands above.
|
||||
#
|
||||
#
|
||||
# This makefile assumes libpng and zlib have already been built or downloaded
|
||||
# and are in subdirectories at the same level as the current subdirectory
|
||||
# (as indicated by the PNGPATH and ZPATH macros below). Edit as appropriate.
|
||||
@@ -32,12 +33,12 @@
|
||||
|
||||
# macros --------------------------------------------------------------------
|
||||
|
||||
PNGPATH = ../..
|
||||
PNGPATH = ../libpng
|
||||
PNGINC = -I$(PNGPATH)
|
||||
#PNGLIB = $(PNGPATH)/pngdll.lib
|
||||
PNGLIB = $(PNGPATH)/libpng.lib
|
||||
|
||||
ZPATH = ../../../zlib
|
||||
ZPATH = ../zlib
|
||||
ZINC = -I$(ZPATH)
|
||||
#ZLIB = $(ZPATH)/zlibdll.lib
|
||||
ZLIB = $(ZPATH)/zlibstat.lib
|
||||
@@ -53,7 +54,7 @@ CC = cl
|
||||
LD = link
|
||||
RM = del
|
||||
CFLAGS = -nologo -O -W3 $(INCS) $(cvars)
|
||||
# [note that -Wall is an MSVC-specific compilation flag ("all warnings on")]
|
||||
# [note that -W3 is an MSVC-specific compilation flag ("all warnings on")]
|
||||
# [see %devstudio%\vc\include\win32.mak for cvars macro definition]
|
||||
O = .obj
|
||||
E = .exe
|
||||
|
||||
@@ -16,14 +16,14 @@ of PBMPLUS/NetPBM) and converts them to PNG.
|
||||
The source code for all three demo programs currently compiles under
|
||||
Unix, OpenVMS, and 32-bit Windows. (Special thanks to Martin Zinser,
|
||||
zinser@decus.de, for making the necessary changes for OpenVMS and for
|
||||
providing an appropriate build script.) Build instructions can be
|
||||
found below.
|
||||
providing an appropriate build script.) Build instructions can be found
|
||||
below.
|
||||
|
||||
Files:
|
||||
|
||||
README this file
|
||||
README.w32 additional Windows-specific information
|
||||
LICENSE terms of distribution and reuse (BSD-like)
|
||||
LICENSE terms of distribution and reuse (BSD-like or GNU GPL)
|
||||
COPYING GNU General Public License (GPL)
|
||||
|
||||
Makefile.unx Unix makefile
|
||||
Makefile.w32 Windows (MSVC) makefile
|
||||
@@ -45,26 +45,27 @@ Files:
|
||||
|
||||
toucan.png transparent PNG for testing (by Stefan Schneider)
|
||||
|
||||
Note that the programs are designed to be functional, but their primary
|
||||
purpose is to demonstrate how to use libpng to add PNG support to other
|
||||
programs. As such, their user interfaces are crude and definitely not
|
||||
intended for everyday use.
|
||||
Note that, although the programs are designed to be functional, their
|
||||
primary purpose is to illustrate how to use libpng to add PNG support to
|
||||
other programs. As such, their user interfaces are crude and definitely
|
||||
are not intended for everyday use.
|
||||
|
||||
Please see http://www.cdrom.com/pub/png/pngbook.html for further infor-
|
||||
Please see http://www.libpng.org/pub/png/pngbook.html for further infor-
|
||||
mation and links to the latest version of the source code, and Chapters
|
||||
13-15 of the book for detailed discussion of the three programs.
|
||||
|
||||
Greg Roelofs
|
||||
19 March 2000
|
||||
http://pobox.com/~newt/greg_contact.html
|
||||
16 March 2008
|
||||
|
||||
|
||||
BUILD INSTRUCTIONS
|
||||
|
||||
- Prerequisites:
|
||||
- Prerequisites (in order of compilation):
|
||||
|
||||
- zlib ftp://ftp.cdrom.com/pub/infozip/zlib/zlib.html
|
||||
- libpng http://www.cdrom.com/pub/png/pngcode.html
|
||||
- pngbook http://www.cdrom.com/pub/png/book/sources.html
|
||||
- zlib http://zlib.net/
|
||||
- libpng http://www.libpng.org/pub/png/libpng.html
|
||||
- pngbook http://www.libpng.org/pub/png/book/sources.html
|
||||
|
||||
The pngbook demo programs are explicitly designed to demonstrate proper
|
||||
coding techniques for using the libpng reference library. As a result,
|
||||
@@ -103,7 +104,7 @@ BUILD INSTRUCTIONS
|
||||
unpacked the source code.
|
||||
|
||||
For MSVC, set up the necessary environment variables by invoking
|
||||
|
||||
|
||||
%devstudio%\vc\bin\vcvars32.bat
|
||||
|
||||
where where %devstudio% is the installation directory for MSVC /
|
||||
@@ -128,11 +129,13 @@ BUILD INSTRUCTIONS
|
||||
|
||||
The result should be three executables: rpng-win.exe, rpng2-win.exe,
|
||||
and wpng.exe. Copy them somewhere in your PATH or run them from the
|
||||
current folder. Unlike the Unix versions, the two windowed programs
|
||||
(rpng and rpng2) do not display a usage screen when invoked without
|
||||
command-line arguments; see README.w32 for brief help or the book for
|
||||
details. Note that the programs use the Unix-style "-" character to
|
||||
specify options, instead of the more common DOS/Windows "/" character.
|
||||
current folder. Like the Unix versions, the two windowed programs
|
||||
(rpng and rpng2) now display a usage screen in a console window when
|
||||
invoked without command-line arguments; this is new behavior as of
|
||||
the June 2001 release. Note that the programs use the Unix-style "-"
|
||||
character to specify options, instead of the more common DOS/Windows
|
||||
"/" character. (For example: "rpng2-win -bgpat 4 foo.png", not
|
||||
"rpng2-win /bgpat 4 foo.png")
|
||||
|
||||
|
||||
- OpenVMS:
|
||||
@@ -148,9 +151,9 @@ BUILD INSTRUCTIONS
|
||||
To run the programs, they probably first need to be set up as "foreign
|
||||
symbols," with "disk" and "dir" set appropriately:
|
||||
|
||||
$ rpng == "$disk:[dir]rpng-x.exe"
|
||||
$ rpng == "$disk:[dir]rpng-x.exe"
|
||||
$ rpng2 == "$disk:[dir]rpng2-x.exe"
|
||||
$ wpng == "$disk:[dir]wpng.exe"
|
||||
$ wpng == "$disk:[dir]wpng.exe"
|
||||
|
||||
All three will print a basic usage screen when run without any command-
|
||||
line arguments; see the book for more details. Note that the options
|
||||
@@ -162,19 +165,19 @@ RUNNING THE PROGRAMS: (VERY) BRIEF INTRO
|
||||
rpng is a simple PNG viewer that can display transparent PNGs with a
|
||||
specified background color; for example,
|
||||
|
||||
rpng -bgcolor #ff0000 toucan.png
|
||||
rpng -bgcolor \#ff0000 toucan.png
|
||||
|
||||
would display the image with a red background. rpng2 is a progressive
|
||||
viewer that simulates a web browser in some respects; it can display
|
||||
images against either a background color or a dynamically generated
|
||||
background image. For example:
|
||||
|
||||
rpng2 -bgpat 16 toucan.png
|
||||
rpng2 -bgpat 16 toucan.png
|
||||
|
||||
wpng is a purely command-line image converter from binary PBMPLUS/NetPBM
|
||||
format (.pgm or .ppm) to PNG; for example,
|
||||
|
||||
wpng -time < toucan.ppm > toucan.png
|
||||
wpng -time < toucan-notrans.ppm > toucan-notrans.png
|
||||
|
||||
would convert the specified PPM file (using redirection) to PNG, auto-
|
||||
matically setting the PNG modification-time chunk.
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
See the main README file for basic instructions on compiling and running
|
||||
the programs. See http://www.cdrom.com/pub/png/pngbook.html for further
|
||||
information and links to the source code, and Chapters 13-15 of the book
|
||||
for detailed discussion of the three programs.
|
||||
|
||||
Since the two viewers, rpng and rpng2, are both designed to write infor-
|
||||
mation to the console (i.e., a DOS-window command line) while displaying
|
||||
the image in a graphical window--and since I haven't yet figured out how
|
||||
to do that under Windows--here are the usage screens for the two programs:
|
||||
|
||||
|
||||
rpng-win 1.02 of 19 March 2000: Simple PNG Viewer for Windows
|
||||
Compiled with libpng 1.0.5; using libpng 1.0.5.
|
||||
Compiled with zlib 1.1.3; using zlib 1.1.3.
|
||||
|
||||
Usage: rpng-win [-gamma exp] [-bgcolor bg] file.png
|
||||
exp transfer-function exponent (``gamma'') of the display
|
||||
system in floating-point format (e.g., ``2.2''); equal
|
||||
to the product of the lookup-table exponent (varies)
|
||||
and the CRT exponent (usually 2.2); must be positive
|
||||
bg desired background color in 7-character hex RGB format
|
||||
(e.g., ``#ff7f00'' for orange: same as HTML colors);
|
||||
used with transparent images
|
||||
|
||||
Press Q, Esc or mouse button 1 after image is displayed to quit.
|
||||
|
||||
|
||||
rpng2-win 1.04 of 19 March 2000: Progressive PNG Viewer for Windows
|
||||
Compiled with libpng 1.0.5; using libpng 1.0.5.
|
||||
Compiled with zlib 1.1.3; using zlib 1.1.3.
|
||||
|
||||
Usage: rpng2-win [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing] file.png
|
||||
|
||||
exp transfer-function exponent (``gamma'') of the display
|
||||
system in floating-point format (e.g., ``2.2''); equal
|
||||
to the product of the lookup-table exponent (varies)
|
||||
and the CRT exponent (usually 2.2); must be positive
|
||||
bg desired background color in 7-character hex RGB format
|
||||
(e.g., ``#ff7f00'' for orange: same as HTML colors);
|
||||
used with transparent images; overrides -bgpat
|
||||
pat desired background pattern number (1-16); used with
|
||||
transparent images; overrides -bgcolor
|
||||
-timing enables delay for every block read, to simulate modem
|
||||
download of image (~36 Kbps)
|
||||
|
||||
Press Q, Esc or mouse button 1 after image is displayed to quit.
|
||||
|
||||
|
||||
The usage screen for the third (non-windowed) program, wpng, can be seen
|
||||
simply by invoking it without any parameters (``wpng'').
|
||||
|
||||
Greg Roelofs
|
||||
19 March 2000
|
||||
@@ -9,23 +9,24 @@ $! Set locations where zlib and libpng sources live.
|
||||
$!
|
||||
$ zpath = ""
|
||||
$ pngpath = ""
|
||||
$ if f$search("[-.zlib]zlib.h").nes."" then zpath = "[-.zlib]"
|
||||
$ if f$search("[-.libpng]png.h").nes."" then pngpath = "[-.libpng]"
|
||||
$!
|
||||
$ if f$search("[---.zlib]zlib.h").nes."" then zpath = "[---.zlib]"
|
||||
$ if f$search("[--]png.h").nes."" then pngpath = "[--]"
|
||||
$!
|
||||
$ if f$search("[-.zlib]zlib.h").nes."" then zpath = "[-.zlib]"
|
||||
$ if f$search("[-.libpng]png.h").nes."" then pngpath = "[-.libpng]"
|
||||
$!
|
||||
$ if zpath .eqs. ""
|
||||
$ then
|
||||
$ write sys$output "Zlib include not found. Exiting..."
|
||||
$ write sys$output "zlib include not found. Exiting..."
|
||||
$ exit 2
|
||||
$ endif
|
||||
$ endif
|
||||
$!
|
||||
$ if pngpath .eqs. ""
|
||||
$ then
|
||||
$ write sys$output "Libpng include not found. Exiting..."
|
||||
$ write sys$output "libpng include not found. Exiting..."
|
||||
$ exit 2
|
||||
$ endif
|
||||
$ endif
|
||||
$!
|
||||
$! Look for the compiler used.
|
||||
$!
|
||||
|
||||
@@ -4,13 +4,20 @@
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
|
||||
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
be held liable for any damages arising in any way from the use of
|
||||
this software.
|
||||
|
||||
The contents of this file are DUAL-LICENSED. You may modify and/or
|
||||
redistribute this software according to the terms of one of the
|
||||
following two licenses (at your option):
|
||||
|
||||
|
||||
LICENSE 1 ("BSD-like with advertising clause"):
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute
|
||||
it freely, subject to the following restrictions:
|
||||
@@ -27,12 +34,30 @@
|
||||
and contributors for the book, "PNG: The Definitive Guide,"
|
||||
published by O'Reilly and Associates.
|
||||
|
||||
|
||||
LICENSE 2 (GNU GPL v2 or later):
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#include "png.h" /* libpng header; includes zlib.h */
|
||||
#include "png.h" /* libpng header */
|
||||
#include "readpng.h" /* typedefs, common macros, public prototypes */
|
||||
|
||||
/* future versions of libpng will provide this macro: */
|
||||
@@ -69,7 +94,7 @@ int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight)
|
||||
* have used slightly more general png_sig_cmp() function instead */
|
||||
|
||||
fread(sig, 1, 8, infile);
|
||||
if (!png_check_sig(sig, 8))
|
||||
if (png_sig_cmp(sig, 0, 8))
|
||||
return 1; /* bad signature */
|
||||
|
||||
|
||||
@@ -205,8 +230,14 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
|
||||
png_set_expand(png_ptr);
|
||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
|
||||
png_set_expand(png_ptr);
|
||||
#ifdef PNG_READ_16_TO_8_SUPPORTED
|
||||
if (bit_depth == 16)
|
||||
# ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
|
||||
png_set_scale_16(png_ptr);
|
||||
# else
|
||||
png_set_strip_16(png_ptr);
|
||||
# endif
|
||||
#endif
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY ||
|
||||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
png_set_gray_to_rgb(png_ptr);
|
||||
@@ -239,7 +270,8 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Trace((stderr, "readpng_get_image: rowbytes = %ld, height = %ld\n", rowbytes, height));
|
||||
Trace((stderr, "readpng_get_image: channels = %d, rowbytes = %ld, height = %ld\n",
|
||||
*pChannels, rowbytes, height));
|
||||
|
||||
|
||||
/* set the individual row_pointers to point at the correct offsets */
|
||||
|
||||
@@ -4,13 +4,20 @@
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
|
||||
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
be held liable for any damages arising in any way from the use of
|
||||
this software.
|
||||
|
||||
The contents of this file are DUAL-LICENSED. You may modify and/or
|
||||
redistribute this software according to the terms of one of the
|
||||
following two licenses (at your option):
|
||||
|
||||
|
||||
LICENSE 1 ("BSD-like with advertising clause"):
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute
|
||||
it freely, subject to the following restrictions:
|
||||
@@ -27,6 +34,23 @@
|
||||
and contributors for the book, "PNG: The Definitive Guide,"
|
||||
published by O'Reilly and Associates.
|
||||
|
||||
|
||||
LICENSE 2 (GNU GPL v2 or later):
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef TRUE
|
||||
|
||||
@@ -4,13 +4,20 @@
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved.
|
||||
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
be held liable for any damages arising in any way from the use of
|
||||
this software.
|
||||
|
||||
The contents of this file are DUAL-LICENSED. You may modify and/or
|
||||
redistribute this software according to the terms of one of the
|
||||
following two licenses (at your option):
|
||||
|
||||
|
||||
LICENSE 1 ("BSD-like with advertising clause"):
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute
|
||||
it freely, subject to the following restrictions:
|
||||
@@ -27,12 +34,31 @@
|
||||
and contributors for the book, "PNG: The Definitive Guide,"
|
||||
published by O'Reilly and Associates.
|
||||
|
||||
|
||||
LICENSE 2 (GNU GPL v2 or later):
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <stdlib.h> /* for exit() prototype */
|
||||
#include <setjmp.h>
|
||||
|
||||
#include "png.h" /* libpng header; includes zlib.h and setjmp.h */
|
||||
#include <zlib.h>
|
||||
#include "png.h" /* libpng header from the local directory */
|
||||
#include "readpng2.h" /* typedefs, common macros, public prototypes */
|
||||
|
||||
|
||||
@@ -49,10 +75,10 @@ static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg);
|
||||
|
||||
void readpng2_version_info(void)
|
||||
{
|
||||
fprintf(stderr, " Compiled with libpng %s; using libpng %s.\n",
|
||||
fprintf(stderr, " Compiled with libpng %s; using libpng %s\n",
|
||||
PNG_LIBPNG_VER_STRING, png_libpng_ver);
|
||||
|
||||
fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n",
|
||||
fprintf(stderr, " and with zlib %s; using zlib %s.\n",
|
||||
ZLIB_VERSION, zlib_version);
|
||||
}
|
||||
|
||||
@@ -61,7 +87,7 @@ void readpng2_version_info(void)
|
||||
|
||||
int readpng2_check_sig(uch *sig, int num)
|
||||
{
|
||||
return png_check_sig(sig, num);
|
||||
return !png_sig_cmp(sig, 0, num);
|
||||
}
|
||||
|
||||
|
||||
@@ -105,12 +131,39 @@ int readpng2_init(mainprog_info *mainprog_ptr)
|
||||
}
|
||||
|
||||
|
||||
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||
/* prepare the reader to ignore all recognized chunks whose data won't be
|
||||
* used, i.e., all chunks recognized by libpng except for IHDR, PLTE, IDAT,
|
||||
* IEND, tRNS, bKGD, gAMA, and sRGB (small performance improvement) */
|
||||
{
|
||||
/* These byte strings were copied from png.h. If a future version
|
||||
* of readpng2.c recognizes more chunks, add them to this list.
|
||||
*/
|
||||
static PNG_CONST png_byte chunks_to_process[] = {
|
||||
98, 75, 71, 68, '\0', /* bKGD */
|
||||
103, 65, 77, 65, '\0', /* gAMA */
|
||||
115, 82, 71, 66, '\0', /* sRGB */
|
||||
};
|
||||
|
||||
/* Ignore all chunks except for IHDR, PLTE, tRNS, IDAT, and IEND */
|
||||
png_set_keep_unknown_chunks(png_ptr, -1 /* PNG_HANDLE_CHUNK_NEVER */,
|
||||
NULL, -1);
|
||||
|
||||
/* But do not ignore chunks in the "chunks_to_process" list */
|
||||
png_set_keep_unknown_chunks(png_ptr,
|
||||
0 /* PNG_HANDLE_CHUNK_AS_DEFAULT */, chunks_to_process,
|
||||
sizeof(chunks_to_process)/5);
|
||||
}
|
||||
#endif /* PNG_HANDLE_AS_UNKNOWN_SUPPORTED */
|
||||
|
||||
|
||||
/* instead of doing png_init_io() here, now we set up our callback
|
||||
* functions for progressive decoding */
|
||||
|
||||
png_set_progressive_read_fn(png_ptr, mainprog_ptr,
|
||||
readpng2_info_callback, readpng2_row_callback, readpng2_end_callback);
|
||||
|
||||
|
||||
/* make sure we save our pointers for use in readpng2_decode_data() */
|
||||
|
||||
mainprog_ptr->png_ptr = png_ptr;
|
||||
@@ -158,7 +211,12 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
mainprog_info *mainprog_ptr;
|
||||
int color_type, bit_depth;
|
||||
png_uint_32 width, height;
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
double gamma;
|
||||
#else
|
||||
png_fixed_point gamma;
|
||||
#endif
|
||||
|
||||
|
||||
/* setjmp() doesn't make sense here, because we'd either have to exit(),
|
||||
@@ -193,8 +251,10 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
|
||||
|
||||
/* this is just like in the non-progressive case */
|
||||
|
||||
png_get_IHDR(png_ptr, info_ptr, &mainprog_ptr->width,
|
||||
&mainprog_ptr->height, &bit_depth, &color_type, NULL, NULL, NULL);
|
||||
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
||||
NULL, NULL, NULL);
|
||||
mainprog_ptr->width = (ulg)width;
|
||||
mainprog_ptr->height = (ulg)height;
|
||||
|
||||
|
||||
/* since we know we've read all of the PNG file's "header" (i.e., up
|
||||
@@ -245,8 +305,14 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
|
||||
png_set_expand(png_ptr);
|
||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
|
||||
png_set_expand(png_ptr);
|
||||
#ifdef PNG_READ_16_TO_8_SUPPORTED
|
||||
if (bit_depth == 16)
|
||||
# ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
|
||||
png_set_scale_16(png_ptr);
|
||||
# else
|
||||
png_set_strip_16(png_ptr);
|
||||
# endif
|
||||
#endif
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY ||
|
||||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
png_set_gray_to_rgb(png_ptr);
|
||||
@@ -267,11 +333,19 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
|
||||
* "gamma" value for the entire display system, i.e., the product of
|
||||
* LUT_exponent and CRT_exponent. */
|
||||
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
if (png_get_gAMA(png_ptr, info_ptr, &gamma))
|
||||
png_set_gamma(png_ptr, mainprog_ptr->display_exponent, gamma);
|
||||
else
|
||||
png_set_gamma(png_ptr, mainprog_ptr->display_exponent, 0.45455);
|
||||
|
||||
#else
|
||||
if (png_get_gAMA_fixed(png_ptr, info_ptr, &gamma))
|
||||
png_set_gamma_fixed(png_ptr,
|
||||
(png_fixed_point)(100000*mainprog_ptr->display_exponent+.5), gamma);
|
||||
else
|
||||
png_set_gamma_fixed(png_ptr,
|
||||
(png_fixed_point)(100000*mainprog_ptr->display_exponent+.5), 45455);
|
||||
#endif
|
||||
|
||||
/* we'll let libpng expand interlaced images, too */
|
||||
|
||||
@@ -420,5 +494,12 @@ static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg)
|
||||
exit(99);
|
||||
}
|
||||
|
||||
/* Now we have our data structure we can use the information in it
|
||||
* to return control to our own higher level code (all the points
|
||||
* where 'setjmp' is called in this file.) This will work with other
|
||||
* error handling mechanisms as well - libpng always calls png_error
|
||||
* when it can proceed no further, thus, so long as the error handler
|
||||
* is intercepted, application code can do its own error recovery.
|
||||
*/
|
||||
longjmp(mainprog_ptr->jmpbuf, 1);
|
||||
}
|
||||
|
||||
@@ -4,13 +4,20 @@
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved.
|
||||
Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
be held liable for any damages arising in any way from the use of
|
||||
this software.
|
||||
|
||||
The contents of this file are DUAL-LICENSED. You may modify and/or
|
||||
redistribute this software according to the terms of one of the
|
||||
following two licenses (at your option):
|
||||
|
||||
|
||||
LICENSE 1 ("BSD-like with advertising clause"):
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute
|
||||
it freely, subject to the following restrictions:
|
||||
@@ -27,6 +34,23 @@
|
||||
and contributors for the book, "PNG: The Definitive Guide,"
|
||||
published by O'Reilly and Associates.
|
||||
|
||||
|
||||
LICENSE 2 (GNU GPL v2 or later):
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef TRUE
|
||||
@@ -45,6 +69,12 @@
|
||||
# define Trace(x) ;
|
||||
#endif
|
||||
|
||||
enum rpng2_states {
|
||||
kPreInit = 0,
|
||||
kWindowInit,
|
||||
kDone
|
||||
};
|
||||
|
||||
typedef unsigned char uch;
|
||||
typedef unsigned short ush;
|
||||
typedef unsigned long ulg;
|
||||
@@ -66,12 +96,7 @@ typedef struct _mainprog_info {
|
||||
int rowbytes;
|
||||
int channels;
|
||||
int need_bgcolor;
|
||||
#if (defined(__i386__) || defined(_M_IX86))
|
||||
int nommxfilters;
|
||||
int nommxcombine;
|
||||
int nommxinterlace;
|
||||
#endif
|
||||
int done;
|
||||
int state;
|
||||
uch bg_red;
|
||||
uch bg_green;
|
||||
uch bg_blue;
|
||||
|
||||
179
contrib/gregbook/readppm.c
Normal file
@@ -0,0 +1,179 @@
|
||||
/*---------------------------------------------------------------------------
|
||||
|
||||
rpng - simple PNG display program readppm.c
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
This is a special-purpose replacement for readpng.c that allows binary
|
||||
PPM files to be used in place of PNG images.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
be held liable for any damages arising in any way from the use of
|
||||
this software.
|
||||
|
||||
The contents of this file are DUAL-LICENSED. You may modify and/or
|
||||
redistribute this software according to the terms of one of the
|
||||
following two licenses (at your option):
|
||||
|
||||
|
||||
LICENSE 1 ("BSD-like with advertising clause"):
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute
|
||||
it freely, subject to the following restrictions:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, disclaimer, and this list of conditions.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, disclaimer, and this list of conditions in the documenta-
|
||||
tion and/or other materials provided with the distribution.
|
||||
3. All advertising materials mentioning features or use of this
|
||||
software must display the following acknowledgment:
|
||||
|
||||
This product includes software developed by Greg Roelofs
|
||||
and contributors for the book, "PNG: The Definitive Guide,"
|
||||
published by O'Reilly and Associates.
|
||||
|
||||
|
||||
LICENSE 2 (GNU GPL v2 or later):
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "readpng.h" /* typedefs, common macros, public prototypes */
|
||||
|
||||
|
||||
ulg width, height;
|
||||
int bit_depth, color_type, channels;
|
||||
uch *image_data = NULL;
|
||||
FILE *saved_infile;
|
||||
|
||||
|
||||
void readpng_version_info()
|
||||
{
|
||||
fprintf(stderr, " Compiled without libpng, zlib or PBMPLUS/NetPBM.\n");
|
||||
}
|
||||
|
||||
|
||||
/* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 4 for no mem */
|
||||
|
||||
int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight)
|
||||
{
|
||||
static uch ppmline[256];
|
||||
int maxval;
|
||||
|
||||
|
||||
saved_infile = infile;
|
||||
|
||||
fgets(ppmline, 256, infile);
|
||||
if (ppmline[0] != 'P' || ppmline[1] != '6') {
|
||||
fprintf(stderr, "ERROR: not a PPM file\n");
|
||||
return 1;
|
||||
}
|
||||
/* possible color types: P5 = grayscale (0), P6 = RGB (2), P8 = RGBA (6) */
|
||||
if (ppmline[1] == '6') {
|
||||
color_type = 2;
|
||||
channels = 3;
|
||||
} else if (ppmline[1] == '8') {
|
||||
color_type = 6;
|
||||
channels = 4;
|
||||
} else /* if (ppmline[1] == '5') */ {
|
||||
color_type = 0;
|
||||
channels = 1;
|
||||
}
|
||||
|
||||
do {
|
||||
fgets(ppmline, 256, infile);
|
||||
} while (ppmline[0] == '#');
|
||||
sscanf(ppmline, "%lu %lu", &width, &height);
|
||||
|
||||
do {
|
||||
fgets(ppmline, 256, infile);
|
||||
} while (ppmline[0] == '#');
|
||||
sscanf(ppmline, "%d", &maxval);
|
||||
if (maxval != 255) {
|
||||
fprintf(stderr, "ERROR: maxval = %d\n", maxval);
|
||||
return 2;
|
||||
}
|
||||
bit_depth = 8;
|
||||
|
||||
*pWidth = width;
|
||||
*pHeight = height;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* returns 0 if succeeds, 1 if fails due to no bKGD chunk, 2 if libpng error;
|
||||
* scales values to 8-bit if necessary */
|
||||
|
||||
int readpng_get_bgcolor(uch *red, uch *green, uch *blue)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* display_exponent == LUT_exponent * CRT_exponent */
|
||||
|
||||
uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
|
||||
{
|
||||
ulg rowbytes;
|
||||
|
||||
|
||||
/* expand palette images to RGB, low-bit-depth grayscale images to 8 bits,
|
||||
* transparency chunks to full alpha channel; strip 16-bit-per-sample
|
||||
* images to 8 bits per sample; and convert grayscale to RGB[A] */
|
||||
|
||||
/* GRR WARNING: grayscale needs to be expanded and channels reset! */
|
||||
|
||||
*pRowbytes = rowbytes = channels*width;
|
||||
*pChannels = channels;
|
||||
|
||||
if ((image_data = (uch *)malloc(rowbytes*height)) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Trace((stderr, "readpng_get_image: rowbytes = %ld, height = %ld\n", rowbytes, height));
|
||||
|
||||
|
||||
/* now we can go ahead and just read the whole image */
|
||||
|
||||
fread(image_data, 1L, rowbytes*height, saved_infile);
|
||||
|
||||
|
||||
return image_data;
|
||||
}
|
||||
|
||||
|
||||
void readpng_cleanup(int free_image_data)
|
||||
{
|
||||
if (free_image_data && image_data) {
|
||||
free(image_data);
|
||||
image_data = NULL;
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@
|
||||
with a little tweaking (or maybe not).
|
||||
|
||||
to do:
|
||||
- stdout/stderr don't work! need message window (maybe scrollable?)
|
||||
- handle quoted command-line args (especially filenames with spaces)
|
||||
- have minimum window width: oh well
|
||||
- use %.1023s to simplify truncation of title-bar string?
|
||||
@@ -22,16 +21,26 @@
|
||||
match; switched to png_jmpbuf() macro
|
||||
- 1.02: added extra set of parentheses to png_jmpbuf() macro; fixed
|
||||
command-line parsing bug
|
||||
- 1.10: enabled "message window"/console (thanks to David Geldreich)
|
||||
- 2.00: dual-licensed (added GNU GPL)
|
||||
- 2.01: fixed improper display of usage screen on PNG error(s)
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
|
||||
Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
be held liable for any damages arising in any way from the use of
|
||||
this software.
|
||||
|
||||
The contents of this file are DUAL-LICENSED. You may modify and/or
|
||||
redistribute this software according to the terms of one of the
|
||||
following two licenses (at your option):
|
||||
|
||||
|
||||
LICENSE 1 ("BSD-like with advertising clause"):
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute
|
||||
it freely, subject to the following restrictions:
|
||||
@@ -48,17 +57,61 @@
|
||||
and contributors for the book, "PNG: The Definitive Guide,"
|
||||
published by O'Reilly and Associates.
|
||||
|
||||
|
||||
LICENSE 2 (GNU GPL v2 or later):
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#define PROGNAME "rpng-win"
|
||||
#define LONGNAME "Simple PNG Viewer for Windows"
|
||||
#define VERSION "1.02 of 19 March 2000"
|
||||
#define VERSION "2.01 of 16 March 2008"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <windows.h>
|
||||
#ifdef __CYGWIN__
|
||||
/* getch replacement. Turns out, we don't really need this,
|
||||
* but leave it here if we ever enable any of the uses of
|
||||
* _getch in the main code
|
||||
*/
|
||||
#include <unistd.h>
|
||||
#include <termio.h>
|
||||
#include <sys/ioctl.h>
|
||||
int repl_getch( void )
|
||||
{
|
||||
char ch;
|
||||
int fd = fileno(stdin);
|
||||
struct termio old_tty, new_tty;
|
||||
|
||||
ioctl(fd, TCGETA, &old_tty);
|
||||
new_tty = old_tty;
|
||||
new_tty.c_lflag &= ~(ICANON | ECHO | ISIG);
|
||||
ioctl(fd, TCSETA, &new_tty);
|
||||
fread(&ch, 1, sizeof(ch), stdin);
|
||||
ioctl(fd, TCSETA, &old_tty);
|
||||
|
||||
return ch;
|
||||
}
|
||||
#define _getch repl_getch
|
||||
#else
|
||||
#include <conio.h> /* only for _getch() */
|
||||
#endif
|
||||
|
||||
/* #define DEBUG : this enables the Trace() macros */
|
||||
|
||||
@@ -84,10 +137,9 @@ static void rpng_win_cleanup(void);
|
||||
LRESULT CALLBACK rpng_win_wndproc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
|
||||
static char titlebar[1024], *window_name = titlebar;
|
||||
static char titlebar[1024];
|
||||
static char *progname = PROGNAME;
|
||||
static char *appname = LONGNAME;
|
||||
static char *icon_name = PROGNAME; /* GRR: not (yet) used */
|
||||
static char *filename;
|
||||
static FILE *infile;
|
||||
|
||||
@@ -127,8 +179,19 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
||||
|
||||
filename = (char *)NULL;
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
/* First reenable console output, which normally goes to the bit bucket
|
||||
* for windowed apps. Closing the console window will terminate the
|
||||
* app. Thanks to David.Geldreich@realviz.com for supplying the magical
|
||||
* incantation. */
|
||||
|
||||
/* First set the default value for our display-system exponent, i.e.,
|
||||
AllocConsole();
|
||||
freopen("CONOUT$", "a", stderr);
|
||||
freopen("CONOUT$", "a", stdout);
|
||||
#endif
|
||||
|
||||
|
||||
/* Next set the default value for our display-system exponent, i.e.,
|
||||
* the product of the CRT exponent and the exponent corresponding to
|
||||
* the frame-buffer's lookup table (LUT), if any. This is not an
|
||||
* exhaustive list of LUT values (e.g., OpenStep has a lot of weird
|
||||
@@ -236,9 +299,43 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
||||
}
|
||||
}
|
||||
|
||||
if (!filename) {
|
||||
if (!filename)
|
||||
++error;
|
||||
} else if (!(infile = fopen(filename, "rb"))) {
|
||||
|
||||
|
||||
/* print usage screen if any errors up to this point */
|
||||
|
||||
if (error) {
|
||||
#ifndef __CYGWIN__
|
||||
int ch;
|
||||
#endif
|
||||
|
||||
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
|
||||
readpng_version_info();
|
||||
fprintf(stderr, "\n"
|
||||
"Usage: %s [-gamma exp] [-bgcolor bg] file.png\n"
|
||||
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
||||
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
||||
"\t\t to the product of the lookup-table exponent (varies)\n"
|
||||
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
|
||||
" bg \tdesired background color in 7-character hex RGB format\n"
|
||||
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
|
||||
"\t\t used with transparent images\n"
|
||||
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
|
||||
#ifndef __CYGWIN__
|
||||
"Press Q or Esc to quit this usage screen.\n"
|
||||
#endif
|
||||
"\n", PROGNAME, default_display_exponent);
|
||||
#ifndef __CYGWIN__
|
||||
do
|
||||
ch = _getch();
|
||||
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
if (!(infile = fopen(filename, "rb"))) {
|
||||
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
|
||||
++error;
|
||||
} else {
|
||||
@@ -251,8 +348,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
||||
break;
|
||||
case 2:
|
||||
fprintf(stderr, PROGNAME
|
||||
": [%s] has bad IHDR (libpng longjmp)\n",
|
||||
filename);
|
||||
": [%s] has bad IHDR (libpng longjmp)\n", filename);
|
||||
break;
|
||||
case 4:
|
||||
fprintf(stderr, PROGNAME ": insufficient memory\n");
|
||||
@@ -269,23 +365,25 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
||||
}
|
||||
|
||||
|
||||
/* usage screen */
|
||||
|
||||
if (error) {
|
||||
#ifndef __CYGWIN__
|
||||
int ch;
|
||||
#endif
|
||||
|
||||
fprintf(stderr, PROGNAME ": aborting.\n");
|
||||
#ifndef __CYGWIN__
|
||||
do
|
||||
ch = _getch();
|
||||
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
||||
#endif
|
||||
exit(2);
|
||||
} else {
|
||||
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
||||
readpng_version_info();
|
||||
fprintf(stderr, "\n"
|
||||
"Usage: %s [-gamma exp] [-bgcolor bg] file.png\n"
|
||||
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
||||
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
||||
"\t\t to the product of the lookup-table exponent (varies)\n"
|
||||
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
|
||||
" bg \tdesired background color in 7-character hex RGB format\n"
|
||||
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
|
||||
"\t\t used with transparent images\n"
|
||||
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
|
||||
"\n", PROGNAME, default_display_exponent);
|
||||
exit(1);
|
||||
#ifndef __CYGWIN__
|
||||
fprintf(stderr,
|
||||
"\n [console window: closing this window will terminate %s]\n\n",
|
||||
PROGNAME);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -303,9 +401,14 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
||||
* check for one in the PNG file--if not, the initialized values of 0
|
||||
* (black) will be used */
|
||||
|
||||
if (have_bg)
|
||||
sscanf(bgstr+1, "%2x%2x%2x", &bg_red, &bg_green, &bg_blue);
|
||||
else if (readpng_get_bgcolor(&bg_red, &bg_green, &bg_blue) > 1) {
|
||||
if (have_bg) {
|
||||
unsigned r, g, b; /* this approach quiets compiler warnings */
|
||||
|
||||
sscanf(bgstr+1, "%2x%2x%2x", &r, &g, &b);
|
||||
bg_red = (uch)r;
|
||||
bg_green = (uch)g;
|
||||
bg_blue = (uch)b;
|
||||
} else if (readpng_get_bgcolor(&bg_red, &bg_green, &bg_blue) > 1) {
|
||||
readpng_cleanup(TRUE);
|
||||
fprintf(stderr, PROGNAME
|
||||
": libpng error while checking for background color\n");
|
||||
@@ -353,7 +456,12 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
||||
/* wait for the user to tell us when to quit */
|
||||
|
||||
printf(
|
||||
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n");
|
||||
#ifndef __CYGWIN__
|
||||
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n"
|
||||
#else
|
||||
"Done. Press mouse button 1 (within image window) to quit.\n"
|
||||
#endif
|
||||
);
|
||||
fflush(stdout);
|
||||
|
||||
while (GetMessage(&msg, NULL, 0, 0)) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
by Martin Zinser under OpenVMS; may work under OS/2 with some tweaking).
|
||||
|
||||
to do:
|
||||
- 8-bit support
|
||||
- 8-bit (colormapped) X support
|
||||
- use %.1023s to simplify truncation of title-bar string?
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
@@ -21,16 +21,28 @@
|
||||
- 1.10: added support for non-default visuals; fixed X pixel-conversion
|
||||
- 1.11: added extra set of parentheses to png_jmpbuf() macro; fixed
|
||||
command-line parsing bug
|
||||
- 1.12: fixed some small X memory leaks (thanks to Fran<61>ois Petitjean)
|
||||
- 1.13: fixed XFreeGC() crash bug (thanks to Patrick Welche)
|
||||
- 1.14: added support for X resources (thanks to Gerhard Niklasch)
|
||||
- 2.00: dual-licensed (added GNU GPL)
|
||||
- 2.01: fixed improper display of usage screen on PNG error(s)
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
|
||||
Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
be held liable for any damages arising in any way from the use of
|
||||
this software.
|
||||
|
||||
The contents of this file are DUAL-LICENSED. You may modify and/or
|
||||
redistribute this software according to the terms of one of the
|
||||
following two licenses (at your option):
|
||||
|
||||
|
||||
LICENSE 1 ("BSD-like with advertising clause"):
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute
|
||||
it freely, subject to the following restrictions:
|
||||
@@ -47,11 +59,30 @@
|
||||
and contributors for the book, "PNG: The Definitive Guide,"
|
||||
published by O'Reilly and Associates.
|
||||
|
||||
|
||||
LICENSE 2 (GNU GPL v2 or later):
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#define PROGNAME "rpng-x"
|
||||
#define LONGNAME "Simple PNG Viewer for X"
|
||||
#define VERSION "1.11 of 19 March 2000"
|
||||
#define VERSION "2.01 of 16 March 2008"
|
||||
#define RESNAME "rpng" /* our X resource application name */
|
||||
#define RESCLASS "Rpng" /* our X resource class name */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -89,6 +120,8 @@ static int rpng_x_msb(ulg u32val);
|
||||
static char titlebar[1024], *window_name = titlebar;
|
||||
static char *appname = LONGNAME;
|
||||
static char *icon_name = PROGNAME;
|
||||
static char *res_name = RESNAME;
|
||||
static char *res_class = RESCLASS;
|
||||
static char *filename;
|
||||
static FILE *infile;
|
||||
|
||||
@@ -117,6 +150,7 @@ static Colormap colormap;
|
||||
static int have_nondefault_visual = FALSE;
|
||||
static int have_colormap = FALSE;
|
||||
static int have_window = FALSE;
|
||||
static int have_gc = FALSE;
|
||||
/*
|
||||
ulg numcolors=0, pixels[256];
|
||||
ush reds[256], greens[256], blues[256];
|
||||
@@ -218,8 +252,8 @@ int main(int argc, char **argv)
|
||||
else {
|
||||
bgstr = *argv;
|
||||
if (strlen(bgstr) != 7 || bgstr[0] != '#')
|
||||
++error;
|
||||
else
|
||||
++error;
|
||||
else
|
||||
have_bg = TRUE;
|
||||
}
|
||||
} else {
|
||||
@@ -232,9 +266,33 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (!filename) {
|
||||
if (!filename)
|
||||
++error;
|
||||
} else if (!(infile = fopen(filename, "rb"))) {
|
||||
|
||||
|
||||
/* print usage screen if any errors up to this point */
|
||||
|
||||
if (error) {
|
||||
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
||||
readpng_version_info();
|
||||
fprintf(stderr, "\n"
|
||||
"Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg] file.png\n"
|
||||
" xdpy\tname of the target X display (e.g., ``hostname:0'')\n"
|
||||
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
||||
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
||||
"\t\t to the product of the lookup-table exponent (varies)\n"
|
||||
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
|
||||
" bg \tdesired background color in 7-character hex RGB format\n"
|
||||
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
|
||||
"\t\t used with transparent images\n"
|
||||
"\nPress Q, Esc or mouse button 1 (within image window, after image\n"
|
||||
"is displayed) to quit.\n"
|
||||
"\n", PROGNAME, default_display_exponent);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
if (!(infile = fopen(filename, "rb"))) {
|
||||
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
|
||||
++error;
|
||||
} else {
|
||||
@@ -247,8 +305,7 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
case 2:
|
||||
fprintf(stderr, PROGNAME
|
||||
": [%s] has bad IHDR (libpng longjmp)\n",
|
||||
filename);
|
||||
": [%s] has bad IHDR (libpng longjmp)\n", filename);
|
||||
break;
|
||||
case 4:
|
||||
fprintf(stderr, PROGNAME ": insufficient memory\n");
|
||||
@@ -273,25 +330,9 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
|
||||
/* usage screen */
|
||||
|
||||
if (error) {
|
||||
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
||||
readpng_version_info();
|
||||
fprintf(stderr, "\n"
|
||||
"Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg] file.png\n"
|
||||
" xdpy\tname of the target X display (e.g., ``hostname:0'')\n"
|
||||
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
||||
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
||||
"\t\t to the product of the lookup-table exponent (varies)\n"
|
||||
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
|
||||
" bg \tdesired background color in 7-character hex RGB format\n"
|
||||
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
|
||||
"\t\t used with transparent images\n"
|
||||
"\nPress Q, Esc or mouse button 1 (within image window, after image\n"
|
||||
"is displayed) to quit.\n"
|
||||
"\n", PROGNAME, default_display_exponent);
|
||||
exit(1);
|
||||
fprintf(stderr, PROGNAME ": aborting.\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
|
||||
@@ -396,11 +437,12 @@ static int rpng_x_create_window(void)
|
||||
XEvent e;
|
||||
XGCValues gcvalues;
|
||||
XSetWindowAttributes attr;
|
||||
XSizeHints *size_hints;
|
||||
XTextProperty windowName, *pWindowName = &windowName;
|
||||
XTextProperty iconName, *pIconName = &iconName;
|
||||
XVisualInfo visual_info;
|
||||
XSizeHints *size_hints;
|
||||
XWMHints *wm_hints;
|
||||
XClassHint *class_hints;
|
||||
|
||||
|
||||
screen = DefaultScreen(display);
|
||||
@@ -523,7 +565,7 @@ static int rpng_x_create_window(void)
|
||||
if (!XStringListToTextProperty(&icon_name, 1, pIconName))
|
||||
pIconName = NULL;
|
||||
|
||||
/* OK if either hints allocation fails; XSetWMProperties() allows NULLs */
|
||||
/* OK if any hints allocation fails; XSetWMProperties() allows NULLs */
|
||||
|
||||
if ((size_hints = XAllocSizeHints()) != NULL) {
|
||||
/* window will not be resizable */
|
||||
@@ -539,12 +581,30 @@ static int rpng_x_create_window(void)
|
||||
wm_hints->flags = StateHint | InputHint /* | IconPixmapHint */ ;
|
||||
}
|
||||
|
||||
if ((class_hints = XAllocClassHint()) != NULL) {
|
||||
class_hints->res_name = res_name;
|
||||
class_hints->res_class = res_class;
|
||||
}
|
||||
|
||||
XSetWMProperties(display, window, pWindowName, pIconName, NULL, 0,
|
||||
size_hints, wm_hints, NULL);
|
||||
size_hints, wm_hints, class_hints);
|
||||
|
||||
/* various properties and hints no longer needed; free memory */
|
||||
if (pWindowName)
|
||||
XFree(pWindowName->value);
|
||||
if (pIconName)
|
||||
XFree(pIconName->value);
|
||||
if (size_hints)
|
||||
XFree(size_hints);
|
||||
if (wm_hints)
|
||||
XFree(wm_hints);
|
||||
if (class_hints)
|
||||
XFree(class_hints);
|
||||
|
||||
XMapWindow(display, window);
|
||||
|
||||
gc = XCreateGC(display, window, 0, &gcvalues);
|
||||
have_gc = TRUE;
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Fill window with the specified background color.
|
||||
@@ -814,7 +874,8 @@ static void rpng_x_cleanup(void)
|
||||
ximage = NULL;
|
||||
}
|
||||
|
||||
XFreeGC(display, gc);
|
||||
if (have_gc)
|
||||
XFreeGC(display, gc);
|
||||
|
||||
if (have_window)
|
||||
XDestroyWindow(display, window);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
tweaking (or maybe not). Thanks to Adam Costello and Pieter S. van der
|
||||
Meulen for the "diamond" and "radial waves" patterns, respectively.
|
||||
|
||||
to do:
|
||||
to do (someday, maybe):
|
||||
- handle quoted command-line args (especially filenames with spaces)
|
||||
- finish resizable checkerboard-gradient (sizes 4-128?)
|
||||
- use %.1023s to simplify truncation of title-bar string?
|
||||
@@ -24,18 +24,32 @@
|
||||
- 1.03: modified to allow abbreviated options
|
||||
- 1.04: removed bogus extra argument from usage fprintf() [Glenn R-P?];
|
||||
fixed command-line parsing bug
|
||||
- 1.10: enabled "message window" (console), thanks to David Geldreich
|
||||
- 1.10: enabled "message window"/console (thanks to David Geldreich)
|
||||
- 1.20: added runtime MMX-enabling/disabling and new -mmx* options
|
||||
- 1.21: made minor tweak to usage screen to fit within 25-line console
|
||||
- 1.22: added AMD64/EM64T support (__x86_64__)
|
||||
- 2.00: dual-licensed (added GNU GPL)
|
||||
- 2.01: fixed 64-bit typo in readpng2.c
|
||||
- 2.02: fixed improper display of usage screen on PNG error(s); fixed
|
||||
unexpected-EOF and file-read-error cases
|
||||
- 2.03: removed runtime MMX-enabling/disabling and obsolete -mmx* options
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved.
|
||||
Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
be held liable for any damages arising in any way from the use of
|
||||
this software.
|
||||
|
||||
The contents of this file are DUAL-LICENSED. You may modify and/or
|
||||
redistribute this software according to the terms of one of the
|
||||
following two licenses (at your option):
|
||||
|
||||
|
||||
LICENSE 1 ("BSD-like with advertising clause"):
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute
|
||||
it freely, subject to the following restrictions:
|
||||
@@ -52,11 +66,28 @@
|
||||
and contributors for the book, "PNG: The Definitive Guide,"
|
||||
published by O'Reilly and Associates.
|
||||
|
||||
|
||||
LICENSE 2 (GNU GPL v2 or later):
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#define PROGNAME "rpng2-win"
|
||||
#define LONGNAME "Progressive PNG Viewer for Windows"
|
||||
#define VERSION "1.20 of 29 January 2001"
|
||||
#define VERSION "2.02 of 16 March 2008"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -65,7 +96,33 @@
|
||||
#include <time.h>
|
||||
#include <math.h> /* only for PvdM background code */
|
||||
#include <windows.h>
|
||||
#ifdef __CYGWIN__
|
||||
/* getch replacement. Turns out, we don't really need this,
|
||||
* but leave it here if we ever enable any of the uses of
|
||||
* _getch in the main code
|
||||
*/
|
||||
#include <unistd.h>
|
||||
#include <termio.h>
|
||||
#include <sys/ioctl.h>
|
||||
int repl_getch( void )
|
||||
{
|
||||
char ch;
|
||||
int fd = fileno(stdin);
|
||||
struct termio old_tty, new_tty;
|
||||
|
||||
ioctl(fd, TCGETA, &old_tty);
|
||||
new_tty = old_tty;
|
||||
new_tty.c_lflag &= ~(ICANON | ECHO | ISIG);
|
||||
ioctl(fd, TCSETA, &new_tty);
|
||||
fread(&ch, 1, sizeof(ch), stdin);
|
||||
ioctl(fd, TCSETA, &old_tty);
|
||||
|
||||
return ch;
|
||||
}
|
||||
#define _getch repl_getch
|
||||
#else
|
||||
#include <conio.h> /* only for _getch() */
|
||||
#endif
|
||||
|
||||
/* all for PvdM background code: */
|
||||
#ifndef PI
|
||||
@@ -118,10 +175,9 @@ static void rpng2_win_cleanup(void);
|
||||
LRESULT CALLBACK rpng2_win_wndproc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
|
||||
static char titlebar[1024], *window_name = titlebar;
|
||||
static char titlebar[1024];
|
||||
static char *progname = PROGNAME;
|
||||
static char *appname = LONGNAME;
|
||||
static char *icon_name = PROGNAME; /* GRR: not (yet) used */
|
||||
static char *filename;
|
||||
static FILE *infile;
|
||||
|
||||
@@ -240,7 +296,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
||||
filename = (char *)NULL;
|
||||
memset(&rpng2_info, 0, sizeof(mainprog_info));
|
||||
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
/* Next reenable console output, which normally goes to the bit bucket
|
||||
* for windowed apps. Closing the console window will terminate the
|
||||
* app. Thanks to David.Geldreich@realviz.com for supplying the magical
|
||||
@@ -249,7 +305,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
||||
AllocConsole();
|
||||
freopen("CONOUT$", "a", stderr);
|
||||
freopen("CONOUT$", "a", stdout);
|
||||
|
||||
#endif
|
||||
|
||||
/* Set the default value for our display-system exponent, i.e., the
|
||||
* product of the CRT exponent and the exponent corresponding to
|
||||
@@ -366,18 +422,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
||||
}
|
||||
} else if (!strncmp(*argv, "-timing", 2)) {
|
||||
timing = TRUE;
|
||||
#if (defined(__i386__) || defined(_M_IX86))
|
||||
} else if (!strncmp(*argv, "-nommxfilters", 7)) {
|
||||
rpng2_info.nommxfilters = TRUE;
|
||||
} else if (!strncmp(*argv, "-nommxcombine", 7)) {
|
||||
rpng2_info.nommxcombine = TRUE;
|
||||
} else if (!strncmp(*argv, "-nommxinterlace", 7)) {
|
||||
rpng2_info.nommxinterlace = TRUE;
|
||||
} else if (!strcmp(*argv, "-nommx")) {
|
||||
rpng2_info.nommxfilters = TRUE;
|
||||
rpng2_info.nommxcombine = TRUE;
|
||||
rpng2_info.nommxinterlace = TRUE;
|
||||
#endif
|
||||
} else {
|
||||
if (**argv != '-') {
|
||||
filename = *argv;
|
||||
@@ -388,9 +432,56 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
||||
}
|
||||
}
|
||||
|
||||
if (!filename) {
|
||||
if (!filename)
|
||||
++error;
|
||||
} else if (!(infile = fopen(filename, "rb"))) {
|
||||
|
||||
|
||||
/* print usage screen if any errors up to this point */
|
||||
|
||||
if (error) {
|
||||
#ifndef __CYGWIN__
|
||||
int ch;
|
||||
#endif
|
||||
|
||||
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
|
||||
readpng2_version_info();
|
||||
fprintf(stderr, "\n"
|
||||
"Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\n"
|
||||
" %*s file.png\n\n"
|
||||
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
||||
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
||||
"\t\t to the product of the lookup-table exponent (varies)\n"
|
||||
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
|
||||
" bg \tdesired background color in 7-character hex RGB format\n"
|
||||
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
|
||||
"\t\t used with transparent images; overrides -bgpat option\n"
|
||||
" pat \tdesired background pattern number (1-%d); used with\n"
|
||||
"\t\t transparent images; overrides -bgcolor option\n"
|
||||
" -timing\tenables delay for every block read, to simulate modem\n"
|
||||
"\t\t download of image (~36 Kbps)\n"
|
||||
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
|
||||
#ifndef __CYGWIN__
|
||||
"Press Q or Esc to quit this usage screen. ",
|
||||
#else
|
||||
,
|
||||
#endif
|
||||
PROGNAME,
|
||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
|
||||
!(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
(int)strlen(PROGNAME), " ",
|
||||
#endif
|
||||
(int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat);
|
||||
fflush(stderr);
|
||||
#ifndef __CYGWIN__
|
||||
do
|
||||
ch = _getch();
|
||||
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
if (!(infile = fopen(filename, "rb"))) {
|
||||
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
|
||||
++error;
|
||||
} else {
|
||||
@@ -404,8 +495,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
||||
switch (rc) {
|
||||
case 2:
|
||||
fprintf(stderr, PROGNAME
|
||||
": [%s] has bad IHDR (libpng longjmp)\n",
|
||||
filename);
|
||||
": [%s] has bad IHDR (libpng longjmp)\n", filename);
|
||||
break;
|
||||
case 4:
|
||||
fprintf(stderr, PROGNAME ": insufficient memory\n");
|
||||
@@ -422,50 +512,26 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
||||
}
|
||||
|
||||
|
||||
/* usage screen */
|
||||
|
||||
if (error) {
|
||||
#ifndef __CYGWIN__
|
||||
int ch;
|
||||
#endif
|
||||
|
||||
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
|
||||
readpng2_version_info();
|
||||
fprintf(stderr, "\n"
|
||||
"Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\n"
|
||||
#if (defined(__i386__) || defined(_M_IX86))
|
||||
" %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n"
|
||||
#endif
|
||||
" %*s file.png\n\n"
|
||||
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
||||
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
||||
"\t\t to the product of the lookup-table exponent (varies)\n"
|
||||
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
|
||||
" bg \tdesired background color in 7-character hex RGB format\n"
|
||||
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
|
||||
"\t\t used with transparent images; overrides -bgpat option\n"
|
||||
" pat \tdesired background pattern number (1-%d); used with\n"
|
||||
"\t\t transparent images; overrides -bgcolor option\n"
|
||||
" -timing\tenables delay for every block read, to simulate modem\n"
|
||||
"\t\t download of image (~36 Kbps)\n"
|
||||
#if (defined(__i386__) || defined(_M_IX86))
|
||||
" -nommx*\tdisable optimized MMX routines for decoding row filters,\n"
|
||||
"\t\t combining rows, and expanding interlacing, respectively\n"
|
||||
#endif
|
||||
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
|
||||
"Press Q or Esc to quit this usage screen.\n"
|
||||
"\n", PROGNAME,
|
||||
#if (defined(__i386__) || defined(_M_IX86))
|
||||
strlen(PROGNAME), " ",
|
||||
#endif
|
||||
strlen(PROGNAME), " ", default_display_exponent, num_bgpat);
|
||||
fprintf(stderr, PROGNAME ": aborting.\n");
|
||||
#ifndef __CYGWIN__
|
||||
do
|
||||
ch = _getch();
|
||||
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
||||
exit(1);
|
||||
#endif
|
||||
exit(2);
|
||||
} else {
|
||||
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
||||
#ifndef __CYGWIN__
|
||||
fprintf(stderr,
|
||||
"\n [console window: closing this window will terminate %s]\n\n",
|
||||
PROGNAME);
|
||||
#endif
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
|
||||
@@ -491,7 +557,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
||||
} else
|
||||
rpng2_info.need_bgcolor = TRUE;
|
||||
|
||||
rpng2_info.done = FALSE;
|
||||
rpng2_info.state = kPreInit;
|
||||
rpng2_info.mainprog_init = rpng2_win_init;
|
||||
rpng2_info.mainprog_display_row = rpng2_win_display_row;
|
||||
rpng2_info.mainprog_finish_display = rpng2_win_finish_display;
|
||||
@@ -511,10 +577,27 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
||||
if (readpng2_decode_data(&rpng2_info, inbuf, incount))
|
||||
++error;
|
||||
Trace((stderr, "done with readpng2_decode_data()\n"))
|
||||
if (error || feof(infile) || rpng2_info.done)
|
||||
|
||||
if (error || incount != INBUFSIZE || rpng2_info.state == kDone) {
|
||||
if (rpng2_info.state == kDone) {
|
||||
Trace((stderr, "done decoding PNG image\n"))
|
||||
} else if (ferror(infile)) {
|
||||
fprintf(stderr, PROGNAME
|
||||
": error while reading PNG image file\n");
|
||||
exit(3);
|
||||
} else if (feof(infile)) {
|
||||
fprintf(stderr, PROGNAME ": end of file reached "
|
||||
"(unexpectedly) while reading PNG image file\n");
|
||||
exit(3);
|
||||
} else /* if (error) */ {
|
||||
/* will print error message below */
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (timing)
|
||||
Sleep(1000L);
|
||||
|
||||
incount = fread(inbuf, 1, INBUFSIZE, infile);
|
||||
}
|
||||
|
||||
@@ -561,7 +644,7 @@ static void rpng2_win_init()
|
||||
ulg rowbytes = rpng2_info.rowbytes;
|
||||
|
||||
Trace((stderr, "beginning rpng2_win_init()\n"))
|
||||
Trace((stderr, " rowbytes = %ld\n", rpng2_info.rowbytes))
|
||||
Trace((stderr, " rowbytes = %d\n", rpng2_info.rowbytes))
|
||||
Trace((stderr, " width = %ld\n", rpng2_info.width))
|
||||
Trace((stderr, " height = %ld\n", rpng2_info.height))
|
||||
|
||||
@@ -591,6 +674,8 @@ static void rpng2_win_init()
|
||||
readpng2_cleanup(&rpng2_info);
|
||||
return;
|
||||
}
|
||||
|
||||
rpng2_info.state = kWindowInit;
|
||||
}
|
||||
|
||||
|
||||
@@ -1086,9 +1171,14 @@ static void rpng2_win_finish_display()
|
||||
* we have nothing to do here except set a flag and let the user know
|
||||
* that the image is done */
|
||||
|
||||
rpng2_info.done = TRUE;
|
||||
rpng2_info.state = kDone;
|
||||
printf(
|
||||
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n");
|
||||
#ifndef __CYGWIN__
|
||||
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n"
|
||||
#else
|
||||
"Done. Press mouse button 1 (within image window) to quit.\n"
|
||||
#endif
|
||||
);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
This program converts certain NetPBM binary files (grayscale and RGB,
|
||||
maxval = 255) to PNG. Non-interlaced PNGs are written progressively;
|
||||
interlaced PNGs are read and written in one memory-intensive blast.
|
||||
|
||||
Thanks to Jean-loup Gailly for providing the necessary trick to read
|
||||
interactive text from the keyboard while stdin is redirected.
|
||||
interactive text from the keyboard while stdin is redirected. Thanks
|
||||
to Cosmin Truta for Cygwin fixes.
|
||||
|
||||
NOTE: includes provisional support for PNM type "8" (portable alphamap)
|
||||
images, presumed to be a 32-bit interleaved RGBA format; no pro-
|
||||
@@ -24,16 +26,32 @@
|
||||
- 1.02: modified to allow abbreviated options
|
||||
- 1.03: removed extraneous character from usage screen; fixed bug in
|
||||
command-line parsing
|
||||
- 1.04: fixed DOS/OS2/Win32 detection, including partial Cygwin fix
|
||||
(see http://home.att.net/~perlspinr/diffs/GregBook_cygwin.diff)
|
||||
- 2.00: dual-licensed (added GNU GPL)
|
||||
|
||||
[REPORTED BUG (win32 only): "contrib/gregbook/wpng.c - cmd line
|
||||
dose not work! In order to do something useful I needed to redirect
|
||||
both input and output, with cygwin and with bcc32 as well. Under
|
||||
Linux, the same wpng appears to work fine. I don't know what is
|
||||
the problem."]
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
|
||||
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
be held liable for any damages arising in any way from the use of
|
||||
this software.
|
||||
|
||||
The contents of this file are DUAL-LICENSED. You may modify and/or
|
||||
redistribute this software according to the terms of one of the
|
||||
following two licenses (at your option):
|
||||
|
||||
|
||||
LICENSE 1 ("BSD-like with advertising clause"):
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute
|
||||
it freely, subject to the following restrictions:
|
||||
@@ -50,16 +68,35 @@
|
||||
and contributors for the book, "PNG: The Definitive Guide,"
|
||||
published by O'Reilly and Associates.
|
||||
|
||||
|
||||
LICENSE 2 (GNU GPL v2 or later):
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#define PROGNAME "wpng"
|
||||
#define VERSION "1.03 of 19 March 2000"
|
||||
#define VERSION "2.00 of 2 June 2007"
|
||||
#define APPNAME "Simple PGM/PPM/PAM to PNG Converter"
|
||||
|
||||
#if defined(__MSDOS__) || defined(__OS2__)
|
||||
# define DOS_OS2_W32
|
||||
#elif defined(_WIN32) || defined(__WIN32__)
|
||||
# define DOS_OS2_W32
|
||||
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
||||
# ifndef __GNUC__ /* treat Win32 native ports of gcc as Unix environments */
|
||||
# define DOS_OS2_W32
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -4,13 +4,20 @@
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
|
||||
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
be held liable for any damages arising in any way from the use of
|
||||
this software.
|
||||
|
||||
The contents of this file are DUAL-LICENSED. You may modify and/or
|
||||
redistribute this software according to the terms of one of the
|
||||
following two licenses (at your option):
|
||||
|
||||
|
||||
LICENSE 1 ("BSD-like with advertising clause"):
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute
|
||||
it freely, subject to the following restrictions:
|
||||
@@ -27,12 +34,30 @@
|
||||
and contributors for the book, "PNG: The Definitive Guide,"
|
||||
published by O'Reilly and Associates.
|
||||
|
||||
|
||||
LICENSE 2 (GNU GPL v2 or later):
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <stdlib.h> /* for exit() prototype */
|
||||
#include <zlib.h>
|
||||
|
||||
#include "png.h" /* libpng header; includes zlib.h and setjmp.h */
|
||||
#include "png.h" /* libpng header, includes setjmp.h */
|
||||
#include "writepng.h" /* typedefs, common macros, public prototypes */
|
||||
|
||||
|
||||
@@ -80,7 +105,8 @@ int writepng_init(mainprog_info *mainprog_ptr)
|
||||
/* setjmp() must be called in every function that calls a PNG-writing
|
||||
* libpng function, unless an alternate error handler was installed--
|
||||
* but compatible error handlers must either use longjmp() themselves
|
||||
* (as in this program) or exit immediately, so here we go: */
|
||||
* (as in this program) or some other method to return control to
|
||||
* application code, so here we go: */
|
||||
|
||||
if (setjmp(mainprog_ptr->jmpbuf)) {
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
@@ -364,5 +390,12 @@ static void writepng_error_handler(png_structp png_ptr, png_const_charp msg)
|
||||
exit(99);
|
||||
}
|
||||
|
||||
/* Now we have our data structure we can use the information in it
|
||||
* to return control to our own higher level code (all the points
|
||||
* where 'setjmp' is called in this file.) This will work with other
|
||||
* error handling mechanisms as well - libpng always calls png_error
|
||||
* when it can proceed no further, thus, so long as the error handler
|
||||
* is intercepted, application code can do its own error recovery.
|
||||
*/
|
||||
longjmp(mainprog_ptr->jmpbuf, 1);
|
||||
}
|
||||
|
||||
@@ -4,13 +4,20 @@
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
|
||||
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
be held liable for any damages arising in any way from the use of
|
||||
this software.
|
||||
|
||||
The contents of this file are DUAL-LICENSED. You may modify and/or
|
||||
redistribute this software according to the terms of one of the
|
||||
following two licenses (at your option):
|
||||
|
||||
|
||||
LICENSE 1 ("BSD-like with advertising clause"):
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute
|
||||
it freely, subject to the following restrictions:
|
||||
@@ -27,6 +34,23 @@
|
||||
and contributors for the book, "PNG: The Definitive Guide,"
|
||||
published by O'Reilly and Associates.
|
||||
|
||||
|
||||
LICENSE 2 (GNU GPL v2 or later):
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef TRUE
|
||||
|
||||
102
contrib/libtests/gentests.sh
Executable file
@@ -0,0 +1,102 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2012 John Cunningham Bowler
|
||||
#
|
||||
# Last changed in libpng 1.6.0 [(PENDING RELEASE)]
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
# and license in png.h
|
||||
#
|
||||
# Generate a set of PNG test images. The images are generated in a
|
||||
# sub-directory called 'tests' by default, however a command line argument will
|
||||
# change that name. The generation requires a built version of makepng in the
|
||||
# current directory.
|
||||
#
|
||||
usage(){
|
||||
exec >&2
|
||||
echo "$0 [<directory>]"
|
||||
echo ' Generate a set of PNG test files in "directory" ("tests" by default)'
|
||||
exit 1
|
||||
}
|
||||
|
||||
mp="$PWD/makepng"
|
||||
test -x "$mp" || {
|
||||
exec >&2
|
||||
echo "$0: the 'makepng' program must exist"
|
||||
echo " in the directory within which this program:"
|
||||
echo " $mp"
|
||||
echo " is executed"
|
||||
usage
|
||||
}
|
||||
|
||||
# Just one argument: the directory
|
||||
testdir="tests"
|
||||
test $# -gt 1 && {
|
||||
testdir="$1"
|
||||
shift
|
||||
}
|
||||
test $# -eq 0 || usage
|
||||
|
||||
# Take care not to clobber something
|
||||
if test -e "$testdir"
|
||||
then
|
||||
test -d "$testdir" || usage
|
||||
else
|
||||
# mkdir -p isn't portable, so do the following
|
||||
mkdir "$testdir" 2>/dev/null || mkdir -p "$testdir" || usage
|
||||
fi
|
||||
|
||||
# This fails in a very satisfactory way if it's not accessible
|
||||
cd "$testdir"
|
||||
:>"test$$.png" || {
|
||||
exec >&2
|
||||
echo "$testdir: directory not writable"
|
||||
usage
|
||||
}
|
||||
rm "test$$.png" || {
|
||||
exec >&2
|
||||
echo "$testdir: you have create but not write privileges here."
|
||||
echo " This is unexpected. You have a spurion; "'"'"test$$.png"'"'"."
|
||||
echo " You need to remove this yourself. Try a different directory."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Now call makepng ($mp) to create every file we can think of with a
|
||||
# reasonable name
|
||||
doit(){
|
||||
for gamma in "" --sRGB --linear --1.8
|
||||
do
|
||||
case "$gamma" in
|
||||
"")
|
||||
gname=;;
|
||||
--sRGB)
|
||||
gname="-srgb";;
|
||||
--linear)
|
||||
gname="-lin";;
|
||||
--1.8)
|
||||
gname="-18";;
|
||||
*)
|
||||
gname="-$gamma";;
|
||||
esac
|
||||
"$mp" $gamma "$1" "$2" "test-$1-$2$gname.png"
|
||||
done
|
||||
}
|
||||
#
|
||||
for ct in gray palette
|
||||
do
|
||||
for bd in 1 2 4 8
|
||||
do
|
||||
doit "$ct" "$bd"
|
||||
done
|
||||
done
|
||||
#
|
||||
doit "gray" "16"
|
||||
#
|
||||
for ct in gray-alpha rgb rgb-alpha
|
||||
do
|
||||
for bd in 8 16
|
||||
do
|
||||
doit "$ct" "$bd"
|
||||
done
|
||||
done
|
||||
1283
contrib/libtests/makepng.c
Normal file
3700
contrib/libtests/pngstest.c
Normal file
721
contrib/libtests/pngunknown.c
Normal file
@@ -0,0 +1,721 @@
|
||||
|
||||
/* pngunknown.c - test the read side unknown chunk handling
|
||||
*
|
||||
* Last changed in libpng 1.6.0 [(PENDING RELEASE)]
|
||||
* Copyright (c) 2012 Glenn Randers-Pehrson
|
||||
* Written by John Cunningham Bowler
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*
|
||||
* NOTES:
|
||||
* This is a C program that is intended to be linked against libpng. It
|
||||
* allows the libpng unknown handling code to be tested by interpreting
|
||||
* arguments to save or discard combinations of chunks. The program is
|
||||
* currently just a minimal validation for the built-in libpng facilities.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <png.h>
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
|
||||
#if PNG_LIBPNG_VER < 10500
|
||||
/* This deliberately lacks the PNG_CONST. */
|
||||
typedef png_byte *png_const_bytep;
|
||||
|
||||
/* This is copied from 1.5.1 png.h: */
|
||||
#define PNG_INTERLACE_ADAM7_PASSES 7
|
||||
#define PNG_PASS_START_ROW(pass) (((1U&~(pass))<<(3-((pass)>>1)))&7)
|
||||
#define PNG_PASS_START_COL(pass) (((1U& (pass))<<(3-(((pass)+1)>>1)))&7)
|
||||
#define PNG_PASS_ROW_SHIFT(pass) ((pass)>2?(8-(pass))>>1:3)
|
||||
#define PNG_PASS_COL_SHIFT(pass) ((pass)>1?(7-(pass))>>1:3)
|
||||
#define PNG_PASS_ROWS(height, pass) (((height)+(((1<<PNG_PASS_ROW_SHIFT(pass))\
|
||||
-1)-PNG_PASS_START_ROW(pass)))>>PNG_PASS_ROW_SHIFT(pass))
|
||||
#define PNG_PASS_COLS(width, pass) (((width)+(((1<<PNG_PASS_COL_SHIFT(pass))\
|
||||
-1)-PNG_PASS_START_COL(pass)))>>PNG_PASS_COL_SHIFT(pass))
|
||||
#define PNG_ROW_FROM_PASS_ROW(yIn, pass) \
|
||||
(((yIn)<<PNG_PASS_ROW_SHIFT(pass))+PNG_PASS_START_ROW(pass))
|
||||
#define PNG_COL_FROM_PASS_COL(xIn, pass) \
|
||||
(((xIn)<<PNG_PASS_COL_SHIFT(pass))+PNG_PASS_START_COL(pass))
|
||||
#define PNG_PASS_MASK(pass,off) ( \
|
||||
((0x110145AFU>>(((7-(off))-(pass))<<2)) & 0xFU) | \
|
||||
((0x01145AF0U>>(((7-(off))-(pass))<<2)) & 0xF0U))
|
||||
#define PNG_ROW_IN_INTERLACE_PASS(y, pass) \
|
||||
((PNG_PASS_MASK(pass,0) >> ((y)&7)) & 1)
|
||||
#define PNG_COL_IN_INTERLACE_PASS(x, pass) \
|
||||
((PNG_PASS_MASK(pass,1) >> ((x)&7)) & 1)
|
||||
|
||||
/* These are needed too for the default build: */
|
||||
#define PNG_WRITE_16BIT_SUPPORTED
|
||||
#define PNG_READ_16BIT_SUPPORTED
|
||||
|
||||
/* This comes from pnglibconf.h afer 1.5: */
|
||||
#define PNG_FP_1 100000
|
||||
#define PNG_GAMMA_THRESHOLD_FIXED\
|
||||
((png_fixed_point)(PNG_GAMMA_THRESHOLD * PNG_FP_1))
|
||||
#endif
|
||||
|
||||
#if PNG_LIBPNG_VER < 10600
|
||||
/* 1.6.0 constifies many APIs. The following exists to allow pngvalid to be
|
||||
* compiled against earlier versions.
|
||||
*/
|
||||
# define png_const_structp png_structp
|
||||
#endif
|
||||
|
||||
|
||||
/* Copied from pngpriv.h */
|
||||
#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
|
||||
#define PNG_CHUNK(b1,b2,b3,b4) \
|
||||
(PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
|
||||
|
||||
#define png_IHDR PNG_CHUNK( 73, 72, 68, 82)
|
||||
#define png_IDAT PNG_CHUNK( 73, 68, 65, 84)
|
||||
#define png_IEND PNG_CHUNK( 73, 69, 78, 68)
|
||||
#define png_PLTE PNG_CHUNK( 80, 76, 84, 69)
|
||||
#define png_bKGD PNG_CHUNK( 98, 75, 71, 68)
|
||||
#define png_cHRM PNG_CHUNK( 99, 72, 82, 77)
|
||||
#define png_gAMA PNG_CHUNK(103, 65, 77, 65)
|
||||
#define png_hIST PNG_CHUNK(104, 73, 83, 84)
|
||||
#define png_iCCP PNG_CHUNK(105, 67, 67, 80)
|
||||
#define png_iTXt PNG_CHUNK(105, 84, 88, 116)
|
||||
#define png_oFFs PNG_CHUNK(111, 70, 70, 115)
|
||||
#define png_pCAL PNG_CHUNK(112, 67, 65, 76)
|
||||
#define png_sCAL PNG_CHUNK(115, 67, 65, 76)
|
||||
#define png_pHYs PNG_CHUNK(112, 72, 89, 115)
|
||||
#define png_sBIT PNG_CHUNK(115, 66, 73, 84)
|
||||
#define png_sPLT PNG_CHUNK(115, 80, 76, 84)
|
||||
#define png_sRGB PNG_CHUNK(115, 82, 71, 66)
|
||||
#define png_sTER PNG_CHUNK(115, 84, 69, 82)
|
||||
#define png_tEXt PNG_CHUNK(116, 69, 88, 116)
|
||||
#define png_tIME PNG_CHUNK(116, 73, 77, 69)
|
||||
#define png_tRNS PNG_CHUNK(116, 82, 78, 83)
|
||||
#define png_zTXt PNG_CHUNK(122, 84, 88, 116)
|
||||
#define png_vpAg PNG_CHUNK('v', 'p', 'A', 'g')
|
||||
|
||||
/* Test on flag values as defined in the spec (section 5.4): */
|
||||
#define PNG_CHUNK_ANCILLARY(c ) (1 & ((c) >> 29))
|
||||
#define PNG_CHUNK_CRITICAL(c) (!PNG_CHUNK_ANCILLARY(c))
|
||||
#define PNG_CHUNK_PRIVATE(c) (1 & ((c) >> 21))
|
||||
#define PNG_CHUNK_RESERVED(c) (1 & ((c) >> 13))
|
||||
#define PNG_CHUNK_SAFE_TO_COPY(c) (1 & ((c) >> 5))
|
||||
|
||||
/* Chunk information */
|
||||
#define PNG_INFO_tEXt 0x10000000U
|
||||
#define PNG_INFO_iTXt 0x20000000U
|
||||
#define PNG_INFO_zTXt 0x40000000U
|
||||
|
||||
#define PNG_INFO_sTER 0x01000000U
|
||||
#define PNG_INFO_vpAg 0x02000000U
|
||||
|
||||
#define ABSENT 0
|
||||
#define START 1
|
||||
#define END 2
|
||||
|
||||
static struct
|
||||
{
|
||||
char name[5];
|
||||
png_uint_32 flag;
|
||||
png_uint_32 tag;
|
||||
int unknown; /* Chunk not known to libpng */
|
||||
int all; /* Chunk set by the '-1' option */
|
||||
int position; /* position in pngtest.png */
|
||||
int keep; /* unknown handling setting */
|
||||
} chunk_info[] = {
|
||||
/* Critical chunks */
|
||||
{ "IDAT", PNG_INFO_IDAT, png_IDAT, 0, 0, START, 0 }, /* must be [0] */
|
||||
{ "PLTE", PNG_INFO_PLTE, png_PLTE, 0, 0, ABSENT, 0 },
|
||||
|
||||
/* Non-critical chunks that libpng handles */
|
||||
{ "bKGD", PNG_INFO_bKGD, png_bKGD, 0, 1, START, 0 },
|
||||
{ "cHRM", PNG_INFO_cHRM, png_cHRM, 0, 1, START, 0 },
|
||||
{ "gAMA", PNG_INFO_gAMA, png_gAMA, 0, 1, START, 0 },
|
||||
{ "hIST", PNG_INFO_hIST, png_hIST, 0, 1, ABSENT, 0 },
|
||||
{ "iCCP", PNG_INFO_iCCP, png_iCCP, 0, 1, ABSENT, 0 },
|
||||
{ "iTXt", PNG_INFO_iTXt, png_iTXt, 0, 1, ABSENT, 0 },
|
||||
{ "oFFs", PNG_INFO_oFFs, png_oFFs, 0, 1, START, 0 },
|
||||
{ "pCAL", PNG_INFO_pCAL, png_pCAL, 0, 1, START, 0 },
|
||||
{ "pHYs", PNG_INFO_pHYs, png_pHYs, 0, 1, START, 0 },
|
||||
{ "sBIT", PNG_INFO_sBIT, png_sBIT, 0, 1, START, 0 },
|
||||
{ "sCAL", PNG_INFO_sCAL, png_sCAL, 0, 1, START, 0 },
|
||||
{ "sPLT", PNG_INFO_sPLT, png_sPLT, 0, 1, ABSENT, 0 },
|
||||
{ "sRGB", PNG_INFO_sRGB, png_sRGB, 0, 1, START, 0 },
|
||||
{ "tEXt", PNG_INFO_tEXt, png_tEXt, 0, 1, START, 0 },
|
||||
{ "tIME", PNG_INFO_tIME, png_tIME, 0, 1, START, 0 },
|
||||
{ "tRNS", PNG_INFO_tRNS, png_tRNS, 0, 0, ABSENT, 0 },
|
||||
{ "zTXt", PNG_INFO_zTXt, png_zTXt, 0, 1, END, 0 },
|
||||
|
||||
/* No libpng handling */
|
||||
{ "sTER", PNG_INFO_sTER, png_sTER, 1, 1, START, 0 },
|
||||
{ "vpAg", PNG_INFO_vpAg, png_vpAg, 1, 0, START, 0 },
|
||||
};
|
||||
|
||||
#define NINFO ((int)((sizeof chunk_info)/(sizeof chunk_info[0])))
|
||||
|
||||
static int
|
||||
find(const char *name)
|
||||
{
|
||||
int i = NINFO;
|
||||
while (--i >= 0)
|
||||
{
|
||||
if (memcmp(chunk_info[i].name, name, 4) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
static int
|
||||
findb(const png_byte *name)
|
||||
{
|
||||
int i = NINFO;
|
||||
while (--i >= 0)
|
||||
{
|
||||
if (memcmp(chunk_info[i].name, name, 4) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
static int
|
||||
find_by_flag(png_uint_32 flag)
|
||||
{
|
||||
int i = NINFO;
|
||||
|
||||
while (--i >= 0) if (chunk_info[i].flag == flag) return i;
|
||||
|
||||
fprintf(stderr, "pngunknown: internal error\n");
|
||||
exit(4);
|
||||
}
|
||||
|
||||
static int
|
||||
ancillary(const char *name)
|
||||
{
|
||||
return PNG_CHUNK_ANCILLARY(PNG_CHUNK(name[0], name[1], name[2], name[3]));
|
||||
}
|
||||
|
||||
static int
|
||||
ancillaryb(const png_byte *name)
|
||||
{
|
||||
return PNG_CHUNK_ANCILLARY(PNG_CHUNK(name[0], name[1], name[2], name[3]));
|
||||
}
|
||||
|
||||
static int error_count = 0;
|
||||
static int warning_count = 0;
|
||||
|
||||
static void
|
||||
error(png_structp png_ptr, const char *message)
|
||||
{
|
||||
fprintf(stderr, "libpng error: %s\n", message);
|
||||
exit(1);
|
||||
(void)png_ptr;
|
||||
}
|
||||
|
||||
static void
|
||||
warning(png_structp png_ptr, const char *message)
|
||||
{
|
||||
++warning_count;
|
||||
fprintf(stderr, "libpng warning: %s\n", message);
|
||||
(void)png_ptr;
|
||||
}
|
||||
|
||||
static png_uint_32
|
||||
get_valid(const char *file, png_const_structp png_ptr, png_const_infop info_ptr)
|
||||
{
|
||||
png_uint_32 flags = png_get_valid(png_ptr, info_ptr, (png_uint_32)~0);
|
||||
|
||||
/* Map the text chunks back into the flags */
|
||||
{
|
||||
png_textp text;
|
||||
png_uint_32 ntext = png_get_text(png_ptr, info_ptr, &text, NULL);
|
||||
|
||||
while (ntext-- > 0) switch (text[ntext].compression)
|
||||
{
|
||||
case -1:
|
||||
flags |= PNG_INFO_tEXt;
|
||||
break;
|
||||
case 0:
|
||||
flags |= PNG_INFO_zTXt;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
flags |= PNG_INFO_iTXt;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "%s: unknown text compression %d\n", file,
|
||||
text[ntext].compression);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
static png_uint_32
|
||||
get_unknown(const char *file, int def, png_const_structp png_ptr,
|
||||
png_const_infop info_ptr)
|
||||
{
|
||||
/* Create corresponding 'unknown' flags */
|
||||
png_uint_32 flags = 0;
|
||||
{
|
||||
png_unknown_chunkp unknown;
|
||||
int num_unknown = png_get_unknown_chunks(png_ptr, info_ptr, &unknown);
|
||||
|
||||
while (--num_unknown >= 0)
|
||||
{
|
||||
int chunk = findb(unknown[num_unknown].name);
|
||||
|
||||
/* Chunks not known to pngunknown must be validated here; since they
|
||||
* must also be unknown to libpng the 'def' behavior should have been
|
||||
* used.
|
||||
*/
|
||||
if (chunk < 0) switch (def)
|
||||
{
|
||||
default: /* impossible */
|
||||
case PNG_HANDLE_CHUNK_AS_DEFAULT:
|
||||
case PNG_HANDLE_CHUNK_NEVER:
|
||||
fprintf(stderr, "%s: %s: %s: unknown chunk saved\n",
|
||||
file, def ? "discard" : "default", unknown[num_unknown].name);
|
||||
++error_count;
|
||||
break;
|
||||
|
||||
case PNG_HANDLE_CHUNK_IF_SAFE:
|
||||
if (!ancillaryb(unknown[num_unknown].name))
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: if-safe: %s: unknown critical chunk saved\n",
|
||||
file, unknown[num_unknown].name);
|
||||
++error_count;
|
||||
break;
|
||||
}
|
||||
/* FALL THROUGH (safe) */
|
||||
case PNG_HANDLE_CHUNK_ALWAYS:
|
||||
break;
|
||||
}
|
||||
|
||||
else
|
||||
flags |= chunk_info[chunk].flag;
|
||||
}
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
static int
|
||||
check(FILE *fp, int argc, const char **argv, png_uint_32p flags/*out*/)
|
||||
{
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr, end_ptr;
|
||||
int i, def = PNG_HANDLE_CHUNK_AS_DEFAULT, npasses, ipass;
|
||||
png_uint_32 height;
|
||||
|
||||
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, error, warning);
|
||||
if (png_ptr == NULL)
|
||||
{
|
||||
fprintf(stderr, "%s: could not allocate png struct\n", argv[argc]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
info_ptr = png_create_info_struct(png_ptr);
|
||||
end_ptr = png_create_info_struct(png_ptr);
|
||||
if (info_ptr == NULL || end_ptr == NULL)
|
||||
{
|
||||
fprintf(stderr, "%s: could not allocate png info\n", argv[argc]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
png_init_io(png_ptr, fp);
|
||||
|
||||
/* Handle each argument in turn; multiple settings are possible for the same
|
||||
* chunk and multiple calls will occur (the last one should override all
|
||||
* preceding ones).
|
||||
*/
|
||||
for (i=1; i<argc; ++i)
|
||||
{
|
||||
const char *equals = strchr(argv[i], '=');
|
||||
|
||||
if (equals != NULL)
|
||||
{
|
||||
int chunk, option;
|
||||
|
||||
if (strcmp(equals+1, "default") == 0)
|
||||
option = PNG_HANDLE_CHUNK_AS_DEFAULT;
|
||||
else if (strcmp(equals+1, "discard") == 0)
|
||||
option = PNG_HANDLE_CHUNK_NEVER;
|
||||
else if (strcmp(equals+1, "if-safe") == 0)
|
||||
option = PNG_HANDLE_CHUNK_IF_SAFE;
|
||||
else if (strcmp(equals+1, "save") == 0)
|
||||
option = PNG_HANDLE_CHUNK_ALWAYS;
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s: unrecognized chunk option\n", argv[i]);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
switch (equals - argv[i])
|
||||
{
|
||||
case 4: /* chunk name */
|
||||
chunk = find(argv[i]);
|
||||
|
||||
if (chunk >= 0)
|
||||
{
|
||||
/* These #if tests have the effect of skipping the arguments
|
||||
* if SAVE support is unavailable - we can't do a useful test
|
||||
* in this case, so we just check the arguments! This could
|
||||
* be improved in the future by using the read callback.
|
||||
*/
|
||||
# ifdef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
png_byte name[5];
|
||||
|
||||
memcpy(name, chunk_info[chunk].name, 5);
|
||||
png_set_keep_unknown_chunks(png_ptr, option, name, 1);
|
||||
chunk_info[chunk].keep = option;
|
||||
# else
|
||||
(void)option;
|
||||
# endif
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 7: /* default */
|
||||
if (memcmp(argv[i], "default", 7) == 0)
|
||||
{
|
||||
# ifdef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
png_set_keep_unknown_chunks(png_ptr, option, NULL, 0);
|
||||
def = option;
|
||||
# endif
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3: /* all */
|
||||
if (memcmp(argv[i], "all", 3) == 0)
|
||||
{
|
||||
# ifdef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
png_set_keep_unknown_chunks(png_ptr, option, NULL, -1);
|
||||
def = option;
|
||||
|
||||
for (chunk = 0; chunk < NINFO; ++chunk)
|
||||
if (chunk_info[chunk].all)
|
||||
chunk_info[chunk].keep = option;
|
||||
# endif
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default: /* some misplaced = */
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "%s: unrecognized chunk argument\n", argv[i]);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
switch (png_get_interlace_type(png_ptr, info_ptr))
|
||||
{
|
||||
case PNG_INTERLACE_NONE:
|
||||
npasses = 1;
|
||||
break;
|
||||
|
||||
case PNG_INTERLACE_ADAM7:
|
||||
npasses = PNG_INTERLACE_ADAM7_PASSES;
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s: invalid interlace type\n", argv[argc]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Skip the image data, if IDAT is not being handled then don't do this
|
||||
* because it will cause a CRC error.
|
||||
*/
|
||||
if (chunk_info[0/*IDAT*/].keep == PNG_HANDLE_CHUNK_AS_DEFAULT)
|
||||
{
|
||||
png_start_read_image(png_ptr);
|
||||
height = png_get_image_height(png_ptr, info_ptr);
|
||||
|
||||
if (npasses > 1)
|
||||
{
|
||||
png_uint_32 width = png_get_image_width(png_ptr, info_ptr);
|
||||
|
||||
for (ipass=0; ipass<npasses; ++ipass)
|
||||
{
|
||||
png_uint_32 wPass = PNG_PASS_COLS(width, ipass);
|
||||
|
||||
if (wPass > 0)
|
||||
{
|
||||
png_uint_32 y;
|
||||
|
||||
for (y=0; y<height; ++y) if (PNG_ROW_IN_INTERLACE_PASS(y, ipass))
|
||||
png_read_row(png_ptr, NULL, NULL);
|
||||
}
|
||||
}
|
||||
} /* interlaced */
|
||||
|
||||
else /* not interlaced */
|
||||
{
|
||||
png_uint_32 y;
|
||||
|
||||
for (y=0; y<height; ++y)
|
||||
png_read_row(png_ptr, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
png_read_end(png_ptr, end_ptr);
|
||||
|
||||
flags[0] = get_valid(argv[argc], png_ptr, info_ptr);
|
||||
flags[1] = get_unknown(argv[argc], def, png_ptr, info_ptr);
|
||||
|
||||
/* Only png_read_png sets PNG_INFO_IDAT! */
|
||||
flags[chunk_info[0/*IDAT*/].keep != PNG_HANDLE_CHUNK_AS_DEFAULT] |=
|
||||
PNG_INFO_IDAT;
|
||||
|
||||
flags[2] = get_valid(argv[argc], png_ptr, end_ptr);
|
||||
flags[3] = get_unknown(argv[argc], def, png_ptr, end_ptr);
|
||||
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, &end_ptr);
|
||||
|
||||
return def;
|
||||
}
|
||||
|
||||
static void
|
||||
check_error(const char *file, png_uint_32 flags, const char *message)
|
||||
{
|
||||
while (flags)
|
||||
{
|
||||
png_uint_32 flag = flags & -flags;
|
||||
int i = find_by_flag(flag);
|
||||
|
||||
fprintf(stderr, "%s: chunk %s: %s\n", file, chunk_info[i].name, message);
|
||||
++error_count;
|
||||
|
||||
flags &= ~flag;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
check_handling(const char *file, int def, png_uint_32 chunks, png_uint_32 known,
|
||||
png_uint_32 unknown, const char *position)
|
||||
{
|
||||
while (chunks)
|
||||
{
|
||||
png_uint_32 flag = chunks & -chunks;
|
||||
int i = find_by_flag(flag);
|
||||
int keep = chunk_info[i].keep;
|
||||
const char *type;
|
||||
const char *errorx = NULL;
|
||||
|
||||
if (chunk_info[i].unknown)
|
||||
{
|
||||
if (keep == PNG_HANDLE_CHUNK_AS_DEFAULT)
|
||||
{
|
||||
type = "UNKNOWN (default)";
|
||||
keep = def;
|
||||
}
|
||||
|
||||
else
|
||||
type = "UNKNOWN (specified)";
|
||||
|
||||
if (flag & known)
|
||||
errorx = "chunk processed";
|
||||
|
||||
else switch (keep)
|
||||
{
|
||||
case PNG_HANDLE_CHUNK_AS_DEFAULT:
|
||||
if (flag & unknown)
|
||||
errorx = "DEFAULT: unknown chunk saved";
|
||||
break;
|
||||
|
||||
case PNG_HANDLE_CHUNK_NEVER:
|
||||
if (flag & unknown)
|
||||
errorx = "DISCARD: unknown chunk saved";
|
||||
break;
|
||||
|
||||
case PNG_HANDLE_CHUNK_IF_SAFE:
|
||||
if (ancillary(chunk_info[i].name))
|
||||
{
|
||||
if (!(flag & unknown))
|
||||
errorx = "IF-SAFE: unknown ancillary chunk lost";
|
||||
}
|
||||
|
||||
else if (flag & unknown)
|
||||
errorx = "IF-SAFE: unknown critical chunk saved";
|
||||
break;
|
||||
|
||||
case PNG_HANDLE_CHUNK_ALWAYS:
|
||||
if (!(flag & unknown))
|
||||
errorx = "SAVE: unknown chunk lost";
|
||||
break;
|
||||
|
||||
default:
|
||||
errorx = "internal error: bad keep";
|
||||
break;
|
||||
}
|
||||
} /* unknown chunk */
|
||||
|
||||
else /* known chunk */
|
||||
{
|
||||
type = "KNOWN";
|
||||
|
||||
if (flag & known)
|
||||
{
|
||||
/* chunk was processed, it won't have been saved because that is
|
||||
* caught below when checking for inconsistent processing.
|
||||
*/
|
||||
if (keep != PNG_HANDLE_CHUNK_AS_DEFAULT)
|
||||
errorx = "!DEFAULT: known chunk processed";
|
||||
}
|
||||
|
||||
else /* not processed */ switch (keep)
|
||||
{
|
||||
case PNG_HANDLE_CHUNK_AS_DEFAULT:
|
||||
errorx = "DEFAULT: known chunk not processed";
|
||||
break;
|
||||
|
||||
case PNG_HANDLE_CHUNK_NEVER:
|
||||
if (flag & unknown)
|
||||
errorx = "DISCARD: known chunk saved";
|
||||
break;
|
||||
|
||||
case PNG_HANDLE_CHUNK_IF_SAFE:
|
||||
if (ancillary(chunk_info[i].name))
|
||||
{
|
||||
if (!(flag & unknown))
|
||||
errorx = "IF-SAFE: known ancillary chunk lost";
|
||||
}
|
||||
|
||||
else if (flag & unknown)
|
||||
errorx = "IF-SAFE: known critical chunk saved";
|
||||
break;
|
||||
|
||||
case PNG_HANDLE_CHUNK_ALWAYS:
|
||||
if (!(flag & unknown))
|
||||
errorx = "SAVE: known chunk lost";
|
||||
break;
|
||||
|
||||
default:
|
||||
errorx = "internal error: bad keep (2)";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (errorx != NULL)
|
||||
{
|
||||
++error_count;
|
||||
fprintf(stderr, "%s: %s %s %s: %s\n",
|
||||
file, type, chunk_info[i].name, position, errorx);
|
||||
}
|
||||
|
||||
chunks &= ~flag;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, const char **argv)
|
||||
{
|
||||
FILE *fp;
|
||||
png_uint_32 flags[2/*default/+options*/][4/*valid,unknown{before,after}*/];
|
||||
int def, strict = 0;
|
||||
const char *program = argv[0];
|
||||
const char *count_argv[3];
|
||||
|
||||
if (argc > 1 && strcmp(argv[1], "--strict") == 0)
|
||||
{
|
||||
strict = 1;
|
||||
--argc;
|
||||
++argv;
|
||||
}
|
||||
|
||||
if (--argc < 1)
|
||||
{
|
||||
fprintf(stderr, "pngunknown: usage:\n"
|
||||
" %s {(CHNK|default|all)=(default|discard|if-safe|save)} testfile.png\n",
|
||||
program);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
# ifndef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
fprintf(stderr,
|
||||
"pngunknown: warning: no 'save' support so arguments ignored\n");
|
||||
# endif
|
||||
fp = fopen(argv[argc], "rb");
|
||||
if (fp == NULL)
|
||||
{
|
||||
perror(argv[argc]);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
/* First find all the chunks, known and unknown, in the test file: */
|
||||
count_argv[0] = program;
|
||||
count_argv[1] = "default=save";
|
||||
count_argv[2] = argv[argc];
|
||||
(void)check(fp, 2, count_argv, flags[0]);
|
||||
|
||||
/* Now find what the various supplied options cause to change: */
|
||||
rewind(fp);
|
||||
def = check(fp, argc, argv, flags[1]);
|
||||
fclose(fp);
|
||||
|
||||
/* Chunks should either be known or unknown, never both and this should apply
|
||||
* whether the chunk is before or after the IDAT (actually, the app can
|
||||
* probably change this by swapping the handling after the image, but this
|
||||
* test does not do that.)
|
||||
*/
|
||||
check_error(argc[argv],
|
||||
(flags[0][0]|flags[0][2]) & (flags[0][1]|flags[0][3]),
|
||||
"chunk handled inconsistently in count tests");
|
||||
check_error(argc[argv],
|
||||
(flags[1][0]|flags[1][2]) & (flags[1][1]|flags[1][3]),
|
||||
"chunk handled inconsistently in option tests");
|
||||
|
||||
/* Now find out what happened to each chunk before and after the IDAT and
|
||||
* determine if the behavior was correct. First some basic sanity checks,
|
||||
* any known chunk should be known in the original count, any unknown chunk
|
||||
* should be either known or unknown in the original.
|
||||
*/
|
||||
{
|
||||
png_uint_32 test;
|
||||
|
||||
test = flags[1][0] & ~flags[0][0];
|
||||
check_error(argv[argc], test, "new known chunk before IDAT");
|
||||
test = flags[1][1] & ~(flags[0][0] | flags[0][1]);
|
||||
check_error(argv[argc], test, "new unknown chunk before IDAT");
|
||||
test = flags[1][2] & ~flags[0][2];
|
||||
check_error(argv[argc], test, "new known chunk after IDAT");
|
||||
test = flags[1][3] & ~(flags[0][2] | flags[0][3]);
|
||||
check_error(argv[argc], test, "new unknown chunk after IDAT");
|
||||
}
|
||||
|
||||
/* Now each chunk in the original list should have been handled according to
|
||||
* the options set for that chunk, regardless of whether libpng knows about
|
||||
* it or not.
|
||||
*/
|
||||
check_handling(argv[argc], def, flags[0][0] | flags[0][1], flags[1][0],
|
||||
flags[1][1], "before IDAT");
|
||||
check_handling(argv[argc], def, flags[0][2] | flags[0][3], flags[1][2],
|
||||
flags[1][3], "after IDAT");
|
||||
|
||||
return error_count + (strict ? warning_count : 0);
|
||||
}
|
||||
|
||||
#else
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
" test ignored because libpng was not built with unknown chunk support\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
10103
contrib/libtests/pngvalid.c
Normal file
999
contrib/libtests/tarith.c
Normal file
@@ -0,0 +1,999 @@
|
||||
|
||||
/* tarith.c
|
||||
*
|
||||
* Copyright (c) 2011,2012 John Cunningham Bowler
|
||||
*
|
||||
* Last changed in libpng 1.6.0 [(PENDING RELEASE)]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*
|
||||
* Test internal arithmetic functions of libpng.
|
||||
*
|
||||
* This code must be linked against a math library (-lm), but does not require
|
||||
* libpng or zlib to work. Because it includes the complete source of 'png.c'
|
||||
* it tests the code with whatever compiler options are used to build it.
|
||||
* Changing these options can substantially change the errors in the
|
||||
* calculations that the compiler chooses!
|
||||
*/
|
||||
#define _POSIX_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
|
||||
/* Obtain a copy of the code to be tested (plus other things), disabling
|
||||
* stuff that is not required.
|
||||
*/
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "../../pngpriv.h"
|
||||
|
||||
#define png_error png_warning
|
||||
|
||||
void png_warning(png_const_structrp png_ptr, png_const_charp msg)
|
||||
{
|
||||
fprintf(stderr, "validation: %s\n", msg);
|
||||
}
|
||||
|
||||
#define png_fixed_error png_fixed_warning
|
||||
|
||||
void png_fixed_warning(png_const_structrp png_ptr, png_const_charp msg)
|
||||
{
|
||||
fprintf(stderr, "overflow in: %s\n", msg);
|
||||
}
|
||||
|
||||
#define png_set_error_fn(pp, ep, efp, wfp) ((void)0)
|
||||
#define png_malloc(pp, s) malloc(s)
|
||||
#define png_malloc_warn(pp, s) malloc(s)
|
||||
#define png_malloc_base(pp, s) malloc(s)
|
||||
#define png_calloc(pp, s) calloc(1, (s))
|
||||
#define png_free(pp, s) free(s)
|
||||
|
||||
#define png_safecat(b, sb, pos, str) (pos)
|
||||
#define png_format_number(start, end, format, number) (start)
|
||||
|
||||
#define crc32(crc, pp, s) (crc)
|
||||
#define inflateReset(zs) Z_OK
|
||||
|
||||
#define png_create_struct(type) (0)
|
||||
#define png_destroy_struct(pp) ((void)0)
|
||||
#define png_create_struct_2(type, m, mm) (0)
|
||||
#define png_destroy_struct_2(pp, f, mm) ((void)0)
|
||||
|
||||
#undef PNG_SIMPLIFIED_READ_SUPPORTED
|
||||
#undef PNG_SIMPLIFIED_WRITE_SUPPORTED
|
||||
#undef PNG_USER_MEM_SUPPORTED
|
||||
|
||||
#include "../../png.c"
|
||||
|
||||
/* Validate ASCII to fp routines. */
|
||||
static int verbose = 0;
|
||||
|
||||
int validation_ascii_to_fp(int count, int argc, char **argv)
|
||||
{
|
||||
int showall = 0;
|
||||
double max_error=2; /* As a percentage error-in-last-digit/.5 */
|
||||
double max_error_abs=17; /* Used when precision is DBL_DIG */
|
||||
double max = 0;
|
||||
double max_abs = 0;
|
||||
double test = 0; /* Important to test this. */
|
||||
int precision = 5;
|
||||
int nonfinite = 0;
|
||||
int finite = 0;
|
||||
int ok = 0;
|
||||
int failcount = 0;
|
||||
int minorarith = 0;
|
||||
|
||||
while (--argc > 0)
|
||||
if (strcmp(*++argv, "-a") == 0)
|
||||
showall = 1;
|
||||
else if (strcmp(*argv, "-e") == 0 && argc > 0)
|
||||
{
|
||||
--argc;
|
||||
max_error = atof(*++argv);
|
||||
}
|
||||
else if (strcmp(*argv, "-E") == 0 && argc > 0)
|
||||
{
|
||||
--argc;
|
||||
max_error_abs = atof(*++argv);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "unknown argument %s\n", *argv);
|
||||
return 1;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
png_size_t index;
|
||||
int state, failed = 0;
|
||||
char buffer[64];
|
||||
|
||||
if (isfinite(test))
|
||||
++finite;
|
||||
else
|
||||
++nonfinite;
|
||||
|
||||
if (verbose)
|
||||
fprintf(stderr, "%.*g %d\n", DBL_DIG, test, precision);
|
||||
|
||||
/* Check for overflow in the buffer by setting a marker. */
|
||||
memset(buffer, 71, sizeof buffer);
|
||||
|
||||
png_ascii_from_fp(0, buffer, precision+10, test, precision);
|
||||
|
||||
/* Allow for a three digit exponent, this stuff will fail if
|
||||
* the exponent is bigger than this!
|
||||
*/
|
||||
if (buffer[precision+7] != 71)
|
||||
{
|
||||
fprintf(stderr, "%g[%d] -> '%s'[%lu] buffer overflow\n", test,
|
||||
precision, buffer, (unsigned long)strlen(buffer));
|
||||
failed = 1;
|
||||
}
|
||||
|
||||
/* Following are used for the number parser below and must be
|
||||
* initialized to zero.
|
||||
*/
|
||||
state = 0;
|
||||
index = 0;
|
||||
if (!isfinite(test))
|
||||
{
|
||||
/* Expect 'inf' */
|
||||
if (test >= 0 && strcmp(buffer, "inf") ||
|
||||
test < 0 && strcmp(buffer, "-inf"))
|
||||
{
|
||||
fprintf(stderr, "%g[%d] -> '%s' but expected 'inf'\n", test,
|
||||
precision, buffer);
|
||||
failed = 1;
|
||||
}
|
||||
}
|
||||
else if (!png_check_fp_number(buffer, precision+10, &state, &index) ||
|
||||
buffer[index] != 0)
|
||||
{
|
||||
fprintf(stderr, "%g[%d] -> '%s' but has bad format ('%c')\n", test,
|
||||
precision, buffer, buffer[index]);
|
||||
failed = 1;
|
||||
}
|
||||
else if (PNG_FP_IS_NEGATIVE(state) && !(test < 0))
|
||||
{
|
||||
fprintf(stderr, "%g[%d] -> '%s' but negative value not so reported\n",
|
||||
test, precision, buffer);
|
||||
failed = 1;
|
||||
assert(!PNG_FP_IS_ZERO(state));
|
||||
assert(!PNG_FP_IS_POSITIVE(state));
|
||||
}
|
||||
else if (PNG_FP_IS_ZERO(state) && !(test == 0))
|
||||
{
|
||||
fprintf(stderr, "%g[%d] -> '%s' but zero value not so reported\n",
|
||||
test, precision, buffer);
|
||||
failed = 1;
|
||||
assert(!PNG_FP_IS_NEGATIVE(state));
|
||||
assert(!PNG_FP_IS_POSITIVE(state));
|
||||
}
|
||||
else if (PNG_FP_IS_POSITIVE(state) && !(test > 0))
|
||||
{
|
||||
fprintf(stderr, "%g[%d] -> '%s' but postive value not so reported\n",
|
||||
test, precision, buffer);
|
||||
failed = 1;
|
||||
assert(!PNG_FP_IS_NEGATIVE(state));
|
||||
assert(!PNG_FP_IS_ZERO(state));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Check the result against the original. */
|
||||
double out = atof(buffer);
|
||||
double change = fabs((out - test)/test);
|
||||
double allow = .5/pow(10,
|
||||
(precision >= DBL_DIG) ? DBL_DIG-1 : precision-1);
|
||||
|
||||
/* NOTE: if you hit this error case are you compiling with gcc
|
||||
* and -O0? Try -O2 - the errors can accumulate if the FP
|
||||
* code above is not optimized and may drift outside the .5 in
|
||||
* DBL_DIG allowed. In any case a small number of errors may
|
||||
* occur (very small ones - 1 or 2%) because of rounding in the
|
||||
* calculations, either in the conversion API or in atof.
|
||||
*/
|
||||
if (change >= allow && (isfinite(out) ||
|
||||
fabs(test/DBL_MAX) <= 1-allow))
|
||||
{
|
||||
double percent = (precision >= DBL_DIG) ? max_error_abs : max_error;
|
||||
double allowp = (change-allow)*100/allow;
|
||||
|
||||
if (precision >= DBL_DIG)
|
||||
{
|
||||
if (max_abs < allowp) max_abs = allowp;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (max < allowp) max = allowp;
|
||||
}
|
||||
|
||||
if (showall || allowp >= percent)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%.*g[%d] -> '%s' -> %.*g number changed (%g > %g (%d%%))\n",
|
||||
DBL_DIG, test, precision, buffer, DBL_DIG, out, change, allow,
|
||||
(int)round(allowp));
|
||||
failed = 1;
|
||||
}
|
||||
else
|
||||
++minorarith;
|
||||
}
|
||||
}
|
||||
|
||||
if (failed)
|
||||
++failcount;
|
||||
else
|
||||
++ok;
|
||||
|
||||
skip:
|
||||
/* Generate a new number and precision. */
|
||||
precision = rand();
|
||||
if (precision & 1) test = -test;
|
||||
precision >>= 1;
|
||||
|
||||
/* Generate random numbers. */
|
||||
if (test == 0 || !isfinite(test))
|
||||
test = precision+1;
|
||||
else
|
||||
{
|
||||
/* Derive the exponent from the previous rand() value. */
|
||||
int exponent = precision % (DBL_MAX_EXP - DBL_MIN_EXP) + DBL_MIN_EXP;
|
||||
int tmp;
|
||||
test = frexp(test * rand(), &tmp);
|
||||
test = ldexp(test, exponent);
|
||||
precision >>= 8; /* arbitrary */
|
||||
}
|
||||
|
||||
/* This limits the precision to 32 digits, enough for standard
|
||||
* IEEE implementations which have at most 15 digits.
|
||||
*/
|
||||
precision = (precision & 0x1f) + 1;
|
||||
}
|
||||
while (--count);
|
||||
|
||||
printf("Tested %d finite values, %d non-finite, %d OK (%d failed) %d minor "
|
||||
"arithmetic errors\n", finite, nonfinite, ok, failcount, minorarith);
|
||||
printf(" Error with >=%d digit precision %.2f%%\n", DBL_DIG, max_abs);
|
||||
printf(" Error with < %d digit precision %.2f%%\n", DBL_DIG, max);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Observe that valid FP numbers have the forms listed in the PNG extensions
|
||||
* specification:
|
||||
*
|
||||
* [+,-]{integer,integer.fraction,.fraction}[{e,E}[+,-]integer]
|
||||
*
|
||||
* Test each of these in turn, including invalid cases.
|
||||
*/
|
||||
typedef enum checkfp_state
|
||||
{
|
||||
start, fraction, exponent, states
|
||||
} checkfp_state;
|
||||
|
||||
/* The characters (other than digits) that characterize the states: */
|
||||
static const char none[] = "";
|
||||
static const char hexdigits[16] = "0123456789ABCDEF";
|
||||
|
||||
static const struct
|
||||
{
|
||||
const char *start; /* Characters valid at the start */
|
||||
const char *end; /* Valid characters that end the state */
|
||||
const char *tests; /* Characters to test after 2 digits seen */
|
||||
}
|
||||
state_characters[states] =
|
||||
{
|
||||
/* start: */ { "+-.", ".eE", "+-.e*0369" },
|
||||
/* fraction: */ { none, "eE", "+-.E#0147" },
|
||||
/* exponent: */ { "+-", none, "+-.eE^0258" }
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char number[1024]; /* Buffer for number being tested */
|
||||
int limit; /* Command line limit */
|
||||
int verbose; /* Shadows global variable */
|
||||
int ctimes; /* Number of numbers tested */
|
||||
int cmillions; /* Count of millions of numbers */
|
||||
int cinvalid; /* Invalid strings checked */
|
||||
int cnoaccept; /* Characters not accepted */
|
||||
}
|
||||
checkfp_command;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int cnumber; /* Index into number string */
|
||||
checkfp_state check_state; /* Current number state */
|
||||
int at_start; /* At start (first character) of state */
|
||||
int cdigits_in_state; /* Digits seen in that state */
|
||||
int limit; /* Limit on same for checking all chars */
|
||||
int state; /* Current parser state */
|
||||
int is_negative; /* Number is negative */
|
||||
int is_zero; /* Number is (still) zero */
|
||||
int number_was_valid; /* Previous character validity */
|
||||
}
|
||||
checkfp_control;
|
||||
|
||||
static int check_all_characters(checkfp_command *co, checkfp_control c);
|
||||
|
||||
static int check_some_characters(checkfp_command *co, checkfp_control c,
|
||||
const char *tests);
|
||||
|
||||
static int check_one_character(checkfp_command *co, checkfp_control c, int ch)
|
||||
{
|
||||
/* Test this character (ch) to ensure the parser does the correct thing.
|
||||
*/
|
||||
png_size_t index = 0;
|
||||
const char test = (char)ch;
|
||||
const int number_is_valid = png_check_fp_number(&test, 1, &c.state, &index);
|
||||
const int character_accepted = (index == 1);
|
||||
|
||||
if (c.check_state != exponent && isdigit(ch) && ch != '0')
|
||||
c.is_zero = 0;
|
||||
|
||||
if (c.check_state == start && c.at_start && ch == '-')
|
||||
c.is_negative = 1;
|
||||
|
||||
if (isprint(ch))
|
||||
co->number[c.cnumber++] = (char)ch;
|
||||
else
|
||||
{
|
||||
co->number[c.cnumber++] = '<';
|
||||
co->number[c.cnumber++] = hexdigits[(ch >> 4) & 0xf];
|
||||
co->number[c.cnumber++] = hexdigits[ch & 0xf];
|
||||
co->number[c.cnumber++] = '>';
|
||||
}
|
||||
co->number[c.cnumber] = 0;
|
||||
|
||||
if (co->verbose > 1)
|
||||
fprintf(stderr, "%s\n", co->number);
|
||||
|
||||
if (++(co->ctimes) == 1000000)
|
||||
{
|
||||
if (co->verbose == 1)
|
||||
fputc('.', stderr);
|
||||
co->ctimes = 0;
|
||||
++(co->cmillions);
|
||||
}
|
||||
|
||||
if (!number_is_valid)
|
||||
++(co->cinvalid);
|
||||
|
||||
if (!character_accepted)
|
||||
++(co->cnoaccept);
|
||||
|
||||
/* This should never fail (it's a serious bug if it does): */
|
||||
if (index != 0 && index != 1)
|
||||
{
|
||||
fprintf(stderr, "%s: read beyond end of string (%lu)\n", co->number,
|
||||
(unsigned long)index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Validate the new state, note that the PNG_FP_IS_ macros all return
|
||||
* false unless the number is valid.
|
||||
*/
|
||||
if (PNG_FP_IS_NEGATIVE(c.state) !=
|
||||
(number_is_valid && !c.is_zero && c.is_negative))
|
||||
{
|
||||
fprintf(stderr, "%s: negative when it is not\n", co->number);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (PNG_FP_IS_ZERO(c.state) != (number_is_valid && c.is_zero))
|
||||
{
|
||||
fprintf(stderr, "%s: zero when it is not\n", co->number);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (PNG_FP_IS_POSITIVE(c.state) !=
|
||||
(number_is_valid && !c.is_zero && !c.is_negative))
|
||||
{
|
||||
fprintf(stderr, "%s: positive when it is not\n", co->number);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Testing a digit */
|
||||
if (isdigit(ch))
|
||||
{
|
||||
if (!character_accepted)
|
||||
{
|
||||
fprintf(stderr, "%s: digit '%c' not accepted\n", co->number, ch);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!number_is_valid)
|
||||
{
|
||||
fprintf(stderr, "%s: saw a digit (%c) but number not valid\n",
|
||||
co->number, ch);
|
||||
return 0;
|
||||
}
|
||||
|
||||
++c.cdigits_in_state;
|
||||
c.at_start = 0;
|
||||
c.number_was_valid = 1;
|
||||
|
||||
/* Continue testing characters in this state. Either test all of
|
||||
* them or, if we have already seen one digit in this state, just test a
|
||||
* limited set.
|
||||
*/
|
||||
if (c.cdigits_in_state < 1)
|
||||
return check_all_characters(co, c);
|
||||
|
||||
else
|
||||
return check_some_characters(co, c,
|
||||
state_characters[c.check_state].tests);
|
||||
}
|
||||
|
||||
/* A non-digit; is it allowed here? */
|
||||
else if (((ch == '+' || ch == '-') && c.check_state != fraction &&
|
||||
c.at_start) ||
|
||||
(ch == '.' && c.check_state == start) ||
|
||||
((ch == 'e' || ch == 'E') && c.number_was_valid &&
|
||||
c.check_state != exponent))
|
||||
{
|
||||
if (!character_accepted)
|
||||
{
|
||||
fprintf(stderr, "%s: character '%c' not accepted\n", co->number, ch);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The number remains valid after start of fraction but nowhere else. */
|
||||
if (number_is_valid && (c.check_state != start || ch != '.'))
|
||||
{
|
||||
fprintf(stderr, "%s: saw a non-digit (%c) but number valid\n",
|
||||
co->number, ch);
|
||||
return 0;
|
||||
}
|
||||
|
||||
c.number_was_valid = number_is_valid;
|
||||
|
||||
/* Check for a state change. When changing to 'fraction' if the number
|
||||
* is valid at this point set the at_start to false to allow an exponent
|
||||
* 'e' to come next.
|
||||
*/
|
||||
if (c.check_state == start && ch == '.')
|
||||
{
|
||||
c.check_state = fraction;
|
||||
c.at_start = !number_is_valid;
|
||||
c.cdigits_in_state = 0;
|
||||
c.limit = co->limit;
|
||||
return check_all_characters(co, c);
|
||||
}
|
||||
|
||||
else if (c.check_state < exponent && (ch == 'e' || ch == 'E'))
|
||||
{
|
||||
c.check_state = exponent;
|
||||
c.at_start = 1;
|
||||
c.cdigits_in_state = 0;
|
||||
c.limit = co->limit;
|
||||
return check_all_characters(co, c);
|
||||
}
|
||||
|
||||
/* Else it was a sign, and the state doesn't change. */
|
||||
else
|
||||
{
|
||||
if (ch != '-' && ch != '+')
|
||||
{
|
||||
fprintf(stderr, "checkfp: internal error (1)\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
c.at_start = 0;
|
||||
return check_all_characters(co, c);
|
||||
}
|
||||
}
|
||||
|
||||
/* Testing an invalid character */
|
||||
else
|
||||
{
|
||||
if (character_accepted)
|
||||
{
|
||||
fprintf(stderr, "%s: character '%c' [0x%.2x] accepted\n", co->number,
|
||||
ch, ch);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (number_is_valid != c.number_was_valid)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: character '%c' [0x%.2x] changed number validity\n", co->number,
|
||||
ch, ch);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Do nothing - the parser has stuck; return success and keep going with
|
||||
* the next character.
|
||||
*/
|
||||
}
|
||||
|
||||
/* Successful return (the caller will try the next character.) */
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int check_all_characters(checkfp_command *co, checkfp_control c)
|
||||
{
|
||||
int ch;
|
||||
|
||||
if (c.cnumber+4 < sizeof co->number) for (ch=0; ch<256; ++ch)
|
||||
{
|
||||
if (!check_one_character(co, c, ch))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int check_some_characters(checkfp_command *co, checkfp_control c,
|
||||
const char *tests)
|
||||
{
|
||||
int i;
|
||||
|
||||
--(c.limit);
|
||||
|
||||
if (c.cnumber+4 < sizeof co->number && c.limit >= 0)
|
||||
{
|
||||
if (c.limit > 0) for (i=0; tests[i]; ++i)
|
||||
{
|
||||
if (!check_one_character(co, c, tests[i]))
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* At the end check all the characters. */
|
||||
else
|
||||
return check_all_characters(co, c);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int validation_checkfp(int count, int argc, char **argv)
|
||||
{
|
||||
int result;
|
||||
checkfp_command command;
|
||||
checkfp_control control;
|
||||
|
||||
command.number[0] = 0;
|
||||
command.limit = 3;
|
||||
command.verbose = verbose;
|
||||
command.ctimes = 0;
|
||||
command.cmillions = 0;
|
||||
command.cinvalid = 0;
|
||||
command.cnoaccept = 0;
|
||||
|
||||
while (--argc > 0)
|
||||
{
|
||||
++argv;
|
||||
if (argc > 1 && strcmp(*argv, "-l") == 0)
|
||||
{
|
||||
--argc;
|
||||
command.limit = atoi(*++argv);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "unknown argument %s\n", *argv);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
control.cnumber = 0;
|
||||
control.check_state = start;
|
||||
control.at_start = 1;
|
||||
control.cdigits_in_state = 0;
|
||||
control.limit = command.limit;
|
||||
control.state = 0;
|
||||
control.is_negative = 0;
|
||||
control.is_zero = 1;
|
||||
control.number_was_valid = 0;
|
||||
|
||||
result = check_all_characters(&command, control);
|
||||
|
||||
printf("checkfp: %s: checked %d,%.3d,%.3d,%.3d strings (%d invalid)\n",
|
||||
result ? "pass" : "FAIL", command.cmillions / 1000,
|
||||
command.cmillions % 1000, command.ctimes / 1000, command.ctimes % 1000,
|
||||
command.cinvalid);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int validation_muldiv(int count, int argc, char **argv)
|
||||
{
|
||||
int tested = 0;
|
||||
int overflow = 0;
|
||||
int error = 0;
|
||||
int error64 = 0;
|
||||
int passed = 0;
|
||||
int randbits = 0;
|
||||
png_uint_32 randbuffer;
|
||||
png_fixed_point a;
|
||||
png_int_32 times, div;
|
||||
|
||||
while (--argc > 0)
|
||||
{
|
||||
fprintf(stderr, "unknown argument %s\n", *++argv);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Find out about the random number generator. */
|
||||
randbuffer = RAND_MAX;
|
||||
while (randbuffer != 0) ++randbits, randbuffer >>= 1;
|
||||
printf("Using random number generator that makes %d bits\n", randbits);
|
||||
for (div=0; div<32; div += randbits)
|
||||
randbuffer = (randbuffer << randbits) ^ rand();
|
||||
|
||||
a = 0;
|
||||
times = div = 0;
|
||||
do
|
||||
{
|
||||
png_fixed_point result;
|
||||
/* NOTE: your mileage may vary, a type is required below that can
|
||||
* hold 64 bits or more, if floating point is used a 64 bit or
|
||||
* better mantissa is required.
|
||||
*/
|
||||
long long int fp, fpround;
|
||||
unsigned long hi, lo;
|
||||
int ok;
|
||||
|
||||
/* Check the values, png_64bit_product can only handle positive
|
||||
* numbers, so correct for that here.
|
||||
*/
|
||||
{
|
||||
long u1, u2;
|
||||
int n = 0;
|
||||
if (a < 0) u1 = -a, n = 1; else u1 = a;
|
||||
if (times < 0) u2 = -times, n = !n; else u2 = times;
|
||||
png_64bit_product(u1, u2, &hi, &lo);
|
||||
if (n)
|
||||
{
|
||||
/* -x = ~x+1 */
|
||||
lo = ((~lo) + 1) & 0xffffffff;
|
||||
hi = ~hi;
|
||||
if (lo == 0) ++hi;
|
||||
}
|
||||
}
|
||||
|
||||
fp = a;
|
||||
fp *= times;
|
||||
if ((fp & 0xffffffff) != lo || ((fp >> 32) & 0xffffffff) != hi)
|
||||
{
|
||||
fprintf(stderr, "png_64bit_product %d * %d -> %lx|%.8lx not %llx\n",
|
||||
a, times, hi, lo, fp);
|
||||
++error64;
|
||||
}
|
||||
|
||||
if (div != 0)
|
||||
{
|
||||
/* Round - this is C round to zero. */
|
||||
if ((fp < 0) != (div < 0))
|
||||
fp -= div/2;
|
||||
else
|
||||
fp += div/2;
|
||||
|
||||
fp /= div;
|
||||
fpround = fp;
|
||||
/* Assume 2's complement here: */
|
||||
ok = fpround <= PNG_UINT_31_MAX &&
|
||||
fpround >= -1-(long long int)PNG_UINT_31_MAX;
|
||||
if (!ok) ++overflow;
|
||||
}
|
||||
else
|
||||
ok = 0, ++overflow, fpround = fp/*misleading*/;
|
||||
|
||||
if (verbose)
|
||||
fprintf(stderr, "TEST %d * %d / %d -> %lld (%s)\n", a, times, div,
|
||||
fp, ok ? "ok" : "overflow");
|
||||
|
||||
++tested;
|
||||
if (png_muldiv(&result, a, times, div) != ok)
|
||||
{
|
||||
++error;
|
||||
if (ok)
|
||||
fprintf(stderr, "%d * %d / %d -> overflow (expected %lld)\n", a,
|
||||
times, div, fp);
|
||||
else
|
||||
fprintf(stderr, "%d * %d / %d -> %d (expected overflow %lld)\n", a,
|
||||
times, div, result, fp);
|
||||
}
|
||||
else if (ok && result != fpround)
|
||||
{
|
||||
++error;
|
||||
fprintf(stderr, "%d * %d / %d -> %d not %lld\n", a, times, div, result,
|
||||
fp);
|
||||
}
|
||||
else
|
||||
++passed;
|
||||
|
||||
/* Generate three new values, this uses rand() and rand() only returns
|
||||
* up to RAND_MAX.
|
||||
*/
|
||||
/* CRUDE */
|
||||
a += times;
|
||||
times += div;
|
||||
div = randbuffer;
|
||||
randbuffer = (randbuffer << randbits) ^ rand();
|
||||
}
|
||||
while (--count > 0);
|
||||
|
||||
printf("%d tests including %d overflows, %d passed, %d failed (%d 64 bit "
|
||||
"errors)\n", tested, overflow, passed, error, error64);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* When FP is on this just becomes a speed test - compile without FP to get real
|
||||
* validation.
|
||||
*/
|
||||
#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
|
||||
#define LN2 .000010576586617430806112933839 /* log(2)/65536 */
|
||||
#define L2INV 94548.46219969910586572651 /* 65536/log(2) */
|
||||
|
||||
/* For speed testing, need the internal functions too: */
|
||||
static png_uint_32 png_log8bit(unsigned x)
|
||||
{
|
||||
if (x > 0)
|
||||
return (png_uint_32)floor(.5-log(x/255.)*L2INV);
|
||||
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
||||
static png_uint_32 png_log16bit(png_uint_32 x)
|
||||
{
|
||||
if (x > 0)
|
||||
return (png_uint_32)floor(.5-log(x/65535.)*L2INV);
|
||||
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
||||
static png_uint_32 png_exp(png_uint_32 x)
|
||||
{
|
||||
return (png_uint_32)floor(.5 + exp(x * -LN2) * 0xffffffffU);
|
||||
}
|
||||
|
||||
static png_byte png_exp8bit(png_uint_32 log)
|
||||
{
|
||||
return (png_byte)floor(.5 + exp(log * -LN2) * 255);
|
||||
}
|
||||
|
||||
static png_uint_16 png_exp16bit(png_uint_32 log)
|
||||
{
|
||||
return (png_uint_16)floor(.5 + exp(log * -LN2) * 65535);
|
||||
}
|
||||
#endif /* FLOATING_ARITHMETIC */
|
||||
|
||||
int validation_gamma(int argc, char **argv)
|
||||
{
|
||||
double gamma[9] = { 2.2, 1.8, 1.52, 1.45, 1., 1/1.45, 1/1.52, 1/1.8, 1/2.2 };
|
||||
double maxerr;
|
||||
int i, silent=0, onlygamma=0;
|
||||
|
||||
/* Silence the output with -s, just test the gamma functions with -g: */
|
||||
while (--argc > 0)
|
||||
if (strcmp(*++argv, "-s") == 0)
|
||||
silent = 1;
|
||||
else if (strcmp(*argv, "-g") == 0)
|
||||
onlygamma = 1;
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "unknown argument %s\n", *argv);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!onlygamma)
|
||||
{
|
||||
/* First validate the log functions: */
|
||||
maxerr = 0;
|
||||
for (i=0; i<256; ++i)
|
||||
{
|
||||
double correct = -log(i/255.)/log(2.)*65536;
|
||||
double error = png_log8bit(i) - correct;
|
||||
|
||||
if (i != 0 && fabs(error) > maxerr)
|
||||
maxerr = fabs(error);
|
||||
|
||||
if (i == 0 && png_log8bit(i) != 0xffffffff ||
|
||||
i != 0 && png_log8bit(i) != floor(correct+.5))
|
||||
{
|
||||
fprintf(stderr, "8 bit log error: %d: got %u, expected %f\n",
|
||||
i, png_log8bit(i), correct);
|
||||
}
|
||||
}
|
||||
|
||||
if (!silent)
|
||||
printf("maximum 8 bit log error = %f\n", maxerr);
|
||||
|
||||
maxerr = 0;
|
||||
for (i=0; i<65536; ++i)
|
||||
{
|
||||
double correct = -log(i/65535.)/log(2.)*65536;
|
||||
double error = png_log16bit(i) - correct;
|
||||
|
||||
if (i != 0 && fabs(error) > maxerr)
|
||||
maxerr = fabs(error);
|
||||
|
||||
if (i == 0 && png_log16bit(i) != 0xffffffff ||
|
||||
i != 0 && png_log16bit(i) != floor(correct+.5))
|
||||
{
|
||||
if (error > .68) /* By experiment error is less than .68 */
|
||||
{
|
||||
fprintf(stderr, "16 bit log error: %d: got %u, expected %f"
|
||||
" error: %f\n", i, png_log16bit(i), correct, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!silent)
|
||||
printf("maximum 16 bit log error = %f\n", maxerr);
|
||||
|
||||
/* Now exponentiations. */
|
||||
maxerr = 0;
|
||||
for (i=0; i<=0xfffff; ++i)
|
||||
{
|
||||
double correct = exp(-i/65536. * log(2.)) * (65536. * 65536);
|
||||
double error = png_exp(i) - correct;
|
||||
|
||||
if (fabs(error) > maxerr)
|
||||
maxerr = fabs(error);
|
||||
if (fabs(error) > 1883) /* By experiment. */
|
||||
{
|
||||
fprintf(stderr, "32 bit exp error: %d: got %u, expected %f"
|
||||
" error: %f\n", i, png_exp(i), correct, error);
|
||||
}
|
||||
}
|
||||
|
||||
if (!silent)
|
||||
printf("maximum 32 bit exp error = %f\n", maxerr);
|
||||
|
||||
maxerr = 0;
|
||||
for (i=0; i<=0xfffff; ++i)
|
||||
{
|
||||
double correct = exp(-i/65536. * log(2.)) * 255;
|
||||
double error = png_exp8bit(i) - correct;
|
||||
|
||||
if (fabs(error) > maxerr)
|
||||
maxerr = fabs(error);
|
||||
if (fabs(error) > .50002) /* By experiment */
|
||||
{
|
||||
fprintf(stderr, "8 bit exp error: %d: got %u, expected %f"
|
||||
" error: %f\n", i, png_exp8bit(i), correct, error);
|
||||
}
|
||||
}
|
||||
|
||||
if (!silent)
|
||||
printf("maximum 8 bit exp error = %f\n", maxerr);
|
||||
|
||||
maxerr = 0;
|
||||
for (i=0; i<=0xfffff; ++i)
|
||||
{
|
||||
double correct = exp(-i/65536. * log(2.)) * 65535;
|
||||
double error = png_exp16bit(i) - correct;
|
||||
|
||||
if (fabs(error) > maxerr)
|
||||
maxerr = fabs(error);
|
||||
if (fabs(error) > .524) /* By experiment */
|
||||
{
|
||||
fprintf(stderr, "16 bit exp error: %d: got %u, expected %f"
|
||||
" error: %f\n", i, png_exp16bit(i), correct, error);
|
||||
}
|
||||
}
|
||||
|
||||
if (!silent)
|
||||
printf("maximum 16 bit exp error = %f\n", maxerr);
|
||||
} /* !onlygamma */
|
||||
|
||||
/* Test the overall gamma correction. */
|
||||
for (i=0; i<9; ++i)
|
||||
{
|
||||
unsigned j;
|
||||
double g = gamma[i];
|
||||
png_fixed_point gfp = floor(g * PNG_FP_1 + .5);
|
||||
|
||||
if (!silent)
|
||||
printf("Test gamma %f\n", g);
|
||||
|
||||
maxerr = 0;
|
||||
for (j=0; j<256; ++j)
|
||||
{
|
||||
double correct = pow(j/255., g) * 255;
|
||||
png_byte out = png_gamma_8bit_correct(j, gfp);
|
||||
double error = out - correct;
|
||||
|
||||
if (fabs(error) > maxerr)
|
||||
maxerr = fabs(error);
|
||||
if (out != floor(correct+.5))
|
||||
{
|
||||
fprintf(stderr, "8bit %d ^ %f: got %d expected %f error %f\n",
|
||||
j, g, out, correct, error);
|
||||
}
|
||||
}
|
||||
|
||||
if (!silent)
|
||||
printf("gamma %f: maximum 8 bit error %f\n", g, maxerr);
|
||||
|
||||
maxerr = 0;
|
||||
for (j=0; j<65536; ++j)
|
||||
{
|
||||
double correct = pow(j/65535., g) * 65535;
|
||||
png_uint_16 out = png_gamma_16bit_correct(j, gfp);
|
||||
double error = out - correct;
|
||||
|
||||
if (fabs(error) > maxerr)
|
||||
maxerr = fabs(error);
|
||||
if (fabs(error) > 1.62)
|
||||
{
|
||||
fprintf(stderr, "16bit %d ^ %f: got %d expected %f error %f\n",
|
||||
j, g, out, correct, error);
|
||||
}
|
||||
}
|
||||
|
||||
if (!silent)
|
||||
printf("gamma %f: maximum 16 bit error %f\n", g, maxerr);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**************************** VALIDATION TESTS ********************************/
|
||||
/* Various validation routines are included herein, they require some
|
||||
* definition for png_warning and png_error, seetings of VALIDATION:
|
||||
*
|
||||
* 1: validates the ASCII to floating point conversions
|
||||
* 2: validates png_muldiv
|
||||
* 3: accuracy test of fixed point gamma tables
|
||||
*/
|
||||
|
||||
/* The following COUNT (10^8) takes about 1 hour on a 1GHz Pentium IV
|
||||
* processor.
|
||||
*/
|
||||
#define COUNT 1000000000
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int count = COUNT;
|
||||
|
||||
while (argc > 1)
|
||||
{
|
||||
if (argc > 2 && strcmp(argv[1], "-c") == 0)
|
||||
{
|
||||
count = atoi(argv[2]);
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
}
|
||||
|
||||
else if (strcmp(argv[1], "-v") == 0)
|
||||
{
|
||||
++verbose;
|
||||
--argc;
|
||||
++argv;
|
||||
}
|
||||
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (count > 0 && argc > 1)
|
||||
{
|
||||
if (strcmp(argv[1], "ascii") == 0)
|
||||
return validation_ascii_to_fp(count, argc-1, argv+1);
|
||||
else if (strcmp(argv[1], "checkfp") == 0)
|
||||
return validation_checkfp(count, argc-1, argv+1);
|
||||
else if (strcmp(argv[1], "muldiv") == 0)
|
||||
return validation_muldiv(count, argc-1, argv+1);
|
||||
else if (strcmp(argv[1], "gamma") == 0)
|
||||
return validation_gamma(argc-1, argv+1);
|
||||
}
|
||||
|
||||
/* Bad argument: */
|
||||
fprintf(stderr,
|
||||
"usage: tarith [-v] [-c count] {ascii,muldiv,gamma} [args]\n");
|
||||
fprintf(stderr, " arguments: ascii [-a (all results)] [-e error%%]\n");
|
||||
fprintf(stderr, " checkfp [-l max-number-chars]\n");
|
||||
fprintf(stderr, " muldiv\n");
|
||||
fprintf(stderr, " gamma -s (silent) -g (only gamma; no log)\n");
|
||||
return 1;
|
||||
}
|
||||
24
contrib/libtests/test-pngstest.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Run the simplified API tests
|
||||
err=0
|
||||
|
||||
echo >> pngtest-log.txt
|
||||
echo "============ pngstest.sh ==============" >> pngtest-log.txt
|
||||
|
||||
echo "Running test-pngstest.sh"
|
||||
for image in ${srcdir}/contrib/pngsuite/*.png
|
||||
do
|
||||
for opts in ""
|
||||
do
|
||||
if ./pngstest --strict --log "$@" $opts $image >>pngtest-log.txt 2>&1
|
||||
then
|
||||
echo " PASS: pngstest $opts $image"
|
||||
else
|
||||
echo " FAIL: pngstest $opts $image"
|
||||
err=1
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
exit $err
|
||||
38
contrib/libtests/test-pngunknown.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Run the unknown API tests
|
||||
err=0
|
||||
image="${srcdir}/pngtest.png"
|
||||
#
|
||||
# stream 4 is used for the output of the shell, pngtest-log.txt gets all the
|
||||
# normal program output.
|
||||
exec 4>&1 1>>pngtest-log.txt 2>&1
|
||||
|
||||
echo
|
||||
echo "============ test-pngunknown.sh =============="
|
||||
|
||||
echo "Running test-pngunknown.sh" >&4
|
||||
|
||||
for tests in \
|
||||
"discard default=discard"\
|
||||
"save default=save"\
|
||||
"if-safe default=if-safe"\
|
||||
"vpAg vpAg=if-safe"\
|
||||
"sTER sTER=if-safe"\
|
||||
"IDAT default=discard IDAT=save"\
|
||||
"sAPI bKGD=save cHRM=save gAMA=save all=discard iCCP=save sBIT=save sRGB=save"
|
||||
do
|
||||
set $tests
|
||||
test="$1"
|
||||
shift
|
||||
|
||||
if ./pngunknown "$@" "$image" 4>&-
|
||||
then
|
||||
echo " PASS: test-pngunknown $test" >&4
|
||||
else
|
||||
echo " FAIL: test-pngunknown $test" >&4
|
||||
err=1
|
||||
fi
|
||||
done
|
||||
|
||||
exit $err
|
||||
21
contrib/libtests/test-pngvalid-full.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Run a sequence of gamma tests quietly
|
||||
err=0
|
||||
|
||||
echo >> pngtest-log.txt
|
||||
echo "============ pngvalid-full.sh ==============" >> pngtest-log.txt
|
||||
|
||||
echo "Running test-pngvalid-full.sh"
|
||||
for gamma in threshold transform sbit 16-to-8 background alpha-mode "transform --expand16" "background --expand16" "alpha-mode --expand16"
|
||||
do
|
||||
if ./pngvalid "$@" --gamma-$gamma >> pngtest-log.txt 2>&1
|
||||
then
|
||||
echo " PASS: pngvalid" "$@" "--gamma-$gamma"
|
||||
else
|
||||
echo " FAIL: pngvalid" "$@" "--gamma-$gamma"
|
||||
err=1
|
||||
fi
|
||||
done
|
||||
|
||||
exit $err
|
||||
30
contrib/libtests/test-pngvalid-simple.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Run a sequence of tests quietly, without the slow
|
||||
# gamma tests
|
||||
err=0
|
||||
|
||||
echo >> pngtest-log.txt
|
||||
echo "============ pngvalid-simple.sh ==============" >> pngtest-log.txt
|
||||
echo "Running test-pngvalid-simple.sh"
|
||||
# The options to test are:
|
||||
#
|
||||
# standard tests with and without progressive reading and interlace
|
||||
# size images with and without progressive reading
|
||||
# transform tests (standard, non-interlaced only)
|
||||
#
|
||||
for opts in "--standard" "--standard --progressive-read" \
|
||||
"--standard --interlace" "--standard --progressive-read --interlace" \
|
||||
"--size" "--size --progressive-read" \
|
||||
"--transform"
|
||||
do
|
||||
if ./pngvalid "$@" $opts >> pngtest-log.txt 2>&1
|
||||
then
|
||||
echo " PASS: pngvalid" "$@" $opts
|
||||
else
|
||||
echo " FAIL: pngvalid" "$@" $opts
|
||||
err=1
|
||||
fi
|
||||
done
|
||||
|
||||
exit $err
|
||||
303
contrib/libtests/timepng.c
Normal file
@@ -0,0 +1,303 @@
|
||||
/* timepng.c
|
||||
*
|
||||
* Copyright (c) 2012 John Cunningham Bowler
|
||||
*
|
||||
* Last changed in libpng 1.6.0 [(PENDING RELEASE)]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*
|
||||
* Load an arbitrary number of PNG files (from the command line, or, if there
|
||||
* are no arguments on the command line, from stdin) then run a time test by
|
||||
* reading each file by row. The test does nothing with the read result and
|
||||
* does no transforms. The only output is a time as a floating point number of
|
||||
* seconds with 9 decimal digits.
|
||||
*/
|
||||
#define _POSIX_C_SOURCE 199309L /* for clock_gettime */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#if (defined HAVE_CONFIG_H) && !(defined PNG_NO_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
/* Define the following to use this test against your installed libpng, rather
|
||||
* than the one being built here:
|
||||
*/
|
||||
#ifdef PNG_FREESTANDING_TESTS
|
||||
# include <png.h>
|
||||
#else
|
||||
# include "../../png.h"
|
||||
#endif
|
||||
|
||||
static int read_png(FILE *fp)
|
||||
{
|
||||
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0);
|
||||
png_infop info_ptr = NULL;
|
||||
png_bytep row = NULL, display = NULL;
|
||||
|
||||
if (png_ptr == NULL)
|
||||
return 0;
|
||||
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
if (row != NULL) free(row);
|
||||
if (display != NULL) free(display);
|
||||
return 0;
|
||||
}
|
||||
|
||||
png_init_io(png_ptr, fp);
|
||||
|
||||
info_ptr = png_create_info_struct(png_ptr);
|
||||
if (info_ptr == NULL)
|
||||
png_error(png_ptr, "OOM allocating info structure");
|
||||
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
{
|
||||
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
|
||||
row = malloc(rowbytes);
|
||||
display = malloc(rowbytes);
|
||||
|
||||
if (row == NULL || display == NULL)
|
||||
png_error(png_ptr, "OOM allocating row buffers");
|
||||
|
||||
{
|
||||
png_uint_32 height = png_get_image_height(png_ptr, info_ptr);
|
||||
int passes = png_set_interlace_handling(png_ptr);
|
||||
int pass;
|
||||
|
||||
png_start_read_image(png_ptr);
|
||||
|
||||
for (pass = 0; pass < passes; ++pass)
|
||||
{
|
||||
png_uint_32 y = height;
|
||||
|
||||
/* NOTE: this trashes the row each time; interlace handling won't
|
||||
* work, but this avoids memory thrashing for speed testing.
|
||||
*/
|
||||
while (y-- > 0)
|
||||
png_read_row(png_ptr, row, display);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Make sure to read to the end of the file: */
|
||||
png_read_end(png_ptr, info_ptr);
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
free(row);
|
||||
free(display);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int mytime(struct timespec *t)
|
||||
{
|
||||
/* Do the timing using clock_gettime and the per-process timer. */
|
||||
if (!clock_gettime(CLOCK_PROCESS_CPUTIME_ID, t))
|
||||
return 1;
|
||||
|
||||
perror("CLOCK_PROCESS_CPUTIME_ID");
|
||||
fprintf(stderr, "timepng: could not get the time\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int perform_one_test(FILE *fp, int nfiles)
|
||||
{
|
||||
int i;
|
||||
struct timespec before, after;
|
||||
|
||||
/* Clear out all errors: */
|
||||
rewind(fp);
|
||||
|
||||
if (mytime(&before))
|
||||
{
|
||||
for (i=0; i<nfiles; ++i)
|
||||
{
|
||||
if (read_png(fp))
|
||||
{
|
||||
if (ferror(fp))
|
||||
{
|
||||
perror("temporary file");
|
||||
fprintf(stderr, "file %d: error reading PNG data\n", i);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
perror("temporary file");
|
||||
fprintf(stderr, "file %d: error from libpng\n", i);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
return 0;
|
||||
|
||||
if (mytime(&after))
|
||||
{
|
||||
/* Work out the time difference and print it - this is the only output,
|
||||
* so flush it immediately.
|
||||
*/
|
||||
unsigned long s = after.tv_sec - before.tv_sec;
|
||||
long ns = after.tv_nsec - before.tv_nsec;
|
||||
|
||||
if (ns < 0)
|
||||
{
|
||||
--s;
|
||||
ns += 1000000000;
|
||||
|
||||
if (ns < 0)
|
||||
{
|
||||
fprintf(stderr, "timepng: bad clock from kernel\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
printf("%lu.%.9ld\n", s, ns);
|
||||
fflush(stdout);
|
||||
if (ferror(stdout))
|
||||
{
|
||||
fprintf(stderr, "timepng: error writing output\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Successful return */
|
||||
return 1;
|
||||
}
|
||||
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int add_one_file(FILE *fp, char *name)
|
||||
{
|
||||
FILE *ip = fopen(name, "rb");
|
||||
|
||||
if (ip != NULL)
|
||||
{
|
||||
int ch;
|
||||
for (;;)
|
||||
{
|
||||
ch = getc(ip);
|
||||
if (ch == EOF) break;
|
||||
putc(ch, fp);
|
||||
}
|
||||
|
||||
if (ferror(ip))
|
||||
{
|
||||
perror(name);
|
||||
fprintf(stderr, "%s: read error\n", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
(void)fclose(ip);
|
||||
|
||||
if (ferror(fp))
|
||||
{
|
||||
perror("temporary file");
|
||||
fprintf(stderr, "temporary file write error\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
perror(name);
|
||||
fprintf(stderr, "%s: open failed\n", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int ok = 0;
|
||||
FILE *fp = tmpfile();
|
||||
|
||||
if (fp != NULL)
|
||||
{
|
||||
int err = 0;
|
||||
int nfiles = 0;
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=1; i<argc; ++i)
|
||||
{
|
||||
if (add_one_file(fp, argv[i]))
|
||||
++nfiles;
|
||||
|
||||
else
|
||||
{
|
||||
err = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
char filename[FILENAME_MAX+1];
|
||||
|
||||
while (fgets(filename, FILENAME_MAX+1, stdin))
|
||||
{
|
||||
int len = strlen(filename);
|
||||
|
||||
if (filename[len-1] == '\n')
|
||||
{
|
||||
filename[len-1] = 0;
|
||||
if (add_one_file(fp, filename))
|
||||
++nfiles;
|
||||
|
||||
else
|
||||
{
|
||||
err = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "timepng: truncated file name ...%s\n",
|
||||
filename+len-32);
|
||||
err = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ferror(stdin))
|
||||
{
|
||||
fprintf(stderr, "timepng: stdin: read error\n");
|
||||
err = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err)
|
||||
{
|
||||
if (nfiles > 0)
|
||||
ok = perform_one_test(fp, nfiles);
|
||||
|
||||
else
|
||||
fprintf(stderr, "usage: timepng {files} or ls files | timepng\n");
|
||||
}
|
||||
|
||||
(void)fclose(fp);
|
||||
}
|
||||
|
||||
else
|
||||
fprintf(stderr, "timepng: could not open temporary file\n");
|
||||
|
||||
/* Exit code 0 on success. */
|
||||
return ok == 0;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
Microsoft Developer Studio Build File, Format Version 6.00 for
|
||||
msvctest
|
||||
|
||||
Assumes that libpng DLLs and LIBs are in ..\..\projects\msvc\win32\libpng
|
||||
Assumes that zlib DLLs and LIBs are in ..\..\projects\msvc\win32\zlib
|
||||
|
||||
To build:
|
||||
|
||||
1) On the main menu Select "Build|Set Active configuration".
|
||||
Choose the configuration that corresponds to the library you want to test.
|
||||
This library must have been built using the libpng MS project located in
|
||||
the "mscv" subdirectory.
|
||||
|
||||
2) Select "Build|Clean"
|
||||
|
||||
3) Select "Build|Rebuild All"
|
||||
|
||||
4) The test results should appear in the "Build" pane of the Output Window.
|
||||
|
||||
|
||||
Simon-Pierre Cadieux
|
||||
Methodex Computer Systems Inc.
|
||||
@@ -1,247 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="msvctest" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=msvctest - Win32 Debug DLL
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "msvctest.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "msvctest.mak" CFG="msvctest - Win32 Debug DLL"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "msvctest - Win32 DLL" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "msvctest - Win32 Debug DLL" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "msvctest - Win32 ASM DLL" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "msvctest - Win32 Debug ASM DLL" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "msvctest - Win32 LIB" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "msvctest - Win32 Debug LIB" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "msvctest - Win32 DLL"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "dll"
|
||||
# PROP BASE Intermediate_Dir "dll"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "dll"
|
||||
# PROP Intermediate_Dir "dll"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /O1 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /O1 /I "..\..\..\zlib" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "PNG_DLL" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll\libpng2.lib /nologo /subsystem:console /machine:I386
|
||||
# Begin Special Build Tool
|
||||
OutDir=.\dll
|
||||
SOURCE="$(InputPath)"
|
||||
PostBuild_Desc=[Run Test]
|
||||
PostBuild_Cmds=set path=..\..\projects\msvc\win32\libpng\dll;..\..\projects\msvc\win32\zlib\dll; $(outdir)\msvctest.exe ..\..\pngtest.png
|
||||
# End Special Build Tool
|
||||
|
||||
!ELSEIF "$(CFG)" == "msvctest - Win32 Debug DLL"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "dll_dbg"
|
||||
# PROP BASE Intermediate_Dir "dll_dbg"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "dll_dbg"
|
||||
# PROP Intermediate_Dir "dll_dbg"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Zi /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Zi /Od /I "..\..\..\zlib" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "PNG_DLL" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_dbg\libpng2d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# Begin Special Build Tool
|
||||
OutDir=.\dll_dbg
|
||||
SOURCE="$(InputPath)"
|
||||
PostBuild_Desc=[Run Test]
|
||||
PostBuild_Cmds=set path=..\..\projects\msvc\win32\libpng\dll_dbg;..\..\projects\msvc\win32\zlib\dll_dbg; $(outdir)\msvctest.exe ..\..\pngtest.png
|
||||
# End Special Build Tool
|
||||
|
||||
!ELSEIF "$(CFG)" == "msvctest - Win32 ASM DLL"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "dll_asm"
|
||||
# PROP BASE Intermediate_Dir "dll_asm"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "dll_asm"
|
||||
# PROP Intermediate_Dir "dll_asm"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /O1 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /O1 /I "..\..\..\zlib" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "PNG_DLL" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_asm\libpng2a.lib /nologo /subsystem:console /machine:I386
|
||||
# Begin Special Build Tool
|
||||
OutDir=.\dll_asm
|
||||
SOURCE="$(InputPath)"
|
||||
PostBuild_Desc=[Run Test]
|
||||
PostBuild_Cmds=set path=..\..\projects\msvc\win32\libpng\dll_asm;..\..\projects\msvc\win32\zlib\dll_asm; $(outdir)\msvctest.exe ..\..\pngtest.png
|
||||
# End Special Build Tool
|
||||
|
||||
!ELSEIF "$(CFG)" == "msvctest - Win32 Debug ASM DLL"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "dll_dbga"
|
||||
# PROP BASE Intermediate_Dir "dll_dbga"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "dll_dbga"
|
||||
# PROP Intermediate_Dir "dll_dbga"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Zi /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Zi /Od /I "..\..\..\zlib" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "PNG_DLL" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_dbga\libpng2b.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# Begin Special Build Tool
|
||||
OutDir=.\dll_dbga
|
||||
SOURCE="$(InputPath)"
|
||||
PostBuild_Desc=[Run Test]
|
||||
PostBuild_Cmds=set path=..\..\projects\msvc\win32\libpng\dll_dbga;..\..\projects\msvc\win32\zlib\dll_dbga; $(outdir)\msvctest.exe ..\..\pngtest.png
|
||||
# End Special Build Tool
|
||||
|
||||
!ELSEIF "$(CFG)" == "msvctest - Win32 LIB"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "lib"
|
||||
# PROP BASE Intermediate_Dir "lib"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "lib"
|
||||
# PROP Intermediate_Dir "lib"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /O1 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /FD /c
|
||||
# ADD CPP /nologo /W3 /O1 /I "..\..\..\zlib" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 ..\..\projects\msvc\win32\libpng\lib\libpng.lib /nologo /subsystem:console /machine:I386
|
||||
# Begin Special Build Tool
|
||||
OutDir=.\lib
|
||||
SOURCE="$(InputPath)"
|
||||
PostBuild_Desc=[Run Test]
|
||||
PostBuild_Cmds=$(outdir)\msvctest.exe ..\..\pngtest.png
|
||||
# End Special Build Tool
|
||||
|
||||
!ELSEIF "$(CFG)" == "msvctest - Win32 Debug LIB"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "lib_dbg"
|
||||
# PROP BASE Intermediate_Dir "lib_dbg"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "lib_dbg"
|
||||
# PROP Intermediate_Dir "lib_dbg"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Zi /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Zi /Od /I "..\..\..\zlib" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 ..\..\projects\msvc\win32\libpng\lib_dbg\libpng.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# Begin Special Build Tool
|
||||
OutDir=.\lib_dbg
|
||||
SOURCE="$(InputPath)"
|
||||
PostBuild_Desc=[Run Test]
|
||||
PostBuild_Cmds=$(outdir)\msvctest.exe ..\..\pngtest.png
|
||||
# End Special Build Tool
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "msvctest - Win32 DLL"
|
||||
# Name "msvctest - Win32 Debug DLL"
|
||||
# Name "msvctest - Win32 ASM DLL"
|
||||
# Name "msvctest - Win32 Debug ASM DLL"
|
||||
# Name "msvctest - Win32 LIB"
|
||||
# Name "msvctest - Win32 Debug LIB"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\pngtest.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\README.txt
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -1,29 +0,0 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "msvctest"=.\msvctest.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
5
contrib/pngminim/README
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
This demonstrates the use of PNG_USER_CONFIG, pngusr.h and pngusr.dfa
|
||||
to build minimal decoder, encoder, and progressive reader applications.
|
||||
|
||||
See the individual README and pngusr.dfa files for more explanation.
|
||||
10
contrib/pngminim/decoder/README
Normal file
@@ -0,0 +1,10 @@
|
||||
This demonstrates the use of PNG_USER_CONFIG, pngusr.h and pngusr.dfa
|
||||
|
||||
The makefile builds a minimal read-only decoder with embedded libpng
|
||||
and zlib.
|
||||
|
||||
Specify the location of the zlib source (1.2.1 or later) as ZLIBSRC
|
||||
on the make command line.
|
||||
|
||||
If you prefer to use the shared libraries, go to contrib/pngminus
|
||||
and build the png2pnm application there.
|
||||
150
contrib/pngminim/decoder/makefile
Normal file
@@ -0,0 +1,150 @@
|
||||
# Makefile for PngMinus (pngm2pnm)
|
||||
# Linux / Unix
|
||||
|
||||
#CC=cc
|
||||
CC=gcc
|
||||
LD=$(CC)
|
||||
|
||||
# If awk fails try
|
||||
# make AWK=nawk
|
||||
|
||||
# If cpp fails try
|
||||
# make CPP=/lib/cpp
|
||||
|
||||
RM=rm -f
|
||||
COPY=cp
|
||||
|
||||
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP -I. -O1
|
||||
|
||||
C=.c
|
||||
O=.o
|
||||
L=.a
|
||||
E=
|
||||
|
||||
# Where to find the source code:
|
||||
PNGSRC =../../..
|
||||
ZLIBSRC=$(PNGSRC)/../zlib
|
||||
PROGSRC=$(PNGSRC)/contrib/pngminus
|
||||
|
||||
# Zlib (minimal inflate requirements - crc32 is used by libpng)
|
||||
# zutil can be eliminated if you provide your own zcalloc and zcfree
|
||||
ZSRCS = adler32$(C) crc32$(C) \
|
||||
inffast$(C) inflate$(C) inftrees$(C) \
|
||||
zutil$(C)
|
||||
|
||||
# Standard headers
|
||||
ZH = zlib.h crc32.h inffast.h inffixed.h \
|
||||
inflate.h inftrees.h zutil.h
|
||||
|
||||
# Machine generated headers
|
||||
ZCONF = zconf.h
|
||||
|
||||
# Headers callers use
|
||||
ZINC = zlib.h $(ZCONF)
|
||||
|
||||
# Headers the Zlib source uses
|
||||
ZHDRS = $(ZH) $(ZCONF)
|
||||
|
||||
ZOBJS = adler32$(O) crc32$(O) \
|
||||
inffast$(O) inflate$(O) inftrees$(O) \
|
||||
zutil$(O)
|
||||
|
||||
# libpng
|
||||
PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
|
||||
pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \
|
||||
pngset$(C) pngtrans$(C)
|
||||
|
||||
# Standard headers
|
||||
PNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
|
||||
|
||||
# Machine generated headers
|
||||
PNGCONF=pnglibconf.h
|
||||
|
||||
# Headers callers use
|
||||
PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
|
||||
|
||||
# Headers the PNG library uses
|
||||
PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
|
||||
|
||||
PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
|
||||
pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
|
||||
pngset$(O) pngtrans$(O)
|
||||
|
||||
PROGSRCS= pngm2pnm$(C)
|
||||
PROGHDRS=
|
||||
PROGDOCS=
|
||||
PROGOBJS= pngm2pnm$(O)
|
||||
|
||||
OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
|
||||
|
||||
# implicit make rules -------------------------------------------------------
|
||||
|
||||
# note: dependencies do not work on implicit rule lines
|
||||
.c$(O):
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
|
||||
# dependencies
|
||||
|
||||
all: pngm2pnm$(E)
|
||||
|
||||
pngm2pnm$(E): $(OBJS)
|
||||
$(LD) -o pngm2pnm$(E) $(OBJS)
|
||||
|
||||
# The DFA_XTRA setting turns all libpng options off then
|
||||
# turns on those required for this minimal build.
|
||||
# The CPP_FLAGS setting causes pngusr.h to be included in
|
||||
# both the build of pnglibconf.h and, subsequently, when
|
||||
# building libpng itself.
|
||||
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak\
|
||||
$(PNGSRC)/scripts/pnglibconf.dfa \
|
||||
$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
|
||||
$(RM) pnglibconf.h pnglibconf.dfn
|
||||
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
||||
srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG"\
|
||||
DFA_XTRA="pngusr.dfa" $@
|
||||
|
||||
clean:
|
||||
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
||||
srcdir=$(PNGSRC) clean
|
||||
$(RM) pngm2pnm$(O)
|
||||
$(RM) pngm2pnm$(E)
|
||||
$(RM) $(OBJS)
|
||||
|
||||
# distclean also removes the copied source and headers
|
||||
distclean: clean
|
||||
$(RM) -r scripts # historical reasons
|
||||
$(RM) $(PNGSRCS) $(PNGH)
|
||||
$(RM) $(ZSRCS) $(ZH) $(ZCONF)
|
||||
$(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
|
||||
|
||||
# Header file dependencies:
|
||||
$(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
|
||||
$(PNGOBJS): $(PNGHDRS) $(ZINC)
|
||||
$(ZOBJS): $(ZHDRS)
|
||||
|
||||
# Gather the source code from the respective directories
|
||||
$(PNGSRCS) $(PNGH): $(PNGSRC)/$@
|
||||
$(RM) $@
|
||||
$(COPY) $(PNGSRC)/$@ $@
|
||||
|
||||
# No dependency on the ZLIBSRC target so that it only needs
|
||||
# to be specified once.
|
||||
$(ZSRCS) $(ZH):
|
||||
$(RM) $@
|
||||
$(COPY) $(ZLIBSRC)/$@ $@
|
||||
|
||||
# The unconfigured zconf.h varies in name according to the
|
||||
# zlib release
|
||||
$(ZCONF):
|
||||
$(RM) $@
|
||||
@for f in zconf.h.in zconf.in.h zconf.h; do\
|
||||
test -r $(ZLIBSRC)/$$f &&\
|
||||
echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
|
||||
$(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
|
||||
done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
|
||||
|
||||
pngm2pnm.c: $(PROGSRC)/png2pnm.c
|
||||
$(RM) $@
|
||||
$(COPY) $(PROGSRC)/png2pnm.c $@
|
||||
|
||||
# End of makefile for pngm2pnm
|
||||
40
contrib/pngminim/decoder/pngusr.dfa
Normal file
@@ -0,0 +1,40 @@
|
||||
# pngminim/decoder/pngusr.dfa
|
||||
#
|
||||
# Copyright (c) 2010-2011 Glenn Randers-Pehrson
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
# and license in png.h
|
||||
|
||||
# First all the build options off:
|
||||
|
||||
everything = off
|
||||
|
||||
# All that is required is some read code. This example switches
|
||||
# on the sequential read code (see ../preader for a progressive
|
||||
# read example).
|
||||
|
||||
option SEQUENTIAL_READ on
|
||||
|
||||
# You must choose fixed or floating point arithmetic:
|
||||
# option FLOATING_POINT on
|
||||
|
||||
option FIXED_POINT on
|
||||
|
||||
# You must chose the internal fixed point implementation or to
|
||||
# use the system floating point. The latter is considerably
|
||||
# smaller (by about 1kbyte on an x86 system):
|
||||
# option FLOATING_ARITHMETIC on
|
||||
|
||||
option FLOATING_ARITHMETIC off
|
||||
|
||||
# Your program will probably need other options. The example
|
||||
# program here, pngm2pnm, requires the following. Take a look
|
||||
# at pnglibconf.h to find out the full set of what has to be
|
||||
# enabled to make the following work.
|
||||
|
||||
option SETJMP on
|
||||
option STDIO on
|
||||
option READ_EXPAND on
|
||||
option READ_STRIP_16_TO_8 on
|
||||
option USER_LIMITS on
|
||||
24
contrib/pngminim/decoder/pngusr.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/* minrdpngconf.h: headers to make a minimal png-read-only library
|
||||
*
|
||||
* Copyright (c) 2007, 2010-2011 Glenn Randers-Pehrson
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*
|
||||
* Derived from pngcrush.h, Copyright 1998-2007, Glenn Randers-Pehrson
|
||||
*/
|
||||
|
||||
#ifndef MINRDPNGCONF_H
|
||||
#define MINRDPNGCONF_H
|
||||
|
||||
/* To include pngusr.h set -DPNG_USER_CONFIG in CPPFLAGS */
|
||||
|
||||
/* List options to turn off features of the build that do not
|
||||
* affect the API (so are not recorded in pnglibconf.h)
|
||||
*/
|
||||
|
||||
#define PNG_NO_WARNINGS
|
||||
#define PNG_ALIGN_TYPE PNG_ALIGN_NONE
|
||||
|
||||
#endif /* MINRDPNGCONF_H */
|
||||
10
contrib/pngminim/encoder/README
Normal file
@@ -0,0 +1,10 @@
|
||||
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
|
||||
|
||||
The makefile builds a minimal write-only decoder with embedded libpng
|
||||
and zlib.
|
||||
|
||||
Specify the location of the zlib source (1.2.1 or later) as ZLIBSRC
|
||||
on the make command line.
|
||||
|
||||
If you prefer to use the shared libraries, go to contrib/pngminus
|
||||
and build the pnm2png application there.
|
||||
149
contrib/pngminim/encoder/makefile
Normal file
@@ -0,0 +1,149 @@
|
||||
# Makefile for PngMinus (pnm2pngm)
|
||||
# Linux / Unix
|
||||
|
||||
#CC=cc
|
||||
CC=gcc
|
||||
LD=$(CC)
|
||||
|
||||
# If awk fails try
|
||||
# make AWK=nawk
|
||||
|
||||
# If cpp fails try
|
||||
# make CPP=/lib/cpp
|
||||
|
||||
RM=rm -f
|
||||
COPY=cp
|
||||
|
||||
CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -I. -O1
|
||||
|
||||
C=.c
|
||||
O=.o
|
||||
L=.a
|
||||
E=
|
||||
|
||||
# Where to find the source code:
|
||||
PNGSRC =../../..
|
||||
ZLIBSRC=$(PNGSRC)/../zlib
|
||||
PROGSRC=$(PNGSRC)/contrib/pngminus
|
||||
|
||||
# Zlib
|
||||
ZSRCS = adler32$(C) compress$(C) crc32$(C) deflate$(C) \
|
||||
trees$(C) zutil$(C)
|
||||
|
||||
# Standard headers
|
||||
#ZH = zlib.h crc32.h deflate.h trees.h zutil.h
|
||||
ZH = zlib.h crc32.h deflate.h trees.h zutil.h
|
||||
|
||||
# Machine generated headers
|
||||
ZCONF = zconf.h
|
||||
|
||||
# Headers callers use
|
||||
ZINC = zlib.h $(ZCONF)
|
||||
|
||||
# Headers the Zlib source uses
|
||||
ZHDRS = $(ZH) $(ZCONF)
|
||||
|
||||
# compress is not required; it is needed to link the zlib
|
||||
# code because deflate defines an unused API function deflateBound
|
||||
# which itself calls compressBound from compress.
|
||||
ZOBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) \
|
||||
trees$(O) zutil$(O)
|
||||
|
||||
# libpng
|
||||
PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
|
||||
pngset$(C) pngtrans$(C) pngwio$(C) pngwrite$(C) \
|
||||
pngwtran$(C) pngwutil$(C)
|
||||
|
||||
# Standard headers
|
||||
PNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
|
||||
|
||||
# Machine generated headers
|
||||
PNGCONF=pnglibconf.h
|
||||
|
||||
# Headers callers use
|
||||
PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
|
||||
|
||||
# Headers the PNG library uses
|
||||
PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
|
||||
|
||||
PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
|
||||
pngset$(O) pngtrans$(O) pngwio$(O) pngwrite$(O) \
|
||||
pngwtran$(O) pngwutil$(O)
|
||||
|
||||
PROGSRCS= pnm2pngm$(C)
|
||||
PROGHDRS=
|
||||
PROGDOCS=
|
||||
PROGOBJS= pnm2pngm$(O)
|
||||
|
||||
OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
|
||||
|
||||
# implicit make rules -------------------------------------------------------
|
||||
|
||||
.c$(O):
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
|
||||
# dependencies
|
||||
|
||||
all: pnm2pngm$(E)
|
||||
|
||||
pnm2pngm$(E): $(OBJS)
|
||||
$(LD) -o pnm2pngm$(E) $(OBJS)
|
||||
|
||||
# The DFA_XTRA setting turns all libpng options off then
|
||||
# turns on those required for this minimal build.
|
||||
# The CPP_FLAGS setting causes pngusr.h to be included in
|
||||
# both the build of pnglibconf.h and, subsequently, when
|
||||
# building libpng itself.
|
||||
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak\
|
||||
$(PNGSRC)/scripts/pnglibconf.dfa \
|
||||
$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
|
||||
$(RM) pnglibconf.h pnglibconf.dfn
|
||||
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
||||
srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG"\
|
||||
DFA_XTRA="pngusr.dfa" $@
|
||||
|
||||
clean:
|
||||
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
||||
srcdir=$(PNGSRC) clean
|
||||
$(RM) pnm2pngm$(O)
|
||||
$(RM) pnm2pngm$(E)
|
||||
$(RM) $(OBJS)
|
||||
|
||||
# distclean also removes the copied source and headers
|
||||
distclean: clean
|
||||
$(RM) -r scripts # historical reasons
|
||||
$(RM) $(PNGSRCS) $(PNGH)
|
||||
$(RM) $(ZSRCS) $(ZH) $(ZCONF)
|
||||
$(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
|
||||
|
||||
# Header file dependencies:
|
||||
$(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
|
||||
$(PNGOBJS): $(PNGHDRS) $(ZINC)
|
||||
$(ZOBJS): $(ZHDRS)
|
||||
|
||||
# Gather the source code from the respective directories
|
||||
$(PNGSRCS) $(PNGH): $(PNGSRC)/$@
|
||||
$(RM) $@
|
||||
$(COPY) $(PNGSRC)/$@ $@
|
||||
|
||||
# No dependency on the ZLIBSRC target so that it only needs
|
||||
# to be specified once.
|
||||
$(ZSRCS) $(ZH):
|
||||
$(RM) $@
|
||||
$(COPY) $(ZLIBSRC)/$@ $@
|
||||
|
||||
# The unconfigured zconf.h varies in name according to the
|
||||
# zlib release
|
||||
$(ZCONF):
|
||||
$(RM) $@
|
||||
@for f in zconf.h.in zconf.in.h zconf.h; do\
|
||||
test -r $(ZLIBSRC)/$$f &&\
|
||||
echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
|
||||
$(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
|
||||
done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
|
||||
|
||||
pnm2pngm.c: $(PROGSRC)/pnm2png.c
|
||||
$(RM) $@
|
||||
$(COPY) $(PROGSRC)/pnm2png.c $@
|
||||
|
||||
# End of makefile for pnm2pngm
|
||||
35
contrib/pngminim/encoder/pngusr.dfa
Normal file
@@ -0,0 +1,35 @@
|
||||
# pngminim/encoder/pngusr.dfa
|
||||
#
|
||||
# Copyright (c) 2010-2011 Glenn Randers-Pehrson
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
# and license in png.h
|
||||
|
||||
# First all the build options off:
|
||||
|
||||
everything = off
|
||||
|
||||
# Switch on the write code - this makes a minimalist encoder
|
||||
|
||||
option WRITE on
|
||||
|
||||
# You must choose fixed or floating point arithmetic:
|
||||
# option FLOATING_POINT on
|
||||
|
||||
option FIXED_POINT on
|
||||
|
||||
# You must chose the internal fixed point implementation or to
|
||||
# use the system floating point. The latter is considerably
|
||||
# smaller (by about 1kbyte on an x86 system):
|
||||
# option FLOATING_ARITHMETIC on
|
||||
|
||||
option FLOATING_ARITHMETIC off
|
||||
|
||||
# Your program will probably need other options. The example
|
||||
# program here, pnm2pngm, requires the following. Take a look
|
||||
# at pnglibconf.h to find out the full set of what has to be
|
||||
# enabled to make the following work.
|
||||
|
||||
option SETJMP on
|
||||
option STDIO on
|
||||
24
contrib/pngminim/encoder/pngusr.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/* minwrpngconf.h: headers to make a minimal png-write-only library
|
||||
*
|
||||
* Copyright (c) 2007, 2010-2011 Glenn Randers-Pehrson
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*
|
||||
* Derived from pngcrush.h, Copyright 1998-2007, Glenn Randers-Pehrson
|
||||
*/
|
||||
|
||||
#ifndef MINWRPNGCONF_H
|
||||
#define MINWRPNGCONF_H
|
||||
|
||||
/* To include pngusr.h set -DPNG_USER_CONFIG in CPPFLAGS */
|
||||
|
||||
/* List options to turn off features of the build that do not
|
||||
* affect the API (so are not recorded in pnglibconf.h)
|
||||
*/
|
||||
|
||||
#define PNG_NO_WARNINGS
|
||||
#define PNG_ALIGN_TYPE PNG_ALIGN_NONE
|
||||
|
||||
#endif /* MINWRPNGCONF_H */
|
||||
15
contrib/pngminim/preader/README
Normal file
@@ -0,0 +1,15 @@
|
||||
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
|
||||
|
||||
The makefile builds a minimal read-only progressive decoder with
|
||||
embedded libpng, zlib and your system's X library.
|
||||
|
||||
Specify the location of the zlib source (1.2.1 or later) as ZLIBSRC
|
||||
on the make command line.
|
||||
|
||||
Edit makefile if required, to find your X library and include files,
|
||||
then
|
||||
|
||||
make ZLIBSRC=directory
|
||||
|
||||
If you prefer to use the shared libraries, go to contrib/gregbook
|
||||
and build the rpng2-x application there.
|
||||
165
contrib/pngminim/preader/makefile
Normal file
@@ -0,0 +1,165 @@
|
||||
# Makefile for PngMinus (rpng2)
|
||||
# Linux / Unix
|
||||
|
||||
#CC=cc
|
||||
CC=gcc
|
||||
LD=$(CC)
|
||||
|
||||
# If awk fails try
|
||||
# make AWK=nawk
|
||||
|
||||
# If cpp fails try
|
||||
# make CPP=/lib/cpp
|
||||
|
||||
RM=rm -f
|
||||
COPY=cp
|
||||
|
||||
#XINC = -I/usr/include # old-style, stock X distributions
|
||||
#XLIB = -L/usr/lib/X11 -lX11 # (including SGI IRIX)
|
||||
|
||||
#XINC = -I/usr/openwin/include # Sun workstations (OpenWindows)
|
||||
#XLIB = -L/usr/openwin/lib -lX11
|
||||
|
||||
XINC = -I/usr/X11R6/include # new X distributions (X.org, etc.)
|
||||
XLIB = -L/usr/X11R6/lib -lX11
|
||||
#XLIB = -L/usr/X11R6/lib64 -lX11 # e.g., Red Hat on AMD64
|
||||
|
||||
#XINC = -I/usr/local/include # FreeBSD
|
||||
#XLIB = -L/usr/local/lib -lX11
|
||||
|
||||
#LIBS = $(XLIB)
|
||||
LIBS = $(XLIB) -lm #platforms that need libm
|
||||
|
||||
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP -I. $(XINC) -O1
|
||||
|
||||
C=.c
|
||||
O=.o
|
||||
L=.a
|
||||
E=
|
||||
|
||||
# Where to find the source code:
|
||||
PNGSRC =../../..
|
||||
ZLIBSRC=$(PNGSRC)/../zlib
|
||||
PROGSRC=$(PNGSRC)/contrib/gregbook
|
||||
|
||||
# Zlib (minimal inflate requirements - crc32 is used by libpng)
|
||||
# zutil can be eliminated if you provide your own zcalloc and zcfree
|
||||
ZSRCS = adler32$(C) crc32$(C) \
|
||||
inffast$(C) inflate$(C) inftrees$(C) \
|
||||
zutil$(C)
|
||||
|
||||
# Standard headers
|
||||
ZH = zlib.h crc32.h inffast.h inffixed.h \
|
||||
inflate.h inftrees.h zutil.h
|
||||
|
||||
# Machine generated headers
|
||||
ZCONF = zconf.h
|
||||
|
||||
# Headers callers use
|
||||
ZINC = zlib.h $(ZCONF)
|
||||
|
||||
# Headers the Zlib source uses
|
||||
ZHDRS = $(ZH) $(ZCONF)
|
||||
|
||||
ZOBJS = adler32$(O) crc32$(O) \
|
||||
inffast$(O) inflate$(O) inftrees$(O) \
|
||||
zutil$(O)
|
||||
|
||||
# libpng
|
||||
PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
|
||||
pngpread$(C) pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \
|
||||
pngset$(C) pngtrans$(C)
|
||||
|
||||
# Standard headers
|
||||
PNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
|
||||
|
||||
# Machine generated headers
|
||||
PNGCONF=pnglibconf.h
|
||||
|
||||
# Headers callers use
|
||||
PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
|
||||
|
||||
# Headers the PNG library uses
|
||||
PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
|
||||
|
||||
PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
|
||||
pngpread$(O) pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
|
||||
pngset$(O) pngtrans$(O)
|
||||
|
||||
PROGSRCS= rpng2-x$(C) readpng2$(C)
|
||||
PROGHDRS= readpng2.h
|
||||
PROGDOCS= COPYING LICENSE
|
||||
PROGOBJS= rpng2-x$(O) readpng2$(O)
|
||||
|
||||
OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
|
||||
|
||||
# implicit make rules -------------------------------------------------------
|
||||
|
||||
.c$(O):
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
|
||||
# dependencies
|
||||
|
||||
all: $(PROGDOCS) rpng2-x$(E)
|
||||
|
||||
rpng2-x$(E): $(OBJS)
|
||||
$(LD) -o rpng2-x$(E) $(OBJS) $(LIBS)
|
||||
|
||||
# The DFA_XTRA setting turns all libpng options off then
|
||||
# turns on those required for this minimal build.
|
||||
# The CPP_FLAGS setting causes pngusr.h to be included in
|
||||
# both the build of pnglibconf.h and, subsequently, when
|
||||
# building libpng itself.
|
||||
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak\
|
||||
$(PNGSRC)/scripts/pnglibconf.dfa \
|
||||
$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
|
||||
$(RM) pnglibconf.h pnglibconf.dfn
|
||||
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
||||
srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG"\
|
||||
DFA_XTRA="pngusr.dfa" $@
|
||||
|
||||
clean:
|
||||
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
||||
srcdir=$(PNGSRC) clean
|
||||
$(RM) rpng2-x$(O)
|
||||
$(RM) rpng2-x$(E)
|
||||
$(RM) $(OBJS)
|
||||
|
||||
# distclean also removes the copied source and headers
|
||||
distclean: clean
|
||||
$(RM) -r scripts # historical reasons
|
||||
$(RM) $(PNGSRCS) $(PNGH)
|
||||
$(RM) $(ZSRCS) $(ZH) $(ZCONF)
|
||||
$(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
|
||||
|
||||
# Header file dependencies:
|
||||
$(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
|
||||
$(PNGOBJS): $(PNGHDRS) $(ZINC)
|
||||
$(ZOBJS): $(ZHDRS)
|
||||
|
||||
# Gather the source code from the respective directories
|
||||
$(PNGSRCS) $(PNGH): $(PNGSRC)/$@
|
||||
$(RM) $@
|
||||
$(COPY) $(PNGSRC)/$@ $@
|
||||
|
||||
# No dependency on the ZLIBSRC target so that it only needs
|
||||
# to be specified once.
|
||||
$(ZSRCS) $(ZH):
|
||||
$(RM) $@
|
||||
$(COPY) $(ZLIBSRC)/$@ $@
|
||||
|
||||
# The unconfigured zconf.h varies in name according to the
|
||||
# zlib release
|
||||
$(ZCONF):
|
||||
$(RM) $@
|
||||
@for f in zconf.h.in zconf.in.h zconf.h; do\
|
||||
test -r $(ZLIBSRC)/$$f &&\
|
||||
echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
|
||||
$(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
|
||||
done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
|
||||
|
||||
$(PROGSRCS) $(PROGHDRS) $(PROGDOCS): $(PROGSRC)/$@
|
||||
$(RM) $@
|
||||
$(COPY) $(PROGSRC)/$@ $@
|
||||
|
||||
# End of makefile for rpng2-x
|
||||
40
contrib/pngminim/preader/pngusr.dfa
Normal file
@@ -0,0 +1,40 @@
|
||||
# pngminim/preader/pngusr.dfa
|
||||
#
|
||||
# Copyright (c) 2010-2011 Glenn Randers-Pehrson
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
# and license in png.h
|
||||
|
||||
# First all the build options off:
|
||||
|
||||
everything = off
|
||||
|
||||
# Just switch on the progressive read code
|
||||
|
||||
option PROGRESSIVE_READ on
|
||||
|
||||
# You may choose fixed or floating point APIs:
|
||||
# option FLOATING_POINT on
|
||||
|
||||
option FIXED_POINT on
|
||||
|
||||
# You must chose the internal fixed point implementation or to
|
||||
# use the system floating point. The latter is considerably
|
||||
# smaller (by about 1kbyte on an x86 system):
|
||||
|
||||
option FLOATING_ARITHMETIC on
|
||||
# option FLOATING_ARITHMETIC off
|
||||
|
||||
# Your program will probably need other options. The example
|
||||
# program here, rpng2-x, requires the following. Take a look
|
||||
# at pnglibconf.h to find out the full set of what has to be
|
||||
# enabled to make the following work.
|
||||
|
||||
option SETJMP on
|
||||
option STDIO on
|
||||
option READ_bKGD on
|
||||
option READ_GAMMA on
|
||||
option READ_EXPAND on
|
||||
option READ_STRIP_16_TO_8 on
|
||||
option READ_GRAY_TO_RGB on
|
||||
24
contrib/pngminim/preader/pngusr.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/* minrdpngconf.h: headers to make a minimal png-read-only library
|
||||
*
|
||||
* Copyright (c) 2009, 2010-2011 Glenn Randers-Pehrson
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*
|
||||
* Derived from pngcrush.h, Copyright 1998-2007, Glenn Randers-Pehrson
|
||||
*/
|
||||
|
||||
#ifndef MINPRDPNGCONF_H
|
||||
#define MINPRDPNGCONF_H
|
||||
|
||||
/* To include pngusr.h set -DPNG_USER_CONFIG in CPPFLAGS */
|
||||
|
||||
/* List options to turn off features of the build that do not
|
||||
* affect the API (so are not recorded in pnglibconf.h)
|
||||
*/
|
||||
|
||||
#define PNG_NO_WARNINGS
|
||||
#define PNG_ALIGN_TYPE PNG_ALIGN_NONE
|
||||
|
||||
#endif /* MINPRDPNGCONF_H */
|
||||
@@ -20,7 +20,7 @@ Soon after the creation of PNG in 1995, the need was felt for a set of
|
||||
pnmtopng / pngtopnm utilities. Independantly Alexander Lehmann and I
|
||||
(Willem van Schaik) started such a project. Luckily we discovered this
|
||||
and merged the two together into pnmtopng.tar.gz, which is available
|
||||
from a/o ftp://swrinde.nde.swri.edu/pub/png/.
|
||||
from a/o ftp://ftp.simplesystems.org/pub/libpng/png/.
|
||||
|
||||
These two utilities have many, many options and make use of most of the
|
||||
features of PNG, like gamma, alpha, sbit, text-chunks, etc. This makes
|
||||
|
||||
@@ -1,26 +1,31 @@
|
||||
# Makefile for PngMinus (png2pnm and pnm2png)
|
||||
# Linux / Unix
|
||||
|
||||
CC=cc -O
|
||||
LD=cc -O
|
||||
#CC=gcc -O
|
||||
#LD=gcc -O
|
||||
LB=ar
|
||||
RM=rm
|
||||
CP=cp
|
||||
#CC=cc
|
||||
CC=gcc
|
||||
LD=$(CC)
|
||||
|
||||
PNGPATH = /usr/local
|
||||
PNGINC = $(PNGPATH)/include
|
||||
#PNGLIB = $(PNGPATH)/lib -lpng
|
||||
PNGLIB = $(PNGPATH)/lib/libpng.a
|
||||
RM=rm -f
|
||||
|
||||
ZPATH = /usr/local
|
||||
ZINC = $(ZPATH)/include
|
||||
#ZLIB = $(ZPATH)/lib -lz
|
||||
ZLIB = $(ZPATH)/lib/libz.a
|
||||
#PNGPATH = /usr/local
|
||||
#PNGINC = -I$(PNGPATH)/include/libpng16
|
||||
#PNGLIB = -L$(PNGPATH)/lib -lpng16
|
||||
#PNGLIBS = $(PNGPATH)/lib/libpng16.a
|
||||
PNGINC = -I../..
|
||||
PNGLIB = -L../.. -lpng
|
||||
PNGLIBS = ../../libpng.a
|
||||
|
||||
CCFLAGS=-I$(PNGINC) -I$(ZINC)
|
||||
LDFLAGS=-L$(PNGLIB) -L$(ZLIB)
|
||||
#ZPATH = /usr/local
|
||||
#ZINC = -I$(ZPATH)/include
|
||||
#ZLIB = -L$(ZPATH)/lib -lz
|
||||
#ZLIBS = $(ZPATH)/lib/libz.a
|
||||
ZINC = -I../../../zlib
|
||||
ZLIB = -L../../../zlib -lz
|
||||
ZLIBS = ../../../zlib/libz.a
|
||||
|
||||
CFLAGS=$(PNGINC) $(ZINC)
|
||||
LDLIBS=$(PNGLIB) $(ZLIB)
|
||||
LDLIBSS=$(PNGLIBS) $(ZLIBS)
|
||||
C=.c
|
||||
O=.o
|
||||
L=.a
|
||||
@@ -28,25 +33,33 @@ E=
|
||||
|
||||
# dependencies
|
||||
|
||||
all: png2pnm$(E) pnm2png$(E)
|
||||
#all: png2pnm$(E) pnm2png$(E)
|
||||
all: png2pnm$(E) pnm2png$(E) png2pnm-static$(E) pnm2png-static$(E)
|
||||
|
||||
png2pnm$(O): png2pnm$(C)
|
||||
$(CC) -c $(CCFLAGS) png2pnm$(C)
|
||||
$(CC) -c $(CFLAGS) png2pnm$(C)
|
||||
|
||||
png2pnm$(E): png2pnm$(O)
|
||||
$(LD) -o png2pnm$(E) png2pnm$(O) $(LDFLAGS) -lpng -lz -lm
|
||||
$(LD) $(LDFLAGS) -o png2pnm$(E) png2pnm$(O) $(LDLIBS) -lm
|
||||
|
||||
png2pnm-static$(E): png2pnm$(O)
|
||||
$(LD) $(LDFLAGS) -o png2pnm-static$(E) png2pnm$(O) $(LDLIBSS) -lm
|
||||
|
||||
pnm2png$(O): pnm2png$(C)
|
||||
$(CC) -c $(CCFLAGS) pnm2png$(C)
|
||||
$(CC) -c $(CFLAGS) pnm2png$(C)
|
||||
|
||||
pnm2png$(E): pnm2png$(O)
|
||||
$(LD) -o pnm2png$(E) pnm2png$(O) $(LDFLAGS) -lpng -lz -lm
|
||||
$(LD) $(LDFLAGS) -o pnm2png$(E) pnm2png$(O) $(LDLIBS) -lm
|
||||
|
||||
pnm2png-static$(E): pnm2png$(O)
|
||||
$(LD) $(LDFLAGS) -o pnm2png-static$(E) pnm2png$(O) $(LDLIBSS) -lm
|
||||
|
||||
clean:
|
||||
$(RM) png2pnm$(O)
|
||||
$(RM) pnm2png$(O)
|
||||
$(RM) png2pnm$(E)
|
||||
$(RM) pnm2png$(E)
|
||||
$(RM) png2pnm-static$(E)
|
||||
$(RM) pnm2png-static$(E)
|
||||
|
||||
# End of makefile for png2pnm / pnm2png
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <mem.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <zlib.h>
|
||||
|
||||
#ifndef BOOL
|
||||
#define BOOL unsigned char
|
||||
@@ -144,7 +145,7 @@ int main(int argc, char *argv[])
|
||||
if (png2pnm (fp_rd, fp_wr, fp_al, raw, alpha) == FALSE)
|
||||
{
|
||||
fprintf (stderr, "PNG2PNM\n");
|
||||
fprintf (stderr, "Error: unsuccessful convertion of PNG-image\n");
|
||||
fprintf (stderr, "Error: unsuccessful conversion of PNG-image\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -188,7 +189,7 @@ void usage()
|
||||
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL alpha)
|
||||
{
|
||||
png_struct *png_ptr = NULL;
|
||||
png_info *info_ptr = NULL;
|
||||
png_info *info_ptr = NULL;
|
||||
png_byte buf[8];
|
||||
png_byte *png_pixels = NULL;
|
||||
png_byte **row_pointers = NULL;
|
||||
@@ -211,8 +212,8 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
||||
if (ret != 8)
|
||||
return FALSE;
|
||||
|
||||
ret = png_check_sig (buf, 8);
|
||||
if (!ret)
|
||||
ret = png_sig_cmp (buf, 0, 8);
|
||||
if (ret)
|
||||
return FALSE;
|
||||
|
||||
/* create png and info structures */
|
||||
@@ -381,7 +382,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
||||
fputc ((int) *pix_ptr++ , pnm_file);
|
||||
else
|
||||
if (bit_depth == 16){
|
||||
dep_16 = (long) *pix_ptr++;
|
||||
dep_16 = (long) *pix_ptr++;
|
||||
fprintf (pnm_file, "%ld ", (dep_16 << 8) + ((long) *pix_ptr++));
|
||||
}
|
||||
else
|
||||
@@ -401,9 +402,9 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
||||
fputc ((int) *pix_ptr++ , alpha_file);
|
||||
else
|
||||
if (bit_depth == 16){
|
||||
dep_16 = (long) *pix_ptr++;
|
||||
dep_16 = (long) *pix_ptr++;
|
||||
fprintf (alpha_file, "%ld ", (dep_16 << 8) + (long) *pix_ptr++);
|
||||
}
|
||||
}
|
||||
else
|
||||
fprintf (alpha_file, "%ld ", (long) *pix_ptr++);
|
||||
}
|
||||
|
||||
1
contrib/pngminus/png2pnm.sh
Executable file → Normal file
@@ -1,3 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -- grayscale
|
||||
./png2pnm -noraw ../pngsuite/basn0g01.png basn0g01.pgm
|
||||
./png2pnm -noraw ../pngsuite/basn0g02.png basn0g02.pgm
|
||||
|
||||
1
contrib/pngminus/pngminus.sh
Executable file → Normal file
@@ -1,3 +1,4 @@
|
||||
#!/bin/sh
|
||||
make -f makefile.std
|
||||
sh png2pnm.sh
|
||||
sh pnm2png.sh
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <mem.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <zlib.h>
|
||||
|
||||
#ifndef BOOL
|
||||
#define BOOL unsigned char
|
||||
@@ -197,6 +198,9 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
char height_token[16];
|
||||
char maxval_token[16];
|
||||
int color_type;
|
||||
unsigned long ul_width, ul_alpha_width;
|
||||
unsigned long ul_height, ul_alpha_height;
|
||||
unsigned long ul_maxval;
|
||||
png_uint_32 width, alpha_width;
|
||||
png_uint_32 height, alpha_height;
|
||||
png_uint_32 maxval;
|
||||
@@ -227,11 +231,15 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
raw = (type_token[1] == '5');
|
||||
color_type = PNG_COLOR_TYPE_GRAY;
|
||||
get_token(pnm_file, width_token);
|
||||
sscanf (width_token, "%lu", &width);
|
||||
sscanf (width_token, "%lu", &ul_width);
|
||||
width = (png_uint_32) ul_width;
|
||||
get_token(pnm_file, height_token);
|
||||
sscanf (height_token, "%lu", &height);
|
||||
sscanf (height_token, "%lu", &ul_height);
|
||||
height = (png_uint_32) ul_height;
|
||||
get_token(pnm_file, maxval_token);
|
||||
sscanf (maxval_token, "%lu", &maxval);
|
||||
sscanf (maxval_token, "%lu", &ul_maxval);
|
||||
maxval = (png_uint_32) ul_maxval;
|
||||
|
||||
if (maxval <= 1)
|
||||
bit_depth = 1;
|
||||
else if (maxval <= 3)
|
||||
@@ -248,11 +256,14 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
raw = (type_token[1] == '6');
|
||||
color_type = PNG_COLOR_TYPE_RGB;
|
||||
get_token(pnm_file, width_token);
|
||||
sscanf (width_token, "%lu", &width);
|
||||
sscanf (width_token, "%lu", &ul_width);
|
||||
width = (png_uint_32) ul_width;
|
||||
get_token(pnm_file, height_token);
|
||||
sscanf (height_token, "%lu", &height);
|
||||
sscanf (height_token, "%lu", &ul_height);
|
||||
height = (png_uint_32) ul_height;
|
||||
get_token(pnm_file, maxval_token);
|
||||
sscanf (maxval_token, "%lu", &maxval);
|
||||
sscanf (maxval_token, "%lu", &ul_maxval);
|
||||
maxval = (png_uint_32) ul_maxval;
|
||||
if (maxval <= 1)
|
||||
bit_depth = 1;
|
||||
else if (maxval <= 3)
|
||||
@@ -287,15 +298,18 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
{
|
||||
alpha_raw = (type_token[1] == '5');
|
||||
get_token(alpha_file, width_token);
|
||||
sscanf (width_token, "%lu", &alpha_width);
|
||||
sscanf (width_token, "%lu", &ul_alpha_width);
|
||||
alpha_width=(png_uint_32) ul_alpha_width;
|
||||
if (alpha_width != width)
|
||||
return FALSE;
|
||||
get_token(alpha_file, height_token);
|
||||
sscanf (height_token, "%lu", &alpha_height);
|
||||
sscanf (height_token, "%lu", &ul_alpha_height);
|
||||
alpha_height = (png_uint_32) ul_alpha_height;
|
||||
if (alpha_height != height)
|
||||
return FALSE;
|
||||
get_token(alpha_file, maxval_token);
|
||||
sscanf (maxval_token, "%lu", &maxval);
|
||||
sscanf (maxval_token, "%lu", &ul_maxval);
|
||||
maxval = (png_uint_32) ul_maxval;
|
||||
if (maxval <= 1)
|
||||
alpha_depth = 1;
|
||||
else if (maxval <= 3)
|
||||
@@ -510,6 +524,7 @@ png_uint_32 get_value (FILE *pnm_file, int depth)
|
||||
{
|
||||
static png_uint_32 mask = 0;
|
||||
png_byte token[16];
|
||||
unsigned long ul_ret_value;
|
||||
png_uint_32 ret_value;
|
||||
int i = 0;
|
||||
|
||||
@@ -518,7 +533,8 @@ png_uint_32 get_value (FILE *pnm_file, int depth)
|
||||
mask = (mask << 1) | 0x01;
|
||||
|
||||
get_token (pnm_file, (char *) token);
|
||||
sscanf ((const char *) token, "%lu", &ret_value);
|
||||
sscanf ((const char *) token, "%lu", &ul_ret_value);
|
||||
ret_value = (png_uint_32) ul_ret_value;
|
||||
|
||||
ret_value &= mask;
|
||||
|
||||
|
||||
1
contrib/pngminus/pnm2png.sh
Executable file → Normal file
@@ -1,3 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -- grayscale
|
||||
./pnm2png basn0g01.pgm basn0g01.png
|
||||
./pnm2png basn0g02.pgm basn0g02.png
|
||||
|
||||
@@ -1,41 +1,61 @@
|
||||
|
||||
pngsuite
|
||||
--------
|
||||
(c) Willem van Schaik, 1999
|
||||
(c) Willem van Schaik, 1999, 2011, 2012
|
||||
Two images are by Glenn Randers-Pehrson, 2012
|
||||
|
||||
Permission to use, copy, and distribute these images for any purpose and
|
||||
without fee is hereby granted.
|
||||
Permission to use, copy, modify, and distribute these images for any
|
||||
purpose and without fee is hereby granted.
|
||||
|
||||
These 15 images are part of the much larger PngSuite test-set of
|
||||
images, available for developers of PNG supporting software. The
|
||||
complete set, available at http:/www.schaik.com/pngsuite/, contains
|
||||
The 15 "bas*.png" images are part of the much larger PngSuite test-set of
|
||||
images, available for developers of PNG supporting software. The
|
||||
complete set, available at http:/www.schaik.com/pngsuite/, contains
|
||||
a variety of images to test interlacing, gamma settings, ancillary
|
||||
chunks, etc.
|
||||
|
||||
The "ft*.png" images are "free/libre" replacements for the transparent
|
||||
corresponding t*.png images in the PngSuite.
|
||||
|
||||
The images in this directory represent the basic PNG color-types:
|
||||
grayscale (1-16 bit deep), full color (8 or 16 bit), paletted
|
||||
(1-8 bit) and grayscale or color images with alpha channel. You
|
||||
can use them to test the proper functioning of PNG software.
|
||||
|
||||
filename depth type
|
||||
filename depth type
|
||||
------------ ------ --------------
|
||||
basn0g01.png 1-bit grayscale
|
||||
basn0g02.png 2-bit grayscale
|
||||
basn0g04.png 4-bit grayscale
|
||||
basn0g08.png 8-bit grayscale
|
||||
basn0g16.png 16-bit grayscale
|
||||
basn2c08.png 8-bit truecolor
|
||||
basn2c16.png 16-bit truecolor
|
||||
basn3p01.png 1-bit paletted
|
||||
basn3p02.png 2-bit paletted
|
||||
basn3p04.png 4-bit paletted
|
||||
basn3p08.png 8-bit paletted
|
||||
basn4a08.png 8-bit gray with alpha
|
||||
basn4a16.png 16-bit gray with alpha
|
||||
basn6a08.png 8-bit RGBA
|
||||
basn6a16.png 16-bit RGBA
|
||||
basn0g01.png 1-bit grayscale
|
||||
basn0g02.png 2-bit grayscale
|
||||
basn0g04.png 4-bit grayscale
|
||||
basn0g08.png 8-bit grayscale
|
||||
basn0g16.png 16-bit grayscale
|
||||
basn2c08.png 8-bit truecolor
|
||||
basn2c16.png 16-bit truecolor
|
||||
basn3p01.png 1-bit paletted
|
||||
basn3p02.png 2-bit paletted
|
||||
basn3p04.png 4-bit paletted
|
||||
basn3p08.png 8-bit paletted
|
||||
basn4a08.png 8-bit gray with alpha
|
||||
basn4a16.png 16-bit gray with alpha
|
||||
basn6a08.png 8-bit RGBA
|
||||
basn6a16.png 16-bit RGBA
|
||||
|
||||
Here is the correct result of typing "pngtest -m *.png" in
|
||||
ftbbn0g01.png 1-bit grayscale, black bKGD
|
||||
ftbbn0g02.png 2-bit grayscale, black bKGD
|
||||
ftbbn0g04.png 4-bit grayscale, black bKGD
|
||||
ftbbn2c16.png 16-bit truecolor, black bKGD
|
||||
ftbbn3p08.png 8-bit paletted, black bKGD
|
||||
ftbgn2c16.png 16-bit truecolor, gray bKGD
|
||||
ftbgn3p08.png 8-bit paletted, gray bKGD
|
||||
ftbrn2c08.png 8-bit truecolor, red bKGD
|
||||
ftbwn0g16.png 16-bit gray, white bKGD
|
||||
ftbwn3p08.png 8-bit paletted, white bKGD
|
||||
ftbyn3p08.png 8-bit paletted, yellow bKGD
|
||||
ftp0n0g08.png 8-bit grayscale, opaque
|
||||
ftp0n2c08.png 8-bit truecolor, opaque
|
||||
ftp0n3p08.png 8-bit paletted, opaque
|
||||
ftp1n3p08.png 8-bit paletted, no bKGD
|
||||
|
||||
Here is the correct result of typing "pngtest -m bas*.png" in
|
||||
this directory:
|
||||
|
||||
Testing basn0g01.png: PASS (524 zero samples)
|
||||
|
||||
|
Before Width: | Height: | Size: 164 B After Width: | Height: | Size: 164 B |
|
Before Width: | Height: | Size: 104 B After Width: | Height: | Size: 104 B |
|
Before Width: | Height: | Size: 145 B After Width: | Height: | Size: 145 B |
|
Before Width: | Height: | Size: 138 B After Width: | Height: | Size: 138 B |
|
Before Width: | Height: | Size: 167 B After Width: | Height: | Size: 167 B |
|
Before Width: | Height: | Size: 145 B After Width: | Height: | Size: 145 B |
|
Before Width: | Height: | Size: 302 B After Width: | Height: | Size: 302 B |
|
Before Width: | Height: | Size: 112 B After Width: | Height: | Size: 112 B |
|
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 146 B |
|
Before Width: | Height: | Size: 216 B After Width: | Height: | Size: 216 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 126 B |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 184 B After Width: | Height: | Size: 184 B |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
BIN
contrib/pngsuite/ftbbn0g01.png
Normal file
|
After Width: | Height: | Size: 176 B |
BIN
contrib/pngsuite/ftbbn0g02.png
Normal file
|
After Width: | Height: | Size: 197 B |
BIN
contrib/pngsuite/ftbbn0g04.png
Normal file
|
After Width: | Height: | Size: 429 B |
BIN
contrib/pngsuite/ftbbn2c16.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
contrib/pngsuite/ftbbn3p08.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
contrib/pngsuite/ftbgn2c16.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
contrib/pngsuite/ftbgn3p08.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
contrib/pngsuite/ftbrn2c08.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
contrib/pngsuite/ftbwn0g16.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
contrib/pngsuite/ftbwn3p08.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |