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 delim %% XDrawArc draws a single circular or elliptical arc, and
43 XDrawArcs draws multiple circular or elliptical arcs. Each arc is
44 specified by a rectangle and two angles. The center of the circle or
45 ellipse is the center of the rectangle, and the major and minor axes
46 are specified by the width and height. Positive angles indicate coun‐
47 terclockwise motion, and negative angles indicate clockwise motion. If
48 the magnitude of angle2 is greater than 360 degrees, XDrawArc or
49 XDrawArcs truncates it to 360 degrees.
50
51 For an arc specified as %[ ~x, ~y, ~width , ~height, ~angle1, ~angle2
52 ]%, the origin of the major and minor axes is at % [ x +^ {width over
53 2} , ~y +^ {height over 2} ]%, and the infinitely thin path describing
54 the entire circle or ellipse intersects the horizontal axis at % [ x,
55 ~y +^ {height over 2} ]% and % [ x +^ width , ~y +^ { height over 2 }]
56 % and intersects the vertical axis at % [ x +^ { width over 2 } , ~y ]%
57 and % [ x +^ { width over 2 }, ~y +^ height ]%. These coordinates can
58 be fractional and so are not truncated to discrete coordinates. The
59 path should be defined by the ideal mathematical path. For a wide line
60 with line-width lw, the bounding outlines for filling are given by the
61 two infinitely thin paths consisting of all points whose perpendicular
62 distance from the path of the circle/ellipse is equal to lw/2 (which
63 may be a fractional value). The cap-style and join-style are applied
64 the same as for a line corresponding to the tangent of the circle/el‐
65 lipse at the endpoint.
66
67 For an arc specified as % [ ~x, ~y, ~width, ~height, ~angle1, ~angle2
68 ]%, the angles must be specified in the effectively skewed coordinate
69 system of the ellipse (for a circle, the angles and coordinate systems
70 are identical). The relationship between these angles and angles ex‐
71 pressed in the normal coordinate system of the screen (as measured with
72 a protractor) is as follows:
73
74 % roman "skewed-angle" ~ = ~ atan left ( tan ( roman "normal-angle" )
75 * width over height right ) +^ adjust%
76
77 The skewed-angle and normal-angle are expressed in radians (rather than
78 in degrees scaled by 64) in the range % [ 0 , ~2 pi ]% and where atan
79 returns a value in the range % [ - pi over 2 , ~pi over 2 ] % and ad‐
80 just is:
81
82 %0% for normal-angle in the range % [ 0 , ~pi over 2 ]%
83 %pi% for normal-angle in the range % [ pi over 2 , ~{3 pi} over 2 ]%
84 %2 pi% for normal-angle in the range % [ {3 pi} over 2 , ~2 pi ]%
85
86 For any given arc, XDrawArc and XDrawArcs do not draw a pixel more than
87 once. If two arcs join correctly and if the line-width is greater than
88 zero and the arcs intersect, XDrawArc and XDrawArcs do not draw a pixel
89 more than once. Otherwise, the intersecting pixels of intersecting
90 arcs are drawn multiple times. Specifying an arc with one endpoint and
91 a clockwise extent draws the same pixels as specifying the other end‐
92 point and an equivalent counterclockwise extent, except as it affects
93 joins.
94
95 If the last point in one arc coincides with the first point in the fol‐
96 lowing arc, the two arcs will join correctly. If the first point in
97 the first arc coincides with the last point in the last arc, the two
98 arcs will join correctly. By specifying one axis to be zero, a hori‐
99 zontal or vertical line can be drawn. Angles are computed based solely
100 on the coordinate system and ignore the aspect ratio.
101
102 Both functions use these GC components: function, plane-mask, line-
103 width, line-style, cap-style, join-style, fill-style, subwindow-mode,
104 clip-x-origin, clip-y-origin, and clip-mask. They also use these GC
105 mode-dependent components: foreground, background, tile, stipple, tile-
106 stipple-x-origin, tile-stipple-y-origin, dash-offset, and dash-list.
107
108 XDrawArc and XDrawArcs can generate BadDrawable, BadGC, and BadMatch
109 errors.
110
112 The XArc structure contains:
113
114 typedef struct {
115 short x, y;
116 unsigned short width, height;
117 short angle1, angle2; /* Degrees * 64 */
118 } XArc;
119
120 All x and y members are signed integers. The width and height members
121 are 16-bit unsigned integers. You should be careful not to generate
122 coordinates and sizes out of the 16-bit ranges, because the protocol
123 only has 16-bit fields for these values.
124
126 BadDrawable
127 A value for a Drawable argument does not name a defined Win‐
128 dow or Pixmap.
129
130 BadGC A value for a GContext argument does not name a defined GCon‐
131 text.
132
133 BadMatch An InputOnly window is used as a Drawable.
134
135 BadMatch Some argument or pair of arguments has the correct type and
136 range but fails to match in some other way required by the
137 request.
138
140 XDrawLine(3), XDrawPoint(3), XDrawRectangle(3)
141 Xlib - C Language X Interface
142
143
144
145X Version 11 libX11 1.8.7 XDrawArc(3)