Images
Name
Images -- an area for bit-mapped graphics stored on the X Windows client.
Synopsis
#include <gdk/gdk.h>
struct GdkImage;
GdkImage* gdk_image_new (GdkImageType type,
GdkVisual *visual,
gint width,
gint height);
enum GdkImageType;
GdkImage* gdk_image_new_bitmap (GdkVisual *visual,
gpointer data,
gint width,
gint height);
GdkImage* gdk_image_get (GdkDrawable *drawable,
gint x,
gint y,
gint width,
gint height);
GdkImage* gdk_image_ref (GdkImage *image);
void gdk_image_unref (GdkImage *image);
#define gdk_image_destroy
GdkColormap* gdk_image_get_colormap (GdkImage *image);
void gdk_image_set_colormap (GdkImage *image,
GdkColormap *colormap);
void gdk_image_put_pixel (GdkImage *image,
gint x,
gint y,
guint32 pixel);
guint32 gdk_image_get_pixel (GdkImage *image,
gint x,
gint y);
|
Details
struct GdkImage
struct GdkImage
{
GObject parent_instance;
GdkImageType type;
GdkVisual *visual; /* visual used to create the image */
GdkByteOrder byte_order;
gint width;
gint height;
guint16 depth;
guint16 bpp; /* bytes per pixel */
guint16 bpl; /* bytes per line */
guint16 bits_per_pixel; /* bits per pixel */
gpointer mem;
GdkColormap *colormap;
gpointer windowing_data;
}; |
The GdkImage struct contains information on the image and the pixel data.
enum GdkImageType
typedef enum
{
GDK_IMAGE_NORMAL,
GDK_IMAGE_SHARED,
GDK_IMAGE_FASTEST
} GdkImageType; |
Specifies the type of a GdkImage.
gdk_image_new_bitmap ()
GdkImage* gdk_image_new_bitmap (GdkVisual *visual,
gpointer data,
gint width,
gint height); |
Warning |
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.
Warning |
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. |
gdk_image_ref ()
Warning |
gdk_image_ref is deprecated and should not be used in newly-written code. |
Deprecated function; use g_object_ref() instead.
gdk_image_unref ()
Warning |
gdk_image_unref is deprecated and should not be used in newly-written code. |
Deprecated function; use g_object_unref() instead.
gdk_image_destroy
#define gdk_image_destroy gdk_image_unref |
Warning |
gdk_image_destroy is deprecated and should not be used in newly-written code. |
Destroys a GdkImage, freeing any resources allocated for it.
gdk_image_get_colormap ()
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().
gdk_image_set_colormap ()
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.
gdk_image_put_pixel ()
void gdk_image_put_pixel (GdkImage *image,
gint x,
gint y,
guint32 pixel); |
Sets a pixel in a GdkImage to a given pixel value.
gdk_image_get_pixel ()
guint32 gdk_image_get_pixel (GdkImage *image,
gint x,
gint y); |
Gets a pixel value at a specified position in a GdkImage.
See Also
- Bitmaps and Pixmaps
Graphics which are stored on the X Windows server.
Since these are stored on the server they can be drawn very quickly, and all
of the Drawing Primitives can be
used to draw on them. Their main disadvantage is that manipulating individual
pixels can be very slow.
- GdkRGB
Built on top of GdkImage, this provides much more functionality,
including the dithering of colors to produce better output on low-color
displays.