/usr/share/gtk-doc/html/pygtk/class-gdkpixbuf.html is in python-gtk2-doc 2.24.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gtk.gdk.Pixbuf</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="gdk-class-reference.html" title="The gtk.gdk Class Reference"><link rel="prev" href="class-gdkpangorenderer.html" title="gtk.gdk.PangoRenderer"><link rel="next" href="class-gdkpixbufanimation.html" title="gtk.gdk.PixbufAnimation"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">gtk.gdk.Pixbuf</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gdkpangorenderer.html">Prev</a> </td><th width="60%" align="center">The gtk.gdk Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-gdkpixbufanimation.html">Next</a></td></tr></table><hr></div><div class="refentry" title="gtk.gdk.Pixbuf"><a name="class-gdkpixbuf"></a><div class="titlepage"></div><div class="refnamediv"><h2>gtk.gdk.Pixbuf</h2><p>gtk.gdk.Pixbuf — an object containing a client side image.</p></div><div class="refsect1" title="Synopsis"><a name="id3467133"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.gdk.Pixbuf</span></span>(<span class="ooclass"><span class="classname"><PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK></span></span>):
<code class="constructorsynopsis"> <span class="methodname"><a class="link" href="class-gdkpixbuf.html#constructor-gdkpixbuf" title="Constructor">gtk.gdk.Pixbuf</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>colorspace</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>has_alpha</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>bits_per_sample</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>height</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><PYGTKDOCLINK HREF="">apply_embedded_orientation</PYGTKDOCLINK></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--render-to-drawable" title="gtk.gdk.Pixbuf.render_to_drawable">render_to_drawable</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>drawable</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>gc</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>height</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dither</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>x_dither</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>y_dither</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--render-to-drawable-alpha" title="gtk.gdk.Pixbuf.render_to_drawable_alpha">render_to_drawable_alpha</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>drawable</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>height</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>alpha_mode</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>alpha_threshold</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dither</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>x_dither</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>y_dither</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--render-pixmap-and-mask" title="gtk.gdk.Pixbuf.render_pixmap_and_mask">render_pixmap_and_mask</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>alpha_threshold</code></strong></span><span class="initializer">=127</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--get-from-drawable" title="gtk.gdk.Pixbuf.get_from_drawable">get_from_drawable</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>src</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>cmap</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>height</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--get-from-image" title="gtk.gdk.Pixbuf.get_from_image">get_from_image</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>src</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>cmap</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>height</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--get-colorspace" title="gtk.gdk.Pixbuf.get_colorspace">get_colorspace</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--get-n-channels" title="gtk.gdk.Pixbuf.get_n_channels">get_n_channels</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--get-has-alpha" title="gtk.gdk.Pixbuf.get_has_alpha">get_has_alpha</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--get-bits-per-sample" title="gtk.gdk.Pixbuf.get_bits_per_sample">get_bits_per_sample</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--get-pixels" title="gtk.gdk.Pixbuf.get_pixels">get_pixels</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--get-width" title="gtk.gdk.Pixbuf.get_width">get_width</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--get-height" title="gtk.gdk.Pixbuf.get_height">get_height</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--get-rowstride" title="gtk.gdk.Pixbuf.get_rowstride">get_rowstride</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--get-option" title="gtk.gdk.Pixbuf.get_option">get_option</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>key</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--copy" title="gtk.gdk.Pixbuf.copy">copy</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--fill" title="gtk.gdk.Pixbuf.fill">fill</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>pixel</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--save" title="gtk.gdk.Pixbuf.save">save</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>filename</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>type</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>options</code></strong></span><span class="initializer">=None</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--save-to-callback" title="gtk.gdk.Pixbuf.save_to_callback">save_to_callback</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>save_func</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>type</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>options</code></strong></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>user_data</code></strong></span><span class="initializer">=None</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--add-alpha" title="gtk.gdk.Pixbuf.add_alpha">add_alpha</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>substitute_color</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>r</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>g</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>b</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--copy-area" title="gtk.gdk.Pixbuf.copy_area">copy_area</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>height</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_pixbuf</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_y</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--saturate-and-pixelate" title="gtk.gdk.Pixbuf.saturate_and_pixelate">saturate_and_pixelate</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>saturation</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>pixelate</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--scale" title="gtk.gdk.Pixbuf.scale">scale</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_height</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>offset_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>offset_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>scale_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>scale_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>interp_type</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--composite" title="gtk.gdk.Pixbuf.composite">composite</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_height</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>offset_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>offset_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>scale_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>scale_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>interp_type</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>overall_alpha</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--composite-color" title="gtk.gdk.Pixbuf.composite_color">composite_color</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_height</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>offset_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>offset_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>scale_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>scale_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>interp_type</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>overall_alpha</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>check_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>check_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>check_size</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>color1</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>color2</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--scale-simple" title="gtk.gdk.Pixbuf.scale_simple">scale_simple</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_height</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>interp_type</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--composite-color-simple" title="gtk.gdk.Pixbuf.composite_color_simple">composite_color_simple</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_height</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>interp_type</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>overall_alpha</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>check_size</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>color1</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>color2</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--get-pixels-array" title="gtk.gdk.Pixbuf.get_pixels_array">get_pixels_array</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--subpixbuf" title="gtk.gdk.Pixbuf.subpixbuf">subpixbuf</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>height</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--rotate-simple" title="gtk.gdk.Pixbuf.rotate_simple">rotate_simple</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>angle</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--flip" title="gtk.gdk.Pixbuf.flip">flip</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>horizontal</code></strong></span></span>)</code><br></pre></td></tr></table><pre class="programlisting">
<span class="bold"><strong>Functions</strong></span>
<code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#function-gdk--pixbuf-new-from-file" title="gtk.gdk.pixbuf_new_from_file">gtk.gdk.pixbuf_new_from_file</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>filename</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#function-gdk--pixbuf-new-from-file-at-size" title="gtk.gdk.pixbuf_new_from_file_at_size">gtk.gdk.pixbuf_new_from_file_at_size</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>filename</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>height</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#function-gdk--pixbuf-new-from-data" title="gtk.gdk.pixbuf_new_from_data">gtk.gdk.pixbuf_new_from_data</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>data</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>colorspace</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>has_alpha</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>bits_per_sample</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>height</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>rowstride</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#function-gdk--pixbuf-new-from-array" title="gtk.gdk.pixbuf_new_from_array">gtk.gdk.pixbuf_new_from_array</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>array</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>colorspace</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>bits_per_sample</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#function-gdk--pixbuf-new-from-xpm-data" title="gtk.gdk.pixbuf_new_from_xpm_data">gtk.gdk.pixbuf_new_from_xpm_data</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>data</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#function-gdk--pixbuf-new-from-inline" title="gtk.gdk.pixbuf_new_from_inline">gtk.gdk.pixbuf_new_from_inline</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>data_length</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>data</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>copy_pixels</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#function-gdk--pixbuf-get-formats" title="gtk.gdk.pixbuf_get_formats">gtk.gdk.pixbuf_get_formats</a></span>()</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gdkpixbuf.html#function-gdk--pixbuf-get-file-info" title="gtk.gdk.pixbuf_get_file_info">gtk.gdk.pixbuf_get_file_info</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>filename</code></strong></span></span>)</code></pre></div><div class="refsect1" title="Ancestry"><a name="id3092375"></a><h2>Ancestry</h2><pre class="synopsis">+-- <PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK>
+-- <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf">gtk.gdk.Pixbuf</a>
</pre></div><div class="refsect1" title="Attributes"><a name="id3092401"></a><h2>Attributes</h2><div class="blockquote"><table width="100%" border="0" bgcolor="#E0E0E0"><tr><td valign="top"><div class="informaltable"><table cellpadding="5" width="100%" border="0"><colgroup><col width="1in"><col width="1in"><col width="4in"></colgroup><tbody><tr valign="top"><td valign="top">"pixel_array"</td><td valign="top">Read</td><td valign="top">A numeric array containing the pixel values of the
<a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>. 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.
<code class="literal">PyGTK</code> must be compiled with Numeric Python support for
this to work.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" title="Properties"><a name="id3092491"></a><h2>Properties</h2><div class="blockquote"><table width="100%" border="0" bgcolor="#E0E0E0"><tr><td valign="top"><div class="informaltable"><table width="100%" border="0"><colgroup><col width="1in"><col width="1in"><col width="4in"></colgroup><tbody><tr valign="top"><td valign="top">"bits-per-sample"</td><td valign="top">Read-Write-Construct Only</td><td valign="top">The number of bits per sample. Available in GTK+ 2.4
and above.</td></tr><tr valign="top"><td valign="top">"colorspace"</td><td valign="top">Read-Write-Construct Only</td><td valign="top">The colorspace in which the samples are interpreted.Available in GTK+ 2.4 and above.</td></tr><tr valign="top"><td valign="top">"has-alpha"</td><td valign="top">Read-Write-Construct Only</td><td valign="top">If <code class="literal">True</code>,the pixbuf has an alpha
channel. Available in GTK+ 2.4 and above.</td></tr><tr valign="top"><td valign="top">"height"</td><td valign="top">Read-Write-Construct Only</td><td valign="top">The number of rows of the pixbuf. Available in GTK+ 2.4
and above.</td></tr><tr valign="top"><td valign="top">"n-channels"</td><td valign="top">Read-Write-Construct Only</td><td valign="top">The number of samples per pixel. Available in GTK+ 2.4
and above.</td></tr><tr valign="top"><td valign="top">"pixels"</td><td valign="top">Read-Write-Construct Only</td><td valign="top">A pointer to the pixel data of the pixbuf. Available
in GTK+ 2.4 and above.</td></tr><tr valign="top"><td valign="top">"rowstride"</td><td valign="top">Read-Write-Construct Only</td><td valign="top">The number of bytes between the start of a row and
the start of the next row. Available in GTK+ 2.4 and above.</td></tr><tr valign="top"><td valign="top">"width"</td><td valign="top">Read-Write-Construct Only</td><td valign="top">The number of columns of the pixbuf. Available in GTK+ 2.4
and above.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" title="Description"><a name="id3107626"></a><h2>Description</h2><p>A <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
object contains the data that describes an image using client side
resources. By contrast a <a class="link" href="class-gdkpixmap.html" title="gtk.gdk.Pixmap"><code class="classname">gtk.gdk.Pixmap</code></a> uses
server side resources to hold image data. Manipulating the image data in a
<a class="link" href="class-gdkpixmap.html" title="gtk.gdk.Pixmap"><code class="classname">gtk.gdk.Pixmap</code></a>
may involve round trip transfers between a client and a server in X11 while
manipulating image data in a <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
involves only client side operations. Therefore using <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
objects may be more efficient than using <a class="link" href="class-gdkpixmap.html" title="gtk.gdk.Pixmap"><code class="classname">gtk.gdk.Pixmap</code></a>
objects if a lot of image manipulation is necessary.</p><p>In addition to the methods associated with a <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
object there are a number of functions that can be used to create <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
objects from file and inline data.</p></div><div class="refsect1" title="Constructor"><a name="constructor-gdkpixbuf"></a><h2>Constructor</h2><pre class="programlisting"><code class="constructorsynopsis"> <span class="methodname">gtk.gdk.Pixbuf</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>colorspace</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>has_alpha</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>bits_per_sample</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>height</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>colorspace</code></strong> :</span></p></td><td>the color space for the image - currently only
<code class="literal">gtk.gdk.COLORSPACE_RGB</code>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>has_alpha</code></strong> :</span></p></td><td>if <code class="literal">True</code> the image will have
transparency information.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>bits_per_sample</code></strong> :</span></p></td><td>the number of bits per color sample - currently
must be 8.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>width</code></strong> :</span></p></td><td>the width of image in
pixels.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>height</code></strong> :</span></p></td><td>the height of image in
pixels.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a newly-created <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>.</td></tr></tbody></table><p>Creates a new <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
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
<em class="parameter"><code>width</code></em> and <em class="parameter"><code>height</code></em>.</p></div><div class="refsect1" title="Methods"><a name="id3107960"></a><h2>Methods</h2><div class="refsect2" title="gtk.gdk.Pixbuf.apply_embedded_orientation"><a name="method-gdkpixbuf--apply-embedded-orientation"></a><h3>gtk.gdk.Pixbuf.apply_embedded_orientation</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">apply_embedded_orientation</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>A newly-created pixbuf.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method was available in PyGTK 2.16 and above.</p></div><p>
The <code class="methodname">apply_embedded_orientation</code>() 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.
</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.render_to_drawable"><a name="method-gdkpixbuf--render-to-drawable"></a><h3>gtk.gdk.Pixbuf.render_to_drawable</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">render_to_drawable</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>drawable</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>gc</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>height</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dither</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>x_dither</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>y_dither</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>drawable</code></strong> :</span></p></td><td>the destination <a class="link" href="class-gdkdrawable.html" title="gtk.gdk.Drawable"><code class="classname">gtk.gdk.Drawable</code></a>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>gc</code></strong> :</span></p></td><td>the <a class="link" href="class-gdkgc.html" title="gtk.gdk.GC"><code class="classname">gtk.gdk.GC</code></a> used for
rendering.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>src_x</code></strong> :</span></p></td><td>the X coordinate within the
pixbuf.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>src_y</code></strong> :</span></p></td><td>the Y coordinate within the
pixbuf.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_x</code></strong> :</span></p></td><td>the X coordinate within
<em class="parameter"><code>drawable</code></em>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_y</code></strong> :</span></p></td><td>the Y coordinate within
<em class="parameter"><code>drawable</code></em>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>width</code></strong> :</span></p></td><td>the width of region to render, in pixels, or -1
to use pixbuf width</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>height</code></strong> :</span></p></td><td>the height of region to render, in pixels, or
-1 to use pixbuf height</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dither</code></strong> :</span></p></td><td>the dithering mode.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>x_dither</code></strong> :</span></p></td><td>the X offset for
dithering.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>y_dither</code></strong> :</span></p></td><td>the Y offset for
dithering.</td></tr></tbody></table><div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>This method is deprecated in PyGTK 2.2 and above. Use the
<a class="link" href="class-gdkdrawable.html#method-gdkdrawable--draw-pixbuf" title="gtk.gdk.Drawable.draw_pixbuf"><code class="methodname">gtk.gdk.Drawable.draw_pixbuf</code>()</a>
method instead.</p></div><p>The <code class="methodname">render_to_drawable</code>() method renders
a rectangular portion of the pixbuf to a <a class="link" href="class-gdkdrawable.html" title="gtk.gdk.Drawable"><code class="classname">gtk.gdk.Drawable</code></a>
specified by <em class="parameter"><code>drawable</code></em> while using the <a class="link" href="class-gdkgc.html" title="gtk.gdk.GC"><code class="classname">gtk.gdk.GC</code></a> specified by
<em class="parameter"><code>gc</code></em>. 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
<a class="link" href="class-gdkgc.html" title="gtk.gdk.GC"><code class="classname">gtk.gdk.GC</code></a> must
already have the clipping mask set if you want transparent regions to show
through.</p><p>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.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.render_to_drawable_alpha"><a name="method-gdkpixbuf--render-to-drawable-alpha"></a><h3>gtk.gdk.Pixbuf.render_to_drawable_alpha</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">render_to_drawable_alpha</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>drawable</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>height</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>alpha_mode</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>alpha_threshold</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dither</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>x_dither</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>y_dither</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>drawable</code></strong> :</span></p></td><td>the destination <a class="link" href="class-gdkdrawable.html" title="gtk.gdk.Drawable"><code class="classname">gtk.gdk.Drawable</code></a>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>gc</code></strong> :</span></p></td><td>the <a class="link" href="class-gdkgc.html" title="gtk.gdk.GC"><code class="classname">gtk.gdk.GC</code></a> used for
rendering.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>src_x</code></strong> :</span></p></td><td>the X coordinate within the
pixbuf.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>src_y</code></strong> :</span></p></td><td>the Y coordinate within the
pixbuf.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_x</code></strong> :</span></p></td><td>the X coordinate within
<em class="parameter"><code>drawable</code></em>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_y</code></strong> :</span></p></td><td>the Y coordinate within
<em class="parameter"><code>drawable</code></em>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>width</code></strong> :</span></p></td><td>the width of region to render, in pixels, or -1
to use pixbuf width</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>height</code></strong> :</span></p></td><td>the height of region to render, in pixels, or
-1 to use pixbuf height</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>alpha_mode</code></strong> :</span></p></td><td>Ignored. Present for backward
compatibility.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>alpha_threshold</code></strong> :</span></p></td><td>Ignored. Present for backward
compatibility</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dither</code></strong> :</span></p></td><td>the dithering mode.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>x_dither</code></strong> :</span></p></td><td>the X offset for
dithering.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>y_dither</code></strong> :</span></p></td><td>the Y offset for
dithering.</td></tr></tbody></table><div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>This method is deprecated in PyGTK 2.2 and above. Use the
<a class="link" href="class-gdkdrawable.html#method-gdkdrawable--draw-pixbuf" title="gtk.gdk.Drawable.draw_pixbuf"><code class="methodname">gtk.gdk.Drawable.draw_pixbuf</code>()</a>
method instead.</p></div><p>The <code class="methodname">render_to_drawable_alpha</code>() method
renders a rectangular portion of the pixbuf to a <a class="link" href="class-gdkdrawable.html" title="gtk.gdk.Drawable"><code class="classname">gtk.gdk.Drawable</code></a>
specified by <em class="parameter"><code>drawable</code></em>.
<em class="parameter"><code>drawable</code></em> 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 <a class="link" href="class-gdkwindow.html" title="gtk.gdk.Window"><code class="classname">gtk.gdk.Window</code></a>.
Otherwise a colormap must be set on them with the <a class="link" href="class-gdkdrawable.html#method-gdkdrawable--set-colormap" title="gtk.gdk.Drawable.set_colormap"><code class="methodname">gtk.gdk.Drawable.set_colormap</code>()</a>
method. On older X servers, rendering pixbufs with an alpha channel involves
round trips to the X server, and may be somewhat slow.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.render_pixmap_and_mask"><a name="method-gdkpixbuf--render-pixmap-and-mask"></a><h3>gtk.gdk.Pixbuf.render_pixmap_and_mask</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">render_pixmap_and_mask</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>alpha_threshold</code></strong></span><span class="initializer">=127</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>alpha_threshold</code></strong> :</span></p></td><td>the threshold value for opacity
values.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a tuple containing the created pixmap and
mask.</td></tr></tbody></table><p>The <code class="methodname">render_to_pixmap_and_mask</code>() 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 <a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--render-to-drawable-alpha" title="gtk.gdk.Pixbuf.render_to_drawable_alpha"><code class="methodname">render_to_drawable_alpha</code>()</a>
or <a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--render-to-drawable" title="gtk.gdk.Pixbuf.render_to_drawable"><code class="methodname">render_to_drawable</code>()</a>
methods. If the pixbuf does not have an alpha channel, then the mask
returned will be None.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.get_from_drawable"><a name="method-gdkpixbuf--get-from-drawable"></a><h3>gtk.gdk.Pixbuf.get_from_drawable</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_from_drawable</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>src</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>cmap</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>height</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>src</code></strong> :</span></p></td><td>the source <a class="link" href="class-gdkdrawable.html" title="gtk.gdk.Drawable"><code class="classname">gtk.gdk.Drawable</code></a>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>cmap</code></strong> :</span></p></td><td>a colormap if <em class="parameter"><code>src</code></em>
doesn't have one set.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>src_x</code></strong> :</span></p></td><td>the X coordinate within
<em class="parameter"><code>drawable</code></em>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>src_y</code></strong> :</span></p></td><td>the Y coordinate within
<em class="parameter"><code>drawable</code></em>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_x</code></strong> :</span></p></td><td>the X coordinate in the
pixbuf.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_y</code></strong> :</span></p></td><td>the Y coordinate in the
pixbuf.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>width</code></strong> :</span></p></td><td>the width in pixels of the region to
get.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>height</code></strong> :</span></p></td><td>the height in pixels of the region to
get.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the pixbuf or <code class="literal">None</code> on
error</td></tr></tbody></table><p>The <code class="methodname">get_from_drawable</code>() method
transfers image data from the <a class="link" href="class-gdkdrawable.html" title="gtk.gdk.Drawable"><code class="classname">gtk.gdk.Drawable</code></a>
specified by <em class="parameter"><code>src</code></em> and converts it to an RGB(A)
representation inside a <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>. 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 <em class="parameter"><code>src</code></em> has no colormap (the <a class="link" href="class-gdkdrawable.html#method-gdkdrawable--get-colormap" title="gtk.gdk.Drawable.get_colormap"><code class="methodname">gtk.gdk.Drawable.get_colormap</code>()</a>
method returns <code class="literal">None</code>), then a suitable colormap must be
specified as <em class="parameter"><code>cmap</code></em>. Typically a <a class="link" href="class-gdkwindow.html" title="gtk.gdk.Window"><code class="classname">gtk.gdk.Window</code></a> or a
pixmap created by passing a <a class="link" href="class-gdkwindow.html" title="gtk.gdk.Window"><code class="classname">gtk.gdk.Window</code></a> to
<code class="function">gtk.gdk.Pixmap()</code> will already have a colormap
associated with it. If <em class="parameter"><code>src</code></em> has a colormap, the
<em class="parameter"><code>cmap</code></em> argument will be ignored. If
<em class="parameter"><code>src</code></em> 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 <a class="link" href="class-gdkcolormap.html#function-gdk--colormap-get-system" title="gtk.gdk.colormap_get_system"><code class="methodname">gtk.gdk.colormap_get_system</code>()</a>
function returns the correct colormap to use.</p><p>If <em class="parameter"><code>src</code></em> is a pixmap, then the requested
source rectangle must be completely contained within the pixmap, otherwise
the function will return <code class="literal">None</code>. For pixmaps only (not for
windows) passing -1 for <em class="parameter"><code>width</code></em> or
<em class="parameter"><code>height</code></em> is allowed to mean the full width or height of
the pixmap. If <em class="parameter"><code>src</code></em> 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.</p><p>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), <code class="literal">None</code> will be returned. If memory can't be
allocated for the return value, <code class="literal">None</code> will be returned
instead. (In short, there are several ways this method can fail, and if it
fails it returns <code class="literal">None</code>; so check the return value.)</p><p>This method calls the <a class="link" href="class-gdkdrawable.html#method-gdkdrawable--get-image" title="gtk.gdk.Drawable.get_image"><code class="methodname">gtk.gdk.Drawable.get_image</code>()</a>
method internally and converts the resulting image to a <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>, so
the documentation for the <a class="link" href="class-gdkdrawable.html#method-gdkdrawable--get-image" title="gtk.gdk.Drawable.get_image"><code class="methodname">gtk.gdk.Drawable.get_image</code>()</a>
method may also be helpful.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.get_from_image"><a name="method-gdkpixbuf--get-from-image"></a><h3>gtk.gdk.Pixbuf.get_from_image</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_from_image</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>src</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>cmap</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>height</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>src</code></strong> :</span></p></td><td>the source <a class="link" href="class-gdkimage.html" title="gtk.gdk.Image"><code class="classname">gtk.gdk.Image</code></a>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>cmap</code></strong> :</span></p></td><td>a colormap if <em class="parameter"><code>src</code></em>
doesn't have one set or <code class="literal">None</code>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>src_x</code></strong> :</span></p></td><td>the X coordinate within
<em class="parameter"><code>src</code></em>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>src_y</code></strong> :</span></p></td><td>the Y coordinate within
<em class="parameter"><code>src</code></em>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_x</code></strong> :</span></p></td><td>the X coordinate in the
pixbuf.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_y</code></strong> :</span></p></td><td>the Y coordinate in the
pixbuf.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>width</code></strong> :</span></p></td><td>the width in pixels of the region to
get.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>height</code></strong> :</span></p></td><td>the height in pixels of the region to
get.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the pixbuf or <code class="literal">None</code> on
error</td></tr></tbody></table><p>The <code class="methodname">get_from_image</code>() method is the same
as the <a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--get-from-drawable" title="gtk.gdk.Pixbuf.get_from_drawable"><code class="methodname">get_from_drawable</code>()</a>
method but gets the pixbuf from the <a class="link" href="class-gdkimage.html" title="gtk.gdk.Image"><code class="classname">gtk.gdk.Image</code></a>
specified by <em class="parameter"><code>src</code></em>.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.get_colorspace"><a name="method-gdkpixbuf--get-colorspace"></a><h3>gtk.gdk.Pixbuf.get_colorspace</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_colorspace</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the color space.</td></tr></tbody></table><p>The <code class="methodname">get_colorspace</code>() method returns the
color space of the pixbuf.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.get_n_channels"><a name="method-gdkpixbuf--get-n-channels"></a><h3>gtk.gdk.Pixbuf.get_n_channels</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_n_channels</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the number of channels.</td></tr></tbody></table><p>The <code class="methodname">get_n_channels</code>() method returns the
number of channels of a pixbuf.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.get_has_alpha"><a name="method-gdkpixbuf--get-has-alpha"></a><h3>gtk.gdk.Pixbuf.get_has_alpha</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_has_alpha</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if the pixbuf has an
alpha channel.</td></tr></tbody></table><p>The <code class="methodname">get_has_alpha</code>() method returns
<code class="literal">True</code> if the pixbuf has an alpha channel (opacity
information).</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.get_bits_per_sample"><a name="method-gdkpixbuf--get-bits-per-sample"></a><h3>gtk.gdk.Pixbuf.get_bits_per_sample</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_bits_per_sample</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the number of bits per color
sample.</td></tr></tbody></table><p>The <code class="methodname">get_bits_per_sample</code>() method returns
the number of bits per color sample in a pixbuf.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.get_pixels"><a name="method-gdkpixbuf--get-pixels"></a><h3>gtk.gdk.Pixbuf.get_pixels</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_pixels</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a string containing the pixel data of the
pixbuf</td></tr></tbody></table><p>The <code class="methodname">get_pixels</code>() method returns a sting
containing the pixel data of the pixbuf.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.get_width"><a name="method-gdkpixbuf--get-width"></a><h3>gtk.gdk.Pixbuf.get_width</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_width</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the width in pixels.</td></tr></tbody></table><p>The <code class="methodname">get_width</code>() method returns the
width of the pixbuf.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.get_height"><a name="method-gdkpixbuf--get-height"></a><h3>gtk.gdk.Pixbuf.get_height</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_height</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the height in pixels.</td></tr></tbody></table><p>The <code class="methodname">get_height</code>() method returns the
height of the pixbuf.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.get_rowstride"><a name="method-gdkpixbuf--get-rowstride"></a><h3>gtk.gdk.Pixbuf.get_rowstride</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_rowstride</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the number of bytes between
rows.</td></tr></tbody></table><p>The <code class="methodname">get_rowstride</code>() method returns the
rowstride of a pixbuf, which is the number of bytes between rows.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.get_option"><a name="method-gdkpixbuf--get-option"></a><h3>gtk.gdk.Pixbuf.get_option</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_option</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>key</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>key</code></strong> :</span></p></td><td>a key string</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the value associated with
<em class="parameter"><code>key</code></em></td></tr></tbody></table><p>The <code class="methodname">get_option</code>() method looks up
<em class="parameter"><code>key</code></em> in the list of options that may have been
attached to the pixbuf when it was loaded.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.copy"><a name="method-gdkpixbuf--copy"></a><h3>gtk.gdk.Pixbuf.copy</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">copy</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>A newly-created pixbuf or
<code class="literal">None</code> if not enough memory could be
allocated.</td></tr></tbody></table><p>The <code class="methodname">copy</code>() method returns a new <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a> with
a copy of the data in the pixbuf.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.fill"><a name="method-gdkpixbuf--fill"></a><h3>gtk.gdk.Pixbuf.fill</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">fill</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>pixel</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>pixel</code></strong> :</span></p></td><td>the RGBA pixel to clear to (0xffffffff is
opaque white, 0x00000000 transparent black)</td></tr></tbody></table><p>The <code class="methodname">fill</code>() method clears the pixbuf to
the RGBA value specified by <em class="parameter"><code>pixel</code></em>, converting the
RGBA value into the pixbuf's pixel format. The alpha will be ignored if the
pixbuf doesn't have an alpha channel.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.save"><a name="method-gdkpixbuf--save"></a><h3>gtk.gdk.Pixbuf.save</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">save</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>filename</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>type</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>options</code></strong></span><span class="initializer">=None</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>filename</code></strong> :</span></p></td><td>the name of file to save.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>type</code></strong> :</span></p></td><td>the name of the file
format.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>options</code></strong> :</span></p></td><td>a Python dict containing key-value string pairs
or <code class="literal">None</code></td></tr></tbody></table><p>The <code class="methodname">save</code>() method saves the pixbuf to a
file in the format specified by <em class="parameter"><code>type</code></em>, which may be
"jpeg" or "png". If <em class="parameter"><code>options</code></em> is not
<code class="literal">None</code> it should be a Python dict containing key-value
string pairs that modify the save parameters. For example:</p><div class="informalexample"><pre class="programlisting">
pixbuf.save(filename, "jpeg", {"quality":"100"})
</pre></div><p>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.</p><p>This method raises the GError exception if an error occurs
during the save operation.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.save_to_callback"><a name="method-gdkpixbuf--save-to-callback"></a><h3>gtk.gdk.Pixbuf.save_to_callback</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">save_to_callback</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>save_func</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>type</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>options</code></strong></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>user_data</code></strong></span><span class="initializer">=None</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>save_func</code></strong> :</span></p></td><td> a function that is called to save each block
of data that the save routine generates.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>type</code></strong> :</span></p></td><td>the name of the file
format.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>options</code></strong> :</span></p></td><td>a Python dict containing key-value string pairs
or <code class="literal">None</code></td></tr><tr><td><p><span class="term"><strong class="parameter"><code>user_data</code></strong> :</span></p></td><td>user-specified data passed to
<code class="literal">save_func</code> or <code class="literal">None</code></td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method was available in PyGTK 2.8 and above.</p></div><p>The <code class="methodname">save_to_callback</code>() method saves the
pixbuf in the format specified by <em class="parameter"><code>type</code></em> by feeding the
pixbuf data to the callback function specified by
<em class="parameter"><code>save_func</code></em>. <em class="parameter"><code>type</code></em> may be "jpeg",
"png" or "ico" or other installed formats. If <em class="parameter"><code>options</code></em>
is not <code class="literal">None</code> it should be a Python dict containing
key-value string pairs that modify the save parameters. For example:</p><div class="informalexample"><pre class="programlisting">
pixbuf.save_to_callback(func, "jpeg", {"quality":"100"})
</pre></div><p>See the <a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--save" title="gtk.gdk.Pixbuf.save"><code class="methodname">save</code>()</a>
method for more information on formats. If <em class="parameter"><code>user_data</code></em>
is not None it is passed to <em class="parameter"><code>save_func</code></em> with each
invocation.</p><p>This method raises a GError exception or exceptions raised by
<em class="parameter"><code>save_func</code></em> if an error occurs during the save
operation.</p><p>The signature of <em class="parameter"><code>save_func</code></em> is:</p><pre class="programlisting">
def pixbuf_save_func(buf, data=None):
</pre><p>where <em class="parameter"><code>buf</code></em> is a Python string containing
the pixbuf data and <em class="parameter"><code>data</code></em> is
<em class="parameter"><code>user_data</code></em>. <em class="parameter"><code>pixbuf_save_func</code></em>
returns <code class="literal">True</code> if successful or <code class="literal">False</code> on
failure.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.add_alpha"><a name="method-gdkpixbuf--add-alpha"></a><h3>gtk.gdk.Pixbuf.add_alpha</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">add_alpha</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>substitute_color</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>r</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>g</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>b</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>substitute_color</code></strong> :</span></p></td><td>if <code class="literal">False</code>, the
(<em class="parameter"><code>r</code></em>, <em class="parameter"><code>g</code></em>,
<em class="parameter"><code>b</code></em>) arguments will be ignored.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>r</code></strong> :</span></p></td><td>the red value to
substitute.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>g</code></strong> :</span></p></td><td>the green value to
substitute.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>b</code></strong> :</span></p></td><td>the blue value to
substitute.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>.</td></tr></tbody></table><p>The <code class="methodname">add_alpha</code>() method returns a new <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
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).</p><p>If <em class="parameter"><code>substitute_color</code></em> is
<code class="literal">True</code>, then the color specified by
(<em class="parameter"><code>r</code></em>, <em class="parameter"><code>g</code></em>,
<em class="parameter"><code>b</code></em>) will be assigned zero opacity. That is, if you
pass (255, 255, 255) for the substitute color, all white pixels will become
fully transparent.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.copy_area"><a name="method-gdkpixbuf--copy-area"></a><h3>gtk.gdk.Pixbuf.copy_area</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">copy_area</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>height</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_pixbuf</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_y</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>src_x</code></strong> :</span></p></td><td>the X coordinate within the
pixbuf.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>src_y</code></strong> :</span></p></td><td>the Y coordinate within the
pixbuf.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>width</code></strong> :</span></p></td><td>the width of the area to
copy.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>height</code></strong> :</span></p></td><td>the height of the area to
copy.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_pixbuf</code></strong> :</span></p></td><td>the destination pixbuf.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_x</code></strong> :</span></p></td><td>the X coordinate within
<em class="parameter"><code>dest_pixbuf</code></em>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_y</code></strong> :</span></p></td><td>the Y coordinate within
<em class="parameter"><code>dest_pixbuf</code></em>.</td></tr></tbody></table><p>The <code class="methodname">copy_area</code>() method copies a
rectangular area from the pixbuf to the destination <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
specified by <em class="parameter"><code>dest_pixbuf</code></em>. Conversion of pixbuf
formats is done automatically.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.saturate_and_pixelate"><a name="method-gdkpixbuf--saturate-and-pixelate"></a><h3>gtk.gdk.Pixbuf.saturate_and_pixelate</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">saturate_and_pixelate</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>saturation</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>pixelate</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>dest</code></strong> :</span></p></td><td>the <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a> to
write the modified version of the pixbuf</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>saturation</code></strong> :</span></p></td><td>the saturation factor</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>pixelate</code></strong> :</span></p></td><td>if <code class="literal">True</code> pixelate
<em class="parameter"><code>dest</code></em></td></tr></tbody></table><p>The <code class="methodname">saturate_and_pixelate</code>() method
modifies the saturation and optionally pixelates the pixbuf, placing the
result in <em class="parameter"><code>dest</code></em>. the pixbuf and
<em class="parameter"><code>dest</code></em> may be the same <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a> with
no ill effects. If <em class="parameter"><code>saturation</code></em> 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 <em class="parameter"><code>pixelate</code></em> is <code class="literal">True</code>,
then pixels are faded in a checkerboard pattern to create a pixelated image.
The pixbuf and <em class="parameter"><code>dest</code></em> must have the same image format,
size, and rowstride.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.scale"><a name="method-gdkpixbuf--scale"></a><h3>gtk.gdk.Pixbuf.scale</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">scale</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_height</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>offset_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>offset_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>scale_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>scale_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>interp_type</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>dest</code></strong> :</span></p></td><td>the <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a> the
scaling is rendered to.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_x</code></strong> :</span></p></td><td>the X coordinate for the
rectangle</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_y</code></strong> :</span></p></td><td>the Y coordinate for the
rectangle</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_width</code></strong> :</span></p></td><td>the width of the rectangle</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_height</code></strong> :</span></p></td><td>the height of the
rectangle</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>offset_x</code></strong> :</span></p></td><td>the offset in the X direction (currently
rounded to an integer)</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>offset_y</code></strong> :</span></p></td><td>the offset in the Y direction (currently
rounded to an integer)</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>scale_x</code></strong> :</span></p></td><td>the scale factor in the X
direction</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>scale_y</code></strong> :</span></p></td><td>the scale factor in the Y
direction</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>interp_type</code></strong> :</span></p></td><td>the interpolation type for the
transformation.</td></tr></tbody></table><p>The <code class="methodname">scale</code>() method creates a
transformation of the pixbuf's image by scaling by
<em class="parameter"><code>scale_x</code></em> and <em class="parameter"><code>scale_y</code></em> and
translating by <em class="parameter"><code>offset_x</code></em> and
<em class="parameter"><code>offset_y</code></em> it, then rendering the rectangle
(<em class="parameter"><code>dest_x</code></em>, <em class="parameter"><code>dest_y</code></em>,
<em class="parameter"><code>dest_width</code></em>, <em class="parameter"><code>dest_height</code></em>) of
the resulting image onto the destination image specified by
<em class="parameter"><code>dest</code></em> replacing the previous contents. The value of
<em class="parameter"><code>interp_type</code></em> must be one of:</p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><code class="literal">gtk.gdk.INTERP_NEAREST</code></span></p></td><td>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.</td></tr><tr><td><p><span class="term"><code class="literal">gtk.gdk.INTERP_TILES</code></span></p></td><td>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.</td></tr><tr><td><p><span class="term"><code class="literal">gtk.gdk.INTERP_BILINEAR</code></span></p></td><td>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.</td></tr><tr><td><p><span class="term"><code class="literal">gtk.gdk.INTERP_HYPER</code></span></p></td><td>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).</td></tr></tbody></table><p>Try the <a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--scale-simple" title="gtk.gdk.Pixbuf.scale_simple"><code class="methodname">scale_simple</code>()</a>
method as an alternative with a simpler interface.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.composite"><a name="method-gdkpixbuf--composite"></a><h3>gtk.gdk.Pixbuf.composite</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">composite</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_height</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>offset_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>offset_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>scale_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>scale_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>interp_type</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>overall_alpha</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>dest</code></strong> :</span></p></td><td>the output <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a></td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_x</code></strong> :</span></p></td><td>the X coordinate for the
rectangle</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_y</code></strong> :</span></p></td><td>the top coordinate for the
rectangle</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_width</code></strong> :</span></p></td><td>the width of the rectangle</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_height</code></strong> :</span></p></td><td>the height of the
rectangle</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>offset_x</code></strong> :</span></p></td><td>the offset in the X direction (currently
rounded to an integer)</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>offset_y</code></strong> :</span></p></td><td>the offset in the Y direction (currently
rounded to an integer)</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>scale_x</code></strong> :</span></p></td><td>the scale factor in the X
direction</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>scale_y</code></strong> :</span></p></td><td>the scale factor in the Y
direction</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>interp_type</code></strong> :</span></p></td><td>the interpolation type for the
transformation.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>overall_alpha</code></strong> :</span></p></td><td>overall alpha for source image
(0..255)</td></tr></tbody></table><p>The <code class="methodname">composite</code>() method creates a
transformation of the pixbuf's image by scaling by
<em class="parameter"><code>scale_x</code></em> and <em class="parameter"><code>scale_y</code></em> and
translating by <em class="parameter"><code>offset_x</code></em> and
<em class="parameter"><code>offset_y</code></em>, then compositing the rectangle
(<em class="parameter"><code>dest_x</code></em>, <em class="parameter"><code>dest_y</code></em>,
<em class="parameter"><code>dest_width</code></em>, <em class="parameter"><code>dest_height</code></em>) of
the resulting image onto the destination image. The value of
<em class="parameter"><code>interp_type</code></em> must be one of:</p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><code class="literal">gtk.gdk.INTERP_NEAREST</code></span></p></td><td>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.</td></tr><tr><td><p><span class="term"><code class="literal">gtk.gdk.INTERP_TILES</code></span></p></td><td>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.</td></tr><tr><td><p><span class="term"><code class="literal">gtk.gdk.INTERP_BILINEAR</code></span></p></td><td>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.</td></tr><tr><td><p><span class="term"><code class="literal">gtk.gdk.INTERP_HYPER</code></span></p></td><td>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).</td></tr></tbody></table><p></p></div><div class="refsect2" title="gtk.gdk.Pixbuf.composite_color"><a name="method-gdkpixbuf--composite-color"></a><h3>gtk.gdk.Pixbuf.composite_color</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">composite_color</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_height</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>offset_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>offset_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>scale_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>scale_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>interp_type</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>overall_alpha</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>check_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>check_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>check_size</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>color1</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>color2</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>dest</code></strong> :</span></p></td><td>the output <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a></td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_x</code></strong> :</span></p></td><td>the X coordinate for the
rectangle</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_y</code></strong> :</span></p></td><td>the top coordinate for the
rectangle</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_width</code></strong> :</span></p></td><td>the width of the rectangle</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_height</code></strong> :</span></p></td><td>the height of the
rectangle</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>offset_x</code></strong> :</span></p></td><td>the offset in the X direction (currently
rounded to an integer)</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>offset_y</code></strong> :</span></p></td><td>the offset in the Y direction (currently
rounded to an integer)</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>scale_x</code></strong> :</span></p></td><td>the scale factor in the X
direction</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>scale_y</code></strong> :</span></p></td><td>the scale factor in the Y
direction</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>interp_type</code></strong> :</span></p></td><td>the interpolation type for the
transformation.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>overall_alpha</code></strong> :</span></p></td><td>overall alpha for source image
(0..255)</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>check_x</code></strong> :</span></p></td><td>the X offset for the checkboard (origin of
checkboard is at -<em class="parameter"><code>check_x</code></em>,
-<em class="parameter"><code>check_y</code></em>)</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>check_y</code></strong> :</span></p></td><td>the Y offset for the
checkboard</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>check_size</code></strong> :</span></p></td><td>the size of checks in the checkboard (must be a
power of two)</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>color1</code></strong> :</span></p></td><td>the color of check at upper
left</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>color2</code></strong> :</span></p></td><td>the color of the other
check</td></tr></tbody></table><p>The <code class="methodname">composite_color</code>() method creates a
transformation of the source image <em class="parameter"><code>src</code></em> by scaling by
<em class="parameter"><code>scale_x</code></em> and <em class="parameter"><code>scale_y</code></em> and
translating by <em class="parameter"><code>offset_x</code></em> and
<em class="parameter"><code>offset_y</code></em>, then compositing the rectangle
(<em class="parameter"><code>dest_x</code></em> ,<em class="parameter"><code>dest_y</code></em>,
<em class="parameter"><code>dest_width</code></em>, <em class="parameter"><code>dest_height</code></em>) of
the resulting image with a checkboard of the colors
<em class="parameter"><code>color1</code></em> and <em class="parameter"><code>color2</code></em> and renders
it onto the destination image. The value of
<em class="parameter"><code>interp_type</code></em> must be one of:</p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><code class="literal">gtk.gdk.INTERP_NEAREST</code></span></p></td><td>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.</td></tr><tr><td><p><span class="term"><code class="literal">gtk.gdk.INTERP_TILES</code></span></p></td><td>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.</td></tr><tr><td><p><span class="term"><code class="literal">gtk.gdk.INTERP_BILINEAR</code></span></p></td><td>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.</td></tr><tr><td><p><span class="term"><code class="literal">gtk.gdk.INTERP_HYPER</code></span></p></td><td>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).</td></tr></tbody></table><p>See the <a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--composite-color-simple" title="gtk.gdk.Pixbuf.composite_color_simple"><code class="methodname">composite_color_simple</code>()</a>
method for a simpler variant of this method suitable for most tasks.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.scale_simple"><a name="method-gdkpixbuf--scale-simple"></a><h3>gtk.gdk.Pixbuf.scale_simple</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">scale_simple</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_height</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>interp_type</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>dest_width</code></strong> :</span></p></td><td>the width of destination
image</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_height</code></strong> :</span></p></td><td>the height of destination
image</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>interp_type</code></strong> :</span></p></td><td>the interpolation type for the
transformation.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the new <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>, or
<code class="literal">None</code> if not enough memory could be allocated for
it.</td></tr></tbody></table><p>The <code class="methodname">scale_simple</code>() method returns a new
<a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
containing a copy of the pixbuf scaled to <em class="parameter"><code>dest_width</code></em>
x <em class="parameter"><code>dest_height</code></em>. The pixbuf is unaffected by the
scaling operation. The value of <em class="parameter"><code>interp_type</code></em> must be
one of:</p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><code class="literal">gtk.gdk.INTERP_NEAREST</code></span></p></td><td>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.</td></tr><tr><td><p><span class="term"><code class="literal">gtk.gdk.INTERP_TILES</code></span></p></td><td>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.</td></tr><tr><td><p><span class="term"><code class="literal">gtk.gdk.INTERP_BILINEAR</code></span></p></td><td>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.</td></tr><tr><td><p><span class="term"><code class="literal">gtk.gdk.INTERP_HYPER</code></span></p></td><td>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).</td></tr></tbody></table><p><em class="parameter"><code>interp_type</code></em> should be
<code class="literal">gtk.gdk.INTERP_NEAREST</code> if you want maximum speed (but
when scaling down <code class="literal">gtk.gdk.INTERP_NEAREST</code> is usually
unusably ugly). The default <em class="parameter"><code>interp_type</code></em> should be
<code class="literal">GDK_INTERP_BILINEAR</code> which offers reasonable quality and
speed.</p><p>You can scale a sub-portion of <em class="parameter"><code>src</code></em> by
creating a sub-pixbuf pointing into <em class="parameter"><code>src</code></em>; see the
<a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--subpixbuf" title="gtk.gdk.Pixbuf.subpixbuf"><code class="methodname">subpixbuf</code>()</a>
method for more information.</p><p>For more complicated scaling/compositing see the <a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--scale" title="gtk.gdk.Pixbuf.scale"><code class="methodname">scale</code>()</a>
and <a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--composite" title="gtk.gdk.Pixbuf.composite"><code class="methodname">composite</code>()</a>
methods.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.composite_color_simple"><a name="method-gdkpixbuf--composite-color-simple"></a><h3>gtk.gdk.Pixbuf.composite_color_simple</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">composite_color_simple</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dest_height</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>interp_type</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>overall_alpha</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>check_size</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>color1</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>color2</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>dest_width</code></strong> :</span></p></td><td>the width of destination
image</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>dest_height</code></strong> :</span></p></td><td>the height of destination
image</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>interp_type</code></strong> :</span></p></td><td>the interpolation type for the
transformation.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>overall_alpha</code></strong> :</span></p></td><td>overall alpha for source image
(0..255)</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>check_size</code></strong> :</span></p></td><td>the size of checks in the checkboard (must be a
power of two)</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>color1</code></strong> :</span></p></td><td>the color of check at upper
left</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>color2</code></strong> :</span></p></td><td>the color of the other
check</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the new <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>, or
<code class="literal">NULL</code> if not enough memory could be allocated for
it.</td></tr></tbody></table><p>The <code class="methodname">composite_color_simple</code>() method
returns a new <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a> by
scaling the pixbuf to <em class="parameter"><code>dest_width</code></em> x
<em class="parameter"><code>dest_height</code></em> and compositing the result with a
checkboard of colors <em class="parameter"><code>color1</code></em> and
<em class="parameter"><code>color2</code></em>. The value of <em class="parameter"><code>interp_type</code></em> must be
one of:</p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><code class="literal">gtk.gdk.INTERP_NEAREST</code></span></p></td><td>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.</td></tr><tr><td><p><span class="term"><code class="literal">gtk.gdk.INTERP_TILES</code></span></p></td><td>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.</td></tr><tr><td><p><span class="term"><code class="literal">gtk.gdk.INTERP_BILINEAR</code></span></p></td><td>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.</td></tr><tr><td><p><span class="term"><code class="literal">gtk.gdk.INTERP_HYPER</code></span></p></td><td>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).</td></tr></tbody></table><p>See the <a class="link" href="class-gdkpixbuf.html#method-gdkpixbuf--composite-color" title="gtk.gdk.Pixbuf.composite_color"><code class="methodname">composite_color</code>()</a>
method for a more powerful but complicated interface.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.get_pixels_array"><a name="method-gdkpixbuf--get-pixels-array"></a><h3>gtk.gdk.Pixbuf.get_pixels_array</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_pixels_array</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a Numeric Python array containing the pixel
data of the pixbuf</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.2 and above.</p></div><p>The <code class="methodname">get_pixels_array</code>() method returns a
Numeric Python array containing the pixel data of the pixbuf.</p><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>PyGTK must be compiled with Numeric Python support for this
method to be available.</p></div></div><div class="refsect2" title="gtk.gdk.Pixbuf.subpixbuf"><a name="method-gdkpixbuf--subpixbuf"></a><h3>gtk.gdk.Pixbuf.subpixbuf</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">subpixbuf</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_x</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>src_y</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>height</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>src_x</code></strong> :</span></p></td><td>X coord in the pixbuf</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>src_y</code></strong> :</span></p></td><td>Y coord in the pixbuf</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>width</code></strong> :</span></p></td><td>width of region in the pixbuf</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>height</code></strong> :</span></p></td><td>height of region in the pixbuf</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a></td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <code class="methodname">subpixbuf</code>() method creates a new
<a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
that represents a sub-region of the pixbuf. The new pixbuf shares its pixels
with the original pixbuf, so writing to one affects both.</p></div><div class="refsect2" title="gtk.gdk.Pixbuf.rotate_simple"><a name="method-gdkpixbuf--rotate-simple"></a><h3>gtk.gdk.Pixbuf.rotate_simple</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">rotate_simple</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>angle</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>angle</code></strong> :</span></p></td><td>the rotation angle</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a></td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.10 and above.</p></div><p>The <code class="methodname">rotate_simple</code>() method creates a
new <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
by rotating the given pixbuf by a multiple of 90 degrees as specified
by <em class="parameter"><code>angle</code></em> which is one of the <a class="xref" href="gdk-constants.html#gdk-pixbuf-rotation-constants" title="GDK Pixbuf Rotation Constants">GDK Pixbuf Rotation Constants</a></p></div><div class="refsect2" title="gtk.gdk.Pixbuf.flip"><a name="method-gdkpixbuf--flip"></a><h3>gtk.gdk.Pixbuf.flip</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">flip</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>horizontal</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>flip</code></strong> :</span></p></td><td><code class="literal">True</code> to flip horizontally, <code class="literal">False</code> to
flip vertically</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a></td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.6 and above.</p></div><p>The <code class="methodname">flip</code>() method creates a
new <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
by flipping the given pixbuf horizontally or vertically, as specified
by <em class="parameter"><code>horizontal</code></em>.</p></div></div><div class="refsect1" title="Functions"><a name="id3144935"></a><h2>Functions</h2><div class="refsect2" title="gtk.gdk.pixbuf_new_from_file"><a name="function-gdk--pixbuf-new-from-file"></a><h3>gtk.gdk.pixbuf_new_from_file</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.pixbuf_new_from_file</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>filename</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>filename</code></strong> :</span></p></td><td>the name of the file containing the image to
load</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>.</td></tr></tbody></table><p>The <code class="function">gtk.gdk.pixbuf_new_from_file</code>() function
returns a new <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
containing an image loaded from the file specified by
<em class="parameter"><code>filename</code></em>. 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 <a class="link" href="class-gdkpixbufloader.html" title="gtk.gdk.PixbufLoader"><code class="classname">gtk.gdk.PixbufLoader</code></a>
instead.</p><p>This function raises the GError exception if an error occurs
during the loading of the pixbuf.</p></div><div class="refsect2" title="gtk.gdk.pixbuf_new_from_file_at_size"><a name="function-gdk--pixbuf-new-from-file-at-size"></a><h3>gtk.gdk.pixbuf_new_from_file_at_size</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.pixbuf_new_from_file_at_size</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>filename</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>height</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>filename</code></strong> :</span></p></td><td>the name of the file containing the image to
load</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>width</code></strong> :</span></p></td><td> The width the image should
have</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>height</code></strong> :</span></p></td><td> The height the image should
have</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This function is available in PyGTK 2.4 and above.</p></div><p>The <code class="function">gtk.gdk.pixbuf_new_from_file_at_size</code>()
function returns a new <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
containing an image loaded from the file specified by
<em class="parameter"><code>filename</code></em> with it scaled to the size specified by
<em class="parameter"><code>width</code></em> and <em class="parameter"><code>height</code></em>. 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 <a class="link" href="class-gdkpixbufloader.html" title="gtk.gdk.PixbufLoader"><code class="classname">gtk.gdk.PixbufLoader</code></a>
instead.</p><p>This function raises the GError exception if an error occurs
during the loading of the pixbuf.</p></div><div class="refsect2" title="gtk.gdk.pixbuf_new_from_data"><a name="function-gdk--pixbuf-new-from-data"></a><h3>gtk.gdk.pixbuf_new_from_data</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.pixbuf_new_from_data</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>data</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>colorspace</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>has_alpha</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>bits_per_sample</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>width</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>height</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>rowstride</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>data</code></strong> :</span></p></td><td>a string containing image data in 8-bit/sample
packed format.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>colorspace</code></strong> :</span></p></td><td>the colorspace for the image
data.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>has_alpha</code></strong> :</span></p></td><td>If <code class="literal">True</code>, the data has an
opacity channel.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>bits_per_sample</code></strong> :</span></p></td><td>the number of bits per
sample.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>width</code></strong> :</span></p></td><td>the width of the image in pixels.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>height</code></strong> :</span></p></td><td>the height of the image in pixels.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>rowstride</code></strong> :</span></p></td><td>the distance in bytes between row
starts.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a></td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This function is available in PyGTK 2.2 and above.</p></div><p>The <code class="function">gtk.gdk.pixbuf_new_from_data</code>() function
returns a new pixbuf created from the string specified by
<em class="parameter"><code>data</code></em>. <em class="parameter"><code>data</code></em> must be RGB image
data with 8 bits per sample. <em class="parameter"><code>colorspace</code></em> must be
<code class="literal">gtk.gdk.COLORSPACE_RGB</code>.</p></div><div class="refsect2" title="gtk.gdk.pixbuf_new_from_array"><a name="function-gdk--pixbuf-new-from-array"></a><h3>gtk.gdk.pixbuf_new_from_array</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.pixbuf_new_from_array</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>array</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>colorspace</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>bits_per_sample</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>array</code></strong> :</span></p></td><td>a string containing image data in 8-bit/sample
packed format.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>colorspace</code></strong> :</span></p></td><td>the colorspace for the image
data.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>bits_per_sample</code></strong> :</span></p></td><td>the number of bits per
sample.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a></td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This function is available in PyGTK 2.2 and above.</p></div><p>The <code class="function">gtk.gdk.pixbuf_new_from_array</code>()
function returns a new pixbuf created from the Numeric Python array
specified by <em class="parameter"><code>array</code></em>. <em class="parameter"><code>array</code></em> must
be a 3 or 4 dimensional array (4 if the image has an alpha channel) with
<em class="parameter"><code>bits_per_sample</code></em> bits per sample.
<em class="parameter"><code>colorspace</code></em> must be
<code class="literal">gtk.gdk.COLORSPACE_RGB</code>.</p><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>PyGTK must be compiled with the Numeric Python module to
support this function.</p></div></div><div class="refsect2" title="gtk.gdk.pixbuf_new_from_xpm_data"><a name="function-gdk--pixbuf-new-from-xpm-data"></a><h3>gtk.gdk.pixbuf_new_from_xpm_data</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.pixbuf_new_from_xpm_data</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>data</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>data</code></strong> :</span></p></td><td>a list of strings containing the XPM image
data</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a></td></tr></tbody></table><p>The <code class="function">gtk.gdk.pixbuf_new_from_xpm_data</code>()
function returns a new <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a> by
parsing <code class="literal">XPM</code> data in memory specified by
<em class="parameter"><code>data</code></em>. <em class="parameter"><code>data</code></em> is a list of
strings containing the <code class="literal">XPM</code> data.</p></div><div class="refsect2" title="gtk.gdk.pixbuf_new_from_inline"><a name="function-gdk--pixbuf-new-from-inline"></a><h3>gtk.gdk.pixbuf_new_from_inline</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.pixbuf_new_from_inline</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>data_length</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>data</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>copy_pixels</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>data_length</code></strong> :</span></p></td><td>the length in bytes of the
<em class="parameter"><code>data</code></em></td></tr><tr><td><p><span class="term"><strong class="parameter"><code>data</code></strong> :</span></p></td><td>a string containing the inline pixbuf
data</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>copy_pixels</code></strong> :</span></p></td><td>if <code class="literal">True</code> the pixel data
should be copied</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
object</td></tr></tbody></table><p>The <code class="function">gtk.gdk.pixbuf_new_from_inline</code>()
function returns a <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a> 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.</p><p>GTK+ ships with a program called
<span class="command"><strong>gdk-pixbuf-csource</strong></span> which allows for conversion of an
image into such a inline representation.In almost all cases, you should pass
the <code class="option">--raw</code> flag to <span class="command"><strong>gdk-pixbuf-csource</strong></span>. A
sample invocation would be:</p><pre class="programlisting">
gdk-pixbuf-csource --raw --name=myimage_inline myimage.png
</pre><p>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 <code class="literal">False</code> for
<em class="parameter"><code>copy_pixels</code></em>.</p><p>This function raises the GError exception if an error occurs
during the loading of the pixbuf.</p></div><div class="refsect2" title="gtk.gdk.pixbuf_get_formats"><a name="function-gdk--pixbuf-get-formats"></a><h3>gtk.gdk.pixbuf_get_formats</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.pixbuf_get_formats</span>()</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a list of image formats as Python
dicts</td></tr></tbody></table><p>The <code class="function">gtk.gdk.pixbuf_get_formats</code>() function
returns a list of the supported image formats as a Python dict. The keys
of the image format dict are:</p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td><td>the name of the image format.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>description</code></em> :</span></p></td><td>a description of the image
format.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>mime_types</code></em> :</span></p></td><td>a list of the mime types this image
matches.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>extensions</code></em> :</span></p></td><td>a list of typical filename extensions for the
image format.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>is_writable</code></em> :</span></p></td><td>if <code class="literal">True</code> the image can be
written to a file</td></tr></tbody></table></div><div class="refsect2" title="gtk.gdk.pixbuf_get_file_info"><a name="function-gdk--pixbuf-get-file-info"></a><h3>gtk.gdk.pixbuf_get_file_info</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.gdk.pixbuf_get_file_info</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>filename</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>filename</code></strong> :</span></p></td><td>the name of the file to check</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>an image format as a Python dict</td></tr></tbody></table><p>The <code class="function">gtk.gdk.pixbuf_get_file_info</code>() function
reads enough of the file specified by <em class="parameter"><code>filename</code></em> to
determine its image format and then returns the image format information in
a Python dict. See the <a class="link" href="class-gdkpixbuf.html#function-gdk--pixbuf-get-formats" title="gtk.gdk.pixbuf_get_formats"><code class="function">gtk.gdk.pixbuf_get_formats</code>()</a>
function for more details on the image format dict.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-gdkpangorenderer.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="gdk-class-reference.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="class-gdkpixbufanimation.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.gdk.PangoRenderer </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> gtk.gdk.PixbufAnimation</td></tr></table></div></body></html>
|