1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 functions for drawing points, lines, arcs, and text.
7 <!-- ##### SECTION Long_Description ##### -->
9 These functions provide support for drawing points, lines, arcs and text
10 onto what are called 'drawables'. Drawables, as the name suggests, are things
11 which support drawing onto them, and are either #GdkWindow or #GdkPixmap
15 Many of the drawing operations take a #GdkGC argument, which represents a
16 graphics context. This #GdkGC contains a number of drawing attributes such
17 as foreground color, background color and line width, and is used to reduce
18 the number of arguments needed for each drawing operation. See the
19 <link linkend="gdk-Graphics-Contexts">Graphics Contexts</link> section for
23 <!-- ##### SECTION See_Also ##### -->
28 <!-- ##### STRUCT GdkDrawable ##### -->
30 An opaque structure representing an object that can be
31 drawn onto. This can be a #GdkPixmap, a #GdkBitmap,
37 <!-- ##### FUNCTION gdk_drawable_ref ##### -->
46 <!-- ##### FUNCTION gdk_drawable_unref ##### -->
54 <!-- ##### FUNCTION gdk_drawable_set_data ##### -->
65 <!-- ##### FUNCTION gdk_drawable_get_data ##### -->
75 <!-- ##### FUNCTION gdk_drawable_get_visual ##### -->
84 <!-- ##### FUNCTION gdk_drawable_set_colormap ##### -->
93 <!-- ##### FUNCTION gdk_drawable_get_colormap ##### -->
102 <!-- ##### FUNCTION gdk_drawable_get_depth ##### -->
111 <!-- ##### FUNCTION gdk_drawable_get_size ##### -->
121 <!-- ##### FUNCTION gdk_drawable_get_clip_region ##### -->
130 <!-- ##### FUNCTION gdk_drawable_get_visible_region ##### -->
139 <!-- ##### FUNCTION gdk_draw_point ##### -->
141 Draws a point, using the foreground color and other attributes of the #GdkGC.
144 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
146 @x: the x coordinate of the point.
147 @y: the y coordinate of the point.
150 <!-- ##### FUNCTION gdk_draw_points ##### -->
152 Draws a number of points, using the foreground color and other attributes of
156 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
158 @points: an array of #GdkPoint structures.
159 @npoints: the number of points to be drawn.
162 <!-- ##### FUNCTION gdk_draw_line ##### -->
164 Draws a line, using the foreground color and other attributes of the #GdkGC.
167 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
169 @x1: the x coordinate of the start point.
170 @y1: the y coordinate of the start point.
171 @x2: the x coordinate of the end point.
172 @y2: the y coordinate of the end point.
175 <!-- ##### FUNCTION gdk_draw_lines ##### -->
177 Draws a series of lines connecting the given points.
178 The way in which joins between lines are draw is determined by the
179 #GdkCapStyle value in the #GdkGC. This can be set with
180 gdk_gc_set_line_attributes().
183 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
185 @points: an array of #GdkPoint structures specifying the endpoints of the
187 @npoints: the size of the @points array.
190 <!-- ##### FUNCTION gdk_draw_segments ##### -->
192 Draws a number of unconnected lines.
195 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
197 @segs: an array of #GdkSegment structures specifying the start and end points
198 of the lines to be drawn,
199 @nsegs: the number of line segments to draw, i.e. the size of the @segs array.
202 <!-- ##### STRUCT GdkSegment ##### -->
204 Specifies the start and end point of a line for use by the gdk_draw_segments()
208 @x1: the x coordinate of the start point.
209 @y1: the y coordinate of the start point.
210 @x2: the x coordinate of the end point.
211 @y2: the y coordinate of the end point.
213 <!-- ##### FUNCTION gdk_draw_rectangle ##### -->
215 Draws a rectangular outline or filled rectangle, using the foreground color
216 and other attributes of the #GdkGC.
220 A rectangle drawn filled is 1 pixel smaller in both dimensions than a rectangle
221 outlined. Calling <literal>gdk_draw_rectangle (window, gc, TRUE, 0, 0, 20, 20)</literal> results
222 in a filled rectangle 20 pixels wide and 20 pixels high. Calling
223 <literal>gdk_draw_rectangle (window, gc, FALSE, 0, 0, 20, 20)</literal> results in an outlined
224 rectangle with corners at (0, 0), (0, 20), (20, 20), and (20, 0), which
225 makes it 21 pixels wide and 21 pixels high.
229 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
231 @filled: %TRUE if the rectangle should be filled.
232 @x: the x coordinate of the left edge of the rectangle.
233 @y: the y coordinate of the top edge of the rectangle.
234 @width: the width of the rectangle.
235 @height: the height of the rectangle.
238 <!-- ##### FUNCTION gdk_draw_arc ##### -->
240 Draws an arc or a filled 'pie slice'. The arc is defined by the bounding
241 rectangle of the entire ellipse, and the start and end angles of the part of
242 the ellipse to be drawn.
245 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
247 @filled: %TRUE if the arc should be filled, producing a 'pie slice'.
248 @x: the x coordinate of the left edge of the bounding rectangle.
249 @y: the y coordinate of the top edge of the bounding rectangle.
250 @width: the width of the bounding rectangle.
251 @height: the height of the bounding rectangle.
252 @angle1: the start angle of the arc, relative to the 3 o'clock position,
253 counter-clockwise, in 1/64ths of a degree.
254 @angle2: the end angle of the arc, relative to @angle1, in 1/64ths of a degree.
257 <!-- ##### FUNCTION gdk_draw_polygon ##### -->
259 Draws an outlined or filled polygon.
262 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
264 @filled: %TRUE if the polygon should be filled. The polygon is closed
265 automatically, connecting the last point to the first point if necessary.
266 @points: an array of #GdkPoint structures specifying the points making up the
268 @npoints: the number of points.
271 <!-- ##### FUNCTION gdk_draw_glyphs ##### -->
284 <!-- ##### FUNCTION gdk_draw_layout_line ##### -->
296 <!-- ##### FUNCTION gdk_draw_layout_line_with_colors ##### -->
310 <!-- ##### FUNCTION gdk_draw_layout ##### -->
322 <!-- ##### FUNCTION gdk_draw_layout_with_colors ##### -->
336 <!-- ##### FUNCTION gdk_draw_string ##### -->
338 Draws a string of characters in the given font or fontset.
341 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
344 @x: the x coordinate of the left edge of the text.
345 @y: the y coordinate of the baseline of the text.
346 @string: the string of characters to draw.
349 <!-- ##### FUNCTION gdk_draw_text ##### -->
351 Draws a number of characters in the given font or fontset.
354 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
357 @x: the x coordinate of the left edge of the text.
358 @y: the y coordinate of the baseline of the text.
359 @text: the characters to draw.
360 @text_length: the number of characters of @text to draw.
363 <!-- ##### FUNCTION gdk_draw_text_wc ##### -->
365 Draws a number of wide characters using the given font of fontset.
366 If the font is a 1-byte font, the string is converted into 1-byte characters
367 (discarding the high bytes) before output.
370 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
373 @x: the x coordinate of the left edge of the text.
374 @y: the y coordinate of the baseline of the text.
375 @text: the wide characters to draw.
376 @text_length: the number of characters to draw.
379 <!-- ##### MACRO gdk_draw_pixmap ##### -->
381 Draws a pixmap, or a part of a pixmap, onto another drawable.
384 <!-- # Unused Parameters # -->
385 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
387 @src: the source #GdkPixmap to draw.
388 @xsrc: the left edge of the source rectangle within @src.
389 @ysrc: the top of the source rectangle within @src.
390 @xdest: the x coordinate of the destination within @drawable.
391 @ydest: the y coordinate of the destination within @drawable.
392 @width: the width of the area to be copied, or -1 to make the area extend to
393 the right edge of the source pixmap.
394 @height: the height of the area to be copied, or -1 to make the area extend
395 to the bottom edge of the source pixmap.
398 <!-- ##### FUNCTION gdk_draw_drawable ##### -->
414 <!-- ##### FUNCTION gdk_draw_image ##### -->
416 Draws a #GdkImage onto a drawable.
417 The depth of the #GdkImage must match the depth of the #GdkDrawable.
420 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
422 @image: the #GdkImage to draw.
423 @xsrc: the left edge of the source rectangle within @image.
424 @ysrc: the top of the source rectangle within @image.
425 @xdest: the x coordinate of the destination within @drawable.
426 @ydest: the y coordinate of the destination within @drawable.
427 @width: the width of the area to be copied, or -1 to make the area extend to
428 the right edge of @image.
429 @height: the height of the area to be copied, or -1 to make the area extend
430 to the bottom edge of @image.
433 <!-- ##### FUNCTION gdk_drawable_get_image ##### -->