librsvgmm  2.26.1
Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions
Rsvg::Handle Class Reference

Create and manipulate SVG objects. More...

Inheritance diagram for Rsvg::Handle:
Inheritance graph
[legend]
Collaboration diagram for Rsvg::Handle:
Collaboration graph
[legend]

List of all members.

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< Handlecreate ()
 Create an empty SVG handle.
static Glib::RefPtr< Handlecreate_from_data (const guint8* data, gsize data_len)
 Load an SVG from a memory buffer.
static Glib::RefPtr< Handlecreate_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::Handlewrap (RsvgHandle* object, bool take_copy=false)
 A Glib::wrap() method for this object.

Detailed Description

Create and manipulate SVG objects.


Constructor & Destructor Documentation

virtual Rsvg::Handle::~Handle ( ) [virtual]
Rsvg::Handle::Handle ( ) [protected]

Member Function Documentation

void Rsvg::Handle::close ( )

Closes the handle, to indicate that loading the image is complete.

Exceptions:
Rsvg::ErrorThrown if the loader could not close successfully.
static Glib::RefPtr<Handle> Rsvg::Handle::create ( ) [static]

Create an empty SVG handle.

Returns:
A pointer to the created 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.

Parameters:
[in]dataPointer to the SVG data in memory.
data_lenLength of the SVG data in bytes.
Returns:
A pointer to the created SVG handle.
Exceptions:
Rsvg::ErrorThrown 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.

Parameters:
file_nameThe name of the file to load.
Returns:
A pointer to the created SVG handle.
Exceptions:
Rsvg::ErrorThrown if the SVG file could not be loaded.
Glib::ustring Rsvg::Handle::get_base_uri ( ) const

Gets the base URI for this Rsvg::Handle.

Returns:
The base URI, possibly empty.
Glib::ustring Rsvg::Handle::get_desc ( ) const

Returns the SVG's description.

Returns:
The SVG's description.
void Rsvg::Handle::get_dimensions ( DimensionData dimension_data) const

Gets the size of the SVG.

Parameters:
[out]dimension_dataResult object.
bool Rsvg::Handle::get_dimensions_sub ( DimensionData dimension_data,
const Glib::ustring id 
) const

Gets the size of an SVG fragment.

Parameters:
[out]dimension_dataResult object.
idAn 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.
Returns:
Whether the dimensions of element id could be retrieved.
Glib::ustring Rsvg::Handle::get_metadata ( ) const

Returns the SVG's metadata.

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.

Parameters:
[out]position_dataResult object.
idAn 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.
Returns:
Whether the position of element id could be retrieved.
Glib::ustring Rsvg::Handle::get_title ( ) const

Returns the SVG's title.

Returns:
The SVG's title.
RsvgHandle* Rsvg::Handle::gobj ( ) [inline]

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

const RsvgHandle* Rsvg::Handle::gobj ( ) const [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.

Parameters:
idAn element's ID within the SVG.
Returns:
true if id exists in the SVG document.
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.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
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.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
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.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
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.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
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.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
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.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
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.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
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.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
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.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
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.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
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.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
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.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
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.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
bool Rsvg::Handle::render ( const Cairo::RefPtr< Cairo::Context > &  cr) const

Draws an SVG to a cairo surface.

Parameters:
crA cairo context.
Returns:
Whether the SVG was drawn successfully.
bool Rsvg::Handle::render_sub ( const Cairo::RefPtr< Cairo::Context > &  cr,
const Glib::ustring id 
) const

Draws an SVG fragment to a cairo surface.

Parameters:
crA cairo context.
idAn 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.
Returns:
Whether the id element was drawn successfully.
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.

Parameters:
base_uriThe base URI.
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.

Parameters:
dpiDots per inch (aka pixels per inch).
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.

Parameters:
dpi_xHorizontal dots per inch (aka pixels per inch).
dpi_yVertical 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.

Parameters:
[in]bufPointer to SVG data.
countSize of the buffer in bytes.
Exceptions:
Rsvg::ErrorThrown if the data could not be loaded successfully.

Friends And Related Function Documentation

Glib::RefPtr< Rsvg::Handle > wrap ( RsvgHandle *  object,
bool  take_copy = false 
) [related]

A Glib::wrap() method for this object.

Parameters:
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns:
A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file: