Images: GDK 2 Reference Manual

## Images Images |

## Functions

GdkImage * | gdk_image_new ()
GdkImage * | gdk_image_new_bitmap ()
GdkImage * | gdk_image_get ()
GdkImage * | gdk_image_ref ()
void | gdk_image_unref ()
GdkColormap * | gdk_image_get_colormap ()
void | gdk_image_set_colormap ()
guint16 | gdk_image_get_bits_per_pixel ()
guint16 | gdk_image_get_bytes_per_pixel ()
guint16 | gdk_image_get_bytes_per_line ()
GdkByteOrder | gdk_image_get_byte_order ()
guint16 | gdk_image_get_depth ()
gint | gdk_image_get_height ()
GdkImageType | gdk_image_get_image_type ()
GdkVisual * | gdk_image_get_visual ()
gint | gdk_image_get_width ()
gpointer | gdk_image_get_pixels ()
void | gdk_image_put_pixel ()
guint32 | gdk_image_get_pixel ()

## Types and Values

| GdkImage
enum | GdkImageType
#define | gdk_image_destroy

## Includes

    #include <gdk/gdk.h>

## Description

## Functions

### gdk_image_new ()

    GdkImage *
    gdk_image_new (GdkImageType type,
                   GdkVisual *visual,
                   gint width,
                   gint height);

`gdk_image_new` is deprecated and should not be used in newly-written code.

### gdk_image_new_bitmap ()

    GdkImage *
    gdk_image_new_bitmap (GdkVisual *visual,
                          gpointer data,
                          gint width,
                          gint height);

`gdk_image_new_bitmap` is deprecated and should not be used in newly-written code.

Creates a new GdkImage with a depth of 1 from the given data.

THIS FUNCTION IS INCREDIBLY BROKEN. The passed-in data must be allocated by `malloc()` (NOT `g_malloc()`) and will be freed when the image is freed.

#### Parameters

visual | the GdkVisual to use for the image. |
data | the pixel data. |
width | the width of the image in pixels. |
height | the height of the image in pixels. |

#### Returns

a new GdkImage.

### gdk_image_get ()

    GdkImage *
    gdk_image_get (GdkDrawable *drawable,
                   gint x,
                   gint y,
                   gint width,
                   gint height);

`gdk_image_get` is deprecated and should not be used in newly-written code.

This is a deprecated wrapper for `gdk_drawable_get_image()`; `gdk_drawable_get_image()` should be used instead. Or even better: in most cases `gdk_pixbuf_get_from_drawable()` is the most convenient choice.

#### Parameters

drawable | a GdkDrawable |
x | x coordinate in `window` |
y | y coordinate in `window` |
width | width of area in `window` |
height | height of area in `window` |

#### Returns

a new GdkImage or `NULL`

### gdk_image_ref ()

    GdkImage *
    gdk_image_ref (GdkImage *image);

`gdk_image_ref` has been deprecated since version 2.0 and should not be used in newly-written code.

Use `g_object_ref()` instead.

Deprecated function; use `g_object_ref()` instead.

#### Parameters

image | a GdkImage |

#### Returns

the image

### gdk_image_unref ()

    void
    gdk_image_unref (GdkImage *image);

`gdk_image_unref` has been deprecated since version 2.0 and should not be used in newly-written code.

Use `g_object_unref()` instead.

Deprecated function; use `g_object_unref()` instead.

#### Parameters

image | a GdkImage |

### gdk_image_get_colormap ()

    GdkColormap *
    gdk_image_get_colormap (GdkImage *image);

`gdk_image_get_colormap` has been deprecated since version 2.22 and should not be used in newly-written code.

GdkImage should not be used anymore.

Retrieves 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 explicitely with `gdk_image_set_colormap()`.

#### Parameters

image | a GdkImage |

#### Returns

colormap for the image

### gdk_image_set_colormap ()

    void
    gdk_image_set_colormap (GdkImage *image,
                            GdkColormap *colormap);

`gdk_image_set_colormap` has been deprecated since version 2.22 and should not be used in newly-written code.

GdkImage should not be used anymore.

Sets the colormap for the image to the given colormap. Normally there's no need to use this function, 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.

#### Parameters

image | a GdkImage |
colormap | a GdkColormap |

### gdk_image_get_bits_per_pixel ()

    guint16
    gdk_image_get_bits_per_pixel (GdkImage *image);

`gdk_image_get_bits_per_pixel` has been deprecated since version 2.22 and should not be used in newly-written code.

GdkImage should not be used anymore.

Determines the number of bits per pixel of the image.

#### Parameters

image | a GdkImage |

#### Returns

the bits per pixel

Since: 2.22

### gdk_image_get_bytes_per_pixel ()

    guint16
    gdk_image_get_bytes_per_pixel (GdkImage *image);

`gdk_image_get_bytes_per_pixel` has been deprecated since version 2.22 and should not be used in newly-written code.

GdkImage should not be used anymore.

Determines the number of bytes per pixel of the image.

#### Parameters

image | a GdkImage |

#### Returns

the bytes per pixel

Since: 2.22

### gdk_image_get_bytes_per_line ()

    guint16
    gdk_image_get_bytes_per_line (GdkImage *image);

`gdk_image_get_bytes_per_line` has been deprecated since version 2.22 and should not be used in newly-written code.

GdkImage should not be used anymore.

Determines the number of bytes per line of the image.

#### Parameters

image | a GdkImage |

#### Returns

the bytes per line

Since: 2.22

### gdk_image_get_byte_order ()

    GdkByteOrder
    gdk_image_get_byte_order (GdkImage *image);

`gdk_image_get_byte_order` has been deprecated since version 2.22 and should not be used in newly-written code.

GdkImage should not be used anymore.

Determines the byte order of the image.

#### Parameters

image | a GdkImage |

#### Returns

a GdkVisual

Since: 2.22

### gdk_image_get_depth ()

    guint16
    gdk_image_get_depth (GdkImage *image);

`gdk_image_get_depth` has been deprecated since version 2.22 and should not be used in newly-written code.

GdkImage should not be used anymore.

Determines the depth of the image.

#### Parameters

image | a GdkImage |

#### Returns

the depth

Since: 2.22

### gdk_image_get_height ()

    gint
    gdk_image_get_height (GdkImage *image);

`gdk_image_get_height` has been deprecated since version 2.22 and should not be used in newly-written code.

GdkImage should not be used anymore.

Determines the height of the image.

#### Parameters

image | a GdkImage |

#### Returns

the height

Since: 2.22

### gdk_image_get_image_type ()

    GdkImageType
    gdk_image_get_image_type (GdkImage *image);

`gdk_image_get_image_type` has been deprecated since version 2.22 and should not be used in newly-written code.

GdkImage should not be used anymore.

Determines the type of a given image.

#### Parameters

image | a GdkImage |

#### Returns

the GdkImageType of the image

Since: 2.22

### gdk_image_get_visual ()

    GdkVisual *
    gdk_image_get_visual (GdkImage *image);

`gdk_image_get_visual` has been deprecated since version 2.22 and should not be used in newly-written code.

GdkImage should not be used anymore.

Determines the visual that was used to create the image.

#### Parameters

image | a GdkImage |

#### Returns

a GdkVisual

Since: 2.22

### gdk_image_get_width ()

    gint
    gdk_image_get_width (GdkImage *image);

`gdk_image_get_width` has been deprecated since version 2.22 and should not be used in newly-written code.

GdkImage should not be used anymore.

Determines the width of the image.

#### Parameters

image | a GdkImage |

#### Returns

the width

Since: 2.22

### gdk_image_get_pixels ()

    gpointer
    gdk_image_get_pixels (GdkImage *image);

`gdk_image_get_pixels` has been deprecated since version 2.22 and should not be used in newly-written code.

GdkImage should not be used anymore.

Returns a pointer to the pixel data of the image.

#### Parameters

image | a GdkImage |

#### Returns

the pixel data of the image

Since: 2.22

### gdk_image_put_pixel ()

    void
    gdk_image_put_pixel (GdkImage *image,
                         gint x,
                         gint y,
                         guint32 pixel);

`gdk_image_put_pixel` is deprecated and should not be used in newly-written code.

### gdk_image_get_pixel ()

    guint32
    gdk_image_get_pixel (GdkImage *image,
                         gint x,
                         gint y);

`gdk_image_get_pixel` is deprecated and should not be used in newly-written code.

## Types and Values

### GdkImage

    typedef struct {
      GObject parent_instance;

      GdkImageType GSEAL (type); /* read only. */
      GdkVisual    *GSEAL (visual);	    /* read only. visual used to create the image */
      GdkByteOrder GSEAL (byte_order); /* read only. */
      gint		GSEAL (width);  /* read only. */
      gint		GSEAL (height); /* read only. */
      guint16 GSEAL (depth);  /* read only. */
      guint16 GSEAL (bpp);    /* read only. bytes per pixel */
      guint16 GSEAL (bpl);    /* read only. bytes per line */
      guint16       GSEAL (bits_per_pixel); /* read only. bits per pixel */
      gpointer GSEAL (mem);

      GdkColormap  *GSEAL (colormap); /* read only. */
    } GdkImage;

### enum GdkImageType

#### Members

GDK_IMAGE_NORMAL |  |
GDK_IMAGE_SHARED |  |
GDK_IMAGE_FASTEST |  |

### gdk_image_destroy

    #define gdk_image_destroy              g_object_unref

`gdk_image_destroy` is deprecated and should not be used in newly-written code.