Compare commits
2400 Commits
SNAP_19971
...
AUTO_DENAT
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a9aea79e1 | ||
|
|
eddc47d1a1 | ||
|
|
0e5e03edb9 | ||
|
|
f3d23741bf | ||
|
|
06884f05ff | ||
|
|
de9fb93157 | ||
|
|
6ab2659931 | ||
|
|
160e3574ac | ||
|
|
e809560d6a | ||
|
|
a629fd7f84 | ||
|
|
117b2eca5c | ||
|
|
e8fa46be45 | ||
|
|
f9d3bbdaaf | ||
|
|
160809ca7b | ||
|
|
1af201e9bb | ||
|
|
e97e6e632e | ||
|
|
713b36cedb | ||
|
|
b128983b58 | ||
|
|
61c009c800 | ||
|
|
8891244084 | ||
|
|
bcc0607e69 | ||
|
|
dd60f7b998 | ||
|
|
d9c46655cc | ||
|
|
6654a22891 | ||
|
|
2444c80ff7 | ||
|
|
811cd0c124 | ||
|
|
92b4a139ba | ||
|
|
79d6346057 | ||
|
|
7ef740e03d | ||
|
|
1dcb67c8f3 | ||
|
|
bddd4ca943 | ||
|
|
797d345446 | ||
|
|
c8a2382b65 | ||
|
|
ab1deac87f | ||
|
|
d0f73034cf | ||
|
|
97f2c2b7bb | ||
|
|
9bf3a0be0c | ||
|
|
37cfb7d74b | ||
|
|
95a9052d56 | ||
|
|
ff99eb7cc1 | ||
|
|
ef03cb5287 | ||
|
|
196d48435e | ||
|
|
7e7c6edad8 | ||
|
|
1ac1bfb995 | ||
|
|
45cb0268b9 | ||
|
|
0f5251b51d | ||
|
|
c37dde738b | ||
|
|
a30c4b9e94 | ||
|
|
e57b1afa2b | ||
|
|
e489f9c26c | ||
|
|
e9f75f6bd8 | ||
|
|
51a0dc303d | ||
|
|
4caf4dc787 | ||
|
|
cacec65e9e | ||
|
|
50ab749f4b | ||
|
|
d201447174 | ||
|
|
08593d3007 | ||
|
|
3cfe378ad1 | ||
|
|
e63fd0e692 | ||
|
|
1cfa0f5a73 | ||
|
|
a3a4a60c34 | ||
|
|
4d48b106f0 | ||
|
|
7d39971922 | ||
|
|
bcfafb624a | ||
|
|
7a9ae74571 | ||
|
|
bb03ba3d31 | ||
|
|
016a451524 | ||
|
|
e91d0a6bf2 | ||
|
|
a74de76f94 | ||
|
|
706e553eb7 | ||
|
|
72ee1f0c50 | ||
|
|
bb8a563730 | ||
|
|
2f27c99f36 | ||
|
|
65ae04e137 | ||
|
|
997868b7e2 | ||
|
|
5d9b2ed63f | ||
|
|
cf51b4790e | ||
|
|
b3a94afdd1 | ||
|
|
f4e1d05613 | ||
|
|
2ecc032847 | ||
|
|
be1161a97b | ||
|
|
4f0f733060 | ||
|
|
ef80871e0a | ||
|
|
c3491b7497 | ||
|
|
1f48e45e54 | ||
|
|
7bfdf70ae1 | ||
|
|
b09b772727 | ||
|
|
eb03ba506a | ||
|
|
64f06bf079 | ||
|
|
d961146335 | ||
|
|
0bce8ff54b | ||
|
|
82abdad4db | ||
|
|
4be016b20b | ||
|
|
6aba663522 | ||
|
|
00b598d267 | ||
|
|
84c85a1a11 | ||
|
|
0e86d28026 | ||
|
|
4bd671a87b | ||
|
|
519ee0665d | ||
|
|
a0a1584106 | ||
|
|
65de04cdb8 | ||
|
|
bba95de158 | ||
|
|
8f48c4b3cd | ||
|
|
cc76a598ba | ||
|
|
33e963e7af | ||
|
|
2bb20aee8b | ||
|
|
273089af2a | ||
|
|
0a60e2963c | ||
|
|
ad41b4ff94 | ||
|
|
19fd09725a | ||
|
|
fe3cc85202 | ||
|
|
d475580348 | ||
|
|
6e3522ab2c | ||
|
|
605c562ffb | ||
|
|
68a6e7befb | ||
|
|
3cc0db6440 | ||
|
|
e4ce74f5b7 | ||
|
|
39e00cbdf2 | ||
|
|
8c510f2ecf | ||
|
|
5ea5e527cd | ||
|
|
0733eb725d | ||
|
|
7b93fcab55 | ||
|
|
d3a63c533a | ||
|
|
d4984ede33 | ||
|
|
cd5f174a7e | ||
|
|
8dae68fbb3 | ||
|
|
24c7df792f | ||
|
|
73fc0b0ecd | ||
|
|
48fbaf72b5 | ||
|
|
f66ae10389 | ||
|
|
6c33d4dcec | ||
|
|
715902025d | ||
|
|
7df755b181 | ||
|
|
4f5b014220 | ||
|
|
913cb7cd85 | ||
|
|
9c00803e19 | ||
|
|
d723183795 | ||
|
|
0b0ebee941 | ||
|
|
a44d2e2e2c | ||
|
|
757fc193c4 | ||
|
|
6b23587aef | ||
|
|
880f5ade6b | ||
|
|
c6f25c2de8 | ||
|
|
a70843bab2 | ||
|
|
e7b2454ce3 | ||
|
|
71223ba41b | ||
|
|
a56ec79881 | ||
|
|
4460746adc | ||
|
|
f2b649691a | ||
|
|
6817444e14 | ||
|
|
cd1870cc83 | ||
|
|
e506cf37cb | ||
|
|
8a02827e39 | ||
|
|
0f5c8e857c | ||
|
|
3f00a28b6c | ||
|
|
a03ac28c6e | ||
|
|
631f507f58 | ||
|
|
d8b35eab3e | ||
|
|
a3bf693cd4 | ||
|
|
16502247df | ||
|
|
e5c1456525 | ||
|
|
1586dd5703 | ||
|
|
72868800d7 | ||
|
|
d6f51967de | ||
|
|
25a8142429 | ||
|
|
21f0dff4cd | ||
|
|
e026570571 | ||
|
|
bfa345c338 | ||
|
|
1284c3fc42 | ||
|
|
3a1f89dcf5 | ||
|
|
4d37cd3eed | ||
|
|
f5b3df2956 | ||
|
|
4aae90b5b1 | ||
|
|
f0e6c2b1f3 | ||
|
|
72fc042792 | ||
|
|
119a9f33ca | ||
|
|
1f6e4e7336 | ||
|
|
b85d11b3b7 | ||
|
|
104c12d28e | ||
|
|
b990b30723 | ||
|
|
0b793d2cc8 | ||
|
|
2421aab193 | ||
|
|
43bbf78a29 | ||
|
|
c8df698460 | ||
|
|
68f5479eb0 | ||
|
|
1bfdff1dcb | ||
|
|
4cbca90747 | ||
|
|
33da844e70 | ||
|
|
14237d13e2 | ||
|
|
89e63f0595 | ||
|
|
143002cac5 | ||
|
|
0652653292 | ||
|
|
7944e647c6 | ||
|
|
09240118e1 | ||
|
|
7b4d53a529 | ||
|
|
8e06c4d7f4 | ||
|
|
b6524a84f5 | ||
|
|
c00a9a84ea | ||
|
|
36a27c6759 | ||
|
|
974e54fc9a | ||
|
|
eec6970fe2 | ||
|
|
3a330a3d6b | ||
|
|
705168dab0 | ||
|
|
3a202479a8 | ||
|
|
f3fcdb4e0e | ||
|
|
e4a2092603 | ||
|
|
ee3d137660 | ||
|
|
e4df9fa95b | ||
|
|
9599825ea9 | ||
|
|
28bcddaca2 | ||
|
|
af73e9d21b | ||
|
|
be83b5c9d3 | ||
|
|
638ebcee70 | ||
|
|
7ca8753ac5 | ||
|
|
aee96e5e1b | ||
|
|
7e52fb900e | ||
|
|
25ae5a77a2 | ||
|
|
cfb0266518 | ||
|
|
23b50343c6 | ||
|
|
827c4c6d21 | ||
|
|
19b42c342f | ||
|
|
16aa7c4316 | ||
|
|
d23b21018c | ||
|
|
d2bfbdb99e | ||
|
|
12474a79ae | ||
|
|
57d2bf74a6 | ||
|
|
95d923f661 | ||
|
|
5a63c9488d | ||
|
|
a3a4606eab | ||
|
|
b835084dfa | ||
|
|
84477de7fc | ||
|
|
78141c328f | ||
|
|
39bb0d649c | ||
|
|
87a2044934 | ||
|
|
c9a347c8e9 | ||
|
|
9495faccfc | ||
|
|
f9615262f2 | ||
|
|
a1a2b8f0eb | ||
|
|
6c57e51ac9 | ||
|
|
aa09cabb94 | ||
|
|
5de53804a1 | ||
|
|
665096fcdf | ||
|
|
43529d911c | ||
|
|
b5f414a1a5 | ||
|
|
5491cd971d | ||
|
|
e9b6bfcc01 | ||
|
|
cd02981bf2 | ||
|
|
ce83490d75 | ||
|
|
6ef7f093d4 | ||
|
|
e11f22b55e | ||
|
|
0ad4aa57d6 | ||
|
|
559a8c8691 | ||
|
|
66d02a986a | ||
|
|
8db40e177c | ||
|
|
9ab8dfc3e4 | ||
|
|
b71e53b222 | ||
|
|
155f3e05e2 | ||
|
|
01fcce4cf9 | ||
|
|
f527b8909f | ||
|
|
9d8da16ee9 | ||
|
|
76f716cec7 | ||
|
|
085a27d330 | ||
|
|
38abc0dee0 | ||
|
|
4107506f65 | ||
|
|
5d0e9b4a2e | ||
|
|
d0ed72ee14 | ||
|
|
567305020d | ||
|
|
e9cebcd36a | ||
|
|
6a3f4d81e9 | ||
|
|
d5015025ba | ||
|
|
e03c0632ad | ||
|
|
58e68f9683 | ||
|
|
7cdf9176e1 | ||
|
|
5ee4989714 | ||
|
|
5869210788 | ||
|
|
317e8b06ae | ||
|
|
677a78b56a | ||
|
|
0b0e66db4b | ||
|
|
87a9022b72 | ||
|
|
d0e4efb401 | ||
|
|
80ce14813b | ||
|
|
ba718c979c | ||
|
|
6e0687de46 | ||
|
|
a8ec2c3b9f | ||
|
|
3d5a2b1230 | ||
|
|
afed181c0a | ||
|
|
66bf26d42d | ||
|
|
5a3e3916f5 | ||
|
|
59ab307a62 | ||
|
|
1c1e3424c1 | ||
|
|
8e6f4fc803 | ||
|
|
1588285e3a | ||
|
|
07c656cdf1 | ||
|
|
53d5c49dbb | ||
|
|
587d91caad | ||
|
|
cacae33871 | ||
|
|
d611593ffd | ||
|
|
b953e64bc6 | ||
|
|
966ae7b613 | ||
|
|
9efff07116 | ||
|
|
0dcfd50a96 | ||
|
|
dc999ba470 | ||
|
|
97688fd28e | ||
|
|
bf146c95a1 | ||
|
|
8c361eed9c | ||
|
|
d39cbe9c2b | ||
|
|
69fb59dd3b | ||
|
|
5dcc2ddd51 | ||
|
|
c3b9b0f7f4 | ||
|
|
827b818ed1 | ||
|
|
00c5e83871 | ||
|
|
241f9c9dab | ||
|
|
896d8ff3ce | ||
|
|
f3a218acc0 | ||
|
|
4adda6ef1f | ||
|
|
bcad6d8598 | ||
|
|
bcf6c51c4c | ||
|
|
2a2a599120 | ||
|
|
a44d5aeaab | ||
|
|
fcdf947205 | ||
|
|
40dfa38a36 | ||
|
|
05505d6a1d | ||
|
|
a4a876d70e | ||
|
|
a3fd5f8d9a | ||
|
|
5749f310e4 | ||
|
|
ece5ac121a | ||
|
|
7e96137070 | ||
|
|
9a1c50c961 | ||
|
|
0a810f950f | ||
|
|
941167e6d8 | ||
|
|
5a8b538ee1 | ||
|
|
53ffebed19 | ||
|
|
0eb096334e | ||
|
|
3176b6b3ea | ||
|
|
be374ad560 | ||
|
|
9ee4ff5eee | ||
|
|
54f017171f | ||
|
|
2ec115ea80 | ||
|
|
5ebe49fdbd | ||
|
|
23b0f15ee8 | ||
|
|
1a0a5d0399 | ||
|
|
e8242a24eb | ||
|
|
95e048c863 | ||
|
|
929c608714 | ||
|
|
14cb9e710a | ||
|
|
a9c16bfabd | ||
|
|
3f4bad9332 | ||
|
|
eacb3ad51f | ||
|
|
2ff92119aa | ||
|
|
3589986260 | ||
|
|
bfd0c12798 | ||
|
|
e5dfd2f5da | ||
|
|
c84756cf38 | ||
|
|
cfc2866019 | ||
|
|
4c9ee0caa9 | ||
|
|
e35d4c6d65 | ||
|
|
5f0ea34beb | ||
|
|
143d11f435 | ||
|
|
c3c9c72281 | ||
|
|
5cf2775f46 | ||
|
|
5f3ae6ad67 | ||
|
|
a3551cc3d0 | ||
|
|
9de0d0c9c3 | ||
|
|
04823f40c4 | ||
|
|
b1c28ea656 | ||
|
|
d8ce1977dd | ||
|
|
7ef5dec32d | ||
|
|
46da5c2bec | ||
|
|
65c1e7458d | ||
|
|
74268afdeb | ||
|
|
3b9835b5bb | ||
|
|
556f481ce9 | ||
|
|
748c5c5f0c | ||
|
|
da95365f93 | ||
|
|
018d098240 | ||
|
|
b39839820b | ||
|
|
a4013d86fb | ||
|
|
2501ca70d6 | ||
|
|
b55008d197 | ||
|
|
5a4cc5a6b1 | ||
|
|
c512d3864c | ||
|
|
2453bc3cca | ||
|
|
e41dd6a199 | ||
|
|
4649192c7a | ||
|
|
bab6969765 | ||
|
|
e29e536d20 | ||
|
|
4f771b6d26 | ||
|
|
bdcba96639 | ||
|
|
ed48ad3344 | ||
|
|
d23e3848a9 | ||
|
|
069932c2a8 | ||
|
|
0e8115218e | ||
|
|
6dc73a6184 | ||
|
|
b31b2734be | ||
|
|
3b348f74e9 | ||
|
|
0fef3d2f6d | ||
|
|
a8d8872c0c | ||
|
|
91f7a92ecd | ||
|
|
f903bdf1a7 | ||
|
|
344e8000a2 | ||
|
|
9c2dea004f | ||
|
|
ef088b50ab | ||
|
|
4c84db87d9 | ||
|
|
c50941c82d | ||
|
|
b196167dbc | ||
|
|
637a466d5c | ||
|
|
74d88d870a | ||
|
|
41be586333 | ||
|
|
f73d6ee34a | ||
|
|
95b3f3e460 | ||
|
|
c3e01fe599 | ||
|
|
442712ba50 | ||
|
|
b11177d6b0 | ||
|
|
9df3375f61 | ||
|
|
6c13b03a45 | ||
|
|
372c4d2627 | ||
|
|
9e7433487b | ||
|
|
de1cf2ecba | ||
|
|
be9abde533 | ||
|
|
6822cce08d | ||
|
|
4a9a849acb | ||
|
|
033bb597de | ||
|
|
4850edb29b | ||
|
|
08f1c75cf1 | ||
|
|
66779b9b26 | ||
|
|
6fce115b98 | ||
|
|
04f5c2a1e7 | ||
|
|
ad8f893e60 | ||
|
|
fc3c4005c4 | ||
|
|
0d0ce95c9a | ||
|
|
50778c9ad5 | ||
|
|
6050aecef6 | ||
|
|
d79f54c4ec | ||
|
|
2b91a5b73f | ||
|
|
60d735cdf2 | ||
|
|
d5facc4cc6 | ||
|
|
fc3cd85675 | ||
|
|
411e9361c2 | ||
|
|
17cb4bb2e6 | ||
|
|
aafd722b21 | ||
|
|
6ebe59ced3 | ||
|
|
24976900cf | ||
|
|
6c8ca48237 | ||
|
|
75ca8715c7 | ||
|
|
cf451eb447 | ||
|
|
b52072a7f8 | ||
|
|
3c67e83bb5 | ||
|
|
f66547c880 | ||
|
|
29b00ba8e5 | ||
|
|
70372ba8bd | ||
|
|
f29407afe8 | ||
|
|
a45a5dedba | ||
|
|
f7a50c4dc2 | ||
|
|
0072dd5508 | ||
|
|
6b126f35b1 | ||
|
|
e809774014 | ||
|
|
91a5956707 | ||
|
|
0455fa3029 | ||
|
|
0139b4a3dc | ||
|
|
60fbf3800b | ||
|
|
fa53582fef | ||
|
|
49ca2615f8 | ||
|
|
ecef1e1f2f | ||
|
|
0775c02e08 | ||
|
|
e8f8e0d484 | ||
|
|
91cb3bb665 | ||
|
|
0899b4718b | ||
|
|
3d679818a0 | ||
|
|
61f0ede138 | ||
|
|
6af18860b6 | ||
|
|
51046a9fbf | ||
|
|
b0a2c890a7 | ||
|
|
8681f36261 | ||
|
|
28fbb33386 | ||
|
|
45a3396064 | ||
|
|
0a07d3ba1f | ||
|
|
1f20f4ddca | ||
|
|
accce610ae | ||
|
|
276ec82df5 | ||
|
|
8194b3483b | ||
|
|
e0fe931832 | ||
|
|
6423183a63 | ||
|
|
e9ed2c18a7 | ||
|
|
f12fbc1b32 | ||
|
|
96ba724fc5 | ||
|
|
1922a3ed01 | ||
|
|
bd943182b7 | ||
|
|
de2313faf3 | ||
|
|
38aa9a941b | ||
|
|
7d03e87069 | ||
|
|
9b462c6024 | ||
|
|
1d146b0d58 | ||
|
|
6992607bb0 | ||
|
|
e3c310e538 | ||
|
|
af663f9a3a | ||
|
|
967288262c | ||
|
|
06c4493ef6 | ||
|
|
834de2994e | ||
|
|
38f428304e | ||
|
|
7befe28245 | ||
|
|
451d40642c | ||
|
|
c38f5f88eb | ||
|
|
c9b2958b6c | ||
|
|
68f895bd68 | ||
|
|
b10feaf1e9 | ||
|
|
8c2c39529a | ||
|
|
359820b98c | ||
|
|
5363075ebd | ||
|
|
d5d599c229 | ||
|
|
f178fb5bb7 | ||
|
|
d38c27bda1 | ||
|
|
8d072a4f58 | ||
|
|
6cf7477093 | ||
|
|
feb9789e64 | ||
|
|
a0b1a437cc | ||
|
|
42311804a4 | ||
|
|
a83f00d89e | ||
|
|
8854db3c4f | ||
|
|
fee33a543d | ||
|
|
b385831d65 | ||
|
|
127bfb203e | ||
|
|
ab49789a33 | ||
|
|
29e22ec9bd | ||
|
|
59f1b1cb96 | ||
|
|
e002a729ca | ||
|
|
ecafc70e02 | ||
|
|
1882f67a30 | ||
|
|
b60ff5b695 | ||
|
|
a6afd23c5b | ||
|
|
64c648d866 | ||
|
|
92cff811a1 | ||
|
|
e89ffda44e | ||
|
|
5134c92df6 | ||
|
|
f43e47dddc | ||
|
|
eefbd04215 | ||
|
|
1d375ea289 | ||
|
|
7b8b856639 | ||
|
|
16d002d074 | ||
|
|
e060cbf62a | ||
|
|
76c28cbbad | ||
|
|
34c2f20968 | ||
|
|
1c73fc83a2 | ||
|
|
330dd2f7c3 | ||
|
|
45dc3bcf82 | ||
|
|
bf21aecc91 | ||
|
|
f30c006cbb | ||
|
|
a313506013 | ||
|
|
1c84483f3e | ||
|
|
eedec945df | ||
|
|
05c3a18b37 | ||
|
|
ff0ec3ac91 | ||
|
|
a76ae0cc9a | ||
|
|
c1ba0be318 | ||
|
|
e2d3078d3c | ||
|
|
b76c1c7bd2 | ||
|
|
9ccee8a3fc | ||
|
|
42e38e41f7 | ||
|
|
578d91f381 | ||
|
|
d05cf752dc | ||
|
|
ef68de7b87 | ||
|
|
4ca8d37b82 | ||
|
|
900944ab01 | ||
|
|
57afb2b588 | ||
|
|
0dfcb2d2be | ||
|
|
8125476783 | ||
|
|
32f6e0a4ce | ||
|
|
55a5d2144d | ||
|
|
65204240f9 | ||
|
|
733c5614e5 | ||
|
|
8de14d3353 | ||
|
|
993d986ee2 | ||
|
|
f03d0014a3 | ||
|
|
d2922401e5 | ||
|
|
f3e95348be | ||
|
|
0b4d29fd6e | ||
|
|
d142187b38 | ||
|
|
9f513b1840 | ||
|
|
95931e18aa | ||
|
|
2d49bbb044 | ||
|
|
f045ba415a | ||
|
|
db30076b0b | ||
|
|
8599979585 | ||
|
|
43ab625770 | ||
|
|
cb8adfba87 | ||
|
|
90d69893fd | ||
|
|
0a23dccde4 | ||
|
|
c65508d272 | ||
|
|
044fd2db47 | ||
|
|
a3c5d33f26 | ||
|
|
0d81100af3 | ||
|
|
b82992851f | ||
|
|
700891684e | ||
|
|
0c178e965c | ||
|
|
ac7b6805f4 | ||
|
|
91ed4f809f | ||
|
|
6cda2a2021 | ||
|
|
ee03faee2a | ||
|
|
fd1b869a35 | ||
|
|
17dd9e43dc | ||
|
|
9f3b82e178 | ||
|
|
ced58eb136 | ||
|
|
209f5d5cd4 | ||
|
|
e84df313c4 | ||
|
|
78bb15f61e | ||
|
|
81161cd723 | ||
|
|
996f8e931a | ||
|
|
2a4c97f3b3 | ||
|
|
473e31208e | ||
|
|
3a3a0ef97b | ||
|
|
cf7888fdaf | ||
|
|
c9cda15e70 | ||
|
|
b515672a1e | ||
|
|
b1135416f2 | ||
|
|
f9a27ad6fd | ||
|
|
da219872d8 | ||
|
|
6333998df4 | ||
|
|
59c4671866 | ||
|
|
3ae4d004ca | ||
|
|
c4fe78345e | ||
|
|
082c0c8975 | ||
|
|
279e878bdd | ||
|
|
26ffb00362 | ||
|
|
e3eedba2f9 | ||
|
|
148e766334 | ||
|
|
d5aed59bbc | ||
|
|
619ca57c5a | ||
|
|
16561707f8 | ||
|
|
039d738e3b | ||
|
|
f3f493abbb | ||
|
|
25cdbd3560 | ||
|
|
295e763b4d | ||
|
|
e8cfe9062f | ||
|
|
58e63f08ae | ||
|
|
b0558e089e | ||
|
|
32b008bf56 | ||
|
|
e0e893da8f | ||
|
|
af1efabafb | ||
|
|
03d9f983de | ||
|
|
b60c8a83d7 | ||
|
|
213c516091 | ||
|
|
63e669a75f | ||
|
|
432be67c9d | ||
|
|
cb54775dab | ||
|
|
666bb6e1bf | ||
|
|
b46aed94c3 | ||
|
|
db2f396bfc | ||
|
|
f15ea7024b | ||
|
|
89b9ff8b2b | ||
|
|
bf39d4cda9 | ||
|
|
fd2c0c5651 | ||
|
|
3a5883b7e4 | ||
|
|
0101a46dcd | ||
|
|
f1a61ecc75 | ||
|
|
0c9af82e97 | ||
|
|
063bad00a2 | ||
|
|
3d23ab250e | ||
|
|
1f85d83ef3 | ||
|
|
ed219818b1 | ||
|
|
6475974086 | ||
|
|
1183c0ea69 | ||
|
|
d8eb880d7d | ||
|
|
c9312d02a4 | ||
|
|
88c112cde8 | ||
|
|
d1bda8d562 | ||
|
|
84d9f5f9a1 | ||
|
|
c3a4205cfa | ||
|
|
72d5843898 | ||
|
|
782ad2e7d2 | ||
|
|
0bb249746f | ||
|
|
b43de0cbda | ||
|
|
e95b3635e8 | ||
|
|
f0d09615c1 | ||
|
|
b89e32d980 | ||
|
|
2277c72c41 | ||
|
|
6e13f7bd2b | ||
|
|
2b4a42497b | ||
|
|
18046d9000 | ||
|
|
39e2943650 | ||
|
|
c13e6db019 | ||
|
|
af30000afe | ||
|
|
eb437560d3 | ||
|
|
915f2c5e59 | ||
|
|
674b23e434 | ||
|
|
189ee72781 | ||
|
|
7a2363134e | ||
|
|
7db6313ab5 | ||
|
|
7f4ba91800 | ||
|
|
902de9d413 | ||
|
|
7e68d71fd2 | ||
|
|
22a54ddf81 | ||
|
|
a19e373baa | ||
|
|
fb00e9bbb8 | ||
|
|
49ff13e5e1 | ||
|
|
b3184736de | ||
|
|
377b72968d | ||
|
|
78ab1ea3fc | ||
|
|
a512f0b841 | ||
|
|
2e2d959bff | ||
|
|
6c3513fa24 | ||
|
|
7402d68c8f | ||
|
|
5ef056ea94 | ||
|
|
c39dffed55 | ||
|
|
e735ac6c86 | ||
|
|
1cf5a13b08 | ||
|
|
a2dafdfc88 | ||
|
|
a700058737 | ||
|
|
b36903b1b6 | ||
|
|
f9807a643c | ||
|
|
bb16a5d331 | ||
|
|
5e836af884 | ||
|
|
a29d25821e | ||
|
|
99b9ce9de6 | ||
|
|
b2c8fed880 | ||
|
|
a472efda2d | ||
|
|
d541b30482 | ||
|
|
77e99440df | ||
|
|
4998934dcb | ||
|
|
9e5e63f0a1 | ||
|
|
7934cf9aea | ||
|
|
607949ed5e | ||
|
|
342e557c58 | ||
|
|
1472462639 | ||
|
|
90c7ea0b91 | ||
|
|
8e979f59b4 | ||
|
|
84c1a71045 | ||
|
|
df403d5908 | ||
|
|
65dd58ffa3 | ||
|
|
d355451c51 | ||
|
|
08f1e8098f | ||
|
|
7d5e1b0ccf | ||
|
|
4b8095d525 | ||
|
|
8ac2b1dda6 | ||
|
|
a1cc053be2 | ||
|
|
42ffb3727e | ||
|
|
79fbe48242 | ||
|
|
6a690c6d3f | ||
|
|
0e9b9e32db | ||
|
|
f37d395c4f | ||
|
|
ad987142c1 | ||
|
|
060c32e4e0 | ||
|
|
cb4bf0657c | ||
|
|
ba58aa201d | ||
|
|
cb2eb293e6 | ||
|
|
a0fa647a64 | ||
|
|
6878910ad4 | ||
|
|
d1d9c5bf04 | ||
|
|
a46ac625c9 | ||
|
|
7cef937760 | ||
|
|
fea53a95f8 | ||
|
|
8dc58cb2d3 | ||
|
|
e7b04a53ac | ||
|
|
a646da3f1e | ||
|
|
1a58d9b3cf | ||
|
|
21993dcb10 | ||
|
|
6e3e247b9a | ||
|
|
df21a7064f | ||
|
|
255005f0e9 | ||
|
|
5ce6bea660 | ||
|
|
6205bbbf65 | ||
|
|
0543c806f9 | ||
|
|
17127d2c6d | ||
|
|
abb7ed1cea | ||
|
|
28df7201ca | ||
|
|
03f25c7ade | ||
|
|
4ee10fdefa | ||
|
|
7709c1d12d | ||
|
|
e260fd6a2b | ||
|
|
deb20a3cd0 | ||
|
|
60c57e3e37 | ||
|
|
4551382631 | ||
|
|
d225ffbc5b | ||
|
|
fae75219e6 | ||
|
|
c9a2b79176 | ||
|
|
e65030aaed | ||
|
|
1adaa231c8 | ||
|
|
2aca4b0a80 | ||
|
|
5af447fa07 | ||
|
|
377579c2ef | ||
|
|
01457a0230 | ||
|
|
7e3af7c078 | ||
|
|
529bd529ef | ||
|
|
3aba370dad | ||
|
|
65ef495712 | ||
|
|
9c5dfcd3ae | ||
|
|
2daaea2f98 | ||
|
|
ad4983713f | ||
|
|
0e46fffa45 | ||
|
|
df4598d582 | ||
|
|
1eb7f7367d | ||
|
|
5c7acbbf42 | ||
|
|
b35b174773 | ||
|
|
251e586236 | ||
|
|
87620764ae | ||
|
|
2e99e7713d | ||
|
|
3bba843968 | ||
|
|
eb7c4e4589 | ||
|
|
40f9670464 | ||
|
|
467e0fcb24 | ||
|
|
c8ae0b92ca | ||
|
|
52a441445c | ||
|
|
aca733c310 | ||
|
|
07cc384be1 | ||
|
|
55b365d76d | ||
|
|
de7ffb4a1c | ||
|
|
38e44202bd | ||
|
|
6790905309 | ||
|
|
9da0be6730 | ||
|
|
fa75646110 | ||
|
|
24f6d8b887 | ||
|
|
5a86cbd116 | ||
|
|
bef538cc7e | ||
|
|
9619e45aa7 | ||
|
|
d7bd87f2ea | ||
|
|
8b0955954c | ||
|
|
d2e69a89d4 | ||
|
|
0b84fc2742 | ||
|
|
983335243b | ||
|
|
e3ee9e9d7d | ||
|
|
f3af00f450 | ||
|
|
b6714d9ad1 | ||
|
|
05e714d6d1 | ||
|
|
bcbe6f4885 | ||
|
|
a24e14ceb4 | ||
|
|
3bd19e15ea | ||
|
|
71adaddfa7 | ||
|
|
a40fd787da | ||
|
|
a646c4b4d0 | ||
|
|
95843529d1 | ||
|
|
b56693d114 | ||
|
|
41604dd844 | ||
|
|
bedab705f2 | ||
|
|
f28c909c58 | ||
|
|
216d83587f | ||
|
|
234d762ec3 | ||
|
|
52601eae08 | ||
|
|
0a411980ef | ||
|
|
5126b13c0a | ||
|
|
1fd7a6e491 | ||
|
|
ce87813af6 | ||
|
|
f876ca2681 | ||
|
|
f0723b00a9 | ||
|
|
249f6c5326 | ||
|
|
c20ce75179 | ||
|
|
37acae8845 | ||
|
|
73c4ee3a6c | ||
|
|
e573567b99 | ||
|
|
d6890b721d | ||
|
|
a6da2cf948 | ||
|
|
7433badf8e | ||
|
|
385108e0de | ||
|
|
d9f5d8f255 | ||
|
|
afd57f842d | ||
|
|
f2091ab7be | ||
|
|
c44d39c06e | ||
|
|
7e855cfc45 | ||
|
|
a078311369 | ||
|
|
fc07d22a53 | ||
|
|
553fa4309e | ||
|
|
9775547b4a | ||
|
|
d01381e1cb | ||
|
|
b596355d0a | ||
|
|
c6cf882eee | ||
|
|
fb833c477b | ||
|
|
08b22ddebf | ||
|
|
1f8fd8871b | ||
|
|
7f0156c2ea | ||
|
|
b45236cee8 | ||
|
|
df7d275d17 | ||
|
|
af2c3bd16f | ||
|
|
cbf5479263 | ||
|
|
5070b178e9 | ||
|
|
651e2f744f | ||
|
|
5225ae6105 | ||
|
|
8fc5066a69 | ||
|
|
ee173b486f | ||
|
|
2231b92bbb | ||
|
|
690fa02b0a | ||
|
|
1163b431b5 | ||
|
|
6704cf6e1a | ||
|
|
8592d1c309 | ||
|
|
21ea00bef0 | ||
|
|
6f50500410 | ||
|
|
c795ded090 | ||
|
|
1a6d6e0647 | ||
|
|
d2dc06dae1 | ||
|
|
11339ec5b3 | ||
|
|
1bde7a5599 | ||
|
|
55ce42dad1 | ||
|
|
eba4c9a85e | ||
|
|
06449bebe1 | ||
|
|
2fa220504c | ||
|
|
a9575223a6 | ||
|
|
b0ecac9fa1 | ||
|
|
47a65b7327 | ||
|
|
b729f6e30a | ||
|
|
2d0bb66479 | ||
|
|
45cdd91a8c | ||
|
|
b4ba8e3b5d | ||
|
|
c1726375b1 | ||
|
|
fcfe7370d8 | ||
|
|
0dcdac5828 | ||
|
|
7f01a3d324 | ||
|
|
62347c40d9 | ||
|
|
017dfc9e4e | ||
|
|
2c9c7efb23 | ||
|
|
0fcd82d16a | ||
|
|
7d7b43c244 | ||
|
|
8968861d79 | ||
|
|
8a202e6f5b | ||
|
|
1566d98867 | ||
|
|
96501b3481 | ||
|
|
a8e00e2169 | ||
|
|
3f1ffdacbb | ||
|
|
cc7eba32a2 | ||
|
|
7b105fea0a | ||
|
|
d56a55a484 | ||
|
|
dabb02d282 | ||
|
|
a3c1e86ffa | ||
|
|
7eec796cbd | ||
|
|
cceabe57ba | ||
|
|
1bf27c357d | ||
|
|
9a9f4591a4 | ||
|
|
a2fc714adb | ||
|
|
a0c84d6818 | ||
|
|
58475f05a5 | ||
|
|
30b9a28779 | ||
|
|
931b25f230 | ||
|
|
d1edd7e40c | ||
|
|
698a11c606 | ||
|
|
c46265c82c | ||
|
|
c242e9e36c | ||
|
|
7facb75c85 | ||
|
|
edc1476865 | ||
|
|
7ea8bb92a6 | ||
|
|
3441c3f2c4 | ||
|
|
113448e030 | ||
|
|
6d6d3a59b8 | ||
|
|
07f0382368 | ||
|
|
823b4d43a1 | ||
|
|
11a8051179 | ||
|
|
84b2d43d95 | ||
|
|
353a7158ed | ||
|
|
6af277b502 | ||
|
|
939c818395 | ||
|
|
ba17081caa | ||
|
|
3821880398 | ||
|
|
600ef4e7d1 | ||
|
|
6413a421f1 | ||
|
|
d3483d010e | ||
|
|
dfa88ef9c7 | ||
|
|
adc2698da1 | ||
|
|
a309b7dd12 | ||
|
|
207757e70d | ||
|
|
af84227184 | ||
|
|
6421c96ccc | ||
|
|
9806d64e40 | ||
|
|
847aed3652 | ||
|
|
f6c5b74fb7 | ||
|
|
d6acd1ecd3 | ||
|
|
287b0ce008 | ||
|
|
583b0b53e8 | ||
|
|
73edf2ce77 | ||
|
|
d1045b6876 | ||
|
|
139e3cd47d | ||
|
|
337bdee253 | ||
|
|
621beb8aaf | ||
|
|
fd7bdf03e0 | ||
|
|
d2a3858b4b | ||
|
|
f314322885 | ||
|
|
33447a3856 | ||
|
|
031aa464c6 | ||
|
|
3f7c856606 | ||
|
|
8abed09aea | ||
|
|
5c42d2f6d6 | ||
|
|
f5c4b3740c | ||
|
|
f76880f205 | ||
|
|
646d68e4bd | ||
|
|
46afb008db | ||
|
|
1ec6733573 | ||
|
|
7cc3040412 | ||
|
|
8285f4fc6f | ||
|
|
0d15bc6687 | ||
|
|
4ebc61c067 | ||
|
|
7078402341 | ||
|
|
6047ed3ebd | ||
|
|
471afbe62b | ||
|
|
060978e069 | ||
|
|
58ca2448eb | ||
|
|
0c36e30836 | ||
|
|
2c0fc39e62 | ||
|
|
140c26afbc | ||
|
|
c7850eccde | ||
|
|
f755abd275 | ||
|
|
60e5a21022 | ||
|
|
6edbb34d54 | ||
|
|
238ede333f | ||
|
|
67d445eebc | ||
|
|
33347533ec | ||
|
|
58af2b56bf | ||
|
|
36d80dc374 | ||
|
|
f26c189e5b | ||
|
|
4ab10dc891 | ||
|
|
c7ac3835fa | ||
|
|
ce073aac7d | ||
|
|
9cb5eb75f8 | ||
|
|
a425e6b5c2 | ||
|
|
1bb0d4c0f3 | ||
|
|
5efb9be963 | ||
|
|
b0fd18c7bf | ||
|
|
91d99f8903 | ||
|
|
5a5fb5635f | ||
|
|
ee1d43929c | ||
|
|
42faec1736 | ||
|
|
47b3584d36 | ||
|
|
72bd1c5859 | ||
|
|
8e2b7688fd | ||
|
|
3e90b96b08 | ||
|
|
6c0458c428 | ||
|
|
b9017e53a2 | ||
|
|
72149265a3 | ||
|
|
f46ffebbc8 | ||
|
|
97fd98099c | ||
|
|
10a2d8be70 | ||
|
|
988f43bfa0 | ||
|
|
98e22a43ab | ||
|
|
12f7825907 | ||
|
|
d88375e9c3 | ||
|
|
06d68566df | ||
|
|
b1ab800825 | ||
|
|
27a8669d0d | ||
|
|
14f08e6a93 | ||
|
|
45c02db925 | ||
|
|
7351327089 | ||
|
|
3725bc3ad9 | ||
|
|
8715d1c1b3 | ||
|
|
fb6a7ccb92 | ||
|
|
9c3e01cf3a | ||
|
|
a85038d0ec | ||
|
|
d8bbe62f8e | ||
|
|
6343181e2b | ||
|
|
e2f7831640 | ||
|
|
9b26da82ca | ||
|
|
cb4a61eaa3 | ||
|
|
3e1dcab4c0 | ||
|
|
bb0ec69706 | ||
|
|
e94a7b1a7a | ||
|
|
7e44eced8c | ||
|
|
d8ab8e0e7d | ||
|
|
3ae1549289 | ||
|
|
3196b43aa2 | ||
|
|
3552f4bbf8 | ||
|
|
a0ca2a7b0d | ||
|
|
8b621ad059 | ||
|
|
d1e07dbee8 | ||
|
|
b214f7e59e | ||
|
|
f164436f86 | ||
|
|
d5f4e60c56 | ||
|
|
6ef274c0ed | ||
|
|
3c07b7ebbd | ||
|
|
a77c4da512 | ||
|
|
cf1d80fd80 | ||
|
|
9d874ec20a | ||
|
|
75fff482b9 | ||
|
|
b0f8915fe7 | ||
|
|
e2a5219220 | ||
|
|
3c0df19a58 | ||
|
|
00fbbe68b0 | ||
|
|
6a227eec1c | ||
|
|
08ebf9dbe9 | ||
|
|
268dd6deb7 | ||
|
|
b9a51f3530 | ||
|
|
5492003cff | ||
|
|
f2fe3fe221 | ||
|
|
704266d646 | ||
|
|
4848d691e0 | ||
|
|
52f5eeab68 | ||
|
|
fd8a1c93a9 | ||
|
|
e655e59bc7 | ||
|
|
4dce69399a | ||
|
|
0d214799be | ||
|
|
b89fb9835c | ||
|
|
6d5faa20c4 | ||
|
|
18ce1ade26 | ||
|
|
87b6664073 | ||
|
|
3785528ef8 | ||
|
|
acfab255cc | ||
|
|
4b2885b5d3 | ||
|
|
7a564681b1 | ||
|
|
4e0feda1bd | ||
|
|
a31d35650b | ||
|
|
a558d2dfef | ||
|
|
0aae38d765 | ||
|
|
40428da32c | ||
|
|
5f53c26527 | ||
|
|
e812996962 | ||
|
|
75f85f940e | ||
|
|
e45890a616 | ||
|
|
b443f453ed | ||
|
|
9b00b1a2ed | ||
|
|
65a9d5b2f9 | ||
|
|
d5129fbb3a | ||
|
|
58d21d03f6 | ||
|
|
f7bcb45607 | ||
|
|
7dbb5755a4 | ||
|
|
eff33964d7 | ||
|
|
0849664209 | ||
|
|
b6b7941b0d | ||
|
|
128cb63dcc | ||
|
|
3e4c74d7ef | ||
|
|
357c50b14e | ||
|
|
922d7fd0ae | ||
|
|
3f7c96b352 | ||
|
|
3a5447574b | ||
|
|
28cd4d6102 | ||
|
|
3322a264e0 | ||
|
|
a2951281f3 | ||
|
|
c3a163b021 | ||
|
|
ecb9ebbce3 | ||
|
|
6b15c2ca82 | ||
|
|
edebc6cf21 | ||
|
|
16786ffbf7 | ||
|
|
89a9da8a21 | ||
|
|
a9c05acd70 | ||
|
|
c62ab96bcc | ||
|
|
879683b674 | ||
|
|
bbe7d97e00 | ||
|
|
b89ed0c35f | ||
|
|
fa5c68f7c6 | ||
|
|
3261e656e5 | ||
|
|
31045ef4f2 | ||
|
|
fbe8f91806 | ||
|
|
d0b7b3f5c9 | ||
|
|
c961dd184b | ||
|
|
416b69a2c1 | ||
|
|
e1aba58de1 | ||
|
|
2e8d1aaa79 | ||
|
|
f6db9670d1 | ||
|
|
8d3a895773 | ||
|
|
dcc8bc33db | ||
|
|
4721a7dd40 | ||
|
|
c1381c8cea | ||
|
|
b9a26457b9 | ||
|
|
beb6af329e | ||
|
|
240a22f4ed | ||
|
|
104e5d2cc6 | ||
|
|
fd69dc379a | ||
|
|
b03172656c | ||
|
|
cc4aa3cd47 | ||
|
|
1fe70a7a0d | ||
|
|
49aa89e261 | ||
|
|
dc9d35402a | ||
|
|
483bec40cc | ||
|
|
eb0fec7865 | ||
|
|
44557367ed | ||
|
|
dfcde48090 | ||
|
|
486362db9f | ||
|
|
ee1b96185f | ||
|
|
0b54ffa9d6 | ||
|
|
bf69ab9d68 | ||
|
|
eacc9f5d05 | ||
|
|
a2524578cd | ||
|
|
c2f99dd168 | ||
|
|
fb00a59c2f | ||
|
|
cb7c4d6c7f | ||
|
|
6d13f0f9b3 | ||
|
|
683cb5753e | ||
|
|
c8fbf3b01e | ||
|
|
e33741aed6 | ||
|
|
f830dc3f36 | ||
|
|
e096fc9752 | ||
|
|
f6d4cb9b99 | ||
|
|
51021f88c5 | ||
|
|
78dbc1efdb | ||
|
|
0f0d9509c0 | ||
|
|
ebe76c752c | ||
|
|
75bda50723 | ||
|
|
698c89e5c4 | ||
|
|
af9c5dede4 | ||
|
|
0e2758ae42 | ||
|
|
7dbe380691 | ||
|
|
1fe35dda56 | ||
|
|
4bb5d92a02 | ||
|
|
10dcedad06 | ||
|
|
f2322ebeb4 | ||
|
|
1dafcb2a24 | ||
|
|
155da3a8c5 | ||
|
|
1cbad0a4fc | ||
|
|
caf8ebc6f1 | ||
|
|
b93d689290 | ||
|
|
02a871bc31 | ||
|
|
db10ace6c8 | ||
|
|
6cfad41c09 | ||
|
|
6ccb4844c9 | ||
|
|
17a24b0ca3 | ||
|
|
04f593c9fb | ||
|
|
41e007894c | ||
|
|
97c37421a6 | ||
|
|
5682c4abb6 | ||
|
|
cb6b2054ab | ||
|
|
0363711f77 | ||
|
|
bf7eeebb3a | ||
|
|
2c099e45e3 | ||
|
|
9c891d4417 | ||
|
|
0c27e75cbe | ||
|
|
02a024df2f | ||
|
|
7aac253dcc | ||
|
|
a7b3b116a9 | ||
|
|
29d8fe021b | ||
|
|
f616dc9a9a | ||
|
|
bd088fe083 | ||
|
|
94ed72d3e6 | ||
|
|
c312fe1c8d | ||
|
|
2fde6f677e | ||
|
|
568b42bd52 | ||
|
|
cad57a6686 | ||
|
|
e946fcf69d | ||
|
|
f1a524a21e | ||
|
|
38db8d1951 | ||
|
|
49dfa78e74 | ||
|
|
1575a19c59 | ||
|
|
7f2909bbab | ||
|
|
fdc36ada3f | ||
|
|
265a137efc | ||
|
|
17d141c8e5 | ||
|
|
47215ba403 | ||
|
|
690a18f032 | ||
|
|
d2716f8bfd | ||
|
|
477f14037c | ||
|
|
42cabcf5fb | ||
|
|
dceb6a11c8 | ||
|
|
fe63fe5da9 | ||
|
|
2b7f8016b5 | ||
|
|
7b9b0ab0fa | ||
|
|
31de6ff4e0 | ||
|
|
a4a3c87b3d | ||
|
|
db85d915e7 | ||
|
|
736bdbeaeb | ||
|
|
0e563e0064 | ||
|
|
0dece0ba4f | ||
|
|
814bfe1305 | ||
|
|
eff77f116b | ||
|
|
87f9cc2162 | ||
|
|
e8e7692534 | ||
|
|
7a235648ea | ||
|
|
0346147a0e | ||
|
|
4af7480f8f | ||
|
|
5d270c2f45 | ||
|
|
ca7082a04a | ||
|
|
b46f089b6f | ||
|
|
f6abe64479 | ||
|
|
20661babbf | ||
|
|
1f3c079761 | ||
|
|
d7cf38387c | ||
|
|
c86201e87e | ||
|
|
279d363ab2 | ||
|
|
7d4023e88e | ||
|
|
e2269c4f03 | ||
|
|
9648fd88b8 | ||
|
|
4ed3aa1cb8 | ||
|
|
355fbf04b8 | ||
|
|
7f39f122d2 | ||
|
|
96457c0af4 | ||
|
|
0b49ebc6f2 | ||
|
|
b08cdd5c00 | ||
|
|
62c2373866 | ||
|
|
5baacee740 | ||
|
|
ae6489b868 | ||
|
|
bebf5b23fd | ||
|
|
334ad44555 | ||
|
|
bdd1baec35 | ||
|
|
075c96bc26 | ||
|
|
7f400fd777 | ||
|
|
8e0cab7cba | ||
|
|
981607d4a0 | ||
|
|
cd14b33a8a | ||
|
|
99fee10fe1 | ||
|
|
c9122881c8 | ||
|
|
0bff0b31cb | ||
|
|
78280d9de0 | ||
|
|
2109f32cfa | ||
|
|
90eca42b09 | ||
|
|
2fe4312b12 | ||
|
|
9aac2c5a1f | ||
|
|
884770db85 | ||
|
|
0caf9d85a5 | ||
|
|
853ec8ef22 | ||
|
|
2be1b69313 | ||
|
|
59f64fa998 | ||
|
|
a77eacb2a1 | ||
|
|
601f4ecdb4 | ||
|
|
a46bb12afe | ||
|
|
54467af1c1 | ||
|
|
6b678e59fd | ||
|
|
e924208067 | ||
|
|
4cb1634b8c | ||
|
|
a63c1000a8 | ||
|
|
ee791f46b4 | ||
|
|
e08f874a51 | ||
|
|
0cb81deacc | ||
|
|
71828f4669 | ||
|
|
c808e8ee75 | ||
|
|
41035ec767 | ||
|
|
a8eac0c33e | ||
|
|
c79aed0e05 | ||
|
|
13da0b3878 | ||
|
|
8ef268f205 | ||
|
|
23fbaaadb0 | ||
|
|
fce02ea0be | ||
|
|
2abc008e51 | ||
|
|
d6aa14f9ac | ||
|
|
2e8dae28fd | ||
|
|
19cc4bc416 | ||
|
|
708e45dd43 | ||
|
|
965e34a43c | ||
|
|
874b1d06e7 | ||
|
|
a698395064 | ||
|
|
e53b16ed74 | ||
|
|
fe7211b9c2 | ||
|
|
3184f21f0a | ||
|
|
d86059ea5a | ||
|
|
c355f84a19 | ||
|
|
25884cfbf5 | ||
|
|
123d1f2673 | ||
|
|
c493091772 | ||
|
|
b7afebffed | ||
|
|
2a98c4a504 | ||
|
|
123709106e | ||
|
|
c8df83a2fe | ||
|
|
e48d4e7159 | ||
|
|
e3b8e18524 | ||
|
|
c4b3014e09 | ||
|
|
ed3c12aa5f | ||
|
|
f7a5303612 | ||
|
|
790a6ae5b2 | ||
|
|
fb8cd9520f | ||
|
|
f8a40e214a | ||
|
|
08d246be89 | ||
|
|
2a1cd0c42e | ||
|
|
fba2b02b10 | ||
|
|
c3c5e72151 | ||
|
|
d597937560 | ||
|
|
7ba4ba0d2f | ||
|
|
8ad52d1024 | ||
|
|
cf7b958af5 | ||
|
|
1616d67d81 | ||
|
|
c312e81604 | ||
|
|
bd745719cf | ||
|
|
e884fc143d | ||
|
|
0e6bf066c6 | ||
|
|
0d1978edbf | ||
|
|
ddabef3c49 | ||
|
|
dcc96c09bd | ||
|
|
032196b9dd | ||
|
|
f6665c9c0a | ||
|
|
e6f7751958 | ||
|
|
93ab7875e4 | ||
|
|
b7ab832906 | ||
|
|
b5658eeaef | ||
|
|
cc7f7a2eb5 | ||
|
|
103739f248 | ||
|
|
3f314b2cd8 | ||
|
|
fe480d99b4 | ||
|
|
965d225c9a | ||
|
|
82765cc166 | ||
|
|
7329d5cb8c | ||
|
|
44097af086 | ||
|
|
527bf45430 | ||
|
|
5f6e095722 | ||
|
|
919c335569 | ||
|
|
2720bec633 | ||
|
|
13ce27bfef | ||
|
|
d1812f696e | ||
|
|
03def75b3f | ||
|
|
63ff245b44 | ||
|
|
5622a388fa | ||
|
|
23aec8934e | ||
|
|
d0ccf396e7 | ||
|
|
4ed4f66911 | ||
|
|
e2aace2ade | ||
|
|
5fa74836b8 | ||
|
|
24de292011 | ||
|
|
9cf57615e6 | ||
|
|
8857d094a8 | ||
|
|
43916bf90f | ||
|
|
551b25196f | ||
|
|
0d45a265fa | ||
|
|
d0b6c5e10f | ||
|
|
a9912f2e78 | ||
|
|
cfd59821e7 | ||
|
|
e93751bbbd | ||
|
|
7b5763fdd0 | ||
|
|
0e7cab347a | ||
|
|
8ad3303188 | ||
|
|
7b07769355 | ||
|
|
dc69fc120d | ||
|
|
71c52a71f4 | ||
|
|
49fdaf4fff | ||
|
|
8864534892 | ||
|
|
718259dcc2 | ||
|
|
31055c2981 | ||
|
|
f111f4b58e | ||
|
|
fc7c7f466f | ||
|
|
656061cb2b | ||
|
|
a7f95d982f | ||
|
|
7170996088 | ||
|
|
fb430a8dc5 | ||
|
|
65044acefd | ||
|
|
72415bc1a7 | ||
|
|
3f8175bb20 | ||
|
|
5c86382961 | ||
|
|
165fab7605 | ||
|
|
f970ecf821 | ||
|
|
7b1a4b5eb5 | ||
|
|
8c56db61e3 | ||
|
|
3ea4f70fa6 | ||
|
|
aa1bf58196 | ||
|
|
59a36172d8 | ||
|
|
b4c814e272 | ||
|
|
8cf49d7c10 | ||
|
|
5f8748c53e | ||
|
|
d154bfafd9 | ||
|
|
4667d36ccd | ||
|
|
e53fd25b04 | ||
|
|
dbfe3d3967 | ||
|
|
7c30f2a15f | ||
|
|
cebb7bfc9f | ||
|
|
bfa2ec274b | ||
|
|
c1c8caa28c | ||
|
|
b43c45571d | ||
|
|
c25b3aad1e | ||
|
|
15201b48c9 | ||
|
|
c0ce3a6107 | ||
|
|
656eaa93bf | ||
|
|
2bc6d4548f | ||
|
|
ca7b223bf0 | ||
|
|
ca17982ed2 | ||
|
|
699dcbab17 | ||
|
|
5886cc2cdf | ||
|
|
81517a6d4c | ||
|
|
5e3acecc12 | ||
|
|
8f733319d1 | ||
|
|
af24aef782 | ||
|
|
8b9b7b9d04 | ||
|
|
b665608816 | ||
|
|
23124810d1 | ||
|
|
a3c7dca8cf | ||
|
|
7702d2f8fc | ||
|
|
a91be9352f | ||
|
|
da355feec6 | ||
|
|
f38374c160 | ||
|
|
8792bbbd28 | ||
|
|
34b7b5d74e | ||
|
|
ab7cb5019e | ||
|
|
5edb04999c | ||
|
|
ab3f4a1607 | ||
|
|
55b5e035fc | ||
|
|
002d37e6e3 | ||
|
|
524be636e9 | ||
|
|
26dcaeaf56 | ||
|
|
347efc33b8 | ||
|
|
9b4d90465e | ||
|
|
88fba9f845 | ||
|
|
da0930717e | ||
|
|
90408c4641 | ||
|
|
c2eb7c28fe | ||
|
|
24ca48fe78 | ||
|
|
5d37ea836c | ||
|
|
9b5ef39404 | ||
|
|
ca98134099 | ||
|
|
fc5df6bb7f | ||
|
|
188ea9b487 | ||
|
|
9dc1fd02b3 | ||
|
|
6a5a84b317 | ||
|
|
6d10b256ef | ||
|
|
8433a5afe5 | ||
|
|
65f993b4ac | ||
|
|
0f3a3909d1 | ||
|
|
d2cb5285d5 | ||
|
|
2e8e686cae | ||
|
|
09de6fb1d4 | ||
|
|
ddefd9c9f5 | ||
|
|
79e1b1ab6f | ||
|
|
1018412555 | ||
|
|
b483ca4b97 | ||
|
|
80b0b3ea05 | ||
|
|
bf44f089cd | ||
|
|
1d82cc2f2e | ||
|
|
dedcbc9918 | ||
|
|
09423315a1 | ||
|
|
e63d08e43f | ||
|
|
e07f8bfc6f | ||
|
|
4b7bbd4434 | ||
|
|
28c7089077 | ||
|
|
f93afa9c75 | ||
|
|
37460b2078 | ||
|
|
713cecba4c | ||
|
|
e5e47e6879 | ||
|
|
faa1434735 | ||
|
|
11f5588755 | ||
|
|
9860caa539 | ||
|
|
14bd8cf9e5 | ||
|
|
dbce6083ef | ||
|
|
00362c03f7 | ||
|
|
4c7408d9ea | ||
|
|
eab38fa264 | ||
|
|
494e401a15 | ||
|
|
1b5a1e1acb | ||
|
|
e14c6c1d87 | ||
|
|
fdaecac622 | ||
|
|
1ae617e324 | ||
|
|
5c68ecbc0f | ||
|
|
5c5a45f9b0 | ||
|
|
3c90c2cd53 | ||
|
|
913831b26f | ||
|
|
25bd56b995 | ||
|
|
f83d57e91b | ||
|
|
85adae970a | ||
|
|
7cb2ce4d11 | ||
|
|
7d0331a679 | ||
|
|
7bb4d7d961 | ||
|
|
ed1e531c36 | ||
|
|
b7f7f3d98d | ||
|
|
673c79d7d1 | ||
|
|
742d01908f | ||
|
|
d36df18dee | ||
|
|
406fd3362c | ||
|
|
2ee01439f0 | ||
|
|
4079c878ca | ||
|
|
48a9f44f31 | ||
|
|
e144ff2bb5 | ||
|
|
f57e0ba8b1 | ||
|
|
c390a6ec47 | ||
|
|
b8368a54a2 | ||
|
|
208057b914 | ||
|
|
e17f31db8f | ||
|
|
2e5dda7c62 | ||
|
|
b39687aac8 | ||
|
|
92270f8620 | ||
|
|
1dc1b050b2 | ||
|
|
cab220ee8b | ||
|
|
d0ff2dbc79 | ||
|
|
dbcf64a3f2 | ||
|
|
0895f5b669 | ||
|
|
07d3d46f08 | ||
|
|
7ffe514812 | ||
|
|
e2fdd9e54f | ||
|
|
8d99ec411e | ||
|
|
122ca000b5 | ||
|
|
7086e475e3 | ||
|
|
6b61461a40 | ||
|
|
344572dc71 | ||
|
|
b70abe38c1 | ||
|
|
6430ad631a | ||
|
|
c486540935 | ||
|
|
602a038747 | ||
|
|
d292dd9b27 | ||
|
|
5ab6b7e020 | ||
|
|
2cabeeb1c3 | ||
|
|
a1fe6d0337 | ||
|
|
aff37e7bea | ||
|
|
c3ccc9b136 | ||
|
|
bd1e56dd83 | ||
|
|
cd34fdd047 | ||
|
|
b377b2dc47 | ||
|
|
a21d063ef8 | ||
|
|
257c54a021 | ||
|
|
207eecc424 | ||
|
|
1e32cc3d63 | ||
|
|
db0c8b158c | ||
|
|
c1665b1441 | ||
|
|
a0d3a674d0 | ||
|
|
8725269e0d | ||
|
|
8102e79daf | ||
|
|
50a9ba1f26 | ||
|
|
e47f60d702 | ||
|
|
110dac34df | ||
|
|
210cb3f5a0 | ||
|
|
cd8e439b9b | ||
|
|
a391196ba5 | ||
|
|
f522f36dd1 | ||
|
|
bcecbbd1be | ||
|
|
895acc9f97 | ||
|
|
68935c790b | ||
|
|
7c8ae8a5f5 | ||
|
|
047e9fcf1a | ||
|
|
57967d9a98 | ||
|
|
88e84f52dd | ||
|
|
8a6a8c7bc3 | ||
|
|
7953813453 | ||
|
|
99fdc828eb | ||
|
|
d6d54509d3 | ||
|
|
bd191b6537 | ||
|
|
ab37cadbfe | ||
|
|
4a6a72fe6c | ||
|
|
23919bb08c | ||
|
|
53d06396b8 | ||
|
|
fdd65ddef3 | ||
|
|
d0f3668232 | ||
|
|
63596d22ae | ||
|
|
0e5ab967d5 | ||
|
|
579856439b | ||
|
|
bf874e967e | ||
|
|
781ff62d7a | ||
|
|
47c47914d6 | ||
|
|
cefd52f52f | ||
|
|
aed9cf77fa | ||
|
|
2abec112dc | ||
|
|
eb3e74cae9 | ||
|
|
6a322e11b2 | ||
|
|
4d3f6feb37 | ||
|
|
abce966642 | ||
|
|
67baa4b4a6 | ||
|
|
75650b4e96 | ||
|
|
c174981e0b | ||
|
|
04a70261a4 | ||
|
|
9256ac8a62 | ||
|
|
5aa450f97b | ||
|
|
dc93f21ffe | ||
|
|
457148333e | ||
|
|
123e299bcf | ||
|
|
c71c5f6a9e | ||
|
|
a7c7158c7b | ||
|
|
5ed260f03e | ||
|
|
d6c6ad105f | ||
|
|
3d6d886c6a | ||
|
|
152ff34893 | ||
|
|
10e187f2f6 | ||
|
|
004f0982e1 | ||
|
|
344a271704 | ||
|
|
b05a8405fe | ||
|
|
40a521703d | ||
|
|
4283c9de4f | ||
|
|
43dfe74c56 | ||
|
|
eae7b32f85 | ||
|
|
c9e78a1094 | ||
|
|
fe6ef6c07a | ||
|
|
e0498db360 | ||
|
|
906b1feab3 | ||
|
|
2fa59370f7 | ||
|
|
62f865ee09 | ||
|
|
962386fb82 | ||
|
|
075cb4320d | ||
|
|
f15bd558ab | ||
|
|
387379e6c4 | ||
|
|
ad137948b9 | ||
|
|
e8df8ce17b | ||
|
|
01003779e9 | ||
|
|
cb12593d57 | ||
|
|
218e61990c | ||
|
|
86be352e82 | ||
|
|
315affdfcb | ||
|
|
f75d8b0c23 | ||
|
|
aab3106abd | ||
|
|
9775962a96 | ||
|
|
142c848308 | ||
|
|
6e99903a4e | ||
|
|
1f455e53c0 | ||
|
|
2934f4f58c | ||
|
|
8460f39363 | ||
|
|
8b667441a3 | ||
|
|
38fc79fcfd | ||
|
|
39ff37dc74 | ||
|
|
91d3176504 | ||
|
|
513a06e966 | ||
|
|
1afc96a702 | ||
|
|
518a8a9c4e | ||
|
|
c3e04d86ec | ||
|
|
7d8df9e60a | ||
|
|
12fd81efd2 | ||
|
|
abf4f510de | ||
|
|
a92832509d | ||
|
|
2780a82a0e | ||
|
|
d142827b34 | ||
|
|
4851efe296 | ||
|
|
c0b9232351 | ||
|
|
5c9af6b5aa | ||
|
|
19bbe0557f | ||
|
|
2ca03393f5 | ||
|
|
864a386300 | ||
|
|
d466bcb7a0 | ||
|
|
998ac31096 | ||
|
|
67c79cda67 | ||
|
|
c924b9be6f | ||
|
|
b0a28fdadd | ||
|
|
de210bbdec | ||
|
|
61554862e6 | ||
|
|
befef270ab | ||
|
|
ce46df0b4b | ||
|
|
005626bd4d | ||
|
|
05bc6a5b36 | ||
|
|
e909f843f8 | ||
|
|
8850ce814d | ||
|
|
32e8dc45b0 | ||
|
|
187dbc0ce7 | ||
|
|
9556bba1ba | ||
|
|
5647eeecf3 | ||
|
|
3e3c14e9ef | ||
|
|
9546a9dc14 | ||
|
|
f83adda582 | ||
|
|
0dc21c5690 | ||
|
|
57703d0170 | ||
|
|
e3b303c212 | ||
|
|
9aab1c5e1b | ||
|
|
c7c0e3d58d | ||
|
|
21bb83612d | ||
|
|
efd3aec503 | ||
|
|
d6084b0f36 | ||
|
|
c07afdb123 | ||
|
|
6f818654a0 | ||
|
|
af4350fc92 | ||
|
|
d5b91db3ce | ||
|
|
e093c42383 | ||
|
|
e649afc0a8 | ||
|
|
7aa5779181 | ||
|
|
7cb8a11038 | ||
|
|
09ea2ad7be | ||
|
|
7be9418f30 | ||
|
|
d6b867723d | ||
|
|
2b210ff47e | ||
|
|
385164d6f9 | ||
|
|
1bafe5a8e7 | ||
|
|
52f719521a | ||
|
|
5c67089e7d | ||
|
|
af36f7765a | ||
|
|
0b0524d397 | ||
|
|
4eaccda110 | ||
|
|
16bcc7bc6d | ||
|
|
26004d36fa | ||
|
|
0b31d8a9c4 | ||
|
|
c2a843d8ed | ||
|
|
ecb8751322 | ||
|
|
d4a428d2e9 | ||
|
|
1d6172102d | ||
|
|
887540e646 | ||
|
|
18dfa1ae90 | ||
|
|
7ec269052d | ||
|
|
a3ee7a9416 | ||
|
|
92006c8e78 | ||
|
|
e6af5d49ae | ||
|
|
0dfc14aa8b | ||
|
|
6114e5b813 | ||
|
|
9c585e9210 | ||
|
|
0e3d507006 | ||
|
|
1cf5800665 | ||
|
|
3a02948170 | ||
|
|
26df647a0f | ||
|
|
ad7dc0e87f | ||
|
|
2a2323d64e | ||
|
|
3a1eebe683 | ||
|
|
520fd17eca | ||
|
|
09d32399ab | ||
|
|
c492bd10e8 | ||
|
|
0d1eb423a1 | ||
|
|
55f36bac3a | ||
|
|
3d19b7ce55 | ||
|
|
2ab408a700 | ||
|
|
1c77b5f926 | ||
|
|
13de9dc34f | ||
|
|
6788abaa48 | ||
|
|
39a05c0b55 | ||
|
|
8051b9d2bc | ||
|
|
30533f0397 | ||
|
|
01c3cd84f5 | ||
|
|
49efbf9b1d | ||
|
|
0f9fe89727 | ||
|
|
d7aa6a88fb | ||
|
|
c4089778fb | ||
|
|
61ca241924 | ||
|
|
79d880ccb7 | ||
|
|
20fee708a3 | ||
|
|
1a099c2ced | ||
|
|
ab7989217a | ||
|
|
6e28c40061 | ||
|
|
9a5ad5d44e | ||
|
|
e19f939b53 | ||
|
|
977b13d37f | ||
|
|
bfd68b4357 | ||
|
|
71824a2cd5 | ||
|
|
e2ae4aec47 | ||
|
|
59d586e2ff | ||
|
|
07a8601adf | ||
|
|
b1446447fc | ||
|
|
308adaa6db | ||
|
|
32cd050cfe | ||
|
|
740b70ea0c | ||
|
|
4268cd7312 | ||
|
|
5d81d2ab28 | ||
|
|
68bc2c51db | ||
|
|
acb95ed9da | ||
|
|
c36ca76bb8 | ||
|
|
30f22e0208 | ||
|
|
4e01061296 | ||
|
|
2be5abf4ed | ||
|
|
f59f2039c0 | ||
|
|
a20f83d9a9 | ||
|
|
4bf5d761bc | ||
|
|
8eb7761e72 | ||
|
|
c05d6f2d12 | ||
|
|
f553b79b70 | ||
|
|
4098ac22ff | ||
|
|
2f5621e566 | ||
|
|
93e1585614 | ||
|
|
5b3cc69b43 | ||
|
|
7033e33822 | ||
|
|
b2c30ad95d | ||
|
|
f2cfc17be8 | ||
|
|
186a0455be | ||
|
|
e0ea1f0c14 | ||
|
|
11f79ebe18 | ||
|
|
c2906f2bea | ||
|
|
a74e338517 | ||
|
|
d38e339ebb | ||
|
|
b47085512c | ||
|
|
cb98231c7d | ||
|
|
36e83663cf | ||
|
|
102b1de4b4 | ||
|
|
d362159181 | ||
|
|
9b7fd1bbe5 | ||
|
|
9457fe86d4 | ||
|
|
13fa9d3819 | ||
|
|
3f5c7acc33 | ||
|
|
7de464ffe8 | ||
|
|
c88afb81f9 | ||
|
|
34e324ca70 | ||
|
|
7bd32a06cf | ||
|
|
ba0b7257a7 | ||
|
|
690e34968a | ||
|
|
923f3f6992 | ||
|
|
f0f650948a | ||
|
|
03a7c4551b | ||
|
|
6b411f4b47 | ||
|
|
b78286eab5 | ||
|
|
dac3ffed60 | ||
|
|
16aa9c1964 | ||
|
|
ac05ab301d | ||
|
|
de26d9af9b | ||
|
|
8cff9d3307 | ||
|
|
995d97b001 | ||
|
|
a7960ed953 | ||
|
|
0328873baf | ||
|
|
babfb28c3c | ||
|
|
8a544b8912 | ||
|
|
75a00da8d1 | ||
|
|
38614a78b6 | ||
|
|
b44ec526b6 | ||
|
|
177354df02 | ||
|
|
2a2fff763d | ||
|
|
3c03a6787d | ||
|
|
f9739e8343 | ||
|
|
85d4cd0f43 | ||
|
|
e648c2d68f | ||
|
|
467e4e73c1 | ||
|
|
b141619b50 | ||
|
|
3f04c019cd | ||
|
|
3872c32d4a | ||
|
|
df0b05ef2b | ||
|
|
70b3b3e6e1 | ||
|
|
a783d668f1 | ||
|
|
a6e2c24b60 | ||
|
|
8a0d67391c | ||
|
|
63955ec2e2 | ||
|
|
077b5109a4 | ||
|
|
444c9529db | ||
|
|
600eaaea09 | ||
|
|
60c008eb99 | ||
|
|
27c086bd95 | ||
|
|
c91f2c0cfa | ||
|
|
3f4411ed52 | ||
|
|
f8170cbd7c | ||
|
|
8ecd7ef5ae | ||
|
|
0ac28d23a4 | ||
|
|
ced74f4435 | ||
|
|
16c6ee03ae | ||
|
|
eac28852ed | ||
|
|
f87ee7e51a | ||
|
|
9ce0cb6037 | ||
|
|
85764dad33 | ||
|
|
9addd8da2c | ||
|
|
bfc969f697 | ||
|
|
e8a447e002 | ||
|
|
8fa6f19aa2 | ||
|
|
85dd78b7d8 | ||
|
|
bc8e40387b | ||
|
|
566a13a6c0 | ||
|
|
9280285954 | ||
|
|
135cdd43a9 | ||
|
|
6e7f4a99e9 | ||
|
|
cfd3a51369 | ||
|
|
ab4fed04fe | ||
|
|
c86bf9bae2 | ||
|
|
b8e7ea1f11 | ||
|
|
54a9eb416d | ||
|
|
f9ad283402 | ||
|
|
8cde2c5c21 | ||
|
|
bc98ea9ce1 | ||
|
|
294cfcdb22 | ||
|
|
3ef2c37a83 | ||
|
|
78290be1c0 | ||
|
|
c31eb969ba | ||
|
|
68fcbef5a1 | ||
|
|
cc4dc8339d | ||
|
|
c57f1e318e | ||
|
|
bd9ddcb231 | ||
|
|
6acde3e1ce | ||
|
|
3832600822 | ||
|
|
fa107ded2a | ||
|
|
8eb77dfea2 | ||
|
|
9c8ed97e83 | ||
|
|
c8e5c809ed | ||
|
|
9b4919dcb8 | ||
|
|
96a7435911 | ||
|
|
7c698ad46c | ||
|
|
9a9070c26d | ||
|
|
aebd3d2df2 | ||
|
|
affaf4f9d2 | ||
|
|
4f3495f955 | ||
|
|
d19d3c5dca | ||
|
|
a8afd462c0 | ||
|
|
093dfedf74 | ||
|
|
48a15b7349 | ||
|
|
59436967d5 | ||
|
|
c5327ecc31 | ||
|
|
617a879dfe | ||
|
|
b7a6cd6750 | ||
|
|
ffc1084029 | ||
|
|
5724801800 | ||
|
|
309d7377e7 | ||
|
|
2ff460a6c8 | ||
|
|
3573f8b5f3 | ||
|
|
e583ab045f | ||
|
|
3d7c2d6634 | ||
|
|
47933b73db | ||
|
|
1432078569 | ||
|
|
6cfdaaa740 | ||
|
|
d94b21a8df | ||
|
|
cfda5f0035 | ||
|
|
5d6fe2d05f | ||
|
|
fb66cb05df | ||
|
|
5d5bbd1a21 | ||
|
|
c45ab2b2d6 | ||
|
|
4a4f0aedf3 | ||
|
|
db51126e3b | ||
|
|
2737494599 | ||
|
|
e9e7e4c86b | ||
|
|
7f17ced74b | ||
|
|
8f8b0f68ff | ||
|
|
f9e5e12bcc | ||
|
|
cb6412978c | ||
|
|
120df3b8b7 | ||
|
|
fabfc17d93 | ||
|
|
4db2561dd5 | ||
|
|
355e74fce4 | ||
|
|
c5e729b4bc | ||
|
|
1f39582f3f | ||
|
|
23a7e9c93e | ||
|
|
0db2549361 | ||
|
|
100775d091 | ||
|
|
8532799aaa | ||
|
|
2f50a3044e | ||
|
|
990bddfe16 | ||
|
|
239a12d0d1 | ||
|
|
2ab3ec6cbd | ||
|
|
d187183161 | ||
|
|
2a8d32a760 | ||
|
|
19a80b7695 | ||
|
|
7b721e200b | ||
|
|
c9f7f2a0f8 | ||
|
|
d894d2dc0c | ||
|
|
2b3f8baf86 | ||
|
|
ab30a02e5f | ||
|
|
85f1364922 | ||
|
|
e60864761c | ||
|
|
829936fd6f | ||
|
|
6eca1a93c0 | ||
|
|
77ff63f7e7 | ||
|
|
5fa1bfcf45 | ||
|
|
76d01a826c | ||
|
|
2395ed0826 | ||
|
|
de1262dcc1 | ||
|
|
124d1e5caa | ||
|
|
640c75216d | ||
|
|
a328473d1b | ||
|
|
1941bf4cbf | ||
|
|
761549b968 | ||
|
|
16f8b9f627 | ||
|
|
2095c552f8 | ||
|
|
3033d6b47a | ||
|
|
2a4c36a73d | ||
|
|
4a35f24c47 | ||
|
|
47f7073e28 | ||
|
|
6c9e2cf195 | ||
|
|
be3ad53c49 | ||
|
|
1ac59c103d | ||
|
|
ba55b3f94b | ||
|
|
793a130520 | ||
|
|
f5c00ed917 | ||
|
|
c6a2248e98 | ||
|
|
12f1b7858e | ||
|
|
3eac46a981 | ||
|
|
3cbeacaf58 | ||
|
|
818ea9d84b | ||
|
|
395ccd366a | ||
|
|
3362281802 | ||
|
|
9eb0ce778a | ||
|
|
5b51a9f7f1 | ||
|
|
558c5f5040 | ||
|
|
1e5d354127 | ||
|
|
68a8537266 | ||
|
|
f6f1ce01c6 | ||
|
|
80fd0a0c00 | ||
|
|
d1f5f06082 | ||
|
|
172d6433a7 | ||
|
|
6ef73ebac0 | ||
|
|
ade3020098 | ||
|
|
af18ab4305 | ||
|
|
3fb589b2ff | ||
|
|
b7056ea129 | ||
|
|
60870d3407 | ||
|
|
afe08d63e3 | ||
|
|
2a9e933d90 | ||
|
|
16da0508af | ||
|
|
f222bd77bb | ||
|
|
2630943eb3 | ||
|
|
9205edae41 | ||
|
|
d491547e86 | ||
|
|
91c1c8dddb | ||
|
|
68a90caf45 | ||
|
|
c4c1c1ea55 | ||
|
|
6d3ef70d1e | ||
|
|
fa26673f49 | ||
|
|
8a19c2a157 | ||
|
|
7ad17f7b08 | ||
|
|
b2e6c9723a | ||
|
|
693fa02b83 | ||
|
|
a36ffb12a5 | ||
|
|
50cc709f77 | ||
|
|
473c1d4d7b | ||
|
|
a597dd9473 | ||
|
|
95efae09a7 | ||
|
|
6c2818881d | ||
|
|
3cdf88be4d | ||
|
|
777159913b | ||
|
|
97bbc97bb2 | ||
|
|
cf01747701 | ||
|
|
82d7ac35ed | ||
|
|
203476915a | ||
|
|
c88ea382d2 | ||
|
|
635d54c091 | ||
|
|
d3607d5465 | ||
|
|
7add75fba5 | ||
|
|
86a97f7835 | ||
|
|
f6f927d227 | ||
|
|
1b656e0dde | ||
|
|
7c99ffb891 | ||
|
|
84335371b1 | ||
|
|
9a0687a673 | ||
|
|
5861dfb9f8 | ||
|
|
06d19fb68d | ||
|
|
e00c0594a3 | ||
|
|
75a8405430 | ||
|
|
800afc55d7 | ||
|
|
a8d6f14c2d | ||
|
|
f97dd05d5a | ||
|
|
782dcc834b | ||
|
|
4c0ca9b968 | ||
|
|
7983856239 | ||
|
|
53a595f448 | ||
|
|
005f39e02e | ||
|
|
75fbe1adae | ||
|
|
6ff27c34f1 | ||
|
|
7cb1030d32 | ||
|
|
22a9a454af | ||
|
|
62dba86c81 | ||
|
|
2fbc8c20c1 | ||
|
|
132f17fa37 | ||
|
|
10474e6a73 | ||
|
|
c87244dd75 | ||
|
|
0ef453b82c | ||
|
|
a4b322cccc | ||
|
|
fc7e845c8f | ||
|
|
3d4cc2f904 | ||
|
|
8923d60dba | ||
|
|
9ad922290c | ||
|
|
7e3692b99f | ||
|
|
83e3008d35 | ||
|
|
1410a8a003 | ||
|
|
825aa9501b | ||
|
|
b5cb66dc35 | ||
|
|
a303493882 | ||
|
|
9f96d18eb1 | ||
|
|
7b399a225c | ||
|
|
d91da80871 | ||
|
|
04c520bad9 | ||
|
|
afcc0ad3b2 | ||
|
|
27575aa216 | ||
|
|
fa10f1361f | ||
|
|
a589338a7f | ||
|
|
623f7d9772 | ||
|
|
3c7f5af2a5 | ||
|
|
c3fc26bb9d | ||
|
|
041983a776 | ||
|
|
888470ee29 | ||
|
|
dd07df15c1 | ||
|
|
39e26262a5 | ||
|
|
c43a50fe36 | ||
|
|
9dee8ee4e4 | ||
|
|
31a238b6b6 | ||
|
|
c305397fca | ||
|
|
f747f3b2cd | ||
|
|
ed848ac41e | ||
|
|
2090cc650c | ||
|
|
13179d42a0 | ||
|
|
6898536a02 | ||
|
|
f98686da85 | ||
|
|
6246db9288 | ||
|
|
38fac1be63 | ||
|
|
7a3af96d84 | ||
|
|
289f6a38fe | ||
|
|
e105a87144 | ||
|
|
c763748dd1 | ||
|
|
75cd57b6cb | ||
|
|
dca018206e | ||
|
|
89107cb751 | ||
|
|
edad08addd | ||
|
|
5b597c65c7 | ||
|
|
d3c3333735 | ||
|
|
9258a7aecb | ||
|
|
f82814760e | ||
|
|
4b86717650 | ||
|
|
8d2bb0f43e | ||
|
|
23a13fd4a5 | ||
|
|
64ca527ecb | ||
|
|
3b0de24a7b | ||
|
|
5842311062 | ||
|
|
b45cd0430c | ||
|
|
a8629917ae | ||
|
|
febe6498f2 | ||
|
|
fc86f630a6 | ||
|
|
b239e3c941 | ||
|
|
6b5e983f3d | ||
|
|
eeaefdf04f | ||
|
|
8822bde131 | ||
|
|
c3154703d0 | ||
|
|
57bae55574 | ||
|
|
58df302b15 | ||
|
|
35ba1ac7ef | ||
|
|
eef38289b2 | ||
|
|
81fe36047e | ||
|
|
b0de5e73f5 | ||
|
|
1522f2ae59 | ||
|
|
a11062b2d9 | ||
|
|
01200282da | ||
|
|
4ef94fd74e | ||
|
|
b38b6f5f0f | ||
|
|
db628b3ca0 | ||
|
|
015c1052ae | ||
|
|
ce4263f901 | ||
|
|
4af33fa24d | ||
|
|
ee7038f9fd | ||
|
|
7922f34318 | ||
|
|
ac492cfab6 | ||
|
|
1ff162c445 | ||
|
|
38bffa52d3 | ||
|
|
db6a8d4a8a | ||
|
|
22388cfc07 | ||
|
|
b5b1534b10 | ||
|
|
89a5c21c07 | ||
|
|
4fb20bdbcc | ||
|
|
7b2f9afe4c | ||
|
|
bad1cb0f37 | ||
|
|
4cb6dec331 | ||
|
|
d43c0de3f4 | ||
|
|
a9f866f4ca | ||
|
|
8f355e26ef | ||
|
|
3cefe524dc | ||
|
|
918f7d484d | ||
|
|
2c4b378455 | ||
|
|
347a06e3d0 | ||
|
|
f734007af4 | ||
|
|
63f6c689ff | ||
|
|
edf9e176db | ||
|
|
33f3f4a2ae | ||
|
|
6f7faf9df2 | ||
|
|
3942cb76af | ||
|
|
6365ebc9ea | ||
|
|
36b2a2ebcd | ||
|
|
3779493d17 | ||
|
|
01f66785cb | ||
|
|
5cb62b4561 | ||
|
|
d64570b781 | ||
|
|
fb48f5a356 | ||
|
|
b2140a2322 | ||
|
|
0b372cfb3a | ||
|
|
2d42cb955e | ||
|
|
10be064561 | ||
|
|
b533c32dd4 | ||
|
|
3dca445763 | ||
|
|
5e517e426c | ||
|
|
325dc92ad4 | ||
|
|
d1da1a45a0 | ||
|
|
06f64ff941 | ||
|
|
4c2931aab5 | ||
|
|
3ae8c300bb | ||
|
|
18ee22d93b | ||
|
|
3b95a7a2b1 | ||
|
|
275d8a2696 | ||
|
|
0dae051ddd | ||
|
|
a7a7e430bf | ||
|
|
839be1dfdb | ||
|
|
53ac2efcad | ||
|
|
73386d5761 | ||
|
|
79f69b1676 | ||
|
|
1a8765e6ce | ||
|
|
0c6a6baa08 | ||
|
|
9dcce18815 | ||
|
|
67e6757069 | ||
|
|
2dd1106130 | ||
|
|
59ff297c24 | ||
|
|
f424cd83a9 | ||
|
|
4628759d3b | ||
|
|
11d37c5067 | ||
|
|
1e34b9ba8d | ||
|
|
1e764e1b41 | ||
|
|
e35fb5486f | ||
|
|
40808fa050 | ||
|
|
3f44ca9487 | ||
|
|
84cf918177 | ||
|
|
443648028c | ||
|
|
2e99581612 | ||
|
|
8d721e5b75 | ||
|
|
8dc9cd53ff | ||
|
|
c44ba4b377 | ||
|
|
a6252a3297 | ||
|
|
582a3f433c | ||
|
|
97f11c694c | ||
|
|
aed02304eb | ||
|
|
8e1fb2cccd | ||
|
|
2d5a6055e8 | ||
|
|
dd77b5db5a | ||
|
|
18681dc653 | ||
|
|
f91efadd4f | ||
|
|
880c62eec1 | ||
|
|
72da1d3e02 | ||
|
|
4da8e492f7 | ||
|
|
139026de73 | ||
|
|
284882b8c7 | ||
|
|
dfc3630c8c | ||
|
|
8bb622a983 | ||
|
|
24cfae7295 | ||
|
|
75b20f2eaf | ||
|
|
839b480391 | ||
|
|
6d33a0791a | ||
|
|
00000538ed | ||
|
|
f873f58d5b | ||
|
|
1d58a2e291 | ||
|
|
84e1ee4bac | ||
|
|
5eee6416f5 | ||
|
|
4ccc005197 | ||
|
|
52d5af4d7e | ||
|
|
82da232b12 | ||
|
|
51a481d9e8 | ||
|
|
d2aa891c8e | ||
|
|
ad5466ca6e | ||
|
|
33a9119c22 | ||
|
|
1f07d39e23 | ||
|
|
49517ca835 | ||
|
|
be68a5dacb | ||
|
|
23db1522f6 | ||
|
|
0e3e5eed78 | ||
|
|
957bd9d9c0 | ||
|
|
65d015d813 | ||
|
|
0eedb30ce8 | ||
|
|
25995faa6c | ||
|
|
621e1dd4c2 | ||
|
|
8eb36ebbd5 | ||
|
|
39f02b638b | ||
|
|
7a2073bf64 | ||
|
|
948a3620cf | ||
|
|
303c8f03a8 | ||
|
|
06dc220d64 | ||
|
|
9dadde735c | ||
|
|
dc4e9e2fe1 | ||
|
|
0e9ff02e85 | ||
|
|
c3a5564894 | ||
|
|
2b65feb5a5 | ||
|
|
af9e316ce6 | ||
|
|
92610dafdb | ||
|
|
26c35927f7 | ||
|
|
f7443e0e85 | ||
|
|
e2f5eb1c3e | ||
|
|
0f6d9f0ffc | ||
|
|
36d360aa98 | ||
|
|
0516fcead1 | ||
|
|
f872397c0c | ||
|
|
aacb5bd1e3 | ||
|
|
fb51b7a6c5 | ||
|
|
b8e57550b7 | ||
|
|
2d8acc12f3 | ||
|
|
a5fa0b03c0 | ||
|
|
d02a42db34 | ||
|
|
4c23b890c4 | ||
|
|
7c21169e72 | ||
|
|
ad1a805810 | ||
|
|
6ceea7e635 | ||
|
|
ed11431bdb | ||
|
|
ee489eafb0 | ||
|
|
104f72cf95 | ||
|
|
7bac5c59eb | ||
|
|
7c726a1e3e | ||
|
|
2b2667e791 | ||
|
|
e3956c289a | ||
|
|
b44565f3e4 | ||
|
|
4da7b2f2ef | ||
|
|
0a81bbf58f | ||
|
|
162795e983 | ||
|
|
81a58c413c | ||
|
|
1b6fb00808 | ||
|
|
32fbb7b821 | ||
|
|
67180c87e1 | ||
|
|
24b21a5d84 | ||
|
|
01eda653ee | ||
|
|
61124945c0 | ||
|
|
e9f322e2f0 | ||
|
|
f7b1fa3aed | ||
|
|
8d0318387f | ||
|
|
1cf3f510d1 | ||
|
|
6824581335 | ||
|
|
fde815eb54 | ||
|
|
05cf0f3203 | ||
|
|
73e9b6b205 | ||
|
|
555aa2baf9 | ||
|
|
26be2f7003 | ||
|
|
d5d01a5af9 | ||
|
|
65e63db01e | ||
|
|
4de2665e8c | ||
|
|
865eab2445 | ||
|
|
f9bfb8462a | ||
|
|
9c5d32799d | ||
|
|
4c530ae5bc | ||
|
|
134466992b | ||
|
|
585dc6d781 | ||
|
|
ad5083714e | ||
|
|
fce69b5a4f | ||
|
|
a97e3501c8 | ||
|
|
d55ed5449d | ||
|
|
4d724c25c7 | ||
|
|
92c316606b | ||
|
|
3103106ba7 | ||
|
|
ebce1f7954 | ||
|
|
da9a8aee9e | ||
|
|
4bb8907c2b | ||
|
|
c3fe09e069 | ||
|
|
19096ebdfd | ||
|
|
d30343b9d9 | ||
|
|
30e8968f3b | ||
|
|
bb698f73f4 | ||
|
|
8a6dea2d55 | ||
|
|
68269a3f2a | ||
|
|
244e4fe4c7 | ||
|
|
2e943b280e | ||
|
|
d6b0c35739 | ||
|
|
ef7a3aa2ff | ||
|
|
79f532177f | ||
|
|
56aae058fc | ||
|
|
37f6b421f2 | ||
|
|
7e4ee8cb4f | ||
|
|
0219b8b6b4 | ||
|
|
4d6f11a6ce | ||
|
|
a51d944e25 | ||
|
|
a7f427d7d9 | ||
|
|
59af5a46f0 | ||
|
|
a8cd23de73 | ||
|
|
bb1aa22b63 | ||
|
|
28de9c69b3 | ||
|
|
ef3f373172 | ||
|
|
4b4c6aff91 | ||
|
|
c3ac6c80a6 | ||
|
|
6653fcf391 | ||
|
|
1ce708c570 | ||
|
|
8fc5d3586a | ||
|
|
a95ad0a897 | ||
|
|
1e4243e40b | ||
|
|
60ec6d4638 | ||
|
|
b50a9f760b | ||
|
|
ebdcd27f15 | ||
|
|
8d073b0232 | ||
|
|
64fd713042 | ||
|
|
fbc9ee9fba | ||
|
|
519a4bc24e | ||
|
|
b04290fe58 | ||
|
|
15f51f0eb6 | ||
|
|
763c529be0 | ||
|
|
dd34bcca5e | ||
|
|
e522ad46ba | ||
|
|
aedb8717f1 | ||
|
|
33b9431580 | ||
|
|
c82e82dafc | ||
|
|
ba1d51293c | ||
|
|
63bf68c991 | ||
|
|
c320a8d858 |
10
.cvsignore
10
.cvsignore
@@ -1,10 +0,0 @@
|
||||
*.lo
|
||||
config.log
|
||||
config.h
|
||||
libtool
|
||||
config.status
|
||||
stamp-h
|
||||
Makefile
|
||||
gtk+.xconfig
|
||||
config.cache
|
||||
|
||||
3
AUTHORS
3
AUTHORS
@@ -1,3 +0,0 @@
|
||||
Peter Mattis (petm@xcf.berkeley.edu)
|
||||
Spencer Kimball (spencer@xcf.berkeley.edu)
|
||||
Josh MacDonald (jmacd@xcf.berkeley.edu)
|
||||
481
COPYING
481
COPYING
@@ -1,481 +0,0 @@
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is
|
||||
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some
|
||||
specially designated Free Software Foundation software, and to any
|
||||
other libraries whose authors decide to use it. You can use it for
|
||||
your libraries, 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 library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link a program with the library, you must provide
|
||||
complete object files to the recipients so that they can relink them
|
||||
with the library, after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright
|
||||
the library, and (2) offer you this license which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
library. If the library is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original
|
||||
version, 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 companies distributing free
|
||||
software will individually obtain patent licenses, thus in effect
|
||||
transforming the program into proprietary software. To prevent this,
|
||||
we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary
|
||||
GNU General Public License, which was designed for utility programs. This
|
||||
license, the GNU Library General Public License, applies to certain
|
||||
designated libraries. This license is quite different from the ordinary
|
||||
one; be sure to read it in full, and don't assume that anything in it is
|
||||
the same as in the ordinary license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that
|
||||
they blur the distinction we usually make between modifying or adding to a
|
||||
program and simply using it. Linking a program with a library, without
|
||||
changing the library, is in some sense simply using the library, and is
|
||||
analogous to running a utility program or application program. However, in
|
||||
a textual and legal sense, the linked executable is a combined work, a
|
||||
derivative of the original library, and the ordinary General Public License
|
||||
treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General
|
||||
Public License for libraries did not effectively promote software
|
||||
sharing, because most developers did not use the libraries. We
|
||||
concluded that weaker conditions might promote sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the
|
||||
users of those programs of all benefit from the free status of the
|
||||
libraries themselves. This Library General Public License is intended to
|
||||
permit developers of non-free programs to use free libraries, while
|
||||
preserving your freedom as a user of such programs to change the free
|
||||
libraries that are incorporated in them. (We have not seen how to achieve
|
||||
this as regards changes in header files, but we have achieved it as regards
|
||||
changes in the actual functions of the Library.) The hope is that this
|
||||
will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, while the latter only
|
||||
works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one.
|
||||
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which
|
||||
contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Library
|
||||
General Public License (also called "this License"). Each licensee is
|
||||
addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, 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 library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete 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 distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
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 Library or any portion
|
||||
of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
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 Library, 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 Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you 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.
|
||||
|
||||
If distribution of 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 satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. 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.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library 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.
|
||||
|
||||
9. 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 Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
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.
|
||||
|
||||
11. 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 Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library 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 Library.
|
||||
|
||||
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.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library 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.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Library 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 Library
|
||||
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 Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
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
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "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
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. 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 LIBRARY 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
|
||||
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. 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 library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
1140
ChangeLog.pre-2-0
1140
ChangeLog.pre-2-0
File diff suppressed because it is too large
Load Diff
1140
ChangeLog.pre-2-10
1140
ChangeLog.pre-2-10
File diff suppressed because it is too large
Load Diff
1140
ChangeLog.pre-2-2
1140
ChangeLog.pre-2-2
File diff suppressed because it is too large
Load Diff
1140
ChangeLog.pre-2-4
1140
ChangeLog.pre-2-4
File diff suppressed because it is too large
Load Diff
1140
ChangeLog.pre-2-6
1140
ChangeLog.pre-2-6
File diff suppressed because it is too large
Load Diff
1140
ChangeLog.pre-2-8
1140
ChangeLog.pre-2-8
File diff suppressed because it is too large
Load Diff
30
Makefile.am
30
Makefile.am
@@ -1,30 +0,0 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
SRC_SUBDIRS = glib gdk gtk
|
||||
SUBDIRS = $(SRC_SUBDIRS) docs
|
||||
|
||||
EXTRA_DIST = gtk+.prj makecopyright TODO
|
||||
|
||||
.PHONY: files populate checkin release
|
||||
|
||||
files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
|
||||
echo $$p; \
|
||||
done
|
||||
@for subdir in $(SUBDIRS); do \
|
||||
files=`cd $$subdir; $(MAKE) files | grep -v "make\[[1-9]\]"`; \
|
||||
for file in $$files; do \
|
||||
echo $$subdir/$$file; \
|
||||
done; \
|
||||
done
|
||||
|
||||
populate:
|
||||
@echo "populating project"
|
||||
@files=`$(MAKE) files | grep -v "make\[[1-9]\]"`; prcs populate -d gtk+.prj $$files
|
||||
|
||||
checkin: populate
|
||||
@echo "checking in project"
|
||||
@prcs checkin
|
||||
|
||||
release:
|
||||
$(MAKE) dist distdir=$(PACKAGE)`date +"%y%m%d"`
|
||||
17
README
17
README
@@ -1,17 +0,0 @@
|
||||
|
||||
The official ftp site is:
|
||||
ftp://ftp.gimp.org/pub/gtk
|
||||
|
||||
Patches can be uploaded to:
|
||||
ftp://ftp.gimp.org/incoming
|
||||
|
||||
Anonymous CVS access for gtk+ (as well as 'gimp', 'gimp-data', and
|
||||
'gnome') is available via
|
||||
CVSROOT=:pserver:anonymous@cvs.gnome.org:/home/cvs
|
||||
with an empty password.
|
||||
|
||||
A mailing list is located at:
|
||||
gtk-list@redhat.com
|
||||
|
||||
To subscribe: mail -s subscribe gtk-list-request@redhat.com < /dev/null
|
||||
(Send mail to gtk-list-request@redhat.com with the subject "subscribe")
|
||||
36
TODO
36
TODO
@@ -1,36 +0,0 @@
|
||||
Now
|
||||
---
|
||||
|
||||
3. Fix focus activation of list items. Does list item activation have to be
|
||||
completely reorganized?
|
||||
|
||||
4. Lists should scroll to center the recently selected item if it isn't
|
||||
visible.
|
||||
|
||||
|
||||
The Future
|
||||
----------
|
||||
|
||||
-Documentation
|
||||
|
||||
-Tree widget
|
||||
|
||||
-Text widget (needs to be finished)
|
||||
|
||||
-Widget redrawing when the window resizes sometimes messes up.
|
||||
|
||||
-Make sure a widget added to a list is a list item and a widget added
|
||||
to a menu is a menu item, etc...
|
||||
|
||||
-More dialogs? Print, font, etc?
|
||||
|
||||
-Multiple document interface (MDI)?
|
||||
|
||||
-Support another widget style? Should be possible using GtkStyle's, but
|
||||
there may be some work needed to remove any style dependencies in widget
|
||||
code. Maybe GtkStyle's should have 'draw_push_button', 'draw_check_button',
|
||||
etc, functions to draw the various widgets.
|
||||
|
||||
-OffiX drag and drop support
|
||||
|
||||
-Make all widget attributes configurable after the widget is created.
|
||||
47
acconfig.h
47
acconfig.h
@@ -1,47 +0,0 @@
|
||||
/* acconfig.h
|
||||
This file is in the public domain.
|
||||
|
||||
Descriptive text for the C preprocessor macros that
|
||||
the distributed Autoconf macros can define.
|
||||
No software package will use all of them; autoheader copies the ones
|
||||
your configure.in uses into your configuration header file templates.
|
||||
|
||||
The entries are in sort -df order: alphabetical, case insensitive,
|
||||
ignoring punctuation (such as underscores). Although this order
|
||||
can split up related entries, it makes it easier to check whether
|
||||
a given entry is in the file.
|
||||
|
||||
Leave the following blank line there!! Autoheader needs it. */
|
||||
|
||||
|
||||
/* Other stuff */
|
||||
#undef HAVE_IPC_H
|
||||
#undef HAVE_SHM_H
|
||||
#undef HAVE_XPM
|
||||
#undef HAVE_XSHM_H
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
|
||||
#undef IPC_RMID_DEFERRED_RELEASE
|
||||
|
||||
#undef NO_FD_SET
|
||||
|
||||
#undef RESOURCE_BASE
|
||||
|
||||
#undef XINPUT_NONE
|
||||
#undef XINPUT_GXI
|
||||
#undef XINPUT_XFREE
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* Most machines will be happy with int or void. IRIX requires '...' */
|
||||
#undef SIGNAL_ARG_TYPE
|
||||
|
||||
/* #undef PACKAGE */
|
||||
/* #undef VERSION */
|
||||
|
||||
|
||||
/* Leave that blank line there!! Autoheader needs it.
|
||||
If you're adding to this file, keep in mind:
|
||||
The entries are in sort -df order: alphabetical, case insensitive,
|
||||
ignoring punctuation (such as underscores). */
|
||||
395
aclocal.m4
vendored
395
aclocal.m4
vendored
@@ -1,395 +0,0 @@
|
||||
dnl aclocal.m4 generated automatically by aclocal 1.2
|
||||
|
||||
# Do all the work for Automake. This macro actually does too much --
|
||||
# some checks are only needed if your package does certain things.
|
||||
# But this isn't really a big deal.
|
||||
|
||||
# serial 1
|
||||
|
||||
dnl Usage:
|
||||
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
|
||||
|
||||
AC_DEFUN(AM_INIT_AUTOMAKE,
|
||||
[AC_REQUIRE([AM_PROG_INSTALL])
|
||||
PACKAGE=[$1]
|
||||
AC_SUBST(PACKAGE)
|
||||
VERSION=[$2]
|
||||
AC_SUBST(VERSION)
|
||||
dnl test to see if srcdir already configured
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
|
||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||
fi
|
||||
ifelse([$3],,
|
||||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
|
||||
AM_SANITY_CHECK
|
||||
AC_ARG_PROGRAM
|
||||
dnl FIXME This is truly gross.
|
||||
missing_dir=`cd $ac_aux_dir && pwd`
|
||||
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
|
||||
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
|
||||
AC_PROG_MAKE_SET])
|
||||
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_PROG_INSTALL,
|
||||
[AC_REQUIRE([AC_PROG_INSTALL])
|
||||
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
|
||||
AC_SUBST(INSTALL_SCRIPT)dnl
|
||||
])
|
||||
|
||||
#
|
||||
# Check to make sure that the build environment is sane.
|
||||
#
|
||||
|
||||
AC_DEFUN(AM_SANITY_CHECK,
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
echo timestamp > conftestfile
|
||||
# Do `set' in a subshell so we don't clobber the current shell's
|
||||
# arguments. Must try -L first in case configure is actually a
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
|
||||
if test "$@" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t $srcdir/configure conftestfile`
|
||||
fi
|
||||
test "[$]2" = conftestfile
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
rm -f conftest*
|
||||
AC_MSG_RESULT(yes)])
|
||||
|
||||
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
|
||||
dnl The program must properly implement --version.
|
||||
AC_DEFUN(AM_MISSING_PROG,
|
||||
[AC_MSG_CHECKING(for working $2)
|
||||
# Run test in a subshell; some versions of sh will print an error if
|
||||
# an executable is not found, even if stderr is redirected.
|
||||
# Redirect stdin to placate older versions of autoconf. Sigh.
|
||||
if ($2 --version) < /dev/null > /dev/null 2>&1; then
|
||||
$1=$2
|
||||
AC_MSG_RESULT(found)
|
||||
else
|
||||
$1="$3/missing $2"
|
||||
AC_MSG_RESULT(missing)
|
||||
fi
|
||||
AC_SUBST($1)])
|
||||
|
||||
# Like AC_CONFIG_HEADER, but automatically create stamp file.
|
||||
|
||||
AC_DEFUN(AM_CONFIG_HEADER,
|
||||
[AC_PREREQ([2.12])
|
||||
AC_CONFIG_HEADER([$1])
|
||||
dnl When config.status generates a header, we must update the stamp-h file.
|
||||
dnl This file resides in the same directory as the config header
|
||||
dnl that is generated. We must strip everything past the first ":",
|
||||
dnl and everything past the last "/".
|
||||
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
|
||||
ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
|
||||
<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
|
||||
<<am_indx=1
|
||||
for am_file in <<$1>>; do
|
||||
case " <<$>>CONFIG_HEADERS " in
|
||||
*" <<$>>am_file "*<<)>>
|
||||
echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
|
||||
;;
|
||||
esac
|
||||
am_indx=`expr "<<$>>am_indx" + 1`
|
||||
done<<>>dnl>>)
|
||||
changequote([,]))])
|
||||
|
||||
|
||||
# serial 17 AM_PROG_LIBTOOL
|
||||
AC_DEFUN(AM_PROG_LIBTOOL,
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_REQUIRE([AC_PROG_RANLIB])
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_REQUIRE([AM_PROG_LD])
|
||||
AC_REQUIRE([AM_PROG_NM])
|
||||
AC_REQUIRE([AC_PROG_LN_S])
|
||||
|
||||
# Always use our own libtool.
|
||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
||||
AC_SUBST(LIBTOOL)
|
||||
|
||||
dnl Allow the --disable-shared flag to stop us from building shared libs.
|
||||
AC_ARG_ENABLE(shared,
|
||||
[ --enable-shared build shared libraries [default=yes]],
|
||||
[if test "$enableval" = no; then
|
||||
libtool_enable_shared=no
|
||||
else
|
||||
libtool_enable_shared=yes
|
||||
fi])
|
||||
test -n "$libtool_enable_shared" && enable_shared="$libtool_enable_shared"
|
||||
libtool_shared=
|
||||
test "$enable_shared" = no && libtool_shared=" --disable-shared"
|
||||
|
||||
dnl Allow the --disable-static flag to stop us from building static libs.
|
||||
AC_ARG_ENABLE(static,
|
||||
[ --enable-static build static libraries [default=yes]],
|
||||
[if test "$enableval" = no; then
|
||||
libtool_enable_static=no
|
||||
else
|
||||
libtool_enable_static=yes
|
||||
fi])
|
||||
test -n "$libtool_enable_static" && enable_static="$libtool_enable_static"
|
||||
libtool_static=
|
||||
test "$enable_static" = no && libtool_static=" --disable-static"
|
||||
|
||||
libtool_flags="$libtool_shared$libtool_static"
|
||||
test "$silent" = yes && libtool_flags="$libtool_flags --silent"
|
||||
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
|
||||
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
|
||||
|
||||
# Some flags need to be propagated to the compiler or linker for good
|
||||
# libtool support.
|
||||
[case "$host" in
|
||||
*-*-irix6*)
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
flag_passed=no
|
||||
for f in -32 -64 -n32 ABI -cckr -mips1 -mips2 -mips3 -mips4; do
|
||||
case "$f" in
|
||||
ABI)
|
||||
test -n "$SGI_ABI" && flag_passed=yes
|
||||
if test "$flag_passed" = no && test "$ac_cv_prog_gcc" = yes; then
|
||||
# Choose the ABI flag according to GCC's specs.
|
||||
if $CC -dumpspecs 2>&1 | sed '/^\*link:$/,/^$/!d' | egrep -e '[ ]-32' >/dev/null; then
|
||||
LD="${LD-ld} -32"
|
||||
else
|
||||
LD="${LD-ld} -n32"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
if echo " $CC $CFLAGS " | egrep -e "[ ]$f[ ]" > /dev/null; then
|
||||
flag_passed=yes
|
||||
LD="${LD-ld} $f"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
;;
|
||||
|
||||
*-*-sco3.2v5*)
|
||||
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
|
||||
CFLAGS="$CFLAGS -belf"
|
||||
;;
|
||||
esac]
|
||||
|
||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
|
||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
|
||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|
||||
|| AC_MSG_ERROR([libtool configure failed])
|
||||
])
|
||||
|
||||
# AM_PROG_LD - find the path to the GNU or non-GNU linker
|
||||
AC_DEFUN(AM_PROG_LD,
|
||||
[AC_ARG_WITH(gnu-ld,
|
||||
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
||||
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
ac_prog=ld
|
||||
if test "$ac_cv_prog_gcc" = yes; then
|
||||
# Check if gcc -print-prog-name=ld gives a path.
|
||||
AC_MSG_CHECKING([for ld used by GCC])
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5`
|
||||
case "$ac_prog" in
|
||||
# Accept absolute paths.
|
||||
/*)
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
"")
|
||||
# If it fails, then pretend we aren't using GCC.
|
||||
ac_prog=ld
|
||||
;;
|
||||
*)
|
||||
# If it is relative, then search for the first ld in PATH.
|
||||
with_gnu_ld=unknown
|
||||
;;
|
||||
esac
|
||||
elif test "$with_gnu_ld" = yes; then
|
||||
AC_MSG_CHECKING([for GNU ld])
|
||||
else
|
||||
AC_MSG_CHECKING([for non-GNU ld])
|
||||
fi
|
||||
AC_CACHE_VAL(ac_cv_path_LD,
|
||||
[if test -z "$LD"; then
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f "$ac_dir/$ac_prog"; then
|
||||
ac_cv_path_LD="$ac_dir/$ac_prog"
|
||||
# Check to see if the program is GNU ld. I'd rather use --version,
|
||||
# but apparently some GNU ld's only accept -v.
|
||||
# Break only if it was the GNU/non-GNU ld that we prefer.
|
||||
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
|
||||
test "$with_gnu_ld" != no && break
|
||||
else
|
||||
test "$with_gnu_ld" != yes && break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
else
|
||||
ac_cv_path_LD="$LD" # Let the user override the test with a path.
|
||||
fi])
|
||||
LD="$ac_cv_path_LD"
|
||||
if test -n "$LD"; then
|
||||
AC_MSG_RESULT($LD)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||
AC_SUBST(LD)
|
||||
AM_PROG_LD_GNU
|
||||
])
|
||||
|
||||
AC_DEFUN(AM_PROG_LD_GNU,
|
||||
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
|
||||
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
||||
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
||||
ac_cv_prog_gnu_ld=yes
|
||||
else
|
||||
ac_cv_prog_gnu_ld=no
|
||||
fi])
|
||||
])
|
||||
|
||||
# AM_PROG_NM - find the path to a BSD-compatible name lister
|
||||
AC_DEFUN(AM_PROG_NM,
|
||||
[AC_MSG_CHECKING([for BSD-compatible nm])
|
||||
AC_CACHE_VAL(ac_cv_path_NM,
|
||||
[case "$NM" in
|
||||
/*)
|
||||
ac_cv_path_NM="$NM" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in /usr/ucb $PATH /bin; do
|
||||
test -z "$ac_dir" && dir=.
|
||||
if test -f $ac_dir/nm; then
|
||||
# Check to see if the nm accepts a BSD-compat flag.
|
||||
if ($ac_dir/nm -B /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -B"
|
||||
elif ($ac_dir/nm -p /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -p"
|
||||
else
|
||||
ac_cv_path_NM="$ac_dir/nm"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
|
||||
;;
|
||||
esac])
|
||||
NM="$ac_cv_path_NM"
|
||||
AC_MSG_RESULT([$NM])
|
||||
AC_SUBST(NM)
|
||||
])
|
||||
|
||||
# Add --enable-maintainer-mode option to configure.
|
||||
# From Jim Meyering
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_MAINTAINER_MODE,
|
||||
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
||||
dnl maintainer-mode is disabled by default
|
||||
AC_ARG_ENABLE(maintainer-mode,
|
||||
[ --enable-maintainer-mode enable make rules and dependencies not useful
|
||||
(and sometimes confusing) to the casual installer],
|
||||
USE_MAINTAINER_MODE=$enableval,
|
||||
USE_MAINTAINER_MODE=no)
|
||||
AC_MSG_RESULT($USE_MAINTAINER_MODE)
|
||||
if test $USE_MAINTAINER_MODE = yes; then
|
||||
MAINT=
|
||||
else
|
||||
MAINT='#M#'
|
||||
fi
|
||||
AC_SUBST(MAINT)dnl
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
# serial 1
|
||||
|
||||
# @defmac AC_PROG_CC_STDC
|
||||
# @maindex PROG_CC_STDC
|
||||
# @ovindex CC
|
||||
# If the C compiler in not in ANSI C mode by default, try to add an option
|
||||
# to output variable @code{CC} to make it so. This macro tries various
|
||||
# options that select ANSI C on some system or another. It considers the
|
||||
# compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
|
||||
# handles function prototypes correctly.
|
||||
#
|
||||
# If you use this macro, you should check after calling it whether the C
|
||||
# compiler has been set to accept ANSI C; if not, the shell variable
|
||||
# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
|
||||
# code in ANSI C, you can make an un-ANSIfied copy of it by using the
|
||||
# program @code{ansi2knr}, which comes with Ghostscript.
|
||||
# @end defmac
|
||||
|
||||
AC_DEFUN(AM_PROG_CC_STDC,
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_BEFORE([$0], [AC_C_INLINE])
|
||||
AC_BEFORE([$0], [AC_C_CONST])
|
||||
AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
|
||||
AC_CACHE_VAL(am_cv_prog_cc_stdc,
|
||||
[am_cv_prog_cc_stdc=no
|
||||
ac_save_CC="$CC"
|
||||
# Don't try gcc -ansi; that turns off useful extensions and
|
||||
# breaks some systems' header files.
|
||||
# AIX -qlanglvl=ansi
|
||||
# Ultrix and OSF/1 -std1
|
||||
# HP-UX -Aa -D_HPUX_SOURCE
|
||||
# SVR4 -Xc -D__EXTENSIONS__
|
||||
for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
|
||||
do
|
||||
CC="$ac_save_CC $ac_arg"
|
||||
AC_TRY_COMPILE(
|
||||
[#if !defined(__STDC__) || __STDC__ != 1
|
||||
choke me
|
||||
#endif
|
||||
/* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
|
||||
#ifdef _SEQUENT_
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
], [
|
||||
int test (int i, double x);
|
||||
struct s1 {int (*f) (int a);};
|
||||
struct s2 {int (*f) (double a);};],
|
||||
[am_cv_prog_cc_stdc="$ac_arg"; break])
|
||||
done
|
||||
CC="$ac_save_CC"
|
||||
])
|
||||
if test -z "$am_cv_prog_cc_stdc"; then
|
||||
AC_MSG_RESULT([none needed])
|
||||
else
|
||||
AC_MSG_RESULT($am_cv_prog_cc_stdc)
|
||||
fi
|
||||
case "x$am_cv_prog_cc_stdc" in
|
||||
x|xno) ;;
|
||||
*) CC="$CC $am_cv_prog_cc_stdc" ;;
|
||||
esac
|
||||
])
|
||||
|
||||
883
config.guess
vendored
883
config.guess
vendored
@@ -1,883 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
#
|
||||
# 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.
|
||||
|
||||
# Written by Per Bothner <bothner@cygnus.com>.
|
||||
# The master version of this file is at the FSF in /home/gd/gnu/lib.
|
||||
#
|
||||
# This script attempts to guess a canonical system name similar to
|
||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||
# exits with 0. Otherwise, it exits with 1.
|
||||
#
|
||||
# The plan is that this can be called by configure scripts if you
|
||||
# don't specify an explicit system type (host/target name).
|
||||
#
|
||||
# Only a few systems have been added to this list; please add others
|
||||
# (but try to keep the structure clean).
|
||||
#
|
||||
|
||||
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
|
||||
# (ghazi@noc.rutgers.edu 8/24/94.)
|
||||
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
|
||||
PATH=$PATH:/.attbin ; export PATH
|
||||
fi
|
||||
|
||||
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
|
||||
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
||||
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
||||
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||
|
||||
trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
|
||||
|
||||
# Note: order is significant - the case branches are not exclusive.
|
||||
|
||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
alpha:OSF1:*:*)
|
||||
if test $UNAME_RELEASE = "V4.0"; then
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
||||
fi
|
||||
# A Vn.n version is a released version.
|
||||
# A Tn.n version is a released field test version.
|
||||
# A Xn.n version is an unreleased experimental baselevel.
|
||||
# 1.2 uses "1.2" for uname -r.
|
||||
cat <<EOF >dummy.s
|
||||
.globl main
|
||||
.ent main
|
||||
main:
|
||||
.frame \$30,0,\$26,0
|
||||
.prologue 0
|
||||
.long 0x47e03d80 # implver $0
|
||||
lda \$2,259
|
||||
.long 0x47e20c21 # amask $2,$1
|
||||
srl \$1,8,\$2
|
||||
sll \$2,2,\$2
|
||||
sll \$0,3,\$0
|
||||
addl \$1,\$0,\$0
|
||||
addl \$2,\$0,\$0
|
||||
ret \$31,(\$26),1
|
||||
.end main
|
||||
EOF
|
||||
${CC-cc} dummy.s -o dummy 2>/dev/null
|
||||
if test "$?" = 0 ; then
|
||||
./dummy
|
||||
case "$?" in
|
||||
7)
|
||||
UNAME_MACHINE="alpha"
|
||||
;;
|
||||
15)
|
||||
UNAME_MACHINE="alphaev5"
|
||||
;;
|
||||
14)
|
||||
UNAME_MACHINE="alphaev56"
|
||||
;;
|
||||
10)
|
||||
UNAME_MACHINE="alphapca56"
|
||||
;;
|
||||
16)
|
||||
UNAME_MACHINE="alphaev6"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -f dummy.s dummy
|
||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
|
||||
exit 0 ;;
|
||||
21064:Windows_NT:50:3)
|
||||
echo alpha-dec-winnt3.5
|
||||
exit 0 ;;
|
||||
Amiga*:UNIX_System_V:4.0:*)
|
||||
echo m68k-cbm-sysv4
|
||||
exit 0;;
|
||||
amiga:NetBSD:*:*)
|
||||
echo m68k-cbm-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
amiga:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arc64:OpenBSD:*:*)
|
||||
echo mips64el-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
hkmips:OpenBSD:*:*)
|
||||
echo mips-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
pmax:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sgi:OpenBSD:*:*)
|
||||
echo mips-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
wgrisc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||
exit 0;;
|
||||
arm32:NetBSD:*:*)
|
||||
echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
SR2?01:HI-UX/MPP:*:*)
|
||||
echo hppa1.1-hitachi-hiuxmpp
|
||||
exit 0;;
|
||||
Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
|
||||
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
|
||||
if test "`(/bin/universe) 2>/dev/null`" = att ; then
|
||||
echo pyramid-pyramid-sysv3
|
||||
else
|
||||
echo pyramid-pyramid-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
NILE:*:*:dcosx)
|
||||
echo pyramid-pyramid-svr4
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
|
||||
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
i86pc:SunOS:5.*:*)
|
||||
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:6*:*)
|
||||
# According to config.sub, this is the proper way to canonicalize
|
||||
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
|
||||
# it's likely to be more like Solaris than SunOS4.
|
||||
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:*:*)
|
||||
case "`/usr/bin/arch -k`" in
|
||||
Series*|S4*)
|
||||
UNAME_RELEASE=`uname -v`
|
||||
;;
|
||||
esac
|
||||
# Japanese Language versions have a version number like `4.1.3-JL'.
|
||||
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
|
||||
exit 0 ;;
|
||||
sun3*:SunOS:*:*)
|
||||
echo m68k-sun-sunos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun*:*:4.2BSD:*)
|
||||
UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
|
||||
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
|
||||
case "`/bin/arch`" in
|
||||
sun3)
|
||||
echo m68k-sun-sunos${UNAME_RELEASE}
|
||||
;;
|
||||
sun4)
|
||||
echo sparc-sun-sunos${UNAME_RELEASE}
|
||||
;;
|
||||
esac
|
||||
exit 0 ;;
|
||||
aushp:SunOS:*:*)
|
||||
echo sparc-auspex-sunos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
atari*:NetBSD:*:*)
|
||||
echo m68k-atari-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
atari*:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3*:NetBSD:*:*)
|
||||
echo m68k-sun-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3*:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:NetBSD:*:*)
|
||||
echo m68k-apple-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mvme68k:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mvme88k:OpenBSD:*:*)
|
||||
echo m88k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
powerpc:machten:*:*)
|
||||
echo powerpc-apple-machten${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
RISC*:Mach:*:*)
|
||||
echo mips-dec-mach_bsd4.3
|
||||
exit 0 ;;
|
||||
RISC*:ULTRIX:*:*)
|
||||
echo mips-dec-ultrix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
VAX*:ULTRIX*:*:*)
|
||||
echo vax-dec-ultrix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
2020:CLIX:*:*)
|
||||
echo clipper-intergraph-clix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mips:*:*:UMIPS | mips:*:*:RISCos)
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
int main (argc, argv) int argc; char **argv; {
|
||||
#if defined (host_mips) && defined (MIPSEB)
|
||||
#if defined (SYSTYPE_SYSV)
|
||||
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
|
||||
#endif
|
||||
#if defined (SYSTYPE_SVR4)
|
||||
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
|
||||
#endif
|
||||
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
|
||||
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
exit (-1);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy \
|
||||
&& ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
|
||||
&& rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo mips-mips-riscos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
Night_Hawk:Power_UNIX:*:*)
|
||||
echo powerpc-harris-powerunix
|
||||
exit 0 ;;
|
||||
m88k:CX/UX:7*:*)
|
||||
echo m88k-harris-cxux7
|
||||
exit 0 ;;
|
||||
m88k:*:4*:R4*)
|
||||
echo m88k-motorola-sysv4
|
||||
exit 0 ;;
|
||||
m88k:*:3*:R3*)
|
||||
echo m88k-motorola-sysv3
|
||||
exit 0 ;;
|
||||
AViiON:dgux:*:*)
|
||||
# DG/UX returns AViiON for all architectures
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
|
||||
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
|
||||
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
|
||||
echo m88k-dg-dgux${UNAME_RELEASE}
|
||||
else
|
||||
echo m88k-dg-dguxbcs${UNAME_RELEASE}
|
||||
fi
|
||||
else echo i586-dg-dgux${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
|
||||
echo m88k-dolphin-sysv3
|
||||
exit 0 ;;
|
||||
M88*:*:R3*:*)
|
||||
# Delta 88k system running SVR3
|
||||
echo m88k-motorola-sysv3
|
||||
exit 0 ;;
|
||||
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
|
||||
echo m88k-tektronix-sysv3
|
||||
exit 0 ;;
|
||||
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
|
||||
echo m68k-tektronix-bsd
|
||||
exit 0 ;;
|
||||
*:IRIX*:*:*)
|
||||
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
|
||||
exit 0 ;;
|
||||
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
|
||||
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
|
||||
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
|
||||
i?86:AIX:*:*)
|
||||
echo i386-ibm-aix
|
||||
exit 0 ;;
|
||||
*:AIX:2:3)
|
||||
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
#include <sys/systemcfg.h>
|
||||
|
||||
main()
|
||||
{
|
||||
if (!__power_pc())
|
||||
exit(1);
|
||||
puts("powerpc-ibm-aix3.2.5");
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo rs6000-ibm-aix3.2.5
|
||||
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
echo rs6000-ibm-aix3.2.4
|
||||
else
|
||||
echo rs6000-ibm-aix3.2
|
||||
fi
|
||||
exit 0 ;;
|
||||
*:AIX:*:4)
|
||||
if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
|
||||
IBM_ARCH=rs6000
|
||||
else
|
||||
IBM_ARCH=powerpc
|
||||
fi
|
||||
if [ -x /usr/bin/oslevel ] ; then
|
||||
IBM_REV=`/usr/bin/oslevel`
|
||||
else
|
||||
IBM_REV=4.${UNAME_RELEASE}
|
||||
fi
|
||||
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
|
||||
exit 0 ;;
|
||||
*:AIX:*:*)
|
||||
echo rs6000-ibm-aix
|
||||
exit 0 ;;
|
||||
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
|
||||
echo romp-ibm-bsd4.4
|
||||
exit 0 ;;
|
||||
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
|
||||
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
|
||||
exit 0 ;; # report: romp-ibm BSD 4.3
|
||||
*:BOSX:*:*)
|
||||
echo rs6000-bull-bosx
|
||||
exit 0 ;;
|
||||
DPX/2?00:B.O.S.:*:*)
|
||||
echo m68k-bull-sysv3
|
||||
exit 0 ;;
|
||||
9000/[34]??:4.3bsd:1.*:*)
|
||||
echo m68k-hp-bsd
|
||||
exit 0 ;;
|
||||
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
|
||||
echo m68k-hp-bsd4.4
|
||||
exit 0 ;;
|
||||
9000/[3478]??:HP-UX:*:*)
|
||||
case "${UNAME_MACHINE}" in
|
||||
9000/31? ) HP_ARCH=m68000 ;;
|
||||
9000/[34]?? ) HP_ARCH=m68k ;;
|
||||
9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
|
||||
9000/8?? ) HP_ARCH=hppa1.0 ;;
|
||||
esac
|
||||
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
|
||||
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
|
||||
exit 0 ;;
|
||||
3050*:HI-UX:*:*)
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
#include <unistd.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
long cpu = sysconf (_SC_CPU_VERSION);
|
||||
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
|
||||
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
|
||||
results, however. */
|
||||
if (CPU_IS_PA_RISC (cpu))
|
||||
{
|
||||
switch (cpu)
|
||||
{
|
||||
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
|
||||
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
|
||||
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
|
||||
default: puts ("hppa-hitachi-hiuxwe2"); break;
|
||||
}
|
||||
}
|
||||
else if (CPU_IS_HP_MC68K (cpu))
|
||||
puts ("m68k-hitachi-hiuxwe2");
|
||||
else puts ("unknown-hitachi-hiuxwe2");
|
||||
exit (0);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo unknown-hitachi-hiuxwe2
|
||||
exit 0 ;;
|
||||
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
|
||||
echo hppa1.1-hp-bsd
|
||||
exit 0 ;;
|
||||
9000/8??:4.3bsd:*:*)
|
||||
echo hppa1.0-hp-bsd
|
||||
exit 0 ;;
|
||||
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
|
||||
echo hppa1.1-hp-osf
|
||||
exit 0 ;;
|
||||
hp8??:OSF1:*:*)
|
||||
echo hppa1.0-hp-osf
|
||||
exit 0 ;;
|
||||
i?86:OSF1:*:*)
|
||||
if [ -x /usr/sbin/sysversion ] ; then
|
||||
echo ${UNAME_MACHINE}-unknown-osf1mk
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-osf1
|
||||
fi
|
||||
exit 0 ;;
|
||||
parisc*:Lites*:*:*)
|
||||
echo hppa1.1-hp-lites
|
||||
exit 0 ;;
|
||||
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
||||
echo c1-convex-bsd
|
||||
exit 0 ;;
|
||||
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
|
||||
if getsysinfo -f scalar_acc
|
||||
then echo c32-convex-bsd
|
||||
else echo c2-convex-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
|
||||
echo c34-convex-bsd
|
||||
exit 0 ;;
|
||||
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
|
||||
echo c38-convex-bsd
|
||||
exit 0 ;;
|
||||
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
|
||||
echo c4-convex-bsd
|
||||
exit 0 ;;
|
||||
CRAY*X-MP:*:*:*)
|
||||
echo xmp-cray-unicos
|
||||
exit 0 ;;
|
||||
CRAY*Y-MP:*:*:*)
|
||||
echo ymp-cray-unicos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
CRAY*[A-Z]90:*:*:*)
|
||||
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
|
||||
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
|
||||
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
||||
exit 0 ;;
|
||||
CRAY*TS:*:*:*)
|
||||
echo t90-cray-unicos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
CRAY-2:*:*:*)
|
||||
echo cray2-cray-unicos
|
||||
exit 0 ;;
|
||||
F300:UNIX_System_V:*:*)
|
||||
FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||
echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit 0 ;;
|
||||
F301:UNIX_System_V:*:*)
|
||||
echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
|
||||
exit 0 ;;
|
||||
hp3[0-9][05]:NetBSD:*:*)
|
||||
echo m68k-hp-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
hp300:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i?86:BSD/386:*:* | *:BSD/OS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:FreeBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
exit 0 ;;
|
||||
*:NetBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
*:OpenBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
i*:CYGWIN*:*)
|
||||
echo i386-pc-cygwin32
|
||||
exit 0 ;;
|
||||
i*:MINGW*:*)
|
||||
echo i386-pc-mingw32
|
||||
exit 0 ;;
|
||||
p*:CYGWIN*:*)
|
||||
echo powerpcle-unknown-cygwin32
|
||||
exit 0 ;;
|
||||
prep*:SunOS:5.*:*)
|
||||
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
*:GNU:*:*)
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
exit 0 ;;
|
||||
*:Linux:*:*)
|
||||
# The BFD linker knows what the default object file format is, so
|
||||
# first see if it will tell us.
|
||||
ld_help_string=`ld --help 2>&1`
|
||||
ld_supported_emulations=`echo $ld_help_string \
|
||||
| sed -ne '/supported emulations:/!d
|
||||
s/[ ][ ]*/ /g
|
||||
s/.*supported emulations: *//
|
||||
s/ .*//
|
||||
p'`
|
||||
case "$ld_supported_emulations" in
|
||||
i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
|
||||
i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
|
||||
sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
|
||||
m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
|
||||
elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;;
|
||||
esac
|
||||
|
||||
if test "${UNAME_MACHINE}" = "alpha" ; then
|
||||
sed 's/^ //' <<EOF >dummy.s
|
||||
.globl main
|
||||
.ent main
|
||||
main:
|
||||
.frame \$30,0,\$26,0
|
||||
.prologue 0
|
||||
.long 0x47e03d80 # implver $0
|
||||
lda \$2,259
|
||||
.long 0x47e20c21 # amask $2,$1
|
||||
srl \$1,8,\$2
|
||||
sll \$2,2,\$2
|
||||
sll \$0,3,\$0
|
||||
addl \$1,\$0,\$0
|
||||
addl \$2,\$0,\$0
|
||||
ret \$31,(\$26),1
|
||||
.end main
|
||||
EOF
|
||||
LIBC=""
|
||||
${CC-cc} dummy.s -o dummy 2>/dev/null
|
||||
if test "$?" = 0 ; then
|
||||
./dummy
|
||||
case "$?" in
|
||||
7)
|
||||
UNAME_MACHINE="alpha"
|
||||
;;
|
||||
15)
|
||||
UNAME_MACHINE="alphaev5"
|
||||
;;
|
||||
14)
|
||||
UNAME_MACHINE="alphaev56"
|
||||
;;
|
||||
10)
|
||||
UNAME_MACHINE="alphapca56"
|
||||
;;
|
||||
16)
|
||||
UNAME_MACHINE="alphaev6"
|
||||
;;
|
||||
esac
|
||||
|
||||
objdump --private-headers dummy | \
|
||||
grep ld.so.1 > /dev/null
|
||||
if test "$?" = 0 ; then
|
||||
LIBC="libc1"
|
||||
fi
|
||||
fi
|
||||
rm -f dummy.s dummy
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
|
||||
elif test "${UNAME_MACHINE}" = "mips" ; then
|
||||
cat >dummy.c <<EOF
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
#ifdef __MIPSEB__
|
||||
printf ("%s-unknown-linux-gnu\n", argv[1]);
|
||||
#endif
|
||||
#ifdef __MIPSEL__
|
||||
printf ("%sel-unknown-linux-gnu\n", argv[1]);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
else
|
||||
# Either a pre-BFD a.out linker (linux-gnuoldld)
|
||||
# or one that does not give us useful --help.
|
||||
# GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
|
||||
# If ld does not provide *any* "supported emulations:"
|
||||
# that means it is gnuoldld.
|
||||
echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
|
||||
test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
|
||||
|
||||
case "${UNAME_MACHINE}" in
|
||||
i?86)
|
||||
VENDOR=pc;
|
||||
;;
|
||||
*)
|
||||
VENDOR=unknown;
|
||||
;;
|
||||
esac
|
||||
# Determine whether the default compiler is a.out or elf
|
||||
cat >dummy.c <<EOF
|
||||
#include <features.h>
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
#ifdef __ELF__
|
||||
# ifdef __GLIBC__
|
||||
# if __GLIBC__ >= 2
|
||||
printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
|
||||
# else
|
||||
printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
|
||||
# endif
|
||||
# else
|
||||
printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
|
||||
# endif
|
||||
#else
|
||||
printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
fi ;;
|
||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
|
||||
# are messed up and put the nodename in both sysname and nodename.
|
||||
i?86:DYNIX/ptx:4*:*)
|
||||
echo i386-sequent-sysv4
|
||||
exit 0 ;;
|
||||
i?86:UNIX_SV:4.2MP:2.*)
|
||||
# Unixware is an offshoot of SVR4, but it has its own version
|
||||
# number series starting with 2...
|
||||
# I am not positive that other SVR4 systems won't match this,
|
||||
# I just have to hope. -- rms.
|
||||
# Use sysv4.2uw... so that sysv4* matches it.
|
||||
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
|
||||
exit 0 ;;
|
||||
i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
|
||||
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
|
||||
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
|
||||
else
|
||||
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
i?86:*:3.2:*)
|
||||
if test -f /usr/options/cb.name; then
|
||||
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
|
||||
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
|
||||
elif /bin/uname -X 2>/dev/null >/dev/null ; then
|
||||
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
|
||||
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
|
||||
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
|
||||
&& UNAME_MACHINE=i586
|
||||
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
|
||||
else
|
||||
echo ${UNAME_MACHINE}-pc-sysv32
|
||||
fi
|
||||
exit 0 ;;
|
||||
pc:*:*:*)
|
||||
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
||||
# the processor, so we play safe by assuming i386.
|
||||
echo i386-pc-msdosdjgpp
|
||||
exit 0 ;;
|
||||
Intel:Mach:3*:*)
|
||||
echo i386-pc-mach3
|
||||
exit 0 ;;
|
||||
paragon:*:*:*)
|
||||
echo i860-intel-osf1
|
||||
exit 0 ;;
|
||||
i860:*:4.*:*) # i860-SVR4
|
||||
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
|
||||
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
|
||||
else # Add other i860-SVR4 vendors below as they are discovered.
|
||||
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
|
||||
fi
|
||||
exit 0 ;;
|
||||
mini*:CTIX:SYS*5:*)
|
||||
# "miniframe"
|
||||
echo m68010-convergent-sysv
|
||||
exit 0 ;;
|
||||
M68*:*:R3V[567]*:*)
|
||||
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
|
||||
3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
|
||||
OS_REL=''
|
||||
test -r /etc/.relid \
|
||||
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
|
||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& echo i486-ncr-sysv4.3${OS_REL} && exit 0
|
||||
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
||||
&& echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
|
||||
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& echo i486-ncr-sysv4 && exit 0 ;;
|
||||
m68*:LynxOS:2.*:*)
|
||||
echo m68k-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mc68030:UNIX_System_V:4.*:*)
|
||||
echo m68k-atari-sysv4
|
||||
exit 0 ;;
|
||||
i?86:LynxOS:2.*:*)
|
||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
TSUNAMI:LynxOS:2.*:*)
|
||||
echo sparc-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
|
||||
echo rs6000-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
SM[BE]S:UNIX_SV:*:*)
|
||||
echo mips-dde-sysv${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
RM*:SINIX-*:*:*)
|
||||
echo mips-sni-sysv4
|
||||
exit 0 ;;
|
||||
*:SINIX-*:*:*)
|
||||
if uname -p 2>/dev/null >/dev/null ; then
|
||||
UNAME_MACHINE=`(uname -p) 2>/dev/null`
|
||||
echo ${UNAME_MACHINE}-sni-sysv4
|
||||
else
|
||||
echo ns32k-sni-sysv
|
||||
fi
|
||||
exit 0 ;;
|
||||
PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||
echo i586-unisys-sysv4
|
||||
exit 0 ;;
|
||||
*:UNIX_System_V:4*:FTX*)
|
||||
# From Gerald Hewes <hewes@openmarket.com>.
|
||||
# How about differentiating between stratus architectures? -djm
|
||||
echo hppa1.1-stratus-sysv4
|
||||
exit 0 ;;
|
||||
*:*:*:FTX*)
|
||||
# From seanf@swdc.stratus.com.
|
||||
echo i860-stratus-sysv4
|
||||
exit 0 ;;
|
||||
mc68*:A/UX:*:*)
|
||||
echo m68k-apple-aux${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
news*:NEWS-OS:*:6*)
|
||||
echo mips-sony-newsos6
|
||||
exit 0 ;;
|
||||
R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
|
||||
if [ -d /usr/nec ]; then
|
||||
echo mips-nec-sysv${UNAME_RELEASE}
|
||||
else
|
||||
echo mips-unknown-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
||||
|
||||
cat >dummy.c <<EOF
|
||||
#ifdef _SEQUENT_
|
||||
# include <sys/types.h>
|
||||
# include <sys/utsname.h>
|
||||
#endif
|
||||
main ()
|
||||
{
|
||||
#if defined (sony)
|
||||
#if defined (MIPSEB)
|
||||
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
|
||||
I don't know.... */
|
||||
printf ("mips-sony-bsd\n"); exit (0);
|
||||
#else
|
||||
#include <sys/param.h>
|
||||
printf ("m68k-sony-newsos%s\n",
|
||||
#ifdef NEWSOS4
|
||||
"4"
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__arm) && defined (__acorn) && defined (__unix)
|
||||
printf ("arm-acorn-riscix"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (hp300) && !defined (hpux)
|
||||
printf ("m68k-hp-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (NeXT)
|
||||
#if !defined (__ARCHITECTURE__)
|
||||
#define __ARCHITECTURE__ "m68k"
|
||||
#endif
|
||||
int version;
|
||||
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
|
||||
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
|
||||
exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (MULTIMAX) || defined (n16)
|
||||
#if defined (UMAXV)
|
||||
printf ("ns32k-encore-sysv\n"); exit (0);
|
||||
#else
|
||||
#if defined (CMU)
|
||||
printf ("ns32k-encore-mach\n"); exit (0);
|
||||
#else
|
||||
printf ("ns32k-encore-bsd\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__386BSD__)
|
||||
printf ("i386-pc-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (sequent)
|
||||
#if defined (i386)
|
||||
printf ("i386-sequent-dynix\n"); exit (0);
|
||||
#endif
|
||||
#if defined (ns32000)
|
||||
printf ("ns32k-sequent-dynix\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (_SEQUENT_)
|
||||
struct utsname un;
|
||||
|
||||
uname(&un);
|
||||
|
||||
if (strncmp(un.version, "V2", 2) == 0) {
|
||||
printf ("i386-sequent-ptx2\n"); exit (0);
|
||||
}
|
||||
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
|
||||
printf ("i386-sequent-ptx1\n"); exit (0);
|
||||
}
|
||||
printf ("i386-sequent-ptx\n"); exit (0);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined (vax)
|
||||
#if !defined (ultrix)
|
||||
printf ("vax-dec-bsd\n"); exit (0);
|
||||
#else
|
||||
printf ("vax-dec-ultrix\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (alliant) && defined (i860)
|
||||
printf ("i860-alliant-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
exit (1);
|
||||
}
|
||||
EOF
|
||||
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
|
||||
# Apollos put the system type in the environment.
|
||||
|
||||
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
|
||||
|
||||
# Convex versions that predate uname can use getsysinfo(1)
|
||||
|
||||
if [ -x /usr/convex/getsysinfo ]
|
||||
then
|
||||
case `getsysinfo -f cpu_type` in
|
||||
c1*)
|
||||
echo c1-convex-bsd
|
||||
exit 0 ;;
|
||||
c2*)
|
||||
if getsysinfo -f scalar_acc
|
||||
then echo c32-convex-bsd
|
||||
else echo c2-convex-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
c34*)
|
||||
echo c34-convex-bsd
|
||||
exit 0 ;;
|
||||
c38*)
|
||||
echo c38-convex-bsd
|
||||
exit 0 ;;
|
||||
c4*)
|
||||
echo c4-convex-bsd
|
||||
exit 0 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
#echo '(Unable to guess system type)' 1>&2
|
||||
|
||||
exit 1
|
||||
36
config.h.in
36
config.h.in
@@ -1,36 +0,0 @@
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
#undef const
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define if the X Window System is missing or not being used. */
|
||||
#undef X_DISPLAY_MISSING
|
||||
|
||||
/* Other stuff */
|
||||
#undef HAVE_IPC_H
|
||||
#undef HAVE_SHM_H
|
||||
#undef HAVE_XPM
|
||||
#undef HAVE_XSHM_H
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
|
||||
#undef IPC_RMID_DEFERRED_RELEASE
|
||||
|
||||
#undef NO_FD_SET
|
||||
|
||||
#undef RESOURCE_BASE
|
||||
|
||||
#undef XINPUT_NONE
|
||||
#undef XINPUT_GXI
|
||||
#undef XINPUT_XFREE
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* #undef PACKAGE */
|
||||
/* #undef VERSION */
|
||||
954
config.sub
vendored
954
config.sub
vendored
@@ -1,954 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script, version 1.1.
|
||||
# Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# 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.
|
||||
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||
|
||||
# This file is supposed to be the same for all GNU packages
|
||||
# and recognize all the CPU types, system types and aliases
|
||||
# that are meaningful with *any* GNU software.
|
||||
# Each package is responsible for reporting which valid configurations
|
||||
# it does not support. The user should be able to distinguish
|
||||
# a failure to support a valid configuration from a meaningless
|
||||
# configuration.
|
||||
|
||||
# The goal of this file is to map all the various variations of a given
|
||||
# machine specification into a single specification in the form:
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or in some cases, the newer four-part form:
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# It is wrong to echo any other type of specification.
|
||||
|
||||
if [ x$1 = x ]
|
||||
then
|
||||
echo Configuration name missing. 1>&2
|
||||
echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
|
||||
echo "or $0 ALIAS" 1>&2
|
||||
echo where ALIAS is a recognized configuration type. 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# First pass through any local machine types.
|
||||
case $1 in
|
||||
*local*)
|
||||
echo $1
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
linux-gnu*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
*)
|
||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
||||
if [ $basic_machine != $1 ]
|
||||
then os=`echo $1 | sed 's/.*-/-/'`
|
||||
else os=; fi
|
||||
;;
|
||||
esac
|
||||
|
||||
### Let's recognize common machines as not being operating systems so
|
||||
### that things like config.sub decstation-3100 work. We also
|
||||
### recognize some manufacturers as not being operating systems, so we
|
||||
### can provide default operating systems below.
|
||||
case $os in
|
||||
-sun*os*)
|
||||
# Prevent following clause from handling this invalid input.
|
||||
;;
|
||||
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
|
||||
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
|
||||
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
|
||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
-sco5)
|
||||
os=sco3.2v5
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco4)
|
||||
os=-sco3.2v4
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco3.2.[4-9]*)
|
||||
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco3.2v[4-9]*)
|
||||
# Don't forget version if it is 3.2v4 or newer.
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco*)
|
||||
os=-sco3.2v2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-isc)
|
||||
os=-isc2.2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-clix*)
|
||||
basic_machine=clipper-intergraph
|
||||
;;
|
||||
-isc*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-lynx*)
|
||||
os=-lynxos
|
||||
;;
|
||||
-ptx*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
|
||||
;;
|
||||
-windowsnt*)
|
||||
os=`echo $os | sed -e 's/windowsnt/winnt/'`
|
||||
;;
|
||||
-psos*)
|
||||
os=-psos
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode aliases for certain CPU-COMPANY combinations.
|
||||
case $basic_machine in
|
||||
# Recognize the basic CPU types without company name.
|
||||
# Some are omitted here because they have special meanings below.
|
||||
tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
|
||||
| arme[lb] | pyramid | mn10200 | mn10300 \
|
||||
| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
|
||||
| alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
|
||||
| i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
|
||||
| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
|
||||
| mipstx39 | mipstx39el \
|
||||
| sparc | sparclet | sparclite | sparc64 | v850)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
i[3456]86)
|
||||
basic_machine=$basic_machine-pc
|
||||
;;
|
||||
# Object if more than one company name word.
|
||||
*-*-*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
# Recognize the basic CPU types with company name.
|
||||
vax-* | tahoe-* | i[3456]86-* | i860-* | m32r-* | m68k-* | m68000-* \
|
||||
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
|
||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
|
||||
| power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
|
||||
| xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* \
|
||||
| alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
|
||||
| ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
|
||||
| sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
|
||||
| sparc64-* | mips64-* | mipsel-* \
|
||||
| mips64el-* | mips64orion-* | mips64orionel-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| f301-*)
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
|
||||
basic_machine=m68000-att
|
||||
;;
|
||||
3b*)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
alliant | fx80)
|
||||
basic_machine=fx80-alliant
|
||||
;;
|
||||
altos | altos3068)
|
||||
basic_machine=m68k-altos
|
||||
;;
|
||||
am29k)
|
||||
basic_machine=a29k-none
|
||||
os=-bsd
|
||||
;;
|
||||
amdahl)
|
||||
basic_machine=580-amdahl
|
||||
os=-sysv
|
||||
;;
|
||||
amiga | amiga-*)
|
||||
basic_machine=m68k-cbm
|
||||
;;
|
||||
amigaos | amigados)
|
||||
basic_machine=m68k-cbm
|
||||
os=-amigaos
|
||||
;;
|
||||
amigaunix | amix)
|
||||
basic_machine=m68k-cbm
|
||||
os=-sysv4
|
||||
;;
|
||||
apollo68)
|
||||
basic_machine=m68k-apollo
|
||||
os=-sysv
|
||||
;;
|
||||
aux)
|
||||
basic_machine=m68k-apple
|
||||
os=-aux
|
||||
;;
|
||||
balance)
|
||||
basic_machine=ns32k-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
convex-c1)
|
||||
basic_machine=c1-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c2)
|
||||
basic_machine=c2-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c32)
|
||||
basic_machine=c32-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c34)
|
||||
basic_machine=c34-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c38)
|
||||
basic_machine=c38-convex
|
||||
os=-bsd
|
||||
;;
|
||||
cray | ymp)
|
||||
basic_machine=ymp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
cray2)
|
||||
basic_machine=cray2-cray
|
||||
os=-unicos
|
||||
;;
|
||||
[ctj]90-cray)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
crds | unos)
|
||||
basic_machine=m68k-crds
|
||||
;;
|
||||
da30 | da30-*)
|
||||
basic_machine=m68k-da30
|
||||
;;
|
||||
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
|
||||
basic_machine=mips-dec
|
||||
;;
|
||||
delta | 3300 | motorola-3300 | motorola-delta \
|
||||
| 3300-motorola | delta-motorola)
|
||||
basic_machine=m68k-motorola
|
||||
;;
|
||||
delta88)
|
||||
basic_machine=m88k-motorola
|
||||
os=-sysv3
|
||||
;;
|
||||
dpx20 | dpx20-*)
|
||||
basic_machine=rs6000-bull
|
||||
os=-bosx
|
||||
;;
|
||||
dpx2* | dpx2*-bull)
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv3
|
||||
;;
|
||||
ebmon29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-ebmon
|
||||
;;
|
||||
elxsi)
|
||||
basic_machine=elxsi-elxsi
|
||||
os=-bsd
|
||||
;;
|
||||
encore | umax | mmax)
|
||||
basic_machine=ns32k-encore
|
||||
;;
|
||||
fx2800)
|
||||
basic_machine=i860-alliant
|
||||
;;
|
||||
genix)
|
||||
basic_machine=ns32k-ns
|
||||
;;
|
||||
gmicro)
|
||||
basic_machine=tron-gmicro
|
||||
os=-sysv
|
||||
;;
|
||||
h3050r* | hiux*)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
h8300hms)
|
||||
basic_machine=h8300-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
harris)
|
||||
basic_machine=m88k-harris
|
||||
os=-sysv3
|
||||
;;
|
||||
hp300-*)
|
||||
basic_machine=m68k-hp
|
||||
;;
|
||||
hp300bsd)
|
||||
basic_machine=m68k-hp
|
||||
os=-bsd
|
||||
;;
|
||||
hp300hpux)
|
||||
basic_machine=m68k-hp
|
||||
os=-hpux
|
||||
;;
|
||||
hp9k2[0-9][0-9] | hp9k31[0-9])
|
||||
basic_machine=m68000-hp
|
||||
;;
|
||||
hp9k3[2-9][0-9])
|
||||
basic_machine=m68k-hp
|
||||
;;
|
||||
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[0-9][0-9] | hp8[0-9][0-9])
|
||||
basic_machine=hppa1.0-hp
|
||||
;;
|
||||
hppa-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
i370-ibm* | ibm*)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i[3456]86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv32
|
||||
;;
|
||||
i[3456]86v4*)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv4
|
||||
;;
|
||||
i[3456]86v)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv
|
||||
;;
|
||||
i[3456]86sol2)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-solaris2
|
||||
;;
|
||||
iris | iris4d)
|
||||
basic_machine=mips-sgi
|
||||
case $os in
|
||||
-irix*)
|
||||
;;
|
||||
*)
|
||||
os=-irix4
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
isi68 | isi)
|
||||
basic_machine=m68k-isi
|
||||
os=-sysv
|
||||
;;
|
||||
m88k-omron*)
|
||||
basic_machine=m88k-omron
|
||||
;;
|
||||
magnum | m3230)
|
||||
basic_machine=mips-mips
|
||||
os=-sysv
|
||||
;;
|
||||
merlin)
|
||||
basic_machine=ns32k-utek
|
||||
os=-sysv
|
||||
;;
|
||||
miniframe)
|
||||
basic_machine=m68000-convergent
|
||||
;;
|
||||
mipsel*-linux*)
|
||||
basic_machine=mipsel-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
mips*-linux*)
|
||||
basic_machine=mips-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
mips3*-*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
|
||||
;;
|
||||
mips3*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
||||
;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
;;
|
||||
news | news700 | news800 | news900)
|
||||
basic_machine=m68k-sony
|
||||
os=-newsos
|
||||
;;
|
||||
news1000)
|
||||
basic_machine=m68030-sony
|
||||
os=-newsos
|
||||
;;
|
||||
news-3600 | risc-news)
|
||||
basic_machine=mips-sony
|
||||
os=-newsos
|
||||
;;
|
||||
next | m*-next )
|
||||
basic_machine=m68k-next
|
||||
case $os in
|
||||
-nextstep* )
|
||||
;;
|
||||
-ns2*)
|
||||
os=-nextstep2
|
||||
;;
|
||||
*)
|
||||
os=-nextstep3
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
nh3000)
|
||||
basic_machine=m68k-harris
|
||||
os=-cxux
|
||||
;;
|
||||
nh[45]000)
|
||||
basic_machine=m88k-harris
|
||||
os=-cxux
|
||||
;;
|
||||
nindy960)
|
||||
basic_machine=i960-intel
|
||||
os=-nindy
|
||||
;;
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
pa-hitachi)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
paragon)
|
||||
basic_machine=i860-intel
|
||||
os=-osf
|
||||
;;
|
||||
pbd)
|
||||
basic_machine=sparc-tti
|
||||
;;
|
||||
pbb)
|
||||
basic_machine=m68k-tti
|
||||
;;
|
||||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pentium | p5)
|
||||
basic_machine=i586-intel
|
||||
;;
|
||||
pentiumpro | p6)
|
||||
basic_machine=i686-intel
|
||||
;;
|
||||
pentium-* | p5-*)
|
||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumpro-* | p6-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
k5)
|
||||
# We don't have specific support for AMD's K5 yet, so just call it a Pentium
|
||||
basic_machine=i586-amd
|
||||
;;
|
||||
nexen)
|
||||
# We don't have specific support for Nexgen yet, so just call it a Pentium
|
||||
basic_machine=i586-nexgen
|
||||
;;
|
||||
pn)
|
||||
basic_machine=pn-gould
|
||||
;;
|
||||
power) basic_machine=rs6000-ibm
|
||||
;;
|
||||
ppc) basic_machine=powerpc-unknown
|
||||
;;
|
||||
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
||||
basic_machine=powerpcle-unknown
|
||||
;;
|
||||
ppcle-* | powerpclittle-*)
|
||||
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ps2)
|
||||
basic_machine=i386-ibm
|
||||
;;
|
||||
rm[46]00)
|
||||
basic_machine=mips-siemens
|
||||
;;
|
||||
rtpc | rtpc-*)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
sequent)
|
||||
basic_machine=i386-sequent
|
||||
;;
|
||||
sh)
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sps7)
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv2
|
||||
;;
|
||||
spur)
|
||||
basic_machine=spur-unknown
|
||||
;;
|
||||
sun2)
|
||||
basic_machine=m68000-sun
|
||||
;;
|
||||
sun2os3)
|
||||
basic_machine=m68000-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun2os4)
|
||||
basic_machine=m68000-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun3os3)
|
||||
basic_machine=m68k-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun3os4)
|
||||
basic_machine=m68k-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun4os3)
|
||||
basic_machine=sparc-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun4os4)
|
||||
basic_machine=sparc-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun4sol2)
|
||||
basic_machine=sparc-sun
|
||||
os=-solaris2
|
||||
;;
|
||||
sun3 | sun3-*)
|
||||
basic_machine=m68k-sun
|
||||
;;
|
||||
sun4)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
sun386 | sun386i | roadrunner)
|
||||
basic_machine=i386-sun
|
||||
;;
|
||||
symmetry)
|
||||
basic_machine=i386-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
tx39)
|
||||
basic_machine=mipstx39-unknown
|
||||
;;
|
||||
tx39el)
|
||||
basic_machine=mipstx39el-unknown
|
||||
;;
|
||||
tower | tower-32)
|
||||
basic_machine=m68k-ncr
|
||||
;;
|
||||
udi29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
ultra3)
|
||||
basic_machine=a29k-nyu
|
||||
os=-sym1
|
||||
;;
|
||||
vaxv)
|
||||
basic_machine=vax-dec
|
||||
os=-sysv
|
||||
;;
|
||||
vms)
|
||||
basic_machine=vax-dec
|
||||
os=-vms
|
||||
;;
|
||||
vpp*|vx|vx-*)
|
||||
basic_machine=f301-fujitsu
|
||||
;;
|
||||
vxworks960)
|
||||
basic_machine=i960-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
vxworks68)
|
||||
basic_machine=m68k-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
vxworks29k)
|
||||
basic_machine=a29k-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
xmp)
|
||||
basic_machine=xmp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
none)
|
||||
basic_machine=none-none
|
||||
os=-none
|
||||
;;
|
||||
|
||||
# Here we handle the default manufacturer of certain CPU types. It is in
|
||||
# some cases the only manufacturer, in others, it is the most popular.
|
||||
mips)
|
||||
if [ x$os = x-linux-gnu ]; then
|
||||
basic_machine=mips-unknown
|
||||
else
|
||||
basic_machine=mips-mips
|
||||
fi
|
||||
;;
|
||||
romp)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
rs6000)
|
||||
basic_machine=rs6000-ibm
|
||||
;;
|
||||
vax)
|
||||
basic_machine=vax-dec
|
||||
;;
|
||||
pdp11)
|
||||
basic_machine=pdp11-dec
|
||||
;;
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sparc)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
basic_machine=cydra-cydrome
|
||||
;;
|
||||
orion)
|
||||
basic_machine=orion-highlevel
|
||||
;;
|
||||
orion105)
|
||||
basic_machine=clipper-highlevel
|
||||
;;
|
||||
*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Here we canonicalize certain aliases for manufacturers.
|
||||
case $basic_machine in
|
||||
*-digital*)
|
||||
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
|
||||
;;
|
||||
*-commodore*)
|
||||
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode manufacturer-specific aliases for certain operating systems.
|
||||
|
||||
if [ x"$os" != x"" ]
|
||||
then
|
||||
case $os in
|
||||
# First match some system type aliases
|
||||
# that might get confused with valid system types.
|
||||
# -solaris* is a basic system type, with this one exception.
|
||||
-solaris1 | -solaris1.*)
|
||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||
;;
|
||||
-solaris)
|
||||
os=-solaris2
|
||||
;;
|
||||
-svr4*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-unixware*)
|
||||
os=-sysv4.2uw
|
||||
;;
|
||||
-gnu/linux*)
|
||||
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
|
||||
;;
|
||||
# First accept the basic system types.
|
||||
# The portable systems comes first.
|
||||
# Each alternative MUST END IN A *, to match a version number.
|
||||
# -sysv* is not here because it comes later, after sysvr4.
|
||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||
| -aos* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -uxpv*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-linux*)
|
||||
os=`echo $os | sed -e 's|linux|linux-gnu|'`
|
||||
;;
|
||||
-sunos5*)
|
||||
os=`echo $os | sed -e 's|sunos5|solaris2|'`
|
||||
;;
|
||||
-sunos6*)
|
||||
os=`echo $os | sed -e 's|sunos6|solaris3|'`
|
||||
;;
|
||||
-osfrose*)
|
||||
os=-osfrose
|
||||
;;
|
||||
-osf*)
|
||||
os=-osf
|
||||
;;
|
||||
-utek*)
|
||||
os=-bsd
|
||||
;;
|
||||
-dynix*)
|
||||
os=-bsd
|
||||
;;
|
||||
-acis*)
|
||||
os=-aos
|
||||
;;
|
||||
-ctix* | -uts*)
|
||||
os=-sysv
|
||||
;;
|
||||
-ns2 )
|
||||
os=-nextstep2
|
||||
;;
|
||||
# Preserve the version number of sinix5.
|
||||
-sinix5.*)
|
||||
os=`echo $os | sed -e 's|sinix|sysv|'`
|
||||
;;
|
||||
-sinix*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-triton*)
|
||||
os=-sysv3
|
||||
;;
|
||||
-oss*)
|
||||
os=-sysv3
|
||||
;;
|
||||
-svr4)
|
||||
os=-sysv4
|
||||
;;
|
||||
-svr3)
|
||||
os=-sysv3
|
||||
;;
|
||||
-sysvr4)
|
||||
os=-sysv4
|
||||
;;
|
||||
# This must come after -sysvr4.
|
||||
-sysv*)
|
||||
;;
|
||||
-xenix)
|
||||
os=-xenix
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
# Get rid of the `-' at the beginning of $os.
|
||||
os=`echo $os | sed 's/[^-]*-//'`
|
||||
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
|
||||
# Here we handle the default operating systems that come with various machines.
|
||||
# The value should be what the vendor currently ships out the door with their
|
||||
# machine or put another way, the most popular os provided with the machine.
|
||||
|
||||
# Note that if you're going to try to match "-MANUFACTURER" here (say,
|
||||
# "-sun"), then you have to tell the case statement up towards the top
|
||||
# that MANUFACTURER isn't an operating system. Otherwise, code above
|
||||
# will signal an error saying that MANUFACTURER isn't an operating
|
||||
# system, and we'll never get to this point.
|
||||
|
||||
case $basic_machine in
|
||||
*-acorn)
|
||||
os=-riscix1.2
|
||||
;;
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
pdp11-*)
|
||||
os=-none
|
||||
;;
|
||||
*-dec | vax-*)
|
||||
os=-ultrix4.2
|
||||
;;
|
||||
m68*-apollo)
|
||||
os=-domain
|
||||
;;
|
||||
i386-sun)
|
||||
os=-sunos4.0.2
|
||||
;;
|
||||
m68000-sun)
|
||||
os=-sunos3
|
||||
# This also exists in the configure program, but was not the
|
||||
# default.
|
||||
# os=-sunos4
|
||||
;;
|
||||
*-tti) # must be before sparc entry or we get the wrong os.
|
||||
os=-sysv3
|
||||
;;
|
||||
sparc-* | *-sun)
|
||||
os=-sunos4.1.1
|
||||
;;
|
||||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-hp)
|
||||
os=-hpux
|
||||
;;
|
||||
*-hitachi)
|
||||
os=-hiux
|
||||
;;
|
||||
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
|
||||
os=-sysv
|
||||
;;
|
||||
*-cbm)
|
||||
os=-amigaos
|
||||
;;
|
||||
*-dg)
|
||||
os=-dgux
|
||||
;;
|
||||
*-dolphin)
|
||||
os=-sysv3
|
||||
;;
|
||||
m68k-ccur)
|
||||
os=-rtu
|
||||
;;
|
||||
m88k-omron*)
|
||||
os=-luna
|
||||
;;
|
||||
*-next )
|
||||
os=-nextstep
|
||||
;;
|
||||
*-sequent)
|
||||
os=-ptx
|
||||
;;
|
||||
*-crds)
|
||||
os=-unos
|
||||
;;
|
||||
*-ns)
|
||||
os=-genix
|
||||
;;
|
||||
i370-*)
|
||||
os=-mvs
|
||||
;;
|
||||
*-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
*-gould)
|
||||
os=-sysv
|
||||
;;
|
||||
*-highlevel)
|
||||
os=-bsd
|
||||
;;
|
||||
*-encore)
|
||||
os=-bsd
|
||||
;;
|
||||
*-sgi)
|
||||
os=-irix
|
||||
;;
|
||||
*-siemens)
|
||||
os=-sysv4
|
||||
;;
|
||||
*-masscomp)
|
||||
os=-rtu
|
||||
;;
|
||||
f301-fujitsu)
|
||||
os=-uxpv
|
||||
;;
|
||||
*)
|
||||
os=-none
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Here we handle the case where we know the os, and the CPU type, but not the
|
||||
# manufacturer. We pick the logical manufacturer.
|
||||
vendor=unknown
|
||||
case $basic_machine in
|
||||
*-unknown)
|
||||
case $os in
|
||||
-riscix*)
|
||||
vendor=acorn
|
||||
;;
|
||||
-sunos*)
|
||||
vendor=sun
|
||||
;;
|
||||
-aix*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-hpux*)
|
||||
vendor=hp
|
||||
;;
|
||||
-hiux*)
|
||||
vendor=hitachi
|
||||
;;
|
||||
-unos*)
|
||||
vendor=crds
|
||||
;;
|
||||
-dgux*)
|
||||
vendor=dg
|
||||
;;
|
||||
-luna*)
|
||||
vendor=omron
|
||||
;;
|
||||
-genix*)
|
||||
vendor=ns
|
||||
;;
|
||||
-mvs*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-ptx*)
|
||||
vendor=sequent
|
||||
;;
|
||||
-vxsim* | -vxworks*)
|
||||
vendor=wrs
|
||||
;;
|
||||
-aux*)
|
||||
vendor=apple
|
||||
;;
|
||||
esac
|
||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
||||
;;
|
||||
esac
|
||||
|
||||
echo $basic_machine$os
|
||||
214
configure.in
214
configure.in
@@ -1,214 +0,0 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(gdk/gdktypes.h)
|
||||
|
||||
# Configure glib
|
||||
AC_CONFIG_SUBDIRS(glib)
|
||||
|
||||
dnl Initialize automake stuff
|
||||
AM_INIT_AUTOMAKE(gtk+, 971109)
|
||||
|
||||
# Specify a configuration file
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
dnl Initialize libtool
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
dnl Initialize maintainer mode
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
AC_ARG_ENABLE(shm, [ --enable-shm support shared memory if available [default=yes]],
|
||||
echo $enable_shm, enable_shm="yes")
|
||||
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],
|
||||
if eval "test x$enable_debug = xyes"; then
|
||||
DEBUGFLAG="-g"
|
||||
fi)
|
||||
AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]],
|
||||
, enable_ansi=no)
|
||||
|
||||
AC_ARG_WITH(xinput, [ --with-xinput[=no/gxi/xfree] support XInput ])
|
||||
|
||||
if test -n "$DEBUGFLAG"; then
|
||||
CFLAGS="$DEBUGFLAG"
|
||||
else
|
||||
CFLAGS="$CFLAGS -DNDEBUG"
|
||||
fi
|
||||
|
||||
# Build time sanity check...
|
||||
AM_SANITY_CHECK
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_STDC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
if eval "test x$GCC = xyes"; then
|
||||
test `echo "$CFLAGS" | grep "\-Wall" > /dev/null 2> /dev/null`
|
||||
if test ! $?; then
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
fi
|
||||
|
||||
if eval "test x$enable_ansi = xyes"; then
|
||||
test `echo "$CFLAGS" | grep "\-ansi" > /dev/null 2> /dev/null`
|
||||
if test ! $?; then
|
||||
CFLAGS="$CFLAGS -ansi"
|
||||
fi
|
||||
|
||||
test `echo "$CFLAGS" | grep "\-pedantic" > /dev/null 2> /dev/null`
|
||||
if test ! $?; then
|
||||
CFLAGS="$CFLAGS -pedantic"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Find the X11 include and library directories
|
||||
AC_PATH_X
|
||||
AC_PATH_XTRA
|
||||
|
||||
if test "x$x_includes" = "x"; then
|
||||
x_includes="/usr/include"
|
||||
fi
|
||||
|
||||
saved_cflags="$CFLAGS"
|
||||
saved_ldflags="$LDFLAGS"
|
||||
|
||||
CFLAGS="$X_CFLAGS"
|
||||
LDFLAGS="$X_LDFLAGS $X_LIBS"
|
||||
|
||||
# Checks for libraries.
|
||||
# Check for the X11 library
|
||||
AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", no_x11_lib=yes, $X_EXTRA_LIBS)
|
||||
|
||||
if eval "test x$enable_shm = xyes"; then
|
||||
# Check for the Xext library (needed for XShm extention)
|
||||
AC_CHECK_LIB(Xext, XShmAttach, x_libs="-lXext $x_libs", no_xext_lib=yes, $x_libs)
|
||||
fi
|
||||
|
||||
x_cflags="$X_CFLAGS"
|
||||
x_ldflags="$X_LDFLAGS $X_LIBS"
|
||||
|
||||
# set up things for XInput
|
||||
|
||||
if eval "test x$with_xinput = xgxi -o x$with_xinput = xyes"; then
|
||||
AC_DEFINE(XINPUT_GXI)
|
||||
xinput_progs=gxid
|
||||
x_libs="-lXi $x_libs"
|
||||
elif eval "test x$with_xinput = xxfree"; then
|
||||
AC_DEFINE(XINPUT_XFREE)
|
||||
x_libs="-lXi $x_libs"
|
||||
else
|
||||
AC_DEFINE(XINPUT_NONE)
|
||||
fi
|
||||
|
||||
|
||||
AC_SUBST(x_cflags)
|
||||
AC_SUBST(x_includes)
|
||||
AC_SUBST(x_ldflags)
|
||||
AC_SUBST(x_libs)
|
||||
AC_SUBST(xinput_progs)
|
||||
|
||||
CFLAGS="$saved_cflags"
|
||||
LDFLAGS="$saved_ldflags"
|
||||
|
||||
if eval "test x$enable_shm = xyes"; then
|
||||
# Check for shared memory
|
||||
AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
|
||||
AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
|
||||
|
||||
# Check whether shmctl IPC_RMID allowes subsequent attaches
|
||||
if test "$ac_cv_header_sys_shm_h" = "yes"; then
|
||||
AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
|
||||
AC_TRY_RUN([
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
int main()
|
||||
{
|
||||
int id;
|
||||
char *shmaddr;
|
||||
id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0777);
|
||||
if (id == -1)
|
||||
exit (2);
|
||||
shmaddr = shmat (id, 0, 0);
|
||||
shmctl (id, IPC_RMID, 0);
|
||||
if ((char*) shmat (id, 0, 0) == (char*) -1)
|
||||
{
|
||||
shmdt (shmaddr);
|
||||
exit (1);
|
||||
}
|
||||
shmdt (shmaddr);
|
||||
shmdt (shmaddr);
|
||||
exit (0);
|
||||
}
|
||||
],
|
||||
AC_DEFINE(IPC_RMID_DEFERRED_RELEASE)
|
||||
AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no),
|
||||
AC_MSG_RESULT(assuming no))
|
||||
fi
|
||||
|
||||
# Check for the X shared memory extension header file
|
||||
AC_MSG_CHECKING(X11/extensions/XShm.h)
|
||||
if eval "test x$no_ext_lib = xyes"; then
|
||||
AC_MSG_RESULT(no)
|
||||
no_xshm=yes
|
||||
else
|
||||
if eval "test -f $x_includes/X11/extensions/XShm.h"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_XSHM_H)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
no_xshm=yes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for private display resource base variable
|
||||
AC_MSG_CHECKING(resource base field in XDisplay)
|
||||
AC_CACHE_VAL(gtk_cv_display_resource_base,
|
||||
[AC_TRY_RUN([
|
||||
#define XLIB_ILLEGAL_ACCESS
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
Display *display;
|
||||
|
||||
return 0;
|
||||
|
||||
display->resource_base;
|
||||
}],
|
||||
gtk_cv_display_resource_base="resource_base",
|
||||
gtk_cv_display_resource_base="private3")])
|
||||
AC_MSG_RESULT($gtk_cv_display_resource_base)
|
||||
AC_DEFINE_UNQUOTED(RESOURCE_BASE, gdk_display->$gtk_cv_display_resource_base)
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
|
||||
# Checks for library functions.
|
||||
AC_TYPE_SIGNAL
|
||||
|
||||
# Check for sys/select.h
|
||||
|
||||
AC_MSG_CHECKING([fd_set and sys/select])
|
||||
AC_TRY_COMPILE([#include <sys/types.h>],
|
||||
[fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
|
||||
if test $gtk_ok = no; then
|
||||
AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
|
||||
if test $gtk_ok = yes; then
|
||||
AC_DEFINE(HAVE_SYS_SELECT_H)
|
||||
fi
|
||||
fi
|
||||
AC_MSG_RESULT($gtk_ok)
|
||||
if test $gtk_ok = no; then
|
||||
AC_DEFINE(NO_FD_SET)
|
||||
fi
|
||||
|
||||
AC_OUTPUT(Makefile gtk+.xconfig docs/Makefile gdk/Makefile gtk/Makefile)
|
||||
462
demos/testanimation.c
Normal file
462
demos/testanimation.c
Normal file
@@ -0,0 +1,462 @@
|
||||
|
||||
/* testpixbuf -- test program for gdk-pixbuf code
|
||||
* Copyright (C) 1999 Mark Crichton, Larry Ewing
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
#include "gdk-pixbuf-loader.h"
|
||||
|
||||
typedef struct {
|
||||
FILE *imagefile;
|
||||
GdkPixbufLoader *loader;
|
||||
GtkWidget **rgbwin;
|
||||
guchar *buf;
|
||||
guint timeout;
|
||||
guint readlen;
|
||||
|
||||
} ProgressFileStatus;
|
||||
|
||||
|
||||
#define DEFAULT_WIDTH 24
|
||||
#define DEFAULT_HEIGHT 24
|
||||
|
||||
static const unsigned char default_image[] = {
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xae, 0xb3, 0xb3, 0xc6, 0xc9, 0xcd, 0xd7, 0xd4, 0xdf,
|
||||
0xec, 0xde, 0xf3, 0xe7, 0xcb, 0xe9, 0xd9, 0xb5, 0xd3, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xb1, 0xb7, 0xa5,
|
||||
0xb0, 0xb8, 0xad, 0xb3, 0xb9, 0xb6, 0xc1, 0xc6, 0xc8, 0xd5, 0xd3, 0xdc,
|
||||
0xec, 0xde, 0xf3, 0xe5, 0xca, 0xe6, 0xe0, 0xbb, 0xd7, 0xe1, 0xad, 0xc2,
|
||||
0xe3, 0xac, 0xa3, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xca, 0xc1, 0xa4, 0xc5, 0xc7, 0xac,
|
||||
0xb7, 0xbe, 0xaf, 0xad, 0xb4, 0xaf, 0xbd, 0xc2, 0xc3, 0xd1, 0xd0, 0xd8,
|
||||
0xec, 0xde, 0xf3, 0xe5, 0xc7, 0xe4, 0xe0, 0xb6, 0xd1, 0xe7, 0xa9, 0xb4,
|
||||
0xed, 0xcd, 0xb6, 0xd6, 0xcf, 0xae, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0x00, 0x00, 0x00, 0xdf, 0xa7, 0x9f, 0xdd, 0xbf, 0xaa, 0xcf, 0xc5, 0xa9,
|
||||
0xc1, 0xc4, 0xac, 0xb2, 0xba, 0xaf, 0xb6, 0xbb, 0xbb, 0xcd, 0xce, 0xd4,
|
||||
0xec, 0xde, 0xf3, 0xe4, 0xc4, 0xe1, 0xe0, 0xaf, 0xc7, 0xea, 0xbc, 0xae,
|
||||
0xe1, 0xd6, 0xb6, 0xc7, 0xcc, 0xae, 0xa2, 0xab, 0x9a, 0x00, 0x00, 0x00,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0x00, 0x00, 0x00, 0xe3, 0xab, 0xc0, 0xe6, 0xa3, 0xa7, 0xdf, 0xba, 0xa8,
|
||||
0xcf, 0xc5, 0xa9, 0xbd, 0xc2, 0xae, 0xad, 0xb4, 0xaf, 0xc6, 0xc9, 0xcd,
|
||||
0xec, 0xde, 0xf3, 0xe2, 0xbf, 0xdc, 0xe7, 0xa9, 0xb4, 0xe7, 0xd6, 0xb8,
|
||||
0xc7, 0xcc, 0xae, 0xac, 0xb6, 0xa6, 0x9d, 0xa8, 0x9f, 0x00, 0x00, 0x00,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
0xd9, 0xaf, 0xcf, 0xe1, 0xb4, 0xd2, 0xe2, 0xb0, 0xcb, 0xe4, 0xa9, 0xbb,
|
||||
0xe2, 0xb2, 0xa6, 0xcf, 0xc5, 0xa9, 0x6a, 0x6a, 0x6a, 0x0d, 0x0d, 0x0d,
|
||||
0x0d, 0x0d, 0x0d, 0x6a, 0x6a, 0x6a, 0xed, 0xcd, 0xb6, 0xc7, 0xcc, 0xae,
|
||||
0xa6, 0xb1, 0xa3, 0x98, 0xa2, 0x9c, 0x8f, 0x97, 0x96, 0x7e, 0x84, 0x85,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
0xe8, 0xc6, 0xe7, 0xe5, 0xc2, 0xe3, 0xe3, 0xbd, 0xdd, 0xe1, 0xb6, 0xd5,
|
||||
0xe2, 0xb0, 0xcb, 0x6a, 0x6a, 0x6a, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x6a, 0x6a, 0x6a, 0x9d, 0xa8, 0x9f,
|
||||
0x8f, 0x97, 0x96, 0x8b, 0x90, 0x92, 0x97, 0x9e, 0xa2, 0xa0, 0xa7, 0xae,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
0xe7, 0xd3, 0xed, 0xe8, 0xd1, 0xed, 0xe8, 0xce, 0xec, 0xe9, 0xcc, 0xeb,
|
||||
0xe8, 0xc6, 0xe7, 0x0d, 0x0d, 0x0d, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x0d, 0x0d, 0x0d, 0x97, 0x9e, 0xa2,
|
||||
0xa7, 0xae, 0xb7, 0xb2, 0xb6, 0xc5, 0xba, 0xbc, 0xce, 0xbf, 0xbe, 0xd3,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
0xe9, 0xdf, 0xf0, 0xe9, 0xdf, 0xf0, 0xe9, 0xdf, 0xf0, 0xe9, 0xdf, 0xf0,
|
||||
0xe9, 0xdf, 0xf0, 0x0d, 0x0d, 0x0d, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x0d, 0x0d, 0x0d, 0xe1, 0xd2, 0xf7,
|
||||
0xe1, 0xd2, 0xf7, 0xe1, 0xd2, 0xf7, 0xe1, 0xd2, 0xf7, 0xe1, 0xd2, 0xf7,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
0xca, 0xc7, 0xd2, 0xc5, 0xc4, 0xcd, 0xbf, 0xbf, 0xc7, 0xb8, 0xb9, 0xc0,
|
||||
0xae, 0xaf, 0xb6, 0x6a, 0x6a, 0x6a, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x6a, 0x6a, 0x6a, 0xd5, 0xa8, 0xe1,
|
||||
0xd8, 0xb2, 0xe9, 0xd9, 0xb8, 0xed, 0xdb, 0xbd, 0xf0, 0xdc, 0xbf, 0xf1,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
0xa4, 0xa6, 0xac, 0xa8, 0xaa, 0xaf, 0xa0, 0xa6, 0xa8, 0x98, 0x9e, 0x9c,
|
||||
0xa1, 0xa8, 0x9e, 0xb1, 0xb6, 0xa1, 0x6a, 0x6a, 0x6a, 0x0d, 0x0d, 0x0d,
|
||||
0x0d, 0x0d, 0x0d, 0x6a, 0x6a, 0x6a, 0xc0, 0x8c, 0xad, 0xcc, 0x90, 0xb5,
|
||||
0xd3, 0x94, 0xca, 0xd6, 0xa2, 0xdb, 0xd5, 0xa8, 0xe1, 0xcf, 0xa7, 0xdf,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0x00, 0x00, 0x00, 0x98, 0x9f, 0x9b, 0xa1, 0xa8, 0x9e, 0xac, 0xb3, 0xa0,
|
||||
0xb9, 0xb9, 0xa4, 0xd0, 0xb8, 0xa8, 0xc5, 0xb5, 0xb8, 0xb6, 0xbb, 0xad,
|
||||
0xe3, 0xd7, 0xb5, 0xdd, 0xb4, 0xa9, 0xcb, 0x89, 0xac, 0xc0, 0x8c, 0xad,
|
||||
0xc8, 0x91, 0xb5, 0xd1, 0x8d, 0xb7, 0xd3, 0x94, 0xca, 0x00, 0x00, 0x00,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0x00, 0x00, 0x00, 0xa1, 0xa7, 0x98, 0xb1, 0xb6, 0xa1, 0xbd, 0xb9, 0xa5,
|
||||
0xd0, 0xb8, 0xa8, 0xca, 0xb5, 0xb7, 0xb8, 0xb1, 0xb1, 0xc2, 0xc8, 0xb2,
|
||||
0xe3, 0xd7, 0xb5, 0xe1, 0xbf, 0xaf, 0xdb, 0x92, 0x9a, 0xbe, 0x82, 0xa6,
|
||||
0xc0, 0x8c, 0xad, 0xc8, 0x91, 0xb4, 0xc7, 0x8b, 0xb0, 0x00, 0x00, 0x00,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xbc, 0xb6, 0xa1, 0xd0, 0xb8, 0xa8,
|
||||
0xcd, 0xb6, 0xb7, 0xc0, 0xb4, 0xb5, 0xb1, 0xb1, 0xaa, 0xca, 0xd1, 0xb4,
|
||||
0xe3, 0xd7, 0xb5, 0xe2, 0xc1, 0xb0, 0xdb, 0xa8, 0xa3, 0xd2, 0x8a, 0xa9,
|
||||
0xb7, 0x7e, 0xa2, 0xbd, 0x89, 0xa9, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xc9, 0xaf, 0xaf,
|
||||
0xc5, 0xb5, 0xb8, 0xb8, 0xb1, 0xb1, 0xb6, 0xbb, 0xad, 0xd0, 0xd6, 0xb5,
|
||||
0xe3, 0xd7, 0xb5, 0xe2, 0xbf, 0xaf, 0xdd, 0xb4, 0xa9, 0xdb, 0x92, 0x9a,
|
||||
0xc6, 0x84, 0xa7, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xac, 0xaa, 0xa6, 0xbd, 0xc3, 0xb0, 0xd2, 0xd7, 0xb5,
|
||||
0xe3, 0xd7, 0xb5, 0xe2, 0xbf, 0xae, 0xdb, 0xb6, 0xa8, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff
|
||||
};
|
||||
|
||||
static void
|
||||
quit_func (GtkWidget *widget, gpointer dummy)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
static void
|
||||
expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
pixbuf = (GdkPixbuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
|
||||
|
||||
if (!pixbuf->art_pixbuf) {
|
||||
g_warning ("art_pixbuf is NULL in expose_func!!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (pixbuf->art_pixbuf->has_alpha) {
|
||||
gdk_draw_rgb_32_image (drawing_area->window,
|
||||
drawing_area->style->black_gc,
|
||||
event->area.x, event->area.y,
|
||||
event->area.width,
|
||||
event->area.height,
|
||||
GDK_RGB_DITHER_MAX,
|
||||
pixbuf->art_pixbuf->pixels
|
||||
+ (event->area.y * pixbuf->art_pixbuf->rowstride)
|
||||
+ (event->area.x * pixbuf->art_pixbuf->n_channels),
|
||||
pixbuf->art_pixbuf->rowstride);
|
||||
} else {
|
||||
gdk_draw_rgb_image (drawing_area->window,
|
||||
drawing_area->style->white_gc,
|
||||
event->area.x, event->area.y,
|
||||
event->area.width,
|
||||
event->area.height,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
pixbuf->art_pixbuf->pixels
|
||||
+ (event->area.y * pixbuf->art_pixbuf->rowstride)
|
||||
+ (event->area.x * pixbuf->art_pixbuf->n_channels),
|
||||
pixbuf->art_pixbuf->rowstride);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
config_func (GtkWidget *drawing_area, GdkEventConfigure *event, gpointer data)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
pixbuf = (GdkPixbuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
|
||||
|
||||
g_print("X:%d Y:%d\n", event->width, event->height);
|
||||
|
||||
#if 0
|
||||
if (((event->width) != (pixbuf->art_pixbuf->width)) ||
|
||||
((event->height) != (pixbuf->art_pixbuf->height)))
|
||||
gdk_pixbuf_scale(pixbuf, event->width, event->height);
|
||||
#endif
|
||||
}
|
||||
|
||||
static GtkWidget*
|
||||
new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *temp_box;
|
||||
GtkWidget *button;
|
||||
GtkWidget *drawing_area;
|
||||
gint w, h;
|
||||
|
||||
w = pixbuf->art_pixbuf->width;
|
||||
h = pixbuf->art_pixbuf->height;
|
||||
|
||||
window = gtk_widget_new (gtk_window_get_type (),
|
||||
"GtkObject::user_data", NULL,
|
||||
"GtkWindow::type", GTK_WINDOW_TOPLEVEL,
|
||||
"GtkWindow::title", "testrgb",
|
||||
"GtkWindow::allow_shrink", TRUE,
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
(GtkSignalFunc) quit_func, NULL);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
|
||||
if (title)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new (title),
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
drawing_area = gtk_drawing_area_new ();
|
||||
|
||||
temp_box = gtk_hbox_new (FALSE, 0);
|
||||
gtk_drawing_area_size (GTK_DRAWING_AREA(drawing_area), w, h);
|
||||
gtk_box_pack_start (GTK_BOX (temp_box), drawing_area, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), temp_box, FALSE, FALSE, 0);
|
||||
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT(drawing_area), "expose_event",
|
||||
GTK_SIGNAL_FUNC(expose_func), NULL);
|
||||
gtk_signal_connect (GTK_OBJECT(drawing_area), "configure_event",
|
||||
GTK_SIGNAL_FUNC (config_func), NULL);
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT(drawing_area), "pixbuf", pixbuf);
|
||||
|
||||
gtk_widget_show (drawing_area);
|
||||
|
||||
button = gtk_button_new_with_label ("Quit");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) gtk_widget_destroy,
|
||||
GTK_OBJECT (window));
|
||||
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_widget_show_all (vbox);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
update_timeout(gpointer data)
|
||||
{
|
||||
ProgressFileStatus *status = data;
|
||||
gboolean done;
|
||||
|
||||
done = TRUE;
|
||||
if (!feof(status->imagefile)) {
|
||||
gint nbytes;
|
||||
|
||||
nbytes = fread(status->buf, 1, status->readlen,
|
||||
status->imagefile);
|
||||
|
||||
done = !gdk_pixbuf_loader_write (GDK_PIXBUF_LOADER (status->loader), status->buf, nbytes);
|
||||
|
||||
}
|
||||
|
||||
if (done) {
|
||||
gtk_widget_queue_draw(*status->rgbwin);
|
||||
gdk_pixbuf_loader_close (GDK_PIXBUF_LOADER (status->loader));
|
||||
gtk_object_destroy (GTK_OBJECT(status->loader));
|
||||
fclose (status->imagefile);
|
||||
g_free (status->buf);
|
||||
}
|
||||
|
||||
return !done;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
progressive_prepared_callback(GdkPixbufLoader* loader, gpointer data)
|
||||
{
|
||||
GtkWidget** retloc = data;
|
||||
GdkPixbuf* pixbuf;
|
||||
|
||||
pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
|
||||
g_assert(pixbuf != NULL);
|
||||
|
||||
gdk_pixbuf_ref(pixbuf); /* for the RGB window */
|
||||
|
||||
*retloc = new_testrgb_window(pixbuf, "Progressive");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
progressive_updated_callback(GdkPixbufLoader* loader, guint x, guint y, guint width, guint height, gpointer data)
|
||||
{
|
||||
GtkWidget** window_loc = data;
|
||||
|
||||
/* g_print ("progressive_updated_callback:\n\t%d\t%d\t%d\t%d\n", x, y, width, height); */
|
||||
|
||||
if (*window_loc != NULL)
|
||||
gtk_widget_queue_draw_area(*window_loc,
|
||||
x, y, width, height);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static int readlen = 4096;
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
int found_valid = FALSE;
|
||||
|
||||
GdkPixbufAnimation *animation;
|
||||
GdkPixbufLoader *pixbuf_loader;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
gdk_rgb_set_verbose (TRUE);
|
||||
|
||||
gdk_rgb_init ();
|
||||
|
||||
gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
|
||||
gtk_widget_set_default_visual (gdk_rgb_get_visual ());
|
||||
|
||||
{
|
||||
char *tbf_readlen = getenv("TBF_READLEN");
|
||||
if(tbf_readlen) readlen = atoi(tbf_readlen);
|
||||
}
|
||||
|
||||
{
|
||||
char *tbf_bps = getenv("TBF_KBPS");
|
||||
guint bps;
|
||||
|
||||
if (tbf_bps) {
|
||||
bps = atoi(tbf_bps);
|
||||
g_print ("Simulating %d kBytes/sec\n", bps);
|
||||
readlen = (bps*1024)/10;
|
||||
}
|
||||
}
|
||||
|
||||
i = 1;
|
||||
if (argc == 1) {
|
||||
g_print ("USAGE: testanimation FILE1 ...\n");
|
||||
return 0;
|
||||
} else {
|
||||
for (i = 1; i < argc; i++) {
|
||||
|
||||
animation = gdk_pixbuf_animation_new_from_file (argv[i]);
|
||||
|
||||
if (animation) {
|
||||
GList *listptr;
|
||||
for (listptr = animation->frames; listptr; listptr = listptr->next){
|
||||
g_print ("in a frame\n");
|
||||
new_testrgb_window (((GdkPixbufFrame *)listptr->data)->pixbuf, "File");
|
||||
}
|
||||
found_valid = TRUE;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
{
|
||||
GtkWidget* rgb_window = NULL;
|
||||
ProgressFileStatus status;
|
||||
|
||||
pixbuf_loader = gdk_pixbuf_loader_new ();
|
||||
status.loader = pixbuf_loader;
|
||||
|
||||
status.rgbwin = &rgb_window;
|
||||
|
||||
status.buf = g_malloc (readlen);
|
||||
gtk_signal_connect(GTK_OBJECT(pixbuf_loader),
|
||||
"area_prepared",
|
||||
GTK_SIGNAL_FUNC(progressive_prepared_callback),
|
||||
&rgb_window);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(pixbuf_loader),
|
||||
"area_updated",
|
||||
GTK_SIGNAL_FUNC(progressive_updated_callback),
|
||||
&rgb_window);
|
||||
|
||||
|
||||
status.imagefile = fopen (argv[1], "r");
|
||||
g_assert (status.imagefile != NULL);
|
||||
|
||||
status.readlen = readlen;
|
||||
|
||||
status.timeout = gtk_timeout_add(100, update_timeout, &status);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (found_valid)
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
113
demos/testpixbuf-drawable.c
Normal file
113
demos/testpixbuf-drawable.c
Normal file
@@ -0,0 +1,113 @@
|
||||
#include <config.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
|
||||
int close_app(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gtk_main_quit();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int expose_cb(GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
pixbuf = (GdkPixbuf *) gtk_object_get_data(GTK_OBJECT(drawing_area),
|
||||
"pixbuf");
|
||||
if(pixbuf->art_pixbuf->has_alpha)
|
||||
{
|
||||
gdk_draw_rgb_32_image(drawing_area->window,
|
||||
drawing_area->style->black_gc,
|
||||
evt->area.x, evt->area.y,
|
||||
evt->area.width,
|
||||
evt->area.height,
|
||||
GDK_RGB_DITHER_MAX,
|
||||
pixbuf->art_pixbuf->pixels +
|
||||
(evt->area.y * pixbuf->art_pixbuf->rowstride) +
|
||||
(evt->area.x * pixbuf->art_pixbuf->n_channels),
|
||||
pixbuf->art_pixbuf->rowstride);
|
||||
}
|
||||
else
|
||||
{
|
||||
gdk_draw_rgb_image(drawing_area->window,
|
||||
drawing_area->style->black_gc,
|
||||
evt->area.x, evt->area.y,
|
||||
evt->area.width,
|
||||
evt->area.height,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
pixbuf->art_pixbuf->pixels +
|
||||
(evt->area.y * pixbuf->art_pixbuf->rowstride) +
|
||||
(evt->area.x * pixbuf->art_pixbuf->n_channels),
|
||||
pixbuf->art_pixbuf->rowstride);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int configure_cb(GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
pixbuf = (GdkPixbuf *) gtk_object_get_data(GTK_OBJECT(drawing_area),
|
||||
"pixbuf");
|
||||
|
||||
g_print("X:%d Y:%d\n", evt->width, evt->height);
|
||||
if(evt->width != pixbuf->art_pixbuf->width || evt->height != pixbuf->art_pixbuf->height)
|
||||
{
|
||||
GdkWindow *root;
|
||||
GdkPixbuf *new_pixbuf;
|
||||
|
||||
root = GDK_ROOT_PARENT();
|
||||
new_pixbuf = gdk_pixbuf_get_from_drawable(NULL, root, NULL,
|
||||
0, 0, 0, 0, evt->width, evt->height);
|
||||
gtk_object_set_data(GTK_OBJECT(drawing_area), "pixbuf", new_pixbuf);
|
||||
gdk_pixbuf_unref(pixbuf);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GdkWindow *root;
|
||||
GtkWidget *window;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *drawing_area;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
gdk_rgb_set_verbose(TRUE);
|
||||
gdk_rgb_init();
|
||||
|
||||
gtk_widget_set_default_colormap(gdk_rgb_get_cmap());
|
||||
gtk_widget_set_default_visual(gdk_rgb_get_visual());
|
||||
|
||||
root = GDK_ROOT_PARENT();
|
||||
pixbuf = gdk_pixbuf_get_from_drawable(NULL, root, NULL,
|
||||
0, 0, 0, 0, 150, 160);
|
||||
|
||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_signal_connect(GTK_OBJECT(window), "delete_event",
|
||||
GTK_SIGNAL_FUNC(close_app), NULL);
|
||||
gtk_signal_connect(GTK_OBJECT(window), "destroy",
|
||||
GTK_SIGNAL_FUNC(close_app), NULL);
|
||||
|
||||
vbox = gtk_vbox_new(FALSE, 0);
|
||||
gtk_container_add(GTK_CONTAINER(window), vbox);
|
||||
|
||||
drawing_area = gtk_drawing_area_new();
|
||||
gtk_drawing_area_size(GTK_DRAWING_AREA(drawing_area),
|
||||
pixbuf->art_pixbuf->width,
|
||||
pixbuf->art_pixbuf->height);
|
||||
gtk_signal_connect(GTK_OBJECT(drawing_area), "expose_event",
|
||||
GTK_SIGNAL_FUNC(expose_cb), NULL);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(drawing_area), "configure_event",
|
||||
GTK_SIGNAL_FUNC(configure_cb), NULL);
|
||||
gtk_object_set_data(GTK_OBJECT(drawing_area), "pixbuf", pixbuf);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), drawing_area, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show_all(window);
|
||||
gtk_main();
|
||||
return 0;
|
||||
}
|
||||
156
demos/testpixbuf-scale.c
Normal file
156
demos/testpixbuf-scale.c
Normal file
@@ -0,0 +1,156 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
ArtFilterLevel filter_level = ART_FILTER_BILINEAR;
|
||||
int overall_alpha = 255;
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkWidget *darea;
|
||||
|
||||
void
|
||||
set_filter_level (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
filter_level = GPOINTER_TO_UINT (data);
|
||||
gtk_widget_queue_draw (darea);
|
||||
}
|
||||
|
||||
void
|
||||
overall_changed_cb (GtkAdjustment *adjustment, gpointer data)
|
||||
{
|
||||
if (adjustment->value != overall_alpha)
|
||||
{
|
||||
overall_alpha = adjustment->value;
|
||||
gtk_widget_queue_draw (darea);
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
{
|
||||
GdkPixbuf *dest;
|
||||
|
||||
gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
|
||||
|
||||
dest = gdk_pixbuf_new (ART_PIX_RGB, FALSE, 8, event->area.width, event->area.height);
|
||||
|
||||
gdk_pixbuf_composite_color (pixbuf, dest,
|
||||
0, 0, event->area.width, event->area.height,
|
||||
-event->area.x, -event->area.y,
|
||||
(double) widget->allocation.width / pixbuf->art_pixbuf->width,
|
||||
(double) widget->allocation.height / pixbuf->art_pixbuf->height,
|
||||
filter_level, overall_alpha,
|
||||
event->area.x, event->area.y, 16, 0xaaaaaa, 0x555555);
|
||||
|
||||
gdk_pixbuf_render_to_drawable (dest, widget->window, widget->style->fg_gc[GTK_STATE_NORMAL],
|
||||
0, 0, event->area.x, event->area.y,
|
||||
event->area.width, event->area.height,
|
||||
GDK_RGB_DITHER_NORMAL, event->area.x, event->area.y);
|
||||
|
||||
gdk_pixbuf_unref (dest);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
GtkWidget *window, *vbox;
|
||||
GtkWidget *menuitem, *optionmenu, *menu;
|
||||
GtkWidget *alignment;
|
||||
GtkWidget *hbox, *label, *hscale;
|
||||
GtkAdjustment *adjustment;
|
||||
GtkRequisition scratch_requisition;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
gdk_rgb_init ();
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf (stderr, "Usage: testpixbuf-scale FILE\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_file (argv[1]);
|
||||
if (!pixbuf) {
|
||||
fprintf (stderr, "Cannot load %s\n", argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("NEAREST");
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
GTK_SIGNAL_FUNC (set_filter_level),
|
||||
GUINT_TO_POINTER (ART_FILTER_NEAREST));
|
||||
gtk_widget_show (menuitem);
|
||||
gtk_container_add (GTK_CONTAINER (menu), menuitem);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("BILINEAR");
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
GTK_SIGNAL_FUNC (set_filter_level),
|
||||
GUINT_TO_POINTER (ART_FILTER_BILINEAR));
|
||||
gtk_widget_show (menuitem);
|
||||
gtk_container_add (GTK_CONTAINER (menu), menuitem);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("TILES");
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
GTK_SIGNAL_FUNC (set_filter_level),
|
||||
GUINT_TO_POINTER (ART_FILTER_TILES));
|
||||
gtk_container_add (GTK_CONTAINER (menu), menuitem);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("HYPER");
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
GTK_SIGNAL_FUNC (set_filter_level),
|
||||
GUINT_TO_POINTER (ART_FILTER_HYPER));
|
||||
gtk_container_add (GTK_CONTAINER (menu), menuitem);
|
||||
|
||||
optionmenu = gtk_option_menu_new ();
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu);
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), 1);
|
||||
|
||||
alignment = gtk_alignment_new (0.0, 0.0, 0.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new ("Overall Alpha:");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
|
||||
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (overall_alpha, 0, 255, 1, 10, 0));
|
||||
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
|
||||
GTK_SIGNAL_FUNC (overall_changed_cb), NULL);
|
||||
|
||||
hscale = gtk_hscale_new (adjustment);
|
||||
gtk_scale_set_digits (GTK_SCALE (hscale), 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), hscale, TRUE, TRUE, 0);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (alignment), optionmenu);
|
||||
gtk_widget_show_all (vbox);
|
||||
|
||||
/* Compute the size without the drawing area, so we know how big to make the default size */
|
||||
gtk_widget_size_request (vbox, &scratch_requisition);
|
||||
|
||||
darea = gtk_drawing_area_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), darea, TRUE, TRUE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (darea), "expose_event",
|
||||
GTK_SIGNAL_FUNC (expose_cb), NULL);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window),
|
||||
pixbuf->art_pixbuf->width,
|
||||
scratch_requisition.height + pixbuf->art_pixbuf->height);
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
594
demos/testpixbuf.c
Normal file
594
demos/testpixbuf.c
Normal file
@@ -0,0 +1,594 @@
|
||||
|
||||
/* testpixbuf -- test program for gdk-pixbuf code
|
||||
* Copyright (C) 1999 Mark Crichton, Larry Ewing
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
#include "gdk-pixbuf-loader.h"
|
||||
|
||||
typedef struct {
|
||||
FILE *imagefile;
|
||||
GdkPixbufLoader *loader;
|
||||
GtkWidget **rgbwin;
|
||||
guchar *buf;
|
||||
guint timeout;
|
||||
guint readlen;
|
||||
|
||||
} ProgressFileStatus;
|
||||
|
||||
|
||||
#define DEFAULT_WIDTH 24
|
||||
#define DEFAULT_HEIGHT 24
|
||||
|
||||
static const unsigned char default_image[] = {
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xae, 0xb3, 0xb3, 0xc6, 0xc9, 0xcd, 0xd7, 0xd4, 0xdf,
|
||||
0xec, 0xde, 0xf3, 0xe7, 0xcb, 0xe9, 0xd9, 0xb5, 0xd3, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xb1, 0xb7, 0xa5,
|
||||
0xb0, 0xb8, 0xad, 0xb3, 0xb9, 0xb6, 0xc1, 0xc6, 0xc8, 0xd5, 0xd3, 0xdc,
|
||||
0xec, 0xde, 0xf3, 0xe5, 0xca, 0xe6, 0xe0, 0xbb, 0xd7, 0xe1, 0xad, 0xc2,
|
||||
0xe3, 0xac, 0xa3, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xca, 0xc1, 0xa4, 0xc5, 0xc7, 0xac,
|
||||
0xb7, 0xbe, 0xaf, 0xad, 0xb4, 0xaf, 0xbd, 0xc2, 0xc3, 0xd1, 0xd0, 0xd8,
|
||||
0xec, 0xde, 0xf3, 0xe5, 0xc7, 0xe4, 0xe0, 0xb6, 0xd1, 0xe7, 0xa9, 0xb4,
|
||||
0xed, 0xcd, 0xb6, 0xd6, 0xcf, 0xae, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0x00, 0x00, 0x00, 0xdf, 0xa7, 0x9f, 0xdd, 0xbf, 0xaa, 0xcf, 0xc5, 0xa9,
|
||||
0xc1, 0xc4, 0xac, 0xb2, 0xba, 0xaf, 0xb6, 0xbb, 0xbb, 0xcd, 0xce, 0xd4,
|
||||
0xec, 0xde, 0xf3, 0xe4, 0xc4, 0xe1, 0xe0, 0xaf, 0xc7, 0xea, 0xbc, 0xae,
|
||||
0xe1, 0xd6, 0xb6, 0xc7, 0xcc, 0xae, 0xa2, 0xab, 0x9a, 0x00, 0x00, 0x00,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0x00, 0x00, 0x00, 0xe3, 0xab, 0xc0, 0xe6, 0xa3, 0xa7, 0xdf, 0xba, 0xa8,
|
||||
0xcf, 0xc5, 0xa9, 0xbd, 0xc2, 0xae, 0xad, 0xb4, 0xaf, 0xc6, 0xc9, 0xcd,
|
||||
0xec, 0xde, 0xf3, 0xe2, 0xbf, 0xdc, 0xe7, 0xa9, 0xb4, 0xe7, 0xd6, 0xb8,
|
||||
0xc7, 0xcc, 0xae, 0xac, 0xb6, 0xa6, 0x9d, 0xa8, 0x9f, 0x00, 0x00, 0x00,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
0xd9, 0xaf, 0xcf, 0xe1, 0xb4, 0xd2, 0xe2, 0xb0, 0xcb, 0xe4, 0xa9, 0xbb,
|
||||
0xe2, 0xb2, 0xa6, 0xcf, 0xc5, 0xa9, 0x6a, 0x6a, 0x6a, 0x0d, 0x0d, 0x0d,
|
||||
0x0d, 0x0d, 0x0d, 0x6a, 0x6a, 0x6a, 0xed, 0xcd, 0xb6, 0xc7, 0xcc, 0xae,
|
||||
0xa6, 0xb1, 0xa3, 0x98, 0xa2, 0x9c, 0x8f, 0x97, 0x96, 0x7e, 0x84, 0x85,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
0xe8, 0xc6, 0xe7, 0xe5, 0xc2, 0xe3, 0xe3, 0xbd, 0xdd, 0xe1, 0xb6, 0xd5,
|
||||
0xe2, 0xb0, 0xcb, 0x6a, 0x6a, 0x6a, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x6a, 0x6a, 0x6a, 0x9d, 0xa8, 0x9f,
|
||||
0x8f, 0x97, 0x96, 0x8b, 0x90, 0x92, 0x97, 0x9e, 0xa2, 0xa0, 0xa7, 0xae,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
0xe7, 0xd3, 0xed, 0xe8, 0xd1, 0xed, 0xe8, 0xce, 0xec, 0xe9, 0xcc, 0xeb,
|
||||
0xe8, 0xc6, 0xe7, 0x0d, 0x0d, 0x0d, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x0d, 0x0d, 0x0d, 0x97, 0x9e, 0xa2,
|
||||
0xa7, 0xae, 0xb7, 0xb2, 0xb6, 0xc5, 0xba, 0xbc, 0xce, 0xbf, 0xbe, 0xd3,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
0xe9, 0xdf, 0xf0, 0xe9, 0xdf, 0xf0, 0xe9, 0xdf, 0xf0, 0xe9, 0xdf, 0xf0,
|
||||
0xe9, 0xdf, 0xf0, 0x0d, 0x0d, 0x0d, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x0d, 0x0d, 0x0d, 0xe1, 0xd2, 0xf7,
|
||||
0xe1, 0xd2, 0xf7, 0xe1, 0xd2, 0xf7, 0xe1, 0xd2, 0xf7, 0xe1, 0xd2, 0xf7,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
0xca, 0xc7, 0xd2, 0xc5, 0xc4, 0xcd, 0xbf, 0xbf, 0xc7, 0xb8, 0xb9, 0xc0,
|
||||
0xae, 0xaf, 0xb6, 0x6a, 0x6a, 0x6a, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x6a, 0x6a, 0x6a, 0xd5, 0xa8, 0xe1,
|
||||
0xd8, 0xb2, 0xe9, 0xd9, 0xb8, 0xed, 0xdb, 0xbd, 0xf0, 0xdc, 0xbf, 0xf1,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
0xa4, 0xa6, 0xac, 0xa8, 0xaa, 0xaf, 0xa0, 0xa6, 0xa8, 0x98, 0x9e, 0x9c,
|
||||
0xa1, 0xa8, 0x9e, 0xb1, 0xb6, 0xa1, 0x6a, 0x6a, 0x6a, 0x0d, 0x0d, 0x0d,
|
||||
0x0d, 0x0d, 0x0d, 0x6a, 0x6a, 0x6a, 0xc0, 0x8c, 0xad, 0xcc, 0x90, 0xb5,
|
||||
0xd3, 0x94, 0xca, 0xd6, 0xa2, 0xdb, 0xd5, 0xa8, 0xe1, 0xcf, 0xa7, 0xdf,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0x00, 0x00, 0x00, 0x98, 0x9f, 0x9b, 0xa1, 0xa8, 0x9e, 0xac, 0xb3, 0xa0,
|
||||
0xb9, 0xb9, 0xa4, 0xd0, 0xb8, 0xa8, 0xc5, 0xb5, 0xb8, 0xb6, 0xbb, 0xad,
|
||||
0xe3, 0xd7, 0xb5, 0xdd, 0xb4, 0xa9, 0xcb, 0x89, 0xac, 0xc0, 0x8c, 0xad,
|
||||
0xc8, 0x91, 0xb5, 0xd1, 0x8d, 0xb7, 0xd3, 0x94, 0xca, 0x00, 0x00, 0x00,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0x00, 0x00, 0x00, 0xa1, 0xa7, 0x98, 0xb1, 0xb6, 0xa1, 0xbd, 0xb9, 0xa5,
|
||||
0xd0, 0xb8, 0xa8, 0xca, 0xb5, 0xb7, 0xb8, 0xb1, 0xb1, 0xc2, 0xc8, 0xb2,
|
||||
0xe3, 0xd7, 0xb5, 0xe1, 0xbf, 0xaf, 0xdb, 0x92, 0x9a, 0xbe, 0x82, 0xa6,
|
||||
0xc0, 0x8c, 0xad, 0xc8, 0x91, 0xb4, 0xc7, 0x8b, 0xb0, 0x00, 0x00, 0x00,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xbc, 0xb6, 0xa1, 0xd0, 0xb8, 0xa8,
|
||||
0xcd, 0xb6, 0xb7, 0xc0, 0xb4, 0xb5, 0xb1, 0xb1, 0xaa, 0xca, 0xd1, 0xb4,
|
||||
0xe3, 0xd7, 0xb5, 0xe2, 0xc1, 0xb0, 0xdb, 0xa8, 0xa3, 0xd2, 0x8a, 0xa9,
|
||||
0xb7, 0x7e, 0xa2, 0xbd, 0x89, 0xa9, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xc9, 0xaf, 0xaf,
|
||||
0xc5, 0xb5, 0xb8, 0xb8, 0xb1, 0xb1, 0xb6, 0xbb, 0xad, 0xd0, 0xd6, 0xb5,
|
||||
0xe3, 0xd7, 0xb5, 0xe2, 0xbf, 0xaf, 0xdd, 0xb4, 0xa9, 0xdb, 0x92, 0x9a,
|
||||
0xc6, 0x84, 0xa7, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xac, 0xaa, 0xa6, 0xbd, 0xc3, 0xb0, 0xd2, 0xd7, 0xb5,
|
||||
0xe3, 0xd7, 0xb5, 0xe2, 0xbf, 0xae, 0xdb, 0xb6, 0xa8, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff
|
||||
};
|
||||
|
||||
|
||||
static const char * book_open_xpm[] = {
|
||||
"16 16 4 1",
|
||||
" c None s None",
|
||||
". c black",
|
||||
"X c #808080",
|
||||
"o c white",
|
||||
" ",
|
||||
" .. ",
|
||||
" .Xo. ... ",
|
||||
" .Xoo. ..oo. ",
|
||||
" .Xooo.Xooo... ",
|
||||
" .Xooo.oooo.X. ",
|
||||
" .Xooo.Xooo.X. ",
|
||||
" .Xooo.oooo.X. ",
|
||||
" .Xooo.Xooo.X. ",
|
||||
" .Xooo.oooo.X. ",
|
||||
" .Xoo.Xoo..X. ",
|
||||
" .Xo.o..ooX. ",
|
||||
" .X..XXXXX. ",
|
||||
" ..X....... ",
|
||||
" .. ",
|
||||
" "};
|
||||
|
||||
static const char * book_closed_xpm[] = {
|
||||
"16 16 6 1",
|
||||
" c None s None",
|
||||
". c black",
|
||||
"X c red",
|
||||
"o c yellow",
|
||||
"O c #808080",
|
||||
"# c white",
|
||||
" ",
|
||||
" .. ",
|
||||
" ..XX. ",
|
||||
" ..XXXXX. ",
|
||||
" ..XXXXXXXX. ",
|
||||
".ooXXXXXXXXX. ",
|
||||
"..ooXXXXXXXXX. ",
|
||||
".X.ooXXXXXXXXX. ",
|
||||
".XX.ooXXXXXX.. ",
|
||||
" .XX.ooXXX..#O ",
|
||||
" .XX.oo..##OO. ",
|
||||
" .XX..##OO.. ",
|
||||
" .X.#OO.. ",
|
||||
" ..O.. ",
|
||||
" .. ",
|
||||
" "};
|
||||
|
||||
static const char * mini_page_xpm[] = {
|
||||
"16 16 4 1",
|
||||
" c None s None",
|
||||
". c black",
|
||||
"X c white",
|
||||
"o c #808080",
|
||||
" ",
|
||||
" ....... ",
|
||||
" .XXXXX.. ",
|
||||
" .XoooX.X. ",
|
||||
" .XXXXX.... ",
|
||||
" .XooooXoo.o ",
|
||||
" .XXXXXXXX.o ",
|
||||
" .XooooooX.o ",
|
||||
" .XXXXXXXX.o ",
|
||||
" .XooooooX.o ",
|
||||
" .XXXXXXXX.o ",
|
||||
" .XooooooX.o ",
|
||||
" .XXXXXXXX.o ",
|
||||
" ..........o ",
|
||||
" oooooooooo ",
|
||||
" "};
|
||||
|
||||
static const char * gtk_mini_xpm[] = {
|
||||
"15 20 17 1",
|
||||
" c None",
|
||||
". c #14121F",
|
||||
"+ c #278828",
|
||||
"@ c #9B3334",
|
||||
"# c #284C72",
|
||||
"$ c #24692A",
|
||||
"% c #69282E",
|
||||
"& c #37C539",
|
||||
"* c #1D2F4D",
|
||||
"= c #6D7076",
|
||||
"- c #7D8482",
|
||||
"; c #E24A49",
|
||||
"> c #515357",
|
||||
", c #9B9C9B",
|
||||
"' c #2FA232",
|
||||
") c #3CE23D",
|
||||
"! c #3B6CCB",
|
||||
" ",
|
||||
" ***> ",
|
||||
" >.*!!!* ",
|
||||
" ***....#*= ",
|
||||
" *!*.!!!**!!# ",
|
||||
" .!!#*!#*!!!!# ",
|
||||
" @%#!.##.*!!$& ",
|
||||
" @;%*!*.#!#')) ",
|
||||
" @;;@%!!*$&)'' ",
|
||||
" @%.%@%$'&)$+' ",
|
||||
" @;...@$'*'*)+ ",
|
||||
" @;%..@$+*.')$ ",
|
||||
" @;%%;;$+..$)# ",
|
||||
" @;%%;@$$$'.$# ",
|
||||
" %;@@;;$$+))&* ",
|
||||
" %;;;@+$&)&* ",
|
||||
" %;;@'))+> ",
|
||||
" %;@'&# ",
|
||||
" >%$$ ",
|
||||
" >= "};
|
||||
|
||||
const gchar ** xpms[] = {
|
||||
book_open_xpm,
|
||||
book_closed_xpm,
|
||||
mini_page_xpm,
|
||||
gtk_mini_xpm,
|
||||
NULL
|
||||
};
|
||||
|
||||
static void
|
||||
quit_func (GtkWidget *widget, gpointer dummy)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
static void
|
||||
expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
pixbuf = (GdkPixbuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
|
||||
|
||||
if (!pixbuf->art_pixbuf) {
|
||||
g_warning ("art_pixbuf is NULL in expose_func!!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (pixbuf->art_pixbuf->has_alpha) {
|
||||
gdk_draw_rgb_32_image (drawing_area->window,
|
||||
drawing_area->style->black_gc,
|
||||
event->area.x, event->area.y,
|
||||
event->area.width,
|
||||
event->area.height,
|
||||
GDK_RGB_DITHER_MAX,
|
||||
pixbuf->art_pixbuf->pixels
|
||||
+ (event->area.y * pixbuf->art_pixbuf->rowstride)
|
||||
+ (event->area.x * pixbuf->art_pixbuf->n_channels),
|
||||
pixbuf->art_pixbuf->rowstride);
|
||||
} else {
|
||||
gdk_draw_rgb_image (drawing_area->window,
|
||||
drawing_area->style->white_gc,
|
||||
event->area.x, event->area.y,
|
||||
event->area.width,
|
||||
event->area.height,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
pixbuf->art_pixbuf->pixels
|
||||
+ (event->area.y * pixbuf->art_pixbuf->rowstride)
|
||||
+ (event->area.x * pixbuf->art_pixbuf->n_channels),
|
||||
pixbuf->art_pixbuf->rowstride);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
config_func (GtkWidget *drawing_area, GdkEventConfigure *event, gpointer data)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
pixbuf = (GdkPixbuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
|
||||
|
||||
g_print("X:%d Y:%d\n", event->width, event->height);
|
||||
|
||||
#if 0
|
||||
if (((event->width) != (pixbuf->art_pixbuf->width)) ||
|
||||
((event->height) != (pixbuf->art_pixbuf->height)))
|
||||
gdk_pixbuf_scale(pixbuf, event->width, event->height);
|
||||
#endif
|
||||
}
|
||||
|
||||
static GtkWidget*
|
||||
new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *temp_box;
|
||||
GtkWidget *button;
|
||||
GtkWidget *drawing_area;
|
||||
gint w, h;
|
||||
|
||||
w = pixbuf->art_pixbuf->width;
|
||||
h = pixbuf->art_pixbuf->height;
|
||||
|
||||
window = gtk_widget_new (gtk_window_get_type (),
|
||||
"GtkObject::user_data", NULL,
|
||||
"GtkWindow::type", GTK_WINDOW_TOPLEVEL,
|
||||
"GtkWindow::title", "testrgb",
|
||||
"GtkWindow::allow_shrink", TRUE,
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
(GtkSignalFunc) quit_func, NULL);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
|
||||
if (title)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new (title),
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
drawing_area = gtk_drawing_area_new ();
|
||||
|
||||
temp_box = gtk_hbox_new (FALSE, 0);
|
||||
gtk_drawing_area_size (GTK_DRAWING_AREA(drawing_area), w, h);
|
||||
gtk_box_pack_start (GTK_BOX (temp_box), drawing_area, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), temp_box, FALSE, FALSE, 0);
|
||||
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT(drawing_area), "expose_event",
|
||||
GTK_SIGNAL_FUNC(expose_func), NULL);
|
||||
gtk_signal_connect (GTK_OBJECT(drawing_area), "configure_event",
|
||||
GTK_SIGNAL_FUNC (config_func), NULL);
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT(drawing_area), "pixbuf", pixbuf);
|
||||
|
||||
gtk_widget_show (drawing_area);
|
||||
|
||||
button = gtk_button_new_with_label ("Quit");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) gtk_widget_destroy,
|
||||
GTK_OBJECT (window));
|
||||
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_widget_show_all (vbox);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
update_timeout(gpointer data)
|
||||
{
|
||||
ProgressFileStatus *status = data;
|
||||
gboolean done;
|
||||
|
||||
done = TRUE;
|
||||
if (!feof(status->imagefile)) {
|
||||
gint nbytes;
|
||||
|
||||
nbytes = fread(status->buf, 1, status->readlen,
|
||||
status->imagefile);
|
||||
|
||||
done = !gdk_pixbuf_loader_write (GDK_PIXBUF_LOADER (status->loader), status->buf, nbytes);
|
||||
|
||||
}
|
||||
|
||||
if (done) {
|
||||
gtk_widget_queue_draw(*status->rgbwin);
|
||||
gdk_pixbuf_loader_close (GDK_PIXBUF_LOADER (status->loader));
|
||||
gtk_object_destroy (GTK_OBJECT(status->loader));
|
||||
fclose (status->imagefile);
|
||||
g_free (status->buf);
|
||||
}
|
||||
|
||||
return !done;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
progressive_prepared_callback(GdkPixbufLoader* loader, gpointer data)
|
||||
{
|
||||
GtkWidget** retloc = data;
|
||||
GdkPixbuf* pixbuf;
|
||||
|
||||
pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
|
||||
g_assert(pixbuf != NULL);
|
||||
|
||||
gdk_pixbuf_ref(pixbuf); /* for the RGB window */
|
||||
|
||||
*retloc = new_testrgb_window(pixbuf, "Progressive");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
progressive_updated_callback(GdkPixbufLoader* loader, guint x, guint y, guint width, guint height, gpointer data)
|
||||
{
|
||||
GtkWidget** window_loc = data;
|
||||
|
||||
/* g_print ("progressive_updated_callback:\n\t%d\t%d\t%d\t%d\n", x, y, width, height); */
|
||||
|
||||
if (*window_loc != NULL)
|
||||
gtk_widget_queue_draw_area(*window_loc,
|
||||
x, y, width, height);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static int readlen = 4096;
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
int found_valid = FALSE;
|
||||
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixbufLoader *pixbuf_loader;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
gdk_rgb_set_verbose (TRUE);
|
||||
|
||||
gdk_rgb_init ();
|
||||
|
||||
gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
|
||||
gtk_widget_set_default_visual (gdk_rgb_get_visual ());
|
||||
|
||||
{
|
||||
char *tbf_readlen = getenv("TBF_READLEN");
|
||||
if(tbf_readlen) readlen = atoi(tbf_readlen);
|
||||
}
|
||||
|
||||
{
|
||||
char *tbf_bps = getenv("TBF_KBPS");
|
||||
guint bps;
|
||||
|
||||
if (tbf_bps) {
|
||||
bps = atoi(tbf_bps);
|
||||
g_print ("Simulating %d kBytes/sec\n", bps);
|
||||
readlen = (bps*1024)/10;
|
||||
}
|
||||
}
|
||||
|
||||
i = 1;
|
||||
if (argc == 1) {
|
||||
const gchar*** xpmp;
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_data (default_image, ART_PIX_RGB, FALSE,
|
||||
DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_WIDTH * 3,
|
||||
NULL, NULL);
|
||||
new_testrgb_window (pixbuf, NULL);
|
||||
|
||||
xpmp = xpms;
|
||||
while (*xpmp) {
|
||||
pixbuf = gdk_pixbuf_new_from_xpm_data (*xpmp);
|
||||
new_testrgb_window (pixbuf, NULL);
|
||||
++xpmp;
|
||||
}
|
||||
|
||||
found_valid = TRUE;
|
||||
} else {
|
||||
for (i = 1; i < argc; i++) {
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_file (argv[i]);
|
||||
#if 0
|
||||
pixbuf = gdk_pixbuf_rotate(pixbuf, 10.0);
|
||||
#endif
|
||||
|
||||
if (pixbuf) {
|
||||
new_testrgb_window (pixbuf, "File");
|
||||
found_valid = TRUE;
|
||||
}
|
||||
}
|
||||
#if 1
|
||||
{
|
||||
GtkWidget* rgb_window = NULL;
|
||||
ProgressFileStatus status;
|
||||
|
||||
pixbuf_loader = gdk_pixbuf_loader_new ();
|
||||
status.loader = pixbuf_loader;
|
||||
|
||||
status.rgbwin = &rgb_window;
|
||||
|
||||
status.buf = g_malloc (readlen);
|
||||
gtk_signal_connect(GTK_OBJECT(pixbuf_loader),
|
||||
"area_prepared",
|
||||
GTK_SIGNAL_FUNC(progressive_prepared_callback),
|
||||
&rgb_window);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(pixbuf_loader),
|
||||
"area_updated",
|
||||
GTK_SIGNAL_FUNC(progressive_updated_callback),
|
||||
&rgb_window);
|
||||
|
||||
|
||||
status.imagefile = fopen (argv[1], "r");
|
||||
g_assert (status.imagefile != NULL);
|
||||
|
||||
status.readlen = readlen;
|
||||
|
||||
status.timeout = gtk_timeout_add(100, update_timeout, &status);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (found_valid)
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
Makefile
|
||||
@@ -1,10 +0,0 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
info_TEXINFOS = gdk.texi gtk.texi
|
||||
|
||||
EXTRA_DIST = texinfo.tex macros.texi
|
||||
|
||||
files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
|
||||
echo $$p; \
|
||||
done
|
||||
326
docs/gdk.texi
326
docs/gdk.texi
@@ -1,326 +0,0 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@c %**start of header
|
||||
@setfilename gdk.info
|
||||
@settitle GDK
|
||||
@setchapternewpage odd
|
||||
@c %**end of header
|
||||
|
||||
@set edition 1.0
|
||||
@set update-date 16 May 1996
|
||||
@set update-month May 1996
|
||||
|
||||
@ifinfo
|
||||
This file documents GDK, the General Drawing Kit
|
||||
|
||||
Copyright (C) 1996 Peter Mattis
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this
|
||||
manual provided the copyright notice and this permission notice are
|
||||
preserved on all copies
|
||||
|
||||
@ignore
|
||||
Permission is granted to process this file throught TeX and print the
|
||||
results, provided the printed document carries copying permission notice
|
||||
identical to this one except for the removal of this paragraph (this
|
||||
paragraph not being relevant to the printed manual).
|
||||
|
||||
@end ignore
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions,
|
||||
except that this permission notice may be stated in a translation
|
||||
approved by Peter Mattis.
|
||||
@end ifinfo
|
||||
|
||||
@titlepage
|
||||
@title The General Drawing Kit
|
||||
@subtitle Version 1.0
|
||||
@subtitle @value{update-month}
|
||||
@author by Peter Mattis
|
||||
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
Copyright @copyright{} 1996 Peter Mattis
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this
|
||||
manual provided the copyright notice and this permission notice are
|
||||
preserved on all copies.
|
||||
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions,
|
||||
except that this permission notice may be stated in a translation
|
||||
approved by Peter Mattis.
|
||||
@end titlepage
|
||||
|
||||
@dircategory User Interface Toolkit
|
||||
@direntry
|
||||
* GDK: (gdk). The General Drawing Kit
|
||||
@end direntry
|
||||
|
||||
@node Top, Copying, (dir), (dir)
|
||||
@top The General Drawing Kit
|
||||
@ifinfo
|
||||
This is edition @value{edition} of the GDK documentation,
|
||||
@w{@value{update-date}}.
|
||||
@end ifinfo
|
||||
|
||||
@menu
|
||||
* Copying:: Your rights.
|
||||
* Overview:: What is GDK?
|
||||
* Initialization:: Initialization and exit.
|
||||
* Events:: Event handling.
|
||||
* Visuals:: Understanding and using visuals.
|
||||
* Windows:: Creating and using windows.
|
||||
* Graphics Contexts:: Creating and modifying GCs.
|
||||
* Pixmaps:: Creating pixmaps.
|
||||
* Images:: Creating images.
|
||||
* Color:: Specifying color.
|
||||
* Fonts:: Creating fonts.
|
||||
* Drawing:: Drawing commands.
|
||||
* XInput Support:: Using extended devices.
|
||||
* Miscellany:: Other stuff.
|
||||
* Examples:: Using GDK.
|
||||
* Function Index:: Index of functions
|
||||
* Concept Index:: Index of concepts
|
||||
@end menu
|
||||
|
||||
@node Copying, Overview, Top, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Copying
|
||||
|
||||
GDK is @dfn{free}; this means that everyone is free to use it and free
|
||||
to redestribute it on a free basis. GDK is not in the public domain; it
|
||||
is copyrighted and there are restrictions on its distribution, but these
|
||||
restrictions are designed to permit everything that a good cooperating
|
||||
citizen would want to do. What is not allowed is to try to prevent
|
||||
others from further sharing any version of GDK that they might get from
|
||||
you.
|
||||
|
||||
Specifically, we want to make sure that you have the right to give away
|
||||
copies of GDK, that you receive source code or else can get it if you
|
||||
want it, that you can change GDK or use pieces of it in new free
|
||||
programs, and that you know you can do these things.
|
||||
|
||||
To make sure that everyone has such rights, we have to forbid you to
|
||||
deprive anyone else of these rights. For example, if you distribute
|
||||
copies of GDK, 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 tell them their rights.
|
||||
|
||||
Also, for my own protection, we must make certain that everyone finds
|
||||
out that there is no warranty for GDK. If GDK is modified by someone
|
||||
else and passed on, we want their recipients to know that what they have
|
||||
is not what we distributed, so that any problems introduced by others
|
||||
will no reflect on our reputation.
|
||||
|
||||
The precise conditions of the licenses for GDK are found in the General
|
||||
Public Licenses that accompanies it.
|
||||
|
||||
|
||||
@node Overview, Initialization, Copying, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter What is GDK?
|
||||
@cindex Overview
|
||||
|
||||
GDK is designed as a wrapper library that lies on top of Xlib. It
|
||||
performs many common and desired operations for a programmer instead
|
||||
of the programmer having to explicitly ask for such functionality from
|
||||
Xlib directly. For example, GDK provides a common interface to both
|
||||
regular and shared memory XImage types. By doing so, an application
|
||||
can nearly transparently use the fastest image type available. GDK
|
||||
also provides routines for determining the best available color depth
|
||||
and the best available visual which is not always the default visual
|
||||
for a screen.
|
||||
|
||||
@node Initialization, Events, Overview, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Initialization and exit
|
||||
@cindex Initialization
|
||||
@cindex Exit
|
||||
|
||||
Initializing GDK is easy. Simply call @code{gdk_init} passing in the
|
||||
@var{argc} and @var{argv} parameters. Exit is similarly easy. Just
|
||||
call @code{gdk_exit}.
|
||||
|
||||
@deftypefun void gdk_init (int *@var{argc}, char ***@var{argv})
|
||||
Initializes the GDK library. The arguments @var{argc} and @var{argv}
|
||||
are scanned and any arguments that GDK recognizes are handled and
|
||||
removed. The @var{argc} and @var{argv} parameters are the values
|
||||
passed to @code{main} upon program invocation.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void gdk_exit (int @var{errorcode})
|
||||
Exit GDK and perform any necessary cleanup. @code{gdk_exit} will call
|
||||
the systems @code{exit} function passing @var{errorcode} as the
|
||||
parameter.
|
||||
@end deftypefun
|
||||
|
||||
@example
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
@{
|
||||
/* Initialize GDK. */
|
||||
gdk_init (&argc, &argv);
|
||||
|
||||
/* Exit from GDK...this call will never return. */
|
||||
gdk_exit (0);
|
||||
|
||||
/* Keep compiler from issuing a warning */
|
||||
return 0;
|
||||
@}
|
||||
@end example
|
||||
|
||||
|
||||
@node Events, Visuals, Initialization, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Event handling
|
||||
@cindex Events
|
||||
|
||||
Events are the means by which GDK lets the programmer know of user
|
||||
interaction. An event is normally a button or key press or some other
|
||||
indirect user action, such as a the mouse cursor entering or leaving a
|
||||
window.
|
||||
|
||||
There exist only a few functions for getting events and event
|
||||
information. These are @code{gdk_events_pending},
|
||||
@code{gdk_event_get}, @code{gdk_events_record} and
|
||||
@code{gdk_events_playback}. The latter two functions are useful for
|
||||
automatic testing of a software package and should normally not be
|
||||
needed in a program.
|
||||
|
||||
@deftypefun gint gdk_events_pending (void)
|
||||
Returns the number of events pending on the event queue.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gint gdk_event_get (GdkEvent *@var{event})
|
||||
Return the next available event in the @var{event}
|
||||
structure. @code{gdk_event_get} will return @code{TRUE} on success and
|
||||
@code{FALSE} on failure. Success and failure is determined by whether
|
||||
an event arrived before the timeout period expired.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void gdk_events_record (char *@var{filename})
|
||||
Turn on recording of events. User events and certain system events will
|
||||
be saved in the file named by the variable @var{filename}. This stream
|
||||
of events can later be played back and ``should'' produce the same
|
||||
results as when the original events were handled. However, the
|
||||
programmer does need to be careful in that the state of the program must
|
||||
be the same when @code{gdk_events_record} is called and when
|
||||
@code{gdk_events_playback} is called. For this reason,
|
||||
@code{gdk_events_record} is normally not called directly, but is instead
|
||||
invoked indirectly by specifying the ``-record'' command line option.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void gdk_events_playback (char *@var{filename})
|
||||
Start playback of events from a file. (See the above description of
|
||||
@code{gdk_events_record}). Normally this function is not called directly
|
||||
but is invoked by the ``-playback'' command line option.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void gdk_events_stop (void)
|
||||
Stop recording and playback of events.
|
||||
@end deftypefun
|
||||
|
||||
@example
|
||||
void
|
||||
handle_event ()
|
||||
@{
|
||||
GdkEvent event;
|
||||
|
||||
if (gdk_event_get (&event))
|
||||
@{
|
||||
switch (event.type)
|
||||
@{
|
||||
@dots{}
|
||||
@}
|
||||
@}
|
||||
@}
|
||||
@end example
|
||||
|
||||
|
||||
@node Visuals, Windows, Events, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Understanding and using visuals
|
||||
@cindex Visuals
|
||||
|
||||
@node Windows, Graphics Contexts, Visuals, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Creating and using windows
|
||||
@cindex Windows
|
||||
|
||||
@node Graphics Contexts, Pixmaps, Windows, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Creating and modifying GCs
|
||||
@cindex Graphics Contexts
|
||||
@cindex GC
|
||||
|
||||
@node Pixmaps, Images, Graphics Contexts, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Creating pixmaps
|
||||
@cindex Pixmaps
|
||||
|
||||
@node Images, Color, Pixmaps, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Creating images
|
||||
@cindex Images
|
||||
|
||||
@node Color, Fonts, Images, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Specifying color
|
||||
@cindex Color
|
||||
|
||||
@node Fonts, Drawing, Color, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Creating Fonts
|
||||
@cindex Fonts
|
||||
|
||||
@node Drawing, XInput Support, Fonts, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Drawing Commands
|
||||
@cindex Drawing
|
||||
|
||||
@node XInput Support, Miscellany, Drawing, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Using extended devices
|
||||
@cindex Overview
|
||||
@cindex Using extended device capabilities
|
||||
@cindex Controlling extended devices
|
||||
|
||||
@node Miscellany, Examples, XInput Support, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Other stuff
|
||||
@cindex Timers
|
||||
@cindex Debugging
|
||||
@cindex Miscellaneous
|
||||
|
||||
|
||||
@node Examples, Function Index, Miscellany, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Using GDK
|
||||
@cindex Examples
|
||||
|
||||
|
||||
@node Function Index, Concept Index, Examples, Top
|
||||
@comment node-name, next, previous, up
|
||||
@unnumbered Variable Index
|
||||
|
||||
@printindex fn
|
||||
|
||||
@node Concept Index, , Function Index, Top
|
||||
@comment node-name, next, previous, up
|
||||
@unnumbered Concept Index
|
||||
|
||||
@printindex cp
|
||||
|
||||
@summarycontents
|
||||
@contents
|
||||
@bye
|
||||
3285
docs/gtk.texi
3285
docs/gtk.texi
File diff suppressed because it is too large
Load Diff
@@ -1,18 +0,0 @@
|
||||
@macro gtkstdmacros {p, q}
|
||||
|
||||
@deftypefun Gtk\p\* GTK_\q\ (gpointer @var{obj})
|
||||
Cast a generic pointer to @code{Gtk\p\*}. @xref{Standard Macros}, for
|
||||
more info.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun Gtk\p\Class* GTK_\q\_CLASS (gpointer @var{class})
|
||||
Cast a generic pointer to @code{Gtk\p\Class*}. @xref{Standard Macros},
|
||||
for more info.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gint GTK_IS_\q\ (gpointer @var{obj})
|
||||
Determine if a generic pointer refers to a @code{Gtk\p\}
|
||||
object. @xref{Standard Macros}, for more info.
|
||||
@end deftypefun
|
||||
|
||||
@end macro
|
||||
5
docs/reference/gdk-pixbuf/.cvsignore
Normal file
5
docs/reference/gdk-pixbuf/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
html
|
||||
sgml
|
||||
gdk-pixbuf.html
|
||||
109
docs/reference/gdk-pixbuf/Makefile.am
Normal file
109
docs/reference/gdk-pixbuf/Makefile.am
Normal file
@@ -0,0 +1,109 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
# The name of the module.
|
||||
DOC_MODULE=gdk-pixbuf
|
||||
|
||||
# The top-level SGML file.
|
||||
DOC_MAIN_SGML_FILE=gdk-pixbuf.sgml
|
||||
|
||||
# The directory containing the source code (if it contains documentation).
|
||||
DOC_SOURCE_DIR=$(GDK_PIXBUF_DIR)/gdk-pixbuf
|
||||
|
||||
CFLAGS=`gnome-config --cflags gnomeui gdk_pixbuf gnomecanvaspixbuf`
|
||||
LDFLAGS=`gnome-config --libs gnomeui gdk_pixbuf gnomecanvaspixbuf`
|
||||
|
||||
HTML_DIR=$(datadir)/gnome/html
|
||||
|
||||
TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
|
||||
|
||||
tmpl_sources = \
|
||||
tmpl/animation.sgml \
|
||||
tmpl/creating.sgml \
|
||||
tmpl/file-loading.sgml \
|
||||
tmpl/from-drawables.sgml \
|
||||
tmpl/gdk-pixbuf-loader.sgml \
|
||||
tmpl/gdk-pixbuf-unused.sgml \
|
||||
tmpl/gdk-pixbuf.sgml \
|
||||
tmpl/gnome-canvas-pixbuf.sgml \
|
||||
tmpl/refcounting.sgml \
|
||||
tmpl/rendering.sgml \
|
||||
tmpl/scaling.sgml \
|
||||
tmpl/util.sgml
|
||||
|
||||
gdk_pixbuf_docdir = $(HTML_DIR)
|
||||
gdk_pixbuf_doc_DATA = \
|
||||
gdk-pixbuf.html \
|
||||
gdk-pixbuf.hierarchy \
|
||||
gdk-pixbuf.types \
|
||||
gdk-pixbuf-decl.txt \
|
||||
gdk-pixbuf-sections.txt
|
||||
|
||||
content_files = \
|
||||
compiling.sgml
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(gdk_pixbuf_doc_DATA) \
|
||||
$(content_files)
|
||||
|
||||
if ENABLE_GTK_DOC
|
||||
gdk-pixbuf.html: html/book1.html
|
||||
-cd $(srcdir) && cp html/book1.html gdk-pixbuf.html
|
||||
else
|
||||
gdk-pixbuf.html:
|
||||
endif
|
||||
|
||||
html/book1.html: sgml/gdk-pixbuf-doc.bottom $(content_files)
|
||||
$(MAKE) html
|
||||
|
||||
sgml/gdk-pixbuf-doc.bottom: $(tmpl_sources)
|
||||
$(MAKE) sgml
|
||||
|
||||
scan:
|
||||
-(cd $(srcdir) \
|
||||
&& env CFLAGS=$(CFLAGS) LDFLAGS=$(LDFLAGS) \
|
||||
gtkdoc-scanobj --module=$(DOC_MODULE) \
|
||||
&& gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="pixops.h pixops-internal.h" )
|
||||
|
||||
templates: scan
|
||||
cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE)
|
||||
|
||||
sgml:
|
||||
cd $(srcdir) \
|
||||
&& gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR)
|
||||
|
||||
html:
|
||||
test -d $(srcdir)/html || mkdir $(srcdir)/html
|
||||
-cd $(srcdir)/html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
|
||||
|
||||
clean-local:
|
||||
rm -f *~ *.bak *.signals *-unused.txt
|
||||
|
||||
maintainer-clean-local: clean
|
||||
cd $(srcdir) && rm -rf sgml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
|
||||
|
||||
install-data-local:
|
||||
$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)
|
||||
(installfiles=`echo $(srcdir)/html/*.html`; \
|
||||
if test "$$installfiles" = '$(srcdir)/html/*.html'; \
|
||||
then echo '-- Nothing to install' ; \
|
||||
else \
|
||||
for i in $$installfiles; do \
|
||||
echo '-- Installing '$$i ; \
|
||||
$(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
|
||||
done; \
|
||||
echo '-- Installing $(srcdir)/html/index.sgml' ; \
|
||||
$(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR); \
|
||||
echo '-- Fixing Crossreferences' ; \
|
||||
gtkdoc-fixxref --module=$(DOC_MODULE) --html-dir=$(HTML_DIR)|| true; \
|
||||
fi)
|
||||
|
||||
dist-hook:
|
||||
mkdir $(distdir)/html
|
||||
mkdir $(distdir)/sgml
|
||||
mkdir $(distdir)/tmpl
|
||||
-cp $(srcdir)/html/*.html $(srcdir)/html/*.css $(distdir)/html
|
||||
-cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
|
||||
-cp $(srcdir)/sgml/*.sgml $(distdir)/sgml
|
||||
-cp $(srcdir)/sgml/*.bottom $(srcdir)/sgml/*.top $(distdir)/sgml
|
||||
|
||||
.PHONY : html sgml templates scan
|
||||
103
docs/reference/gdk-pixbuf/compiling.sgml
Normal file
103
docs/reference/gdk-pixbuf/compiling.sgml
Normal file
@@ -0,0 +1,103 @@
|
||||
<appendix id="compiling">
|
||||
<title>Compiling the gdk-pixbuf library</title>
|
||||
|
||||
<para>
|
||||
This appendix describes the special options you can use while
|
||||
compiling the gdk-pixbuf library.
|
||||
</para>
|
||||
|
||||
<sect1 id="building">
|
||||
<title>Building the Library</title>
|
||||
<para>
|
||||
The gdk-pixbuf library uses the standard GNU build system,
|
||||
using <productname>autoconf</productname> for package
|
||||
configuration and resolving portability issues,
|
||||
<productname>automake</productname> for building makefiles
|
||||
that comply with the GNU Coding Standards, and
|
||||
<productname>libtool</productname> for building shared
|
||||
libraries on multiple platforms. The normal sequence for
|
||||
compiling and installing the gdk-pixbuf library is thus:
|
||||
|
||||
<literallayout>
|
||||
<userinput>./configure</userinput>
|
||||
<userinput>make</userinput>
|
||||
<userinput>make install</userinput>
|
||||
</literallayout>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The standard options provided by <productname>GNU
|
||||
autoconf</productname> may be passed to the
|
||||
<command>configure</command> script. Please see the
|
||||
<productname>autoconf</productname> documentation or run
|
||||
<command>./configure --help</command> for information about
|
||||
the standard options.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="extra-configuration-options">
|
||||
<title>Extra Configuration Options</title>
|
||||
|
||||
<para>
|
||||
In addition to the normal options, the
|
||||
<command>configure</command> script in the gdk-pixbuf library
|
||||
supports these additional arguments:
|
||||
|
||||
<cmdsynopsis>
|
||||
<command>configure</command>
|
||||
|
||||
<group>
|
||||
<arg>--disable-modules</arg>
|
||||
<arg>--enable-modules</arg>
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<arg>--disable-gtk-doc</arg>
|
||||
<arg>--enable-gtk-doc</arg>
|
||||
</group>
|
||||
</cmdsynopsis>
|
||||
</para>
|
||||
|
||||
<formalpara>
|
||||
<title><systemitem>--disable-modules</systemitem> and
|
||||
<systemitem>--enable-modules</systemitem></title>
|
||||
|
||||
<para>
|
||||
Normally gdk-pixbuf will try to build the image file format
|
||||
loaders as little shared libraries that are loaded on
|
||||
demand. The <systemitem>--disable-modules</systemitem>
|
||||
argument indicates that they should all be built statically
|
||||
into the gdk-pixbuf library instead. This is useful for
|
||||
people who need to produce statically-linked binaries. If
|
||||
neither <systemitem>--disable-modules</systemitem> nor
|
||||
<systemitem>--enable-modules</systemitem> is specified, then
|
||||
the <command>configure</command> script will try to
|
||||
auto-detect whether shared modules work on your system.
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
<formalpara>
|
||||
<title><systemitem>--disable-gtk-doc</systemitem> and
|
||||
<systemitem>--enable-gtk-doc</systemitem></title>
|
||||
|
||||
<para>
|
||||
By default the <command>configure</command> script will try
|
||||
to auto-detect whether the
|
||||
<productname>gtk-doc</productname> package is installed. If
|
||||
it is, then it will use it to extract and build the
|
||||
documentation for the gdk-pixbuf library. These options can
|
||||
be used to explicitly control whether gtk-doc should be used
|
||||
or not. If it is not used, the distributed, pre-generated
|
||||
HTML files will be installed instead of building them on
|
||||
your machine.
|
||||
</para>
|
||||
</formalpara>
|
||||
</sect1>
|
||||
</appendix>
|
||||
|
||||
<!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("gdk-pixbuf.sgml" "book" "book" "")
|
||||
End:
|
||||
-->
|
||||
414
docs/reference/gdk-pixbuf/gdk-pixbuf-decl.txt
Normal file
414
docs/reference/gdk-pixbuf/gdk-pixbuf-decl.txt
Normal file
@@ -0,0 +1,414 @@
|
||||
<USER_FUNCTION>
|
||||
<NAME>ModulePreparedNotifyFunc</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *pixbuf, gpointer user_data
|
||||
</USER_FUNCTION>
|
||||
<USER_FUNCTION>
|
||||
<NAME>ModuleUpdatedNotifyFunc</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *pixbuf,
|
||||
guint x, guint y,
|
||||
guint width, guint height,
|
||||
gpointer user_data
|
||||
</USER_FUNCTION>
|
||||
<USER_FUNCTION>
|
||||
<NAME>ModuleFrameDoneNotifyFunc</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbufFrame *frame,
|
||||
gpointer user_data
|
||||
</USER_FUNCTION>
|
||||
<USER_FUNCTION>
|
||||
<NAME>ModuleAnimationDoneNotifyFunc</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *pixbuf,
|
||||
gpointer user_data
|
||||
</USER_FUNCTION>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbufModule</NAME>
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbufModule</NAME>
|
||||
struct GdkPixbufModule {
|
||||
char *module_name;
|
||||
gboolean (* format_check) (guchar *buffer, int size);
|
||||
GModule *module;
|
||||
GdkPixbuf *(* load) (FILE *f);
|
||||
GdkPixbuf *(* load_xpm_data) (const char **data);
|
||||
|
||||
/* Incremental loading */
|
||||
|
||||
gpointer (* begin_load) (ModulePreparedNotifyFunc prepare_func,
|
||||
ModuleUpdatedNotifyFunc update_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data);
|
||||
void (* stop_load) (gpointer context);
|
||||
gboolean (* load_increment) (gpointer context, const guchar *buf, guint size);
|
||||
|
||||
/* Animation loading */
|
||||
GdkPixbufAnimation *(* load_animation) (FILE *f);
|
||||
};
|
||||
</STRUCT>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_module</NAME>
|
||||
<RETURNS>GdkPixbufModule *</RETURNS>
|
||||
guchar *buffer, guint size
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_load_module</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbufModule *image_module
|
||||
</FUNCTION>
|
||||
<MACRO>
|
||||
<NAME>GDK_TYPE_PIXBUF_LOADER</NAME>
|
||||
#define GDK_TYPE_PIXBUF_LOADER (gdk_pixbuf_loader_get_type ())
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GDK_PIXBUF_LOADER</NAME>
|
||||
#define GDK_PIXBUF_LOADER(obj) (GTK_CHECK_CAST ((obj), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoader))
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GDK_PIXBUF_LOADER_CLASS</NAME>
|
||||
#define GDK_PIXBUF_LOADER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoaderClass))
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GDK_IS_PIXBUF_LOADER</NAME>
|
||||
#define GDK_IS_PIXBUF_LOADER(obj) (GTK_CHECK_TYPE ((obj), GDK_TYPE_PIXBUF_LOADER))
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GDK_IS_PIXBUF_LOADER_CLASS</NAME>
|
||||
#define GDK_IS_PIXBUF_LOADER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_LOADER))
|
||||
</MACRO>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbufLoader</NAME>
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbufLoader</NAME>
|
||||
struct GdkPixbufLoader
|
||||
{
|
||||
GtkObject object;
|
||||
|
||||
/* < Private > */
|
||||
gpointer private;
|
||||
};
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbufLoaderClass</NAME>
|
||||
</STRUCT>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_loader_get_type</NAME>
|
||||
<RETURNS>GtkType </RETURNS>
|
||||
void
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_loader_new</NAME>
|
||||
<RETURNS>GdkPixbufLoader *</RETURNS>
|
||||
void
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_loader_write</NAME>
|
||||
<RETURNS>gboolean </RETURNS>
|
||||
GdkPixbufLoader *loader,const guchar *buf,size_t count
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_loader_get_pixbuf</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
GdkPixbufLoader *loader
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_loader_get_animation</NAME>
|
||||
<RETURNS>GdkPixbufAnimation *</RETURNS>
|
||||
GdkPixbufLoader *loader
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_loader_close</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbufLoader *loader
|
||||
</FUNCTION>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbuf</NAME>
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbufFrame</NAME>
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbufAnimation</NAME>
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbuf</NAME>
|
||||
struct GdkPixbuf {
|
||||
/* Reference count */
|
||||
int ref_count;
|
||||
|
||||
/* Libart pixbuf */
|
||||
ArtPixBuf *art_pixbuf;
|
||||
};
|
||||
</STRUCT>
|
||||
<ENUM>
|
||||
<NAME>GdkPixbufFrameAction</NAME>
|
||||
typedef enum {
|
||||
GDK_PIXBUF_FRAME_RETAIN,
|
||||
GDK_PIXBUF_FRAME_DISPOSE,
|
||||
GDK_PIXBUF_FRAME_REVERT
|
||||
} GdkPixbufFrameAction;
|
||||
</ENUM>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbufFrame</NAME>
|
||||
struct GdkPixbufFrame {
|
||||
/* The pixbuf with this frame's image data */
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
/* Offsets for overlaying onto the animation's area */
|
||||
int x_offset;
|
||||
int y_offset;
|
||||
|
||||
/* Frame duration in ms */
|
||||
int delay_time;
|
||||
|
||||
/* Overlay mode */
|
||||
GdkPixbufFrameAction action;
|
||||
};
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbufAnimation</NAME>
|
||||
struct GdkPixbufAnimation {
|
||||
/* Reference count */
|
||||
int ref_count;
|
||||
|
||||
/* Number of frames */
|
||||
int n_frames;
|
||||
|
||||
/* List of GdkPixbufFrame structures */
|
||||
GList *frames;
|
||||
};
|
||||
</STRUCT>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_format</NAME>
|
||||
<RETURNS>ArtPixFormat </RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_n_channels</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_has_alpha</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_bits_per_sample</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_pixels</NAME>
|
||||
<RETURNS>guchar *</RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_width</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_height</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_rowstride</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_ref</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_unref</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_new_from_art_pixbuf</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
ArtPixBuf *art_pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_new</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
ArtPixFormat format, gboolean has_alpha, int bits_per_sample,int width, int height
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_new_from_file</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
const char *filename
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_new_from_data</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
guchar *data,ArtPixFormat format,gboolean has_alpha,int width, int height,int rowstride,ArtDestroyNotify dfunc,gpointer dfunc_data
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_new_from_xpm_data</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
const char **data
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_add_alpha</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
GdkPixbuf *pixbuf, gboolean substitute_color,guchar r, guchar g, guchar b
|
||||
</FUNCTION>
|
||||
<ENUM>
|
||||
<NAME>GdkPixbufAlphaMode</NAME>
|
||||
typedef enum {
|
||||
GDK_PIXBUF_ALPHA_BILEVEL,
|
||||
GDK_PIXBUF_ALPHA_FULL
|
||||
} GdkPixbufAlphaMode;
|
||||
</ENUM>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_render_threshold_alpha</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *pixbuf, GdkBitmap *bitmap,int src_x, int src_y,int dest_x, int dest_y,int width, int height,int alpha_threshold
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_render_to_drawable</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *pixbuf,GdkDrawable *drawable, GdkGC *gc,int src_x, int src_y,int dest_x, int dest_y,int width, int height,GdkRgbDither dither,int x_dither, int y_dither
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_render_to_drawable_alpha</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *pixbuf, GdkDrawable *drawable,int src_x, int src_y,int dest_x, int dest_y,int width, int height,GdkPixbufAlphaMode alpha_mode,int alpha_threshold,GdkRgbDither dither,int x_dither, int y_dither
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_render_pixmap_and_mask</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *pixbuf,GdkPixmap **pixmap_return, GdkBitmap **mask_return,int alpha_threshold
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_from_drawable</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
GdkPixbuf *dest,GdkDrawable *src, GdkColormap *cmap,int src_x, int src_y,int dest_x, int dest_y,int width, int height
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_copy_area</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *src_pixbuf,int src_x, int src_y,int width, int height,GdkPixbuf *dest_pixbuf,int dest_x, int dest_y
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_scale</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *src,GdkPixbuf *dest,int dest_x,int dest_y,int dest_width,int dest_height,double offset_x,double offset_y,double scale_x,double scale_y,ArtFilterLevel filter_level
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_composite</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *src,GdkPixbuf *dest,int dest_x,int dest_y,int dest_width,int dest_height,double offset_x,double offset_y,double scale_x,double scale_y,ArtFilterLevel filter_level,int overall_alpha
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_composite_color</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *src,GdkPixbuf *dest,int dest_x,int dest_y,int dest_width,int dest_height,double offset_x,double offset_y,double scale_x,double scale_y,ArtFilterLevel filter_level,int overall_alpha,int check_x,int check_y,int check_size,art_u32 color1,art_u32 color2
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_scale_simple</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
GdkPixbuf *src,int dest_width,int dest_height,ArtFilterLevel filter_level
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_composite_color_simple</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
GdkPixbuf *src,int dest_width,int dest_height,ArtFilterLevel filter_level,int overall_alpha,int check_size,art_u32 color1,art_u32 color2
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_animation_new_from_file</NAME>
|
||||
<RETURNS>GdkPixbufAnimation *</RETURNS>
|
||||
const char *filename
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_animation_ref</NAME>
|
||||
<RETURNS>GdkPixbufAnimation *</RETURNS>
|
||||
GdkPixbufAnimation *animation
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_animation_unref</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbufAnimation *animation
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_preinit</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
gpointer app, gpointer modinfo
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_postinit</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
gpointer app, gpointer modinfo
|
||||
</FUNCTION>
|
||||
<MACRO>
|
||||
<NAME>GNOME_TYPE_CANVAS_PIXBUF</NAME>
|
||||
#define GNOME_TYPE_CANVAS_PIXBUF (gnome_canvas_pixbuf_get_type ())
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GNOME_CANVAS_PIXBUF</NAME>
|
||||
#define GNOME_CANVAS_PIXBUF(obj) (GTK_CHECK_CAST ((obj), \
|
||||
GNOME_TYPE_CANVAS_PIXBUF, GnomeCanvasPixbuf))
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GNOME_CANVAS_PIXBUF_CLASS</NAME>
|
||||
#define GNOME_CANVAS_PIXBUF_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), \
|
||||
GNOME_TYPE_CANVAS_PIXBUF, GnomeCanvasPixbufClass))
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GNOME_IS_CANVAS_PIXBUF</NAME>
|
||||
#define GNOME_IS_CANVAS_PIXBUF(obj) (GTK_CHECK_TYPE ((obj), GNOME_TYPE_CANVAS_PIXBUF))
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GNOME_IS_CANVAS_PIXBUF_CLASS</NAME>
|
||||
#define GNOME_IS_CANVAS_PIXBUF_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), \
|
||||
GNOME_TYPE_CANVAS_PIXBUF))
|
||||
</MACRO>
|
||||
<STRUCT>
|
||||
<NAME>GnomeCanvasPixbuf</NAME>
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GnomeCanvasPixbufClass</NAME>
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GnomeCanvasPixbuf</NAME>
|
||||
struct GnomeCanvasPixbuf {
|
||||
GnomeCanvasItem item;
|
||||
|
||||
/* Private data */
|
||||
gpointer priv;
|
||||
};
|
||||
</STRUCT>
|
||||
<FUNCTION>
|
||||
<NAME>gnome_canvas_pixbuf_get_type</NAME>
|
||||
<RETURNS>GtkType </RETURNS>
|
||||
void
|
||||
</FUNCTION>
|
||||
<MACRO>
|
||||
<NAME>GDK_PIXBUF_MAJOR</NAME>
|
||||
#define GDK_PIXBUF_MAJOR (0)
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GDK_PIXBUF_MINOR</NAME>
|
||||
#define GDK_PIXBUF_MINOR (4)
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GDK_PIXBUF_MICRO</NAME>
|
||||
#define GDK_PIXBUF_MICRO (0)
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GDK_PIXBUF_VERSION</NAME>
|
||||
#define GDK_PIXBUF_VERSION "0.4.0"
|
||||
</MACRO>
|
||||
<VARIABLE>
|
||||
<NAME>gdk_pixbuf_version</NAME>
|
||||
extern const char *gdk_pixbuf_version;
|
||||
</VARIABLE>
|
||||
105
docs/reference/gdk-pixbuf/gdk-pixbuf-sections.txt
Normal file
105
docs/reference/gdk-pixbuf/gdk-pixbuf-sections.txt
Normal file
@@ -0,0 +1,105 @@
|
||||
<INCLUDE>gdk-pixbuf/gdk-pixbuf.h</INCLUDE>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gdk-pixbuf</FILE>
|
||||
GdkPixbuf
|
||||
gdk_pixbuf_get_format
|
||||
gdk_pixbuf_get_n_channels
|
||||
gdk_pixbuf_get_has_alpha
|
||||
gdk_pixbuf_get_bits_per_sample
|
||||
gdk_pixbuf_get_pixels
|
||||
gdk_pixbuf_get_width
|
||||
gdk_pixbuf_get_height
|
||||
gdk_pixbuf_get_rowstride
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>refcounting</FILE>
|
||||
gdk_pixbuf_ref
|
||||
gdk_pixbuf_unref
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>file-loading</FILE>
|
||||
gdk_pixbuf_new_from_file
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>creating</FILE>
|
||||
gdk_pixbuf_new_from_art_pixbuf
|
||||
gdk_pixbuf_new
|
||||
gdk_pixbuf_new_from_data
|
||||
gdk_pixbuf_new_from_xpm_data
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>rendering</FILE>
|
||||
GdkPixbufAlphaMode
|
||||
gdk_pixbuf_render_to_drawable_alpha
|
||||
gdk_pixbuf_render_to_drawable
|
||||
gdk_pixbuf_render_threshold_alpha
|
||||
gdk_pixbuf_render_pixmap_and_mask
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>from-drawables</FILE>
|
||||
gdk_pixbuf_get_from_drawable
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>util</FILE>
|
||||
gdk_pixbuf_add_alpha
|
||||
gdk_pixbuf_copy_area
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>animation</FILE>
|
||||
GdkPixbufFrameAction
|
||||
GdkPixbufFrame
|
||||
GdkPixbufAnimation
|
||||
gdk_pixbuf_animation_new_from_file
|
||||
gdk_pixbuf_animation_ref
|
||||
gdk_pixbuf_animation_unref
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>scaling</FILE>
|
||||
gdk_pixbuf_scale
|
||||
gdk_pixbuf_composite
|
||||
gdk_pixbuf_composite_color
|
||||
gdk_pixbuf_scale_simple
|
||||
gdk_pixbuf_composite_color_simple
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gdk-pixbuf-loader</FILE>
|
||||
GDK_PIXBUF_LOADER
|
||||
<TITLE>GdkPixbufLoader</TITLE>
|
||||
gdk_pixbuf_loader_new
|
||||
gdk_pixbuf_loader_write
|
||||
gdk_pixbuf_loader_get_pixbuf
|
||||
gdk_pixbuf_loader_get_animation
|
||||
gdk_pixbuf_loader_close
|
||||
<SUBSECTION Standard>
|
||||
GDK_TYPE_PIXBUF_LOADER
|
||||
GDK_IS_PIXBUF_LOADER
|
||||
gdk_pixbuf_loader_get_type
|
||||
GDK_PIXBUF_LOADER_CLASS
|
||||
GDK_IS_PIXBUF_LOADER_CLASS
|
||||
<SUBSECTION Private>
|
||||
GdkPixbufLoader
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gnome-canvas-pixbuf</FILE>
|
||||
GNOME_CANVAS_PIXBUF
|
||||
<TITLE>GnomeCanvasPixbuf</TITLE>
|
||||
<SUBSECTION Standard>
|
||||
GNOME_TYPE_CANVAS_PIXBUF
|
||||
GNOME_IS_CANVAS_PIXBUF
|
||||
gnome_canvas_pixbuf_get_type
|
||||
GNOME_CANVAS_PIXBUF_CLASS
|
||||
GNOME_IS_CANVAS_PIXBUF_CLASS
|
||||
<SUBSECTION Private>
|
||||
GnomeCanvasPixbuf
|
||||
</SECTION>
|
||||
66
docs/reference/gdk-pixbuf/gdk-pixbuf.args
Normal file
66
docs/reference/gdk-pixbuf/gdk-pixbuf.args
Normal file
@@ -0,0 +1,66 @@
|
||||
<ARG>
|
||||
<NAME>GnomeCanvasPixbuf::pixbuf</NAME>
|
||||
<TYPE>gpointer</TYPE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GnomeCanvasPixbuf::width</NAME>
|
||||
<TYPE>gdouble</TYPE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GnomeCanvasPixbuf::width_set</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GnomeCanvasPixbuf::width_in_pixels</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GnomeCanvasPixbuf::height</NAME>
|
||||
<TYPE>gdouble</TYPE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GnomeCanvasPixbuf::height_set</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GnomeCanvasPixbuf::height_in_pixels</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GnomeCanvasPixbuf::x</NAME>
|
||||
<TYPE>gdouble</TYPE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GnomeCanvasPixbuf::x_in_pixels</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GnomeCanvasPixbuf::y</NAME>
|
||||
<TYPE>gdouble</TYPE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GnomeCanvasPixbuf::y_in_pixels</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
</ARG>
|
||||
|
||||
4
docs/reference/gdk-pixbuf/gdk-pixbuf.hierarchy
Normal file
4
docs/reference/gdk-pixbuf/gdk-pixbuf.hierarchy
Normal file
@@ -0,0 +1,4 @@
|
||||
GtkObject
|
||||
GdkPixbufLoader
|
||||
GnomeCanvasItem
|
||||
GnomeCanvasPixbuf
|
||||
63
docs/reference/gdk-pixbuf/gdk-pixbuf.sgml
Normal file
63
docs/reference/gdk-pixbuf/gdk-pixbuf.sgml
Normal file
@@ -0,0 +1,63 @@
|
||||
<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
|
||||
<!entity gdk-pixbuf-gdk-pixbuf SYSTEM "sgml/gdk-pixbuf.sgml">
|
||||
<!entity gdk-pixbuf-refcounting SYSTEM "sgml/refcounting.sgml">
|
||||
<!entity gdk-pixbuf-file-loading SYSTEM "sgml/file-loading.sgml">
|
||||
<!entity gdk-pixbuf-creating SYSTEM "sgml/creating.sgml">
|
||||
<!entity gdk-pixbuf-rendering SYSTEM "sgml/rendering.sgml">
|
||||
<!entity gdk-pixbuf-scaling SYSTEM "sgml/scaling.sgml">
|
||||
<!entity gdk-pixbuf-from-drawables SYSTEM "sgml/from-drawables.sgml">
|
||||
<!entity gdk-pixbuf-util SYSTEM "sgml/util.sgml">
|
||||
<!entity gdk-pixbuf-animation SYSTEM "sgml/animation.sgml">
|
||||
<!entity GdkPixbufLoader SYSTEM "sgml/gdk-pixbuf-loader.sgml">
|
||||
<!entity GnomeCanvasPixbuf SYSTEM "sgml/gnome-canvas-pixbuf.sgml">
|
||||
<!entity Compiling SYSTEM "compiling.sgml">
|
||||
]>
|
||||
|
||||
<book>
|
||||
<bookinfo>
|
||||
<title>The GdkPixbuf Library</title>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Federico</firstname>
|
||||
<surname>Mena Quintero</surname>
|
||||
<affiliation>
|
||||
<address>
|
||||
<email>federico@gimp.org</email>
|
||||
</address>
|
||||
</affiliation>
|
||||
</author>
|
||||
</authorgroup>
|
||||
|
||||
<copyright>
|
||||
<year>1999</year>
|
||||
<holder>The Free Software Foundation</holder>
|
||||
</copyright>
|
||||
</bookinfo>
|
||||
|
||||
<reference>
|
||||
<title>API Reference</title>
|
||||
|
||||
<partintro>
|
||||
<para>
|
||||
This part presents the class and function reference for the
|
||||
GdkPixbuf library. Classes are described together with their
|
||||
methods; individual functions are grouped by functional group.
|
||||
</para>
|
||||
</partintro>
|
||||
|
||||
&gdk-pixbuf-gdk-pixbuf;
|
||||
&gdk-pixbuf-refcounting;
|
||||
&gdk-pixbuf-file-loading;
|
||||
&gdk-pixbuf-creating;
|
||||
&gdk-pixbuf-rendering;
|
||||
&gdk-pixbuf-scaling;
|
||||
&gdk-pixbuf-from-drawables;
|
||||
&gdk-pixbuf-util;
|
||||
&gdk-pixbuf-animation;
|
||||
&GdkPixbufLoader;
|
||||
&GnomeCanvasPixbuf;
|
||||
</reference>
|
||||
|
||||
&Compiling;
|
||||
</book>
|
||||
34
docs/reference/gdk-pixbuf/gdk-pixbuf.signals
Normal file
34
docs/reference/gdk-pixbuf/gdk-pixbuf.signals
Normal file
@@ -0,0 +1,34 @@
|
||||
<SIGNAL>
|
||||
<NAME>GdkPixbufLoader::area-updated</NAME>
|
||||
<RETURNS>void</RETURNS>
|
||||
GdkPixbufLoader *gdkpixbufloader
|
||||
gint arg1
|
||||
gint arg2
|
||||
gint arg3
|
||||
gint arg4
|
||||
</SIGNAL>
|
||||
|
||||
<SIGNAL>
|
||||
<NAME>GdkPixbufLoader::area-prepared</NAME>
|
||||
<RETURNS>void</RETURNS>
|
||||
GdkPixbufLoader *gdkpixbufloader
|
||||
</SIGNAL>
|
||||
|
||||
<SIGNAL>
|
||||
<NAME>GdkPixbufLoader::frame-done</NAME>
|
||||
<RETURNS>void</RETURNS>
|
||||
GdkPixbufLoader *gdkpixbufloader
|
||||
</SIGNAL>
|
||||
|
||||
<SIGNAL>
|
||||
<NAME>GdkPixbufLoader::animation-done</NAME>
|
||||
<RETURNS>void</RETURNS>
|
||||
GdkPixbufLoader *gdkpixbufloader
|
||||
</SIGNAL>
|
||||
|
||||
<SIGNAL>
|
||||
<NAME>GdkPixbufLoader::closed</NAME>
|
||||
<RETURNS>void</RETURNS>
|
||||
GdkPixbufLoader *gdkpixbufloader
|
||||
</SIGNAL>
|
||||
|
||||
7
docs/reference/gdk-pixbuf/gdk-pixbuf.types
Normal file
7
docs/reference/gdk-pixbuf/gdk-pixbuf.types
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <gnome.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf-loader.h>
|
||||
#include <gdk-pixbuf/gnome-canvas-pixbuf.h>
|
||||
|
||||
gdk_pixbuf_loader_get_type
|
||||
gnome_canvas_pixbuf_get_type
|
||||
91
docs/reference/gdk-pixbuf/tmpl/animation.sgml
Normal file
91
docs/reference/gdk-pixbuf/tmpl/animation.sgml
Normal file
@@ -0,0 +1,91 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
Animations
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Animations as multi-frame structures.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The GdkPixbuf library provides a simple mechanism to load and
|
||||
represent animations, primarily animated GIF files. Animations
|
||||
are represented as lists of #GdkPixbufFrame structures. Each
|
||||
frame structure contains a #GdkPixbuf structure and information
|
||||
about the frame's overlay mode and duration.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#GdkPixbufLoader
|
||||
</para>
|
||||
|
||||
<!-- ##### ENUM GdkPixbufFrameAction ##### -->
|
||||
<para>
|
||||
Each animation frame can have several things happen to it when the
|
||||
next frame is displayed. The #GdkPixbufFrameAction determines this.
|
||||
If a frame as marked as #GDK_PIXBUF_FRAME_RETAIN, then the image
|
||||
will remain displayed, and will be potentially occluded by the next
|
||||
frame. If it is marked as #GDK_PIXBUF_FRAME_DISPOSE, then the
|
||||
animation is reverted to the setting before the frame was shown. If
|
||||
it is marked as #GDK_PIXBUF_FRAME_REVERT, then the animation is
|
||||
reverted to the first image before continuing.
|
||||
</para>
|
||||
|
||||
@GDK_PIXBUF_FRAME_RETAIN:
|
||||
@GDK_PIXBUF_FRAME_DISPOSE:
|
||||
@GDK_PIXBUF_FRAME_REVERT:
|
||||
|
||||
<!-- ##### STRUCT GdkPixbufFrame ##### -->
|
||||
<para>
|
||||
This structure describes a frame in a #GdkPixbufAnimation. Each
|
||||
frame consists of a #GdkPixbuf, an offset of the frame within the
|
||||
animation's bounding box, a duration, and an overlay mode or
|
||||
action.
|
||||
</para>
|
||||
|
||||
@pixbuf: The frame's image contents.
|
||||
@x_offset: X offset of the frame inside the animation's bounding box.
|
||||
@y_offset: Y offset of the frame inside the animation's bounding box.
|
||||
@delay_time: Duration of the frame in milliseconds.
|
||||
@action: Overlay mode.
|
||||
|
||||
<!-- ##### STRUCT GdkPixbufAnimation ##### -->
|
||||
<para>
|
||||
This structure describes an animation, which is represented as a
|
||||
list of #GdkPixbufFrame structures.
|
||||
</para>
|
||||
|
||||
@ref_count: Reference count.
|
||||
@n_frames: Number of frames in the animation.
|
||||
@frames: List of #GdkPixbufFrame structures.
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_animation_new_from_file ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@filename:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_animation_ref ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@animation:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_animation_unref ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@animation: <!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
End:
|
||||
-->
|
||||
|
||||
|
||||
96
docs/reference/gdk-pixbuf/tmpl/creating.sgml
Normal file
96
docs/reference/gdk-pixbuf/tmpl/creating.sgml
Normal file
@@ -0,0 +1,96 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
Image Data in Memory
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Creating a pixbuf from image data that is already in memory.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The most basic way to create a pixbuf is to wrap an existing
|
||||
#ArtPixBuf structure with a #GdkPixbuf to add reference counting
|
||||
capabilities to it. The gdk_pixbuf_new_from_art_pixbuf() performs
|
||||
this operation.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
As a convenience, you can use the gdk_pixbuf_new_from_data()
|
||||
function to wrap an existing data buffer with a #GdkPixbuf. You
|
||||
need to specify the destroy notification function that will be
|
||||
called when the data buffer needs to be freed; this will happen
|
||||
when the pixbuf's reference count drops to zero and thus the
|
||||
#ArtPixBuf needs to be destroyed. If you have a chunk of static
|
||||
data compiled into your application, you can pass in #NULL as the
|
||||
destroy notification function so that the data will not be freed.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The gdk_pixbuf_new() function can be used as a convenience to
|
||||
create a pixbuf with an empty buffer. This is equivalent to
|
||||
allocating a data buffer using malloc() and then wrapping it with
|
||||
gdk_pixbuf_new_from_data(). The gdk_pixbuf_new() function will
|
||||
compute an optimal rowstride so that rendering can be performed
|
||||
with an efficient algorithm.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
As a special case, you can use the gdk_pixbuf_new_from_xpm_data()
|
||||
function to create a pixbuf from inline XPM image data.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#ArtPixBuf
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_new_from_art_pixbuf ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@art_pixbuf:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@format:
|
||||
@has_alpha:
|
||||
@bits_per_sample:
|
||||
@width:
|
||||
@height:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_new_from_data ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@data:
|
||||
@format:
|
||||
@has_alpha:
|
||||
@width:
|
||||
@height:
|
||||
@rowstride:
|
||||
@dfunc:
|
||||
@dfunc_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_new_from_xpm_data ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@data:
|
||||
@Returns: <!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
End:
|
||||
-->
|
||||
|
||||
|
||||
41
docs/reference/gdk-pixbuf/tmpl/file-loading.sgml
Normal file
41
docs/reference/gdk-pixbuf/tmpl/file-loading.sgml
Normal file
@@ -0,0 +1,41 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
File Loading
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Loading a pixbuf from a file.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The GdkPixbuf library provides a simple mechanism for loading an
|
||||
image from a file in synchronous fashion. This means that the
|
||||
library takes control of the application while the file is being
|
||||
loaded; from the user's point of view, the application will block
|
||||
until the image is done loading.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This interface can be used by applications in which blocking is
|
||||
acceptable while an image is being loaded. It can also be used to
|
||||
load small images in general. Applications that need progressive
|
||||
loading can use the #GdkPixbufLoader functionality instead.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#GdkPixbufLoader
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_new_from_file ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@filename:
|
||||
@Returns: <!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
End:
|
||||
-->
|
||||
|
||||
|
||||
42
docs/reference/gdk-pixbuf/tmpl/from-drawables.sgml
Normal file
42
docs/reference/gdk-pixbuf/tmpl/from-drawables.sgml
Normal file
@@ -0,0 +1,42 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
Drawables to Pixbufs
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Getting parts of a drawable's image data into a pixbuf.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The functions in this section allow you to take the image data
|
||||
from a GDK drawable and dump it into a #GdkPixbuf. This can be
|
||||
used for screenshots and other special effects. Note that these
|
||||
operations can be expensive, since the image data has to be
|
||||
transferred from the X server to the client program and converted.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#GdkPixbuf, gdk_image_get()
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_get_from_drawable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@dest:
|
||||
@src:
|
||||
@cmap:
|
||||
@src_x:
|
||||
@src_y:
|
||||
@dest_x:
|
||||
@dest_y:
|
||||
@width:
|
||||
@height:
|
||||
@Returns: <!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
End:
|
||||
-->
|
||||
|
||||
|
||||
70
docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-io.sgml
Normal file
70
docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-io.sgml
Normal file
@@ -0,0 +1,70 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
gdk-pixbuf-io
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### USER_FUNCTION ModulePreparedNotifyFunc ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@user_data:
|
||||
|
||||
|
||||
<!-- ##### USER_FUNCTION ModuleUpdatedNotifyFunc ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@user_data:
|
||||
@x:
|
||||
@y:
|
||||
@width:
|
||||
@height:
|
||||
|
||||
|
||||
<!-- ##### STRUCT GdkPixbufModule ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@module_name:
|
||||
@format_check:
|
||||
@module:
|
||||
@load:
|
||||
@load_xpm_data:
|
||||
@begin_load:
|
||||
@stop_load:
|
||||
@load_increment:
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_get_module ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buffer:
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_load_module ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@image_module:
|
||||
|
||||
|
||||
182
docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-loader.sgml
Normal file
182
docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-loader.sgml
Normal file
@@ -0,0 +1,182 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GdkPixbufLoader
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Application-driven progressive image loading.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
#GdkPixbufLoader provides a way for applications to drive the
|
||||
process of loading an image, by letting them send the image data
|
||||
directly. Applications can use this functionality instead of
|
||||
gdk_pixbuf_new_from_file() when they need to parse image data in
|
||||
small chunks. For example, it should be used when reading an image
|
||||
from a (potentially) slow network connection, or when loading an
|
||||
extremely large file.
|
||||
</para>
|
||||
<para>
|
||||
To use #GdkPixbufLoader to load an image, just create a new one, and
|
||||
call gdk_pixbuf_loader_write() to send the data to it. When done,
|
||||
gdk_pixbuf_loader_close() should be called to end the stream and
|
||||
finalize everything. The loader will emit two important signals
|
||||
throughout the process. The first, #"area_prepared", will be called
|
||||
as soon as the image has enough information to determine the size of
|
||||
the image to be used. It will pass a @GdkPixbuf in. If you want to
|
||||
use it, you can simply ref it. In addition, no actual information
|
||||
will be passed in yet, so the pixbuf can be safely filled with any
|
||||
temporary graphics (or an initial color) as needed. You can also
|
||||
call the gdk_pixbuf_loader_get_pixbuf() once this signal has been
|
||||
emitted and get the same pixbuf.
|
||||
</para>
|
||||
<para>
|
||||
The other signal, #"area_updated" gets called every
|
||||
time a region is updated. This way you can update a partially
|
||||
completed image. Note that you do not know anything about the
|
||||
completeness of an image from the area updated. For example, in an
|
||||
interlaced image, you need to make several passes before the image
|
||||
is done loading.
|
||||
</para>
|
||||
<refsect2>
|
||||
<title>Loading an animation</title>
|
||||
<para>
|
||||
Loading an animation is a little more complex then loading an
|
||||
image. In addition to the above signals, there is also a
|
||||
#"frame_done" signal, as well as an #"animation_done" signal. The
|
||||
first lets the application know that it is dealing with an
|
||||
animation, instead of a static image. It also passes a
|
||||
#GdkPixbufFrame in the signal. As before, if you want to keep the
|
||||
frame, you need to ref it. Once the first #"frame_done" signal
|
||||
has been emitted, you can call gdk_pixbuf_loader_get_animation()
|
||||
to get the #GdkPixbufAnimation struct. Each subsequent frame goes
|
||||
through a similar lifecycle. For example #"area_prepared" is
|
||||
re-emitted. Then #"area_updated" is emitted as many times as
|
||||
necessary. Finally, #"animation_done" is emitted as soon as all
|
||||
frames are done.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
gdk_pixbuf_new_from_file()
|
||||
</para>
|
||||
|
||||
<!-- ##### MACRO GDK_PIXBUF_LOADER ##### -->
|
||||
<para>
|
||||
Casts a #GtkObject to a #GdkPixbufLoader.
|
||||
</para>
|
||||
|
||||
@obj: A GTK+ object.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_loader_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_loader_write ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@loader:
|
||||
@buf:
|
||||
@count:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_loader_get_pixbuf ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@loader:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_loader_get_animation ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@loader:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_loader_close ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@loader:
|
||||
|
||||
|
||||
<!-- ##### SIGNAL GdkPixbufLoader::area-updated ##### -->
|
||||
<para>
|
||||
This signal is emitted when a significant area of the image being
|
||||
loaded has been updated. Normally it means that a complete
|
||||
scanline has been read in, but it could be a different area as
|
||||
well. Applications can use this signal to know when to repaint
|
||||
areas of an image that is being loaded.
|
||||
</para>
|
||||
|
||||
@gdkpixbufloader: the object which received the signal.
|
||||
@arg1:
|
||||
@arg2:
|
||||
@arg3:
|
||||
@arg4:
|
||||
<!-- # Unused Parameters # -->
|
||||
@loader: Loader which emitted the signal.
|
||||
@x: X offset of upper-left corner of the updated area.
|
||||
@y: Y offset of upper-left corner of the updated area.
|
||||
@width: Width of updated area.
|
||||
@height: Height of updated area.
|
||||
|
||||
<!-- ##### SIGNAL GdkPixbufLoader::area-prepared ##### -->
|
||||
<para>
|
||||
This signal is emitted when the pixbuf loader has been fed the
|
||||
initial amount of data that is required to figure out the size and
|
||||
format of the image that it will create. After this signal is
|
||||
emitted, applications can call gdk_pixbuf_loader_get_pixbuf() to
|
||||
fetch the partially-loaded pixbuf.
|
||||
</para>
|
||||
|
||||
@gdkpixbufloader: the object which received the signal.
|
||||
<!-- # Unused Parameters # -->
|
||||
@loader: Loader which emitted the signal.
|
||||
|
||||
<!-- ##### SIGNAL GdkPixbufLoader::frame-done ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@gdkpixbufloader: the object which received the signal.
|
||||
|
||||
<!-- ##### SIGNAL GdkPixbufLoader::animation-done ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@gdkpixbufloader: the object which received the signal.
|
||||
|
||||
<!-- ##### SIGNAL GdkPixbufLoader::closed ##### -->
|
||||
<para>
|
||||
This signal is emitted when gdk_pixbuf_loader_close() is called.
|
||||
It can be used by different parts of an application to receive
|
||||
notification when an image loader is closed by the code that
|
||||
drives it.
|
||||
</para>
|
||||
|
||||
@gdkpixbufloader: the object which received the signal.
|
||||
<!-- # Unused Parameters # -->
|
||||
@loader: Loader which emitted the signal.
|
||||
|
||||
<!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
End:
|
||||
-->
|
||||
|
||||
114
docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-unused.sgml
Normal file
114
docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-unused.sgml
Normal file
@@ -0,0 +1,114 @@
|
||||
<!-- ##### SECTION ./tmpl/gdk-pixbuf-io.sgml:See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_load_module ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@image_module:
|
||||
|
||||
<!-- ##### SECTION ./tmpl/gdk-pixbuf-io.sgml:Short_Description ##### -->
|
||||
|
||||
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:height_pixels ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### STRUCT GdkPixbufModule ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@module_name:
|
||||
@format_check:
|
||||
@module:
|
||||
@load:
|
||||
@load_xpm_data:
|
||||
@begin_load:
|
||||
@stop_load:
|
||||
@load_increment:
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:y_pixels ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SECTION ./tmpl/gdk-pixbuf-io.sgml:Long_Description ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### USER_FUNCTION ModuleUpdatedNotifyFunc ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@user_data:
|
||||
@x:
|
||||
@y:
|
||||
@width:
|
||||
@height:
|
||||
|
||||
<!-- ##### SECTION ./tmpl/gdk-pixbuf-io.sgml:Title ##### -->
|
||||
gdk-pixbuf-io
|
||||
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:x_set ##### -->
|
||||
<para>
|
||||
Determines whether the <link
|
||||
linkend="GnomeCanvasPixbuf--x">x</link> argument is used to
|
||||
translate the pixbuf from its logical origin in item-relative
|
||||
coordinates.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:y_set ##### -->
|
||||
<para>
|
||||
Determines whether the <link
|
||||
linkend="GnomeCanvasPixbuf--y">y</link> argument is used to
|
||||
translate the pixbuf from its logical origin in item-relative
|
||||
coordinates. Works in the same way as the <link
|
||||
linkend="GnomeCanvasPixbuf--x-set">x_set</link> argument. The
|
||||
default is %FALSE.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### USER_FUNCTION ModulePreparedNotifyFunc ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@user_data:
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:x_pixels ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_get_module ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buffer:
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:width_pixels ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
108
docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf.sgml
Normal file
108
docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf.sgml
Normal file
@@ -0,0 +1,108 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
The GdkPixbuf Structure
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Information that describes an image.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
|
||||
<para>
|
||||
The <structname>GdkPixbuf</structname> structure contains
|
||||
information that describes an image in memory. It is actually a
|
||||
simple wrapper that adds reference counting capabilities to an
|
||||
#ArtPixBuf structure.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#ArtPixBuf
|
||||
</para>
|
||||
|
||||
<!-- ##### STRUCT GdkPixbuf ##### -->
|
||||
<para>
|
||||
This is the main structure in the GdkPixbuf library. This
|
||||
structure adds reference counting capabilities to an #ArtPixBuf
|
||||
structure.
|
||||
</para>
|
||||
|
||||
@ref_count: Reference count.
|
||||
@art_pixbuf: An #ArtPixBuf that actually contains the description of
|
||||
the image data.
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_get_format ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_get_n_channels ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_get_has_alpha ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_get_bits_per_sample ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_get_pixels ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_get_width ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_get_height ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_get_rowstride ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@Returns: <!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
End:
|
||||
-->
|
||||
|
||||
|
||||
302
docs/reference/gdk-pixbuf/tmpl/gnome-canvas-pixbuf.sgml
Normal file
302
docs/reference/gdk-pixbuf/tmpl/gnome-canvas-pixbuf.sgml
Normal file
@@ -0,0 +1,302 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GnomeCanvasPixbuf
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Canvas item to display #GdkPixbuf images.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
This canvas item displays #GdkPixbuf images. It handles full
|
||||
affine transformations in both GDK and antialiased modes, and also
|
||||
supports the <ulink url="http://www.w3.org">W3C</ulink>'s <ulink
|
||||
url="http://www.w3.org/Graphics/SVG/">SVG</ulink>-like scaling and
|
||||
translation semantics for absolute pixel values.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
#GdkPixbuf structures may be shared among different pixbuf canvas
|
||||
items; the pixbuf item uses #GdkPixbuf's reference counting
|
||||
functions for this.
|
||||
</para>
|
||||
|
||||
<refsect2>
|
||||
<title>Custom Scaling and Translation</title>
|
||||
|
||||
<para>
|
||||
In addition to the normal affine transformations supported by
|
||||
canvas items, the #GnomeCanvasPixbuf item supports independent
|
||||
object arguments for scaling and translation. This is useful
|
||||
for explicitly setting a size to which the pixbuf's image will
|
||||
be scaled, and for specifying translation offsets that take
|
||||
place in the item's local coordinate system.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
By default, the pixbuf canvas item will attain the size in units
|
||||
of the #GdkPixbuf it contains. If a #GnomeCanvasPixbuf is
|
||||
configured to use a #GdkPixbuf that has a size of 300 by 200
|
||||
pixels, then the pixbuf item will automatically obtain a size of
|
||||
300 by 200 units in the item's local coordinate system. If the
|
||||
item is transformed with a scaling transformation of (0.5, 2.0),
|
||||
then the final image size will be of 150 by 400 pixels.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To set custom width and height values, you must set the <link
|
||||
linkend="GnomeCanvasPixbuf--width-set">width_set</link> or <link
|
||||
linkend="GnomeCanvasPixbuf--height-set">height_set</link>
|
||||
arguments to %TRUE, and then set the <link
|
||||
linkend="GnomeCanvasPixbuf--width">width</link> or <link
|
||||
linkend="GnomeCanvasPixbuf--height">height</link> arguments to
|
||||
the desired values. The former two arguments control whether
|
||||
the latter two are used when computing the final image's size;
|
||||
they are both %FALSE by default so that the pixbuf item will
|
||||
attain a size in units equal to the size in pixels of the
|
||||
#GdkPixbuf that the item contains.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The custom translation offsets are controlled by the <link
|
||||
linkend="GnomeCanvasPixbuf--x">x</link> and <link
|
||||
linkend="GnomeCanvasPixbuf--y">y</link> arguments. The logical
|
||||
upper-left vertex of the image will be translated by the
|
||||
specified distance, aligned with the item's local coordinate
|
||||
system.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2>
|
||||
<title>Absolute Pixel Scaling and Translation</title>
|
||||
|
||||
<para>
|
||||
The <ulink url="http://www.w3.org/Graphics/SVG/">Scalable Vector
|
||||
Graphics</ulink> specification (SVG) of the <ulink
|
||||
url="http://www.w3.org">World Wide Web Consortium</ulink> also
|
||||
allows images to be translated and scaled by absolute pixel
|
||||
values that are independent of an item's normal affine
|
||||
transformation.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Normally, the pixbuf item's translation and scaling arguments
|
||||
are interpreted in units, so they will be modified by the item's
|
||||
affine transformation. The <link
|
||||
linkend="GnomeCanvasPixbuf--width-in-pixels">width_in_pixels</link>,
|
||||
<link
|
||||
linkend="GnomeCanvasPixbuf--height-in-pixels">height_in_pixels</link>,
|
||||
<link
|
||||
linkend="GnomeCanvasPixbuf--x-in-pixels">x_in_pixels</link>, and
|
||||
<link
|
||||
linkend="GnomeCanvasPixbuf--y-in-pixels">y_in_pixels</link>
|
||||
object arguments can be used to modify this behavior. If one of
|
||||
these arguments is %TRUE, then the corresponding scaling or
|
||||
translation value will not be affected lengthwise by the pixbuf
|
||||
item's affine transformation.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For example, consider a pixbuf item whose size is (300, 200).
|
||||
If the item is modified with a scaling transformation of (0.5,
|
||||
2.0) but the <link
|
||||
linkend="GnomeCanvasPixbuf--width-in-pixels">width_in_pixels</link>
|
||||
is set to %TRUE, then the item will appear to be (300, 400)
|
||||
pixels in size. This means that in this case the item's affine
|
||||
transformation only applies to the height value, while the width
|
||||
value is kept in absolute pixels.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Likewise, consider a pixbuf item whose (<link
|
||||
linkend="GnomeCanvasPixbuf--x">x</link>, <link
|
||||
linkend="GnomeCanvasPixbuf--y">y</link>) arguments are set to
|
||||
(30, 40). If the item is then modified by the same scaling
|
||||
transformation of (0.5, 2.0) but the <link
|
||||
linkend="GnomeCanvasPixbuf--y-in-pixels">y_in_pixels</link>
|
||||
argument is set to %TRUE, then the image's upper-left corner
|
||||
will appear to be at position (15, 40). In this case, the
|
||||
affine transformation is applied only to the x offset, while the
|
||||
y offset is kept in absolute pixels.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In short, these arguments control whether a particular dimension
|
||||
of a pixbuf item is scaled or not in the normal way by the
|
||||
item's affine transformation.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2>
|
||||
<title>Resource Management</title>
|
||||
|
||||
<para>
|
||||
When you set the #GdkPixbuf structure that a #GnomeCanvasPixbuf
|
||||
item will use by setting the <link
|
||||
linkend="GnomeCanvasPixbuf--pixbuf">pixbuf</link> argument, a
|
||||
reference count will be added to that #GdkPixbuf structure.
|
||||
When the pixbuf item no longer needs the #GdkPixbuf structure,
|
||||
such as when the item is destroyed or when a new pixbuf
|
||||
structure is passed to it, then the old #GdkPixbuf structure
|
||||
will be automatically unreferenced.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This means that if an application just needs to load a pixbuf
|
||||
image and set it into a pixbuf canvas item, it can do the
|
||||
following to ‘forget’ about the pixbuf structure:
|
||||
|
||||
<programlisting>
|
||||
GdkPixbuf *pixbuf;
|
||||
GnomeCanvasItem *item;
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_file ("foo.png");
|
||||
g_assert (pixbuf != NULL);
|
||||
|
||||
item = gnome_canvas_item_new (gnome_canvas_root (my_canvas),
|
||||
gnome_canvas_pixbuf_get_type (),
|
||||
"pixbuf", pixbuf,
|
||||
NULL);
|
||||
gdk_pixbuf_unref (pixbuf);
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
After this happens, the reference count of the pixbuf structure
|
||||
will be 1: the gdk_pixbuf_new_from_file() function creates it
|
||||
with a reference count of 1, then setting the <link
|
||||
linkend="GnomeCanvasPixbuf--pixbuf">pixbuf</link> argument of
|
||||
the #GnomeCanvasPixbuf item increases it to 2, and then it is
|
||||
decremented to 1 by the call to gdk_pixbuf_unref(). When the
|
||||
canvas item is destroyed, it will automatically unreference the
|
||||
pixbuf structure again, causing its reference count to drop to
|
||||
zero and thus be freed.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#GnomeCanvas, #GdkPixbuf
|
||||
</para>
|
||||
|
||||
<!-- ##### MACRO GNOME_CANVAS_PIXBUF ##### -->
|
||||
<para>
|
||||
Casts a #GtkOjbect to a #GnomeCanvasPixbuf.
|
||||
</para>
|
||||
|
||||
@obj: A GTK+ object.
|
||||
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:pixbuf ##### -->
|
||||
<para>
|
||||
Contains a pointer to a #GdkPixbuf structure that will be used by
|
||||
the pixbuf canvas item as an image source. When a pixbuf is set
|
||||
its reference count is incremented; if the pixbuf item kept a
|
||||
pointer to another #GdkPixbuf structure, the reference count of
|
||||
this structure will be decremented. Also, the GdkPixbuf's
|
||||
reference count will automatically be decremented when the
|
||||
#GnomeCanvasPixbuf item is destroyed. When a pixbuf is queried, a
|
||||
reference count will not be added to the return value; you must do
|
||||
this yourself if you intend to keep the pixbuf structure around.
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:width ##### -->
|
||||
<para>
|
||||
Indicates the width the pixbuf will be scaled to. This argument
|
||||
will only be used if the <link
|
||||
linkend="GnomeCanvasPixbuf--width-set">width_set</link> argument
|
||||
is %TRUE. If the <link
|
||||
linkend="GnomeCanvasPixbuf--width-in-pixels">width_in_pixels</link>
|
||||
argument is %FALSE, the width will be taken to be in canvas units,
|
||||
and thus will be scaled along with the canvas item's affine
|
||||
transformation. If width_in_pixels is %TRUE, the width will be
|
||||
taken to be in pixels, and will visually remain a constant size
|
||||
even if the item's affine transformation changes.
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:width_set ##### -->
|
||||
<para>
|
||||
Determines whether the <link
|
||||
linkend="GnomeCanvasPixbuf--width">width</link> argument is taken
|
||||
into account when scaling the pixbuf item. If this argument is
|
||||
%FALSE, then the width value of the pixbuf's #ArtPixBuf will be
|
||||
used instead. This argument is %FALSE by default.
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:width_in_pixels ##### -->
|
||||
<para>
|
||||
If this argument is %TRUE, then the width of the pixbuf will be
|
||||
considered to be in pixels, that is, it will not be visually
|
||||
scaled even if the item's affine transformation changes. If this
|
||||
is %FALSE, then the width of the pixbuf will be considered to be
|
||||
in canvas units, and so will be scaled normally by affine
|
||||
transformations. The default is %FALSE.
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:height ##### -->
|
||||
<para>
|
||||
Indicates the height the pixbuf will be scaled to. This argument
|
||||
will only be used if the <link
|
||||
linkend="GnomeCanvasPixbuf--height-set">height_set</link> argument
|
||||
is %TRUE. Works in the same way as the <link
|
||||
linkend="GnomeCanvasPixbuf--width">width</link> argument.
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:height_set ##### -->
|
||||
<para>
|
||||
Determines whether the <link
|
||||
linkend="GnomeCanvasPixbuf--height">height</link> argument is
|
||||
taken into account when scaling the pixbuf item. Works in the
|
||||
same way as the <link
|
||||
linkend="GnomeCanvasPixbuf--width-set">width_set</link> argument.
|
||||
The default is %FALSE.
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:height_in_pixels ##### -->
|
||||
<para>
|
||||
Works in the same way as the <link
|
||||
linkend="GnomeCanvasPixbuf--width-in-pixels">width_in_pixels</link>
|
||||
argument. The default is %FALSE.
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:x ##### -->
|
||||
<para>
|
||||
Indicates the horizontal translation offset of the pixbuf item's
|
||||
image. This offset may not actually appear horizontal, since it
|
||||
will be affected by the item's affine transformation. The default
|
||||
is 0.0.
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:x_in_pixels ##### -->
|
||||
<para>
|
||||
If this argument is %TRUE, the pixbuf's translation with respect
|
||||
to its logical origin in item-relative coordinates will be in
|
||||
pixels, that is, the visible offset will not change even if the
|
||||
item's affine transformation changes. If it is %FALSE, the
|
||||
pixbuf's translation will be taken to be in canvas units, and thus
|
||||
will change along with the item's affine transformation. The
|
||||
default is %FALSE.
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:y ##### -->
|
||||
<para>
|
||||
Indicates the vertical translation offset of the pixbuf item's
|
||||
image. Works in the same way as the <link
|
||||
linkend="GnomeCanvasPixbuf--x">x</link> argument. The default is
|
||||
0.0.
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:y_in_pixels ##### -->
|
||||
<para>
|
||||
Works in the same way as the <link
|
||||
linkend="GnomeCanvasPixbuf--x-in-pixels">x_in_pixels</link>
|
||||
argument, but controls whether the <link
|
||||
linkend="GnomeCanvasPixbuf--y">y</link> translation offset is
|
||||
scaled or not. The default is %FALSE.
|
||||
</para>
|
||||
|
||||
<!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
End:
|
||||
-->
|
||||
|
||||
44
docs/reference/gdk-pixbuf/tmpl/refcounting.sgml
Normal file
44
docs/reference/gdk-pixbuf/tmpl/refcounting.sgml
Normal file
@@ -0,0 +1,44 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
Reference Counting
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Functions to perform reference counting on a #GdkPixbuf.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
#GdkPixbuf structures are reference counted. This means that
|
||||
an application can share a single pixbuf among many parts of the
|
||||
code. When a piece of the program needs to keep a pointer to a
|
||||
pixbuf, it should add a reference to it. When it no longer needs
|
||||
the pixbuf, it should subtract a reference. The pixbuf will be
|
||||
destroyed when its reference count drops to zero. Newly-created
|
||||
#GdkPixbuf structures start with a reference count of one.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#GdkPixbuf, #ArtPixBuf
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_ref ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_unref ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf: <!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
End:
|
||||
-->
|
||||
|
||||
|
||||
125
docs/reference/gdk-pixbuf/tmpl/rendering.sgml
Normal file
125
docs/reference/gdk-pixbuf/tmpl/rendering.sgml
Normal file
@@ -0,0 +1,125 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
Rendering
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Rendering a pixbuf to a GDK drawable.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The GdkPixbuf library provides several convenience functions to
|
||||
render pixbufs to GDK drawables. It uses the GdkRGB to render the
|
||||
image data.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
At this point there is not a standard alpha channel extension for
|
||||
the X Window System, so it is not possible to use full opacity
|
||||
information when painting images to arbitrary drawables. The
|
||||
GdkPixbuf convenience functions will threshold the opacity
|
||||
information to create a bi-level clipping mask (black and white),
|
||||
and use that to draw the image onto a drawable.
|
||||
</para>
|
||||
|
||||
<important>
|
||||
<para>
|
||||
Since these functions use GdkRGB for rendering, you must
|
||||
initialize GdkRGB before using any of them. You can do this by
|
||||
calling gdk_rgb_init() near the beginning of your program.
|
||||
</para>
|
||||
</important>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
GdkRGB
|
||||
</para>
|
||||
|
||||
<!-- ##### ENUM GdkPixbufAlphaMode ##### -->
|
||||
<para>
|
||||
These values can be passed to
|
||||
gdk_pixbuf_render_to_drawable_alpha() to control how the alpha
|
||||
chanel of an image should be handled. This function can create a
|
||||
bilevel clipping mask (black and white) and use it while painting
|
||||
the image. In the future, when the X Window System gets an alpha
|
||||
channel extension, it will be possible to do full alpha
|
||||
compositing onto arbitrary drawables. For now both cases fall
|
||||
back to a bilevel clipping mask.
|
||||
</para>
|
||||
|
||||
@GDK_PIXBUF_ALPHA_BILEVEL: A bilevel clipping mask (black and white)
|
||||
will be created and used to draw the image. Pixels below 0.5 opacity
|
||||
will be considered fully transparent, and all others will be
|
||||
considered fully opaque.
|
||||
@GDK_PIXBUF_ALPHA_FULL: For now falls back to #GDK_PIXBUF_ALPHA_BILEVEL.
|
||||
In the future it will do full alpha compositing.
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_render_to_drawable_alpha ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@drawable:
|
||||
@src_x:
|
||||
@src_y:
|
||||
@dest_x:
|
||||
@dest_y:
|
||||
@width:
|
||||
@height:
|
||||
@alpha_mode:
|
||||
@alpha_threshold:
|
||||
@dither:
|
||||
@x_dither:
|
||||
@y_dither:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_render_to_drawable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@drawable:
|
||||
@gc:
|
||||
@src_x:
|
||||
@src_y:
|
||||
@dest_x:
|
||||
@dest_y:
|
||||
@width:
|
||||
@height:
|
||||
@dither:
|
||||
@x_dither:
|
||||
@y_dither:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_render_threshold_alpha ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@bitmap:
|
||||
@src_x:
|
||||
@src_y:
|
||||
@dest_x:
|
||||
@dest_y:
|
||||
@width:
|
||||
@height:
|
||||
@alpha_threshold: <!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
End:
|
||||
-->
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_render_pixmap_and_mask ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@pixmap_return:
|
||||
@mask_return:
|
||||
@alpha_threshold:
|
||||
|
||||
|
||||
162
docs/reference/gdk-pixbuf/tmpl/scaling.sgml
Normal file
162
docs/reference/gdk-pixbuf/tmpl/scaling.sgml
Normal file
@@ -0,0 +1,162 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
Scaling
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Scaling pixbufs and scaling and compositing pixbufs
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
gdk-pixbuf contains functions to scale pixbufs, to scale pixbufs and
|
||||
composite against an existing image, and to scale pixbufs and
|
||||
composite against a solid color or checkerboard. (Compositing a
|
||||
checkerboard is a common way to show an image with an alpha-channel in
|
||||
image-viewing and editing software.)
|
||||
</para>
|
||||
<para>
|
||||
Since the full-featured functions (gdk_pixbuf_scale(),
|
||||
gdk_pixbuf_composite(), and gdk_pixbuf_composite_color()) are
|
||||
rather complex to use and have many arguments, two simple
|
||||
convenience functions are provided, gdk_pixbuf_scale_simple()
|
||||
and gdk_pixbuf_composite_color_simple() which create a
|
||||
new pixbuf of a given size, scale an original image to fit,
|
||||
and then return the new pixmap.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The following example demonstrates handling an expose event by
|
||||
rendering the appropriate area of a source image (which is scaled to
|
||||
fit the widget) onto the widget's window. The source image is
|
||||
rendered against a checkerboard, which provides a visual
|
||||
representation of the alpha channel if the image has one. If the image
|
||||
doesn't have an alpha channel, calling gdk_pixbuf_composite_color()
|
||||
function has exactly the same effect as calling gdk_pixbuf_scale().
|
||||
</para>
|
||||
|
||||
<programlisting>
|
||||
gboolean
|
||||
expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
{
|
||||
GdkPixbuf *dest;
|
||||
|
||||
gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
|
||||
|
||||
dest = gdk_pixbuf_new (ART_PIX_RGB, FALSE, 8, event->area.width, event->area.height);
|
||||
|
||||
gdk_pixbuf_composite_color (pixbuf, dest,
|
||||
0, 0, event->area.width, event->area.height,
|
||||
-event->area.x, -event->area.y,
|
||||
(double) widget->allocation.width / pixbuf->art_pixbuf->width,
|
||||
(double) widget->allocation.height / pixbuf->art_pixbuf->height,
|
||||
filter_level, 255,
|
||||
event->area.x, event->area.y, 16, 0xaaaaaa, 0x555555);
|
||||
|
||||
gdk_pixbuf_render_to_drawable (dest, widget->window, widget->style->fg_gc[GTK_STATE_NORMAL],
|
||||
0, 0, event->area.x, event->area.y,
|
||||
event->area.width, event->area.height,
|
||||
GDK_RGB_DITHER_NORMAL, event->area.x, event->area.y);
|
||||
|
||||
gdk_pixbuf_unref (dest);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
</programlisting>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_scale ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@src:
|
||||
@dest:
|
||||
@dest_x:
|
||||
@dest_y:
|
||||
@dest_width:
|
||||
@dest_height:
|
||||
@offset_x:
|
||||
@offset_y:
|
||||
@scale_x:
|
||||
@scale_y:
|
||||
@filter_level:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_composite ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@src:
|
||||
@dest:
|
||||
@dest_x:
|
||||
@dest_y:
|
||||
@dest_width:
|
||||
@dest_height:
|
||||
@offset_x:
|
||||
@offset_y:
|
||||
@scale_x:
|
||||
@scale_y:
|
||||
@filter_level:
|
||||
@overall_alpha:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_composite_color ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@src:
|
||||
@dest:
|
||||
@dest_x:
|
||||
@dest_y:
|
||||
@dest_width:
|
||||
@dest_height:
|
||||
@offset_x:
|
||||
@offset_y:
|
||||
@scale_x:
|
||||
@scale_y:
|
||||
@filter_level:
|
||||
@overall_alpha:
|
||||
@check_x:
|
||||
@check_y:
|
||||
@check_size:
|
||||
@color1:
|
||||
@color2:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_scale_simple ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@src:
|
||||
@dest_width:
|
||||
@dest_height:
|
||||
@filter_level:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_composite_color_simple ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@src:
|
||||
@dest_width:
|
||||
@dest_height:
|
||||
@filter_level:
|
||||
@overall_alpha:
|
||||
@check_size:
|
||||
@color1:
|
||||
@color2:
|
||||
@Returns: <!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
End:
|
||||
-->
|
||||
|
||||
|
||||
52
docs/reference/gdk-pixbuf/tmpl/util.sgml
Normal file
52
docs/reference/gdk-pixbuf/tmpl/util.sgml
Normal file
@@ -0,0 +1,52 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
Utilities
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Utility and miscellaneous convenience functions.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
These functions provide miscellaneous utilities for manipulating
|
||||
pixbufs. The pixel data in pixbufs may of course be manipulated
|
||||
directly by applications, but several common operations can be
|
||||
performed by these functions instead.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#GdkPixbuf
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_add_alpha ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@substitute_color:
|
||||
@r:
|
||||
@g:
|
||||
@b:
|
||||
@Returns: <!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
End:
|
||||
-->
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_copy_area ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@src_pixbuf:
|
||||
@src_x:
|
||||
@src_y:
|
||||
@width:
|
||||
@height:
|
||||
@dest_pixbuf:
|
||||
@dest_x:
|
||||
@dest_y:
|
||||
|
||||
|
||||
4692
docs/texinfo.tex
4692
docs/texinfo.tex
File diff suppressed because it is too large
Load Diff
12
gdk-pixbuf/.cvsignore
Normal file
12
gdk-pixbuf/.cvsignore
Normal file
@@ -0,0 +1,12 @@
|
||||
Makefile.in
|
||||
Makefile
|
||||
.deps
|
||||
.xvpics
|
||||
.libs
|
||||
*.la
|
||||
*.lo
|
||||
testpixbuf
|
||||
testpixbuf-drawable
|
||||
testpixbuf-scale
|
||||
testanimation
|
||||
gdk-pixbuf-features.h
|
||||
1637
gdk-pixbuf/ChangeLog
Normal file
1637
gdk-pixbuf/ChangeLog
Normal file
File diff suppressed because it is too large
Load Diff
196
gdk-pixbuf/Makefile.am
Normal file
196
gdk-pixbuf/Makefile.am
Normal file
@@ -0,0 +1,196 @@
|
||||
SUBDIRS = pixops
|
||||
|
||||
if BUILD_CANVAS_ITEM
|
||||
CANVAS_PIXBUF_LIB = libgnomecanvaspixbuf.la
|
||||
CANVAS_PIXBUF_HEADERFILES=gnome-canvas-pixbuf.h
|
||||
libgnomecanvaspixbuf_la_SOURCES = gnome-canvas-pixbuf.c
|
||||
EXTRA_GNOME_LIBS = $(GNOME_LIBS)
|
||||
else
|
||||
CANVAS_PIXBUF_LIB =
|
||||
CANVAS_PIXBUF_HEADERFILES =
|
||||
EXTRA_GNOME_LIBS =
|
||||
endif
|
||||
|
||||
lib_LTLIBRARIES = \
|
||||
libgdk_pixbuf.la \
|
||||
$(CANVAS_PIXBUF_LIB)
|
||||
|
||||
libgnomecanvaspixbuf_la_LDFLAGS = $(EXTRA_GNOME_LIBS)
|
||||
|
||||
libexecdir = $(libdir)/gdk-pixbuf/loaders
|
||||
|
||||
#
|
||||
# The PNG plugin.
|
||||
#
|
||||
libpixbuf_png_la_SOURCES = io-png.c
|
||||
libpixbuf_png_la_LDFLAGS = -avoid-version -module
|
||||
libpixbuf_png_la_LIBADD = $(LIBPNG)
|
||||
|
||||
#
|
||||
# The JPEG loader
|
||||
#
|
||||
libpixbuf_jpeg_la_SOURCES = io-jpeg.c
|
||||
libpixbuf_jpeg_la_LDFLAGS = -avoid-version -module
|
||||
libpixbuf_jpeg_la_LIBADD = $(LIBJPEG)
|
||||
|
||||
#
|
||||
# The XPM loader
|
||||
#
|
||||
libpixbuf_xpm_la_SOURCES = io-xpm.c
|
||||
libpixbuf_xpm_la_LDFLAGS = -avoid-version -module
|
||||
libpixbuf_xpm_la_LIBADD =
|
||||
|
||||
#
|
||||
# The GIF loader
|
||||
#
|
||||
libpixbuf_gif_la_SOURCES = io-gif.c
|
||||
libpixbuf_gif_la_LDFLAGS = -avoid-version -module
|
||||
libpixbuf_gif_la_LIBADD =
|
||||
|
||||
#
|
||||
# The ICO loader
|
||||
#
|
||||
libpixbuf_ico_la_SOURCES = io-ico.c
|
||||
libpixbuf_ico_la_LDFLAGS = -avoid-version -module
|
||||
libpixbuf_ico_la_LIBADD =
|
||||
|
||||
#
|
||||
# The RAS loader
|
||||
#
|
||||
libpixbuf_ras_la_SOURCES = io-ras.c
|
||||
libpixbuf_ras_la_LDFLAGS = -avoid-version -module
|
||||
libpixbuf_ras_la_LIBADD =
|
||||
|
||||
#
|
||||
# The TIFF loader
|
||||
#
|
||||
libpixbuf_tiff_la_SOURCES = io-tiff.c
|
||||
libpixbuf_tiff_la_LDFLAGS = -avoid-version -module
|
||||
libpixbuf_tiff_la_LIBADD = $(LIBTIFF)
|
||||
|
||||
#
|
||||
# The PNM loader
|
||||
#
|
||||
libpixbuf_pnm_la_SOURCES = io-pnm.c
|
||||
libpixbuf_pnm_la_LDFLAGS = -avoid-version -module
|
||||
libpixbuf_pnm_la_LIBADD =
|
||||
|
||||
#
|
||||
# The BMP loader
|
||||
#
|
||||
libpixbuf_bmp_la_SOURCES = io-bmp.c
|
||||
libpixbuf_bmp_la_LDFLAGS = -avoid-version -module
|
||||
libpixbuf_bmp_la_LIBADD =
|
||||
|
||||
if HAVE_PNG
|
||||
PNG_LIB = libpixbuf-png.la
|
||||
endif
|
||||
|
||||
if HAVE_JPEG
|
||||
JPEG_LIB = libpixbuf-jpeg.la
|
||||
endif
|
||||
|
||||
GIF_LIB = libpixbuf-gif.la
|
||||
|
||||
ICO_LIB = libpixbuf-ico.la
|
||||
|
||||
RAS_LIB = libpixbuf-ras.la
|
||||
|
||||
if HAVE_TIFF
|
||||
TIFF_LIB = libpixbuf-tiff.la
|
||||
endif
|
||||
|
||||
XPM_LIB = libpixbuf-xpm.la
|
||||
|
||||
PNM_LIB = libpixbuf-pnm.la
|
||||
|
||||
BMP_LIB = libpixbuf-bmp.la
|
||||
|
||||
if BUILD_DYNAMIC_MODULES
|
||||
|
||||
libexec_LTLIBRARIES = \
|
||||
$(PNG_LIB) \
|
||||
$(JPEG_LIB) \
|
||||
$(GIF_LIB) \
|
||||
$(ICO_LIB) \
|
||||
$(RAS_LIB) \
|
||||
$(XPM_LIB) \
|
||||
$(TIFF_LIB) \
|
||||
$(PNM_LIB) \
|
||||
$(BMP_LIB)
|
||||
|
||||
|
||||
extra_sources =
|
||||
|
||||
else
|
||||
libexec_LTLIBRARIES =
|
||||
|
||||
extra_sources = $(libpixbuf_png_la_SOURCES) \
|
||||
$(libpixbuf_jpeg_la_SOURCES) \
|
||||
$(libpixbuf_xpm_la_SOURCES) \
|
||||
$(libpixbuf_gif_la_SOURCES) \
|
||||
$(libpixbuf_ico_la_SOURCES) \
|
||||
$(libpixbuf_ras_la_SOURCES) \
|
||||
$(libpixbuf_tiff_la_SOURCES) \
|
||||
$(libpixbuf_pnm_la_SOURCES) \
|
||||
$(libpixbuf_bmp_la_SOURCES)
|
||||
|
||||
builtin_libraries =
|
||||
endif
|
||||
|
||||
noinst_PROGRAMS = testpixbuf testpixbuf-drawable testanimation testpixbuf-scale
|
||||
|
||||
DEPS = libgdk_pixbuf.la
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_builddir) \
|
||||
-I$(top_srcdir)/gdk-pixbuf \
|
||||
-I$(top_builddir)/gdk-pixbuf \
|
||||
$(GLIB_CFLAGS) $(LIBART_CFLAGS) $(GTK_CFLAGS)
|
||||
AM_CPPFLAGS = "-DPIXBUF_LIBDIR=\"$(libexecdir)\""
|
||||
|
||||
LDADDS = libgdk_pixbuf.la $(LIBART_LIBS) $(GLIB_LIBS) $(GTK_LIBS) $(STATIC_LIB_DEPS)
|
||||
|
||||
if INSIDE_GNOME_LIBS
|
||||
testpixbuf_LDADD = $(LDADDS) $(LIBART_LIBS) -lgmodule
|
||||
testpixbuf_drawable_LDADD = $(LDADDS)
|
||||
testpixbuf_scale_LDADD = $(LDADDS)
|
||||
testanimation_LDADD = $(LDADDS) $(LIBART_LIBS) -lgmodule
|
||||
else
|
||||
testpixbuf_LDADD = $(LDADDS) $(LIBART_LIBS) $(GNOME_LIBS) -lgmodule
|
||||
testpixbuf_drawable_LDADD = $(LDADDS) $(GNOME_LIBS)
|
||||
testpixbuf_scale_LDADD = $(LDADDS) $(GNOME_LIBS)
|
||||
testanimation_LDADD = $(LDADDS) $(LIBART_LIBS) $(GNOME_LIBS) -lgmodule
|
||||
endif
|
||||
|
||||
|
||||
GDK_PIXBUF_LIBS = $(LIBART_LIBS) $(GLIB_LIBS) $(GTK_LIBS)
|
||||
|
||||
#
|
||||
# The GdkPixBuf library
|
||||
#
|
||||
|
||||
libgdk_pixbufincludedir = $(includedir)/gdk-pixbuf
|
||||
|
||||
libgdk_pixbuf_la_SOURCES = \
|
||||
gdk-pixbuf.c \
|
||||
gdk-pixbuf-animation.c \
|
||||
gdk-pixbuf-data.c \
|
||||
gdk-pixbuf-drawable.c \
|
||||
gdk-pixbuf-io.c \
|
||||
gdk-pixbuf-loader.c \
|
||||
gdk-pixbuf-render.c \
|
||||
gdk-pixbuf-scale.c \
|
||||
gdk-pixbuf-util.c \
|
||||
$(extra_sources)
|
||||
|
||||
libgdk_pixbuf_la_LDFLAGS = -version-info 1:0:0 $(LIBART_LIBS) $(GLIB_LIBS) $(GTK_LIBS)
|
||||
libgdk_pixbuf_la_LIBADD = pixops/libpixops.la
|
||||
|
||||
libgdk_pixbufinclude_HEADERS = \
|
||||
gdk-pixbuf.h \
|
||||
gdk-pixbuf-loader.h \
|
||||
gdk-pixbuf-features.h \
|
||||
$(CANVAS_PIXBUF_HEADERFILES)
|
||||
|
||||
noinst_HEADERS = \
|
||||
gdk-pixbuf-io.h
|
||||
|
||||
162
gdk-pixbuf/gdk-pixbuf-animation.c
Normal file
162
gdk-pixbuf/gdk-pixbuf-animation.c
Normal file
@@ -0,0 +1,162 @@
|
||||
/* GdkPixbuf library - Simple animation support
|
||||
*
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Authors: Jonathan Blandford <jrb@redhat.com>
|
||||
* Havoc Pennington <hp@redhat.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "gdk-pixbuf-io.h"
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_animation_new_from_file:
|
||||
* @filename: Name of file to load.
|
||||
*
|
||||
* Creates a new animation by loading it from a file. The file format is
|
||||
* detected automatically. If the file's format does not support multi-frame
|
||||
* images, then an animation with a single frame will be created.
|
||||
*
|
||||
* Return value: A newly created animation with a reference count of 1, or NULL
|
||||
* if any of several error conditions ocurred: the file could not be opened,
|
||||
* there was no loader for the file's format, there was not enough memory to
|
||||
* allocate the image buffer, or the image file contained invalid data.
|
||||
**/
|
||||
GdkPixbufAnimation *
|
||||
gdk_pixbuf_animation_new_from_file (const char *filename)
|
||||
{
|
||||
GdkPixbufAnimation *animation;
|
||||
int size;
|
||||
FILE *f;
|
||||
guchar buffer [128];
|
||||
GdkPixbufModule *image_module;
|
||||
|
||||
g_return_val_if_fail (filename != NULL, NULL);
|
||||
|
||||
f = fopen (filename, "r");
|
||||
if (!f)
|
||||
return NULL;
|
||||
|
||||
size = fread (&buffer, 1, sizeof (buffer), f);
|
||||
|
||||
if (size == 0) {
|
||||
fclose (f);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
image_module = gdk_pixbuf_get_module (buffer, size);
|
||||
if (!image_module) {
|
||||
g_warning ("Unable to find handler for file: %s", filename);
|
||||
fclose (f);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (image_module->module == NULL)
|
||||
gdk_pixbuf_load_module (image_module);
|
||||
|
||||
if (image_module->load_animation == NULL) {
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixbufFrame *frame;
|
||||
|
||||
/* Keep this logic in sync with gdk_pixbuf_new_from_file() */
|
||||
|
||||
if (image_module->load == NULL) {
|
||||
fclose (f);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fseek (f, 0, SEEK_SET);
|
||||
pixbuf = (* image_module->load) (f);
|
||||
fclose (f);
|
||||
|
||||
if (pixbuf)
|
||||
g_assert (pixbuf->ref_count > 0);
|
||||
else
|
||||
return NULL;
|
||||
|
||||
frame = g_new (GdkPixbufFrame, 1);
|
||||
frame->pixbuf = pixbuf;
|
||||
frame->x_offset = 0;
|
||||
frame->y_offset = 0;
|
||||
frame->delay_time = -1;
|
||||
frame->action = GDK_PIXBUF_FRAME_RETAIN;
|
||||
|
||||
animation = g_new0 (GdkPixbufAnimation, 1);
|
||||
animation->ref_count = 1;
|
||||
animation->n_frames = 1;
|
||||
animation->frames = g_list_prepend (NULL, frame);
|
||||
} else {
|
||||
fseek (f, 0, SEEK_SET);
|
||||
animation = (* image_module->load_animation) (f);
|
||||
fclose (f);
|
||||
}
|
||||
|
||||
return animation;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_animation_ref:
|
||||
* @animation: An animation.
|
||||
*
|
||||
* Adds a reference to an animation. It must be released afterwards using
|
||||
* gdk_pixbuf_animation_unref().
|
||||
*
|
||||
* Return value: The same as the @animation argument.
|
||||
**/
|
||||
GdkPixbufAnimation *
|
||||
gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation)
|
||||
{
|
||||
g_return_val_if_fail (animation != NULL, NULL);
|
||||
g_return_val_if_fail (animation->ref_count > 0, NULL);
|
||||
|
||||
animation->ref_count++;
|
||||
return animation;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_animation_unref:
|
||||
* @animation: An animation.
|
||||
*
|
||||
* Removes a reference from an animation. It will be destroyed when the
|
||||
* reference count drops to zero. At that point, all the frames in the
|
||||
* animation will be freed and their corresponding pixbufs will be unreferenced.
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_animation_unref (GdkPixbufAnimation *animation)
|
||||
{
|
||||
g_return_if_fail (animation != NULL);
|
||||
g_return_if_fail (animation->ref_count > 0);
|
||||
|
||||
animation->ref_count--;
|
||||
|
||||
if (animation->ref_count == 0) {
|
||||
GList *l;
|
||||
GdkPixbufFrame *frame;
|
||||
|
||||
for (l = animation->frames; l; l = l->next) {
|
||||
frame = l->data;
|
||||
gdk_pixbuf_unref (frame->pixbuf);
|
||||
g_free (frame);
|
||||
}
|
||||
|
||||
g_list_free (animation->frames);
|
||||
g_free (animation);
|
||||
}
|
||||
}
|
||||
69
gdk-pixbuf/gdk-pixbuf-data.c
Normal file
69
gdk-pixbuf/gdk-pixbuf-data.c
Normal file
@@ -0,0 +1,69 @@
|
||||
/* GdkPixbuf library - Image creation from in-memory buffers
|
||||
*
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Author: Federico Mena-Quintero <federico@gimp.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_new_from_data:
|
||||
* @data: Image data in 8-bit/sample packed format.
|
||||
* @format: Color format used for the data.
|
||||
* @has_alpha: Whether the data has an opacity channel.
|
||||
* @width: Width of the image in pixels.
|
||||
* @height: Height of the image in pixels.
|
||||
* @rowstride: Distance in bytes between rows.
|
||||
* @dfunc: Function used to free the data when the pixbuf's reference count
|
||||
* drops to zero, or NULL if the data should not be freed.
|
||||
* @dfunc_data: Closure data to pass to the destroy notification function.
|
||||
*
|
||||
* Creates a new #GdkPixbuf out of in-memory RGB data.
|
||||
*
|
||||
* Return value: A newly-created #GdkPixbuf structure with a reference count of
|
||||
* 1.
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_new_from_data (const guchar *data, ArtPixFormat format, gboolean has_alpha,
|
||||
int width, int height, int rowstride,
|
||||
ArtDestroyNotify dfunc, gpointer dfunc_data)
|
||||
{
|
||||
ArtPixBuf *art_pixbuf;
|
||||
|
||||
/* Only 8-bit/sample RGB buffers are supported for now */
|
||||
|
||||
g_return_val_if_fail (data != NULL, NULL);
|
||||
g_return_val_if_fail (format == ART_PIX_RGB, NULL);
|
||||
g_return_val_if_fail (width > 0, NULL);
|
||||
g_return_val_if_fail (height > 0, NULL);
|
||||
|
||||
if (has_alpha)
|
||||
art_pixbuf = art_pixbuf_new_rgba_dnotify ((art_u8 *)data, width, height, rowstride,
|
||||
dfunc_data, dfunc);
|
||||
else
|
||||
art_pixbuf = art_pixbuf_new_rgb_dnotify ((art_u8 *)data, width, height, rowstride,
|
||||
dfunc_data, dfunc);
|
||||
|
||||
g_assert (art_pixbuf != NULL);
|
||||
|
||||
return gdk_pixbuf_new_from_art_pixbuf (art_pixbuf);
|
||||
}
|
||||
12
gdk-pixbuf/gdk-pixbuf-features.h.in
Normal file
12
gdk-pixbuf/gdk-pixbuf-features.h.in
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef GDK_PIXBUF_FEATURES_H
|
||||
#define GDK_PIXBUF_FEATURES_H 1
|
||||
|
||||
#define GDK_PIXBUF_MAJOR (@GDK_PIXBUF_MAJOR@)
|
||||
#define GDK_PIXBUF_MINOR (@GDK_PIXBUF_MINOR@)
|
||||
#define GDK_PIXBUF_MICRO (@GDK_PIXBUF_MICRO@)
|
||||
#define GDK_PIXBUF_VERSION "@GDK_PIXBUF_VERSION@"
|
||||
|
||||
extern const guint gdk_pixbuf_major_version, gdk_pixbuf_minor_version, gdk_pixbuf_micro_version;
|
||||
extern const char *gdk_pixbuf_version;
|
||||
|
||||
#endif
|
||||
484
gdk-pixbuf/gdk-pixbuf-io.c
Normal file
484
gdk-pixbuf/gdk-pixbuf-io.c
Normal file
@@ -0,0 +1,484 @@
|
||||
/* GdkPixbuf library - Main loading interface.
|
||||
*
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Authors: Miguel de Icaza <miguel@gnu.org>
|
||||
* Federico Mena-Quintero <federico@gimp.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include "gdk-pixbuf-io.h"
|
||||
|
||||
|
||||
|
||||
static gboolean
|
||||
pixbuf_check_png (guchar *buffer, int size)
|
||||
{
|
||||
if (size < 28)
|
||||
return FALSE;
|
||||
|
||||
if (buffer [0] != 0x89 ||
|
||||
buffer [1] != 'P' ||
|
||||
buffer [2] != 'N' ||
|
||||
buffer [3] != 'G' ||
|
||||
buffer [4] != 0x0d ||
|
||||
buffer [5] != 0x0a ||
|
||||
buffer [6] != 0x1a ||
|
||||
buffer [7] != 0x0a)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
pixbuf_check_jpeg (guchar *buffer, int size)
|
||||
{
|
||||
if (size < 10)
|
||||
return FALSE;
|
||||
|
||||
if (buffer [0] != 0xff || buffer [1] != 0xd8)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
pixbuf_check_tiff (guchar *buffer, int size)
|
||||
{
|
||||
if (size < 10)
|
||||
return FALSE;
|
||||
|
||||
if (buffer [0] == 'M' &&
|
||||
buffer [1] == 'M' &&
|
||||
buffer [2] == 0 &&
|
||||
buffer [3] == 0x2a)
|
||||
return TRUE;
|
||||
|
||||
if (buffer [0] == 'I' &&
|
||||
buffer [1] == 'I' &&
|
||||
buffer [2] == 0x2a &&
|
||||
buffer [3] == 0)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
pixbuf_check_gif (guchar *buffer, int size)
|
||||
{
|
||||
if (size < 20)
|
||||
return FALSE;
|
||||
|
||||
if (strncmp (buffer, "GIF8", 4) == 0)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
pixbuf_check_xpm (guchar *buffer, int size)
|
||||
{
|
||||
if (size < 20)
|
||||
return FALSE;
|
||||
|
||||
if (strncmp (buffer, "/* XPM */", 9) == 0)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
pixbuf_check_pnm (guchar *buffer, int size)
|
||||
{
|
||||
if (size < 20)
|
||||
return FALSE;
|
||||
|
||||
if (buffer [0] == 'P') {
|
||||
if (buffer [1] == '1' ||
|
||||
buffer [1] == '2' ||
|
||||
buffer [1] == '3' ||
|
||||
buffer [1] == '4' ||
|
||||
buffer [1] == '5' ||
|
||||
buffer [1] == '6')
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
static gboolean
|
||||
pixbuf_check_sunras (guchar *buffer, int size)
|
||||
{
|
||||
if (size < 32)
|
||||
return FALSE;
|
||||
|
||||
if (buffer [0] != 0x59 ||
|
||||
buffer [1] != 0xA6 ||
|
||||
buffer [2] != 0x6A ||
|
||||
buffer [3] != 0x95)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
pixbuf_check_ico (guchar *buffer, int size)
|
||||
{
|
||||
/* Note that this may cause false positives, but .ico's don't
|
||||
have a magic number.*/
|
||||
if (size < 6)
|
||||
return FALSE;
|
||||
if (buffer [0] != 0x0 ||
|
||||
buffer [1] != 0x0 ||
|
||||
((buffer [2] != 0x1)&&(buffer[2]!=0x2)) ||
|
||||
buffer [3] != 0x0 ||
|
||||
buffer [5] != 0x0 )
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
pixbuf_check_bmp (guchar *buffer, int size)
|
||||
{
|
||||
if (size < 20)
|
||||
return FALSE;
|
||||
|
||||
if (buffer [0] != 'B' || buffer [1] != 'M')
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GdkPixbufModule file_formats [] = {
|
||||
{ "png", pixbuf_check_png, NULL, NULL, NULL, NULL, NULL, NULL },
|
||||
{ "jpeg", pixbuf_check_jpeg, NULL, NULL, NULL, NULL, NULL, NULL },
|
||||
{ "tiff", pixbuf_check_tiff, NULL, NULL, NULL, NULL, NULL, NULL },
|
||||
{ "gif", pixbuf_check_gif, NULL, NULL, NULL, NULL, NULL, NULL },
|
||||
#define XPM_FILE_FORMAT_INDEX 4
|
||||
{ "xpm", pixbuf_check_xpm, NULL, NULL, NULL, NULL, NULL, NULL },
|
||||
{ "pnm", pixbuf_check_pnm, NULL, NULL, NULL, NULL, NULL, NULL },
|
||||
{ "ras", pixbuf_check_sunras, NULL, NULL, NULL, NULL, NULL, NULL },
|
||||
{ "ico", pixbuf_check_ico, NULL, NULL, NULL, NULL, NULL, NULL },
|
||||
{ "bmp", pixbuf_check_bmp, NULL, NULL, NULL, NULL, NULL, NULL },
|
||||
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
#ifdef USE_GMODULE
|
||||
static gboolean
|
||||
pixbuf_module_symbol (GModule *module, const char *module_name, const char *symbol_name, gpointer *symbol)
|
||||
{
|
||||
char *full_symbol_name = g_strconcat ("gdk_pixbuf__", module_name, "_", symbol_name, NULL);
|
||||
gboolean return_value;
|
||||
|
||||
return_value = g_module_symbol (module, full_symbol_name, symbol);
|
||||
g_free (full_symbol_name);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/* actually load the image handler - gdk_pixbuf_get_module only get a */
|
||||
/* reference to the module to load, it doesn't actually load it */
|
||||
/* perhaps these actions should be combined in one function */
|
||||
void
|
||||
gdk_pixbuf_load_module (GdkPixbufModule *image_module)
|
||||
{
|
||||
char *module_name;
|
||||
char *path;
|
||||
GModule *module;
|
||||
gpointer load_sym;
|
||||
char *name;
|
||||
|
||||
g_return_if_fail (image_module->module == NULL);
|
||||
|
||||
name = image_module->module_name;
|
||||
|
||||
module_name = g_strconcat ("pixbuf-", name, NULL);
|
||||
path = g_module_build_path (PIXBUF_LIBDIR, module_name);
|
||||
|
||||
module = g_module_open (path, G_MODULE_BIND_LAZY);
|
||||
if (!module) {
|
||||
/* Debug feature, check in present working directory */
|
||||
g_free (path);
|
||||
path = g_module_build_path ("", module_name);
|
||||
module = g_module_open (path, G_MODULE_BIND_LAZY);
|
||||
|
||||
if (!module) {
|
||||
g_warning ("Unable to load module: %s: %s", path, g_module_error ());
|
||||
g_free (module_name);
|
||||
g_free (path);
|
||||
return;
|
||||
}
|
||||
g_free (path);
|
||||
} else {
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
g_free (module_name);
|
||||
|
||||
image_module->module = module;
|
||||
|
||||
if (pixbuf_module_symbol (module, name, "image_load", &load_sym))
|
||||
image_module->load = load_sym;
|
||||
|
||||
if (pixbuf_module_symbol (module, name, "image_load_xpm_data", &load_sym))
|
||||
image_module->load_xpm_data = load_sym;
|
||||
|
||||
if (pixbuf_module_symbol (module, name, "image_begin_load", &load_sym))
|
||||
image_module->begin_load = load_sym;
|
||||
|
||||
if (pixbuf_module_symbol (module, name, "image_stop_load", &load_sym))
|
||||
image_module->stop_load = load_sym;
|
||||
|
||||
if (pixbuf_module_symbol (module, name, "image_load_increment", &load_sym))
|
||||
image_module->load_increment = load_sym;
|
||||
|
||||
if (pixbuf_module_symbol (module, name, "image_load_animation", &load_sym))
|
||||
image_module->load_animation = load_sym;
|
||||
}
|
||||
#else
|
||||
|
||||
#define mname(type,fn) gdk_pixbuf__ ## type ## _image_ ##fn
|
||||
#define m_load(type) extern GdkPixbuf * mname(type,load) (FILE *f);
|
||||
#define m_load_xpm_data(type) extern GdkPixbuf * mname(type,load_xpm_data) (const char **data);
|
||||
#define m_begin_load(type) \
|
||||
extern gpointer mname(type,begin_load) (ModulePreparedNotifyFunc prepare_func, \
|
||||
ModuleUpdatedNotifyFunc update_func, \
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,\
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,\
|
||||
gpointer user_data);
|
||||
#define m_stop_load(type) extern void mname(type,stop_load) (gpointer context);
|
||||
#define m_load_increment(type) extern gboolean mname(type,load_increment) (gpointer context, const guchar *buf, guint size);
|
||||
#define m_load_animation(type) extern GdkPixbufAnimation * mname(type,load_animation) (FILE *f);
|
||||
|
||||
m_load (png);
|
||||
m_begin_load (png);
|
||||
m_load_increment (png);
|
||||
m_stop_load (png);
|
||||
m_load (bmp);
|
||||
m_begin_load (bmp);
|
||||
m_load_increment (bmp);
|
||||
m_stop_load (bmp);
|
||||
m_load (gif);
|
||||
m_begin_load (gif);
|
||||
m_load_increment (gif);
|
||||
m_stop_load (gif);
|
||||
m_load_animation (gif);
|
||||
m_load (ico);
|
||||
m_begin_load (ico);
|
||||
m_load_increment (ico);
|
||||
m_stop_load (ico);
|
||||
m_load (jpeg);
|
||||
m_begin_load (jpeg);
|
||||
m_load_increment (jpeg);
|
||||
m_stop_load (jpeg);
|
||||
m_load (pnm);
|
||||
m_begin_load (pnm);
|
||||
m_load_increment (pnm);
|
||||
m_stop_load (pnm);
|
||||
m_load (ras);
|
||||
m_begin_load (ras);
|
||||
m_load_increment (ras);
|
||||
m_stop_load (ras);
|
||||
m_load (tiff);
|
||||
m_begin_load (tiff);
|
||||
m_load_increment (tiff);
|
||||
m_stop_load (tiff);
|
||||
m_load (xpm);
|
||||
m_load_xpm_data (xpm);
|
||||
|
||||
void
|
||||
gdk_pixbuf_load_module (GdkPixbufModule *image_module)
|
||||
{
|
||||
image_module->module = (void *) 1;
|
||||
|
||||
if (strcmp (image_module->module_name, "png") == 0){
|
||||
image_module->load = mname (png,load);
|
||||
image_module->begin_load = mname (png,begin_load);
|
||||
image_module->load_increment = mname (png,load_increment);
|
||||
image_module->stop_load = mname (png,stop_load);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp (image_module->module_name, "bmp") == 0){
|
||||
image_module->load = mname (bmp,load);
|
||||
image_module->begin_load = mname (bmp,begin_load);
|
||||
image_module->load_increment = mname (bmp,load_increment);
|
||||
image_module->stop_load = mname (bmp,stop_load);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp (image_module->module_name, "gif") == 0){
|
||||
image_module->load = mname (gif,load);
|
||||
image_module->begin_load = mname (gif,begin_load);
|
||||
image_module->load_increment = mname (gif,load_increment);
|
||||
image_module->stop_load = mname (gif,stop_load);
|
||||
image_module->load_animation = mname (gif,load_animation);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp (image_module->module_name, "ico") == 0){
|
||||
image_module->load = mname (ico,load);
|
||||
image_module->begin_load = mname (ico,begin_load);
|
||||
image_module->load_increment = mname (ico,load_increment);
|
||||
image_module->stop_load = mname (ico,stop_load);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp (image_module->module_name, "jpeg") == 0){
|
||||
image_module->load = mname (jpeg,load);
|
||||
image_module->begin_load = mname (jpeg,begin_load);
|
||||
image_module->load_increment = mname (jpeg,load_increment);
|
||||
image_module->stop_load = mname (jpeg,stop_load);
|
||||
return;
|
||||
}
|
||||
if (strcmp (image_module->module_name, "pnm") == 0){
|
||||
image_module->load = mname (pnm,load);
|
||||
image_module->begin_load = mname (pnm,begin_load);
|
||||
image_module->load_increment = mname (pnm,load_increment);
|
||||
image_module->stop_load = mname (pnm,stop_load);
|
||||
return;
|
||||
}
|
||||
if (strcmp (image_module->module_name, "ras") == 0){
|
||||
image_module->load = mname (ras,load);
|
||||
image_module->begin_load = mname (ras,begin_load);
|
||||
image_module->load_increment = mname (ras,load_increment);
|
||||
image_module->stop_load = mname (ras,stop_load);
|
||||
return;
|
||||
}
|
||||
if (strcmp (image_module->module_name, "tiff") == 0){
|
||||
image_module->load = mname (tiff,load);
|
||||
image_module->begin_load = mname (tiff,begin_load);
|
||||
image_module->load_increment = mname (tiff,load_increment);
|
||||
image_module->stop_load = mname (tiff,stop_load);
|
||||
return;
|
||||
}
|
||||
if (strcmp (image_module->module_name, "xpm") == 0){
|
||||
image_module->load = mname (xpm,load);
|
||||
image_module->load_xpm_data = mname (xpm,load_xpm_data);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
GdkPixbufModule *
|
||||
gdk_pixbuf_get_module (guchar *buffer, guint size)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; file_formats [i].module_name; i++) {
|
||||
if ((* file_formats [i].format_check) (buffer, size))
|
||||
return &(file_formats[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_new_from_file:
|
||||
* @filename: Name of file to load.
|
||||
*
|
||||
* Creates a new pixbuf by loading an image from a file. The file format is
|
||||
* detected automatically.
|
||||
*
|
||||
* Return value: A newly-created pixbuf with a reference count of 1, or NULL if
|
||||
* any of several error conditions occurred: the file could not be opened,
|
||||
* there was no loader for the file's format, there was not enough memory to
|
||||
* allocate the image buffer, or the image file contained invalid data.
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_new_from_file (const char *filename)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
int size;
|
||||
FILE *f;
|
||||
guchar buffer [128];
|
||||
GdkPixbufModule *image_module;
|
||||
|
||||
g_return_val_if_fail (filename != NULL, NULL);
|
||||
|
||||
f = fopen (filename, "r");
|
||||
if (!f)
|
||||
return NULL;
|
||||
|
||||
size = fread (&buffer, 1, sizeof (buffer), f);
|
||||
if (size == 0) {
|
||||
fclose (f);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
image_module = gdk_pixbuf_get_module (buffer, size);
|
||||
if (!image_module) {
|
||||
g_warning ("Unable to find handler for file: %s", filename);
|
||||
fclose (f);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (image_module->module == NULL)
|
||||
gdk_pixbuf_load_module (image_module);
|
||||
|
||||
if (image_module->load == NULL) {
|
||||
fclose (f);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fseek (f, 0, SEEK_SET);
|
||||
pixbuf = (* image_module->load) (f);
|
||||
fclose (f);
|
||||
|
||||
if (pixbuf)
|
||||
g_assert (pixbuf->ref_count > 0);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_new_from_xpm_data:
|
||||
* @data: Pointer to inline XPM data.
|
||||
*
|
||||
* Creates a new pixbuf by parsing XPM data in memory. This data is commonly
|
||||
* the result of including an XPM file into a program's C source.
|
||||
*
|
||||
* Return value: A newly-created pixbuf with a reference count of 1.
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_new_from_xpm_data (const char **data)
|
||||
{
|
||||
GdkPixbuf *(* load_xpm_data) (const char **data);
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
if (file_formats[XPM_FILE_FORMAT_INDEX].module == NULL)
|
||||
gdk_pixbuf_load_module (&file_formats[XPM_FILE_FORMAT_INDEX]);
|
||||
|
||||
if (file_formats[XPM_FILE_FORMAT_INDEX].module == NULL) {
|
||||
g_warning ("Can't find gdk-pixbuf module for parsing inline XPM data");
|
||||
return NULL;
|
||||
} else if (file_formats[XPM_FILE_FORMAT_INDEX].load_xpm_data == NULL) {
|
||||
g_warning ("gdk-pixbuf XPM module lacks XPM data capability");
|
||||
return NULL;
|
||||
} else
|
||||
load_xpm_data = file_formats[XPM_FILE_FORMAT_INDEX].load_xpm_data;
|
||||
|
||||
pixbuf = (* load_xpm_data) (data);
|
||||
return pixbuf;
|
||||
}
|
||||
84
gdk-pixbuf/gdk-pixbuf-io.h
Normal file
84
gdk-pixbuf/gdk-pixbuf-io.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/* GdkPixbuf library - Io handling. This is an internal header for gdk-pixbuf.
|
||||
* You should never use it unless you are doing developement for gdkpixbuf itself.
|
||||
*
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Authors: Mark Crichton <crichton@gimp.org>
|
||||
* Miguel de Icaza <miguel@gnu.org>
|
||||
* Federico Mena-Quintero <federico@gimp.org>
|
||||
* Jonathan Blandford <jrb@redhat.com>
|
||||
* Michael Fulbright <drmike@redhat.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef GDK_PIXBUF_IO_H
|
||||
#define GDK_PIXBUF_IO_H
|
||||
|
||||
#include <gmodule.h>
|
||||
#include <stdio.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
typedef void (* ModulePreparedNotifyFunc) (GdkPixbuf *pixbuf, gpointer user_data);
|
||||
typedef void (* ModuleUpdatedNotifyFunc) (GdkPixbuf *pixbuf,
|
||||
guint x, guint y,
|
||||
guint width, guint height,
|
||||
gpointer user_data);
|
||||
/* Needed only for animated images. */
|
||||
typedef void (* ModuleFrameDoneNotifyFunc) (GdkPixbufFrame *frame,
|
||||
gpointer user_data);
|
||||
typedef void (* ModuleAnimationDoneNotifyFunc) (GdkPixbuf *pixbuf,
|
||||
gpointer user_data);
|
||||
|
||||
typedef struct _GdkPixbufModule GdkPixbufModule;
|
||||
struct _GdkPixbufModule {
|
||||
char *module_name;
|
||||
gboolean (* format_check) (guchar *buffer, int size);
|
||||
GModule *module;
|
||||
GdkPixbuf *(* load) (FILE *f);
|
||||
GdkPixbuf *(* load_xpm_data) (const char **data);
|
||||
|
||||
/* Incremental loading */
|
||||
|
||||
gpointer (* begin_load) (ModulePreparedNotifyFunc prepare_func,
|
||||
ModuleUpdatedNotifyFunc update_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data);
|
||||
void (* stop_load) (gpointer context);
|
||||
gboolean (* load_increment) (gpointer context, const guchar *buf, guint size);
|
||||
|
||||
/* Animation loading */
|
||||
GdkPixbufAnimation *(* load_animation) (FILE *f);
|
||||
};
|
||||
|
||||
|
||||
GdkPixbufModule *gdk_pixbuf_get_module (guchar *buffer, guint size);
|
||||
void gdk_pixbuf_load_module (GdkPixbufModule *image_module);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
492
gdk-pixbuf/gdk-pixbuf-loader.c
Normal file
492
gdk-pixbuf/gdk-pixbuf-loader.c
Normal file
@@ -0,0 +1,492 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
|
||||
/* GdkPixbuf library - Main header file
|
||||
*
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Authors: Mark Crichton <crichton@gimp.org>
|
||||
* Miguel de Icaza <miguel@gnu.org>
|
||||
* Federico Mena-Quintero <federico@gimp.org>
|
||||
* Jonathan Blandford <jrb@redhat.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <gtk/gtksignal.h>
|
||||
#include "gdk-pixbuf-loader.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
|
||||
|
||||
|
||||
enum {
|
||||
AREA_UPDATED,
|
||||
AREA_PREPARED,
|
||||
FRAME_DONE,
|
||||
ANIMATION_DONE,
|
||||
CLOSED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static GtkObjectClass *parent_class;
|
||||
|
||||
static void gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *klass);
|
||||
static void gdk_pixbuf_loader_init (GdkPixbufLoader *loader);
|
||||
static void gdk_pixbuf_loader_destroy (GtkObject *loader);
|
||||
static void gdk_pixbuf_loader_finalize (GtkObject *loader);
|
||||
|
||||
static guint pixbuf_loader_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
|
||||
|
||||
/* Internal data */
|
||||
|
||||
#define LOADER_HEADER_SIZE 128
|
||||
|
||||
typedef struct {
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixbufAnimation *animation;
|
||||
gboolean closed;
|
||||
guchar header_buf[LOADER_HEADER_SIZE];
|
||||
gint header_buf_offset;
|
||||
GdkPixbufModule *image_module;
|
||||
gpointer context;
|
||||
} GdkPixbufLoaderPrivate;
|
||||
|
||||
|
||||
|
||||
/* our marshaller */
|
||||
typedef void (* GtkSignal_NONE__INT_INT_INT_INT) (GtkObject *object,
|
||||
gint arg1, gint arg2, gint arg3, gint arg4,
|
||||
gpointer user_data);
|
||||
static void
|
||||
gtk_marshal_NONE__INT_INT_INT_INT (GtkObject *object, GtkSignalFunc func, gpointer func_data,
|
||||
GtkArg * args)
|
||||
{
|
||||
GtkSignal_NONE__INT_INT_INT_INT rfunc;
|
||||
|
||||
rfunc = (GtkSignal_NONE__INT_INT_INT_INT) func;
|
||||
(*rfunc) (object,
|
||||
GTK_VALUE_INT (args[0]),
|
||||
GTK_VALUE_INT (args[1]),
|
||||
GTK_VALUE_INT (args[2]),
|
||||
GTK_VALUE_INT (args[3]),
|
||||
func_data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_loader_get_type:
|
||||
* @void:
|
||||
*
|
||||
* Registers the #GdkPixubfLoader class if necessary, and returns the type ID
|
||||
* associated to it.
|
||||
*
|
||||
* Return value: The type ID of the #GdkPixbufLoader class.
|
||||
**/
|
||||
GtkType
|
||||
gdk_pixbuf_loader_get_type (void)
|
||||
{
|
||||
static GtkType loader_type = 0;
|
||||
|
||||
if (!loader_type) {
|
||||
static const GtkTypeInfo loader_info = {
|
||||
"GdkPixbufLoader",
|
||||
sizeof (GdkPixbufLoader),
|
||||
sizeof (GdkPixbufLoaderClass),
|
||||
(GtkClassInitFunc) gdk_pixbuf_loader_class_init,
|
||||
(GtkObjectInitFunc) gdk_pixbuf_loader_init,
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserved_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL,
|
||||
};
|
||||
|
||||
loader_type = gtk_type_unique (GTK_TYPE_OBJECT, &loader_info);
|
||||
}
|
||||
|
||||
return loader_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
|
||||
object_class = (GtkObjectClass *) class;
|
||||
|
||||
parent_class = gtk_type_class (gtk_object_get_type ());
|
||||
|
||||
pixbuf_loader_signals[AREA_PREPARED] =
|
||||
gtk_signal_new ("area_prepared",
|
||||
GTK_RUN_LAST,
|
||||
parent_class->type,
|
||||
GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, area_prepared),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
|
||||
pixbuf_loader_signals[AREA_UPDATED] =
|
||||
gtk_signal_new ("area_updated",
|
||||
GTK_RUN_LAST,
|
||||
parent_class->type,
|
||||
GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, area_updated),
|
||||
gtk_marshal_NONE__INT_INT_INT_INT,
|
||||
GTK_TYPE_NONE, 4,
|
||||
GTK_TYPE_INT,
|
||||
GTK_TYPE_INT,
|
||||
GTK_TYPE_INT,
|
||||
GTK_TYPE_INT);
|
||||
|
||||
pixbuf_loader_signals[FRAME_DONE] =
|
||||
gtk_signal_new ("frame_done",
|
||||
GTK_RUN_LAST,
|
||||
parent_class->type,
|
||||
GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, frame_done),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
|
||||
pixbuf_loader_signals[ANIMATION_DONE] =
|
||||
gtk_signal_new ("animation_done",
|
||||
GTK_RUN_LAST,
|
||||
parent_class->type,
|
||||
GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, animation_done),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
|
||||
pixbuf_loader_signals[CLOSED] =
|
||||
gtk_signal_new ("closed",
|
||||
GTK_RUN_LAST,
|
||||
parent_class->type,
|
||||
GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, closed),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
|
||||
gtk_object_class_add_signals (object_class, pixbuf_loader_signals, LAST_SIGNAL);
|
||||
|
||||
object_class->destroy = gdk_pixbuf_loader_destroy;
|
||||
object_class->finalize = gdk_pixbuf_loader_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_pixbuf_loader_init (GdkPixbufLoader *loader)
|
||||
{
|
||||
GdkPixbufLoaderPrivate *priv;
|
||||
|
||||
priv = g_new0 (GdkPixbufLoaderPrivate, 1);
|
||||
loader->private = priv;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_pixbuf_loader_destroy (GtkObject *object)
|
||||
{
|
||||
GdkPixbufLoader *loader;
|
||||
GdkPixbufLoaderPrivate *priv = NULL;
|
||||
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (GDK_IS_PIXBUF_LOADER (object));
|
||||
|
||||
loader = GDK_PIXBUF_LOADER (object);
|
||||
priv = loader->private;
|
||||
|
||||
if (!priv->closed)
|
||||
gdk_pixbuf_loader_close (loader);
|
||||
|
||||
if (priv->animation)
|
||||
gdk_pixbuf_animation_unref (priv->animation);
|
||||
if (priv->pixbuf)
|
||||
gdk_pixbuf_unref (priv->pixbuf);
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_pixbuf_loader_finalize (GtkObject *object)
|
||||
{
|
||||
GdkPixbufLoader *loader;
|
||||
GdkPixbufLoaderPrivate *priv = NULL;
|
||||
|
||||
loader = GDK_PIXBUF_LOADER (object);
|
||||
priv = loader->private;
|
||||
|
||||
g_free (priv);
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->finalize)
|
||||
(* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_pixbuf_loader_prepare (GdkPixbuf *pixbuf, gpointer loader)
|
||||
{
|
||||
GdkPixbufLoaderPrivate *priv = NULL;
|
||||
|
||||
priv = GDK_PIXBUF_LOADER (loader)->private;
|
||||
gdk_pixbuf_ref (pixbuf);
|
||||
g_assert (priv->pixbuf == NULL);
|
||||
|
||||
priv->pixbuf = pixbuf;
|
||||
gtk_signal_emit (GTK_OBJECT (loader), pixbuf_loader_signals[AREA_PREPARED]);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_pixbuf_loader_update (GdkPixbuf *pixbuf, guint x, guint y, guint width, guint height, gpointer loader)
|
||||
{
|
||||
GdkPixbufLoaderPrivate *priv = NULL;
|
||||
|
||||
priv = GDK_PIXBUF_LOADER (loader)->private;
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (loader),
|
||||
pixbuf_loader_signals[AREA_UPDATED],
|
||||
x, y,
|
||||
/* sanity check in here. Defend against an errant loader */
|
||||
MIN (width, gdk_pixbuf_get_width (priv->pixbuf)),
|
||||
MIN (height, gdk_pixbuf_get_height (priv->pixbuf)));
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_pixbuf_loader_frame_done (GdkPixbufFrame *frame, gpointer loader)
|
||||
{
|
||||
GdkPixbufLoaderPrivate *priv = NULL;
|
||||
|
||||
priv = GDK_PIXBUF_LOADER (loader)->private;
|
||||
|
||||
if (priv->animation == NULL) {
|
||||
priv->animation = g_new0 (GdkPixbufAnimation, 1);
|
||||
priv->animation->n_frames = 0;
|
||||
priv->animation->ref_count = 1;
|
||||
}
|
||||
|
||||
priv->animation->frames = g_list_append (priv->animation->frames, frame);
|
||||
priv->animation->n_frames ++;
|
||||
gtk_signal_emit (GTK_OBJECT (loader),
|
||||
pixbuf_loader_signals[FRAME_DONE],
|
||||
frame);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_pixbuf_loader_animation_done (GdkPixbuf *pixbuf, gpointer loader)
|
||||
{
|
||||
gtk_signal_emit (GTK_OBJECT (loader),
|
||||
pixbuf_loader_signals[ANIMATION_DONE]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_loader_new:
|
||||
*
|
||||
* Creates a new pixbuf loader object.
|
||||
*
|
||||
* Return value: A newly-created pixbuf loader.
|
||||
**/
|
||||
GdkPixbufLoader *
|
||||
gdk_pixbuf_loader_new (void)
|
||||
{
|
||||
return gtk_type_new (gdk_pixbuf_loader_get_type ());
|
||||
}
|
||||
|
||||
static int
|
||||
gdk_pixbuf_loader_load_module(GdkPixbufLoader *loader)
|
||||
{
|
||||
GdkPixbufLoaderPrivate *priv = loader->private;
|
||||
|
||||
priv->image_module = gdk_pixbuf_get_module (priv->header_buf, priv->header_buf_offset);
|
||||
|
||||
if (priv->image_module == NULL)
|
||||
return 0;
|
||||
|
||||
if (priv->image_module->module == NULL)
|
||||
gdk_pixbuf_load_module (priv->image_module);
|
||||
|
||||
if (priv->image_module->module == NULL)
|
||||
return 0;
|
||||
|
||||
if ((priv->image_module->begin_load == NULL) ||
|
||||
(priv->image_module->stop_load == NULL) ||
|
||||
(priv->image_module->load_increment == NULL)) {
|
||||
g_warning ("module %s does not support incremental loading.\n",
|
||||
priv->image_module->module_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
priv->context = (*priv->image_module->begin_load) (gdk_pixbuf_loader_prepare,
|
||||
gdk_pixbuf_loader_update,
|
||||
gdk_pixbuf_loader_frame_done,
|
||||
gdk_pixbuf_loader_animation_done,
|
||||
loader);
|
||||
|
||||
if (priv->context == NULL) {
|
||||
g_warning("Failed to begin progressive load");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( (* priv->image_module->load_increment) (priv->context, priv->header_buf, priv->header_buf_offset) )
|
||||
return priv->header_buf_offset;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
gdk_pixbuf_loader_eat_header_write (GdkPixbufLoader *loader, const guchar *buf, size_t count)
|
||||
{
|
||||
int nbytes;
|
||||
GdkPixbufLoaderPrivate *priv = loader->private;
|
||||
|
||||
nbytes = MIN(LOADER_HEADER_SIZE - priv->header_buf_offset, count);
|
||||
memcpy (priv->header_buf + priv->header_buf_offset, buf, nbytes);
|
||||
|
||||
priv->header_buf_offset += nbytes;
|
||||
|
||||
if(priv->header_buf_offset >= LOADER_HEADER_SIZE) {
|
||||
if (gdk_pixbuf_loader_load_module(loader) == 0)
|
||||
return 0;
|
||||
}
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_loader_write:
|
||||
* @loader: A pixbuf loader.
|
||||
* @buf: Pointer to image data.
|
||||
* @count: Length of the @buf buffer in bytes.
|
||||
*
|
||||
* This will cause a pixbuf loader to parse the next @count bytes of an image.
|
||||
* It will return TRUE if the data was loaded successfully, and FALSE if an
|
||||
* error occurred. In the latter case, the loader will be closed, and will not
|
||||
* accept further writes.
|
||||
*
|
||||
* Return value: #TRUE if the write was successful, or #FALSE if the loader
|
||||
* cannot parse the buffer.
|
||||
**/
|
||||
gboolean
|
||||
gdk_pixbuf_loader_write (GdkPixbufLoader *loader, const guchar *buf, size_t count)
|
||||
{
|
||||
GdkPixbufLoaderPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (loader != NULL, FALSE);
|
||||
g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), FALSE);
|
||||
|
||||
g_return_val_if_fail (buf != NULL, FALSE);
|
||||
g_return_val_if_fail (count >= 0, FALSE);
|
||||
|
||||
priv = loader->private;
|
||||
|
||||
/* we expect it's not to be closed */
|
||||
g_return_val_if_fail (priv->closed == FALSE, FALSE);
|
||||
|
||||
if (priv->image_module == NULL) {
|
||||
int eaten;
|
||||
|
||||
eaten = gdk_pixbuf_loader_eat_header_write(loader, buf, count);
|
||||
if (eaten <= 0)
|
||||
return FALSE;
|
||||
|
||||
count -= eaten;
|
||||
buf += eaten;
|
||||
}
|
||||
|
||||
if (count > 0 && priv->image_module->load_increment)
|
||||
return (* priv->image_module->load_increment) (priv->context, buf, count);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_loader_get_pixbuf:
|
||||
* @loader: A pixbuf loader.
|
||||
*
|
||||
* Queries the GdkPixbuf that a pixbuf loader is currently creating. In general
|
||||
* it only makes sense to call this function afer the "area_prepared" signal has
|
||||
* been emitted by the loader; this means that enough data has been read to know
|
||||
* the size of the image that will be allocated. If the loader has not received
|
||||
* enough data via gdk_pixbuf_loader_write(), then this function returns NULL.
|
||||
* The returned pixbuf will be the same in all future calls to the loader, so
|
||||
* simply calling gdk_pixbuf_ref() should be sufficient to continue using it.
|
||||
*
|
||||
* Return value: The GdkPixbuf that the loader is creating, or NULL if not
|
||||
* enough data has been read to determine how to create the image buffer.
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_loader_get_pixbuf (GdkPixbufLoader *loader)
|
||||
{
|
||||
GdkPixbufLoaderPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (loader != NULL, NULL);
|
||||
g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), NULL);
|
||||
|
||||
priv = loader->private;
|
||||
|
||||
return priv->pixbuf;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_loader_get_animation:
|
||||
* @loader: A pixbuf loader
|
||||
*
|
||||
* Queries the GdkPixbufAnimation that a pixbuf loader is currently creating.
|
||||
* In general it only makes sense to call this function afer the "area_prepared"
|
||||
* signal has been emitted by the loader. If the image is not an animation,
|
||||
* then it will return NULL.
|
||||
*
|
||||
* Return value: The GdkPixbufAnimation that the loader is loading, or NULL if
|
||||
not enough data has been read to determine the information.
|
||||
**/
|
||||
GdkPixbufAnimation *
|
||||
gdk_pixbuf_loader_get_animation (GdkPixbufLoader *loader)
|
||||
{
|
||||
GdkPixbufLoaderPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (loader != NULL, NULL);
|
||||
g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), NULL);
|
||||
|
||||
priv = loader->private;
|
||||
|
||||
return priv->animation;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_loader_close:
|
||||
* @loader: A pixbuf loader.
|
||||
*
|
||||
* Informs a pixbuf loader that no further writes with gdk_pixbuf_load_write()
|
||||
* will occur, so that it can free its internal loading structures.
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_loader_close (GdkPixbufLoader *loader)
|
||||
{
|
||||
GdkPixbufLoaderPrivate *priv;
|
||||
|
||||
g_return_if_fail (loader != NULL);
|
||||
g_return_if_fail (GDK_IS_PIXBUF_LOADER (loader));
|
||||
|
||||
priv = loader->private;
|
||||
|
||||
/* we expect it's not closed */
|
||||
g_return_if_fail (priv->closed == FALSE);
|
||||
|
||||
/* We have less the 128 bytes in the image. Flush it, and keep going. */
|
||||
if (priv->image_module == NULL)
|
||||
gdk_pixbuf_loader_load_module (loader);
|
||||
|
||||
if (priv->image_module && priv->image_module->stop_load)
|
||||
(* priv->image_module->stop_load) (priv->context);
|
||||
|
||||
priv->closed = TRUE;
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (loader),
|
||||
pixbuf_loader_signals[CLOSED]);
|
||||
}
|
||||
|
||||
88
gdk-pixbuf/gdk-pixbuf-loader.h
Normal file
88
gdk-pixbuf/gdk-pixbuf-loader.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/* GdkPixbuf library - Main header file
|
||||
*
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Authors: Mark Crichton <crichton@gimp.org>
|
||||
* Miguel de Icaza <miguel@gnu.org>
|
||||
* Federico Mena-Quintero <federico@gimp.org>
|
||||
* Jonathan Blandford <jrb@redhat.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef GDK_PIXBUF_LOADER_H
|
||||
#define GDK_PIXBUF_LOADER_H
|
||||
|
||||
#include <unistd.h>
|
||||
#include <gtk/gtkobject.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define GDK_TYPE_PIXBUF_LOADER (gdk_pixbuf_loader_get_type ())
|
||||
#define GDK_PIXBUF_LOADER(obj) (GTK_CHECK_CAST ((obj), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoader))
|
||||
#define GDK_PIXBUF_LOADER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoaderClass))
|
||||
#define GDK_IS_PIXBUF_LOADER(obj) (GTK_CHECK_TYPE ((obj), GDK_TYPE_PIXBUF_LOADER))
|
||||
#define GDK_IS_PIXBUF_LOADER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_LOADER))
|
||||
|
||||
|
||||
typedef struct _GdkPixbufLoader GdkPixbufLoader;
|
||||
struct _GdkPixbufLoader
|
||||
{
|
||||
GtkObject object;
|
||||
|
||||
/* < Private > */
|
||||
gpointer private;
|
||||
};
|
||||
|
||||
typedef struct _GdkPixbufLoaderClass GdkPixbufLoaderClass;
|
||||
struct _GdkPixbufLoaderClass {
|
||||
GtkObjectClass parent_class;
|
||||
|
||||
void (* area_prepared) (GdkPixbufLoader *loader);
|
||||
|
||||
void (* area_updated) (GdkPixbufLoader *loader,
|
||||
guint x, guint y, guint width, guint height);
|
||||
|
||||
void (* frame_done) (GdkPixbufLoader *loader, GdkPixbufFrame *frame);
|
||||
|
||||
void (* animation_done) (GdkPixbufLoader *loader);
|
||||
|
||||
void (* closed) (GdkPixbufLoader *loader);
|
||||
};
|
||||
|
||||
|
||||
|
||||
GtkType gdk_pixbuf_loader_get_type (void);
|
||||
GdkPixbufLoader *gdk_pixbuf_loader_new (void);
|
||||
gboolean gdk_pixbuf_loader_write (GdkPixbufLoader *loader,
|
||||
const guchar *buf,
|
||||
size_t count);
|
||||
GdkPixbuf *gdk_pixbuf_loader_get_pixbuf (GdkPixbufLoader *loader);
|
||||
GdkPixbufAnimation *gdk_pixbuf_loader_get_animation (GdkPixbufLoader *loader);
|
||||
void gdk_pixbuf_loader_close (GdkPixbufLoader *loader);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
214
gdk-pixbuf/gdk-pixbuf-scale.c
Normal file
214
gdk-pixbuf/gdk-pixbuf-scale.c
Normal file
@@ -0,0 +1,214 @@
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "pixops/pixops.h"
|
||||
#include "math.h"
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_scale:
|
||||
* @src: a #GdkPixbuf
|
||||
* @dest: the #GdkPixbuf into which to render the results
|
||||
* @dest_x: the left coordinate for region to render
|
||||
* @dest_y: the top coordinate for region to render
|
||||
* @dest_width: the width of the region to render
|
||||
* @dest_height: the height of the region to render
|
||||
* @offset_x: the offset in the X direction (currently rounded to an integer)
|
||||
* @offset_y: the offset in the Y direction (currently rounded to an integer)
|
||||
* @scale_x: the scale factor in the X direction
|
||||
* @scale_y: the scale factor in the Y direction
|
||||
* @filter_level: the filter quality for the transformation.
|
||||
*
|
||||
* Transforms the image by source image by scaling by @scale_x and @scale_y then
|
||||
* translating by @offset_x and @offset_y, then renders the rectangle
|
||||
* (@dest,@dest_y,@dest_width,@dest_height) of the resulting image onto the
|
||||
* destination drawable replacing the previous contents.
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_scale (const GdkPixbuf *src,
|
||||
GdkPixbuf *dest,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
int dest_width,
|
||||
int dest_height,
|
||||
double offset_x,
|
||||
double offset_y,
|
||||
double scale_x,
|
||||
double scale_y,
|
||||
ArtFilterLevel filter_level)
|
||||
{
|
||||
offset_x = floor (offset_x + 0.5);
|
||||
offset_y = floor (offset_y + 0.5);
|
||||
|
||||
pixops_scale (dest->art_pixbuf->pixels + dest_y * dest->art_pixbuf->rowstride + dest_x * dest->art_pixbuf->n_channels,
|
||||
-offset_x, -offset_y, dest_width - offset_x, dest_height - offset_y,
|
||||
dest->art_pixbuf->rowstride, dest->art_pixbuf->n_channels, dest->art_pixbuf->has_alpha,
|
||||
src->art_pixbuf->pixels, src->art_pixbuf->width, src->art_pixbuf->height,
|
||||
src->art_pixbuf->rowstride, src->art_pixbuf->n_channels, src->art_pixbuf->has_alpha,
|
||||
scale_x, scale_y, filter_level);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_composite:
|
||||
* @src: a #GdkPixbuf
|
||||
* @dest: the #GdkPixbuf into which to render the results
|
||||
* @dest_x: the left coordinate for region to render
|
||||
* @dest_y: the top coordinate for region to render
|
||||
* @dest_width: the width of the region to render
|
||||
* @dest_height: the height of the region to render
|
||||
* @offset_x: the offset in the X direction (currently rounded to an integer)
|
||||
* @offset_y: the offset in the Y direction (currently rounded to an integer)
|
||||
* @scale_x: the scale factor in the X direction
|
||||
* @scale_y: the scale factor in the Y direction
|
||||
* @filter_level: the filter quality for the transformation.
|
||||
* @overall_alpha: overall alpha for source image (0..255)
|
||||
*
|
||||
* Transforms the image by source image by scaling by @scale_x and @scale_y then
|
||||
* translating by @offset_x and @offset_y, then composites the rectangle
|
||||
* (@dest,@dest_y,@dest_width,@dest_height) of the resulting image onto the
|
||||
* destination drawable.
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_composite (const GdkPixbuf *src,
|
||||
GdkPixbuf *dest,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
int dest_width,
|
||||
int dest_height,
|
||||
double offset_x,
|
||||
double offset_y,
|
||||
double scale_x,
|
||||
double scale_y,
|
||||
ArtFilterLevel filter_level,
|
||||
int overall_alpha)
|
||||
{
|
||||
offset_x = floor (offset_x + 0.5);
|
||||
offset_y = floor (offset_y + 0.5);
|
||||
pixops_composite (dest->art_pixbuf->pixels + dest_y * dest->art_pixbuf->rowstride + dest_x * dest->art_pixbuf->n_channels,
|
||||
-offset_x, -offset_y, dest_width - offset_x, dest_height - offset_y,
|
||||
dest->art_pixbuf->rowstride, dest->art_pixbuf->n_channels, dest->art_pixbuf->has_alpha,
|
||||
src->art_pixbuf->pixels, src->art_pixbuf->width, src->art_pixbuf->height,
|
||||
src->art_pixbuf->rowstride, src->art_pixbuf->n_channels, src->art_pixbuf->has_alpha,
|
||||
scale_x, scale_y, filter_level, overall_alpha);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_composite_color:
|
||||
* @src: a #GdkPixbuf
|
||||
* @dest: the #GdkPixbuf into which to render the results
|
||||
* @dest_x: the left coordinate for region to render
|
||||
* @dest_y: the top coordinate for region to render
|
||||
* @dest_width: the width of the region to render
|
||||
* @dest_height: the height of the region to render
|
||||
* @offset_x: the offset in the X direction (currently rounded to an integer)
|
||||
* @offset_y: the offset in the Y direction (currently rounded to an integer)
|
||||
* @scale_x: the scale factor in the X direction
|
||||
* @scale_y: the scale factor in the Y direction
|
||||
* @filter_level: the filter quality for the transformation.
|
||||
* @overall_alpha: overall alpha for source image (0..255)
|
||||
* @check_x: the X offset for the checkboard (origin of checkboard is at -@check_x, -@check_y)
|
||||
* @check_y: the Y offset for the checkboard
|
||||
* @check_size: the size of checks in the checkboard (must be a power of two)
|
||||
* @color1: the color of check at upper left
|
||||
* @color2: the color of the other check
|
||||
*
|
||||
* Transforms the image by source image by scaling by @scale_x and @scale_y then
|
||||
* translating by @offset_x and @offset_y, then composites the rectangle
|
||||
* (@dest,@dest_y,@dest_width,@dest_height) of the resulting image with
|
||||
* a checkboard of the colors @color1 and @color2 and renders it onto the
|
||||
* destination drawable.
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_composite_color (const GdkPixbuf *src,
|
||||
GdkPixbuf *dest,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
int dest_width,
|
||||
int dest_height,
|
||||
double offset_x,
|
||||
double offset_y,
|
||||
double scale_x,
|
||||
double scale_y,
|
||||
ArtFilterLevel filter_level,
|
||||
int overall_alpha,
|
||||
int check_x,
|
||||
int check_y,
|
||||
int check_size,
|
||||
art_u32 color1,
|
||||
art_u32 color2)
|
||||
{
|
||||
offset_x = floor (offset_x + 0.5);
|
||||
offset_y = floor (offset_y + 0.5);
|
||||
|
||||
pixops_composite_color (dest->art_pixbuf->pixels + dest_y * dest->art_pixbuf->rowstride + dest_x * dest->art_pixbuf->n_channels,
|
||||
-offset_x, -offset_y, dest_width - offset_x, dest_height - offset_y,
|
||||
dest->art_pixbuf->rowstride, dest->art_pixbuf->n_channels, dest->art_pixbuf->has_alpha,
|
||||
src->art_pixbuf->pixels, src->art_pixbuf->width, src->art_pixbuf->height,
|
||||
src->art_pixbuf->rowstride, src->art_pixbuf->n_channels, src->art_pixbuf->has_alpha,
|
||||
scale_x, scale_y, filter_level, overall_alpha, check_x, check_y, check_size, color1, color2);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_scale_simple:
|
||||
* @src: a #GdkPixbuf
|
||||
* @dest_width: the width of destination image
|
||||
* @dest_height: the height of destination image
|
||||
* @filter_level: the filter quality for the transformation.
|
||||
*
|
||||
* Scale the #GdkPixbuf @src to @dest_width x @dest_height and render the result into
|
||||
* a new #GdkPixbuf.
|
||||
*
|
||||
* Return value: the new #GdkPixbuf
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_scale_simple (const GdkPixbuf *src,
|
||||
int dest_width,
|
||||
int dest_height,
|
||||
ArtFilterLevel filter_level)
|
||||
{
|
||||
GdkPixbuf *dest = gdk_pixbuf_new (ART_PIX_RGB, src->art_pixbuf->has_alpha, 8, dest_width, dest_height);
|
||||
|
||||
gdk_pixbuf_scale (src, dest, 0, 0, dest_width, dest_height, 0, 0,
|
||||
(double)dest_width / src->art_pixbuf->width,
|
||||
(double)dest_height / src->art_pixbuf->height,
|
||||
filter_level);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_composite_color_simple:
|
||||
* @src: a #GdkPixbuf
|
||||
* @dest_width: the width of destination image
|
||||
* @dest_height: the height of destination image
|
||||
* @filter_level: the filter quality for the transformation.
|
||||
* @overall_alpha: overall alpha for source image (0..255)
|
||||
* @check_size: the size of checks in the checkboard (must be a power of two)
|
||||
* @color1: the color of check at upper left
|
||||
* @color2: the color of the other check
|
||||
*
|
||||
* Scale the #GdkPixbuf @src to @dest_width x @dest_height composite the result with
|
||||
* a checkboard of colors @color1 and @color2 and render the result into
|
||||
* a new #GdkPixbuf.
|
||||
*
|
||||
* Return value: the new #GdkPixbuf
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_composite_color_simple (const GdkPixbuf *src,
|
||||
int dest_width,
|
||||
int dest_height,
|
||||
ArtFilterLevel filter_level,
|
||||
int overall_alpha,
|
||||
int check_size,
|
||||
art_u32 color1,
|
||||
art_u32 color2)
|
||||
{
|
||||
GdkPixbuf *dest = gdk_pixbuf_new (ART_PIX_RGB, src->art_pixbuf->has_alpha, 8, dest_width, dest_height);
|
||||
|
||||
gdk_pixbuf_composite_color (src, dest, 0, 0, dest_width, dest_height, 0, 0,
|
||||
(double)dest_width / src->art_pixbuf->width,
|
||||
(double)dest_height / src->art_pixbuf->height,
|
||||
filter_level, overall_alpha, 0, 0, check_size, color1, color2);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
||||
|
||||
144
gdk-pixbuf/gdk-pixbuf-util.c
Normal file
144
gdk-pixbuf/gdk-pixbuf-util.c
Normal file
@@ -0,0 +1,144 @@
|
||||
/* GdkPixbuf library - Utilities and miscellaneous convenience functions
|
||||
*
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Authors: Federico Mena-Quintero <federico@gimp.org>
|
||||
* Cody Russell <bratsche@dfw.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_add_alpha:
|
||||
* @pixbuf: A pixbuf.
|
||||
* @substitute_color: Whether to substitute a color for zero opacity. If this
|
||||
* is #FALSE, then the (@r, @g, @b) arguments will be ignored.
|
||||
* @r: Red value to substitute.
|
||||
* @g: Green value to substitute.
|
||||
* @b: Blue value to substitute.
|
||||
*
|
||||
* Takes an existing pixbuf and adds an alpha channel to it. If the original
|
||||
* pixbuf already had alpha information, then the contents of the new pixbuf are
|
||||
* exactly the same as the original's. Otherwise, the new pixbuf will have all
|
||||
* pixels with full opacity if @substitute_color is #FALSE. If
|
||||
* @substitute_color is #TRUE, then the color specified by (@r, @g, @b) will be
|
||||
* substituted for zero opacity.
|
||||
*
|
||||
* Return value: A newly-created pixbuf with a reference count of 1.
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_add_alpha (GdkPixbuf *pixbuf, gboolean substitute_color, guchar r, guchar g, guchar b)
|
||||
{
|
||||
ArtPixBuf *apb;
|
||||
ArtPixBuf *new_apb;
|
||||
GdkPixbuf *new_pixbuf;
|
||||
int x, y;
|
||||
|
||||
g_return_val_if_fail (pixbuf != NULL, NULL);
|
||||
|
||||
apb = pixbuf->art_pixbuf;
|
||||
g_return_val_if_fail (apb->format == ART_PIX_RGB, NULL);
|
||||
g_return_val_if_fail (apb->n_channels == 3 || apb->n_channels == 4, NULL);
|
||||
g_return_val_if_fail (apb->bits_per_sample == 8, NULL);
|
||||
|
||||
if (apb->has_alpha) {
|
||||
new_apb = art_pixbuf_duplicate (apb);
|
||||
if (!new_apb)
|
||||
return NULL;
|
||||
|
||||
return gdk_pixbuf_new_from_art_pixbuf (new_apb);
|
||||
}
|
||||
|
||||
new_pixbuf = gdk_pixbuf_new (ART_PIX_RGB, TRUE, 8, apb->width, apb->height);
|
||||
if (!new_pixbuf)
|
||||
return NULL;
|
||||
|
||||
new_apb = new_pixbuf->art_pixbuf;
|
||||
|
||||
for (y = 0; y < apb->height; y++) {
|
||||
guchar *src, *dest;
|
||||
guchar tr, tg, tb;
|
||||
|
||||
src = apb->pixels + y * apb->rowstride;
|
||||
dest = new_apb->pixels + y * new_apb->rowstride;
|
||||
|
||||
for (x = 0; x < apb->width; x++) {
|
||||
tr = *dest++ = *src++;
|
||||
tg = *dest++ = *src++;
|
||||
tb = *dest++ = *src++;
|
||||
|
||||
if (substitute_color && tr == r && tg == g && tb == b)
|
||||
*dest++ = 0;
|
||||
else
|
||||
*dest++ = 255;
|
||||
}
|
||||
}
|
||||
|
||||
return new_pixbuf;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_copy_area:
|
||||
* @src_pixbuf: Source pixbuf.
|
||||
* @src_x: Source X coordinate within @src_pixbuf.
|
||||
* @src_y: Source Y coordinate within @src_pixbuf.
|
||||
* @width: Width of the area to copy.
|
||||
* @height: Height of the area to copy.
|
||||
* @dest_pixbuf: Destination pixbuf.
|
||||
* @dest_x: X coordinate within @dest_pixbuf.
|
||||
* @dest_y: Y coordinate within @dest_pixbuf.
|
||||
*
|
||||
* Copies a rectangular area from @src_pixbuf to @dest_pixbuf. Conversion of
|
||||
* pixbuf formats is done automatically.
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf,
|
||||
int src_x, int src_y,
|
||||
int width, int height,
|
||||
GdkPixbuf *dest_pixbuf,
|
||||
int dest_x, int dest_y)
|
||||
{
|
||||
const ArtPixBuf *src_apb;
|
||||
ArtPixBuf *dest_apb;
|
||||
|
||||
g_return_if_fail (src_pixbuf != NULL);
|
||||
g_return_if_fail (dest_pixbuf != NULL);
|
||||
|
||||
src_apb = src_pixbuf->art_pixbuf;
|
||||
dest_apb = dest_pixbuf->art_pixbuf;
|
||||
|
||||
g_return_if_fail (src_x >= 0 && src_x + width <= src_apb->width);
|
||||
g_return_if_fail (src_y >= 0 && src_y + height <= src_apb->height);
|
||||
|
||||
g_return_if_fail (dest_x >= 0 && dest_x + width <= dest_apb->width);
|
||||
g_return_if_fail (dest_y >= 0 && dest_y + height <= dest_apb->height);
|
||||
|
||||
/* This will perform format conversions automatically */
|
||||
|
||||
gdk_pixbuf_scale (src_pixbuf,
|
||||
dest_pixbuf,
|
||||
dest_x, dest_y,
|
||||
width, height,
|
||||
(double) (dest_x - src_x),
|
||||
(double) (dest_y - src_y),
|
||||
1.0, 1.0,
|
||||
ART_FILTER_NEAREST);
|
||||
}
|
||||
95
gdk-pixbuf/gdk-pixbuf-xform.c
Normal file
95
gdk-pixbuf/gdk-pixbuf-xform.c
Normal file
@@ -0,0 +1,95 @@
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_scale (const GdkPixbuf *pixbuf, gint w, gint h)
|
||||
{
|
||||
art_u8 *pixels;
|
||||
gint rowstride;
|
||||
double affine[6];
|
||||
ArtAlphaGamma *alphagamma;
|
||||
ArtPixBuf *art_pixbuf = NULL;
|
||||
GdkPixbuf *copy = NULL;
|
||||
|
||||
alphagamma = NULL;
|
||||
|
||||
affine[1] = affine[2] = affine[4] = affine[5] = 0;
|
||||
|
||||
affine[0] = w / (double)(pixbuf->art_pixbuf->width);
|
||||
affine[3] = h / (double)(pixbuf->art_pixbuf->height);
|
||||
|
||||
/* rowstride = w * pixbuf->art_pixbuf->n_channels; */
|
||||
rowstride = w * 3;
|
||||
|
||||
pixels = art_alloc (h * rowstride);
|
||||
art_rgb_pixbuf_affine (pixels, 0, 0, w, h, rowstride,
|
||||
pixbuf->art_pixbuf,
|
||||
affine, ART_FILTER_NEAREST, alphagamma);
|
||||
|
||||
if (pixbuf->art_pixbuf->has_alpha)
|
||||
/* should be rgba */
|
||||
art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
|
||||
else
|
||||
art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
|
||||
|
||||
copy = gdk_pixbuf_new (art_pixbuf, NULL);
|
||||
|
||||
if (!copy)
|
||||
art_free (pixels);
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_rotate (GdkPixbuf *pixbuf, gdouble angle)
|
||||
{
|
||||
art_u8 *pixels;
|
||||
gint rowstride, w, h;
|
||||
gdouble rad;
|
||||
double rot[6], trans[6], affine[6];
|
||||
ArtAlphaGamma *alphagamma = NULL;
|
||||
ArtPixBuf *art_pixbuf = NULL;
|
||||
|
||||
w = pixbuf->art_pixbuf->width;
|
||||
h = pixbuf->art_pixbuf->height;
|
||||
|
||||
rad = (M_PI * angle / 180.0);
|
||||
|
||||
rot[0] = cos(rad);
|
||||
rot[1] = sin(rad);
|
||||
rot[2] = -sin(rad);
|
||||
rot[3] = cos(rad);
|
||||
rot[4] = rot[5] = 0;
|
||||
|
||||
trans[0] = trans[3] = 1;
|
||||
trans[1] = trans[2] = 0;
|
||||
trans[4] = -(double)w / 2.0;
|
||||
trans[5] = -(double)h / 2.0;
|
||||
|
||||
art_affine_multiply(rot, trans, rot);
|
||||
|
||||
trans[0] = trans[3] = 1;
|
||||
trans[1] = trans[2] = 0;
|
||||
trans[4] = (double)w / 2.0;
|
||||
trans[5] = (double)h / 2.0;
|
||||
|
||||
art_affine_multiply(affine, rot, trans);
|
||||
/*
|
||||
g_print("Affine: %e %e %e %e %e %e\n", affine[0], affine[1], affine[2],
|
||||
affine[3], affine[4], affine[5]);
|
||||
*/
|
||||
/* rowstride = w * pixbuf->art_pixbuf->n_channels; */
|
||||
rowstride = w * 3;
|
||||
|
||||
pixels = art_alloc (h * rowstride);
|
||||
art_rgb_pixbuf_affine (pixels, 0, 0, w, h, rowstride,
|
||||
pixbuf->art_pixbuf,
|
||||
affine, ART_FILTER_NEAREST, alphagamma);
|
||||
if (pixbuf->art_pixbuf->has_alpha)
|
||||
/* should be rgba */
|
||||
art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
|
||||
else
|
||||
art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
|
||||
|
||||
art_pixbuf_free (pixbuf->art_pixbuf);
|
||||
pixbuf->art_pixbuf = art_pixbuf;
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
313
gdk-pixbuf/gdk-pixbuf.c
Normal file
313
gdk-pixbuf/gdk-pixbuf.c
Normal file
@@ -0,0 +1,313 @@
|
||||
/* GdkPixbuf library - Basic memory management
|
||||
*
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Authors: Mark Crichton <crichton@gimp.org>
|
||||
* Miguel de Icaza <miguel@gnu.org>
|
||||
* Federico Mena-Quintero <federico@gimp.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <math.h>
|
||||
#include <libart_lgpl/art_misc.h>
|
||||
#include <libart_lgpl/art_affine.h>
|
||||
#include <libart_lgpl/art_pixbuf.h>
|
||||
#include <libart_lgpl/art_rgb_pixbuf_affine.h>
|
||||
#include <libart_lgpl/art_alphagamma.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
|
||||
|
||||
|
||||
/* Reference counting */
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_ref:
|
||||
* @pixbuf: A pixbuf.
|
||||
*
|
||||
* Adds a reference to a pixbuf. It must be released afterwards using
|
||||
* gdk_pixbuf_unref().
|
||||
*
|
||||
* Return value: The same as the @pixbuf argument.
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_ref (GdkPixbuf *pixbuf)
|
||||
{
|
||||
g_return_val_if_fail (pixbuf != NULL, NULL);
|
||||
g_return_val_if_fail (pixbuf->ref_count > 0, NULL);
|
||||
|
||||
pixbuf->ref_count++;
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_unref:
|
||||
* @pixbuf: A pixbuf.
|
||||
*
|
||||
* Removes a reference from a pixbuf. It will be destroyed when the reference
|
||||
* count drops to zero.
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_unref (GdkPixbuf *pixbuf)
|
||||
{
|
||||
g_return_if_fail (pixbuf != NULL);
|
||||
g_return_if_fail (pixbuf->ref_count > 0);
|
||||
|
||||
pixbuf->ref_count--;
|
||||
|
||||
if (pixbuf->ref_count == 0) {
|
||||
art_pixbuf_free (pixbuf->art_pixbuf);
|
||||
pixbuf->art_pixbuf = NULL;
|
||||
g_free (pixbuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Wrap a libart pixbuf */
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_new_from_art_pixbuf:
|
||||
* @art_pixbuf: A libart pixbuf.
|
||||
*
|
||||
* Creates a #GdkPixbuf by wrapping a libart pixbuf.
|
||||
*
|
||||
* Return value: A newly-created #GdkPixbuf structure with a reference count of
|
||||
* 1.
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_new_from_art_pixbuf (ArtPixBuf *art_pixbuf)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
g_return_val_if_fail (art_pixbuf != NULL, NULL);
|
||||
|
||||
pixbuf = g_new (GdkPixbuf, 1);
|
||||
pixbuf->ref_count = 1;
|
||||
pixbuf->art_pixbuf = art_pixbuf;
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
/* Destroy notification function for gdk_pixbuf_new() */
|
||||
static void
|
||||
free_buffer (gpointer user_data, gpointer data)
|
||||
{
|
||||
free (data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Create an empty pixbuf */
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_new:
|
||||
* @format: Image format.
|
||||
* @has_alpha: Whether the image should have transparency information.
|
||||
* @bits_per_sample: Number of bits per color sample.
|
||||
* @width: Width of image in pixels.
|
||||
* @height: Height of image in pixels.
|
||||
*
|
||||
* Creates a new #GdkPixbuf structure and allocates a buffer for it. The buffer
|
||||
* has an optimal rowstride. Note that the buffer is not cleared; you will have
|
||||
* to fill it completely.
|
||||
*
|
||||
* Return value: A newly-created #GdkPixbuf with a reference count of 1, or NULL
|
||||
* if not enough memory could be allocated for the image buffer.
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_new (ArtPixFormat format, gboolean has_alpha, int bits_per_sample,
|
||||
int width, int height)
|
||||
{
|
||||
guchar *buf;
|
||||
int channels;
|
||||
int rowstride;
|
||||
|
||||
g_return_val_if_fail (format == ART_PIX_RGB, NULL);
|
||||
g_return_val_if_fail (bits_per_sample == 8, NULL);
|
||||
g_return_val_if_fail (width > 0, NULL);
|
||||
g_return_val_if_fail (height > 0, NULL);
|
||||
|
||||
/* Always align rows to 32-bit boundaries */
|
||||
|
||||
channels = has_alpha ? 4 : 3;
|
||||
rowstride = 4 * ((channels * width + 3) / 4);
|
||||
|
||||
buf = malloc (height * rowstride);
|
||||
if (!buf)
|
||||
return NULL;
|
||||
|
||||
return gdk_pixbuf_new_from_data (buf, format, has_alpha, width, height, rowstride,
|
||||
free_buffer, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Convenience functions */
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_get_format:
|
||||
* @pixbuf: A pixbuf.
|
||||
*
|
||||
* Queries the image format (color model) of a pixbuf.
|
||||
*
|
||||
* Return value: Image format.
|
||||
**/
|
||||
ArtPixFormat
|
||||
gdk_pixbuf_get_format (GdkPixbuf *pixbuf)
|
||||
{
|
||||
g_return_val_if_fail (pixbuf != NULL, ART_PIX_RGB);
|
||||
g_assert (pixbuf->art_pixbuf != NULL);
|
||||
|
||||
return pixbuf->art_pixbuf->format;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_get_n_channels:
|
||||
* @pixbuf: A pixbuf.
|
||||
*
|
||||
* Queries the number of channels of a pixbuf.
|
||||
*
|
||||
* Return value: Number of channels.
|
||||
**/
|
||||
int
|
||||
gdk_pixbuf_get_n_channels (GdkPixbuf *pixbuf)
|
||||
{
|
||||
g_return_val_if_fail (pixbuf != NULL, -1);
|
||||
g_assert (pixbuf->art_pixbuf != NULL);
|
||||
|
||||
return pixbuf->art_pixbuf->n_channels;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_get_has_alpha:
|
||||
* @pixbuf: A pixbuf.
|
||||
*
|
||||
* Queries whether a pixbuf has an alpha channel (opacity information).
|
||||
*
|
||||
* Return value: TRUE if it has an alpha channel, FALSE otherwise.
|
||||
**/
|
||||
int
|
||||
gdk_pixbuf_get_has_alpha (GdkPixbuf *pixbuf)
|
||||
{
|
||||
g_return_val_if_fail (pixbuf != NULL, -1);
|
||||
g_assert (pixbuf->art_pixbuf != NULL);
|
||||
|
||||
return pixbuf->art_pixbuf->has_alpha;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_get_bits_per_sample:
|
||||
* @pixbuf: A pixbuf.
|
||||
*
|
||||
* Queries the number of bits per color sample in a pixbuf.
|
||||
*
|
||||
* Return value: Number of bits per color sample.
|
||||
**/
|
||||
int
|
||||
gdk_pixbuf_get_bits_per_sample (GdkPixbuf *pixbuf)
|
||||
{
|
||||
g_return_val_if_fail (pixbuf != NULL, -1);
|
||||
g_assert (pixbuf->art_pixbuf != NULL);
|
||||
|
||||
return pixbuf->art_pixbuf->bits_per_sample;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_get_pixels:
|
||||
* @pixbuf: A pixbuf.
|
||||
*
|
||||
* Queries a pointer to the pixel data of a pixbuf.
|
||||
*
|
||||
* Return value: A pointer to the pixbuf's pixel data.
|
||||
**/
|
||||
guchar *
|
||||
gdk_pixbuf_get_pixels (GdkPixbuf *pixbuf)
|
||||
{
|
||||
g_return_val_if_fail (pixbuf != NULL, NULL);
|
||||
g_assert (pixbuf->art_pixbuf != NULL);
|
||||
|
||||
return pixbuf->art_pixbuf->pixels;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_get_width:
|
||||
* @pixbuf: A pixbuf.
|
||||
*
|
||||
* Queries the width of a pixbuf.
|
||||
*
|
||||
* Return value: Width in pixels.
|
||||
**/
|
||||
int
|
||||
gdk_pixbuf_get_width (GdkPixbuf *pixbuf)
|
||||
{
|
||||
g_return_val_if_fail (pixbuf != NULL, -1);
|
||||
g_assert (pixbuf->art_pixbuf != NULL);
|
||||
|
||||
return pixbuf->art_pixbuf->width;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_get_height:
|
||||
* @pixbuf: A pixbuf.
|
||||
*
|
||||
* Queries the height of a pixbuf.
|
||||
*
|
||||
* Return value: Height in pixels.
|
||||
**/
|
||||
int
|
||||
gdk_pixbuf_get_height (GdkPixbuf *pixbuf)
|
||||
{
|
||||
g_return_val_if_fail (pixbuf != NULL, -1);
|
||||
g_assert (pixbuf->art_pixbuf != NULL);
|
||||
|
||||
return pixbuf->art_pixbuf->height;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_get_rowstride:
|
||||
* @pixbuf: A pixbuf.
|
||||
*
|
||||
* Queries the rowstride of a pixbuf, or the number of bytes between rows.
|
||||
*
|
||||
* Return value: Number of bytes between rows.
|
||||
**/
|
||||
int
|
||||
gdk_pixbuf_get_rowstride (GdkPixbuf *pixbuf)
|
||||
{
|
||||
g_return_val_if_fail (pixbuf != NULL, -1);
|
||||
g_assert (pixbuf->art_pixbuf != NULL);
|
||||
|
||||
return pixbuf->art_pixbuf->rowstride;
|
||||
}
|
||||
|
||||
/* General initialization hooks */
|
||||
const guint gdk_pixbuf_major_version=GDK_PIXBUF_MAJOR,
|
||||
gdk_pixbuf_minor_version=GDK_PIXBUF_MINOR,
|
||||
gdk_pixbuf_micro_version=GDK_PIXBUF_MICRO;
|
||||
|
||||
const char *gdk_pixbuf_version = GDK_PIXBUF_VERSION;
|
||||
|
||||
void
|
||||
gdk_pixbuf_preinit(gpointer app, gpointer modinfo)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
gdk_pixbuf_postinit(gpointer app, gpointer modinfo)
|
||||
{
|
||||
}
|
||||
250
gdk-pixbuf/gdk-pixbuf.h
Normal file
250
gdk-pixbuf/gdk-pixbuf.h
Normal file
@@ -0,0 +1,250 @@
|
||||
/* GdkPixbuf library - Main header file
|
||||
*
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Authors: Mark Crichton <crichton@gimp.org>
|
||||
* Miguel de Icaza <miguel@gnu.org>
|
||||
* Federico Mena-Quintero <federico@gimp.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef GDK_PIXBUF_H
|
||||
#define GDK_PIXBUF_H
|
||||
|
||||
#include <libart_lgpl/art_misc.h>
|
||||
#include <libart_lgpl/art_pixbuf.h>
|
||||
#include <libart_lgpl/art_filterlevel.h>
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf-features.h>
|
||||
|
||||
/* GdkPixbuf structures */
|
||||
typedef struct _GdkPixbuf GdkPixbuf;
|
||||
typedef struct _GdkPixbufFrame GdkPixbufFrame;
|
||||
typedef struct _GdkPixbufAnimation GdkPixbufAnimation;
|
||||
|
||||
struct _GdkPixbuf {
|
||||
/* Reference count */
|
||||
int ref_count;
|
||||
|
||||
/* Libart pixbuf */
|
||||
ArtPixBuf *art_pixbuf;
|
||||
};
|
||||
|
||||
/* GIF-like animation overlay modes for frames */
|
||||
typedef enum {
|
||||
GDK_PIXBUF_FRAME_RETAIN,
|
||||
GDK_PIXBUF_FRAME_DISPOSE,
|
||||
GDK_PIXBUF_FRAME_REVERT
|
||||
} GdkPixbufFrameAction;
|
||||
|
||||
struct _GdkPixbufFrame {
|
||||
/* The pixbuf with this frame's image data */
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
/* Offsets for overlaying onto the animation's area */
|
||||
int x_offset;
|
||||
int y_offset;
|
||||
|
||||
/* Frame duration in ms */
|
||||
int delay_time;
|
||||
|
||||
/* Overlay mode */
|
||||
GdkPixbufFrameAction action;
|
||||
};
|
||||
|
||||
struct _GdkPixbufAnimation {
|
||||
/* Reference count */
|
||||
int ref_count;
|
||||
|
||||
/* Number of frames */
|
||||
int n_frames;
|
||||
|
||||
/* List of GdkPixbufFrame structures */
|
||||
GList *frames;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* Convenience functions */
|
||||
|
||||
ArtPixFormat gdk_pixbuf_get_format (GdkPixbuf *pixbuf);
|
||||
int gdk_pixbuf_get_n_channels (GdkPixbuf *pixbuf);
|
||||
int gdk_pixbuf_get_has_alpha (GdkPixbuf *pixbuf);
|
||||
int gdk_pixbuf_get_bits_per_sample (GdkPixbuf *pixbuf);
|
||||
guchar *gdk_pixbuf_get_pixels (GdkPixbuf *pixbuf);
|
||||
int gdk_pixbuf_get_width (GdkPixbuf *pixbuf);
|
||||
int gdk_pixbuf_get_height (GdkPixbuf *pixbuf);
|
||||
int gdk_pixbuf_get_rowstride (GdkPixbuf *pixbuf);
|
||||
|
||||
/* Reference counting */
|
||||
|
||||
GdkPixbuf *gdk_pixbuf_ref (GdkPixbuf *pixbuf);
|
||||
void gdk_pixbuf_unref (GdkPixbuf *pixbuf);
|
||||
|
||||
/* Wrap a libart pixbuf */
|
||||
GdkPixbuf *gdk_pixbuf_new_from_art_pixbuf (ArtPixBuf *art_pixbuf);
|
||||
|
||||
/* Create a blank pixbuf with an optimal rowstride and a new buffer */
|
||||
GdkPixbuf *gdk_pixbuf_new (ArtPixFormat format, gboolean has_alpha, int bits_per_sample,
|
||||
int width, int height);
|
||||
|
||||
/* Simple loading */
|
||||
|
||||
GdkPixbuf *gdk_pixbuf_new_from_file (const char *filename);
|
||||
|
||||
GdkPixbuf *gdk_pixbuf_new_from_data (const guchar *data,
|
||||
ArtPixFormat format,
|
||||
gboolean has_alpha,
|
||||
int width, int height,
|
||||
int rowstride,
|
||||
ArtDestroyNotify dfunc,
|
||||
gpointer dfunc_data);
|
||||
|
||||
GdkPixbuf *gdk_pixbuf_new_from_xpm_data (const char **data);
|
||||
|
||||
/* Adding an alpha channel */
|
||||
GdkPixbuf *gdk_pixbuf_add_alpha (GdkPixbuf *pixbuf, gboolean substitute_color,
|
||||
guchar r, guchar g, guchar b);
|
||||
|
||||
/* Rendering to a drawable */
|
||||
|
||||
/* Alpha compositing mode */
|
||||
typedef enum {
|
||||
GDK_PIXBUF_ALPHA_BILEVEL,
|
||||
GDK_PIXBUF_ALPHA_FULL
|
||||
} GdkPixbufAlphaMode;
|
||||
|
||||
void gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf, GdkBitmap *bitmap,
|
||||
int src_x, int src_y,
|
||||
int dest_x, int dest_y,
|
||||
int width, int height,
|
||||
int alpha_threshold);
|
||||
|
||||
void gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf,
|
||||
GdkDrawable *drawable, GdkGC *gc,
|
||||
int src_x, int src_y,
|
||||
int dest_x, int dest_y,
|
||||
int width, int height,
|
||||
GdkRgbDither dither,
|
||||
int x_dither, int y_dither);
|
||||
|
||||
void gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf, GdkDrawable *drawable,
|
||||
int src_x, int src_y,
|
||||
int dest_x, int dest_y,
|
||||
int width, int height,
|
||||
GdkPixbufAlphaMode alpha_mode,
|
||||
int alpha_threshold,
|
||||
GdkRgbDither dither,
|
||||
int x_dither, int y_dither);
|
||||
|
||||
void gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
|
||||
GdkPixmap **pixmap_return, GdkBitmap **mask_return,
|
||||
int alpha_threshold);
|
||||
|
||||
/* Fetching a region from a drawable */
|
||||
GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
|
||||
GdkDrawable *src, GdkColormap *cmap,
|
||||
int src_x, int src_y,
|
||||
int dest_x, int dest_y,
|
||||
int width, int height);
|
||||
|
||||
/* Copy an area of a pixbuf onto another one */
|
||||
void gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf,
|
||||
int src_x, int src_y,
|
||||
int width, int height,
|
||||
GdkPixbuf *dest_pixbuf,
|
||||
int dest_x, int dest_y);
|
||||
|
||||
/* Scaling */
|
||||
|
||||
void gdk_pixbuf_scale (const GdkPixbuf *src,
|
||||
GdkPixbuf *dest,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
int dest_width,
|
||||
int dest_height,
|
||||
double offset_x,
|
||||
double offset_y,
|
||||
double scale_x,
|
||||
double scale_y,
|
||||
ArtFilterLevel filter_level);
|
||||
void gdk_pixbuf_composite (const GdkPixbuf *src,
|
||||
GdkPixbuf *dest,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
int dest_width,
|
||||
int dest_height,
|
||||
double offset_x,
|
||||
double offset_y,
|
||||
double scale_x,
|
||||
double scale_y,
|
||||
ArtFilterLevel filter_level,
|
||||
int overall_alpha);
|
||||
void gdk_pixbuf_composite_color (const GdkPixbuf *src,
|
||||
GdkPixbuf *dest,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
int dest_width,
|
||||
int dest_height,
|
||||
double offset_x,
|
||||
double offset_y,
|
||||
double scale_x,
|
||||
double scale_y,
|
||||
ArtFilterLevel filter_level,
|
||||
int overall_alpha,
|
||||
int check_x,
|
||||
int check_y,
|
||||
int check_size,
|
||||
art_u32 color1,
|
||||
art_u32 color2);
|
||||
|
||||
GdkPixbuf *gdk_pixbuf_scale_simple (const GdkPixbuf *src,
|
||||
int dest_width,
|
||||
int dest_height,
|
||||
ArtFilterLevel filter_level);
|
||||
GdkPixbuf *gdk_pixbuf_composite_color_simple (const GdkPixbuf *src,
|
||||
int dest_width,
|
||||
int dest_height,
|
||||
ArtFilterLevel filter_level,
|
||||
int overall_alpha,
|
||||
int check_size,
|
||||
art_u32 color1,
|
||||
art_u32 color2);
|
||||
|
||||
/* Animation support */
|
||||
|
||||
GdkPixbufAnimation *gdk_pixbuf_animation_new_from_file (const char *filename);
|
||||
|
||||
GdkPixbufAnimation *gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation);
|
||||
void gdk_pixbuf_animation_unref (GdkPixbufAnimation *animation);
|
||||
|
||||
/* General (presently empty) initialization hooks, primarily for gnome-libs */
|
||||
void gdk_pixbuf_preinit (gpointer app, gpointer modinfo);
|
||||
void gdk_pixbuf_postinit (gpointer app, gpointer modinfo);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
833
gdk-pixbuf/gnome-canvas-pixbuf.c
Normal file
833
gdk-pixbuf/gnome-canvas-pixbuf.c
Normal file
@@ -0,0 +1,833 @@
|
||||
/* GNOME libraries - GdkPixbuf item for the GNOME canvas
|
||||
*
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Author: Federico Mena-Quintero <federico@gimp.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <math.h>
|
||||
#include <libgnomeui/gnome-canvas.h>
|
||||
#include <libgnomeui/gnome-canvas-util.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include <libart_lgpl/art_rgb_pixbuf_affine.h>
|
||||
#include "gnome-canvas-pixbuf.h"
|
||||
|
||||
|
||||
|
||||
/* Private part of the GnomeCanvasPixbuf structure */
|
||||
typedef struct {
|
||||
/* Our gdk-pixbuf */
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
/* Width value */
|
||||
double width;
|
||||
|
||||
/* Height value */
|
||||
double height;
|
||||
|
||||
/* X translation */
|
||||
double x;
|
||||
|
||||
/* Y translation */
|
||||
double y;
|
||||
|
||||
/* Whether dimensions are set and whether they are in pixels or units */
|
||||
guint width_set : 1;
|
||||
guint width_in_pixels : 1;
|
||||
guint height_set : 1;
|
||||
guint height_in_pixels : 1;
|
||||
guint x_in_pixels : 1;
|
||||
guint y_in_pixels : 1;
|
||||
|
||||
/* Whether the pixbuf has changed */
|
||||
guint need_pixbuf_update : 1;
|
||||
|
||||
/* Whether the transformation or size have changed */
|
||||
guint need_xform_update : 1;
|
||||
} PixbufPrivate;
|
||||
|
||||
|
||||
|
||||
/* Object argument IDs */
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_PIXBUF,
|
||||
ARG_WIDTH,
|
||||
ARG_WIDTH_SET,
|
||||
ARG_WIDTH_IN_PIXELS,
|
||||
ARG_HEIGHT,
|
||||
ARG_HEIGHT_SET,
|
||||
ARG_HEIGHT_IN_PIXELS,
|
||||
ARG_X,
|
||||
ARG_X_IN_PIXELS,
|
||||
ARG_Y,
|
||||
ARG_Y_IN_PIXELS
|
||||
};
|
||||
|
||||
static void gnome_canvas_pixbuf_class_init (GnomeCanvasPixbufClass *class);
|
||||
static void gnome_canvas_pixbuf_init (GnomeCanvasPixbuf *cpb);
|
||||
static void gnome_canvas_pixbuf_destroy (GtkObject *object);
|
||||
static void gnome_canvas_pixbuf_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
|
||||
static void gnome_canvas_pixbuf_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
|
||||
|
||||
static void gnome_canvas_pixbuf_update (GnomeCanvasItem *item, double *affine,
|
||||
ArtSVP *clip_path, int flags);
|
||||
static void gnome_canvas_pixbuf_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
||||
int x, int y, int width, int height);
|
||||
static void gnome_canvas_pixbuf_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf);
|
||||
static double gnome_canvas_pixbuf_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
|
||||
GnomeCanvasItem **actual_item);
|
||||
static void gnome_canvas_pixbuf_bounds (GnomeCanvasItem *item,
|
||||
double *x1, double *y1, double *x2, double *y2);
|
||||
|
||||
static GnomeCanvasItemClass *parent_class;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* gnome_canvas_pixbuf_get_type:
|
||||
* @void:
|
||||
*
|
||||
* Registers the #GnomeCanvasPixbuf class if necessary, and returns the type ID
|
||||
* associated to it.
|
||||
*
|
||||
* Return value: The type ID of the #GnomeCanvasPixbuf class.
|
||||
**/
|
||||
GtkType
|
||||
gnome_canvas_pixbuf_get_type (void)
|
||||
{
|
||||
static GtkType canvas_pixbuf_type = 0;
|
||||
|
||||
if (!canvas_pixbuf_type) {
|
||||
static const GtkTypeInfo canvas_pixbuf_info = {
|
||||
"GnomeCanvasPixbuf",
|
||||
sizeof (GnomeCanvasPixbuf),
|
||||
sizeof (GnomeCanvasPixbufClass),
|
||||
(GtkClassInitFunc) gnome_canvas_pixbuf_class_init,
|
||||
(GtkObjectInitFunc) gnome_canvas_pixbuf_init,
|
||||
NULL, /* reserved_1 */
|
||||
NULL, /* reserved_2 */
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
canvas_pixbuf_type = gtk_type_unique (gnome_canvas_item_get_type (),
|
||||
&canvas_pixbuf_info);
|
||||
}
|
||||
|
||||
return canvas_pixbuf_type;
|
||||
}
|
||||
|
||||
/* Class initialization function for the pixbuf canvas item */
|
||||
static void
|
||||
gnome_canvas_pixbuf_class_init (GnomeCanvasPixbufClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GnomeCanvasItemClass *item_class;
|
||||
|
||||
object_class = (GtkObjectClass *) class;
|
||||
item_class = (GnomeCanvasItemClass *) class;
|
||||
|
||||
parent_class = gtk_type_class (gnome_canvas_item_get_type ());
|
||||
|
||||
gtk_object_add_arg_type ("GnomeCanvasPixbuf::pixbuf",
|
||||
GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_PIXBUF);
|
||||
gtk_object_add_arg_type ("GnomeCanvasPixbuf::width",
|
||||
GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_WIDTH);
|
||||
gtk_object_add_arg_type ("GnomeCanvasPixbuf::width_set",
|
||||
GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_WIDTH_SET);
|
||||
gtk_object_add_arg_type ("GnomeCanvasPixbuf::width_in_pixels",
|
||||
GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_WIDTH_IN_PIXELS);
|
||||
gtk_object_add_arg_type ("GnomeCanvasPixbuf::height",
|
||||
GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_HEIGHT);
|
||||
gtk_object_add_arg_type ("GnomeCanvasPixbuf::height_set",
|
||||
GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HEIGHT_SET);
|
||||
gtk_object_add_arg_type ("GnomeCanvasPixbuf::height_in_pixels",
|
||||
GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HEIGHT_IN_PIXELS);
|
||||
gtk_object_add_arg_type ("GnomeCanvasPixbuf::x",
|
||||
GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_X);
|
||||
gtk_object_add_arg_type ("GnomeCanvasPixbuf::x_in_pixels",
|
||||
GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_X_IN_PIXELS);
|
||||
gtk_object_add_arg_type ("GnomeCanvasPixbuf::y",
|
||||
GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_Y);
|
||||
gtk_object_add_arg_type ("GnomeCanvasPixbuf::y_in_pixels",
|
||||
GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_Y_IN_PIXELS);
|
||||
|
||||
|
||||
object_class->destroy = gnome_canvas_pixbuf_destroy;
|
||||
object_class->set_arg = gnome_canvas_pixbuf_set_arg;
|
||||
object_class->get_arg = gnome_canvas_pixbuf_get_arg;
|
||||
|
||||
item_class->update = gnome_canvas_pixbuf_update;
|
||||
item_class->draw = gnome_canvas_pixbuf_draw;
|
||||
item_class->render = gnome_canvas_pixbuf_render;
|
||||
item_class->point = gnome_canvas_pixbuf_point;
|
||||
item_class->bounds = gnome_canvas_pixbuf_bounds;
|
||||
}
|
||||
|
||||
/* Object initialization function for the pixbuf canvas item */
|
||||
static void
|
||||
gnome_canvas_pixbuf_init (GnomeCanvasPixbuf *gcp)
|
||||
{
|
||||
PixbufPrivate *priv;
|
||||
|
||||
priv = g_new0 (PixbufPrivate, 1);
|
||||
gcp->priv = priv;
|
||||
|
||||
priv->width = 0.0;
|
||||
priv->height = 0.0;
|
||||
priv->x = 0.0;
|
||||
priv->y = 0.0;
|
||||
}
|
||||
|
||||
/* Destroy handler for the pixbuf canvas item */
|
||||
static void
|
||||
gnome_canvas_pixbuf_destroy (GtkObject *object)
|
||||
{
|
||||
GnomeCanvasItem *item;
|
||||
GnomeCanvasPixbuf *gcp;
|
||||
PixbufPrivate *priv;
|
||||
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (GNOME_IS_CANVAS_PIXBUF (object));
|
||||
|
||||
item = GNOME_CANVAS_ITEM (object);
|
||||
gcp = (GNOME_CANVAS_PIXBUF (object));
|
||||
priv = gcp->priv;
|
||||
|
||||
gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2);
|
||||
|
||||
if (priv->pixbuf)
|
||||
gdk_pixbuf_unref (priv->pixbuf);
|
||||
|
||||
g_free (priv);
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Set_arg handler for the pixbuf canvas item */
|
||||
static void
|
||||
gnome_canvas_pixbuf_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
|
||||
{
|
||||
GnomeCanvasItem *item;
|
||||
GnomeCanvasPixbuf *gcp;
|
||||
PixbufPrivate *priv;
|
||||
GdkPixbuf *pixbuf;
|
||||
double val;
|
||||
|
||||
item = GNOME_CANVAS_ITEM (object);
|
||||
gcp = GNOME_CANVAS_PIXBUF (object);
|
||||
priv = gcp->priv;
|
||||
|
||||
switch (arg_id) {
|
||||
case ARG_PIXBUF:
|
||||
pixbuf = GTK_VALUE_POINTER (*arg);
|
||||
if (pixbuf != priv->pixbuf) {
|
||||
if (pixbuf) {
|
||||
g_return_if_fail (pixbuf->art_pixbuf->format == ART_PIX_RGB);
|
||||
g_return_if_fail (pixbuf->art_pixbuf->n_channels == 3
|
||||
|| pixbuf->art_pixbuf->n_channels == 4);
|
||||
g_return_if_fail (pixbuf->art_pixbuf->bits_per_sample == 8);
|
||||
|
||||
gdk_pixbuf_ref (pixbuf);
|
||||
}
|
||||
|
||||
if (priv->pixbuf)
|
||||
gdk_pixbuf_unref (priv->pixbuf);
|
||||
|
||||
priv->pixbuf = pixbuf;
|
||||
}
|
||||
|
||||
priv->need_pixbuf_update = TRUE;
|
||||
gnome_canvas_item_request_update (item);
|
||||
break;
|
||||
|
||||
case ARG_WIDTH:
|
||||
val = GTK_VALUE_DOUBLE (*arg);
|
||||
g_return_if_fail (val >= 0.0);
|
||||
priv->width = val;
|
||||
priv->need_xform_update = TRUE;
|
||||
gnome_canvas_item_request_update (item);
|
||||
break;
|
||||
|
||||
case ARG_WIDTH_SET:
|
||||
priv->width_set = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
|
||||
priv->need_xform_update = TRUE;
|
||||
gnome_canvas_item_request_update (item);
|
||||
break;
|
||||
|
||||
case ARG_WIDTH_IN_PIXELS:
|
||||
priv->width_in_pixels = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
|
||||
priv->need_xform_update = TRUE;
|
||||
gnome_canvas_item_request_update (item);
|
||||
break;
|
||||
|
||||
case ARG_HEIGHT:
|
||||
val = GTK_VALUE_DOUBLE (*arg);
|
||||
g_return_if_fail (val >= 0.0);
|
||||
priv->height = val;
|
||||
priv->need_xform_update = TRUE;
|
||||
gnome_canvas_item_request_update (item);
|
||||
break;
|
||||
|
||||
case ARG_HEIGHT_SET:
|
||||
priv->height_set = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
|
||||
priv->need_xform_update = TRUE;
|
||||
gnome_canvas_item_request_update (item);
|
||||
break;
|
||||
|
||||
case ARG_HEIGHT_IN_PIXELS:
|
||||
priv->height_in_pixels = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
|
||||
priv->need_xform_update = TRUE;
|
||||
gnome_canvas_item_request_update (item);
|
||||
break;
|
||||
|
||||
case ARG_X:
|
||||
priv->x = GTK_VALUE_DOUBLE (*arg);
|
||||
priv->need_xform_update = TRUE;
|
||||
gnome_canvas_item_request_update (item);
|
||||
break;
|
||||
|
||||
case ARG_X_IN_PIXELS:
|
||||
priv->x_in_pixels = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
|
||||
priv->need_xform_update = TRUE;
|
||||
gnome_canvas_item_request_update (item);
|
||||
break;
|
||||
|
||||
case ARG_Y:
|
||||
priv->y = GTK_VALUE_DOUBLE (*arg);
|
||||
priv->need_xform_update = TRUE;
|
||||
gnome_canvas_item_request_update (item);
|
||||
break;
|
||||
|
||||
case ARG_Y_IN_PIXELS:
|
||||
priv->y_in_pixels = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
|
||||
priv->need_xform_update = TRUE;
|
||||
gnome_canvas_item_request_update (item);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get_arg handler for the pixbuf canvasi item */
|
||||
static void
|
||||
gnome_canvas_pixbuf_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
|
||||
{
|
||||
GnomeCanvasPixbuf *gcp;
|
||||
PixbufPrivate *priv;
|
||||
|
||||
gcp = GNOME_CANVAS_PIXBUF (object);
|
||||
priv = gcp->priv;
|
||||
|
||||
switch (arg_id) {
|
||||
case ARG_PIXBUF:
|
||||
GTK_VALUE_POINTER (*arg) = priv->pixbuf;
|
||||
break;
|
||||
|
||||
case ARG_WIDTH:
|
||||
GTK_VALUE_DOUBLE (*arg) = priv->width;
|
||||
break;
|
||||
|
||||
case ARG_WIDTH_SET:
|
||||
GTK_VALUE_BOOL (*arg) = priv->width_set;
|
||||
break;
|
||||
|
||||
case ARG_WIDTH_IN_PIXELS:
|
||||
GTK_VALUE_BOOL (*arg) = priv->width_in_pixels;
|
||||
break;
|
||||
|
||||
case ARG_HEIGHT:
|
||||
GTK_VALUE_DOUBLE (*arg) = priv->height;
|
||||
break;
|
||||
|
||||
case ARG_HEIGHT_SET:
|
||||
GTK_VALUE_BOOL (*arg) = priv->height_set;
|
||||
break;
|
||||
|
||||
case ARG_HEIGHT_IN_PIXELS:
|
||||
GTK_VALUE_BOOL (*arg) = priv->height_in_pixels;
|
||||
break;
|
||||
|
||||
case ARG_X:
|
||||
GTK_VALUE_DOUBLE (*arg) = priv->x;
|
||||
break;
|
||||
|
||||
case ARG_X_IN_PIXELS:
|
||||
GTK_VALUE_BOOL (*arg) = priv->x_in_pixels;
|
||||
break;
|
||||
|
||||
case ARG_Y:
|
||||
GTK_VALUE_DOUBLE (*arg) = priv->y;
|
||||
break;
|
||||
|
||||
case ARG_Y_IN_PIXELS:
|
||||
GTK_VALUE_BOOL (*arg) = priv->y_in_pixels;
|
||||
break;
|
||||
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Bounds and utilities */
|
||||
|
||||
/* Computes the amount by which the unit horizontal and vertical vectors will be
|
||||
* scaled by an affine transformation.
|
||||
*/
|
||||
static void
|
||||
compute_xform_scaling (double *affine, ArtPoint *i_c, ArtPoint *j_c)
|
||||
{
|
||||
ArtPoint orig, orig_c;
|
||||
ArtPoint i, j;
|
||||
|
||||
/* Origin */
|
||||
|
||||
orig.x = 0.0;
|
||||
orig.y = 0.0;
|
||||
art_affine_point (&orig_c, &orig, affine);
|
||||
|
||||
/* Horizontal and vertical vectors */
|
||||
|
||||
i.x = 1.0;
|
||||
i.y = 0.0;
|
||||
art_affine_point (i_c, &i, affine);
|
||||
i_c->x -= orig_c.x;
|
||||
i_c->y -= orig_c.y;
|
||||
|
||||
j.x = 0.0;
|
||||
j.y = 1.0;
|
||||
art_affine_point (j_c, &j, affine);
|
||||
j_c->x -= orig_c.x;
|
||||
j_c->y -= orig_c.y;
|
||||
}
|
||||
|
||||
/* computes the addtional resolution dependent affine needed to
|
||||
* fit the image within its viewport defined by x,y,width and height
|
||||
* args
|
||||
*/
|
||||
static void
|
||||
compute_viewport_affine (GnomeCanvasPixbuf *gcp, double *viewport_affine, double *i2c)
|
||||
{
|
||||
PixbufPrivate *priv;
|
||||
ArtPoint i_c, j_c;
|
||||
double i_len, j_len;
|
||||
double si_len, sj_len;
|
||||
double ti_len, tj_len;
|
||||
double scale[6], translate[6];
|
||||
double w, h;
|
||||
|
||||
priv = gcp->priv;
|
||||
|
||||
/* Compute scaling vectors and required width/height */
|
||||
|
||||
compute_xform_scaling (i2c, &i_c, &j_c);
|
||||
|
||||
i_len = sqrt (i_c.x * i_c.x + i_c.y * i_c.y);
|
||||
j_len = sqrt (j_c.x * j_c.x + j_c.y * j_c.y);
|
||||
|
||||
if (priv->width_set)
|
||||
w = priv->width;
|
||||
else
|
||||
w = priv->pixbuf->art_pixbuf->width;
|
||||
|
||||
if (priv->height_set)
|
||||
h = priv->height;
|
||||
else
|
||||
h = priv->pixbuf->art_pixbuf->height;
|
||||
|
||||
/* Convert i_len and j_len into scaling factors */
|
||||
|
||||
if (priv->width_in_pixels) {
|
||||
if (i_len > GNOME_CANVAS_EPSILON)
|
||||
si_len = 1.0 / i_len;
|
||||
else
|
||||
si_len = 0.0;
|
||||
} else
|
||||
si_len = 1.0;
|
||||
|
||||
si_len *= w / priv->pixbuf->art_pixbuf->width;
|
||||
|
||||
if (priv->height_in_pixels) {
|
||||
if (j_len > GNOME_CANVAS_EPSILON)
|
||||
sj_len = 1.0 / j_len;
|
||||
else
|
||||
sj_len = 0.0;
|
||||
} else
|
||||
sj_len = 1.0;
|
||||
|
||||
sj_len *= h / priv->pixbuf->art_pixbuf->height;
|
||||
|
||||
/* Calculate translation offsets */
|
||||
|
||||
if (priv->x_in_pixels) {
|
||||
if (i_len > GNOME_CANVAS_EPSILON)
|
||||
ti_len = 1.0 / i_len;
|
||||
else
|
||||
ti_len = 0.0;
|
||||
} else
|
||||
ti_len = 1.0;
|
||||
|
||||
ti_len *= priv->x;
|
||||
|
||||
if (priv->y_in_pixels) {
|
||||
if (j_len > GNOME_CANVAS_EPSILON)
|
||||
tj_len = 1.0 / j_len;
|
||||
else
|
||||
tj_len = 0.0;
|
||||
} else
|
||||
tj_len = 1.0;
|
||||
|
||||
tj_len *= priv->y;
|
||||
|
||||
/* Compute the final affine */
|
||||
|
||||
art_affine_scale (scale, si_len, sj_len);
|
||||
art_affine_translate (translate, ti_len, tj_len);
|
||||
art_affine_multiply (viewport_affine, scale, translate);
|
||||
}
|
||||
|
||||
/* Computes the affine transformation with which the pixbuf needs to be
|
||||
* transformed to render it on the canvas. This is not the same as the
|
||||
* item_to_canvas transformation because we may need to scale the pixbuf
|
||||
* by some other amount.
|
||||
*/
|
||||
static void
|
||||
compute_render_affine (GnomeCanvasPixbuf *gcp, double *render_affine, double *i2c)
|
||||
{
|
||||
double viewport_affine[6];
|
||||
|
||||
compute_viewport_affine (gcp, viewport_affine, i2c);
|
||||
art_affine_multiply (render_affine, viewport_affine, i2c);
|
||||
}
|
||||
|
||||
/* Recomputes the bounding box of a pixbuf canvas item. The horizontal and
|
||||
* vertical dimensions may be specified in units or pixels, separately, so we
|
||||
* have to compute the components individually for each dimension.
|
||||
*/
|
||||
static void
|
||||
recompute_bounding_box (GnomeCanvasPixbuf *gcp)
|
||||
{
|
||||
GnomeCanvasItem *item;
|
||||
PixbufPrivate *priv;
|
||||
double i2c[6], render_affine[6];
|
||||
ArtDRect rect;
|
||||
|
||||
item = GNOME_CANVAS_ITEM (gcp);
|
||||
priv = gcp->priv;
|
||||
|
||||
if (!priv->pixbuf) {
|
||||
item->x1 = item->y1 = item->x2 = item->y2 = 0.0;
|
||||
return;
|
||||
}
|
||||
|
||||
rect.x0 = 0.0;
|
||||
rect.x1 = priv->pixbuf->art_pixbuf->width;
|
||||
|
||||
rect.y0 = 0.0;
|
||||
rect.y1 = priv->pixbuf->art_pixbuf->height;
|
||||
|
||||
gnome_canvas_item_i2c_affine (item, i2c);
|
||||
compute_render_affine (gcp, render_affine, i2c);
|
||||
art_drect_affine_transform (&rect, &rect, render_affine);
|
||||
|
||||
item->x1 = floor (rect.x0);
|
||||
item->y1 = floor (rect.y0);
|
||||
item->x2 = ceil (rect.x1);
|
||||
item->y2 = ceil (rect.y1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Update sequence */
|
||||
|
||||
/* Update handler for the pixbuf canvas item */
|
||||
static void
|
||||
gnome_canvas_pixbuf_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
|
||||
{
|
||||
GnomeCanvasPixbuf *gcp;
|
||||
PixbufPrivate *priv;
|
||||
|
||||
gcp = GNOME_CANVAS_PIXBUF (item);
|
||||
priv = gcp->priv;
|
||||
|
||||
if (parent_class->update)
|
||||
(* parent_class->update) (item, affine, clip_path, flags);
|
||||
|
||||
if (((flags & GNOME_CANVAS_UPDATE_VISIBILITY)
|
||||
&& !(GTK_OBJECT_FLAGS (item) & GNOME_CANVAS_ITEM_VISIBLE))
|
||||
|| (flags & GNOME_CANVAS_UPDATE_AFFINE)
|
||||
|| priv->need_pixbuf_update
|
||||
|| priv->need_xform_update)
|
||||
gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2);
|
||||
|
||||
/* If we need a pixbuf update, or if the item changed visibility to
|
||||
* shown, recompute the bounding box.
|
||||
*/
|
||||
if (priv->need_pixbuf_update
|
||||
|| priv->need_xform_update
|
||||
|| ((flags & GNOME_CANVAS_UPDATE_VISIBILITY)
|
||||
&& (GTK_OBJECT_FLAGS (gcp) & GNOME_CANVAS_ITEM_VISIBLE))
|
||||
|| (flags & GNOME_CANVAS_UPDATE_AFFINE)) {
|
||||
recompute_bounding_box (gcp);
|
||||
gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2);
|
||||
priv->need_pixbuf_update = FALSE;
|
||||
priv->need_xform_update = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Rendering */
|
||||
|
||||
/* This is private to libart, but we need it. Sigh. */
|
||||
extern void art_rgb_affine_run (int *p_x0, int *p_x1, int y, int src_width, int src_height,
|
||||
const double affine[6]);
|
||||
|
||||
/* Fills the specified buffer with the transformed version of a pixbuf */
|
||||
static void
|
||||
transform_pixbuf (guchar *dest, int x, int y, int width, int height, int rowstride,
|
||||
GdkPixbuf *pixbuf, double *affine)
|
||||
{
|
||||
ArtPixBuf *apb;
|
||||
int xx, yy;
|
||||
double inv[6];
|
||||
guchar *src, *d;
|
||||
ArtPoint src_p, dest_p;
|
||||
int run_x1, run_x2;
|
||||
int src_x, src_y;
|
||||
int i;
|
||||
|
||||
apb = pixbuf->art_pixbuf;
|
||||
|
||||
art_affine_invert (inv, affine);
|
||||
|
||||
for (yy = 0; yy < height; yy++) {
|
||||
dest_p.y = y + yy + 0.5;
|
||||
|
||||
run_x1 = x;
|
||||
run_x2 = x + width;
|
||||
art_rgb_affine_run (&run_x1, &run_x2, yy + y,
|
||||
apb->width, apb->height,
|
||||
inv);
|
||||
|
||||
d = dest + yy * rowstride + (run_x1 - x) * 4;
|
||||
|
||||
for (xx = run_x1; xx < run_x2; xx++) {
|
||||
dest_p.x = xx + 0.5;
|
||||
art_affine_point (&src_p, &dest_p, inv);
|
||||
src_x = floor (src_p.x);
|
||||
src_y = floor (src_p.y);
|
||||
|
||||
src = apb->pixels + src_y * apb->rowstride + src_x * apb->n_channels;
|
||||
|
||||
for (i = 0; i < apb->n_channels; i++)
|
||||
*d++ = *src++;
|
||||
|
||||
if (!apb->has_alpha)
|
||||
*d++ = 255; /* opaque */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Draw handler for the pixbuf canvas item */
|
||||
static void
|
||||
gnome_canvas_pixbuf_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
||||
int x, int y, int width, int height)
|
||||
{
|
||||
GnomeCanvasPixbuf *gcp;
|
||||
PixbufPrivate *priv;
|
||||
double i2c[6], render_affine[6];
|
||||
guchar *buf;
|
||||
GdkPixbuf *pixbuf;
|
||||
ArtIRect p_rect, a_rect, d_rect;
|
||||
int w, h;
|
||||
|
||||
gcp = GNOME_CANVAS_PIXBUF (item);
|
||||
priv = gcp->priv;
|
||||
|
||||
if (!priv->pixbuf)
|
||||
return;
|
||||
|
||||
gnome_canvas_item_i2c_affine (item, i2c);
|
||||
compute_render_affine (gcp, render_affine, i2c);
|
||||
|
||||
/* Compute the area we need to repaint */
|
||||
|
||||
p_rect.x0 = item->x1;
|
||||
p_rect.y0 = item->y1;
|
||||
p_rect.x1 = item->x2;
|
||||
p_rect.y1 = item->y2;
|
||||
|
||||
a_rect.x0 = x;
|
||||
a_rect.y0 = y;
|
||||
a_rect.x1 = x + width;
|
||||
a_rect.y1 = y + height;
|
||||
|
||||
art_irect_intersect (&d_rect, &p_rect, &a_rect);
|
||||
if (art_irect_empty (&d_rect))
|
||||
return;
|
||||
|
||||
/* Create a temporary buffer and transform the pixbuf there */
|
||||
|
||||
w = d_rect.x1 - d_rect.x0;
|
||||
h = d_rect.y1 - d_rect.y0;
|
||||
|
||||
buf = g_new0 (guchar, w * h * 4);
|
||||
transform_pixbuf (buf,
|
||||
d_rect.x0, d_rect.y0,
|
||||
w, h,
|
||||
w * 4,
|
||||
priv->pixbuf, render_affine);
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_data (buf, ART_PIX_RGB, TRUE, w, h, w * 4, NULL, NULL);
|
||||
|
||||
gdk_pixbuf_render_to_drawable_alpha (pixbuf, drawable,
|
||||
0, 0,
|
||||
d_rect.x0 - x, d_rect.y0 - y,
|
||||
w, h,
|
||||
GDK_PIXBUF_ALPHA_BILEVEL,
|
||||
128,
|
||||
GDK_RGB_DITHER_MAX,
|
||||
d_rect.x0, d_rect.y0);
|
||||
|
||||
gdk_pixbuf_unref (pixbuf);
|
||||
g_free (buf);
|
||||
}
|
||||
|
||||
/* Render handler for the pixbuf canvas item */
|
||||
static void
|
||||
gnome_canvas_pixbuf_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf)
|
||||
{
|
||||
GnomeCanvasPixbuf *gcp;
|
||||
PixbufPrivate *priv;
|
||||
double i2c[6], render_affine[6];
|
||||
|
||||
gcp = GNOME_CANVAS_PIXBUF (item);
|
||||
priv = gcp->priv;
|
||||
|
||||
if (!priv->pixbuf)
|
||||
return;
|
||||
|
||||
gnome_canvas_item_i2c_affine (item, i2c);
|
||||
compute_render_affine (gcp, render_affine, i2c);
|
||||
gnome_canvas_buf_ensure_buf (buf);
|
||||
|
||||
art_rgb_pixbuf_affine (buf->buf,
|
||||
buf->rect.x0, buf->rect.y0, buf->rect.x1, buf->rect.y1,
|
||||
buf->buf_rowstride,
|
||||
priv->pixbuf->art_pixbuf,
|
||||
render_affine,
|
||||
ART_FILTER_NEAREST, NULL);
|
||||
|
||||
buf->is_bg = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Point handler for the pixbuf canvas item */
|
||||
static double
|
||||
gnome_canvas_pixbuf_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
|
||||
GnomeCanvasItem **actual_item)
|
||||
{
|
||||
GnomeCanvasPixbuf *gcp;
|
||||
PixbufPrivate *priv;
|
||||
double i2c[6], render_affine[6], inv[6];
|
||||
ArtPoint c, p;
|
||||
int px, py;
|
||||
double no_hit;
|
||||
ArtPixBuf *apb;
|
||||
guchar *src;
|
||||
|
||||
gcp = GNOME_CANVAS_PIXBUF (item);
|
||||
priv = gcp->priv;
|
||||
|
||||
*actual_item = item;
|
||||
|
||||
no_hit = item->canvas->pixels_per_unit * 2 + 10;
|
||||
|
||||
if (!priv->pixbuf)
|
||||
return no_hit;
|
||||
|
||||
apb = priv->pixbuf->art_pixbuf;
|
||||
|
||||
gnome_canvas_item_i2c_affine (item, i2c);
|
||||
compute_render_affine (gcp, render_affine, i2c);
|
||||
art_affine_invert (inv, render_affine);
|
||||
|
||||
c.x = cx;
|
||||
c.y = cy;
|
||||
art_affine_point (&p, &c, inv);
|
||||
px = p.x;
|
||||
py = p.y;
|
||||
|
||||
if (px < 0 || px >= apb->width || py < 0 || py >= apb->height)
|
||||
return no_hit;
|
||||
|
||||
if (!apb->has_alpha)
|
||||
return 0.0;
|
||||
|
||||
src = apb->pixels + py * apb->rowstride + px * apb->n_channels;
|
||||
|
||||
if (src[3] < 128)
|
||||
return no_hit;
|
||||
else
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Bounds handler for the pixbuf canvas item */
|
||||
static void
|
||||
gnome_canvas_pixbuf_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2)
|
||||
{
|
||||
GnomeCanvasPixbuf *gcp;
|
||||
PixbufPrivate *priv;
|
||||
double i2c[6], viewport_affine[6];
|
||||
ArtDRect rect;
|
||||
|
||||
gcp = GNOME_CANVAS_PIXBUF (item);
|
||||
priv = gcp->priv;
|
||||
|
||||
if (!priv->pixbuf) {
|
||||
*x1 = *y1 = *x2 = *y2 = 0.0;
|
||||
return;
|
||||
}
|
||||
|
||||
rect.x0 = 0.0;
|
||||
rect.x1 = priv->pixbuf->art_pixbuf->width;
|
||||
|
||||
rect.y0 = 0.0;
|
||||
rect.y1 = priv->pixbuf->art_pixbuf->height;
|
||||
|
||||
gnome_canvas_item_i2c_affine (item, i2c);
|
||||
compute_viewport_affine (gcp, viewport_affine, i2c);
|
||||
art_drect_affine_transform (&rect, &rect, viewport_affine);
|
||||
|
||||
*x1 = rect.x0;
|
||||
*y1 = rect.y0;
|
||||
*x2 = rect.x1;
|
||||
*y2 = rect.y1;
|
||||
}
|
||||
64
gdk-pixbuf/gnome-canvas-pixbuf.h
Normal file
64
gdk-pixbuf/gnome-canvas-pixbuf.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/* GNOME libraries - GdkPixbuf item for the GNOME canvas
|
||||
*
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Author: Federico Mena-Quintero <federico@gimp.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef GNOME_CANVAS_PIXBUF_H
|
||||
#define GNOME_CANVAS_PIXBUF_H
|
||||
|
||||
#include <libgnome/gnome-defs.h>
|
||||
#include <libgnomeui/gnome-canvas.h>
|
||||
|
||||
BEGIN_GNOME_DECLS
|
||||
|
||||
|
||||
|
||||
#define GNOME_TYPE_CANVAS_PIXBUF (gnome_canvas_pixbuf_get_type ())
|
||||
#define GNOME_CANVAS_PIXBUF(obj) (GTK_CHECK_CAST ((obj), \
|
||||
GNOME_TYPE_CANVAS_PIXBUF, GnomeCanvasPixbuf))
|
||||
#define GNOME_CANVAS_PIXBUF_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), \
|
||||
GNOME_TYPE_CANVAS_PIXBUF, GnomeCanvasPixbufClass))
|
||||
#define GNOME_IS_CANVAS_PIXBUF(obj) (GTK_CHECK_TYPE ((obj), GNOME_TYPE_CANVAS_PIXBUF))
|
||||
#define GNOME_IS_CANVAS_PIXBUF_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), \
|
||||
GNOME_TYPE_CANVAS_PIXBUF))
|
||||
|
||||
|
||||
typedef struct _GnomeCanvasPixbuf GnomeCanvasPixbuf;
|
||||
typedef struct _GnomeCanvasPixbufClass GnomeCanvasPixbufClass;
|
||||
|
||||
struct _GnomeCanvasPixbuf {
|
||||
GnomeCanvasItem item;
|
||||
|
||||
/* Private data */
|
||||
gpointer priv;
|
||||
};
|
||||
|
||||
struct _GnomeCanvasPixbufClass {
|
||||
GnomeCanvasItemClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GtkType gnome_canvas_pixbuf_get_type (void);
|
||||
|
||||
|
||||
|
||||
END_GNOME_DECLS
|
||||
|
||||
#endif
|
||||
720
gdk-pixbuf/io-bmp.c
Normal file
720
gdk-pixbuf/io-bmp.c
Normal file
@@ -0,0 +1,720 @@
|
||||
/* GdkPixbuf library - Windows Bitmap image loader
|
||||
*
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Authors: Arjan van de Ven <arjan@fenrus.demon.nl>
|
||||
* Federico Mena-Quintero <federico@gimp.org>
|
||||
*
|
||||
* Based on io-ras.c
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Known bugs:
|
||||
* 4bpp compressed files don't work
|
||||
* bi-tonal files aren't tested with palettes
|
||||
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf-io.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
These structures are actually dummies. These are according to
|
||||
the "Windows API reference guide volume II" as written by
|
||||
Borland International, but GCC fiddles with the alignment of
|
||||
the internal members, so these aren't actually usable.
|
||||
|
||||
*/
|
||||
|
||||
struct BitmapFileHeader {
|
||||
gushort bfType;
|
||||
guint bfSize;
|
||||
guint reserverd;
|
||||
guint bfOffbits;
|
||||
};
|
||||
|
||||
struct BitmapInfoHeader {
|
||||
guint biSize;
|
||||
guint biWidth;
|
||||
guint biHeight;
|
||||
gushort biPlanes;
|
||||
gushort biBitCount;
|
||||
guint biCompression;
|
||||
guint biSizeImage;
|
||||
guint biXPelsPerMeter;
|
||||
guint biYPelsPerMeter;
|
||||
guint biClrUsed;
|
||||
guint biClrImportant;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
DumpBIH printf's the values in a BitmapInfoHeader to the screen, for
|
||||
debugging purposes.
|
||||
|
||||
*/
|
||||
#if DUMPBIH
|
||||
static void DumpBIH(unsigned char *BIH)
|
||||
{
|
||||
printf("biSize = %i \n",
|
||||
(int) (BIH[3] << 24) + (BIH[2] << 16) + (BIH[1] << 8) +
|
||||
(BIH[0]));
|
||||
printf("biWidth = %i \n",
|
||||
(int) (BIH[7] << 24) + (BIH[6] << 16) + (BIH[5] << 8) +
|
||||
(BIH[4]));
|
||||
printf("biHeight = %i \n",
|
||||
(int) (BIH[11] << 24) + (BIH[10] << 16) + (BIH[9] << 8) +
|
||||
(BIH[8]));
|
||||
printf("biPlanes = %i \n", (int) (BIH[13] << 8) + (BIH[12]));
|
||||
printf("biBitCount = %i \n", (int) (BIH[15] << 8) + (BIH[14]));
|
||||
printf("biCompress = %i \n",
|
||||
(int) (BIH[19] << 24) + (BIH[18] << 16) + (BIH[17] << 8) +
|
||||
(BIH[16]));
|
||||
printf("biSizeImage = %i \n",
|
||||
(int) (BIH[23] << 24) + (BIH[22] << 16) + (BIH[21] << 8) +
|
||||
(BIH[20]));
|
||||
printf("biXPels = %i \n",
|
||||
(int) (BIH[27] << 24) + (BIH[26] << 16) + (BIH[25] << 8) +
|
||||
(BIH[24]));
|
||||
printf("biYPels = %i \n",
|
||||
(int) (BIH[31] << 24) + (BIH[30] << 16) + (BIH[29] << 8) +
|
||||
(BIH[28]));
|
||||
printf("biClrUsed = %i \n",
|
||||
(int) (BIH[35] << 24) + (BIH[34] << 16) + (BIH[33] << 8) +
|
||||
(BIH[32]));
|
||||
printf("biClrImprtnt= %i \n",
|
||||
(int) (BIH[39] << 24) + (BIH[38] << 16) + (BIH[37] << 8) +
|
||||
(BIH[36]));
|
||||
}
|
||||
#endif
|
||||
/* struct headerpair contains the decoded width/height/depth info for
|
||||
the current bitmap */
|
||||
|
||||
struct headerpair {
|
||||
guint width;
|
||||
guint height;
|
||||
guint depth;
|
||||
guint Negative; /* Negative = 1 -> top down BMP,
|
||||
Negative = 0 -> bottom up BMP */
|
||||
};
|
||||
|
||||
/* Data needed for the "state" during decompression */
|
||||
struct bmp_compression_state {
|
||||
gint phase; /* 0 = clean,
|
||||
1 = count received
|
||||
2 = escape received
|
||||
3 = in "raw" run
|
||||
4 = Relative part 1 is next
|
||||
5 = Relative part 2 is next
|
||||
6 = end of image -> No more input allowed
|
||||
*/
|
||||
gint RunCount;
|
||||
gint XDelta;
|
||||
gint YDelta;
|
||||
};
|
||||
|
||||
/* Progressive loading */
|
||||
|
||||
struct bmp_progressive_state {
|
||||
ModulePreparedNotifyFunc prepared_func;
|
||||
ModuleUpdatedNotifyFunc updated_func;
|
||||
gpointer user_data;
|
||||
|
||||
gint HeaderSize; /* The size of the header-part (incl colormap) */
|
||||
guchar *HeaderBuf; /* The buffer for the header (incl colormap) */
|
||||
gint HeaderDone; /* The nr of bytes actually in HeaderBuf */
|
||||
|
||||
gint LineWidth; /* The width of a line in bytes */
|
||||
guchar *LineBuf; /* Buffer for 1 line */
|
||||
gint LineDone; /* # of bytes in LineBuf */
|
||||
gint Lines; /* # of finished lines */
|
||||
|
||||
gint Type; /*
|
||||
32 = RGB + alpha
|
||||
24 = RGB
|
||||
4 = 4 bpp colormapped
|
||||
8 = 8 bpp colormapped
|
||||
1 = 1 bit bitonal
|
||||
*/
|
||||
gint Compressed;
|
||||
struct bmp_compression_state compr;
|
||||
|
||||
|
||||
struct headerpair Header; /* Decoded (BE->CPU) header */
|
||||
|
||||
|
||||
GdkPixbuf *pixbuf; /* Our "target" */
|
||||
};
|
||||
|
||||
gpointer
|
||||
gdk_pixbuf__bmp_image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data);
|
||||
|
||||
void gdk_pixbuf__bmp_image_stop_load(gpointer data);
|
||||
gboolean gdk_pixbuf__bmp_image_load_increment(gpointer data, guchar * buf, guint size);
|
||||
|
||||
|
||||
|
||||
/* Shared library entry point --> This should be removed when
|
||||
generic_image_load enters gdk-pixbuf-io. */
|
||||
GdkPixbuf *gdk_pixbuf__bmp_image_load(FILE * f)
|
||||
{
|
||||
guchar *membuf;
|
||||
size_t length;
|
||||
struct bmp_progressive_state *State;
|
||||
|
||||
GdkPixbuf *pb;
|
||||
|
||||
State = gdk_pixbuf__bmp_image_begin_load(NULL, NULL, NULL, NULL, NULL);
|
||||
membuf = g_malloc(4096);
|
||||
|
||||
g_assert(membuf != NULL);
|
||||
|
||||
|
||||
while (feof(f) == 0) {
|
||||
length = fread(membuf, 1, 4096, f);
|
||||
if (length > 0)
|
||||
(void) gdk_pixbuf__bmp_image_load_increment(State, membuf, length);
|
||||
|
||||
}
|
||||
g_free(membuf);
|
||||
if (State->pixbuf != NULL)
|
||||
gdk_pixbuf_ref(State->pixbuf);
|
||||
|
||||
pb = State->pixbuf;
|
||||
|
||||
gdk_pixbuf__bmp_image_stop_load(State);
|
||||
return pb;
|
||||
}
|
||||
|
||||
static void DecodeHeader(unsigned char *BFH, unsigned char *BIH,
|
||||
struct bmp_progressive_state *State)
|
||||
{
|
||||
#if DUMPBIH
|
||||
DumpBIH(BIH);
|
||||
#endif
|
||||
|
||||
State->Header.width =
|
||||
(int) (BIH[7] << 24) + (BIH[6] << 16) + (BIH[5] << 8) +
|
||||
(BIH[4]);
|
||||
State->Header.height =
|
||||
(int) (BIH[11] << 24) + (BIH[10] << 16) + (BIH[9] << 8) +
|
||||
(BIH[8]);
|
||||
State->Header.depth = (int) (BIH[15] << 8) + (BIH[14]);;
|
||||
|
||||
State->Type = State->Header.depth; /* This may be less trivial someday */
|
||||
State->HeaderSize =
|
||||
(int) ((BFH[13] << 24) + (BFH[12] << 16) + (BFH[11] << 8) +
|
||||
(BFH[10]));
|
||||
if (State->HeaderSize >= 14 + 40 + 1024)
|
||||
State->HeaderBuf =
|
||||
g_realloc(State->HeaderBuf, State->HeaderSize);
|
||||
|
||||
if ((BIH[16] != 0) || (BIH[17] != 0) || (BIH[18] != 0)
|
||||
|| (BIH[19] != 0)) {
|
||||
State->Compressed = 1;
|
||||
}
|
||||
|
||||
/* Negative heights indicates bottom-down pixelorder */
|
||||
if (State->Header.height < 0) {
|
||||
State->Header.height = -State->Header.height;
|
||||
State->Header.Negative = 1;
|
||||
}
|
||||
if (State->Header.width < 0) {
|
||||
State->Header.width = -State->Header.width;
|
||||
State->Header.Negative = 0;
|
||||
}
|
||||
|
||||
if (State->Type == 32)
|
||||
State->LineWidth = State->Header.width * 4;
|
||||
if (State->Type == 24)
|
||||
State->LineWidth = State->Header.width * 3;
|
||||
if (State->Type == 8)
|
||||
State->LineWidth = State->Header.width * 1;
|
||||
if (State->Type == 4)
|
||||
State->LineWidth = (State->Header.width + 1) / 2;
|
||||
if (State->Type == 1) {
|
||||
State->LineWidth = State->Header.width / 8;
|
||||
if ((State->Header.width & 7) != 0)
|
||||
State->LineWidth++;
|
||||
}
|
||||
|
||||
/* Pad to a 32 bit boundary */
|
||||
if (((State->LineWidth % 4) > 0) && (State->Compressed == 0))
|
||||
State->LineWidth = (State->LineWidth / 4) * 4 + 4;
|
||||
|
||||
|
||||
if (State->LineBuf == NULL)
|
||||
State->LineBuf = g_malloc(State->LineWidth);
|
||||
|
||||
g_assert(State->LineBuf != NULL);
|
||||
|
||||
|
||||
if (State->pixbuf == NULL) {
|
||||
if (State->Type == 32)
|
||||
State->pixbuf =
|
||||
gdk_pixbuf_new(ART_PIX_RGB, TRUE, 8,
|
||||
(gint) State->Header.width,
|
||||
(gint) State->Header.height);
|
||||
else
|
||||
State->pixbuf =
|
||||
gdk_pixbuf_new(ART_PIX_RGB, FALSE, 8,
|
||||
(gint) State->Header.width,
|
||||
(gint) State->Header.height);
|
||||
|
||||
if (State->prepared_func != NULL)
|
||||
/* Notify the client that we are ready to go */
|
||||
(*State->prepared_func) (State->pixbuf,
|
||||
State->user_data);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* func - called when we have pixmap created (but no image data)
|
||||
* user_data - passed as arg 1 to func
|
||||
* return context (opaque to user)
|
||||
*/
|
||||
|
||||
gpointer
|
||||
gdk_pixbuf__bmp_image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
struct bmp_progressive_state *context;
|
||||
|
||||
context = g_new0(struct bmp_progressive_state, 1);
|
||||
context->prepared_func = prepared_func;
|
||||
context->updated_func = updated_func;
|
||||
context->user_data = user_data;
|
||||
|
||||
context->HeaderSize = 54;
|
||||
context->HeaderBuf = g_malloc(14 + 40 + 1024);
|
||||
/* 14 for the BitmapFileHeader, 40 for the BitmapImageHeader and
|
||||
1024 for the colormap */
|
||||
|
||||
context->HeaderDone = 0;
|
||||
|
||||
context->LineWidth = 0;
|
||||
context->LineBuf = NULL;
|
||||
context->LineDone = 0;
|
||||
context->Lines = 0;
|
||||
|
||||
context->Type = 0;
|
||||
|
||||
memset(&context->Header, 0, sizeof(struct headerpair));
|
||||
memset(&context->compr, 0, sizeof(struct bmp_compression_state));
|
||||
|
||||
|
||||
context->pixbuf = NULL;
|
||||
|
||||
|
||||
return (gpointer) context;
|
||||
}
|
||||
|
||||
/*
|
||||
* context - returned from image_begin_load
|
||||
*
|
||||
* free context, unref gdk_pixbuf
|
||||
*/
|
||||
void gdk_pixbuf__bmp_image_stop_load(gpointer data)
|
||||
{
|
||||
struct bmp_progressive_state *context =
|
||||
(struct bmp_progressive_state *) data;
|
||||
|
||||
|
||||
g_return_if_fail(context != NULL);
|
||||
|
||||
if (context->LineBuf != NULL)
|
||||
g_free(context->LineBuf);
|
||||
context->LineBuf = NULL;
|
||||
|
||||
if (context->HeaderBuf != NULL)
|
||||
g_free(context->HeaderBuf);
|
||||
context->LineBuf = NULL;
|
||||
|
||||
if (context->pixbuf)
|
||||
gdk_pixbuf_unref(context->pixbuf);
|
||||
|
||||
g_free(context);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
The OneLineXX functions are called when 1 line worth of data is present.
|
||||
OneLine24 is the 24 bpp-version.
|
||||
*/
|
||||
static void OneLine32(struct bmp_progressive_state *context)
|
||||
{
|
||||
gint X;
|
||||
guchar *Pixels;
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(context->Header.height - context->Lines - 1);
|
||||
else
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
context->Lines;
|
||||
while (X < context->Header.width) {
|
||||
Pixels[X * 4 + 0] = context->LineBuf[X * 4 + 2];
|
||||
Pixels[X * 4 + 1] = context->LineBuf[X * 4 + 1];
|
||||
Pixels[X * 4 + 2] = context->LineBuf[X * 4 + 0];
|
||||
Pixels[X * 4 + 3] = context->LineBuf[X * 4 + 3];
|
||||
X++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void OneLine24(struct bmp_progressive_state *context)
|
||||
{
|
||||
gint X;
|
||||
guchar *Pixels;
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(context->Header.height - context->Lines - 1);
|
||||
else
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
context->Lines;
|
||||
while (X < context->Header.width) {
|
||||
Pixels[X * 3 + 0] = context->LineBuf[X * 3 + 2];
|
||||
Pixels[X * 3 + 1] = context->LineBuf[X * 3 + 1];
|
||||
Pixels[X * 3 + 2] = context->LineBuf[X * 3 + 0];
|
||||
X++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void OneLine8(struct bmp_progressive_state *context)
|
||||
{
|
||||
gint X;
|
||||
guchar *Pixels;
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(context->Header.height - context->Lines - 1);
|
||||
else
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
context->Lines;
|
||||
while (X < context->Header.width) {
|
||||
Pixels[X * 3 + 0] =
|
||||
context->HeaderBuf[4 * context->LineBuf[X] + 56];
|
||||
Pixels[X * 3 + 1] =
|
||||
context->HeaderBuf[4 * context->LineBuf[X] + 55];
|
||||
Pixels[X * 3 + 2] =
|
||||
context->HeaderBuf[4 * context->LineBuf[X] + 54];
|
||||
X++;
|
||||
}
|
||||
}
|
||||
|
||||
static void OneLine4(struct bmp_progressive_state *context)
|
||||
{
|
||||
gint X;
|
||||
guchar *Pixels;
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(context->Header.height - context->Lines - 1);
|
||||
else
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
context->Lines;
|
||||
|
||||
while (X < context->Header.width) {
|
||||
guchar Pix;
|
||||
|
||||
Pix = context->LineBuf[X / 2];
|
||||
|
||||
Pixels[X * 3 + 0] =
|
||||
context->HeaderBuf[4 * (Pix >> 4) + 56];
|
||||
Pixels[X * 3 + 1] =
|
||||
context->HeaderBuf[4 * (Pix >> 4) + 55];
|
||||
Pixels[X * 3 + 2] =
|
||||
context->HeaderBuf[4 * (Pix >> 4) + 54];
|
||||
X++;
|
||||
if (X < context->Header.width) {
|
||||
/* Handle the other 4 bit pixel only when there is one */
|
||||
Pixels[X * 3 + 0] =
|
||||
context->HeaderBuf[4 * (Pix & 15) + 56];
|
||||
Pixels[X * 3 + 1] =
|
||||
context->HeaderBuf[4 * (Pix & 15) + 55];
|
||||
Pixels[X * 3 + 2] =
|
||||
context->HeaderBuf[4 * (Pix & 15) + 54];
|
||||
X++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void OneLine1(struct bmp_progressive_state *context)
|
||||
{
|
||||
gint X;
|
||||
guchar *Pixels;
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(context->Header.height - context->Lines - 1);
|
||||
else
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
context->Lines;
|
||||
while (X < context->Header.width) {
|
||||
gint Bit;
|
||||
|
||||
Bit = (context->LineBuf[X / 8]) >> (7 - (X & 7));
|
||||
Bit = Bit & 1;
|
||||
Pixels[X * 3 + 0] = Bit*255;
|
||||
Pixels[X * 3 + 1] = Bit*255;
|
||||
Pixels[X * 3 + 2] = Bit*255;
|
||||
X++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void OneLine(struct bmp_progressive_state *context)
|
||||
{
|
||||
context->LineDone = 0;
|
||||
if (context->Lines >= context->Header.height)
|
||||
return;
|
||||
|
||||
if (context->Type == 32)
|
||||
OneLine32(context);
|
||||
if (context->Type == 24)
|
||||
OneLine24(context);
|
||||
if (context->Type == 8)
|
||||
OneLine8(context);
|
||||
if (context->Type == 4)
|
||||
OneLine4(context);
|
||||
if (context->Type == 1)
|
||||
OneLine1(context);
|
||||
|
||||
context->Lines++;
|
||||
|
||||
if (context->updated_func != NULL) {
|
||||
(*context->updated_func) (context->pixbuf,
|
||||
0,
|
||||
context->Lines,
|
||||
context->Header.width,
|
||||
context->Header.height,
|
||||
context->user_data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* DoCompressedByte handles 1 byte of incomming compressed data */
|
||||
void DoCompressedByte(struct bmp_progressive_state *context, guchar ** buf,
|
||||
gint * size)
|
||||
{
|
||||
gint BytesToCopy;
|
||||
switch (context->compr.phase) {
|
||||
case 0: /* Neutral state */
|
||||
if (buf[0] != 0) { /* run count */
|
||||
context->compr.phase = 1;
|
||||
context->compr.RunCount = (*buf)[0];
|
||||
} else { /* Escape */
|
||||
context->compr.phase = 2;
|
||||
}
|
||||
(*buf)++;
|
||||
(*size)--;
|
||||
break;
|
||||
case 1: /* Run count received.... */
|
||||
while (context->compr.RunCount > 0) {
|
||||
BytesToCopy =
|
||||
context->LineWidth - context->LineDone;
|
||||
if (BytesToCopy > context->compr.RunCount)
|
||||
BytesToCopy = context->compr.RunCount;
|
||||
if (BytesToCopy > 0) {
|
||||
memset(context->LineBuf +
|
||||
context->LineDone,
|
||||
(*buf)[0], BytesToCopy);
|
||||
|
||||
context->compr.RunCount -= BytesToCopy;
|
||||
context->LineDone += BytesToCopy;
|
||||
}
|
||||
if ((context->LineDone >= context->LineWidth)
|
||||
&& (context->LineWidth > 0)) {
|
||||
OneLine(context);
|
||||
}
|
||||
}
|
||||
context->compr.phase = 0;
|
||||
(*buf)++;
|
||||
(*size)--;
|
||||
break;
|
||||
case 2: /* Escape received */
|
||||
if ((*buf)[0] == 0) { /* End of line */
|
||||
context->compr.phase = 0;
|
||||
if (context->LineDone > 0)
|
||||
OneLine(context);
|
||||
} else if ((*buf)[0] == 1) { /* End of image */
|
||||
OneLine(context);
|
||||
context->compr.phase = 6;
|
||||
(*size) = 0;
|
||||
break;
|
||||
} else if ((*buf)[0] == 2) { /* Cursor displacement */
|
||||
context->compr.phase = 4;
|
||||
} else {
|
||||
context->compr.phase = 3;
|
||||
context->compr.RunCount = (*buf)[0];
|
||||
}
|
||||
(*buf)++;
|
||||
(*size)--;
|
||||
|
||||
break;
|
||||
case 3:
|
||||
while ((context->compr.RunCount > 0)
|
||||
&& (size > 0)) {
|
||||
BytesToCopy =
|
||||
context->LineWidth - context->LineDone;
|
||||
if (BytesToCopy > context->compr.RunCount)
|
||||
BytesToCopy = context->compr.RunCount;
|
||||
if (BytesToCopy > *size)
|
||||
BytesToCopy = *size;
|
||||
|
||||
if (BytesToCopy > 0) {
|
||||
memcpy(context->LineBuf +
|
||||
context->LineDone,
|
||||
*buf, BytesToCopy);
|
||||
|
||||
context->compr.RunCount -= BytesToCopy;
|
||||
(*buf) += BytesToCopy;
|
||||
(*size) -= BytesToCopy;
|
||||
context->LineDone += BytesToCopy;
|
||||
}
|
||||
if ((context->LineDone >= context->LineWidth)
|
||||
&& (context->LineWidth > 0))
|
||||
OneLine(context);
|
||||
}
|
||||
if (context->compr.RunCount <= 0)
|
||||
context->compr.phase = 0;
|
||||
|
||||
break;
|
||||
case 4:
|
||||
context->compr.phase = 5;
|
||||
context->compr.XDelta = (*buf)[0];
|
||||
(*buf)++;
|
||||
(*size)--;
|
||||
break;
|
||||
case 5:
|
||||
context->compr.phase = 0;
|
||||
context->compr.YDelta = (*buf)[0];
|
||||
g_assert(0); /* No implementatio of this yet */
|
||||
/* If this happens, please email me (arjan@fenrus.demon.nl)
|
||||
the image concerned. */
|
||||
(*buf)++;
|
||||
(*size)--;
|
||||
break;
|
||||
case 6:
|
||||
(*size) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* context - from image_begin_load
|
||||
* buf - new image data
|
||||
* size - length of new image data
|
||||
*
|
||||
* append image data onto inrecrementally built output image
|
||||
*/
|
||||
gboolean gdk_pixbuf__bmp_image_load_increment(gpointer data, guchar * buf, guint size)
|
||||
{
|
||||
struct bmp_progressive_state *context =
|
||||
(struct bmp_progressive_state *) data;
|
||||
|
||||
gint BytesToCopy;
|
||||
|
||||
while (size > 0) {
|
||||
g_assert(context->LineDone >= 0);
|
||||
if (context->HeaderDone < context->HeaderSize) { /* We still
|
||||
have headerbytes to do */
|
||||
BytesToCopy =
|
||||
context->HeaderSize - context->HeaderDone;
|
||||
if (BytesToCopy > size)
|
||||
BytesToCopy = size;
|
||||
|
||||
memmove(context->HeaderBuf + context->HeaderDone,
|
||||
buf, BytesToCopy);
|
||||
|
||||
size -= BytesToCopy;
|
||||
buf += BytesToCopy;
|
||||
context->HeaderDone += BytesToCopy;
|
||||
|
||||
} else if (context->Compressed) {
|
||||
/* Compression is done 1 byte at a time for now */
|
||||
DoCompressedByte(context, &buf, &size);
|
||||
|
||||
} else {
|
||||
/* Uncompressed pixeldata */
|
||||
BytesToCopy =
|
||||
context->LineWidth - context->LineDone;
|
||||
if (BytesToCopy > size)
|
||||
BytesToCopy = size;
|
||||
|
||||
if (BytesToCopy > 0) {
|
||||
memmove(context->LineBuf +
|
||||
context->LineDone, buf,
|
||||
BytesToCopy);
|
||||
|
||||
size -= BytesToCopy;
|
||||
buf += BytesToCopy;
|
||||
context->LineDone += BytesToCopy;
|
||||
}
|
||||
if ((context->LineDone >= context->LineWidth) &&
|
||||
(context->LineWidth > 0))
|
||||
OneLine(context);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (context->HeaderDone >= 14 + 40)
|
||||
DecodeHeader(context->HeaderBuf,
|
||||
context->HeaderBuf + 14, context);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
1213
gdk-pixbuf/io-gif.c
Normal file
1213
gdk-pixbuf/io-gif.c
Normal file
File diff suppressed because it is too large
Load Diff
689
gdk-pixbuf/io-ico.c
Normal file
689
gdk-pixbuf/io-ico.c
Normal file
@@ -0,0 +1,689 @@
|
||||
/* GdkPixbuf library - Windows Icon/Cursor image loader
|
||||
*
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Authors: Arjan van de Ven <arjan@fenrus.demon.nl>
|
||||
* Federico Mena-Quintero <federico@gimp.org>
|
||||
*
|
||||
* Based on io-bmp.c
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#undef DUMPBIH
|
||||
/*
|
||||
|
||||
Icons are just like BMP's, except for the header.
|
||||
|
||||
Known bugs:
|
||||
* bi-tonal files aren't tested
|
||||
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
These structures are actually dummies. These are according to
|
||||
the "Windows API reference guide volume II" as written by
|
||||
Borland International, but GCC fiddles with the alignment of
|
||||
the internal members.
|
||||
|
||||
*/
|
||||
|
||||
struct BitmapFileHeader {
|
||||
gushort bfType;
|
||||
guint bfSize;
|
||||
guint reserverd;
|
||||
guint bfOffbits;
|
||||
};
|
||||
|
||||
struct BitmapInfoHeader {
|
||||
guint biSize;
|
||||
guint biWidth;
|
||||
guint biHeight;
|
||||
gushort biPlanes;
|
||||
gushort biBitCount;
|
||||
guint biCompression;
|
||||
guint biSizeImage;
|
||||
guint biXPelsPerMeter;
|
||||
guint biYPelsPerMeter;
|
||||
guint biClrUsed;
|
||||
guint biClrImportant;
|
||||
};
|
||||
|
||||
#ifdef DUMPBIH
|
||||
/*
|
||||
|
||||
DumpBIH printf's the values in a BitmapInfoHeader to the screen, for
|
||||
debugging purposes.
|
||||
|
||||
*/
|
||||
static void DumpBIH(unsigned char *BIH)
|
||||
{
|
||||
printf("biSize = %i \n",
|
||||
(int)(BIH[3] << 24) + (BIH[2] << 16) + (BIH[1] << 8) + (BIH[0]));
|
||||
printf("biWidth = %i \n",
|
||||
(int)(BIH[7] << 24) + (BIH[6] << 16) + (BIH[5] << 8) + (BIH[4]));
|
||||
printf("biHeight = %i \n",
|
||||
(int)(BIH[11] << 24) + (BIH[10] << 16) + (BIH[9] << 8) +
|
||||
(BIH[8]));
|
||||
printf("biPlanes = %i \n", (int)(BIH[13] << 8) + (BIH[12]));
|
||||
printf("biBitCount = %i \n", (int)(BIH[15] << 8) + (BIH[14]));
|
||||
printf("biCompress = %i \n",
|
||||
(int)(BIH[19] << 24) + (BIH[18] << 16) + (BIH[17] << 8) +
|
||||
(BIH[16]));
|
||||
printf("biSizeImage = %i \n",
|
||||
(int)(BIH[23] << 24) + (BIH[22] << 16) + (BIH[21] << 8) +
|
||||
(BIH[20]));
|
||||
printf("biXPels = %i \n",
|
||||
(int)(BIH[27] << 24) + (BIH[26] << 16) + (BIH[25] << 8) +
|
||||
(BIH[24]));
|
||||
printf("biYPels = %i \n",
|
||||
(int)(BIH[31] << 24) + (BIH[30] << 16) + (BIH[29] << 8) +
|
||||
(BIH[28]));
|
||||
printf("biClrUsed = %i \n",
|
||||
(int)(BIH[35] << 24) + (BIH[34] << 16) + (BIH[33] << 8) +
|
||||
(BIH[32]));
|
||||
printf("biClrImprtnt= %i \n",
|
||||
(int)(BIH[39] << 24) + (BIH[38] << 16) + (BIH[37] << 8) +
|
||||
(BIH[36]));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Progressive loading */
|
||||
struct headerpair {
|
||||
guint width;
|
||||
guint height;
|
||||
guint depth;
|
||||
guint Negative; /* Negative = 1 -> top down BMP,
|
||||
Negative = 0 -> bottom up BMP */
|
||||
};
|
||||
|
||||
struct ico_progressive_state {
|
||||
ModulePreparedNotifyFunc prepared_func;
|
||||
ModuleUpdatedNotifyFunc updated_func;
|
||||
gpointer user_data;
|
||||
|
||||
gint HeaderSize; /* The size of the header-part (incl colormap) */
|
||||
guchar *HeaderBuf; /* The buffer for the header (incl colormap) */
|
||||
gint BytesInHeaderBuf; /* The size of the allocated HeaderBuf */
|
||||
gint HeaderDone; /* The nr of bytes actually in HeaderBuf */
|
||||
|
||||
gint LineWidth; /* The width of a line in bytes */
|
||||
guchar *LineBuf; /* Buffer for 1 line */
|
||||
gint LineDone; /* # of bytes in LineBuf */
|
||||
gint Lines; /* # of finished lines */
|
||||
|
||||
gint Type; /*
|
||||
24 = RGB
|
||||
8 = 8 bit colormapped
|
||||
1 = 1 bit bitonal
|
||||
*/
|
||||
|
||||
|
||||
struct headerpair Header; /* Decoded (BE->CPU) header */
|
||||
|
||||
gint DIBoffset;
|
||||
gint ImageScore;
|
||||
|
||||
|
||||
GdkPixbuf *pixbuf; /* Our "target" */
|
||||
};
|
||||
|
||||
gpointer
|
||||
gdk_pixbuf__ico_image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data);
|
||||
void gdk_pixbuf__ico_image_stop_load(gpointer data);
|
||||
gboolean gdk_pixbuf__ico_image_load_increment(gpointer data, guchar * buf, guint size);
|
||||
|
||||
|
||||
|
||||
/* Shared library entry point --> Can go when generic_image_load
|
||||
enters gdk-pixbuf-io */
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf__ico_image_load(FILE * f)
|
||||
{
|
||||
guchar *membuf;
|
||||
size_t length;
|
||||
struct ico_progressive_state *State;
|
||||
|
||||
GdkPixbuf *pb;
|
||||
|
||||
State = gdk_pixbuf__ico_image_begin_load(NULL, NULL, NULL, NULL, NULL);
|
||||
membuf = g_malloc(4096);
|
||||
|
||||
g_assert(membuf != NULL);
|
||||
|
||||
while (feof(f) == 0) {
|
||||
length = fread(membuf, 1, 4096, f);
|
||||
if (length > 0)
|
||||
gdk_pixbuf__ico_image_load_increment(State, membuf, length);
|
||||
|
||||
}
|
||||
g_free(membuf);
|
||||
if (State->pixbuf != NULL)
|
||||
gdk_pixbuf_ref(State->pixbuf);
|
||||
|
||||
pb = State->pixbuf;
|
||||
|
||||
gdk_pixbuf__ico_image_stop_load(State);
|
||||
return pb;
|
||||
}
|
||||
|
||||
static void DecodeHeader(guchar *Data, gint Bytes,
|
||||
struct ico_progressive_state *State)
|
||||
{
|
||||
/* For ICO's we have to be very clever. There are multiple images possible
|
||||
in an .ICO. For now, we select (in order of priority):
|
||||
1) The one with the highest number of colors
|
||||
2) The largest one
|
||||
*/
|
||||
|
||||
gint IconCount = 0; /* The number of icon-versions in the file */
|
||||
guchar *BIH; /* The DIB for the used icon */
|
||||
guchar *Ptr;
|
||||
gint I;
|
||||
|
||||
/* Step 1: The ICO header */
|
||||
|
||||
IconCount = (Data[5] << 8) + (Data[4]);
|
||||
|
||||
State->HeaderSize = 6 + IconCount*16;
|
||||
|
||||
if (State->HeaderSize>State->BytesInHeaderBuf) {
|
||||
State->HeaderBuf=g_realloc(State->HeaderBuf,State->HeaderSize);
|
||||
State->BytesInHeaderBuf = State->HeaderSize;
|
||||
}
|
||||
if (Bytes < State->HeaderSize)
|
||||
return;
|
||||
|
||||
/* We now have all the "short-specs" of the versions
|
||||
So we iterate through them and select the best one */
|
||||
|
||||
State->ImageScore = 0;
|
||||
State->DIBoffset = 0;
|
||||
Ptr = Data + 6;
|
||||
for (I=0;I<IconCount;I++) {
|
||||
int ThisWidth, ThisHeight,ThisColors;
|
||||
int ThisScore;
|
||||
|
||||
ThisWidth = Ptr[0];
|
||||
ThisHeight = Ptr[1];
|
||||
ThisColors = (Ptr[2]);
|
||||
if (ThisColors==0)
|
||||
ThisColors=256; /* Yes, this is in the spec, ugh */
|
||||
|
||||
ThisScore = ThisColors*1024+ThisWidth*ThisHeight;
|
||||
|
||||
if (ThisScore>State->ImageScore) {
|
||||
State->ImageScore = ThisScore;
|
||||
State->DIBoffset = (Ptr[15]<<24)+(Ptr[14]<<16)+
|
||||
(Ptr[13]<<8) + (Ptr[12]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Ptr += 16;
|
||||
}
|
||||
|
||||
/* We now have a winner, pointed to in State->DIBoffset,
|
||||
so we know how many bytes are in the "header" part. */
|
||||
|
||||
State->HeaderSize = State->DIBoffset + 40; /* 40 = sizeof(InfoHeader) */
|
||||
|
||||
if (State->HeaderSize>State->BytesInHeaderBuf) {
|
||||
State->HeaderBuf=g_realloc(State->HeaderBuf,State->HeaderSize);
|
||||
State->BytesInHeaderBuf = State->HeaderSize;
|
||||
}
|
||||
if (Bytes<State->HeaderSize)
|
||||
return;
|
||||
|
||||
BIH = Data+State->DIBoffset;
|
||||
|
||||
#ifdef DUMPBIH
|
||||
DumpBIH(BIH);
|
||||
#endif
|
||||
|
||||
/* Add the palette to the headersize */
|
||||
|
||||
State->Header.width =
|
||||
(int)(BIH[7] << 24) + (BIH[6] << 16) + (BIH[5] << 8) + (BIH[4]);
|
||||
State->Header.height =
|
||||
(int)(BIH[11] << 24) + (BIH[10] << 16) + (BIH[9] << 8) + (BIH[8])/2;
|
||||
/* /2 because the BIH height includes the transparency mask */
|
||||
State->Header.depth = (BIH[15] << 8) + (BIH[14]);;
|
||||
|
||||
State->Type = State->Header.depth;
|
||||
if (State->Lines>=State->Header.height)
|
||||
State->Type = 1; /* The transparency mask is 1 bpp */
|
||||
|
||||
|
||||
|
||||
/* Determine the palette size. If the header indicates 0, it
|
||||
is actually the maximum for the bpp. You have to love the
|
||||
guys who made the spec. */
|
||||
I = (int)(BIH[35] << 24) + (BIH[34] << 16) + (BIH[33] << 8) + (BIH[32]);
|
||||
I = I*4;
|
||||
if ((I==0)&&(State->Type==1))
|
||||
I = 2*4;
|
||||
if ((I==0)&&(State->Type==4))
|
||||
I = 16*4;
|
||||
if ((I==0)&&(State->Type==8))
|
||||
I = 256*4;
|
||||
|
||||
State->HeaderSize+=I;
|
||||
|
||||
if (State->HeaderSize>State->BytesInHeaderBuf) {
|
||||
State->HeaderBuf=g_realloc(State->HeaderBuf,State->HeaderSize);
|
||||
State->BytesInHeaderBuf = State->HeaderSize;
|
||||
}
|
||||
if (Bytes < State->HeaderSize)
|
||||
return;
|
||||
|
||||
if ((BIH[16] != 0) || (BIH[17] != 0) || (BIH[18] != 0)
|
||||
|| (BIH[19] != 0)) {
|
||||
g_assert(0); /* Compressed icons aren't allowed */
|
||||
}
|
||||
|
||||
/* Negative heights mean top-down pixel-order */
|
||||
if (State->Header.height < 0) {
|
||||
State->Header.height = -State->Header.height;
|
||||
State->Header.Negative = 1;
|
||||
}
|
||||
if (State->Header.width < 0) {
|
||||
State->Header.width = -State->Header.width;
|
||||
}
|
||||
|
||||
if (State->Type == 24)
|
||||
State->LineWidth = State->Header.width * 3;
|
||||
if (State->Type == 8)
|
||||
State->LineWidth = State->Header.width * 1;
|
||||
if (State->Type == 4) {
|
||||
State->LineWidth = (State->Header.width+1)/2;
|
||||
}
|
||||
if (State->Type == 1) {
|
||||
State->LineWidth = State->Header.width / 8;
|
||||
if ((State->Header.width & 7) != 0)
|
||||
State->LineWidth++;
|
||||
}
|
||||
|
||||
/* Pad to a 32 bit boundary */
|
||||
if (((State->LineWidth % 4) > 0))
|
||||
State->LineWidth = (State->LineWidth / 4) * 4 + 4;
|
||||
|
||||
|
||||
if (State->LineBuf == NULL)
|
||||
State->LineBuf = g_malloc(State->LineWidth);
|
||||
|
||||
g_assert(State->LineBuf != NULL);
|
||||
|
||||
|
||||
if (State->pixbuf == NULL) {
|
||||
State->pixbuf =
|
||||
gdk_pixbuf_new(ART_PIX_RGB, TRUE, 8,
|
||||
(gint) State->Header.width,
|
||||
(gint) State->Header.height);
|
||||
|
||||
if (State->prepared_func != NULL)
|
||||
/* Notify the client that we are ready to go */
|
||||
(*State->prepared_func) (State->pixbuf,
|
||||
State->user_data);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* func - called when we have pixmap created (but no image data)
|
||||
* user_data - passed as arg 1 to func
|
||||
* return context (opaque to user)
|
||||
*/
|
||||
|
||||
gpointer
|
||||
gdk_pixbuf__ico_image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
struct ico_progressive_state *context;
|
||||
|
||||
context = g_new0(struct ico_progressive_state, 1);
|
||||
context->prepared_func = prepared_func;
|
||||
context->updated_func = updated_func;
|
||||
context->user_data = user_data;
|
||||
|
||||
context->HeaderSize = 54;
|
||||
context->HeaderBuf = g_malloc(14 + 40 + 4*256 + 512);
|
||||
/* 4*256 for the colormap */
|
||||
context->BytesInHeaderBuf = 14 + 40 + 4*256 + 512 ;
|
||||
context->HeaderDone = 0;
|
||||
|
||||
context->LineWidth = 0;
|
||||
context->LineBuf = NULL;
|
||||
context->LineDone = 0;
|
||||
context->Lines = 0;
|
||||
|
||||
context->Type = 0;
|
||||
|
||||
memset(&context->Header, 0, sizeof(struct headerpair));
|
||||
|
||||
|
||||
context->pixbuf = NULL;
|
||||
|
||||
|
||||
return (gpointer) context;
|
||||
}
|
||||
|
||||
/*
|
||||
* context - returned from image_begin_load
|
||||
*
|
||||
* free context, unref gdk_pixbuf
|
||||
*/
|
||||
void gdk_pixbuf__ico_image_stop_load(gpointer data)
|
||||
{
|
||||
struct ico_progressive_state *context =
|
||||
(struct ico_progressive_state *) data;
|
||||
|
||||
|
||||
g_return_if_fail(context != NULL);
|
||||
|
||||
if (context->LineBuf != NULL)
|
||||
g_free(context->LineBuf);
|
||||
context->LineBuf = NULL;
|
||||
if (context->HeaderBuf != NULL)
|
||||
g_free(context->HeaderBuf);
|
||||
|
||||
if (context->pixbuf)
|
||||
gdk_pixbuf_unref(context->pixbuf);
|
||||
|
||||
g_free(context);
|
||||
}
|
||||
|
||||
|
||||
static void OneLine24(struct ico_progressive_state *context)
|
||||
{
|
||||
gint X;
|
||||
guchar *Pixels;
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(context->Header.height - context->Lines - 1);
|
||||
else
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
context->Lines;
|
||||
while (X < context->Header.width) {
|
||||
Pixels[X * 4 + 0] = context->LineBuf[X * 3 + 2];
|
||||
Pixels[X * 4 + 1] = context->LineBuf[X * 3 + 1];
|
||||
Pixels[X * 4 + 2] = context->LineBuf[X * 3 + 0];
|
||||
X++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void OneLine8(struct ico_progressive_state *context)
|
||||
{
|
||||
gint X;
|
||||
guchar *Pixels;
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(context->Header.height - context->Lines - 1);
|
||||
else
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
context->Lines;
|
||||
while (X < context->Header.width) {
|
||||
/* The joys of having a BGR byteorder */
|
||||
Pixels[X * 4 + 0] =
|
||||
context->HeaderBuf[4 * context->LineBuf[X] + 42+context->DIBoffset];
|
||||
Pixels[X * 4 + 1] =
|
||||
context->HeaderBuf[4 * context->LineBuf[X] + 41+context->DIBoffset];
|
||||
Pixels[X * 4 + 2] =
|
||||
context->HeaderBuf[4 * context->LineBuf[X] + 40+context->DIBoffset];
|
||||
X++;
|
||||
}
|
||||
}
|
||||
static void OneLine4(struct ico_progressive_state *context)
|
||||
{
|
||||
gint X;
|
||||
guchar *Pixels;
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(context->Header.height - context->Lines - 1);
|
||||
else
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
context->Lines;
|
||||
|
||||
while (X < context->Header.width) {
|
||||
guchar Pix;
|
||||
|
||||
Pix = context->LineBuf[X/2];
|
||||
|
||||
Pixels[X * 4 + 0] =
|
||||
context->HeaderBuf[4 * (Pix>>4) + 42+context->DIBoffset];
|
||||
Pixels[X * 4 + 1] =
|
||||
context->HeaderBuf[4 * (Pix>>4) + 41+context->DIBoffset];
|
||||
Pixels[X * 4 + 2] =
|
||||
context->HeaderBuf[4 * (Pix>>4) + 40+context->DIBoffset];
|
||||
X++;
|
||||
if (X<context->Header.width) {
|
||||
/* Handle the other 4 bit pixel only when there is one */
|
||||
Pixels[X * 4 + 0] =
|
||||
context->HeaderBuf[4 * (Pix&15) + 42+context->DIBoffset];
|
||||
Pixels[X * 4 + 1] =
|
||||
context->HeaderBuf[4 * (Pix&15) + 41+context->DIBoffset];
|
||||
Pixels[X * 4 + 2] =
|
||||
context->HeaderBuf[4 * (Pix&15) + 40+context->DIBoffset];
|
||||
X++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void OneLine1(struct ico_progressive_state *context)
|
||||
{
|
||||
gint X;
|
||||
guchar *Pixels;
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(context->Header.height - context->Lines - 1);
|
||||
else
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
context->Lines;
|
||||
while (X < context->Header.width) {
|
||||
int Bit;
|
||||
|
||||
Bit = (context->LineBuf[X / 8]) >> (7 - (X & 7));
|
||||
Bit = Bit & 1;
|
||||
/* The joys of having a BGR byteorder */
|
||||
Pixels[X * 4 + 0] = Bit*255;
|
||||
Pixels[X * 4 + 1] = Bit*255;
|
||||
Pixels[X * 4 + 2] = Bit*255;
|
||||
X++;
|
||||
}
|
||||
}
|
||||
|
||||
static void OneLineTransp(struct ico_progressive_state *context)
|
||||
{
|
||||
gint X;
|
||||
guchar *Pixels;
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(2*context->Header.height - context->Lines - 1);
|
||||
else
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(context->Lines-context->Header.height);
|
||||
while (X < context->Header.width) {
|
||||
int Bit;
|
||||
|
||||
Bit = (context->LineBuf[X / 8]) >> (7 - (X & 7));
|
||||
Bit = Bit & 1;
|
||||
/* The joys of having a BGR byteorder */
|
||||
Pixels[X * 4 + 3] = 255-Bit*255;
|
||||
#if 0
|
||||
if (Bit){
|
||||
Pixels[X*4+0] = 255;
|
||||
Pixels[X*4+1] = 255;
|
||||
} else {
|
||||
Pixels[X*4+0] = 0;
|
||||
Pixels[X*4+1] = 0;
|
||||
}
|
||||
#endif
|
||||
X++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void OneLine(struct ico_progressive_state *context)
|
||||
{
|
||||
context->LineDone = 0;
|
||||
|
||||
if (context->Lines >= context->Header.height*2) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (context->Lines <context->Header.height) {
|
||||
|
||||
if (context->Type == 24)
|
||||
OneLine24(context);
|
||||
if (context->Type == 8)
|
||||
OneLine8(context);
|
||||
if (context->Type == 4)
|
||||
OneLine4(context);
|
||||
if (context->Type == 1)
|
||||
OneLine1(context);
|
||||
} else
|
||||
{
|
||||
OneLineTransp(context);
|
||||
}
|
||||
|
||||
context->Lines++;
|
||||
if (context->Lines>=context->Header.height) {
|
||||
context->Type = 1;
|
||||
context->LineWidth = context->Header.width / 8;
|
||||
if ((context->Header.width & 7) != 0)
|
||||
context->LineWidth++;
|
||||
/* Pad to a 32 bit boundary */
|
||||
if (((context->LineWidth % 4) > 0))
|
||||
context->LineWidth = (context->LineWidth / 4) * 4 + 4;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (context->updated_func != NULL) {
|
||||
(*context->updated_func) (context->pixbuf,
|
||||
0,
|
||||
context->Lines,
|
||||
context->Header.width,
|
||||
context->Header.height,
|
||||
context->user_data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* context - from image_begin_load
|
||||
* buf - new image data
|
||||
* size - length of new image data
|
||||
*
|
||||
* append image data onto inrecrementally built output image
|
||||
*/
|
||||
gboolean
|
||||
gdk_pixbuf__ico_image_load_increment(gpointer data, guchar * buf, guint size)
|
||||
{
|
||||
struct ico_progressive_state *context =
|
||||
(struct ico_progressive_state *) data;
|
||||
|
||||
gint BytesToCopy;
|
||||
|
||||
while (size > 0) {
|
||||
g_assert(context->LineDone >= 0);
|
||||
if (context->HeaderDone < context->HeaderSize) { /* We still
|
||||
have headerbytes to do */
|
||||
BytesToCopy =
|
||||
context->HeaderSize - context->HeaderDone;
|
||||
if (BytesToCopy > size)
|
||||
BytesToCopy = size;
|
||||
|
||||
memmove(context->HeaderBuf + context->HeaderDone,
|
||||
buf, BytesToCopy);
|
||||
|
||||
size -= BytesToCopy;
|
||||
buf += BytesToCopy;
|
||||
context->HeaderDone += BytesToCopy;
|
||||
|
||||
} else
|
||||
{
|
||||
BytesToCopy =
|
||||
context->LineWidth - context->LineDone;
|
||||
if (BytesToCopy > size)
|
||||
BytesToCopy = size;
|
||||
|
||||
if (BytesToCopy > 0) {
|
||||
memmove(context->LineBuf +
|
||||
context->LineDone, buf,
|
||||
BytesToCopy);
|
||||
|
||||
size -= BytesToCopy;
|
||||
buf += BytesToCopy;
|
||||
context->LineDone += BytesToCopy;
|
||||
}
|
||||
if ((context->LineDone >= context->LineWidth) &&
|
||||
(context->LineWidth > 0))
|
||||
OneLine(context);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (context->HeaderDone >= 6)
|
||||
DecodeHeader(context->HeaderBuf,
|
||||
context->HeaderDone, context);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
550
gdk-pixbuf/io-jpeg.c
Normal file
550
gdk-pixbuf/io-jpeg.c
Normal file
@@ -0,0 +1,550 @@
|
||||
/* GdkPixbuf library - JPEG image loader
|
||||
*
|
||||
* Copyright (C) 1999 Michael Zucchi
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Progressive loading code Copyright (C) 1999 Red Hat, Inc.
|
||||
*
|
||||
* Authors: Michael Zucchi <zucchi@zedzone.mmc.com.au>
|
||||
* Federico Mena-Quintero <federico@gimp.org>
|
||||
* Michael Fulbright <drmike@redhat.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
Progressive file loading notes (11/03/1999) <drmike@redhat.com>...
|
||||
|
||||
These are issues I know of and will be dealing with shortly:
|
||||
|
||||
- Currently does not handle progressive jpegs - this
|
||||
requires a change in the way image_load_increment () calls
|
||||
libjpeg. Progressive jpegs are rarer but I will add this
|
||||
support asap.
|
||||
|
||||
- error handling is not as good as it should be
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <setjmp.h>
|
||||
#include <jpeglib.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
|
||||
|
||||
|
||||
/* we are a "source manager" as far as libjpeg is concerned */
|
||||
#define JPEG_PROG_BUF_SIZE 4096
|
||||
|
||||
typedef struct {
|
||||
struct jpeg_source_mgr pub; /* public fields */
|
||||
|
||||
JOCTET buffer[JPEG_PROG_BUF_SIZE]; /* start of buffer */
|
||||
long skip_next; /* number of bytes to skip next read */
|
||||
|
||||
} my_source_mgr;
|
||||
|
||||
typedef my_source_mgr * my_src_ptr;
|
||||
|
||||
/* error handler data */
|
||||
struct error_handler_data {
|
||||
struct jpeg_error_mgr pub;
|
||||
sigjmp_buf setjmp_buffer;
|
||||
};
|
||||
|
||||
/* progressive loader context */
|
||||
typedef struct {
|
||||
ModuleUpdatedNotifyFunc updated_func;
|
||||
ModulePreparedNotifyFunc prepared_func;
|
||||
gpointer user_data;
|
||||
|
||||
GdkPixbuf *pixbuf;
|
||||
guchar *dptr; /* current position in pixbuf */
|
||||
|
||||
gboolean did_prescan; /* are we in image data yet? */
|
||||
gboolean got_header; /* have we loaded jpeg header? */
|
||||
gboolean src_initialized;/* TRUE when jpeg lib initialized */
|
||||
struct jpeg_decompress_struct cinfo;
|
||||
struct error_handler_data jerr;
|
||||
} JpegProgContext;
|
||||
|
||||
GdkPixbuf *gdk_pixbuf__jpeg_image_load (FILE *f);
|
||||
gpointer gdk_pixbuf__jpeg_image_begin_load (ModulePreparedNotifyFunc func,
|
||||
ModuleUpdatedNotifyFunc func2,
|
||||
ModuleFrameDoneNotifyFunc func3,
|
||||
ModuleAnimationDoneNotifyFunc func4,
|
||||
gpointer user_data);
|
||||
void gdk_pixbuf__jpeg_image_stop_load (gpointer context);
|
||||
gboolean gdk_pixbuf__jpeg_image_load_increment(gpointer context, guchar *buf, guint size);
|
||||
|
||||
|
||||
static void
|
||||
fatal_error_handler (j_common_ptr cinfo)
|
||||
{
|
||||
/* FIXME:
|
||||
* We should somehow signal what error occurred to the caller so the
|
||||
* caller can handle the error message */
|
||||
struct error_handler_data *errmgr;
|
||||
|
||||
errmgr = (struct error_handler_data *) cinfo->err;
|
||||
cinfo->err->output_message (cinfo);
|
||||
siglongjmp (errmgr->setjmp_buffer, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Destroy notification function for the libart pixbuf */
|
||||
static void
|
||||
free_buffer (gpointer user_data, gpointer data)
|
||||
{
|
||||
free (data);
|
||||
}
|
||||
|
||||
|
||||
/* explode gray image data from jpeg library into rgb components in pixbuf */
|
||||
static void
|
||||
explode_gray_into_buf (struct jpeg_decompress_struct *cinfo,
|
||||
guchar **lines)
|
||||
{
|
||||
gint i, j;
|
||||
guint w;
|
||||
|
||||
g_return_if_fail (cinfo != NULL);
|
||||
g_return_if_fail (cinfo->output_components == 1);
|
||||
|
||||
/* Expand grey->colour. Expand from the end of the
|
||||
* memory down, so we can use the same buffer.
|
||||
*/
|
||||
w = cinfo->image_width;
|
||||
for (i = cinfo->rec_outbuf_height - 1; i >= 0; i--) {
|
||||
guchar *from, *to;
|
||||
|
||||
from = lines[i] + w - 1;
|
||||
to = lines[i] + (w - 1) * 3;
|
||||
for (j = w - 1; j >= 0; j--) {
|
||||
to[0] = from[0];
|
||||
to[1] = from[0];
|
||||
to[2] = from[0];
|
||||
to -= 3;
|
||||
from--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Shared library entry point */
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf__jpeg_image_load (FILE *f)
|
||||
{
|
||||
gint w, h, i;
|
||||
guchar *pixels = NULL;
|
||||
guchar *dptr;
|
||||
guchar *lines[4]; /* Used to expand rows, via rec_outbuf_height,
|
||||
* from the header file:
|
||||
* " Usually rec_outbuf_height will be 1 or 2,
|
||||
* at most 4."
|
||||
*/
|
||||
guchar **lptr;
|
||||
struct jpeg_decompress_struct cinfo;
|
||||
struct error_handler_data jerr;
|
||||
|
||||
/* setup error handler */
|
||||
cinfo.err = jpeg_std_error (&jerr.pub);
|
||||
jerr.pub.error_exit = fatal_error_handler;
|
||||
|
||||
if (sigsetjmp (jerr.setjmp_buffer, 1)) {
|
||||
/* Whoops there was a jpeg error */
|
||||
if (pixels)
|
||||
free (pixels);
|
||||
|
||||
jpeg_destroy_decompress (&cinfo);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* load header, setup */
|
||||
jpeg_create_decompress (&cinfo);
|
||||
jpeg_stdio_src (&cinfo, f);
|
||||
jpeg_read_header (&cinfo, TRUE);
|
||||
jpeg_start_decompress (&cinfo);
|
||||
cinfo.do_fancy_upsampling = FALSE;
|
||||
cinfo.do_block_smoothing = FALSE;
|
||||
|
||||
w = cinfo.output_width;
|
||||
h = cinfo.output_height;
|
||||
|
||||
pixels = g_malloc (h * w * 3);
|
||||
if (!pixels) {
|
||||
jpeg_destroy_decompress (&cinfo);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dptr = pixels;
|
||||
|
||||
/* decompress all the lines, a few at a time */
|
||||
|
||||
while (cinfo.output_scanline < cinfo.output_height) {
|
||||
lptr = lines;
|
||||
for (i = 0; i < cinfo.rec_outbuf_height; i++) {
|
||||
*lptr++ = dptr;
|
||||
dptr += w * 3;
|
||||
}
|
||||
|
||||
jpeg_read_scanlines (&cinfo, lines, cinfo.rec_outbuf_height);
|
||||
|
||||
if (cinfo.output_components == 1)
|
||||
explode_gray_into_buf (&cinfo, lines);
|
||||
}
|
||||
|
||||
jpeg_finish_decompress (&cinfo);
|
||||
jpeg_destroy_decompress (&cinfo);
|
||||
|
||||
return gdk_pixbuf_new_from_data (pixels, ART_PIX_RGB, FALSE,
|
||||
w, h, w * 3,
|
||||
free_buffer, NULL);
|
||||
}
|
||||
|
||||
|
||||
/**** Progressive image loading handling *****/
|
||||
|
||||
/* these routines required because we are acting as a source manager for */
|
||||
/* libjpeg. */
|
||||
static void
|
||||
init_source (j_decompress_ptr cinfo)
|
||||
{
|
||||
my_src_ptr src = (my_src_ptr) cinfo->src;
|
||||
|
||||
src->skip_next = 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
term_source (j_decompress_ptr cinfo)
|
||||
{
|
||||
/* XXXX - probably should scream something has happened */
|
||||
}
|
||||
|
||||
|
||||
/* for progressive loading (called "I/O Suspension" by libjpeg docs) */
|
||||
/* we do nothing except return "FALSE" */
|
||||
static boolean
|
||||
fill_input_buffer (j_decompress_ptr cinfo)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
skip_input_data (j_decompress_ptr cinfo, long num_bytes)
|
||||
{
|
||||
my_src_ptr src = (my_src_ptr) cinfo->src;
|
||||
long num_can_do;
|
||||
|
||||
/* move as far as we can into current buffer */
|
||||
/* then set skip_next to catch the rest */
|
||||
if (num_bytes > 0) {
|
||||
num_can_do = MIN (src->pub.bytes_in_buffer, num_bytes);
|
||||
src->pub.next_input_byte += (size_t) num_can_do;
|
||||
src->pub.bytes_in_buffer -= (size_t) num_can_do;
|
||||
|
||||
src->skip_next = num_bytes - num_can_do;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* func - called when we have pixmap created (but no image data)
|
||||
* user_data - passed as arg 1 to func
|
||||
* return context (opaque to user)
|
||||
*/
|
||||
|
||||
gpointer
|
||||
gdk_pixbuf__jpeg_image_begin_load (ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
JpegProgContext *context;
|
||||
my_source_mgr *src;
|
||||
|
||||
context = g_new0 (JpegProgContext, 1);
|
||||
context->prepared_func = prepared_func;
|
||||
context->updated_func = updated_func;
|
||||
context->user_data = user_data;
|
||||
context->pixbuf = NULL;
|
||||
context->got_header = FALSE;
|
||||
context->did_prescan = FALSE;
|
||||
context->src_initialized = FALSE;
|
||||
|
||||
/* create libjpeg structures */
|
||||
jpeg_create_decompress (&context->cinfo);
|
||||
|
||||
context->cinfo.src = (struct jpeg_source_mgr *) g_new0 (my_source_mgr, 1);
|
||||
src = (my_src_ptr) context->cinfo.src;
|
||||
|
||||
context->cinfo.err = jpeg_std_error (&context->jerr.pub);
|
||||
|
||||
src = (my_src_ptr) context->cinfo.src;
|
||||
src->pub.init_source = init_source;
|
||||
src->pub.fill_input_buffer = fill_input_buffer;
|
||||
src->pub.skip_input_data = skip_input_data;
|
||||
src->pub.resync_to_restart = jpeg_resync_to_restart;
|
||||
src->pub.term_source = term_source;
|
||||
src->pub.bytes_in_buffer = 0;
|
||||
src->pub.next_input_byte = NULL;
|
||||
|
||||
return (gpointer) context;
|
||||
}
|
||||
|
||||
/*
|
||||
* context - returned from image_begin_load
|
||||
*
|
||||
* free context, unref gdk_pixbuf
|
||||
*/
|
||||
void
|
||||
gdk_pixbuf__jpeg_image_stop_load (gpointer data)
|
||||
{
|
||||
JpegProgContext *context = (JpegProgContext *) data;
|
||||
|
||||
g_return_if_fail (context != NULL);
|
||||
|
||||
if (context->pixbuf)
|
||||
gdk_pixbuf_unref (context->pixbuf);
|
||||
|
||||
jpeg_finish_decompress(&context->cinfo);
|
||||
jpeg_destroy_decompress(&context->cinfo);
|
||||
|
||||
if (context->cinfo.src) {
|
||||
my_src_ptr src = (my_src_ptr) context->cinfo.src;
|
||||
|
||||
g_free (src);
|
||||
}
|
||||
|
||||
g_free (context);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* context - from image_begin_load
|
||||
* buf - new image data
|
||||
* size - length of new image data
|
||||
*
|
||||
* append image data onto inrecrementally built output image
|
||||
*/
|
||||
gboolean
|
||||
gdk_pixbuf__jpeg_image_load_increment (gpointer data, guchar *buf, guint size)
|
||||
{
|
||||
JpegProgContext *context = (JpegProgContext *)data;
|
||||
struct jpeg_decompress_struct *cinfo;
|
||||
my_src_ptr src;
|
||||
guint num_left, num_copy;
|
||||
guint last_bytes_left;
|
||||
guint spinguard;
|
||||
gboolean first;
|
||||
guchar *bufhd;
|
||||
|
||||
g_return_val_if_fail (context != NULL, FALSE);
|
||||
g_return_val_if_fail (buf != NULL, FALSE);
|
||||
|
||||
src = (my_src_ptr) context->cinfo.src;
|
||||
|
||||
cinfo = &context->cinfo;
|
||||
|
||||
/* XXXXXXX (drmike) - loop(s) below need to be recoded now I
|
||||
* have a grasp of what the flow needs to be!
|
||||
*/
|
||||
|
||||
|
||||
/* skip over data if requested, handle unsigned int sizes cleanly */
|
||||
/* only can happen if we've already called jpeg_get_header once */
|
||||
if (context->src_initialized && src->skip_next) {
|
||||
if (src->skip_next > size) {
|
||||
src->skip_next -= size;
|
||||
return TRUE;
|
||||
} else {
|
||||
num_left = size - src->skip_next;
|
||||
bufhd = buf + src->skip_next;
|
||||
src->skip_next = 0;
|
||||
}
|
||||
} else {
|
||||
num_left = size;
|
||||
bufhd = buf;
|
||||
}
|
||||
|
||||
if (num_left == 0)
|
||||
return TRUE;
|
||||
|
||||
last_bytes_left = 0;
|
||||
spinguard = 0;
|
||||
first = TRUE;
|
||||
while (TRUE) {
|
||||
|
||||
/* handle any data from caller we haven't processed yet */
|
||||
if (num_left > 0) {
|
||||
if(src->pub.bytes_in_buffer &&
|
||||
src->pub.next_input_byte != src->buffer)
|
||||
memmove(src->buffer, src->pub.next_input_byte,
|
||||
src->pub.bytes_in_buffer);
|
||||
|
||||
|
||||
num_copy = MIN (JPEG_PROG_BUF_SIZE - src->pub.bytes_in_buffer,
|
||||
num_left);
|
||||
|
||||
/* if (num_copy == 0)
|
||||
g_error ("Buffer overflow!");
|
||||
*/
|
||||
memcpy(src->buffer + src->pub.bytes_in_buffer, bufhd,num_copy);
|
||||
src->pub.next_input_byte = src->buffer;
|
||||
src->pub.bytes_in_buffer += num_copy;
|
||||
bufhd += num_copy;
|
||||
num_left -= num_copy;
|
||||
} else {
|
||||
/* did anything change from last pass, if not return */
|
||||
if (first) {
|
||||
last_bytes_left = src->pub.bytes_in_buffer;
|
||||
first = FALSE;
|
||||
} else if (src->pub.bytes_in_buffer == last_bytes_left)
|
||||
spinguard++;
|
||||
else
|
||||
last_bytes_left = src->pub.bytes_in_buffer;
|
||||
}
|
||||
|
||||
/* should not go through twice and not pull bytes out of buf */
|
||||
if (spinguard > 2)
|
||||
return TRUE;
|
||||
|
||||
/* try to load jpeg header */
|
||||
if (!context->got_header) {
|
||||
int rc;
|
||||
|
||||
rc = jpeg_read_header (cinfo, TRUE);
|
||||
context->src_initialized = TRUE;
|
||||
|
||||
if (rc == JPEG_SUSPENDED)
|
||||
continue;
|
||||
|
||||
context->got_header = TRUE;
|
||||
|
||||
#if 0
|
||||
if (jpeg_has_multiple_scans (cinfo)) {
|
||||
g_print ("io-jpeg.c: Does not currently "
|
||||
"support progressive jpeg files.\n");
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
context->pixbuf = gdk_pixbuf_new(ART_PIX_RGB,
|
||||
/*have_alpha*/ FALSE,
|
||||
8,
|
||||
cinfo->image_width,
|
||||
cinfo->image_height);
|
||||
|
||||
if (context->pixbuf == NULL) {
|
||||
/* Failed to allocate memory */
|
||||
g_error ("Couldn't allocate gdkpixbuf");
|
||||
}
|
||||
|
||||
/* Use pixbuf buffer to store decompressed data */
|
||||
context->dptr = context->pixbuf->art_pixbuf->pixels;
|
||||
|
||||
/* Notify the client that we are ready to go */
|
||||
(* context->prepared_func) (context->pixbuf,
|
||||
context->user_data);
|
||||
|
||||
} else if (!context->did_prescan) {
|
||||
int rc;
|
||||
|
||||
/* start decompression */
|
||||
rc = jpeg_start_decompress (cinfo);
|
||||
cinfo->do_fancy_upsampling = FALSE;
|
||||
cinfo->do_block_smoothing = FALSE;
|
||||
|
||||
if (rc == JPEG_SUSPENDED)
|
||||
continue;
|
||||
|
||||
context->did_prescan = TRUE;
|
||||
} else {
|
||||
|
||||
/* we're decompressing so feed jpeg lib scanlines */
|
||||
guchar *lines[4];
|
||||
guchar **lptr;
|
||||
guchar *rowptr;
|
||||
gint nlines, i;
|
||||
gint start_scanline;
|
||||
|
||||
/* keep going until we've done all scanlines */
|
||||
while (cinfo->output_scanline < cinfo->output_height) {
|
||||
start_scanline = cinfo->output_scanline;
|
||||
lptr = lines;
|
||||
rowptr = context->dptr;
|
||||
for (i=0; i < cinfo->rec_outbuf_height; i++) {
|
||||
*lptr++ = rowptr;
|
||||
rowptr += context->pixbuf->art_pixbuf->rowstride;
|
||||
}
|
||||
|
||||
nlines = jpeg_read_scanlines (cinfo, lines,
|
||||
cinfo->rec_outbuf_height);
|
||||
if (nlines == 0)
|
||||
break;
|
||||
|
||||
/* handle gray */
|
||||
if (cinfo->output_components == 1)
|
||||
explode_gray_into_buf (cinfo, lines);
|
||||
|
||||
context->dptr += nlines * context->pixbuf->art_pixbuf->rowstride;
|
||||
|
||||
/* send updated signal */
|
||||
(* context->updated_func) (context->pixbuf,
|
||||
0,
|
||||
cinfo->output_scanline-1,
|
||||
cinfo->image_width,
|
||||
nlines,
|
||||
context->user_data);
|
||||
|
||||
#undef DEBUG_JPEG_PROGRESSIVE
|
||||
#ifdef DEBUG_JPEG_PROGRESSIVE
|
||||
|
||||
if (start_scanline != cinfo->output_scanline)
|
||||
g_print("jpeg: Input pass=%2d, next input scanline=%3d,"
|
||||
" emitted %3d - %3d\n",
|
||||
cinfo->input_scan_number, cinfo->input_iMCU_row * 16,
|
||||
start_scanline, cinfo->output_scanline - 1);
|
||||
|
||||
|
||||
|
||||
g_print ("Scanline %d of %d - ",
|
||||
cinfo->output_scanline,
|
||||
cinfo->output_height);
|
||||
/* g_print ("rec_height %d -", cinfo->rec_outbuf_height); */
|
||||
g_print ("Processed %d lines - bytes left = %d\n",
|
||||
nlines, cinfo->src->bytes_in_buffer);
|
||||
#endif
|
||||
}
|
||||
/* did entire image */
|
||||
if (cinfo->output_scanline >= cinfo->output_height)
|
||||
return TRUE;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
524
gdk-pixbuf/io-png.c
Normal file
524
gdk-pixbuf/io-png.c
Normal file
@@ -0,0 +1,524 @@
|
||||
/* GdkPixbuf library - JPEG image loader
|
||||
*
|
||||
* Copyright (C) 1999 Mark Crichton
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Authors: Mark Crichton <crichton@gimp.org>
|
||||
* Federico Mena-Quintero <federico@gimp.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <png.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
|
||||
|
||||
|
||||
static void
|
||||
setup_png_transformations(png_structp png_read_ptr, png_infop png_info_ptr,
|
||||
gboolean *fatal_error_occurred,
|
||||
png_uint_32* width_p, png_uint_32* height_p,
|
||||
int* color_type_p)
|
||||
{
|
||||
png_uint_32 width, height;
|
||||
int bit_depth, color_type, interlace_type, compression_type, filter_type;
|
||||
int channels;
|
||||
|
||||
/* Get the image info */
|
||||
|
||||
png_get_IHDR (png_read_ptr, png_info_ptr,
|
||||
&width, &height,
|
||||
&bit_depth,
|
||||
&color_type,
|
||||
&interlace_type,
|
||||
&compression_type,
|
||||
&filter_type);
|
||||
|
||||
/* set_expand() basically needs to be called unless
|
||||
we are already in RGB/RGBA mode
|
||||
*/
|
||||
if (color_type == PNG_COLOR_TYPE_PALETTE &&
|
||||
bit_depth <= 8) {
|
||||
|
||||
/* Convert indexed images to RGB */
|
||||
png_set_expand (png_read_ptr);
|
||||
|
||||
} else if (color_type == PNG_COLOR_TYPE_GRAY &&
|
||||
bit_depth < 8) {
|
||||
|
||||
/* Convert grayscale to RGB */
|
||||
png_set_expand (png_read_ptr);
|
||||
|
||||
} else if (png_get_valid (png_read_ptr,
|
||||
png_info_ptr, PNG_INFO_tRNS)) {
|
||||
|
||||
/* If we have transparency header, convert it to alpha
|
||||
channel */
|
||||
png_set_expand(png_read_ptr);
|
||||
|
||||
} else if (bit_depth < 8) {
|
||||
|
||||
/* If we have < 8 scale it up to 8 */
|
||||
png_set_expand(png_read_ptr);
|
||||
|
||||
|
||||
/* Conceivably, png_set_packing() is a better idea;
|
||||
* God only knows how libpng works
|
||||
*/
|
||||
}
|
||||
|
||||
/* If we are 16-bit, convert to 8-bit */
|
||||
if (bit_depth == 16) {
|
||||
png_set_strip_16(png_read_ptr);
|
||||
}
|
||||
|
||||
/* If gray scale, convert to RGB */
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY ||
|
||||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
|
||||
png_set_gray_to_rgb(png_read_ptr);
|
||||
}
|
||||
|
||||
/* If interlaced, handle that */
|
||||
if (interlace_type != PNG_INTERLACE_NONE) {
|
||||
png_set_interlace_handling(png_read_ptr);
|
||||
}
|
||||
|
||||
/* Update the info the reflect our transformations */
|
||||
png_read_update_info(png_read_ptr, png_info_ptr);
|
||||
|
||||
png_get_IHDR (png_read_ptr, png_info_ptr,
|
||||
&width, &height,
|
||||
&bit_depth,
|
||||
&color_type,
|
||||
&interlace_type,
|
||||
&compression_type,
|
||||
&filter_type);
|
||||
|
||||
*width_p = width;
|
||||
*height_p = height;
|
||||
*color_type_p = color_type;
|
||||
|
||||
#ifndef G_DISABLE_CHECKS
|
||||
/* Check that the new info is what we want */
|
||||
|
||||
if (bit_depth != 8) {
|
||||
g_warning("Bits per channel of transformed PNG is %d, not 8.", bit_depth);
|
||||
*fatal_error_occurred = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! (color_type == PNG_COLOR_TYPE_RGB ||
|
||||
color_type == PNG_COLOR_TYPE_RGB_ALPHA) ) {
|
||||
g_warning("Transformed PNG not RGB or RGBA.");
|
||||
*fatal_error_occurred = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
channels = png_get_channels(png_read_ptr, png_info_ptr);
|
||||
if ( ! (channels == 3 || channels == 4) ) {
|
||||
g_warning("Transformed PNG has %d channels, must be 3 or 4.", channels);
|
||||
*fatal_error_occurred = TRUE;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Destroy notification function for the libart pixbuf */
|
||||
static void
|
||||
free_buffer (gpointer user_data, gpointer data)
|
||||
{
|
||||
free (data);
|
||||
}
|
||||
|
||||
/* Shared library entry point */
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf__png_image_load (FILE *f)
|
||||
{
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr, end_info;
|
||||
gboolean failed = FALSE;
|
||||
gint i, ctype, bpp;
|
||||
png_uint_32 w, h;
|
||||
png_bytepp rows;
|
||||
guchar *pixels;
|
||||
|
||||
png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
if (!png_ptr)
|
||||
return NULL;
|
||||
|
||||
info_ptr = png_create_info_struct (png_ptr);
|
||||
if (!info_ptr) {
|
||||
png_destroy_read_struct (&png_ptr, NULL, NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
end_info = png_create_info_struct (png_ptr);
|
||||
if (!end_info) {
|
||||
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (setjmp (png_ptr->jmpbuf)) {
|
||||
png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
png_init_io (png_ptr, f);
|
||||
png_read_info (png_ptr, info_ptr);
|
||||
|
||||
setup_png_transformations(png_ptr, info_ptr, &failed, &w, &h, &ctype);
|
||||
|
||||
if (failed) {
|
||||
png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ctype & PNG_COLOR_MASK_ALPHA)
|
||||
bpp = 4;
|
||||
else
|
||||
bpp = 3;
|
||||
|
||||
pixels = malloc (w * h * bpp);
|
||||
if (!pixels) {
|
||||
png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rows = g_new (png_bytep, h);
|
||||
|
||||
for (i = 0; i < h; i++)
|
||||
rows[i] = pixels + i * w * bpp;
|
||||
|
||||
png_read_image (png_ptr, rows);
|
||||
png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
|
||||
g_free (rows);
|
||||
|
||||
if (ctype & PNG_COLOR_MASK_ALPHA)
|
||||
return gdk_pixbuf_new_from_data (pixels, ART_PIX_RGB, TRUE,
|
||||
w, h, w * 4,
|
||||
free_buffer, NULL);
|
||||
else
|
||||
return gdk_pixbuf_new_from_data (pixels, ART_PIX_RGB, FALSE,
|
||||
w, h, w * 3,
|
||||
free_buffer, NULL);
|
||||
}
|
||||
|
||||
/* These avoid the setjmp()/longjmp() crap in libpng */
|
||||
static void png_error_callback (png_structp png_read_ptr,
|
||||
png_const_charp error_msg);
|
||||
|
||||
static void png_warning_callback(png_structp png_read_ptr,
|
||||
png_const_charp warning_msg);
|
||||
|
||||
/* Called at the start of the progressive load */
|
||||
static void png_info_callback (png_structp png_read_ptr,
|
||||
png_infop png_info_ptr);
|
||||
|
||||
/* Called for each row; note that you will get duplicate row numbers
|
||||
for interlaced PNGs */
|
||||
static void png_row_callback (png_structp png_read_ptr,
|
||||
png_bytep new_row,
|
||||
png_uint_32 row_num,
|
||||
int pass_num);
|
||||
|
||||
/* Called after reading the entire image */
|
||||
static void png_end_callback (png_structp png_read_ptr,
|
||||
png_infop png_info_ptr);
|
||||
|
||||
typedef struct _LoadContext LoadContext;
|
||||
|
||||
struct _LoadContext {
|
||||
png_structp png_read_ptr;
|
||||
png_infop png_info_ptr;
|
||||
|
||||
ModulePreparedNotifyFunc prepare_func;
|
||||
ModuleUpdatedNotifyFunc update_func;
|
||||
gpointer notify_user_data;
|
||||
|
||||
GdkPixbuf* pixbuf;
|
||||
|
||||
/* row number of first row seen, or -1 if none yet seen */
|
||||
|
||||
gint first_row_seen_in_chunk;
|
||||
|
||||
/* pass number for the first row seen */
|
||||
|
||||
gint first_pass_seen_in_chunk;
|
||||
|
||||
/* row number of last row seen */
|
||||
gint last_row_seen_in_chunk;
|
||||
|
||||
gint last_pass_seen_in_chunk;
|
||||
|
||||
/* highest row number seen */
|
||||
gint max_row_seen_in_chunk;
|
||||
|
||||
guint fatal_error_occurred : 1;
|
||||
|
||||
};
|
||||
|
||||
gpointer
|
||||
gdk_pixbuf__png_image_begin_load (ModulePreparedNotifyFunc prepare_func,
|
||||
ModuleUpdatedNotifyFunc update_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
LoadContext* lc;
|
||||
|
||||
lc = g_new0(LoadContext, 1);
|
||||
|
||||
lc->fatal_error_occurred = FALSE;
|
||||
|
||||
lc->prepare_func = prepare_func;
|
||||
lc->update_func = update_func;
|
||||
lc->notify_user_data = user_data;
|
||||
|
||||
lc->first_row_seen_in_chunk = -1;
|
||||
lc->last_row_seen_in_chunk = -1;
|
||||
lc->first_pass_seen_in_chunk = -1;
|
||||
lc->last_pass_seen_in_chunk = -1;
|
||||
lc->max_row_seen_in_chunk = -1;
|
||||
|
||||
/* Create the main PNG context struct */
|
||||
|
||||
lc->png_read_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
||||
lc, /* error/warning callback data */
|
||||
png_error_callback,
|
||||
png_warning_callback);
|
||||
|
||||
if (lc->png_read_ptr == NULL) {
|
||||
g_free(lc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Create the auxiliary context struct */
|
||||
|
||||
lc->png_info_ptr = png_create_info_struct(lc->png_read_ptr);
|
||||
|
||||
if (lc->png_info_ptr == NULL) {
|
||||
png_destroy_read_struct(&lc->png_read_ptr, NULL, NULL);
|
||||
g_free(lc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
png_set_progressive_read_fn(lc->png_read_ptr,
|
||||
lc, /* callback data */
|
||||
png_info_callback,
|
||||
png_row_callback,
|
||||
png_end_callback);
|
||||
|
||||
|
||||
return lc;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_pixbuf__png_image_stop_load (gpointer context)
|
||||
{
|
||||
LoadContext* lc = context;
|
||||
|
||||
g_return_if_fail(lc != NULL);
|
||||
|
||||
gdk_pixbuf_unref(lc->pixbuf);
|
||||
|
||||
png_destroy_read_struct(&lc->png_read_ptr, NULL, NULL);
|
||||
g_free(lc);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_pixbuf__png_image_load_increment(gpointer context, guchar *buf, guint size)
|
||||
{
|
||||
LoadContext* lc = context;
|
||||
|
||||
g_return_val_if_fail(lc != NULL, FALSE);
|
||||
|
||||
/* reset */
|
||||
lc->first_row_seen_in_chunk = -1;
|
||||
lc->last_row_seen_in_chunk = -1;
|
||||
lc->first_pass_seen_in_chunk = -1;
|
||||
lc->last_pass_seen_in_chunk = -1;
|
||||
lc->max_row_seen_in_chunk = -1;
|
||||
|
||||
/* Invokes our callbacks as needed */
|
||||
png_process_data(lc->png_read_ptr, lc->png_info_ptr, buf, size);
|
||||
|
||||
if (lc->fatal_error_occurred)
|
||||
return FALSE;
|
||||
else {
|
||||
if (lc->first_row_seen_in_chunk >= 0) {
|
||||
/* We saw at least one row */
|
||||
gint pass_diff = lc->last_pass_seen_in_chunk - lc->first_pass_seen_in_chunk;
|
||||
|
||||
g_assert(pass_diff >= 0);
|
||||
|
||||
if (pass_diff == 0) {
|
||||
/* start and end row were in the same pass */
|
||||
(lc->update_func)(lc->pixbuf, 0,
|
||||
lc->first_row_seen_in_chunk,
|
||||
lc->pixbuf->art_pixbuf->width,
|
||||
(lc->last_row_seen_in_chunk -
|
||||
lc->first_row_seen_in_chunk) + 1,
|
||||
lc->notify_user_data);
|
||||
} else if (pass_diff == 1) {
|
||||
/* We have from the first row seen to
|
||||
the end of the image (max row
|
||||
seen), then from the top of the
|
||||
image to the last row seen */
|
||||
/* first row to end */
|
||||
(lc->update_func)(lc->pixbuf, 0,
|
||||
lc->first_row_seen_in_chunk,
|
||||
lc->pixbuf->art_pixbuf->width,
|
||||
(lc->max_row_seen_in_chunk -
|
||||
lc->first_row_seen_in_chunk) + 1,
|
||||
lc->notify_user_data);
|
||||
/* top to last row */
|
||||
(lc->update_func)(lc->pixbuf,
|
||||
0, 0,
|
||||
lc->pixbuf->art_pixbuf->width,
|
||||
lc->last_row_seen_in_chunk + 1,
|
||||
lc->notify_user_data);
|
||||
} else {
|
||||
/* We made at least one entire pass, so update the
|
||||
whole image */
|
||||
(lc->update_func)(lc->pixbuf,
|
||||
0, 0,
|
||||
lc->pixbuf->art_pixbuf->width,
|
||||
lc->max_row_seen_in_chunk + 1,
|
||||
lc->notify_user_data);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Called at the start of the progressive load, once we have image info */
|
||||
static void
|
||||
png_info_callback (png_structp png_read_ptr,
|
||||
png_infop png_info_ptr)
|
||||
{
|
||||
LoadContext* lc;
|
||||
png_uint_32 width, height;
|
||||
int color_type;
|
||||
gboolean have_alpha = FALSE;
|
||||
gboolean failed = FALSE;
|
||||
|
||||
lc = png_get_progressive_ptr(png_read_ptr);
|
||||
|
||||
if (lc->fatal_error_occurred)
|
||||
return;
|
||||
|
||||
|
||||
setup_png_transformations(lc->png_read_ptr,
|
||||
lc->png_info_ptr,
|
||||
&failed,
|
||||
&width, &height, &color_type);
|
||||
|
||||
if (failed) {
|
||||
lc->fatal_error_occurred = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
/* If we have alpha, set a flag */
|
||||
if (color_type & PNG_COLOR_MASK_ALPHA)
|
||||
have_alpha = TRUE;
|
||||
|
||||
lc->pixbuf = gdk_pixbuf_new(ART_PIX_RGB, have_alpha, 8, width, height);
|
||||
|
||||
if (lc->pixbuf == NULL) {
|
||||
/* Failed to allocate memory */
|
||||
lc->fatal_error_occurred = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Notify the client that we are ready to go */
|
||||
|
||||
if (lc->prepare_func)
|
||||
(* lc->prepare_func) (lc->pixbuf, lc->notify_user_data);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Called for each row; note that you will get duplicate row numbers
|
||||
for interlaced PNGs */
|
||||
static void
|
||||
png_row_callback (png_structp png_read_ptr,
|
||||
png_bytep new_row,
|
||||
png_uint_32 row_num,
|
||||
int pass_num)
|
||||
{
|
||||
LoadContext* lc;
|
||||
guchar* old_row = NULL;
|
||||
|
||||
lc = png_get_progressive_ptr(png_read_ptr);
|
||||
|
||||
if (lc->fatal_error_occurred)
|
||||
return;
|
||||
|
||||
if (lc->first_row_seen_in_chunk < 0) {
|
||||
lc->first_row_seen_in_chunk = row_num;
|
||||
lc->first_pass_seen_in_chunk = pass_num;
|
||||
}
|
||||
|
||||
lc->max_row_seen_in_chunk = MAX(lc->max_row_seen_in_chunk, ((gint)row_num));
|
||||
lc->last_row_seen_in_chunk = row_num;
|
||||
lc->last_pass_seen_in_chunk = pass_num;
|
||||
|
||||
old_row = lc->pixbuf->art_pixbuf->pixels + (row_num * lc->pixbuf->art_pixbuf->rowstride);
|
||||
|
||||
png_progressive_combine_row(lc->png_read_ptr, old_row, new_row);
|
||||
}
|
||||
|
||||
/* Called after reading the entire image */
|
||||
static void
|
||||
png_end_callback (png_structp png_read_ptr,
|
||||
png_infop png_info_ptr)
|
||||
{
|
||||
LoadContext* lc;
|
||||
|
||||
lc = png_get_progressive_ptr(png_read_ptr);
|
||||
|
||||
if (lc->fatal_error_occurred)
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
png_error_callback(png_structp png_read_ptr,
|
||||
png_const_charp error_msg)
|
||||
{
|
||||
LoadContext* lc;
|
||||
|
||||
lc = png_get_error_ptr(png_read_ptr);
|
||||
|
||||
lc->fatal_error_occurred = TRUE;
|
||||
|
||||
fprintf(stderr, "Fatal error loading PNG: %s\n", error_msg);
|
||||
}
|
||||
|
||||
static void
|
||||
png_warning_callback(png_structp png_read_ptr,
|
||||
png_const_charp warning_msg)
|
||||
{
|
||||
LoadContext* lc;
|
||||
|
||||
lc = png_get_error_ptr(png_read_ptr);
|
||||
|
||||
fprintf(stderr, "Warning loading PNG: %s\n", warning_msg);
|
||||
}
|
||||
|
||||
860
gdk-pixbuf/io-pnm.c
Normal file
860
gdk-pixbuf/io-pnm.c
Normal file
@@ -0,0 +1,860 @@
|
||||
/* GdkPixbuf library - PNM image loader
|
||||
*
|
||||
* Copyright (C) 1999 Red Hat, Inc.
|
||||
*
|
||||
* Authors: Michael Fulbright <drmike@redhat.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <setjmp.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
|
||||
|
||||
|
||||
#define PNM_BUF_SIZE 4096
|
||||
|
||||
#define PNM_SUSPEND 0
|
||||
#define PNM_OK 1
|
||||
#define PNM_FATAL_ERR -1
|
||||
|
||||
typedef enum {
|
||||
PNM_FORMAT_PGM,
|
||||
PNM_FORMAT_PGM_RAW,
|
||||
PNM_FORMAT_PPM,
|
||||
PNM_FORMAT_PPM_RAW,
|
||||
PNM_FORMAT_PBM,
|
||||
PNM_FORMAT_PBM_RAW
|
||||
} PnmFormat;
|
||||
|
||||
typedef struct {
|
||||
guchar buffer[PNM_BUF_SIZE];
|
||||
guchar *next_byte;
|
||||
guint bytes_left;
|
||||
} PnmIOBuffer;
|
||||
|
||||
typedef struct {
|
||||
ModuleUpdatedNotifyFunc updated_func;
|
||||
ModulePreparedNotifyFunc prepared_func;
|
||||
gpointer user_data;
|
||||
|
||||
GdkPixbuf *pixbuf;
|
||||
guchar *pixels; /* incoming pixel data buffer */
|
||||
guchar *dptr; /* current position in pixbuf */
|
||||
|
||||
PnmIOBuffer inbuf;
|
||||
|
||||
guint width;
|
||||
guint height;
|
||||
guint maxval;
|
||||
guint rowstride;
|
||||
PnmFormat type;
|
||||
|
||||
guint output_row; /* last row to be completed */
|
||||
guint output_col;
|
||||
gboolean did_prescan; /* are we in image data yet? */
|
||||
gboolean got_header; /* have we loaded jpeg header? */
|
||||
} PnmLoaderContext;
|
||||
|
||||
GdkPixbuf *gdk_pixbuf__pnm_image_load (FILE *f);
|
||||
gpointer gdk_pixbuf__pnm_image_begin_load (ModulePreparedNotifyFunc func,
|
||||
ModuleUpdatedNotifyFunc func2,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data);
|
||||
void gdk_pixbuf__pnm_image_stop_load (gpointer context);
|
||||
gboolean gdk_pixbuf__pnm_image_load_increment(gpointer context, guchar *buf, guint size);
|
||||
|
||||
static void explode_bitmap_into_buf (PnmLoaderContext *context);
|
||||
static void explode_gray_into_buf (PnmLoaderContext *context);
|
||||
|
||||
/* Destroy notification function for the libart pixbuf */
|
||||
static void
|
||||
free_buffer (gpointer user_data, gpointer data)
|
||||
{
|
||||
free (data);
|
||||
}
|
||||
|
||||
|
||||
/* explode bitmap data into rgb components */
|
||||
/* we need to know what the row so we can */
|
||||
/* do sub-byte expansion (since 1 byte = 8 pixels) */
|
||||
/* context->dptr MUST point at first byte in incoming data */
|
||||
/* which corresponds to first pixel of row y */
|
||||
static void
|
||||
explode_bitmap_into_buf (PnmLoaderContext *context)
|
||||
{
|
||||
gint j;
|
||||
guchar *from, *to, data;
|
||||
gint bit;
|
||||
guchar *dptr;
|
||||
gint wid, x, y;
|
||||
|
||||
g_return_if_fail (context != NULL);
|
||||
g_return_if_fail (context->dptr != NULL);
|
||||
|
||||
/* I'm no clever bit-hacker so I'm sure this can be optimized */
|
||||
dptr = context->dptr;
|
||||
y = context->output_row;
|
||||
wid = context->width;
|
||||
|
||||
from = dptr + (wid - 1)/8;
|
||||
to = dptr + (wid - 1) * 3;
|
||||
/* bit = 7 - (((y+1)*wid-1) % 8); */
|
||||
bit = 7 - ((wid-1) % 8);
|
||||
|
||||
/* get first byte and align properly */
|
||||
data = from[0];
|
||||
for (j = 0; j < bit; j++, data >>= 1);
|
||||
|
||||
for (x = wid-1; x >= 0; x--) {
|
||||
|
||||
/* g_print ("%c", (data & 1) ? '*' : ' '); */
|
||||
|
||||
to[0] = to[1] = to[2] = (data & 1) ? 0x00 : 0xff;
|
||||
|
||||
to -= 3;
|
||||
bit++;
|
||||
|
||||
if (bit > 7) {
|
||||
from--;
|
||||
data = from[0];
|
||||
bit = 0;
|
||||
} else {
|
||||
data >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* g_print ("\n"); */
|
||||
}
|
||||
|
||||
/* explode gray image row into rgb components in pixbuf */
|
||||
static void
|
||||
explode_gray_into_buf (PnmLoaderContext *context)
|
||||
{
|
||||
gint j;
|
||||
guchar *from, *to;
|
||||
guint w;
|
||||
|
||||
g_return_if_fail (context != NULL);
|
||||
g_return_if_fail (context->dptr != NULL);
|
||||
|
||||
/* Expand grey->colour. Expand from the end of the
|
||||
* memory down, so we can use the same buffer.
|
||||
*/
|
||||
w = context->width;
|
||||
from = context->dptr + w - 1;
|
||||
to = context->dptr + (w - 1) * 3;
|
||||
for (j = w - 1; j >= 0; j--) {
|
||||
to[0] = from[0];
|
||||
to[1] = from[0];
|
||||
to[2] = from[0];
|
||||
to -= 3;
|
||||
from--;
|
||||
}
|
||||
}
|
||||
|
||||
/* skip over whitespace in file from current pos. */
|
||||
/* also skips comments */
|
||||
/* returns pointer to first non-whitespace char hit or, or NULL if */
|
||||
/* we ran out of data w/o hitting a whitespace */
|
||||
/* internal pointer in inbuf isnt moved ahead in this case */
|
||||
static guchar *
|
||||
skip_ahead_whitespace (PnmIOBuffer *inbuf)
|
||||
{
|
||||
gboolean in_comment;
|
||||
guchar *ptr;
|
||||
guint num_left;
|
||||
|
||||
g_return_val_if_fail (inbuf != NULL, NULL);
|
||||
g_return_val_if_fail (inbuf->next_byte != NULL, NULL);
|
||||
|
||||
in_comment = FALSE;
|
||||
num_left = inbuf->bytes_left;
|
||||
ptr = inbuf->next_byte;
|
||||
while (num_left > 0) {
|
||||
if (in_comment) {
|
||||
if (*ptr == '\n')
|
||||
in_comment = FALSE;
|
||||
} else if (*ptr == '#') {
|
||||
in_comment = TRUE;
|
||||
} else if (!isspace (*ptr)) {
|
||||
inbuf->bytes_left -= (ptr-inbuf->next_byte);
|
||||
inbuf->next_byte = ptr;
|
||||
return ptr;
|
||||
}
|
||||
ptr ++;
|
||||
num_left--;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* reads into buffer until we hit whitespace in file from current pos, */
|
||||
/* return NULL if ran out of data */
|
||||
/* advances inbuf if successful */
|
||||
static guchar *
|
||||
read_til_whitespace (PnmIOBuffer *inbuf, guchar *buf, guint size)
|
||||
{
|
||||
guchar *p;
|
||||
guchar *ptr;
|
||||
guint num_left;
|
||||
|
||||
g_return_val_if_fail (inbuf != NULL, NULL);
|
||||
g_return_val_if_fail (inbuf->next_byte != NULL, NULL);
|
||||
|
||||
p = buf;
|
||||
num_left = inbuf->bytes_left;
|
||||
ptr = inbuf->next_byte;
|
||||
while (num_left > 0 && (p-buf)+1 < size) {
|
||||
if (isspace (*ptr)) {
|
||||
*p = '\0';
|
||||
inbuf->bytes_left = num_left;
|
||||
inbuf->next_byte = ptr;
|
||||
return ptr;
|
||||
} else {
|
||||
*p = *ptr;
|
||||
p++;
|
||||
ptr++;
|
||||
num_left--;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* read next number from buffer */
|
||||
/* -1 if failed, 0 if successful */
|
||||
static gint
|
||||
read_next_number (PnmIOBuffer *inbuf, guint *value)
|
||||
{
|
||||
guchar *tmpptr;
|
||||
guchar *old_next_byte;
|
||||
gchar *errptr;
|
||||
guint old_bytes_left;
|
||||
guchar buf[128];
|
||||
|
||||
g_return_val_if_fail (inbuf != NULL, -1);
|
||||
g_return_val_if_fail (inbuf->next_byte != NULL, -1);
|
||||
g_return_val_if_fail (value != NULL, -1);
|
||||
|
||||
old_next_byte = inbuf->next_byte;
|
||||
old_bytes_left = inbuf->bytes_left;
|
||||
|
||||
if ((tmpptr = skip_ahead_whitespace (inbuf)) == NULL)
|
||||
return -1;
|
||||
|
||||
if ((tmpptr = read_til_whitespace (inbuf, buf, 128)) == NULL) {
|
||||
inbuf->next_byte = old_next_byte;
|
||||
inbuf->bytes_left = old_bytes_left;
|
||||
return -1;
|
||||
}
|
||||
|
||||
*value = strtol (buf, &errptr, 10);
|
||||
|
||||
if (*errptr != '\0') {
|
||||
inbuf->next_byte = old_next_byte;
|
||||
inbuf->bytes_left = old_bytes_left;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* returns PNM_OK, PNM_SUSPEND, or PNM_FATAL_ERR */
|
||||
static gint
|
||||
pnm_read_header (PnmLoaderContext *context)
|
||||
{
|
||||
guchar *old_next_byte;
|
||||
guint old_bytes_left;
|
||||
PnmIOBuffer *inbuf;
|
||||
guint w, h;
|
||||
gint rc;
|
||||
PnmFormat type;
|
||||
|
||||
g_return_val_if_fail (context != NULL, PNM_FATAL_ERR);
|
||||
|
||||
inbuf = &context->inbuf;
|
||||
old_bytes_left = inbuf->bytes_left;
|
||||
old_next_byte = inbuf->next_byte;
|
||||
|
||||
/* file must start with a 'P' followed by a numeral */
|
||||
/* so loop till we get enough data to determine type*/
|
||||
if (inbuf->bytes_left < 2)
|
||||
return PNM_SUSPEND;
|
||||
|
||||
if (*inbuf->next_byte != 'P')
|
||||
return PNM_FATAL_ERR;
|
||||
|
||||
switch (*(inbuf->next_byte+1)) {
|
||||
case '1':
|
||||
type = PNM_FORMAT_PBM;
|
||||
break;
|
||||
case '2':
|
||||
type = PNM_FORMAT_PGM;
|
||||
break;
|
||||
case '3':
|
||||
type = PNM_FORMAT_PPM;
|
||||
break;
|
||||
case '4':
|
||||
type = PNM_FORMAT_PBM_RAW;
|
||||
break;
|
||||
case '5':
|
||||
type = PNM_FORMAT_PGM_RAW;
|
||||
break;
|
||||
case '6':
|
||||
type = PNM_FORMAT_PPM_RAW;
|
||||
break;
|
||||
default:
|
||||
return PNM_FATAL_ERR;
|
||||
}
|
||||
|
||||
context->type = type;
|
||||
|
||||
inbuf->next_byte += 2;
|
||||
inbuf->bytes_left -= 2;
|
||||
|
||||
/* now read remainder of header */
|
||||
if ((rc = read_next_number (inbuf, &w))) {
|
||||
inbuf->next_byte = old_next_byte;
|
||||
inbuf->bytes_left = old_bytes_left;
|
||||
return PNM_SUSPEND;
|
||||
}
|
||||
|
||||
if ((rc = read_next_number (inbuf, &h))) {
|
||||
inbuf->next_byte = old_next_byte;
|
||||
inbuf->bytes_left = old_bytes_left;
|
||||
return PNM_SUSPEND;
|
||||
}
|
||||
|
||||
context->width = w;
|
||||
context->height = h;
|
||||
|
||||
switch (type) {
|
||||
case PNM_FORMAT_PPM:
|
||||
case PNM_FORMAT_PPM_RAW:
|
||||
case PNM_FORMAT_PGM:
|
||||
case PNM_FORMAT_PGM_RAW:
|
||||
if ((rc = read_next_number (inbuf, &context->maxval)) < 0) {
|
||||
inbuf->next_byte = old_next_byte;
|
||||
inbuf->bytes_left = old_bytes_left;
|
||||
return PNM_SUSPEND;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return PNM_OK;
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
pnm_read_raw_scanline (PnmLoaderContext *context)
|
||||
{
|
||||
guint numpix;
|
||||
guint numbytes, offset;
|
||||
PnmIOBuffer *inbuf;
|
||||
|
||||
g_return_val_if_fail (context != NULL, PNM_FATAL_ERR);
|
||||
|
||||
/*G_BREAKPOINT(); */
|
||||
|
||||
inbuf = &context->inbuf;
|
||||
|
||||
switch (context->type) {
|
||||
case PNM_FORMAT_PBM_RAW:
|
||||
numpix = inbuf->bytes_left * 8;
|
||||
break;
|
||||
case PNM_FORMAT_PGM_RAW:
|
||||
numpix = inbuf->bytes_left;
|
||||
break;
|
||||
case PNM_FORMAT_PPM_RAW:
|
||||
numpix = inbuf->bytes_left/3;
|
||||
break;
|
||||
default:
|
||||
g_warning ("io-pnm.c: Illegal raw pnm type!\n");
|
||||
return PNM_FATAL_ERR;
|
||||
}
|
||||
|
||||
numpix = MIN (numpix, context->width - context->output_col);
|
||||
|
||||
if (numpix == 0)
|
||||
return PNM_SUSPEND;
|
||||
|
||||
context->dptr = context->pixels +
|
||||
context->output_row * context->rowstride;
|
||||
|
||||
switch (context->type) {
|
||||
case PNM_FORMAT_PBM_RAW:
|
||||
numbytes = numpix/8 + ((numpix % 8) ? 1 : 0);
|
||||
offset = context->output_col/8;
|
||||
break;
|
||||
case PNM_FORMAT_PGM_RAW:
|
||||
numbytes = numpix;
|
||||
offset = context->output_col;
|
||||
break;
|
||||
case PNM_FORMAT_PPM_RAW:
|
||||
numbytes = numpix*3;
|
||||
offset = context->output_col*3;
|
||||
break;
|
||||
default:
|
||||
g_warning ("io-pnm.c: Illegal raw pnm type!\n");
|
||||
return PNM_FATAL_ERR;
|
||||
}
|
||||
|
||||
memcpy (context->dptr + offset, inbuf->next_byte, numbytes);
|
||||
|
||||
inbuf->next_byte += numbytes;
|
||||
inbuf->bytes_left -= numbytes;
|
||||
|
||||
context->output_col += numpix;
|
||||
if (context->output_col == context->width) {
|
||||
if ( context->type == PNM_FORMAT_PBM_RAW )
|
||||
explode_bitmap_into_buf(context);
|
||||
else if ( context->type == PNM_FORMAT_PGM_RAW )
|
||||
explode_gray_into_buf (context);
|
||||
|
||||
context->output_col = 0;
|
||||
context->output_row++;
|
||||
|
||||
} else {
|
||||
return PNM_SUSPEND;
|
||||
}
|
||||
|
||||
return PNM_OK;
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
pnm_read_ascii_scanline (PnmLoaderContext *context)
|
||||
{
|
||||
guint offset;
|
||||
gint rc;
|
||||
guint value, numval, i;
|
||||
guchar data;
|
||||
guchar mask;
|
||||
guchar *old_next_byte, *dptr;
|
||||
guint old_bytes_left;
|
||||
PnmIOBuffer *inbuf;
|
||||
|
||||
g_return_val_if_fail (context != NULL, PNM_FATAL_ERR);
|
||||
|
||||
data = mask = 0;
|
||||
|
||||
inbuf = &context->inbuf;
|
||||
|
||||
context->dptr = context->pixels +
|
||||
context->output_row * context->rowstride;
|
||||
|
||||
switch (context->type) {
|
||||
case PNM_FORMAT_PBM:
|
||||
numval = MIN (8, context->width - context->output_col);
|
||||
offset = context->output_col/8;
|
||||
break;
|
||||
case PNM_FORMAT_PGM:
|
||||
numval = 1;
|
||||
offset = context->output_col;
|
||||
break;
|
||||
case PNM_FORMAT_PPM:
|
||||
numval = 3;
|
||||
offset = context->output_col*3;
|
||||
break;
|
||||
|
||||
default:
|
||||
g_warning ("Can't happen\n");
|
||||
return PNM_FATAL_ERR;
|
||||
}
|
||||
|
||||
dptr = context->dptr + offset;
|
||||
|
||||
while (TRUE) {
|
||||
if (context->type == PNM_FORMAT_PBM) {
|
||||
mask = 0x80;
|
||||
data = 0;
|
||||
numval = MIN (8, context->width - context->output_col);
|
||||
}
|
||||
|
||||
old_next_byte = inbuf->next_byte;
|
||||
old_bytes_left = inbuf->bytes_left;
|
||||
|
||||
for (i=0; i<numval; i++) {
|
||||
if ((rc = read_next_number (inbuf, &value))) {
|
||||
inbuf->next_byte = old_next_byte;
|
||||
inbuf->bytes_left = old_bytes_left;
|
||||
return PNM_SUSPEND;
|
||||
}
|
||||
switch (context->type) {
|
||||
case PNM_FORMAT_PBM:
|
||||
if (value)
|
||||
data |= mask;
|
||||
mask >>= 1;
|
||||
|
||||
break;
|
||||
case PNM_FORMAT_PGM:
|
||||
*dptr++ = (guchar)(255.0*((double)value/(double)context->maxval));
|
||||
break;
|
||||
case PNM_FORMAT_PPM:
|
||||
*dptr++ = (guchar)(255.0*((double)value/(double)context->maxval));
|
||||
break;
|
||||
default:
|
||||
g_warning ("io-pnm.c: Illegal raw pnm type!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (context->type == PNM_FORMAT_PBM) {
|
||||
*dptr++ = data;
|
||||
context->output_col += numval;
|
||||
} else {
|
||||
context->output_col++;
|
||||
}
|
||||
|
||||
if (context->output_col == context->width) {
|
||||
if ( context->type == PNM_FORMAT_PBM )
|
||||
explode_bitmap_into_buf(context);
|
||||
else if ( context->type == PNM_FORMAT_PGM )
|
||||
explode_gray_into_buf (context);
|
||||
|
||||
context->output_col = 0;
|
||||
context->output_row++;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return PNM_OK;
|
||||
}
|
||||
|
||||
/* returns 1 if a scanline was converted, 0 means we ran out of data */
|
||||
static gint
|
||||
pnm_read_scanline (PnmLoaderContext *context)
|
||||
{
|
||||
gint rc;
|
||||
|
||||
g_return_val_if_fail (context != NULL, PNM_FATAL_ERR);
|
||||
|
||||
/* read in image data */
|
||||
/* for raw formats this is trivial */
|
||||
switch (context->type) {
|
||||
case PNM_FORMAT_PBM_RAW:
|
||||
case PNM_FORMAT_PGM_RAW:
|
||||
case PNM_FORMAT_PPM_RAW:
|
||||
rc = pnm_read_raw_scanline (context);
|
||||
if (rc == PNM_SUSPEND)
|
||||
return rc;
|
||||
break;
|
||||
|
||||
case PNM_FORMAT_PBM:
|
||||
case PNM_FORMAT_PGM:
|
||||
case PNM_FORMAT_PPM:
|
||||
rc = pnm_read_ascii_scanline (context);
|
||||
if (rc == PNM_SUSPEND)
|
||||
return rc;
|
||||
break;
|
||||
|
||||
default:
|
||||
g_warning ("Cannot load these image types (yet)\n");
|
||||
return PNM_FATAL_ERR;
|
||||
}
|
||||
|
||||
return PNM_OK;
|
||||
}
|
||||
|
||||
/* Shared library entry point */
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf__pnm_image_load (FILE *f)
|
||||
{
|
||||
gint nbytes;
|
||||
gint rc;
|
||||
|
||||
PnmLoaderContext context;
|
||||
PnmIOBuffer *inbuf;
|
||||
|
||||
/* pretend to be doing progressive loading */
|
||||
context.updated_func = NULL;
|
||||
context.prepared_func = NULL;
|
||||
context.user_data = NULL;
|
||||
context.inbuf.bytes_left = 0;
|
||||
context.inbuf.next_byte = NULL;
|
||||
context.pixels = NULL;
|
||||
context.pixbuf = NULL;
|
||||
context.got_header = context.did_prescan = FALSE;
|
||||
|
||||
inbuf = &context.inbuf;
|
||||
|
||||
while (TRUE) {
|
||||
guint num_to_read;
|
||||
|
||||
/* keep buffer as full as possible */
|
||||
num_to_read = PNM_BUF_SIZE - inbuf->bytes_left;
|
||||
|
||||
if (inbuf->next_byte != NULL && inbuf->bytes_left > 0)
|
||||
memmove (inbuf->buffer, inbuf->next_byte,
|
||||
inbuf->bytes_left);
|
||||
|
||||
nbytes = fread (inbuf->buffer+inbuf->bytes_left,
|
||||
1, num_to_read, f);
|
||||
inbuf->bytes_left += nbytes;
|
||||
inbuf->next_byte = inbuf->buffer;
|
||||
|
||||
/* ran out of data and we haven't exited main loop */
|
||||
if (inbuf->bytes_left == 0) {
|
||||
if (context.pixbuf)
|
||||
gdk_pixbuf_unref (context.pixbuf);
|
||||
g_warning ("io-pnm.c: Ran out of data...\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* get header if needed */
|
||||
if (!context.got_header) {
|
||||
|
||||
rc = pnm_read_header (&context);
|
||||
if (rc == PNM_FATAL_ERR)
|
||||
return NULL;
|
||||
else if (rc == PNM_SUSPEND)
|
||||
continue;
|
||||
|
||||
context.got_header = TRUE;
|
||||
}
|
||||
|
||||
/* scan until we hit image data */
|
||||
if (!context.did_prescan) {
|
||||
|
||||
if (skip_ahead_whitespace (inbuf) == NULL)
|
||||
continue;
|
||||
|
||||
context.did_prescan = TRUE;
|
||||
context.output_row = 0;
|
||||
context.output_col = 0;
|
||||
|
||||
context.rowstride = context.width * 3;
|
||||
context.pixels = g_malloc (context.height *
|
||||
context.width * 3);
|
||||
if (!context.pixels) {
|
||||
/* Failed to allocate memory */
|
||||
g_error ("Couldn't allocate pixel buf");
|
||||
}
|
||||
}
|
||||
|
||||
/* if we got here we're reading image data */
|
||||
while (context.output_row < context.height) {
|
||||
|
||||
rc = pnm_read_scanline (&context);
|
||||
|
||||
if (rc == PNM_SUSPEND) {
|
||||
break;
|
||||
} else if (rc == PNM_FATAL_ERR) {
|
||||
if (context.pixbuf)
|
||||
gdk_pixbuf_unref (context.pixbuf);
|
||||
g_warning ("io-pnm.c: error reading rows..\n");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (context.output_row < context.height)
|
||||
continue;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
return gdk_pixbuf_new_from_data (context.pixels, ART_PIX_RGB, FALSE,
|
||||
context.width, context.height,
|
||||
context.width * 3, free_buffer, NULL);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* func - called when we have pixmap created (but no image data)
|
||||
* user_data - passed as arg 1 to func
|
||||
* return context (opaque to user)
|
||||
*/
|
||||
|
||||
gpointer
|
||||
gdk_pixbuf__pnm_image_begin_load (ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
PnmLoaderContext *context;
|
||||
|
||||
context = g_new0 (PnmLoaderContext, 1);
|
||||
context->prepared_func = prepared_func;
|
||||
context->updated_func = updated_func;
|
||||
context->user_data = user_data;
|
||||
context->pixbuf = NULL;
|
||||
context->pixels = NULL;
|
||||
context->got_header = FALSE;
|
||||
context->did_prescan = FALSE;
|
||||
|
||||
context->inbuf.bytes_left = 0;
|
||||
context->inbuf.next_byte = NULL;
|
||||
|
||||
return (gpointer) context;
|
||||
}
|
||||
|
||||
/*
|
||||
* context - returned from image_begin_load
|
||||
*
|
||||
* free context, unref gdk_pixbuf
|
||||
*/
|
||||
void
|
||||
gdk_pixbuf__pnm_image_stop_load (gpointer data)
|
||||
{
|
||||
PnmLoaderContext *context = (PnmLoaderContext *) data;
|
||||
|
||||
g_return_if_fail (context != NULL);
|
||||
|
||||
if (context->pixbuf)
|
||||
gdk_pixbuf_unref (context->pixbuf);
|
||||
|
||||
g_free (context);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* context - from image_begin_load
|
||||
* buf - new image data
|
||||
* size - length of new image data
|
||||
*
|
||||
* append image data onto inrecrementally built output image
|
||||
*/
|
||||
gboolean
|
||||
gdk_pixbuf__pnm_image_load_increment (gpointer data, guchar *buf, guint size)
|
||||
{
|
||||
PnmLoaderContext *context = (PnmLoaderContext *)data;
|
||||
PnmIOBuffer *inbuf;
|
||||
|
||||
guchar *old_next_byte;
|
||||
guint old_bytes_left;
|
||||
guchar *bufhd;
|
||||
guint num_left, spinguard;
|
||||
gint rc;
|
||||
|
||||
g_return_val_if_fail (context != NULL, FALSE);
|
||||
g_return_val_if_fail (buf != NULL, FALSE);
|
||||
|
||||
bufhd = buf;
|
||||
inbuf = &context->inbuf;
|
||||
old_bytes_left = inbuf->bytes_left;
|
||||
old_next_byte = inbuf->next_byte;
|
||||
|
||||
num_left = size;
|
||||
spinguard = 0;
|
||||
while (TRUE) {
|
||||
guint num_to_copy;
|
||||
|
||||
/* keep buffer as full as possible */
|
||||
num_to_copy = MIN (PNM_BUF_SIZE - inbuf->bytes_left, num_left);
|
||||
|
||||
if (num_to_copy == 0)
|
||||
spinguard++;
|
||||
|
||||
if (spinguard > 1)
|
||||
return TRUE;
|
||||
|
||||
if (inbuf->next_byte != NULL && inbuf->bytes_left > 0)
|
||||
memmove (inbuf->buffer, inbuf->next_byte,
|
||||
inbuf->bytes_left);
|
||||
|
||||
memcpy (inbuf->buffer + inbuf->bytes_left, bufhd, num_to_copy);
|
||||
bufhd += num_to_copy;
|
||||
inbuf->bytes_left += num_to_copy;
|
||||
inbuf->next_byte = inbuf->buffer;
|
||||
num_left -= num_to_copy;
|
||||
|
||||
/* ran out of data and we haven't exited main loop */
|
||||
if (inbuf->bytes_left == 0)
|
||||
return TRUE;
|
||||
|
||||
/* get header if needed */
|
||||
if (!context->got_header) {
|
||||
rc = pnm_read_header (context);
|
||||
if (rc == PNM_FATAL_ERR)
|
||||
return FALSE;
|
||||
else if (rc == PNM_SUSPEND)
|
||||
continue;
|
||||
|
||||
context->got_header = TRUE;
|
||||
}
|
||||
|
||||
/* scan until we hit image data */
|
||||
if (!context->did_prescan) {
|
||||
if (skip_ahead_whitespace (inbuf) == NULL)
|
||||
continue;
|
||||
|
||||
context->did_prescan = TRUE;
|
||||
context->output_row = 0;
|
||||
context->output_col = 0;
|
||||
|
||||
context->pixbuf = gdk_pixbuf_new(ART_PIX_RGB,
|
||||
/*have_alpha*/ FALSE,
|
||||
8,
|
||||
context->width,
|
||||
context->height);
|
||||
|
||||
if (context->pixbuf == NULL) {
|
||||
/* Failed to allocate memory */
|
||||
g_error ("Couldn't allocate gdkpixbuf");
|
||||
}
|
||||
|
||||
context->pixels = context->pixbuf->art_pixbuf->pixels;
|
||||
context->rowstride = context->pixbuf->art_pixbuf->rowstride;
|
||||
|
||||
/* Notify the client that we are ready to go */
|
||||
(* context->prepared_func) (context->pixbuf,
|
||||
context->user_data);
|
||||
|
||||
}
|
||||
|
||||
/* if we got here we're reading image data */
|
||||
while (context->output_row < context->height) {
|
||||
rc = pnm_read_scanline (context);
|
||||
|
||||
if (rc == PNM_SUSPEND) {
|
||||
break;
|
||||
} else if (rc == PNM_FATAL_ERR) {
|
||||
if (context->pixbuf)
|
||||
gdk_pixbuf_unref (context->pixbuf);
|
||||
g_warning ("io-pnm.c: error reading rows..\n");
|
||||
return FALSE;
|
||||
} else if (rc == PNM_OK) {
|
||||
|
||||
/* send updated signal */
|
||||
(* context->updated_func) (context->pixbuf,
|
||||
0,
|
||||
context->output_row-1,
|
||||
context->width,
|
||||
1,
|
||||
context->user_data);
|
||||
}
|
||||
}
|
||||
|
||||
if (context->output_row < context->height)
|
||||
continue;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
444
gdk-pixbuf/io-ras.c
Normal file
444
gdk-pixbuf/io-ras.c
Normal file
@@ -0,0 +1,444 @@
|
||||
/* GdkPixbuf library - SUNRAS image loader
|
||||
*
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Authors: Arjan van de Ven <arjan@fenrus.demon.nl>
|
||||
* Federico Mena-Quintero <federico@gimp.org>
|
||||
*
|
||||
* Based on io-gif.c, io-tiff.c and io-png.c
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Known bugs:
|
||||
* Compressed rasterfiles don't work yet
|
||||
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Header structure for sunras files.
|
||||
All values are in big-endian order on disk
|
||||
|
||||
Note: Every scanline is padded to be a multiple of 16 bits
|
||||
*/
|
||||
|
||||
struct rasterfile {
|
||||
guint magic;
|
||||
guint width;
|
||||
guint height;
|
||||
guint depth;
|
||||
guint length;
|
||||
guint type;
|
||||
guint maptype;
|
||||
guint maplength;
|
||||
};
|
||||
|
||||
/*
|
||||
This does a byte-order swap. Does glib have something like
|
||||
be32_to_cpu() ??
|
||||
*/
|
||||
|
||||
/* Progressive loading */
|
||||
|
||||
struct ras_progressive_state {
|
||||
ModulePreparedNotifyFunc prepared_func;
|
||||
ModuleUpdatedNotifyFunc updated_func;
|
||||
gpointer user_data;
|
||||
|
||||
gint HeaderSize; /* The size of the header-part (incl colormap) */
|
||||
guchar *HeaderBuf; /* The buffer for the header (incl colormap) */
|
||||
gint HeaderDone; /* The nr of bytes actually in HeaderBuf */
|
||||
|
||||
gint LineWidth; /* The width of a line in bytes */
|
||||
guchar *LineBuf; /* Buffer for 1 line */
|
||||
gint LineDone; /* # of bytes in LineBuf */
|
||||
gint Lines; /* # of finished lines */
|
||||
|
||||
gint RasType; /* 32 = BGRA
|
||||
24 = BGR
|
||||
8 = 8 bit colormapped
|
||||
1 = 1 bit bitonal
|
||||
*/
|
||||
|
||||
|
||||
struct rasterfile Header; /* Decoded (BE->CPU) header */
|
||||
|
||||
|
||||
GdkPixbuf *pixbuf; /* Our "target" */
|
||||
};
|
||||
|
||||
gpointer
|
||||
gdk_pixbuf__ras_image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data);
|
||||
void gdk_pixbuf__ras_image_stop_load(gpointer data);
|
||||
gboolean gdk_pixbuf__ras_image_load_increment(gpointer data, guchar * buf, guint size);
|
||||
|
||||
|
||||
|
||||
/* Shared library entry point */
|
||||
GdkPixbuf *gdk_pixbuf__ras_image_load(FILE * f)
|
||||
{
|
||||
guchar *membuf;
|
||||
size_t length;
|
||||
struct ras_progressive_state *State;
|
||||
|
||||
GdkPixbuf *pb;
|
||||
|
||||
State = gdk_pixbuf__ras_image_begin_load(NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
membuf = g_malloc(4096);
|
||||
|
||||
g_assert(membuf != NULL);
|
||||
|
||||
while (feof(f) == 0) {
|
||||
length = fread(membuf, 1, 4096, f);
|
||||
(void)gdk_pixbuf__ras_image_load_increment(State, membuf, length);
|
||||
}
|
||||
g_free(membuf);
|
||||
if (State->pixbuf != NULL)
|
||||
gdk_pixbuf_ref(State->pixbuf);
|
||||
|
||||
pb = State->pixbuf;
|
||||
|
||||
gdk_pixbuf__ras_image_stop_load(State);
|
||||
return pb;
|
||||
}
|
||||
|
||||
static void RAS2State(struct rasterfile *RAS,
|
||||
struct ras_progressive_state *State)
|
||||
{
|
||||
State->Header.width = GUINT32_FROM_BE(RAS->width);
|
||||
State->Header.height = GUINT32_FROM_BE(RAS->height);
|
||||
State->Header.depth = GUINT32_FROM_BE(RAS->depth);
|
||||
State->Header.type = GUINT32_FROM_BE(RAS->type);
|
||||
State->Header.maptype = GUINT32_FROM_BE(RAS->maptype);
|
||||
State->Header.maplength = GUINT32_FROM_BE(RAS->maplength);
|
||||
|
||||
g_assert(State->Header.maplength <= 768); /* Otherwise, we are in trouble */
|
||||
|
||||
State->RasType = State->Header.depth; /* This may be less trivial someday */
|
||||
State->HeaderSize = 32 + State->Header.maplength;
|
||||
|
||||
if (State->RasType == 32)
|
||||
State->LineWidth = State->Header.width * 4;
|
||||
if (State->RasType == 24)
|
||||
State->LineWidth = State->Header.width * 3;
|
||||
if (State->RasType == 8)
|
||||
State->LineWidth = State->Header.width * 1;
|
||||
if (State->RasType == 1) {
|
||||
State->LineWidth = State->Header.width / 8;
|
||||
if ((State->Header.width & 7) != 0)
|
||||
State->LineWidth++;
|
||||
}
|
||||
|
||||
/* Now padd the line to be a multiple of 16 bits */
|
||||
if ((State->LineWidth & 1) != 0)
|
||||
State->LineWidth++;
|
||||
|
||||
if (State->LineBuf == NULL)
|
||||
State->LineBuf = g_malloc(State->LineWidth);
|
||||
|
||||
g_assert(State->LineBuf != NULL);
|
||||
|
||||
|
||||
if (State->pixbuf == NULL) {
|
||||
if (State->RasType == 32)
|
||||
State->pixbuf = gdk_pixbuf_new(ART_PIX_RGB, TRUE,
|
||||
8,
|
||||
(gint)
|
||||
State->Header.width,
|
||||
(gint)
|
||||
State->Header.
|
||||
height);
|
||||
else
|
||||
State->pixbuf =
|
||||
gdk_pixbuf_new(ART_PIX_RGB, FALSE, 8,
|
||||
(gint) State->Header.width,
|
||||
(gint) State->Header.height);
|
||||
if (State->prepared_func != NULL)
|
||||
/* Notify the client that we are ready to go */
|
||||
(*State->prepared_func) (State->pixbuf,
|
||||
State->user_data);
|
||||
|
||||
}
|
||||
|
||||
if ((State->Header.maplength==0)&&(State->RasType==1)) {
|
||||
State->HeaderBuf[32] = 255;
|
||||
State->HeaderBuf[33] = 0;
|
||||
State->HeaderBuf[34] = 255;
|
||||
State->HeaderBuf[35] = 0;
|
||||
State->HeaderBuf[36] = 255;
|
||||
State->HeaderBuf[37] = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* func - called when we have pixmap created (but no image data)
|
||||
* user_data - passed as arg 1 to func
|
||||
* return context (opaque to user)
|
||||
*/
|
||||
|
||||
gpointer
|
||||
gdk_pixbuf__ras_image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
struct ras_progressive_state *context;
|
||||
|
||||
context = g_new0(struct ras_progressive_state, 1);
|
||||
context->prepared_func = prepared_func;
|
||||
context->updated_func = updated_func;
|
||||
context->user_data = user_data;
|
||||
|
||||
context->HeaderSize = 32;
|
||||
context->HeaderBuf = g_malloc(32 + 768); /* 32 for rasheader,
|
||||
768 for the colormap */
|
||||
context->HeaderDone = 0;
|
||||
|
||||
context->LineWidth = 0;
|
||||
context->LineBuf = NULL;
|
||||
context->LineDone = 0;
|
||||
context->Lines = 0;
|
||||
|
||||
context->RasType = 0;
|
||||
|
||||
memset(&context->Header, 0, sizeof(struct rasterfile));
|
||||
|
||||
|
||||
context->pixbuf = NULL;
|
||||
|
||||
|
||||
return (gpointer) context;
|
||||
}
|
||||
|
||||
/*
|
||||
* context - returned from image_begin_load
|
||||
*
|
||||
* free context, unref gdk_pixbuf
|
||||
*/
|
||||
void
|
||||
gdk_pixbuf__ras_image_stop_load(gpointer data)
|
||||
{
|
||||
struct ras_progressive_state *context =
|
||||
(struct ras_progressive_state *) data;
|
||||
|
||||
|
||||
g_return_if_fail(context != NULL);
|
||||
|
||||
if (context->LineBuf != NULL)
|
||||
g_free(context->LineBuf);
|
||||
if (context->HeaderBuf != NULL)
|
||||
g_free(context->HeaderBuf);
|
||||
|
||||
if (context->pixbuf)
|
||||
gdk_pixbuf_unref(context->pixbuf);
|
||||
|
||||
g_free(context);
|
||||
}
|
||||
|
||||
/*
|
||||
OneLine is called when enough data is received to process 1 line
|
||||
of pixels
|
||||
*/
|
||||
|
||||
static void OneLine32(struct ras_progressive_state *context)
|
||||
{
|
||||
gint X;
|
||||
guchar *Pixels;
|
||||
|
||||
X = 0;
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
context->pixbuf->art_pixbuf->rowstride * context->Lines;
|
||||
while (X < context->Header.width) {
|
||||
/* The joys of having a BGR byteorder */
|
||||
Pixels[X * 4 + 0] = context->LineBuf[X * 4 + 2];
|
||||
Pixels[X * 4 + 1] = context->LineBuf[X * 4 + 1];
|
||||
Pixels[X * 4 + 2] = context->LineBuf[X * 4 + 0];
|
||||
Pixels[X * 4 + 3] = context->LineBuf[X * 4 + 3];
|
||||
X++;
|
||||
}
|
||||
}
|
||||
|
||||
static void OneLine24(struct ras_progressive_state *context)
|
||||
{
|
||||
gint X;
|
||||
guchar *Pixels;
|
||||
|
||||
X = 0;
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
context->pixbuf->art_pixbuf->rowstride * context->Lines;
|
||||
while (X < context->Header.width) {
|
||||
/* The joys of having a BGR byteorder */
|
||||
Pixels[X * 3 + 0] = context->LineBuf[X * 3 + 2];
|
||||
Pixels[X * 3 + 1] = context->LineBuf[X * 3 + 1];
|
||||
Pixels[X * 3 + 2] = context->LineBuf[X * 3 + 0];
|
||||
X++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void OneLine8(struct ras_progressive_state *context)
|
||||
{
|
||||
gint X;
|
||||
guchar *Pixels;
|
||||
|
||||
X = 0;
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
context->pixbuf->art_pixbuf->rowstride * context->Lines;
|
||||
while (X < context->Header.width) {
|
||||
/* The joys of having a BGR byteorder */
|
||||
Pixels[X * 3 + 0] =
|
||||
context->HeaderBuf[context->LineBuf[X] + 32];
|
||||
Pixels[X * 3 + 1] =
|
||||
context->HeaderBuf[context->LineBuf[X] + 256 + 32];
|
||||
Pixels[X * 3 + 2] =
|
||||
context->HeaderBuf[context->LineBuf[X] + 512 + 32];
|
||||
X++;
|
||||
}
|
||||
}
|
||||
|
||||
static void OneLine1(struct ras_progressive_state *context)
|
||||
{
|
||||
gint X;
|
||||
guchar *Pixels;
|
||||
|
||||
X = 0;
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
context->pixbuf->art_pixbuf->rowstride * context->Lines;
|
||||
while (X < context->Header.width) {
|
||||
int Bit;
|
||||
|
||||
Bit = (context->LineBuf[X/8])>>(7-(X&7));
|
||||
Bit = Bit & 1;
|
||||
/* The joys of having a BGR byteorder */
|
||||
Pixels[X * 3 + 0] =
|
||||
context->HeaderBuf[Bit + 32];
|
||||
Pixels[X * 3 + 1] =
|
||||
context->HeaderBuf[Bit + 2 + 32];
|
||||
Pixels[X * 3 + 2] =
|
||||
context->HeaderBuf[Bit + 4 + 32];
|
||||
X++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void OneLine(struct ras_progressive_state *context)
|
||||
{
|
||||
if (context->RasType == 32)
|
||||
OneLine32(context);
|
||||
if (context->RasType == 24)
|
||||
OneLine24(context);
|
||||
if (context->RasType == 8)
|
||||
OneLine8(context);
|
||||
if (context->RasType == 1)
|
||||
OneLine1(context);
|
||||
|
||||
context->LineDone = 0;
|
||||
if (context->Lines > context->Header.height)
|
||||
return;
|
||||
context->Lines++;
|
||||
|
||||
if (context->updated_func != NULL) {
|
||||
(*context->updated_func) (context->pixbuf,
|
||||
0,
|
||||
context->Lines,
|
||||
context->Header.width,
|
||||
context->Header.height,
|
||||
context->user_data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* context - from image_begin_load
|
||||
* buf - new image data
|
||||
* size - length of new image data
|
||||
*
|
||||
* append image data onto inrecrementally built output image
|
||||
*/
|
||||
gboolean
|
||||
gdk_pixbuf__ras_image_load_increment(gpointer data, guchar * buf, guint size)
|
||||
{
|
||||
struct ras_progressive_state *context =
|
||||
(struct ras_progressive_state *) data;
|
||||
|
||||
gint BytesToCopy;
|
||||
|
||||
while (size > 0) {
|
||||
if (context->HeaderDone < context->HeaderSize) { /* We still
|
||||
have headerbytes to do */
|
||||
BytesToCopy =
|
||||
context->HeaderSize - context->HeaderDone;
|
||||
if (BytesToCopy > size)
|
||||
BytesToCopy = size;
|
||||
|
||||
memmove(context->HeaderBuf + context->HeaderDone,
|
||||
buf, BytesToCopy);
|
||||
|
||||
size -= BytesToCopy;
|
||||
buf += BytesToCopy;
|
||||
context->HeaderDone += BytesToCopy;
|
||||
|
||||
} else {
|
||||
/* Pixeldata only */
|
||||
BytesToCopy =
|
||||
context->LineWidth - context->LineDone;
|
||||
if (BytesToCopy > size)
|
||||
BytesToCopy = size;
|
||||
|
||||
if (BytesToCopy > 0) {
|
||||
memmove(context->LineBuf +
|
||||
context->LineDone, buf,
|
||||
BytesToCopy);
|
||||
|
||||
size -= BytesToCopy;
|
||||
buf += BytesToCopy;
|
||||
context->LineDone += BytesToCopy;
|
||||
}
|
||||
if ((context->LineDone >= context->LineWidth) &&
|
||||
(context->LineWidth > 0))
|
||||
OneLine(context);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (context->HeaderDone >= 32)
|
||||
RAS2State((struct rasterfile *) context->HeaderBuf,
|
||||
context);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
202
gdk-pixbuf/io-tiff.c
Normal file
202
gdk-pixbuf/io-tiff.c
Normal file
@@ -0,0 +1,202 @@
|
||||
/* GdkPixbuf library - JPEG image loader
|
||||
*
|
||||
* Copyright (C) 1999 Mark Crichton
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Authors: Mark Crichton <crichton@gimp.org>
|
||||
* Federico Mena-Quintero <federico@gimp.org>
|
||||
* Jonathan Blandford <jrb@redhat.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* Following code (almost) blatantly ripped from Imlib */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <tiffio.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
|
||||
|
||||
|
||||
typedef struct _TiffData TiffData;
|
||||
struct _TiffData
|
||||
{
|
||||
ModulePreparedNotifyFunc prepare_func;
|
||||
ModuleUpdatedNotifyFunc update_func;
|
||||
gpointer user_data;
|
||||
|
||||
gchar *tempname;
|
||||
FILE *file;
|
||||
gboolean all_okay;
|
||||
};
|
||||
|
||||
|
||||
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf__tiff_image_load_real (FILE *f, TiffData *context)
|
||||
{
|
||||
TIFF *tiff;
|
||||
guchar *pixels = NULL;
|
||||
guchar *tmppix;
|
||||
gint w, h, x, y, num_pixs, fd;
|
||||
uint32 *rast, *tmp_rast;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
fd = fileno (f);
|
||||
tiff = TIFFFdOpen (fd, "libpixbuf-tiff", "r");
|
||||
|
||||
if (!tiff)
|
||||
return NULL;
|
||||
|
||||
TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &w);
|
||||
TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &h);
|
||||
num_pixs = w * h;
|
||||
pixbuf = gdk_pixbuf_new (ART_PIX_RGB, TRUE, 8, w, h);
|
||||
|
||||
if (context)
|
||||
(* context->prepare_func) (pixbuf, context->user_data);
|
||||
|
||||
/* Yes, it needs to be _TIFFMalloc... */
|
||||
rast = (uint32 *) _TIFFmalloc (num_pixs * sizeof (uint32));
|
||||
|
||||
if (!rast) {
|
||||
TIFFClose (tiff);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (TIFFReadRGBAImage (tiff, w, h, rast, 0)) {
|
||||
pixels = gdk_pixbuf_get_pixels (pixbuf);
|
||||
if (!pixels) {
|
||||
_TIFFfree (rast);
|
||||
TIFFClose (tiff);
|
||||
return NULL;
|
||||
}
|
||||
tmppix = pixels;
|
||||
|
||||
for (y = 0; y < h; y++) {
|
||||
/* Unexplainable...are tiffs backwards? */
|
||||
/* Also looking at the GIMP plugin, this
|
||||
* whole reading thing can be a bit more
|
||||
* robust.
|
||||
*/
|
||||
tmp_rast = rast + ((h - y - 1) * w);
|
||||
for (x = 0; x < w; x++) {
|
||||
tmppix[0] = TIFFGetR (*tmp_rast);
|
||||
tmppix[1] = TIFFGetG (*tmp_rast);
|
||||
tmppix[2] = TIFFGetB (*tmp_rast);
|
||||
tmppix[3] = TIFFGetA (*tmp_rast);
|
||||
tmp_rast++;
|
||||
tmppix += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
_TIFFfree (rast);
|
||||
TIFFClose (tiff);
|
||||
|
||||
if (context) {
|
||||
(* context->update_func) (pixbuf, 0, 0, w, h, context->user_data);
|
||||
gdk_pixbuf_unref (pixbuf);
|
||||
}
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Static loader */
|
||||
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf__tiff_image_load (FILE *f)
|
||||
{
|
||||
return gdk_pixbuf__tiff_image_load_real (f, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Progressive loader */
|
||||
/*
|
||||
* Tiff loading progressively cannot be done. We write it to a file, then load
|
||||
* the file when it's done. It's not pretty.
|
||||
*/
|
||||
|
||||
|
||||
gpointer
|
||||
gdk_pixbuf__tiff_image_begin_load (ModulePreparedNotifyFunc prepare_func,
|
||||
ModuleUpdatedNotifyFunc update_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
TiffData *context;
|
||||
gint fd;
|
||||
|
||||
context = g_new (TiffData, 1);
|
||||
context->prepare_func = prepare_func;
|
||||
context->update_func = update_func;
|
||||
context->user_data = user_data;
|
||||
context->all_okay = TRUE;
|
||||
context->tempname = g_strdup ("/tmp/gdkpixbuf-tif-tmp.XXXXXX");
|
||||
fd = mkstemp (context->tempname);
|
||||
if (fd < 0) {
|
||||
g_free (context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
context->file = fdopen (fd, "w");
|
||||
if (context->file == NULL) {
|
||||
g_free (context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_pixbuf__tiff_image_stop_load (gpointer data)
|
||||
{
|
||||
TiffData *context = (TiffData*) data;
|
||||
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
fflush (context->file);
|
||||
rewind (context->file);
|
||||
if (context->all_okay)
|
||||
gdk_pixbuf__tiff_image_load_real (context->file, context);
|
||||
|
||||
fclose (context->file);
|
||||
unlink (context->tempname);
|
||||
g_free ((TiffData *) context);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_pixbuf__tiff_image_load_increment (gpointer data, guchar *buf, guint size)
|
||||
{
|
||||
TiffData *context = (TiffData *) data;
|
||||
|
||||
g_return_val_if_fail (data != NULL, FALSE);
|
||||
|
||||
if (fwrite (buf, sizeof (guchar), size, context->file) != size) {
|
||||
context->all_okay = FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
465
gdk-pixbuf/io-xpm.c
Normal file
465
gdk-pixbuf/io-xpm.c
Normal file
@@ -0,0 +1,465 @@
|
||||
/* GdkPixbuf library - JPEG image loader
|
||||
*
|
||||
* Copyright (C) 1999 Mark Crichton
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Authors: Mark Crichton <crichton@gimp.org>
|
||||
* Federico Mena-Quintero <federico@gimp.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
|
||||
|
||||
|
||||
/* I have must have done something to deserve this.
|
||||
* XPM is such a crappy format to handle.
|
||||
* This code is an ugly hybred from gdkpixmap.c
|
||||
* modified to respect transparent colors.
|
||||
* It's still a mess, though.
|
||||
*/
|
||||
|
||||
enum buf_op {
|
||||
op_header,
|
||||
op_cmap,
|
||||
op_body
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
gchar *color_string;
|
||||
GdkColor color;
|
||||
gint transparent;
|
||||
} _XPMColor;
|
||||
|
||||
struct file_handle {
|
||||
FILE *infile;
|
||||
gchar *buffer;
|
||||
guint buffer_size;
|
||||
};
|
||||
|
||||
struct mem_handle {
|
||||
const gchar **data;
|
||||
int offset;
|
||||
};
|
||||
|
||||
static gint
|
||||
xpm_seek_string (FILE *infile, const gchar *str, gint skip_comments)
|
||||
{
|
||||
char instr[1024];
|
||||
|
||||
while (!feof (infile)) {
|
||||
fscanf (infile, "%1023s", instr);
|
||||
if (skip_comments == TRUE && strcmp (instr, "/*") == 0) {
|
||||
fscanf (infile, "%1023s", instr);
|
||||
while (!feof (infile) && strcmp (instr, "*/") != 0)
|
||||
fscanf (infile, "%1023s", instr);
|
||||
fscanf (infile, "%1023s", instr);
|
||||
}
|
||||
|
||||
if (strcmp (instr, str) == 0)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
xpm_seek_char (FILE *infile, gchar c)
|
||||
{
|
||||
gint b, oldb;
|
||||
|
||||
while ((b = getc (infile)) != EOF) {
|
||||
if (c != b && b == '/') {
|
||||
b = getc (infile);
|
||||
if (b == EOF)
|
||||
return FALSE;
|
||||
|
||||
else if (b == '*') { /* we have a comment */
|
||||
b = -1;
|
||||
do {
|
||||
oldb = b;
|
||||
b = getc (infile);
|
||||
if (b == EOF)
|
||||
return FALSE;
|
||||
} while (!(oldb == '*' && b == '/'));
|
||||
}
|
||||
} else if (c == b)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
xpm_read_string (FILE *infile, gchar **buffer, guint *buffer_size)
|
||||
{
|
||||
gint c;
|
||||
guint cnt = 0, bufsiz, ret = FALSE;
|
||||
gchar *buf;
|
||||
|
||||
buf = *buffer;
|
||||
bufsiz = *buffer_size;
|
||||
if (buf == NULL) {
|
||||
bufsiz = 10 * sizeof (gchar);
|
||||
buf = g_new (gchar, bufsiz);
|
||||
}
|
||||
|
||||
do {
|
||||
c = getc (infile);
|
||||
} while (c != EOF && c != '"');
|
||||
|
||||
if (c != '"')
|
||||
goto out;
|
||||
|
||||
while ((c = getc (infile)) != EOF) {
|
||||
if (cnt == bufsiz) {
|
||||
guint new_size = bufsiz * 2;
|
||||
|
||||
if (new_size > bufsiz)
|
||||
bufsiz = new_size;
|
||||
else
|
||||
goto out;
|
||||
|
||||
buf = g_realloc (buf, bufsiz);
|
||||
buf[bufsiz - 1] = '\0';
|
||||
}
|
||||
|
||||
if (c != '"')
|
||||
buf[cnt++] = c;
|
||||
else {
|
||||
buf[cnt] = 0;
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
buf[bufsiz - 1] = '\0'; /* ensure null termination for errors */
|
||||
*buffer = buf;
|
||||
*buffer_size = bufsiz;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
xpm_skip_whitespaces (const gchar *buffer)
|
||||
{
|
||||
gint32 index = 0;
|
||||
|
||||
while (buffer[index] != 0 && (buffer[index] == 0x20 || buffer[index] == 0x09))
|
||||
index++;
|
||||
|
||||
return &buffer[index];
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
xpm_skip_string (const gchar *buffer)
|
||||
{
|
||||
gint32 index = 0;
|
||||
|
||||
while (buffer[index] != 0 && buffer[index] != 0x20 && buffer[index] != 0x09)
|
||||
index++;
|
||||
|
||||
return &buffer[index];
|
||||
}
|
||||
|
||||
/* Xlib crashed once at a color name lengths around 125 */
|
||||
#define MAX_COLOR_LEN 120
|
||||
|
||||
static gchar *
|
||||
xpm_extract_color (const gchar *buffer)
|
||||
{
|
||||
gint counter, numnames;
|
||||
const gchar *ptr = NULL;
|
||||
gchar ch, temp[128];
|
||||
gchar color[MAX_COLOR_LEN], *retcol;
|
||||
gint space;
|
||||
|
||||
counter = 0;
|
||||
while (ptr == NULL) {
|
||||
if ((buffer[counter] == 'c') || (buffer[counter] == 'g')) {
|
||||
ch = buffer[counter + 1];
|
||||
if (ch == 0x20 || ch == 0x09)
|
||||
ptr = &buffer[counter + 1];
|
||||
} else if (buffer[counter] == 0)
|
||||
return NULL;
|
||||
|
||||
counter++;
|
||||
}
|
||||
ptr = xpm_skip_whitespaces (ptr);
|
||||
|
||||
if (ptr[0] == 0)
|
||||
return NULL;
|
||||
else if (ptr[0] == '#') {
|
||||
counter = 1;
|
||||
while (ptr[counter] != 0 &&
|
||||
((ptr[counter] >= '0' && ptr[counter] <= '9') ||
|
||||
(ptr[counter] >= 'a' && ptr[counter] <= 'f') ||
|
||||
(ptr[counter] >= 'A' && ptr[counter] <= 'F')))
|
||||
counter++;
|
||||
retcol = g_new (gchar, counter + 1);
|
||||
strncpy (retcol, ptr, counter);
|
||||
|
||||
retcol[counter] = 0;
|
||||
|
||||
return retcol;
|
||||
}
|
||||
color[0] = 0;
|
||||
numnames = 0;
|
||||
|
||||
space = MAX_COLOR_LEN - 1;
|
||||
while (space > 0) {
|
||||
sscanf (ptr, "%127s", temp);
|
||||
|
||||
if (((gint) ptr[0] == 0) ||
|
||||
(strcmp ("s", temp) == 0) || (strcmp ("m", temp) == 0) ||
|
||||
(strcmp ("g", temp) == 0) || (strcmp ("g4", temp) == 0))
|
||||
break;
|
||||
else {
|
||||
if (numnames > 0) {
|
||||
space -= 1;
|
||||
strcat (color, " ");
|
||||
}
|
||||
|
||||
strncat (color, temp, space);
|
||||
space -= MIN (space, strlen (temp));
|
||||
ptr = xpm_skip_string (ptr);
|
||||
ptr = xpm_skip_whitespaces (ptr);
|
||||
numnames++;
|
||||
}
|
||||
}
|
||||
|
||||
retcol = g_strdup (color);
|
||||
return retcol;
|
||||
}
|
||||
|
||||
/* (almost) direct copy from gdkpixmap.c... loads an XPM from a file */
|
||||
|
||||
static const gchar *
|
||||
file_buffer (enum buf_op op, gpointer handle)
|
||||
{
|
||||
struct file_handle *h = handle;
|
||||
|
||||
switch (op) {
|
||||
case op_header:
|
||||
if (xpm_seek_string (h->infile, "XPM", FALSE) != TRUE)
|
||||
break;
|
||||
|
||||
if (xpm_seek_char (h->infile, '{') != TRUE)
|
||||
break;
|
||||
/* Fall through to the next xpm_seek_char. */
|
||||
|
||||
case op_cmap:
|
||||
xpm_seek_char (h->infile, '"');
|
||||
fseek (h->infile, -1, SEEK_CUR);
|
||||
/* Fall through to the xpm_read_string. */
|
||||
|
||||
case op_body:
|
||||
xpm_read_string (h->infile, &h->buffer, &h->buffer_size);
|
||||
return h->buffer;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* This reads from memory */
|
||||
static const gchar *
|
||||
mem_buffer (enum buf_op op, gpointer handle)
|
||||
{
|
||||
struct mem_handle *h = handle;
|
||||
switch (op) {
|
||||
case op_header:
|
||||
case op_cmap:
|
||||
case op_body:
|
||||
if (h->data[h->offset]) {
|
||||
const gchar* retval;
|
||||
|
||||
retval = h->data[h->offset];
|
||||
h->offset += 1;
|
||||
return retval;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Destroy notification function for the libart pixbuf */
|
||||
static void
|
||||
free_buffer (gpointer user_data, gpointer data)
|
||||
{
|
||||
free (data);
|
||||
}
|
||||
|
||||
/* This function does all the work. */
|
||||
static GdkPixbuf *
|
||||
pixbuf_create_from_xpm (const gchar * (*get_buf) (enum buf_op op, gpointer handle), gpointer handle)
|
||||
{
|
||||
gint w, h, n_col, cpp;
|
||||
gint cnt, xcnt, ycnt, wbytes, n, ns;
|
||||
gint is_trans = FALSE;
|
||||
const gchar *buffer;
|
||||
gchar *name_buf;
|
||||
gchar pixel_str[32];
|
||||
GHashTable *color_hash;
|
||||
_XPMColor *colors, *color, *fallbackcolor;
|
||||
guchar *pixels, *pixtmp;
|
||||
|
||||
fallbackcolor = NULL;
|
||||
|
||||
buffer = (*get_buf) (op_header, handle);
|
||||
if (!buffer) {
|
||||
g_warning ("No XPM header found");
|
||||
return NULL;
|
||||
}
|
||||
sscanf (buffer, "%d %d %d %d", &w, &h, &n_col, &cpp);
|
||||
if (cpp >= 32) {
|
||||
g_warning ("XPM has more than 31 chars per pixel.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* The hash is used for fast lookups of color from chars */
|
||||
color_hash = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
name_buf = g_new (gchar, n_col * (cpp + 1));
|
||||
colors = g_new (_XPMColor, n_col);
|
||||
|
||||
for (cnt = 0; cnt < n_col; cnt++) {
|
||||
gchar *color_name;
|
||||
|
||||
buffer = (*get_buf) (op_cmap, handle);
|
||||
if (!buffer) {
|
||||
g_warning ("Can't load XPM colormap");
|
||||
g_hash_table_destroy (color_hash);
|
||||
g_free (name_buf);
|
||||
g_free (colors);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
color = &colors[cnt];
|
||||
color->color_string = &name_buf[cnt * (cpp + 1)];
|
||||
strncpy (color->color_string, buffer, cpp);
|
||||
color->color_string[cpp] = 0;
|
||||
buffer += strlen (color->color_string);
|
||||
color->transparent = FALSE;
|
||||
|
||||
color_name = xpm_extract_color (buffer);
|
||||
|
||||
if ((color_name == NULL) || (g_strcasecmp (color_name, "None") == 0)
|
||||
|| (gdk_color_parse (color_name, &color->color) == FALSE)) {
|
||||
color->transparent = TRUE;
|
||||
is_trans = TRUE;
|
||||
}
|
||||
|
||||
g_free (color_name);
|
||||
g_hash_table_insert (color_hash, color->color_string, color);
|
||||
|
||||
if (cnt == 0)
|
||||
fallbackcolor = color;
|
||||
}
|
||||
|
||||
if (is_trans)
|
||||
pixels = malloc (w * h * 4);
|
||||
else
|
||||
pixels = malloc (w * h * 3);
|
||||
|
||||
if (!pixels) {
|
||||
g_hash_table_destroy (color_hash);
|
||||
g_free (colors);
|
||||
g_free (name_buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wbytes = w * cpp;
|
||||
pixtmp = pixels;
|
||||
|
||||
for (ycnt = 0; ycnt < h; ycnt++) {
|
||||
buffer = (*get_buf) (op_body, handle);
|
||||
if ((!buffer) || (strlen (buffer) < wbytes))
|
||||
continue;
|
||||
|
||||
for (n = 0, cnt = 0, xcnt = 0; n < wbytes; n += cpp, xcnt++) {
|
||||
strncpy (pixel_str, &buffer[n], cpp);
|
||||
pixel_str[cpp] = 0;
|
||||
ns = 0;
|
||||
|
||||
color = g_hash_table_lookup (color_hash, pixel_str);
|
||||
|
||||
/* Bad XPM...punt */
|
||||
if (!color)
|
||||
color = fallbackcolor;
|
||||
|
||||
*pixtmp++ = color->color.red >> 8;
|
||||
*pixtmp++ = color->color.green >> 8;
|
||||
*pixtmp++ = color->color.blue >> 8;
|
||||
|
||||
if (is_trans && color->transparent)
|
||||
*pixtmp++ = 0;
|
||||
else if (is_trans)
|
||||
*pixtmp++ = 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
g_hash_table_destroy (color_hash);
|
||||
g_free (colors);
|
||||
g_free (name_buf);
|
||||
|
||||
return gdk_pixbuf_new_from_data (pixels, ART_PIX_RGB, is_trans,
|
||||
w, h, is_trans ? (w * 4) : (w * 3),
|
||||
free_buffer, NULL);
|
||||
}
|
||||
|
||||
/* Shared library entry point for file loading */
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf__xpm_image_load (FILE *f)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
struct file_handle h;
|
||||
|
||||
memset (&h, 0, sizeof (h));
|
||||
h.infile = f;
|
||||
pixbuf = pixbuf_create_from_xpm (file_buffer, &h);
|
||||
g_free (h.buffer);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
/* Shared library entry point for memory loading */
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf__xpm_image_load_xpm_data (const gchar **data)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
struct mem_handle h;
|
||||
|
||||
h.data = data;
|
||||
h.offset = 0;
|
||||
|
||||
pixbuf = pixbuf_create_from_xpm (mem_buffer, &h);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
7
gdk-pixbuf/pixops/.cvsignore
Normal file
7
gdk-pixbuf/pixops/.cvsignore
Normal file
@@ -0,0 +1,7 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
.libs
|
||||
.deps
|
||||
*.lo
|
||||
*.la
|
||||
timescale
|
||||
22
gdk-pixbuf/pixops/Makefile.am
Normal file
22
gdk-pixbuf/pixops/Makefile.am
Normal file
@@ -0,0 +1,22 @@
|
||||
noinst_LTLIBRARIES = libpixops.la
|
||||
|
||||
INCLUDES = $(GLIB_CFLAGS) $(LIBART_CFLAGS)
|
||||
|
||||
noinst_PROGRAMS = timescale
|
||||
|
||||
timescale_SOURCES = timescale.c
|
||||
timescale_LDADD = libpixops.la $(GLIB_LIBS) -lm
|
||||
|
||||
if USE_MMX
|
||||
mmx_sources = \
|
||||
have_mmx.S \
|
||||
scale_line_22_33_mmx.S \
|
||||
composite_line_22_4a4_mmx.S \
|
||||
composite_line_color_22_4a4_mmx.S
|
||||
endif
|
||||
|
||||
libpixops_la_SOURCES = \
|
||||
pixops.c \
|
||||
pixops.h \
|
||||
pixops-internal.h \
|
||||
$(mmx_sources)
|
||||
110
gdk-pixbuf/pixops/README
Normal file
110
gdk-pixbuf/pixops/README
Normal file
@@ -0,0 +1,110 @@
|
||||
The code in this directory implements optimized, filtered scaling
|
||||
for pixmap data.
|
||||
|
||||
This code is copyright Red Hat, Inc, 2000 and licensed under the terms
|
||||
of the GNU Lesser General Public License (LGPL).
|
||||
|
||||
(If you want to use it in a project where that license is not
|
||||
appropriate, please contact me, and most likely something can be
|
||||
worked out.)
|
||||
|
||||
Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
PRINCIPLES
|
||||
==========
|
||||
|
||||
The general principle of this code is that it first computes a filter
|
||||
matrix for the given filtering mode, and then calls a general driver
|
||||
routine, passing in functions to composite pixels and lines.
|
||||
|
||||
(The pixel functions are used for handling edge cases, and the line
|
||||
functions are simply used for the middle parts of the image.)
|
||||
|
||||
The system is designed so that the line functions can be simple,
|
||||
don't have to worry about special cases, can be selected to
|
||||
be specific to the particular formats involved. This allows them
|
||||
to be hyper-optimized. Since most of the compution time is
|
||||
spent in these functions, this results in an overall fast design.
|
||||
|
||||
MMX assembly code for Intel (and compatible) processors is included
|
||||
for a number of the most common special cases:
|
||||
|
||||
scaling from RGB to RGB
|
||||
compositing from RGBA to RGBx
|
||||
compositing against a color from RGBA and storing in a RGBx buffer
|
||||
|
||||
TODO
|
||||
====
|
||||
|
||||
* ART_FILTER_HYPER is not correctly implemented. It is currently
|
||||
implemented as a filter that is derived by doing linear interpolation
|
||||
on the source image and then averaging that with a box filter.
|
||||
|
||||
It should be defined as followed (see art_filterlevel.h)
|
||||
|
||||
"HYPER is the highest quality reconstruction function. It is derived
|
||||
from the hyperbolic filters in Wolberg's "Digital Image Warping,"
|
||||
and is formally defined as the hyperbolic-filter sampling the ideal
|
||||
hyperbolic-filter interpolated image (the filter is designed to be
|
||||
idempotent for 1:1 pixel mapping). It is the slowest and highest
|
||||
quality."
|
||||
|
||||
The current HYPER is probably as slow, but lower quality. Also, there
|
||||
are some subtle errors in the calculation current HYPER that show up as dark
|
||||
stripes if you scale a constant-color image.
|
||||
|
||||
* There are some roundoff errors in the compositing routines.
|
||||
the _nearest() variants do it right, most of the other code
|
||||
is wrong to some degree or another.
|
||||
|
||||
For instance, in composite line, we have:
|
||||
|
||||
dest[0] = ((0xff0000 - a) * dest[0] + r) >> 24;
|
||||
|
||||
if a is 0, then we have:
|
||||
|
||||
(0xff0000 * dest[0] + r) >> 24
|
||||
|
||||
which gives results which are 1 to low:
|
||||
|
||||
255 => 254, 1 => 0.
|
||||
|
||||
So, this should be something like:
|
||||
|
||||
((0xff0000 - a) * dest[0] + r + 0xffffff) >> 24;
|
||||
|
||||
(Not checked, caveat emptor)
|
||||
|
||||
An alternatve formulation of this as:
|
||||
|
||||
dest[0] + (r - a * dest[0] + 0xffffff) >> 24
|
||||
|
||||
may be better numerically, but would need consideration for overflow.
|
||||
|
||||
* The generic functions could be sped up considerably by
|
||||
switching around conditionals and inner loops in various
|
||||
places.
|
||||
|
||||
* Right now, in several of the most common cases, there are
|
||||
optimized mmx routines, but no optimized C routines.
|
||||
|
||||
For instance, there is a
|
||||
|
||||
pixops_composite_line_22_4a4_mmx()
|
||||
|
||||
But no
|
||||
|
||||
pixops_composite_line_22_4a4()
|
||||
|
||||
Also, it may be desirable to include a few more special cases - in particular:
|
||||
|
||||
pixops_composite_line_22_4a3()
|
||||
|
||||
May be desirable.
|
||||
|
||||
* Scaling down images by large scale factors is _slow_ since huge filter
|
||||
matrixes are computed. (e.g., to scale down by a factor of 100, we compute
|
||||
101x101 filter matrixes. At some point, it would be more efficent to
|
||||
switch over to subsampling when scaling down - one should never need a filter
|
||||
matrix bigger than 16x16.
|
||||
|
||||
208
gdk-pixbuf/pixops/composite_line_22_4a4_mmx.S
Normal file
208
gdk-pixbuf/pixops/composite_line_22_4a4_mmx.S
Normal file
@@ -0,0 +1,208 @@
|
||||
.file "composite_line_22_4a4_mmx.S"
|
||||
.version "01.01"
|
||||
gcc2_compiled.:
|
||||
.text
|
||||
.align 16
|
||||
.globl pixops_composite_line_22_4a4_mmx
|
||||
.type pixops_composite_line_22_4a4_mmx,@function
|
||||
/*
|
||||
* Arguments
|
||||
*
|
||||
* weights: 8(%ebp)
|
||||
* p: 12(%ebp) %esi
|
||||
* q1: 16(%ebp)
|
||||
* q2: 20(%ebp)
|
||||
* xstep: 24(%ebp)
|
||||
* p_end: 28(%ebp)
|
||||
* xinit: 32(%ebp)
|
||||
*
|
||||
*/
|
||||
pixops_composite_line_22_4a4_mmx:
|
||||
/*
|
||||
* Function call entry
|
||||
*/
|
||||
pushl %ebp
|
||||
movl %esp,%ebp
|
||||
subl $28,%esp
|
||||
pushl %edi
|
||||
pushl %esi
|
||||
pushl %ebx
|
||||
/* Locals:
|
||||
* int x %ebx
|
||||
* int x_scaled -24(%ebp)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Setup
|
||||
*/
|
||||
/* Initialize variables */
|
||||
movl 32(%ebp),%ebx
|
||||
movl 32(%ebp),%edx
|
||||
sarl $16,%edx
|
||||
movl 12(%ebp),%esi
|
||||
|
||||
movl %edx,-24(%ebp)
|
||||
|
||||
cmpl %esi,28(%ebp)
|
||||
je .out
|
||||
|
||||
/* Load initial values into %mm1, %mm3 */
|
||||
shll $2, %edx
|
||||
|
||||
pxor %mm4, %mm4
|
||||
|
||||
movl 16(%ebp),%edi
|
||||
movl (%edi, %edx), %eax
|
||||
movd (%edi, %edx), %mm5
|
||||
punpcklbw %mm4, %mm5
|
||||
shrl $24, %eax
|
||||
movl $0x010101, %ecx
|
||||
mull %ecx
|
||||
orl $0xff000000, %eax
|
||||
movd %eax, %mm1
|
||||
punpcklbw %mm4, %mm1
|
||||
pmullw %mm5,%mm1
|
||||
|
||||
movl -24(%ebp),%edx
|
||||
shll $2, %edx
|
||||
|
||||
movl 20(%ebp),%edi
|
||||
movl (%edi, %edx), %eax
|
||||
movd (%edi, %edx), %mm5
|
||||
punpcklbw %mm4, %mm5
|
||||
shrl $24, %eax
|
||||
movl $0x010101, %ecx
|
||||
mull %ecx
|
||||
orl $0xff000000, %eax
|
||||
movd %eax, %mm3
|
||||
punpcklbw %mm4, %mm3
|
||||
pmullw %mm5,%mm3
|
||||
|
||||
psrlw $8,%mm1
|
||||
psrlw $8,%mm3
|
||||
|
||||
addl $65536,%ebx
|
||||
movl %ebx,%edx
|
||||
sarl $16,%edx
|
||||
|
||||
jmp .newx
|
||||
.p2align 4,,7
|
||||
.loop:
|
||||
/* int x_index = (x & 0xf000) >> 12 */
|
||||
movl %ebx,%eax
|
||||
andl $0xf000,%eax
|
||||
shrl $7,%eax
|
||||
|
||||
movq (%edi,%eax),%mm4
|
||||
pmullw %mm0,%mm4
|
||||
movq 8(%edi,%eax),%mm5
|
||||
pmullw %mm1,%mm5
|
||||
movq 16(%edi,%eax),%mm6
|
||||
movq 24(%edi,%eax),%mm7
|
||||
pmullw %mm2,%mm6
|
||||
pmullw %mm3,%mm7
|
||||
paddw %mm4, %mm5
|
||||
paddw %mm6, %mm7
|
||||
paddw %mm5, %mm7
|
||||
|
||||
movl $0xffff,%ecx
|
||||
movd %ecx,%mm4
|
||||
psllq $48,%mm4
|
||||
movq %mm4,%mm6
|
||||
psubw %mm7,%mm4
|
||||
pand %mm6,%mm4
|
||||
|
||||
movq %mm4,%mm5
|
||||
psrlq $16,%mm4
|
||||
por %mm4,%mm5
|
||||
psrlq $32,%mm5
|
||||
por %mm4,%mm5
|
||||
|
||||
psrlw $8,%mm5
|
||||
|
||||
movd (%esi),%mm7
|
||||
pxor %mm4,%mm4
|
||||
punpcklbw %mm4, %mm7
|
||||
|
||||
pmullw %mm7,%mm5
|
||||
|
||||
/* x += x_step; */
|
||||
addl 24(%ebp),%ebx
|
||||
/* x_scale = x >> 16; */
|
||||
movl %ebx,%edx
|
||||
sarl $16,%edx
|
||||
|
||||
paddw %mm5,%mm6
|
||||
|
||||
psrlw $8,%mm6
|
||||
packuswb %mm6, %mm6
|
||||
movd %mm6,(%esi)
|
||||
|
||||
addl $4, %esi
|
||||
|
||||
cmpl %esi,28(%ebp)
|
||||
je .out
|
||||
|
||||
cmpl %edx,-24(%ebp)
|
||||
je .loop
|
||||
|
||||
.newx:
|
||||
movl %edx,-24(%ebp)
|
||||
/*
|
||||
* Load the two new values into %mm1, %mm3, move old values into %mm0, %mm2
|
||||
*/
|
||||
movq %mm1, %mm0
|
||||
movq %mm3, %mm2
|
||||
|
||||
shll $2, %edx
|
||||
|
||||
# %mm4 will always be already clear here
|
||||
# pxor %mm4, %mm4
|
||||
|
||||
movl 16(%ebp),%edi
|
||||
movl (%edi, %edx), %eax
|
||||
movd (%edi, %edx), %mm5
|
||||
punpcklbw %mm4, %mm5
|
||||
shrl $24, %eax
|
||||
movl $0x010101, %ecx
|
||||
mull %ecx
|
||||
/*
|
||||
* mull destroyed %edx, need to reconstitute
|
||||
*/
|
||||
movl -24(%ebp),%edx
|
||||
shll $2, %edx
|
||||
|
||||
orl $0xff000000, %eax
|
||||
movd %eax, %mm1
|
||||
punpcklbw %mm4, %mm1
|
||||
pmullw %mm5,%mm1
|
||||
|
||||
movl 20(%ebp),%edi
|
||||
movl (%edi, %edx), %eax
|
||||
movd (%edi, %edx), %mm5
|
||||
punpcklbw %mm4, %mm5
|
||||
shrl $24, %eax
|
||||
movl $0x010101, %ecx
|
||||
mull %ecx
|
||||
orl $0xff000000, %eax
|
||||
movd %eax, %mm3
|
||||
punpcklbw %mm4, %mm3
|
||||
pmullw %mm5,%mm3
|
||||
|
||||
psrlw $8,%mm1
|
||||
psrlw $8,%mm3
|
||||
|
||||
movl 8(%ebp),%edi
|
||||
|
||||
jmp .loop
|
||||
|
||||
.out:
|
||||
movl %esi,%eax
|
||||
emms
|
||||
leal -40(%ebp),%esp
|
||||
popl %ebx
|
||||
popl %esi
|
||||
popl %edi
|
||||
movl %ebp,%esp
|
||||
popl %ebp
|
||||
ret
|
||||
219
gdk-pixbuf/pixops/composite_line_color_22_4a4_mmx.S
Normal file
219
gdk-pixbuf/pixops/composite_line_color_22_4a4_mmx.S
Normal file
@@ -0,0 +1,219 @@
|
||||
.file "composite_line_color_22_4a4_mmx.S"
|
||||
.version "01.01"
|
||||
gcc2_compiled.:
|
||||
.text
|
||||
.align 16
|
||||
.globl pixops_composite_line_color_22_4a4_mmx
|
||||
.type pixops_composite_line_color_22_4a4_mmx,@function
|
||||
/*
|
||||
* Arguments
|
||||
*
|
||||
* weights: 8(%ebp)
|
||||
* p: 12(%ebp) %esi
|
||||
* q1: 16(%ebp)
|
||||
* q2: 20(%ebp)
|
||||
* xstep: 24(%ebp)
|
||||
* p_end: 28(%ebp)
|
||||
* xinit: 32(%ebp)
|
||||
* dest_x: 36(%ebp)
|
||||
* check_shift: 40(%ebp)
|
||||
* colors: 44(%ebp)
|
||||
*
|
||||
*/
|
||||
pixops_composite_line_color_22_4a4_mmx:
|
||||
/*
|
||||
* Function call entry
|
||||
*/
|
||||
pushl %ebp
|
||||
movl %esp,%ebp
|
||||
subl $28,%esp
|
||||
pushl %edi
|
||||
pushl %esi
|
||||
pushl %ebx
|
||||
/* Locals:
|
||||
* int x %ebx
|
||||
* int x_scaled -24(%ebp)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Setup
|
||||
*/
|
||||
/* Initialize variables */
|
||||
movl 32(%ebp),%ebx
|
||||
movl 32(%ebp),%edx
|
||||
sarl $16,%edx
|
||||
movl 12(%ebp),%esi
|
||||
|
||||
movl %edx,-24(%ebp)
|
||||
|
||||
cmpl %esi,28(%ebp)
|
||||
je .out
|
||||
|
||||
/* Load initial values into %mm1, %mm3 */
|
||||
shll $2, %edx
|
||||
|
||||
pxor %mm4, %mm4
|
||||
|
||||
movl 16(%ebp),%edi
|
||||
movl (%edi, %edx), %eax
|
||||
movd (%edi, %edx), %mm5
|
||||
punpcklbw %mm4, %mm5
|
||||
shrl $24, %eax
|
||||
movl $0x010101, %ecx
|
||||
mull %ecx
|
||||
orl $0xff000000, %eax
|
||||
movd %eax, %mm1
|
||||
punpcklbw %mm4, %mm1
|
||||
pmullw %mm5,%mm1
|
||||
|
||||
/*
|
||||
* mull destroyed %edx, need to reconstitute
|
||||
*/
|
||||
movl -24(%ebp),%edx
|
||||
shll $2, %edx
|
||||
|
||||
movl 20(%ebp),%edi
|
||||
movl (%edi, %edx), %eax
|
||||
movd (%edi, %edx), %mm5
|
||||
punpcklbw %mm4, %mm5
|
||||
shrl $24, %eax
|
||||
movl $0x010101, %ecx
|
||||
mull %ecx
|
||||
orl $0xff000000, %eax
|
||||
movd %eax, %mm3
|
||||
punpcklbw %mm4, %mm3
|
||||
pmullw %mm5,%mm3
|
||||
|
||||
psrlw $8,%mm1
|
||||
psrlw $8,%mm3
|
||||
|
||||
addl $65536,%ebx
|
||||
movl %ebx,%edx
|
||||
sarl $16,%edx
|
||||
|
||||
jmp .newx
|
||||
.p2align 4,,7
|
||||
.loop:
|
||||
/* int x_index = (x & 0xf000) >> 12 */
|
||||
movl %ebx,%eax
|
||||
andl $0xf000,%eax
|
||||
shrl $7,%eax
|
||||
|
||||
movq (%edi,%eax),%mm4
|
||||
pmullw %mm0,%mm4
|
||||
movq 8(%edi,%eax),%mm5
|
||||
pmullw %mm1,%mm5
|
||||
movq 16(%edi,%eax),%mm6
|
||||
movq 24(%edi,%eax),%mm7
|
||||
pmullw %mm2,%mm6
|
||||
pmullw %mm3,%mm7
|
||||
paddw %mm4, %mm5
|
||||
paddw %mm6, %mm7
|
||||
paddw %mm5, %mm7
|
||||
|
||||
movl $0xffff,%ecx
|
||||
movd %ecx,%mm4
|
||||
psllq $48,%mm4
|
||||
movq %mm4,%mm6
|
||||
psubw %mm7,%mm4
|
||||
pand %mm6,%mm4
|
||||
|
||||
movq %mm4,%mm5
|
||||
psrlq $16,%mm4
|
||||
por %mm4,%mm5
|
||||
psrlq $32,%mm5
|
||||
por %mm4,%mm5
|
||||
|
||||
psrlw $8,%mm5
|
||||
|
||||
movl 36(%ebp),%eax
|
||||
incl 36(%ebp)
|
||||
|
||||
movl 40(%ebp),%ecx
|
||||
shrl %cl,%eax
|
||||
andl $1,%eax
|
||||
|
||||
movl 44(%ebp),%ecx
|
||||
movq (%ecx,%eax,8),%mm6
|
||||
|
||||
pmullw %mm6,%mm5
|
||||
|
||||
/* x += x_step; */
|
||||
addl 24(%ebp),%ebx
|
||||
/* x_scale = x >> 16; */
|
||||
movl %ebx,%edx
|
||||
sarl $16,%edx
|
||||
|
||||
paddw %mm5,%mm7
|
||||
|
||||
psrlw $8,%mm7
|
||||
packuswb %mm7, %mm7
|
||||
movd %mm7,(%esi)
|
||||
|
||||
addl $4, %esi
|
||||
|
||||
cmpl %esi,28(%ebp)
|
||||
je .out
|
||||
|
||||
cmpl %edx,-24(%ebp)
|
||||
je .loop
|
||||
|
||||
.newx:
|
||||
movl %edx,-24(%ebp)
|
||||
/*
|
||||
* Load the two new values into %mm1, %mm3, move old values into %mm0, %mm2
|
||||
*/
|
||||
movq %mm1, %mm0
|
||||
movq %mm3, %mm2
|
||||
|
||||
shll $2, %edx
|
||||
|
||||
pxor %mm4, %mm4
|
||||
|
||||
movl 16(%ebp),%edi
|
||||
movl (%edi, %edx), %eax
|
||||
movd (%edi, %edx), %mm5
|
||||
punpcklbw %mm4, %mm5
|
||||
shrl $24, %eax
|
||||
movl $0x010101, %ecx
|
||||
mull %ecx
|
||||
/*
|
||||
* mull destroyed %edx, need to reconstitute
|
||||
*/
|
||||
movl -24(%ebp),%edx
|
||||
shll $2, %edx
|
||||
|
||||
orl $0xff000000, %eax
|
||||
movd %eax, %mm1
|
||||
punpcklbw %mm4, %mm1
|
||||
pmullw %mm5,%mm1
|
||||
|
||||
movl 20(%ebp),%edi
|
||||
movl (%edi, %edx), %eax
|
||||
movd (%edi, %edx), %mm5
|
||||
punpcklbw %mm4, %mm5
|
||||
shrl $24, %eax
|
||||
movl $0x010101, %ecx
|
||||
mull %ecx
|
||||
orl $0xff000000, %eax
|
||||
movd %eax, %mm3
|
||||
punpcklbw %mm4, %mm3
|
||||
pmullw %mm5,%mm3
|
||||
|
||||
psrlw $8,%mm1
|
||||
psrlw $8,%mm3
|
||||
|
||||
movl 8(%ebp),%edi
|
||||
|
||||
jmp .loop
|
||||
|
||||
.out:
|
||||
movl %esi,%eax
|
||||
emms
|
||||
leal -40(%ebp),%esp
|
||||
popl %ebx
|
||||
popl %esi
|
||||
popl %edi
|
||||
movl %ebp,%esp
|
||||
popl %ebp
|
||||
ret
|
||||
42
gdk-pixbuf/pixops/have_mmx.S
Normal file
42
gdk-pixbuf/pixops/have_mmx.S
Normal file
@@ -0,0 +1,42 @@
|
||||
.file "have_mmx.S"
|
||||
.version "01.01"
|
||||
gcc2_compiled.:
|
||||
.text
|
||||
.align 16
|
||||
.globl pixops_have_mmx
|
||||
.type pixops_have_mmx,@function
|
||||
|
||||
pixops_have_mmx:
|
||||
push %ebx
|
||||
|
||||
# Check if bit 21 in flags word is writeable
|
||||
|
||||
pushfl
|
||||
popl %eax
|
||||
movl %eax,%ebx
|
||||
xorl $0x00200000, %eax
|
||||
pushl %eax
|
||||
popfl
|
||||
pushfl
|
||||
popl %eax
|
||||
|
||||
cmpl %eax, %ebx
|
||||
|
||||
je .notfound
|
||||
|
||||
# OK, we have CPUID
|
||||
|
||||
movl $1, %eax
|
||||
cpuid
|
||||
|
||||
test $0x00800000, %edx
|
||||
jz .notfound
|
||||
|
||||
movl $1, %eax
|
||||
jmp .out
|
||||
|
||||
.notfound:
|
||||
movl $0, %eax
|
||||
.out:
|
||||
popl %ebx
|
||||
ret
|
||||
7
gdk-pixbuf/pixops/pixops-internal.h
Normal file
7
gdk-pixbuf/pixops/pixops-internal.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifdef USE_MMX
|
||||
art_u8 *pixops_scale_line_22_33_mmx (art_u32 weights[16][8], art_u8 *p, art_u8 *q1, art_u8 *q2, int x_step, art_u8 *p_stop, int x_init);
|
||||
art_u8 *pixops_composite_line_22_4a4_mmx (art_u32 weights[16][8], art_u8 *p, art_u8 *q1, art_u8 *q2, int x_step, art_u8 *p_stop, int x_init);
|
||||
art_u8 *pixops_composite_line_color_22_4a4_mmx (art_u32 weights[16][8], art_u8 *p, art_u8 *q1, art_u8 *q2, int x_step, art_u8 *p_stop, int x_init, int dest_x, int check_shift, int *colors);
|
||||
int pixops_have_mmx (void);
|
||||
#endif
|
||||
|
||||
1528
gdk-pixbuf/pixops/pixops.c
Normal file
1528
gdk-pixbuf/pixops/pixops.c
Normal file
File diff suppressed because it is too large
Load Diff
80
gdk-pixbuf/pixops/pixops.h
Normal file
80
gdk-pixbuf/pixops/pixops.h
Normal file
@@ -0,0 +1,80 @@
|
||||
#include <libart_lgpl/art_misc.h>
|
||||
#include <libart_lgpl/art_filterlevel.h>
|
||||
|
||||
/* Scale src_buf from src_width / src_height by factors scale_x, scale_y
|
||||
* and composite the portion corresponding to
|
||||
* render_x, render_y, render_width, render_height in the new
|
||||
* coordinate system into dest_buf starting at 0, 0
|
||||
*/
|
||||
void pixops_composite (art_u8 *dest_buf,
|
||||
int render_x0,
|
||||
int render_y0,
|
||||
int render_x1,
|
||||
int render_y1,
|
||||
int dest_rowstride,
|
||||
int dest_channels,
|
||||
int dest_has_alpha,
|
||||
const art_u8 *src_buf,
|
||||
int src_width,
|
||||
int src_height,
|
||||
int src_rowstride,
|
||||
int src_channels,
|
||||
int src_has_alpha,
|
||||
double scale_x,
|
||||
double scale_y,
|
||||
ArtFilterLevel filter_level,
|
||||
int overall_alpha);
|
||||
|
||||
/* Scale src_buf from src_width / src_height by factors scale_x, scale_y
|
||||
* and composite the portion corresponding to
|
||||
* render_x, render_y, render_width, render_height in the new
|
||||
* coordinate system against a checkboard with checks of size check_size
|
||||
* of the colors color1 and color2 into dest_buf starting at 0, 0
|
||||
*/
|
||||
void pixops_composite_color (art_u8 *dest_buf,
|
||||
int render_x0,
|
||||
int render_y0,
|
||||
int render_x1,
|
||||
int render_y1,
|
||||
int dest_rowstride,
|
||||
int dest_channels,
|
||||
int dest_has_alpha,
|
||||
const art_u8 *src_buf,
|
||||
int src_width,
|
||||
int src_height,
|
||||
int src_rowstride,
|
||||
int src_channels,
|
||||
int src_has_alpha,
|
||||
double scale_x,
|
||||
double scale_y,
|
||||
ArtFilterLevel filter_level,
|
||||
int overall_alpha,
|
||||
int check_x,
|
||||
int check_y,
|
||||
int check_size,
|
||||
art_u32 color1,
|
||||
art_u32 color2);
|
||||
|
||||
/* Scale src_buf from src_width / src_height by factors scale_x, scale_y
|
||||
* and composite the portion corresponding to
|
||||
* render_x, render_y, render_width, render_height in the new
|
||||
* coordinate system into dest_buf starting at 0, 0
|
||||
*/
|
||||
void pixops_scale (art_u8 *dest_buf,
|
||||
int render_x0,
|
||||
int render_y0,
|
||||
int render_x1,
|
||||
int render_y1,
|
||||
int dest_rowstride,
|
||||
int dest_channels,
|
||||
int dest_has_alpha,
|
||||
const art_u8 *src_buf,
|
||||
int src_width,
|
||||
int src_height,
|
||||
int src_rowstride,
|
||||
int src_channels,
|
||||
int src_has_alpha,
|
||||
double scale_x,
|
||||
double scale_y,
|
||||
ArtFilterLevel filter_level);
|
||||
|
||||
152
gdk-pixbuf/pixops/scale_line_22_33_mmx.S
Normal file
152
gdk-pixbuf/pixops/scale_line_22_33_mmx.S
Normal file
@@ -0,0 +1,152 @@
|
||||
.file "scale_line_22_33_mmx.S"
|
||||
.version "01.01"
|
||||
gcc2_compiled.:
|
||||
.text
|
||||
.align 16
|
||||
.globl pixops_scale_line_22_33_mmx
|
||||
.type pixops_scale_line_22_33_mmx,@function
|
||||
/*
|
||||
* Arguments
|
||||
*
|
||||
* weights: 8(%ebp)
|
||||
* p: 12(%ebp) %esi
|
||||
* q1: 16(%ebp)
|
||||
* q2: 20(%ebp)
|
||||
* xstep: 24(%ebp)
|
||||
* p_end: 28(%ebp)
|
||||
* xinit: 32(%ebp)
|
||||
*
|
||||
*/
|
||||
pixops_scale_line_22_33_mmx:
|
||||
/*
|
||||
* Function call entry
|
||||
*/
|
||||
pushl %ebp
|
||||
movl %esp,%ebp
|
||||
subl $28,%esp
|
||||
pushl %edi
|
||||
pushl %esi
|
||||
pushl %ebx
|
||||
/* Locals:
|
||||
* int x %ebx
|
||||
* int x_scaled -24(%ebp)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Setup
|
||||
*/
|
||||
/* Initialize variables */
|
||||
movl 32(%ebp),%ebx
|
||||
movl 32(%ebp),%edx
|
||||
sarl $16,%edx
|
||||
movl 12(%ebp),%esi
|
||||
|
||||
cmpl %esi,28(%ebp)
|
||||
je .out
|
||||
|
||||
/* Load initial values into %mm1, %mm3 */
|
||||
leal (%edx,%edx,2),%edx # Multiply by 3
|
||||
|
||||
movl 16(%ebp),%edi
|
||||
pxor %mm4, %mm4
|
||||
movzbl 2(%edi,%edx),%ecx
|
||||
shll $16,%ecx
|
||||
movzwl (%edi,%edx),%eax
|
||||
orl %eax,%ecx
|
||||
movd %ecx, %mm1
|
||||
punpcklbw %mm4, %mm1
|
||||
|
||||
movl 20(%ebp),%edi
|
||||
movzbl 2(%edi,%edx),%ecx
|
||||
shll $16,%ecx
|
||||
movzwl (%edi,%edx),%eax
|
||||
orl %eax,%ecx
|
||||
movd %ecx, %mm3
|
||||
punpcklbw %mm4, %mm3
|
||||
|
||||
addl $65536,%ebx
|
||||
movl %ebx,%edx
|
||||
sarl $16,%edx
|
||||
|
||||
jmp .newx
|
||||
.p2align 4,,7
|
||||
.loop:
|
||||
/* int x_index = (x & 0xf000) >> 12 */
|
||||
movl %ebx,%eax
|
||||
andl $0xf000,%eax
|
||||
shrl $7,%eax
|
||||
|
||||
movq (%edi,%eax),%mm4
|
||||
pmullw %mm0,%mm4
|
||||
movq 8(%edi,%eax),%mm5
|
||||
pmullw %mm1,%mm5
|
||||
movq 16(%edi,%eax),%mm6
|
||||
movq 24(%edi,%eax),%mm7
|
||||
pmullw %mm2,%mm6
|
||||
pmullw %mm3,%mm7
|
||||
paddw %mm4, %mm5
|
||||
paddw %mm6, %mm7
|
||||
paddw %mm5, %mm7
|
||||
|
||||
psrlw $8, %mm7
|
||||
packuswb %mm7, %mm7
|
||||
movd %mm7, %eax
|
||||
|
||||
movb %al, (%esi)
|
||||
shrl $8, %eax
|
||||
movw %ax, 1(%esi)
|
||||
addl $3, %esi
|
||||
|
||||
cmpl %esi,28(%ebp)
|
||||
je .out
|
||||
|
||||
/* x += x_step; */
|
||||
addl 24(%ebp),%ebx
|
||||
/* x_scale = x >> 16; */
|
||||
movl %ebx,%edx
|
||||
sarl $16,%edx
|
||||
|
||||
cmpl %edx,-24(%ebp)
|
||||
je .loop
|
||||
|
||||
.newx:
|
||||
movl %edx,-24(%ebp)
|
||||
/*
|
||||
* Load the two new values into %mm1, %mm3, move old values into %mm0, %mm2
|
||||
*/
|
||||
movq %mm1, %mm0
|
||||
movq %mm3, %mm2
|
||||
|
||||
leal (%edx,%edx,2),%edx # Multiply by 3
|
||||
|
||||
movl 16(%ebp),%edi
|
||||
pxor %mm4, %mm4
|
||||
movzbl 2(%edi,%edx),%ecx
|
||||
shll $16,%ecx
|
||||
movzwl (%edi,%edx),%eax
|
||||
orl %eax,%ecx
|
||||
movd %ecx, %mm1
|
||||
punpcklbw %mm4, %mm1
|
||||
|
||||
movl 20(%ebp),%edi
|
||||
movzbl 2(%edi,%edx),%ecx
|
||||
shll $16,%ecx
|
||||
movzwl (%edi,%edx),%eax
|
||||
orl %eax,%ecx
|
||||
movd %ecx, %mm3
|
||||
punpcklbw %mm4, %mm3
|
||||
|
||||
movl 8(%ebp),%edi
|
||||
|
||||
jmp .loop
|
||||
|
||||
.out:
|
||||
movl %esi,%eax
|
||||
emms
|
||||
leal -40(%ebp),%esp
|
||||
popl %ebx
|
||||
popl %esi
|
||||
popl %edi
|
||||
movl %ebp,%esp
|
||||
popl %ebp
|
||||
ret
|
||||
232
gdk-pixbuf/pixops/timescale.c
Normal file
232
gdk-pixbuf/pixops/timescale.c
Normal file
@@ -0,0 +1,232 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "pixops.h"
|
||||
|
||||
struct timeval start_time;
|
||||
|
||||
void start_timing (void)
|
||||
{
|
||||
gettimeofday (&start_time, NULL);
|
||||
}
|
||||
|
||||
double
|
||||
stop_timing (const char *test, int iterations, int bytes)
|
||||
{
|
||||
struct timeval stop_time;
|
||||
double msecs;
|
||||
|
||||
gettimeofday (&stop_time, NULL);
|
||||
if (stop_time.tv_usec < start_time.tv_usec)
|
||||
{
|
||||
stop_time.tv_usec += 1000000;
|
||||
stop_time.tv_sec -= 1;
|
||||
}
|
||||
|
||||
msecs = (stop_time.tv_sec - start_time.tv_sec) * 1000. +
|
||||
(stop_time.tv_usec - start_time.tv_usec) / 1000.;
|
||||
|
||||
printf("%s%d\t%.1f\t\t%.2f\t\t%.2f\n",
|
||||
test, iterations, msecs, msecs / iterations, ((double)bytes * iterations) / (1000*msecs));
|
||||
|
||||
return ((double)bytes * iterations) / (1000*msecs);
|
||||
}
|
||||
|
||||
void
|
||||
init_array (double times[3][3][4])
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
for (i=0; i<3; i++)
|
||||
for (j=0; j<3; j++)
|
||||
for (k=0; k<4; k++)
|
||||
times[i][j][k] = -1;
|
||||
}
|
||||
|
||||
void
|
||||
dump_array (double times[3][3][4])
|
||||
{
|
||||
int i, j;
|
||||
|
||||
printf(" 3\t4\t4a\n");
|
||||
for (i=0; i<3; i++)
|
||||
{
|
||||
for (j=0; j<4; j++)
|
||||
{
|
||||
if (j == 0)
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
printf("3 ");
|
||||
break;
|
||||
case 1:
|
||||
printf("4 ");
|
||||
break;
|
||||
case 2:
|
||||
printf("4a ");
|
||||
break;
|
||||
}
|
||||
else
|
||||
printf(" ");
|
||||
|
||||
printf("%6.2f %6.2f %6.2f",
|
||||
times[i][0][j], times[i][1][j], times[i][2][j]);
|
||||
|
||||
switch (j)
|
||||
{
|
||||
case ART_FILTER_NEAREST:
|
||||
printf (" NEAREST\n");
|
||||
break;
|
||||
case ART_FILTER_TILES:
|
||||
printf (" TILES\n");
|
||||
break;
|
||||
case ART_FILTER_BILINEAR:
|
||||
printf (" BILINEAR\n");
|
||||
break;
|
||||
case ART_FILTER_HYPER:
|
||||
printf (" HYPER\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
#define ITERS 10
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
int src_width, src_height, dest_width, dest_height;
|
||||
char *src_buf, *dest_buf;
|
||||
int src_index, dest_index;
|
||||
int i;
|
||||
double scale_times[3][3][4];
|
||||
double composite_times[3][3][4];
|
||||
double composite_color_times[3][3][4];
|
||||
|
||||
if (argc == 5)
|
||||
{
|
||||
src_width = atoi(argv[1]);
|
||||
src_height = atoi(argv[2]);
|
||||
dest_width = atoi(argv[3]);
|
||||
dest_height = atoi(argv[4]);
|
||||
}
|
||||
else if (argc == 1)
|
||||
{
|
||||
src_width = 343;
|
||||
src_height = 343;
|
||||
dest_width = 711;
|
||||
dest_height = 711;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "Usage: scale [src_width src_height dest_width dest_height]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
printf ("Scaling from (%d, %d) to (%d, %d)\n\n", src_width, src_height, dest_width, dest_height);
|
||||
|
||||
init_array (scale_times);
|
||||
init_array (composite_times);
|
||||
init_array (composite_color_times);
|
||||
|
||||
for (src_index = 0; src_index < 3; src_index++)
|
||||
for (dest_index = 0; dest_index < 3; dest_index++)
|
||||
{
|
||||
int src_channels = (src_index == 0) ? 3 : 4;
|
||||
int src_has_alpha = (src_index == 2);
|
||||
int dest_channels = (dest_index == 0) ? 3 : 4;
|
||||
int dest_has_alpha = (dest_index == 2);
|
||||
|
||||
int src_rowstride = (src_channels*src_width + 3) & ~3;
|
||||
int dest_rowstride = (dest_channels *dest_width + 3) & ~3;
|
||||
|
||||
int filter_level;
|
||||
|
||||
src_buf = malloc(src_rowstride * src_height);
|
||||
memset (src_buf, 0x80, src_rowstride * src_height);
|
||||
|
||||
dest_buf = malloc(dest_rowstride * dest_height);
|
||||
memset (dest_buf, 0x80, dest_rowstride * dest_height);
|
||||
|
||||
for (filter_level = ART_FILTER_NEAREST ; filter_level <= ART_FILTER_HYPER; filter_level++)
|
||||
{
|
||||
printf ("src_channels = %d (%s); dest_channels = %d (%s); filter_level=",
|
||||
src_channels, src_has_alpha ? "alpha" : "no alpha",
|
||||
dest_channels, dest_has_alpha ? "alpha" : "no alpha");
|
||||
switch (filter_level)
|
||||
{
|
||||
case ART_FILTER_NEAREST:
|
||||
printf ("ART_FILTER_NEAREST\n");
|
||||
break;
|
||||
case ART_FILTER_TILES:
|
||||
printf ("ART_FILTER_TILES\n");
|
||||
break;
|
||||
case ART_FILTER_BILINEAR:
|
||||
printf ("ART_FILTER_BILINEAR\n");
|
||||
break;
|
||||
case ART_FILTER_HYPER:
|
||||
printf ("ART_FILTER_HYPER\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf("\t\t\titers\ttotal\t\tmsecs/iter\tMpixels/sec\t\n");
|
||||
|
||||
|
||||
if (!(src_has_alpha && !dest_has_alpha))
|
||||
{
|
||||
start_timing ();
|
||||
for (i = 0; i < ITERS; i++)
|
||||
{
|
||||
pixops_scale (dest_buf, 0, 0, dest_width, dest_height, dest_rowstride, dest_channels, dest_has_alpha,
|
||||
src_buf, src_width, src_height, src_rowstride, src_channels, src_has_alpha,
|
||||
(double)dest_width / src_width, (double)dest_height / src_height,
|
||||
filter_level);
|
||||
}
|
||||
scale_times[src_index][dest_index][filter_level] =
|
||||
stop_timing (" scale\t\t", ITERS, dest_height * dest_width);
|
||||
}
|
||||
|
||||
start_timing ();
|
||||
for (i = 0; i < ITERS; i++)
|
||||
{
|
||||
pixops_composite (dest_buf, 0, 0, dest_width, dest_height, dest_rowstride, dest_channels, dest_has_alpha,
|
||||
src_buf, src_width, src_height, src_rowstride, src_channels, src_has_alpha,
|
||||
(double)dest_width / src_width, (double)dest_height / src_height,
|
||||
filter_level, 255);
|
||||
}
|
||||
composite_times[src_index][dest_index][filter_level] =
|
||||
stop_timing (" composite\t\t", ITERS, dest_height * dest_width);
|
||||
|
||||
start_timing ();
|
||||
for (i = 0; i < ITERS; i++)
|
||||
{
|
||||
pixops_composite_color (dest_buf, 0, 0, dest_width, dest_height, dest_rowstride, dest_channels, dest_has_alpha,
|
||||
src_buf, src_width, src_height, src_rowstride, src_channels, src_has_alpha,
|
||||
(double)dest_width / src_width, (double)dest_height / src_height,
|
||||
filter_level, 255, 0, 0, 16, 0xaaaaaa, 0x555555);
|
||||
}
|
||||
composite_color_times[src_index][dest_index][filter_level] =
|
||||
stop_timing (" composite color\t", ITERS, dest_height * dest_width);
|
||||
|
||||
printf ("\n");
|
||||
}
|
||||
printf ("\n");
|
||||
|
||||
free (src_buf);
|
||||
free (dest_buf);
|
||||
}
|
||||
|
||||
printf ("SCALE\n=====\n\n");
|
||||
dump_array (scale_times);
|
||||
|
||||
printf ("COMPOSITE\n=========\n\n");
|
||||
dump_array (composite_times);
|
||||
|
||||
printf ("COMPOSITE_COLOR\n===============\n\n");
|
||||
dump_array (composite_color_times);
|
||||
return 0;
|
||||
}
|
||||
33
gdk-pixbuf/test-gdk-pixbuf.c
Normal file
33
gdk-pixbuf/test-gdk-pixbuf.c
Normal file
@@ -0,0 +1,33 @@
|
||||
/* GdkPixbuf library - test program
|
||||
*
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Author: Federico Mena-Quintero <federico@gimp.org>
|
||||
*
|
||||
* 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 <config.h>
|
||||
#include <gnome.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-loader.h"
|
||||
#include "gnome-canvas-pixbuf.h"
|
||||
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
*.lo
|
||||
Makefile
|
||||
.deps
|
||||
_libs
|
||||
libgdk.la
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
gdkincludedir = $(includedir)/gdk
|
||||
|
||||
lib_LTLIBRARIES = libgdk.la
|
||||
|
||||
libgdk_la_SOURCES = \
|
||||
gdk.c \
|
||||
gdkcolor.c \
|
||||
gdkcursor.c \
|
||||
gdkdraw.c \
|
||||
gdkfont.c \
|
||||
gdkgc.c \
|
||||
gdkglobals.c \
|
||||
gdkimage.c \
|
||||
gdkinput.c \
|
||||
gdkpixmap.c \
|
||||
gdkproperty.c \
|
||||
gdkrectangle.c \
|
||||
gdkselection.c \
|
||||
gdkvisual.c \
|
||||
gdkwindow.c \
|
||||
gdkxid.c \
|
||||
gxid_lib.c
|
||||
## this last one is ifdef'd out unless XINPUT_GXI is defined
|
||||
## It's easier than trying to get automake to handle compiling
|
||||
## it conditionally
|
||||
|
||||
gdkinclude_HEADERS = \
|
||||
gdk.h \
|
||||
gdkcursors.h \
|
||||
gdkkeysyms.h \
|
||||
gdkprivate.h \
|
||||
gdktypes.h \
|
||||
gdkinput.h \
|
||||
gdkinputnone.h \
|
||||
gdkinputcommon.h\
|
||||
gdkinputgxi.h \
|
||||
gdkinputxfree.h \
|
||||
gxid_lib.h \
|
||||
gxid_proto.h \
|
||||
gdkx.h
|
||||
|
||||
libgdk_la_LDFLAGS = -version-info 1:0:0 \
|
||||
@x_ldflags@ @x_libs@
|
||||
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/glib @x_cflags@
|
||||
|
||||
EXTRA_PROGRAMS = gxid
|
||||
|
||||
bin_PROGRAMS = @xinput_progs@
|
||||
|
||||
gxid_SOURCES = gxid.c
|
||||
|
||||
gxid_LDADD = \
|
||||
@x_ldflags@ \
|
||||
@x_libs@ \
|
||||
-lm
|
||||
|
||||
BUILT_SOURCES = gdkcursors.h gdkkeysyms.h
|
||||
|
||||
EXTRA_DIST = makecursors makecursors.sed makekeysyms makekeysyms.sed
|
||||
|
||||
gdkcursors.h:
|
||||
$(srcdir)/makecursors @x_includes@/X11/cursorfont.h > $@
|
||||
|
||||
gdkkeysyms.h:
|
||||
$(srcdir)/makekeysyms @x_includes@/X11/keysymdef.h > $@
|
||||
|
||||
.PHONY: files
|
||||
|
||||
files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
|
||||
echo $$p; \
|
||||
done
|
||||
614
gdk/gdk.h
614
gdk/gdk.h
@@ -1,614 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#ifndef __GDK_H__
|
||||
#define __GDK_H__
|
||||
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/* Initialization, exit and events
|
||||
*/
|
||||
void gdk_init (int *argc,
|
||||
char ***argv);
|
||||
void gdk_exit (int error_code);
|
||||
gchar* gdk_set_locale (void);
|
||||
|
||||
gint gdk_events_pending (void);
|
||||
gint gdk_event_get (GdkEvent *event,
|
||||
GdkEventFunc pred,
|
||||
gpointer data);
|
||||
void gdk_event_put (GdkEvent *event);
|
||||
|
||||
GdkEvent *gdk_event_copy (GdkEvent *event);
|
||||
void gdk_event_free (GdkEvent *event);
|
||||
|
||||
void gdk_set_debug_level (gint level);
|
||||
void gdk_set_show_events (gint show_events);
|
||||
void gdk_set_use_xshm (gint use_xshm);
|
||||
|
||||
gint gdk_get_debug_level (void);
|
||||
gint gdk_get_show_events (void);
|
||||
gint gdk_get_use_xshm (void);
|
||||
|
||||
guint32 gdk_time_get (void);
|
||||
guint32 gdk_timer_get (void);
|
||||
void gdk_timer_set (guint32 milliseconds);
|
||||
void gdk_timer_enable (void);
|
||||
void gdk_timer_disable (void);
|
||||
|
||||
gint gdk_input_add (gint source,
|
||||
GdkInputCondition condition,
|
||||
GdkInputFunction function,
|
||||
gpointer data);
|
||||
void gdk_input_remove (gint tag);
|
||||
|
||||
gint gdk_pointer_grab (GdkWindow * window,
|
||||
gint owner_events,
|
||||
GdkEventMask event_mask,
|
||||
GdkWindow * confine_to,
|
||||
GdkCursor * cursor,
|
||||
guint32 time);
|
||||
void gdk_pointer_ungrab (guint32 time);
|
||||
|
||||
gint gdk_keyboard_grab (GdkWindow * window,
|
||||
gint owner_events,
|
||||
guint32 time);
|
||||
void gdk_keyboard_ungrab (guint32 time);
|
||||
|
||||
gint gdk_screen_width (void);
|
||||
gint gdk_screen_height (void);
|
||||
|
||||
void gdk_flush (void);
|
||||
void gdk_beep (void);
|
||||
|
||||
void gdk_key_repeat_disable (void);
|
||||
void gdk_key_repeat_restore (void);
|
||||
|
||||
|
||||
/* Visuals
|
||||
*/
|
||||
gint gdk_visual_get_best_depth (void);
|
||||
GdkVisualType gdk_visual_get_best_type (void);
|
||||
GdkVisual* gdk_visual_get_system (void);
|
||||
GdkVisual* gdk_visual_get_best (void);
|
||||
GdkVisual* gdk_visual_get_best_with_depth (gint depth);
|
||||
GdkVisual* gdk_visual_get_best_with_type (GdkVisualType visual_type);
|
||||
GdkVisual* gdk_visual_get_best_with_both (gint depth,
|
||||
GdkVisualType visual_type);
|
||||
|
||||
/* Actually, these are no-ops... */
|
||||
GdkVisual* gdk_visual_ref (GdkVisual *visual);
|
||||
void gdk_visual_unref (GdkVisual *visual);
|
||||
|
||||
void gdk_query_depths (gint **depths,
|
||||
gint *count);
|
||||
void gdk_query_visual_types (GdkVisualType **visual_types,
|
||||
gint *count);
|
||||
void gdk_query_visuals (GdkVisual **visuals,
|
||||
gint *count);
|
||||
|
||||
|
||||
/* Windows
|
||||
*/
|
||||
GdkWindow* gdk_window_new (GdkWindow *parent,
|
||||
GdkWindowAttr *attributes,
|
||||
gint attributes_mask);
|
||||
|
||||
GdkWindow * gdk_window_foreign_new (guint32 anid);
|
||||
void gdk_window_destroy (GdkWindow *window);
|
||||
GdkWindow* gdk_window_ref (GdkWindow *window);
|
||||
void gdk_window_unref (GdkWindow *window);
|
||||
|
||||
void gdk_window_show (GdkWindow *window);
|
||||
void gdk_window_hide (GdkWindow *window);
|
||||
void gdk_window_move (GdkWindow *window,
|
||||
gint x,
|
||||
gint y);
|
||||
void gdk_window_resize (GdkWindow *window,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_window_move_resize (GdkWindow *window,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_window_reparent (GdkWindow *window,
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y);
|
||||
void gdk_window_clear (GdkWindow *window);
|
||||
void gdk_window_clear_area (GdkWindow *window,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_window_clear_area_e(GdkWindow *window,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_window_copy_area (GdkWindow *window,
|
||||
GdkGC *gc,
|
||||
gint x,
|
||||
gint y,
|
||||
GdkWindow *source_window,
|
||||
gint source_x,
|
||||
gint source_y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_window_raise (GdkWindow *window);
|
||||
void gdk_window_lower (GdkWindow *window);
|
||||
|
||||
void gdk_window_set_user_data (GdkWindow *window,
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
/*
|
||||
* This allows for making shaped (partially transparent) windows
|
||||
* - cool feature, needed for Drag and Drag for example.
|
||||
* The shape_mask can be the mask
|
||||
* from gdk_pixmap_create_from_xpm. Stefan Wille
|
||||
*/
|
||||
void gdk_window_shape_combine_mask (GdkWindow *window,
|
||||
GdkBitmap *shape_mask,
|
||||
gint offset_x,
|
||||
gint offset_y);
|
||||
|
||||
/*
|
||||
* Drag & Drop
|
||||
* Algorithm (drop source):
|
||||
* A window being dragged will be sent a GDK_DRAG_BEGIN message.
|
||||
* It will then do gdk_dnd_drag_addwindow() for any other windows that are to be
|
||||
* dragged.
|
||||
* When we get a DROP_ENTER incoming, we send it on to the window in question.
|
||||
* That window needs to use gdk_dnd_drop_enter_reply() to indicate the state of
|
||||
* things (it must call that even if it's not going to accept the drop)
|
||||
*
|
||||
* These two turn on/off drag or drop, and if enabling it also
|
||||
* sets the list of types supported. The list of types passed in
|
||||
* should be in order of decreasing preference.
|
||||
*/
|
||||
void gdk_window_dnd_drag_set (GdkWindow *window,
|
||||
guint8 drag_enable,
|
||||
gchar **typelist,
|
||||
guint numtypes);
|
||||
|
||||
/*
|
||||
*XXX todo: add a GDK_DROP_ENTER which can look at actual data
|
||||
*/
|
||||
void gdk_window_dnd_drop_set (GdkWindow *window,
|
||||
guint8 drop_enable,
|
||||
gchar **typelist,
|
||||
guint numtypes,
|
||||
guint8 destructive_op);
|
||||
|
||||
/*
|
||||
* This is used by the GDK_DRAG_BEGIN handler. An example of usage would be a
|
||||
* file manager where multiple icons were selected and the drag began.
|
||||
* The icon that the drag actually began on would gdk_dnd_drag_addwindow
|
||||
* for all the other icons that were being dragged...
|
||||
*/
|
||||
void gdk_dnd_drag_addwindow (GdkWindow *window);
|
||||
void gdk_window_dnd_data_set (GdkWindow *window,
|
||||
GdkEvent *event,
|
||||
gpointer data,
|
||||
gulong data_numbytes);
|
||||
|
||||
|
||||
void gdk_window_set_hints (GdkWindow *window,
|
||||
gint x,
|
||||
gint y,
|
||||
gint min_width,
|
||||
gint min_height,
|
||||
gint max_width,
|
||||
gint max_height,
|
||||
gint flags);
|
||||
void gdk_window_set_title (GdkWindow *window,
|
||||
const gchar *title);
|
||||
void gdk_window_set_background (GdkWindow *window,
|
||||
GdkColor *color);
|
||||
void gdk_window_set_back_pixmap (GdkWindow *window,
|
||||
GdkPixmap *pixmap,
|
||||
gint parent_relative);
|
||||
void gdk_window_set_cursor (GdkWindow *window,
|
||||
GdkCursor *cursor);
|
||||
void gdk_window_set_colormap (GdkWindow *window,
|
||||
GdkColormap *colormap);
|
||||
void gdk_window_get_user_data (GdkWindow *window,
|
||||
gpointer *data);
|
||||
void gdk_window_get_geometry (GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height,
|
||||
gint *depth);
|
||||
void gdk_window_get_position (GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y);
|
||||
void gdk_window_get_size (GdkWindow *window,
|
||||
gint *width,
|
||||
gint *height);
|
||||
GdkVisual* gdk_window_get_visual (GdkWindow *window);
|
||||
GdkColormap* gdk_window_get_colormap (GdkWindow *window);
|
||||
GdkWindowType gdk_window_get_type (GdkWindow *window);
|
||||
gint gdk_window_get_origin (GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y);
|
||||
GdkWindow* gdk_window_get_pointer (GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y,
|
||||
GdkModifierType *mask);
|
||||
GdkWindow* gdk_window_get_parent (GdkWindow *window);
|
||||
GdkWindow* gdk_window_get_toplevel (GdkWindow *window);
|
||||
GList* gdk_window_get_children (GdkWindow *window);
|
||||
GdkEventMask gdk_window_get_events (GdkWindow *window);
|
||||
void gdk_window_set_events (GdkWindow *window,
|
||||
GdkEventMask event_mask);
|
||||
|
||||
/* Cursors
|
||||
*/
|
||||
GdkCursor* gdk_cursor_new (GdkCursorType cursor_type);
|
||||
void gdk_cursor_destroy (GdkCursor *cursor);
|
||||
|
||||
|
||||
/* GCs
|
||||
*/
|
||||
GdkGC* gdk_gc_new (GdkWindow *window);
|
||||
GdkGC* gdk_gc_new_with_values (GdkWindow *window,
|
||||
GdkGCValues *values,
|
||||
GdkGCValuesMask values_mask);
|
||||
void gdk_gc_destroy (GdkGC *gc);
|
||||
void gdk_gc_get_values (GdkGC *gc,
|
||||
GdkGCValues *values);
|
||||
void gdk_gc_set_foreground (GdkGC *gc,
|
||||
GdkColor *color);
|
||||
void gdk_gc_set_background (GdkGC *gc,
|
||||
GdkColor *color);
|
||||
void gdk_gc_set_font (GdkGC *gc,
|
||||
GdkFont *font);
|
||||
void gdk_gc_set_function (GdkGC *gc,
|
||||
GdkFunction function);
|
||||
void gdk_gc_set_fill (GdkGC *gc,
|
||||
GdkFill fill);
|
||||
void gdk_gc_set_tile (GdkGC *gc,
|
||||
GdkPixmap *tile);
|
||||
void gdk_gc_set_stipple (GdkGC *gc,
|
||||
GdkPixmap *stipple);
|
||||
void gdk_gc_set_ts_origin (GdkGC *gc,
|
||||
gint x,
|
||||
gint y);
|
||||
void gdk_gc_set_clip_origin (GdkGC *gc,
|
||||
gint x,
|
||||
gint y);
|
||||
void gdk_gc_set_clip_mask (GdkGC *gc,
|
||||
GdkBitmap *mask);
|
||||
void gdk_gc_set_clip_rectangle (GdkGC *gc,
|
||||
GdkRectangle *rectangle);
|
||||
void gdk_gc_set_subwindow (GdkGC *gc,
|
||||
GdkSubwindowMode mode);
|
||||
void gdk_gc_set_exposures (GdkGC *gc,
|
||||
gint exposures);
|
||||
void gdk_gc_set_line_attributes (GdkGC *gc,
|
||||
gint line_width,
|
||||
GdkLineStyle line_style,
|
||||
GdkCapStyle cap_style,
|
||||
GdkJoinStyle join_style);
|
||||
|
||||
|
||||
/* Pixmaps
|
||||
*/
|
||||
GdkPixmap* gdk_pixmap_new (GdkWindow *window,
|
||||
gint width,
|
||||
gint height,
|
||||
gint depth);
|
||||
GdkBitmap* gdk_bitmap_create_from_data (GdkWindow *window,
|
||||
gchar *data,
|
||||
gint width,
|
||||
gint height);
|
||||
GdkPixmap* gdk_pixmap_create_from_data (GdkWindow *window,
|
||||
gchar *data,
|
||||
gint width,
|
||||
gint height,
|
||||
gint depth,
|
||||
GdkColor *fg,
|
||||
GdkColor *bg);
|
||||
GdkPixmap* gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
const gchar *filename);
|
||||
GdkPixmap* gdk_pixmap_create_from_xpm_d (GdkWindow *window,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
gchar **data);
|
||||
void gdk_pixmap_destroy (GdkPixmap *pixmap);
|
||||
|
||||
|
||||
|
||||
/* Images
|
||||
*/
|
||||
GdkImage* gdk_image_new_bitmap(GdkVisual *,
|
||||
gpointer,
|
||||
gint,
|
||||
gint);
|
||||
GdkImage* gdk_image_new (GdkImageType type,
|
||||
GdkVisual *visual,
|
||||
gint width,
|
||||
gint height);
|
||||
GdkImage* gdk_image_get (GdkWindow *window,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_image_put_pixel (GdkImage *image,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 pixel);
|
||||
guint32 gdk_image_get_pixel (GdkImage *image,
|
||||
gint x,
|
||||
gint y);
|
||||
void gdk_image_destroy (GdkImage *image);
|
||||
|
||||
|
||||
/* Color
|
||||
*/
|
||||
GdkColormap* gdk_colormap_new (GdkVisual *visual,
|
||||
gint allocate);
|
||||
void gdk_colormap_destroy (GdkColormap *colormap);
|
||||
|
||||
GdkColormap* gdk_colormap_ref (GdkColormap *cmap);
|
||||
void gdk_colormap_unref (GdkColormap *cmap);
|
||||
|
||||
GdkColormap* gdk_colormap_get_system (void);
|
||||
gint gdk_colormap_get_system_size (void);
|
||||
|
||||
void gdk_colormap_change (GdkColormap *colormap,
|
||||
gint ncolors);
|
||||
void gdk_colors_store (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors);
|
||||
gint gdk_colors_alloc (GdkColormap *colormap,
|
||||
gint contiguous,
|
||||
gulong *planes,
|
||||
gint nplanes,
|
||||
gulong *pixels,
|
||||
gint npixels);
|
||||
void gdk_colors_free (GdkColormap *colormap,
|
||||
gulong *pixels,
|
||||
gint npixels,
|
||||
gulong planes);
|
||||
gint gdk_color_white (GdkColormap *colormap,
|
||||
GdkColor *color);
|
||||
gint gdk_color_black (GdkColormap *colormap,
|
||||
GdkColor *color);
|
||||
gint gdk_color_parse (const gchar *spec,
|
||||
GdkColor *color);
|
||||
gint gdk_color_alloc (GdkColormap *colormap,
|
||||
GdkColor *color);
|
||||
gint gdk_color_change (GdkColormap *colormap,
|
||||
GdkColor *color);
|
||||
gint gdk_color_equal (GdkColor *colora,
|
||||
GdkColor *colorb);
|
||||
|
||||
|
||||
/* Fonts
|
||||
*/
|
||||
GdkFont* gdk_font_load (const gchar *font_name);
|
||||
GdkFont* gdk_fontset_load (gchar *fontset_name);
|
||||
void gdk_font_free (GdkFont *font);
|
||||
void gdk_fontset_free (GdkFont *font);
|
||||
GdkFont* gdk_font_ref (GdkFont *font);
|
||||
gint gdk_font_id (GdkFont *font);
|
||||
gint gdk_font_equal (GdkFont *fonta,
|
||||
GdkFont *fontb);
|
||||
gint gdk_string_width (GdkFont *font,
|
||||
const gchar *string);
|
||||
gint gdk_text_width (GdkFont *font,
|
||||
const gchar *text,
|
||||
gint text_length);
|
||||
gint gdk_char_width (GdkFont *font,
|
||||
gchar character);
|
||||
gint gdk_string_measure (GdkFont *font,
|
||||
const gchar *string);
|
||||
gint gdk_text_measure (GdkFont *font,
|
||||
const gchar *text,
|
||||
gint text_length);
|
||||
gint gdk_char_measure (GdkFont *font,
|
||||
gchar character);
|
||||
|
||||
|
||||
/* Drawing
|
||||
*/
|
||||
void gdk_draw_point (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
gint x,
|
||||
gint y);
|
||||
void gdk_draw_line (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
gint x1,
|
||||
gint y1,
|
||||
gint x2,
|
||||
gint y2);
|
||||
void gdk_draw_rectangle (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
gint filled,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_draw_arc (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
gint filled,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
gint angle1,
|
||||
gint angle2);
|
||||
void gdk_draw_polygon (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
gint filled,
|
||||
GdkPoint *points,
|
||||
gint npoints);
|
||||
void gdk_draw_string (GdkDrawable *drawable,
|
||||
GdkFont *font,
|
||||
GdkGC *gc,
|
||||
gint x,
|
||||
gint y,
|
||||
const gchar *string);
|
||||
void gdk_draw_text (GdkDrawable *drawable,
|
||||
GdkFont *font,
|
||||
GdkGC *gc,
|
||||
gint x,
|
||||
gint y,
|
||||
const gchar *text,
|
||||
gint text_length);
|
||||
void gdk_draw_pixmap (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkDrawable *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_draw_bitmap (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkDrawable *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_draw_image (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkImage *image,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_draw_points (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPoint *points,
|
||||
gint npoints);
|
||||
void gdk_draw_segments (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkSegment *segs,
|
||||
gint nsegs);
|
||||
|
||||
|
||||
/* Selections
|
||||
*/
|
||||
gint gdk_selection_owner_set (GdkWindow *owner,
|
||||
GdkAtom selection,
|
||||
guint32 time,
|
||||
gint send_event);
|
||||
GdkWindow* gdk_selection_owner_get (GdkAtom selection);
|
||||
void gdk_selection_convert (GdkWindow *requestor,
|
||||
GdkAtom selection,
|
||||
GdkAtom target,
|
||||
guint32 time);
|
||||
gint gdk_selection_property_get (GdkWindow *requestor,
|
||||
guchar **data,
|
||||
GdkAtom *prop_type,
|
||||
gint *prop_format);
|
||||
void gdk_selection_send_notify (guint32 requestor,
|
||||
GdkAtom selection,
|
||||
GdkAtom target,
|
||||
GdkAtom property,
|
||||
guint32 time);
|
||||
|
||||
/* Properties
|
||||
*/
|
||||
GdkAtom gdk_atom_intern (const gchar *atom_name,
|
||||
gint only_if_exists);
|
||||
gchar* gdk_atom_name (GdkAtom atom);
|
||||
gint gdk_property_get (GdkWindow *window,
|
||||
GdkAtom property,
|
||||
GdkAtom type,
|
||||
gulong offset,
|
||||
gulong length,
|
||||
gint pdelete,
|
||||
GdkAtom *actual_property_type,
|
||||
gint *actual_format,
|
||||
gint *actual_length,
|
||||
guchar **data);
|
||||
|
||||
void gdk_property_change (GdkWindow *window,
|
||||
GdkAtom property,
|
||||
GdkAtom type,
|
||||
gint format,
|
||||
GdkPropMode mode,
|
||||
guchar *data,
|
||||
gint nelements);
|
||||
void gdk_property_delete (GdkWindow *window,
|
||||
GdkAtom property);
|
||||
|
||||
|
||||
/* Rectangle utilities
|
||||
*/
|
||||
gint gdk_rectangle_intersect (GdkRectangle *src1,
|
||||
GdkRectangle *src2,
|
||||
GdkRectangle *dest);
|
||||
|
||||
/* XInput support
|
||||
*/
|
||||
|
||||
void gdk_input_init (void);
|
||||
void gdk_input_exit (void);
|
||||
GList *gdk_input_list_devices (void);
|
||||
void gdk_input_set_extension_events (GdkWindow *window,
|
||||
gint mask,
|
||||
GdkExtensionMode mode);
|
||||
void gdk_input_set_source (guint32 deviceid,
|
||||
GdkInputSource source);
|
||||
gint gdk_input_set_mode (guint32 deviceid,
|
||||
GdkInputMode mode);
|
||||
void gdk_input_set_axes (guint32 deviceid,
|
||||
GdkAxisUse *axes);
|
||||
void gdk_input_window_get_pointer (GdkWindow *window,
|
||||
guint32 deviceid,
|
||||
gdouble *x,
|
||||
gdouble *y,
|
||||
gdouble *pressure,
|
||||
gdouble *xtilt,
|
||||
gdouble *ytilt,
|
||||
GdkModifierType *mask);
|
||||
|
||||
GdkTimeCoord *gdk_input_motion_events (GdkWindow *window,
|
||||
guint32 deviceid,
|
||||
guint32 start,
|
||||
guint32 stop,
|
||||
gint *nevents_return);
|
||||
|
||||
/* Miscellaneous */
|
||||
void gdk_event_send_clientmessage_toall(GdkEvent *event);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GDK_H__ */
|
||||
718
gdk/gdkcolor.c
718
gdk/gdkcolor.c
@@ -1,718 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include <X11/Xlib.h>
|
||||
#include "gdk.h"
|
||||
#include "gdkprivate.h"
|
||||
|
||||
|
||||
static gint gdk_colormap_match_color (GdkColormap *cmap,
|
||||
GdkColor *color,
|
||||
const gchar *available);
|
||||
static void gdk_colormap_add (GdkColormap *cmap);
|
||||
static void gdk_colormap_remove (GdkColormap *cmap);
|
||||
static guint gdk_colormap_hash (Colormap *cmap);
|
||||
static gint gdk_colormap_cmp (Colormap *a,
|
||||
Colormap *b);
|
||||
|
||||
static GHashTable *colormap_hash = NULL;
|
||||
|
||||
|
||||
GdkColormap*
|
||||
gdk_colormap_new (GdkVisual *visual,
|
||||
gint private_cmap)
|
||||
{
|
||||
GdkColormap *colormap;
|
||||
GdkColormapPrivate *private;
|
||||
Visual *xvisual;
|
||||
XColor default_colors[256];
|
||||
int size;
|
||||
int i;
|
||||
|
||||
g_return_val_if_fail (visual != NULL, NULL);
|
||||
|
||||
private = g_new (GdkColormapPrivate, 1);
|
||||
colormap = (GdkColormap*) private;
|
||||
|
||||
private->xdisplay = gdk_display;
|
||||
private->visual = visual;
|
||||
private->next_color = 0;
|
||||
private->ref_count = 1;
|
||||
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
|
||||
|
||||
switch (visual->type)
|
||||
{
|
||||
case GDK_VISUAL_GRAYSCALE:
|
||||
case GDK_VISUAL_PSEUDO_COLOR:
|
||||
private->private_val = private_cmap;
|
||||
private->xcolormap = XCreateColormap (private->xdisplay, gdk_root_window,
|
||||
xvisual, (private_cmap) ? (AllocAll) : (AllocNone));
|
||||
|
||||
if (private_cmap)
|
||||
{
|
||||
for (i = 0; i < 256; i++)
|
||||
default_colors[i].pixel = i;
|
||||
|
||||
XQueryColors (private->xdisplay,
|
||||
DefaultColormap (private->xdisplay, gdk_screen),
|
||||
default_colors, visual->colormap_size);
|
||||
|
||||
for (i = 0; i < visual->colormap_size; i++)
|
||||
{
|
||||
colormap->colors[i].pixel = default_colors[i].pixel;
|
||||
colormap->colors[i].red = default_colors[i].red;
|
||||
colormap->colors[i].green = default_colors[i].green;
|
||||
colormap->colors[i].blue = default_colors[i].blue;
|
||||
}
|
||||
|
||||
gdk_colormap_change (colormap, visual->colormap_size);
|
||||
}
|
||||
break;
|
||||
|
||||
case GDK_VISUAL_DIRECT_COLOR:
|
||||
private->private_val = TRUE;
|
||||
private->xcolormap = XCreateColormap (private->xdisplay, gdk_root_window,
|
||||
xvisual, AllocAll);
|
||||
|
||||
size = 1 << visual->red_prec;
|
||||
for (i = 0; i < size; i++)
|
||||
colormap->colors[i].red = i * 65535 / (size - 1);
|
||||
|
||||
size = 1 << visual->green_prec;
|
||||
for (i = 0; i < size; i++)
|
||||
colormap->colors[i].green = i * 65535 / (size - 1);
|
||||
|
||||
size = 1 << visual->blue_prec;
|
||||
for (i = 0; i < size; i++)
|
||||
colormap->colors[i].blue = i * 65535 / (size - 1);
|
||||
|
||||
gdk_colormap_change (colormap, visual->colormap_size);
|
||||
break;
|
||||
|
||||
case GDK_VISUAL_STATIC_GRAY:
|
||||
case GDK_VISUAL_STATIC_COLOR:
|
||||
case GDK_VISUAL_TRUE_COLOR:
|
||||
private->private_val = FALSE;
|
||||
private->xcolormap = XCreateColormap (private->xdisplay, gdk_root_window,
|
||||
xvisual, AllocNone);
|
||||
break;
|
||||
}
|
||||
|
||||
gdk_colormap_add (colormap);
|
||||
|
||||
return colormap;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_colormap_real_destroy (GdkColormap *colormap)
|
||||
{
|
||||
GdkColormapPrivate *private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
g_return_if_fail (colormap != NULL);
|
||||
|
||||
if (private->ref_count > 0)
|
||||
return;
|
||||
|
||||
gdk_colormap_remove (colormap);
|
||||
XFreeColormap (private->xdisplay, private->xcolormap);
|
||||
g_free (colormap);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_colormap_destroy (GdkColormap *colormap)
|
||||
{
|
||||
gdk_colormap_unref (colormap);
|
||||
}
|
||||
|
||||
GdkColormap*
|
||||
gdk_colormap_ref (GdkColormap *cmap)
|
||||
{
|
||||
GdkColormapPrivate *private = (GdkColormapPrivate *)cmap;
|
||||
g_return_val_if_fail (cmap != NULL, NULL);
|
||||
|
||||
private->ref_count += 1;
|
||||
return cmap;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_colormap_unref (GdkColormap *cmap)
|
||||
{
|
||||
GdkColormapPrivate *private = (GdkColormapPrivate *)cmap;
|
||||
g_return_if_fail (cmap != NULL);
|
||||
|
||||
private->ref_count -= 1;
|
||||
if (private->ref_count == 0)
|
||||
gdk_colormap_real_destroy (cmap);
|
||||
}
|
||||
|
||||
GdkColormap*
|
||||
gdk_colormap_get_system (void)
|
||||
{
|
||||
static GdkColormap *colormap = NULL;
|
||||
GdkColormapPrivate *private;
|
||||
XColor xpalette[256];
|
||||
gint i;
|
||||
|
||||
if (!colormap)
|
||||
{
|
||||
private = g_new (GdkColormapPrivate, 1);
|
||||
colormap = (GdkColormap*) private;
|
||||
|
||||
private->xdisplay = gdk_display;
|
||||
private->xcolormap = DefaultColormap (gdk_display, gdk_screen);
|
||||
private->visual = gdk_visual_get_system ();
|
||||
private->private_val = FALSE;
|
||||
private->next_color = 0;
|
||||
private->ref_count = 1;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
xpalette[i].pixel = i;
|
||||
xpalette[i].red = 0;
|
||||
xpalette[i].green = 0;
|
||||
xpalette[i].blue = 0;
|
||||
}
|
||||
|
||||
XQueryColors (gdk_display, private->xcolormap, xpalette, 256);
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
colormap->colors[i].pixel = xpalette[i].pixel;
|
||||
colormap->colors[i].red = xpalette[i].red;
|
||||
colormap->colors[i].green = xpalette[i].green;
|
||||
colormap->colors[i].blue = xpalette[i].blue;
|
||||
}
|
||||
|
||||
gdk_colormap_add (colormap);
|
||||
}
|
||||
|
||||
return colormap;
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_colormap_get_system_size (void)
|
||||
{
|
||||
return DisplayCells (gdk_display, gdk_screen);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_colormap_change (GdkColormap *colormap,
|
||||
gint ncolors)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
GdkVisual *visual;
|
||||
XColor palette[256];
|
||||
gint shift;
|
||||
int max_colors;
|
||||
int size;
|
||||
int i;
|
||||
|
||||
g_return_if_fail (colormap != NULL);
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
switch (private->visual->type)
|
||||
{
|
||||
case GDK_VISUAL_GRAYSCALE:
|
||||
case GDK_VISUAL_PSEUDO_COLOR:
|
||||
for (i = 0; i < ncolors; i++)
|
||||
{
|
||||
palette[i].pixel = colormap->colors[i].pixel;
|
||||
palette[i].red = colormap->colors[i].red;
|
||||
palette[i].green = colormap->colors[i].green;
|
||||
palette[i].blue = colormap->colors[i].blue;
|
||||
palette[i].flags = DoRed | DoGreen | DoBlue;
|
||||
}
|
||||
|
||||
XStoreColors (private->xdisplay, private->xcolormap, palette, ncolors);
|
||||
private->next_color = MAX (private->next_color, ncolors);
|
||||
break;
|
||||
|
||||
case GDK_VISUAL_DIRECT_COLOR:
|
||||
visual = private->visual;
|
||||
|
||||
shift = visual->red_shift;
|
||||
max_colors = 1 << visual->red_prec;
|
||||
size = (ncolors < max_colors) ? (ncolors) : (max_colors);
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
palette[i].pixel = i << shift;
|
||||
palette[i].red = colormap->colors[i].red;
|
||||
palette[i].flags = DoRed;
|
||||
}
|
||||
|
||||
XStoreColors (private->xdisplay, private->xcolormap, palette, size);
|
||||
|
||||
shift = visual->green_shift;
|
||||
max_colors = 1 << visual->green_prec;
|
||||
size = (ncolors < max_colors) ? (ncolors) : (max_colors);
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
palette[i].pixel = i << shift;
|
||||
palette[i].green = colormap->colors[i].green;
|
||||
palette[i].flags = DoGreen;
|
||||
}
|
||||
|
||||
XStoreColors (private->xdisplay, private->xcolormap, palette, size);
|
||||
|
||||
shift = visual->blue_shift;
|
||||
max_colors = 1 << visual->blue_prec;
|
||||
size = (ncolors < max_colors) ? (ncolors) : (max_colors);
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
palette[i].pixel = i << shift;
|
||||
palette[i].blue = colormap->colors[i].blue;
|
||||
palette[i].flags = DoBlue;
|
||||
}
|
||||
|
||||
XStoreColors (private->xdisplay, private->xcolormap, palette, size);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gdk_colors_store (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < ncolors; i++)
|
||||
{
|
||||
colormap->colors[i].pixel = colors[i].pixel;
|
||||
colormap->colors[i].red = colors[i].red;
|
||||
colormap->colors[i].green = colors[i].green;
|
||||
colormap->colors[i].blue = colors[i].blue;
|
||||
}
|
||||
|
||||
gdk_colormap_change (colormap, ncolors);
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_colors_alloc (GdkColormap *colormap,
|
||||
gint contiguous,
|
||||
gulong *planes,
|
||||
gint nplanes,
|
||||
gulong *pixels,
|
||||
gint npixels)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
gint return_val;
|
||||
|
||||
g_return_val_if_fail (colormap != NULL, 0);
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
return_val = XAllocColorCells (private->xdisplay, private->xcolormap,
|
||||
contiguous, planes, nplanes, pixels, npixels);
|
||||
|
||||
return return_val;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_colors_free (GdkColormap *colormap,
|
||||
gulong *pixels,
|
||||
gint npixels,
|
||||
gulong planes)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
|
||||
g_return_if_fail (colormap != NULL);
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
XFreeColors (private->xdisplay, private->xcolormap,
|
||||
pixels, npixels, planes);
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_color_white (GdkColormap *colormap,
|
||||
GdkColor *color)
|
||||
{
|
||||
gint return_val;
|
||||
|
||||
g_return_val_if_fail (colormap != NULL, FALSE);
|
||||
|
||||
if (color)
|
||||
{
|
||||
color->pixel = WhitePixel (gdk_display, gdk_screen);
|
||||
color->red = 65535;
|
||||
color->green = 65535;
|
||||
color->blue = 65535;
|
||||
|
||||
return_val = gdk_color_alloc (colormap, color);
|
||||
}
|
||||
else
|
||||
return_val = FALSE;
|
||||
|
||||
return return_val;
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_color_black (GdkColormap *colormap,
|
||||
GdkColor *color)
|
||||
{
|
||||
gint return_val;
|
||||
|
||||
g_return_val_if_fail (colormap != NULL, FALSE);
|
||||
|
||||
if (color)
|
||||
{
|
||||
color->pixel = BlackPixel (gdk_display, gdk_screen);
|
||||
color->red = 0;
|
||||
color->green = 0;
|
||||
color->blue = 0;
|
||||
|
||||
return_val = gdk_color_alloc (colormap, color);
|
||||
}
|
||||
else
|
||||
return_val = FALSE;
|
||||
|
||||
return return_val;
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_color_parse (const gchar *spec,
|
||||
GdkColor *color)
|
||||
{
|
||||
Colormap xcolormap;
|
||||
XColor xcolor;
|
||||
gint return_val;
|
||||
|
||||
g_return_val_if_fail (spec != NULL, FALSE);
|
||||
g_return_val_if_fail (color != NULL, FALSE);
|
||||
|
||||
xcolormap = DefaultColormap (gdk_display, gdk_screen);
|
||||
|
||||
if (XParseColor (gdk_display, xcolormap, spec, &xcolor))
|
||||
{
|
||||
return_val = TRUE;
|
||||
color->red = xcolor.red;
|
||||
color->green = xcolor.green;
|
||||
color->blue = xcolor.blue;
|
||||
}
|
||||
else
|
||||
return_val = FALSE;
|
||||
|
||||
return return_val;
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_color_alloc (GdkColormap *colormap,
|
||||
GdkColor *color)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
GdkVisual *visual;
|
||||
XColor xcolor;
|
||||
gchar available[256];
|
||||
gint available_init;
|
||||
gint return_val;
|
||||
gint i, index;
|
||||
|
||||
g_return_val_if_fail (colormap != NULL, FALSE);
|
||||
g_return_val_if_fail (color != NULL, FALSE);
|
||||
|
||||
xcolor.red = color->red;
|
||||
xcolor.green = color->green;
|
||||
xcolor.blue = color->blue;
|
||||
xcolor.pixel = color->pixel;
|
||||
xcolor.flags = DoRed | DoGreen | DoBlue;
|
||||
|
||||
return_val = FALSE;
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
switch (private->visual->type)
|
||||
{
|
||||
case GDK_VISUAL_GRAYSCALE:
|
||||
case GDK_VISUAL_PSEUDO_COLOR:
|
||||
if (private->private_val)
|
||||
{
|
||||
if (private->next_color > 255)
|
||||
{
|
||||
for (i = 0; i < 256; i++)
|
||||
available[i] = TRUE;
|
||||
|
||||
index = gdk_colormap_match_color (colormap, color, available);
|
||||
if (index != -1)
|
||||
{
|
||||
available[index] = FALSE;
|
||||
*color = colormap->colors[index];
|
||||
return_val = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return_val = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xcolor.pixel = 255 - private->next_color;
|
||||
color->pixel = xcolor.pixel;
|
||||
private->next_color += 1;
|
||||
|
||||
XStoreColor (private->xdisplay, private->xcolormap, &xcolor);
|
||||
return_val = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
available_init = 1;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (XAllocColor (private->xdisplay, private->xcolormap, &xcolor))
|
||||
{
|
||||
color->pixel = xcolor.pixel;
|
||||
color->red = xcolor.red;
|
||||
color->green = xcolor.green;
|
||||
color->blue = xcolor.blue;
|
||||
|
||||
colormap->colors[color->pixel] = *color;
|
||||
|
||||
return_val = TRUE;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (available_init)
|
||||
{
|
||||
available_init = 0;
|
||||
for (i = 0; i < 256; i++)
|
||||
available[i] = TRUE;
|
||||
}
|
||||
|
||||
index = gdk_colormap_match_color (colormap, color, available);
|
||||
if (index != -1)
|
||||
{
|
||||
available[index] = FALSE;
|
||||
xcolor.red = colormap->colors[index].red;
|
||||
xcolor.green = colormap->colors[index].green;
|
||||
xcolor.blue = colormap->colors[index].blue;
|
||||
}
|
||||
else
|
||||
{
|
||||
return_val = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GDK_VISUAL_DIRECT_COLOR:
|
||||
visual = private->visual;
|
||||
xcolor.pixel = (((xcolor.red >> (16 - visual->red_prec)) << visual->red_shift) +
|
||||
((xcolor.green >> (16 - visual->green_prec)) << visual->green_shift) +
|
||||
((xcolor.blue >> (16 - visual->blue_prec)) << visual->blue_shift));
|
||||
color->pixel = xcolor.pixel;
|
||||
return_val = TRUE;
|
||||
break;
|
||||
|
||||
case GDK_VISUAL_STATIC_GRAY:
|
||||
case GDK_VISUAL_STATIC_COLOR:
|
||||
case GDK_VISUAL_TRUE_COLOR:
|
||||
if (XAllocColor (private->xdisplay, private->xcolormap, &xcolor))
|
||||
{
|
||||
color->pixel = xcolor.pixel;
|
||||
return_val = TRUE;
|
||||
}
|
||||
else
|
||||
return_val = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
return return_val;
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_color_change (GdkColormap *colormap,
|
||||
GdkColor *color)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
XColor xcolor;
|
||||
|
||||
g_return_val_if_fail (colormap != NULL, FALSE);
|
||||
g_return_val_if_fail (color != NULL, FALSE);
|
||||
|
||||
xcolor.pixel = color->pixel;
|
||||
xcolor.red = color->red;
|
||||
xcolor.green = color->green;
|
||||
xcolor.blue = color->blue;
|
||||
xcolor.flags = DoRed | DoGreen | DoBlue;
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
XStoreColor (private->xdisplay, private->xcolormap, &xcolor);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_color_equal (GdkColor *colora,
|
||||
GdkColor *colorb)
|
||||
{
|
||||
g_return_val_if_fail (colora != NULL, FALSE);
|
||||
g_return_val_if_fail (colorb != NULL, FALSE);
|
||||
|
||||
return ((colora->red == colorb->red) &&
|
||||
(colora->green == colorb->green) &&
|
||||
(colora->blue == colorb->blue));
|
||||
}
|
||||
|
||||
GdkColormap*
|
||||
gdkx_colormap_get (Colormap xcolormap)
|
||||
{
|
||||
GdkColormap *colormap;
|
||||
GdkColormapPrivate *private;
|
||||
XColor xpalette[256];
|
||||
gint i;
|
||||
|
||||
colormap = gdk_colormap_lookup (xcolormap);
|
||||
if (colormap)
|
||||
return colormap;
|
||||
|
||||
if (xcolormap == DefaultColormap (gdk_display, gdk_screen))
|
||||
return gdk_colormap_get_system ();
|
||||
|
||||
private = g_new (GdkColormapPrivate, 1);
|
||||
colormap = (GdkColormap*) private;
|
||||
|
||||
private->xdisplay = gdk_display;
|
||||
private->xcolormap = xcolormap;
|
||||
private->visual = NULL;
|
||||
private->private_val = TRUE;
|
||||
private->next_color = 0;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
xpalette[i].pixel = i;
|
||||
xpalette[i].red = 0;
|
||||
xpalette[i].green = 0;
|
||||
xpalette[i].blue = 0;
|
||||
}
|
||||
|
||||
XQueryColors (gdk_display, private->xcolormap, xpalette, 256);
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
colormap->colors[i].pixel = xpalette[i].pixel;
|
||||
colormap->colors[i].red = xpalette[i].red;
|
||||
colormap->colors[i].green = xpalette[i].green;
|
||||
colormap->colors[i].blue = xpalette[i].blue;
|
||||
}
|
||||
|
||||
gdk_colormap_add (colormap);
|
||||
|
||||
return colormap;
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
gdk_colormap_match_color (GdkColormap *cmap,
|
||||
GdkColor *color,
|
||||
const gchar *available)
|
||||
{
|
||||
GdkColor *colors;
|
||||
guint sum, max;
|
||||
gint rdiff, gdiff, bdiff;
|
||||
gint i, index;
|
||||
|
||||
g_return_val_if_fail (cmap != NULL, 0);
|
||||
g_return_val_if_fail (color != NULL, 0);
|
||||
|
||||
colors = cmap->colors;
|
||||
max = 3 * (65536);
|
||||
index = -1;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
if ((!available) || (available && available[i]))
|
||||
{
|
||||
rdiff = (color->red - colors[i].red);
|
||||
gdiff = (color->green - colors[i].green);
|
||||
bdiff = (color->blue - colors[i].blue);
|
||||
|
||||
sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
|
||||
|
||||
if (sum < max)
|
||||
{
|
||||
index = i;
|
||||
max = sum;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
GdkColormap*
|
||||
gdk_colormap_lookup (Colormap xcolormap)
|
||||
{
|
||||
GdkColormap *cmap;
|
||||
|
||||
if (!colormap_hash)
|
||||
return NULL;
|
||||
|
||||
cmap = g_hash_table_lookup (colormap_hash, &xcolormap);
|
||||
return cmap;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_colormap_add (GdkColormap *cmap)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
|
||||
if (!colormap_hash)
|
||||
colormap_hash = g_hash_table_new ((GHashFunc) gdk_colormap_hash,
|
||||
(GCompareFunc) gdk_colormap_cmp);
|
||||
|
||||
private = (GdkColormapPrivate*) cmap;
|
||||
|
||||
g_hash_table_insert (colormap_hash, &private->xcolormap, cmap);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_colormap_remove (GdkColormap *cmap)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
|
||||
if (!colormap_hash)
|
||||
colormap_hash = g_hash_table_new ((GHashFunc) gdk_colormap_hash,
|
||||
(GCompareFunc) gdk_colormap_cmp);
|
||||
|
||||
private = (GdkColormapPrivate*) cmap;
|
||||
|
||||
g_hash_table_remove (colormap_hash, &private->xcolormap);
|
||||
}
|
||||
|
||||
static guint
|
||||
gdk_colormap_hash (Colormap *cmap)
|
||||
{
|
||||
return *cmap;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_colormap_cmp (Colormap *a,
|
||||
Colormap *b)
|
||||
{
|
||||
return (*a == *b);
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/cursorfont.h>
|
||||
#include "gdk.h"
|
||||
#include "gdkprivate.h"
|
||||
|
||||
|
||||
GdkCursor*
|
||||
gdk_cursor_new (GdkCursorType cursor_type)
|
||||
{
|
||||
GdkCursorPrivate *private;
|
||||
GdkCursor *cursor;
|
||||
Cursor xcursor;
|
||||
|
||||
xcursor = XCreateFontCursor (gdk_display, cursor_type);
|
||||
private = g_new (GdkCursorPrivate, 1);
|
||||
private->xdisplay = gdk_display;
|
||||
private->xcursor = xcursor;
|
||||
cursor = (GdkCursor*) private;
|
||||
cursor->type = cursor_type;
|
||||
|
||||
return cursor;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_cursor_destroy (GdkCursor *cursor)
|
||||
{
|
||||
GdkCursorPrivate *private;
|
||||
|
||||
g_return_if_fail (cursor != NULL);
|
||||
|
||||
private = (GdkCursorPrivate *) cursor;
|
||||
XFreeCursor (private->xdisplay, private->xcursor);
|
||||
|
||||
g_free (private);
|
||||
}
|
||||
383
gdk/gdkdraw.c
383
gdk/gdkdraw.c
@@ -1,383 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xos.h>
|
||||
#include "gdk.h"
|
||||
#include "gdkprivate.h"
|
||||
|
||||
|
||||
void
|
||||
gdk_draw_point (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
GdkWindowPrivate *drawable_private;
|
||||
GdkGCPrivate *gc_private;
|
||||
|
||||
g_return_if_fail (drawable != NULL);
|
||||
g_return_if_fail (gc != NULL);
|
||||
|
||||
drawable_private = (GdkWindowPrivate*) drawable;
|
||||
gc_private = (GdkGCPrivate*) gc;
|
||||
|
||||
XDrawPoint (drawable_private->xdisplay, drawable_private->xwindow,
|
||||
gc_private->xgc, x, y);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_draw_line (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
gint x1,
|
||||
gint y1,
|
||||
gint x2,
|
||||
gint y2)
|
||||
{
|
||||
GdkWindowPrivate *drawable_private;
|
||||
GdkGCPrivate *gc_private;
|
||||
|
||||
g_return_if_fail (drawable != NULL);
|
||||
g_return_if_fail (gc != NULL);
|
||||
|
||||
drawable_private = (GdkWindowPrivate*) drawable;
|
||||
gc_private = (GdkGCPrivate*) gc;
|
||||
|
||||
XDrawLine (drawable_private->xdisplay, drawable_private->xwindow,
|
||||
gc_private->xgc, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_draw_rectangle (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
gint filled,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkWindowPrivate *drawable_private;
|
||||
GdkGCPrivate *gc_private;
|
||||
|
||||
g_return_if_fail (drawable != NULL);
|
||||
g_return_if_fail (gc != NULL);
|
||||
|
||||
drawable_private = (GdkWindowPrivate*) drawable;
|
||||
gc_private = (GdkGCPrivate*) gc;
|
||||
|
||||
if (width == -1)
|
||||
width = drawable_private->width;
|
||||
if (height == -1)
|
||||
height = drawable_private->height;
|
||||
|
||||
if (filled)
|
||||
XFillRectangle (drawable_private->xdisplay, drawable_private->xwindow,
|
||||
gc_private->xgc, x, y, width, height);
|
||||
else
|
||||
XDrawRectangle (drawable_private->xdisplay, drawable_private->xwindow,
|
||||
gc_private->xgc, x, y, width, height);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_draw_arc (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
gint filled,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
gint angle1,
|
||||
gint angle2)
|
||||
{
|
||||
GdkWindowPrivate *drawable_private;
|
||||
GdkGCPrivate *gc_private;
|
||||
|
||||
g_return_if_fail (drawable != NULL);
|
||||
g_return_if_fail (gc != NULL);
|
||||
|
||||
drawable_private = (GdkWindowPrivate*) drawable;
|
||||
gc_private = (GdkGCPrivate*) gc;
|
||||
|
||||
if (width == -1)
|
||||
width = drawable_private->width;
|
||||
if (height == -1)
|
||||
height = drawable_private->height;
|
||||
|
||||
if (filled)
|
||||
XFillArc (drawable_private->xdisplay, drawable_private->xwindow,
|
||||
gc_private->xgc, x, y, width, height, angle1, angle2);
|
||||
else
|
||||
XDrawArc (drawable_private->xdisplay, drawable_private->xwindow,
|
||||
gc_private->xgc, x, y, width, height, angle1, angle2);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_draw_polygon (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
gint filled,
|
||||
GdkPoint *points,
|
||||
gint npoints)
|
||||
{
|
||||
GdkWindowPrivate *drawable_private;
|
||||
GdkGCPrivate *gc_private;
|
||||
|
||||
g_return_if_fail (drawable != NULL);
|
||||
g_return_if_fail (gc != NULL);
|
||||
|
||||
drawable_private = (GdkWindowPrivate*) drawable;
|
||||
gc_private = (GdkGCPrivate*) gc;
|
||||
|
||||
if (filled)
|
||||
{
|
||||
XFillPolygon (drawable_private->xdisplay, drawable_private->xwindow,
|
||||
gc_private->xgc, (XPoint*) points, npoints, Complex, CoordModeOrigin);
|
||||
}
|
||||
else
|
||||
{
|
||||
XDrawLines (drawable_private->xdisplay, drawable_private->xwindow,
|
||||
gc_private->xgc, (XPoint*) points, npoints, CoordModeOrigin);
|
||||
|
||||
if ((points[0].x != points[npoints-1].x) ||
|
||||
(points[0].y != points[npoints-1].y))
|
||||
XDrawLine (drawable_private->xdisplay, drawable_private->xwindow,
|
||||
gc_private->xgc, points[npoints-1].x, points[npoints-1].y,
|
||||
points[0].x, points[0].y);
|
||||
}
|
||||
}
|
||||
|
||||
/* gdk_draw_string
|
||||
*
|
||||
* Modified by Li-Da Lho to draw 16 bits and Multibyte strings
|
||||
*
|
||||
* Interface changed: add "GdkFont *font" to specify font or fontset explicitely
|
||||
*/
|
||||
void
|
||||
gdk_draw_string (GdkDrawable *drawable,
|
||||
GdkFont *font,
|
||||
GdkGC *gc,
|
||||
gint x,
|
||||
gint y,
|
||||
const gchar *string)
|
||||
{
|
||||
GdkWindowPrivate *drawable_private;
|
||||
GdkFontPrivate *font_private;
|
||||
GdkGCPrivate *gc_private;
|
||||
|
||||
g_return_if_fail (drawable != NULL);
|
||||
g_return_if_fail (font != NULL);
|
||||
g_return_if_fail (gc != NULL);
|
||||
g_return_if_fail (string != NULL);
|
||||
|
||||
drawable_private = (GdkWindowPrivate*) drawable;
|
||||
gc_private = (GdkGCPrivate*) gc;
|
||||
font_private = (GdkFontPrivate*) font;
|
||||
|
||||
if (font->type == GDK_FONT_FONT)
|
||||
{
|
||||
XFontStruct *xfont = (XFontStruct *) font_private->xfont;
|
||||
XSetFont(drawable_private->xdisplay, gc_private->xgc, xfont->fid);
|
||||
if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
|
||||
{
|
||||
XDrawString (drawable_private->xdisplay, drawable_private->xwindow,
|
||||
gc_private->xgc, x, y, string, strlen (string));
|
||||
}
|
||||
else
|
||||
{
|
||||
XDrawString16 (drawable_private->xdisplay, drawable_private->xwindow,
|
||||
gc_private->xgc, x, y, (XChar2b *) string,
|
||||
strlen (string) / 2);
|
||||
}
|
||||
}
|
||||
else if (font->type == GDK_FONT_FONTSET)
|
||||
{
|
||||
XFontSet fontset = (XFontSet) font_private->xfont;
|
||||
XmbDrawString (drawable_private->xdisplay, drawable_private->xwindow,
|
||||
fontset, gc_private->xgc, x, y, string, strlen (string));
|
||||
}
|
||||
else
|
||||
g_error("undefined font type\n");
|
||||
}
|
||||
|
||||
/* gdk_draw_text
|
||||
*
|
||||
* Modified by Li-Da Lho to draw 16 bits and Multibyte strings
|
||||
*
|
||||
* Interface changed: add "GdkFont *font" to specify font or fontset explicitely
|
||||
*/
|
||||
void
|
||||
gdk_draw_text (GdkDrawable *drawable,
|
||||
GdkFont *font,
|
||||
GdkGC *gc,
|
||||
gint x,
|
||||
gint y,
|
||||
const gchar *text,
|
||||
gint text_length)
|
||||
{
|
||||
GdkWindowPrivate *drawable_private;
|
||||
GdkFontPrivate *font_private;
|
||||
GdkGCPrivate *gc_private;
|
||||
|
||||
g_return_if_fail (drawable != NULL);
|
||||
g_return_if_fail (font != NULL);
|
||||
g_return_if_fail (gc != NULL);
|
||||
g_return_if_fail (text != NULL);
|
||||
|
||||
drawable_private = (GdkWindowPrivate*) drawable;
|
||||
gc_private = (GdkGCPrivate*) gc;
|
||||
font_private = (GdkFontPrivate*) font;
|
||||
|
||||
if (font->type == GDK_FONT_FONT)
|
||||
{
|
||||
XFontStruct *xfont = (XFontStruct *) font_private->xfont;
|
||||
XSetFont(drawable_private->xdisplay, gc_private->xgc, xfont->fid);
|
||||
if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
|
||||
{
|
||||
XDrawString (drawable_private->xdisplay, drawable_private->xwindow,
|
||||
gc_private->xgc, x, y, text, text_length);
|
||||
}
|
||||
else
|
||||
{
|
||||
XDrawString16 (drawable_private->xdisplay, drawable_private->xwindow,
|
||||
gc_private->xgc, x, y, (XChar2b *) text, text_length / 2);
|
||||
}
|
||||
}
|
||||
else if (font->type == GDK_FONT_FONTSET)
|
||||
{
|
||||
XFontSet fontset = (XFontSet) font_private->xfont;
|
||||
XmbDrawString (drawable_private->xdisplay, drawable_private->xwindow,
|
||||
fontset, gc_private->xgc, x, y, text, text_length);
|
||||
}
|
||||
else
|
||||
g_error("undefined font type\n");
|
||||
}
|
||||
|
||||
void
|
||||
gdk_draw_pixmap (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPixmap *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkWindowPrivate *drawable_private;
|
||||
GdkWindowPrivate *src_private;
|
||||
GdkGCPrivate *gc_private;
|
||||
|
||||
g_return_if_fail (drawable != NULL);
|
||||
g_return_if_fail (src != NULL);
|
||||
g_return_if_fail (gc != NULL);
|
||||
|
||||
drawable_private = (GdkWindowPrivate*) drawable;
|
||||
src_private = (GdkWindowPrivate*) src;
|
||||
gc_private = (GdkGCPrivate*) gc;
|
||||
|
||||
if (width == -1)
|
||||
width = src_private->width;
|
||||
if (height == -1)
|
||||
height = src_private->height;
|
||||
|
||||
XCopyArea (drawable_private->xdisplay,
|
||||
src_private->xwindow,
|
||||
drawable_private->xwindow,
|
||||
gc_private->xgc,
|
||||
xsrc, ysrc,
|
||||
width, height,
|
||||
xdest, ydest);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_draw_image (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkImage *image,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkImagePrivate *image_private;
|
||||
|
||||
g_return_if_fail (drawable != NULL);
|
||||
g_return_if_fail (image != NULL);
|
||||
g_return_if_fail (gc != NULL);
|
||||
|
||||
image_private = (GdkImagePrivate*) image;
|
||||
|
||||
g_return_if_fail (image_private->image_put != NULL);
|
||||
|
||||
if (width == -1)
|
||||
width = image->width;
|
||||
if (height == -1)
|
||||
height = image->height;
|
||||
|
||||
(* image_private->image_put) (drawable, gc, image, xsrc, ysrc,
|
||||
xdest, ydest, width, height);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_draw_points (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPoint *points,
|
||||
gint npoints)
|
||||
{
|
||||
GdkWindowPrivate *drawable_private;
|
||||
GdkGCPrivate *gc_private;
|
||||
|
||||
g_return_if_fail (drawable != NULL);
|
||||
g_return_if_fail ((points != NULL) && (npoints > 0));
|
||||
g_return_if_fail (gc != NULL);
|
||||
|
||||
drawable_private = (GdkWindowPrivate*) drawable;
|
||||
gc_private = (GdkGCPrivate*) gc;
|
||||
|
||||
XDrawPoints (drawable_private->xdisplay,
|
||||
drawable_private->xwindow,
|
||||
gc_private->xgc,
|
||||
(XPoint *) points,
|
||||
npoints,
|
||||
CoordModeOrigin);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_draw_segments (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkSegment *segs,
|
||||
gint nsegs)
|
||||
{
|
||||
GdkWindowPrivate *drawable_private;
|
||||
GdkGCPrivate *gc_private;
|
||||
|
||||
if (nsegs <= 0)
|
||||
return;
|
||||
|
||||
g_return_if_fail (drawable != NULL);
|
||||
g_return_if_fail (segs != NULL);
|
||||
g_return_if_fail (gc != NULL);
|
||||
|
||||
drawable_private = (GdkWindowPrivate*) drawable;
|
||||
gc_private = (GdkGCPrivate*) gc;
|
||||
|
||||
XDrawSegments (drawable_private->xdisplay,
|
||||
drawable_private->xwindow,
|
||||
gc_private->xgc,
|
||||
(XSegment *) segs,
|
||||
nsegs);
|
||||
}
|
||||
379
gdk/gdkfont.c
379
gdk/gdkfont.c
@@ -1,379 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xos.h>
|
||||
#include "gdk.h"
|
||||
#include "gdkprivate.h"
|
||||
|
||||
GdkFont*
|
||||
gdk_font_load (const gchar *font_name)
|
||||
{
|
||||
GdkFont *font;
|
||||
GdkFontPrivate *private;
|
||||
|
||||
private = g_new (GdkFontPrivate, 1);
|
||||
font = (GdkFont*) private;
|
||||
|
||||
private->xdisplay = gdk_display;
|
||||
private->xfont = XLoadQueryFont (private->xdisplay, font_name);
|
||||
private->ref_count = 1;
|
||||
|
||||
if (!private->xfont)
|
||||
{
|
||||
g_free (font);
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
font->type = GDK_FONT_FONT;
|
||||
font->ascent = ((XFontStruct *) private->xfont)->ascent;
|
||||
font->descent = ((XFontStruct *) private->xfont)->descent;
|
||||
}
|
||||
|
||||
gdk_xid_table_insert (&((XFontStruct *) private->xfont)->fid, font);
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
GdkFont*
|
||||
gdk_fontset_load(gchar *fontset_name)
|
||||
{
|
||||
GdkFont *font;
|
||||
GdkFontPrivate *private;
|
||||
XFontSet fontset;
|
||||
gint missing_charset_count;
|
||||
gchar **missing_charset_list;
|
||||
gchar *def_string;
|
||||
|
||||
private = g_new (GdkFontPrivate, 1);
|
||||
font = (GdkFont*) private;
|
||||
|
||||
private->xdisplay = gdk_display;
|
||||
fontset = XCreateFontSet (gdk_display, fontset_name,
|
||||
&missing_charset_list, &missing_charset_count,
|
||||
&def_string);
|
||||
|
||||
if (missing_charset_count)
|
||||
{
|
||||
g_print ("Missing charsets in FontSet creation");
|
||||
XFreeStringList (missing_charset_list);
|
||||
}
|
||||
|
||||
private->ref_count = 1;
|
||||
|
||||
if (!fontset)
|
||||
{
|
||||
g_free (font);
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
XFontSetExtents *extent = XExtentsOfFontSet(fontset);
|
||||
|
||||
private->xfont = fontset;
|
||||
font->type = GDK_FONT_FONTSET;
|
||||
/* how to define ascent and descent for fontset ??? */
|
||||
font->ascent = extent->max_logical_extent.height;
|
||||
font->descent = font->ascent / 4 ;
|
||||
}
|
||||
return font;
|
||||
}
|
||||
void
|
||||
gdk_font_free (GdkFont *font)
|
||||
{
|
||||
GdkFontPrivate *private;
|
||||
|
||||
g_return_if_fail (font != NULL);
|
||||
|
||||
private = (GdkFontPrivate*) font;
|
||||
|
||||
private->ref_count -= 1;
|
||||
if (private->ref_count == 0)
|
||||
{
|
||||
gdk_xid_table_remove (((XFontStruct *) private->xfont)->fid);
|
||||
XFreeFont (private->xdisplay, (XFontStruct *) private->xfont);
|
||||
g_free (font);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gdk_fontset_free (GdkFont *font)
|
||||
{
|
||||
GdkFontPrivate *private;
|
||||
|
||||
g_return_if_fail (font != NULL);
|
||||
|
||||
private = (GdkFontPrivate*) font;
|
||||
|
||||
private->ref_count -= 1;
|
||||
if (private->ref_count == 0)
|
||||
{
|
||||
XFreeFontSet (private->xdisplay, (XFontSet) private->xfont);
|
||||
g_free (font);
|
||||
}
|
||||
}
|
||||
|
||||
GdkFont*
|
||||
gdk_font_ref (GdkFont *font)
|
||||
{
|
||||
GdkFontPrivate *private;
|
||||
|
||||
g_return_val_if_fail (font != NULL, NULL);
|
||||
|
||||
private = (GdkFontPrivate*) font;
|
||||
private->ref_count += 1;
|
||||
return font;
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_font_id (GdkFont *font)
|
||||
{
|
||||
GdkFontPrivate *font_private;
|
||||
|
||||
g_return_val_if_fail (font != NULL, 0);
|
||||
|
||||
font_private = (GdkFontPrivate*) font;
|
||||
|
||||
if (font->type == GDK_FONT_FONT)
|
||||
{
|
||||
return ((XFontStruct *) font_private->xfont)->fid;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_font_equal (GdkFont *fonta,
|
||||
GdkFont *fontb)
|
||||
{
|
||||
GdkFontPrivate *privatea;
|
||||
GdkFontPrivate *privateb;
|
||||
|
||||
g_return_val_if_fail (fonta != NULL, FALSE);
|
||||
g_return_val_if_fail (fontb != NULL, FALSE);
|
||||
|
||||
privatea = (GdkFontPrivate*) fonta;
|
||||
privateb = (GdkFontPrivate*) fontb;
|
||||
|
||||
if (fonta->type == GDK_FONT_FONT && fontb->type == GDK_FONT_FONT)
|
||||
{
|
||||
return (((XFontStruct *) privatea->xfont)->fid ==
|
||||
((XFontStruct *) privateb->xfont)->fid);
|
||||
}
|
||||
else if (fonta->type == GDK_FONT_FONTSET && fontb->type == GDK_FONT_FONTSET)
|
||||
{
|
||||
/* how to compare two fontsets ?? by basename or XFontSet ?? */
|
||||
return (((XFontSet) privatea->xfont) == ((XFontSet) privateb->xfont));
|
||||
}
|
||||
else
|
||||
/* fontset != font */
|
||||
return 0;
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_string_width (GdkFont *font,
|
||||
const gchar *string)
|
||||
{
|
||||
GdkFontPrivate *font_private;
|
||||
gint width;
|
||||
XFontStruct *xfont;
|
||||
XFontSet fontset;
|
||||
|
||||
g_return_val_if_fail (font != NULL, -1);
|
||||
g_return_val_if_fail (string != NULL, -1);
|
||||
|
||||
font_private = (GdkFontPrivate*) font;
|
||||
|
||||
switch (font->type)
|
||||
{
|
||||
case GDK_FONT_FONT:
|
||||
xfont = (XFontStruct *) font_private->xfont;
|
||||
if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
|
||||
{
|
||||
width = XTextWidth (xfont, string, strlen (string));
|
||||
}
|
||||
else
|
||||
{
|
||||
width = XTextWidth16 (xfont, (XChar2b *) string, strlen (string) / 2);
|
||||
}
|
||||
break;
|
||||
case GDK_FONT_FONTSET:
|
||||
fontset = (XFontSet) font_private->xfont;
|
||||
width = XmbTextEscapement (fontset, string, strlen(string));
|
||||
break;
|
||||
default:
|
||||
width = 0;
|
||||
}
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_text_width (GdkFont *font,
|
||||
const gchar *text,
|
||||
gint text_length)
|
||||
{
|
||||
GdkFontPrivate *private;
|
||||
gint width;
|
||||
XFontStruct *xfont;
|
||||
XFontSet fontset;
|
||||
|
||||
g_return_val_if_fail (font != NULL, -1);
|
||||
g_return_val_if_fail (text != NULL, -1);
|
||||
|
||||
private = (GdkFontPrivate*) font;
|
||||
|
||||
switch (font->type)
|
||||
{
|
||||
case GDK_FONT_FONT:
|
||||
xfont = (XFontStruct *) private->xfont;
|
||||
if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
|
||||
{
|
||||
width = XTextWidth (xfont, text, text_length);
|
||||
}
|
||||
else
|
||||
{
|
||||
width = XTextWidth16 (xfont, (XChar2b *) text, text_length / 2);
|
||||
}
|
||||
break;
|
||||
case GDK_FONT_FONTSET:
|
||||
fontset = (XFontSet) private->xfont;
|
||||
width = XmbTextEscapement (fontset, text, text_length);
|
||||
break;
|
||||
default:
|
||||
width = 0;
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
||||
/* Problem: What if a character is a 16 bits character ?? */
|
||||
gint
|
||||
gdk_char_width (GdkFont *font,
|
||||
gchar character)
|
||||
{
|
||||
GdkFontPrivate *private;
|
||||
XCharStruct *chars;
|
||||
gint width;
|
||||
guint ch = character & 0xff; /* get rid of sign-extension */
|
||||
XFontStruct *xfont;
|
||||
XFontSet fontset;
|
||||
|
||||
g_return_val_if_fail (font != NULL, -1);
|
||||
|
||||
private = (GdkFontPrivate*) font;
|
||||
|
||||
switch (font->type)
|
||||
{
|
||||
case GDK_FONT_FONT:
|
||||
/* only 8 bits characters are considered here */
|
||||
xfont = (XFontStruct *) private->xfont;
|
||||
if ((xfont->min_byte1 == 0) &&
|
||||
(xfont->max_byte1 == 0) &&
|
||||
(ch >= xfont->min_char_or_byte2) &&
|
||||
(ch <= xfont->max_char_or_byte2))
|
||||
{
|
||||
chars = xfont->per_char;
|
||||
if (chars)
|
||||
width = chars[ch - xfont->min_char_or_byte2].width;
|
||||
else
|
||||
width = xfont->min_bounds.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
width = XTextWidth (xfont, &character, 1);
|
||||
}
|
||||
break;
|
||||
case GDK_FONT_FONTSET:
|
||||
fontset = (XFontSet) private->xfont;
|
||||
width = XmbTextEscapement (fontset, &character, 1) ;
|
||||
break;
|
||||
default:
|
||||
width = 0;
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_string_measure (GdkFont *font,
|
||||
const gchar *string)
|
||||
{
|
||||
g_return_val_if_fail (font != NULL, -1);
|
||||
g_return_val_if_fail (string != NULL, -1);
|
||||
|
||||
return gdk_text_measure (font, string, strlen (string));
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_text_measure (GdkFont *font,
|
||||
const gchar *text,
|
||||
gint text_length)
|
||||
{
|
||||
GdkFontPrivate *private;
|
||||
XCharStruct overall;
|
||||
XFontStruct *xfont;
|
||||
XFontSet fontset;
|
||||
XRectangle ink, log;
|
||||
int direction;
|
||||
int font_ascent;
|
||||
int font_descent;
|
||||
gint width;
|
||||
|
||||
g_return_val_if_fail (font != NULL, -1);
|
||||
g_return_val_if_fail (text != NULL, -1);
|
||||
|
||||
private = (GdkFontPrivate*) font;
|
||||
|
||||
switch (font->type)
|
||||
{
|
||||
case GDK_FONT_FONT:
|
||||
xfont = (XFontStruct *) private->xfont;
|
||||
if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
|
||||
{
|
||||
XTextExtents (xfont, text, text_length,
|
||||
&direction, &font_ascent, &font_descent,
|
||||
&overall);
|
||||
}
|
||||
else
|
||||
{
|
||||
XTextExtents16 (xfont, (XChar2b *) text, text_length / 2,
|
||||
&direction, &font_ascent, &font_descent,
|
||||
&overall);
|
||||
}
|
||||
width = overall.rbearing;
|
||||
break;
|
||||
case GDK_FONT_FONTSET:
|
||||
fontset = (XFontSet) private->xfont;
|
||||
XmbTextExtents (fontset, text, text_length, &ink, &log);
|
||||
width = log.width;
|
||||
break;
|
||||
default:
|
||||
width = 0;
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_char_measure (GdkFont *font,
|
||||
gchar character)
|
||||
{
|
||||
g_return_val_if_fail (font != NULL, -1);
|
||||
|
||||
return gdk_text_measure (font, &character, 1);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user