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