manpagez: man pages & more
html files: pygtk
Home | html | info | man
gtk.gdk.Image — an area for bit-mapped graphics stored on the X Windows client.


class gtk.gdk.Image(gobject.GObject):
    gtk.gdk.Image(type, visual, width, height)
def put_pixel(x, y, pixel)
def get_pixel(x, y)
def set_colormap(colormap)
def get_colormap()


+-- gobject.GObject
  +-- gtk.gdk.Image


The gtk.gdk.Image type represents an area for drawing graphics. It has now been superseded to a large extent by the much more flexible RGB methods (see gtk.gdk.Drawable).


    gtk.gdk.Image(type, visual, width, height)

type :

a gtk.gdk.Image type

visual :

a gtk.gdk.Visual

width :

the width in pixels of the image

height :

the height in pixels of the image

Returns :

a new gtk.gdk.Image object

Creates a new gtk.gdk.Image object of the specified type, width and height and using the gtk.gdk.Visual specified by visual. The value of type must be one of:


The original X image type, which is quite slow since the image has to be transferred from the client to the server to display it.


A faster image type, which uses shared memory to transfer the image data between client and server. However this will only be available if client and server are on the same machine and the shared memory extension is supported by the server.


Specifies that gtk.gdk.IMAGE_SHARED should be tried first, and if that fails then gtk.gdk.IMAGE_NORMAL will be used.

Usually using gtk.gdk.IMAGE_FASTEST is the best choice.



    def put_pixel(x, y, pixel)

x :

the x coordinate of the pixel to set.

y :

the y coordinate of the pixel to set.

pixel :

the pixel value to set.

The put_pixel() method sets the value of the pixel in the image at the location specified by x and y to the value specified by pixel.


    def get_pixel(x, y)

x :

the x coordinate of the pixel to get.

y :

the y coordinate of the pixel to get.

Returns :

the pixel value at the image location

The get_pixel() method returns the value of the pixel at the image location specified by x and y.


    def set_colormap(colormap)

colormap :

a gtk.gdk.Colormap

The set_colormap() method sets the colormap for the image to the specified colormap. Normally there's no need to use this method since images are created with the correct colormap if you get the image from a drawable. If you create the image from scratch, use the colormap of the drawable you intend to render the image to.


    def get_colormap()

Returns :

the colormap for the image

The get_colormap() method returns the colormap for a given image, if it exists. An image will have a colormap if the drawable from which it was created has a colormap, or if a colormap was set explicitly with the set_colormap() method.

© 2000-2024
Individual documents may contain additional copyright information.