1 \input texinfo @c -*-texinfo-*-
9 @set update-date 16 May 1996
10 @set update-month May 1996
13 This file documents GDK, the General Drawing Kit
15 Copyright (C) 1996 Peter Mattis
17 Permission is granted to make and distribute verbatim copies of this
18 manual provided the copyright notice and this permission notice are
19 preserved on all copies
22 Permission is granted to process this file throught TeX and print the
23 results, provided the printed document carries copying permission notice
24 identical to this one except for the removal of this paragraph (this
25 paragraph not being relevant to the printed manual).
28 Permission is granted to copy and distribute modified versions of this
29 manual under the conditions for verbatim copying, provided that the
30 entire resulting derived work is distributed under the terms of a
31 permission notice identical to this one.
33 Permission is granted to copy and distribute translations of this manual
34 into another language, under the above conditions for modified versions,
35 except that this permission notice may be stated in a translation
36 approved by Peter Mattis.
40 @title The General Drawing Kit
42 @subtitle @value{update-month}
43 @author by Peter Mattis
46 @vskip 0pt plus 1filll
47 Copyright @copyright{} 1996 Peter Mattis
49 Permission is granted to make and distribute verbatim copies of this
50 manual provided the copyright notice and this permission notice are
51 preserved on all copies.
53 Permission is granted to copy and distribute modified versions of this
54 manual under the conditions for verbatim copying, provided that the
55 entire resulting derived work is distributed under the terms of a
56 permission notice identical to this one.
58 Permission is granted to copy and distribute translations of this manual
59 into another language, under the above conditions for modified versions,
60 except that this permission notice may be stated in a translation
61 approved by Peter Mattis.
64 @dircategory User Interface Toolkit
66 * GDK: (gdk). The General Drawing Kit
69 @node Top, Copying, (dir), (dir)
70 @top The General Drawing Kit
72 This is edition @value{edition} of the GDK documentation,
73 @w{@value{update-date}}.
77 * Copying:: Your rights.
78 * Overview:: What is GDK?
79 * Initialization:: Initialization and exit.
80 * Events:: Event handling.
81 * Visuals:: Understanding and using visuals.
82 * Windows:: Creating and using windows.
83 * Graphics Contexts:: Creating and modifying GCs.
84 * Pixmaps:: Creating pixmaps.
85 * Images:: Creating images.
86 * Color:: Specifying color.
87 * Fonts:: Creating fonts.
88 * Drawing:: Drawing commands.
89 * XInput Support:: Using extended devices.
90 * Miscellany:: Other stuff.
91 * Examples:: Using GDK.
92 * Function Index:: Index of functions
93 * Concept Index:: Index of concepts
96 @node Copying, Overview, Top, Top
97 @comment node-name, next, previous, up
100 GDK is @dfn{free}; this means that everyone is free to use it and free
101 to redestribute it on a free basis. GDK is not in the public domain; it
102 is copyrighted and there are restrictions on its distribution, but these
103 restrictions are designed to permit everything that a good cooperating
104 citizen would want to do. What is not allowed is to try to prevent
105 others from further sharing any version of GDK that they might get from
108 Specifically, we want to make sure that you have the right to give away
109 copies of GDK, that you receive source code or else can get it if you
110 want it, that you can change GDK or use pieces of it in new free
111 programs, and that you know you can do these things.
113 To make sure that everyone has such rights, we have to forbid you to
114 deprive anyone else of these rights. For example, if you distribute
115 copies of GDK, you must give the recipients all the rights that you
116 have. You must make sure that they, too, receive or can get the source
117 code. And you must tell them their rights.
119 Also, for my own protection, we must make certain that everyone finds
120 out that there is no warranty for GDK. If GDK is modified by someone
121 else and passed on, we want their recipients to know that what they have
122 is not what we distributed, so that any problems introduced by others
123 will no reflect on our reputation.
125 The precise conditions of the licenses for GDK are found in the General
126 Public Licenses that accompanies it.
129 @node Overview, Initialization, Copying, Top
130 @comment node-name, next, previous, up
131 @chapter What is GDK?
134 GDK is designed as a wrapper library that lies on top of Xlib. It
135 performs many common and desired operations for a programmer instead
136 of the programmer having to explicitly ask for such functionality from
137 Xlib directly. For example, GDK provides a common interface to both
138 regular and shared memory XImage types. By doing so, an application
139 can nearly transparently use the fastest image type available. GDK
140 also provides routines for determining the best available color depth
141 and the best available visual which is not always the default visual
144 @node Initialization, Events, Overview, Top
145 @comment node-name, next, previous, up
146 @chapter Initialization and exit
147 @cindex Initialization
150 Initializing GDK is easy. Simply call @code{gdk_init} passing in the
151 @var{argc} and @var{argv} parameters. Exit is similarly easy. Just
152 call @code{gdk_exit}.
154 @deftypefun void gdk_init (int *@var{argc}, char ***@var{argv})
155 Initializes the GDK library. The arguments @var{argc} and @var{argv}
156 are scanned and any arguments that GDK recognizes are handled and
157 removed. The @var{argc} and @var{argv} parameters are the values
158 passed to @code{main} upon program invocation.
161 @deftypefun void gdk_exit (int @var{errorcode})
162 Exit GDK and perform any necessary cleanup. @code{gdk_exit} will call
163 the systems @code{exit} function passing @var{errorcode} as the
169 main (int argc, char *argv[])
171 /* Initialize GDK. */
172 gdk_init (&argc, &argv);
174 /* Exit from GDK...this call will never return. */
177 /* Keep compiler from issuing a warning */
183 @node Events, Visuals, Initialization, Top
184 @comment node-name, next, previous, up
185 @chapter Event handling
188 Events are the means by which GDK lets the programmer know of user
189 interaction. An event is normally a button or key press or some other
190 indirect user action, such as a the mouse cursor entering or leaving a
193 There exist only a few functions for getting events and event
194 information. These are @code{gdk_events_pending},
195 @code{gdk_event_get}, @code{gdk_events_record} and
196 @code{gdk_events_playback}. The latter two functions are useful for
197 automatic testing of a software package and should normally not be
200 @deftypefun gint gdk_events_pending (void)
201 Returns the number of events pending on the event queue.
204 @deftypefun gint gdk_event_get (GdkEvent *@var{event})
205 Return the next available event in the @var{event}
206 structure. @code{gdk_event_get} will return @code{TRUE} on success and
207 @code{FALSE} on failure. Success and failure is determined by whether
208 an event arrived before the timeout period expired.
211 @deftypefun void gdk_events_record (char *@var{filename})
212 Turn on recording of events. User events and certain system events will
213 be saved in the file named by the variable @var{filename}. This stream
214 of events can later be played back and ``should'' produce the same
215 results as when the original events were handled. However, the
216 programmer does need to be careful in that the state of the program must
217 be the same when @code{gdk_events_record} is called and when
218 @code{gdk_events_playback} is called. For this reason,
219 @code{gdk_events_record} is normally not called directly, but is instead
220 invoked indirectly by specifying the ``-record'' command line option.
223 @deftypefun void gdk_events_playback (char *@var{filename})
224 Start playback of events from a file. (See the above description of
225 @code{gdk_events_record}). Normally this function is not called directly
226 but is invoked by the ``-playback'' command line option.
229 @deftypefun void gdk_events_stop (void)
230 Stop recording and playback of events.
239 if (gdk_event_get (&event))
250 @node Visuals, Windows, Events, Top
251 @comment node-name, next, previous, up
252 @chapter Understanding and using visuals
255 @node Windows, Graphics Contexts, Visuals, Top
256 @comment node-name, next, previous, up
257 @chapter Creating and using windows
260 @node Graphics Contexts, Pixmaps, Windows, Top
261 @comment node-name, next, previous, up
262 @chapter Creating and modifying GCs
263 @cindex Graphics Contexts
266 @node Pixmaps, Images, Graphics Contexts, Top
267 @comment node-name, next, previous, up
268 @chapter Creating pixmaps
271 @node Images, Color, Pixmaps, Top
272 @comment node-name, next, previous, up
273 @chapter Creating images
276 @node Color, Fonts, Images, Top
277 @comment node-name, next, previous, up
278 @chapter Specifying color
281 @node Fonts, Drawing, Color, Top
282 @comment node-name, next, previous, up
283 @chapter Creating Fonts
286 @node Drawing, XInput Support, Fonts, Top
287 @comment node-name, next, previous, up
288 @chapter Drawing Commands
291 @node XInput Support, Miscellany, Drawing, Top
292 @comment node-name, next, previous, up
293 @chapter Using extended devices
295 @cindex Using extended device capabilities
296 @cindex Controlling extended devices
298 @node Miscellany, Examples, XInput Support, Top
299 @comment node-name, next, previous, up
303 @cindex Miscellaneous
306 @node Examples, Function Index, Miscellany, Top
307 @comment node-name, next, previous, up
312 @node Function Index, Concept Index, Examples, Top
313 @comment node-name, next, previous, up
314 @unnumbered Variable Index
318 @node Concept Index, , Function Index, Top
319 @comment node-name, next, previous, up
320 @unnumbered Concept Index