Create and manipulate SVG objects. More...
Inherits Glib::Object.
Public Member Functions | |
virtual | ~Handle () |
RsvgHandle* | gobj () |
Provides access to the underlying C GObject. | |
const RsvgHandle* | gobj () const |
Provides access to the underlying C GObject. | |
RsvgHandle* | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | |
void | set_dpi (double dpi) |
Sets the DPI for future pixel calculations. | |
void | set_dpi (double dpi_x, double dpi_y) |
Sets the DPI for future pixel calculations. | |
void | write (const guint8* buf, gsize count) |
Loads the next count bytes of the image. | |
void | close () |
Closes the handle, to indicate that loading the image is complete. | |
Glib::ustring | get_base_uri () const |
Gets the base URI for this Rsvg::Handle. | |
void | set_base_uri (const Glib::ustring& base_uri) |
Set the base URI for this SVG. | |
void | get_dimensions (DimensionData& dimension_data) const |
Gets the size of the SVG. | |
bool | get_dimensions_sub (DimensionData& dimension_data, const Glib::ustring& id) const |
Gets the size of an SVG fragment. | |
bool | get_position_sub (PositionData& position_data, const Glib::ustring& id) const |
Gets the position of an SVG fragment. | |
bool | has_sub (const Glib::ustring& id) const |
Checks whether the element id exists in the SVG document. | |
bool | render (const Cairo::RefPtr< Cairo::Context >& cr) const |
Draws an SVG to a cairo surface. | |
bool | render_sub (const Cairo::RefPtr< Cairo::Context >& cr, const Glib::ustring& id) const |
Draws an SVG fragment to a cairo surface. | |
Glib::ustring | get_title () const |
Returns the SVG's title. | |
Glib::ustring | get_desc () const |
Returns the SVG's description. | |
Glib::ustring | get_metadata () const |
Returns the SVG's metadata. | |
Glib::PropertyProxy< double > | property_dpi_x () |
Horizontal resolution. | |
Glib::PropertyProxy_ReadOnly < double > | property_dpi_x () const |
Horizontal resolution. | |
Glib::PropertyProxy< double > | property_dpi_y () |
Vertical resolution. | |
Glib::PropertyProxy_ReadOnly < double > | property_dpi_y () const |
Vertical resolution. | |
Glib::PropertyProxy < Glib::ustring > | property_base_uri () |
Base URI. | |
Glib::PropertyProxy_ReadOnly < Glib::ustring > | property_base_uri () const |
Base URI. | |
Glib::PropertyProxy_ReadOnly< int > | property_width () const |
Image width. | |
Glib::PropertyProxy_ReadOnly< int > | property_height () const |
Image height. | |
Glib::PropertyProxy_ReadOnly < double > | property_em () const |
em. | |
Glib::PropertyProxy_ReadOnly < double > | property_ex () const |
ex. | |
Glib::PropertyProxy_ReadOnly < Glib::ustring > | property_title () const |
SVG file title. | |
Glib::PropertyProxy_ReadOnly < Glib::ustring > | property_desc () const |
SVG file description. | |
Glib::PropertyProxy_ReadOnly < Glib::ustring > | property_metadata () const |
SVG file metadata. | |
Static Public Member Functions | |
static Glib::RefPtr< Handle > | create () |
Create an empty SVG handle. | |
static Glib::RefPtr< Handle > | create_from_data (const guint8* data, gsize data_len) |
Load an SVG from a memory buffer. | |
static Glib::RefPtr< Handle > | create_from_file (const std::string& file_name) |
Load the SVG file specified by file_name. | |
Protected Member Functions | |
Handle () | |
Related Functions | |
(Note that these are not member functions.) | |
Glib::RefPtr< Rsvg::Handle > | wrap (RsvgHandle* object, bool take_copy=false) |
A Glib::wrap() method for this object. |
Create and manipulate SVG objects.
virtual Rsvg::Handle::~Handle | ( | ) | [virtual] |
Rsvg::Handle::Handle | ( | ) | [protected] |
void Rsvg::Handle::close | ( | ) |
Closes the handle, to indicate that loading the image is complete.
Rsvg::Error | Thrown if the loader could not close successfully. |
static Glib::RefPtr<Handle> Rsvg::Handle::create | ( | ) | [static] |
Create an empty SVG handle.
static Glib::RefPtr<Handle> Rsvg::Handle::create_from_data | ( | const guint8 * | data, | |
gsize | data_len | |||
) | [static] |
Load an SVG from a memory buffer.
[in] | data | Pointer to the SVG data in memory. |
data_len | Length of the SVG data in bytes. |
Rsvg::Error | Thrown if the SVG could not be loaded. |
static Glib::RefPtr<Handle> Rsvg::Handle::create_from_file | ( | const std::string & | file_name | ) | [static] |
Load the SVG file specified by file_name.
file_name | The name of the file to load. |
Rsvg::Error | Thrown if the SVG file could not be loaded. |
Glib::ustring Rsvg::Handle::get_base_uri | ( | ) | const |
Gets the base URI for this Rsvg::Handle.
Glib::ustring Rsvg::Handle::get_desc | ( | ) | const |
Returns the SVG's description.
void Rsvg::Handle::get_dimensions | ( | DimensionData& | dimension_data | ) | const |
Gets the size of the SVG.
[out] | dimension_data | Result object. |
bool Rsvg::Handle::get_dimensions_sub | ( | DimensionData& | dimension_data, | |
const Glib::ustring & | id | |||
) | const |
Gets the size of an SVG fragment.
[out] | dimension_data | Result object. |
id | An element's ID within the SVG, or the empty string to get the dimensions of the whole SVG. For example, if you have a layer called "layer1" for that you want to get the dimensions, pass "#layer1" as the ID. |
Glib::ustring Rsvg::Handle::get_metadata | ( | ) | const |
Returns the SVG's metadata.
bool Rsvg::Handle::get_position_sub | ( | PositionData& | position_data, | |
const Glib::ustring & | id | |||
) | const |
Gets the position of an SVG fragment.
[out] | position_data | Result object. |
id | 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 "#layer1" as the ID. |
Glib::ustring Rsvg::Handle::get_title | ( | ) | const |
Returns the SVG's title.
const RsvgHandle* Rsvg::Handle::gobj | ( | ) | const [inline] |
Provides access to the underlying C GObject.
Reimplemented from Glib::ObjectBase.
RsvgHandle* Rsvg::Handle::gobj | ( | ) | [inline] |
Provides access to the underlying C GObject.
Reimplemented from Glib::ObjectBase.
RsvgHandle* Rsvg::Handle::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
bool Rsvg::Handle::has_sub | ( | const Glib::ustring & | id | ) | const |
Checks whether the element id exists in the SVG document.
id | An element's ID within the SVG. |
true
if id exists in the SVG document. Glib::PropertyProxy_ReadOnly<Glib::ustring> Rsvg::Handle::property_base_uri | ( | ) | const |
Base URI.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<Glib::ustring> Rsvg::Handle::property_base_uri | ( | ) |
Base URI.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<Glib::ustring> Rsvg::Handle::property_desc | ( | ) | const |
SVG file description.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<double> Rsvg::Handle::property_dpi_x | ( | ) | const |
Horizontal resolution.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<double> Rsvg::Handle::property_dpi_x | ( | ) |
Horizontal resolution.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<double> Rsvg::Handle::property_dpi_y | ( | ) | const |
Vertical resolution.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<double> Rsvg::Handle::property_dpi_y | ( | ) |
Vertical resolution.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<double> Rsvg::Handle::property_em | ( | ) | const |
em.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<double> Rsvg::Handle::property_ex | ( | ) | const |
ex.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<int> Rsvg::Handle::property_height | ( | ) | const |
Image height.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<Glib::ustring> Rsvg::Handle::property_metadata | ( | ) | const |
SVG file metadata.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<Glib::ustring> Rsvg::Handle::property_title | ( | ) | const |
SVG file title.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<int> Rsvg::Handle::property_width | ( | ) | const |
Image width.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
bool Rsvg::Handle::render | ( | const Cairo::RefPtr< Cairo::Context > & | cr | ) | const |
Draws an SVG to a cairo surface.
cr | A cairo context. |
bool Rsvg::Handle::render_sub | ( | const Cairo::RefPtr< Cairo::Context > & | cr, | |
const Glib::ustring & | id | |||
) | const |
Draws an SVG fragment to a cairo surface.
cr | A cairo context. | |
id | An element's ID within the SVG, or the empty string to render the whole SVG. For example, if you have a layer called "layer1" that you wish to render, pass "#layer1" as the ID. |
void Rsvg::Handle::set_base_uri | ( | const Glib::ustring & | base_uri | ) |
Set the base URI for this SVG.
This can only be called before write() has been called.
base_uri | The base URI. |
void Rsvg::Handle::set_dpi | ( | double | dpi_x, | |
double | dpi_y | |||
) |
Sets the DPI for future pixel calculations.
Common values are 75, 90, and 300 DPI. Passing a number <= 0 to dpi_x or dpi_y will reset the DPI to whatever the default value happens to be.
dpi_x | Horizontal dots per inch (aka pixels per inch). | |
dpi_y | Vertical dots per inch (aka pixels per inch). |
void Rsvg::Handle::set_dpi | ( | double | dpi | ) |
Sets the DPI for future pixel calculations.
Common values are 75, 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). |
void Rsvg::Handle::write | ( | const guint8 * | buf, | |
gsize | count | |||
) |
Loads the next count bytes of the image.
If the data could not be loaded successfully, the loader will be closed, and will not accept further writes.
[in] | buf | Pointer to SVG data. |
count | Size of the buffer in bytes. |
Rsvg::Error | Thrown if the data could not be loaded successfully. |
Glib::RefPtr< Rsvg::Handle > wrap | ( | RsvgHandle * | object, | |
bool | take_copy = false | |||
) | [related] |
A Glib::wrap() method for this object.
object | The C instance. | |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |