1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
|
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="class-gdkpixbuf">
<refnamediv>
<refname>gtk.gdk.Pixbuf</refname>
<refpurpose>an object containing a client side image.</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<classsynopsis language="python">
<ooclass><classname>gtk.gdk.Pixbuf</classname></ooclass>
<ooclass><classname><link
linkend="class-gobject">gobject.GObject</link></classname></ooclass>
<constructorsynopsis language="python">
<methodname><link
linkend="constructor-gdkpixbuf">gtk.gdk.Pixbuf</link></methodname>
<methodparam><parameter
role="keyword">colorspace</parameter></methodparam>
<methodparam><parameter
role="keyword">has_alpha</parameter></methodparam>
<methodparam><parameter
role="keyword">bits_per_sample</parameter></methodparam>
<methodparam><parameter
role="keyword">width</parameter></methodparam>
<methodparam><parameter
role="keyword">height</parameter></methodparam>
</constructorsynopsis>
<methodsynopsis language="python">
<methodname><link inkend="method-gdkpixbuf--apply-embedded-orientation">apply_embedded_orientation</link></methodname>
<methodparam></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--render-to-drawable">render_to_drawable</link></methodname>
<methodparam><parameter
role="keyword">drawable</parameter></methodparam>
<methodparam><parameter role="keyword">gc</parameter></methodparam>
<methodparam><parameter
role="keyword">src_x</parameter></methodparam>
<methodparam><parameter
role="keyword">src_y</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_x</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_y</parameter></methodparam>
<methodparam><parameter
role="keyword">width</parameter></methodparam>
<methodparam><parameter
role="keyword">height</parameter></methodparam>
<methodparam><parameter
role="keyword">dither</parameter></methodparam>
<methodparam><parameter
role="keyword">x_dither</parameter></methodparam>
<methodparam><parameter
role="keyword">y_dither</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--render-to-drawable-alpha">render_to_drawable_alpha</link></methodname>
<methodparam><parameter
role="keyword">drawable</parameter></methodparam>
<methodparam><parameter
role="keyword">src_x</parameter></methodparam>
<methodparam><parameter
role="keyword">src_y</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_x</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_y</parameter></methodparam>
<methodparam><parameter
role="keyword">width</parameter></methodparam>
<methodparam><parameter
role="keyword">height</parameter></methodparam>
<methodparam><parameter
role="keyword">alpha_mode</parameter></methodparam>
<methodparam><parameter
role="keyword">alpha_threshold</parameter></methodparam>
<methodparam><parameter
role="keyword">dither</parameter></methodparam>
<methodparam><parameter
role="keyword">x_dither</parameter></methodparam>
<methodparam><parameter
role="keyword">y_dither</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--render-pixmap-and-mask">render_pixmap_and_mask</link></methodname>
<methodparam><parameter
role="keyword">alpha_threshold</parameter><initializer>127</initializer></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--get-from-drawable">get_from_drawable</link></methodname>
<methodparam><parameter role="keyword">src</parameter></methodparam>
<methodparam><parameter
role="keyword">cmap</parameter></methodparam>
<methodparam><parameter
role="keyword">src_x</parameter></methodparam>
<methodparam><parameter
role="keyword">src_y</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_x</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_y</parameter></methodparam>
<methodparam><parameter
role="keyword">width</parameter></methodparam>
<methodparam><parameter
role="keyword">height</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--get-from-image">get_from_image</link></methodname>
<methodparam><parameter role="keyword">src</parameter></methodparam>
<methodparam><parameter
role="keyword">cmap</parameter></methodparam>
<methodparam><parameter
role="keyword">src_x</parameter></methodparam>
<methodparam><parameter
role="keyword">src_y</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_x</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_y</parameter></methodparam>
<methodparam><parameter
role="keyword">width</parameter></methodparam>
<methodparam><parameter
role="keyword">height</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--get-colorspace">get_colorspace</link></methodname>
<methodparam></methodparam> </methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--get-n-channels">get_n_channels</link></methodname>
<methodparam></methodparam> </methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--get-has-alpha">get_has_alpha</link></methodname>
<methodparam></methodparam> </methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--get-bits-per-sample">get_bits_per_sample</link></methodname>
<methodparam></methodparam> </methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--get-pixels">get_pixels</link></methodname>
<methodparam></methodparam> </methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--get-width">get_width</link></methodname>
<methodparam></methodparam> </methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--get-height">get_height</link></methodname>
<methodparam></methodparam> </methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--get-rowstride">get_rowstride</link></methodname>
<methodparam></methodparam> </methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--get-option">get_option</link></methodname>
<methodparam><parameter role="keyword">key</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--copy">copy</link></methodname>
<methodparam></methodparam> </methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--fill">fill</link></methodname>
<methodparam><parameter
role="keyword">pixel</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--save">save</link></methodname>
<methodparam><parameter
role="keyword">filename</parameter></methodparam>
<methodparam><parameter
role="keyword">type</parameter></methodparam>
<methodparam><parameter
role="keyword">options</parameter>
<initializer>None</initializer></methodparam>
</methodsynopsis>
<!-- NOT IMPLEMENTED
<methodsynopsis language="python">
<methodname><link linkend="method-gdkpixbuf- -savev">savev</link></methodname>
<methodparam><parameter role="keyword">filename</parameter></methodparam>
<methodparam><parameter role="keyword">type</parameter></methodparam>
<methodparam><parameter role="keyword">option_keys</parameter></methodparam>
<methodparam><parameter role="keyword">option_values</parameter></methodparam>
<methodparam><parameter role="keyword">error</parameter></methodparam>
</methodsynopsis>
END NOT IMPLEMENTED -->
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--save-to-callback">save_to_callback</link></methodname>
<methodparam><parameter
role="keyword">save_func</parameter></methodparam>
<methodparam><parameter
role="keyword">type</parameter></methodparam>
<methodparam><parameter
role="keyword">options</parameter>
<initializer>None</initializer></methodparam>
<methodparam><parameter
role="keyword">user_data</parameter>
<initializer>None</initializer></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--add-alpha">add_alpha</link></methodname>
<methodparam><parameter
role="keyword">substitute_color</parameter></methodparam>
<methodparam><parameter role="keyword">r</parameter></methodparam>
<methodparam><parameter role="keyword">g</parameter></methodparam>
<methodparam><parameter role="keyword">b</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--copy-area">copy_area</link></methodname>
<methodparam><parameter
role="keyword">src_x</parameter></methodparam>
<methodparam><parameter
role="keyword">src_y</parameter></methodparam>
<methodparam><parameter
role="keyword">width</parameter></methodparam>
<methodparam><parameter
role="keyword">height</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_pixbuf</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_x</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_y</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--saturate-and-pixelate">saturate_and_pixelate</link></methodname>
<methodparam><parameter
role="keyword">dest</parameter></methodparam>
<methodparam><parameter
role="keyword">saturation</parameter></methodparam>
<methodparam><parameter
role="keyword">pixelate</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--scale">scale</link></methodname>
<methodparam><parameter
role="keyword">dest</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_x</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_y</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_width</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_height</parameter></methodparam>
<methodparam><parameter
role="keyword">offset_x</parameter></methodparam>
<methodparam><parameter
role="keyword">offset_y</parameter></methodparam>
<methodparam><parameter
role="keyword">scale_x</parameter></methodparam>
<methodparam><parameter
role="keyword">scale_y</parameter></methodparam>
<methodparam><parameter
role="keyword">interp_type</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--composite">composite</link></methodname>
<methodparam><parameter
role="keyword">dest</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_x</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_y</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_width</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_height</parameter></methodparam>
<methodparam><parameter
role="keyword">offset_x</parameter></methodparam>
<methodparam><parameter
role="keyword">offset_y</parameter></methodparam>
<methodparam><parameter
role="keyword">scale_x</parameter></methodparam>
<methodparam><parameter
role="keyword">scale_y</parameter></methodparam>
<methodparam><parameter
role="keyword">interp_type</parameter></methodparam>
<methodparam><parameter
role="keyword">overall_alpha</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--composite-color">composite_color</link></methodname>
<methodparam><parameter
role="keyword">dest</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_x</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_y</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_width</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_height</parameter></methodparam>
<methodparam><parameter
role="keyword">offset_x</parameter></methodparam>
<methodparam><parameter
role="keyword">offset_y</parameter></methodparam>
<methodparam><parameter
role="keyword">scale_x</parameter></methodparam>
<methodparam><parameter
role="keyword">scale_y</parameter></methodparam>
<methodparam><parameter
role="keyword">interp_type</parameter></methodparam>
<methodparam><parameter
role="keyword">overall_alpha</parameter></methodparam>
<methodparam><parameter
role="keyword">check_x</parameter></methodparam>
<methodparam><parameter
role="keyword">check_y</parameter></methodparam>
<methodparam><parameter
role="keyword">check_size</parameter></methodparam>
<methodparam><parameter
role="keyword">color1</parameter></methodparam>
<methodparam><parameter
role="keyword">color2</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--scale-simple">scale_simple</link></methodname>
<methodparam><parameter
role="keyword">dest_width</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_height</parameter></methodparam>
<methodparam><parameter
role="keyword">interp_type</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--composite-color-simple">composite_color_simple</link></methodname>
<methodparam><parameter
role="keyword">dest_width</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_height</parameter></methodparam>
<methodparam><parameter
role="keyword">interp_type</parameter></methodparam>
<methodparam><parameter
role="keyword">overall_alpha</parameter></methodparam>
<methodparam><parameter
role="keyword">check_size</parameter></methodparam>
<methodparam><parameter
role="keyword">color1</parameter></methodparam>
<methodparam><parameter
role="keyword">color2</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link linkend="method-gdkpixbuf--get-pixels-array">get_pixels_array</link></methodname>
<methodparam></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--subpixbuf">subpixbuf</link></methodname>
<methodparam><parameter
role="keyword">src_x</parameter></methodparam>
<methodparam><parameter
role="keyword">src_y</parameter></methodparam>
<methodparam><parameter
role="keyword">width</parameter></methodparam>
<methodparam><parameter
role="keyword">height</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--rotate-simple">rotate_simple</link></methodname>
<methodparam><parameter
role="keyword">angle</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gdkpixbuf--flip">flip</link></methodname>
<methodparam><parameter
role="keyword">horizontal</parameter></methodparam>
</methodsynopsis>
</classsynopsis>
<programlisting>
<emphasis role="bold">Functions</emphasis>
<methodsynopsis language="python">
<methodname><link
linkend="function-gdk--pixbuf-new-from-file">gtk.gdk.pixbuf_new_from_file</link></methodname>
<methodparam><parameter
role="keyword">filename</parameter></methodparam>
</methodsynopsis><methodsynopsis language="python">
<methodname><link
linkend="function-gdk--pixbuf-new-from-file-at-size">gtk.gdk.pixbuf_new_from_file_at_size</link></methodname>
<methodparam><parameter
role="keyword">filename</parameter></methodparam>
<methodparam><parameter
role="keyword">width</parameter></methodparam>
<methodparam><parameter
role="keyword">height</parameter></methodparam>
</methodsynopsis><methodsynopsis language="python">
<methodname><link
linkend="function-gdk--pixbuf-new-from-data">gtk.gdk.pixbuf_new_from_data</link></methodname>
<methodparam><parameter
role="keyword">data</parameter></methodparam>
<methodparam><parameter
role="keyword">colorspace</parameter></methodparam>
<methodparam><parameter
role="keyword">has_alpha</parameter></methodparam>
<methodparam><parameter
role="keyword">bits_per_sample</parameter></methodparam>
<methodparam><parameter
role="keyword">width</parameter></methodparam>
<methodparam><parameter
role="keyword">height</parameter></methodparam>
<methodparam><parameter
role="keyword">rowstride</parameter></methodparam>
</methodsynopsis><methodsynopsis language="python">
<methodname><link
linkend="function-gdk--pixbuf-new-from-array">gtk.gdk.pixbuf_new_from_array</link></methodname>
<methodparam><parameter
role="keyword">array</parameter></methodparam>
<methodparam><parameter
role="keyword">colorspace</parameter></methodparam>
<methodparam><parameter
role="keyword">bits_per_sample</parameter></methodparam>
</methodsynopsis><methodsynopsis language="python">
<methodname><link
linkend="function-gdk--pixbuf-new-from-xpm-data">gtk.gdk.pixbuf_new_from_xpm_data</link></methodname>
<methodparam><parameter
role="keyword">data</parameter></methodparam>
</methodsynopsis><methodsynopsis language="python">
<methodname><link
linkend="function-gdk--pixbuf-new-from-inline">gtk.gdk.pixbuf_new_from_inline</link></methodname>
<methodparam><parameter
role="keyword">data_length</parameter></methodparam>
<methodparam><parameter
role="keyword">data</parameter></methodparam>
<methodparam><parameter
role="keyword">copy_pixels</parameter></methodparam>
</methodsynopsis><methodsynopsis language="python">
<methodname><link
linkend="function-gdk--pixbuf-get-formats">gtk.gdk.pixbuf_get_formats</link></methodname>
</methodsynopsis><methodsynopsis language="python">
<methodname><link
linkend="function-gdk--pixbuf-get-file-info">gtk.gdk.pixbuf_get_file_info</link></methodname>
<methodparam><parameter
role="keyword">filename</parameter></methodparam>
</methodsynopsis></programlisting>
</refsect1>
<refsect1>
<title>Ancestry</title>
<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
+-- <link linkend="class-gdkpixbuf">gtk.gdk.Pixbuf</link>
</synopsis>
</refsect1>
<refsect1>
<title>Attributes</title>
<blockquote role="properties">
<informaltable pgwide="1" frame="none">
<tgroup cols="3">
<?dbhtml cellpadding="5"?>
<colspec column="1" colwidth="1in"/>
<colspec column="2" colwidth="1in"/>
<colspec column="3" colwidth="4in"/>
<tbody>
<row valign="top">
<entry>"pixel_array"</entry>
<entry>Read</entry>
<entry>A numeric array containing the pixel values of the
<link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>. The
contents of the numeric array can be changed even though the array is
read-only. However you cannot change the pixel data of pixbufs that are
backed by a const string such as stock icon pixbufs.
<literal>PyGTK</literal> must be compiled with Numeric Python support for
this to work.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</blockquote>
</refsect1>
<refsect1>
<title>Properties</title>
<blockquote role="properties">
<informaltable pgwide="1" frame="none">
<tgroup cols="3">
<colspec column="1" colwidth="1in"/>
<colspec column="2" colwidth="1in"/>
<colspec column="3" colwidth="4in"/>
<tbody>
<row valign="top">
<entry>"bits-per-sample"</entry>
<entry>Read-Write-Construct Only</entry>
<entry>The number of bits per sample. Available in GTK+ 2.4
and above.</entry>
</row>
<row valign="top">
<entry>"colorspace"</entry>
<entry>Read-Write-Construct Only</entry>
<entry>The colorspace in which the samples are interpreted.Available in GTK+ 2.4 and above.</entry>
</row>
<row valign="top">
<entry>"has-alpha"</entry>
<entry>Read-Write-Construct Only</entry>
<entry>If <literal>True</literal>,the pixbuf has an alpha
channel. Available in GTK+ 2.4 and above.</entry>
</row>
<row valign="top">
<entry>"height"</entry>
<entry>Read-Write-Construct Only</entry>
<entry>The number of rows of the pixbuf. Available in GTK+ 2.4
and above.</entry>
</row>
<row valign="top">
<entry>"n-channels"</entry>
<entry>Read-Write-Construct Only</entry>
<entry>The number of samples per pixel. Available in GTK+ 2.4
and above.</entry>
</row>
<row valign="top">
<entry>"pixels"</entry>
<entry>Read-Write-Construct Only</entry>
<entry>A pointer to the pixel data of the pixbuf. Available
in GTK+ 2.4 and above.</entry>
</row>
<row valign="top">
<entry>"rowstride"</entry>
<entry>Read-Write-Construct Only</entry>
<entry>The number of bytes between the start of a row and
the start of the next row. Available in GTK+ 2.4 and above.</entry>
</row>
<row valign="top">
<entry>"width"</entry>
<entry>Read-Write-Construct Only</entry>
<entry>The number of columns of the pixbuf. Available in GTK+ 2.4
and above.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</blockquote>
</refsect1>
<refsect1>
<title>Description</title>
<para>A <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
object contains the data that describes an image using client side
resources. By contrast a <link
linkend="class-gdkpixmap"><classname>gtk.gdk.Pixmap</classname></link> uses
server side resources to hold image data. Manipulating the image data in a
<link linkend="class-gdkpixmap"><classname>gtk.gdk.Pixmap</classname></link>
may involve round trip transfers between a client and a server in X11 while
manipulating image data in a <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
involves only client side operations. Therefore using <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
objects may be more efficient than using <link
linkend="class-gdkpixmap"><classname>gtk.gdk.Pixmap</classname></link>
objects if a lot of image manipulation is necessary.</para>
<para>In addition to the methods associated with a <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
object there are a number of functions that can be used to create <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
objects from file and inline data.</para>
</refsect1>
<refsect1 id="constructor-gdkpixbuf">
<title>Constructor</title>
<programlisting><constructorsynopsis language="python">
<methodname>gtk.gdk.Pixbuf</methodname>
<methodparam><parameter
role="keyword">colorspace</parameter></methodparam>
<methodparam><parameter
role="keyword">has_alpha</parameter></methodparam>
<methodparam><parameter
role="keyword">bits_per_sample</parameter></methodparam>
<methodparam><parameter
role="keyword">width</parameter></methodparam>
<methodparam><parameter
role="keyword">height</parameter></methodparam>
</constructorsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">colorspace</parameter> :</term>
<listitem><simpara>the color space for the image - currently only
<literal>gtk.gdk.COLORSPACE_RGB</literal>.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">has_alpha</parameter> :</term>
<listitem><simpara>if <literal>True</literal> the image will have
transparency information.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">bits_per_sample</parameter> :</term>
<listitem><simpara>the number of bits per color sample - currently
must be 8.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">width</parameter> :</term>
<listitem><simpara>the width of image in
pixels.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">height</parameter> :</term>
<listitem><simpara>the height of image in
pixels.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a newly-created <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>.</simpara></listitem>
</varlistentry>
</variablelist>
<para>Creates a new <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
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 yourself. The size of the image is specified by
<parameter>width</parameter> and <parameter>height</parameter>.</para>
</refsect1>
<refsect1>
<title>Methods</title>
<refsect2 id="method-gdkpixbuf--apply-embedded-orientation">
<title>gtk.gdk.Pixbuf.apply_embedded_orientation</title>
<programlisting><methodsynopsis language="python">
<methodname>apply_embedded_orientation</methodname>
<methodparam></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>A newly-created pixbuf.</simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This method was available in PyGTK 2.16 and above.</para>
</note>
<para>
The <methodname>apply_embedded_orientation</methodname>() method takes an existing
pixbuf and checks for the presence of an associated "orientation" option,
which may be provided by the jpeg loader (which reads the exif orientation tag)
or the tiff loader (which reads the tiff orientation tag, and compensates it for
the partial transforms performed by libtiff). If an orientation option/tag is present,
the appropriate transform will be performed so that the pixbuf is oriented correctly.
</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--render-to-drawable">
<title>gtk.gdk.Pixbuf.render_to_drawable</title>
<programlisting><methodsynopsis language="python">
<methodname>render_to_drawable</methodname>
<methodparam><parameter
role="keyword">drawable</parameter></methodparam>
<methodparam><parameter
role="keyword">gc</parameter></methodparam>
<methodparam><parameter
role="keyword">src_x</parameter></methodparam>
<methodparam><parameter
role="keyword">src_y</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_x</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_y</parameter></methodparam>
<methodparam><parameter
role="keyword">width</parameter></methodparam>
<methodparam><parameter
role="keyword">height</parameter></methodparam>
<methodparam><parameter
role="keyword">dither</parameter></methodparam>
<methodparam><parameter
role="keyword">x_dither</parameter></methodparam>
<methodparam><parameter
role="keyword">y_dither</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">drawable</parameter> :</term>
<listitem><simpara>the destination <link
linkend="class-gdkdrawable"><classname>gtk.gdk.Drawable</classname></link>.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">gc</parameter> :</term>
<listitem><simpara>the <link
linkend="class-gdkgc"><classname>gtk.gdk.GC</classname></link> used for
rendering.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">src_x</parameter> :</term>
<listitem><simpara>the X coordinate within the
pixbuf.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">src_y</parameter> :</term>
<listitem><simpara>the Y coordinate within the
pixbuf.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">dest_x</parameter> :</term>
<listitem><simpara>the X coordinate within
<parameter>drawable</parameter>.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">dest_y</parameter> :</term>
<listitem><simpara>the Y coordinate within
<parameter>drawable</parameter>.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">width</parameter> :</term>
<listitem><simpara>the width of region to render, in pixels, or -1
to use pixbuf width</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">height</parameter> :</term>
<listitem><simpara>the height of region to render, in pixels, or
-1 to use pixbuf height</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">dither</parameter> :</term>
<listitem><simpara>the dithering mode.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">x_dither</parameter> :</term>
<listitem><simpara>the X offset for
dithering.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">y_dither</parameter> :</term>
<listitem><simpara>the Y offset for
dithering.</simpara></listitem>
</varlistentry>
</variablelist>
<warning>
<para>This method is deprecated in PyGTK 2.2 and above. Use the
<link
linkend="method-gdkdrawable--draw-pixbuf"><methodname>gtk.gdk.Drawable.draw_pixbuf</methodname>()</link>
method instead.</para>
</warning>
<para>The <methodname>render_to_drawable</methodname>() method renders
a rectangular portion of the pixbuf to a <link
linkend="class-gdkdrawable"><classname>gtk.gdk.Drawable</classname></link>
specified by <parameter>drawable</parameter> while using the <link
linkend="class-gdkgc"><classname>gtk.gdk.GC</classname></link> specified by
<parameter>gc</parameter>. This is done using GdkRGB, so the specified
drawable must have the GdkRGB visual and colormap. Note that this method
will ignore the opacity information for images with an alpha channel; the
<link linkend="class-gdkgc"><classname>gtk.gdk.GC</classname></link> must
already have the clipping mask set if you want transparent regions to show
through.</para>
<para>The dither offset is important when re-rendering partial regions
of an image to a rendered version of the full image, or when the offsets to
a base position change, as in scrolling. The dither matrix has to be shifted
for consistent visual results. If you do not have any of these cases, the
dither offsets can be both zero.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--render-to-drawable-alpha">
<title>gtk.gdk.Pixbuf.render_to_drawable_alpha</title>
<programlisting><methodsynopsis language="python">
<methodname>render_to_drawable_alpha</methodname>
<methodparam><parameter
role="keyword">drawable</parameter></methodparam>
<methodparam><parameter
role="keyword">src_x</parameter></methodparam>
<methodparam><parameter
role="keyword">src_y</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_x</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_y</parameter></methodparam>
<methodparam><parameter
role="keyword">width</parameter></methodparam>
<methodparam><parameter
role="keyword">height</parameter></methodparam>
<methodparam><parameter
role="keyword">alpha_mode</parameter></methodparam>
<methodparam><parameter
role="keyword">alpha_threshold</parameter></methodparam>
<methodparam><parameter
role="keyword">dither</parameter></methodparam>
<methodparam><parameter
role="keyword">x_dither</parameter></methodparam>
<methodparam><parameter
role="keyword">y_dither</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">drawable</parameter> :</term>
<listitem><simpara>the destination <link
linkend="class-gdkdrawable"><classname>gtk.gdk.Drawable</classname></link>.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">gc</parameter> :</term>
<listitem><simpara>the <link
linkend="class-gdkgc"><classname>gtk.gdk.GC</classname></link> used for
rendering.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">src_x</parameter> :</term>
<listitem><simpara>the X coordinate within the
pixbuf.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">src_y</parameter> :</term>
<listitem><simpara>the Y coordinate within the
pixbuf.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">dest_x</parameter> :</term>
<listitem><simpara>the X coordinate within
<parameter>drawable</parameter>.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">dest_y</parameter> :</term>
<listitem><simpara>the Y coordinate within
<parameter>drawable</parameter>.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">width</parameter> :</term>
<listitem><simpara>the width of region to render, in pixels, or -1
to use pixbuf width</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">height</parameter> :</term>
<listitem><simpara>the height of region to render, in pixels, or
-1 to use pixbuf height</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">alpha_mode</parameter> :</term>
<listitem><simpara>Ignored. Present for backward
compatibility.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">alpha_threshold</parameter> :</term>
<listitem><simpara>Ignored. Present for backward
compatibility</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">dither</parameter> :</term>
<listitem><simpara>the dithering mode.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">x_dither</parameter> :</term>
<listitem><simpara>the X offset for
dithering.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">y_dither</parameter> :</term>
<listitem><simpara>the Y offset for
dithering.</simpara></listitem>
</varlistentry>
</variablelist>
<warning>
<para>This method is deprecated in PyGTK 2.2 and above. Use the
<link
linkend="method-gdkdrawable--draw-pixbuf"><methodname>gtk.gdk.Drawable.draw_pixbuf</methodname>()</link>
method instead.</para>
</warning>
<para>The <methodname>render_to_drawable_alpha</methodname>() method
renders a rectangular portion of the pixbuf to a <link
linkend="class-gdkdrawable"><classname>gtk.gdk.Drawable</classname></link>
specified by <parameter>drawable</parameter>.
<parameter>drawable</parameter> must have a colormap. All windows have a
colormap; however, pixmaps only have colormap by default if they were
created with a window argument.specifying a <link
linkend="class-gdkwindow"><classname>gtk.gdk.Window</classname></link>.
Otherwise a colormap must be set on them with the <link
linkend="method-gdkdrawable--set-colormap"><methodname>gtk.gdk.Drawable.set_colormap</methodname>()</link>
method. On older X servers, rendering pixbufs with an alpha channel involves
round trips to the X server, and may be somewhat slow.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--render-pixmap-and-mask">
<title>gtk.gdk.Pixbuf.render_pixmap_and_mask</title>
<programlisting><methodsynopsis language="python">
<methodname>render_pixmap_and_mask</methodname>
<methodparam><parameter
role="keyword">alpha_threshold</parameter><initializer>127</initializer></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter
role="keyword">alpha_threshold</parameter> :</term>
<listitem><simpara>the threshold value for opacity
values.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a tuple containing the created pixmap and
mask.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>render_to_pixmap_and_mask</methodname>() method
returns a tuple containing a pixmap and a mask bitmap that the pixbuf and
its corresponding thresholded alpha mask are rendered to. This is merely a
convenience method; applications that need to render pixbufs with dither
offsets or to specific drawables should use the <link
linkend="method-gdkpixbuf--render-to-drawable-alpha"><methodname>render_to_drawable_alpha</methodname>()</link>
or <link
linkend="method-gdkpixbuf--render-to-drawable"><methodname>render_to_drawable</methodname>()</link>
methods. If the pixbuf does not have an alpha channel, then the mask
returned will be None.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--get-from-drawable">
<title>gtk.gdk.Pixbuf.get_from_drawable</title>
<programlisting><methodsynopsis language="python">
<methodname>get_from_drawable</methodname>
<methodparam><parameter
role="keyword">src</parameter></methodparam>
<methodparam><parameter
role="keyword">cmap</parameter></methodparam>
<methodparam><parameter
role="keyword">src_x</parameter></methodparam>
<methodparam><parameter
role="keyword">src_y</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_x</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_y</parameter></methodparam>
<methodparam><parameter
role="keyword">width</parameter></methodparam>
<methodparam><parameter
role="keyword">height</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">src</parameter> :</term>
<listitem><simpara>the source <link
linkend="class-gdkdrawable"><classname>gtk.gdk.Drawable</classname></link>.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">cmap</parameter> :</term>
<listitem><simpara>a colormap if <parameter>src</parameter>
doesn't have one set.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">src_x</parameter> :</term>
<listitem><simpara>the X coordinate within
<parameter>drawable</parameter>.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">src_y</parameter> :</term>
<listitem><simpara>the Y coordinate within
<parameter>drawable</parameter>.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">dest_x</parameter> :</term>
<listitem><simpara>the X coordinate in the
pixbuf.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">dest_y</parameter> :</term>
<listitem><simpara>the Y coordinate in the
pixbuf.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">width</parameter> :</term>
<listitem><simpara>the width in pixels of the region to
get.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">height</parameter> :</term>
<listitem><simpara>the height in pixels of the region to
get.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the pixbuf or <literal>None</literal> on
error</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_from_drawable</methodname>() method
transfers image data from the <link
linkend="class-gdkdrawable"><classname>gtk.gdk.Drawable</classname></link>
specified by <parameter>src</parameter> and converts it to an RGB(A)
representation inside a <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>. In
other words, copies image data from a server-side drawable to a client-side
RGB(A) buffer. This allows you to efficiently read individual pixels on the
client side. If <parameter>src</parameter> has no colormap (the <link
linkend="method-gdkdrawable--get-colormap"><methodname>gtk.gdk.Drawable.get_colormap</methodname>()</link>
method returns <literal>None</literal>), then a suitable colormap must be
specified as <parameter>cmap</parameter>. Typically a <link
linkend="class-gdkwindow"><classname>gtk.gdk.Window</classname></link> or a
pixmap created by passing a <link
linkend="class-gdkwindow"><classname>gtk.gdk.Window</classname></link> to
<function>gtk.gdk.Pixmap()</function> will already have a colormap
associated with it. If <parameter>src</parameter> has a colormap, the
<parameter>cmap</parameter> argument will be ignored. If
<parameter>src</parameter> is a bitmap (1 bit per pixel pixmap), then a
colormap is not required; pixels with a value of 1 are assumed to be white,
and pixels with a value of 0 are assumed to be black. For taking
screenshots, the <link
linkend="function-gdk--colormap-get-system"><methodname>gtk.gdk.colormap_get_system</methodname>()</link>
function returns the correct colormap to use.</para>
<para>If <parameter>src</parameter> is a pixmap, then the requested
source rectangle must be completely contained within the pixmap, otherwise
the function will return <literal>None</literal>. For pixmaps only (not for
windows) passing -1 for <parameter>width</parameter> or
<parameter>height</parameter> is allowed to mean the full width or height of
the pixmap. If <parameter>src</parameter> is a window, and the window
is off the screen, then there is no image data in the obscured/offscreen
regions to be placed in the pixbuf. The contents of portions of the pixbuf
corresponding to the offscreen region are undefined.</para>
<para>If the window you're obtaining data from is partially obscured
by other windows, then the contents of the pixbuf areas corresponding to the
obscured regions are undefined. If the target drawable is not mapped
(typically because it's iconified/minimized or not on the current
workspace), <literal>None</literal> will be returned. If memory can't be
allocated for the return value, <literal>None</literal> will be returned
instead. (In short, there are several ways this method can fail, and if it
fails it returns <literal>None</literal>; so check the return value.)</para>
<para>This method calls the <link
linkend="method-gdkdrawable--get-image"><methodname>gtk.gdk.Drawable.get_image</methodname>()</link>
method internally and converts the resulting image to a <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>, so
the documentation for the <link
linkend="method-gdkdrawable--get-image"><methodname>gtk.gdk.Drawable.get_image</methodname>()</link>
method may also be helpful.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--get-from-image">
<title>gtk.gdk.Pixbuf.get_from_image</title>
<programlisting><methodsynopsis language="python">
<methodname>get_from_image</methodname>
<methodparam><parameter
role="keyword">src</parameter></methodparam>
<methodparam><parameter
role="keyword">cmap</parameter></methodparam>
<methodparam><parameter
role="keyword">src_x</parameter></methodparam>
<methodparam><parameter
role="keyword">src_y</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_x</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_y</parameter></methodparam>
<methodparam><parameter
role="keyword">width</parameter></methodparam>
<methodparam><parameter
role="keyword">height</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">src</parameter> :</term>
<listitem><simpara>the source <link
linkend="class-gdkimage"><classname>gtk.gdk.Image</classname></link>.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">cmap</parameter> :</term>
<listitem><simpara>a colormap if <parameter>src</parameter>
doesn't have one set or <literal>None</literal>.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">src_x</parameter> :</term>
<listitem><simpara>the X coordinate within
<parameter>src</parameter>.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">src_y</parameter> :</term>
<listitem><simpara>the Y coordinate within
<parameter>src</parameter>.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">dest_x</parameter> :</term>
<listitem><simpara>the X coordinate in the
pixbuf.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">dest_y</parameter> :</term>
<listitem><simpara>the Y coordinate in the
pixbuf.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">width</parameter> :</term>
<listitem><simpara>the width in pixels of the region to
get.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">height</parameter> :</term>
<listitem><simpara>the height in pixels of the region to
get.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the pixbuf or <literal>None</literal> on
error</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_from_image</methodname>() method is the same
as the <link
linkend="method-gdkpixbuf--get-from-drawable"><methodname>get_from_drawable</methodname>()</link>
method but gets the pixbuf from the <link
linkend="class-gdkimage"><classname>gtk.gdk.Image</classname></link>
specified by <parameter>src</parameter>.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--get-colorspace">
<title>gtk.gdk.Pixbuf.get_colorspace</title>
<programlisting><methodsynopsis language="python">
<methodname>get_colorspace</methodname>
<methodparam></methodparam> </methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the color space.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_colorspace</methodname>() method returns the
color space of the pixbuf.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--get-n-channels">
<title>gtk.gdk.Pixbuf.get_n_channels</title>
<programlisting><methodsynopsis language="python">
<methodname>get_n_channels</methodname>
<methodparam></methodparam> </methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the number of channels.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_n_channels</methodname>() method returns the
number of channels of a pixbuf.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--get-has-alpha">
<title>gtk.gdk.Pixbuf.get_has_alpha</title>
<programlisting><methodsynopsis language="python">
<methodname>get_has_alpha</methodname>
<methodparam></methodparam> </methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara><literal>True</literal> if the pixbuf has an
alpha channel.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_has_alpha</methodname>() method returns
<literal>True</literal> if the pixbuf has an alpha channel (opacity
information).</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--get-bits-per-sample">
<title>gtk.gdk.Pixbuf.get_bits_per_sample</title>
<programlisting><methodsynopsis language="python">
<methodname>get_bits_per_sample</methodname>
<methodparam></methodparam> </methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the number of bits per color
sample.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_bits_per_sample</methodname>() method returns
the number of bits per color sample in a pixbuf.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--get-pixels">
<title>gtk.gdk.Pixbuf.get_pixels</title>
<programlisting><methodsynopsis language="python">
<methodname>get_pixels</methodname>
<methodparam></methodparam> </methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a string containing the pixel data of the
pixbuf</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_pixels</methodname>() method returns a sting
containing the pixel data of the pixbuf.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--get-width">
<title>gtk.gdk.Pixbuf.get_width</title>
<programlisting><methodsynopsis language="python">
<methodname>get_width</methodname>
<methodparam></methodparam> </methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the width in pixels.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_width</methodname>() method returns the
width of the pixbuf.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--get-height">
<title>gtk.gdk.Pixbuf.get_height</title>
<programlisting><methodsynopsis language="python">
<methodname>get_height</methodname>
<methodparam></methodparam> </methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the height in pixels.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_height</methodname>() method returns the
height of the pixbuf.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--get-rowstride">
<title>gtk.gdk.Pixbuf.get_rowstride</title>
<programlisting><methodsynopsis language="python">
<methodname>get_rowstride</methodname>
<methodparam></methodparam> </methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the number of bytes between
rows.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_rowstride</methodname>() method returns the
rowstride of a pixbuf, which is the number of bytes between rows.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--get-option">
<title>gtk.gdk.Pixbuf.get_option</title>
<programlisting><methodsynopsis language="python">
<methodname>get_option</methodname>
<methodparam><parameter
role="keyword">key</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">key</parameter> :</term>
<listitem><simpara>a key string</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the value associated with
<parameter>key</parameter></simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_option</methodname>() method looks up
<parameter>key</parameter> in the list of options that may have been
attached to the pixbuf when it was loaded.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--copy">
<title>gtk.gdk.Pixbuf.copy</title>
<programlisting><methodsynopsis language="python">
<methodname>copy</methodname>
<methodparam></methodparam> </methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>A newly-created pixbuf or
<literal>None</literal> if not enough memory could be
allocated.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>copy</methodname>() method returns a new <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link> with
a copy of the data in the pixbuf.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--fill">
<title>gtk.gdk.Pixbuf.fill</title>
<programlisting><methodsynopsis language="python">
<methodname>fill</methodname>
<methodparam><parameter
role="keyword">pixel</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">pixel</parameter> :</term>
<listitem><simpara>the RGBA pixel to clear to (0xffffffff is
opaque white, 0x00000000 transparent black)</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>fill</methodname>() method clears the pixbuf to
the RGBA value specified by <parameter>pixel</parameter>, converting the
RGBA value into the pixbuf's pixel format. The alpha will be ignored if the
pixbuf doesn't have an alpha channel.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--save">
<title>gtk.gdk.Pixbuf.save</title>
<programlisting><methodsynopsis language="python">
<methodname>save</methodname>
<methodparam><parameter
role="keyword">filename</parameter></methodparam>
<methodparam><parameter
role="keyword">type</parameter></methodparam>
<methodparam><parameter role="keyword">options</parameter>
<initializer>None</initializer></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">filename</parameter> :</term>
<listitem><simpara>the name of file to save.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">type</parameter> :</term>
<listitem><simpara>the name of the file
format.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">options</parameter> :</term>
<listitem><simpara>a Python dict containing key-value string pairs
or <literal>None</literal></simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>save</methodname>() method saves the pixbuf to a
file in the format specified by <parameter>type</parameter>, which may be
"jpeg" or "png". If <parameter>options</parameter> is not
<literal>None</literal> it should be a Python dict containing key-value
string pairs that modify the save parameters. For example:</para>
<informalexample><programlisting>
pixbuf.save(filename, "jpeg", {"quality":"100"})
</programlisting></informalexample>
<para>Currently only a few parameters exist. JPEG images can be saved
with a "quality" parameter; its value should be in the range [0,100]. Text
chunks can be attached to PNG images by specifying parameters of the form
"tEXt::key", where key is an ASCII string of length 1-79. Note however that
PNG text chunks are stored in ISO-8859-1 encoding, so you can only set texts
that can be represented in this encoding. The values are UTF-8 encoded
strings. ICO images can be saved in depth 16, 24, or 32, by using the
"depth" parameter. When the ICO saver is given "x_hot" and "y_hot"
parameters, it produces a CUR instead of an ICO.</para>
<para>This method raises the GError exception if an error occurs
during the save operation.</para>
</refsect2>
<!-- NOT IMPLEMENTED
<refsect2 id="method-gdkpixbuf- -savev">
<title>gtk.gdk.Pixbuf.savev</title>
<programlisting><methodsynopsis language="python">
<methodname>savev</methodname>
<methodparam><parameter role="keyword">filename</parameter></methodparam>
<methodparam><parameter role="keyword">type</parameter></methodparam>
<methodparam><parameter role="keyword">option_keys</parameter></methodparam>
<methodparam><parameter role="keyword">option_values</parameter></methodparam>
<methodparam><parameter role="keyword">error</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">filename</parameter> :</term>
<listitem><simpara>name of file to save.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">type</parameter> :</term>
<listitem><simpara>name of file format.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">option_keys</parameter> :</term>
<listitem><simpara>name of options to set, <literal>NULL</literal>-terminated</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">option_values</parameter> :</term>
<listitem><simpara>values for named options</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">error</parameter> :</term>
<listitem><simpara>return location for error, or <literal>NULL</literal></simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>whether an error was set</simpara></listitem>
</varlistentry>
</variablelist>
<para>
Saves pixbuf to a file in <parameter>type</parameter>, which is currently "jpeg" or "png".
If <parameter>error</parameter> is set, <literal>False</literal> will be returned. See <link linkend="method-gdkpixbuf- -save"><function>gtk.gdk.Pixbuf.save()</function></link> for more
details.
</para> </refsect2>
END NOT IMPLEMENTED -->
<refsect2 id="method-gdkpixbuf--save-to-callback">
<title>gtk.gdk.Pixbuf.save_to_callback</title>
<programlisting><methodsynopsis language="python">
<methodname>save_to_callback</methodname>
<methodparam><parameter
role="keyword">save_func</parameter></methodparam>
<methodparam><parameter
role="keyword">type</parameter></methodparam>
<methodparam><parameter
role="keyword">options</parameter>
<initializer>None</initializer></methodparam>
<methodparam><parameter
role="keyword">user_data</parameter>
<initializer>None</initializer></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">save_func</parameter> :</term>
<listitem><simpara> a function that is called to save each block
of data that the save routine generates.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">type</parameter> :</term>
<listitem><simpara>the name of the file
format.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">options</parameter> :</term>
<listitem><simpara>a Python dict containing key-value string pairs
or <literal>None</literal></simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">user_data</parameter> :</term>
<listitem><simpara>user-specified data passed to
<literal>save_func</literal> or <literal>None</literal></simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This method was available in PyGTK 2.8 and above.</para>
</note>
<para>The <methodname>save_to_callback</methodname>() method saves the
pixbuf in the format specified by <parameter>type</parameter> by feeding the
pixbuf data to the callback function specified by
<parameter>save_func</parameter>. <parameter>type</parameter> may be "jpeg",
"png" or "ico" or other installed formats. If <parameter>options</parameter>
is not <literal>None</literal> it should be a Python dict containing
key-value string pairs that modify the save parameters. For example:</para>
<informalexample><programlisting>
pixbuf.save_to_callback(func, "jpeg", {"quality":"100"})
</programlisting></informalexample>
<para>See the <link
linkend="method-gdkpixbuf--save"><methodname>save</methodname>()</link>
method for more information on formats. If <parameter>user_data</parameter>
is not None it is passed to <parameter>save_func</parameter> with each
invocation.</para>
<para>This method raises a GError exception or exceptions raised by
<parameter>save_func</parameter> if an error occurs during the save
operation.</para>
<para>The signature of <parameter>save_func</parameter> is:</para>
<programlisting>
def pixbuf_save_func(buf, data=None):
</programlisting>
<para>where <parameter>buf</parameter> is a Python string containing
the pixbuf data and <parameter>data</parameter> is
<parameter>user_data</parameter>. <parameter>pixbuf_save_func</parameter>
returns <literal>True</literal> if successful or <literal>False</literal> on
failure.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--add-alpha">
<title>gtk.gdk.Pixbuf.add_alpha</title>
<programlisting><methodsynopsis language="python">
<methodname>add_alpha</methodname>
<methodparam><parameter
role="keyword">substitute_color</parameter></methodparam>
<methodparam><parameter role="keyword">r</parameter></methodparam>
<methodparam><parameter role="keyword">g</parameter></methodparam>
<methodparam><parameter role="keyword">b</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter
role="keyword">substitute_color</parameter> :</term>
<listitem><simpara>if <literal>False</literal>, the
(<parameter>r</parameter>, <parameter>g</parameter>,
<parameter>b</parameter>) arguments will be ignored.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">r</parameter> :</term>
<listitem><simpara>the red value to
substitute.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">g</parameter> :</term>
<listitem><simpara>the green value to
substitute.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">b</parameter> :</term>
<listitem><simpara>the blue value to
substitute.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a new <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>add_alpha</methodname>() method returns a new <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
created from the pixbuf with an alpha channel added. If the pixbuf already
had an alpha channel, the channel values are copied; otherwise, the alpha
channel is initialized to 255 (full opacity).</para>
<para>If <parameter>substitute_color</parameter> is
<literal>True</literal>, then the color specified by
(<parameter>r</parameter>, <parameter>g</parameter>,
<parameter>b</parameter>) will be assigned zero opacity. That is, if you
pass (255, 255, 255) for the substitute color, all white pixels will become
fully transparent.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--copy-area">
<title>gtk.gdk.Pixbuf.copy_area</title>
<programlisting><methodsynopsis language="python">
<methodname>copy_area</methodname>
<methodparam><parameter
role="keyword">src_x</parameter></methodparam>
<methodparam><parameter
role="keyword">src_y</parameter></methodparam>
<methodparam><parameter
role="keyword">width</parameter></methodparam>
<methodparam><parameter
role="keyword">height</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_pixbuf</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_x</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_y</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">src_x</parameter> :</term>
<listitem><simpara>the X coordinate within the
pixbuf.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">src_y</parameter> :</term>
<listitem><simpara>the Y coordinate within the
pixbuf.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">width</parameter> :</term>
<listitem><simpara>the width of the area to
copy.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">height</parameter> :</term>
<listitem><simpara>the height of the area to
copy.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">dest_pixbuf</parameter> :</term>
<listitem><simpara>the destination pixbuf.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">dest_x</parameter> :</term>
<listitem><simpara>the X coordinate within
<parameter>dest_pixbuf</parameter>.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">dest_y</parameter> :</term>
<listitem><simpara>the Y coordinate within
<parameter>dest_pixbuf</parameter>.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>copy_area</methodname>() method copies a
rectangular area from the pixbuf to the destination <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
specified by <parameter>dest_pixbuf</parameter>. Conversion of pixbuf
formats is done automatically.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--saturate-and-pixelate">
<title>gtk.gdk.Pixbuf.saturate_and_pixelate</title>
<programlisting><methodsynopsis language="python">
<methodname>saturate_and_pixelate</methodname>
<methodparam><parameter
role="keyword">dest</parameter></methodparam>
<methodparam><parameter
role="keyword">saturation</parameter></methodparam>
<methodparam><parameter
role="keyword">pixelate</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">dest</parameter> :</term>
<listitem><simpara>the <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link> to
write the modified version of the pixbuf</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">saturation</parameter> :</term>
<listitem><simpara>the saturation factor</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">pixelate</parameter> :</term>
<listitem><simpara>if <literal>True</literal> pixelate
<parameter>dest</parameter></simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>saturate_and_pixelate</methodname>() method
modifies the saturation and optionally pixelates the pixbuf, placing the
result in <parameter>dest</parameter>. the pixbuf and
<parameter>dest</parameter> may be the same <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link> with
no ill effects. If <parameter>saturation</parameter> is 1.0 then saturation
is not changed. If it's less than 1.0, saturation is reduced (the image is
darkened); if greater than 1.0, saturation is increased (the image is
brightened). If <parameter>pixelate</parameter> is <literal>True</literal>,
then pixels are faded in a checkerboard pattern to create a pixelated image.
The pixbuf and <parameter>dest</parameter> must have the same image format,
size, and rowstride.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--scale">
<title>gtk.gdk.Pixbuf.scale</title>
<programlisting><methodsynopsis language="python">
<methodname>scale</methodname>
<methodparam><parameter
role="keyword">dest</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_x</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_y</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_width</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_height</parameter></methodparam>
<methodparam><parameter
role="keyword">offset_x</parameter></methodparam>
<methodparam><parameter
role="keyword">offset_y</parameter></methodparam>
<methodparam><parameter
role="keyword">scale_x</parameter></methodparam>
<methodparam><parameter
role="keyword">scale_y</parameter></methodparam>
<methodparam><parameter
role="keyword">interp_type</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">dest</parameter> :</term>
<listitem><simpara>the <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link> the
scaling is rendered to.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">dest_x</parameter> :</term>
<listitem><simpara>the X coordinate for the
rectangle</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">dest_y</parameter> :</term>
<listitem><simpara>the Y coordinate for the
rectangle</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">dest_width</parameter> :</term>
<listitem><simpara>the width of the rectangle</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">dest_height</parameter> :</term>
<listitem><simpara>the height of the
rectangle</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">offset_x</parameter> :</term>
<listitem><simpara>the offset in the X direction (currently
rounded to an integer)</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">offset_y</parameter> :</term>
<listitem><simpara>the offset in the Y direction (currently
rounded to an integer)</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">scale_x</parameter> :</term>
<listitem><simpara>the scale factor in the X
direction</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">scale_y</parameter> :</term>
<listitem><simpara>the scale factor in the Y
direction</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">interp_type</parameter> :</term>
<listitem><simpara>the interpolation type for the
transformation.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>scale</methodname>() method creates a
transformation of the pixbuf's image by scaling by
<parameter>scale_x</parameter> and <parameter>scale_y</parameter> and
translating by <parameter>offset_x</parameter> and
<parameter>offset_y</parameter> it, then rendering the rectangle
(<parameter>dest_x</parameter>, <parameter>dest_y</parameter>,
<parameter>dest_width</parameter>, <parameter>dest_height</parameter>) of
the resulting image onto the destination image specified by
<parameter>dest</parameter> replacing the previous contents. The value of
<parameter>interp_type</parameter> must be one of:</para>
<variablelist>
<varlistentry>
<term><literal>gtk.gdk.INTERP_NEAREST</literal></term>
<listitem>
<simpara>Nearest neighbor sampling; this is the fastest and
lowest quality mode. Quality is normally unacceptable when scaling down, but
may be OK when scaling up.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>gtk.gdk.INTERP_TILES</literal></term>
<listitem>
<simpara>This is an accurate simulation of the PostScript image
operator without any interpolation enabled. Each pixel is rendered as a tiny
parallelogram of solid color, the edges of which are implemented with
antialiasing. It resembles nearest neighbor for enlargement, and bilinear
for reduction.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>gtk.gdk.INTERP_BILINEAR</literal></term>
<listitem>
<simpara>Best quality/speed balance; use this mode by default.
Bilinear interpolation. For enlargement, it is equivalent to point-sampling
the ideal bilinear-interpolated image. For reduction, it is equivalent to
laying down small tiles and integrating over the coverage area.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>gtk.gdk.INTERP_HYPER</literal></term>
<listitem>
<simpara>This is the slowest and 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).</simpara>
</listitem>
</varlistentry>
</variablelist>
<para>Try the <link
linkend="method-gdkpixbuf--scale-simple"><methodname>scale_simple</methodname>()</link>
method as an alternative with a simpler interface.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--composite">
<title>gtk.gdk.Pixbuf.composite</title>
<programlisting><methodsynopsis language="python">
<methodname>composite</methodname>
<methodparam><parameter
role="keyword">dest</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_x</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_y</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_width</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_height</parameter></methodparam>
<methodparam><parameter
role="keyword">offset_x</parameter></methodparam>
<methodparam><parameter
role="keyword">offset_y</parameter></methodparam>
<methodparam><parameter
role="keyword">scale_x</parameter></methodparam>
<methodparam><parameter
role="keyword">scale_y</parameter></methodparam>
<methodparam><parameter
role="keyword">interp_type</parameter></methodparam>
<methodparam><parameter
role="keyword">overall_alpha</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">dest</parameter> :</term>
<listitem><simpara>the output <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link></simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">dest_x</parameter> :</term>
<listitem><simpara>the X coordinate for the
rectangle</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">dest_y</parameter> :</term>
<listitem><simpara>the top coordinate for the
rectangle</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">dest_width</parameter> :</term>
<listitem><simpara>the width of the rectangle</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">dest_height</parameter> :</term>
<listitem><simpara>the height of the
rectangle</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">offset_x</parameter> :</term>
<listitem><simpara>the offset in the X direction (currently
rounded to an integer)</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">offset_y</parameter> :</term>
<listitem><simpara>the offset in the Y direction (currently
rounded to an integer)</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">scale_x</parameter> :</term>
<listitem><simpara>the scale factor in the X
direction</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">scale_y</parameter> :</term>
<listitem><simpara>the scale factor in the Y
direction</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">interp_type</parameter> :</term>
<listitem><simpara>the interpolation type for the
transformation.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">overall_alpha</parameter> :</term>
<listitem><simpara>overall alpha for source image
(0..255)</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>composite</methodname>() method creates a
transformation of the pixbuf's image by scaling by
<parameter>scale_x</parameter> and <parameter>scale_y</parameter> and
translating by <parameter>offset_x</parameter> and
<parameter>offset_y</parameter>, then compositing the rectangle
(<parameter>dest_x</parameter>, <parameter>dest_y</parameter>,
<parameter>dest_width</parameter>, <parameter>dest_height</parameter>) of
the resulting image onto the destination image. The value of
<parameter>interp_type</parameter> must be one of:</para>
<variablelist>
<varlistentry>
<term><literal>gtk.gdk.INTERP_NEAREST</literal></term>
<listitem>
<simpara>Nearest neighbor sampling; this is the fastest and
lowest quality mode. Quality is normally unacceptable when scaling down, but
may be OK when scaling up.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>gtk.gdk.INTERP_TILES</literal></term>
<listitem>
<simpara>This is an accurate simulation of the PostScript image
operator without any interpolation enabled. Each pixel is rendered as a tiny
parallelogram of solid color, the edges of which are implemented with
antialiasing. It resembles nearest neighbor for enlargement, and bilinear
for reduction.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>gtk.gdk.INTERP_BILINEAR</literal></term>
<listitem>
<simpara>Best quality/speed balance; use this mode by default.
Bilinear interpolation. For enlargement, it is equivalent to point-sampling
the ideal bilinear-interpolated image. For reduction, it is equivalent to
laying down small tiles and integrating over the coverage area.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>gtk.gdk.INTERP_HYPER</literal></term>
<listitem>
<simpara>This is the slowest and 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).</simpara>
</listitem>
</varlistentry>
</variablelist>
<para></para>
</refsect2>
<refsect2 id="method-gdkpixbuf--composite-color">
<title>gtk.gdk.Pixbuf.composite_color</title>
<programlisting><methodsynopsis language="python">
<methodname>composite_color</methodname>
<methodparam><parameter
role="keyword">dest</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_x</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_y</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_width</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_height</parameter></methodparam>
<methodparam><parameter
role="keyword">offset_x</parameter></methodparam>
<methodparam><parameter
role="keyword">offset_y</parameter></methodparam>
<methodparam><parameter
role="keyword">scale_x</parameter></methodparam>
<methodparam><parameter
role="keyword">scale_y</parameter></methodparam>
<methodparam><parameter
role="keyword">interp_type</parameter></methodparam>
<methodparam><parameter
role="keyword">overall_alpha</parameter></methodparam>
<methodparam><parameter
role="keyword">check_x</parameter></methodparam>
<methodparam><parameter
role="keyword">check_y</parameter></methodparam>
<methodparam><parameter
role="keyword">check_size</parameter></methodparam>
<methodparam><parameter
role="keyword">color1</parameter></methodparam>
<methodparam><parameter
role="keyword">color2</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">dest</parameter> :</term>
<listitem><simpara>the output <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link></simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">dest_x</parameter> :</term>
<listitem><simpara>the X coordinate for the
rectangle</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">dest_y</parameter> :</term>
<listitem><simpara>the top coordinate for the
rectangle</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">dest_width</parameter> :</term>
<listitem><simpara>the width of the rectangle</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">dest_height</parameter> :</term>
<listitem><simpara>the height of the
rectangle</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">offset_x</parameter> :</term>
<listitem><simpara>the offset in the X direction (currently
rounded to an integer)</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">offset_y</parameter> :</term>
<listitem><simpara>the offset in the Y direction (currently
rounded to an integer)</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">scale_x</parameter> :</term>
<listitem><simpara>the scale factor in the X
direction</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">scale_y</parameter> :</term>
<listitem><simpara>the scale factor in the Y
direction</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">interp_type</parameter> :</term>
<listitem><simpara>the interpolation type for the
transformation.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">overall_alpha</parameter> :</term>
<listitem><simpara>overall alpha for source image
(0..255)</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">check_x</parameter> :</term>
<listitem><simpara>the X offset for the checkboard (origin of
checkboard is at -<parameter>check_x</parameter>,
-<parameter>check_y</parameter>)</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">check_y</parameter> :</term>
<listitem><simpara>the Y offset for the
checkboard</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">check_size</parameter> :</term>
<listitem><simpara>the size of checks in the checkboard (must be a
power of two)</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">color1</parameter> :</term>
<listitem><simpara>the color of check at upper
left</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">color2</parameter> :</term>
<listitem><simpara>the color of the other
check</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>composite_color</methodname>() method creates a
transformation of the source image <parameter>src</parameter> by scaling by
<parameter>scale_x</parameter> and <parameter>scale_y</parameter> and
translating by <parameter>offset_x</parameter> and
<parameter>offset_y</parameter>, then compositing the rectangle
(<parameter>dest_x</parameter> ,<parameter>dest_y</parameter>,
<parameter>dest_width</parameter>, <parameter>dest_height</parameter>) of
the resulting image with a checkboard of the colors
<parameter>color1</parameter> and <parameter>color2</parameter> and renders
it onto the destination image. The value of
<parameter>interp_type</parameter> must be one of:</para>
<variablelist>
<varlistentry>
<term><literal>gtk.gdk.INTERP_NEAREST</literal></term>
<listitem>
<simpara>Nearest neighbor sampling; this is the fastest and
lowest quality mode. Quality is normally unacceptable when scaling down, but
may be OK when scaling up.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>gtk.gdk.INTERP_TILES</literal></term>
<listitem>
<simpara>This is an accurate simulation of the PostScript image
operator without any interpolation enabled. Each pixel is rendered as a tiny
parallelogram of solid color, the edges of which are implemented with
antialiasing. It resembles nearest neighbor for enlargement, and bilinear
for reduction.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>gtk.gdk.INTERP_BILINEAR</literal></term>
<listitem>
<simpara>Best quality/speed balance; use this mode by default.
Bilinear interpolation. For enlargement, it is equivalent to point-sampling
the ideal bilinear-interpolated image. For reduction, it is equivalent to
laying down small tiles and integrating over the coverage area.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>gtk.gdk.INTERP_HYPER</literal></term>
<listitem>
<simpara>This is the slowest and 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).</simpara>
</listitem>
</varlistentry>
</variablelist>
<para>See the <link
linkend="method-gdkpixbuf--composite-color-simple"><methodname>composite_color_simple</methodname>()</link>
method for a simpler variant of this method suitable for most tasks.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--scale-simple">
<title>gtk.gdk.Pixbuf.scale_simple</title>
<programlisting><methodsynopsis language="python">
<methodname>scale_simple</methodname>
<methodparam><parameter
role="keyword">dest_width</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_height</parameter></methodparam>
<methodparam><parameter
role="keyword">interp_type</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter
role="keyword">dest_width</parameter> :</term>
<listitem><simpara>the width of destination
image</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">dest_height</parameter> :</term>
<listitem><simpara>the height of destination
image</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">interp_type</parameter> :</term>
<listitem><simpara>the interpolation type for the
transformation.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the new <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>, or
<literal>None</literal> if not enough memory could be allocated for
it.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>scale_simple</methodname>() method returns a new
<link linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
containing a copy of the pixbuf scaled to <parameter>dest_width</parameter>
x <parameter>dest_height</parameter>. The pixbuf is unaffected by the
scaling operation. The value of <parameter>interp_type</parameter> must be
one of:</para>
<variablelist>
<varlistentry>
<term><literal>gtk.gdk.INTERP_NEAREST</literal></term>
<listitem>
<simpara>Nearest neighbor sampling; this is the fastest and
lowest quality mode. Quality is normally unacceptable when scaling down, but
may be OK when scaling up.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>gtk.gdk.INTERP_TILES</literal></term>
<listitem>
<simpara>This is an accurate simulation of the PostScript image
operator without any interpolation enabled. Each pixel is rendered as a tiny
parallelogram of solid color, the edges of which are implemented with
antialiasing. It resembles nearest neighbor for enlargement, and bilinear
for reduction.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>gtk.gdk.INTERP_BILINEAR</literal></term>
<listitem>
<simpara>Best quality/speed balance; use this mode by default.
Bilinear interpolation. For enlargement, it is equivalent to point-sampling
the ideal bilinear-interpolated image. For reduction, it is equivalent to
laying down small tiles and integrating over the coverage area.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>gtk.gdk.INTERP_HYPER</literal></term>
<listitem>
<simpara>This is the slowest and 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).</simpara>
</listitem>
</varlistentry>
</variablelist>
<para><parameter>interp_type</parameter> should be
<literal>gtk.gdk.INTERP_NEAREST</literal> if you want maximum speed (but
when scaling down <literal>gtk.gdk.INTERP_NEAREST</literal> is usually
unusably ugly). The default <parameter>interp_type</parameter> should be
<literal>GDK_INTERP_BILINEAR</literal> which offers reasonable quality and
speed.</para>
<para>You can scale a sub-portion of <parameter>src</parameter> by
creating a sub-pixbuf pointing into <parameter>src</parameter>; see the
<link
linkend="method-gdkpixbuf--subpixbuf"><methodname>subpixbuf</methodname>()</link>
method for more information.</para>
<para>For more complicated scaling/compositing see the <link
linkend="method-gdkpixbuf--scale"><methodname>scale</methodname>()</link>
and <link
linkend="method-gdkpixbuf--composite"><methodname>composite</methodname>()</link>
methods.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--composite-color-simple">
<title>gtk.gdk.Pixbuf.composite_color_simple</title>
<programlisting><methodsynopsis language="python">
<methodname>composite_color_simple</methodname>
<methodparam><parameter
role="keyword">dest_width</parameter></methodparam>
<methodparam><parameter
role="keyword">dest_height</parameter></methodparam>
<methodparam><parameter
role="keyword">interp_type</parameter></methodparam>
<methodparam><parameter
role="keyword">overall_alpha</parameter></methodparam>
<methodparam><parameter
role="keyword">check_size</parameter></methodparam>
<methodparam><parameter
role="keyword">color1</parameter></methodparam>
<methodparam><parameter
role="keyword">color2</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter
role="keyword">dest_width</parameter> :</term>
<listitem><simpara>the width of destination
image</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">dest_height</parameter> :</term>
<listitem><simpara>the height of destination
image</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">interp_type</parameter> :</term>
<listitem><simpara>the interpolation type for the
transformation.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">overall_alpha</parameter> :</term>
<listitem><simpara>overall alpha for source image
(0..255)</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">check_size</parameter> :</term>
<listitem><simpara>the size of checks in the checkboard (must be a
power of two)</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">color1</parameter> :</term>
<listitem><simpara>the color of check at upper
left</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">color2</parameter> :</term>
<listitem><simpara>the color of the other
check</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the new <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>, or
<literal>NULL</literal> if not enough memory could be allocated for
it.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>composite_color_simple</methodname>() method
returns a new <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link> by
scaling the pixbuf to <parameter>dest_width</parameter> x
<parameter>dest_height</parameter> and compositing the result with a
checkboard of colors <parameter>color1</parameter> and
<parameter>color2</parameter>. The value of <parameter>interp_type</parameter> must be
one of:</para>
<variablelist>
<varlistentry>
<term><literal>gtk.gdk.INTERP_NEAREST</literal></term>
<listitem>
<simpara>Nearest neighbor sampling; this is the fastest and
lowest quality mode. Quality is normally unacceptable when scaling down, but
may be OK when scaling up.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>gtk.gdk.INTERP_TILES</literal></term>
<listitem>
<simpara>This is an accurate simulation of the PostScript image
operator without any interpolation enabled. Each pixel is rendered as a tiny
parallelogram of solid color, the edges of which are implemented with
antialiasing. It resembles nearest neighbor for enlargement, and bilinear
for reduction.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>gtk.gdk.INTERP_BILINEAR</literal></term>
<listitem>
<simpara>Best quality/speed balance; use this mode by default.
Bilinear interpolation. For enlargement, it is equivalent to point-sampling
the ideal bilinear-interpolated image. For reduction, it is equivalent to
laying down small tiles and integrating over the coverage area.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>gtk.gdk.INTERP_HYPER</literal></term>
<listitem>
<simpara>This is the slowest and 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).</simpara>
</listitem>
</varlistentry>
</variablelist>
<para>See the <link
linkend="method-gdkpixbuf--composite-color"><methodname>composite_color</methodname>()</link>
method for a more powerful but complicated interface.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--get-pixels-array">
<title>gtk.gdk.Pixbuf.get_pixels_array</title>
<programlisting><methodsynopsis language="python">
<methodname>get_pixels_array</methodname>
<methodparam></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a Numeric Python array containing the pixel
data of the pixbuf</simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This method is available in PyGTK 2.2 and above.</para>
</note>
<para>The <methodname>get_pixels_array</methodname>() method returns a
Numeric Python array containing the pixel data of the pixbuf.</para>
<note>
<para>PyGTK must be compiled with Numeric Python support for this
method to be available.</para>
</note>
</refsect2>
<refsect2 id="method-gdkpixbuf--subpixbuf">
<title>gtk.gdk.Pixbuf.subpixbuf</title>
<programlisting><methodsynopsis language="python">
<methodname>subpixbuf</methodname>
<methodparam><parameter role="keyword">src_x</parameter></methodparam>
<methodparam><parameter role="keyword">src_y</parameter></methodparam>
<methodparam><parameter role="keyword">width</parameter></methodparam>
<methodparam><parameter role="keyword">height</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">src_x</parameter> :</term>
<listitem><simpara>X coord in the pixbuf</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">src_y</parameter> :</term>
<listitem><simpara>Y coord in the pixbuf</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">width</parameter> :</term>
<listitem><simpara>width of region in the pixbuf</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">height</parameter> :</term>
<listitem><simpara>height of region in the pixbuf</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a new <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link></simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This method is available in PyGTK 2.4 and above.</para>
</note>
<para>The <methodname>subpixbuf</methodname>() method creates a new
<link linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
that represents a sub-region of the pixbuf. The new pixbuf shares its pixels
with the original pixbuf, so writing to one affects both.</para>
</refsect2>
<refsect2 id="method-gdkpixbuf--rotate-simple">
<title>gtk.gdk.Pixbuf.rotate_simple</title>
<programlisting><methodsynopsis language="python">
<methodname>rotate_simple</methodname>
<methodparam><parameter role="keyword">angle</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">angle</parameter> :</term>
<listitem><simpara>the rotation angle</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a new <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link></simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This method is available in PyGTK 2.10 and above.</para>
</note>
<para>The <methodname>rotate_simple</methodname>() method creates a
new <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
by rotating the given pixbuf by a multiple of 90 degrees as specified
by <parameter>angle</parameter> which is one of the <xref
linkend="gdk-pixbuf-rotation-constants"
endterm="gdk-pixbuf-rotation-constants-title"></xref></para>
</refsect2>
<refsect2 id="method-gdkpixbuf--flip">
<title>gtk.gdk.Pixbuf.flip</title>
<programlisting><methodsynopsis language="python">
<methodname>flip</methodname>
<methodparam><parameter role="keyword">horizontal</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">flip</parameter> :</term>
<listitem><simpara><literal>True</literal> to flip horizontally, <literal>False</literal> to
flip vertically</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a new <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link></simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This method is available in PyGTK 2.6 and above.</para>
</note>
<para>The <methodname>flip</methodname>() method creates a
new <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
by flipping the given pixbuf horizontally or vertically, as specified
by <parameter>horizontal</parameter>.</para>
</refsect2>
</refsect1>
<refsect1>
<title>Functions</title>
<refsect2 id="function-gdk--pixbuf-new-from-file">
<title>gtk.gdk.pixbuf_new_from_file</title>
<programlisting><methodsynopsis language="python">
<methodname>gtk.gdk.pixbuf_new_from_file</methodname>
<methodparam><parameter
role="keyword">filename</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">filename</parameter> :</term>
<listitem><simpara>the name of the file containing the image to
load</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a new <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <function>gtk.gdk.pixbuf_new_from_file</function>() function
returns a new <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
containing an image loaded from the file specified by
<parameter>filename</parameter>. The image file format is detected
automatically. The application will block until the image is done loading.
This method can be used by applications in which blocking is acceptable
while an image is being loaded (small images in general). Applications that
need progressive loading should use <link
linkend="class-gdkpixbufloader"><classname>gtk.gdk.PixbufLoader</classname></link>
instead.</para>
<para>This function raises the GError exception if an error occurs
during the loading of the pixbuf.</para>
</refsect2>
<refsect2 id="function-gdk--pixbuf-new-from-file-at-size">
<title>gtk.gdk.pixbuf_new_from_file_at_size</title>
<programlisting><methodsynopsis language="python">
<methodname>gtk.gdk.pixbuf_new_from_file_at_size</methodname>
<methodparam><parameter
role="keyword">filename</parameter></methodparam>
<methodparam><parameter
role="keyword">width</parameter></methodparam>
<methodparam><parameter
role="keyword">height</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">filename</parameter> :</term>
<listitem><simpara>the name of the file containing the image to
load</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">width</parameter> :</term>
<listitem><simpara> The width the image should
have</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">height</parameter> :</term>
<listitem><simpara> The height the image should
have</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a new <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>.</simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This function is available in PyGTK 2.4 and above.</para>
</note>
<para>The <function>gtk.gdk.pixbuf_new_from_file_at_size</function>()
function returns a new <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
containing an image loaded from the file specified by
<parameter>filename</parameter> with it scaled to the size specified by
<parameter>width</parameter> and <parameter>height</parameter>. The image
file format is detected automatically. The application will block until the
image is done loading. This function can be used by applications in which
blocking is acceptable while an image is being loaded (small images in
general). Applications that need progressive loading should use a <link
linkend="class-gdkpixbufloader"><classname>gtk.gdk.PixbufLoader</classname></link>
instead.</para>
<para>This function raises the GError exception if an error occurs
during the loading of the pixbuf.</para>
</refsect2>
<refsect2 id="function-gdk--pixbuf-new-from-data">
<title>gtk.gdk.pixbuf_new_from_data</title>
<programlisting><methodsynopsis language="python">
<methodname>gtk.gdk.pixbuf_new_from_data</methodname>
<methodparam><parameter
role="keyword">data</parameter></methodparam>
<methodparam><parameter
role="keyword">colorspace</parameter></methodparam>
<methodparam><parameter
role="keyword">has_alpha</parameter></methodparam>
<methodparam><parameter
role="keyword">bits_per_sample</parameter></methodparam>
<methodparam><parameter
role="keyword">width</parameter></methodparam>
<methodparam><parameter
role="keyword">height</parameter></methodparam>
<methodparam><parameter
role="keyword">rowstride</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">data</parameter> :</term>
<listitem><simpara>a string containing image data in 8-bit/sample
packed format.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">colorspace</parameter> :</term>
<listitem><simpara>the colorspace for the image
data.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">has_alpha</parameter> :</term>
<listitem><simpara>If <literal>True</literal>, the data has an
opacity channel.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">bits_per_sample</parameter> :</term>
<listitem><simpara>the number of bits per
sample.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">width</parameter> :</term>
<listitem><simpara>the width of the image in pixels.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">height</parameter> :</term>
<listitem><simpara>the height of the image in pixels.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">rowstride</parameter> :</term>
<listitem><simpara>the distance in bytes between row
starts.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link></simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This function is available in PyGTK 2.2 and above.</para>
</note>
<para>The <function>gtk.gdk.pixbuf_new_from_data</function>() function
returns a new pixbuf created from the string specified by
<parameter>data</parameter>. <parameter>data</parameter> must be RGB image
data with 8 bits per sample. <parameter>colorspace</parameter> must be
<literal>gtk.gdk.COLORSPACE_RGB</literal>.</para>
</refsect2>
<refsect2 id="function-gdk--pixbuf-new-from-array">
<title>gtk.gdk.pixbuf_new_from_array</title>
<programlisting><methodsynopsis language="python">
<methodname>gtk.gdk.pixbuf_new_from_array</methodname>
<methodparam><parameter
role="keyword">array</parameter></methodparam>
<methodparam><parameter
role="keyword">colorspace</parameter></methodparam>
<methodparam><parameter
role="keyword">bits_per_sample</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">array</parameter> :</term>
<listitem><simpara>a string containing image data in 8-bit/sample
packed format.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">colorspace</parameter> :</term>
<listitem><simpara>the colorspace for the image
data.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">bits_per_sample</parameter> :</term>
<listitem><simpara>the number of bits per
sample.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link></simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This function is available in PyGTK 2.2 and above.</para>
</note>
<para>The <function>gtk.gdk.pixbuf_new_from_array</function>()
function returns a new pixbuf created from the Numeric Python array
specified by <parameter>array</parameter>. <parameter>array</parameter> must
be a 3 or 4 dimensional array (4 if the image has an alpha channel) with
<parameter>bits_per_sample</parameter> bits per sample.
<parameter>colorspace</parameter> must be
<literal>gtk.gdk.COLORSPACE_RGB</literal>.</para>
<note>
<para>PyGTK must be compiled with the Numeric Python module to
support this function.</para>
</note>
</refsect2>
<refsect2 id="function-gdk--pixbuf-new-from-xpm-data">
<title>gtk.gdk.pixbuf_new_from_xpm_data</title>
<programlisting><methodsynopsis language="python">
<methodname>gtk.gdk.pixbuf_new_from_xpm_data</methodname>
<methodparam><parameter
role="keyword">data</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">data</parameter> :</term>
<listitem><simpara>a list of strings containing the XPM image
data</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link></simpara></listitem>
</varlistentry>
</variablelist>
<para>The <function>gtk.gdk.pixbuf_new_from_xpm_data</function>()
function returns a new <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link> by
parsing <literal>XPM</literal> data in memory specified by
<parameter>data</parameter>. <parameter>data</parameter> is a list of
strings containing the <literal>XPM</literal> data.</para>
</refsect2>
<refsect2 id="function-gdk--pixbuf-new-from-inline">
<title>gtk.gdk.pixbuf_new_from_inline</title>
<programlisting><methodsynopsis language="python">
<methodname>gtk.gdk.pixbuf_new_from_inline</methodname>
<methodparam><parameter
role="keyword">data_length</parameter></methodparam>
<methodparam><parameter
role="keyword">data</parameter></methodparam>
<methodparam><parameter
role="keyword">copy_pixels</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter
role="keyword">data_length</parameter> :</term>
<listitem><simpara>the length in bytes of the
<parameter>data</parameter></simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">data</parameter> :</term>
<listitem><simpara>a string containing the inline pixbuf
data</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">copy_pixels</parameter> :</term>
<listitem><simpara>if <literal>True</literal> the pixel data
should be copied</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a new <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
object</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <function>gtk.gdk.pixbuf_new_from_inline</function>()
function returns a <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link> from
a flat representation that is suitable for storing as inline data in a
program. This is useful if you want to ship a program with images, but don't
want to depend on any external files.</para>
<para>GTK+ ships with a program called
<command>gdk-pixbuf-csource</command> which allows for conversion of an
image into such a inline representation.In almost all cases, you should pass
the <option>--raw</option> flag to <command>gdk-pixbuf-csource</command>. A
sample invocation would be:</para>
<programlisting>
gdk-pixbuf-csource --raw --name=myimage_inline myimage.png
</programlisting>
<para>For the typical case where the inline pixbuf is read-only static
data, you don't need to copy the pixel data unless you intend to write to
it, so you can pass <literal>False</literal> for
<parameter>copy_pixels</parameter>.</para>
<para>This function raises the GError exception if an error occurs
during the loading of the pixbuf.</para>
</refsect2>
<refsect2 id="function-gdk--pixbuf-get-formats">
<title>gtk.gdk.pixbuf_get_formats</title>
<programlisting><methodsynopsis language="python">
<methodname>gtk.gdk.pixbuf_get_formats</methodname>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a list of image formats as Python
dicts</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <function>gtk.gdk.pixbuf_get_formats</function>() function
returns a list of the supported image formats as a Python dict. The keys
of the image format dict are:</para>
<variablelist>
<varlistentry>
<term><parameter>name</parameter> :</term>
<listitem><simpara>the name of the image format.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>description</parameter> :</term>
<listitem><simpara>a description of the image
format.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>mime_types</parameter> :</term>
<listitem><simpara>a list of the mime types this image
matches.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>extensions</parameter> :</term>
<listitem><simpara>a list of typical filename extensions for the
image format.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>is_writable</parameter> :</term>
<listitem><simpara>if <literal>True</literal> the image can be
written to a file</simpara></listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect2 id="function-gdk--pixbuf-get-file-info">
<title>gtk.gdk.pixbuf_get_file_info</title>
<programlisting><methodsynopsis language="python">
<methodname>gtk.gdk.pixbuf_get_file_info</methodname>
<methodparam><parameter
role="keyword">filename</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">filename</parameter> :</term>
<listitem><simpara>the name of the file to check</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>an image format as a Python dict</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <function>gtk.gdk.pixbuf_get_file_info</function>() function
reads enough of the file specified by <parameter>filename</parameter> to
determine its image format and then returns the image format information in
a Python dict. See the <link
linkend="function-gdk--pixbuf-get-formats"><function>gtk.gdk.pixbuf_get_formats</function>()</link>
function for more details on the image format dict.</para>
</refsect2>
</refsect1>
</refentry>
|