![]() Simplified software architecture ofGTK | |
Original author(s) | GIMP authors |
---|---|
Developer(s) | The GNOME Project |
Repository | |
Written in | C |
Operating system | Linux,macOS,Microsoft Windows |
Platform | X11,Wayland,Quartz andGDI |
Type | Software library |
License | GNU Lesser General Public License (LGPL) |
Website | developer |
GDK (GIMP Drawing Kit) is alibrary that acts as awrapper around the low-level functions provided by the underlying windowing and graphics systems. GDK lies between thedisplay server and theGTK library, handling basicrendering such as drawing primitives,raster graphics (bitmaps),cursors,fonts, as well aswindow events anddrag-and-drop functionality.
LikeGTK Scene Graph Kit (GSK), GDK is part of GTK and licensed under theGNU Lesser General Public License (LGPL).
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 byGLib, all that is needed to make GTK run on other platforms is to port GDK to the underlyingoperating system's graphics layer. Hence, the GDK ports to theWindows API andQuartz are what enable GTK applications to run onWindows andmacOS, respectively.
Starting with GTK+ 2.8, GDK supportsCairo, which is recommended for use with GTK+ 3 instead of GDK's drawing functions.[1]
GDK is an intermediate layer which isolatesGTK from the details of thewindowing system. GDK is a thin wrapper aroundXlib. The X Window System comes with a low-level library calledXlib. 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 asWayland or Microsoft Windows. The Xlib functionality provided is mostly that targeted toward applications; for example, many features used solely bywindow managers are not exposed in GDK.
GDK supportsOpenGL (orOpenGL ES) for better control of thegraphics pipeline.
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 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.[3] The update rate can be synchronized with the monitor refresh rate.
In its history GDK contained and linked with a couple of differentCanvases.
Developers were also considering new directions for the library, including removing deprecatedAPI components and adding an integratedscene graph (canvas) system, similar to the Clutter graphics library, effectively integrating GTK withOpenGL andVulkan.[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.
GDK contains back-ends to a couple ofwindowing systems, namely to theX11 andWayland protocols, toQuartz andGDI, and even to theHypertext Transfer Protocol (HTTP) engine Broadway.[citation needed]
With the release of GNOME 3.16 in March 2015, GDK obtained an experimental back-end for theMir display server protocol.[8] The Mir display server protocol is a product byCanonical for theirUbuntu 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 forKMS.[citation needed]
The environment variableGDK_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 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 aroundlibart. 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 theGNOME 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 was2.22 on 2010-Sep-21, its development started with2.21.3 on 2010-06-23.
GDK was originally developed on theX Window System for the GIMPraster graphics editor.[9]