1XDrawArc(3) XLIB FUNCTIONS XDrawArc(3)
2
3
4
6 XDrawArc, XDrawArcs, XArc - draw arcs and arc structure
7
9 int XDrawArc(Display *display, Drawable d, GC gc, int x, int y, un‐
10 signed int width, unsigned int height, int angle1, int angle2);
11
12 int XDrawArcs(Display *display, Drawable d, GC gc, XArc *arcs, int
13 narcs);
14
16 angle1 Specifies the start of the arc relative to the three-o'clock
17 position from the center, in units of degrees * 64.
18
19 angle2 Specifies the path and extent of the arc relative to the
20 start of the arc, in units of degrees * 64.
21
22 arcs Specifies an array of arcs.
23
24 d Specifies the drawable.
25
26 display Specifies the connection to the X server.
27
28 gc Specifies the GC.
29
30 narcs Specifies the number of arcs in the array.
31
32 width
33 height Specify the width and height, which are the major and minor
34 axes of the arc.
35
36 x
37 y Specify the x and y coordinates, which are relative to the
38 origin of the drawable and specify the upper-left corner of
39 the bounding rectangle.
40
42 XDrawArc draws a single circular or elliptical arc, and XDrawArcs draws
43 multiple circular or elliptical arcs. Each arc is specified by a rec‐
44 tangle and two angles. The center of the circle or ellipse is the cen‐
45 ter of the rectangle, and the major and minor axes are specified by the
46 width and height. Positive angles indicate counterclockwise motion,
47 and negative angles indicate clockwise motion. If the magnitude of an‐
48 gle2 is greater than 360 degrees, XDrawArc or XDrawArcs truncates it to
49 360 degrees.
50
51 For an arc specified as [x,y,width,height,angle1,angle2], the origin of
52 the major and minor axes is at [x+w_i_d2_t_h_,y+h_e_i_g2_h_t_], and the infinitely
53 thin path describing the entire circle or ellipse intersects the hori‐
54 zontal axis at [x,y+h_e_i_g2_h_t_] and [x+width,y+h_e_i_g2_h_t_] and intersects the
55 vertical axis at [x+w_i_d2_t_h_,y] and [x+w_i_d2_t_h_,y+height]. These coordinates
56 can be fractional and so are not truncated to discrete coordinates.
57 The path should be defined by the ideal mathematical path. For a wide
58 line with line-width lw, the bounding outlines for filling are given by
59 the two infinitely thin paths consisting of all points whose perpendic‐
60 ular distance from the path of the circle/ellipse is equal to lw/2
61 (which may be a fractional value). The cap-style and join-style are
62 applied the same as for a line corresponding to the tangent of the cir‐
63 cle/ellipse at the endpoint.
64
65 For an arc specified as [x,y,width,height,angle1,angle2], the angles
66 must be specified in the effectively skewed coordinate system of the
67 ellipse (for a circle, the angles and coordinate systems are identi‐
68 cal). The relationship between these angles and angles expressed in
69 the normal coordinate system of the screen (as measured with a protrac‐
70 tor) is as follows:
71
72 skewed-angle=atan⎛⎝tan(normal-angle)*h_we_ii_dg_th_ht_⎞⎠+adjust
73
74 The skewed-angle and normal-angle are expressed in radians (rather than
75 in degrees scaled by 64) in the range [0,2π] and where atan returns a
76 value in the range [−π2_,π2_] and adjust is:
77
78 l l. 0 for normal-angle in the range [0,π2_] π for normal-angle in
79 the range [π2_,3_π2_] 2π for normal-angle in the range [3_π2_,2π]
80
81 For any given arc, XDrawArc and XDrawArcs do not draw a pixel more than
82 once. If two arcs join correctly and if the line-width is greater than
83 zero and the arcs intersect, XDrawArc and XDrawArcs do not draw a pixel
84 more than once. Otherwise, the intersecting pixels of intersecting
85 arcs are drawn multiple times. Specifying an arc with one endpoint and
86 a clockwise extent draws the same pixels as specifying the other end‐
87 point and an equivalent counterclockwise extent, except as it affects
88 joins.
89
90 If the last point in one arc coincides with the first point in the fol‐
91 lowing arc, the two arcs will join correctly. If the first point in
92 the first arc coincides with the last point in the last arc, the two
93 arcs will join correctly. By specifying one axis to be zero, a hori‐
94 zontal or vertical line can be drawn. Angles are computed based solely
95 on the coordinate system and ignore the aspect ratio.
96
97 Both functions use these GC components: function, plane-mask, line-
98 width, line-style, cap-style, join-style, fill-style, subwindow-mode,
99 clip-x-origin, clip-y-origin, and clip-mask. They also use these GC
100 mode-dependent components: foreground, background, tile, stipple, tile-
101 stipple-x-origin, tile-stipple-y-origin, dash-offset, and dash-list.
102
103 XDrawArc and XDrawArcs can generate BadDrawable, BadGC, and BadMatch
104 errors.
105
107 The XArc structure contains:
108
109 typedef struct {
110 short x, y;
111 unsigned short width, height;
112 short angle1, angle2; /* Degrees * 64 */
113 } XArc;
114
115 All x and y members are signed integers. The width and height members
116 are 16-bit unsigned integers. You should be careful not to generate
117 coordinates and sizes out of the 16-bit ranges, because the protocol
118 only has 16-bit fields for these values.
119
121 BadDrawable
122 A value for a Drawable argument does not name a defined Win‐
123 dow or Pixmap.
124
125 BadGC A value for a GContext argument does not name a defined GCon‐
126 text.
127
128 BadMatch An InputOnly window is used as a Drawable.
129
130 BadMatch Some argument or pair of arguments has the correct type and
131 range but fails to match in some other way required by the
132 request.
133
135 XDrawLine(3), XDrawPoint(3), XDrawRectangle(3)
136 Xlib - C Language X Interface
137
138
139
140X Version 11 libX11 1.7.0 XDrawArc(3)