Gnome User Interface Library Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# GnomePixmap

## Name

GnomePixmap -- A widget to display and load images (pixmaps)

## Synopsis

    #include <gnome.h>

    struct      GnomePixmap;
    GtkWidget*  gnome_pixmap_new_from_file      (const char *filename);
    GtkWidget*  gnome_pixmap_new_from_file_at_size
                                                (const char *filename,
                                                 int width,
                                                 int height);
    GtkWidget*  gnome_pixmap_new_from_xpm_d     (char **xpm_data);
    GtkWidget*  gnome_pixmap_new_from_xpm_d_at_size
                                                (char **xpm_data,
                                                 int width,
                                                 int height);
    GtkWidget*  gnome_pixmap_new_from_rgb_d     (unsigned char *data,
                                                 unsigned char *alpha,
                                                 int rgb_width,
                                                 int rgb_height);
    GtkWidget*  gnome_pixmap_new_from_rgb_d_shaped
                                                (unsigned char *data,
                                                 unsigned char *alpha,
                                                 int rgb_width,
                                                 int rgb_height,
                                                 GdkImlibColor *shape_color);
    GtkWidget*  gnome_pixmap_new_from_rgb_d_shaped_at_size
                                                (unsigned char *data,
                                                 unsigned char *alpha,
                                                 int rgb_width,
                                                 int rgb_height,
                                                 int width,
                                                 int height,
                                                 GdkImlibColor *shape_color);
    GtkWidget*  gnome_pixmap_new_from_rgb_d_at_size
                                                (unsigned char *data,
                                                 unsigned char *alpha,
                                                 int rgb_width,
                                                 int rgb_height,
                                                 int width,
                                                 int height);
    GtkWidget*  gnome_pixmap_new_from_gnome_pixmap
                                                (GnomePixmap *gpixmap);
    GtkWidget*  gnome_pixmap_new_from_imlib     (GdkImlibImage *im);
    GtkWidget*  gnome_pixmap_new_from_imlib_at_size
                                                (GdkImlibImage *im,
                                                 int width,
                                                 int height);
    void        gnome_pixmap_load_file          (GnomePixmap *gpixmap,
                                                 const char *filename);
    void        gnome_pixmap_load_file_at_size  (GnomePixmap *gpixmap,
                                                 const char *filename,
                                                 int width,
                                                 int height);
    void        gnome_pixmap_load_xpm_d         (GnomePixmap *gpixmap,
                                                 char **xpm_data);
    void        gnome_pixmap_load_xpm_d_at_size (GnomePixmap *gpixmap,
                                                 char **xpm_data,
                                                 int width,
                                                 int height);
    void        gnome_pixmap_load_rgb_d         (GnomePixmap *gpixmap,
                                                 unsigned char *data,
                                                 unsigned char *alpha,
                                                 int rgb_width,
                                                 int rgb_height);
    void        gnome_pixmap_load_rgb_d_shaped  (GnomePixmap *gpixmap,
                                                 unsigned char *data,
                                                 unsigned char *alpha,
                                                 int rgb_width,
                                                 int rgb_height,
                                                 GdkImlibColor *shape_color);
    void        gnome_pixmap_load_rgb_d_shaped_at_size
                                                (GnomePixmap *gpixmap,
                                                 unsigned char *data,
                                                 unsigned char *alpha,
                                                 int rgb_width,
                                                 int rgb_height,
                                                 int width,
                                                 int height,
                                                 GdkImlibColor *shape_color);
    void        gnome_pixmap_load_rgb_d_at_size (GnomePixmap *gpixmap,
                                                 unsigned char *data,
                                                 unsigned char *alpha,
                                                 int rgb_width,
                                                 int rgb_height,
                                                 int width,
                                                 int height);
    void        gnome_pixmap_load_imlib         (GnomePixmap *gpixmap,
                                                 GdkImlibImage *im);
    void        gnome_pixmap_load_imlib_at_size (GnomePixmap *gpixmap,
                                                 GdkImlibImage *im,
                                                 int width,
                                                 int height);

## Object Hierarchy

      GtkObject
       +----GtkWidget
             +----GnomePixmap

## Description

This widget can display an image created or provided by a number of sources (a file from various supported file formats, memory, in-memory-xpm, Imlib handle, RGB buffer) and it can scale the image during the load process.

The GnomePixmap widget is particularly useful, as it load an image and provides it as a GtkWidget. While doing this, it does also make sure that the visuals and colormaps are correctly set so that the application will work properly on multi-depth display machines.

You should use this widget instead of the less powerful and more error-prone GtkPixmap widget.

## Details

### struct GnomePixmap

    struct GnomePixmap;

### gnome_pixmap_new_from_file ()

    GtkWidget*  gnome_pixmap_new_from_file      (const char *filename);

Returns a widget that contains the image, or `NULL` if it fails to load the image.

`filename` : | The name of a file containing a graphics image
Returns : | A new GnomePixmap widget or `NULL`

### gnome_pixmap_new_from_file_at_size ()

    GtkWidget*  gnome_pixmap_new_from_file_at_size
                                                (const char *filename,
                                                 int width,
                                                 int height);

Returns a widget that contains the image scaled to `width` by `height` pixels, or `NULL` if it fails to load the image.

`filename` : | The name of a file containing a graphics image
`width` : | desired width
`height` : | desired height.
Returns : | A new GnomePixmap widget or `NULL`

### gnome_pixmap_new_from_xpm_d ()

    GtkWidget*  gnome_pixmap_new_from_xpm_d     (char **xpm_data);

Returns a widget that contains the image, or `NULL` if it fails to load the image.

`xpm_data` : | A pointer to an inlined xpm image.
Returns : | A new GnomePixmap widget or `NULL`

### gnome_pixmap_new_from_xpm_d_at_size ()

    GtkWidget*  gnome_pixmap_new_from_xpm_d_at_size
                                                (char **xpm_data,
                                                 int width,
                                                 int height);

Returns a widget that contains the image scaled to `width` by `height` pixels, or `NULL` if it fails to load the image.

`xpm_data` : | A pointer to an inlined xpm image.
`width` : | desired widht
`height` : | desired height.
Returns : | A new GnomePixmap widget or `NULL`

### gnome_pixmap_new_from_rgb_d ()

    GtkWidget*  gnome_pixmap_new_from_rgb_d     (unsigned char *data,
                                                 unsigned char *alpha,
                                                 int rgb_width,
                                                 int rgb_height);

Returns a widget that contains the image, or `NULL` if it fails to load the image.

`data` : | A pointer to an inlined rgb image.
`alpha` : |
`rgb_width` : |
`rgb_height` : |
Returns : | A new GnomePixmap widget or `NULL`

### gnome_pixmap_new_from_rgb_d_shaped ()

    GtkWidget*  gnome_pixmap_new_from_rgb_d_shaped
                                                (unsigned char *data,
                                                 unsigned char *alpha,
                                                 int rgb_width,
                                                 int rgb_height,
                                                 GdkImlibColor *shape_color);

Returns a widget that contains the image, or `NULL` if it fails to load the image.

`data` : | A pointer to an inlined rgb image
`alpha` : | pointer to the alpha channel.
`rgb_width` : | width of the rgb data
`rgb_height` : | height of the rgb data.
`shape_color` : | which color encodes the transparency
Returns : | A new GnomePixmap widget or `NULL`

### gnome_pixmap_new_from_rgb_d_shaped_at_size ()

    GtkWidget*  gnome_pixmap_new_from_rgb_d_shaped_at_size
                                                (unsigned char *data,
                                                 unsigned char *alpha,
                                                 int rgb_width,
                                                 int rgb_height,
                                                 int width,
                                                 int height,
                                                 GdkImlibColor *shape_color);

Returns a widget that contains the image scaled to `width` by `height` pixels, or `NULL` if it fails to load the image.

`data` : | A pointer to an inlined rgb image
`alpha` : | pointer to the alpha channel.
`rgb_width` : | width of the rgb data
`rgb_height` : | height of the rgb data.
`width` : | desired width.
`height` : | desired height.
`shape_color` : | which color encodes the transparency
Returns : | A new GnomePixmap widget or `NULL`

### gnome_pixmap_new_from_rgb_d_at_size ()

    GtkWidget*  gnome_pixmap_new_from_rgb_d_at_size
                                                (unsigned char *data,
                                                 unsigned char *alpha,
                                                 int rgb_width,
                                                 int rgb_height,
                                                 int width,
                                                 int height);

Returns a widget that contains the image scaled to `width` by `height` pixels, or `NULL` if it fails to load the image.

`data` : | A pointer to an inlined rgb image.
`alpha` : |
`rgb_width` : | the width of the rgb image.
`rgb_height` : | the height of the rgb image.
`width` : | desired width.
`height` : | desired height.
Returns : | A new GnomePixmap widget or `NULL`

### gnome_pixmap_new_from_gnome_pixmap ()

    GtkWidget*  gnome_pixmap_new_from_gnome_pixmap
                                                (GnomePixmap *gpixmap);

Returns a widget that contains a copy of `gpixmap_old`

`gpixmap` : |
Returns : | A new GnomePixmap widget

### gnome_pixmap_new_from_imlib ()

    GtkWidget*  gnome_pixmap_new_from_imlib     (GdkImlibImage *im);

Returns a widget that contains the image, or `NULL` if it fails to load the image. Note that `im` will not be rendered after this call.

`im` : | A pointer to GdkImlibImage data
Returns : | A new GnomePixmap widget or `NULL`

### gnome_pixmap_new_from_imlib_at_size ()

    GtkWidget*  gnome_pixmap_new_from_imlib_at_size
                                                (GdkImlibImage *im,
                                                 int width,
                                                 int height);

Returns a widget that contains the image scaled to `width` by `height` pixels, or `NULL` if it fails to load the image. Note that `im` will not be * rendered after this call.

`im` : | A pointer to GdkImlibImage data
`width` : | desired width.
`height` : | desired height.
Returns : | A new GnomePixmap widget or `NULL`

### gnome_pixmap_load_file ()

    void        gnome_pixmap_load_file          (GnomePixmap *gpixmap,
                                                 const char *filename);

Sets the gnome pixmap to image stored in `filename`.

`gpixmap` : | the GnomePixmap widget
`filename` : | a new filename

### gnome_pixmap_load_file_at_size ()

    void        gnome_pixmap_load_file_at_size  (GnomePixmap *gpixmap,
                                                 const char *filename,
                                                 int width,
                                                 int height);

Sets the gnome pixmap to image stored in `filename` scaled to `width` and `height` pixels.

`gpixmap` : | the GnomePixmap widget
`filename` : | a new filename
`width` : | desired width.
`height` : | desired height.

### gnome_pixmap_load_xpm_d ()

    void        gnome_pixmap_load_xpm_d         (GnomePixmap *gpixmap,
                                                 char **xpm_data);

Sets the gnome pixmap to image stored in `xpm_data`.

`gpixmap` : | the GnomePixmap widget
`xpm_data` : | xpm image data

### gnome_pixmap_load_xpm_d_at_size ()

    void        gnome_pixmap_load_xpm_d_at_size (GnomePixmap *gpixmap,
                                                 char **xpm_data,
                                                 int width,
                                                 int height);

Sets the gnome pixmap to image stored in `xpm_data` scaled to `width` and `height` pixels.

`gpixmap` : | the GnomePixmap widget
`xpm_data` : | xpm image data
`width` : | desired width.
`height` : | desired height.

### gnome_pixmap_load_rgb_d ()

    void        gnome_pixmap_load_rgb_d         (GnomePixmap *gpixmap,
                                                 unsigned char *data,
                                                 unsigned char *alpha,
                                                 int rgb_width,
                                                 int rgb_height);

Sets the gnome pixmap to the image.

`gpixmap` : | the GnomePixmap widget
`data` : | A pointer to an inlined rgb image.
`alpha` : |
`rgb_width` : | the width of the rgb image.
`rgb_height` : | the height of the rgb image.

### gnome_pixmap_load_rgb_d_shaped ()

    void        gnome_pixmap_load_rgb_d_shaped  (GnomePixmap *gpixmap,
                                                 unsigned char *data,
                                                 unsigned char *alpha,
                                                 int rgb_width,
                                                 int rgb_height,
                                                 GdkImlibColor *shape_color);

Sets the gnome pixmap to the image.

`gpixmap` : | the GnomePixmap widget
`data` : | A pointer to an inlined rgb image.
`alpha` : |
`rgb_width` : | the width of the rgb image.
`rgb_height` : | the height of the rgb image.
`shape_color` : | which color encodes the transparency

### gnome_pixmap_load_rgb_d_shaped_at_size ()

    void        gnome_pixmap_load_rgb_d_shaped_at_size
                                                (GnomePixmap *gpixmap,
                                                 unsigned char *data,
                                                 unsigned char *alpha,
                                                 int rgb_width,
                                                 int rgb_height,
                                                 int width,
                                                 int height,
                                                 GdkImlibColor *shape_color);

Sets the gnome pixmap to the image scaled to `width` and `height` pixels.

`gpixmap` : | the GnomePixmap widget
`data` : | A pointer to an inlined rgb image.
`alpha` : |
`rgb_width` : | the width of the rgb image.
`rgb_height` : | the height of the rgb image.
`width` : | desired width.
`height` : | desired height.
`shape_color` : | which color encodes the transparency

### gnome_pixmap_load_rgb_d_at_size ()

    void        gnome_pixmap_load_rgb_d_at_size (GnomePixmap *gpixmap,
                                                 unsigned char *data,
                                                 unsigned char *alpha,
                                                 int rgb_width,
                                                 int rgb_height,
                                                 int width,
                                                 int height);

Sets the gnome pixmap to the image scaled to `width` and `height` pixels.

`gpixmap` : | the GnomePixmap widget
`data` : | A pointer to an inlined rgb image.
`alpha` : |
`rgb_width` : | the width of the rgb image.
`rgb_height` : | the height of the rgb image.
`width` : | desired width.
`height` : | desired height.

### gnome_pixmap_load_imlib ()

    void        gnome_pixmap_load_imlib         (GnomePixmap *gpixmap,
                                                 GdkImlibImage *im);

Sets the gnome pixmap to image stored in `im`. Note that `im` will not be rendered after this call.

`gpixmap` : | the GnomePixmap widget
`im` : | A pointer to GdkImlibImage data

### gnome_pixmap_load_imlib_at_size ()

    void        gnome_pixmap_load_imlib_at_size (GnomePixmap *gpixmap,
                                                 GdkImlibImage *im,
                                                 int width,
                                                 int height);

Sets the gnome pixmap to image stored in `im` scaled to `width` and `height` pixels. Note that `im` will not be rendered after this call.

`gpixmap` : | the GnomePixmap widget
`im` : | A pointer to GdkImlibImage data
`width` : | desired width.
`height` : | desired height.

## See Also

GdkImlib

<<< Previous Page | Home | Up | Next Page >>>
GnomePixmapEntry | GnomePropertyBox