GOImage

## GOImage GOImage |

## Synopsis

                        GOImage;
                        GOImageClass;
    enum                GOImageFormat;
                        GOImageFormatInfo;
    gboolean            go_image_differ                     (GOImage *first,
                                                             GOImage *second);
    void                go_image_draw                       (GOImage *image,
                                                             cairo_t *cr);
    GType               go_image_format_info_get_type       (void);
    char *              go_image_format_to_mime             (char const *format);
    guint8 const	*      go_image_get_data                   (GOImage *image,
                                                             gsize *length);
    void                go_image_get_default_dpi            (double *dpi_x,
                                                             double *dpi_y);
    GOImageFormat       go_image_get_format_from_name       (char const *name);
    GOImageFormatInfo const * go_image_get_format_info      (GOImageFormat format);
    GSList *            go_image_get_formats_with_pixbuf_saver
                                                            (void);
    double              go_image_get_height                 (GOImage const *image);
    char const	*        go_image_get_name                   (GOImage const *image);
    GdkPixbuf *         go_image_get_pixbuf                 (GOImage *image);
    GdkPixbuf *         go_image_get_scaled_pixbuf          (GOImage *image,
                                                             int width,
                                                             int height);
    GdkPixbuf const *   go_image_get_thumbnail              (GOImage *image);
    double              go_image_get_width                  (GOImage const *image);
    void                go_image_load_attrs                 (GOImage *image,
                                                             GsfXMLIn *xin,
                                                             xmlChar const **attrs);
    void                go_image_load_data                  (GOImage *image,
                                                             GsfXMLIn *xin);
    GOImage *           go_image_new_for_format             (char const *format);
    GOImage *           go_image_new_from_data              (char const *type,
                                                             guint8 const *data,
                                                             gsize length,
                                                             char **format,
                                                             GError **error);
    GOImage *           go_image_new_from_file              (char const *filename,
                                                             GError **error);
    void                go_image_save                       (GOImage *image,
                                                             GsfXMLOut *output);
    void                go_image_set_default_dpi            (double dpi_x,
                                                             double dpi_y);
    void                go_image_set_name                   (GOImage *image,
                                                             char const *name);
    GType               go_image_type_for_format            (char const *format);
    char *              go_mime_to_image_format             (char const *mime_type);

## Object Hierarchy

      GObject
       +----GOImage
             +----GOEmf
             +----GOPixbuf
             +----GOSpectre
             +----GOSvg

      GBoxed
       +----GOImageFormatInfo

## Properties

      "height"                   guint                 : Read / Write
      "width"                    guint                 : Read / Write

## Description

## Details

### GOImage

    typedef struct _GOImage GOImage;

### GOImageClass

    typedef struct {
    	GObjectClass parent_klass;

    	GdkPixbuf *(*get_pixbuf) (GOImage *image);
    	GdkPixbuf *(*get_scaled_pixbuf) (GOImage *image, int width, int height);
    	void (*save) (GOImage *image, GsfXMLOut *output);
    	void (*load_attr) (GOImage *image, xmlChar const *attr_name, xmlChar const *attr_value);
    	void (*load_data) (GOImage *image, GsfXMLIn *xin);
    	void (*draw) (GOImage *image, cairo_t *cr);
    	gboolean (*differ) (GOImage *first, GOImage *second);
    } GOImageClass;

GObjectClass `parent_klass`; | parent class.
`get_pixbuf` () | gets a pixbuf with the same size as the image.
`get_scaled_pixbuf` () | gets a scaled pixbuf respecting the original aspect ratio.
`save` () | saves the image.
`load_attr` () | loads the images properties.
`load_data` () | loads the image data.
`draw` () | draws the image.
`differ` () | returns `TRUE` if the two images are different.

### enum GOImageFormat

    typedef enum {
    	GO_IMAGE_FORMAT_SVG,
    	GO_IMAGE_FORMAT_PNG,
    	GO_IMAGE_FORMAT_JPG,
    	GO_IMAGE_FORMAT_PDF,
    	GO_IMAGE_FORMAT_PS,
    	GO_IMAGE_FORMAT_EMF,
    	GO_IMAGE_FORMAT_WMF,
    	GO_IMAGE_FORMAT_EPS,
    	GO_IMAGE_FORMAT_UNKNOWN
    } GOImageFormat;

`GO_IMAGE_FORMAT_SVG` | SVG.
`GO_IMAGE_FORMAT_PNG` | PNG.
`GO_IMAGE_FORMAT_JPG` | JPEG.
`GO_IMAGE_FORMAT_PDF` | PDF.
`GO_IMAGE_FORMAT_PS` | PostScript.
`GO_IMAGE_FORMAT_EMF` | Enhanced Metafile.
`GO_IMAGE_FORMAT_WMF` | Windows Metafile.
`GO_IMAGE_FORMAT_EPS` | Encapsulated Postscript.
`GO_IMAGE_FORMAT_UNKNOWN` | unknown.

### GOImageFormatInfo

    typedef struct {
    	GOImageFormat format;
    	char *name;
    	char *desc;
    	char *ext;
    	gboolean has_pixbuf_saver;
    	gboolean is_dpi_useful;
    	gboolean alpha_support;
    } GOImageFormatInfo;

GOImageFormat `format`; | GOImageFormat.
char *`name`; | image type name.
char *`desc`; | image type description.
char *`ext`; | file extension.
gboolean `has_pixbuf_saver`; | can be saved as pixbuf.
gboolean `is_dpi_useful`; | depends upon device resolution.
gboolean `alpha_support`; | supports transparency.

### go_image_differ ()

    gboolean            go_image_differ                     (GOImage *first,
                                                             GOImage *second);

### go_image_draw ()

    void                go_image_draw                       (GOImage *image,
                                                             cairo_t *cr);

### go_image_format_info_get_type ()

    GType               go_image_format_info_get_type       (void);

### go_image_format_to_mime ()

    char *              go_image_format_to_mime             (char const *format);

`format` : | a file extension string
Returns : | corresponding mime type.

### go_image_get_data ()

    guint8 const	*      go_image_get_data                   (GOImage *image,
                                                             gsize *length);

### go_image_get_default_dpi ()

    void                go_image_get_default_dpi            (double *dpi_x,
                                                             double *dpi_y);

### go_image_get_format_from_name ()

    GOImageFormat       go_image_get_format_from_name       (char const *name);

`name` : | a string
Returns : | corresponding GOImageFormat.

### go_image_get_format_info ()

    GOImageFormatInfo const * go_image_get_format_info      (GOImageFormat format);

Retrieves information associated to `format`.

`format` : | a GOImageFormat
Returns : | a GOImageFormatInfo struct.

### go_image_get_formats_with_pixbuf_saver ()

    GSList *            go_image_get_formats_with_pixbuf_saver
                                                            (void);

Returns : | a list of GOImageFormat that can be created from a pixbuf. [element-type GOImageFormat][transfer container]

### go_image_get_height ()

    double              go_image_get_height                 (GOImage const *image);

### go_image_get_name ()

    char const	*        go_image_get_name                   (GOImage const *image);

### go_image_get_pixbuf ()

    GdkPixbuf *         go_image_get_pixbuf                 (GOImage *image);

Builds a pixbuf from the image if not already done and returns it, adding a reference.

`image` : | GOImage
Returns : | the pixbuf for `image`. [transfer full]

### go_image_get_scaled_pixbuf ()

    GdkPixbuf *         go_image_get_scaled_pixbuf          (GOImage *image,
                                                             int width,
                                                             int height);

Builds a scaled pixbuf from the image and returns it. The caller needs to unref it. The pixbuf is scaled so that its width and height are not larger than, respectively, `width` and `height`, and preserving the aspect ratio.

`image` : | GOImage
`width` : | the new pixbuf width
`height` : | the new pixbuf height
Returns : | the scaled pixbuf for `image`. [transfer full]

### go_image_get_thumbnail ()

    GdkPixbuf const *   go_image_get_thumbnail              (GOImage *image);

Generates a thumbnail for `image` if not already done and returns it, adding a reference. The pixbuf is scaled so that its width and height are not larger than 64 pixels, and preserving the aspect ratio.

`image` : | GOImage
Returns : | the thumbnail for `image`. [transfer full]

### go_image_get_width ()

    double              go_image_get_width                  (GOImage const *image);

### go_image_load_attrs ()

    void                go_image_load_attrs                 (GOImage *image,
                                                             GsfXMLIn *xin,
                                                             xmlChar const **attrs);

### go_image_load_data ()

    void                go_image_load_data                  (GOImage *image,
                                                             GsfXMLIn *xin);

### go_image_new_for_format ()

    GOImage *           go_image_new_for_format             (char const *format);

### go_image_new_from_data ()

    GOImage *           go_image_new_from_data              (char const *type,
                                                             guint8 const *data,
                                                             gsize length,
                                                             char **format,
                                                             GError **error);

### go_image_new_from_file ()

    GOImage *           go_image_new_from_file              (char const *filename,
                                                             GError **error);

### go_image_save ()

    void                go_image_save                       (GOImage *image,
                                                             GsfXMLOut *output);

### go_image_set_default_dpi ()

    void                go_image_set_default_dpi            (double dpi_x,
                                                             double dpi_y);

### go_image_set_name ()

    void                go_image_set_name                   (GOImage *image,
                                                             char const *name);

### go_image_type_for_format ()

    GType               go_image_type_for_format            (char const *format);

### go_mime_to_image_format ()

    char *              go_mime_to_image_format             (char const *mime_type);

`mime_type` : | a mime type string
Returns : | file extension for the given mime type.

## Property Details

### The `"height"` property

      "height"                   guint                 : Read / Write

Image height in pixels.

Allowed values: <= 65535

Default value: 0

### The `"width"` property

      "width"                    guint                 : Read / Write

Image width in pixels.

Allowed values: <= 65535

Default value: 0