GFC Logo GFC Title Logo
Reference Manual
Main Page  |  Namespace List  |  Alphabetical List  |  Class List  |  File List

GFC::Gdk::Image Class Reference

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

#include <gfc/gdk/image.hh>

Inheritance diagram for GFC::Gdk::Image:

GFC::G::Object GFC::G::TypeInstance GFC::Trackable List of all members.

Public Member Functions

Constructors
Accessors
Methods

Static Public Member Functions

Protected Member Functions

Constructors

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

GFC::Gdk::Image::Image GdkImage *  image,
bool  owns_reference = true
[explicit, protected]
 

Construct a new Image from an existing GdkImage.

Parameters:
image A pointer to a GdkImage.
owns_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> GFC::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* GFC::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 GFC::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 GFC::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 GFC::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:
Generated on Tue Aug 24 00:34:36 2004 for GFC-UI by doxygen 1.3.8