Compare commits
804 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16ee3e9870 | ||
|
|
c8444775b1 | ||
|
|
784d80b509 | ||
|
|
98aacb16c3 | ||
|
|
8a35e25852 | ||
|
|
97eb073189 | ||
|
|
28534bd47a | ||
|
|
2053a26873 | ||
|
|
736a230890 | ||
|
|
3926448598 | ||
|
|
11130874d4 | ||
|
|
ef5a57119a | ||
|
|
31f4e52842 | ||
|
|
0e1aad158a | ||
|
|
5f5d6d637b | ||
|
|
a2336bcf05 | ||
|
|
20e6003290 | ||
|
|
54c633b810 | ||
|
|
f0c2cc32b1 | ||
|
|
8709982e22 | ||
|
|
686d45dcfd | ||
|
|
8502e1ff25 | ||
|
|
603c9fd959 | ||
|
|
86946fdc03 | ||
|
|
af4c99b21a | ||
|
|
97d2d68428 | ||
|
|
ce5d7cb7aa | ||
|
|
c4ff4e7167 | ||
|
|
b94d24eb25 | ||
|
|
379d0160ea | ||
|
|
23c2ea38a6 | ||
|
|
d486eb18c5 | ||
|
|
a10d488a32 | ||
|
|
25d754e86d | ||
|
|
bba85637d7 | ||
|
|
94c3a45f4c | ||
|
|
221be3def1 | ||
|
|
1daf8980dd | ||
|
|
5945408a93 | ||
|
|
9a8c568e3c | ||
|
|
fb05477e11 | ||
|
|
df68ef4d5e | ||
|
|
d857ed275e | ||
|
|
14181b7f48 | ||
|
|
6916ec5fa9 | ||
|
|
acb4822f6b | ||
|
|
79fb836d66 | ||
|
|
010110a0be | ||
|
|
756f873a25 | ||
|
|
e2d740ae04 | ||
|
|
ff244b6181 | ||
|
|
d3494d172c | ||
|
|
2922c07e67 | ||
|
|
c03a949a0d | ||
|
|
377e3ca5e6 | ||
|
|
f320728911 | ||
|
|
b4a5d88e0a | ||
|
|
7ea0b3b9e2 | ||
|
|
aa3725c860 | ||
|
|
8aa84c7fce | ||
|
|
453ceae85f | ||
|
|
1f5a0b9fa6 | ||
|
|
820a8d1de9 | ||
|
|
6bb02b28a1 | ||
|
|
60ba227d57 | ||
|
|
175e21f5e1 | ||
|
|
97db6709e4 | ||
|
|
c0fc0dfc45 | ||
|
|
f3eadd1737 | ||
|
|
c4ec48281c | ||
|
|
1a006390d9 | ||
|
|
953f265513 | ||
|
|
468877578a | ||
|
|
ff14eeb4f2 | ||
|
|
5f3eabf4cd | ||
|
|
bbc70d2471 | ||
|
|
a0cafa3d0b | ||
|
|
58219ca22f | ||
|
|
50b28f3bf2 | ||
|
|
0f8345abf7 | ||
|
|
4f213e08aa | ||
|
|
8493de3cee | ||
|
|
fee6e7428f | ||
|
|
d10616d364 | ||
|
|
85d143a273 | ||
|
|
6e72bc46d3 | ||
|
|
b8eed1d830 | ||
|
|
a64ecdfa5b | ||
|
|
bcfc0ce5f6 | ||
|
|
8bc0719dde | ||
|
|
185cd6c058 | ||
|
|
afb77541b4 | ||
|
|
c4a5c2de26 | ||
|
|
87bc4b08ff | ||
|
|
65cdb3dfa8 | ||
|
|
cc411ae004 | ||
|
|
f521b99b09 | ||
|
|
b08f330d62 | ||
|
|
41ffb1c950 | ||
|
|
ebe3ea3204 | ||
|
|
d94c4516c6 | ||
|
|
b0f8d9bb97 | ||
|
|
04dfe7b3f6 | ||
|
|
547afcfc74 | ||
|
|
48afdb4eef | ||
|
|
9ee96e3ba9 | ||
|
|
0311f5412e | ||
|
|
e734eba51e | ||
|
|
7ed40716cb | ||
|
|
155889b318 | ||
|
|
4dd011f6d0 | ||
|
|
e45a5d3a32 | ||
|
|
80a1050237 | ||
|
|
54592bba4d | ||
|
|
902d4d109a | ||
|
|
d8daacf157 | ||
|
|
0da5bcb414 | ||
|
|
ac6555fa3c | ||
|
|
2af7ef63c3 | ||
|
|
6da5b35fca | ||
|
|
abd68eb92b | ||
|
|
bf451ffc9a | ||
|
|
be734f5592 | ||
|
|
9f0c080847 | ||
|
|
3a1ba773b0 | ||
|
|
849a1ab845 | ||
|
|
940de5ab02 | ||
|
|
dd9578f379 | ||
|
|
0ce807691b | ||
|
|
4f8ea5eede | ||
|
|
7869e676af | ||
|
|
af0a726689 | ||
|
|
8d9263fca6 | ||
|
|
d6a0cbaade | ||
|
|
2302a4d04f | ||
|
|
8f9a2d08ea | ||
|
|
30c73195b5 | ||
|
|
097485195c | ||
|
|
c5f6fa110a | ||
|
|
90cfcecc09 | ||
|
|
dee0e2ed0f | ||
|
|
5ad9884ff1 | ||
|
|
188eb6b426 | ||
|
|
8361f64dbf | ||
|
|
2a6227941e | ||
|
|
a582b8f840 | ||
|
|
5316f66005 | ||
|
|
f86905457a | ||
|
|
abb211c4e8 | ||
|
|
bb56c39d16 | ||
|
|
77237196c7 | ||
|
|
a310a3b398 | ||
|
|
e0f6c7d90b | ||
|
|
a1587302aa | ||
|
|
cc0bff446b | ||
|
|
9b8ddff5b7 | ||
|
|
ac4942e26b | ||
|
|
2c55e3e917 | ||
|
|
db082802c6 | ||
|
|
b367fb5ac6 | ||
|
|
e9ab2f8d94 | ||
|
|
a845cca037 | ||
|
|
3ab6ef0aa1 | ||
|
|
198ed18b9e | ||
|
|
9110473f93 | ||
|
|
97313e0aab | ||
|
|
8876e74e43 | ||
|
|
510227e39e | ||
|
|
7a1f214166 | ||
|
|
5913dd10f1 | ||
|
|
087ebd80da | ||
|
|
bc9267e3a6 | ||
|
|
a019c335c9 | ||
|
|
ed49c8c1b6 | ||
|
|
2a243fc074 | ||
|
|
47045ce402 | ||
|
|
d6e67586bf | ||
|
|
6e9783bd25 | ||
|
|
8dc3729522 | ||
|
|
7aad4e7fb4 | ||
|
|
930af7d50b | ||
|
|
0f544f62d6 | ||
|
|
398c212955 | ||
|
|
2ec1fc60c3 | ||
|
|
c01ee053b1 | ||
|
|
b0baee5e36 | ||
|
|
b55295cb12 | ||
|
|
5928ee97ca | ||
|
|
2445ad4331 | ||
|
|
93d6d9d835 | ||
|
|
d207e6a6ad | ||
|
|
df6f3f404a | ||
|
|
357c1c8c53 | ||
|
|
44827ccad8 | ||
|
|
0d1a2dd7a9 | ||
|
|
471c9b47fe | ||
|
|
23b9a2fda0 | ||
|
|
7d6103ad6c | ||
|
|
ec39f8f8d7 | ||
|
|
a2cde53c87 | ||
|
|
13714e87f2 | ||
|
|
9101d75316 | ||
|
|
233edbf415 | ||
|
|
bd209f75fa | ||
|
|
27854a478e | ||
|
|
f12a87a96c | ||
|
|
cb4358ddbb | ||
|
|
c4819d78ba | ||
|
|
0b721cd4c4 | ||
|
|
b025757328 | ||
|
|
4bd73b6947 | ||
|
|
f3c42680db | ||
|
|
c10066205d | ||
|
|
21b7aaa428 | ||
|
|
d7225fdfce | ||
|
|
deb870c77d | ||
|
|
c05538959b | ||
|
|
f6c761dda1 | ||
|
|
877b08d6d2 | ||
|
|
a69064328b | ||
|
|
01b9566e50 | ||
|
|
ca3a100be6 | ||
|
|
1655e4ddb0 | ||
|
|
526f839764 | ||
|
|
1a86bd2a09 | ||
|
|
610e7b5bd6 | ||
|
|
86f6c04d84 | ||
|
|
fb3a1da4bb | ||
|
|
525efcbb7b | ||
|
|
ea4340e1ec | ||
|
|
91f3864fbd | ||
|
|
14fa704caf | ||
|
|
ad1f8180a5 | ||
|
|
e364f899af | ||
|
|
40683870ea | ||
|
|
7569d7c069 | ||
|
|
c87ddbb3ce | ||
|
|
793fedcf57 | ||
|
|
74fd86a69e | ||
|
|
f234091207 | ||
|
|
772b72139a | ||
|
|
6e6a844baf | ||
|
|
2f2f80273b | ||
|
|
353d8860ac | ||
|
|
fab96cb72a | ||
|
|
2203e41900 | ||
|
|
e16f2bc5f7 | ||
|
|
2381cf3269 | ||
|
|
7e3a82cd9c | ||
|
|
115817d118 | ||
|
|
5cfea4fc98 | ||
|
|
a87c870f99 | ||
|
|
b9d671326b | ||
|
|
8e4e070151 | ||
|
|
4607e1386f | ||
|
|
9686172872 | ||
|
|
8563ac1664 | ||
|
|
9a80a35f4b | ||
|
|
4cde19b0c9 | ||
|
|
230e8b436f | ||
|
|
dbb86efac3 | ||
|
|
e8d28e1b1c | ||
|
|
a3a5d0d1f4 | ||
|
|
4cf1ca4338 | ||
|
|
f174f27096 | ||
|
|
1a15762c59 | ||
|
|
fec6a4ca4e | ||
|
|
bcc878bb81 | ||
|
|
df61a00acc | ||
|
|
878fea5403 | ||
|
|
804cc98cd1 | ||
|
|
6e00020a9f | ||
|
|
2aac9a1fa3 | ||
|
|
5aa8676122 | ||
|
|
ea88d94dcf | ||
|
|
eaa1b0a5f2 | ||
|
|
de5c932283 | ||
|
|
3b673e0fb0 | ||
|
|
83b84d65c2 | ||
|
|
c31e04e2f8 | ||
|
|
a460e00574 | ||
|
|
c593d488f9 | ||
|
|
44a7c89e02 | ||
|
|
88bbbfa567 | ||
|
|
e3f9ce59eb | ||
|
|
12f0c2f580 | ||
|
|
6099e57b07 | ||
|
|
e53ecd35c0 | ||
|
|
8397b45b20 | ||
|
|
bcb1b414ed | ||
|
|
bef02a89ea | ||
|
|
1aae1bf9fd | ||
|
|
078f2aecfb | ||
|
|
c87f913eb9 | ||
|
|
a5fc3eb9d4 | ||
|
|
780dc06584 | ||
|
|
365cddf35f | ||
|
|
c099ea497a | ||
|
|
336b43d278 | ||
|
|
08e585d948 | ||
|
|
7aacd895ee | ||
|
|
3130af0e2b | ||
|
|
02a58af3c0 | ||
|
|
86645a3f19 | ||
|
|
edc3994cfd | ||
|
|
71f29b701d | ||
|
|
b4b853b4c5 | ||
|
|
d5483f3352 | ||
|
|
2522de8594 | ||
|
|
e5e60564cf | ||
|
|
bf2dabe6f1 | ||
|
|
70c873bcac | ||
|
|
5aabf5b8eb | ||
|
|
20e82ae2a2 | ||
|
|
e890cb118c | ||
|
|
275d1aa94e | ||
|
|
f748fda0ed | ||
|
|
87480bf6d4 | ||
|
|
bd6f1edea8 | ||
|
|
ed4c9fc4e9 | ||
|
|
8f8be84024 | ||
|
|
ead562ed05 | ||
|
|
8cf8726c7c | ||
|
|
b83df4e711 | ||
|
|
7e64470a71 | ||
|
|
fd3d717df5 | ||
|
|
d4ebb803fa | ||
|
|
5d276731e6 | ||
|
|
6dcfbc479d | ||
|
|
d8bf20d9ac | ||
|
|
38453101f0 | ||
|
|
8e46375186 | ||
|
|
c75d7fb32e | ||
|
|
6e0cf087ad | ||
|
|
af9a41d770 | ||
|
|
d6dc43db7d | ||
|
|
4c49647788 | ||
|
|
3de7bde0e1 | ||
|
|
dc38e24fed | ||
|
|
a61724c004 | ||
|
|
29b738b4e6 | ||
|
|
602d314ba0 | ||
|
|
a68974409c | ||
|
|
5d67107c79 | ||
|
|
da9b591621 | ||
|
|
2e8aa25844 | ||
|
|
6611322a8b | ||
|
|
948c6ee88d | ||
|
|
b7a9d80f28 | ||
|
|
277f6fbe49 | ||
|
|
e05080f5a8 | ||
|
|
4de250dd75 | ||
|
|
8f2f7f431c | ||
|
|
4f67b78853 | ||
|
|
4b14b35208 | ||
|
|
bc2ab12f99 | ||
|
|
c3166b2a48 | ||
|
|
1eef1e5b2f | ||
|
|
8191965555 | ||
|
|
f1c9244dfd | ||
|
|
58155a9921 | ||
|
|
5d398a69fb | ||
|
|
4560de58f4 | ||
|
|
7f9f605781 | ||
|
|
41cad5fbed | ||
|
|
e4f15b0f0e | ||
|
|
d4e3ef6eae | ||
|
|
eda90ace80 | ||
|
|
0c127348e1 | ||
|
|
eb6b59af64 | ||
|
|
11066e33f8 | ||
|
|
51a32d64d8 | ||
|
|
77a9f59487 | ||
|
|
1814c4e45b | ||
|
|
722f5fd8d4 | ||
|
|
e9c8dcf96c | ||
|
|
89e0d95883 | ||
|
|
aeb9906717 | ||
|
|
368971ec8b | ||
|
|
0112826daf | ||
|
|
9023e8f7bb | ||
|
|
48fac4e8ce | ||
|
|
edeccce619 | ||
|
|
60668aa210 | ||
|
|
455e8a4281 | ||
|
|
5d7fe7a718 | ||
|
|
64ca95e375 | ||
|
|
837eecbc91 | ||
|
|
26cc10a00c | ||
|
|
f12abe957d | ||
|
|
caaf688582 | ||
|
|
3dfd0cd62a | ||
|
|
18bd86f154 | ||
|
|
338f465019 | ||
|
|
ac13f5e6f9 | ||
|
|
1b6f6d80ea | ||
|
|
18b078414a | ||
|
|
f6ce318061 | ||
|
|
a21c94e3dc | ||
|
|
38b92d56e7 | ||
|
|
a08d95b971 | ||
|
|
339416b38b | ||
|
|
7e2f07486a | ||
|
|
a3e569cdda | ||
|
|
d68d8d82e6 | ||
|
|
997b4a544d | ||
|
|
176d2b622e | ||
|
|
3a9ab23713 | ||
|
|
9e88fcd58c | ||
|
|
39ffc1c3c7 | ||
|
|
69d0e44295 | ||
|
|
d2d5e540ac | ||
|
|
d7bd2d2b2c | ||
|
|
ddf5fc8a42 | ||
|
|
0841c63e0d | ||
|
|
a4d439b975 | ||
|
|
8de509a837 | ||
|
|
219760639a | ||
|
|
38ed8795ab | ||
|
|
55697d7dc9 | ||
|
|
a7fb782aea | ||
|
|
d91c64e428 | ||
|
|
4aa911abc6 | ||
|
|
64c72bb919 | ||
|
|
fec191d3cc | ||
|
|
7430bcbc44 | ||
|
|
eba11d2ba5 | ||
|
|
a3a724f805 | ||
|
|
a770d71890 | ||
|
|
1de866cd09 | ||
|
|
54380f53a2 | ||
|
|
7d870524d3 | ||
|
|
d28aad9a58 | ||
|
|
8be63adbc8 | ||
|
|
7d8f352e0a | ||
|
|
587382c0ba | ||
|
|
0f714ca6bc | ||
|
|
63da1df6fe | ||
|
|
bbe589da44 | ||
|
|
b278e91338 | ||
|
|
f2609e133d | ||
|
|
e14fdbbddb | ||
|
|
a162155919 | ||
|
|
4d7ae382a8 | ||
|
|
0c86eb2dc7 | ||
|
|
70c2db8b9f | ||
|
|
c1dd118d2c | ||
|
|
2d21d91abd | ||
|
|
e5ee05dc0d | ||
|
|
c0d53e176b | ||
|
|
b26d188190 | ||
|
|
0a6382e2af | ||
|
|
1214d8cd26 | ||
|
|
65a30ab0a2 | ||
|
|
61616abef2 | ||
|
|
bb1fcd1ba8 | ||
|
|
6d65121993 | ||
|
|
ecf0bffb79 | ||
|
|
af2ea0a1f2 | ||
|
|
286467db82 | ||
|
|
6b60a31ebf | ||
|
|
54028e5943 | ||
|
|
0c062e839d | ||
|
|
0fcbf05b6d | ||
|
|
f4276c36c9 | ||
|
|
ba05bddf92 | ||
|
|
7a63d75a83 | ||
|
|
da3f74a70e | ||
|
|
5f26656fc5 | ||
|
|
2f76e90d1a | ||
|
|
1296329f02 | ||
|
|
e38b432846 | ||
|
|
549a5101e7 | ||
|
|
031a8648cb | ||
|
|
a8476a8404 | ||
|
|
25c8491fc8 | ||
|
|
d0d637dd47 | ||
|
|
977c6bd44c | ||
|
|
89ad3aa168 | ||
|
|
55b921dab2 | ||
|
|
92d0fe938f | ||
|
|
d07e9b03c4 | ||
|
|
6cbd1cba68 | ||
|
|
3b8df1f143 | ||
|
|
85f7d0a8d5 | ||
|
|
556450a2ff | ||
|
|
6048b12510 | ||
|
|
8cafc1e1ac | ||
|
|
51807d7608 | ||
|
|
e104df5bb7 | ||
|
|
c6df7e5899 | ||
|
|
d0a4300dde | ||
|
|
d8865433f9 | ||
|
|
9c2bd642ba | ||
|
|
09883db208 | ||
|
|
f7f68f7160 | ||
|
|
31f744a8c0 | ||
|
|
bc66c96275 | ||
|
|
87c2acdeae | ||
|
|
6b90023764 | ||
|
|
e502bca962 | ||
|
|
c4d44b72e8 | ||
|
|
e7324bb94f | ||
|
|
8431b2c190 | ||
|
|
7d376ccd8c | ||
|
|
382410249d | ||
|
|
bfb5132362 | ||
|
|
4489dbc630 | ||
|
|
5c31bc8ffc | ||
|
|
baee5f46cf | ||
|
|
66ab7ffa15 | ||
|
|
32df7eb346 | ||
|
|
576b532b45 | ||
|
|
b520414d5a | ||
|
|
b54fd5c588 | ||
|
|
d9b4c01719 | ||
|
|
84d5d968a6 | ||
|
|
9c8717e42f | ||
|
|
3215e97b17 | ||
|
|
975e721432 | ||
|
|
b8bccdd081 | ||
|
|
4310a4d813 | ||
|
|
b96b342561 | ||
|
|
eb1cd11d57 | ||
|
|
a55c72890d | ||
|
|
247e230581 | ||
|
|
1586ea6fe9 | ||
|
|
ae505c50b0 | ||
|
|
fce1b4b1fb | ||
|
|
c6bcbf4951 | ||
|
|
6ed6086da5 | ||
|
|
9f7b16ad19 | ||
|
|
fc70a92071 | ||
|
|
ccaaab2898 | ||
|
|
8d36e630f2 | ||
|
|
eb1f347bca | ||
|
|
7db798186c | ||
|
|
a1cd94bfbb | ||
|
|
d9d2a6f6d9 | ||
|
|
b8c4b82d18 | ||
|
|
b8f615d7a1 | ||
|
|
35d97eb5c5 | ||
|
|
fc15b2e479 | ||
|
|
936df0d290 | ||
|
|
3236beddf8 | ||
|
|
c13f8f10e6 | ||
|
|
d8b530b93c | ||
|
|
2296f211e8 | ||
|
|
a5136b8863 | ||
|
|
913bc38217 | ||
|
|
4b7dca3d2c | ||
|
|
5c58e3ee31 | ||
|
|
49f304bd07 | ||
|
|
c95be42221 | ||
|
|
dbc07e13bb | ||
|
|
5ca40ebc22 | ||
|
|
a8e07274ae | ||
|
|
af99dba018 | ||
|
|
03dfa028d2 | ||
|
|
541b47ac2a | ||
|
|
507a35a9be | ||
|
|
1eddb5463e | ||
|
|
d91769efd4 | ||
|
|
134a8eb272 | ||
|
|
930be98598 | ||
|
|
28e3cb3e93 | ||
|
|
6328671ef8 | ||
|
|
fab1959d00 | ||
|
|
5ab788cd84 | ||
|
|
ce2a6d3739 | ||
|
|
40dd10dfb2 | ||
|
|
e41076e082 | ||
|
|
582fec4e11 | ||
|
|
42ae02aa08 | ||
|
|
79e3fc64c4 | ||
|
|
b188d671d1 | ||
|
|
5ecf1b53ea | ||
|
|
0636311d37 | ||
|
|
219d3b449f | ||
|
|
22eaa89c5a | ||
|
|
79e28a4c2e | ||
|
|
db05b1eb2b | ||
|
|
d20666a228 | ||
|
|
9cc7b03503 | ||
|
|
b38f12d519 | ||
|
|
e736f1ead9 | ||
|
|
b56c1f6023 | ||
|
|
268f0d64fc | ||
|
|
b3ea17736b | ||
|
|
963daeaec5 | ||
|
|
249bd44ebc | ||
|
|
04a1b1c123 | ||
|
|
3922e7afc3 | ||
|
|
f0a97a0d80 | ||
|
|
88713fd590 | ||
|
|
394759e0c8 | ||
|
|
c229f65dcf | ||
|
|
f929861609 | ||
|
|
f024ce7675 | ||
|
|
f3fcf00392 | ||
|
|
08313ef870 | ||
|
|
911c469d69 | ||
|
|
07c089ee04 | ||
|
|
dadc944810 | ||
|
|
80663032a9 | ||
|
|
67c75ee7f0 | ||
|
|
62626737a5 | ||
|
|
e404eed318 | ||
|
|
3c115428ea | ||
|
|
db40ca4aca | ||
|
|
f456d0d6bb | ||
|
|
06fe17eb9f | ||
|
|
7945bdb88f | ||
|
|
f7794ec181 | ||
|
|
16851b3eb3 | ||
|
|
c72d8d4d29 | ||
|
|
2b7436558e | ||
|
|
e59c47d5b1 | ||
|
|
c1523ad16d | ||
|
|
d0be8e27de | ||
|
|
5c66b81289 | ||
|
|
1a42cb2013 | ||
|
|
cf2978cbbb | ||
|
|
8a9733e777 | ||
|
|
ba880c5501 | ||
|
|
788f962fbd | ||
|
|
12f8283560 | ||
|
|
4d27f6b77b | ||
|
|
413ed28246 | ||
|
|
ad084f559a | ||
|
|
3832ab1c21 | ||
|
|
999bceb413 | ||
|
|
e8f6605642 | ||
|
|
3148c65323 | ||
|
|
0a3d2cc68b | ||
|
|
11cf76edb3 | ||
|
|
8833ad415c | ||
|
|
bc290d8e6c | ||
|
|
9c5b3a4060 | ||
|
|
04bbba55c7 | ||
|
|
40b70d5373 | ||
|
|
833d32646e | ||
|
|
6cdefb3cac | ||
|
|
f959d3ee7a | ||
|
|
b0952eabc7 | ||
|
|
43bb4ba4bf | ||
|
|
c2de22abeb | ||
|
|
a0113ee049 | ||
|
|
05db10fda3 | ||
|
|
948ee23a2a | ||
|
|
271a2931b6 | ||
|
|
9fe05edd47 | ||
|
|
c2573702cf | ||
|
|
b8e76b586e | ||
|
|
11a89964b9 | ||
|
|
b5bfcbae59 | ||
|
|
efe95a6953 | ||
|
|
e88a5eca8b | ||
|
|
2e3980e1de | ||
|
|
0ff85c6923 | ||
|
|
e3358d1839 | ||
|
|
f5eac0c7fa | ||
|
|
6034592a27 | ||
|
|
7b00d826d3 | ||
|
|
52ef3586b9 | ||
|
|
4118fcdd14 | ||
|
|
d9e18047d3 | ||
|
|
734f320ade | ||
|
|
79f25cdeb2 | ||
|
|
413f3db617 | ||
|
|
4db11d5143 | ||
|
|
78d28c6b96 | ||
|
|
24df7333a2 | ||
|
|
8694cd8bf5 | ||
|
|
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 | ||
|
|
e68f5a361b | ||
|
|
328353990f | ||
|
|
82ae383331 | ||
|
|
e1eff58f87 | ||
|
|
f64a06f5ec | ||
|
|
87c6bc984a | ||
|
|
13cfbac075 | ||
|
|
e164447858 | ||
|
|
1909560348 | ||
|
|
d4e8109a48 | ||
|
|
be9de0f428 | ||
|
|
cdf140beec | ||
|
|
231e687411 | ||
|
|
76e5fd642e | ||
|
|
f05f8033b8 | ||
|
|
408b421265 | ||
|
|
2ad31ae31f | ||
|
|
f6b4f45c7e | ||
|
|
d56aca7104 | ||
|
|
f5ed0e130c | ||
|
|
fbbb5ecb52 | ||
|
|
5e5c1e1f56 | ||
|
|
32fc5ceb91 | ||
|
|
4766a244b2 | ||
|
|
a4d54bdb4a | ||
|
|
ff9c947a1a | ||
|
|
15dac0b14e | ||
|
|
316f97a063 | ||
|
|
3d5a520610 | ||
|
|
98b0ff4998 | ||
|
|
1394480f4b | ||
|
|
1f2d559f70 | ||
|
|
db66d44801 | ||
|
|
d436672048 | ||
|
|
104622bebb | ||
|
|
fc4a143ec6 | ||
|
|
ec61c23d56 | ||
|
|
1ef65b6742 | ||
|
|
752945701e | ||
|
|
98c9d73605 | ||
|
|
6942d53c25 | ||
|
|
326320e5a9 | ||
|
|
228bd390ac | ||
|
|
4accabb590 |
59
ANNOUNCE
@@ -1,38 +1,35 @@
|
|||||||
|
|
||||||
Libpng 1.0.6e - April 10, 2000
|
Libpng 1.4.7 - April 10, 2011
|
||||||
|
|
||||||
This is not intended to be a public release. It will be replaced
|
This is a public release of libpng, intended for use in production codes.
|
||||||
within a few weeks by a public version or by another test version.
|
|
||||||
|
|
||||||
Changes since the last public release (1.0.6):
|
Files available for download:
|
||||||
|
|
||||||
version 1.0.6d [April 8, 2000]
|
Source files with LF line endings (for Unix/Linux) and with a
|
||||||
Changed sprintf() to strcpy() in png_write_sCAL_s() to work without STDIO
|
"configure" script
|
||||||
Added data_length parameter to png_decompress_chunk() function
|
|
||||||
Revised documentation to remove reference to abandoned png_free_chnk functions
|
|
||||||
Fixed an error in png_rgb_to_gray_fixed()
|
|
||||||
Revised example.c, usage of png_destroy_write_struct().
|
|
||||||
Renamed makefile.ibmvac3 to makefile.ibmc, added libpng.icc IBM project file
|
|
||||||
Added a check for info_ptr->free_me&PNG_FREE_TEXT when free'ing text in png.c
|
|
||||||
Simplify png_sig_bytes() function to remove use of non-ISO-C strdup().
|
|
||||||
version 1.0.6e [April 10, 2000]
|
|
||||||
Added png_data_freer() function.
|
|
||||||
In the code that checks for over-length tRNS chunks, added check of
|
|
||||||
info_ptr->num_trans as well as png_ptr->num_trans (Matthias Benckmann)
|
|
||||||
Minor revisions of libpng.txt/libpng.3.
|
|
||||||
Check for existing data and free it if the free_me flag is set, in png_set_*()
|
|
||||||
and png_handle_*().
|
|
||||||
Only define PNG_WEIGHTED_FILTERS_SUPPORTED when PNG_FLOATING_POINT_SUPPORTED
|
|
||||||
is defined.
|
|
||||||
Changed several instances of PNG_NO_CONSOLE_ID to PNG_NO_STDIO in pngrutil.c
|
|
||||||
and mentioned the purposes of the two macros in libpng.txt/libpng.3.
|
|
||||||
|
|
||||||
Send comments/corrections/commendations to
|
libpng-1.4.7.tar.xz (LZMA-compressed, recommended)
|
||||||
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
libpng-1.4.7.tar.gz
|
||||||
|
libpng-1.4.7.tar.bz2
|
||||||
Glenn R-P
|
|
||||||
|
Source files with CRLF line endings (for Windows), without the
|
||||||
Send comments/corrections/commendations to
|
"configure" script
|
||||||
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
|
||||||
|
lpng147.7z (LZMA-compressed, recommended)
|
||||||
|
lpng147.zip
|
||||||
|
|
||||||
|
Other information:
|
||||||
|
|
||||||
|
libpng-1.4.7-README.txt
|
||||||
|
libpng-1.4.7-LICENSE.txt
|
||||||
|
|
||||||
|
Changes since the last public release (1.4.6):
|
||||||
|
|
||||||
|
Relocated misplaced new declarations in pngwutil.c.
|
||||||
|
Disabled PNG_PEDANTIC_WARNINGS for all MSC versions as in libpng-1.4.5.
|
||||||
|
|
||||||
|
Send comments/corrections/commendations to glennrp at users.sourceforge.net
|
||||||
|
or to png-mng-implement at lists.sf.net (subscription required; visit
|
||||||
|
https://lists.sourceforge.net/lists/listinfo/png-mng-implement).
|
||||||
|
|
||||||
Glenn R-P
|
Glenn R-P
|
||||||
|
|||||||
397
CMakeLists.txt
Normal file
@@ -0,0 +1,397 @@
|
|||||||
|
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 4)
|
||||||
|
set(PNGLIB_RELEASE 7)
|
||||||
|
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")
|
||||||
|
|
||||||
|
# OUR SOURCES
|
||||||
|
set(libpng_public_hdrs
|
||||||
|
png.h
|
||||||
|
pngconf.h
|
||||||
|
)
|
||||||
|
set(libpng_sources
|
||||||
|
${libpng_public_hdrs}
|
||||||
|
pngpriv.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 lib)
|
||||||
|
endif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||||
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
|
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
|
set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
|
||||||
|
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
|
||||||
|
set(LIBS "-lz -lm")
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)
|
||||||
|
_png_generate_symlink_code(PNG_PC_INSTALL_CODE
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/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
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/libpng-config)
|
||||||
|
install(CODE ${PNG_CONFIG_INSTALL_CODE})
|
||||||
|
|
||||||
|
# SET UP LINKS
|
||||||
|
if(PNG_SHARED)
|
||||||
|
set_target_properties(${PNG_LIB_NAME} PROPERTIES
|
||||||
|
# VERSION 14.${PNGLIB_RELEASE}.1.4.7
|
||||||
|
VERSION 14.${PNGLIB_RELEASE}.0
|
||||||
|
SOVERSION 14
|
||||||
|
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)
|
||||||
|
IF(CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
||||||
|
_png_generate_symlink_code(PNG_SHARED_INSTALL_CODE
|
||||||
|
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${PNGLIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
|
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||||
|
install(CODE ${PNG_SHARED_INSTALL_CODE})
|
||||||
|
install(FILES
|
||||||
|
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
ELSE(CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
||||||
|
_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(CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
||||||
|
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)
|
||||||
|
IF(CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
|
||||||
|
_png_generate_symlink_code(PNG_STATIC_INSTALL_CODE
|
||||||
|
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${PNGLIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||||
|
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||||
|
install(CODE ${PNG_STATIC_INSTALL_CODE})
|
||||||
|
install(FILES
|
||||||
|
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
ELSE(CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
|
||||||
|
_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(CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
|
||||||
|
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
|
||||||
|
|
||||||
152
INSTALL
@@ -1,17 +1,53 @@
|
|||||||
|
|
||||||
Installing libpng version 1.0.6e - April 10, 2000
|
Installing libpng version 1.4.7 - April 10, 2011
|
||||||
|
|
||||||
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. If you run 'libtoolize --force', though, this will replace
|
||||||
|
the distributed, patched, version of ltmain.sh with an unpatched version
|
||||||
|
and your shared library builds may fail to produce libraries with the
|
||||||
|
correct version numbers.
|
||||||
|
|
||||||
|
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.6e" or "lpng106" and "zlib-1.1.3"
|
might be called "libpng-1.4.7" or "libpng14" and "zlib-1.2.3"
|
||||||
or "zlib113") so that you have directories called "zlib" and "libpng".
|
or "zlib123") so that you have directories called "zlib" and "libpng".
|
||||||
|
|
||||||
Your directory structure should look like this:
|
Your directory structure should look like this:
|
||||||
|
|
||||||
@@ -21,12 +57,27 @@ 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,
|
||||||
|
aclocal.m4, config.h.in, config.sub,
|
||||||
|
depcomp, install-sh, test-pngtest.sh
|
||||||
contrib
|
contrib
|
||||||
gregbook
|
gregbook
|
||||||
|
pngminim
|
||||||
pngminus
|
pngminus
|
||||||
pngsuite
|
pngsuite
|
||||||
|
visupng
|
||||||
|
projects
|
||||||
|
cbuilder5 (Borland)
|
||||||
|
visualc6 (msvc)
|
||||||
|
visualc71
|
||||||
|
vstudio
|
||||||
|
xcode
|
||||||
scripts
|
scripts
|
||||||
makefile.*
|
makefile.*
|
||||||
|
*.def (module definition files)
|
||||||
pngtest.png
|
pngtest.png
|
||||||
etc.
|
etc.
|
||||||
zlib
|
zlib
|
||||||
@@ -40,53 +91,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.
|
||||||
|
|
||||||
First enter the zlib directory and follow the instructions in zlib/README.
|
If you are building libpng with MSVC, you can enter the
|
||||||
Then come back here and choose the appropriate makefile.sys in the scripts
|
libpng projects\visualc6 or visualc71 directory and follow the instructions
|
||||||
directory.
|
in README.txt.
|
||||||
The files that are presently available in the scripts directory
|
|
||||||
include
|
|
||||||
|
|
||||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
Otherwise enter the zlib directory and follow the instructions in zlib/README,
|
||||||
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6e)
|
then come back here and run "configure" or choose the appropriate
|
||||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6e,
|
makefile.sys in the scripts directory.
|
||||||
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.dec => DEC Alpha UNIX makefile
|
|
||||||
makefile.hpux => HPUX (10.20 and 11.00) makefile
|
|
||||||
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
|
|
||||||
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
|
|
||||||
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
|
||||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.6e)
|
|
||||||
makefile.sunos => Sun makefile
|
|
||||||
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.6e)
|
|
||||||
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
|
||||||
@@ -100,18 +111,33 @@ target directories to match your preferences.
|
|||||||
Then read pngconf.h to see if you want to make any configuration
|
Then read pngconf.h 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".
|
||||||
|
|
||||||
|
If you encounter a compiler error message complaining about the
|
||||||
|
lines
|
||||||
|
|
||||||
|
__png.h__ already includes setjmp.h;
|
||||||
|
__dont__ include it again.;
|
||||||
|
|
||||||
|
this means you have compiled another module that includes setjmp.h,
|
||||||
|
which is hazardous because the two modules might not include exactly
|
||||||
|
the same setjmp.h. If you are sure that you know what you are doing
|
||||||
|
and that they are exactly the same, then you can comment out or
|
||||||
|
delete the two lines. Better yet, use the cexcept interface
|
||||||
|
instead, as demonstrated in contrib/visupng of the libpng distribution.
|
||||||
|
|
||||||
Further information can be found in the README and libpng.txt
|
Further information can be found in the README and libpng.txt
|
||||||
files, in the individual makefiles, in png.h, and the manual pages
|
files, in the individual makefiles, in png.h, and the manual pages
|
||||||
|
|||||||
82
KNOWNBUG
@@ -1,82 +0,0 @@
|
|||||||
|
|
||||||
Known bugs and suggested enhancements in libpng-1.0.6
|
|
||||||
|
|
||||||
1. April 1, 2000 -- BUG
|
|
||||||
|
|
||||||
Under some circumstances old applications that make direct access to
|
|
||||||
the info_ptr->text and its members might free the same memory that
|
|
||||||
is also free'ed by libpng during the png_destroy_struct process.
|
|
||||||
|
|
||||||
Fixed in libpng-1.0.6-patch-03 and libpng-1.0.6d. The PNG_FREE_TEXT flag
|
|
||||||
bit in info_ptr->free_me is now checked to make sure libpng is responsible
|
|
||||||
for freeing the memory.
|
|
||||||
|
|
||||||
2. April 1, 2000 -- BUG
|
|
||||||
|
|
||||||
The non-ISO-C "strdup()" function is used in png.c
|
|
||||||
|
|
||||||
STATUS: The function has been simplified and no longer uses strdup()
|
|
||||||
in libpng-1.0.6-patch-03 and libpng-1.0.6d.
|
|
||||||
|
|
||||||
3. March 24, 2000 -- BUG
|
|
||||||
|
|
||||||
The png_set_rgb_to_gray_fixed() function is setting incorrect weighting
|
|
||||||
factors.
|
|
||||||
|
|
||||||
STATUS: Fixed in libpng-1.0.6-patch-02 and libpng-1.0.6d.
|
|
||||||
|
|
||||||
4. March 22, 2000 -- BUG
|
|
||||||
|
|
||||||
There are some printf() and fprintf() statements active in pngwutil.c
|
|
||||||
when PNG_NO_STDIO and PNG_sCAL_SUPPORTED are both defined.
|
|
||||||
|
|
||||||
STATUS: Fixed in libpng-1.0.6-patch-01 and libpng-1.0.6d. The strcpy()
|
|
||||||
function is used instead.
|
|
||||||
|
|
||||||
5. March 22, 2000 -- BUG
|
|
||||||
|
|
||||||
The length of the iCCP chunk data is calculated incorrectly; because
|
|
||||||
it can contain zeroes, strlen() doesn't work.
|
|
||||||
|
|
||||||
STATUS: Fixed in libpng-1.0.6-patch-01 and libpng-1.0.6d by adding a
|
|
||||||
data_length parameter to the png_decompress_chunk() function.
|
|
||||||
|
|
||||||
6. March 15, 1998 -- OPTIMIZATION -- Kevin Bracey
|
|
||||||
|
|
||||||
Loops need to be optimized everywhere
|
|
||||||
|
|
||||||
Make them count down instead of up -- Kevin Bracey
|
|
||||||
|
|
||||||
Optimizing compilers don't need this, and making
|
|
||||||
the change would be error prone -- Tom Lane, Glenn R-P
|
|
||||||
|
|
||||||
Question whether i-- or --i is better.
|
|
||||||
|
|
||||||
STATUS: Under investigation, postponed until after
|
|
||||||
libpng-1.1.0. About 160 loops will be turned around
|
|
||||||
in libpng-1.1.Nn, for testing.
|
|
||||||
|
|
||||||
7. July 4, 1998 -- ENHANCEMENT -- Glenn R-P
|
|
||||||
|
|
||||||
libpng-1.0.5 and earlier transform colors to gamma=1.0 space for
|
|
||||||
merging with background, and then back to the image's gamma. The
|
|
||||||
bit_depth of the intermediate (gamma=1.0) representation is probably
|
|
||||||
not sufficient. In the typical gamma=1/2.2 situation, the linear
|
|
||||||
pixels need about 4 more bits than the gamma-encoded ones, to avoid
|
|
||||||
loss of precision. A similar situation exists with the rgb_to_gray
|
|
||||||
operation.
|
|
||||||
|
|
||||||
STATUS: under development.
|
|
||||||
|
|
||||||
8. September 1999 -- ENHANCEMENT --
|
|
||||||
|
|
||||||
It should be possible to use libpng without floating-point aritmetic.
|
|
||||||
|
|
||||||
STATUS: Under investigation, implementation postponed until after
|
|
||||||
libpng-1.0.6. The application interface will change because replacements
|
|
||||||
for the png_set_gAMA(), png_set_cHRM(), and corresponding png_get_()
|
|
||||||
functions will be needed.
|
|
||||||
|
|
||||||
Much of this was completed in libpng-1.0.6, but gamma compensation
|
|
||||||
is not yet done in fixed-point arithmetic.
|
|
||||||
|
|
||||||
94
LICENSE
@@ -1,29 +1,71 @@
|
|||||||
COPYRIGHT NOTICE:
|
|
||||||
|
|
||||||
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
This copy of the libpng notices is provided for your convenience. In case of
|
||||||
(libpng versions 0.5, May 1995, through 0.89c, May 1996)
|
any discrepancy between this copy and the notices in the file png.h that is
|
||||||
|
included in the libpng distribution, the latter shall prevail.
|
||||||
|
|
||||||
|
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
||||||
|
|
||||||
|
If you modify libpng you may insert additional notices immediately following
|
||||||
|
this sentence.
|
||||||
|
|
||||||
|
This code is released under the libpng license.
|
||||||
|
|
||||||
|
libpng versions 1.2.6, August 15, 2004, through 1.4.7, April 10, 2011, 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
|
||||||
|
|
||||||
|
Simon-Pierre Cadieux
|
||||||
|
Eric S. Raymond
|
||||||
|
Gilles Vollant
|
||||||
|
|
||||||
|
and with the following additions to the disclaimer:
|
||||||
|
|
||||||
|
There is no warranty against interference with your enjoyment of the
|
||||||
|
library or against infringement. There is no warranty that our
|
||||||
|
efforts or the library will fulfill any of your particular purposes
|
||||||
|
or needs. This library is provided with all faults, and the entire
|
||||||
|
risk of satisfactory quality, performance, accuracy, and effort is with
|
||||||
|
the user.
|
||||||
|
|
||||||
|
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||||
|
Copyright (c) 1998, 1999 Glenn Randers-Pehrson, and are
|
||||||
|
distributed according to the same disclaimer and license as libpng-0.96,
|
||||||
|
with the following individuals added to the list of Contributing Authors:
|
||||||
|
|
||||||
|
Tom Lane
|
||||||
|
Glenn Randers-Pehrson
|
||||||
|
Willem van Schaik
|
||||||
|
|
||||||
|
libpng versions 0.89, June 1996, through 0.96, May 1997, are
|
||||||
Copyright (c) 1996, 1997 Andreas Dilger
|
Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
(libpng versions 0.90, December 1996, through 0.96, May 1997)
|
Distributed according to the same disclaimer and license as libpng-0.88,
|
||||||
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
with the following individuals added to the list of Contributing Authors:
|
||||||
(libpng versions 0.97, January 1998, through 1.0.6e, April 10, 2000)
|
|
||||||
|
|
||||||
For the purposes of this copyright and license, "Contributing Authors"
|
|
||||||
is defined as the following set of individuals:
|
|
||||||
|
|
||||||
John Bowler
|
John Bowler
|
||||||
Kevin Bracey
|
Kevin Bracey
|
||||||
Sam Bushell
|
Sam Bushell
|
||||||
Andreas Dilger
|
|
||||||
Magnus Holmgren
|
Magnus Holmgren
|
||||||
Tom Lane
|
|
||||||
Dave Martindale
|
|
||||||
Glenn Randers-Pehrson
|
|
||||||
Eric S. Raymond
|
|
||||||
Greg Roelofs
|
Greg Roelofs
|
||||||
|
Tom Tanner
|
||||||
|
|
||||||
|
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
||||||
|
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
||||||
|
For the purposes of this copyright and license, "Contributing Authors"
|
||||||
|
is defined as the following set of individuals:
|
||||||
|
|
||||||
|
Andreas Dilger
|
||||||
|
Dave Martindale
|
||||||
Guy Eric Schalnat
|
Guy Eric Schalnat
|
||||||
Paul Schmidt
|
Paul Schmidt
|
||||||
Tom Tanner
|
|
||||||
Willem van Schaik
|
|
||||||
Tim Wegner
|
Tim Wegner
|
||||||
|
|
||||||
The PNG Reference Library is supplied "AS IS". The Contributing Authors
|
The PNG Reference Library is supplied "AS IS". The Contributing Authors
|
||||||
@@ -38,16 +80,13 @@ Permission is hereby granted to use, copy, modify, and distribute this
|
|||||||
source code, or portions hereof, for any purpose, without fee, subject
|
source code, or portions hereof, for any purpose, without fee, subject
|
||||||
to the following restrictions:
|
to the following restrictions:
|
||||||
|
|
||||||
1. The origin of this source code must not be
|
1. The origin of this source code must not be misrepresented.
|
||||||
misrepresented.
|
|
||||||
|
|
||||||
2. Altered versions must be plainly marked as such
|
2. Altered versions must be plainly marked as such and must not
|
||||||
and must not be misrepresented as being the
|
be misrepresented as being the original source.
|
||||||
original source.
|
|
||||||
|
|
||||||
3. This Copyright notice may not be removed or
|
3. This Copyright notice may not be removed or altered from any
|
||||||
altered from any source or altered source
|
source or altered source distribution.
|
||||||
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
|
||||||
@@ -55,17 +94,18 @@ supporting the PNG file format in commercial products. If you use this
|
|||||||
source code in a product, acknowledgment is not required but would be
|
source code in a product, acknowledgment is not required but would be
|
||||||
appreciated.
|
appreciated.
|
||||||
|
|
||||||
|
|
||||||
A "png_get_copyright" function is available, for convenient use in "about"
|
A "png_get_copyright" function is available, for convenient use in "about"
|
||||||
boxes and the like:
|
boxes and the like:
|
||||||
|
|
||||||
printf("%s",png_get_copyright(NULL));
|
printf("%s",png_get_copyright(NULL));
|
||||||
|
|
||||||
Also, the PNG logo (in PNG format, of course) is supplied in the
|
Also, the PNG logo (in PNG format, of course) is supplied in the
|
||||||
file "pngnow.png".
|
files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
|
||||||
|
|
||||||
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is a
|
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
|
||||||
April 10, 2000
|
April 10, 2011
|
||||||
|
|||||||
132
Makefile.am
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
# 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
|
||||||
|
AUTOMAKE_OPTIONS = foreign
|
||||||
|
|
||||||
|
# test programs - run on make check, make distcheck
|
||||||
|
check_PROGRAMS= pngtest
|
||||||
|
pngtest_SOURCES = pngtest.c
|
||||||
|
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
|
TESTS = test-pngtest.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 pngset.c pngget.c pngrutil.c \
|
||||||
|
pngtrans.c pngwutil.c \
|
||||||
|
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
||||||
|
pngwtran.c pngmem.c pngerror.c pngpread.c \
|
||||||
|
png.h pngconf.h pngpriv.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
|
||||||
|
|
||||||
|
# Avoid depending upon Character Ranges.
|
||||||
|
AN = '_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
|
||||||
|
|
||||||
|
#distribute headers in /usr/include/libpng/*
|
||||||
|
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
|
||||||
|
pkginclude_HEADERS= png.h pngconf.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}/projects/visualc6/* \
|
||||||
|
${srcdir}/projects/visualc71/* \
|
||||||
|
${srcdir}/projects/xcode/* \
|
||||||
|
${srcdir}/scripts/* \
|
||||||
|
${srcdir}/contrib/gregbook/* \
|
||||||
|
${srcdir}/contrib/pngminim/* \
|
||||||
|
${srcdir}/contrib/pngminus/* \
|
||||||
|
${srcdir}/contrib/pngsuite/* \
|
||||||
|
${srcdir}/contrib/visupng/* \
|
||||||
|
$(TESTS) \
|
||||||
|
example.c libpng-*.txt
|
||||||
|
|
||||||
|
CLEANFILES= pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers \
|
||||||
|
libpng.sym
|
||||||
|
|
||||||
|
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
|
||||||
|
config.sub configure depcomp install-sh ltmain.sh missing
|
||||||
|
|
||||||
|
$(PNGLIB_BASENAME).pc: libpng.pc
|
||||||
|
cp libpng.pc $@
|
||||||
|
|
||||||
|
$(PNGLIB_BASENAME)-config: libpng-config
|
||||||
|
cp libpng-config $@
|
||||||
|
|
||||||
|
libpng.sym: png.h pngconf.h
|
||||||
|
rm -f $@ $@.new
|
||||||
|
$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
|
||||||
|
$(SED) -n -e \
|
||||||
|
's|^.*PNG_FUNCTION_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
|
||||||
|
-e 's|^.*PNG_DATA_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
|
||||||
|
>$@.new
|
||||||
|
mv $@.new $@
|
||||||
|
|
||||||
|
libpng.vers: libpng.sym
|
||||||
|
rm -f $@ $@.new
|
||||||
|
echo PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0 '{global:' > $@.new
|
||||||
|
$(SED) s/$$/\;/ libpng.sym >> $@.new
|
||||||
|
echo 'local: *; };' >> $@.new
|
||||||
|
mv $@.new $@
|
||||||
|
|
||||||
|
test: check
|
||||||
|
|
||||||
|
# install the .../include headers as links to the new ones
|
||||||
|
install-data-hook:
|
||||||
|
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.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)$(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
|
||||||
|
rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc
|
||||||
|
rm -f $(DESTDIR)$(bindir)/libpng-config
|
||||||
1261
Makefile.in
Normal file
122
README
@@ -1,11 +1,11 @@
|
|||||||
README for libpng 1.0.6e - April 10, 2000 (shared library 2.1)
|
README for libpng version 1.4.7 - April 10, 2011 (shared library 14.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,9 +54,9 @@ 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.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
|
||||||
@@ -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:
|
||||||
|
|
||||||
@@ -144,11 +148,11 @@ Files in this distribution:
|
|||||||
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
|
||||||
pngconf.h => System specific library configuration
|
pngconf.h => System specific library configuration
|
||||||
pngasmrd.h => Header file for assembler-coded functions
|
|
||||||
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
|
||||||
pngnow.png => PNG logo
|
pngbar.png => PNG logo, 88x31
|
||||||
|
pngnow.png => PNG logo, 98x31
|
||||||
pngpread.c => Progressive reading functions
|
pngpread.c => Progressive reading functions
|
||||||
pngread.c => Read data/helper high-level functions
|
pngread.c => Read data/helper high-level functions
|
||||||
pngrio.c => Lowest-level data read I/O functions
|
pngrio.c => Lowest-level data read I/O functions
|
||||||
@@ -166,29 +170,53 @@ Files in this distribution:
|
|||||||
gregbook => source code for PNG reading and writing, from
|
gregbook => source code for PNG reading and writing, from
|
||||||
Greg Roelofs' "PNG: The Definitive Guide",
|
Greg Roelofs' "PNG: The Definitive Guide",
|
||||||
O'Reilly, 1999
|
O'Reilly, 1999
|
||||||
|
msvctest => Builds and runs pngtest using a MSVC workspace
|
||||||
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
|
||||||
|
projects => Contains project files and workspaces for
|
||||||
|
building a DLL
|
||||||
|
c5builder => Contains a Borland workspace for building
|
||||||
|
libpng and zlib
|
||||||
|
visualc6 => Contains a Microsoft Visual C++ (MSVC)
|
||||||
|
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
|
descrip.mms => VMS makefile for MMS or MMK
|
||||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
makefile.std => Generic UNIX makefile (cc, creates static
|
||||||
|
libpng.a)
|
||||||
|
makefile.elf => Linux/ELF makefile symbol versioning,
|
||||||
|
(gcc, creates libpng14.so.14.1.4.7)
|
||||||
makefile.linux => Linux/ELF makefile
|
makefile.linux => Linux/ELF makefile
|
||||||
(gcc, creates libpng.so.2.1.0.6e)
|
(gcc, creates libpng14.so.14.1.4.7)
|
||||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates
|
|
||||||
libpng.so.2.1.0.6e, uses assembler code
|
|
||||||
tuned for Intel MMX platform)
|
|
||||||
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||||
makefile.knr => Archaic UNIX Makefile that converts files with
|
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||||
ansi2knr (Requires ansi2knr.c from
|
ansi2knr (Requires ansi2knr.c from
|
||||||
ftp://ftp.cs.wisc.edu/ghost)
|
ftp://ftp.cs.wisc.edu/ghost)
|
||||||
|
makefile.aix => AIX makefile
|
||||||
|
makefile.cygwin => Cygwin/gcc makefile
|
||||||
|
makefile.darwin => Darwin makefile
|
||||||
makefile.dec => DEC Alpha UNIX makefile
|
makefile.dec => DEC Alpha UNIX makefile
|
||||||
|
makefile.freebsd => FreeBSD makefile
|
||||||
|
makefile.hpgcc => HPUX makefile using gcc
|
||||||
makefile.hpux => HPUX (10.20 and 11.00) makefile
|
makefile.hpux => HPUX (10.20 and 11.00) makefile
|
||||||
|
makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64 bit
|
||||||
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
|
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
|
||||||
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
|
makefile.intel => Intel C/C++ version 4.0 and later
|
||||||
|
makefile.mingw => Mingw/gcc makefile
|
||||||
|
makefile.netbsd => NetBSD/cc makefile, makes libpng.so.
|
||||||
|
makefile.ne14bsd => NetBSD/cc makefile, makes
|
||||||
|
libpng14.so
|
||||||
|
makefile.openbsd => OpenBSD makefile
|
||||||
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
|
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
|
||||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.6e)
|
makefile.sggcc => Silicon Graphics
|
||||||
|
(gcc, creates libpng14.so.14.1.4.7)
|
||||||
makefile.sunos => Sun makefile
|
makefile.sunos => Sun makefile
|
||||||
makefile.solaris => Solaris 2.X makefile
|
makefile.solaris => Solaris 2.X makefile
|
||||||
(gcc, creates libpng.so.2.1.0.6e)
|
(gcc, creates libpng14.so.14.1.4.7)
|
||||||
|
makefile.so9 => Solaris 9 makefile
|
||||||
|
(gcc, creates libpng14.so.14.1.4.7)
|
||||||
|
makefile.32sunu => Sun Ultra 32-bit makefile
|
||||||
|
makefile.64sunu => Sun Ultra 64-bit makefile
|
||||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||||
makefile.mips => MIPS makefile
|
makefile.mips => MIPS makefile
|
||||||
makefile.acorn => Acorn makefile
|
makefile.acorn => Acorn makefile
|
||||||
@@ -200,32 +228,30 @@ Files in this distribution:
|
|||||||
makefile.beos => BEOS makefile for X86
|
makefile.beos => BEOS makefile for X86
|
||||||
makefile.bor => Borland makefile (uses bcc)
|
makefile.bor => Borland makefile (uses bcc)
|
||||||
makefile.bc32 => 32-bit Borland C++ (all modules compiled in C mode)
|
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.tc3 => Turbo C 3.0 makefile
|
||||||
makefile.dj2 => DJGPP 2 makefile
|
makefile.dj2 => DJGPP 2 makefile
|
||||||
makefile.msc => Microsoft C 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
|
makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and
|
||||||
later (does not use assembler code)
|
later (does not use assembler code)
|
||||||
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
|
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
|
||||||
pngos2.def => OS/2 module definition file used by makefile.os2
|
png32ce.def => module definition for makefile.cegccg
|
||||||
|
pngos2.def => OS/2 module definition file used by
|
||||||
|
makefile.os2
|
||||||
|
pngwin.def => module definition file used by
|
||||||
|
makefile.cygwin and makefile.mingw
|
||||||
makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model
|
makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model
|
||||||
makevms.com => VMS build script
|
makevms.com => VMS build script
|
||||||
pngdef.pas => Defines for a png32bd.dll with Borland C++ 4.5
|
|
||||||
SCOPTIONS.ppc => Used with smakefile.ppc
|
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
|
||||||
Web: http://www.rpi.edu/~randeg/index.html
|
|
||||||
|
|
||||||
-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
|
||||||
|
|||||||
16
TODO
@@ -1,13 +1,15 @@
|
|||||||
|
/*
|
||||||
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)
|
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.
|
Improve setjmp/longjmp usage or remove it 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 quantizing and dithering.
|
||||||
Multi-lingual error and warning message support.
|
Multi-lingual error and warning message support.
|
||||||
Complete sRGB transformation (presently it simply uses gamma=0.45455).
|
Complete sRGB transformation (presently it simply uses gamma=0.45455).
|
||||||
Man pages for function calls.
|
Man pages for function calls.
|
||||||
@@ -16,4 +18,14 @@ 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).
|
||||||
Improve API by hiding the info_ptr.
|
Build gamma tables using fixed point (and do away with floating point entirely).
|
||||||
|
Avoid building gamma tables whenever possible.
|
||||||
|
Use greater precision when changing to linear gamma for compositing against
|
||||||
|
background and doing rgb-to-gray transformation.
|
||||||
|
Investigate pre-incremented loop counters and other loop constructions.
|
||||||
|
Add interpolated method of handling interlacing.
|
||||||
|
Provide for conditional compilation of 16-bit support (except for the
|
||||||
|
initial stripping down to 8-bits when reading a 16-bit PNG datastream).
|
||||||
|
Switch to the simpler zlib (zlib/libpng) license if legally possible.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|||||||
55
Y2KINFO
@@ -1,55 +0,0 @@
|
|||||||
Y2K compliance in libpng:
|
|
||||||
=========================
|
|
||||||
|
|
||||||
April 10, 2000
|
|
||||||
|
|
||||||
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.6e 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
|
|
||||||
9036
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
Executable 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
Executable file
140
configure.ac
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
# 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)
|
||||||
|
|
||||||
|
AC_INIT([libpng], [1.4.7], [png-mng-implement@lists.sourceforge.net])
|
||||||
|
AM_INIT_AUTOMAKE
|
||||||
|
dnl stop configure from automagically running automake
|
||||||
|
AM_MAINTAINER_MODE
|
||||||
|
|
||||||
|
dnl Version number stuff here:
|
||||||
|
|
||||||
|
PNGLIB_VERSION=1.4.7
|
||||||
|
PNGLIB_MAJOR=1
|
||||||
|
PNGLIB_MINOR=4
|
||||||
|
PNGLIB_RELEASE=7
|
||||||
|
|
||||||
|
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_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_CHECK_LIB(z, zlibVersion, , AC_ERROR([zlib not installed]))
|
||||||
|
|
||||||
|
case $host_os in
|
||||||
|
aix*)
|
||||||
|
LIBPNG_DEFINES="-DPNG_CONFIGURE_LIBPNG -D_ALL_SOURCE";;
|
||||||
|
*)
|
||||||
|
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG;;
|
||||||
|
esac
|
||||||
|
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)
|
||||||
104
contrib/gregbook/Makefile.sgi
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
# Sample makefile for rpng-x / rpng2-x / wpng for SGI using cc and make.
|
||||||
|
# Greg Roelofs
|
||||||
|
# Last modified: 7 March 2002
|
||||||
|
#
|
||||||
|
# The programs built by this makefile are described in the book,
|
||||||
|
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
|
||||||
|
# Associates, 1999). Go buy a copy, eh? Buy some for friends
|
||||||
|
# and family, too. (Not that this is a blatant plug or anything.)
|
||||||
|
#
|
||||||
|
# Invoke this makefile from a shell prompt in the usual way; for example:
|
||||||
|
#
|
||||||
|
# make -f Makefile.sgi
|
||||||
|
#
|
||||||
|
# This makefile assumes libpng and zlib have already been built or downloaded
|
||||||
|
# and are both installed in /usr/local/{include,lib} (as indicated by the
|
||||||
|
# PNG* and Z* macros below). Edit as appropriate--choose only ONE each of
|
||||||
|
# the PNGINC, PNGLIB, ZINC and ZLIB lines.
|
||||||
|
#
|
||||||
|
# This makefile builds dynamically linked executables (against libpng and zlib,
|
||||||
|
# that is), but that can be changed by uncommenting the appropriate PNGLIB and
|
||||||
|
# ZLIB lines.
|
||||||
|
|
||||||
|
|
||||||
|
# macros --------------------------------------------------------------------
|
||||||
|
|
||||||
|
PNGINC = -I/usr/local/include/libpng14
|
||||||
|
PNGLIB = -L/usr/local/lib -lpng14 # dynamically linked against libpng
|
||||||
|
#PNGLIB = /usr/local/lib/libpng14.a # statically linked against libpng
|
||||||
|
# or:
|
||||||
|
#PNGINC = -I../..
|
||||||
|
#PNGLIB = -L../.. -lpng
|
||||||
|
#PNGLIB = ../../libpng.a
|
||||||
|
|
||||||
|
ZINC = -I/usr/local/include
|
||||||
|
ZLIB = -L/usr/local/lib -lz # dynamically linked against zlib
|
||||||
|
#ZLIB = /usr/local/lib/libz.a # statically linked against zlib
|
||||||
|
#ZINC = -I../zlib
|
||||||
|
#ZLIB = -L../zlib -lz
|
||||||
|
#ZLIB = ../../../zlib/libz.a
|
||||||
|
|
||||||
|
XINC = -I/usr/include/X11 # old-style, stock X distributions
|
||||||
|
XLIB = -L/usr/lib/X11 -lX11
|
||||||
|
#XINC = -I/usr/openwin/include # Sun workstations (OpenWindows)
|
||||||
|
#XLIB = -L/usr/openwin/lib -lX11
|
||||||
|
#XINC = -I/usr/X11R6/include # new X distributions (XFree86, etc.)
|
||||||
|
#XLIB = -L/usr/X11R6/lib -lX11
|
||||||
|
|
||||||
|
INCS = $(PNGINC) $(ZINC) $(XINC)
|
||||||
|
RLIBS = $(PNGLIB) $(ZLIB) $(XLIB) -lm
|
||||||
|
WLIBS = $(PNGLIB) $(ZLIB)
|
||||||
|
|
||||||
|
CC = cc
|
||||||
|
LD = cc
|
||||||
|
RM = rm -f
|
||||||
|
# ABI must be the same as that used to build libpng.
|
||||||
|
ABI=
|
||||||
|
CFLAGS = $(ABI) -O -fullwarn $(INCS)
|
||||||
|
LDFLAGS = $(ABI)
|
||||||
|
O = .o
|
||||||
|
E =
|
||||||
|
|
||||||
|
RPNG = rpng-x
|
||||||
|
RPNG2 = rpng2-x
|
||||||
|
WPNG = wpng
|
||||||
|
|
||||||
|
ROBJS = $(RPNG)$(O) readpng$(O)
|
||||||
|
ROBJS2 = $(RPNG2)$(O) readpng2$(O)
|
||||||
|
WOBJS = $(WPNG)$(O) writepng$(O)
|
||||||
|
|
||||||
|
EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
|
||||||
|
|
||||||
|
|
||||||
|
# implicit make rules -------------------------------------------------------
|
||||||
|
|
||||||
|
.c$(O):
|
||||||
|
$(CC) -c $(CFLAGS) $<
|
||||||
|
|
||||||
|
|
||||||
|
# dependencies --------------------------------------------------------------
|
||||||
|
|
||||||
|
all: $(EXES)
|
||||||
|
|
||||||
|
$(RPNG)$(E): $(ROBJS)
|
||||||
|
$(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBS)
|
||||||
|
|
||||||
|
$(RPNG2)$(E): $(ROBJS2)
|
||||||
|
$(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBS)
|
||||||
|
|
||||||
|
$(WPNG)$(E): $(WOBJS)
|
||||||
|
$(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBS)
|
||||||
|
|
||||||
|
$(RPNG)$(O): $(RPNG).c readpng.h
|
||||||
|
$(RPNG2)$(O): $(RPNG2).c readpng2.h
|
||||||
|
$(WPNG)$(O): $(WPNG).c writepng.h
|
||||||
|
|
||||||
|
readpng$(O): readpng.c readpng.h
|
||||||
|
readpng2$(O): readpng2.c readpng2.h
|
||||||
|
writepng$(O): writepng.c writepng.h
|
||||||
|
|
||||||
|
|
||||||
|
# maintenance ---------------------------------------------------------------
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) $(EXES) $(ROBJS) $(ROBJS2) $(WOBJS)
|
||||||
@@ -1,58 +1,70 @@
|
|||||||
# 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/libpng14
|
||||||
PNGLIB = /usr/local/lib/libpng.a # statically linked against libpng
|
#PNGLIBd = -L$(PNGDIR) -lpng14 # dynamically linked, installed libpng
|
||||||
|
#PNGLIBs = $(PNGDIR)/libpng14.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) -lpng14 # 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/X11 # 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 =
|
||||||
@@ -63,11 +75,18 @@ 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:
|
||||||
@@ -162,7 +165,7 @@ 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
|
||||||
@@ -174,7 +177,7 @@ RUNNING THE PROGRAMS: (VERY) BRIEF INTRO
|
|||||||
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
|
|
||||||
@@ -7,12 +7,26 @@ $!
|
|||||||
$!
|
$!
|
||||||
$! Set locations where zlib and libpng sources live.
|
$! Set locations where zlib and libpng sources live.
|
||||||
$!
|
$!
|
||||||
$ zpath = "[-.zlib]"
|
$ zpath = ""
|
||||||
$ pngpath = "[-.libpng]"
|
$ pngpath = ""
|
||||||
$!
|
$!
|
||||||
$! USE THESE INSTEAD if building from libpng's [.contrib.gregbook] directory:
|
$ if f$search("[---.zlib]zlib.h").nes."" then zpath = "[---.zlib]"
|
||||||
$! zpath = "[---.zlib]"
|
$ if f$search("[--]png.h").nes."" then pngpath = "[--]"
|
||||||
$! pngpath = "[--]"
|
$!
|
||||||
|
$ if f$search("[-.zlib]zlib.h").nes."" then zpath = "[-.zlib]"
|
||||||
|
$ if f$search("[-.libpng]png.h").nes."" then pngpath = "[-.libpng]"
|
||||||
|
$!
|
||||||
|
$ if zpath .eqs. ""
|
||||||
|
$ then
|
||||||
|
$ write sys$output "zlib include not found. Exiting..."
|
||||||
|
$ exit 2
|
||||||
|
$ endif
|
||||||
|
$!
|
||||||
|
$ if pngpath .eqs. ""
|
||||||
|
$ then
|
||||||
|
$ write sys$output "libpng include not found. Exiting..."
|
||||||
|
$ exit 2
|
||||||
|
$ endif
|
||||||
$!
|
$!
|
||||||
$! Look for the compiler used.
|
$! Look for the compiler used.
|
||||||
$!
|
$!
|
||||||
|
|||||||
@@ -4,13 +4,20 @@
|
|||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
|
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
|
||||||
|
|
||||||
This software is provided "as is," without warranty of any kind,
|
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,7 @@ 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-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
|
||||||
|
|
||||||
---------------------------------------------------------------------------*/
|
---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
@@ -49,9 +73,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +85,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -104,6 +129,38 @@ 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 */
|
||||||
|
|
||||||
@@ -158,6 +215,7 @@ 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;
|
||||||
double gamma;
|
double gamma;
|
||||||
|
|
||||||
|
|
||||||
@@ -193,8 +251,10 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
|
|||||||
|
|
||||||
/* this is just like in the non-progressive case */
|
/* 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
|
||||||
|
|||||||
@@ -4,13 +4,20 @@
|
|||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
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:
|
||||||
@@ -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,7 +96,7 @@ typedef struct _mainprog_info {
|
|||||||
int rowbytes;
|
int rowbytes;
|
||||||
int channels;
|
int channels;
|
||||||
int need_bgcolor;
|
int need_bgcolor;
|
||||||
int done;
|
int state;
|
||||||
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,6 +874,7 @@ static void rpng_x_cleanup(void)
|
|||||||
ximage = NULL;
|
ximage = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (have_gc)
|
||||||
XFreeGC(display, gc);
|
XFreeGC(display, gc);
|
||||||
|
|
||||||
if (have_window)
|
if (have_window)
|
||||||
|
|||||||
@@ -10,8 +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):
|
||||||
- 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)
|
||||||
- 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?
|
||||||
@@ -25,16 +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.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-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:
|
||||||
@@ -51,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.04 of 19 March 2000"
|
#define VERSION "2.02 of 16 March 2008"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -64,6 +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() */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* all for PvdM background code: */
|
/* all for PvdM background code: */
|
||||||
#ifndef PI
|
#ifndef PI
|
||||||
@@ -116,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;
|
||||||
|
|
||||||
@@ -238,6 +296,16 @@ 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
|
||||||
|
* for windowed apps. Closing the console window will terminate the
|
||||||
|
* app. Thanks to David.Geldreich@realviz.com for supplying the magical
|
||||||
|
* incantation. */
|
||||||
|
|
||||||
|
AllocConsole();
|
||||||
|
freopen("CONOUT$", "a", stderr);
|
||||||
|
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
|
||||||
@@ -364,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 {
|
||||||
@@ -380,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");
|
||||||
@@ -398,28 +512,26 @@ 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);
|
||||||
readpng2_version_info();
|
#ifndef __CYGWIN__
|
||||||
fprintf(stderr, "\n"
|
fprintf(stderr,
|
||||||
"Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]"
|
"\n [console window: closing this window will terminate %s]\n\n",
|
||||||
" file.png\n\n"
|
PROGNAME);
|
||||||
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
#endif
|
||||||
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
fflush(stderr);
|
||||||
"\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\n"
|
|
||||||
" pat \tdesired background pattern number (1-%d); used with\n"
|
|
||||||
"\t\t transparent images; overrides -bgcolor\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"
|
|
||||||
"\n", PROGNAME, default_display_exponent, num_bgpat);
|
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -445,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;
|
||||||
@@ -465,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -515,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))
|
||||||
|
|
||||||
@@ -545,6 +674,8 @@ static void rpng2_win_init()
|
|||||||
readpng2_cleanup(&rpng2_info);
|
readpng2_cleanup(&rpng2_info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpng2_info.state = kWindowInit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1040,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,17 +68,36 @@
|
|||||||
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__)
|
||||||
|
# ifndef __GNUC__ /* treat Win32 native ports of gcc as Unix environments */
|
||||||
# define DOS_OS2_W32
|
# define DOS_OS2_W32
|
||||||
# endif
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.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
|
||||||
|
|
||||||
---------------------------------------------------------------------------*/
|
---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
9
contrib/pngminim/decoder/README
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
|
||||||
|
|
||||||
|
To build a minimal read-only decoder with embedded libpng and zlib, run
|
||||||
|
|
||||||
|
gather.sh # to collect needed files from pngminus, libpng, and zlib
|
||||||
|
make
|
||||||
|
|
||||||
|
If you prefer to use the shared libraries, go to contrib/pngminus
|
||||||
|
and build the png2pnm application there.
|
||||||
10
contrib/pngminim/decoder/gather.sh
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cp ../../pngminus/png2pnm.c pngm2pnm.c
|
||||||
|
cp ../../../*.h .
|
||||||
|
cp ../../../*.c .
|
||||||
|
rm example.c pngtest.c pngpread.c pngw*.c
|
||||||
|
# change the following 2 lines if zlib is somewhere else
|
||||||
|
cp ../../../../zlib/*.h .
|
||||||
|
cp ../../../../zlib/*.c .
|
||||||
|
rm minigzip.c example.c compress.c deflate.c gz*
|
||||||
43
contrib/pngminim/decoder/makefile
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# Makefile for PngMinus (pngm2pnm)
|
||||||
|
# Linux / Unix
|
||||||
|
|
||||||
|
#CC=cc
|
||||||
|
CC=gcc
|
||||||
|
LD=$(CC)
|
||||||
|
|
||||||
|
RM=rm -f
|
||||||
|
|
||||||
|
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP \
|
||||||
|
-DdeflateParams\(a,b,c\)=Z_OK -I. -O1
|
||||||
|
|
||||||
|
C=.c
|
||||||
|
O=.o
|
||||||
|
L=.a
|
||||||
|
E=
|
||||||
|
|
||||||
|
ZOBJS = adler32$(O) crc32$(O) \
|
||||||
|
infback$(O) inffast$(O) inflate$(O) inftrees$(O) \
|
||||||
|
trees$(O) uncompr$(O) zutil$(O)
|
||||||
|
|
||||||
|
OBJS = pngm2pnm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
|
||||||
|
pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
|
||||||
|
pngset$(O) pngtrans$(O) $(ZOBJS)
|
||||||
|
|
||||||
|
# implicit make rules -------------------------------------------------------
|
||||||
|
|
||||||
|
.c$(O): png.h pngconf.h pngpriv.h pngusr.h zlib.h
|
||||||
|
$(CC) -c $(CFLAGS) $<
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
|
||||||
|
all: pngm2pnm$(E)
|
||||||
|
|
||||||
|
pngm2pnm$(E): $(OBJS)
|
||||||
|
$(LD) -o pngm2pnm$(E) $(OBJS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) pngm2pnm$(O)
|
||||||
|
$(RM) pngm2pnm$(E)
|
||||||
|
$(RM) $(OBJS)
|
||||||
|
|
||||||
|
# End of makefile for pngm2pnm
|
||||||
75
contrib/pngminim/decoder/pngusr.h
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
/* minrdpngconf.h: headers to make a minimal png-read-only library
|
||||||
|
*
|
||||||
|
* Copyright (c) 2007, 2009 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
|
||||||
|
|
||||||
|
#define PNG_NO_WARNINGS
|
||||||
|
#define png_warning(s1,s2) ""
|
||||||
|
#define png_chunk_warning(s1,s2) ""
|
||||||
|
#define PNG_NO_ERROR_TEXT
|
||||||
|
#define png_error(s1,s2) png_err(s1)
|
||||||
|
#define png_chunk_error(s1,s2) png_err(s1)
|
||||||
|
|
||||||
|
#define PNG_NO_READ_BGR
|
||||||
|
#define PNG_NO_READ_GAMMA
|
||||||
|
#define PNG_NO_READ_BACKGROUND
|
||||||
|
#define PNG_NO_READ_QUANTIZE
|
||||||
|
#define PNG_NO_READ_INVERT
|
||||||
|
#define PNG_NO_READ_SHIFT
|
||||||
|
#define PNG_NO_READ_PACK
|
||||||
|
#define PNG_NO_READ_PACKSWAP
|
||||||
|
#define PNG_NO_READ_FILLER
|
||||||
|
#define PNG_NO_READ_SWAP
|
||||||
|
#define PNG_NO_READ_SWAP_ALPHA
|
||||||
|
#define PNG_NO_READ_INVERT_ALPHA
|
||||||
|
#define PNG_NO_READ_RGB_TO_GRAY
|
||||||
|
#define PNG_NO_READ_USER_TRANSFORM
|
||||||
|
#define PNG_NO_READ_bKGD
|
||||||
|
#define PNG_NO_READ_cHRM
|
||||||
|
#define PNG_NO_READ_gAMA
|
||||||
|
#define PNG_NO_READ_hIST
|
||||||
|
#define PNG_NO_READ_iCCP
|
||||||
|
#define PNG_NO_READ_oFFs
|
||||||
|
#define PNG_NO_READ_pCAL
|
||||||
|
#define PNG_NO_READ_pHYs
|
||||||
|
#define PNG_NO_READ_sBIT
|
||||||
|
#define PNG_NO_READ_sCAL
|
||||||
|
#define PNG_NO_READ_sPLT
|
||||||
|
#define PNG_NO_READ_sRGB
|
||||||
|
#define PNG_NO_READ_TEXT
|
||||||
|
#define PNG_NO_READ_tIME
|
||||||
|
#define PNG_NO_READ_UNKNOWN_CHUNKS
|
||||||
|
#define PNG_NO_READ_USER_CHUNKS
|
||||||
|
#define PNG_NO_READ_EMPTY_PLTE
|
||||||
|
#define PNG_NO_READ_OPT_PLTE
|
||||||
|
#define PNG_NO_READ_STRIP_ALPHA
|
||||||
|
|
||||||
|
#define PNG_NO_WRITE_SUPPORTED
|
||||||
|
|
||||||
|
#define PNG_NO_INFO_IMAGE
|
||||||
|
#define PNG_NO_IO_STATE
|
||||||
|
#define PNG_NO_USER_MEM
|
||||||
|
#define PNG_NO_FIXED_POINT_SUPPORTED
|
||||||
|
#define PNG_NO_MNG_FEATURES
|
||||||
|
#define PNG_NO_USER_TRANSFORM_PTR
|
||||||
|
#define PNG_NO_HANDLE_AS_UNKNOWN
|
||||||
|
#define PNG_NO_CONSOLE_IO
|
||||||
|
#define PNG_NO_ZALLOC_ZERO
|
||||||
|
#define PNG_NO_ERROR_NUMBERS
|
||||||
|
#define PNG_NO_EASY_ACCESS
|
||||||
|
#define PNG_NO_PROGRESSIVE_READ
|
||||||
|
#define PNG_NO_USER_LIMITS
|
||||||
|
#define PNG_NO_SET_USER_LIMITS
|
||||||
|
#define PNG_NO_TIME_RFC1123
|
||||||
|
|
||||||
|
#endif /* MINRDPNGCONF_H */
|
||||||
|
|
||||||
9
contrib/pngminim/encoder/README
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
|
||||||
|
|
||||||
|
To build a minimal write-only decoder with embedded libpng and zlib, run
|
||||||
|
|
||||||
|
gather.sh # to collect needed files from pngminus, libpng, and zlib
|
||||||
|
make
|
||||||
|
|
||||||
|
If you prefer to use the shared libraries, go to contrib/pngminus
|
||||||
|
and build the pnm2png application there.
|
||||||
11
contrib/pngminim/encoder/gather.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cp ../../pngminus/pnm2png.c pnm2pngm.c
|
||||||
|
cp ../../../*.h .
|
||||||
|
cp ../../../*.c .
|
||||||
|
rm example.c pngtest.c pngr*.c pngpread.c
|
||||||
|
# Change the next 2 lines if zlib is somewhere else.
|
||||||
|
cp ../../../../zlib/*.h .
|
||||||
|
cp ../../../../zlib/*.c .
|
||||||
|
rm inf*.[ch]
|
||||||
|
rm uncompr.c minigzip.c example.c gz*
|
||||||
41
contrib/pngminim/encoder/makefile
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# Makefile for PngMinus (pnm2pngm)
|
||||||
|
# Linux / Unix
|
||||||
|
|
||||||
|
#CC=cc
|
||||||
|
CC=gcc
|
||||||
|
LD=$(CC)
|
||||||
|
|
||||||
|
RM=rm -f
|
||||||
|
|
||||||
|
CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -I. -O1
|
||||||
|
|
||||||
|
C=.c
|
||||||
|
O=.o
|
||||||
|
L=.a
|
||||||
|
E=
|
||||||
|
|
||||||
|
ZOBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) \
|
||||||
|
trees$(O) zutil$(O)
|
||||||
|
|
||||||
|
OBJS = pnm2pngm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
|
||||||
|
pngset$(O) pngtrans$(O) pngwio$(O) pngwrite$(O) \
|
||||||
|
pngwtran$(O) pngwutil$(O) $(ZOBJS)
|
||||||
|
|
||||||
|
# implicit make rules -------------------------------------------------------
|
||||||
|
|
||||||
|
.c$(O): png.h pngconf.h pngpriv.h pngusr.h zlib.h
|
||||||
|
$(CC) -c $(CFLAGS) $<
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
|
||||||
|
all: pnm2pngm$(E)
|
||||||
|
|
||||||
|
pnm2pngm$(E): $(OBJS)
|
||||||
|
$(LD) -o pnm2pngm$(E) $(OBJS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) pnm2pngm$(O)
|
||||||
|
$(RM) pnm2pngm$(E)
|
||||||
|
$(RM) $(OBJS)
|
||||||
|
|
||||||
|
# End of makefile for pnm2pngm
|
||||||
75
contrib/pngminim/encoder/pngusr.h
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
/* minwrpngconf.h: headers to make a minimal png-write-only library
|
||||||
|
*
|
||||||
|
* Copyright (c) 2007, 2009 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
|
||||||
|
|
||||||
|
#define PNG_NO_READ_SUPPORTED
|
||||||
|
|
||||||
|
#define PNG_NO_WARNINGS
|
||||||
|
#define png_warning(s1,s2) ""
|
||||||
|
#define png_chunk_warning(s1,s2) ""
|
||||||
|
#define PNG_NO_ERROR_TEXT
|
||||||
|
#define png_error(s1,s2) png_err(s1)
|
||||||
|
#define png_chunk_error(s1,s2) png_err(s1)
|
||||||
|
|
||||||
|
#define PNG_NO_WRITE_BACKGROUND
|
||||||
|
#define PNG_NO_WRITE_BGR
|
||||||
|
#define PNG_NO_WRITE_QUANTIZE
|
||||||
|
#define PNG_NO_WRITE_INVERT
|
||||||
|
#define PNG_NO_WRITE_SHIFT
|
||||||
|
#define PNG_NO_WRITE_PACK
|
||||||
|
#define PNG_NO_WRITE_PACKSWAP
|
||||||
|
#define PNG_NO_WRITE_FILLER
|
||||||
|
#define PNG_NO_WRITE_SWAP
|
||||||
|
#define PNG_NO_WRITE_SWAP_ALPHA
|
||||||
|
#define PNG_NO_WRITE_INVERT_ALPHA
|
||||||
|
#define PNG_NO_WRITE_RGB_TO_GRAY
|
||||||
|
#define PNG_NO_WRITE_USER_TRANSFORM
|
||||||
|
#define PNG_NO_WRITE_bKGD
|
||||||
|
#define PNG_NO_WRITE_cHRM
|
||||||
|
#define PNG_NO_WRITE_gAMA
|
||||||
|
#define PNG_NO_WRITE_hIST
|
||||||
|
#define PNG_NO_WRITE_iCCP
|
||||||
|
#define PNG_NO_WRITE_oFFs
|
||||||
|
#define PNG_NO_WRITE_pCAL
|
||||||
|
#define PNG_NO_WRITE_pHYs
|
||||||
|
#define PNG_NO_WRITE_sBIT
|
||||||
|
#define PNG_NO_WRITE_sCAL
|
||||||
|
#define PNG_NO_WRITE_sPLT
|
||||||
|
#define PNG_NO_WRITE_sRGB
|
||||||
|
#define PNG_NO_WRITE_TEXT
|
||||||
|
#define PNG_NO_WRITE_tIME
|
||||||
|
#define PNG_NO_WRITE_UNKNOWN_CHUNKS
|
||||||
|
#define PNG_NO_WRITE_USER_CHUNKS
|
||||||
|
#define PNG_NO_WRITE_EMPTY_PLTE
|
||||||
|
#define PNG_NO_WRITE_OPT_PLTE
|
||||||
|
#define PNG_NO_WRITE_FILTER
|
||||||
|
#define PNG_NO_WRITE_WEIGHTED_FILTER
|
||||||
|
#define PNG_NO_WRITE_INTERLACING_SUPPORTED
|
||||||
|
#define PNG_NO_WRITE_FLUSH
|
||||||
|
|
||||||
|
#define PNG_NO_INFO_IMAGE
|
||||||
|
#define PNG_NO_IO_STATE
|
||||||
|
#define PNG_NO_USER_MEM
|
||||||
|
#define PNG_NO_FIXED_POINT_SUPPORTED
|
||||||
|
#define PNG_NO_MNG_FEATURES
|
||||||
|
#define PNG_NO_USER_TRANSFORM_PTR
|
||||||
|
#define PNG_NO_HANDLE_AS_UNKNOWN
|
||||||
|
#define PNG_NO_CONSOLE_IO
|
||||||
|
#define PNG_NO_ZALLOC_ZERO
|
||||||
|
#define PNG_NO_ERROR_NUMBERS
|
||||||
|
#define PNG_NO_EASY_ACCESS
|
||||||
|
#define PNG_NO_USER_LIMITS
|
||||||
|
#define PNG_NO_SET_USER_LIMITS
|
||||||
|
#define PNG_NO_TIME_RFC1123
|
||||||
|
|
||||||
|
#endif /* MINWRPNGCONF_H */
|
||||||
14
contrib/pngminim/preader/README
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
|
||||||
|
|
||||||
|
To build a minimal read-only progressive decoder embedded libpng and
|
||||||
|
zlib and with your system's X library, run
|
||||||
|
|
||||||
|
gather.sh # to collect needed files from gregbook, libpng, and zlib
|
||||||
|
|
||||||
|
Edit makefile if required, to find your X library and include files,
|
||||||
|
then
|
||||||
|
|
||||||
|
make
|
||||||
|
|
||||||
|
If you prefer to use the shared libraries, go to contrib/gregbook
|
||||||
|
and build the rpng2-x application there.
|
||||||
11
contrib/pngminim/preader/gather.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cp ../../gregbook/rpng2-x.c ../../gregbook/readpng2.[ch] .
|
||||||
|
cp ../../gregbook/COPYING ../../gregbook/LICENSE .
|
||||||
|
cp ../../../*.h .
|
||||||
|
cp ../../../*.c .
|
||||||
|
rm example.c pngtest.c pngw*.c
|
||||||
|
# change the following 2 lines if zlib is somewhere else
|
||||||
|
cp ../../../../zlib/*.h .
|
||||||
|
cp ../../../../zlib/*.c .
|
||||||
|
rm minigzip.c example.c compress.c deflate.c gz*
|
||||||
59
contrib/pngminim/preader/makefile
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# Makefile for PngMinus (rpng2)
|
||||||
|
# Linux / Unix
|
||||||
|
|
||||||
|
#CC=cc
|
||||||
|
CC=gcc
|
||||||
|
LD=$(CC)
|
||||||
|
|
||||||
|
RM=rm -f
|
||||||
|
|
||||||
|
#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 \
|
||||||
|
-DdeflateParams\(a,b,c\)=Z_OK -I. $(XINC) -O1
|
||||||
|
|
||||||
|
C=.c
|
||||||
|
O=.o
|
||||||
|
L=.a
|
||||||
|
E=
|
||||||
|
|
||||||
|
ZOBJS = adler32$(O) crc32$(O) \
|
||||||
|
infback$(O) inffast$(O) inflate$(O) inftrees$(O) \
|
||||||
|
trees$(O) uncompr$(O) zutil$(O)
|
||||||
|
|
||||||
|
OBJS = rpng2-x$(O) readpng2$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
|
||||||
|
pngpread$(O) pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
|
||||||
|
pngset$(O) pngtrans$(O) $(ZOBJS)
|
||||||
|
|
||||||
|
# implicit make rules -------------------------------------------------------
|
||||||
|
|
||||||
|
.c$(O): png.h pngconf.h pngpriv.h readpng2.h pngusr.h zlib.h
|
||||||
|
$(CC) -c $(CFLAGS) $<
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
|
||||||
|
all: rpng2-x$(E)
|
||||||
|
|
||||||
|
rpng2-x$(E): $(OBJS)
|
||||||
|
$(LD) -o rpng2-x$(E) $(OBJS) $(LIBS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) rpng2-x$(O)
|
||||||
|
$(RM) rpng2-x$(E)
|
||||||
|
$(RM) $(OBJS)
|
||||||
|
|
||||||
|
# End of makefile for rpng2-x
|
||||||
68
contrib/pngminim/preader/pngusr.h
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
/* minrdpngconf.h: headers to make a minimal png-read-only library
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009 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
|
||||||
|
|
||||||
|
#define PNG_NO_WARNINGS
|
||||||
|
#define png_warning(s1,s2) ""
|
||||||
|
#define png_chunk_warning(s1,s2) ""
|
||||||
|
#define PNG_NO_ERROR_TEXT
|
||||||
|
#define png_error(s1,s2) png_err(s1)
|
||||||
|
#define png_chunk_error(s1,s2) png_err(s1)
|
||||||
|
|
||||||
|
#define PNG_NO_READ_BGR
|
||||||
|
#define PNG_NO_READ_DITHER
|
||||||
|
#define PNG_NO_READ_INVERT
|
||||||
|
#define PNG_NO_READ_SHIFT
|
||||||
|
#define PNG_NO_READ_PACK
|
||||||
|
#define PNG_NO_READ_PACKSWAP
|
||||||
|
#define PNG_NO_READ_FILLER
|
||||||
|
#define PNG_NO_READ_SWAP
|
||||||
|
#define PNG_NO_READ_SWAP_ALPHA
|
||||||
|
#define PNG_NO_READ_INVERT_ALPHA
|
||||||
|
#define PNG_NO_READ_RGB_TO_GRAY
|
||||||
|
#define PNG_NO_READ_USER_TRANSFORM
|
||||||
|
#define PNG_NO_READ_cHRM
|
||||||
|
#define PNG_NO_READ_hIST
|
||||||
|
#define PNG_NO_READ_iCCP
|
||||||
|
#define PNG_NO_READ_oFFs
|
||||||
|
#define PNG_NO_READ_pCAL
|
||||||
|
#define PNG_NO_READ_pHYs
|
||||||
|
#define PNG_NO_READ_sBIT
|
||||||
|
#define PNG_NO_READ_sCAL
|
||||||
|
#define PNG_NO_READ_sPLT
|
||||||
|
#define PNG_NO_READ_TEXT
|
||||||
|
#define PNG_NO_READ_tIME
|
||||||
|
#define PNG_NO_READ_UNKNOWN_CHUNKS
|
||||||
|
#define PNG_NO_READ_USER_CHUNKS
|
||||||
|
#define PNG_NO_READ_EMPTY_PLTE
|
||||||
|
#define PNG_NO_READ_OPT_PLTE
|
||||||
|
#define PNG_NO_READ_STRIP_ALPHA
|
||||||
|
|
||||||
|
#define PNG_NO_WRITE_SUPPORTED
|
||||||
|
|
||||||
|
#define PNG_NO_INFO_IMAGE
|
||||||
|
#define PNG_NO_IO_STATE
|
||||||
|
#define PNG_NO_USER_MEM
|
||||||
|
#define PNG_NO_FIXED_POINT_SUPPORTED
|
||||||
|
#define PNG_NO_MNG_FEATURES
|
||||||
|
#define PNG_NO_USER_TRANSFORM_PTR
|
||||||
|
#define PNG_NO_HANDLE_AS_UNKNOWN
|
||||||
|
#define PNG_NO_CONSOLE_IO
|
||||||
|
#define PNG_NO_ZALLOC_ZERO
|
||||||
|
#define PNG_NO_ERROR_NUMBERS
|
||||||
|
#define PNG_NO_EASY_ACCESS
|
||||||
|
#define PNG_NO_USER_LIMITS
|
||||||
|
#define PNG_NO_SET_USER_LIMITS
|
||||||
|
#define PNG_NO_TIME_RFC1123
|
||||||
|
|
||||||
|
#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,52 +0,0 @@
|
|||||||
# Makefile for PngMinus (png2pnm and pnm2png)
|
|
||||||
# Linux / Unix
|
|
||||||
|
|
||||||
CC=cc -O -n32
|
|
||||||
LD=cc -O -n32
|
|
||||||
#CC=gcc -O
|
|
||||||
#LD=gcc -O
|
|
||||||
LB=ar
|
|
||||||
RM=rm
|
|
||||||
CP=cp
|
|
||||||
|
|
||||||
PNGPATH = /usr/local
|
|
||||||
PNGINC = $(PNGPATH)/include
|
|
||||||
PNGLIB = $(PNGPATH)/lib -lpng
|
|
||||||
# PNGLIB = $(PNGPATH)/libpng.a
|
|
||||||
|
|
||||||
ZPATH = /usr/local
|
|
||||||
ZINC = $(ZPATH)/include
|
|
||||||
ZLIB = $(ZPATH)/lib -lz
|
|
||||||
# ZLIB = $(ZPATH)/libz.a
|
|
||||||
|
|
||||||
CCFLAGS=-I$(PNGINC) -I$(ZINC)
|
|
||||||
LDFLAGS=-L$(PNGLIB) -L$(ZLIB) -lm
|
|
||||||
C=.c
|
|
||||||
O=.o
|
|
||||||
L=.a
|
|
||||||
E=
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
|
|
||||||
all: png2pnm$(E) pnm2png$(E)
|
|
||||||
|
|
||||||
png2pnm$(O): png2pnm$(C)
|
|
||||||
$(CC) -c $(CCFLAGS) png2pnm$(C)
|
|
||||||
|
|
||||||
png2pnm$(E): png2pnm$(O)
|
|
||||||
$(LD) -o png2pnm$(E) png2pnm$(O) $(LDFLAGS)
|
|
||||||
|
|
||||||
pnm2png$(O): pnm2png$(C)
|
|
||||||
$(CC) -c $(CCFLAGS) pnm2png$(C)
|
|
||||||
|
|
||||||
pnm2png$(E): pnm2png$(O)
|
|
||||||
$(LD) -o pnm2png$(E) pnm2png$(O) $(LDFLAGS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(RM) png2pnm$(O)
|
|
||||||
$(RM) pnm2png$(O)
|
|
||||||
$(RM) png2pnm$(E)
|
|
||||||
$(RM) pnm2png$(E)
|
|
||||||
|
|
||||||
# End of makefile for png2pnm / pnm2png
|
|
||||||
|
|
||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -45,9 +45,9 @@ $ call make pnm2png.exe -
|
|||||||
$ write sys$output "Building png2pnm..."
|
$ write sys$output "Building png2pnm..."
|
||||||
$ CALL MAKE png2pnm.OBJ "cc ''CCOPT' png2pnm" -
|
$ CALL MAKE png2pnm.OBJ "cc ''CCOPT' png2pnm" -
|
||||||
png2pnm.c
|
png2pnm.c
|
||||||
$ call make pnm2png.exe -
|
$ call make png2pnm.exe -
|
||||||
"LINK pnm2png,lib.opt/opt" -
|
"LINK png2pnm,lib.opt/opt" -
|
||||||
pnm2png.obj
|
png2pnm.obj
|
||||||
$ exit
|
$ exit
|
||||||
$!
|
$!
|
||||||
$!
|
$!
|
||||||
|
|||||||
@@ -204,14 +204,15 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
|||||||
int row, col;
|
int row, col;
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
long dep_16;
|
||||||
|
|
||||||
/* read and check signature in PNG file */
|
/* read and check signature in PNG file */
|
||||||
ret = fread (buf, 1, 8, png_file);
|
ret = fread (buf, 1, 8, png_file);
|
||||||
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 */
|
||||||
@@ -379,8 +380,10 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
|||||||
if (raw)
|
if (raw)
|
||||||
fputc ((int) *pix_ptr++ , pnm_file);
|
fputc ((int) *pix_ptr++ , pnm_file);
|
||||||
else
|
else
|
||||||
if (bit_depth == 16)
|
if (bit_depth == 16){
|
||||||
fprintf (pnm_file, "%ld ", ((long) *pix_ptr++ << 8) + (long) *pix_ptr++);
|
dep_16 = (long) *pix_ptr++;
|
||||||
|
fprintf (pnm_file, "%ld ", (dep_16 << 8) + ((long) *pix_ptr++));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
fprintf (pnm_file, "%ld ", (long) *pix_ptr++);
|
fprintf (pnm_file, "%ld ", (long) *pix_ptr++);
|
||||||
}
|
}
|
||||||
@@ -397,8 +400,10 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
|||||||
if (raw)
|
if (raw)
|
||||||
fputc ((int) *pix_ptr++ , alpha_file);
|
fputc ((int) *pix_ptr++ , alpha_file);
|
||||||
else
|
else
|
||||||
if (bit_depth == 16)
|
if (bit_depth == 16){
|
||||||
fprintf (alpha_file, "%ld ", ((long) *pix_ptr++ << 8) + (long) *pix_ptr++);
|
dep_16 = (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
|
||||||
|
|||||||
@@ -1,17 +1,20 @@
|
|||||||
|
|
||||||
pngsuite
|
pngsuite
|
||||||
--------
|
--------
|
||||||
(c) Willem van Schaik, 1999
|
(c) Willem van Schaik, 1999, 2011
|
||||||
|
|
||||||
Permission to use, copy, and distribute these images for any purpose and
|
Permission to use, copy, modify, and distribute these images for any
|
||||||
without fee is hereby granted.
|
purpose and 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
|
||||||
@@ -35,7 +38,21 @@ can use them to test the proper functioning of PNG software.
|
|||||||
basn6a08.png 8-bit RGBA
|
basn6a08.png 8-bit RGBA
|
||||||
basn6a16.png 16-bit RGBA
|
basn6a16.png 16-bit RGBA
|
||||||
|
|
||||||
Here is the correct result of typing "pngtest -m *.png" in
|
ftbbn0g04.png 4-bit grayscale, black bKGD
|
||||||
|
ftbbn2c16.png 16-bit truecolor, black bKGD
|
||||||
|
ftbbn3p08.png 8-bit paletted, black bKGD
|
||||||
|
ftbgn2c16.png 16-bit truecolor, gray bKGD
|
||||||
|
ftbgn3p08.png 8-bit paletted, gray bKGD
|
||||||
|
ftbrn2c08.png 8-bit truecolor, red bKGD
|
||||||
|
ftbwn0g16.png 16-bit gray, white bKGD
|
||||||
|
ftbwn3p08.png 8-bit paletted, white bKGD
|
||||||
|
ftbyn3p08.png 8-bit paletted, yellow bKGD
|
||||||
|
ftp0n0g08.png 8-bit grayscale, opaque
|
||||||
|
ftp0n2c08.png 8-bit truecolor, opaque
|
||||||
|
ftp0n3p08.png 8-bit paletted, opaque
|
||||||
|
ftp1n3p08.png 8-bit paletted, no bKGD
|
||||||
|
|
||||||
|
Here is the correct result of typing "pngtest -m bas*.png" in
|
||||||
this directory:
|
this directory:
|
||||||
|
|
||||||
Testing basn0g01.png: PASS (524 zero samples)
|
Testing basn0g01.png: PASS (524 zero samples)
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 164 B After Width: | Height: | Size: 164 B |
|
Before Width: | Height: | Size: 104 B After Width: | Height: | Size: 104 B |
|
Before Width: | Height: | Size: 145 B After Width: | Height: | Size: 145 B |
|
Before Width: | Height: | Size: 138 B After Width: | Height: | Size: 138 B |
|
Before Width: | Height: | Size: 167 B After Width: | Height: | Size: 167 B |
|
Before Width: | Height: | Size: 145 B After Width: | Height: | Size: 145 B |
|
Before Width: | Height: | Size: 302 B After Width: | Height: | Size: 302 B |
|
Before Width: | Height: | Size: 112 B After Width: | Height: | Size: 112 B |
|
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 146 B |
|
Before Width: | Height: | Size: 216 B After Width: | Height: | Size: 216 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 126 B |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 184 B After Width: | Height: | Size: 184 B |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
BIN
contrib/pngsuite/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 |
442
contrib/visupng/PngFile.c
Normal file
@@ -0,0 +1,442 @@
|
|||||||
|
//-------------------------------------
|
||||||
|
// PNGFILE.C -- Image File Functions
|
||||||
|
//-------------------------------------
|
||||||
|
|
||||||
|
// Copyright 2000, Willem van Schaik.
|
||||||
|
//
|
||||||
|
// 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 <commdlg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "png.h"
|
||||||
|
#include "pngfile.h"
|
||||||
|
#include "cexcept.h"
|
||||||
|
|
||||||
|
define_exception_type(const char *);
|
||||||
|
extern struct exception_context the_exception_context[1];
|
||||||
|
struct exception_context the_exception_context[1];
|
||||||
|
png_const_charp msg;
|
||||||
|
|
||||||
|
static OPENFILENAME ofn;
|
||||||
|
|
||||||
|
static png_structp png_ptr = NULL;
|
||||||
|
static png_infop info_ptr = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
// cexcept interface
|
||||||
|
|
||||||
|
static void
|
||||||
|
png_cexcept_error(png_structp png_ptr, png_const_charp msg)
|
||||||
|
{
|
||||||
|
if(png_ptr)
|
||||||
|
;
|
||||||
|
#ifdef PNG_CONSOLE_IO_SUPPORTED
|
||||||
|
fprintf(stderr, "libpng error: %s\n", msg);
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
Throw msg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Windows open-file functions
|
||||||
|
|
||||||
|
void PngFileInitialize (HWND hwnd)
|
||||||
|
{
|
||||||
|
static TCHAR szFilter[] = TEXT ("PNG Files (*.PNG)\0*.png\0")
|
||||||
|
TEXT ("All Files (*.*)\0*.*\0\0");
|
||||||
|
|
||||||
|
ofn.lStructSize = sizeof (OPENFILENAME);
|
||||||
|
ofn.hwndOwner = hwnd;
|
||||||
|
ofn.hInstance = NULL;
|
||||||
|
ofn.lpstrFilter = szFilter;
|
||||||
|
ofn.lpstrCustomFilter = NULL;
|
||||||
|
ofn.nMaxCustFilter = 0;
|
||||||
|
ofn.nFilterIndex = 0;
|
||||||
|
ofn.lpstrFile = NULL; // Set in Open and Close functions
|
||||||
|
ofn.nMaxFile = MAX_PATH;
|
||||||
|
ofn.lpstrFileTitle = NULL; // Set in Open and Close functions
|
||||||
|
ofn.nMaxFileTitle = MAX_PATH;
|
||||||
|
ofn.lpstrInitialDir = NULL;
|
||||||
|
ofn.lpstrTitle = NULL;
|
||||||
|
ofn.Flags = 0; // Set in Open and Close functions
|
||||||
|
ofn.nFileOffset = 0;
|
||||||
|
ofn.nFileExtension = 0;
|
||||||
|
ofn.lpstrDefExt = TEXT ("png");
|
||||||
|
ofn.lCustData = 0;
|
||||||
|
ofn.lpfnHook = NULL;
|
||||||
|
ofn.lpTemplateName = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL PngFileOpenDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName)
|
||||||
|
{
|
||||||
|
ofn.hwndOwner = hwnd;
|
||||||
|
ofn.lpstrFile = pstrFileName;
|
||||||
|
ofn.lpstrFileTitle = pstrTitleName;
|
||||||
|
ofn.Flags = OFN_HIDEREADONLY;
|
||||||
|
|
||||||
|
return GetOpenFileName (&ofn);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL PngFileSaveDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName)
|
||||||
|
{
|
||||||
|
ofn.hwndOwner = hwnd;
|
||||||
|
ofn.lpstrFile = pstrFileName;
|
||||||
|
ofn.lpstrFileTitle = pstrTitleName;
|
||||||
|
ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
|
||||||
|
|
||||||
|
return GetSaveFileName (&ofn);
|
||||||
|
}
|
||||||
|
|
||||||
|
// PNG image handler functions
|
||||||
|
|
||||||
|
BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
||||||
|
int *piWidth, int *piHeight, int *piChannels, png_color *pBkgColor)
|
||||||
|
{
|
||||||
|
static FILE *pfFile;
|
||||||
|
png_byte pbSig[8];
|
||||||
|
int iBitDepth;
|
||||||
|
int iColorType;
|
||||||
|
double dGamma;
|
||||||
|
png_color_16 *pBackground;
|
||||||
|
png_uint_32 ulChannels;
|
||||||
|
png_uint_32 ulRowBytes;
|
||||||
|
png_byte *pbImageData = *ppbImageData;
|
||||||
|
static png_byte **ppbRowPointers = NULL;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// open the PNG input file
|
||||||
|
|
||||||
|
if (!pstrFileName)
|
||||||
|
{
|
||||||
|
*ppbImageData = pbImageData = NULL;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(pfFile = fopen(pstrFileName, "rb")))
|
||||||
|
{
|
||||||
|
*ppbImageData = pbImageData = NULL;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// first check the eight byte PNG signature
|
||||||
|
|
||||||
|
fread(pbSig, 1, 8, pfFile);
|
||||||
|
if (png_sig_cmp(pbSig, 0, 8))
|
||||||
|
{
|
||||||
|
*ppbImageData = pbImageData = NULL;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the two png(-info) structures
|
||||||
|
|
||||||
|
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL,
|
||||||
|
(png_error_ptr)png_cexcept_error, (png_error_ptr)NULL);
|
||||||
|
if (!png_ptr)
|
||||||
|
{
|
||||||
|
*ppbImageData = pbImageData = NULL;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
info_ptr = png_create_info_struct(png_ptr);
|
||||||
|
if (!info_ptr)
|
||||||
|
{
|
||||||
|
png_destroy_read_struct(&png_ptr, NULL, NULL);
|
||||||
|
*ppbImageData = pbImageData = NULL;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Try
|
||||||
|
{
|
||||||
|
|
||||||
|
// initialize the png structure
|
||||||
|
|
||||||
|
#ifdef PNG_STDIO_SUPPORTED
|
||||||
|
png_init_io(png_ptr, pfFile);
|
||||||
|
#else
|
||||||
|
png_set_read_fn(png_ptr, (png_voidp)pfFile, png_read_data);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
png_set_sig_bytes(png_ptr, 8);
|
||||||
|
|
||||||
|
// read all PNG info up to image data
|
||||||
|
|
||||||
|
png_read_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
|
// get width, height, bit-depth and color-type
|
||||||
|
|
||||||
|
png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth,
|
||||||
|
&iColorType, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
// expand images of all color-type and bit-depth to 3x8 bit RGB images
|
||||||
|
// let the library process things like alpha, transparency, background
|
||||||
|
|
||||||
|
if (iBitDepth == 16)
|
||||||
|
png_set_strip_16(png_ptr);
|
||||||
|
if (iColorType == PNG_COLOR_TYPE_PALETTE)
|
||||||
|
png_set_expand(png_ptr);
|
||||||
|
if (iBitDepth < 8)
|
||||||
|
png_set_expand(png_ptr);
|
||||||
|
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
|
||||||
|
png_set_expand(png_ptr);
|
||||||
|
if (iColorType == PNG_COLOR_TYPE_GRAY ||
|
||||||
|
iColorType == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||||
|
png_set_gray_to_rgb(png_ptr);
|
||||||
|
|
||||||
|
// set the background color to draw transparent and alpha images over.
|
||||||
|
if (png_get_bKGD(png_ptr, info_ptr, &pBackground))
|
||||||
|
{
|
||||||
|
png_set_background(png_ptr, pBackground, PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
|
||||||
|
pBkgColor->red = (byte) pBackground->red;
|
||||||
|
pBkgColor->green = (byte) pBackground->green;
|
||||||
|
pBkgColor->blue = (byte) pBackground->blue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pBkgColor = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if required set gamma conversion
|
||||||
|
if (png_get_gAMA(png_ptr, info_ptr, &dGamma))
|
||||||
|
png_set_gamma(png_ptr, (double) 2.2, dGamma);
|
||||||
|
|
||||||
|
// after the transformations have been registered update info_ptr data
|
||||||
|
|
||||||
|
png_read_update_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
|
// get again width, height and the new bit-depth and color-type
|
||||||
|
|
||||||
|
png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth,
|
||||||
|
&iColorType, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
|
||||||
|
// row_bytes is the width x number of channels
|
||||||
|
|
||||||
|
ulRowBytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||||
|
ulChannels = png_get_channels(png_ptr, info_ptr);
|
||||||
|
|
||||||
|
*piChannels = ulChannels;
|
||||||
|
|
||||||
|
// now we can allocate memory to store the image
|
||||||
|
|
||||||
|
if (pbImageData)
|
||||||
|
{
|
||||||
|
free (pbImageData);
|
||||||
|
pbImageData = NULL;
|
||||||
|
}
|
||||||
|
if ((pbImageData = (png_byte *) malloc(ulRowBytes * (*piHeight)
|
||||||
|
* sizeof(png_byte))) == NULL)
|
||||||
|
{
|
||||||
|
png_error(png_ptr, "Visual PNG: out of memory");
|
||||||
|
}
|
||||||
|
*ppbImageData = pbImageData;
|
||||||
|
|
||||||
|
// and allocate memory for an array of row-pointers
|
||||||
|
|
||||||
|
if ((ppbRowPointers = (png_bytepp) malloc((*piHeight)
|
||||||
|
* sizeof(png_bytep))) == NULL)
|
||||||
|
{
|
||||||
|
png_error(png_ptr, "Visual PNG: out of memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the individual row-pointers to point at the correct offsets
|
||||||
|
|
||||||
|
for (i = 0; i < (*piHeight); i++)
|
||||||
|
ppbRowPointers[i] = pbImageData + i * ulRowBytes;
|
||||||
|
|
||||||
|
// now we can go ahead and just read the whole image
|
||||||
|
|
||||||
|
png_read_image(png_ptr, ppbRowPointers);
|
||||||
|
|
||||||
|
// read the additional chunks in the PNG file (not really needed)
|
||||||
|
|
||||||
|
png_read_end(png_ptr, NULL);
|
||||||
|
|
||||||
|
// and we're done
|
||||||
|
|
||||||
|
free (ppbRowPointers);
|
||||||
|
ppbRowPointers = NULL;
|
||||||
|
|
||||||
|
// yepp, done
|
||||||
|
}
|
||||||
|
|
||||||
|
Catch (msg)
|
||||||
|
{
|
||||||
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
|
|
||||||
|
*ppbImageData = pbImageData = NULL;
|
||||||
|
|
||||||
|
if(ppbRowPointers)
|
||||||
|
free (ppbRowPointers);
|
||||||
|
|
||||||
|
fclose(pfFile);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose (pfFile);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
||||||
|
int iWidth, int iHeight, png_color bkgColor)
|
||||||
|
{
|
||||||
|
const int ciBitDepth = 8;
|
||||||
|
const int ciChannels = 3;
|
||||||
|
|
||||||
|
static FILE *pfFile;
|
||||||
|
png_uint_32 ulRowBytes;
|
||||||
|
static png_byte **ppbRowPointers = NULL;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// open the PNG output file
|
||||||
|
|
||||||
|
if (!pstrFileName)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!(pfFile = fopen(pstrFileName, "wb")))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
// prepare the standard PNG structures
|
||||||
|
|
||||||
|
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL,
|
||||||
|
(png_error_ptr)png_cexcept_error, (png_error_ptr)NULL);
|
||||||
|
if (!png_ptr)
|
||||||
|
{
|
||||||
|
fclose(pfFile);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
info_ptr = png_create_info_struct(png_ptr);
|
||||||
|
if (!info_ptr) {
|
||||||
|
fclose(pfFile);
|
||||||
|
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Try
|
||||||
|
{
|
||||||
|
// initialize the png structure
|
||||||
|
|
||||||
|
#ifdef PNG_STDIO_SUPPORTED
|
||||||
|
png_init_io(png_ptr, pfFile);
|
||||||
|
#else
|
||||||
|
png_set_write_fn(png_ptr, (png_voidp)pfFile, png_write_data, png_flush);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// we're going to write a very simple 3x8 bit RGB image
|
||||||
|
|
||||||
|
png_set_IHDR(png_ptr, info_ptr, iWidth, iHeight, ciBitDepth,
|
||||||
|
PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE,
|
||||||
|
PNG_FILTER_TYPE_BASE);
|
||||||
|
|
||||||
|
// write the file header information
|
||||||
|
|
||||||
|
png_write_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
|
// swap the BGR pixels in the DiData structure to RGB
|
||||||
|
|
||||||
|
png_set_bgr(png_ptr);
|
||||||
|
|
||||||
|
// row_bytes is the width x number of channels
|
||||||
|
|
||||||
|
ulRowBytes = iWidth * ciChannels;
|
||||||
|
|
||||||
|
// we can allocate memory for an array of row-pointers
|
||||||
|
|
||||||
|
if ((ppbRowPointers = (png_bytepp) malloc(iHeight * sizeof(png_bytep))) == NULL)
|
||||||
|
Throw "Visualpng: Out of memory";
|
||||||
|
|
||||||
|
// set the individual row-pointers to point at the correct offsets
|
||||||
|
|
||||||
|
for (i = 0; i < iHeight; i++)
|
||||||
|
ppbRowPointers[i] = pDiData + i * (((ulRowBytes + 3) >> 2) << 2);
|
||||||
|
|
||||||
|
// write out the entire image data in one call
|
||||||
|
|
||||||
|
png_write_image (png_ptr, ppbRowPointers);
|
||||||
|
|
||||||
|
// write the additional chunks to the PNG file (not really needed)
|
||||||
|
|
||||||
|
png_write_end(png_ptr, info_ptr);
|
||||||
|
|
||||||
|
// and we're done
|
||||||
|
|
||||||
|
free (ppbRowPointers);
|
||||||
|
ppbRowPointers = NULL;
|
||||||
|
|
||||||
|
// clean up after the write, and free any memory allocated
|
||||||
|
|
||||||
|
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
|
||||||
|
|
||||||
|
// yepp, done
|
||||||
|
}
|
||||||
|
|
||||||
|
Catch (msg)
|
||||||
|
{
|
||||||
|
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
|
||||||
|
|
||||||
|
if(ppbRowPointers)
|
||||||
|
free (ppbRowPointers);
|
||||||
|
|
||||||
|
fclose(pfFile);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose (pfFile);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef PNG_STDIO_SUPPORTED
|
||||||
|
|
||||||
|
static void
|
||||||
|
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
|
{
|
||||||
|
png_size_t check;
|
||||||
|
|
||||||
|
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
||||||
|
* instead of an int, which is what fread() actually returns.
|
||||||
|
*/
|
||||||
|
check = (png_size_t)fread(data, (png_size_t)1, length,
|
||||||
|
(FILE *)png_ptr->io_ptr);
|
||||||
|
|
||||||
|
if (check != length)
|
||||||
|
{
|
||||||
|
png_error(png_ptr, "Read Error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
|
{
|
||||||
|
png_uint_32 check;
|
||||||
|
|
||||||
|
check = fwrite(data, 1, length, (FILE *)(png_ptr->io_ptr));
|
||||||
|
if (check != length)
|
||||||
|
{
|
||||||
|
png_error(png_ptr, "Write Error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
png_flush(png_structp png_ptr)
|
||||||
|
{
|
||||||
|
FILE *io_ptr;
|
||||||
|
io_ptr = (FILE *)CVT_PTR((png_ptr->io_ptr));
|
||||||
|
if (io_ptr != NULL)
|
||||||
|
fflush(io_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//-----------------
|
||||||
|
// end of source
|
||||||
|
//-----------------
|
||||||
30
contrib/visupng/PngFile.h
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
//------------------------------------------
|
||||||
|
// PNGFILE.H -- Header File for pngfile.c
|
||||||
|
//------------------------------------------
|
||||||
|
|
||||||
|
// Copyright 2000, Willem van Schaik.
|
||||||
|
|
||||||
|
// 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 <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
void PngFileInitialize (HWND hwnd) ;
|
||||||
|
BOOL PngFileOpenDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName) ;
|
||||||
|
BOOL PngFileSaveDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName) ;
|
||||||
|
|
||||||
|
BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
||||||
|
int *piWidth, int *piHeight, int *piChannels, png_color *pBkgColor);
|
||||||
|
BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
||||||
|
int iWidth, int iHeight, png_color BkgColor);
|
||||||
|
|
||||||
|
#ifndef PNG_STDIO_SUPPORTED
|
||||||
|
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_flush(png_structp png_ptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
61
contrib/visupng/README.txt
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
Microsoft Developer Studio Build File, Format Version 6.00 for VisualPng
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright 2000, Willem van Schaik.
|
||||||
|
|
||||||
|
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
|
||||||
|
the program's objective. However, further extensions (like support for other
|
||||||
|
graphics formats) are in development. To get these, or for pre-compiled
|
||||||
|
binaries, go to "http://www.schaik.com/png/visualpng.html".
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Assumes that
|
||||||
|
|
||||||
|
libpng DLLs and LIBs are in ..\..\projects\msvc\win32\libpng
|
||||||
|
zlib DLLs and LIBs are in ..\..\projects\msvc\win32\zlib
|
||||||
|
libpng header files are in ..\..\..\libpng
|
||||||
|
zlib header files are in ..\..\..\zlib
|
||||||
|
the pngsuite images are in ..\pngsuite
|
||||||
|
|
||||||
|
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) After compiling and linking VisualPng will be started to view an image
|
||||||
|
from the PngSuite directory. Press Ctrl-N (and Ctrl-V) for other images.
|
||||||
|
|
||||||
|
|
||||||
|
To install:
|
||||||
|
|
||||||
|
When distributing VisualPng (or a further development) the following options
|
||||||
|
are available:
|
||||||
|
|
||||||
|
1) Build the program with the configuration "Win32 LIB" and you only need to
|
||||||
|
include the executable from the ./lib directory in your distribution.
|
||||||
|
|
||||||
|
2) Build the program with the configuration "Win32 DLL" and you need to put
|
||||||
|
in your distribution the executable from the ./dll directory and the dll's
|
||||||
|
libpng1.dll, zlib.dll and msvcrt.dll. These need to be in the user's PATH.
|
||||||
|
|
||||||
|
|
||||||
|
Willem van Schaik
|
||||||
|
Calgary, June 6th 2000
|
||||||
|
|
||||||
|
P.S. VisualPng was written based on preliminary work of:
|
||||||
|
|
||||||
|
- Simon-Pierre Cadieux
|
||||||
|
- Glenn Randers-Pehrson
|
||||||
|
- Greg Roelofs
|
||||||
|
|
||||||
964
contrib/visupng/VisualPng.c
Normal file
@@ -0,0 +1,964 @@
|
|||||||
|
//------------------------------------
|
||||||
|
// VisualPng.C -- Shows a PNG image
|
||||||
|
//------------------------------------
|
||||||
|
|
||||||
|
// Copyright 2000, Willem van Schaik.
|
||||||
|
|
||||||
|
// This code is released under the libpng license.
|
||||||
|
// For conditions of distribution and use, see the disclaimer
|
||||||
|
// and license in png.h
|
||||||
|
|
||||||
|
// switches
|
||||||
|
|
||||||
|
// defines
|
||||||
|
|
||||||
|
#define PROGNAME "VisualPng"
|
||||||
|
#define LONGNAME "Win32 Viewer for PNG-files"
|
||||||
|
#define VERSION "1.0 of 2000 June 07"
|
||||||
|
|
||||||
|
// constants
|
||||||
|
|
||||||
|
#define MARGIN 8
|
||||||
|
|
||||||
|
// standard includes
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
// application includes
|
||||||
|
|
||||||
|
#include "png.h"
|
||||||
|
#include "pngfile.h"
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
// macros
|
||||||
|
|
||||||
|
// function prototypes
|
||||||
|
|
||||||
|
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
|
||||||
|
BOOL CALLBACK AboutDlgProc (HWND, UINT, WPARAM, LPARAM) ;
|
||||||
|
|
||||||
|
BOOL CenterAbout (HWND hwndChild, HWND hwndParent);
|
||||||
|
|
||||||
|
BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
|
||||||
|
int *pFileIndex);
|
||||||
|
|
||||||
|
BOOL SearchPngList (TCHAR *pFileList, int FileCount, int *pFileIndex,
|
||||||
|
PTSTR pstrPrevName, PTSTR pstrNextName);
|
||||||
|
|
||||||
|
BOOL LoadImageFile(HWND hwnd, PTSTR pstrPathName,
|
||||||
|
png_byte **ppbImage, int *pxImgSize, int *pyImgSize, int *piChannels,
|
||||||
|
png_color *pBkgColor);
|
||||||
|
|
||||||
|
BOOL DisplayImage (HWND hwnd, BYTE **ppDib,
|
||||||
|
BYTE **ppDiData, int cxWinSize, int cyWinSize,
|
||||||
|
BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels,
|
||||||
|
BOOL bStretched);
|
||||||
|
|
||||||
|
BOOL InitBitmap (
|
||||||
|
BYTE *pDiData, int cxWinSize, int cyWinSize);
|
||||||
|
|
||||||
|
BOOL FillBitmap (
|
||||||
|
BYTE *pDiData, int cxWinSize, int cyWinSize,
|
||||||
|
BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels,
|
||||||
|
BOOL bStretched);
|
||||||
|
|
||||||
|
// a few global variables
|
||||||
|
|
||||||
|
static char *szProgName = PROGNAME;
|
||||||
|
static char *szAppName = LONGNAME;
|
||||||
|
static char *szIconName = PROGNAME;
|
||||||
|
static char szCmdFileName [MAX_PATH];
|
||||||
|
|
||||||
|
// MAIN routine
|
||||||
|
|
||||||
|
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
|
PSTR szCmdLine, int iCmdShow)
|
||||||
|
{
|
||||||
|
HACCEL hAccel;
|
||||||
|
HWND hwnd;
|
||||||
|
MSG msg;
|
||||||
|
WNDCLASS wndclass;
|
||||||
|
int ixBorders, iyBorders;
|
||||||
|
|
||||||
|
wndclass.style = CS_HREDRAW | CS_VREDRAW;
|
||||||
|
wndclass.lpfnWndProc = WndProc;
|
||||||
|
wndclass.cbClsExtra = 0;
|
||||||
|
wndclass.cbWndExtra = 0;
|
||||||
|
wndclass.hInstance = hInstance;
|
||||||
|
wndclass.hIcon = LoadIcon (hInstance, szIconName) ;
|
||||||
|
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
|
||||||
|
wndclass.hbrBackground = NULL; // (HBRUSH) GetStockObject (GRAY_BRUSH);
|
||||||
|
wndclass.lpszMenuName = szProgName;
|
||||||
|
wndclass.lpszClassName = szProgName;
|
||||||
|
|
||||||
|
if (!RegisterClass (&wndclass))
|
||||||
|
{
|
||||||
|
MessageBox (NULL, TEXT ("Error: this program requires Windows NT!"),
|
||||||
|
szProgName, MB_ICONERROR);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if filename given on commandline, store it
|
||||||
|
if ((szCmdLine != NULL) && (*szCmdLine != '\0'))
|
||||||
|
if (szCmdLine[0] == '"')
|
||||||
|
strncpy (szCmdFileName, szCmdLine + 1, strlen(szCmdLine) - 2);
|
||||||
|
else
|
||||||
|
strcpy (szCmdFileName, szCmdLine);
|
||||||
|
else
|
||||||
|
strcpy (szCmdFileName, "");
|
||||||
|
|
||||||
|
// calculate size of window-borders
|
||||||
|
ixBorders = 2 * (GetSystemMetrics (SM_CXBORDER) +
|
||||||
|
GetSystemMetrics (SM_CXDLGFRAME));
|
||||||
|
iyBorders = 2 * (GetSystemMetrics (SM_CYBORDER) +
|
||||||
|
GetSystemMetrics (SM_CYDLGFRAME)) +
|
||||||
|
GetSystemMetrics (SM_CYCAPTION) +
|
||||||
|
GetSystemMetrics (SM_CYMENUSIZE) +
|
||||||
|
1; /* WvS: don't ask me why? */
|
||||||
|
|
||||||
|
hwnd = CreateWindow (szProgName, szAppName,
|
||||||
|
WS_OVERLAPPEDWINDOW,
|
||||||
|
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
|
512 + 2 * MARGIN + ixBorders, 384 + 2 * MARGIN + iyBorders,
|
||||||
|
// CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
|
NULL, NULL, hInstance, NULL);
|
||||||
|
|
||||||
|
ShowWindow (hwnd, iCmdShow);
|
||||||
|
UpdateWindow (hwnd);
|
||||||
|
|
||||||
|
hAccel = LoadAccelerators (hInstance, szProgName);
|
||||||
|
|
||||||
|
while (GetMessage (&msg, NULL, 0, 0))
|
||||||
|
{
|
||||||
|
if (!TranslateAccelerator (hwnd, hAccel, &msg))
|
||||||
|
{
|
||||||
|
TranslateMessage (&msg);
|
||||||
|
DispatchMessage (&msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return msg.wParam;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
|
||||||
|
LPARAM lParam)
|
||||||
|
{
|
||||||
|
static HINSTANCE hInstance ;
|
||||||
|
static HDC hdc;
|
||||||
|
static PAINTSTRUCT ps;
|
||||||
|
static HMENU hMenu;
|
||||||
|
|
||||||
|
static BITMAPFILEHEADER *pbmfh;
|
||||||
|
static BITMAPINFOHEADER *pbmih;
|
||||||
|
static BYTE *pbImage;
|
||||||
|
static int cxWinSize, cyWinSize;
|
||||||
|
static int cxImgSize, cyImgSize;
|
||||||
|
static int cImgChannels;
|
||||||
|
static png_color bkgColor = {127, 127, 127};
|
||||||
|
|
||||||
|
static BOOL bStretched = TRUE;
|
||||||
|
|
||||||
|
static BYTE *pDib = NULL;
|
||||||
|
static BYTE *pDiData = NULL;
|
||||||
|
|
||||||
|
static TCHAR szImgPathName [MAX_PATH];
|
||||||
|
static TCHAR szTitleName [MAX_PATH];
|
||||||
|
|
||||||
|
static TCHAR *pPngFileList = NULL;
|
||||||
|
static int iPngFileCount;
|
||||||
|
static int iPngFileIndex;
|
||||||
|
|
||||||
|
BOOL bOk;
|
||||||
|
|
||||||
|
switch (message)
|
||||||
|
{
|
||||||
|
case WM_CREATE:
|
||||||
|
hInstance = ((LPCREATESTRUCT) lParam)->hInstance ;
|
||||||
|
PngFileInitialize (hwnd);
|
||||||
|
|
||||||
|
strcpy (szImgPathName, "");
|
||||||
|
|
||||||
|
// in case we process file given on command-line
|
||||||
|
|
||||||
|
if (szCmdFileName[0] != '\0')
|
||||||
|
{
|
||||||
|
strcpy (szImgPathName, szCmdFileName);
|
||||||
|
|
||||||
|
// read the other png-files in the directory for later
|
||||||
|
// next/previous commands
|
||||||
|
|
||||||
|
BuildPngList (szImgPathName, &pPngFileList, &iPngFileCount,
|
||||||
|
&iPngFileIndex);
|
||||||
|
|
||||||
|
// load the image from file
|
||||||
|
|
||||||
|
if (!LoadImageFile (hwnd, szImgPathName,
|
||||||
|
&pbImage, &cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// invalidate the client area for later update
|
||||||
|
|
||||||
|
InvalidateRect (hwnd, NULL, TRUE);
|
||||||
|
|
||||||
|
// display the PNG into the DIBitmap
|
||||||
|
|
||||||
|
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
||||||
|
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case WM_SIZE:
|
||||||
|
cxWinSize = LOWORD (lParam);
|
||||||
|
cyWinSize = HIWORD (lParam);
|
||||||
|
|
||||||
|
// invalidate the client area for later update
|
||||||
|
|
||||||
|
InvalidateRect (hwnd, NULL, TRUE);
|
||||||
|
|
||||||
|
// display the PNG into the DIBitmap
|
||||||
|
|
||||||
|
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
||||||
|
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case WM_INITMENUPOPUP:
|
||||||
|
hMenu = GetMenu (hwnd);
|
||||||
|
|
||||||
|
if (pbImage)
|
||||||
|
EnableMenuItem (hMenu, IDM_FILE_SAVE, MF_ENABLED);
|
||||||
|
else
|
||||||
|
EnableMenuItem (hMenu, IDM_FILE_SAVE, MF_GRAYED);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case WM_COMMAND:
|
||||||
|
hMenu = GetMenu (hwnd);
|
||||||
|
|
||||||
|
switch (LOWORD (wParam))
|
||||||
|
{
|
||||||
|
case IDM_FILE_OPEN:
|
||||||
|
|
||||||
|
// show the File Open dialog box
|
||||||
|
|
||||||
|
if (!PngFileOpenDlg (hwnd, szImgPathName, szTitleName))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// read the other png-files in the directory for later
|
||||||
|
// next/previous commands
|
||||||
|
|
||||||
|
BuildPngList (szImgPathName, &pPngFileList, &iPngFileCount,
|
||||||
|
&iPngFileIndex);
|
||||||
|
|
||||||
|
// load the image from file
|
||||||
|
|
||||||
|
if (!LoadImageFile (hwnd, szImgPathName,
|
||||||
|
&pbImage, &cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// invalidate the client area for later update
|
||||||
|
|
||||||
|
InvalidateRect (hwnd, NULL, TRUE);
|
||||||
|
|
||||||
|
// display the PNG into the DIBitmap
|
||||||
|
|
||||||
|
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
||||||
|
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case IDM_FILE_SAVE:
|
||||||
|
|
||||||
|
// show the File Save dialog box
|
||||||
|
|
||||||
|
if (!PngFileSaveDlg (hwnd, szImgPathName, szTitleName))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// save the PNG to a disk file
|
||||||
|
|
||||||
|
SetCursor (LoadCursor (NULL, IDC_WAIT));
|
||||||
|
ShowCursor (TRUE);
|
||||||
|
|
||||||
|
bOk = PngSaveImage (szImgPathName, pDiData, cxWinSize, cyWinSize,
|
||||||
|
bkgColor);
|
||||||
|
|
||||||
|
ShowCursor (FALSE);
|
||||||
|
SetCursor (LoadCursor (NULL, IDC_ARROW));
|
||||||
|
|
||||||
|
if (!bOk)
|
||||||
|
MessageBox (hwnd, TEXT ("Error in saving the PNG image"),
|
||||||
|
szProgName, MB_ICONEXCLAMATION | MB_OK);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case IDM_FILE_NEXT:
|
||||||
|
|
||||||
|
// read next entry in the directory
|
||||||
|
|
||||||
|
if (SearchPngList (pPngFileList, iPngFileCount, &iPngFileIndex,
|
||||||
|
NULL, szImgPathName))
|
||||||
|
{
|
||||||
|
if (strcmp (szImgPathName, "") == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// load the image from file
|
||||||
|
|
||||||
|
if (!LoadImageFile (hwnd, szImgPathName, &pbImage,
|
||||||
|
&cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// invalidate the client area for later update
|
||||||
|
|
||||||
|
InvalidateRect (hwnd, NULL, TRUE);
|
||||||
|
|
||||||
|
// display the PNG into the DIBitmap
|
||||||
|
|
||||||
|
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
||||||
|
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case IDM_FILE_PREVIOUS:
|
||||||
|
|
||||||
|
// read previous entry in the directory
|
||||||
|
|
||||||
|
if (SearchPngList (pPngFileList, iPngFileCount, &iPngFileIndex,
|
||||||
|
szImgPathName, NULL))
|
||||||
|
{
|
||||||
|
|
||||||
|
if (strcmp (szImgPathName, "") == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// load the image from file
|
||||||
|
|
||||||
|
if (!LoadImageFile (hwnd, szImgPathName, &pbImage, &cxImgSize,
|
||||||
|
&cyImgSize, &cImgChannels, &bkgColor))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// invalidate the client area for later update
|
||||||
|
|
||||||
|
InvalidateRect (hwnd, NULL, TRUE);
|
||||||
|
|
||||||
|
// display the PNG into the DIBitmap
|
||||||
|
|
||||||
|
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
||||||
|
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case IDM_FILE_EXIT:
|
||||||
|
|
||||||
|
// more cleanup needed...
|
||||||
|
|
||||||
|
// free image buffer
|
||||||
|
|
||||||
|
if (pDib != NULL)
|
||||||
|
{
|
||||||
|
free (pDib);
|
||||||
|
pDib = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// free file-list
|
||||||
|
|
||||||
|
if (pPngFileList != NULL)
|
||||||
|
{
|
||||||
|
free (pPngFileList);
|
||||||
|
pPngFileList = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// let's go ...
|
||||||
|
|
||||||
|
exit (0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case IDM_OPTIONS_STRETCH:
|
||||||
|
bStretched = !bStretched;
|
||||||
|
if (bStretched)
|
||||||
|
CheckMenuItem (hMenu, IDM_OPTIONS_STRETCH, MF_CHECKED);
|
||||||
|
else
|
||||||
|
CheckMenuItem (hMenu, IDM_OPTIONS_STRETCH, MF_UNCHECKED);
|
||||||
|
|
||||||
|
// invalidate the client area for later update
|
||||||
|
|
||||||
|
InvalidateRect (hwnd, NULL, TRUE);
|
||||||
|
|
||||||
|
// display the PNG into the DIBitmap
|
||||||
|
|
||||||
|
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
||||||
|
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case IDM_HELP_ABOUT:
|
||||||
|
DialogBox (hInstance, TEXT ("AboutBox"), hwnd, AboutDlgProc) ;
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
} // end switch
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_PAINT:
|
||||||
|
hdc = BeginPaint (hwnd, &ps);
|
||||||
|
|
||||||
|
if (pDib)
|
||||||
|
SetDIBitsToDevice (hdc, 0, 0, cxWinSize, cyWinSize, 0, 0,
|
||||||
|
0, cyWinSize, pDiData, (BITMAPINFO *) pDib, DIB_RGB_COLORS);
|
||||||
|
|
||||||
|
EndPaint (hwnd, &ps);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case WM_DESTROY:
|
||||||
|
if (pbmfh)
|
||||||
|
{
|
||||||
|
free (pbmfh);
|
||||||
|
pbmfh = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
PostQuitMessage (0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DefWindowProc (hwnd, message, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CALLBACK AboutDlgProc (HWND hDlg, UINT message,
|
||||||
|
WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
switch (message)
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG :
|
||||||
|
ShowWindow (hDlg, SW_HIDE);
|
||||||
|
CenterAbout (hDlg, GetWindow (hDlg, GW_OWNER));
|
||||||
|
ShowWindow (hDlg, SW_SHOW);
|
||||||
|
return TRUE ;
|
||||||
|
|
||||||
|
case WM_COMMAND :
|
||||||
|
switch (LOWORD (wParam))
|
||||||
|
{
|
||||||
|
case IDOK :
|
||||||
|
case IDCANCEL :
|
||||||
|
EndDialog (hDlg, 0) ;
|
||||||
|
return TRUE ;
|
||||||
|
}
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
return FALSE ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------
|
||||||
|
// CenterAbout
|
||||||
|
//---------------
|
||||||
|
|
||||||
|
BOOL CenterAbout (HWND hwndChild, HWND hwndParent)
|
||||||
|
{
|
||||||
|
RECT rChild, rParent, rWorkArea;
|
||||||
|
int wChild, hChild, wParent, hParent;
|
||||||
|
int xNew, yNew;
|
||||||
|
BOOL bResult;
|
||||||
|
|
||||||
|
// Get the Height and Width of the child window
|
||||||
|
GetWindowRect (hwndChild, &rChild);
|
||||||
|
wChild = rChild.right - rChild.left;
|
||||||
|
hChild = rChild.bottom - rChild.top;
|
||||||
|
|
||||||
|
// Get the Height and Width of the parent window
|
||||||
|
GetWindowRect (hwndParent, &rParent);
|
||||||
|
wParent = rParent.right - rParent.left;
|
||||||
|
hParent = rParent.bottom - rParent.top;
|
||||||
|
|
||||||
|
// Get the limits of the 'workarea'
|
||||||
|
bResult = SystemParametersInfo(
|
||||||
|
SPI_GETWORKAREA, // system parameter to query or set
|
||||||
|
sizeof(RECT),
|
||||||
|
&rWorkArea,
|
||||||
|
0);
|
||||||
|
if (!bResult) {
|
||||||
|
rWorkArea.left = rWorkArea.top = 0;
|
||||||
|
rWorkArea.right = GetSystemMetrics(SM_CXSCREEN);
|
||||||
|
rWorkArea.bottom = GetSystemMetrics(SM_CYSCREEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate new X position, then adjust for workarea
|
||||||
|
xNew = rParent.left + ((wParent - wChild) /2);
|
||||||
|
if (xNew < rWorkArea.left) {
|
||||||
|
xNew = rWorkArea.left;
|
||||||
|
} else if ((xNew+wChild) > rWorkArea.right) {
|
||||||
|
xNew = rWorkArea.right - wChild;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate new Y position, then adjust for workarea
|
||||||
|
yNew = rParent.top + ((hParent - hChild) /2);
|
||||||
|
if (yNew < rWorkArea.top) {
|
||||||
|
yNew = rWorkArea.top;
|
||||||
|
} else if ((yNew+hChild) > rWorkArea.bottom) {
|
||||||
|
yNew = rWorkArea.bottom - hChild;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set it, and return
|
||||||
|
return SetWindowPos (hwndChild, NULL, xNew, yNew, 0, 0, SWP_NOSIZE |
|
||||||
|
SWP_NOZORDER);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------
|
||||||
|
// BuildPngList
|
||||||
|
//----------------
|
||||||
|
|
||||||
|
BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
|
||||||
|
int *pFileIndex)
|
||||||
|
{
|
||||||
|
static TCHAR szImgPathName [MAX_PATH];
|
||||||
|
static TCHAR szImgFileName [MAX_PATH];
|
||||||
|
static TCHAR szImgFindName [MAX_PATH];
|
||||||
|
|
||||||
|
WIN32_FIND_DATA finddata;
|
||||||
|
HANDLE hFind;
|
||||||
|
|
||||||
|
static TCHAR szTmp [MAX_PATH];
|
||||||
|
BOOL bOk;
|
||||||
|
int i, ii;
|
||||||
|
int j, jj;
|
||||||
|
|
||||||
|
// free previous file-list
|
||||||
|
|
||||||
|
if (*ppFileList != NULL)
|
||||||
|
{
|
||||||
|
free (*ppFileList);
|
||||||
|
*ppFileList = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// extract foldername, filename and search-name
|
||||||
|
|
||||||
|
strcpy (szImgPathName, pstrPathName);
|
||||||
|
strcpy (szImgFileName, strrchr (pstrPathName, '\\') + 1);
|
||||||
|
|
||||||
|
strcpy (szImgFindName, szImgPathName);
|
||||||
|
*(strrchr (szImgFindName, '\\') + 1) = '\0';
|
||||||
|
strcat (szImgFindName, "*.png");
|
||||||
|
|
||||||
|
// first cycle: count number of files in directory for memory allocation
|
||||||
|
|
||||||
|
*pFileCount = 0;
|
||||||
|
|
||||||
|
hFind = FindFirstFile(szImgFindName, &finddata);
|
||||||
|
bOk = (hFind != (HANDLE) -1);
|
||||||
|
|
||||||
|
while (bOk)
|
||||||
|
{
|
||||||
|
*pFileCount += 1;
|
||||||
|
bOk = FindNextFile(hFind, &finddata);
|
||||||
|
}
|
||||||
|
FindClose(hFind);
|
||||||
|
|
||||||
|
// allocation memory for file-list
|
||||||
|
|
||||||
|
*ppFileList = (TCHAR *) malloc (*pFileCount * MAX_PATH);
|
||||||
|
|
||||||
|
// second cycle: read directory and store filenames in file-list
|
||||||
|
|
||||||
|
hFind = FindFirstFile(szImgFindName, &finddata);
|
||||||
|
bOk = (hFind != (HANDLE) -1);
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
ii = 0;
|
||||||
|
while (bOk)
|
||||||
|
{
|
||||||
|
strcpy (*ppFileList + ii, szImgPathName);
|
||||||
|
strcpy (strrchr(*ppFileList + ii, '\\') + 1, finddata.cFileName);
|
||||||
|
|
||||||
|
if (strcmp(pstrPathName, *ppFileList + ii) == 0)
|
||||||
|
*pFileIndex = i;
|
||||||
|
|
||||||
|
ii += MAX_PATH;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
bOk = FindNextFile(hFind, &finddata);
|
||||||
|
}
|
||||||
|
FindClose(hFind);
|
||||||
|
|
||||||
|
// finally we must sort the file-list
|
||||||
|
|
||||||
|
for (i = 0; i < *pFileCount - 1; i++)
|
||||||
|
{
|
||||||
|
ii = i * MAX_PATH;
|
||||||
|
for (j = i+1; j < *pFileCount; j++)
|
||||||
|
{
|
||||||
|
jj = j * MAX_PATH;
|
||||||
|
if (strcmp (*ppFileList + ii, *ppFileList + jj) > 0)
|
||||||
|
{
|
||||||
|
strcpy (szTmp, *ppFileList + jj);
|
||||||
|
strcpy (*ppFileList + jj, *ppFileList + ii);
|
||||||
|
strcpy (*ppFileList + ii, szTmp);
|
||||||
|
|
||||||
|
// check if this was the current image that we moved
|
||||||
|
|
||||||
|
if (*pFileIndex == i)
|
||||||
|
*pFileIndex = j;
|
||||||
|
else
|
||||||
|
if (*pFileIndex == j)
|
||||||
|
*pFileIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------
|
||||||
|
// SearchPngList
|
||||||
|
//----------------
|
||||||
|
|
||||||
|
BOOL SearchPngList (
|
||||||
|
TCHAR *pFileList, int FileCount, int *pFileIndex,
|
||||||
|
PTSTR pstrPrevName, PTSTR pstrNextName)
|
||||||
|
{
|
||||||
|
if (FileCount > 0)
|
||||||
|
{
|
||||||
|
// get previous entry
|
||||||
|
|
||||||
|
if (pstrPrevName != NULL)
|
||||||
|
{
|
||||||
|
if (*pFileIndex > 0)
|
||||||
|
*pFileIndex -= 1;
|
||||||
|
else
|
||||||
|
*pFileIndex = FileCount - 1;
|
||||||
|
|
||||||
|
strcpy (pstrPrevName, pFileList + (*pFileIndex * MAX_PATH));
|
||||||
|
}
|
||||||
|
|
||||||
|
// get next entry
|
||||||
|
|
||||||
|
if (pstrNextName != NULL)
|
||||||
|
{
|
||||||
|
if (*pFileIndex < FileCount - 1)
|
||||||
|
*pFileIndex += 1;
|
||||||
|
else
|
||||||
|
*pFileIndex = 0;
|
||||||
|
|
||||||
|
strcpy (pstrNextName, pFileList + (*pFileIndex * MAX_PATH));
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------
|
||||||
|
// LoadImageFile
|
||||||
|
//-----------------
|
||||||
|
|
||||||
|
BOOL LoadImageFile (HWND hwnd, PTSTR pstrPathName,
|
||||||
|
png_byte **ppbImage, int *pxImgSize, int *pyImgSize,
|
||||||
|
int *piChannels, png_color *pBkgColor)
|
||||||
|
{
|
||||||
|
static TCHAR szTmp [MAX_PATH];
|
||||||
|
|
||||||
|
// if there's an existing PNG, free the memory
|
||||||
|
|
||||||
|
if (*ppbImage)
|
||||||
|
{
|
||||||
|
free (*ppbImage);
|
||||||
|
*ppbImage = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load the entire PNG into memory
|
||||||
|
|
||||||
|
SetCursor (LoadCursor (NULL, IDC_WAIT));
|
||||||
|
ShowCursor (TRUE);
|
||||||
|
|
||||||
|
PngLoadImage (pstrPathName, ppbImage, pxImgSize, pyImgSize, piChannels,
|
||||||
|
pBkgColor);
|
||||||
|
|
||||||
|
ShowCursor (FALSE);
|
||||||
|
SetCursor (LoadCursor (NULL, IDC_ARROW));
|
||||||
|
|
||||||
|
if (*ppbImage != NULL)
|
||||||
|
{
|
||||||
|
sprintf (szTmp, "VisualPng - %s", strrchr(pstrPathName, '\\') + 1);
|
||||||
|
SetWindowText (hwnd, szTmp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox (hwnd, TEXT ("Error in loading the PNG image"),
|
||||||
|
szProgName, MB_ICONEXCLAMATION | MB_OK);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------
|
||||||
|
// DisplayImage
|
||||||
|
//----------------
|
||||||
|
|
||||||
|
BOOL DisplayImage (HWND hwnd, BYTE **ppDib,
|
||||||
|
BYTE **ppDiData, int cxWinSize, int cyWinSize,
|
||||||
|
BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels,
|
||||||
|
BOOL bStretched)
|
||||||
|
{
|
||||||
|
BYTE *pDib = *ppDib;
|
||||||
|
BYTE *pDiData = *ppDiData;
|
||||||
|
// BITMAPFILEHEADER *pbmfh;
|
||||||
|
BITMAPINFOHEADER *pbmih;
|
||||||
|
WORD wDIRowBytes;
|
||||||
|
png_color bkgBlack = {0, 0, 0};
|
||||||
|
png_color bkgGray = {127, 127, 127};
|
||||||
|
png_color bkgWhite = {255, 255, 255};
|
||||||
|
|
||||||
|
// allocate memory for the Device Independant bitmap
|
||||||
|
|
||||||
|
wDIRowBytes = (WORD) ((3 * cxWinSize + 3L) >> 2) << 2;
|
||||||
|
|
||||||
|
if (pDib)
|
||||||
|
{
|
||||||
|
free (pDib);
|
||||||
|
pDib = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(pDib = (BYTE *) malloc (sizeof(BITMAPINFOHEADER) +
|
||||||
|
wDIRowBytes * cyWinSize)))
|
||||||
|
{
|
||||||
|
MessageBox (hwnd, TEXT ("Error in displaying the PNG image"),
|
||||||
|
szProgName, MB_ICONEXCLAMATION | MB_OK);
|
||||||
|
*ppDib = pDib = NULL;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
*ppDib = pDib;
|
||||||
|
memset (pDib, 0, sizeof(BITMAPINFOHEADER));
|
||||||
|
|
||||||
|
// initialize the dib-structure
|
||||||
|
|
||||||
|
pbmih = (BITMAPINFOHEADER *) pDib;
|
||||||
|
pbmih->biSize = sizeof(BITMAPINFOHEADER);
|
||||||
|
pbmih->biWidth = cxWinSize;
|
||||||
|
pbmih->biHeight = -((long) cyWinSize);
|
||||||
|
pbmih->biPlanes = 1;
|
||||||
|
pbmih->biBitCount = 24;
|
||||||
|
pbmih->biCompression = 0;
|
||||||
|
pDiData = pDib + sizeof(BITMAPINFOHEADER);
|
||||||
|
*ppDiData = pDiData;
|
||||||
|
|
||||||
|
// first fill bitmap with gray and image border
|
||||||
|
|
||||||
|
InitBitmap (pDiData, cxWinSize, cyWinSize);
|
||||||
|
|
||||||
|
// then fill bitmap with image
|
||||||
|
|
||||||
|
if (pbImage)
|
||||||
|
{
|
||||||
|
FillBitmap (
|
||||||
|
pDiData, cxWinSize, cyWinSize,
|
||||||
|
pbImage, cxImgSize, cyImgSize, cImgChannels,
|
||||||
|
bStretched);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------
|
||||||
|
// InitBitmap
|
||||||
|
//--------------
|
||||||
|
|
||||||
|
BOOL InitBitmap (BYTE *pDiData, int cxWinSize, int cyWinSize)
|
||||||
|
{
|
||||||
|
BYTE *dst;
|
||||||
|
int x, y, col;
|
||||||
|
|
||||||
|
// initialize the background with gray
|
||||||
|
|
||||||
|
dst = pDiData;
|
||||||
|
for (y = 0; y < cyWinSize; y++)
|
||||||
|
{
|
||||||
|
col = 0;
|
||||||
|
for (x = 0; x < cxWinSize; x++)
|
||||||
|
{
|
||||||
|
// fill with GRAY
|
||||||
|
*dst++ = 127;
|
||||||
|
*dst++ = 127;
|
||||||
|
*dst++ = 127;
|
||||||
|
col += 3;
|
||||||
|
}
|
||||||
|
// rows start on 4 byte boundaries
|
||||||
|
while ((col % 4) != 0)
|
||||||
|
{
|
||||||
|
dst++;
|
||||||
|
col++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------
|
||||||
|
// FillBitmap
|
||||||
|
//--------------
|
||||||
|
|
||||||
|
BOOL FillBitmap (
|
||||||
|
BYTE *pDiData, int cxWinSize, int cyWinSize,
|
||||||
|
BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels,
|
||||||
|
BOOL bStretched)
|
||||||
|
{
|
||||||
|
BYTE *pStretchedImage;
|
||||||
|
BYTE *pImg;
|
||||||
|
BYTE *src, *dst;
|
||||||
|
BYTE r, g, b, a;
|
||||||
|
const int cDIChannels = 3;
|
||||||
|
WORD wImgRowBytes;
|
||||||
|
WORD wDIRowBytes;
|
||||||
|
int cxNewSize, cyNewSize;
|
||||||
|
int cxImgPos, cyImgPos;
|
||||||
|
int xImg, yImg;
|
||||||
|
int xWin, yWin;
|
||||||
|
int xOld, yOld;
|
||||||
|
int xNew, yNew;
|
||||||
|
|
||||||
|
if (bStretched)
|
||||||
|
{
|
||||||
|
cxNewSize = cxWinSize - 2 * MARGIN;
|
||||||
|
cyNewSize = cyWinSize - 2 * MARGIN;
|
||||||
|
|
||||||
|
// stretch the image to it's window determined size
|
||||||
|
|
||||||
|
// the following two are the same, but the first has side-effects
|
||||||
|
// because of rounding
|
||||||
|
// if ((cyNewSize / cxNewSize) > (cyImgSize / cxImgSize))
|
||||||
|
if ((cyNewSize * cxImgSize) > (cyImgSize * cxNewSize))
|
||||||
|
{
|
||||||
|
cyNewSize = cxNewSize * cyImgSize / cxImgSize;
|
||||||
|
cxImgPos = MARGIN;
|
||||||
|
cyImgPos = (cyWinSize - cyNewSize) / 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cxNewSize = cyNewSize * cxImgSize / cyImgSize;
|
||||||
|
cyImgPos = MARGIN;
|
||||||
|
cxImgPos = (cxWinSize - cxNewSize) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
pStretchedImage = malloc (cImgChannels * cxNewSize * cyNewSize);
|
||||||
|
pImg = pStretchedImage;
|
||||||
|
|
||||||
|
for (yNew = 0; yNew < cyNewSize; yNew++)
|
||||||
|
{
|
||||||
|
yOld = yNew * cyImgSize / cyNewSize;
|
||||||
|
for (xNew = 0; xNew < cxNewSize; xNew++)
|
||||||
|
{
|
||||||
|
xOld = xNew * cxImgSize / cxNewSize;
|
||||||
|
|
||||||
|
r = *(pbImage + cImgChannels * ((yOld * cxImgSize) + xOld) + 0);
|
||||||
|
g = *(pbImage + cImgChannels * ((yOld * cxImgSize) + xOld) + 1);
|
||||||
|
b = *(pbImage + cImgChannels * ((yOld * cxImgSize) + xOld) + 2);
|
||||||
|
*pImg++ = r;
|
||||||
|
*pImg++ = g;
|
||||||
|
*pImg++ = b;
|
||||||
|
if (cImgChannels == 4)
|
||||||
|
{
|
||||||
|
a = *(pbImage + cImgChannels * ((yOld * cxImgSize) + xOld)
|
||||||
|
+ 3);
|
||||||
|
*pImg++ = a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// calculate row-bytes
|
||||||
|
|
||||||
|
wImgRowBytes = cImgChannels * cxNewSize;
|
||||||
|
wDIRowBytes = (WORD) ((cDIChannels * cxWinSize + 3L) >> 2) << 2;
|
||||||
|
|
||||||
|
// copy image to screen
|
||||||
|
|
||||||
|
for (yImg = 0, yWin = cyImgPos; yImg < cyNewSize; yImg++, yWin++)
|
||||||
|
{
|
||||||
|
if (yWin >= cyWinSize - cyImgPos)
|
||||||
|
break;
|
||||||
|
src = pStretchedImage + yImg * wImgRowBytes;
|
||||||
|
dst = pDiData + yWin * wDIRowBytes + cxImgPos * cDIChannels;
|
||||||
|
|
||||||
|
for (xImg = 0, xWin = cxImgPos; xImg < cxNewSize; xImg++, xWin++)
|
||||||
|
{
|
||||||
|
if (xWin >= cxWinSize - cxImgPos)
|
||||||
|
break;
|
||||||
|
r = *src++;
|
||||||
|
g = *src++;
|
||||||
|
b = *src++;
|
||||||
|
*dst++ = b; /* note the reverse order */
|
||||||
|
*dst++ = g;
|
||||||
|
*dst++ = r;
|
||||||
|
if (cImgChannels == 4)
|
||||||
|
{
|
||||||
|
a = *src++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// free memory
|
||||||
|
|
||||||
|
if (pStretchedImage != NULL)
|
||||||
|
{
|
||||||
|
free (pStretchedImage);
|
||||||
|
pStretchedImage = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// process the image not-stretched
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// calculate the central position
|
||||||
|
|
||||||
|
cxImgPos = (cxWinSize - cxImgSize) / 2;
|
||||||
|
cyImgPos = (cyWinSize - cyImgSize) / 2;
|
||||||
|
|
||||||
|
// check for image larger than window
|
||||||
|
|
||||||
|
if (cxImgPos < MARGIN)
|
||||||
|
cxImgPos = MARGIN;
|
||||||
|
if (cyImgPos < MARGIN)
|
||||||
|
cyImgPos = MARGIN;
|
||||||
|
|
||||||
|
// calculate both row-bytes
|
||||||
|
|
||||||
|
wImgRowBytes = cImgChannels * cxImgSize;
|
||||||
|
wDIRowBytes = (WORD) ((cDIChannels * cxWinSize + 3L) >> 2) << 2;
|
||||||
|
|
||||||
|
// copy image to screen
|
||||||
|
|
||||||
|
for (yImg = 0, yWin = cyImgPos; yImg < cyImgSize; yImg++, yWin++)
|
||||||
|
{
|
||||||
|
if (yWin >= cyWinSize - MARGIN)
|
||||||
|
break;
|
||||||
|
src = pbImage + yImg * wImgRowBytes;
|
||||||
|
dst = pDiData + yWin * wDIRowBytes + cxImgPos * cDIChannels;
|
||||||
|
|
||||||
|
for (xImg = 0, xWin = cxImgPos; xImg < cxImgSize; xImg++, xWin++)
|
||||||
|
{
|
||||||
|
if (xWin >= cxWinSize - MARGIN)
|
||||||
|
break;
|
||||||
|
r = *src++;
|
||||||
|
g = *src++;
|
||||||
|
b = *src++;
|
||||||
|
*dst++ = b; /* note the reverse order */
|
||||||
|
*dst++ = g;
|
||||||
|
*dst++ = r;
|
||||||
|
if (cImgChannels == 4)
|
||||||
|
{
|
||||||
|
a = *src++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------
|
||||||
|
// end of source
|
||||||
|
//-----------------
|
||||||
147
contrib/visupng/VisualPng.dsp
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="VisualPng" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||||
|
|
||||||
|
CFG=VisualPng - Win32 Debug
|
||||||
|
!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 "VisualPng.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 "VisualPng.mak" CFG="VisualPng - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "VisualPng - Win32 Release" (based on "Win32 (x86) Application")
|
||||||
|
!MESSAGE "VisualPng - Win32 Debug" (based on "Win32 (x86) Application")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
MTL=midl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "VisualPng - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Ignore_Export_Lib 0
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_NO_STDIO" /FD /c
|
||||||
|
# SUBTRACT BASE CPP /YX
|
||||||
|
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_NO_STDIO" /FD /c
|
||||||
|
# SUBTRACT CPP /YX
|
||||||
|
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
|
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
|
# 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 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 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
|
||||||
|
# Begin Special Build Tool
|
||||||
|
OutDir=.\Release
|
||||||
|
SOURCE="$(InputPath)"
|
||||||
|
PostBuild_Cmds=$(outdir)\VisualPng.exe ..\..\contrib\pngsuite\basn6a16.png
|
||||||
|
# End Special Build Tool
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "VisualPng - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Ignore_Export_Lib 0
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "Debug"
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_NO_STDIO" /FD /GZ /c
|
||||||
|
# SUBTRACT BASE CPP /YX
|
||||||
|
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_NO_STDIO" /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 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 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
|
||||||
|
# Begin Special Build Tool
|
||||||
|
OutDir=.\Debug
|
||||||
|
SOURCE="$(InputPath)"
|
||||||
|
PostBuild_Cmds=$(outdir)\VisualPng.exe ..\..\contrib\pngsuite\basn6a16.png
|
||||||
|
# End Special Build Tool
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "VisualPng - Win32 Release"
|
||||||
|
# Name "VisualPng - Win32 Debug"
|
||||||
|
# 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
|
||||||
29
contrib/visupng/VisualPng.dsw
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "VisualPng"=.\VisualPng.dsp - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
BIN
contrib/visupng/VisualPng.ico
Normal file
|
After Width: | Height: | Size: 766 B |
BIN
contrib/visupng/VisualPng.png
Normal file
|
After Width: | Height: | Size: 208 B |
152
contrib/visupng/VisualPng.rc
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
//Microsoft Developer Studio generated resource script.
|
||||||
|
//
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 2 resource.
|
||||||
|
//
|
||||||
|
#include "afxres.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// English (U.S.) resources
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||||
|
#ifdef _WIN32
|
||||||
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
#pragma code_page(1252)
|
||||||
|
#endif //_WIN32
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// TEXTINCLUDE
|
||||||
|
//
|
||||||
|
|
||||||
|
1 TEXTINCLUDE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
"resource.h\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
2 TEXTINCLUDE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
"#include ""afxres.h""\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
3 TEXTINCLUDE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
"\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Menu
|
||||||
|
//
|
||||||
|
|
||||||
|
VISUALPNG MENU DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
POPUP "&File"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "&Open Image...\tCtrl+O", IDM_FILE_OPEN
|
||||||
|
MENUITEM "Save &As...", IDM_FILE_SAVE
|
||||||
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "&Next Image\tCtrl+N", IDM_FILE_NEXT
|
||||||
|
MENUITEM "Pre&vious Image\tCtrl+V", IDM_FILE_PREVIOUS
|
||||||
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "E&xit\tAlt+X", IDM_FILE_EXIT
|
||||||
|
END
|
||||||
|
POPUP "&Options"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "&Stretch", IDM_OPTIONS_STRETCH, CHECKED
|
||||||
|
END
|
||||||
|
POPUP "&Help"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "&About", IDM_HELP_ABOUT
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Accelerator
|
||||||
|
//
|
||||||
|
|
||||||
|
VISUALPNG ACCELERATORS DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
"N", IDM_FILE_NEXT, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
"O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
"P", IDM_FILE_PREVIOUS, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
"V", IDM_FILE_PREVIOUS, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
"X", IDM_FILE_EXIT, VIRTKEY, ALT, NOINVERT
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Icon
|
||||||
|
//
|
||||||
|
|
||||||
|
// Icon with lowest ID value placed first to ensure application icon
|
||||||
|
// remains consistent on all systems.
|
||||||
|
VISUALPNG ICON DISCARDABLE "VisualPng.ico"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Dialog
|
||||||
|
//
|
||||||
|
|
||||||
|
ABOUTBOX DIALOG DISCARDABLE 0, 0, 186, 94
|
||||||
|
STYLE DS_MODALFRAME | WS_POPUP
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
DEFPUSHBUTTON "OK",IDOK,68,67,50,14
|
||||||
|
CTEXT "VisualPng 1.0 - June 2000",IDC_STATIC,49,14,88,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 "to demonstrate the use of libpng in Visual C",
|
||||||
|
IDC_STATIC,25,38,136,8
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// DESIGNINFO
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
GUIDELINES DESIGNINFO DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
"ABOUTBOX", DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 179
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 87
|
||||||
|
END
|
||||||
|
END
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
#endif // English (U.S.) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
||||||
248
contrib/visupng/cexcept.h
Normal file
@@ -0,0 +1,248 @@
|
|||||||
|
/*===
|
||||||
|
cexcept.h 2.0.1 (2008-Jul-19-Sat)
|
||||||
|
http://www.nicemice.net/cexcept/
|
||||||
|
Adam M. Costello
|
||||||
|
http://www.nicemice.net/amc/
|
||||||
|
|
||||||
|
An interface for exception-handling in ANSI C (C89 and subsequent ISO
|
||||||
|
standards), developed jointly with Cosmin Truta.
|
||||||
|
|
||||||
|
Copyright (c) 2000-2008 Adam M. Costello and Cosmin Truta.
|
||||||
|
This software may be modified only if its author and version
|
||||||
|
information is updated accurately, and may be redistributed
|
||||||
|
only if accompanied by this unaltered notice. Subject to those
|
||||||
|
restrictions, permission is granted to anyone to do anything
|
||||||
|
with this software. The copyright holders make no guarantees
|
||||||
|
regarding this software, and are not responsible for any damage
|
||||||
|
resulting from its use.
|
||||||
|
|
||||||
|
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
|
||||||
|
includes this header file and then invokes the define_exception_type
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
define_exception_type(type_name);
|
||||||
|
|
||||||
|
This macro is used like an external declaration. It specifies
|
||||||
|
the type of object that gets copied from the exception thrower to
|
||||||
|
the exception catcher. The type_name can be any type that can be
|
||||||
|
assigned to, that is, a non-constant arithmetic type, struct, union,
|
||||||
|
or pointer. Examples:
|
||||||
|
|
||||||
|
define_exception_type(int);
|
||||||
|
|
||||||
|
enum exception { out_of_memory, bad_arguments, disk_full };
|
||||||
|
define_exception_type(enum exception);
|
||||||
|
|
||||||
|
struct exception { int code; const char *msg; };
|
||||||
|
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;
|
||||||
|
|
||||||
|
This type may be used after the define_exception_type() macro has
|
||||||
|
been invoked. A struct exception_context must be known to both
|
||||||
|
the thrower and the catcher. It is expected that there be one
|
||||||
|
context for each thread that uses exceptions. It would certainly
|
||||||
|
be dangerous for multiple threads to access the same context.
|
||||||
|
One thread can use multiple contexts, but that is likely to be
|
||||||
|
confusing and not typically useful. The application can allocate
|
||||||
|
this structure in any way it pleases--automatic, static, or dynamic.
|
||||||
|
The application programmer should pretend not to know the structure
|
||||||
|
members, which are subject to change.
|
||||||
|
|
||||||
|
|
||||||
|
struct exception_context *the_exception_context;
|
||||||
|
|
||||||
|
The Try/Catch and Throw statements (described below) implicitly
|
||||||
|
refer to a context, using the name the_exception_context. It is
|
||||||
|
the application's responsibility to make sure that this name yields
|
||||||
|
the address of a mutable (non-constant) struct exception_context
|
||||||
|
wherever those statements are used. Subject to that constraint, the
|
||||||
|
application may declare a variable of this name anywhere it likes
|
||||||
|
(inside a function, in a parameter list, or externally), and may
|
||||||
|
use whatever storage class specifiers (static, extern, etc) or type
|
||||||
|
qualifiers (const, volatile, etc) it likes. Examples:
|
||||||
|
|
||||||
|
static struct exception_context
|
||||||
|
* const the_exception_context = &foo;
|
||||||
|
|
||||||
|
{ struct exception_context *the_exception_context = bar; ... }
|
||||||
|
|
||||||
|
int blah(struct exception_context *the_exception_context, ...);
|
||||||
|
|
||||||
|
extern struct exception_context the_exception_context[1];
|
||||||
|
|
||||||
|
The last example illustrates a trick that avoids creating a pointer
|
||||||
|
object separate from the structure object.
|
||||||
|
|
||||||
|
The name could even be a macro, for example:
|
||||||
|
|
||||||
|
struct exception_context ec_array[numthreads];
|
||||||
|
#define the_exception_context (ec_array + thread_id)
|
||||||
|
|
||||||
|
Be aware that the_exception_context is used several times by the
|
||||||
|
Try/Catch/Throw macros, so it shouldn't be expensive or have side
|
||||||
|
effects. The expansion must be a drop-in replacement for an
|
||||||
|
identifier, so it's safest to put parentheses around it.
|
||||||
|
|
||||||
|
|
||||||
|
void init_exception_context(struct exception_context *ec);
|
||||||
|
|
||||||
|
For context structures allocated statically (by an external
|
||||||
|
definition or using the "static" keyword), the implicit
|
||||||
|
initialization to all zeros is sufficient, but contexts allocated
|
||||||
|
by other means must be initialized using this macro before they
|
||||||
|
are used by a Try/Catch statement. It does no harm to initialize
|
||||||
|
a context more than once (by using this macro on a statically
|
||||||
|
allocated context, or using this macro twice on the same context),
|
||||||
|
but a context must not be re-initialized after it has been used by a
|
||||||
|
Try/Catch statement.
|
||||||
|
|
||||||
|
|
||||||
|
Try statement
|
||||||
|
Catch (expression) statement
|
||||||
|
|
||||||
|
The Try/Catch/Throw macros are capitalized in order to avoid
|
||||||
|
confusion with the C++ keywords, which have subtly different
|
||||||
|
semantics.
|
||||||
|
|
||||||
|
A Try/Catch statement has a syntax similar to an if/else statement,
|
||||||
|
except that the parenthesized expression goes after the second
|
||||||
|
keyword rather than the first. As with if/else, there are two
|
||||||
|
clauses, each of which may be a simple statement ending with a
|
||||||
|
semicolon or a brace-enclosed compound statement. But whereas
|
||||||
|
the else clause is optional, the Catch clause is required. The
|
||||||
|
expression must be a modifiable lvalue (something capable of being
|
||||||
|
assigned to) of the same type (disregarding type qualifiers) that
|
||||||
|
was passed to define_exception_type().
|
||||||
|
|
||||||
|
If a Throw that uses the same exception context as the Try/Catch is
|
||||||
|
executed within the Try clause (typically within a function called
|
||||||
|
by the Try clause), and the exception is not caught by a nested
|
||||||
|
Try/Catch statement, then a copy of the exception will be assigned
|
||||||
|
to the expression, and control will jump to the Catch clause. If no
|
||||||
|
such Throw is executed, then the assignment is not performed, and
|
||||||
|
the Catch clause is not executed.
|
||||||
|
|
||||||
|
The expression is not evaluated unless and until the exception is
|
||||||
|
caught, which is significant if it has side effects, for example:
|
||||||
|
|
||||||
|
Try foo();
|
||||||
|
Catch (p[++i].e) { ... }
|
||||||
|
|
||||||
|
IMPORTANT: Jumping into or out of a Try clause (for example via
|
||||||
|
return, break, continue, goto, longjmp) is forbidden--the compiler
|
||||||
|
will not complain, but bad things will happen at run-time. Jumping
|
||||||
|
into or out of a Catch clause is okay, and so is jumping around
|
||||||
|
inside a Try clause. In many cases where one is tempted to return
|
||||||
|
from a Try clause, it will suffice to use Throw, and then return
|
||||||
|
from the Catch clause. Another option is to set a flag variable and
|
||||||
|
use goto to jump to the end of the Try clause, then check the flag
|
||||||
|
after the Try/Catch statement.
|
||||||
|
|
||||||
|
IMPORTANT: The values of any non-volatile automatic variables
|
||||||
|
changed within the Try clause are undefined after an exception is
|
||||||
|
caught. Therefore, variables modified inside the Try block whose
|
||||||
|
values are needed later outside the Try block must either use static
|
||||||
|
storage or be declared with the "volatile" type qualifier.
|
||||||
|
|
||||||
|
|
||||||
|
Throw expression;
|
||||||
|
|
||||||
|
A Throw statement is very much like a return statement, except that
|
||||||
|
the expression is required. Whereas return jumps back to the place
|
||||||
|
where the current function was called, Throw jumps back to the Catch
|
||||||
|
clause of the innermost enclosing Try clause. The expression must
|
||||||
|
be compatible with the type passed to define_exception_type(). The
|
||||||
|
exception must be caught, otherwise the program may crash.
|
||||||
|
|
||||||
|
Slight limitation: If the expression is a comma-expression, it must
|
||||||
|
be enclosed in parentheses.
|
||||||
|
|
||||||
|
|
||||||
|
Try statement
|
||||||
|
Catch_anonymous statement
|
||||||
|
|
||||||
|
When the value of the exception is not needed, a Try/Catch statement
|
||||||
|
can use Catch_anonymous instead of Catch (expression).
|
||||||
|
|
||||||
|
|
||||||
|
Everything below this point is for the benefit of the compiler. The
|
||||||
|
application programmer should pretend not to know any of it, because it
|
||||||
|
is subject to change.
|
||||||
|
|
||||||
|
===*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef CEXCEPT_H
|
||||||
|
#define CEXCEPT_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <setjmp.h>
|
||||||
|
|
||||||
|
#define define_exception_type(etype) \
|
||||||
|
struct exception_context { \
|
||||||
|
jmp_buf *penv; \
|
||||||
|
int caught; \
|
||||||
|
volatile struct { etype etmp; } v; \
|
||||||
|
}
|
||||||
|
|
||||||
|
/* etmp must be volatile because the application might use automatic */
|
||||||
|
/* storage for the_exception_context, and etmp is modified between */
|
||||||
|
/* 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)->penv = 0))
|
||||||
|
|
||||||
|
#define Try \
|
||||||
|
{ \
|
||||||
|
jmp_buf *exception__prev, exception__env; \
|
||||||
|
exception__prev = the_exception_context->penv; \
|
||||||
|
the_exception_context->penv = &exception__env; \
|
||||||
|
if (setjmp(exception__env) == 0) { \
|
||||||
|
do
|
||||||
|
|
||||||
|
#define exception__catch(action) \
|
||||||
|
while (the_exception_context->caught = 0, \
|
||||||
|
the_exception_context->caught); \
|
||||||
|
} \
|
||||||
|
else { \
|
||||||
|
the_exception_context->caught = 1; \
|
||||||
|
} \
|
||||||
|
the_exception_context->penv = exception__prev; \
|
||||||
|
} \
|
||||||
|
if (!the_exception_context->caught || action) { } \
|
||||||
|
else
|
||||||
|
|
||||||
|
#define Catch(e) exception__catch(((e) = the_exception_context->v.etmp, 0))
|
||||||
|
#define Catch_anonymous exception__catch(0)
|
||||||
|
|
||||||
|
/* 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. */
|
||||||
|
/* */
|
||||||
|
/* The 0 in while(0) is expressed as x=0,x in order to appease */
|
||||||
|
/* compilers that warn about constant expressions inside while(). */
|
||||||
|
/* Most compilers should still recognize that the condition is always */
|
||||||
|
/* false and avoid generating code for it. */
|
||||||
|
|
||||||
|
#define Throw \
|
||||||
|
for (;; longjmp(*the_exception_context->penv, 1)) \
|
||||||
|
the_exception_context->v.etmp =
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* CEXCEPT_H */
|
||||||
23
contrib/visupng/resource.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Developer Studio generated include file.
|
||||||
|
// Used by VisualPng.rc
|
||||||
|
//
|
||||||
|
#define IDM_FILE_OPEN 40001
|
||||||
|
#define IDM_FILE_SAVE 40002
|
||||||
|
#define IDM_FILE_NEXT 40003
|
||||||
|
#define IDM_FILE_PREVIOUS 40004
|
||||||
|
#define IDM_FILE_EXIT 40005
|
||||||
|
#define IDM_OPTIONS_BACKGROUND 40006
|
||||||
|
#define IDM_OPTIONS_STRETCH 40007
|
||||||
|
#define IDM_HELP_ABOUT 40008
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 113
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 40009
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
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:
|
||||||