GTK Scene Graph Kit

Last updated
GSK
Original author(s) Emmanuele Bassi et al.
Developer(s) The GNOME Project
Initial releaseMarch 24, 2017;7 years ago (2017-03-24)
Written in C
Operating system Part of GTK
Type Software library
License LGPL
Website developer.gnome.org/gsk4/unstable/
Simplified software architecture of GTK. GTK+ software architecture.svg
Simplified software architecture of GTK.
CSS taxonomy. CSS3 taxonomy and status by Sergey Mavrody.svg
CSS taxonomy.

GTK Scene Graph Kit (GSK) is the rendering and scene graph API for GTK introduced with version 3.90. GSK lies between the graphical control elements (widgets) and the rendering.

Contents

Like GDK, GSK is part of GTK and licensed under the GNU Lesser General Public License (LGPL).

Rationale

GSK is part of GTK. GSK is meant to be used by GTK itself and by GTK-based applications that wish to replace Clutter for their UI. Applications that made use of Clutter instead of using only GTK are e.g. GNOME Shell, GNOME Videos, GNOME Boxes and Cheese.

Any application which makes use of GTK's graphical control elements (widgets), as opposed to those applications getting a GTK window and then drawing themselves on it, benefit from GSK.

Performance

Drawing graphical control elements (widgets) without a scenegraph leads to rendering things that don't show up on the screen, things that do not need to be rendered; hence it leads to avoidable performance and battery life losses. The scenegraph is used to do hidden surface determination.

Simplicity

The way widgets were drawn in GTK (when not using Clutter), was, that a draw function (part of GDK hence the name (GIMP "Drawing" Kit)) drew everything. There was no way to know, what has just been drawn. To know where the mouse pointer was currently hovering over, the current position had to be computed. With GSK, it should be fairly easy to write complex graphical control elements (widgets) and still track easily the whereabout of the mouse pointer.

CSS

It was decided for GTK to move to a Cascading Style Sheet (CSS)-based model for how graphical control elements (widgets) are styled (i.e. themed/skinned) and rendered. In CSS, shadows, borders, padding and style properties have well-defined semantics. Some of those semantics are difficult to implement with the old GTK drawing model.

GSK makes use of graphene, [1] an external library which houses a collection of geometry types — points, sizes, rectangles, vectors, quads, quaternions, matrices. graphene has been ported to the Meson build system.

GSK rendering pipeline

GSK uses a dual-layer approach: [2]

  1. The lower layer is a simple rendering tree of operations; it can be transformed into appropriate rendering commands with minimal state changes, so it gets transformed into the rendering pipeline. The tree of rendering operations is represented by GskRenderNode instances; an instance of GskRenderer takes the render nodes and submits them (after potentially reordering and transforming them to a more appropriate representation) to the underlying graphic system.
  2. higher layer: a complex set of logical layers; it adds a high level convenience API for application developers.

Rendering APIs

As of GTK 3.90, which is the development version number of what will become GTK 4, GSK supports rendering using these back-ends:

History

Clutter

Clutter was released to the public on June 22, 2006. The integration library "clutter-gtk" has been available since 2006-11-29. [3]

At the 2nd Desktop Summit in August 2011 in Berlin there was quite some talk regarding "GTK+ 4.0 and Clutter 2.0". [4]

Idea to introduce a scene graph to GTK

In 2008 developers such as Havoc Pennington were considering to add a scene canvas to GTK, as people outside of GTK were making use of things like Clutter, Pigment, HippoCanvas or GooCanvas. [5] It was proposed to make graphical control elements (widgets) one kind of object in a more flexible scene graph.

GSK

Before GSK, drawing used to be done by GDK - handling basic rendering such as drawing primitives, raster graphics (bitmaps), cursors, fonts, as well as window events and drag-and-drop functionality. [6]

In June 2006 Clutter, an OpenGL-based 'interactive canvas' library, was released. Clutter has its own scene graph, and GNOME developers preferred to use Clutter's scene graph with GTK, facilitated by a library called clutter-gtk. [7] Clutter can be embedded into every GNOME application by using the clutter-gtk library. The clutter-gtk library provides a GtkClutterEmbed GTK widget which can be used to display a ClutterStage.

Some thought went into how to merge Clutter and GTK in a better way than the clutter-gtk library.

In 2011, Firefox introduced "Azure" and Joe Drew and Bas Schouten bothered with some explanations. [8] [9] [10]

There was a presentation at the 2014 Developer Experience Hackfest regarding a new scene graph for GTK aimed at being merged into GTK+ 3.16. [14] Then GSK was planned to be ready and fully integrated into GTK+ version 3.20, to be released in March 2016. This was postponed to 3.22, [15] and then finally merged into 3.90.

Having OpenGL (or OpenGL ES) support in GDK facilitates a slightly better control of the graphics pipeline; OpenGL is well suited for compositing textured data but totally unsuited for drawing.[ citation needed ]

The latest information about the status of GSK is from GUADEC 2016. [16]

Other projects

See also

Related Research Articles

<span class="mw-page-title-main">Scene graph</span>

A scene graph is a general data structure commonly used by vector-based graphics editing applications and modern computer games, which arranges the logical and often spatial representation of a graphical scene. It is a collection of nodes in a graph or tree structure. A tree node may have many children but only a single parent, with the effect of a parent applied to all its child nodes; an operation performed on a group automatically propagates its effect to all of its members. In many programs, associating a geometrical transformation matrix at each group level and concatenating such matrices together is an efficient and natural way to process such operations. A common feature, for instance, is the ability to group related shapes and objects into a compound object that can then be manipulated as easily as a single object.

A widget toolkit, widget library, GUI toolkit, or UX library is a library or a collection of libraries containing a set of graphical control elements used to construct the graphical user interface (GUI) of programs.

<span class="mw-page-title-main">PyQt</span> Python GUI library

PyQt is a Python binding of the cross-platform GUI toolkit Qt, implemented as a Python plug-in. PyQt is free software developed by the British firm Riverbank Computing. It is available under similar terms to Qt versions older than 4.5; this means a variety of licenses including GNU General Public License (GPL) and commercial license, but not the GNU Lesser General Public License (LGPL). PyQt supports Microsoft Windows as well as various kinds of UNIX, including Linux and MacOS.

<span class="mw-page-title-main">PyGTK</span> Set of Python wrappers for the GTK graphical user interface library

PyGTK is a set of Python wrappers for the GTK graphical user interface library. PyGTK is free software and licensed under the LGPL. It is analogous to PyQt/PySide and wxPython, the Python wrappers for Qt and wxWidgets, respectively. Its original author is GNOME developer James Henstridge. There are six people in the core development team, with various other people who have submitted patches and bug reports. PyGTK has been selected as the environment of choice for applications running on One Laptop Per Child systems.

<span class="mw-page-title-main">Fox toolkit</span>

The FOX toolkit is an open-source, cross-platform widget toolkit, i.e. a library of basic elements for building a graphical user interface (GUI). FOX stands for Free Objects for X.

Cairo (graphics) Vector graphics-based software library

Cairo is an open-source graphics library that provides a vector graphics-based, device-independent API for software developers. It provides primitives for two-dimensional drawing across a number of different backends. Cairo uses hardware acceleration when available.

<span class="mw-page-title-main">GDK</span> Software library

GDK is a library that acts as a wrapper around the low-level functions provided by the underlying windowing and graphics systems. GDK lies between the display server and the GTK library, handling basic rendering such as drawing primitives, raster graphics (bitmaps), cursors, fonts, as well as window events and drag-and-drop functionality.

gtkmm is the official C++ interface for the popular GUI library GTK. gtkmm is free software distributed under the GNU Lesser General Public License (LGPL).

<span class="mw-page-title-main">Accessibility Toolkit</span> Software library

Accessibility Toolkit (ATK) is an open source software library, part of the GNOME project, which provides application programming interfaces (APIs) for implementing accessibility support in software.

A graphics library is a program library designed to aid in rendering computer graphics to a monitor. This typically involves providing optimized versions of functions that handle common rendering tasks. This can be done purely in software and running on the CPU, common in embedded systems, or being hardware accelerated by a GPU, more common in PCs. By employing these functions, a program can assemble an image to be output to a monitor. This relieves the programmer of the task of creating and optimizing these functions, and allows them to focus on building the graphics program. Graphics libraries are mainly used in video games and simulations.

Resolution independence is where elements on a computer screen are rendered at sizes independent from the pixel grid, resulting in a graphical user interface that is displayed at a consistent physical size, regardless of the resolution of the screen.

Clutter is a discontinued GObject-based graphics library for creating hardware-accelerated user interfaces. Clutter is an OpenGL-based 'interactive canvas' library and does not contain any graphical control elements. It relies upon OpenGL (1.4+) or OpenGL ES for rendering,. It also supports media playback using GStreamer and 2D graphics rendering using Cairo.

java-gnome is a set of language bindings for the Java programming language for use in the GNOME desktop environment. It is part of the official GNOME language bindings suite and provides a set of libraries allowing developers to write computer programs for GNOME using the Java programming language and the GTK cross-platform widget toolkit.

<span class="mw-page-title-main">Hildon</span> Linux-based application framework

Hildon is an application framework originally developed for mobile devices running the Linux operating system as well as the Symbian operating system. The Symbian variant of Hildon was discontinued with the cancellation of Series 90. It was developed by Nokia for the Maemo operating system. It focuses on providing a finger-friendly interface. It is primarily a set of GTK extensions that provide mobile-device–oriented functionality, but also provides a desktop environment that includes a task navigator for opening and switching between programs, a control panel for user settings, and status bar, task bar and home applets. It is standard on the Maemo platform used by the Nokia Internet Tablets and the Nokia N900 smartphone.

<span class="mw-page-title-main">Wayland (protocol)</span> Display system intended to replace X11

Wayland is a communication protocol that specifies the communication between a display server and its clients, as well as a C library implementation of that protocol. A display server using the Wayland protocol is called a Wayland compositor, because it additionally performs the task of a compositing window manager.

<span class="mw-page-title-main">GTK</span> Free and open-source cross-platform widget toolkit for creating graphical user interfaces

GTK is a free software cross-platform widget toolkit for creating graphical user interfaces (GUIs). It is licensed under the terms of the GNU Lesser General Public License, allowing both free and proprietary software to use it. It is one of the most popular toolkits for the Wayland and X11 windowing systems.

Seed is a JavaScript interpreter and a library of the GNOME project to create standalone applications in JavaScript. It uses the JavaScript engine JavaScriptCore of the WebKit project. It is possible to easily create modules in C.

In computer science and visualization, a canvas is a container that holds various drawing elements. It takes its name from the canvas used in visual arts. It is sometimes called a scene graph because it arranges the logical representation of a user interface or graphical scene. Some implementations also define the spatial representation and allow the user to interact with the elements via a graphical user interface.

Client-side decoration (CSD) is the concept of allowing a graphical application software to be responsible for drawing its own window decorations, historically the responsibility of the window manager.

References

  1. Bassi, Emmanuele (2014-05-02). "Graphene".
  2. Bassi, Emmanuele (2016-10-18). "Initial implementation of GSK rendering pipeline".
  3. Bassi, Emmanuele (2006-11-29). "add clutter-gtk".
  4. Bassi, Emmanuele (2011-08-31). "GTK+ 4.0 and Clutter 2.0: rainbows and unicorns".
  5. Pennington, Havoc (2008-03-07). "Havoc Pennington's scene graph proposal".
  6. Bassi, Emmanuele (2014-07-29). "The GTK+ Scene Graph Kit".
  7. "clutter-gtk on git.gnome".
  8. "Introducing the Azure project". 2011-04-26. Archived from the original on 2016-09-08. Retrieved 2017-03-17.
  9. "Comparing Performance: Azure vs Cairo". 2011-06-06.
  10. "Releasing Azure". 2011-08-16.
  11. Bassi, Emmanuele (2013-08-12). "Future in the past GTK scene-graph".
  12. Bassi, Emmanuele (2014-07-29). "The GTK+ Scene Graph Kit".
  13. Bassi, Emmanuele (2014-07-30). "Halting Problem – Future in the Past".
  14. "2014 Developer Experience Hackfest: A scene graph for GTK+ 3.16".
  15. "GNOME Wiki: roadmap for GTK+".
  16. Bassi, Emmanuele (2016-08-16). "GTK: are we in the future, yet?". YouTube .
  17. "Evas".
  18. "Qt Quick Scene Graph".