Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gdk::Image Class Reference

A GdkImage C++ wrapper class. More...

`#include <inti/gdk/image.h>`

Inheritance diagram for Inti::Gdk::Image:

List of all members.

## Public Member Functions

Constructors

- virtual ~Image ()
    Destructor.

Accessors

- GdkImage * gdk_image () const
    Get a pointer to the GdkImage structure.
- GdkImageClass * gdk_image_class () const
    Get a pointer to the GdkImageClass structure.
- operator GdkImage * () const
    Conversion operator; safely converts a Image to a GdkImage pointer.
- ImageType image_type () const
    Returns the type of the image.
- const Visual & visual () const
    Returns the Visual used to create the image.
- ByteOrder byte_order () const
    Returns the byte order for the image.
- int width () const
    Returns the width of the image in pixels.
- int height () const
    Returns the height of the image in pixels.
- unsigned short depth () const
    Returns the depth of the image, i.e. the number of bits per pixel.
- unsigned short bytes_per_pixel () const
    Returns the number of bytes per pixel.
- unsigned short bytes_per_line () const
    Returns the number of bytes per line of the image.
- unsigned int get_pixel (int x, int y) const
    Gets a pixel value at a specified position in the image.
- Colormap * get_colormap () const
    Retrieves the colormap for a given image, if it exists.

Methods

- void put_pixel (int x, int y, unsigned int pixel)
    Sets a pixel in the image to a given pixel value.
- void set_colormap (Colormap &colormap)
    Sets the colormap for the image to the given colormap.

## Static Public Member Functions

- Pointer< Image > create (ImageType type, const Visual &visual, int width, int height)
    Creates a new image.

## Protected Member Functions

Constructors

- Image (GdkImage *image, bool reference=true)
    Construct a new Image from an existing GdkImage.

## Detailed Description

A GdkImage C++ wrapper class.

The Image object represents an area for drawing graphics. It has now been superceded to a large extent by the much more flexible Gdk::Drawable RGB drawing methods.

An Image can be manipulated with get_pixel() and put_pixel(), or alternatively by changing the actual pixel data. Though manipulating the pixel data requires complicated code to cope with the different formats that may be used. To draw an Image in a Gdk::Window or Gdk::Pixmap use Gdk::Drawable::draw_image().

## Constructor & Destructor Documentation

Inti::Gdk::Image::Image | ( | GdkImage * | image,
|  | bool | reference = true
| ) | `[explicit, protected]`

Construct a new Image from an existing GdkImage.

Parameters:

  image | A pointer to a GdkImage.
  reference | Set false if the initial reference count is floating, set true if it's not.

The image can be a newly created GdkImage or an existing GdkImage. (see G::Object::Object).

## Member Function Documentation

Pointer<Image> Inti::Gdk::Image::create | ( | ImageType | type,
|  | const Visual & | visual,
|  | int | width,
|  | int | height
| ) | `[static]`

Creates a new image.

Parameters:

  type | The type of the image, one of IMAGE_NORMAL, IMAGE_SHARED and IMAGE_FASTEST.
  visual | The Visual to use for the image.
  width | The width of the image in pixels.
  height | The height of the image in pixels.

Returns:
  A smart pointer to the new Image, or null if the image could not be created.

IMAGE_FASTEST is probably the best choice, since it will try creating an IMAGE_SHARED image first and if that fails it will then use IMAGE_NORMAL.

Colormap* Inti::Gdk::Image::get_colormap | ( |  | ) | const

Retrieves the colormap for a given image, if it exists.

Returns:
  The colormap for the image.

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 set_colormap().

unsigned int Inti::Gdk::Image::get_pixel | ( | int | x,
|  | int | y
| ) | const

Gets a pixel value at a specified position in the image.

Parameters:

  x | The X coordinate of the pixel to get.
  y | The Y coordinate of the pixel to get.

Returns:
  The pixel value at the given position.

void Inti::Gdk::Image::put_pixel | ( | int | x,
|  | int | y,
|  | unsigned int | pixel
| ) |

Sets a pixel in the image to a given pixel value.

Parameters:

  x | The X coordinate of the pixel to set.
  y | The Y coordinate of the pixel to set.
  pixel | The pixel value to set.

void Inti::Gdk::Image::set_colormap | ( | Colormap & | colormap | ) |

Sets the colormap for the image to the given colormap.

Parameters:

  colormap | A Colormap.

Normally there's no need to use this method, 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.

The documentation for this class was generated from the following file:

- gdk/image.h

Main Page - Footer