Core API

Name

Core API -- 

Synopsis



GQuark      rsvg_error_quark                (void);
void        (*RsvgSizeFunc)                 (gint *width,
                                             gint *height,
                                             gpointer user_data);
void        rsvg_set_default_dpi            (double dpi);
RsvgHandle* rsvg_handle_new                 (void);
void        rsvg_handle_set_dpi             (RsvgHandle *handle,
                                             double dpi);
void        rsvg_handle_set_size_callback   (RsvgHandle *handle,
                                             RsvgSizeFunc size_func,
                                             gpointer user_data,
                                             GDestroyNotify user_data_destroy);
gboolean    rsvg_handle_write               (RsvgHandle *handle,
                                             const guchar *buf,
                                             gsize count,
                                             GError **error);
gboolean    rsvg_handle_close               (RsvgHandle *handle,
                                             GError **error);
GdkPixbuf*  rsvg_handle_get_pixbuf          (RsvgHandle *handle);
void        rsvg_handle_free                (RsvgHandle *handle);

Description

Details

rsvg_error_quark ()

GQuark      rsvg_error_quark                (void);

The error domain for RSVG

Returns :

The error domain


RsvgSizeFunc ()

void        (*RsvgSizeFunc)                 (gint *width,
                                             gint *height,
                                             gpointer user_data);

Function to let a user of the library specify the SVG's dimensions width: the ouput width the SVG should be height: the output height the SVG should be user_data: user data

width :

Pointer to where to set/store the width

height :

Pointer to where to set/store the height

user_data :

User data pointer


rsvg_set_default_dpi ()

void        rsvg_set_default_dpi            (double dpi);

Sets the DPI for the all future outgoing pixbufs. Common values are 72, 90, and 300 DPI. Passing a number <= 0 to dpi will reset the DPI to whatever the default value happens to be.

dpi :

Dots Per Inch (aka Pixels Per Inch)

Since 2.2


rsvg_handle_new ()

RsvgHandle* rsvg_handle_new                 (void);

Returns a new rsvg handle. Must be freed with rsvg_handle_free. This handle can be used for dynamically loading an image. You need to feed it data using rsvg_handle_write, then call rsvg_handle_close when done. No more than one image can be loaded with one handle.

Returns :

A new RsvgHandle


rsvg_handle_set_dpi ()

void        rsvg_handle_set_dpi             (RsvgHandle *handle,
                                             double dpi);

Sets the DPI for the outgoing pixbuf. Common values are 72, 90, and 300 DPI. Passing a number <= 0 to dpi will reset the DPI to whatever the default value happens to be.

handle :

An RsvgHandle

dpi :

Dots Per Inch (aka Pixels Per Inch)

Since 2.2


rsvg_handle_set_size_callback ()

void        rsvg_handle_set_size_callback   (RsvgHandle *handle,
                                             RsvgSizeFunc size_func,
                                             gpointer user_data,
                                             GDestroyNotify user_data_destroy);

Sets the sizing function for the handle. This function is called right after the size of the image has been loaded. The size of the image is passed in to the function, which may then modify these values to set the real size of the generated pixbuf. If the image has no associated size, then the size arguments are set to -1.

handle :

An RsvgHandle

size_func :

A sizing function, or NULL

user_data :

User data to pass to size_func, or NULL

user_data_destroy :

Destroy function for user_data, or NULL


rsvg_handle_write ()

gboolean    rsvg_handle_write               (RsvgHandle *handle,
                                             const guchar *buf,
                                             gsize count,
                                             GError **error);

Loads the next count bytes of the image. This will return TRUE if the data was loaded successful, and FALSE if an error occurred. In the latter case, the loader will be closed, and will not accept further writes. If FALSE is returned, error will be set to an error from the RSVG_ERROR domain.

handle :

An RsvgHandle

buf :

Pointer to svg data

count :

length of the buf buffer in bytes

error :

return location for errors

Returns :

TRUE if the write was successful, or FALSE if there was an error.


rsvg_handle_close ()

gboolean    rsvg_handle_close               (RsvgHandle *handle,
                                             GError **error);

Closes handle, to indicate that loading the image is complete. This will return TRUE if the loader closed successfully. Note that handle isn't freed until rsvg_handle_free is called.

handle :

A RsvgHandle

error :

A GError

Returns :

TRUE if the loader closed successfully, or FALSE if there was an error.


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. If insufficient data has been read to create the pixbuf, or an error occurred in loading, then NULL will be returned. Note that the pixbuf may not be complete until rsvg_handle_close has been called.

handle :

An RsvgHandle

Returns :

the pixbuf loaded by handle, or NULL.


rsvg_handle_free ()

void        rsvg_handle_free                (RsvgHandle *handle);

Frees handle.

handle :

An RsvgHandle