Compare commits
838 Commits
v1.0.13
...
v1.5.0rc02
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
500
ANNOUNCE
@@ -1,22 +1,492 @@
|
|||||||
|
|
||||||
Libpng 1.0.12beta1 - May 14, 2001
|
Libpng 1.5.0rc02 - December 28, 2010
|
||||||
|
|
||||||
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)
|
Source files with LF line endings (for Unix/Linux) and with a
|
||||||
Updated makefile.cygwin and handling of Cygwin's ALL_STATIC in pngconf.h
|
"configure" script
|
||||||
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.
|
|
||||||
|
|
||||||
Send comments/corrections/commendations to
|
1.5.0rc02.tar.xz (LZMA-compressed, recommended)
|
||||||
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
1.5.0rc02.tar.gz
|
||||||
|
1.5.0rc02.tar.bz2
|
||||||
|
|
||||||
|
Source files with CRLF line endings (for Windows), without the
|
||||||
|
"configure" script
|
||||||
|
|
||||||
|
lp150r02.7z (LZMA-compressed, recommended)
|
||||||
|
lp150r02.zip
|
||||||
|
|
||||||
|
Other information:
|
||||||
|
|
||||||
|
1.5.0rc02-README.txt
|
||||||
|
1.5.0rc02-LICENSE.txt
|
||||||
|
|
||||||
|
Changes since the last public release (1.4.1):
|
||||||
|
|
||||||
|
version 1.5.0beta01 [February 7, 2010]
|
||||||
|
Moved declaration of png_struct into private pngstruct.h and png_info
|
||||||
|
into pnginfo.h
|
||||||
|
|
||||||
|
version 1.5.0beta02 [February 7, 2010]
|
||||||
|
Reverted to original png_push_save_buffer() code.
|
||||||
|
|
||||||
|
version 1.5.0beta03 [February 8, 2010]
|
||||||
|
Return allocated "old_buffer" in png_push_save_buffer() before
|
||||||
|
calling png_error().
|
||||||
|
Updated configure script to use SO number 15.
|
||||||
|
|
||||||
|
version 1.5.0beta04 [February 9, 2010]
|
||||||
|
Removed malformed "incomplete struct declaration" of png_info from png.h
|
||||||
|
|
||||||
|
version 1.5.0beta05 [February 12, 2010]
|
||||||
|
Removed PNG_DEPSTRUCT markup in pngstruct.h and pnginfo.h, and undid the
|
||||||
|
linewrapping that it entailed.
|
||||||
|
Revised comments in pngstruct.h and pnginfo.h and added pointers to
|
||||||
|
the libpng license.
|
||||||
|
Changed PNG_INTERNAL to PNG_EXPOSE_INTERNAL_STRUCTURES
|
||||||
|
Removed the cbuilder5 project, which has not been updated to 1.4.0.
|
||||||
|
|
||||||
|
version 1.4.1beta12 and 1.5.0beta06 [February 14, 2010]
|
||||||
|
Fixed type declaration of png_get_chunk_malloc_max() in pngget.c (Daisuke
|
||||||
|
Nishikawa)
|
||||||
|
|
||||||
|
version 1.5.0beta07 [omitted]
|
||||||
|
|
||||||
|
version 1.5.0beta08 [February 19, 2010]
|
||||||
|
Changed #ifdef PNG_NO_STDIO_SUPPORTED to #ifdef PNG_NO_CONSOLE_IO_SUPPORTED
|
||||||
|
wherever png_snprintf() is used to construct error and warning messages.
|
||||||
|
Noted in scripts/makefile.mingw that it expects to be run under MSYS.
|
||||||
|
Removed obsolete unused MMX-querying support from contrib/gregbook
|
||||||
|
Added exported png_longjmp() function.
|
||||||
|
Removed the AIX redefinition of jmpbuf in png.h
|
||||||
|
Added -D_ALLSOURCE in configure.ac, makefile.aix, and CMakeLists.txt
|
||||||
|
when building on AIX.
|
||||||
|
|
||||||
|
version 1.5.0beta09 [February 19, 2010]
|
||||||
|
Removed -D_ALLSOURCE from configure.ac, makefile.aix, and CMakeLists.txt.
|
||||||
|
Changed the name of png_ptr->jmpbuf to png_ptr->png_jmpbuf in pngstruct.h
|
||||||
|
|
||||||
|
version 1.5.0beta10 [February 25, 2010]
|
||||||
|
Removed unused gzio.c from contrib/pngminim gather and makefile scripts
|
||||||
|
Removed replacement error handlers from contrib/gregbook. Because of
|
||||||
|
the new png_longjmp() function they are no longer needed.
|
||||||
|
|
||||||
|
version 1.5.0beta11 [March 6, 2010]
|
||||||
|
Removed checking for already-included setjmp.h from pngconf.h
|
||||||
|
Fixed inconsistent indentations and made numerous cosmetic changes.
|
||||||
|
Revised the "SEE ALSO" style of libpng.3, libpngpf.3, and png.5
|
||||||
|
|
||||||
|
version 1.5.0beta12 [March 9, 2010]
|
||||||
|
Moved "#include png.h" inside pngpriv.h and removed "#include png.h" from
|
||||||
|
the source files, along with "#define PNG_EXPOSE_INTERNAL_STRUCTURES"
|
||||||
|
and "#define PNG_NO_PEDANTIC_WARNINGS" (John Bowler).
|
||||||
|
Created new pngdebug.h and moved debug definitions there.
|
||||||
|
|
||||||
|
version 1.5.0beta13 [March 10, 2010]
|
||||||
|
Protect pngstruct.h, pnginfo.h, and pngdebug.h from being included twice.
|
||||||
|
Revise the "#ifdef" blocks in png_inflate() so it will compile when neither
|
||||||
|
PNG_USER_CHUNK_MALLOC_MAX nor PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
|
||||||
|
is defined.
|
||||||
|
Removed unused png_measure_compressed_chunk() from pngpriv.h and libpngpf.3
|
||||||
|
Moved the 'config.h' support from pngconf.h to pngpriv.h
|
||||||
|
Removed PNGAPI from the png_longjmp_ptr typedef.
|
||||||
|
Eliminated dependence of pngtest.c on the private pngdebug.h file.
|
||||||
|
Make all png_debug macros into *unterminated* statements or
|
||||||
|
expressions (i.e. a trailing ';' must always be added) and correct
|
||||||
|
the format statements in various png_debug messages.
|
||||||
|
|
||||||
|
version 1.5.0beta14 [March 14, 2010]
|
||||||
|
Removed direct access to png_ptr->io_ptr from the Windows code in pngtest.c
|
||||||
|
Revised Makefile.am to account for recent additions and replacements.
|
||||||
|
Corrected CE and OS/2 DEF files (scripts/png*def) for symbols removed and
|
||||||
|
added ordinal numbers to the Windows DEF file and corrected the duplicated
|
||||||
|
ordinal numbers on CE symbols that are commented out.
|
||||||
|
Added back in export symbols that can be present in the Windows build but
|
||||||
|
are disabled by default.
|
||||||
|
PNG_EXPORT changed to include an 'ordinal' field for DEF file generation.
|
||||||
|
PNG_CALLBACK added to make callback definitions uniform. PNGAPI split
|
||||||
|
into PNGCAPI (base C form), PNGAPI (exports) and PNGCBAPI (callbacks),
|
||||||
|
and appropriate changes made to all files. Cygwin builds re-hinged to
|
||||||
|
allow procedure call standard changes and to remove the need for the DEF
|
||||||
|
file (fixes build on Cygwin).
|
||||||
|
Enabled 'attribute' warnings that are relevant to library APIs and callbacks.
|
||||||
|
Changed rules for generation of the various symbol files and added a new
|
||||||
|
rule for a DEF file (which is also added to the distribution).
|
||||||
|
Updated the symbol file generation to stop it adding spurious spaces
|
||||||
|
to EOL (coming from preprocessor macro expansion). Added a facility
|
||||||
|
to join tokens in the output and rewrite *.dfn to use this.
|
||||||
|
Eliminated scripts/*.def in favor of libpng.def; updated projects/visualc71
|
||||||
|
and removed scripts/makefile.cygwin.
|
||||||
|
Made PNG_BUILD_DLL safe: it can be set whenever a DLL is being built.
|
||||||
|
Removed the include of sys/types.h - apparently unnecessary now on the
|
||||||
|
platforms on which it happened (all but Mac OS and RISC OS).
|
||||||
|
Moved the Mac OS test into pngpriv.h (the only place it is used.)
|
||||||
|
|
||||||
|
version 1.5.0beta15 [March 17, 2010]
|
||||||
|
Added symbols.chk target to Makefile.am to validate the symbols in png.h
|
||||||
|
against the new DEF file scripts/symbols.def.
|
||||||
|
Changed the default DEF file back to pngwin.def.
|
||||||
|
Removed makefile.mingw.
|
||||||
|
Eliminated PNG_NO_EXTERN and PNG_ALL_EXTERN
|
||||||
|
|
||||||
|
version 1.5.0beta16 [April 1, 2010]
|
||||||
|
Made png_text_struct independent of PNG_iTXt_SUPPORTED, so that
|
||||||
|
fields are initialized in all configurations. The READ/WRITE
|
||||||
|
macros (PNG_(READ|WRITE)_iTXt_SUPPORTED) still function as
|
||||||
|
before to disable code to actually read or write iTXt chunks
|
||||||
|
and iTXt_SUPPORTED can be used to detect presence of either
|
||||||
|
read or write support (but it is probably better to check for
|
||||||
|
the one actually required - read or write.)
|
||||||
|
Combined multiple png_warning() calls for a single error.
|
||||||
|
Restored the macro definition of png_check_sig().
|
||||||
|
|
||||||
|
version 1.5.0beta17 [April 17, 2010]
|
||||||
|
Documented the fact that png_set_dither() was disabled since libpng-1.4.0.
|
||||||
|
Reenabled png_set_dither() but renamed it to png_set_quantize() to reflect
|
||||||
|
more accurately what it actually does. At the same time, renamed
|
||||||
|
the PNG_DITHER_[RED,GREEN_BLUE]_BITS macros to
|
||||||
|
PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS.
|
||||||
|
Added some "(long)" typecasts to printf calls in png_handle_cHRM().
|
||||||
|
Freeze build-time only configuration in the build.
|
||||||
|
In all prior versions of libpng most configuration options
|
||||||
|
controlled by compiler #defines had to be repeated by the
|
||||||
|
application code that used libpng. This patch changes this
|
||||||
|
so that compilation options that can only be changed at build
|
||||||
|
time are frozen in the build. Options that are compiler
|
||||||
|
dependent (and those that are system dependent) are evaluated
|
||||||
|
each time - pngconf.h holds these. Options that can be changed
|
||||||
|
per-file in the application are in png.h. Frozen options are
|
||||||
|
in the new installed header file pnglibconf.h (John Bowler)
|
||||||
|
Removed the xcode project because it has not been updated to work
|
||||||
|
with libpng-1.5.0.
|
||||||
|
|
||||||
|
version 1.5.0beta18 [April 17, 2010]
|
||||||
|
Restored the ability to include optional pngusr.h
|
||||||
|
Moved replacements for png_error() and png_warning() from the
|
||||||
|
contrib/pngminim project to pngerror.c, for use when warnings or
|
||||||
|
errors are disabled via PNG_NO_WARN or PNG_NO_ERROR_TEXT, to avoid
|
||||||
|
storing unneeded error/warning text.
|
||||||
|
Updated contrib/pngminim project to work with the new pnglibconf.h
|
||||||
|
Added some PNG_NO_* defines to contrib/pngminim/*/pngusr.h to save space.
|
||||||
|
|
||||||
|
version 1.5.0beta19 [April 24, 2010]
|
||||||
|
Added PNG_{READ,WRITE}_INT_FUNCTIONS_SUPPORTED. This allows the functions
|
||||||
|
to read and write ints to be disabled independently of PNG_USE_READ_MACROS,
|
||||||
|
which allows libpng to be built with the functions even though the default
|
||||||
|
is to use the macros - this allows applications to choose at app build
|
||||||
|
time whether or not to use macros (previously impossible because the
|
||||||
|
functions weren't in the default build.)
|
||||||
|
Changed Windows calling convention back to __cdecl for API functions.
|
||||||
|
For Windows/x86 platforms only:
|
||||||
|
__stdcall is no longer needed for Visual Basic, so libpng-1.5.0 uses
|
||||||
|
__cdecl throughout (both API functions and callbacks) on Windows/x86
|
||||||
|
platforms.
|
||||||
|
Replaced visualc6 and visualc71 projects with new vstudio project
|
||||||
|
Relaxed the overly-restrictive permissions of some files.
|
||||||
|
|
||||||
|
version 1.5.0beta20 [April 24, 2010]
|
||||||
|
Relaxed more overly-restrictive permissions of some files.
|
||||||
|
|
||||||
|
version 1.5.0beta21 [April 27, 2010]
|
||||||
|
Removed some unwanted binary bytes and changed CRLF to NEWLINE in the new
|
||||||
|
vstudio project files, and some trivial editing of some files in the
|
||||||
|
scripts directory.
|
||||||
|
Set PNG_NO_READ_BGR, PNG_NO_IO_STATE, and PNG_NO_TIME_RFC1123 in
|
||||||
|
contrib/pngminim/decoder/pngusr.h to make a smaller decoder application.
|
||||||
|
|
||||||
|
version 1.5.0beta22 [April 28, 2010]
|
||||||
|
Fixed dependencies of GET_INT_32 - it does not require READ_INT_FUNCTIONS
|
||||||
|
because it has a macro equivalent.
|
||||||
|
Improved the options.awk script; added an "everything off" option.
|
||||||
|
Revised contrib/pngminim to use the "everything off" option in pngusr.dfa.
|
||||||
|
|
||||||
|
version 1.5.0beta23 [April 29, 2010]
|
||||||
|
Corrected PNG_REMOVED macro to take five arguments.
|
||||||
|
The macro was documented with two arguments (name,ordinal), however
|
||||||
|
the symbol checking .dfn files assumed five arguments. The five
|
||||||
|
argument form seems more useful so it is changed to that.
|
||||||
|
Corrected PNG_UNKNOWN_CHUNKS_SUPPORTED to PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||||
|
in gregbook/readpng2.c
|
||||||
|
Corrected protection of png_get_user_transform_ptr. The API declaration in
|
||||||
|
png.h is removed if both READ and WRITE USER_TRANSFORM are turned off
|
||||||
|
but was left defined in pngtrans.c
|
||||||
|
Added logunsupported=1 to cause pnglibconf.h to document disabled options.
|
||||||
|
This makes the installed pnglibconf.h more readable but causes no
|
||||||
|
other change. The intention is that users of libpng will find it
|
||||||
|
easier to understand if an API they need is missing.
|
||||||
|
Include png_reset_zstream() in png.c only when PNG_READ_SUPPORTED is defined.
|
||||||
|
Removed dummy_inflate.c from contrib/pngminim/encoder
|
||||||
|
Removed contrib/pngminim/*/gather.sh; gathering is now done in the makefile.
|
||||||
|
|
||||||
|
version 1.5.0beta24 [May 7, 2010]
|
||||||
|
Use bitwise "&" instead of arithmetic mod in pngrutil.c calculation of the
|
||||||
|
offset of the png_ptr->rowbuf pointer into png_ptr->big_row_buf.
|
||||||
|
Added more blank lines for readability.
|
||||||
|
|
||||||
|
version 1.5.0beta25 [December 28, 2010]
|
||||||
|
In pngpread.c: png_push_have_row() add check for new_row > height
|
||||||
|
Removed the now-redundant check for out-of-bounds new_row from example.c
|
||||||
|
|
||||||
|
version 1.5.0beta26 [June 18, 2010]
|
||||||
|
In pngpread.c: png_push_process_row() add check for too many rows.
|
||||||
|
|
||||||
|
version 1.5.0beta27 [June 18, 2010]
|
||||||
|
Removed the check added in beta25 as it is now redundant.
|
||||||
|
|
||||||
|
version 1.5.0beta28 [June 19, 2010]
|
||||||
|
Rewrote png_process_IDAT_data to consistently treat extra data as warnings
|
||||||
|
and handle end conditions more cleanly.
|
||||||
|
Removed the new (beta26) check in png_push_process_row().
|
||||||
|
|
||||||
|
version 1.5.0beta29 [June 21, 2010]
|
||||||
|
Revised scripts/options.awk to work on Sunos (but still doesn't work)
|
||||||
|
Added comment to options.awk and contrib/pngminim/*/makefile to try nawk.
|
||||||
|
|
||||||
|
version 1.5.0beta30 [June 22, 2010]
|
||||||
|
Stop memory leak when reading a malformed sCAL chunk.
|
||||||
|
|
||||||
|
version 1.5.0beta31 [June 26, 2010]
|
||||||
|
Revised pngpread.c patch of beta28 to avoid an endless loop.
|
||||||
|
Removed some trailing blanks.
|
||||||
|
|
||||||
|
version 1.5.0beta32 [June 26, 2010]
|
||||||
|
Removed leftover scripts/options.patch and scripts/options.rej
|
||||||
|
|
||||||
|
version 1.5.0beta33 [July 6, 2010]
|
||||||
|
Made FIXED and FLOATING options consistent in the APIs they enable and
|
||||||
|
disable. Corrected scripts/options.awk to handle both command line
|
||||||
|
options and options specified in the .dfa files.
|
||||||
|
Changed char *msg to PNG_CONST char *msg in pngrutil.c
|
||||||
|
Make png_set_sRGB_gAMA_and_cHRM set values using either the fixed or
|
||||||
|
floating point APIs, but not both.
|
||||||
|
Reversed patch to remove error handler when the jmp_buf is stored in the
|
||||||
|
main program structure, not the png_struct.
|
||||||
|
The error handler is needed because the default handler in libpng will
|
||||||
|
always use the jmp_buf in the library control structure; this is never
|
||||||
|
set. The gregbook code is a useful example because, even though it
|
||||||
|
uses setjmp/longjmp, it shows how error handling can be implemented
|
||||||
|
using control mechanisms not directly supported by libpng. The
|
||||||
|
technique will work correctly with mechanisms such as Microsoft
|
||||||
|
Structure Exceptions or C++ exceptions (compiler willing - note that gcc
|
||||||
|
does not by default support interworking of C and C++ error handling.)
|
||||||
|
Reverted changes to call png_longjmp in contrib/gregbook where it is not
|
||||||
|
appropriate. If mainprog->jmpbuf is used by setjmp, then png_longjmp
|
||||||
|
cannot be used.
|
||||||
|
Changed "extern PNG_EXPORT" to "PNG_EXPORT" in png.h (Jan Nijtmans)
|
||||||
|
Changed "extern" to "PNG_EXTERN" in pngpriv.h (except for the 'extern "C" {')
|
||||||
|
|
||||||
|
version 1.5.0beta34 [July 12, 2010]
|
||||||
|
Put #ifndef PNG_EXTERN, #endif around the define PNG_EXTERN in pngpriv.h
|
||||||
|
|
||||||
|
version 1.5.0beta35 [July 24, 2010]
|
||||||
|
Removed some newly-added TAB characters.
|
||||||
|
Added -DNO_PNG_SNPRINTF to CFLAGS in scripts/makefile.dj2
|
||||||
|
Moved the definition of png_snprintf() outside of the enclosing
|
||||||
|
#ifdef blocks in pngconf.h
|
||||||
|
|
||||||
|
version 1.5.0beta36 [July 29, 2010]
|
||||||
|
Patches by John Bowler:
|
||||||
|
Fixed point APIs are now supported throughout (no missing APIs).
|
||||||
|
Internal fixed point arithmetic support exists for all internal floating
|
||||||
|
point operations.
|
||||||
|
sCAL validates the floating point strings it is passed.
|
||||||
|
Safe, albeit rudimentary, Watcom support is provided by PNG_API_RULE==2
|
||||||
|
Two new APIs exist to get the number of passes without turning on the
|
||||||
|
PNG_INTERLACE transform and to get the number of rows in the current
|
||||||
|
pass.
|
||||||
|
A new test program, pngvalid.c, validates the gamma code.
|
||||||
|
Errors in the 16 bit gamma correction (overflows) have been corrected.
|
||||||
|
cHRM chunk testing is done consistently (previously the floating point
|
||||||
|
API bypassed it, because the test really didn't work on FP, now the test
|
||||||
|
is performed on the actual values to be stored in the PNG file so it
|
||||||
|
works in the FP case too.)
|
||||||
|
Most floating point APIs now simply call the fixed point APIs after
|
||||||
|
converting the values to the fixed point form used in the PNG file.
|
||||||
|
The standard headers no longer include zlib.h, which is currently only
|
||||||
|
required for pngstruct.h and can therefore be internal.
|
||||||
|
Revised png_get_int_32 to undo the PNG two's complement representation of
|
||||||
|
negative numbers.
|
||||||
|
|
||||||
|
version 1.5.0beta37 [July 30, 2010]
|
||||||
|
Added a typecast in png_get_int_32() in png.h and pngrutil.h to avoid
|
||||||
|
a compiler warning.
|
||||||
|
Replaced oFFs 0,0 with oFFs -10,20 in pngtest.png
|
||||||
|
|
||||||
|
version 1.5.0beta38 [July 31, 2010]
|
||||||
|
Implemented remaining "_fixed" functions.
|
||||||
|
Corrected a number of recently introduced warnings mostly resulting from
|
||||||
|
safe but uncast assignments to shorter integers. Also added a zlib
|
||||||
|
VStudio release library project because the latest zlib Official Windows
|
||||||
|
build does not include such a thing.
|
||||||
|
Revised png_get_int_16() to be similar to png_get_int_32().
|
||||||
|
Restored projects/visualc71.
|
||||||
|
|
||||||
|
version 1.5.0beta39 [August 2, 2010]
|
||||||
|
VisualC/GCC warning fixes, VisualC build fixes
|
||||||
|
The changes include support for function attributes in VC in addition to
|
||||||
|
those already present in GCC - necessary because without these some
|
||||||
|
warnings are unavoidable. Fixes include signed/unsigned fixes in
|
||||||
|
pngvalid and checks with gcc -Wall -Wextra -Wunused.
|
||||||
|
VC requires function attributes on function definitions as well as
|
||||||
|
declarations, PNG_FUNCTION has been added to enable this and the
|
||||||
|
relevant function definitions changed.
|
||||||
|
|
||||||
|
version 1.5.0beta40 [August 6, 2010]
|
||||||
|
Correct use of _WINDOWS_ in pngconf.h
|
||||||
|
Removed png_mem_ #defines; they are no longer used.
|
||||||
|
Added the sRGB chunk to pngtest.png
|
||||||
|
|
||||||
|
version 1.5.0beta41 [August 11, 2010]
|
||||||
|
Added the cHRM chunk to pngtest.png
|
||||||
|
Don't try to use version-script with cygwin/mingw.
|
||||||
|
Revised contrib/gregbook to work under cygwin/mingw.
|
||||||
|
|
||||||
|
version 1.5.0beta42 [August 18, 2010]
|
||||||
|
Add .dll.a to the list of extensions to be symlinked by Makefile.am (Yaakov)
|
||||||
|
Made all API functions that have const arguments and constant string
|
||||||
|
literal pointers declare them (John Bowler).
|
||||||
|
|
||||||
|
Version 1.5.0beta43 [August 20, 2010]
|
||||||
|
Removed spurious tabs, shorten long lines (no source change)
|
||||||
|
Also added scripts/chkfmt to validate the format of all the files that can
|
||||||
|
reasonably be validated (it is suggested to run "make distclean" before
|
||||||
|
checking, because some machine generated files have long lines.)
|
||||||
|
Reformatted the CHANGES file to be more consistent throughout.
|
||||||
|
Made changes to address various issues identified by GCC, mostly
|
||||||
|
signed/unsigned and shortening problems on assignment but also a few
|
||||||
|
difficult to optimize (for GCC) loops.
|
||||||
|
Fixed non-GCC fixed point builds. In png.c a declaration was misplaced
|
||||||
|
in an earlier update. Fixed to declare the auto variables at the head.
|
||||||
|
Use cexcept.h in pngvalid.c.
|
||||||
|
|
||||||
|
Version 1.5.0beta44 [August 24, 2010]
|
||||||
|
Updated CMakeLists.txt to use CMAKE_INSTALL_LIBDIR variable; useful for
|
||||||
|
installing libpng in /usr/lib64 (Funda Wang).
|
||||||
|
Revised CMakeLists.txt to put the man pages in share/man/man* not man/man*
|
||||||
|
Revised CMakeLists.txt to make symlinks instead of copies when installing.
|
||||||
|
Changed PNG_LIB_NAME from pngNN to libpngNN in CMakeLists.txt (Philip Lowman)
|
||||||
|
Implemented memory checks within pngvalid
|
||||||
|
Reformatted/rearranged pngvalid.c to assist use of progressive reader.
|
||||||
|
Check interlaced images in pngvalid
|
||||||
|
Clarified pngusr.h comments in pnglibconf.dfa
|
||||||
|
Simplified the pngvalid error-handling code now that cexcept.h is in place.
|
||||||
|
Implemented progressive reader in pngvalid.c for standard tests
|
||||||
|
Implemented progressive read in pngvalid.c gamma tests
|
||||||
|
Turn on progressive reader in pngvalid.c by default and tidy code.
|
||||||
|
|
||||||
|
Version 1.5.0beta45 [August 26, 2010]
|
||||||
|
Added an explicit make step to projects/vstudio for pnglibconf.h
|
||||||
|
Also corrected zlib.vcxproj into which Visual Studio had introduced
|
||||||
|
what it calls an "authoring error". The change to make pnglibconf.h
|
||||||
|
simply copies the file; in the future it may actually generate the
|
||||||
|
file from scripts/pnglibconf.dfa as the other build systems do.
|
||||||
|
Changed pngvalid to work when floating point APIs are disabled
|
||||||
|
Renamed the prebuilt scripts/pnglibconf.h to scripts/pnglibconf.h.prebuilt
|
||||||
|
Supply default values for PNG_USER_PRIVATEBUILD and PNG_USER_DLLFNAME_POSTFIX
|
||||||
|
in pngpriv.h in case the user neglected to define them in their pngusr.h
|
||||||
|
|
||||||
|
Version 1.5.0beta46 [August 28, 2010]
|
||||||
|
Added new private header files to libpng_sources in CMakeLists.txt
|
||||||
|
Added PNG_READ_16BIT, PNG_WRITE_16BIT, and PNG_16BIT options.
|
||||||
|
Added reference to scripts/pnglibconf.h.prebuilt in the visualc71 project.
|
||||||
|
|
||||||
|
Version 1.5.0beta47 [September 11, 2010]
|
||||||
|
Fixed a number of problems with 64-bit compilation reported by Visual
|
||||||
|
Studio 2010 (John Bowler).
|
||||||
|
|
||||||
|
Version 1.5.0beta48 [October 4, 2010]
|
||||||
|
Updated CMakeLists.txt (Philip Lowman).
|
||||||
|
Revised autogen.sh to recognize and use $AUTOCONF, $AUTOMAKE, $AUTOHEADER,
|
||||||
|
$AUTOPOINT, $ACLOCAL and $LIBTOOLIZE
|
||||||
|
Fixed problem with symbols creation in Makefile.am which was assuming that
|
||||||
|
all versions of ccp write to standard output by default (Martin Banky). The
|
||||||
|
bug was introduced in libpng-1.2.9beta5.
|
||||||
|
|
||||||
|
Version 1.5.0beta49 [October 8, 2010]
|
||||||
|
Undid Makefile.am revision of 1.5.0beta48.
|
||||||
|
|
||||||
|
Version 1.5.0beta50 [October 14, 2010]
|
||||||
|
Revised Makefile.in to account for mkinstalldirs being removed.
|
||||||
|
Added some "(unsigned long)" typecasts in printf statements in pngvalid.c.
|
||||||
|
Suppressed a compiler warning in png_handle_sPLT().
|
||||||
|
Check for out-of-range text compression mode in png_set_text().
|
||||||
|
|
||||||
|
Version 1.5.0beta51 [October 15, 2010]
|
||||||
|
Changed embedded dates to "(PENDING RELEASE) in beta releases (and future
|
||||||
|
rc releases) to minimize the difference between releases.
|
||||||
|
|
||||||
|
Version 1.5.0beta52 [October 16, 2010]
|
||||||
|
Restored some of the embedded dates (in png.h, png.c, documentation, etc.)
|
||||||
|
|
||||||
|
Version 1.5.0beta53 [October 18, 2010]
|
||||||
|
Updated INSTALL to mention using "make maintainer-clean" and to remove
|
||||||
|
obsolete statement about a custom ltmain.sh
|
||||||
|
Disabled "color-tests" by default in Makefile.am so it will work with
|
||||||
|
automake versions earlier than 1.11.1
|
||||||
|
Use document name "libpng-manual.txt" instead of "libpng-<version>.txt"
|
||||||
|
to simplify version differences.
|
||||||
|
Removed obsolete remarks about setjmp handling from INSTALL.
|
||||||
|
Revised and renamed the typedef in png.h and png.c that was designed
|
||||||
|
to catch library and header mismatch.
|
||||||
|
|
||||||
|
Version 1.5.0beta54 [November 10, 2010]
|
||||||
|
Require 48 bytes, not 64 bytes, for big_row_buf in overflow checks.
|
||||||
|
Used a consistent structure for the pngget.c functions.
|
||||||
|
|
||||||
|
Version 1.5.0beta55 [November 21, 2010]
|
||||||
|
Revised png_get_uint_32, png_get_int_32, png_get_uint_16 (Cosmin)
|
||||||
|
Moved reading of file signature into png_read_sig (Cosmin)
|
||||||
|
Fixed atomicity of chunk header serialization (Cosmin)
|
||||||
|
Added test for io_state in pngtest.c (Cosmin)
|
||||||
|
Added "#!/bin/sh" at the top of contrib/pngminim/*/gather.sh scripts.
|
||||||
|
Changes to remove gcc warnings (John Bowler)
|
||||||
|
Certain optional gcc warning flags resulted in warnings in libpng code.
|
||||||
|
With these changes only -Wconversion and -Wcast-qual cannot be turned on.
|
||||||
|
Changes are trivial rearrangements of code. -Wconversion is not possible
|
||||||
|
for pngrutil.c (because of the widespread use of += et al on variables
|
||||||
|
smaller than (int) or (unsigned int)) and -Wcast-qual is not possible
|
||||||
|
with pngwio.c and pngwutil.c because the 'write' callback and zlib
|
||||||
|
compression both fail to declare their input buffers with 'const'.
|
||||||
|
|
||||||
|
Version 1.5.0beta56 [December 7, 2010]
|
||||||
|
Added the private PNG_UNUSED() macro definition in pngpriv.h.
|
||||||
|
Added some commentary about PNG_EXPORT in png.h and pngconf.h
|
||||||
|
Revised PNG_EXPORT() macro and added PNG_EXPORTA() macro, with the
|
||||||
|
objective of simplifying and improving the cosmetic appearance of png.h.
|
||||||
|
Fixed some incorrect "=" macro names in pnglibconf.dfa
|
||||||
|
Included documentation of changes in 1.5.0 from 1.4.x in libpng-manual.txt
|
||||||
|
|
||||||
|
Version 1.5.0beta57 [December 9, 2010]
|
||||||
|
Documented the pngvalid gamma error summary with additional comments and
|
||||||
|
print statements.
|
||||||
|
Improved missing symbol handling in checksym.awk; symbols missing in both
|
||||||
|
the old and new files can now be optionally ignored, treated as errors
|
||||||
|
or warnings.
|
||||||
|
Removed references to pngvcrd.c and pnggccrd.c from the vstudio project.
|
||||||
|
Updated "libpng14" to "libpng15" in the visualc71 project.
|
||||||
|
Enabled the strip16 tests in pngvalid.`
|
||||||
|
Don't display test results (except PASS/FAIL) when running "make test".
|
||||||
|
Instead put them in pngtest-log.txt
|
||||||
|
Added "--with-zprefix=<string>" to configure.ac
|
||||||
|
Updated the prebuilt configuration files to autoconf version 2.68
|
||||||
|
|
||||||
|
Version 1.5.0beta58 [December 19, 2010]
|
||||||
|
Fixed interlace image handling and add test cases (John Bowler)
|
||||||
|
Fixed the clean rule in Makefile.am to remove pngtest-log.txt
|
||||||
|
Made minor changes to work around warnings in gcc 3.4
|
||||||
|
|
||||||
|
Version 1.5.0rc01 [December 28, 2010]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.5.0rc02 [December 28, 2010]
|
||||||
|
Eliminated references to the scripts/*.def files in project/visualc71.
|
||||||
|
|
||||||
|
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
|
Glenn R-P
|
||||||
|
|||||||
383
CMakeLists.txt
Normal file
@@ -0,0 +1,383 @@
|
|||||||
|
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()
|
||||||
|
|
||||||
|
# Copyright (C) 2007-2010 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
|
||||||
|
|
||||||
|
set(PNGLIB_MAJOR 1)
|
||||||
|
set(PNGLIB_MINOR 5)
|
||||||
|
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()
|
||||||
|
|
||||||
|
if(MINGW)
|
||||||
|
option(PNG_TESTS "Build pngtest" NO)
|
||||||
|
else()
|
||||||
|
option(PNG_TESTS "Build pngtest" YES)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
option(PNG_NO_CONSOLE_IO "FIXME" YES)
|
||||||
|
option(PNG_NO_STDIO "FIXME" YES)
|
||||||
|
option(PNG_DEBUG "Build with debug output" NO)
|
||||||
|
option(PNGARG "FIXME" YES)
|
||||||
|
#TODO:
|
||||||
|
# PNG_CONSOLE_IO_SUPPORTED
|
||||||
|
|
||||||
|
# maybe needs improving, but currently I don't know when we can enable what :)
|
||||||
|
set(png_asm_tmp "OFF")
|
||||||
|
if(NOT WIN32)
|
||||||
|
find_program(uname_executable NAMES uname PATHS /bin /usr/bin /usr/local/bin)
|
||||||
|
if(uname_executable)
|
||||||
|
exec_program(${uname_executable}
|
||||||
|
ARGS --machine OUTPUT_VARIABLE uname_output)
|
||||||
|
if("uname_output" MATCHES "^.*i[1-9]86.*$")
|
||||||
|
set(png_asm_tmp "ON")
|
||||||
|
else("uname_output" MATCHES "^.*i[1-9]86.*$")
|
||||||
|
set(png_asm_tmp "OFF")
|
||||||
|
endif("uname_output" MATCHES "^.*i[1-9]86.*$")
|
||||||
|
endif(uname_executable)
|
||||||
|
else()
|
||||||
|
# this env var is normally only set on win64
|
||||||
|
set(TEXT "ProgramFiles(x86)")
|
||||||
|
if("$ENV{${TEXT}}" STREQUAL "")
|
||||||
|
set(png_asm_tmp "ON")
|
||||||
|
endif("$ENV{${TEXT}}" STREQUAL "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# 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
|
||||||
|
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
|
||||||
|
)
|
||||||
|
# SOME NEEDED DEFINITIONS
|
||||||
|
|
||||||
|
add_definitions(-DPNG_CONFIGURE_LIBPNG)
|
||||||
|
|
||||||
|
if(_AIX)
|
||||||
|
add_definitions(-D_ALL_SOURCE)
|
||||||
|
endif(_AIX)
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
add_definitions(-DPNG_NO_MODULEDEF -D_CRT_SECURE_NO_DEPRECATE)
|
||||||
|
endif(MSVC)
|
||||||
|
|
||||||
|
if(PNG_SHARED OR NOT MSVC)
|
||||||
|
#if building msvc static this has NOT to be defined
|
||||||
|
add_definitions(-DZLIB_DLL)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if(PNG_CONSOLE_IO_SUPPORTED)
|
||||||
|
add_definitions(-DPNG_CONSOLE_IO_SUPPORTED)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PNG_NO_CONSOLE_IO)
|
||||||
|
add_definitions(-DPNG_NO_CONSOLE_IO)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PNG_NO_STDIO)
|
||||||
|
add_definitions(-DPNG_NO_STDIO)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PNG_DEBUG)
|
||||||
|
add_definitions(-DPNG_DEBUG)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT M_LIBRARY AND NOT WIN32)
|
||||||
|
add_definitions(-DPNG_NO_FLOATING_POINT_SUPPORTED)
|
||||||
|
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)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#
|
||||||
|
# Set a variable with CMake code which:
|
||||||
|
# Creates a symlink from src to dest (if possible) or alternatively
|
||||||
|
# copies if different.
|
||||||
|
macro(_png_generate_symlink_code CODE SRC DEST)
|
||||||
|
if(WIN32 AND NOT CYGWIN)
|
||||||
|
set(_png_gsc_message "Copying ${SRC} to ${DEST} if needed")
|
||||||
|
set(_png_gsc_operation "copy_if_different")
|
||||||
|
else()
|
||||||
|
set(_png_gsc_message "Symlinking ${SRC} to ${DEST}")
|
||||||
|
set(_png_gsc_operation "create_symlink")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(${CODE} "
|
||||||
|
message(STATUS \"${_png_gsc_message}\")
|
||||||
|
execute_process(COMMAND \${CMAKE_COMMAND} -E ${_png_gsc_operation}
|
||||||
|
\"${SRC}\" \"${DEST}\")
|
||||||
|
")
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# CREATE PKGCONFIG FILES
|
||||||
|
# we use the same files like ./configure, so we have to set its vars
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||||
|
set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
|
||||||
|
endif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||||
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
|
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
|
set(libdir ${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)
|
||||||
|
_png_generate_symlink_code(PNG_PC_INSTALL_CODE ${PNGLIB_NAME}.pc libpng.pc)
|
||||||
|
install(CODE ${PNG_PC_INSTALL_CODE})
|
||||||
|
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY)
|
||||||
|
_png_generate_symlink_code(PNG_CONFIG_INSTALL_CODE ${PNGLIB_NAME}-config
|
||||||
|
libpng-config)
|
||||||
|
install(CODE ${PNG_CONFIG_INSTALL_CODE})
|
||||||
|
|
||||||
|
# SET UP LINKS
|
||||||
|
if(PNG_SHARED)
|
||||||
|
set_target_properties(${PNG_LIB_NAME} PROPERTIES
|
||||||
|
# VERSION 15.${PNGLIB_RELEASE}.1.5.0rc02
|
||||||
|
VERSION 15.${PNGLIB_RELEASE}.0
|
||||||
|
SOVERSION 15
|
||||||
|
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 => libpng14.dll.a on Cygwin
|
||||||
|
if(CYGWIN)
|
||||||
|
_png_generate_symlink_code(PNG_SHARED_IMPLIB_INSTALL_CODE
|
||||||
|
${PNGLIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
||||||
|
libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
|
||||||
|
install(CODE ${PNG_SHARED_IMPLIB_INSTALL_CODE})
|
||||||
|
install(FILES
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
_png_generate_symlink_code(PNG_SHARED_INSTALL_CODE
|
||||||
|
${PNGLIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
|
libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||||
|
install(CODE ${PNG_SHARED_INSTALL_CODE})
|
||||||
|
install(FILES
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
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)
|
||||||
|
_png_generate_symlink_code(PNG_STATIC_INSTALL_CODE
|
||||||
|
${PNGLIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||||
|
libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||||
|
install(CODE ${PNG_STATIC_INSTALL_CODE})
|
||||||
|
install(FILES
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
endif()
|
||||||
|
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 )
|
||||||
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin)
|
||||||
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
||||||
|
DESTINATION bin)
|
||||||
|
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
|
||||||
|
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()
|
||||||
|
|
||||||
|
# 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-manual.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
|
||||||
|
|
||||||
166
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
|
On Unix/Linux and similar systems, you can simply type
|
||||||
can usually be found wherever you got libpng. zlib can be
|
|
||||||
placed in another directory, at the same level as libpng.
|
./configure [--prefix=/path]
|
||||||
Note that your system might already have a preinstalled
|
make check
|
||||||
zlib, but you will still need to have access to the
|
make install
|
||||||
zlib.h and zconf.h include files that correspond to the
|
|
||||||
version of zlib that's installed.
|
and ignore the rest of this document.
|
||||||
|
|
||||||
|
If configure does not work on your system and you have a reasonably
|
||||||
|
up-to-date set of tools, running ./autogen.sh before running ./configure
|
||||||
|
may fix the problem. You can also run the individual commands in
|
||||||
|
autogen.sh with the --force option, if supported by your version of
|
||||||
|
the tools. 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
|
||||||
|
./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
|
You can rename the directories that you downloaded (they
|
||||||
might be called "libpng-1.0.12beta1" or "lpng109" and "zlib-1.1.3"
|
might be called "libpng-x.y.z" or "libpngNN" and "zlib-1.2.5"
|
||||||
or "zlib113") so that you have directories called "zlib" and "libpng".
|
or "zlib125") so that you have directories called "zlib" and "libpng".
|
||||||
|
|
||||||
Your directory structure should look like this:
|
Your directory structure should look like this:
|
||||||
|
|
||||||
@@ -21,19 +63,25 @@ Your directory structure should look like this:
|
|||||||
README
|
README
|
||||||
*.h
|
*.h
|
||||||
*.c
|
*.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
|
contrib
|
||||||
gregbook
|
gregbook
|
||||||
msvctest
|
pngminim
|
||||||
pngminus
|
pngminus
|
||||||
pngsuite
|
pngsuite
|
||||||
visupng
|
visupng
|
||||||
projects
|
projects
|
||||||
beos
|
visualc71
|
||||||
borland
|
vstudio
|
||||||
msvc
|
|
||||||
wince
|
|
||||||
scripts
|
scripts
|
||||||
makefile.*
|
makefile.*
|
||||||
|
*.def (module definition files)
|
||||||
|
etc.
|
||||||
pngtest.png
|
pngtest.png
|
||||||
etc.
|
etc.
|
||||||
zlib
|
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
|
distribution of libpng. It is available in both tar.gz (UNIX style line
|
||||||
endings) and zip (DOS style line endings) formats.
|
endings) and zip (DOS style line endings) formats.
|
||||||
|
|
||||||
If you are building libpng with MSVC, you can enter the libpng\msvc directory
|
If you are building libpng with MSVC, you can enter the
|
||||||
and follow the instructions in msvc\README.txt. You can build libpng for
|
libpng projects\visualc6 or visualc71 directory and follow the instructions
|
||||||
WindowsCE by entering the libpng\wince directory and following the
|
in README.txt.
|
||||||
instructions in the README* files.
|
|
||||||
|
|
||||||
Else enter the zlib directory and follow the instructions in zlib/README,
|
Otherwise enter the zlib directory and follow the instructions in zlib/README,
|
||||||
then come back here and choose the appropriate makefile.sys in the scripts
|
then come back here and run "configure" or choose the appropriate
|
||||||
directory.
|
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
|
|
||||||
|
|
||||||
Copy the file (or files) that you need from the
|
Copy the file (or files) that you need from the
|
||||||
scripts directory into this directory, for example
|
scripts directory into this directory, for example
|
||||||
@@ -116,22 +112,24 @@ scripts directory into this directory, for example
|
|||||||
Read the makefile to see if you need to change any source or
|
Read the makefile to see if you need to change any source or
|
||||||
target directories to match your preferences.
|
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.
|
changes.
|
||||||
|
|
||||||
Then just run "make test" which will create the libpng library in
|
Then just run "make" which will create the libpng library in
|
||||||
this directory and run a quick test that reads the "pngtest.png"
|
this directory and "make test" which will run a quick test that reads
|
||||||
file and writes a "pngout.png" file that should be identical to it.
|
the "pngtest.png" file and writes a "pngout.png" file that should be
|
||||||
Look for "9782 zero samples" in the output of the test. For more
|
identical to it. Look for "9782 zero samples" in the output of the
|
||||||
confidence, you can run another test by typing "pngtest pngnow.png"
|
test. For more confidence, you can run another test by typing
|
||||||
and looking for "289 zero samples" in the output. Also, you can
|
"pngtest pngnow.png" and looking for "289 zero samples" in the output.
|
||||||
run "pngtest -m *.png" in the "contrib/pngsuite" directory and compare
|
Also, you can run "pngtest -m contrib/pngsuite/*.png" and compare
|
||||||
your output with the result shown in contrib/pngsuite/README.
|
your output with the result shown in contrib/pngsuite/README.
|
||||||
|
|
||||||
Most of the makefiles will allow you to run "make install" to
|
Most of the makefiles will allow you to run "make install" to
|
||||||
put the library in its final resting place (if you want 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).
|
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.txt
|
Further information can be found in the README and libpng-manual.txt
|
||||||
files, in the individual makefiles, in png.h, in the README files in
|
files, in the individual makefiles, in png.h, and the manual pages
|
||||||
subdirectories of the LIB directory, and the manual pages libpng.3 and png.5.
|
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
|
If you modify libpng you may insert additional notices immediately following
|
||||||
this sentence.
|
this sentence.
|
||||||
|
|
||||||
libpng versions 1.0.7, July 1, 2000, through 1.0.12beta1, May 14, 2001, are
|
This code is released under the libpng license.
|
||||||
Copyright (c) 2000, 2001 Glenn Randers-Pehrson
|
|
||||||
and are distributed according to the same disclaimer and license as libpng-1.0.6
|
libpng versions 1.2.6, August 15, 2004, through 1.5.0rc02, December 28, 2010, are
|
||||||
|
Copyright (c) 2004, 2006-2010 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
|
with the following individuals added to the list of Contributing Authors
|
||||||
|
|
||||||
Simon-Pierre Cadieux
|
Simon-Pierre Cadieux
|
||||||
@@ -73,11 +82,11 @@ to the following restrictions:
|
|||||||
|
|
||||||
1. The origin of this source code must not be misrepresented.
|
1. The origin of this source code must not be misrepresented.
|
||||||
|
|
||||||
2. Altered versions must be plainly marked as such and
|
2. Altered versions must be plainly marked as such and must not
|
||||||
must not be misrepresented as being the original source.
|
be misrepresented as being the original source.
|
||||||
|
|
||||||
3. This Copyright notice may not be removed or altered from
|
3. This Copyright notice may not be removed or altered from any
|
||||||
any source or altered source distribution.
|
source or altered source distribution.
|
||||||
|
|
||||||
The Contributing Authors and Group 42, Inc. specifically permit, without
|
The Contributing Authors and Group 42, Inc. specifically permit, without
|
||||||
fee, and encourage the use of this source code as a component to
|
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.
|
certification mark of the Open Source Initiative.
|
||||||
|
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
randeg@alum.rpi.edu
|
glennrp at users.sourceforge.net
|
||||||
May 14, 2001
|
December 28, 2010
|
||||||
|
|||||||
204
Makefile.am
Normal file
@@ -0,0 +1,204 @@
|
|||||||
|
# Makefile.am:
|
||||||
|
# Source file for Makefile.in (and hence Makefile)
|
||||||
|
#
|
||||||
|
|
||||||
|
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
||||||
|
|
||||||
|
# libpng does not follow GNU file name conventions
|
||||||
|
|
||||||
|
# "color-tests" requires automake 1.11.1 or later. Enable it if you like,
|
||||||
|
# to get red "FAIL" and green "PASS" notations during tests.
|
||||||
|
# AUTOMAKE_OPTIONS = foreign color-tests
|
||||||
|
AUTOMAKE_OPTIONS = foreign
|
||||||
|
|
||||||
|
# test programs - run on make check, make distcheck
|
||||||
|
check_PROGRAMS= pngtest pngvalid
|
||||||
|
pngtest_SOURCES = pngtest.c
|
||||||
|
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
|
pngvalid_SOURCES = pngvalid.c
|
||||||
|
pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
|
TESTS = test-pngtest.sh test-pngvalid-simple.sh test-pngvalid-full.sh
|
||||||
|
TESTS_ENVIRONMENT= srcdir=$(srcdir)
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
|
||||||
|
|
||||||
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS = @LIBPNG_DEFINES@
|
||||||
|
|
||||||
|
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
|
||||||
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,--version-script=libpng.vers
|
||||||
|
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= dfn.c dfn?.out pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
|
||||||
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \
|
||||||
|
pngwin.def check.new pnglibconf.* 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
|
||||||
|
|
||||||
|
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/symbols.out scripts/pngwin.out: png.h pngconf.h scripts/pnglibconf.h.prebuilt
|
||||||
|
|
||||||
|
libpng.sym: scripts/sym.out
|
||||||
|
rm -f $@
|
||||||
|
cp $? $@
|
||||||
|
libpng.vers: scripts/vers.out
|
||||||
|
rm -f $@
|
||||||
|
cp $? $@
|
||||||
|
pngwin.def: scripts/pngwin.out
|
||||||
|
rm -f $@
|
||||||
|
cp $? $@
|
||||||
|
pnglibconf.h: pnglibconf.out
|
||||||
|
rm -f $@
|
||||||
|
cp $? $@
|
||||||
|
scripts/pnglibconf.h.prebuilt:
|
||||||
|
@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.)
|
||||||
|
pngvalid.o pngtest.o: pnglibconf.h
|
||||||
|
|
||||||
|
SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\
|
||||||
|
-DPNGLIB_VERSION='@PNGLIB_VERSION@'\
|
||||||
|
-DSYMBOL_PREFIX='$(SYMBOL_PREFIX)'
|
||||||
|
|
||||||
|
.dfn.out:
|
||||||
|
rm -f $@ dfn.c dfn?.out
|
||||||
|
test -d scripts || mkdir scripts
|
||||||
|
echo '#include "$<"' >dfn.c
|
||||||
|
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\
|
||||||
|
$(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c > dfn1.out
|
||||||
|
$(SED) -n -e 's|^.*PNG_DEFN_MAGIC-\(.*\)-PNG_DEFN_END.*$$|\1|p'\
|
||||||
|
dfn1.out >dfn2.out
|
||||||
|
$(SED) -e 's| *@@@ *||g' -e 's| *$$||' dfn2.out >dfn3.out
|
||||||
|
rm -f dfn.c dfn[12].out
|
||||||
|
mv dfn3.out $@
|
||||||
|
|
||||||
|
# The .dfn file for pnglibconf.h is machine generated
|
||||||
|
pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk
|
||||||
|
rm -f $@ dfn?.out
|
||||||
|
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn1.out\
|
||||||
|
${srcdir}/scripts/pnglibconf.dfa $(DFA_XTRA) 1>&2
|
||||||
|
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn2.out dfn1.out 1>&2
|
||||||
|
rm dfn1.out
|
||||||
|
mv dfn2.out $@
|
||||||
|
|
||||||
|
# Symbol checks (.def and .out files should match)
|
||||||
|
scripts/pngwin.chk: scripts/checksym.awk scripts/pngwin.def scripts/pngwin.out
|
||||||
|
scripts/symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/symbols.out
|
||||||
|
.out.chk:
|
||||||
|
rm -f $@ symbols.new
|
||||||
|
$(AWK) -f ${srcdir}/scripts/checksym.awk ${srcdir}/scripts/${*F}.def\
|
||||||
|
$< >&2
|
||||||
|
mv symbols.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
|
||||||
|
rm -f $@ dfn?.out
|
||||||
|
test -z "$(CPPFLAGS)"
|
||||||
|
echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\
|
||||||
|
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn1.out\
|
||||||
|
logunsupported=1 - ${srcdir}/scripts/pnglibconf.dfa 1>&2
|
||||||
|
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn2.out dfn1.out 1>&2
|
||||||
|
rm dfn1.out
|
||||||
|
mv dfn2.out $@
|
||||||
|
|
||||||
|
$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h \
|
||||||
|
pnglibconf.h pngpriv.h pngdebug.h pnginfo.h pngstruct.h
|
||||||
|
|
||||||
|
test: check-am
|
||||||
|
|
||||||
|
# Extra checks
|
||||||
|
check: scripts/symbols.chk scripts/pngwin.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
|
||||||
1367
Makefile.in
Normal file
152
README
@@ -1,11 +1,11 @@
|
|||||||
README for libpng 1.0.12beta1 - May 14, 2001 (shared library 2.1)
|
README for libpng version 1.5.0rc02 - December 28, 2010 (shared library 15.0)
|
||||||
See the note about version numbers near the top of png.h
|
See the note about version numbers near the top of png.h
|
||||||
|
|
||||||
See INSTALL for instructions on how to install libpng.
|
See INSTALL for instructions on how to install libpng.
|
||||||
|
|
||||||
Libpng comes in two distribution formats. Get libpng-*.tar.gz if you
|
Libpng comes in several distribution formats. Get libpng-*.tar.gz,
|
||||||
want UNIX-style line endings in the text files, or lpng*.zip if you want
|
libpng-*.tar.xz or libpng-*.tar.bz2 if you want UNIX-style line endings
|
||||||
DOS-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
|
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
|
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.
|
critical or an ancillary chunk.
|
||||||
|
|
||||||
The changes made to the library, and bugs fixed are based on discussions
|
The changes made to the library, and bugs fixed are based on discussions
|
||||||
on the PNG implementation mailing list <png-implement@ccrc.wustl.edu>
|
on the PNG-implement mailing list and not on material submitted
|
||||||
and not on material submitted privately to Guy, Andreas, or Glenn. They will
|
privately to Guy, Andreas, or Glenn. They will forward any good
|
||||||
forward any good suggestions to the list.
|
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
|
examples of libpng in a program, see example.c and pngtest.c. For usage
|
||||||
information and restrictions (what little they are) on libpng, see
|
information and restrictions (what little they are) on libpng, see
|
||||||
png.h. For a description on using zlib (the compression library used by
|
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 can use zlib as a drop-in replacement for fread() and fwrite() if
|
||||||
you are so inclined.
|
you are so inclined.
|
||||||
|
|
||||||
zlib should be available at the same place that libpng is.
|
zlib should be available at the same place that libpng is, or at.
|
||||||
If not, it should be at ftp.uu.net in /graphics/png
|
ftp://ftp.info-zip.org/pub/infozip/zlib
|
||||||
Eventually, it will be at ftp.uu.net in /pub/archiving/zip/zlib
|
|
||||||
|
|
||||||
You may also want a copy of the PNG specification. It is available
|
You may also want a copy of the PNG specification. It is available
|
||||||
as an RFC and a W3C Recommendation. Failing
|
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
|
||||||
these resources you can try ftp.uu.net in the /graphics/png directory.
|
these at http://www.libpng.org/pub/png/documents/
|
||||||
|
|
||||||
This code is currently being archived at ftp.uu.net in the
|
This code is currently being archived at libpng.sf.net in the
|
||||||
/graphics/png directory, and on CompuServe, Lib 20 (PNG SUPPORT)
|
[DOWNLOAD] area, and on CompuServe, Lib 20 (PNG SUPPORT)
|
||||||
at GO GRAPHSUP. If you can't find it in any of those places,
|
at GO GRAPHSUP. If you can't find it in any of those places,
|
||||||
e-mail me, and I'll help you find it.
|
e-mail me, and I'll help you find it.
|
||||||
|
|
||||||
@@ -102,19 +101,24 @@ Finally, if you get any warning messages when compiling libpng
|
|||||||
fix. Please mention "libpng" somewhere in the subject line. Thanks.
|
fix. Please mention "libpng" somewhere in the subject line. Thanks.
|
||||||
|
|
||||||
This release was created and will be supported by myself (of course
|
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
|
Send comments/corrections/commendations to png-mng-implement at
|
||||||
png-implement@ccrc.wustl.edu
|
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
|
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
|
given in previous versions of this document. He and Andreas will
|
||||||
addressed to the png-implement list, however.
|
read mail addressed to the png-implement list, however.
|
||||||
|
|
||||||
Please do not send general questions about PNG. Send them to
|
Please do not send general questions about PNG. Send them to
|
||||||
the address in the specification (png-group@w3.org). At the same
|
the (png-list at ccrc.wustl.edu, subscription required, write to
|
||||||
time, please do not send libpng questions to that address, send them to me
|
majordomo at ccrc.wustl.edu with "subscribe png-list" in your message).
|
||||||
or to png-implement@ccrc.wustl.edu. I'll
|
On the other hand,
|
||||||
|
please do not send libpng questions to that address, send them to me
|
||||||
|
or to the png-implement list. I'll
|
||||||
get them in the end anyway. If you have a question about something
|
get them in the end anyway. If you have a question about something
|
||||||
in the PNG specification that is related to using libpng, send it
|
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,
|
to me. Send me any questions that start with "I was using libpng,
|
||||||
@@ -122,10 +126,10 @@ and ...". If in doubt, send questions to me. I'll bounce them
|
|||||||
to others, if necessary.
|
to others, if necessary.
|
||||||
|
|
||||||
Please do not send suggestions on how to change PNG. We have
|
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 nine years now, and it is official and
|
||||||
finished. If you have suggestions for libpng, however, I'll
|
finished. If you have suggestions for libpng, however, I'll
|
||||||
gladly listen. Even if your suggestion is not used for version
|
gladly listen. Even if your suggestion is not used immediately,
|
||||||
1.0, it may be used later.
|
it may be used later.
|
||||||
|
|
||||||
Files in this distribution:
|
Files in this distribution:
|
||||||
|
|
||||||
@@ -137,14 +141,17 @@ Files in this distribution:
|
|||||||
TODO => Things not implemented in the current library
|
TODO => Things not implemented in the current library
|
||||||
Y2KINFO => Statement of Y2K compliance
|
Y2KINFO => Statement of Y2K compliance
|
||||||
example.c => Example code for using libpng functions
|
example.c => Example code for using libpng functions
|
||||||
libpng.3 => manual page for libpng (includes libpng.txt)
|
libpng.3 => manual page for libpng (includes libpng-manual.txt)
|
||||||
libpng.txt => Description of libpng and its functions
|
libpng-manual.txt => Description of libpng and its functions
|
||||||
libpngpf.3 => manual page for libpng's private functions
|
libpngpf.3 => manual page for libpng's private functions
|
||||||
png.5 => manual page for the PNG format
|
png.5 => manual page for the PNG format
|
||||||
png.c => Basic interface functions common to library
|
png.c => Basic interface functions common to library
|
||||||
png.h => Library function and interface declarations
|
png.h => Library function and interface declarations (public)
|
||||||
pngconf.h => System specific library configuration
|
pngpriv.h => Library function and interface declarations (private)
|
||||||
pngasmrd.h => Header file for assembler-coded functions
|
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
|
pngerror.c => Error/warning message I/O functions
|
||||||
pngget.c => Functions for retrieving info from struct
|
pngget.c => Functions for retrieving info from struct
|
||||||
pngmem.c => Memory handling functions
|
pngmem.c => Memory handling functions
|
||||||
@@ -171,77 +178,28 @@ Files in this distribution:
|
|||||||
pngminus => Simple pnm2png and png2pnm programs
|
pngminus => Simple pnm2png and png2pnm programs
|
||||||
pngsuite => Test images
|
pngsuite => Test images
|
||||||
visupng => Contains a MSVC workspace for VisualPng
|
visupng => Contains a MSVC workspace for VisualPng
|
||||||
projects => Contains project files and workspaces for building DLL
|
projects => Contains project files and workspaces for
|
||||||
beos => Contains a Beos workspace for building libpng
|
building a DLL
|
||||||
borland => Contains a Borland workspace for building libpng
|
cbuilder5 => Contains a Borland workspace for building
|
||||||
and zlib
|
libpng and zlib
|
||||||
msvc => Contains a Microsoft Visual C++ (MSVC) workspace
|
visualc6 => Contains a Microsoft Visual C++ (MSVC)
|
||||||
for building libpng and zlib
|
workspace for building libpng and zlib
|
||||||
wince => Contains a Microsoft Visual C++ (Windows CD Toolkit)
|
visualc71 => Contains a Microsoft Visual C++ (MSVC)
|
||||||
workspace for building libpng and zlib on WindowsCE
|
workspace for building libpng and zlib
|
||||||
|
xcode => Contains an Apple xcode
|
||||||
|
workspace for building libpng and zlib
|
||||||
scripts => Directory containing scripts for building libpng:
|
scripts => Directory containing scripts for building libpng:
|
||||||
descrip.mms => VMS makefile for MMS or MMK
|
(see scripts/README.txt for the list of scripts)
|
||||||
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
|
|
||||||
|
|
||||||
Good luck, and happy coding.
|
Good luck, and happy coding.
|
||||||
|
|
||||||
-Glenn Randers-Pehrson
|
-Glenn Randers-Pehrson (current maintainer, since 1998)
|
||||||
Internet: randeg@alum.rpi.edu
|
Internet: glennrp at users.sourceforge.net
|
||||||
|
|
||||||
-Andreas Eric Dilger
|
-Andreas Eric Dilger (former maintainer, 1996-1997)
|
||||||
Internet: adilger@enel.ucalgary.ca
|
Internet: adilger at enel.ucalgary.ca
|
||||||
Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/
|
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)
|
(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:
|
TODO - list of things to do for libpng:
|
||||||
|
|
||||||
Final bug fixes.
|
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?
|
Better C++ wrapper/full C++ implementation?
|
||||||
Fix problem with C++ and EXTERN "C".
|
Fix problem with C++ and EXTERN "C".
|
||||||
cHRM transformation.
|
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.
|
Add "grayscale->palette" transformation and "palette->grayscale" detection.
|
||||||
Improved dithering.
|
Improved dithering.
|
||||||
Multi-lingual error and warning message support.
|
Multi-lingual error and warning message support.
|
||||||
@@ -17,8 +16,12 @@ Better filter selection
|
|||||||
(counting huffman bits/precompression? filter inertia? filter costs?).
|
(counting huffman bits/precompression? filter inertia? filter costs?).
|
||||||
Histogram creation.
|
Histogram creation.
|
||||||
Text conversion between different code pages (Latin-1 -> Mac and DOS).
|
Text conversion between different code pages (Latin-1 -> Mac and DOS).
|
||||||
Should we always malloc 2^bit_depth PLTE/tRNS/hIST entries for safety?
|
Avoid building gamma tables whenever possible.
|
||||||
Build gamma tables using fixed point (and do away with floating point entirely).
|
|
||||||
Use greater precision when changing to linear gamma for compositing against
|
Use greater precision when changing to linear gamma for compositing against
|
||||||
background and doing rgb-to-gray transformation.
|
background and doing rgb-to-gray transformation.
|
||||||
Investigate pre-incremented loop counters and other loop constructions.
|
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
|
|
||||||
9430
aclocal.m4
vendored
Normal file
34
autogen.sh
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
# a quick hack script to generate necessary files from
|
||||||
|
# auto* tools.
|
||||||
|
#
|
||||||
|
# WARNING: if you run this you will change the versions
|
||||||
|
# of the tools which are used and, maybe, required!
|
||||||
|
|
||||||
|
# You can define your own replacements in your environment.
|
||||||
|
# $AUTOCONF, $AUTOMAKE, $AUTOHEADER, $AUTOPOINT, $ACLOCAL and $LIBTOOLIZE
|
||||||
|
|
||||||
|
touch Makefile.am configure.ac
|
||||||
|
{
|
||||||
|
LT=${LIBTOOLIZE-libtoolize}
|
||||||
|
echo "running $LT" >&2
|
||||||
|
$LT --force --copy --automake
|
||||||
|
} && {
|
||||||
|
AL=${ACLOCAL-aclocal}
|
||||||
|
echo "running $AL" >&2
|
||||||
|
$AL
|
||||||
|
} && {
|
||||||
|
AH=${AUTOHEADER-autoheader}
|
||||||
|
echo "running $AH [ignore the warnings]" >&2
|
||||||
|
$AH
|
||||||
|
} && {
|
||||||
|
AM=${AUTOMAKE-automake}
|
||||||
|
echo "running $AM" >&2
|
||||||
|
$AM --force-missing --foreign -a -c
|
||||||
|
} && {
|
||||||
|
AC=${AUTOCONF-autoconf}
|
||||||
|
echo "running $AC" >&2
|
||||||
|
$AC
|
||||||
|
} &&
|
||||||
|
echo "autogen complete" >&2 ||
|
||||||
|
echo "ERROR: autogen.sh failed, autogen is incomplete" >&2
|
||||||
1501
config.guess
vendored
Normal file
86
config.h.in
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||||
|
#undef HAVE_DLFCN_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
|
#undef HAVE_INTTYPES_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `m' library (-lm). */
|
||||||
|
#undef HAVE_LIBM
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `z' library (-lz). */
|
||||||
|
#undef HAVE_LIBZ
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <malloc.h> header file. */
|
||||||
|
#undef HAVE_MALLOC_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <memory.h> header file. */
|
||||||
|
#undef HAVE_MEMORY_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `memset' function. */
|
||||||
|
#undef HAVE_MEMSET
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pow' function. */
|
||||||
|
#undef HAVE_POW
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdint.h> header file. */
|
||||||
|
#undef HAVE_STDINT_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||||
|
#undef HAVE_STDLIB_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <strings.h> header file. */
|
||||||
|
#undef HAVE_STRINGS_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <string.h> header file. */
|
||||||
|
#undef HAVE_STRING_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||||
|
#undef HAVE_SYS_STAT_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||||
|
#undef HAVE_SYS_TYPES_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
|
#undef HAVE_UNISTD_H
|
||||||
|
|
||||||
|
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||||
|
*/
|
||||||
|
#undef LT_OBJDIR
|
||||||
|
|
||||||
|
/* Name of package */
|
||||||
|
#undef PACKAGE
|
||||||
|
|
||||||
|
/* Define to the address where bug reports for this package should be sent. */
|
||||||
|
#undef PACKAGE_BUGREPORT
|
||||||
|
|
||||||
|
/* Define to the full name of this package. */
|
||||||
|
#undef PACKAGE_NAME
|
||||||
|
|
||||||
|
/* Define to the full name and version of this package. */
|
||||||
|
#undef PACKAGE_STRING
|
||||||
|
|
||||||
|
/* Define to the one symbol short name of this package. */
|
||||||
|
#undef PACKAGE_TARNAME
|
||||||
|
|
||||||
|
/* Define to the home page for this package. */
|
||||||
|
#undef PACKAGE_URL
|
||||||
|
|
||||||
|
/* Define to the version of this package. */
|
||||||
|
#undef PACKAGE_VERSION
|
||||||
|
|
||||||
|
/* Define to 1 if you have the ANSI C header files. */
|
||||||
|
#undef STDC_HEADERS
|
||||||
|
|
||||||
|
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||||
|
#undef TM_IN_SYS_TIME
|
||||||
|
|
||||||
|
/* Version number of package */
|
||||||
|
#undef VERSION
|
||||||
|
|
||||||
|
/* Define to empty if `const' does not conform to ANSI C. */
|
||||||
|
#undef const
|
||||||
|
|
||||||
|
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||||
|
#undef size_t
|
||||||
1705
config.sub
vendored
Normal file
144
configure.ac
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
# 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.59)
|
||||||
|
|
||||||
|
dnl Version number stuff here:
|
||||||
|
|
||||||
|
AC_INIT([libpng], [1.5.0rc02], [png-mng-implement@lists.sourceforge.net])
|
||||||
|
AM_INIT_AUTOMAKE
|
||||||
|
dnl stop configure from automagically running automake
|
||||||
|
AM_MAINTAINER_MODE
|
||||||
|
|
||||||
|
PNGLIB_VERSION=1.5.0rc02
|
||||||
|
PNGLIB_MAJOR=1
|
||||||
|
PNGLIB_MINOR=5
|
||||||
|
PNGLIB_RELEASE=0
|
||||||
|
|
||||||
|
dnl End of version number stuff
|
||||||
|
|
||||||
|
AC_CONFIG_SRCDIR([pngget.c])
|
||||||
|
AM_CONFIG_HEADER(config.h)
|
||||||
|
|
||||||
|
# Checks for programs.
|
||||||
|
AC_PROG_CC
|
||||||
|
AC_PROG_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
|
||||||
|
LT_INIT([win32-dll])
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Checks for library functions.
|
||||||
|
AC_FUNC_STRTOD
|
||||||
|
AC_CHECK_FUNCS([memset], , AC_ERROR([memset not found in libc]))
|
||||||
|
AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_ERROR([cannot find pow])) )
|
||||||
|
AC_ARG_WITH(zprefix,
|
||||||
|
AC_HELP_STRING([--with-zprefix],
|
||||||
|
[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_ERROR([zlib not installed])))
|
||||||
|
|
||||||
|
|
||||||
|
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
|
||||||
|
LIBPNG_DEFINES=$LIBPNG_DEFINES
|
||||||
|
AC_SUBST(LIBPNG_DEFINES)
|
||||||
|
|
||||||
|
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* )
|
||||||
|
have_ld_version_script=no
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
|
||||||
|
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} "s:^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,
|
||||||
|
AC_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,
|
||||||
|
AC_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])
|
||||||
|
|
||||||
|
# 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
|
||||||
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,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
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
|
be held liable for any damages arising in any way from the use of
|
||||||
this software.
|
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,
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
including commercial applications, and to alter it and redistribute
|
including commercial applications, and to alter it and redistribute
|
||||||
it freely, subject to the following restrictions:
|
it freely, subject to the following restrictions:
|
||||||
@@ -23,4 +30,21 @@
|
|||||||
and contributors for the book, "PNG: The Definitive Guide,"
|
and contributors for the book, "PNG: The Definitive Guide,"
|
||||||
published by O'Reilly and Associates.
|
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.
|
# Sample makefile for rpng-x / rpng2-x / wpng for SGI using cc and make.
|
||||||
# Greg Roelofs
|
# Greg Roelofs
|
||||||
# Last modified: 16 January 1000
|
# Last modified: 7 March 2002
|
||||||
#
|
#
|
||||||
# The programs built by this makefile are described in the book,
|
# The programs built by this makefile are described in the book,
|
||||||
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
|
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
|
||||||
@@ -23,9 +23,9 @@
|
|||||||
|
|
||||||
# macros --------------------------------------------------------------------
|
# macros --------------------------------------------------------------------
|
||||||
|
|
||||||
PNGINC = -I/usr/local/include
|
PNGINC = -I/usr/local/include/libpng15
|
||||||
PNGLIB = -L/usr/local/lib -lpng # dynamically linked against libpng
|
PNGLIB = -L/usr/local/lib -lpng15 # dynamically linked against libpng
|
||||||
#PNGLIB = /usr/local/lib/libpng.a # statically linked against libpng
|
#PNGLIB = /usr/local/lib/libpng15.a # statically linked against libpng
|
||||||
# or:
|
# or:
|
||||||
#PNGINC = -I../..
|
#PNGINC = -I../..
|
||||||
#PNGLIB = -L../.. -lpng
|
#PNGLIB = -L../.. -lpng
|
||||||
@@ -52,8 +52,10 @@ WLIBS = $(PNGLIB) $(ZLIB)
|
|||||||
CC = cc
|
CC = cc
|
||||||
LD = cc
|
LD = cc
|
||||||
RM = rm -f
|
RM = rm -f
|
||||||
CFLAGS = -O -fullwarn $(INCS)
|
# ABI must be the same as that used to build libpng.
|
||||||
LDFLAGS =
|
ABI=
|
||||||
|
CFLAGS = $(ABI) -O -fullwarn $(INCS)
|
||||||
|
LDFLAGS = $(ABI)
|
||||||
O = .o
|
O = .o
|
||||||
E =
|
E =
|
||||||
|
|
||||||
|
|||||||
@@ -1,73 +1,92 @@
|
|||||||
# Sample makefile for rpng-x / rpng2-x / wpng using gcc and make.
|
# Sample makefile for rpng-x / rpng2-x / wpng using gcc and make.
|
||||||
# Greg Roelofs
|
# Greg Roelofs
|
||||||
# Last modified: 28 February 2000
|
# Last modified: 2 June 2007
|
||||||
#
|
#
|
||||||
# The programs built by this makefile are described in the book,
|
# The programs built by this makefile are described in the book,
|
||||||
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
|
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
|
||||||
# Associates, 1999). Go buy a copy, eh? Buy some for friends
|
# Associates, 1999). Go buy a copy, eh? Well, OK, it's not
|
||||||
# and family, too. (Not that this is a blatant plug or anything.)
|
# 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:
|
# Invoke this makefile from a shell prompt in the usual way; for example:
|
||||||
#
|
#
|
||||||
# make -f Makefile.unx
|
# make -f Makefile.unx
|
||||||
#
|
#
|
||||||
# This makefile assumes libpng and zlib have already been built or downloaded
|
# 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
|
# and are installed in /usr/local/{include,lib} or as otherwise indicated by
|
||||||
# PNG* and Z* macros below). Edit as appropriate--choose only ONE each of
|
# the PNG* and Z* macros below. Edit as appropriate--choose only ONE each of
|
||||||
# the PNGINC, PNGLIB, ZINC and ZLIB lines.
|
# the PNGINC, PNGLIBd, PNGLIBs, ZINC, ZLIBd and ZLIBs lines.
|
||||||
#
|
#
|
||||||
# This makefile builds statically linked executables (against libpng and zlib,
|
# This makefile builds both dynamically and statically linked executables
|
||||||
# that is), but that can be changed by uncommenting the appropriate PNGLIB and
|
# (against libpng and zlib, that is), but that can be changed by modifying
|
||||||
# ZLIB lines.
|
# the "EXES =" line. (You need only one set, but for testing it can be handy
|
||||||
|
# to have both.)
|
||||||
|
|
||||||
|
|
||||||
# macros --------------------------------------------------------------------
|
# macros --------------------------------------------------------------------
|
||||||
|
|
||||||
PNGINC = -I/usr/local/include
|
#PNGDIR = /usr/local/lib
|
||||||
#PNGLIB = -L/usr/local/lib -lpng # dynamically linked against libpng
|
#PNGINC = -I/usr/local/include/libpng15
|
||||||
PNGLIB = /usr/local/lib/libpng.a # statically linked against libpng
|
#PNGLIBd = -L$(PNGDIR) -lpng15 # dynamically linked, installed libpng
|
||||||
|
#PNGLIBs = $(PNGDIR)/libpng15.a # statically linked, installed libpng
|
||||||
# or:
|
# or:
|
||||||
#PNGINC = -I../..
|
PNGDIR = ../..# this one is for libpng-x.y.z/contrib/gregbook builds
|
||||||
#PNGLIB = -L../.. -lpng
|
#PNGDIR = ../libpng
|
||||||
#PNGLIB = ../../libpng.a
|
PNGINC = -I$(PNGDIR)
|
||||||
|
PNGLIBd = -Wl,-rpath,$(PNGDIR) -L$(PNGDIR) -lpng15 # dynamically linked
|
||||||
|
PNGLIBs = $(PNGDIR)/libpng.a # statically linked, local libpng
|
||||||
|
|
||||||
|
ZDIR = /usr/local/lib
|
||||||
|
#ZDIR = /usr/lib64
|
||||||
ZINC = -I/usr/local/include
|
ZINC = -I/usr/local/include
|
||||||
#ZLIB = -L/usr/local/lib -lz # dynamically linked against zlib
|
ZLIBd = -L$(ZDIR) -lz # dynamically linked against zlib
|
||||||
ZLIB = /usr/local/lib/libz.a # statically linked against zlib
|
ZLIBs = $(ZDIR)/libz.a # statically linked against zlib
|
||||||
#ZINC = -I../zlib
|
# or:
|
||||||
#ZLIB = -L../zlib -lz
|
#ZDIR = ../zlib
|
||||||
#ZLIB = ../../../zlib/libz.a
|
#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
|
#XINC = -I/usr/include # old-style, stock X distributions
|
||||||
#XLIB = -L/usr/lib/X11 -lX11
|
#XLIB = -L/usr/lib/X11 -lX11 # (including SGI IRIX)
|
||||||
#XINC = -I/usr/openwin/include # Sun workstations (OpenWindows)
|
#XINC = -I/usr/openwin/include # Sun workstations (OpenWindows)
|
||||||
#XLIB = -L/usr/openwin/lib -lX11
|
#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/lib -lX11
|
||||||
|
#XLIB = -L/usr/X11R6/lib64 -lX11 # e.g., Red Hat on AMD64
|
||||||
|
|
||||||
INCS = $(PNGINC) $(ZINC) $(XINC)
|
INCS = $(PNGINC) $(ZINC) $(XINC)
|
||||||
RLIBS = $(PNGLIB) $(ZLIB) $(XLIB) -lm
|
RLIBSd = $(PNGLIBd) $(ZLIBd) $(XLIB) -lm
|
||||||
WLIBS = $(PNGLIB) $(ZLIB)
|
RLIBSs = $(PNGLIBs) $(ZLIBs) $(XLIB) -lm
|
||||||
|
WLIBSd = $(PNGLIBd) $(ZLIBd) -lm
|
||||||
|
WLIBSs = $(PNGLIBs) $(ZLIBs)
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
LD = gcc
|
LD = gcc
|
||||||
RM = rm -f
|
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")]
|
# [note that -Wall is a gcc-specific compilation flag ("most warnings on")]
|
||||||
# [-ansi, -pedantic and -W can also be used]
|
# [-ansi, -pedantic and -W can also be used]
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
O = .o
|
O = .o
|
||||||
E =
|
E =
|
||||||
|
|
||||||
RPNG = rpng-x
|
RPNG = rpng-x
|
||||||
RPNG2 = rpng2-x
|
RPNG2 = rpng2-x
|
||||||
WPNG = wpng
|
WPNG = wpng
|
||||||
|
|
||||||
|
RPNGs = $(RPNG)-static
|
||||||
|
RPNG2s = $(RPNG2)-static
|
||||||
|
WPNGs = $(WPNG)-static
|
||||||
|
|
||||||
ROBJS = $(RPNG)$(O) readpng$(O)
|
ROBJS = $(RPNG)$(O) readpng$(O)
|
||||||
ROBJS2 = $(RPNG2)$(O) readpng2$(O)
|
ROBJS2 = $(RPNG2)$(O) readpng2$(O)
|
||||||
WOBJS = $(WPNG)$(O) writepng$(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 -------------------------------------------------------
|
# implicit make rules -------------------------------------------------------
|
||||||
@@ -80,14 +99,23 @@ EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
|
|||||||
|
|
||||||
all: $(EXES)
|
all: $(EXES)
|
||||||
|
|
||||||
|
$(RPNGs)$(E): $(ROBJS)
|
||||||
|
$(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBSs)
|
||||||
|
|
||||||
$(RPNG)$(E): $(ROBJS)
|
$(RPNG)$(E): $(ROBJS)
|
||||||
$(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBS)
|
$(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBSd)
|
||||||
|
|
||||||
|
$(RPNG2s)$(E): $(ROBJS2)
|
||||||
|
$(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBSs)
|
||||||
|
|
||||||
$(RPNG2)$(E): $(ROBJS2)
|
$(RPNG2)$(E): $(ROBJS2)
|
||||||
$(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBS)
|
$(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBSd)
|
||||||
|
|
||||||
|
$(WPNGs)$(E): $(WOBJS)
|
||||||
|
$(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBSs)
|
||||||
|
|
||||||
$(WPNG)$(E): $(WOBJS)
|
$(WPNG)$(E): $(WOBJS)
|
||||||
$(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBS)
|
$(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBSd)
|
||||||
|
|
||||||
$(RPNG)$(O): $(RPNG).c readpng.h
|
$(RPNG)$(O): $(RPNG).c readpng.h
|
||||||
$(RPNG2)$(O): $(RPNG2).c readpng2.h
|
$(RPNG2)$(O): $(RPNG2).c readpng2.h
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# Sample makefile for rpng-win / rpng2-win / wpng using MSVC and NMAKE.
|
# Sample makefile for rpng-win / rpng2-win / wpng using MSVC and NMAKE.
|
||||||
# Greg Roelofs
|
# Greg Roelofs
|
||||||
# Last modified: 16 February 1999
|
# Last modified: 2 June 2007
|
||||||
#
|
#
|
||||||
# The programs built by this makefile are described in the book,
|
# The programs built by this makefile are described in the book,
|
||||||
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
|
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
|
||||||
# Associates, 1999). Go buy a copy, eh? Buy some for friends
|
# Associates, 1999). Go buy a copy, eh? Well, OK, it's not
|
||||||
# and family, too. (Not that this is a blatant plug or anything.)
|
# 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:
|
# Invoke this makefile from a DOS prompt window via:
|
||||||
#
|
#
|
||||||
@@ -32,12 +33,12 @@
|
|||||||
|
|
||||||
# macros --------------------------------------------------------------------
|
# macros --------------------------------------------------------------------
|
||||||
|
|
||||||
PNGPATH = ../..
|
PNGPATH = ../libpng
|
||||||
PNGINC = -I$(PNGPATH)
|
PNGINC = -I$(PNGPATH)
|
||||||
#PNGLIB = $(PNGPATH)/pngdll.lib
|
#PNGLIB = $(PNGPATH)/pngdll.lib
|
||||||
PNGLIB = $(PNGPATH)/libpng.lib
|
PNGLIB = $(PNGPATH)/libpng.lib
|
||||||
|
|
||||||
ZPATH = ../../../zlib
|
ZPATH = ../zlib
|
||||||
ZINC = -I$(ZPATH)
|
ZINC = -I$(ZPATH)
|
||||||
#ZLIB = $(ZPATH)/zlibdll.lib
|
#ZLIB = $(ZPATH)/zlibdll.lib
|
||||||
ZLIB = $(ZPATH)/zlibstat.lib
|
ZLIB = $(ZPATH)/zlibstat.lib
|
||||||
@@ -53,7 +54,7 @@ CC = cl
|
|||||||
LD = link
|
LD = link
|
||||||
RM = del
|
RM = del
|
||||||
CFLAGS = -nologo -O -W3 $(INCS) $(cvars)
|
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]
|
# [see %devstudio%\vc\include\win32.mak for cvars macro definition]
|
||||||
O = .obj
|
O = .obj
|
||||||
E = .exe
|
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
|
The source code for all three demo programs currently compiles under
|
||||||
Unix, OpenVMS, and 32-bit Windows. (Special thanks to Martin Zinser,
|
Unix, OpenVMS, and 32-bit Windows. (Special thanks to Martin Zinser,
|
||||||
zinser@decus.de, for making the necessary changes for OpenVMS and for
|
zinser@decus.de, for making the necessary changes for OpenVMS and for
|
||||||
providing an appropriate build script.) Build instructions can be
|
providing an appropriate build script.) Build instructions can be found
|
||||||
found below.
|
below.
|
||||||
|
|
||||||
Files:
|
Files:
|
||||||
|
|
||||||
README this file
|
README this file
|
||||||
README.w32 additional Windows-specific information
|
LICENSE terms of distribution and reuse (BSD-like or GNU GPL)
|
||||||
LICENSE terms of distribution and reuse (BSD-like)
|
COPYING GNU General Public License (GPL)
|
||||||
|
|
||||||
Makefile.unx Unix makefile
|
Makefile.unx Unix makefile
|
||||||
Makefile.w32 Windows (MSVC) makefile
|
Makefile.w32 Windows (MSVC) makefile
|
||||||
@@ -45,26 +45,27 @@ Files:
|
|||||||
|
|
||||||
toucan.png transparent PNG for testing (by Stefan Schneider)
|
toucan.png transparent PNG for testing (by Stefan Schneider)
|
||||||
|
|
||||||
Note that the programs are designed to be functional, but their primary
|
Note that, although the programs are designed to be functional, their
|
||||||
purpose is to demonstrate how to use libpng to add PNG support to other
|
primary purpose is to illustrate how to use libpng to add PNG support to
|
||||||
programs. As such, their user interfaces are crude and definitely not
|
other programs. As such, their user interfaces are crude and definitely
|
||||||
intended for everyday use.
|
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
|
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.
|
13-15 of the book for detailed discussion of the three programs.
|
||||||
|
|
||||||
Greg Roelofs
|
Greg Roelofs
|
||||||
19 March 2000
|
http://pobox.com/~newt/greg_contact.html
|
||||||
|
16 March 2008
|
||||||
|
|
||||||
|
|
||||||
BUILD INSTRUCTIONS
|
BUILD INSTRUCTIONS
|
||||||
|
|
||||||
- Prerequisites:
|
- Prerequisites (in order of compilation):
|
||||||
|
|
||||||
- zlib ftp://ftp.cdrom.com/pub/infozip/zlib/zlib.html
|
- zlib http://zlib.net/
|
||||||
- libpng http://www.cdrom.com/pub/png/pngcode.html
|
- libpng http://www.libpng.org/pub/png/libpng.html
|
||||||
- pngbook http://www.cdrom.com/pub/png/book/sources.html
|
- pngbook http://www.libpng.org/pub/png/book/sources.html
|
||||||
|
|
||||||
The pngbook demo programs are explicitly designed to demonstrate proper
|
The pngbook demo programs are explicitly designed to demonstrate proper
|
||||||
coding techniques for using the libpng reference library. As a result,
|
coding techniques for using the libpng reference library. As a result,
|
||||||
@@ -128,11 +129,13 @@ BUILD INSTRUCTIONS
|
|||||||
|
|
||||||
The result should be three executables: rpng-win.exe, rpng2-win.exe,
|
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
|
and wpng.exe. Copy them somewhere in your PATH or run them from the
|
||||||
current folder. Unlike the Unix versions, the two windowed programs
|
current folder. Like the Unix versions, the two windowed programs
|
||||||
(rpng and rpng2) do not display a usage screen when invoked without
|
(rpng and rpng2) now display a usage screen in a console window when
|
||||||
command-line arguments; see README.w32 for brief help or the book for
|
invoked without command-line arguments; this is new behavior as of
|
||||||
details. Note that the programs use the Unix-style "-" character to
|
the June 2001 release. Note that the programs use the Unix-style "-"
|
||||||
specify options, instead of the more common DOS/Windows "/" character.
|
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:
|
- OpenVMS:
|
||||||
@@ -148,9 +151,9 @@ BUILD INSTRUCTIONS
|
|||||||
To run the programs, they probably first need to be set up as "foreign
|
To run the programs, they probably first need to be set up as "foreign
|
||||||
symbols," with "disk" and "dir" set appropriately:
|
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"
|
$ 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-
|
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
|
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
|
rpng is a simple PNG viewer that can display transparent PNGs with a
|
||||||
specified background color; for example,
|
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
|
would display the image with a red background. rpng2 is a progressive
|
||||||
viewer that simulates a web browser in some respects; it can display
|
viewer that simulates a web browser in some respects; it can display
|
||||||
images against either a background color or a dynamically generated
|
images against either a background color or a dynamically generated
|
||||||
background image. For example:
|
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
|
wpng is a purely command-line image converter from binary PBMPLUS/NetPBM
|
||||||
format (.pgm or .ppm) to PNG; for example,
|
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-
|
would convert the specified PPM file (using redirection) to PNG, auto-
|
||||||
matically setting the PNG modification-time chunk.
|
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,21 +9,22 @@ $! Set locations where zlib and libpng sources live.
|
|||||||
$!
|
$!
|
||||||
$ zpath = ""
|
$ zpath = ""
|
||||||
$ pngpath = ""
|
$ 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("[---.zlib]zlib.h").nes."" then zpath = "[---.zlib]"
|
||||||
$ if f$search("[--]png.h").nes."" then pngpath = "[--]"
|
$ 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. ""
|
$ if zpath .eqs. ""
|
||||||
$ then
|
$ then
|
||||||
$ write sys$output "Zlib include not found. Exiting..."
|
$ write sys$output "zlib include not found. Exiting..."
|
||||||
$ exit 2
|
$ exit 2
|
||||||
$ endif
|
$ endif
|
||||||
$!
|
$!
|
||||||
$ if pngpath .eqs. ""
|
$ if pngpath .eqs. ""
|
||||||
$ then
|
$ then
|
||||||
$ write sys$output "Libpng include not found. Exiting..."
|
$ write sys$output "libpng include not found. Exiting..."
|
||||||
$ exit 2
|
$ exit 2
|
||||||
$ endif
|
$ endif
|
||||||
$!
|
$!
|
||||||
|
|||||||
@@ -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,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
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
|
be held liable for any damages arising in any way from the use of
|
||||||
this software.
|
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,
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
including commercial applications, and to alter it and redistribute
|
including commercial applications, and to alter it and redistribute
|
||||||
it freely, subject to the following restrictions:
|
it freely, subject to the following restrictions:
|
||||||
@@ -27,6 +34,23 @@
|
|||||||
and contributors for the book, "PNG: The Definitive Guide,"
|
and contributors for the book, "PNG: The Definitive Guide,"
|
||||||
published by O'Reilly and Associates.
|
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 <stdio.h>
|
||||||
@@ -69,7 +93,7 @@ int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight)
|
|||||||
* have used slightly more general png_sig_cmp() function instead */
|
* have used slightly more general png_sig_cmp() function instead */
|
||||||
|
|
||||||
fread(sig, 1, 8, infile);
|
fread(sig, 1, 8, infile);
|
||||||
if (!png_check_sig(sig, 8))
|
if (png_sig_cmp(sig, 0, 8))
|
||||||
return 1; /* bad signature */
|
return 1; /* bad signature */
|
||||||
|
|
||||||
|
|
||||||
@@ -239,7 +263,8 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
|
|||||||
return NULL;
|
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 */
|
/* 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,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
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
|
be held liable for any damages arising in any way from the use of
|
||||||
this software.
|
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,
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
including commercial applications, and to alter it and redistribute
|
including commercial applications, and to alter it and redistribute
|
||||||
it freely, subject to the following restrictions:
|
it freely, subject to the following restrictions:
|
||||||
@@ -27,6 +34,23 @@
|
|||||||
and contributors for the book, "PNG: The Definitive Guide,"
|
and contributors for the book, "PNG: The Definitive Guide,"
|
||||||
published by O'Reilly and Associates.
|
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
|
#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,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
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
|
be held liable for any damages arising in any way from the use of
|
||||||
this software.
|
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,
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
including commercial applications, and to alter it and redistribute
|
including commercial applications, and to alter it and redistribute
|
||||||
it freely, subject to the following restrictions:
|
it freely, subject to the following restrictions:
|
||||||
@@ -27,12 +34,31 @@
|
|||||||
and contributors for the book, "PNG: The Definitive Guide,"
|
and contributors for the book, "PNG: The Definitive Guide,"
|
||||||
published by O'Reilly and Associates.
|
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 <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 */
|
#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)
|
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);
|
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);
|
ZLIB_VERSION, zlib_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +87,7 @@ void readpng2_version_info(void)
|
|||||||
|
|
||||||
int readpng2_check_sig(uch *sig, int num)
|
int readpng2_check_sig(uch *sig, int num)
|
||||||
{
|
{
|
||||||
return png_check_sig(sig, num);
|
return !png_sig_cmp(sig, 0, num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -105,12 +131,45 @@ 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 libpng
|
||||||
|
* version recognizes more chunks, add them to this list. If a
|
||||||
|
* future version of readpng2.c recognizes more chunks, delete them
|
||||||
|
* from this list. */
|
||||||
|
static /* const */ png_byte chunks_to_ignore[] = {
|
||||||
|
99, 72, 82, 77, '\0', /* cHRM */
|
||||||
|
104, 73, 83, 84, '\0', /* hIST */
|
||||||
|
105, 67, 67, 80, '\0', /* iCCP */
|
||||||
|
105, 84, 88, 116, '\0', /* iTXt */
|
||||||
|
111, 70, 70, 115, '\0', /* oFFs */
|
||||||
|
112, 67, 65, 76, '\0', /* pCAL */
|
||||||
|
112, 72, 89, 115, '\0', /* pHYs */
|
||||||
|
115, 66, 73, 84, '\0', /* sBIT */
|
||||||
|
115, 67, 65, 76, '\0', /* sCAL */
|
||||||
|
115, 80, 76, 84, '\0', /* sPLT */
|
||||||
|
115, 84, 69, 82, '\0', /* sTER */
|
||||||
|
116, 69, 88, 116, '\0', /* tEXt */
|
||||||
|
116, 73, 77, 69, '\0', /* tIME */
|
||||||
|
122, 84, 88, 116, '\0' /* zTXt */
|
||||||
|
};
|
||||||
|
|
||||||
|
png_set_keep_unknown_chunks(png_ptr, 1 /* PNG_HANDLE_CHUNK_NEVER */,
|
||||||
|
chunks_to_ignore, sizeof(chunks_to_ignore)/5);
|
||||||
|
}
|
||||||
|
#endif /* PNG_HANDLE_AS_UNKNOWN_SUPPORTED */
|
||||||
|
|
||||||
|
|
||||||
/* instead of doing png_init_io() here, now we set up our callback
|
/* instead of doing png_init_io() here, now we set up our callback
|
||||||
* functions for progressive decoding */
|
* functions for progressive decoding */
|
||||||
|
|
||||||
png_set_progressive_read_fn(png_ptr, mainprog_ptr,
|
png_set_progressive_read_fn(png_ptr, mainprog_ptr,
|
||||||
readpng2_info_callback, readpng2_row_callback, readpng2_end_callback);
|
readpng2_info_callback, readpng2_row_callback, readpng2_end_callback);
|
||||||
|
|
||||||
|
|
||||||
/* make sure we save our pointers for use in readpng2_decode_data() */
|
/* make sure we save our pointers for use in readpng2_decode_data() */
|
||||||
|
|
||||||
mainprog_ptr->png_ptr = png_ptr;
|
mainprog_ptr->png_ptr = png_ptr;
|
||||||
@@ -158,7 +217,12 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
|
|||||||
{
|
{
|
||||||
mainprog_info *mainprog_ptr;
|
mainprog_info *mainprog_ptr;
|
||||||
int color_type, bit_depth;
|
int color_type, bit_depth;
|
||||||
|
png_uint_32 width, height;
|
||||||
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
double gamma;
|
double gamma;
|
||||||
|
#else
|
||||||
|
png_fixed_point gamma;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* setjmp() doesn't make sense here, because we'd either have to exit(),
|
/* setjmp() doesn't make sense here, because we'd either have to exit(),
|
||||||
@@ -193,8 +257,10 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
|
|||||||
|
|
||||||
/* this is just like in the non-progressive case */
|
/* this is just like in the non-progressive case */
|
||||||
|
|
||||||
png_get_IHDR(png_ptr, info_ptr, &mainprog_ptr->width,
|
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
||||||
&mainprog_ptr->height, &bit_depth, &color_type, NULL, NULL, NULL);
|
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
|
/* since we know we've read all of the PNG file's "header" (i.e., up
|
||||||
@@ -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
|
* "gamma" value for the entire display system, i.e., the product of
|
||||||
* LUT_exponent and CRT_exponent. */
|
* LUT_exponent and CRT_exponent. */
|
||||||
|
|
||||||
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
if (png_get_gAMA(png_ptr, info_ptr, &gamma))
|
if (png_get_gAMA(png_ptr, info_ptr, &gamma))
|
||||||
png_set_gamma(png_ptr, mainprog_ptr->display_exponent, gamma);
|
png_set_gamma(png_ptr, mainprog_ptr->display_exponent, gamma);
|
||||||
else
|
else
|
||||||
png_set_gamma(png_ptr, mainprog_ptr->display_exponent, 0.45455);
|
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 */
|
/* 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);
|
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);
|
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,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
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
|
be held liable for any damages arising in any way from the use of
|
||||||
this software.
|
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,
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
including commercial applications, and to alter it and redistribute
|
including commercial applications, and to alter it and redistribute
|
||||||
it freely, subject to the following restrictions:
|
it freely, subject to the following restrictions:
|
||||||
@@ -27,6 +34,23 @@
|
|||||||
and contributors for the book, "PNG: The Definitive Guide,"
|
and contributors for the book, "PNG: The Definitive Guide,"
|
||||||
published by O'Reilly and Associates.
|
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
|
#ifndef TRUE
|
||||||
@@ -45,6 +69,12 @@
|
|||||||
# define Trace(x) ;
|
# define Trace(x) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
enum rpng2_states {
|
||||||
|
kPreInit = 0,
|
||||||
|
kWindowInit,
|
||||||
|
kDone
|
||||||
|
};
|
||||||
|
|
||||||
typedef unsigned char uch;
|
typedef unsigned char uch;
|
||||||
typedef unsigned short ush;
|
typedef unsigned short ush;
|
||||||
typedef unsigned long ulg;
|
typedef unsigned long ulg;
|
||||||
@@ -66,12 +96,7 @@ typedef struct _mainprog_info {
|
|||||||
int rowbytes;
|
int rowbytes;
|
||||||
int channels;
|
int channels;
|
||||||
int need_bgcolor;
|
int need_bgcolor;
|
||||||
#if (defined(__i386__) || defined(_M_IX86))
|
int state;
|
||||||
int nommxfilters;
|
|
||||||
int nommxcombine;
|
|
||||||
int nommxinterlace;
|
|
||||||
#endif
|
|
||||||
int done;
|
|
||||||
uch bg_red;
|
uch bg_red;
|
||||||
uch bg_green;
|
uch bg_green;
|
||||||
uch bg_blue;
|
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).
|
with a little tweaking (or maybe not).
|
||||||
|
|
||||||
to do:
|
to do:
|
||||||
- stdout/stderr don't work! need message window (maybe scrollable?)
|
|
||||||
- handle quoted command-line args (especially filenames with spaces)
|
- handle quoted command-line args (especially filenames with spaces)
|
||||||
- have minimum window width: oh well
|
- have minimum window width: oh well
|
||||||
- use %.1023s to simplify truncation of title-bar string?
|
- use %.1023s to simplify truncation of title-bar string?
|
||||||
@@ -22,16 +21,26 @@
|
|||||||
match; switched to png_jmpbuf() macro
|
match; switched to png_jmpbuf() macro
|
||||||
- 1.02: added extra set of parentheses to png_jmpbuf() macro; fixed
|
- 1.02: added extra set of parentheses to png_jmpbuf() macro; fixed
|
||||||
command-line parsing bug
|
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,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
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
|
be held liable for any damages arising in any way from the use of
|
||||||
this software.
|
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,
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
including commercial applications, and to alter it and redistribute
|
including commercial applications, and to alter it and redistribute
|
||||||
it freely, subject to the following restrictions:
|
it freely, subject to the following restrictions:
|
||||||
@@ -48,17 +57,61 @@
|
|||||||
and contributors for the book, "PNG: The Definitive Guide,"
|
and contributors for the book, "PNG: The Definitive Guide,"
|
||||||
published by O'Reilly and Associates.
|
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 PROGNAME "rpng-win"
|
||||||
#define LONGNAME "Simple PNG Viewer for Windows"
|
#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 <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <windows.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 */
|
/* #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);
|
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 *progname = PROGNAME;
|
||||||
static char *appname = LONGNAME;
|
static char *appname = LONGNAME;
|
||||||
static char *icon_name = PROGNAME; /* GRR: not (yet) used */
|
|
||||||
static char *filename;
|
static char *filename;
|
||||||
static FILE *infile;
|
static FILE *infile;
|
||||||
|
|
||||||
@@ -127,8 +179,19 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
|
|
||||||
filename = (char *)NULL;
|
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 product of the CRT exponent and the exponent corresponding to
|
||||||
* the frame-buffer's lookup table (LUT), if any. This is not an
|
* 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
|
* 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;
|
++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);
|
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
|
||||||
++error;
|
++error;
|
||||||
} else {
|
} else {
|
||||||
@@ -251,8 +348,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
fprintf(stderr, PROGNAME
|
fprintf(stderr, PROGNAME
|
||||||
": [%s] has bad IHDR (libpng longjmp)\n",
|
": [%s] has bad IHDR (libpng longjmp)\n", filename);
|
||||||
filename);
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
fprintf(stderr, PROGNAME ": insufficient memory\n");
|
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) {
|
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);
|
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
||||||
readpng_version_info();
|
#ifndef __CYGWIN__
|
||||||
fprintf(stderr, "\n"
|
fprintf(stderr,
|
||||||
"Usage: %s [-gamma exp] [-bgcolor bg] file.png\n"
|
"\n [console window: closing this window will terminate %s]\n\n",
|
||||||
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
PROGNAME);
|
||||||
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
#endif
|
||||||
"\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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -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
|
* check for one in the PNG file--if not, the initialized values of 0
|
||||||
* (black) will be used */
|
* (black) will be used */
|
||||||
|
|
||||||
if (have_bg)
|
if (have_bg) {
|
||||||
sscanf(bgstr+1, "%2x%2x%2x", &bg_red, &bg_green, &bg_blue);
|
unsigned r, g, b; /* this approach quiets compiler warnings */
|
||||||
else if (readpng_get_bgcolor(&bg_red, &bg_green, &bg_blue) > 1) {
|
|
||||||
|
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);
|
readpng_cleanup(TRUE);
|
||||||
fprintf(stderr, PROGNAME
|
fprintf(stderr, PROGNAME
|
||||||
": libpng error while checking for background color\n");
|
": 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 */
|
/* wait for the user to tell us when to quit */
|
||||||
|
|
||||||
printf(
|
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);
|
fflush(stdout);
|
||||||
|
|
||||||
while (GetMessage(&msg, NULL, 0, 0)) {
|
while (GetMessage(&msg, NULL, 0, 0)) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
by Martin Zinser under OpenVMS; may work under OS/2 with some tweaking).
|
by Martin Zinser under OpenVMS; may work under OS/2 with some tweaking).
|
||||||
|
|
||||||
to do:
|
to do:
|
||||||
- 8-bit support
|
- 8-bit (colormapped) X support
|
||||||
- use %.1023s to simplify truncation of title-bar string?
|
- 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.10: added support for non-default visuals; fixed X pixel-conversion
|
||||||
- 1.11: added extra set of parentheses to png_jmpbuf() macro; fixed
|
- 1.11: added extra set of parentheses to png_jmpbuf() macro; fixed
|
||||||
command-line parsing bug
|
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,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
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
|
be held liable for any damages arising in any way from the use of
|
||||||
this software.
|
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,
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
including commercial applications, and to alter it and redistribute
|
including commercial applications, and to alter it and redistribute
|
||||||
it freely, subject to the following restrictions:
|
it freely, subject to the following restrictions:
|
||||||
@@ -47,11 +59,30 @@
|
|||||||
and contributors for the book, "PNG: The Definitive Guide,"
|
and contributors for the book, "PNG: The Definitive Guide,"
|
||||||
published by O'Reilly and Associates.
|
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 PROGNAME "rpng-x"
|
||||||
#define LONGNAME "Simple PNG Viewer for 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 <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -89,6 +120,8 @@ static int rpng_x_msb(ulg u32val);
|
|||||||
static char titlebar[1024], *window_name = titlebar;
|
static char titlebar[1024], *window_name = titlebar;
|
||||||
static char *appname = LONGNAME;
|
static char *appname = LONGNAME;
|
||||||
static char *icon_name = PROGNAME;
|
static char *icon_name = PROGNAME;
|
||||||
|
static char *res_name = RESNAME;
|
||||||
|
static char *res_class = RESCLASS;
|
||||||
static char *filename;
|
static char *filename;
|
||||||
static FILE *infile;
|
static FILE *infile;
|
||||||
|
|
||||||
@@ -117,6 +150,7 @@ static Colormap colormap;
|
|||||||
static int have_nondefault_visual = FALSE;
|
static int have_nondefault_visual = FALSE;
|
||||||
static int have_colormap = FALSE;
|
static int have_colormap = FALSE;
|
||||||
static int have_window = FALSE;
|
static int have_window = FALSE;
|
||||||
|
static int have_gc = FALSE;
|
||||||
/*
|
/*
|
||||||
ulg numcolors=0, pixels[256];
|
ulg numcolors=0, pixels[256];
|
||||||
ush reds[256], greens[256], blues[256];
|
ush reds[256], greens[256], blues[256];
|
||||||
@@ -232,9 +266,33 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filename) {
|
if (!filename)
|
||||||
++error;
|
++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);
|
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
|
||||||
++error;
|
++error;
|
||||||
} else {
|
} else {
|
||||||
@@ -247,8 +305,7 @@ int main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
fprintf(stderr, PROGNAME
|
fprintf(stderr, PROGNAME
|
||||||
": [%s] has bad IHDR (libpng longjmp)\n",
|
": [%s] has bad IHDR (libpng longjmp)\n", filename);
|
||||||
filename);
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
fprintf(stderr, PROGNAME ": insufficient memory\n");
|
fprintf(stderr, PROGNAME ": insufficient memory\n");
|
||||||
@@ -273,25 +330,9 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* usage screen */
|
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
fprintf(stderr, PROGNAME ": aborting.\n");
|
||||||
readpng_version_info();
|
exit(2);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -396,11 +437,12 @@ static int rpng_x_create_window(void)
|
|||||||
XEvent e;
|
XEvent e;
|
||||||
XGCValues gcvalues;
|
XGCValues gcvalues;
|
||||||
XSetWindowAttributes attr;
|
XSetWindowAttributes attr;
|
||||||
XSizeHints *size_hints;
|
|
||||||
XTextProperty windowName, *pWindowName = &windowName;
|
XTextProperty windowName, *pWindowName = &windowName;
|
||||||
XTextProperty iconName, *pIconName = &iconName;
|
XTextProperty iconName, *pIconName = &iconName;
|
||||||
XVisualInfo visual_info;
|
XVisualInfo visual_info;
|
||||||
|
XSizeHints *size_hints;
|
||||||
XWMHints *wm_hints;
|
XWMHints *wm_hints;
|
||||||
|
XClassHint *class_hints;
|
||||||
|
|
||||||
|
|
||||||
screen = DefaultScreen(display);
|
screen = DefaultScreen(display);
|
||||||
@@ -523,7 +565,7 @@ static int rpng_x_create_window(void)
|
|||||||
if (!XStringListToTextProperty(&icon_name, 1, pIconName))
|
if (!XStringListToTextProperty(&icon_name, 1, pIconName))
|
||||||
pIconName = NULL;
|
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) {
|
if ((size_hints = XAllocSizeHints()) != NULL) {
|
||||||
/* window will not be resizable */
|
/* window will not be resizable */
|
||||||
@@ -539,12 +581,30 @@ static int rpng_x_create_window(void)
|
|||||||
wm_hints->flags = StateHint | InputHint /* | IconPixmapHint */ ;
|
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,
|
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);
|
XMapWindow(display, window);
|
||||||
|
|
||||||
gc = XCreateGC(display, window, 0, &gcvalues);
|
gc = XCreateGC(display, window, 0, &gcvalues);
|
||||||
|
have_gc = TRUE;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
Fill window with the specified background color.
|
Fill window with the specified background color.
|
||||||
@@ -814,7 +874,8 @@ static void rpng_x_cleanup(void)
|
|||||||
ximage = NULL;
|
ximage = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
XFreeGC(display, gc);
|
if (have_gc)
|
||||||
|
XFreeGC(display, gc);
|
||||||
|
|
||||||
if (have_window)
|
if (have_window)
|
||||||
XDestroyWindow(display, window);
|
XDestroyWindow(display, window);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
tweaking (or maybe not). Thanks to Adam Costello and Pieter S. van der
|
tweaking (or maybe not). Thanks to Adam Costello and Pieter S. van der
|
||||||
Meulen for the "diamond" and "radial waves" patterns, respectively.
|
Meulen for the "diamond" and "radial waves" patterns, respectively.
|
||||||
|
|
||||||
to do:
|
to do (someday, maybe):
|
||||||
- handle quoted command-line args (especially filenames with spaces)
|
- handle quoted command-line args (especially filenames with spaces)
|
||||||
- finish resizable checkerboard-gradient (sizes 4-128?)
|
- finish resizable checkerboard-gradient (sizes 4-128?)
|
||||||
- use %.1023s to simplify truncation of title-bar string?
|
- use %.1023s to simplify truncation of title-bar string?
|
||||||
@@ -24,18 +24,32 @@
|
|||||||
- 1.03: modified to allow abbreviated options
|
- 1.03: modified to allow abbreviated options
|
||||||
- 1.04: removed bogus extra argument from usage fprintf() [Glenn R-P?];
|
- 1.04: removed bogus extra argument from usage fprintf() [Glenn R-P?];
|
||||||
fixed command-line parsing bug
|
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.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,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
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
|
be held liable for any damages arising in any way from the use of
|
||||||
this software.
|
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,
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
including commercial applications, and to alter it and redistribute
|
including commercial applications, and to alter it and redistribute
|
||||||
it freely, subject to the following restrictions:
|
it freely, subject to the following restrictions:
|
||||||
@@ -52,11 +66,28 @@
|
|||||||
and contributors for the book, "PNG: The Definitive Guide,"
|
and contributors for the book, "PNG: The Definitive Guide,"
|
||||||
published by O'Reilly and Associates.
|
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 PROGNAME "rpng2-win"
|
||||||
#define LONGNAME "Progressive PNG Viewer for Windows"
|
#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 <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -65,7 +96,33 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <math.h> /* only for PvdM background code */
|
#include <math.h> /* only for PvdM background code */
|
||||||
#include <windows.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() */
|
#include <conio.h> /* only for _getch() */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* all for PvdM background code: */
|
/* all for PvdM background code: */
|
||||||
#ifndef PI
|
#ifndef PI
|
||||||
@@ -118,10 +175,9 @@ static void rpng2_win_cleanup(void);
|
|||||||
LRESULT CALLBACK rpng2_win_wndproc(HWND, UINT, WPARAM, LPARAM);
|
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 *progname = PROGNAME;
|
||||||
static char *appname = LONGNAME;
|
static char *appname = LONGNAME;
|
||||||
static char *icon_name = PROGNAME; /* GRR: not (yet) used */
|
|
||||||
static char *filename;
|
static char *filename;
|
||||||
static FILE *infile;
|
static FILE *infile;
|
||||||
|
|
||||||
@@ -240,7 +296,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
filename = (char *)NULL;
|
filename = (char *)NULL;
|
||||||
memset(&rpng2_info, 0, sizeof(mainprog_info));
|
memset(&rpng2_info, 0, sizeof(mainprog_info));
|
||||||
|
|
||||||
|
#ifndef __CYGWIN__
|
||||||
/* Next reenable console output, which normally goes to the bit bucket
|
/* Next reenable console output, which normally goes to the bit bucket
|
||||||
* for windowed apps. Closing the console window will terminate the
|
* for windowed apps. Closing the console window will terminate the
|
||||||
* app. Thanks to David.Geldreich@realviz.com for supplying the magical
|
* 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();
|
AllocConsole();
|
||||||
freopen("CONOUT$", "a", stderr);
|
freopen("CONOUT$", "a", stderr);
|
||||||
freopen("CONOUT$", "a", stdout);
|
freopen("CONOUT$", "a", stdout);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Set the default value for our display-system exponent, i.e., the
|
/* Set the default value for our display-system exponent, i.e., the
|
||||||
* product of the CRT exponent and the exponent corresponding to
|
* 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)) {
|
} else if (!strncmp(*argv, "-timing", 2)) {
|
||||||
timing = TRUE;
|
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 {
|
} else {
|
||||||
if (**argv != '-') {
|
if (**argv != '-') {
|
||||||
filename = *argv;
|
filename = *argv;
|
||||||
@@ -388,9 +432,56 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filename) {
|
if (!filename)
|
||||||
++error;
|
++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);
|
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
|
||||||
++error;
|
++error;
|
||||||
} else {
|
} else {
|
||||||
@@ -404,8 +495,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
switch (rc) {
|
switch (rc) {
|
||||||
case 2:
|
case 2:
|
||||||
fprintf(stderr, PROGNAME
|
fprintf(stderr, PROGNAME
|
||||||
": [%s] has bad IHDR (libpng longjmp)\n",
|
": [%s] has bad IHDR (libpng longjmp)\n", filename);
|
||||||
filename);
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
fprintf(stderr, PROGNAME ": insufficient memory\n");
|
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) {
|
if (error) {
|
||||||
|
#ifndef __CYGWIN__
|
||||||
int ch;
|
int ch;
|
||||||
|
#endif
|
||||||
|
|
||||||
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
|
fprintf(stderr, PROGNAME ": aborting.\n");
|
||||||
readpng2_version_info();
|
#ifndef __CYGWIN__
|
||||||
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);
|
|
||||||
do
|
do
|
||||||
ch = _getch();
|
ch = _getch();
|
||||||
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
||||||
exit(1);
|
#endif
|
||||||
|
exit(2);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
||||||
|
#ifndef __CYGWIN__
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"\n [console window: closing this window will terminate %s]\n\n",
|
"\n [console window: closing this window will terminate %s]\n\n",
|
||||||
PROGNAME);
|
PROGNAME);
|
||||||
|
#endif
|
||||||
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -491,7 +557,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
} else
|
} else
|
||||||
rpng2_info.need_bgcolor = TRUE;
|
rpng2_info.need_bgcolor = TRUE;
|
||||||
|
|
||||||
rpng2_info.done = FALSE;
|
rpng2_info.state = kPreInit;
|
||||||
rpng2_info.mainprog_init = rpng2_win_init;
|
rpng2_info.mainprog_init = rpng2_win_init;
|
||||||
rpng2_info.mainprog_display_row = rpng2_win_display_row;
|
rpng2_info.mainprog_display_row = rpng2_win_display_row;
|
||||||
rpng2_info.mainprog_finish_display = rpng2_win_finish_display;
|
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))
|
if (readpng2_decode_data(&rpng2_info, inbuf, incount))
|
||||||
++error;
|
++error;
|
||||||
Trace((stderr, "done with readpng2_decode_data()\n"))
|
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;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (timing)
|
if (timing)
|
||||||
Sleep(1000L);
|
Sleep(1000L);
|
||||||
|
|
||||||
incount = fread(inbuf, 1, INBUFSIZE, infile);
|
incount = fread(inbuf, 1, INBUFSIZE, infile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -561,7 +644,7 @@ static void rpng2_win_init()
|
|||||||
ulg rowbytes = rpng2_info.rowbytes;
|
ulg rowbytes = rpng2_info.rowbytes;
|
||||||
|
|
||||||
Trace((stderr, "beginning rpng2_win_init()\n"))
|
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, " width = %ld\n", rpng2_info.width))
|
||||||
Trace((stderr, " height = %ld\n", rpng2_info.height))
|
Trace((stderr, " height = %ld\n", rpng2_info.height))
|
||||||
|
|
||||||
@@ -591,6 +674,8 @@ static void rpng2_win_init()
|
|||||||
readpng2_cleanup(&rpng2_info);
|
readpng2_cleanup(&rpng2_info);
|
||||||
return;
|
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
|
* we have nothing to do here except set a flag and let the user know
|
||||||
* that the image is done */
|
* that the image is done */
|
||||||
|
|
||||||
rpng2_info.done = TRUE;
|
rpng2_info.state = kDone;
|
||||||
printf(
|
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);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,10 @@
|
|||||||
This program converts certain NetPBM binary files (grayscale and RGB,
|
This program converts certain NetPBM binary files (grayscale and RGB,
|
||||||
maxval = 255) to PNG. Non-interlaced PNGs are written progressively;
|
maxval = 255) to PNG. Non-interlaced PNGs are written progressively;
|
||||||
interlaced PNGs are read and written in one memory-intensive blast.
|
interlaced PNGs are read and written in one memory-intensive blast.
|
||||||
|
|
||||||
Thanks to Jean-loup Gailly for providing the necessary trick to read
|
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)
|
NOTE: includes provisional support for PNM type "8" (portable alphamap)
|
||||||
images, presumed to be a 32-bit interleaved RGBA format; no pro-
|
images, presumed to be a 32-bit interleaved RGBA format; no pro-
|
||||||
@@ -24,16 +26,32 @@
|
|||||||
- 1.02: modified to allow abbreviated options
|
- 1.02: modified to allow abbreviated options
|
||||||
- 1.03: removed extraneous character from usage screen; fixed bug in
|
- 1.03: removed extraneous character from usage screen; fixed bug in
|
||||||
command-line parsing
|
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,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
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
|
be held liable for any damages arising in any way from the use of
|
||||||
this software.
|
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,
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
including commercial applications, and to alter it and redistribute
|
including commercial applications, and to alter it and redistribute
|
||||||
it freely, subject to the following restrictions:
|
it freely, subject to the following restrictions:
|
||||||
@@ -50,16 +68,35 @@
|
|||||||
and contributors for the book, "PNG: The Definitive Guide,"
|
and contributors for the book, "PNG: The Definitive Guide,"
|
||||||
published by O'Reilly and Associates.
|
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 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"
|
#define APPNAME "Simple PGM/PPM/PAM to PNG Converter"
|
||||||
|
|
||||||
#if defined(__MSDOS__) || defined(__OS2__)
|
#if defined(__MSDOS__) || defined(__OS2__)
|
||||||
# define DOS_OS2_W32
|
# define DOS_OS2_W32
|
||||||
#elif defined(_WIN32) || defined(__WIN32__)
|
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
||||||
# define DOS_OS2_W32
|
# ifndef __GNUC__ /* treat Win32 native ports of gcc as Unix environments */
|
||||||
|
# define DOS_OS2_W32
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#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,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
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
|
be held liable for any damages arising in any way from the use of
|
||||||
this software.
|
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,
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
including commercial applications, and to alter it and redistribute
|
including commercial applications, and to alter it and redistribute
|
||||||
it freely, subject to the following restrictions:
|
it freely, subject to the following restrictions:
|
||||||
@@ -27,6 +34,23 @@
|
|||||||
and contributors for the book, "PNG: The Definitive Guide,"
|
and contributors for the book, "PNG: The Definitive Guide,"
|
||||||
published by O'Reilly and Associates.
|
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
|
||||||
|
|
||||||
---------------------------------------------------------------------------*/
|
---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
@@ -80,7 +104,8 @@ int writepng_init(mainprog_info *mainprog_ptr)
|
|||||||
/* setjmp() must be called in every function that calls a PNG-writing
|
/* setjmp() must be called in every function that calls a PNG-writing
|
||||||
* libpng function, unless an alternate error handler was installed--
|
* libpng function, unless an alternate error handler was installed--
|
||||||
* but compatible error handlers must either use longjmp() themselves
|
* 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)) {
|
if (setjmp(mainprog_ptr->jmpbuf)) {
|
||||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||||
@@ -364,5 +389,12 @@ static void writepng_error_handler(png_structp png_ptr, png_const_charp msg)
|
|||||||
exit(99);
|
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);
|
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,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
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
|
be held liable for any damages arising in any way from the use of
|
||||||
this software.
|
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,
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
including commercial applications, and to alter it and redistribute
|
including commercial applications, and to alter it and redistribute
|
||||||
it freely, subject to the following restrictions:
|
it freely, subject to the following restrictions:
|
||||||
@@ -27,6 +34,23 @@
|
|||||||
and contributors for the book, "PNG: The Definitive Guide,"
|
and contributors for the book, "PNG: The Definitive Guide,"
|
||||||
published by O'Reilly and Associates.
|
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
|
#ifndef TRUE
|
||||||
|
|||||||
@@ -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>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
4
contrib/pngminim/README
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
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.
|
||||||
149
contrib/pngminim/decoder/makefile
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
# Makefile for PngMinus (pngm2pnm)
|
||||||
|
# Linux / Unix
|
||||||
|
|
||||||
|
#CC=cc
|
||||||
|
CC=gcc
|
||||||
|
LD=$(CC)
|
||||||
|
STRIP=strip
|
||||||
|
|
||||||
|
# If awk fails try
|
||||||
|
# make AWK=nawk
|
||||||
|
|
||||||
|
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)
|
||||||
|
$(STRIP) pngm2pnm$(E)
|
||||||
|
|
||||||
|
# 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
|
||||||
39
contrib/pngminim/decoder/pngusr.dfa
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# pngminim/decoder/pngusr.dfa
|
||||||
|
#
|
||||||
|
# Copyright (c) 2010 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_16_TO_8 on
|
||||||
23
contrib/pngminim/decoder/pngusr.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/* minrdpngconf.h: headers to make a minimal png-read-only library
|
||||||
|
*
|
||||||
|
* Copyright (c) 2007, 2010 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
|
||||||
|
|
||||||
|
#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.
|
||||||
148
contrib/pngminim/encoder/makefile
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
# Makefile for PngMinus (pnm2pngm)
|
||||||
|
# Linux / Unix
|
||||||
|
|
||||||
|
#CC=cc
|
||||||
|
CC=gcc
|
||||||
|
LD=$(CC)
|
||||||
|
STRIP=strip
|
||||||
|
|
||||||
|
# If awk fails try
|
||||||
|
# make AWK=nawk
|
||||||
|
|
||||||
|
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)
|
||||||
|
$(STRIP) pnm2pngm$(E)
|
||||||
|
|
||||||
|
# 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 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
|
||||||
23
contrib/pngminim/encoder/pngusr.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/* minwrpngconf.h: headers to make a minimal png-write-only library
|
||||||
|
*
|
||||||
|
* Copyright (c) 2007, 2010 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
|
||||||
|
|
||||||
|
#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.
|
||||||
164
contrib/pngminim/preader/makefile
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
# Makefile for PngMinus (rpng2)
|
||||||
|
# Linux / Unix
|
||||||
|
|
||||||
|
#CC=cc
|
||||||
|
CC=gcc
|
||||||
|
LD=$(CC)
|
||||||
|
STRIP=strip
|
||||||
|
|
||||||
|
# If awk fails try
|
||||||
|
# make AWK=nawk
|
||||||
|
|
||||||
|
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)
|
||||||
|
$(STRIP) rpng2-x$(E)
|
||||||
|
|
||||||
|
# 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 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_16_TO_8 on
|
||||||
|
option READ_GRAY_TO_RGB on
|
||||||
23
contrib/pngminim/preader/pngusr.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/* minrdpngconf.h: headers to make a minimal png-read-only library
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009, 2010 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
|
||||||
|
|
||||||
|
#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
|
pnmtopng / pngtopnm utilities. Independantly Alexander Lehmann and I
|
||||||
(Willem van Schaik) started such a project. Luckily we discovered this
|
(Willem van Schaik) started such a project. Luckily we discovered this
|
||||||
and merged the two together into pnmtopng.tar.gz, which is available
|
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
|
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
|
features of PNG, like gamma, alpha, sbit, text-chunks, etc. This makes
|
||||||
|
|||||||
@@ -1,26 +1,31 @@
|
|||||||
# Makefile for PngMinus (png2pnm and pnm2png)
|
# Makefile for PngMinus (png2pnm and pnm2png)
|
||||||
# Linux / Unix
|
# Linux / Unix
|
||||||
|
|
||||||
CC=cc -O
|
#CC=cc
|
||||||
LD=cc -O
|
CC=gcc
|
||||||
#CC=gcc -O
|
LD=$(CC)
|
||||||
#LD=gcc -O
|
|
||||||
LB=ar
|
|
||||||
RM=rm
|
|
||||||
CP=cp
|
|
||||||
|
|
||||||
PNGPATH = /usr/local
|
RM=rm -f
|
||||||
PNGINC = $(PNGPATH)/include
|
|
||||||
#PNGLIB = $(PNGPATH)/lib -lpng
|
|
||||||
PNGLIB = $(PNGPATH)/lib/libpng.a
|
|
||||||
|
|
||||||
ZPATH = /usr/local
|
#PNGPATH = /usr/local
|
||||||
ZINC = $(ZPATH)/include
|
#PNGINC = -I$(PNGPATH)/include/libpng12
|
||||||
#ZLIB = $(ZPATH)/lib -lz
|
#PNGLIB = -L$(PNGPATH)/lib -lpng12
|
||||||
ZLIB = $(ZPATH)/lib/libz.a
|
#PNGLIBS = $(PNGPATH)/lib/libpng12.a
|
||||||
|
PNGINC = -I../..
|
||||||
|
PNGLIB = -L../.. -lpng
|
||||||
|
PNGLIBS = ../../libpng.a
|
||||||
|
|
||||||
CCFLAGS=-I$(PNGINC) -I$(ZINC)
|
#ZPATH = /usr/local
|
||||||
LDFLAGS=-L$(PNGLIB) -L$(ZLIB)
|
#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=-O3 $(PNGINC) $(ZINC)
|
||||||
|
LDFLAGS=$(PNGLIB) $(ZLIB)
|
||||||
|
LDFLAGSS=$(PNGLIBS) $(ZLIBS)
|
||||||
C=.c
|
C=.c
|
||||||
O=.o
|
O=.o
|
||||||
L=.a
|
L=.a
|
||||||
@@ -28,25 +33,33 @@ E=
|
|||||||
|
|
||||||
# dependencies
|
# 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)
|
png2pnm$(O): png2pnm$(C)
|
||||||
$(CC) -c $(CCFLAGS) png2pnm$(C)
|
$(CC) -c $(CFLAGS) png2pnm$(C)
|
||||||
|
|
||||||
png2pnm$(E): png2pnm$(O)
|
png2pnm$(E): png2pnm$(O)
|
||||||
$(LD) -o png2pnm$(E) png2pnm$(O) $(LDFLAGS) -lpng -lz -lm
|
$(LD) -o png2pnm$(E) png2pnm$(O) $(LDFLAGS) -lm
|
||||||
|
|
||||||
|
png2pnm-static$(E): png2pnm$(O)
|
||||||
|
$(LD) -o png2pnm-static$(E) png2pnm$(O) $(LDFLAGSS) -lm
|
||||||
|
|
||||||
pnm2png$(O): pnm2png$(C)
|
pnm2png$(O): pnm2png$(C)
|
||||||
$(CC) -c $(CCFLAGS) pnm2png$(C)
|
$(CC) -c $(CFLAGS) pnm2png$(C)
|
||||||
|
|
||||||
pnm2png$(E): pnm2png$(O)
|
pnm2png$(E): pnm2png$(O)
|
||||||
$(LD) -o pnm2png$(E) pnm2png$(O) $(LDFLAGS) -lpng -lz -lm
|
$(LD) -o pnm2png$(E) pnm2png$(O) $(LDFLAGS) -lm
|
||||||
|
|
||||||
|
pnm2png-static$(E): pnm2png$(O)
|
||||||
|
$(LD) -o pnm2png-static$(E) pnm2png$(O) $(LDFLAGSS) -lm
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) png2pnm$(O)
|
$(RM) png2pnm$(O)
|
||||||
$(RM) pnm2png$(O)
|
$(RM) pnm2png$(O)
|
||||||
$(RM) png2pnm$(E)
|
$(RM) png2pnm$(E)
|
||||||
$(RM) pnm2png$(E)
|
$(RM) pnm2png$(E)
|
||||||
|
$(RM) png2pnm-static$(E)
|
||||||
|
$(RM) pnm2png-static$(E)
|
||||||
|
|
||||||
# End of makefile for png2pnm / pnm2png
|
# End of makefile for png2pnm / pnm2png
|
||||||
|
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ void usage()
|
|||||||
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL alpha)
|
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL alpha)
|
||||||
{
|
{
|
||||||
png_struct *png_ptr = NULL;
|
png_struct *png_ptr = NULL;
|
||||||
png_info *info_ptr = NULL;
|
png_info *info_ptr = NULL;
|
||||||
png_byte buf[8];
|
png_byte buf[8];
|
||||||
png_byte *png_pixels = NULL;
|
png_byte *png_pixels = NULL;
|
||||||
png_byte **row_pointers = NULL;
|
png_byte **row_pointers = NULL;
|
||||||
@@ -211,8 +211,8 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
|||||||
if (ret != 8)
|
if (ret != 8)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
ret = png_check_sig (buf, 8);
|
ret = png_sig_cmp (buf, 0, 8);
|
||||||
if (!ret)
|
if (ret)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* create png and info structures */
|
/* create png and info structures */
|
||||||
@@ -381,7 +381,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
|||||||
fputc ((int) *pix_ptr++ , pnm_file);
|
fputc ((int) *pix_ptr++ , pnm_file);
|
||||||
else
|
else
|
||||||
if (bit_depth == 16){
|
if (bit_depth == 16){
|
||||||
dep_16 = (long) *pix_ptr++;
|
dep_16 = (long) *pix_ptr++;
|
||||||
fprintf (pnm_file, "%ld ", (dep_16 << 8) + ((long) *pix_ptr++));
|
fprintf (pnm_file, "%ld ", (dep_16 << 8) + ((long) *pix_ptr++));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -401,9 +401,9 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
|||||||
fputc ((int) *pix_ptr++ , alpha_file);
|
fputc ((int) *pix_ptr++ , alpha_file);
|
||||||
else
|
else
|
||||||
if (bit_depth == 16){
|
if (bit_depth == 16){
|
||||||
dep_16 = (long) *pix_ptr++;
|
dep_16 = (long) *pix_ptr++;
|
||||||
fprintf (alpha_file, "%ld ", (dep_16 << 8) + (long) *pix_ptr++);
|
fprintf (alpha_file, "%ld ", (dep_16 << 8) + (long) *pix_ptr++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fprintf (alpha_file, "%ld ", (long) *pix_ptr++);
|
fprintf (alpha_file, "%ld ", (long) *pix_ptr++);
|
||||||
}
|
}
|
||||||
|
|||||||
1
contrib/pngminus/png2pnm.sh
Executable file → Normal file
@@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
# -- grayscale
|
# -- grayscale
|
||||||
./png2pnm -noraw ../pngsuite/basn0g01.png basn0g01.pgm
|
./png2pnm -noraw ../pngsuite/basn0g01.png basn0g01.pgm
|
||||||
./png2pnm -noraw ../pngsuite/basn0g02.png basn0g02.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
|
make -f makefile.std
|
||||||
sh png2pnm.sh
|
sh png2pnm.sh
|
||||||
sh pnm2png.sh
|
sh pnm2png.sh
|
||||||
|
|||||||
1
contrib/pngminus/pnm2png.sh
Executable file → Normal file
@@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
# -- grayscale
|
# -- grayscale
|
||||||
./pnm2png basn0g01.pgm basn0g01.png
|
./pnm2png basn0g01.pgm basn0g01.png
|
||||||
./pnm2png basn0g02.pgm basn0g02.png
|
./pnm2png basn0g02.pgm basn0g02.png
|
||||||
|
|||||||
@@ -6,34 +6,51 @@ pngsuite
|
|||||||
Permission to use, copy, and distribute these images for any purpose and
|
Permission to use, copy, and distribute these images for any purpose and
|
||||||
without fee is hereby granted.
|
without fee is hereby granted.
|
||||||
|
|
||||||
These 15 images are part of the much larger PngSuite test-set of
|
The 15 "bas*.png" images are part of the much larger PngSuite test-set of
|
||||||
images, available for developers of PNG supporting software. The
|
images, available for developers of PNG supporting software. The
|
||||||
complete set, available at http:/www.schaik.com/pngsuite/, contains
|
complete set, available at http:/www.schaik.com/pngsuite/, contains
|
||||||
a variety of images to test interlacing, gamma settings, ancillary
|
a variety of images to test interlacing, gamma settings, ancillary
|
||||||
chunks, etc.
|
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:
|
The images in this directory represent the basic PNG color-types:
|
||||||
grayscale (1-16 bit deep), full color (8 or 16 bit), paletted
|
grayscale (1-16 bit deep), full color (8 or 16 bit), paletted
|
||||||
(1-8 bit) and grayscale or color images with alpha channel. You
|
(1-8 bit) and grayscale or color images with alpha channel. You
|
||||||
can use them to test the proper functioning of PNG software.
|
can use them to test the proper functioning of PNG software.
|
||||||
|
|
||||||
filename depth type
|
filename depth type
|
||||||
------------ ------ --------------
|
------------ ------ --------------
|
||||||
basn0g01.png 1-bit grayscale
|
basn0g01.png 1-bit grayscale
|
||||||
basn0g02.png 2-bit grayscale
|
basn0g02.png 2-bit grayscale
|
||||||
basn0g04.png 4-bit grayscale
|
basn0g04.png 4-bit grayscale
|
||||||
basn0g08.png 8-bit grayscale
|
basn0g08.png 8-bit grayscale
|
||||||
basn0g16.png 16-bit grayscale
|
basn0g16.png 16-bit grayscale
|
||||||
basn2c08.png 8-bit truecolor
|
basn2c08.png 8-bit truecolor
|
||||||
basn2c16.png 16-bit truecolor
|
basn2c16.png 16-bit truecolor
|
||||||
basn3p01.png 1-bit paletted
|
basn3p01.png 1-bit paletted
|
||||||
basn3p02.png 2-bit paletted
|
basn3p02.png 2-bit paletted
|
||||||
basn3p04.png 4-bit paletted
|
basn3p04.png 4-bit paletted
|
||||||
basn3p08.png 8-bit paletted
|
basn3p08.png 8-bit paletted
|
||||||
basn4a08.png 8-bit gray with alpha
|
basn4a08.png 8-bit gray with alpha
|
||||||
basn4a16.png 16-bit gray with alpha
|
basn4a16.png 16-bit gray with alpha
|
||||||
basn6a08.png 8-bit RGBA
|
basn6a08.png 8-bit RGBA
|
||||||
basn6a16.png 16-bit RGBA
|
basn6a16.png 16-bit RGBA
|
||||||
|
|
||||||
|
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 *.png" in
|
Here is the correct result of typing "pngtest -m *.png" in
|
||||||
this directory:
|
this directory:
|
||||||
|
|||||||
|
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/ftbbn1g04.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/ftbwn1g16.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
contrib/pngsuite/ftbwn3p08.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
contrib/pngsuite/ftbyn3p08.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
contrib/pngsuite/ftp0n1g08.png
Normal file
|
After Width: | Height: | Size: 719 B |
BIN
contrib/pngsuite/ftp0n2c08.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
contrib/pngsuite/ftp0n3p08.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
contrib/pngsuite/ftp1n3p08.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
@@ -2,8 +2,11 @@
|
|||||||
// PNGFILE.C -- Image File Functions
|
// PNGFILE.C -- Image File Functions
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
|
|
||||||
// Copyright 2000, Willem van Schaik. For conditions of distribution and
|
// Copyright 2000, Willem van Schaik.
|
||||||
// use, see the copyright/license/disclaimer notice in png.h
|
//
|
||||||
|
// This code is released under the libpng license.
|
||||||
|
// For conditions of distribution and use, see the disclaimer
|
||||||
|
// and license in png.h
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commdlg.h>
|
#include <commdlg.h>
|
||||||
@@ -32,7 +35,7 @@ png_cexcept_error(png_structp png_ptr, png_const_charp msg)
|
|||||||
{
|
{
|
||||||
if(png_ptr)
|
if(png_ptr)
|
||||||
;
|
;
|
||||||
#ifndef PNG_NO_CONSOLE_IO
|
#ifdef PNG_CONSOLE_IO_SUPPORTED
|
||||||
fprintf(stderr, "libpng error: %s\n", msg);
|
fprintf(stderr, "libpng error: %s\n", msg);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@@ -123,7 +126,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
// first check the eight byte PNG signature
|
// first check the eight byte PNG signature
|
||||||
|
|
||||||
fread(pbSig, 1, 8, pfFile);
|
fread(pbSig, 1, 8, pfFile);
|
||||||
if (!png_check_sig(pbSig, 8))
|
if (png_sig_cmp(pbSig, 0, 8))
|
||||||
{
|
{
|
||||||
*ppbImageData = pbImageData = NULL;
|
*ppbImageData = pbImageData = NULL;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -152,7 +155,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
|
|
||||||
// initialize the png structure
|
// initialize the png structure
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
#ifdef PNG_STDIO_SUPPORTED
|
||||||
png_init_io(png_ptr, pfFile);
|
png_init_io(png_ptr, pfFile);
|
||||||
#else
|
#else
|
||||||
png_set_read_fn(png_ptr, (png_voidp)pfFile, png_read_data);
|
png_set_read_fn(png_ptr, (png_voidp)pfFile, png_read_data);
|
||||||
@@ -321,7 +324,7 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
|||||||
{
|
{
|
||||||
// initialize the png structure
|
// initialize the png structure
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
#ifdef PNG_STDIO_SUPPORTED
|
||||||
png_init_io(png_ptr, pfFile);
|
png_init_io(png_ptr, pfFile);
|
||||||
#else
|
#else
|
||||||
png_set_write_fn(png_ptr, (png_voidp)pfFile, png_write_data, png_flush);
|
png_set_write_fn(png_ptr, (png_voidp)pfFile, png_write_data, png_flush);
|
||||||
@@ -370,14 +373,14 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
|||||||
|
|
||||||
// clean up after the write, and free any memory allocated
|
// clean up after the write, and free any memory allocated
|
||||||
|
|
||||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
|
||||||
|
|
||||||
// yepp, done
|
// yepp, done
|
||||||
}
|
}
|
||||||
|
|
||||||
Catch (msg)
|
Catch (msg)
|
||||||
{
|
{
|
||||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
|
||||||
|
|
||||||
if(ppbRowPointers)
|
if(ppbRowPointers)
|
||||||
free (ppbRowPointers);
|
free (ppbRowPointers);
|
||||||
@@ -392,7 +395,7 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_NO_STDIO
|
#ifndef PNG_STDIO_SUPPORTED
|
||||||
|
|
||||||
static void
|
static void
|
||||||
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
|
|||||||
@@ -2,8 +2,11 @@
|
|||||||
// PNGFILE.H -- Header File for pngfile.c
|
// PNGFILE.H -- Header File for pngfile.c
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
|
|
||||||
// Copyright 2000, Willem van Schaik. For conditions of distribution and
|
// Copyright 2000, Willem van Schaik.
|
||||||
// use, see the copyright/license/disclaimer notice in png.h
|
|
||||||
|
// This code is released under the libpng license.
|
||||||
|
// For conditions of distribution and use, see the disclaimer
|
||||||
|
// and license in png.h
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -19,7 +22,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
||||||
int iWidth, int iHeight, png_color BkgColor);
|
int iWidth, int iHeight, png_color BkgColor);
|
||||||
|
|
||||||
#if defined(PNG_NO_STDIO)
|
#ifndef PNG_STDIO_SUPPORTED
|
||||||
static void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length);
|
static void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length);
|
||||||
static void png_write_data(png_structp png_ptr, png_bytep data, png_size_t length);
|
static void png_write_data(png_structp png_ptr, png_bytep data, png_size_t length);
|
||||||
static void png_flush(png_structp png_ptr);
|
static void png_flush(png_structp png_ptr);
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
Microsoft Developer Studio Build File, Format Version 6.00 for VisualPng
|
Microsoft Developer Studio Build File, Format Version 6.00 for VisualPng
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright 2000, Willem van Schaik. For conditions of distribution and
|
Copyright 2000, Willem van Schaik.
|
||||||
use, see the copyright/license/disclaimer notice in png.h
|
|
||||||
|
This code is released under the libpng license.
|
||||||
|
For conditions of distribution and use, see the disclaimer
|
||||||
|
and license in png.h
|
||||||
|
|
||||||
As a PNG .dll demo VisualPng is finished. More features would only hinder
|
As a PNG .dll demo VisualPng is finished. More features would only hinder
|
||||||
the program's objective. However, further extensions (like support for other
|
the program's objective. However, further extensions (like support for other
|
||||||
|
|||||||
@@ -2,8 +2,11 @@
|
|||||||
// VisualPng.C -- Shows a PNG image
|
// VisualPng.C -- Shows a PNG image
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
|
|
||||||
// Copyright 2000, Willem van Schaik. For conditions of distribution and
|
// Copyright 2000, Willem van Schaik.
|
||||||
// use, see the copyright/license/disclaimer notice in png.h
|
|
||||||
|
// This code is released under the libpng license.
|
||||||
|
// For conditions of distribution and use, see the disclaimer
|
||||||
|
// and license in png.h
|
||||||
|
|
||||||
// switches
|
// switches
|
||||||
|
|
||||||
|
|||||||
@@ -1,223 +1,147 @@
|
|||||||
# Microsoft Developer Studio Project File - Name="VisualPng" - Package Owner=<4>
|
# Microsoft Developer Studio Project File - Name="VisualPng" - Package Owner=<4>
|
||||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
# Copyright 2000, Willem van Schaik. For conditions of distribution and
|
|
||||||
# use, see the copyright/license/disclaimer notice in png.h
|
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||||
|
|
||||||
# ** DO NOT EDIT **
|
CFG=VisualPng - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
CFG=VisualPng - Win32 Debug LIB
|
!MESSAGE NMAKE /f "VisualPng.mak".
|
||||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
!MESSAGE
|
||||||
!MESSAGE use the Export Makefile command and run
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
!MESSAGE
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
!MESSAGE NMAKE /f "VisualPng.mak".
|
!MESSAGE
|
||||||
!MESSAGE
|
!MESSAGE NMAKE /f "VisualPng.mak" CFG="VisualPng - Win32 Debug"
|
||||||
!MESSAGE You can specify a configuration when running NMAKE
|
!MESSAGE
|
||||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
!MESSAGE Possible choices for configuration are:
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE NMAKE /f "VisualPng.mak" CFG="VisualPng - Win32 Debug LIB"
|
!MESSAGE "VisualPng - Win32 Release" (based on "Win32 (x86) Application")
|
||||||
!MESSAGE
|
!MESSAGE "VisualPng - Win32 Debug" (based on "Win32 (x86) Application")
|
||||||
!MESSAGE Possible choices for configuration are:
|
!MESSAGE
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE "VisualPng - Win32 DLL" (based on "Win32 (x86) Application")
|
# Begin Project
|
||||||
!MESSAGE "VisualPng - Win32 Debug DLL" (based on "Win32 (x86) Application")
|
# PROP AllowPerConfigDependencies 0
|
||||||
!MESSAGE "VisualPng - Win32 LIB" (based on "Win32 (x86) Application")
|
# PROP Scc_ProjName ""
|
||||||
!MESSAGE "VisualPng - Win32 Debug LIB" (based on "Win32 (x86) Application")
|
# PROP Scc_LocalPath ""
|
||||||
!MESSAGE
|
CPP=cl.exe
|
||||||
|
MTL=midl.exe
|
||||||
# Begin Project
|
RSC=rc.exe
|
||||||
# PROP AllowPerConfigDependencies 0
|
|
||||||
# PROP Scc_ProjName ""
|
!IF "$(CFG)" == "VisualPng - Win32 Release"
|
||||||
# PROP Scc_LocalPath ""
|
|
||||||
CPP=cl.exe
|
# PROP BASE Use_MFC 0
|
||||||
MTL=midl.exe
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
RSC=rc.exe
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
!IF "$(CFG)" == "VisualPng - Win32 DLL"
|
# PROP BASE Ignore_Export_Lib 0
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
# PROP BASE Use_MFC 0
|
# PROP Use_MFC 0
|
||||||
# PROP BASE Use_Debug_Libraries 0
|
# PROP Use_Debug_Libraries 0
|
||||||
# PROP BASE Output_Dir "VisualPng___Win32_DLL"
|
# PROP Output_Dir "Release"
|
||||||
# PROP BASE Intermediate_Dir "VisualPng___Win32_DLL"
|
# PROP Intermediate_Dir "Release"
|
||||||
# PROP BASE Target_Dir ""
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Use_MFC 0
|
# PROP Target_Dir ""
|
||||||
# PROP Use_Debug_Libraries 0
|
# ADD BASE CPP /nologo /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_NO_STDIO" /FD /c
|
||||||
# PROP Output_Dir "dll"
|
# SUBTRACT BASE CPP /YX
|
||||||
# PROP Intermediate_Dir "dll"
|
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_NO_STDIO" /FD /c
|
||||||
# PROP Ignore_Export_Lib 0
|
# SUBTRACT CPP /YX
|
||||||
# PROP Target_Dir ""
|
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "libpng" /I "zlib" /D "PNG_USE_DLL" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\libpng" /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "PNG_USE_DLL" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /c
|
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||||
# SUBTRACT CPP /YX
|
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
BSC32=bscmake.exe
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
# ADD BSC32 /nologo
|
||||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
LINK32=link.exe
|
||||||
BSC32=bscmake.exe
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||||
# ADD BASE BSC32 /nologo
|
# ADD LINK32 ..\..\projects\visualc6\Win32_LIB_Release\libpng.lib ..\..\..\zlib\projects\visualc6\Win32_LIB_Release\zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||||
# ADD BSC32 /nologo
|
# Begin Special Build Tool
|
||||||
LINK32=link.exe
|
OutDir=.\Release
|
||||||
# ADD BASE LINK32 libpng2.lib zlibd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"libpng" /libpath:"zlib"
|
SOURCE="$(InputPath)"
|
||||||
# ADD LINK32 libpng2.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\dll"
|
PostBuild_Cmds=$(outdir)\VisualPng.exe ..\..\contrib\pngsuite\basn6a16.png
|
||||||
# Begin Special Build Tool
|
# End Special Build Tool
|
||||||
OutDir=.\dll
|
|
||||||
SOURCE="$(InputPath)"
|
!ELSEIF "$(CFG)" == "VisualPng - Win32 Debug"
|
||||||
PostBuild_Cmds=set path=..\..\projects\msvc\win32\libpng\dll;..\..\projects\msvc\win32\zlib\dll; $(outdir)\VisualPng.exe ..\..\contrib\pngsuite\basn6a16.png
|
|
||||||
# End Special Build Tool
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
!ELSEIF "$(CFG)" == "VisualPng - Win32 Debug DLL"
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
# PROP BASE Use_MFC 0
|
# PROP BASE Ignore_Export_Lib 0
|
||||||
# PROP BASE Use_Debug_Libraries 1
|
# PROP BASE Target_Dir ""
|
||||||
# PROP BASE Output_Dir "VisualPng___Win32_Debug_DLL"
|
# PROP Use_MFC 0
|
||||||
# PROP BASE Intermediate_Dir "VisualPng___Win32_Debug_DLL"
|
# PROP Use_Debug_Libraries 1
|
||||||
# PROP BASE Ignore_Export_Lib 0
|
# PROP Output_Dir "Debug"
|
||||||
# PROP BASE Target_Dir ""
|
# PROP Intermediate_Dir "Debug"
|
||||||
# PROP Use_MFC 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Use_Debug_Libraries 1
|
# PROP Target_Dir ""
|
||||||
# PROP Output_Dir "dll_dbg"
|
# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_NO_STDIO" /FD /GZ /c
|
||||||
# PROP Intermediate_Dir "dll_dbg"
|
# SUBTRACT BASE CPP /YX
|
||||||
# PROP Ignore_Export_Lib 0
|
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_NO_STDIO" /FD /GZ /c
|
||||||
# PROP Target_Dir ""
|
# SUBTRACT CPP /YX
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "libpng" /I "zlib" /D "PNG_USE_DLL" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\libpng" /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "PNG_USE_DLL" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /GZ /c
|
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
# SUBTRACT CPP /YX
|
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
BSC32=bscmake.exe
|
||||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
# ADD BSC32 /nologo
|
||||||
BSC32=bscmake.exe
|
LINK32=link.exe
|
||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||||
# ADD BSC32 /nologo
|
# ADD LINK32 ..\..\projects\visualc6\Win32_LIB_Release\libpng.lib ..\..\..\zlib\projects\visualc6\Win32_LIB_Release\zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /pdbtype:sept
|
||||||
LINK32=link.exe
|
# Begin Special Build Tool
|
||||||
# ADD BASE LINK32 libpng2.lib zlibd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"libpng" /libpath:"zlib"
|
OutDir=.\Debug
|
||||||
# SUBTRACT BASE LINK32 /nodefaultlib
|
SOURCE="$(InputPath)"
|
||||||
# ADD LINK32 libpng2d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\dll_dbg"
|
PostBuild_Cmds=$(outdir)\VisualPng.exe ..\..\contrib\pngsuite\basn6a16.png
|
||||||
# SUBTRACT LINK32 /nodefaultlib
|
# End Special Build Tool
|
||||||
# Begin Special Build Tool
|
|
||||||
OutDir=.\dll_dbg
|
!ENDIF
|
||||||
SOURCE="$(InputPath)"
|
|
||||||
PostBuild_Cmds=set path=..\..\projects\msvc\win32\libpng\dll_dbg;..\..\projects\msvc\win32\zlib\dll_dbg; $(outdir)\VisualPng.exe ..\..\contrib\pngsuite\basn6a16.png
|
# Begin Target
|
||||||
# End Special Build Tool
|
|
||||||
|
# Name "VisualPng - Win32 Release"
|
||||||
!ELSEIF "$(CFG)" == "VisualPng - Win32 LIB"
|
# Name "VisualPng - Win32 Debug"
|
||||||
|
# Begin Group "Source Files"
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 0
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
# PROP BASE Output_Dir "VisualPng___Win32_LIB"
|
# Begin Source File
|
||||||
# PROP BASE Intermediate_Dir "VisualPng___Win32_LIB"
|
|
||||||
# PROP BASE Ignore_Export_Lib 0
|
SOURCE=.\PngFile.c
|
||||||
# PROP BASE Target_Dir ""
|
# End Source File
|
||||||
# PROP Use_MFC 0
|
# Begin Source File
|
||||||
# PROP Use_Debug_Libraries 0
|
|
||||||
# PROP Output_Dir "lib"
|
SOURCE=.\VisualPng.c
|
||||||
# PROP Intermediate_Dir "lib"
|
# End Source File
|
||||||
# PROP Ignore_Export_Lib 0
|
# End Group
|
||||||
# PROP Target_Dir ""
|
# Begin Group "Header Files"
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\..\libpng" /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "PNG_USE_DLL" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /c
|
|
||||||
# SUBTRACT BASE CPP /YX
|
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\libpng" /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /c
|
# Begin Source File
|
||||||
# SUBTRACT CPP /YX
|
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
SOURCE=.\cexcept.h
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
# End Source File
|
||||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
# Begin Source File
|
||||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
|
||||||
BSC32=bscmake.exe
|
SOURCE=.\PngFile.h
|
||||||
# ADD BASE BSC32 /nologo
|
# End Source File
|
||||||
# ADD BSC32 /nologo
|
# Begin Source File
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 libpng2.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\dll"
|
SOURCE=.\resource.h
|
||||||
# ADD LINK32 libpng.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\lib"
|
# End Source File
|
||||||
# Begin Special Build Tool
|
# End Group
|
||||||
OutDir=.\lib
|
# Begin Group "Resource Files"
|
||||||
SOURCE="$(InputPath)"
|
|
||||||
PostBuild_Cmds=$(outdir)\VisualPng.exe ..\..\contrib\pngsuite\basn6a16.png
|
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||||
# End Special Build Tool
|
# Begin Source File
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "VisualPng - Win32 Debug LIB"
|
SOURCE=.\VisualPng.ico
|
||||||
|
# End Source File
|
||||||
# PROP BASE Use_MFC 0
|
# Begin Source File
|
||||||
# PROP BASE Use_Debug_Libraries 1
|
|
||||||
# PROP BASE Output_Dir "VisualPng___Win32_Debug_LIB"
|
SOURCE=.\VisualPng.rc
|
||||||
# PROP BASE Intermediate_Dir "VisualPng___Win32_Debug_LIB"
|
# End Source File
|
||||||
# PROP BASE Ignore_Export_Lib 0
|
# End Group
|
||||||
# PROP BASE Target_Dir ""
|
# End Target
|
||||||
# PROP Use_MFC 0
|
# End Project
|
||||||
# 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 /Gm /GX /ZI /Od /I "..\..\..\libpng" /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "PNG_USE_DLL" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /YX /FD /GZ /c
|
|
||||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\libpng" /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /GZ /c
|
|
||||||
# SUBTRACT CPP /YX
|
|
||||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
|
||||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
|
||||||
# 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 libpng2d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\dll_dbg"
|
|
||||||
# SUBTRACT BASE LINK32 /nodefaultlib
|
|
||||||
# ADD LINK32 libpng.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\lib_dbg"
|
|
||||||
# SUBTRACT LINK32 /nodefaultlib
|
|
||||||
# Begin Special Build Tool
|
|
||||||
OutDir=.\lib_dbg
|
|
||||||
SOURCE="$(InputPath)"
|
|
||||||
PostBuild_Cmds=$(outdir)\VisualPng.exe ..\..\contrib\pngsuite\basn6a16.png
|
|
||||||
# End Special Build Tool
|
|
||||||
|
|
||||||
!ENDIF
|
|
||||||
|
|
||||||
# Begin Target
|
|
||||||
|
|
||||||
# Name "VisualPng - Win32 DLL"
|
|
||||||
# Name "VisualPng - Win32 Debug DLL"
|
|
||||||
# Name "VisualPng - Win32 LIB"
|
|
||||||
# Name "VisualPng - Win32 Debug LIB"
|
|
||||||
# Begin Group "Source Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\PngFile.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\VisualPng.c
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
|
||||||
# Begin Group "Header Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\cexcept.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\PngFile.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\resource.h
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
|
||||||
# Begin Group "Resource Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\VisualPng.ico
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\VisualPng.rc
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
|
||||||
# End Target
|
|
||||||
# End Project
|
|
||||||
|
|||||||
@@ -1,29 +1,29 @@
|
|||||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
Project: "VisualPng"=.\VisualPng.dsp - Package Owner=<4>
|
Project: "VisualPng"=.\VisualPng.dsp - Package Owner=<4>
|
||||||
|
|
||||||
Package=<5>
|
Package=<5>
|
||||||
{{{
|
{{{
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
Package=<4>
|
Package=<4>
|
||||||
{{{
|
{{{
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
Global:
|
Global:
|
||||||
|
|
||||||
Package=<5>
|
Package=<5>
|
||||||
{{{
|
{{{
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
Package=<3>
|
Package=<3>
|
||||||
{{{
|
{{{
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|||||||
@@ -1,152 +1,152 @@
|
|||||||
//Microsoft Developer Studio generated resource script.
|
//Microsoft Developer Studio generated resource script.
|
||||||
//
|
//
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
#define APSTUDIO_READONLY_SYMBOLS
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Generated from the TEXTINCLUDE 2 resource.
|
// Generated from the TEXTINCLUDE 2 resource.
|
||||||
//
|
//
|
||||||
#include "afxres.h"
|
#include "afxres.h"
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
#undef APSTUDIO_READONLY_SYMBOLS
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// English (U.S.) resources
|
// English (U.S.) resources
|
||||||
|
|
||||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
#pragma code_page(1252)
|
#pragma code_page(1252)
|
||||||
#endif //_WIN32
|
#endif //_WIN32
|
||||||
|
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// TEXTINCLUDE
|
// TEXTINCLUDE
|
||||||
//
|
//
|
||||||
|
|
||||||
1 TEXTINCLUDE DISCARDABLE
|
1 TEXTINCLUDE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
"resource.h\0"
|
"resource.h\0"
|
||||||
END
|
END
|
||||||
|
|
||||||
2 TEXTINCLUDE DISCARDABLE
|
2 TEXTINCLUDE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
"#include ""afxres.h""\r\n"
|
"#include ""afxres.h""\r\n"
|
||||||
"\0"
|
"\0"
|
||||||
END
|
END
|
||||||
|
|
||||||
3 TEXTINCLUDE DISCARDABLE
|
3 TEXTINCLUDE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
"\r\n"
|
"\r\n"
|
||||||
"\0"
|
"\0"
|
||||||
END
|
END
|
||||||
|
|
||||||
#endif // APSTUDIO_INVOKED
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Menu
|
// Menu
|
||||||
//
|
//
|
||||||
|
|
||||||
VISUALPNG MENU DISCARDABLE
|
VISUALPNG MENU DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
POPUP "&File"
|
POPUP "&File"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Open Image...\tCtrl+O", IDM_FILE_OPEN
|
MENUITEM "&Open Image...\tCtrl+O", IDM_FILE_OPEN
|
||||||
MENUITEM "Save &As...", IDM_FILE_SAVE
|
MENUITEM "Save &As...", IDM_FILE_SAVE
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "&Next Image\tCtrl+N", IDM_FILE_NEXT
|
MENUITEM "&Next Image\tCtrl+N", IDM_FILE_NEXT
|
||||||
MENUITEM "Pre&vious Image\tCtrl+V", IDM_FILE_PREVIOUS
|
MENUITEM "Pre&vious Image\tCtrl+V", IDM_FILE_PREVIOUS
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "E&xit\tAlt+X", IDM_FILE_EXIT
|
MENUITEM "E&xit\tAlt+X", IDM_FILE_EXIT
|
||||||
END
|
END
|
||||||
POPUP "&Options"
|
POPUP "&Options"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Stretch", IDM_OPTIONS_STRETCH, CHECKED
|
MENUITEM "&Stretch", IDM_OPTIONS_STRETCH, CHECKED
|
||||||
END
|
END
|
||||||
POPUP "&Help"
|
POPUP "&Help"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&About", IDM_HELP_ABOUT
|
MENUITEM "&About", IDM_HELP_ABOUT
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Accelerator
|
// Accelerator
|
||||||
//
|
//
|
||||||
|
|
||||||
VISUALPNG ACCELERATORS DISCARDABLE
|
VISUALPNG ACCELERATORS DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
"N", IDM_FILE_NEXT, VIRTKEY, CONTROL, NOINVERT
|
"N", IDM_FILE_NEXT, VIRTKEY, CONTROL, NOINVERT
|
||||||
"O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
|
"O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
|
||||||
"P", IDM_FILE_PREVIOUS, VIRTKEY, CONTROL, NOINVERT
|
"P", IDM_FILE_PREVIOUS, VIRTKEY, CONTROL, NOINVERT
|
||||||
"V", IDM_FILE_PREVIOUS, VIRTKEY, CONTROL, NOINVERT
|
"V", IDM_FILE_PREVIOUS, VIRTKEY, CONTROL, NOINVERT
|
||||||
"X", IDM_FILE_EXIT, VIRTKEY, ALT, NOINVERT
|
"X", IDM_FILE_EXIT, VIRTKEY, ALT, NOINVERT
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Icon
|
// Icon
|
||||||
//
|
//
|
||||||
|
|
||||||
// Icon with lowest ID value placed first to ensure application icon
|
// Icon with lowest ID value placed first to ensure application icon
|
||||||
// remains consistent on all systems.
|
// remains consistent on all systems.
|
||||||
VISUALPNG ICON DISCARDABLE "VisualPng.ico"
|
VISUALPNG ICON DISCARDABLE "VisualPng.ico"
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Dialog
|
// Dialog
|
||||||
//
|
//
|
||||||
|
|
||||||
ABOUTBOX DIALOG DISCARDABLE 0, 0, 186, 94
|
ABOUTBOX DIALOG DISCARDABLE 0, 0, 186, 94
|
||||||
STYLE DS_MODALFRAME | WS_POPUP
|
STYLE DS_MODALFRAME | WS_POPUP
|
||||||
FONT 8, "MS Sans Serif"
|
FONT 8, "MS Sans Serif"
|
||||||
BEGIN
|
BEGIN
|
||||||
DEFPUSHBUTTON "OK",IDOK,68,67,50,14
|
DEFPUSHBUTTON "OK",IDOK,68,67,50,14
|
||||||
CTEXT "VisualPng 1.0 - June 2000",IDC_STATIC,49,14,88,8
|
CTEXT "VisualPng 1.0 - June 2000",IDC_STATIC,49,14,88,8
|
||||||
LTEXT "a PNG image viewer",IDC_STATIC,60,30,66,8
|
LTEXT "a PNG image viewer",IDC_STATIC,60,30,66,8
|
||||||
LTEXT "(c) Willem van Schaik, 2000",IDC_STATIC,48,52,90,8
|
LTEXT "(c) Willem van Schaik, 2000",IDC_STATIC,48,52,90,8
|
||||||
LTEXT "to demonstrate the use of libpng in Visual C",
|
LTEXT "to demonstrate the use of libpng in Visual C",
|
||||||
IDC_STATIC,25,38,136,8
|
IDC_STATIC,25,38,136,8
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// DESIGNINFO
|
// DESIGNINFO
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
GUIDELINES DESIGNINFO DISCARDABLE
|
GUIDELINES DESIGNINFO DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
"ABOUTBOX", DIALOG
|
"ABOUTBOX", DIALOG
|
||||||
BEGIN
|
BEGIN
|
||||||
LEFTMARGIN, 7
|
LEFTMARGIN, 7
|
||||||
RIGHTMARGIN, 179
|
RIGHTMARGIN, 179
|
||||||
TOPMARGIN, 7
|
TOPMARGIN, 7
|
||||||
BOTTOMMARGIN, 87
|
BOTTOMMARGIN, 87
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
#endif // APSTUDIO_INVOKED
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
#endif // English (U.S.) resources
|
#endif // English (U.S.) resources
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef APSTUDIO_INVOKED
|
#ifndef APSTUDIO_INVOKED
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Generated from the TEXTINCLUDE 3 resource.
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
#endif // not APSTUDIO_INVOKED
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,30 @@
|
|||||||
/*===
|
/*===
|
||||||
cexcept.h 1.0.0 (2000-Jun-21-Wed)
|
cexcept.h 2.0.1 (2008-Jul-19-Sat)
|
||||||
Adam M. Costello <amc@cs.berkeley.edu>
|
http://www.nicemice.net/cexcept/
|
||||||
|
Adam M. Costello
|
||||||
|
http://www.nicemice.net/amc/
|
||||||
|
|
||||||
An interface for exception-handling in ANSI C, developed jointly with
|
An interface for exception-handling in ANSI C (C89 and subsequent ISO
|
||||||
Cosmin Truta <cosmin@cs.toronto.edu>.
|
standards), developed jointly with Cosmin Truta.
|
||||||
|
|
||||||
Copyright (c) 2000 Adam M. Costello and Cosmin Truta. Everyone
|
Copyright (c) 2000-2008 Adam M. Costello and Cosmin Truta.
|
||||||
is hereby granted permission to do whatever they like with this
|
This software may be modified only if its author and version
|
||||||
file, provided that if they modify it they take reasonable steps to
|
information is updated accurately, and may be redistributed
|
||||||
avoid confusing or misleading people about the authors, version,
|
only if accompanied by this unaltered notice. Subject to those
|
||||||
and terms of use of the derived file. The copyright holders make
|
restrictions, permission is granted to anyone to do anything
|
||||||
no guarantees about the correctness of this file, and are not
|
with this software. The copyright holders make no guarantees
|
||||||
responsible for any damage resulting from its use.
|
regarding this software, and are not responsible for any damage
|
||||||
|
resulting from its use.
|
||||||
|
|
||||||
If this interface is used by multiple .c files, they shouldn't include
|
The cexcept interface is not compatible with and cannot interact
|
||||||
|
with system exceptions (like division by zero or memory segmentation
|
||||||
|
violation), compiler-generated exceptions (like C++ exceptions), or
|
||||||
|
other exception-handling interfaces.
|
||||||
|
|
||||||
|
When using this interface across multiple .c files, do not include
|
||||||
this header file directly. Instead, create a wrapper header file that
|
this header file directly. Instead, create a wrapper header file that
|
||||||
includes this header file and then invokes the define_exception_type
|
includes this header file and then invokes the define_exception_type
|
||||||
macro (see below), and let your .c files include that header file.
|
macro (see below). The .c files should then include that header file.
|
||||||
|
|
||||||
The interface consists of one type, one well-known name, and six macros.
|
The interface consists of one type, one well-known name, and six macros.
|
||||||
|
|
||||||
@@ -37,6 +45,10 @@ define_exception_type(type_name);
|
|||||||
struct exception { int code; const char *msg; };
|
struct exception { int code; const char *msg; };
|
||||||
define_exception_type(struct exception);
|
define_exception_type(struct exception);
|
||||||
|
|
||||||
|
Because throwing an exception causes the object to be copied (not
|
||||||
|
just once, but twice), programmers may wish to consider size when
|
||||||
|
choosing the exception type.
|
||||||
|
|
||||||
|
|
||||||
struct exception_context;
|
struct exception_context;
|
||||||
|
|
||||||
@@ -62,7 +74,7 @@ struct exception_context *the_exception_context;
|
|||||||
application may declare a variable of this name anywhere it likes
|
application may declare a variable of this name anywhere it likes
|
||||||
(inside a function, in a parameter list, or externally), and may
|
(inside a function, in a parameter list, or externally), and may
|
||||||
use whatever storage class specifiers (static, extern, etc) or type
|
use whatever storage class specifiers (static, extern, etc) or type
|
||||||
qualifiers (const, volatile) it likes. Examples:
|
qualifiers (const, volatile, etc) it likes. Examples:
|
||||||
|
|
||||||
static struct exception_context
|
static struct exception_context
|
||||||
* const the_exception_context = &foo;
|
* const the_exception_context = &foo;
|
||||||
@@ -107,15 +119,15 @@ Catch (expression) statement
|
|||||||
confusion with the C++ keywords, which have subtly different
|
confusion with the C++ keywords, which have subtly different
|
||||||
semantics.
|
semantics.
|
||||||
|
|
||||||
A Try/Catch statement has a syntax similar to an if/else
|
A Try/Catch statement has a syntax similar to an if/else statement,
|
||||||
statement, except that the parenthesized expression goes after
|
except that the parenthesized expression goes after the second
|
||||||
the second keyword rather than the first. As with if/else,
|
keyword rather than the first. As with if/else, there are two
|
||||||
there are two clauses, each of which may be a simple statement
|
clauses, each of which may be a simple statement ending with a
|
||||||
ending with a semicolon or a brace-enclosed compound statement.
|
semicolon or a brace-enclosed compound statement. But whereas
|
||||||
But whereas the else clause is optional, the Catch clause is
|
the else clause is optional, the Catch clause is required. The
|
||||||
required. The expression must be a modifiable lvalue (something
|
expression must be a modifiable lvalue (something capable of being
|
||||||
capable of being assigned to) of the exact same type passed to
|
assigned to) of the same type (disregarding type qualifiers) that
|
||||||
define_exception_type().
|
was passed to define_exception_type().
|
||||||
|
|
||||||
If a Throw that uses the same exception context as the Try/Catch is
|
If a Throw that uses the same exception context as the Try/Catch is
|
||||||
executed within the Try clause (typically within a function called
|
executed within the Try clause (typically within a function called
|
||||||
@@ -125,9 +137,8 @@ Catch (expression) statement
|
|||||||
such Throw is executed, then the assignment is not performed, and
|
such Throw is executed, then the assignment is not performed, and
|
||||||
the Catch clause is not executed.
|
the Catch clause is not executed.
|
||||||
|
|
||||||
Regardless of whether an exception is caught, the expression is
|
The expression is not evaluated unless and until the exception is
|
||||||
always evaluated exactly once, which is significant if it has side
|
caught, which is significant if it has side effects, for example:
|
||||||
effects, for example:
|
|
||||||
|
|
||||||
Try foo();
|
Try foo();
|
||||||
Catch (p[++i].e) { ... }
|
Catch (p[++i].e) { ... }
|
||||||
@@ -158,7 +169,7 @@ Throw expression;
|
|||||||
be compatible with the type passed to define_exception_type(). The
|
be compatible with the type passed to define_exception_type(). The
|
||||||
exception must be caught, otherwise the program may crash.
|
exception must be caught, otherwise the program may crash.
|
||||||
|
|
||||||
Slight limitation: If the expression is a comma-expression it must
|
Slight limitation: If the expression is a comma-expression, it must
|
||||||
be enclosed in parentheses.
|
be enclosed in parentheses.
|
||||||
|
|
||||||
|
|
||||||
@@ -183,62 +194,55 @@ is subject to change.
|
|||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
|
||||||
#define define_exception_type(etype) \
|
#define define_exception_type(etype) \
|
||||||
struct exception__state { \
|
struct exception_context { \
|
||||||
etype *exception; \
|
jmp_buf *penv; \
|
||||||
jmp_buf env; \
|
int caught; \
|
||||||
|
volatile struct { etype etmp; } v; \
|
||||||
}
|
}
|
||||||
|
|
||||||
struct exception_context { \
|
/* etmp must be volatile because the application might use automatic */
|
||||||
struct exception__state *last; \
|
/* storage for the_exception_context, and etmp is modified between */
|
||||||
int caught; \
|
/* the calls to setjmp() and longjmp(). A wrapper struct is used to */
|
||||||
};
|
/* avoid warnings about a duplicate volatile qualifier in case etype */
|
||||||
|
/* already includes it. */
|
||||||
|
|
||||||
#define init_exception_context(ec) ((void)((ec)->last = 0))
|
#define init_exception_context(ec) ((void)((ec)->penv = 0))
|
||||||
|
|
||||||
#define Catch(e) exception__catch(&(e))
|
|
||||||
#define Catch_anonymous exception__catch(0)
|
|
||||||
|
|
||||||
#define Try \
|
#define Try \
|
||||||
{ \
|
{ \
|
||||||
struct exception__state *exception__p, exception__s; \
|
jmp_buf *exception__prev, exception__env; \
|
||||||
int exception__i; \
|
exception__prev = the_exception_context->penv; \
|
||||||
exception__p = the_exception_context->last; \
|
the_exception_context->penv = &exception__env; \
|
||||||
the_exception_context->last = &exception__s; \
|
if (setjmp(exception__env) == 0) { \
|
||||||
for (exception__i = 0; ; exception__i = 1) \
|
do
|
||||||
if (exception__i) { \
|
|
||||||
if (setjmp(exception__s.env) == 0) { \
|
|
||||||
if (&exception__s)
|
|
||||||
|
|
||||||
#define exception__catch(e_addr) \
|
#define exception__catch(action) \
|
||||||
else { } \
|
while (the_exception_context->caught = 0, \
|
||||||
the_exception_context->caught = 0; \
|
the_exception_context->caught); \
|
||||||
} \
|
} \
|
||||||
else the_exception_context->caught = 1; \
|
else { \
|
||||||
the_exception_context->last = exception__p; \
|
the_exception_context->caught = 1; \
|
||||||
break; \
|
} \
|
||||||
} \
|
the_exception_context->penv = exception__prev; \
|
||||||
else exception__s.exception = e_addr; \
|
|
||||||
} \
|
} \
|
||||||
if (!the_exception_context->caught) { } \
|
if (!the_exception_context->caught || action) { } \
|
||||||
else
|
else
|
||||||
|
|
||||||
/* Try ends with if(), and Catch begins and ends with else. This */
|
#define Catch(e) exception__catch(((e) = the_exception_context->v.etmp, 0))
|
||||||
/* ensures that the Try/Catch syntax is really the same as the */
|
#define Catch_anonymous exception__catch(0)
|
||||||
/* if/else syntax. */
|
|
||||||
|
/* Try ends with do, and Catch begins with while(0) and ends with */
|
||||||
|
/* else, to ensure that Try/Catch syntax is similar to if/else */
|
||||||
|
/* syntax. */
|
||||||
/* */
|
/* */
|
||||||
/* We use &exception__s instead of 1 to appease compilers that */
|
/* The 0 in while(0) is expressed as x=0,x in order to appease */
|
||||||
/* warn about constant expressions inside if(). Most compilers */
|
/* compilers that warn about constant expressions inside while(). */
|
||||||
/* should still recognize that &exception__s is never zero and avoid */
|
/* Most compilers should still recognize that the condition is always */
|
||||||
/* generating test code. */
|
/* false and avoid generating code for it. */
|
||||||
/* */
|
|
||||||
/* We use the variable exception__i to start the loop at the bottom, */
|
|
||||||
/* rather than jump into the loop using a switch statement, to */
|
|
||||||
/* appease compilers that warn about jumping into loops. */
|
|
||||||
|
|
||||||
#define Throw \
|
#define Throw \
|
||||||
for (;; longjmp(the_exception_context->last->env, 1)) \
|
for (;; longjmp(*the_exception_context->penv, 1)) \
|
||||||
if (the_exception_context->last->exception) \
|
the_exception_context->v.etmp =
|
||||||
*the_exception_context->last->exception =
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* CEXCEPT_H */
|
#endif /* CEXCEPT_H */
|
||||||
|
|||||||
630
depcomp
Executable file
@@ -0,0 +1,630 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
# depcomp - compile a program generating dependencies as side-effects
|
||||||
|
|
||||||
|
scriptversion=2009-04-28.21; # UTC
|
||||||
|
|
||||||
|
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
|
||||||
|
# Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# As a special exception to the GNU General Public License, if you
|
||||||
|
# distribute this file as part of a program that contains a
|
||||||
|
# configuration script generated by Autoconf, you may include it under
|
||||||
|
# the same distribution terms that you use for the rest of that program.
|
||||||
|
|
||||||
|
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
'')
|
||||||
|
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||||
|
exit 1;
|
||||||
|
;;
|
||||||
|
-h | --h*)
|
||||||
|
cat <<\EOF
|
||||||
|
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||||
|
|
||||||
|
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||||
|
as side-effects.
|
||||||
|
|
||||||
|
Environment variables:
|
||||||
|
depmode Dependency tracking mode.
|
||||||
|
source Source file read by `PROGRAMS ARGS'.
|
||||||
|
object Object file output by `PROGRAMS ARGS'.
|
||||||
|
DEPDIR directory where to store dependencies.
|
||||||
|
depfile Dependency file to output.
|
||||||
|
tmpdepfile Temporary file to use when outputing dependencies.
|
||||||
|
libtool Whether libtool is used (yes/no).
|
||||||
|
|
||||||
|
Report bugs to <bug-automake@gnu.org>.
|
||||||
|
EOF
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
-v | --v*)
|
||||||
|
echo "depcomp $scriptversion"
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||||
|
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||||
|
depfile=${depfile-`echo "$object" |
|
||||||
|
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||||
|
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||||
|
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
|
||||||
|
# Some modes work just like other modes, but use different flags. We
|
||||||
|
# parameterize here, but still list the modes in the big case below,
|
||||||
|
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||||
|
# here, because this file can only contain one case statement.
|
||||||
|
if test "$depmode" = hp; then
|
||||||
|
# HP compiler uses -M and no extra arg.
|
||||||
|
gccflag=-M
|
||||||
|
depmode=gcc
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$depmode" = dashXmstdout; then
|
||||||
|
# This is just like dashmstdout with a different argument.
|
||||||
|
dashmflag=-xM
|
||||||
|
depmode=dashmstdout
|
||||||
|
fi
|
||||||
|
|
||||||
|
cygpath_u="cygpath -u -f -"
|
||||||
|
if test "$depmode" = msvcmsys; then
|
||||||
|
# This is just like msvisualcpp but w/o cygpath translation.
|
||||||
|
# Just convert the backslash-escaped backslashes to single forward
|
||||||
|
# slashes to satisfy depend.m4
|
||||||
|
cygpath_u="sed s,\\\\\\\\,/,g"
|
||||||
|
depmode=msvisualcpp
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$depmode" in
|
||||||
|
gcc3)
|
||||||
|
## gcc 3 implements dependency tracking that does exactly what
|
||||||
|
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||||
|
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||||
|
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||||
|
## the command line argument order; so add the flags where they
|
||||||
|
## appear in depend2.am. Note that the slowdown incurred here
|
||||||
|
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||||
|
for arg
|
||||||
|
do
|
||||||
|
case $arg in
|
||||||
|
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||||
|
*) set fnord "$@" "$arg" ;;
|
||||||
|
esac
|
||||||
|
shift # fnord
|
||||||
|
shift # $arg
|
||||||
|
done
|
||||||
|
"$@"
|
||||||
|
stat=$?
|
||||||
|
if test $stat -eq 0; then :
|
||||||
|
else
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
exit $stat
|
||||||
|
fi
|
||||||
|
mv "$tmpdepfile" "$depfile"
|
||||||
|
;;
|
||||||
|
|
||||||
|
gcc)
|
||||||
|
## There are various ways to get dependency output from gcc. Here's
|
||||||
|
## why we pick this rather obscure method:
|
||||||
|
## - Don't want to use -MD because we'd like the dependencies to end
|
||||||
|
## up in a subdir. Having to rename by hand is ugly.
|
||||||
|
## (We might end up doing this anyway to support other compilers.)
|
||||||
|
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||||
|
## -MM, not -M (despite what the docs say).
|
||||||
|
## - Using -M directly means running the compiler twice (even worse
|
||||||
|
## than renaming).
|
||||||
|
if test -z "$gccflag"; then
|
||||||
|
gccflag=-MD,
|
||||||
|
fi
|
||||||
|
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||||
|
stat=$?
|
||||||
|
if test $stat -eq 0; then :
|
||||||
|
else
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
exit $stat
|
||||||
|
fi
|
||||||
|
rm -f "$depfile"
|
||||||
|
echo "$object : \\" > "$depfile"
|
||||||
|
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||||
|
## The second -e expression handles DOS-style file names with drive letters.
|
||||||
|
sed -e 's/^[^:]*: / /' \
|
||||||
|
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||||
|
## This next piece of magic avoids the `deleted header file' problem.
|
||||||
|
## The problem is that when a header file which appears in a .P file
|
||||||
|
## is deleted, the dependency causes make to die (because there is
|
||||||
|
## typically no way to rebuild the header). We avoid this by adding
|
||||||
|
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||||
|
## this for us directly.
|
||||||
|
tr ' ' '
|
||||||
|
' < "$tmpdepfile" |
|
||||||
|
## Some versions of gcc put a space before the `:'. On the theory
|
||||||
|
## that the space means something, we add a space to the output as
|
||||||
|
## well.
|
||||||
|
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||||
|
## correctly. Breaking it into two sed invocations is a workaround.
|
||||||
|
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
;;
|
||||||
|
|
||||||
|
hp)
|
||||||
|
# This case exists only to let depend.m4 do its work. It works by
|
||||||
|
# looking at the text of this script. This case will never be run,
|
||||||
|
# since it is checked for above.
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
sgi)
|
||||||
|
if test "$libtool" = yes; then
|
||||||
|
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||||
|
else
|
||||||
|
"$@" -MDupdate "$tmpdepfile"
|
||||||
|
fi
|
||||||
|
stat=$?
|
||||||
|
if test $stat -eq 0; then :
|
||||||
|
else
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
exit $stat
|
||||||
|
fi
|
||||||
|
rm -f "$depfile"
|
||||||
|
|
||||||
|
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||||
|
echo "$object : \\" > "$depfile"
|
||||||
|
|
||||||
|
# Clip off the initial element (the dependent). Don't try to be
|
||||||
|
# clever and replace this with sed code, as IRIX sed won't handle
|
||||||
|
# lines with more than a fixed number of characters (4096 in
|
||||||
|
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||||
|
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||||
|
# dependency line.
|
||||||
|
tr ' ' '
|
||||||
|
' < "$tmpdepfile" \
|
||||||
|
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||||
|
tr '
|
||||||
|
' ' ' >> "$depfile"
|
||||||
|
echo >> "$depfile"
|
||||||
|
|
||||||
|
# The second pass generates a dummy entry for each header file.
|
||||||
|
tr ' ' '
|
||||||
|
' < "$tmpdepfile" \
|
||||||
|
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||||
|
>> "$depfile"
|
||||||
|
else
|
||||||
|
# The sourcefile does not contain any dependencies, so just
|
||||||
|
# store a dummy comment line, to avoid errors with the Makefile
|
||||||
|
# "include basename.Plo" scheme.
|
||||||
|
echo "#dummy" > "$depfile"
|
||||||
|
fi
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
;;
|
||||||
|
|
||||||
|
aix)
|
||||||
|
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||||
|
# in a .u file. In older versions, this file always lives in the
|
||||||
|
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||||
|
# start of each line; $object doesn't have directory information.
|
||||||
|
# Version 6 uses the directory in both cases.
|
||||||
|
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||||
|
test "x$dir" = "x$object" && dir=
|
||||||
|
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||||
|
if test "$libtool" = yes; then
|
||||||
|
tmpdepfile1=$dir$base.u
|
||||||
|
tmpdepfile2=$base.u
|
||||||
|
tmpdepfile3=$dir.libs/$base.u
|
||||||
|
"$@" -Wc,-M
|
||||||
|
else
|
||||||
|
tmpdepfile1=$dir$base.u
|
||||||
|
tmpdepfile2=$dir$base.u
|
||||||
|
tmpdepfile3=$dir$base.u
|
||||||
|
"$@" -M
|
||||||
|
fi
|
||||||
|
stat=$?
|
||||||
|
|
||||||
|
if test $stat -eq 0; then :
|
||||||
|
else
|
||||||
|
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||||
|
exit $stat
|
||||||
|
fi
|
||||||
|
|
||||||
|
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||||
|
do
|
||||||
|
test -f "$tmpdepfile" && break
|
||||||
|
done
|
||||||
|
if test -f "$tmpdepfile"; then
|
||||||
|
# Each line is of the form `foo.o: dependent.h'.
|
||||||
|
# Do two passes, one to just change these to
|
||||||
|
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||||
|
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||||
|
# That's a tab and a space in the [].
|
||||||
|
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||||
|
else
|
||||||
|
# The sourcefile does not contain any dependencies, so just
|
||||||
|
# store a dummy comment line, to avoid errors with the Makefile
|
||||||
|
# "include basename.Plo" scheme.
|
||||||
|
echo "#dummy" > "$depfile"
|
||||||
|
fi
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
;;
|
||||||
|
|
||||||
|
icc)
|
||||||
|
# Intel's C compiler understands `-MD -MF file'. However on
|
||||||
|
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||||
|
# ICC 7.0 will fill foo.d with something like
|
||||||
|
# foo.o: sub/foo.c
|
||||||
|
# foo.o: sub/foo.h
|
||||||
|
# which is wrong. We want:
|
||||||
|
# sub/foo.o: sub/foo.c
|
||||||
|
# sub/foo.o: sub/foo.h
|
||||||
|
# sub/foo.c:
|
||||||
|
# sub/foo.h:
|
||||||
|
# ICC 7.1 will output
|
||||||
|
# foo.o: sub/foo.c sub/foo.h
|
||||||
|
# and will wrap long lines using \ :
|
||||||
|
# foo.o: sub/foo.c ... \
|
||||||
|
# sub/foo.h ... \
|
||||||
|
# ...
|
||||||
|
|
||||||
|
"$@" -MD -MF "$tmpdepfile"
|
||||||
|
stat=$?
|
||||||
|
if test $stat -eq 0; then :
|
||||||
|
else
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
exit $stat
|
||||||
|
fi
|
||||||
|
rm -f "$depfile"
|
||||||
|
# Each line is of the form `foo.o: dependent.h',
|
||||||
|
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||||
|
# Do two passes, one to just change these to
|
||||||
|
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||||
|
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||||
|
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||||
|
# correctly. Breaking it into two sed invocations is a workaround.
|
||||||
|
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||||
|
sed -e 's/$/ :/' >> "$depfile"
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
;;
|
||||||
|
|
||||||
|
hp2)
|
||||||
|
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||||
|
# compilers, which have integrated preprocessors. The correct option
|
||||||
|
# to use with these is +Maked; it writes dependencies to a file named
|
||||||
|
# 'foo.d', which lands next to the object file, wherever that
|
||||||
|
# happens to be.
|
||||||
|
# Much of this is similar to the tru64 case; see comments there.
|
||||||
|
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||||
|
test "x$dir" = "x$object" && dir=
|
||||||
|
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||||
|
if test "$libtool" = yes; then
|
||||||
|
tmpdepfile1=$dir$base.d
|
||||||
|
tmpdepfile2=$dir.libs/$base.d
|
||||||
|
"$@" -Wc,+Maked
|
||||||
|
else
|
||||||
|
tmpdepfile1=$dir$base.d
|
||||||
|
tmpdepfile2=$dir$base.d
|
||||||
|
"$@" +Maked
|
||||||
|
fi
|
||||||
|
stat=$?
|
||||||
|
if test $stat -eq 0; then :
|
||||||
|
else
|
||||||
|
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||||
|
exit $stat
|
||||||
|
fi
|
||||||
|
|
||||||
|
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||||
|
do
|
||||||
|
test -f "$tmpdepfile" && break
|
||||||
|
done
|
||||||
|
if test -f "$tmpdepfile"; then
|
||||||
|
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||||
|
# Add `dependent.h:' lines.
|
||||||
|
sed -ne '2,${
|
||||||
|
s/^ *//
|
||||||
|
s/ \\*$//
|
||||||
|
s/$/:/
|
||||||
|
p
|
||||||
|
}' "$tmpdepfile" >> "$depfile"
|
||||||
|
else
|
||||||
|
echo "#dummy" > "$depfile"
|
||||||
|
fi
|
||||||
|
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||||
|
;;
|
||||||
|
|
||||||
|
tru64)
|
||||||
|
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||||
|
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||||
|
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||||
|
# dependencies in `foo.d' instead, so we check for that too.
|
||||||
|
# Subdirectories are respected.
|
||||||
|
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||||
|
test "x$dir" = "x$object" && dir=
|
||||||
|
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||||
|
|
||||||
|
if test "$libtool" = yes; then
|
||||||
|
# With Tru64 cc, shared objects can also be used to make a
|
||||||
|
# static library. This mechanism is used in libtool 1.4 series to
|
||||||
|
# handle both shared and static libraries in a single compilation.
|
||||||
|
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||||
|
#
|
||||||
|
# With libtool 1.5 this exception was removed, and libtool now
|
||||||
|
# generates 2 separate objects for the 2 libraries. These two
|
||||||
|
# compilations output dependencies in $dir.libs/$base.o.d and
|
||||||
|
# in $dir$base.o.d. We have to check for both files, because
|
||||||
|
# one of the two compilations can be disabled. We should prefer
|
||||||
|
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||||
|
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||||
|
# the former would cause a distcleancheck panic.
|
||||||
|
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||||
|
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||||
|
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||||
|
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||||
|
"$@" -Wc,-MD
|
||||||
|
else
|
||||||
|
tmpdepfile1=$dir$base.o.d
|
||||||
|
tmpdepfile2=$dir$base.d
|
||||||
|
tmpdepfile3=$dir$base.d
|
||||||
|
tmpdepfile4=$dir$base.d
|
||||||
|
"$@" -MD
|
||||||
|
fi
|
||||||
|
|
||||||
|
stat=$?
|
||||||
|
if test $stat -eq 0; then :
|
||||||
|
else
|
||||||
|
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||||
|
exit $stat
|
||||||
|
fi
|
||||||
|
|
||||||
|
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||||
|
do
|
||||||
|
test -f "$tmpdepfile" && break
|
||||||
|
done
|
||||||
|
if test -f "$tmpdepfile"; then
|
||||||
|
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||||
|
# That's a tab and a space in the [].
|
||||||
|
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||||
|
else
|
||||||
|
echo "#dummy" > "$depfile"
|
||||||
|
fi
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
;;
|
||||||
|
|
||||||
|
#nosideeffect)
|
||||||
|
# This comment above is used by automake to tell side-effect
|
||||||
|
# dependency tracking mechanisms from slower ones.
|
||||||
|
|
||||||
|
dashmstdout)
|
||||||
|
# Important note: in order to support this mode, a compiler *must*
|
||||||
|
# always write the preprocessed file to stdout, regardless of -o.
|
||||||
|
"$@" || exit $?
|
||||||
|
|
||||||
|
# Remove the call to Libtool.
|
||||||
|
if test "$libtool" = yes; then
|
||||||
|
while test "X$1" != 'X--mode=compile'; do
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove `-o $object'.
|
||||||
|
IFS=" "
|
||||||
|
for arg
|
||||||
|
do
|
||||||
|
case $arg in
|
||||||
|
-o)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
$object)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
set fnord "$@" "$arg"
|
||||||
|
shift # fnord
|
||||||
|
shift # $arg
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
test -z "$dashmflag" && dashmflag=-M
|
||||||
|
# Require at least two characters before searching for `:'
|
||||||
|
# in the target name. This is to cope with DOS-style filenames:
|
||||||
|
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
||||||
|
"$@" $dashmflag |
|
||||||
|
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||||
|
rm -f "$depfile"
|
||||||
|
cat < "$tmpdepfile" > "$depfile"
|
||||||
|
tr ' ' '
|
||||||
|
' < "$tmpdepfile" | \
|
||||||
|
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||||
|
## correctly. Breaking it into two sed invocations is a workaround.
|
||||||
|
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
;;
|
||||||
|
|
||||||
|
dashXmstdout)
|
||||||
|
# This case only exists to satisfy depend.m4. It is never actually
|
||||||
|
# run, as this mode is specially recognized in the preamble.
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
makedepend)
|
||||||
|
"$@" || exit $?
|
||||||
|
# Remove any Libtool call
|
||||||
|
if test "$libtool" = yes; then
|
||||||
|
while test "X$1" != 'X--mode=compile'; do
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
# X makedepend
|
||||||
|
shift
|
||||||
|
cleared=no eat=no
|
||||||
|
for arg
|
||||||
|
do
|
||||||
|
case $cleared in
|
||||||
|
no)
|
||||||
|
set ""; shift
|
||||||
|
cleared=yes ;;
|
||||||
|
esac
|
||||||
|
if test $eat = yes; then
|
||||||
|
eat=no
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
case "$arg" in
|
||||||
|
-D*|-I*)
|
||||||
|
set fnord "$@" "$arg"; shift ;;
|
||||||
|
# Strip any option that makedepend may not understand. Remove
|
||||||
|
# the object too, otherwise makedepend will parse it as a source file.
|
||||||
|
-arch)
|
||||||
|
eat=yes ;;
|
||||||
|
-*|$object)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
set fnord "$@" "$arg"; shift ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||||
|
touch "$tmpdepfile"
|
||||||
|
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||||
|
rm -f "$depfile"
|
||||||
|
cat < "$tmpdepfile" > "$depfile"
|
||||||
|
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||||
|
' | \
|
||||||
|
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||||
|
## correctly. Breaking it into two sed invocations is a workaround.
|
||||||
|
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||||
|
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||||
|
;;
|
||||||
|
|
||||||
|
cpp)
|
||||||
|
# Important note: in order to support this mode, a compiler *must*
|
||||||
|
# always write the preprocessed file to stdout.
|
||||||
|
"$@" || exit $?
|
||||||
|
|
||||||
|
# Remove the call to Libtool.
|
||||||
|
if test "$libtool" = yes; then
|
||||||
|
while test "X$1" != 'X--mode=compile'; do
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove `-o $object'.
|
||||||
|
IFS=" "
|
||||||
|
for arg
|
||||||
|
do
|
||||||
|
case $arg in
|
||||||
|
-o)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
$object)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
set fnord "$@" "$arg"
|
||||||
|
shift # fnord
|
||||||
|
shift # $arg
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
"$@" -E |
|
||||||
|
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||||
|
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||||
|
sed '$ s: \\$::' > "$tmpdepfile"
|
||||||
|
rm -f "$depfile"
|
||||||
|
echo "$object : \\" > "$depfile"
|
||||||
|
cat < "$tmpdepfile" >> "$depfile"
|
||||||
|
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
;;
|
||||||
|
|
||||||
|
msvisualcpp)
|
||||||
|
# Important note: in order to support this mode, a compiler *must*
|
||||||
|
# always write the preprocessed file to stdout.
|
||||||
|
"$@" || exit $?
|
||||||
|
|
||||||
|
# Remove the call to Libtool.
|
||||||
|
if test "$libtool" = yes; then
|
||||||
|
while test "X$1" != 'X--mode=compile'; do
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
|
IFS=" "
|
||||||
|
for arg
|
||||||
|
do
|
||||||
|
case "$arg" in
|
||||||
|
-o)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
$object)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||||
|
set fnord "$@"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
set fnord "$@" "$arg"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
"$@" -E 2>/dev/null |
|
||||||
|
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||||
|
rm -f "$depfile"
|
||||||
|
echo "$object : \\" > "$depfile"
|
||||||
|
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||||
|
echo " " >> "$depfile"
|
||||||
|
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
;;
|
||||||
|
|
||||||
|
msvcmsys)
|
||||||
|
# This case exists only to let depend.m4 do its work. It works by
|
||||||
|
# looking at the text of this script. This case will never be run,
|
||||||
|
# since it is checked for above.
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
none)
|
||||||
|
exec "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Unknown depmode $depmode" 1>&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
# Local Variables:
|
||||||
|
# mode: shell-script
|
||||||
|
# sh-indentation: 2
|
||||||
|
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||||
|
# time-stamp-start: "scriptversion="
|
||||||
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||||
|
# time-stamp-time-zone: "UTC"
|
||||||
|
# time-stamp-end: "; # UTC"
|
||||||
|
# End:
|
||||||
361
example.c
@@ -1,10 +1,16 @@
|
|||||||
|
|
||||||
#if 0 /* in case someone actually tries to compile this */
|
#if 0 /* in case someone actually tries to compile this */
|
||||||
|
|
||||||
/* example.c - an example of using libpng */
|
/* example.c - an example of using libpng
|
||||||
|
* Last changed in libpng 1.5.0 [(PENDING RELEASE)]
|
||||||
|
* This file has been placed in the public domain by the authors.
|
||||||
|
* Maintained 1998-2010 Glenn Randers-Pehrson
|
||||||
|
* Maintained 1996, 1997 Andreas Dilger)
|
||||||
|
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
|
*/
|
||||||
|
|
||||||
/* This is an example of how to use libpng to read and write PNG files.
|
/* This is an example of how to use libpng to read and write PNG files.
|
||||||
* The file libpng.txt is much more verbose then this. If you have not
|
* The file libpng-manual.txt is much more verbose then this. If you have not
|
||||||
* read it, do so first. This was designed to be a starting point of an
|
* read it, do so first. This was designed to be a starting point of an
|
||||||
* implementation. This is not officially part of libpng, is hereby placed
|
* implementation. This is not officially part of libpng, is hereby placed
|
||||||
* in the public domain, and therefore does not require a copyright notice.
|
* in the public domain, and therefore does not require a copyright notice.
|
||||||
@@ -25,7 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef png_jmpbuf
|
#ifndef png_jmpbuf
|
||||||
# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
|
# define png_jmpbuf(png_ptr) ((png_ptr)->png_jmpbuf)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check to see if a file is a PNG file using png_sig_cmp(). png_sig_cmp()
|
/* Check to see if a file is a PNG file using png_sig_cmp(). png_sig_cmp()
|
||||||
@@ -85,14 +91,15 @@ void read_png(char *file_name) /* We need to open the file */
|
|||||||
|
|
||||||
if ((fp = fopen(file_name, "rb")) == NULL)
|
if ((fp = fopen(file_name, "rb")) == NULL)
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
|
|
||||||
#else no_open_file /* prototype 2 */
|
#else no_open_file /* prototype 2 */
|
||||||
void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
||||||
{
|
{
|
||||||
png_structp png_ptr;
|
png_structp png_ptr;
|
||||||
png_infop info_ptr;
|
png_infop info_ptr;
|
||||||
png_uint_32 width, height;
|
png_uint_32 width, height;
|
||||||
int bit_depth, color_type, interlace_type;
|
int bit_depth, color_type, interlace_type;
|
||||||
#endif no_open_file /* only use one prototype! */
|
#endif no_open_file /* Only use one prototype! */
|
||||||
|
|
||||||
/* Create and initialize the png_struct with the desired error handler
|
/* Create and initialize the png_struct with the desired error handler
|
||||||
* functions. If you want to use the default stderr and longjump method,
|
* functions. If you want to use the default stderr and longjump method,
|
||||||
@@ -114,7 +121,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
if (info_ptr == NULL)
|
if (info_ptr == NULL)
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
|
png_destroy_read_struct(&png_ptr, NULL, NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +133,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
if (setjmp(png_jmpbuf(png_ptr)))
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
/* Free all of the memory associated with the png_ptr and info_ptr */
|
/* Free all of the memory associated with the png_ptr and info_ptr */
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
/* If we get here, we had a problem reading the file */
|
/* If we get here, we had a problem reading the file */
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
@@ -153,11 +160,12 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
* If you have enough memory to read in the entire image at once,
|
* If you have enough memory to read in the entire image at once,
|
||||||
* and you need to specify only transforms that can be controlled
|
* and you need to specify only transforms that can be controlled
|
||||||
* with one of the PNG_TRANSFORM_* bits (this presently excludes
|
* with one of the PNG_TRANSFORM_* bits (this presently excludes
|
||||||
* dithering, filling, setting background, and doing gamma
|
* quantizing, filling, setting background, and doing gamma
|
||||||
* adjustment), then you can read the entire image (including
|
* adjustment), then you can read the entire image (including
|
||||||
* pixels) into the info structure with this call:
|
* pixels) into the info structure with this call:
|
||||||
*/
|
*/
|
||||||
png_read_png(png_ptr, info_ptr, png_transforms, NULL);
|
png_read_png(png_ptr, info_ptr, png_transforms, NULL);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* OK, you're doing it the hard way, with the lower-level functions */
|
/* OK, you're doing it the hard way, with the lower-level functions */
|
||||||
|
|
||||||
@@ -169,13 +177,13 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
||||||
&interlace_type, NULL, NULL);
|
&interlace_type, NULL, NULL);
|
||||||
|
|
||||||
/**** Set up the data transformations you want. Note that these are all
|
/* Set up the data transformations you want. Note that these are all
|
||||||
**** optional. Only call them if you want/need them. Many of the
|
* optional. Only call them if you want/need them. Many of the
|
||||||
**** transformations only work on specific types of images, and many
|
* transformations only work on specific types of images, and many
|
||||||
**** are mutually exclusive.
|
* are mutually exclusive.
|
||||||
****/
|
*/
|
||||||
|
|
||||||
/* tell libpng to strip 16 bit/color files down to 8 bits/color */
|
/* Tell libpng to strip 16 bit/color files down to 8 bits/color */
|
||||||
png_set_strip_16(png_ptr);
|
png_set_strip_16(png_ptr);
|
||||||
|
|
||||||
/* Strip alpha bytes from the input data without combining with the
|
/* Strip alpha bytes from the input data without combining with the
|
||||||
@@ -194,17 +202,17 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
|
|
||||||
/* Expand paletted colors into true RGB triplets */
|
/* Expand paletted colors into true RGB triplets */
|
||||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
png_set_expand(png_ptr);
|
png_set_palette_to_rgb(png_ptr);
|
||||||
|
|
||||||
/* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */
|
/* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */
|
||||||
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
||||||
png_set_expand(png_ptr);
|
png_set_expand_gray_1_2_4_to_8(png_ptr);
|
||||||
|
|
||||||
/* Expand paletted or RGB images with transparency to full alpha channels
|
/* Expand paletted or RGB images with transparency to full alpha channels
|
||||||
* so the data will be available as RGBA quartets.
|
* so the data will be available as RGBA quartets.
|
||||||
*/
|
*/
|
||||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
|
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
|
||||||
png_set_expand(png_ptr);
|
png_set_tRNS_to_alpha(png_ptr);
|
||||||
|
|
||||||
/* Set the background color to draw transparent and alpha images over.
|
/* Set the background color to draw transparent and alpha images over.
|
||||||
* It is possible to set the red, green, and blue components directly
|
* It is possible to set the red, green, and blue components directly
|
||||||
@@ -222,10 +230,11 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
png_set_background(png_ptr, &my_background,
|
png_set_background(png_ptr, &my_background,
|
||||||
PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
|
PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
|
||||||
|
|
||||||
/* Some suggestions as to how to get a screen gamma value */
|
/* Some suggestions as to how to get a screen gamma value
|
||||||
|
*
|
||||||
/* Note that screen gamma is the display_exponent, which includes
|
* Note that screen gamma is the display_exponent, which includes
|
||||||
* the CRT_exponent and any correction for viewing conditions */
|
* the CRT_exponent and any correction for viewing conditions
|
||||||
|
*/
|
||||||
if (/* We have a user-defined screen gamma value */)
|
if (/* We have a user-defined screen gamma value */)
|
||||||
{
|
{
|
||||||
screen_gamma = user-defined screen_gamma;
|
screen_gamma = user-defined screen_gamma;
|
||||||
@@ -238,7 +247,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
/* If we don't have another value */
|
/* If we don't have another value */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
screen_gamma = 2.2; /* A good guess for a PC monitors in a dimly
|
screen_gamma = 2.2; /* A good guess for a PC monitor in a dimly
|
||||||
lit room */
|
lit room */
|
||||||
screen_gamma = 1.7 or 1.0; /* A good guess for Mac systems */
|
screen_gamma = 1.7 or 1.0; /* A good guess for Mac systems */
|
||||||
}
|
}
|
||||||
@@ -262,7 +271,8 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dither RGB files down to 8 bit palette or reduce palettes
|
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||||
|
/* Quantize RGB files down to 8 bit palette or reduce palettes
|
||||||
* to the number of colors available on your screen.
|
* to the number of colors available on your screen.
|
||||||
*/
|
*/
|
||||||
if (color_type & PNG_COLOR_MASK_COLOR)
|
if (color_type & PNG_COLOR_MASK_COLOR)
|
||||||
@@ -271,27 +281,28 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
png_colorp palette;
|
png_colorp palette;
|
||||||
|
|
||||||
/* This reduces the image to the application supplied palette */
|
/* This reduces the image to the application supplied palette */
|
||||||
if (/* we have our own palette */)
|
if (/* We have our own palette */)
|
||||||
{
|
{
|
||||||
/* An array of colors to which the image should be dithered */
|
/* An array of colors to which the image should be quantized */
|
||||||
png_color std_color_cube[MAX_SCREEN_COLORS];
|
png_color std_color_cube[MAX_SCREEN_COLORS];
|
||||||
|
|
||||||
png_set_dither(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
|
png_set_quantize(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
|
||||||
MAX_SCREEN_COLORS, NULL, 0);
|
MAX_SCREEN_COLORS, NULL, 0);
|
||||||
}
|
}
|
||||||
/* This reduces the image to the palette supplied in the file */
|
/* This reduces the image to the palette supplied in the file */
|
||||||
else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette))
|
else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette))
|
||||||
{
|
{
|
||||||
png_uint_16p histogram;
|
png_uint_16p histogram = NULL;
|
||||||
|
|
||||||
png_get_hIST(png_ptr, info_ptr, &histogram);
|
png_get_hIST(png_ptr, info_ptr, &histogram);
|
||||||
|
|
||||||
png_set_dither(png_ptr, palette, num_palette,
|
png_set_quantize(png_ptr, palette, num_palette,
|
||||||
max_screen_colors, histogram, 0);
|
max_screen_colors, histogram, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* PNG_READ_QUANTIZE_SUPPORTED */
|
||||||
|
|
||||||
/* invert monochrome files to have 0 as white and 1 as black */
|
/* Invert monochrome files to have 0 as white and 1 as black */
|
||||||
png_set_invert_mono(png_ptr);
|
png_set_invert_mono(png_ptr);
|
||||||
|
|
||||||
/* If you want to shift the pixel values from the range [0,255] or
|
/* If you want to shift the pixel values from the range [0,255] or
|
||||||
@@ -300,20 +311,20 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
*/
|
*/
|
||||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT))
|
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT))
|
||||||
{
|
{
|
||||||
png_color_8p sig_bit;
|
png_color_8p sig_bit_p;
|
||||||
|
|
||||||
png_get_sBIT(png_ptr, info_ptr, &sig_bit);
|
png_get_sBIT(png_ptr, info_ptr, &sig_bit_p);
|
||||||
png_set_shift(png_ptr, sig_bit);
|
png_set_shift(png_ptr, sig_bit_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* flip the RGB pixels to BGR (or RGBA to BGRA) */
|
/* Flip the RGB pixels to BGR (or RGBA to BGRA) */
|
||||||
if (color_type & PNG_COLOR_MASK_COLOR)
|
if (color_type & PNG_COLOR_MASK_COLOR)
|
||||||
png_set_bgr(png_ptr);
|
png_set_bgr(png_ptr);
|
||||||
|
|
||||||
/* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
|
/* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
|
||||||
png_set_swap_alpha(png_ptr);
|
png_set_swap_alpha(png_ptr);
|
||||||
|
|
||||||
/* swap bytes of 16 bit files to least significant byte first */
|
/* Swap bytes of 16 bit files to least significant byte first */
|
||||||
png_set_swap(png_ptr);
|
png_set_swap(png_ptr);
|
||||||
|
|
||||||
/* Add filler (or alpha) byte (before/after each RGB triplet) */
|
/* Add filler (or alpha) byte (before/after each RGB triplet) */
|
||||||
@@ -336,11 +347,13 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
/* The easiest way to read the image: */
|
/* The easiest way to read the image: */
|
||||||
png_bytep row_pointers[height];
|
png_bytep row_pointers[height];
|
||||||
|
|
||||||
|
/* Clear the pointer array */
|
||||||
|
for (row = 0; row < height; row++)
|
||||||
|
row_pointers[row] = NULL;
|
||||||
|
|
||||||
for (row = 0; row < height; row++)
|
for (row = 0; row < height; row++)
|
||||||
{
|
|
||||||
row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr,
|
row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr,
|
||||||
info_ptr));
|
info_ptr));
|
||||||
}
|
|
||||||
|
|
||||||
/* Now it's time to read the image. One of these methods is REQUIRED */
|
/* Now it's time to read the image. One of these methods is REQUIRED */
|
||||||
#ifdef entire /* Read the entire image in one go */
|
#ifdef entire /* Read the entire image in one go */
|
||||||
@@ -361,37 +374,36 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
for (y = 0; y < height; y += number_of_rows)
|
for (y = 0; y < height; y += number_of_rows)
|
||||||
{
|
{
|
||||||
#ifdef sparkle /* Read the image using the "sparkle" effect. */
|
#ifdef sparkle /* Read the image using the "sparkle" effect. */
|
||||||
png_read_rows(png_ptr, &row_pointers[y], NULL, number_of_rows);
|
png_read_rows(png_ptr, &row_pointers[y], NULL,
|
||||||
|
number_of_rows);
|
||||||
png_read_rows(png_ptr, NULL, row_pointers[y], number_of_rows);
|
|
||||||
#else no_sparkle /* Read the image using the "rectangle" effect */
|
#else no_sparkle /* Read the image using the "rectangle" effect */
|
||||||
png_read_rows(png_ptr, NULL, &row_pointers[y], number_of_rows);
|
png_read_rows(png_ptr, NULL, &row_pointers[y],
|
||||||
#endif no_sparkle /* use only one of these two methods */
|
number_of_rows);
|
||||||
|
#endif no_sparkle /* Use only one of these two methods */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if you want to display the image after every pass, do
|
/* If you want to display the image after every pass, do so here */
|
||||||
so here */
|
#endif no_single /* Use only one of these two methods */
|
||||||
#endif no_single /* use only one of these two methods */
|
|
||||||
}
|
}
|
||||||
#endif no_entire /* use only one of these two methods */
|
#endif no_entire /* Use only one of these two methods */
|
||||||
|
|
||||||
/* read rest of file, and get additional chunks in info_ptr - REQUIRED */
|
/* Read rest of file, and get additional chunks in info_ptr - REQUIRED */
|
||||||
png_read_end(png_ptr, info_ptr);
|
png_read_end(png_ptr, info_ptr);
|
||||||
#endif hilevel
|
#endif hilevel
|
||||||
|
|
||||||
/* At this point you have read the entire image */
|
/* At this point you have read the entire image */
|
||||||
|
|
||||||
/* clean up after the read, and free any memory allocated - REQUIRED */
|
/* Clean up after the read, and free any memory allocated - REQUIRED */
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
|
|
||||||
/* close the file */
|
/* Close the file */
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
/* that's it */
|
/* That's it */
|
||||||
return (OK);
|
return (OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* progressively read a file */
|
/* Progressively read a file */
|
||||||
|
|
||||||
int
|
int
|
||||||
initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
|
initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
|
||||||
@@ -415,13 +427,13 @@ initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
|
|||||||
|
|
||||||
if (*info_ptr == NULL)
|
if (*info_ptr == NULL)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(png_ptr, info_ptr, (png_infopp)NULL);
|
png_destroy_read_struct(png_ptr, info_ptr, NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setjmp(png_jmpbuf((*png_ptr))))
|
if (setjmp(png_jmpbuf((*png_ptr))))
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(png_ptr, info_ptr, (png_infopp)NULL);
|
png_destroy_read_struct(png_ptr, info_ptr, NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,13 +462,13 @@ process_data(png_structp *png_ptr, png_infop *info_ptr,
|
|||||||
if (setjmp(png_jmpbuf((*png_ptr))))
|
if (setjmp(png_jmpbuf((*png_ptr))))
|
||||||
{
|
{
|
||||||
/* Free the png_ptr and info_ptr memory on error */
|
/* Free the png_ptr and info_ptr memory on error */
|
||||||
png_destroy_read_struct(png_ptr, info_ptr, (png_infopp)NULL);
|
png_destroy_read_struct(png_ptr, info_ptr, NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This one's new also. Simply give it chunks of data as
|
/* This one's new also. Simply give it chunks of data as
|
||||||
* they arrive from the data stream (in order, of course).
|
* they arrive from the data stream (in order, of course).
|
||||||
* On Segmented machines, don't give it any more than 64K.
|
* On segmented machines, don't give it any more than 64K.
|
||||||
* The library seems to run fine with sizes of 4K, although
|
* The library seems to run fine with sizes of 4K, although
|
||||||
* you can give it much less if necessary (I assume you can
|
* you can give it much less if necessary (I assume you can
|
||||||
* give it chunks of 1 byte, but I haven't tried with less
|
* give it chunks of 1 byte, but I haven't tried with less
|
||||||
@@ -470,60 +482,84 @@ process_data(png_structp *png_ptr, png_infop *info_ptr,
|
|||||||
|
|
||||||
info_callback(png_structp png_ptr, png_infop info)
|
info_callback(png_structp png_ptr, png_infop info)
|
||||||
{
|
{
|
||||||
/* do any setup here, including setting any of the transformations
|
/* Do any setup here, including setting any of the transformations
|
||||||
* mentioned in the Reading PNG files section. For now, you _must_
|
* mentioned in the Reading PNG files section. For now, you _must_
|
||||||
* call either png_start_read_image() or png_read_update_info()
|
* call either png_start_read_image() or png_read_update_info()
|
||||||
* after all the transformations are set (even if you don't set
|
* after all the transformations are set (even if you don't set
|
||||||
* any). You may start getting rows before png_process_data()
|
* any). You may start getting rows before png_process_data()
|
||||||
* returns, so this is your last chance to prepare for that.
|
* returns, so this is your last chance to prepare for that.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
row_callback(png_structp png_ptr, png_bytep new_row,
|
row_callback(png_structp png_ptr, png_bytep new_row,
|
||||||
png_uint_32 row_num, int pass)
|
png_uint_32 row_num, int pass)
|
||||||
{
|
{
|
||||||
/* this function is called for every row in the image. If the
|
/*
|
||||||
* image is interlacing, and you turned on the interlace handler,
|
* This function is called for every row in the image. If the
|
||||||
* this function will be called for every row in every pass.
|
* image is interlaced, and you turned on the interlace handler,
|
||||||
* Some of these rows will not be changed from the previous pass.
|
* this function will be called for every row in every pass.
|
||||||
* When the row is not changed, the new_row variable will be NULL.
|
*
|
||||||
* The rows and passes are called in order, so you don't really
|
* In this function you will receive a pointer to new row data from
|
||||||
* need the row_num and pass, but I'm supplying them because it
|
* libpng called new_row that is to replace a corresponding row (of
|
||||||
* may make your life easier.
|
* the same data format) in a buffer allocated by your application.
|
||||||
*
|
*
|
||||||
* For the non-NULL rows of interlaced images, you must call
|
* The new row data pointer "new_row" may be NULL, indicating there is
|
||||||
* png_progressive_combine_row() passing in the row and the
|
* no new data to be replaced (in cases of interlace loading).
|
||||||
* old row. You can call this function for NULL rows (it will
|
*
|
||||||
* just return) and for non-interlaced images (it just does the
|
* If new_row is not NULL then you need to call
|
||||||
* png_memcpy for you) if it will make the code easier. Thus, you
|
* png_progressive_combine_row() to replace the corresponding row as
|
||||||
* can just do this for all cases:
|
* shown below:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Get pointer to corresponding row in our
|
||||||
|
* PNG read buffer.
|
||||||
|
*/
|
||||||
|
png_bytep old_row = ((png_bytep *)our_data)[row_num];
|
||||||
|
|
||||||
|
/* If both rows are allocated then copy the new row
|
||||||
|
* data to the corresponding row data.
|
||||||
|
*/
|
||||||
|
if ((old_row != NULL) && (new_row != NULL))
|
||||||
|
png_progressive_combine_row(png_ptr, old_row, new_row);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The rows and passes are called in order, so you don't really
|
||||||
|
* need the row_num and pass, but I'm supplying them because it
|
||||||
|
* may make your life easier.
|
||||||
|
*
|
||||||
|
* For the non-NULL rows of interlaced images, you must call
|
||||||
|
* png_progressive_combine_row() passing in the new row and the
|
||||||
|
* old row, as demonstrated above. You can call this function for
|
||||||
|
* NULL rows (it will just return) and for non-interlaced images
|
||||||
|
* (it just does the png_memcpy for you) if it will make the code
|
||||||
|
* easier. Thus, you can just do this for all cases:
|
||||||
|
*/
|
||||||
|
|
||||||
png_progressive_combine_row(png_ptr, old_row, new_row);
|
png_progressive_combine_row(png_ptr, old_row, new_row);
|
||||||
|
|
||||||
/* where old_row is what was displayed for previous rows. Note
|
/* where old_row is what was displayed for previous rows. Note
|
||||||
* that the first pass (pass == 0 really) will completely cover
|
* that the first pass (pass == 0 really) will completely cover
|
||||||
* the old row, so the rows do not have to be initialized. After
|
* the old row, so the rows do not have to be initialized. After
|
||||||
* the first pass (and only for interlaced images), you will have
|
* the first pass (and only for interlaced images), you will have
|
||||||
* to pass the current row, and the function will combine the
|
* to pass the current row as new_row, and the function will combine
|
||||||
* old row and the new row.
|
* the old row and the new row.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
end_callback(png_structp png_ptr, png_infop info)
|
end_callback(png_structp png_ptr, png_infop info)
|
||||||
{
|
{
|
||||||
/* this function is called when the whole image has been read,
|
/* This function is called when the whole image has been read,
|
||||||
* including any chunks after the image (up to and including
|
* including any chunks after the image (up to and including
|
||||||
* the IEND). You will usually have the same info chunk as you
|
* the IEND). You will usually have the same info chunk as you
|
||||||
* had in the header, although some data may have been added
|
* had in the header, although some data may have been added
|
||||||
* to the comments and time fields.
|
* to the comments and time fields.
|
||||||
*
|
*
|
||||||
* Most people won't do much here, perhaps setting a flag that
|
* Most people won't do much here, perhaps setting a flag that
|
||||||
* marks the image as finished.
|
* marks the image as finished.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write a png file */
|
/* Write a png file */
|
||||||
void write_png(char *file_name /* , ... other image information ... */)
|
void write_png(char *file_name /* , ... other image information ... */)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@@ -531,7 +567,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
png_infop info_ptr;
|
png_infop info_ptr;
|
||||||
png_colorp palette;
|
png_colorp palette;
|
||||||
|
|
||||||
/* open the file */
|
/* Open the file */
|
||||||
fp = fopen(file_name, "wb");
|
fp = fopen(file_name, "wb");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
@@ -556,7 +592,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
if (info_ptr == NULL)
|
if (info_ptr == NULL)
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
|
png_destroy_write_struct(&png_ptr, NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -565,30 +601,34 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
*/
|
*/
|
||||||
if (setjmp(png_jmpbuf(png_ptr)))
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
/* If we get here, we had a problem reading the file */
|
/* If we get here, we had a problem writing the file */
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* One of the following I/O initialization functions is REQUIRED */
|
/* One of the following I/O initialization functions is REQUIRED */
|
||||||
|
|
||||||
#ifdef streams /* I/O initialization method 1 */
|
#ifdef streams /* I/O initialization method 1 */
|
||||||
/* set up the output control if you are using standard C streams */
|
/* Set up the output control if you are using standard C streams */
|
||||||
png_init_io(png_ptr, fp);
|
png_init_io(png_ptr, fp);
|
||||||
|
|
||||||
#else no_streams /* I/O initialization method 2 */
|
#else no_streams /* I/O initialization method 2 */
|
||||||
/* If you are using replacement read functions, instead of calling
|
/* If you are using replacement write functions, instead of calling
|
||||||
* png_init_io() here you would call */
|
* png_init_io() here you would call
|
||||||
|
*/
|
||||||
png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn,
|
png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn,
|
||||||
user_IO_flush_function);
|
user_IO_flush_function);
|
||||||
/* where user_io_ptr is a structure you want available to the callbacks */
|
/* where user_io_ptr is a structure you want available to the callbacks */
|
||||||
#endif no_streams /* only use one initialization method */
|
#endif no_streams /* Only use one initialization method */
|
||||||
|
|
||||||
#ifdef hilevel
|
#ifdef hilevel
|
||||||
/* This is the easy way. Use it if you already have all the
|
/* This is the easy way. Use it if you already have all the
|
||||||
* image info living info in the structure. You could "|" many
|
* image info living in the structure. You could "|" many
|
||||||
* PNG_TRANSFORM flags into the png_transforms integer here.
|
* PNG_TRANSFORM flags into the png_transforms integer here.
|
||||||
*/
|
*/
|
||||||
png_write_png(png_ptr, info_ptr, png_transforms, NULL);
|
png_write_png(png_ptr, info_ptr, png_transforms, NULL);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* This is the hard way */
|
/* This is the hard way */
|
||||||
|
|
||||||
@@ -603,25 +643,31 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, PNG_COLOR_TYPE_???,
|
png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, PNG_COLOR_TYPE_???,
|
||||||
PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||||
|
|
||||||
/* set the palette if there is one. REQUIRED for indexed-color images */
|
/* Set the palette if there is one. REQUIRED for indexed-color images */
|
||||||
palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH
|
palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH
|
||||||
* sizeof (png_color));
|
* png_sizeof(png_color));
|
||||||
/* ... set palette colors ... */
|
/* ... Set palette colors ... */
|
||||||
png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH);
|
png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH);
|
||||||
/* You must not free palette here, because png_set_PLTE only makes a link to
|
/* You must not free palette here, because png_set_PLTE only makes a link to
|
||||||
the palette that you malloced. Wait until you are about to destroy
|
* the palette that you malloced. Wait until you are about to destroy
|
||||||
the png structure. */
|
* the png structure.
|
||||||
|
*/
|
||||||
|
|
||||||
/* optional significant bit chunk */
|
/* Optional significant bit (sBIT) chunk */
|
||||||
/* if we are dealing with a grayscale image then */
|
png_color_8 sig_bit;
|
||||||
|
|
||||||
|
/* If we are dealing with a grayscale image then */
|
||||||
sig_bit.gray = true_bit_depth;
|
sig_bit.gray = true_bit_depth;
|
||||||
/* otherwise, if we are dealing with a color image then */
|
|
||||||
|
/* Otherwise, if we are dealing with a color image then */
|
||||||
sig_bit.red = true_red_bit_depth;
|
sig_bit.red = true_red_bit_depth;
|
||||||
sig_bit.green = true_green_bit_depth;
|
sig_bit.green = true_green_bit_depth;
|
||||||
sig_bit.blue = true_blue_bit_depth;
|
sig_bit.blue = true_blue_bit_depth;
|
||||||
/* if the image has an alpha channel then */
|
|
||||||
|
/* If the image has an alpha channel then */
|
||||||
sig_bit.alpha = true_alpha_bit_depth;
|
sig_bit.alpha = true_alpha_bit_depth;
|
||||||
png_set_sBIT(png_ptr, info_ptr, sig_bit);
|
|
||||||
|
png_set_sBIT(png_ptr, info_ptr, &sig_bit);
|
||||||
|
|
||||||
|
|
||||||
/* Optional gamma chunk is strongly suggested if you have any guess
|
/* Optional gamma chunk is strongly suggested if you have any guess
|
||||||
@@ -633,22 +679,29 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
text_ptr[0].key = "Title";
|
text_ptr[0].key = "Title";
|
||||||
text_ptr[0].text = "Mona Lisa";
|
text_ptr[0].text = "Mona Lisa";
|
||||||
text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE;
|
text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE;
|
||||||
|
text_ptr[0].itxt_length = 0;
|
||||||
|
text_ptr[0].lang = NULL;
|
||||||
|
text_ptr[0].lang_key = NULL;
|
||||||
text_ptr[1].key = "Author";
|
text_ptr[1].key = "Author";
|
||||||
text_ptr[1].text = "Leonardo DaVinci";
|
text_ptr[1].text = "Leonardo DaVinci";
|
||||||
text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE;
|
text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE;
|
||||||
|
text_ptr[1].itxt_length = 0;
|
||||||
|
text_ptr[1].lang = NULL;
|
||||||
|
text_ptr[1].lang_key = NULL;
|
||||||
text_ptr[2].key = "Description";
|
text_ptr[2].key = "Description";
|
||||||
text_ptr[2].text = "<long text>";
|
text_ptr[2].text = "<long text>";
|
||||||
text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt;
|
text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt;
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
text_ptr[2].itxt_length = 0;
|
||||||
text_ptr[0].lang = NULL;
|
|
||||||
text_ptr[1].lang = NULL;
|
|
||||||
text_ptr[2].lang = NULL;
|
text_ptr[2].lang = NULL;
|
||||||
#endif
|
text_ptr[2].lang_key = NULL;
|
||||||
png_set_text(png_ptr, info_ptr, text_ptr, 3);
|
png_set_text(png_ptr, info_ptr, text_ptr, 3);
|
||||||
|
|
||||||
/* other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs, */
|
/* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs */
|
||||||
/* note that if sRGB is present the gAMA and cHRM chunks must be ignored
|
|
||||||
* on read and must be written in accordance with the sRGB profile */
|
/* Note that if sRGB is present the gAMA and cHRM chunks must be ignored
|
||||||
|
* on read and, if your application chooses to write them, they must
|
||||||
|
* be written in accordance with the sRGB profile
|
||||||
|
*/
|
||||||
|
|
||||||
/* Write the file header information. REQUIRED */
|
/* Write the file header information. REQUIRED */
|
||||||
png_write_info(png_ptr, info_ptr);
|
png_write_info(png_ptr, info_ptr);
|
||||||
@@ -660,7 +713,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
* write_my_chunk();
|
* write_my_chunk();
|
||||||
* png_write_info(png_ptr, info_ptr);
|
* png_write_info(png_ptr, info_ptr);
|
||||||
*
|
*
|
||||||
* However, given the level of known- and unknown-chunk support in 1.1.0
|
* However, given the level of known- and unknown-chunk support in 1.2.0
|
||||||
* and up, this should no longer be necessary.
|
* and up, this should no longer be necessary.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -670,11 +723,11 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
* at the end.
|
* at the end.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* set up the transformations you want. Note that these are
|
/* Set up the transformations you want. Note that these are
|
||||||
* all optional. Only call them if you want them.
|
* all optional. Only call them if you want them.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* invert monochrome pixels */
|
/* Invert monochrome pixels */
|
||||||
png_set_invert_mono(png_ptr);
|
png_set_invert_mono(png_ptr);
|
||||||
|
|
||||||
/* Shift the pixels up to a legal bit depth and fill in
|
/* Shift the pixels up to a legal bit depth and fill in
|
||||||
@@ -682,10 +735,10 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
*/
|
*/
|
||||||
png_set_shift(png_ptr, &sig_bit);
|
png_set_shift(png_ptr, &sig_bit);
|
||||||
|
|
||||||
/* pack pixels into bytes */
|
/* Pack pixels into bytes */
|
||||||
png_set_packing(png_ptr);
|
png_set_packing(png_ptr);
|
||||||
|
|
||||||
/* swap location of alpha bytes from ARGB to RGBA */
|
/* Swap location of alpha bytes from ARGB to RGBA */
|
||||||
png_set_swap_alpha(png_ptr);
|
png_set_swap_alpha(png_ptr);
|
||||||
|
|
||||||
/* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into
|
/* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into
|
||||||
@@ -693,18 +746,19 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
*/
|
*/
|
||||||
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
|
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
|
||||||
|
|
||||||
/* flip BGR pixels to RGB */
|
/* Flip BGR pixels to RGB */
|
||||||
png_set_bgr(png_ptr);
|
png_set_bgr(png_ptr);
|
||||||
|
|
||||||
/* swap bytes of 16-bit files to most significant byte first */
|
/* Swap bytes of 16-bit files to most significant byte first */
|
||||||
png_set_swap(png_ptr);
|
png_set_swap(png_ptr);
|
||||||
|
|
||||||
/* swap bits of 1, 2, 4 bit packed pixel formats */
|
/* Swap bits of 1, 2, 4 bit packed pixel formats */
|
||||||
png_set_packswap(png_ptr);
|
png_set_packswap(png_ptr);
|
||||||
|
|
||||||
/* turn on interlace handling if you are not using png_write_image() */
|
/* Turn on interlace handling if you are not using png_write_image() */
|
||||||
if (interlacing)
|
if (interlacing)
|
||||||
number_passes = png_set_interlace_handling(png_ptr);
|
number_passes = png_set_interlace_handling(png_ptr);
|
||||||
|
|
||||||
else
|
else
|
||||||
number_passes = 1;
|
number_passes = 1;
|
||||||
|
|
||||||
@@ -715,16 +769,22 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
png_uint_32 k, height, width;
|
png_uint_32 k, height, width;
|
||||||
png_byte image[height][width*bytes_per_pixel];
|
png_byte image[height][width*bytes_per_pixel];
|
||||||
png_bytep row_pointers[height];
|
png_bytep row_pointers[height];
|
||||||
|
|
||||||
|
if (height > PNG_UINT_32_MAX/png_sizeof(png_bytep))
|
||||||
|
png_error (png_ptr, "Image is too tall to process in memory");
|
||||||
|
|
||||||
for (k = 0; k < height; k++)
|
for (k = 0; k < height; k++)
|
||||||
row_pointers[k] = image + k*width*bytes_per_pixel;
|
row_pointers[k] = image + k*width*bytes_per_pixel;
|
||||||
|
|
||||||
/* One of the following output methods is REQUIRED */
|
/* One of the following output methods is REQUIRED */
|
||||||
#ifdef entire /* write out the entire image data in one call */
|
|
||||||
|
#ifdef entire /* Write out the entire image data in one call */
|
||||||
png_write_image(png_ptr, row_pointers);
|
png_write_image(png_ptr, row_pointers);
|
||||||
|
|
||||||
/* the other way to write the image - deal with interlacing */
|
/* The other way to write the image - deal with interlacing */
|
||||||
|
|
||||||
|
#else no_entire /* Write out the image data by one or more scanlines */
|
||||||
|
|
||||||
#else no_entire /* write out the image data by one or more scanlines */
|
|
||||||
/* The number of passes is either 1 for non-interlaced images,
|
/* The number of passes is either 1 for non-interlaced images,
|
||||||
* or 7 for interlaced images.
|
* or 7 for interlaced images.
|
||||||
*/
|
*/
|
||||||
@@ -735,14 +795,12 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
|
|
||||||
/* If you are only writing one row at a time, this works */
|
/* If you are only writing one row at a time, this works */
|
||||||
for (y = 0; y < height; y++)
|
for (y = 0; y < height; y++)
|
||||||
{
|
|
||||||
png_write_rows(png_ptr, &row_pointers[y], 1);
|
png_write_rows(png_ptr, &row_pointers[y], 1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif no_entire /* use only one output method */
|
#endif no_entire /* Use only one output method */
|
||||||
|
|
||||||
/* You can write optional chunks like tEXt, zTXt, and tIME at the end
|
/* You can write optional chunks like tEXt, zTXt, and tIME at the end
|
||||||
* as well. Shouldn't be necessary in 1.1.0 and up as all the public
|
* as well. Shouldn't be necessary in 1.2.0 and up as all the public
|
||||||
* chunks are supported and you can use png_set_unknown_chunks() to
|
* chunks are supported and you can use png_set_unknown_chunks() to
|
||||||
* register unknown chunks into the info structure to be written out.
|
* register unknown chunks into the info structure to be written out.
|
||||||
*/
|
*/
|
||||||
@@ -752,26 +810,33 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
#endif hilevel
|
#endif hilevel
|
||||||
|
|
||||||
/* If you png_malloced a palette, free it here (don't free info_ptr->palette,
|
/* If you png_malloced a palette, free it here (don't free info_ptr->palette,
|
||||||
as recommended in versions 1.0.5m and earlier of this example; if
|
* as recommended in versions 1.0.5m and earlier of this example; if
|
||||||
libpng mallocs info_ptr->palette, libpng will free it). If you
|
* libpng mallocs info_ptr->palette, libpng will free it). If you
|
||||||
allocated it with malloc() instead of png_malloc(), use free() instead
|
* allocated it with malloc() instead of png_malloc(), use free() instead
|
||||||
of png_free(). */
|
* of png_free().
|
||||||
|
*/
|
||||||
png_free(png_ptr, palette);
|
png_free(png_ptr, palette);
|
||||||
palette=NULL;
|
palette = NULL;
|
||||||
|
|
||||||
/* Similarly, if you png_malloced any data that you passed in with
|
/* Similarly, if you png_malloced any data that you passed in with
|
||||||
png_set_something(), such as a hist or trans array, free it here,
|
* png_set_something(), such as a hist or trans array, free it here,
|
||||||
when you can be sure that libpng is through with it. */
|
* when you can be sure that libpng is through with it.
|
||||||
|
*/
|
||||||
png_free(png_ptr, trans);
|
png_free(png_ptr, trans);
|
||||||
trans=NULL;
|
trans = NULL;
|
||||||
|
/* Whenever you use png_free() it is a good idea to set the pointer to
|
||||||
|
* NULL in case your application inadvertently tries to png_free() it
|
||||||
|
* again. When png_free() sees a NULL it returns without action, thus
|
||||||
|
* avoiding the double-free security problem.
|
||||||
|
*/
|
||||||
|
|
||||||
/* clean up after the write, and free any memory allocated */
|
/* Clean up after the write, and free any memory allocated */
|
||||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||||
|
|
||||||
/* close the file */
|
/* Close the file */
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
/* that's it */
|
/* That's it */
|
||||||
return (OK);
|
return (OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||