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 docs.gtk.org/gsk4
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

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">Glade Interface Designer</span> Graphical user interface builder

Glade Interface Designer is a graphical user interface builder for GTK, with additional components for GNOME. In its third version, Glade is programming language–independent, and does not produce code for events, but rather an XML file that is then used with an appropriate binding. See List of language bindings for GTK for the available ones.

<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 or graphics API 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.

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">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.

<span class="mw-page-title-main">GNOME</span> Desktop environment for Linux and other Unix-like systems

GNOME, originally an acronym for GNU Network Object Model Environment, is a free and open-source desktop environment for Linux and other Unix-like operating 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.

<span class="mw-page-title-main">GNOME 1</span> First major release of GNOME

GNOME 1 is the first major release of the GNOME desktop environment. Its primary goal was to provide a consistent user-friendly environment in conjunction with the X Window System. It was also a modern and free and open source software alternative to older desktop environments such as the Common Desktop Environment (CDE), but also to the K Desktop Environment (KDE). Each desktop environment was built-upon then proprietary-licensed widget toolkits, whereas GNOME's goal from the onset, was to be freely-licensed, and utilize the GTK toolkit instead.

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".