1XDrawLine(3)                    XLIB FUNCTIONS                    XDrawLine(3)
2
3
4

NAME

6       XDrawLine,  XDrawLines, XDrawSegments, XSegment - draw lines, polygons,
7       and line structure
8

SYNTAX

10       int XDrawLine(Display *display, Drawable d, GC gc, int x1, int y1,  int
11              x2, int y2);
12
13       int XDrawLines(Display *display, Drawable d, GC gc, XPoint *points, int
14              npoints, int mode);
15
16       int XDrawSegments(Display *display, Drawable d, GC gc,  XSegment  *seg‐
17              ments, int nsegments);
18

ARGUMENTS

20       d         Specifies the drawable.
21
22       display   Specifies the connection to the X server.
23
24       gc        Specifies the GC.
25
26       mode      Specifies  the coordinate mode.  You can pass CoordModeOrigin
27                 or CoordModePrevious.
28
29       npoints   Specifies the number of points in the array.
30
31       nsegments Specifies the number of segments in the array.
32
33       points    Specifies an array of points.
34
35       segments  Specifies an array of segments.
36
37       x1
38       y1
39       x2
40       y2        Specify the points (x1, y1) and (x2, y2) to be connected.
41

DESCRIPTION

43       The XDrawLine function uses the components of the specified GC to  draw
44       a  line  between the specified set of points (x1, y1) and (x2, y2).  It
45       does not perform joining at coincident endpoints.  For any given  line,
46       XDrawLine  does  not  draw a pixel more than once.  If lines intersect,
47       the intersecting pixels are drawn multiple times.
48
49       The XDrawLines function uses the components of the specified GC to draw
50       npoints-1  lines  between each pair of points (point[i], point[i+1]) in
51       the array of XPoint structures.  It draws the lines in the order listed
52       in the array.  The lines join correctly at all intermediate points, and
53       if the first and last points coincide, the first and  last  lines  also
54       join  correctly.   For any given line, XDrawLines does not draw a pixel
55       more than once.  If thin (zero line-width) lines intersect, the  inter‐
56       secting  pixels are drawn multiple times.  If wide lines intersect, the
57       intersecting pixels are drawn only once, as though the entire  PolyLine
58       protocol  request  were a single, filled shape.  CoordModeOrigin treats
59       all coordinates as relative to the origin, and CoordModePrevious treats
60       all coordinates after the first as relative to the previous point.
61
62       The XDrawSegments function draws multiple, unconnected lines.  For each
63       segment, XDrawSegments draws a line between (x1, y1) and (x2, y2).   It
64       draws the lines in the order listed in the array of XSegment structures
65       and does not perform joining at coincident endpoints.   For  any  given
66       line, XDrawSegments does not draw a pixel more than once.  If lines in‐
67       tersect, the intersecting pixels are drawn multiple times.
68
69       All three functions use  these  GC  components:  function,  plane-mask,
70       line-width,  line-style, cap-style, fill-style, subwindow-mode, clip-x-
71       origin, clip-y-origin, and clip-mask.   The  XDrawLines  function  also
72       uses  the  join-style GC component.  All three functions also use these
73       GC mode-dependent components: foreground,  background,  tile,  stipple,
74       tile-stipple-x-origin,  tile-stipple-y-origin,  dash-offset,  and dash-
75       list.
76
77       XDrawLine, XDrawLines,  and  XDrawSegments  can  generate  BadDrawable,
78       BadGC,  and  BadMatch  errors.  XDrawLines can also generate a BadValue
79       error.
80

STRUCTURES

82       The XSegment structure contains:
83
84       typedef struct {
85               short x1, y1, x2, y2;
86       } XSegment;
87
88       All x and y members are signed integers.  The width and height  members
89       are  16-bit  unsigned  integers.  You should be careful not to generate
90       coordinates and sizes out of the 16-bit ranges,  because  the  protocol
91       only has 16-bit fields for these values.
92

DIAGNOSTICS

94       BadDrawable
95                 A  value for a Drawable argument does not name a defined Win‐
96                 dow or Pixmap.
97
98       BadGC     A value for a GContext argument does not name a defined GCon‐
99                 text.
100
101       BadMatch  An InputOnly window is used as a Drawable.
102
103       BadMatch  Some  argument  or pair of arguments has the correct type and
104                 range but fails to match in some other way  required  by  the
105                 request.
106
107       BadValue  Some numeric value falls outside the range of values accepted
108                 by the request.  Unless a specific range is specified for  an
109                 argument,  the  full  range defined by the argument's type is
110                 accepted.  Any argument defined as a set of alternatives  can
111                 generate this error.
112

SEE ALSO

114       XDrawArc(3), XDrawPoint(3), XDrawRectangle(3)
115       Xlib - C Language X Interface
116
117
118
119X Version 11                    libX11 1.7.3.1                    XDrawLine(3)
Impressum