ArticleslgStudy

science

GDK

GDK is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand GDK rather than just read about it. In short: 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.

GDK — main illustration
GDK — illustration

Key takeaways

  • GDK belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect GDK to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of GDK from memory before moving on to harder problems.

Reference excerpt

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. Like GTK Scene Graph Kit (GSK), GDK is part of GTK and licensed under the GNU Lesser General Public License (LGPL).

Software architecture

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 is recommended for use with GTK+ 3 instead of GDK's drawing functions. 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 Xlib functionality provided is mostly that targeted toward applications; for example, many features used solely by window managers are not exposed in GDK. GDK supports OpenGL (or OpenGL ES) for better control of the graphics pipeline.

GdkFrameClock GdkFrameClock was added in GTK 3.8 While GTK applications remain mainloop driven (cf. Glib event loop), meaning the application is idle inside this main loop most of the time waiting for an event and then calls the appropriate subroutine when one occurs, GdkFrameClock adds an additional mechanism, which tells the application when to update and repaint a window. The update 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.

https://wiki.gnome.org/Attic/ProjectRidley/CanvasOverview https://wiki.gnome.org/Attic/ProjectRidley/CanvasOverview/Canvases https://wiki.gnome.org/Projects/GooCanvas 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.

GTK Scene Graph Kit (GSK) 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. With the release of GNOME 3.16 in March 2015, GDK obtained an experimental back-end for the Mir display server protocol. 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. The environment variable GDK_BACKEND can be used to start an application and force this instance of it to use a certain windowing system: 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.

https://git.gnome.org/browse/gdk-pixbuf/ 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.

See also

Clutter

References

External links GDK code from release GTK+ 3.19.0 The modern Gtk drawing model – Alexander Larsson, 2013/11/04 Overview of GTK and its Libraries Archived 2019-03-12 at the Wayback Machine - The GTK Project https://git.gnome.org/browse/gtk-web/plain/images/architecture.svg

Illustrations

GDK illustration
GDK: 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 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.

Worked examples

Example 1 — a first encounter with GDK

Start with the simplest possible case. Write down what GDK claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to GDK before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about GDK ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of GDK

In research
GDK appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses GDK in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
GDK is common in secondary-school and first-year university syllabi. It links to neighbouring topics GTK, Graphics libraries, so understanding it makes those chapters shorter.
In everyday life
Look for GDK outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “GDK” →

How to study GDK in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what GDK means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain GDK out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is GDK in simple terms?

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, font…

Why does GDK matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study GDK?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on GDK.

Tags

  • GTK
  • Graphics libraries

Keep exploring