Class: Gtk::Svg

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Gtk::Svg

Parses the SVG data in the resource and creates a paintable.

Parameters:

  • path (String) —

    the resource path

Instance Method Details

#features ⇒ Gtk::SvgFeatures

Enabled features for this paintable.

Note that features have to be set before
loading SVG data to take effect.

Returns:

#features=(features) ⇒ Gtk::SvgFeatures

Enabled features for this paintable.

Note that features have to be set before
loading SVG data to take effect.

Parameters:

Returns:

#frame_clock=(clock) ⇒ nil

Sets a frame clock.

Without a frame clock, GtkSvg will not advance animations.

Parameters:

  • clock (Gdk::FrameClock) —

    the frame clock

Returns:

  • (nil)

#get_state_names(length) ⇒ Array<String>

Returns a NULL-terminated array of
state names, if available.

Note that the returned array and the strings
contained in it will only be valid until the
GtkSvg is cleared or reloaded, so if you
want to keep it around, you should make a copy.

Parameters:

  • length (Integer) —

    return location for the number
    of strings that are returned

Returns:

  • (Array<String>) —

    the state names

#load_from_bytes(bytes) ⇒ nil

Loads SVG content into an existing SVG paintable.

To track errors while loading SVG content,
connect to the [signalGtk.Svg::error] signal.

This clears any previously loaded content.

Parameters:

  • bytes (GLib::Bytes) —

    the data to load

Returns:

  • (nil)

#load_from_resource(path) ⇒ nil

Loads SVG content into an existing SVG paintable.

To track errors while loading SVG content,
connect to the [signalGtk.Svg::error] signal.

This clears any previously loaded content.

Parameters:

  • path (String) —

    the resource path

Returns:

  • (nil)

#pause ⇒ nil

Stop any playing animations and state transitions.

Animations can be paused and started repeatedly.

Returns:

  • (nil)

#play ⇒ nil

Start playing animations and state transitions.

Animations can be paused and started repeatedly.

Returns:

  • (nil)

#playing=(playing) ⇒ Boolean

Whether the paintable is currently animating its content.

To set this property, use the [methodGtk.Svg.play] and
[methodGtk.Svg.pause] functions.

Parameters:

  • playing (Boolean)

Returns:

  • (Boolean) —

    playing

  • (Boolean) —

    playing

#playing? ⇒ Boolean

Whether the paintable is currently animating its content.

To set this property, use the [methodGtk.Svg.play] and
[methodGtk.Svg.pause] functions.

Returns:

  • (Boolean) —

    playing

#resource ⇒ String

Resource to load SVG data from.

This property is meant to create a paintable
from a resource in ui files.

Returns:

  • (String) —

    resource

#resource=(resource) ⇒ String

Resource to load SVG data from.

This property is meant to create a paintable
from a resource in ui files.

Parameters:

  • resource (String)

Returns:

  • (String) —

    resource

  • (String) —

    resource

#serialize ⇒ GLib::Bytes

Serializes the content of the renderer as SVG.

The SVG will be similar to the orignally loaded one,
but is not guaranteed to be 100% identical.

This function serializes the DOM, i.e. the results
of parsing the SVG. It does not reflect the effect
of applying animations.

Returns:

  • (GLib::Bytes) —

    the serialized contents

#state ⇒ Integer

The current state of the renderer.

This can be a number between 0 and 63.

Returns:

  • (Integer) —

    state

#state=(state) ⇒ Integer

The current state of the renderer.

This can be a number between 0 and 63.

Parameters:

  • state (Integer)

Returns:

  • (Integer) —

    state

  • (Integer) —

    state

#weight ⇒ Float

If not set to -1, this value overrides the weight used
when rendering the paintable.

Returns:

  • (Float) —

    weight

#weight=(weight) ⇒ Float

If not set to -1, this value overrides the weight used
when rendering the paintable.

Parameters:

  • weight (Float)

Returns:

  • (Float) —

    weight

  • (Float) —

    weight

#write_to_file(filename) ⇒ Boolean

Serializes the paintable, and saves the result to a file.

Parameters:

  • filename (String) —

    the file to save to

Returns:

  • (Boolean) —

    true, unless an error occurred