![]() |
![]() |
![]() |
RSVG Libary Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties |
enum RsvgError; #define RSVG_ERRORGQuark rsvg_error_quark (void
); RsvgHandle; typedef RsvgHandlePrivate; RsvgHandleClass; RsvgDimensionData; RsvgPositionData;void rsvg_cleanup (void
);void rsvg_set_default_dpi ();
double dpivoid rsvg_set_default_dpi_x_y (,
double dpi_x);
double dpi_yvoid rsvg_handle_set_dpi (RsvgHandle *handle
,);
double dpivoid rsvg_handle_set_dpi_x_y (RsvgHandle *handle
,,
double dpi_x); RsvgHandle * rsvg_handle_new (
double dpi_yvoid
); RsvgHandle * rsvg_handle_new_with_flags (RsvgHandleFlags flags
);gboolean rsvg_handle_write (RsvgHandle *handle
,const
,guchar *buf,
gsize count);
GError **errorgboolean rsvg_handle_close (RsvgHandle *handle
,); const
GError **errorchar * rsvg_handle_get_base_uri (RsvgHandle *handle
);void rsvg_handle_set_base_uri (RsvgHandle *handle
,const
);char *base_urivoid rsvg_handle_get_dimensions (RsvgHandle *handle
,RsvgDimensionData *dimension_data
);gboolean rsvg_handle_get_dimensions_sub (RsvgHandle *handle
,RsvgDimensionData *dimension_data
,const
);char *idgboolean rsvg_handle_get_position_sub (RsvgHandle *handle
,RsvgPositionData *position_data
,const
);char *idgboolean rsvg_handle_has_sub (RsvgHandle *handle
,const
); constchar *idchar * rsvg_handle_get_title (RsvgHandle *handle
); constchar * rsvg_handle_get_desc (RsvgHandle *handle
); constchar * rsvg_handle_get_metadata (RsvgHandle *handle
); RsvgHandle * rsvg_handle_new_from_data (const
,guint8 *data,
gsize data_len); RsvgHandle * rsvg_handle_new_from_file (
GError **errorconst
,gchar *file_name);
GError **errorGType rsvg_error_get_type (void
); #define RSVG_TYPE_ERRORvoid rsvg_init (void
);void rsvg_term (void
);void rsvg_handle_free (RsvgHandle *handle
);void rsvg_handle_set_size_callback (RsvgHandle *handle
,,
RsvgSizeFunc size_func,
gpointer user_data);
GDestroyNotify user_data_destroy
"base-uri"gchar * : Read / Write / Construct "desc"gchar * : Read "dpi-x"gdouble : Read / Write / Construct "dpi-y"gdouble : Read / Write / Construct "em"gdouble : Read "ex"gdouble : Read "flags" RsvgHandleFlags : Read / Write / Construct Only "height"gint : Read "metadata"gchar * : Read "title"gchar * : Read "width"gint : Read
librsvg is a component used within software applications to enable support for SVG-format scalable graphics. In contrast to raster formats, scalable vector graphics provide users and artists a way to create, view, and provide imagery that is not limited to the pixel or dot density that an output device is capable of.
Many software developers use the librsvg library to render SVG graphics. It is lightweight and portable.
GQuark rsvg_error_quark (void
);
The error domain for RSVG
Returns : |
The error domain |
typedef struct { /** * SVG's width, in pixels */ int width; /** * SVG's height, in pixels */ int height; /** * em */ gdouble em; /** * ex */ gdouble ex; } RsvgDimensionData;
void rsvg_cleanup (void
);
This function should not be called from normal programs.
See xmlCleanupParser()
Since 2.36
void rsvg_set_default_dpi ();
double dpi
Sets the DPI for the all future outgoing pixbufs. Common values are
75, 90, and 300 DPI. Passing a number <= 0 to
|
Dots Per Inch (aka Pixels Per Inch) |
Since 2.8
void rsvg_set_default_dpi_x_y (,
double dpi_x);
double dpi_y
Sets the DPI for the all future outgoing pixbufs. Common values are
75, 90, and 300 DPI. Passing a number <= 0 to
|
Dots Per Inch (aka Pixels Per Inch) |
|
Dots Per Inch (aka Pixels Per Inch) |
Since 2.8
void rsvg_handle_set_dpi (RsvgHandle *handle
,);
double dpi
Sets the DPI for the outgoing pixbuf. Common values are
75, 90, and 300 DPI. Passing a number <= 0 to
|
An RsvgHandle |
|
Dots Per Inch (aka Pixels Per Inch) |
Since 2.8
void rsvg_handle_set_dpi_x_y (RsvgHandle *handle
,,
double dpi_x);
double dpi_y
Sets the DPI for the outgoing pixbuf. Common values are
75, 90, and 300 DPI. Passing a number <= 0 to
|
An RsvgHandle |
|
Dots Per Inch (aka Pixels Per Inch) |
|
Dots Per Inch (aka Pixels Per Inch) |
Since 2.8
RsvgHandle * rsvg_handle_new (void
);
Returns a new rsvg handle. Must be freed with g_object_unref
. 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.
Afterwords, you can render it using Cairo or get a GdkPixbuf from it. When
finished, free with g_object_unref()
Returns : |
A new RsvgHandle |
RsvgHandle * rsvg_handle_new_with_flags (RsvgHandleFlags flags
);
Creates a new RsvgHandle with flags flags
.
|
flags from RsvgHandleFlags |
Returns : |
a new RsvgHandle. [transfer full] |
Since 2.36
gboolean rsvg_handle_write (RsvgHandle *handle
,const
,guchar *buf,
gsize count);
GError **error
Loads the next count
bytes of the image. This will return error
will be set to an error from the RsvgError domain. Errors
from
|
an RsvgHandle |
|
pointer to svg data. [array length=count][element-type uint8] |
|
length of the buf buffer in bytes
|
|
a location to store a NULL |
Returns : |
TRUE FALSE |
gboolean rsvg_handle_close (RsvgHandle *handle
,);
GError **error
Closes handle
, to indicate that loading the image is complete. This will
return TRUE
handle
isn't
freed until g_object_unref
is called.
|
a RsvgHandle |
|
a location to store a NULL |
Returns : |
TRUE FALSE |
constchar * rsvg_handle_get_base_uri (RsvgHandle *handle
);
Gets the base uri for this RsvgHandle.
|
A RsvgHandle |
Returns : |
the base uri, possibly null |
Since 2.8
void rsvg_handle_set_base_uri (RsvgHandle *handle
,const
);char *base_uri
Set the base URI for this SVG. This can only be called before rsvg_handle_write()
has been called.
|
A RsvgHandle |
|
The base uri |
Since 2.9
void rsvg_handle_get_dimensions (RsvgHandle *handle
,RsvgDimensionData *dimension_data
);
Get the SVG's size. Do not call from within the size_func callback, because an infinite loop will occur.
|
A RsvgHandle |
|
A place to store the SVG's size. [out] |
Since 2.14
gboolean rsvg_handle_get_dimensions_sub (RsvgHandle *handle
,RsvgDimensionData *dimension_data
,const
);char *id
Get the size of a subelement of the SVG file. Do not call from within the size_func callback, because an infinite loop will occur.
|
A RsvgHandle |
|
A place to store the SVG's size |
|
An element's id within the SVG, or NULL to get the dimension of the whole SVG.
For example, if you have a layer called "layer1" for that you want to get the dimension,
pass " |
Since 2.22
gboolean rsvg_handle_get_position_sub (RsvgHandle *handle
,RsvgPositionData *position_data
,const
);char *id
Get the position of a subelement of the SVG file. Do not call from within the size_func callback, because an infinite loop will occur.
|
A RsvgHandle |
|
A place to store the SVG fragment's position. |
|
An element's id within the SVG.
For example, if you have a layer called "layer1" for that you want to get
the position, pass " |
Since 2.22
gboolean rsvg_handle_has_sub (RsvgHandle *handle
,const
);char *id
Checks whether the element id
exists in the SVG document.
|
a RsvgHandle |
|
an element's id within the SVG |
Returns : |
TRUE id exists in the SVG document
|
Since 2.22
constchar * rsvg_handle_get_title (RsvgHandle *handle
);
Returns the SVG's title in UTF-8 or NULL
|
An RsvgHandle |
Returns : |
The SVG's title |
Since 2.4
constchar * rsvg_handle_get_desc (RsvgHandle *handle
);
Returns the SVG's description in UTF-8 or NULL
|
An RsvgHandle |
Returns : |
The SVG's description |
Since 2.4
constchar * rsvg_handle_get_metadata (RsvgHandle *handle
);
Returns the SVG's metadata in UTF-8 or NULL
|
An RsvgHandle |
Returns : |
The SVG's title |
Since 2.9
RsvgHandle * rsvg_handle_new_from_data (const
,guint8 *data,
gsize data_len);
GError **error
Loads the SVG specified by
|
The SVG data. [array length=data_len] |
|
The length of |
|
return location for errors |
Returns : |
A RsvgHandle or NULL |
Since 2.14
RsvgHandle * rsvg_handle_new_from_file (const
,gchar *file_name);
GError **error
Loads the SVG specified by
|
The file name to load. If built with gnome-vfs, can be a URI. |
|
return location for errors |
Returns : |
A RsvgHandle or NULL |
Since 2.14
void rsvg_init (void
);
rsvg_init
has been deprecated since version 2.36 and should not be used in newly-written code. Use g_type_init()
Initializes librsvg
Since 2.9
void rsvg_term (void
);
rsvg_term
is deprecated and should not be used in newly-written code. 2.36
This function does nothing.
Since 2.9
void rsvg_handle_free (RsvgHandle *handle
);
rsvg_handle_free
is deprecated and should not be used in newly-written code. Use g_object_unref()
Frees
|
An RsvgHandle |
void rsvg_handle_set_size_callback (RsvgHandle *handle
,,
RsvgSizeFunc size_func,
gpointer user_data);
GDestroyNotify user_data_destroy
rsvg_handle_set_size_callback
is deprecated and should not be used in newly-written code. Set up a cairo matrix and use rsvg_handle_render_cairo()
instead.
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.
|
An RsvgHandle |
|
A sizing function, or NULL |
|
User data to pass to size_func , or NULL |
|
Destroy function for user_data , or NULL |
"dpi-x"
property"dpi-x"gdouble : Read / Write / Construct
Horizontal resolution.
Allowed values: >= 0
Default value: 90
"dpi-y"
property"dpi-y"gdouble : Read / Write / Construct
Vertical resolution.
Allowed values: >= 0
Default value: 90
"flags"
property"flags" RsvgHandleFlags : Read / Write / Construct Only
Flags from RsvgHandleFlags.
Since 2.36