thorvg_python.paint.scene¶
Classes¶
Scene API |
Module Contents¶
-
class thorvg_python.paint.scene.Scene(engine: thorvg_python.engine.Engine, scene: thorvg_python.base.PaintPointer | None =
None)¶ Bases:
thorvg_python.paint.PaintScene API
A module managing the multiple paints as one group paint.
As a group, scene can be transformed, translucent, maskd with other target paints, its children will be affected by the scene world.
- engine¶
- thorvg_lib¶
- _new() thorvg_python.base.PaintPointer¶
Creates a new Scene object.
This function allocates and returns a new Scene instance. To properly destroy the Scene object, use
Paint.rel().See also
Paint.rel()
- add(paint: thorvg_python.paint.Paint) thorvg_python.base.Result¶
Adds a paint object to the scene.
Appends the specified paint object to the given scene. Only paint objects added to the scene are considered rendering targets.
- Parameters:¶
- paint : thorvg_python.paint.Paint¶
A handle to the paint object to be added to the scene. This parameter must not be
None.
- Return type:¶
Note
Ownership of the
paintobject is transferred to the canvas upon successful addition. To retain ownership, callPaint.ref()before adding it to the scene.Note
The rendering order of paint objects follows their order in the root scene. If layering is required, ensure the paints are added in the desired order.
See also
Scene.insert()
See also
Scene.remove()
Added in version 1.0.
- insert(at: thorvg_python.paint.Paint) thorvg_python.base.Result¶
Inserts a paint object into the scene.
Inserts the specified paint object into the scene immediately before the given paint object
at. Theatparameter must reference an existing paint object already added to the scene.- Parameters:¶
- at : thorvg_python.paint.Paint¶
A handle to an existing paint object in the scene before which
targetwill be inserted. This parameter must not beNone.
- Return type:¶
Note
Ownership of the
targetobject is transferred to the scene upon successful addition. To retain ownership, callPaint.ref()before adding it to the scene.Note
The rendering order of paint objects follows their order in the root scene. If layering is required, ensure the paints are added in the desired order.
See also
Scene.add()
See also
Scene.remove()
Added in version 1.0.
- remove(paint: thorvg_python.paint.Paint | None) thorvg_python.base.Result¶
Removes a paint object from the scene.
This function removes a specified paint object from the scene. If no paint object is specified (i.e., the default
Noneis used), the function performs to clear all paints from the scene.- Parameters:¶
- paint: thorvg_python.paint.Paint | None¶
A pointer to the Paint object to be removed from the scene. If
None, remove all the paints from the scene.
- Return type:¶
See also
Scene.add()
Added in version 1.0.
- clear_effects() thorvg_python.base.Result¶
Clears all previously applied scene effects.
This function clears all effects that have been applied to the scene, restoring it to its original state without any post-processing.
- Return type:¶
Added in version 1.0.
- add_effect_gaussian_blur(sigma: float, direction: int, border: int, quality: int) thorvg_python.base.Result¶
Adds a Gaussian blur effect to the scene.
This function adds a Gaussian blur filter to the scene as a post-processing effect. The blur can be applied in different directions with configurable border handling and quality settings.
Added in version 1.0.
- add_effect_drop_shadow(r: int, g: int, b: int, a: int, angle: float, distance: float, sigma: float, quality: int) thorvg_python.base.Result¶
Adds a drop shadow effect to the scene.
This function adds a drop shadow with a Gaussian blur to the scene. The shadow can be customized using color, opacity, angle, distance, blur radius (sigma), and quality parameters.
:param int r Red channel value of the shadow color [0 - 255]. :param int g: Green channel value of the shadow color [0 - 255]. :param int b: Blue channel value of the shadow color [0 - 255]. :param int a Alpha (opacity) channel value of the shadow [0 - 255]. :param float angle: Shadow direction in degrees [0 - 360]. :param float distance: Distance of the shadow from the original object. :param float sigma: Gaussian blur sigma value for the shadow. Must be > 0. :param int quality: Blur quality level [0 - 100].
- Return type:¶
Added in version 1.0.
- add_effect_fill(r: int, g: int, b: int, a: int) thorvg_python.base.Result¶
Adds a fill color effect to the scene.
This function overrides the scene’s content colors with the specified fill color.
:param int r Red color channel value [0 - 255]. :param int g: Green color channel value [0 - 255]. :param int b: Blue color channel value [0 - 255]. :param int a Alpha (opacity) channel value [0 - 255].
- Return type:¶
Added in version 1.0.
- add_effect_tint(black_r: int, black_g: int, black_b: int, white_r: int, white_g: int, white_b: int, intensity: float) thorvg_python.base.Result¶
Adds a tint effect to the scene.
This function tints the current scene using specified black and white color values, modulated by a given intensity.
- Parameters:¶
- black_r : int¶
Red component of the black color [0 - 255].
- black_g : int¶
Green component of the black color [0 - 255].
- black_b : int¶
Blue component of the black color [0 - 255].
- white_r : int¶
Red component of the white color [0 - 255].
- white_g : int¶
Green component of the white color [0 - 255].
- white_b : int¶
Blue component of the white color [0 - 255].
- intensity : float¶
Tint intensity value [0 - 100].
Added in version 1.0.
- add_effect_effect_tritone(shadow_r: int, shadow_g: int, shadow_b: int, midtone_r: int, midtone_g: int, midtone_b: int, highlight_r: int, highlight_g: int, highlight_b: int, blend: int) thorvg_python.base.Result¶
Adds a tritone color effect to the scene.
This function adds a tritone color effect to the given scene using three sets of RGB values representing shadow, midtone, and highlight colors.
- Parameters:¶
- shadow_r : int¶
Red component of the shadow color [0 - 255].
- shadow_g : int¶
Green component of the shadow color [0 - 255].
- shadow_b : int¶
Blue component of the shadow color [0 - 255].
- midtone_r : int¶
Red component of the midtone color [0 - 255].
- midtone_g : int¶
Green component of the midtone color [0 - 255].
- midtone_b : int¶
Blue component of the midtone color [0 - 255].
- highlight_r : int¶
Red component of the highlight color [0 - 255].
- highlight_g : int¶
Green component of the highlight color [0 - 255].
- highlight_b : int¶
Blue component of the highlight color [0 - 255].
- blend : int¶
A blending factor that determines the mix between the original color and the tritone colors [0 - 255].
Added in version 1.0.