## Deprecated functions to render to GdkPixbuf

Deprecated functions to render to GdkPixbuf

## Functions

GdkPixbuf * | rsvg_handle_get_pixbuf ()
GdkPixbuf * | rsvg_handle_get_pixbuf_sub ()
GdkPixbuf * | rsvg_pixbuf_from_file ()
GdkPixbuf * | rsvg_pixbuf_from_file_at_zoom ()
GdkPixbuf * | rsvg_pixbuf_from_file_at_size ()
GdkPixbuf * | rsvg_pixbuf_from_file_at_max_size ()
GdkPixbuf * | rsvg_pixbuf_from_file_at_zoom_with_max ()

## Description

Years ago, GNOME and GTK used the gdk-pixbuf library as a general mechanism to load raster images into memory (PNG, JPEG, etc.) and pass them around. The general idiom was, "load this image file and give me a GdkPixbuf object", which is basically a pixel buffer. Librsvg supports this kind of interface to load and render SVG documents, but it is deprecated in favor of rendering to Cairo contexts.

## Functions

### rsvg_handle_get_pixbuf ()

    GdkPixbuf *
    rsvg_handle_get_pixbuf (RsvgHandle *handle);

Returns the pixbuf loaded by `handle` . The pixbuf returned will be reffed, so the caller of this function must assume that ref.

API ordering: This function must be called on a fully-loaded `handle` . See the section API ordering for details.

This function depends on the RsvgHandle's dots-per-inch value (DPI) to compute the "natural size" of the document in pixels, so you should call `rsvg_handle_set_dpi()` beforehand.

#### Parameters

handle | An RsvgHandle |

#### Returns

a pixbuf, or `NULL` if an error occurs during rendering.

[transfer full][nullable]

### rsvg_handle_get_pixbuf_sub ()

    GdkPixbuf *
    rsvg_handle_get_pixbuf_sub (RsvgHandle *handle,
                                const char *id);

Creates a GdkPixbuf the same size as the entire SVG loaded into `handle` , but only renders the sub-element that has the specified `id` (and all its sub-sub-elements recursively). If `id` is NULL, this function renders the whole SVG.

This function depends on the RsvgHandle's dots-per-inch value (DPI) to compute the "natural size" of the document in pixels, so you should call `rsvg_handle_set_dpi()` beforehand.

If you need to render an image which is only big enough to fit a particular sub-element of the SVG, consider using `rsvg_handle_render_element()`.

Element IDs should look like an URL fragment identifier; for example, pass "#foo" (hash `foo`) to get the geometry of the element that has an `id="foo"` attribute.

API ordering: This function must be called on a fully-loaded `handle` . See the section API ordering for details.

#### Parameters

handle | An RsvgHandle |
id | An element's id within the SVG, starting with "#" (a single hash character), for example, "#layer1". This notation corresponds to a URL's fragment ID. Alternatively, pass `NULL` to use the whole SVG. | [nullable]

#### Returns

a pixbuf, or `NULL` if an error occurs during rendering.

[transfer full][nullable]

Since: 2.14

### rsvg_pixbuf_from_file ()

    GdkPixbuf *
    rsvg_pixbuf_from_file (const gchar *filename,
                           GError **error);

`rsvg_pixbuf_from_file` is deprecated and should not be used in newly-written code.

Use `rsvg_handle_new_from_file()` and `rsvg_handle_render_document()` instead.

Loads a new GdkPixbuf from `filename` and returns it. The caller must assume the reference to the reurned pixbuf. If an error occurred, `error` is set and `NULL` is returned.

#### Parameters

filename | A file name |
error | return location for errors |

#### Returns

A newly allocated GdkPixbuf, or `NULL`

### rsvg_pixbuf_from_file_at_zoom ()

    GdkPixbuf *
    rsvg_pixbuf_from_file_at_zoom (const gchar *filename,
                                   double x_zoom,
                                   double y_zoom,
                                   GError **error);

`rsvg_pixbuf_from_file_at_zoom` is deprecated and should not be used in newly-written code.

Use `rsvg_handle_new_from_file()` and `rsvg_handle_render_document()` instead.

Loads a new GdkPixbuf from `filename` and returns it. This pixbuf is scaled from the size indicated by the file by a factor of `x_zoom` and `y_zoom` . The caller must assume the reference to the returned pixbuf. If an error occurred, `error` is set and `NULL` is returned.

#### Parameters

filename | A file name |
x_zoom | The horizontal zoom factor |
y_zoom | The vertical zoom factor |
error | return location for errors |

#### Returns

A newly allocated GdkPixbuf, or `NULL`

### rsvg_pixbuf_from_file_at_size ()

    GdkPixbuf *
    rsvg_pixbuf_from_file_at_size (const gchar *filename,
                                   gint width,
                                   gint height,
                                   GError **error);

`rsvg_pixbuf_from_file_at_size` is deprecated and should not be used in newly-written code.

Use `rsvg_handle_new_from_file()` and `rsvg_handle_render_document()` instead.

Loads a new GdkPixbuf from `filename` and returns it. This pixbuf is scaled from the size indicated to the new size indicated by `width` and `height` . If both of these are -1, then the default size of the image being loaded is used. The caller must assume the reference to the returned pixbuf. If an error occurred, `error` is set and `NULL` is returned.

#### Parameters

filename | A file name |
width | The new width, or -1 |
height | The new height, or -1 |
error | return location for errors |

#### Returns

A newly allocated GdkPixbuf, or `NULL`

### rsvg_pixbuf_from_file_at_max_size ()

    GdkPixbuf *
    rsvg_pixbuf_from_file_at_max_size (const gchar *filename,
                                       gint max_width,
                                       gint max_height,
                                       GError **error);

`rsvg_pixbuf_from_file_at_max_size` is deprecated and should not be used in newly-written code.

Use `rsvg_handle_new_from_file()` and `rsvg_handle_render_document()` instead.

Loads a new GdkPixbuf from `filename` and returns it. This pixbuf is uniformly scaled so that the it fits into a rectangle of size max_width * max_height. The caller must assume the reference to the returned pixbuf. If an error occurred, `error` is set and `NULL` is returned.

#### Parameters

filename | A file name |
max_width | The requested max width |
max_height | The requested max height |
error | return location for errors |

#### Returns

A newly allocated GdkPixbuf, or `NULL`

### rsvg_pixbuf_from_file_at_zoom_with_max ()

    GdkPixbuf *
    rsvg_pixbuf_from_file_at_zoom_with_max
                                   (const gchar *filename,
                                    double x_zoom,
                                    double y_zoom,
                                    gint max_width,
                                    gint max_height,
                                    GError **error);

`rsvg_pixbuf_from_file_at_zoom_with_max` is deprecated and should not be used in newly-written code.

Use `rsvg_handle_new_from_file()` and `rsvg_handle_render_document()` instead.

Loads a new GdkPixbuf from `filename` and returns it. This pixbuf is scaled from the size indicated by the file by a factor of `x_zoom` and `y_zoom` . If the resulting pixbuf would be larger than max_width/max_heigh it is uniformly scaled down to fit in that rectangle. The caller must assume the reference to the returned pixbuf. If an error occurred, `error` is set and `NULL` is returned.

#### Parameters

filename | A file name |
x_zoom | The horizontal zoom factor |
y_zoom | The vertical zoom factor |
max_width | The requested max width |
max_height | The requested max height |
error | return location for errors |

#### Returns

A newly allocated GdkPixbuf, or `NULL`