GDK

Last updated
GDK
Original author(s) GIMP authors
Developer(s) The GNOME Project
Repository
Written in C
Operating system Linux, macOS, Microsoft Windows
Platform X11, Wayland, Quartz and GDI
Type Software library
License GNU Lesser General Public License (LGPL)
Website developer.gnome.org/gdk3/stable/

GDK (GIMP Drawing Kit) 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.

Contents

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

Software architecture

GDK contains back-ends to X11, Wayland, Broadway (HTTP), Quartz and GDI and relies on Cairo for the rendering. Its new scene graph (canvas) is work-in-progress, its arrival should herald GTK 4.0. GDK software architecture.svg
GDK contains back-ends to X11, Wayland, Broadway (HTTP), Quartz and GDI and relies on Cairo for the rendering. Its new scene graph (canvas) is work-in-progress, its arrival should herald GTK 4.0.

GTK is implemented on top of an abstraction layer called GDK, freeing GTK from low-level concerns like input gathering, Drag and drop and pixel format conversion. GDK is an intermediate layer which separates GTK from the details of the windowing system.

GDK is an important part of GTK's portability. Since low-level cross-platform functionality is already provided by GLib, all that is needed to make GTK run on other platforms is to port GDK to the underlying operating system's graphics layer. Hence, the GDK ports to the Windows API and Quartz are what enable GTK applications to run on Windows and macOS, respectively.

Starting with GTK+ 2.8, GDK supports Cairo which should be used with GTK+ 3 instead of GDK's drawing functions. [1]

GDK is an intermediate layer which isolates GTK from the details of the windowing system. GDK is a thin wrapper around Xlib. The X Window System comes with a low-level library called Xlib. Almost every function in GDK is a very thin wrapper around a corresponding Xlib function; but some of the complexity (and functionality) of Xlib is hidden, to simplify programming and to make GDK easier to port to other windowing systems, such as Wayland or Microsoft Windows. The concealed Xlib functionality will rarely be of interest to application programmers; for example, many features used solely by window managers are not exposed in GDK.

GDK lets you do low level stuff, like e.g. "blit this pixmap to the screen".

GDK provides a layer that is much more portable than say the X protocol, without sacrificing any of the low-level accessibility that systems such as X provide. The true power of this abstraction is that if you choose to use it rather than say, X, your software will automatically render on the Linux Framebuffer and Windows.

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.

GdkFrameClock

GdkFrameClock was added in GTK 3.8 [2]

While GTK applications remain mainloop driven (cf. Glib event loop), meaning the application is idle inside this main loop most of the time and just waits for something to happen and then calls the appropriate subroutine when it does, GdkFrameClock adds an additional mechanism, that gives a "pulse" to the application. It tells the application when to update and repaint a window. [3] The beat rate can be synchronized with the monitor refresh rate.

GTK Scene Graph Kit

In its history GDK contained and linked with a couple of different Canvases.

Developers were also considering new directions for the library, including removing deprecated API components and adding an integrated scene graph (canvas) system, similar to the Clutter graphics library, effectively integrating GTK with OpenGL and Vulkan. [4] [5]

GTK+ Scene Graph Kit (GSK) was released as part of GTK+ 3.90 in March 2017. It is the scene graph and rendering API for GTK. GSK has not been further integrated with GDK (which is also part of GTK) but is kept in its own directory.

Windowing systems

GDK contains back-ends to a couple of windowing systems, namely to the X11 and Wayland protocols, to Quartz and GDI, and even to the Hypertext Transfer Protocol (HTTP) engine Broadway.[ citation needed ]

With the release of GNOME 3.16 in March 2015, GDK obtained an experimental back-end for the Mir display server protocol. [8] The Mir display server protocol is a product by Canonical for their Ubuntu distribution of Linux, which they intend to compete with the Wayland display server protocol; so far, it is implemented only in Ubuntu.

At present, no back-end exists for KMS.[ citation needed ]

To start an application and force this instance of it to use a certain windowing system, you specify the variable GDK_BACKEND:
GDK_BACKEND=wayland gnome-calculator
GDK_BACKEND=wayland CLUTTER_BACKEND=wayland cheese

gdk-pixbuf

gdk-pixbuf is a toolkit for image loading and pixel buffer manipulation. The library provides image loading and saving facilities, fast scaling and compositing of pixbufs, simple animation loading (i.e. animated GIFs), and rendering the libart image buffer to a GdkDrawable instance.

gdk-pixbuf has a fairly large API.

The fundamental structure in the gdk-pixbuf library is GdkPixbuf, a private, opaque data structure that mirrors many of the same concepts that ArtPixBuf supports. In fact, most of GdkPixbuf's private data fields have the same names and data types as the corresponding ones in ArtPixBuf. This similarity dates back to the earlier days when gdk-pixbuf was a wrapper around libart. Since that time, the libart dependency has been stripped out, and gdk-pixbuf was merged into the GTK+ 2.0 code base. As such, gdk-pixbuf's days as a standalone library are limited to the GNOME 1 release.

With the release of GTK+ 2.22 on 2010-09-23, gdk-pixbuf has been turned back into a standalone library, after being shipped as part of GTK+ since gtk+ 2.0. This was done in preparation for the transition to GTK+ 3.

The first stand-alone release was 2.22 on 2010-Sep-21, its development started with 2.21.3 on 2010-06-23.

History

GDK was originally developed on the X Window System for the GIMP raster graphics editor. [9]

See also

Related Research Articles

<span class="mw-page-title-main">GNUstep</span> Open source widget toolkit and application development tools

GNUstep is a free software implementation of the Cocoa Objective-C frameworks, widget toolkit, and application development tools for Unix-like operating systems and Microsoft Windows. It is part of the GNU Project.

<span class="mw-page-title-main">Windowing system</span> Software that manages separately different parts of display screens

In computing, a windowing system is a software suite that manages separately different parts of display screens. It is a type of graphical user interface (GUI) which implements the WIMP paradigm for a user interface.

freedesktop.org (fd.o), formerly X Desktop Group (XDG), is a project to work on interoperability and shared base technology for free-software desktop environments for the X Window System (X11) and Wayland on Linux and other Unix-like operating systems. Although freedesktop.org produces specifications for interoperability, it is not a formal standards body.

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

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.

GNOME-DB is a database application by the GNOME community. The project aims to provide a free unified data access architecture to the GNOME project for all Unix platforms. GNOME-DB is useful for any application that accesses persistent data, since it contains a data management API.

<span class="mw-page-title-main">Java OpenGL</span>

Java OpenGL (JOGL) is a wrapper library that allows OpenGL to be used in the Java programming language. It was originally developed by Kenneth Bradley Russell and Christopher John Kline, and was further developed by the Game Technology Group at Sun Microsystems. Since 2010, it has been an independent open-source project under a BSD license. It is the reference implementation for Java Bindings for OpenGL (JSR-231).

The canvas element is part of HTML5 and allows for dynamic, scriptable rendering of 2D shapes and bitmap images. It is a low level, procedural model that updates a bitmap. HTML5 Canvas also helps in making 2D games.

Libart is a free software graphics library of functions for 2D graphics supporting a superset of the PostScript imaging model. Libart was designed to be integrated with graphics, artwork, and illustration programs. It is written in optimized C and is fully compatible with C++. With a small footprint of 10,000 lines of code, it is especially suitable for embedded applications.

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">EGL (API)</span> Application programming interface

EGL is an interface between Khronos rendering APIs and the underlying native platform windowing system. EGL handles graphics context management, surface/buffer binding, rendering synchronization, and enables "high-performance, accelerated, mixed-mode 2D and 3D rendering using other Khronos APIs." EGL is managed by the non-profit technology consortium Khronos Group.

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.

ANGLE is an open source, cross-platform graphics engine abstraction layer developed by Google. ANGLE translates OpenGL ES 2/3 calls to DirectX 9, 11, OpenGL or Vulkan API calls. It is a portable version of OpenGL but with limitations of OpenGL ES standard.

<span class="mw-page-title-main">GTK Scene Graph Kit</span>

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.

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.

ArkGraphics 3D is an open source, 3D graphic stack developed by Huawei as a subset of Ark Engine for HarmonyOS and OpenAtom OpenHarmony. The engine layer includes two modules, such as 2D graphics library and 3D graphics engine with OpenGL with OpenGL Shading Language, WebGL and Vulkan as render service backend. The 2D graphics library provides the underlying API for 2D graphics rendering, and supports the underlying capabilities of graphics rendering and text rendering for ArkUI. AGP Engine as a component of ArkUI, it provides the 3D drawing capability of the system.

References

  1. Migrating from GTK+ 2.x to GTK+ 3 - Use cairo for drawing
  2. "GdkFrameClock".
  3. Larsson, Alexander (2013-11-04). "The modern Gtk drawing model".
  4. Alberto Ruiz's Blog
  5. Havoc Pennington's scene graph proposal
  6. "The GTK+ Scene Graph Kit". 2014-07-29.
  7. "Graphene". 2014-05-02.
  8. "add an experimental backend for mir".
  9. GIMP - A Brief (and Ancient) History of GIMP