Package: gtk

Class gtk:svg

Superclasses

gdk:paintable, gtk:symbolic-paintable, gobject:object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

None

Direct Slots

features
The features property of type gtk:svg-features (Read / Write)
Enabled features for this SVG paintable. Note that features have to be set before loading SVG data to take effect.
Default value: '(:animations :system-resources :external-resources :extensions)
overflow
The overflow property of type gtk:overflow (Read / Write)
Whether the rendering will be clipped to the bounds. Since 4.24
Default value: :hidden
playing
The playing property of type gtk:overflow (Read / Write)
Whether the SVG paintable is currently animating its content. To set this property, use the gtk:svg-play and gtk:svg-pause functions.
Default value: false
resource
The resource property of type :string (Read / Write)
Resource to load SVG data from. This property is meant to create a paintable from a resource in UI files.
Default value: nil
state
The state property of type :uint (Read / Write)
The current state of the renderer. This can be a number between 0 and 63.
Default value: 0
stylesheet
The stylesheet property of type g:bytes (Read / Write)
The CSS stylesheet to apply to the SVG. Since 4.24
weight
The weight property of type :double (Read / Write)
If not set to -1, this value overrides the weight used when rendering the SVG paintable.
Default value: -1.0d0

Details

A paintable implementation that renders SVG, with animations. The gtk:svg object is created by parsing a subset of SVG, including SVG animations.

The gtk:svg object fills or strokes paths with symbolic or fixed colors. It can have multiple states, and paths can be included in a subset of the states. States can have animations, and the transition between different states can also be animated.

To show a static SVG image, it is enough to load the the SVG and use it like any other paintable. To play an SVG animation, use the gtk:svg-set-frame-clock function to connect the paintable to a frame clock, and call the gtk:svg-play function after loading the SVG. The animation can be paused using the gtk:svg-pause function. To set the current state, use the gtk:svg-state function.

Signal Details

The "error" signal
lambda (svg error)    :run-last      
svg
The gtk:svg object that received the signal.
error
The g:error instance for the error.
Signals that an error occurred. Errors can occur both during parsing and during rendering. The expected error values are in the GtkSvgError enumeration, context information about the location of parsing errors can be obtained with the various gtk_svg_error() functions. Parsing errors are never fatal, so the parsing will resume after the error. Errors may however cause parts of the given data or even all of it to not be parsed at all. So it is a useful idea to check that the parsing succeeds by connecting to this signal.
 

Returned by

Slot Access Functions

Inherited Slot Access Functions

See also

2026-11-05