Module: Gsk

Defined in:
lib/gsk4/loader.rb,
lib/gsk4.rb,
lib/gsk4/version.rb,
lib/gsk4/rounded-rect.rb

Overview

Copyright (C) 2025 Ruby-GNOME Project Team

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Defined Under Namespace

Modules: BlendMode, Corner, FillRule, GLUniformType, Isolation, LineCap, LineJoin, MaskMode, PathDirection, PathForeachFlags, PathIntersection, PathOperation, PorterDuff, RenderNodeType, ScalingFilter, SerializationError, TransformCategory, Version Classes: BlendNode, BlurNode, BorderNode, BroadwayRenderer, CairoNode, CairoRenderer, ClipNode, ColorMatrixNode, ColorNode, ComponentTransferNode, CompositeNode, ConicGradientNode, ContainerNode, CopyNode, CrossFadeNode, DebugNode, Error, FillNode, GLRenderer, GLShader, GLShaderNode, InsetShadowNode, IsolationNode, LinearGradientNode, Loader, MaskNode, NglRenderer, OpacityNode, OutsetShadowNode, PasteNode, RadialGradientNode, RenderNode, Renderer, RepeatNode, RepeatingLinearGradientNode, RepeatingRadialGradientNode, RoundedClipNode, RoundedRect, ShadowNode, StrokeNode, SubsurfaceNode, TextNode, TextureNode, TextureScaleNode, TransformNode, VulkanRenderer

Constant Summary collapse

LOG_DOMAIN =
"Gsk"

Instance Method Summary collapse

Instance Method Details

#component_transfer_equal(self, other) ⇒ Boolean

Compares two component transfers for equality.

Parameters:

  • self (GObject) —

    a component transfer

  • other (GObject) —

    another component transfer

Returns:

  • (Boolean) —

    true if self and other are equal

#path_parse(string) ⇒ Gsk::Path

Constructs a path from a serialized form.

The string is expected to be in (a superset of)
SVG path syntax,
as e.g. produced by [methodGsk.Path.to_string].

A high-level summary of the syntax:

  • M x y Move to (x, y)
  • L x y Add a line from the current point to (x, y)
  • Q x1 y1 x2 y2 Add a quadratic Bézier from the current point to (x2, y2), with control point (x1, y1)
  • C x1 y1 x2 y2 x3 y3 Add a cubic Bézier from the current point to (x3, y3), with control points (x1, y1) and (x2, y2)
  • Z Close the contour by drawing a line back to the start point
  • H x Add a horizontal line from the current point to the given x value
  • V y Add a vertical line from the current point to the given y value
  • T x2 y2 Add a quadratic Bézier, using the reflection of the previous segments' control point as control point
  • S x2 y2 x3 y3 Add a cubic Bézier, using the reflection of the previous segments' second control point as first control point
  • A rx ry r l s x y Add an elliptical arc from the current point to (x, y) with radii rx and ry. See the SVG documentation for how the other parameters influence the arc.
  • O x1 y1 x2 y2 w Add a rational quadratic Bézier from the current point to (x2, y2) with control point (x1, y1) and weight w.

All the commands have lowercase variants that interpret coordinates
relative to the current point.

The O command is an extension that is not supported in SVG.

Parameters:

  • string (String) —

    a string

Returns:

  • (Gsk::Path) —

    a new GskPath, or NULL if string could not be parsed

#serialization_error_quark ⇒ GLib::Quark

Registers an error quark for [classGsk.RenderNode] errors.

Returns:

  • (GLib::Quark) —

    the error quark

#stroke_equal(stroke1, stroke2) ⇒ Boolean

Checks if two strokes are identical.

Parameters:

  • stroke1 (GObject) —

    the first stroke

  • stroke2 (GObject) —

    the second stroke

Returns:

  • (Boolean) —

    true if the two strokes are equal, false otherwise

#transform_parse(string, out_transform) ⇒ Boolean

Parses a given into a transform.

Strings printed via [methodGsk.Transform.to_string]
can be read in again successfully using this function.

If string does not describe a valid transform, false
is returned and NULL is put in out_transform.

Parameters:

  • string (String) —

    the string to parse

  • out_transform (Gsk::Transform) —

    return location for the transform

Returns:

  • (Boolean) —

    true if string described a valid transform

#value_dup_render_node(value) ⇒ Gsk::RenderNode

Retrieves the render node stored inside a GValue,
and acquires a reference to it.

Parameters:

  • value (GObject::Value) —

    a [structGObject.Value] initialized with type GSK_TYPE_RENDER_NODE

Returns:

#value_get_render_node(value) ⇒ Gsk::RenderNode

Retrieves the render node stored inside a GValue.

Parameters:

  • value (GObject::Value) —

    a GValue initialized with type GSK_TYPE_RENDER_NODE

Returns:

#value_set_render_node(value, node) ⇒ nil

Stores the given render node inside a GValue.

The [structGObject.Value] will acquire a reference
to the render node.

Parameters:

  • value (GObject::Value) —

    a [structGObject.Value] initialized with type GSK_TYPE_RENDER_NODE

  • node (Gsk::RenderNode) —

    a render node

Returns:

  • (nil)

#value_take_render_node(value, node) ⇒ nil

Stores the given render node inside a GValue.

This function transfers the ownership of the
render node to the GValue.

Parameters:

  • value (GObject::Value) —

    a [structGObject.Value] initialized with type GSK_TYPE_RENDER_NODE

  • node (Gsk::RenderNode) —

    a render node

Returns:

  • (nil)