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 <!-- ##### ENUM GdkFill ##### -->
30 Used to specify the way in which drawing operations are performed.
31 See gdk_gc_set_fill().
34 @GDK_SOLID: graphics are drawn in a solid color, usually the foreground color
36 @GDK_TILED: graphics are drawn using a tile pixmap. See gdk_gc_set_tile().
37 @GDK_STIPPLED: graphics are drawn with a stipple (a pixmap with a depth of 1).
38 Bits set in the stipple are drawn in the foreground color. Bits not set in the
39 stipple are left as they are. See gdk_gc_set_stipple().
40 @GDK_OPAQUE_STIPPLED: graphics are drawn with a stipple, as in @GDK_STIPPLED,
41 except that the bits not set in the stipple are drawn in the background color
42 instead of being left as they are. See gdk_gc_set_stipple().
44 <!-- ##### ENUM GdkFillRule ##### -->
46 The method for determining which pixels are included in a region, when
47 creating a #GdkRegion from a polygon.
48 The fill rule is only relevant for polygons which overlap themselves.
51 @GDK_EVEN_ODD_RULE: areas which are overlapped an odd number of times are
52 included in the region, while areas overlapped an even number of times are not.
53 @GDK_WINDING_RULE: overlapping areas are always included.
56 <!-- ##### ENUM GdkLineStyle ##### -->
58 Used to specify how lines are drawn. See gdk_gc_set_line_attributes().
61 @GDK_LINE_SOLID: lines are drawn in a solid color, the foreground color.
62 @GDK_LINE_ON_OFF_DASH: dashed lines are drawn, with the pixels between the
63 dashes left as they are. The #GdkCapStyle is applied to each end of the dashes.
64 @GDK_LINE_DOUBLE_DASH: dashed lines are drawn, alternating between the
65 foreground and background colors. The %GDK_CAP_BUTT style is used where
68 <!-- ##### ENUM GdkCapStyle ##### -->
70 Used to specify how the ends of lines and dashes are drawn.
71 See gdk_gc_set_line_attributes().
74 @GDK_CAP_NOT_LAST: this is equivalent to %GDK_CAP_BUTT, except that for a line
75 width of 0 the final endpoint is not drawn.
76 @GDK_CAP_BUTT: the ends of the line are square with no projection beyond the
78 @GDK_CAP_ROUND: the ends of the line are rounded using a circular arc centered
79 on the endpoint. This is equivalent to %GDK_CAP_BUTT when the line width is 0.
80 @GDK_CAP_PROJECTING: the ends of the line are square, but project beyond the
81 endpoint to a distance of half the line width.
82 This is equivalent to %GDK_CAP_BUTT when the line width is 0.
84 <!-- ##### ENUM GdkJoinStyle ##### -->
86 Used to specify how the the joins between lines are drawn.
87 See gdk_gc_set_line_attributes().
90 @GDK_JOIN_MITER: the ends of the lines are extended to meet at a point.
91 If the angle between the lines is less than 11 degrees, %GDK_JOIN_BEVEL is
93 @GDK_JOIN_ROUND: the ends of the lines are rounded with a circular arc
94 centered on the joinpoint, with a diameter equal to the line width.
95 @GDK_JOIN_BEVEL: the lines have %GDK_CAP_BUTT cap styles, with the triangular
98 <!-- ##### FUNCTION gdk_draw_point ##### -->
100 Draws a point, using the foreground color and other attributes of the #GdkGC.
103 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
105 @x: the x coordinate of the point.
106 @y: the y coordinate of the point.
109 <!-- ##### FUNCTION gdk_draw_line ##### -->
111 Draws a line, using the foreground color and other attributes of the #GdkGC.
114 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
116 @x1: the x coordinate of the start point.
117 @y1: the y coordinate of the start point.
118 @x2: the x coordinate of the end point.
119 @y2: the y coordinate of the end point.
122 <!-- ##### FUNCTION gdk_draw_rectangle ##### -->
124 Draws a rectangular outline or filled rectangle, using the foreground color
125 and other attributes of the #GdkGC.
129 A rectangle drawn filled is 1 pixel smaller in both dimensions than a rectangle
130 outlined. Calling gdk_draw_rectangle (window, gc, TRUE, 0, 0, 20, 20) results
131 in a filled rectangle 20 pixels wide and 20 pixels high. Calling
132 gdk_draw_rectangle (window, gc, FALSE, 0, 0, 20, 20) results in an outlined
133 rectangle with corners at (0, 0), (0, 20), (20, 20), and (20, 0), which
134 makes it 21 pixels wide and 21 pixels high.
138 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
140 @filled: TRUE if the rectangle should be filled.
141 @x: the x coordinate of the left edge of the rectangle.
142 @y: the y coordinate of the top edge of the rectangle.
143 @width: the width of the rectangle.
144 @height: the height of the rectangle.
147 <!-- ##### FUNCTION gdk_draw_arc ##### -->
149 Draws an arc or a filled 'pie slice'. The arc is defined by the bounding
150 rectangle of the entire ellipse, and the start and end angles of the part of
151 the ellipse to be drawn.
154 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
156 @filled: TRUE if the arc should be filled, producing a 'pie slice'.
157 @x: the x coordinate of the left edge of the bounding rectangle.
158 @y: the y coordinate of the top edge of the bounding rectangle.
159 @width: the width of the bounding rectangle.
160 @height: the height of the bounding rectangle.
161 @angle1: the start angle of the arc, relative to the 3 o'clock position,
162 counter-clockwise, in 1/64ths of a degree.
163 @angle2: the end angle of the arc, similar to @angle1.
166 <!-- ##### FUNCTION gdk_draw_polygon ##### -->
168 Draws an outlined or filled polygon.
171 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
173 @filled: TRUE if the polygon should be filled. The polygon is closed
174 automatically, connecting the last point to the first point if necessary.
175 @points: an array of #GdkPoint structures specifying the points making up the
177 @npoints: the number of points.
180 <!-- ##### FUNCTION gdk_draw_string ##### -->
182 Draws a string of characters in the given font or fontset.
185 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
188 @x: the x coordinate of the left edge of the text.
189 @y: the y coordinate of the baseline of the text.
190 @string: the string of characters to draw.
193 <!-- ##### FUNCTION gdk_draw_text ##### -->
195 Draws a number of characters in the given font or fontset.
198 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
201 @x: the x coordinate of the left edge of the text.
202 @y: the y coordinate of the baseline of the text.
203 @text: the characters to draw.
204 @text_length: the number of characters of @text to draw.
207 <!-- ##### FUNCTION gdk_draw_text_wc ##### -->
209 Draws a number of wide characters using the given font of fontset.
210 If the font is a 1-byte font, the string is converted into 1-byte characters
211 (discarding the high bytes) before output.
214 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
217 @x: the x coordinate of the left edge of the text.
218 @y: the y coordinate of the baseline of the text.
219 @text: the wide characters to draw.
220 @text_length: the number of characters to draw.
223 <!-- ##### FUNCTION gdk_draw_pixmap ##### -->
225 Draws a pixmap, or a part of a pixmap, onto another drawable.
228 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
230 @src: the source #GdkPixmap to draw.
231 @xsrc: the left edge of the source rectangle within @src.
232 @ysrc: the top of the source rectangle within @src.
233 @xdest: the x coordinate of the destination within @drawable.
234 @ydest: the y coordinate of the destination within @drawable.
235 @width: the width of the area to be copied, or -1 to make the area extend to
236 the right edge of the source pixmap.
237 @height: the height of the area to be copied, or -1 to make the area extend
238 to the bottom edge of the source pixmap.
241 <!-- ##### FUNCTION gdk_draw_bitmap ##### -->
246 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
257 <!-- ##### FUNCTION gdk_draw_image ##### -->
262 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
273 <!-- ##### FUNCTION gdk_draw_points ##### -->
275 Draws a number of points, using the foreground color and other attributes of
279 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
281 @points: an array of #GdkPoint structures.
282 @npoints: the number of points to be drawn.
285 <!-- ##### FUNCTION gdk_draw_segments ##### -->
290 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
296 <!-- ##### STRUCT GdkSegment ##### -->
306 <!-- ##### FUNCTION gdk_draw_lines ##### -->
308 Draws a series of lines connecting the given points.
309 The way in which joins between lines are draw is determined by the
310 #GdkCapStyle value in the #GdkGC. This can be set with
311 gdk_gc_set_line_attributes().
314 @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
316 @points: an array of #GdkPoint structures specifying the endpoints of the
318 @npoints: the number of endpoints.