Imported Upstream version 1.6.2
[platform/upstream/libX11.git] / man / XCreateGC.man
1 '\" t
2 .\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1994, 1996 X Consortium
3 .\"
4 .\" Permission is hereby granted, free of charge, to any person obtaining
5 .\" a copy of this software and associated documentation files (the
6 .\" "Software"), to deal in the Software without restriction, including
7 .\" without limitation the rights to use, copy, modify, merge, publish,
8 .\" distribute, sublicense, and/or sell copies of the Software, and to
9 .\" permit persons to whom the Software is furnished to do so, subject to
10 .\" the following conditions:
11 .\"
12 .\" The above copyright notice and this permission notice shall be included
13 .\" in all copies or substantial portions of the Software.
14 .\"
15 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 .\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 .\" OTHER DEALINGS IN THE SOFTWARE.
22 .\"
23 .\" Except as contained in this notice, the name of the X Consortium shall
24 .\" not be used in advertising or otherwise to promote the sale, use or
25 .\" other dealings in this Software without prior written authorization
26 .\" from the X Consortium.
27 .\"
28 .\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991 by
29 .\" Digital Equipment Corporation
30 .\"
31 .\" Portions Copyright \(co 1990, 1991 by
32 .\" Tektronix, Inc.
33 .\"
34 .\" Permission to use, copy, modify and distribute this documentation for
35 .\" any purpose and without fee is hereby granted, provided that the above
36 .\" copyright notice appears in all copies and that both that copyright notice
37 .\" and this permission notice appear in all copies, and that the names of
38 .\" Digital and Tektronix not be used in in advertising or publicity pertaining
39 .\" to this documentation without specific, written prior permission.
40 .\" Digital and Tektronix makes no representations about the suitability
41 .\" of this documentation for any purpose.
42 .\" It is provided ``as is'' without express or implied warranty.
43 .\" 
44 .\"
45 .ds xT X Toolkit Intrinsics \- C Language Interface
46 .ds xW Athena X Widgets \- C Language X Toolkit Interface
47 .ds xL Xlib \- C Language X Interface
48 .ds xC Inter-Client Communication Conventions Manual
49 .na
50 .de Ds
51 .nf
52 .\\$1D \\$2 \\$1
53 .ft CW
54 .\".ps \\n(PS
55 .\".if \\n(VS>=40 .vs \\n(VSu
56 .\".if \\n(VS<=39 .vs \\n(VSp
57 ..
58 .de De
59 .ce 0
60 .if \\n(BD .DF
61 .nr BD 0
62 .in \\n(OIu
63 .if \\n(TM .ls 2
64 .sp \\n(DDu
65 .fi
66 ..
67 .de IN          \" send an index entry to the stderr
68 ..
69 .de Pn
70 .ie t \\$1\fB\^\\$2\^\fR\\$3
71 .el \\$1\fI\^\\$2\^\fP\\$3
72 ..
73 .de ZN
74 .ie t \fB\^\\$1\^\fR\\$2
75 .el \fI\^\\$1\^\fP\\$2
76 ..
77 .de hN
78 .ie t <\fB\\$1\fR>\\$2
79 .el <\fI\\$1\fP>\\$2
80 ..
81 .ny0
82 '\" t
83 .TH XCreateGC __libmansuffix__ __xorgversion__ "XLIB FUNCTIONS"
84 .SH NAME
85 XCreateGC, XCopyGC, XChangeGC, XGetGCValues, XFreeGC, XGContextFromGC, XGCValues \- create or free graphics contexts and graphics context structure
86 .SH SYNTAX
87 .HP
88 GC XCreateGC\^(\^Display *\fIdisplay\fP\^, Drawable \fId\fP\^, unsigned long
89 \fIvaluemask\fP\^, XGCValues *\^\fIvalues\fP\^); 
90 .HP
91 int XCopyGC\^(\^Display *\fIdisplay\fP\^, GC \fIsrc\fP\^,
92 unsigned long \fIvaluemask\fP\^, GC \fIdest\fP\^); 
93 .HP
94 int XChangeGC\^(\^Display *\fIdisplay\fP\^, GC \fIgc\fP\^, unsigned long
95 \fIvaluemask\fP\^, XGCValues *\^\fIvalues\fP\^); 
96 .HP
97 Status XGetGCValues\^(\^Display *\fIdisplay\fP\^, GC \fIgc\fP\^, unsigned long
98 \fIvaluemask\fP\^, XGCValues *\fIvalues_return\fP\^); 
99 .HP
100 int XFreeGC\^(\^Display *\fIdisplay\fP\^, GC \fIgc\fP\^); 
101 .HP
102 GContext XGContextFromGC\^(\^GC \fIgc\fP\^); 
103 .SH ARGUMENTS
104 .IP \fId\fP 1i
105 Specifies the drawable. 
106 .IP \fIdest\fP 1i
107 Specifies the destination GC.
108 .IP \fIdisplay\fP 1i
109 Specifies the connection to the X server.
110 .IP \fIgc\fP 1i
111 Specifies the GC.
112 .IP \fIsrc\fP 1i
113 Specifies the components of the source GC.
114 .ds Vm set, copied, changed, or returned 
115 .IP \fIvaluemask\fP 1i
116 Specifies which components in the GC are to be \*(Vm. 
117 This argument is the bitwise inclusive OR of zero or more of the valid
118 GC component mask bits.
119 .IP \fIvalues\fP 1i
120 Specifies any values as specified by the valuemask.
121 .IP \fIvalues_return\fP 1i
122 Returns the GC values in the specified
123 .ZN XGCValues 
124 structure.
125 .SH DESCRIPTION
126 The
127 .ZN XCreateGC
128 function creates a graphics context and returns a GC.
129 The GC can be used with any destination drawable having the same root
130 and depth as the specified drawable.
131 Use with other drawables results in a
132 .ZN BadMatch
133 error.
134 .LP
135 .ZN XCreateGC
136 can generate
137 .ZN BadAlloc ,
138 .ZN BadDrawable ,
139 .ZN BadFont ,
140 .ZN BadMatch ,
141 .ZN BadPixmap ,
142 and
143 .ZN BadValue 
144 errors.
145 .LP
146 The
147 .ZN XCopyGC
148 function copies the specified components from the source GC
149 to the destination GC.
150 The source and destination GCs must have the same root and depth,
151 or a
152 .ZN BadMatch
153 error results.
154 The valuemask specifies which component to copy, as for
155 .ZN XCreateGC .
156 .LP
157 .ZN XCopyGC
158 can generate
159 .ZN BadAlloc ,
160 .ZN BadGC ,
161 and
162 .ZN BadMatch
163 errors.
164 .LP
165 The
166 .ZN XChangeGC
167 function changes the components specified by valuemask for
168 the specified GC.
169 The values argument contains the values to be set.
170 The values and restrictions are the same as for 
171 .ZN XCreateGC .
172 Changing the clip-mask overrides any previous 
173 .ZN XSetClipRectangles
174 request on the context. 
175 Changing the dash-offset or dash-list
176 overrides any previous 
177 .ZN XSetDashes
178 request on the context.
179 The order in which components are verified and altered is server dependent.
180 If an error is generated, a subset of the components may have been altered.
181 .LP
182 .ZN XChangeGC
183 can generate
184 .ZN BadAlloc ,
185 .ZN BadFont ,
186 .ZN BadGC ,
187 .ZN BadMatch ,
188 .ZN BadPixmap ,
189 and
190 .ZN BadValue 
191 errors.
192 .LP
193 The
194 .ZN XGetGCValues
195 function returns the components specified by valuemask for the specified GC.
196 If the valuemask contains a valid set of GC mask bits
197 .Pn ( GCFunction ,
198 .ZN GCPlaneMask ,
199 .ZN GCForeground ,
200 .ZN GCBackground ,
201 .ZN GCLineWidth ,
202 .ZN GCLineStyle ,
203 .ZN GCCapStyle ,
204 .ZN GCJoinStyle ,
205 .ZN GCFillStyle ,
206 .ZN GCFillRule ,
207 .ZN GCTile ,
208 .ZN GCStipple ,
209 .ZN GCTileStipXOrigin ,
210 .ZN GCTileStipYOrigin ,
211 .ZN GCFont ,
212 .ZN GCSubwindowMode ,
213 .ZN GCGraphicsExposures ,
214 .ZN GCClipXOrigin ,
215 .ZN GCCLipYOrigin ,
216 .ZN GCDashOffset ,
217 or
218 .ZN GCArcMode )
219 and no error occurs,
220 .ZN XGetGCValues
221 sets the requested components in values_return and returns a nonzero status.
222 Otherwise, it returns a zero status.
223 Note that the clip-mask and dash-list (represented by the
224 .ZN GCClipMask
225 and 
226 .ZN GCDashList
227 bits, respectively, in the valuemask)
228 cannot be requested.
229 Also note that an invalid resource ID (with one or more of the three
230 most significant bits set to 1) will be returned for
231 .ZN GCFont ,
232 .ZN GCTile ,
233 and
234 .ZN GCStipple
235 if the component has never been explicitly set by the client.
236 .LP
237 The
238 .ZN XFreeGC
239 function destroys the specified GC as well as all the associated storage.
240 .LP
241 .ZN XFreeGC
242 can generate a
243 .ZN BadGC 
244 error.
245 .SH STRUCTURES
246 The
247 .ZN XGCValues
248 structure contains:
249 .LP
250 .LP
251 /\&* GC attribute value mask bits */
252 .TS
253 lw(.5i) lw(2.5i) lw(.75i).
254 T{
255 \&#define
256 T}      T{
257 .ZN GCFunction
258 T}      T{
259 (1L<<0)
260 T}
261 T{
262 \&#define
263 T}      T{
264 .ZN GCPlaneMask
265 T}      T{
266 (1L<<1)
267 T}
268 T{
269 \&#define
270 T}      T{
271 .ZN GCForeground
272 T}      T{
273 (1L<<2)
274 T}
275 T{
276 \&#define
277 T}      T{
278 .ZN GCBackground
279 T}      T{
280 (1L<<3)
281 T}
282 T{
283 \&#define
284 T}      T{
285 .ZN GCLineWidth
286 T}      T{
287 (1L<<4)
288 T}
289 T{
290 \&#define
291 T}      T{
292 .ZN GCLineStyle
293 T}      T{
294 (1L<<5)
295 T}
296 T{
297 \&#define
298 T}      T{
299 .ZN GCCapStyle
300 T}      T{
301 (1L<<6)
302 T}
303 T{
304 \&#define
305 T}      T{
306 .ZN GCJoinStyle
307 T}      T{
308 (1L<<7)
309 T}
310 T{
311 \&#define
312 T}      T{
313 .ZN GCFillStyle
314 T}      T{
315 (1L<<8)
316 T}
317 T{
318 \&#define
319 T}      T{
320 .ZN GCFillRule
321 T}      T{
322 (1L<<9)
323 T}
324 T{
325 \&#define
326 T}      T{
327 .ZN GCTile
328 T}      T{
329 (1L<<10)
330 T}
331 T{
332 \&#define
333 T}      T{
334 .ZN GCStipple
335 T}      T{
336 (1L<<11)
337 T}
338 T{
339 \&#define
340 T}      T{
341 .ZN GCTileStipXOrigin
342 T}      T{
343 (1L<<12)
344 T}
345 T{
346 \&#define
347 T}      T{
348 .ZN GCTileStipYOrigin
349 T}      T{
350 (1L<<13)
351 T}
352 T{
353 \&#define
354 T}      T{
355 .ZN GCFont
356 T}      T{
357 (1L<<14)
358 T}
359 T{
360 \&#define
361 T}      T{
362 .ZN GCSubwindowMode
363 T}      T{
364 (1L<<15)
365 T}
366 T{
367 \&#define
368 T}      T{
369 .ZN GCGraphicsExposures
370 T}      T{
371 (1L<<16)
372 T}
373 T{
374 \&#define
375 T}      T{
376 .ZN GCClipXOrigin
377 T}      T{
378 (1L<<17)
379 T}
380 T{
381 \&#define
382 T}      T{
383 .ZN GCClipYOrigin
384 T}      T{
385 (1L<<18)
386 T}
387 T{
388 \&#define
389 T}      T{
390 .ZN GCClipMask
391 T}      T{
392 (1L<<19)
393 T}
394 T{
395 \&#define
396 T}      T{
397 .ZN GCDashOffset
398 T}      T{
399 (1L<<20)
400 T}
401 T{
402 \&#define
403 T}      T{
404 .ZN GCDashList
405 T}      T{
406 (1L<<21)
407 T}
408 T{
409 \&#define
410 T}      T{
411 .ZN GCArcMode
412 T}      T{
413 (1L<<22)
414 T}
415 .TE
416 .IN "XGCValues" "" "@DEF@"
417 .Ds 0
418 /\&* Values */
419
420 typedef struct {
421         int function;   /\&* logical operation */
422         unsigned long plane_mask;       /\&* plane mask */
423         unsigned long foreground;       /\&* foreground pixel */
424         unsigned long background;       /\&* background pixel */
425         int line_width; /\&* line width (in pixels) */
426         int line_style; /\&* LineSolid, LineOnOffDash, LineDoubleDash */
427         int cap_style;  /\&* CapNotLast, CapButt, CapRound, CapProjecting */
428         int join_style; /\&* JoinMiter, JoinRound, JoinBevel */
429         int fill_style; /\&* FillSolid, FillTiled, FillStippled FillOpaqueStippled*/
430         int fill_rule;  /\&* EvenOddRule, WindingRule */
431         int arc_mode;   /\&* ArcChord, ArcPieSlice */
432         Pixmap tile;    /\&* tile pixmap for tiling operations */
433         Pixmap stipple; /\&* stipple 1 plane pixmap for stippling */
434         int ts_x_origin;        /\&* offset for tile or stipple operations */
435         int ts_y_origin;
436         Font font;      /\&* default text font for text operations */
437         int subwindow_mode;     /\&* ClipByChildren, IncludeInferiors */
438         Bool graphics_exposures;        /\&* boolean, should exposures be generated */
439         int clip_x_origin;      /\&* origin for clipping */
440         int clip_y_origin;
441         Pixmap clip_mask;       /\&* bitmap clipping; other calls for rects */
442         int dash_offset;        /\&* patterned/dashed line information */
443         char dashes;
444 } XGCValues;
445 .De
446 .LP
447 The function attributes of a GC are used when you update a section of
448 a drawable (the destination) with bits from somewhere else (the source).  
449 The function in a GC defines how the new destination bits are to be
450 computed from the source bits and the old destination bits.
451 .ZN GXcopy
452 is typically the most useful because it will work on a color display,
453 but special applications may use other functions,
454 particularly in concert with particular planes of a color display.
455 The 16 GC functions, defined in 
456 .hN X11/X.h ,
457 are:
458 .\" are listed in Table 5-1 along with the 
459 .\"the associated hexadecimal code
460 .\" and operation.
461 .\".CP T 1
462 .\"Display Functions
463 .TS
464 lw(1.5i) cw(.5i) lw(2i).
465 _
466 .sp 6p
467 .B
468 Function Name   Value   Operation
469 .sp 6p
470 _
471 .sp 6p
472 T{
473 .ZN GXclear
474 T}      T{
475 0x0
476 T}      T{
477 0
478 T}
479 T{
480 .ZN GXand
481 T}      T{
482 0x1
483 T}      T{
484 src AND dst
485 T}
486 T{
487 .ZN GXandReverse
488 T}      T{
489 0x2
490 T}      T{
491 src AND NOT dst
492 T}
493 T{
494 .ZN GXcopy
495 T}      T{
496 0x3
497 T}      T{
498 src
499 T}
500 T{
501 .ZN GXandInverted
502 T}      T{
503 0x4
504 T}      T{
505 (NOT src) AND dst
506 T}
507 T{
508 .ZN GXnoop
509 T}      T{
510 0x5
511 T}      T{
512 dst
513 T}
514 T{
515 .ZN GXxor
516 T}      T{
517 0x6
518 T}      T{
519 src XOR dst
520 T}
521 T{
522 .ZN GXor
523 T}      T{
524 0x7
525 T}      T{
526 src OR dst
527 T}
528 T{
529 .ZN GXnor
530 T}      T{
531 0x8
532 T}      T{
533 (NOT src) AND (NOT dst)
534 T}
535 T{
536 .ZN GXequiv
537 T}      T{
538 0x9
539 T}      T{
540 (NOT src) XOR dst
541 T}
542 T{
543 .ZN GXinvert
544 T}      T{
545 0xa
546 T}      T{
547 NOT dst
548 T}
549 T{
550 .ZN GXorReverse
551 T}      T{
552 0xb
553 T}      T{
554 src OR (NOT dst)
555 T}
556 T{
557 .ZN GXcopyInverted
558 T}      T{
559 0xc
560 T}      T{
561 NOT src
562 T}
563 T{
564 .ZN GXorInverted
565 T}      T{
566 0xd
567 T}      T{
568 (NOT src) OR dst
569 T}
570 T{
571 .ZN GXnand
572 T}      T{
573 0xe
574 T}      T{
575 (NOT src) OR (NOT dst)
576 T}
577 T{
578 .ZN GXset
579 T}      T{
580 0xf
581 T}      T{
582 1
583 T}
584 .sp 6p
585 _
586 .TE
587 .LP
588 Many graphics operations depend on either pixel values or planes in a GC.
589 .IN "Pixel value"
590 The planes attribute is of type long, and it specifies which planes of the
591 destination are to be modified, one bit per plane.
592 .IN "Plane" "mask"
593 A monochrome display has only one plane and
594 will be the least significant bit of the word.
595 As planes are added to the display hardware, they will occupy more
596 significant bits in the plane mask.
597 .LP
598 In graphics operations, given a source and destination pixel, 
599 the result is computed bitwise on corresponding bits of the pixels.
600 That is, a Boolean operation is performed in each bit plane.  
601 The plane_mask restricts the operation to a subset of planes.
602 A macro constant
603 .ZN AllPlanes
604 can be used to refer to all planes of the screen simultaneously.
605 The result is computed by the following:
606 .LP
607 .Ds 
608 ((src FUNC dst) AND plane-mask) OR (dst AND (NOT plane-mask))
609 .De
610 .LP
611 Range checking is not performed on the values for foreground,
612 background, or plane_mask.
613 They are simply truncated to the appropriate
614 number of bits.
615 The line-width is measured in pixels and either can be greater than or equal to
616 one (wide line) or can be the special value zero (thin line).
617 .LP
618 Wide lines are drawn centered on the path described by the graphics request.
619 Unless otherwise specified by the join-style or cap-style,
620 the bounding box of a wide line with endpoints [x1, y1], [x2, y2] and
621 width w is a rectangle with vertices at the following real coordinates:
622 .LP
623 .Ds
624 [x1-(w*sn/2), y1+(w*cs/2)], [x1+(w*sn/2), y1-(w*cs/2)],
625 [x2-(w*sn/2), y2+(w*cs/2)], [x2+(w*sn/2), y2-(w*cs/2)]
626 .De
627 .LP
628 Here sn is the sine of the angle of the line,
629 and cs is the cosine of the angle of the line.
630 A pixel is part of the line and so is drawn
631 if the center of the pixel is fully inside the bounding box
632 (which is viewed as having infinitely thin edges).
633 If the center of the pixel is exactly on the bounding box,
634 it is part of the line if and only if the interior is immediately to its right
635 (x increasing direction).
636 Pixels with centers on a horizontal edge are a special case and are part of
637 the line if and only if the interior or the boundary is immediately below 
638 (y increasing direction) and the interior or the boundary is immediately
639 to the right (x increasing direction).
640 .LP
641 Thin lines (zero line-width) are one-pixel-wide lines drawn using an
642 unspecified, device-dependent algorithm.
643 There are only two constraints on this algorithm. 
644 .IP 1. 5
645 If a line is drawn unclipped from [x1,y1] to [x2,y2] and
646 if another line is drawn unclipped from [x1+dx,y1+dy] to [x2+dx,y2+dy],
647 a point [x,y] is touched by drawing the first line 
648 if and only if the point [x+dx,y+dy] is touched by drawing the second line.
649 .IP 2. 5
650 The effective set of points comprising a line cannot be affected by clipping.
651 That is, a point is touched in a clipped line if and only if the point 
652 lies inside the clipping region and the point would be touched
653 by the line when drawn unclipped.
654 .LP
655 A wide line drawn from [x1,y1] to [x2,y2] always draws the same pixels 
656 as a wide line drawn from [x2,y2] to [x1,y1], not counting cap-style 
657 and join-style.
658 It is recommended that this property be true for thin lines, 
659 but this is not required.
660 A line-width of zero may differ from a line-width of one in which pixels are
661 drawn.
662 This permits the use of many manufacturers' line drawing hardware,
663 which may run many times faster than the more precisely specified
664 wide lines.
665 .LP
666 In general, 
667 drawing a thin line will be faster than drawing a wide line of width one.
668 However, because of their different drawing algorithms,
669 thin lines may not mix well aesthetically with wide lines.
670 If it is desirable to obtain precise and uniform results across all displays,
671 a client should always use a line-width of one rather than a line-width of zero.
672 .LP
673 The line-style defines which sections of a line are drawn:
674 .TS
675 lw(1.3i) lw(4.5i).
676 T{
677 .ZN LineSolid
678 T}      T{
679 The full path of the line is drawn.
680 T}
681 .sp 6p
682 T{
683 .ZN LineDoubleDash
684 T}      T{
685 The full path of the line is drawn, 
686 but the even dashes are filled differently 
687 from the odd dashes (see fill-style) with
688 .ZN CapButt 
689 style used where even and odd dashes meet.
690 T}
691 .sp 6p
692 T{
693 .ZN LineOnOffDash
694 T}      T{
695 Only the even dashes are drawn,
696 and cap-style applies to 
697 all internal ends of the individual dashes,
698 except 
699 .ZN CapNotLast
700 is treated as 
701 .ZN CapButt . 
702 T}
703 .TE
704 .LP
705 The cap-style defines how the endpoints of a path are drawn:
706 .IN "Graphics context" "path"
707 .TS
708 lw(1.3i) lw(4.5i).
709 T{
710 .ZN CapNotLast
711 T}      T{
712 This is equivalent to 
713 .ZN CapButt  
714 except that for a line-width of zero the final endpoint is not drawn.
715 T}
716 .sp 6p
717 T{
718 .ZN CapButt
719 T}      T{
720 The line is square at the endpoint (perpendicular to the slope of the line)
721 with no projection beyond.
722 T}
723 .sp 6p
724 T{
725 .ZN CapRound
726 T}      T{
727 The line has a circular arc with the diameter equal to the line-width,
728 centered on the endpoint.
729 (This is equivalent to 
730 .ZN CapButt 
731 for line-width of zero).
732 T}
733 .sp 6p
734 T{
735 .ZN CapProjecting
736 T}      T{
737 The line is square at the end, but the path continues beyond the endpoint 
738 for a distance equal to half the line-width.
739 (This is equivalent to 
740 .ZN CapButt 
741 for line-width of zero).
742 T}
743 .TE
744 .LP
745 The join-style defines how corners are drawn for wide lines:
746 .TS
747 lw(1.3i) lw(4.5i).
748 T{
749 .ZN JoinMiter
750 T}      T{
751 The outer edges of two lines extend to meet at an angle.
752 However, if the angle is less than 11 degrees,
753 then a
754 .ZN JoinBevel
755 join-style is used instead.
756 T}
757 .sp 6p
758 T{
759 .ZN JoinRound
760 T}      T{
761 The corner is a circular arc with the diameter equal to the line-width, 
762 centered on the joinpoint.
763 T}
764 .sp 6p
765 T{
766 .ZN JoinBevel
767 T}      T{
768 The corner has
769 .ZN CapButt 
770 endpoint styles with the triangular notch filled.
771 T}
772 .TE
773 .LP
774 For a line with coincident endpoints (x1=x2, y1=y2), 
775 when the cap-style is applied to both endpoints, 
776 the semantics depends on the line-width and the cap-style:
777 .TS
778 lw(1.3i) lw(.5i) lw(4i).
779 T{
780 .ZN CapNotLast
781 T}      T{
782 thin
783 T}      T{
784 The results are device dependent, 
785 but the desired effect is that nothing is drawn.
786 T}
787 .sp 6p
788 T{
789 .ZN CapButt
790 T}      T{
791 thin
792 T}      T{
793 The results are device dependent, 
794 but the desired effect is that a single pixel is drawn.
795 T}
796 .sp 6p
797 T{
798 .ZN CapRound
799 T}      T{
800 thin
801 T}      T{
802 The results are the same as for
803 .ZN CapButt /thin.
804 T}
805 .sp 6p
806 T{
807 .ZN CapProjecting
808 T}      T{
809 thin
810 T}      T{
811 The results are the same as for
812 .ZN CapButt /thin.
813 T}
814 .sp 6p
815 T{
816 .ZN CapButt
817 T}      T{
818 wide
819 T}      T{
820 Nothing is drawn.
821 T}
822 .sp 6p
823 T{
824 .ZN CapRound
825 T}      T{
826 wide
827 T}      T{
828 The closed path is a circle, centered at the endpoint, and
829 with the diameter equal to the line-width.
830 T}
831 .sp 6p
832 T{
833 .ZN CapProjecting
834 T}      T{
835 wide
836 T}      T{
837 The closed path is a square, aligned with the coordinate axes, centered at the
838 endpoint, and with the sides equal to the line-width.
839 T}
840 .TE
841 .LP
842 For a line with coincident endpoints (x1=x2, y1=y2), 
843 when the join-style is applied at one or both endpoints, 
844 the effect is as if the line was removed from the overall path.
845 However, if the total path consists of or is reduced to a single point joined
846 with itself, the effect is the same as when the cap-style is applied at both
847 endpoints.
848 .LP
849 The tile/stipple represents an infinite two-dimensional plane,
850 with the tile/stipple replicated in all dimensions.
851 When that plane is superimposed on the drawable
852 for use in a graphics operation, the upper-left corner
853 of some instance of the tile/stipple is at the coordinates within
854 the drawable specified by the tile/stipple origin.
855 The tile/stipple and clip origins are interpreted relative to the
856 origin of whatever destination drawable is specified in a graphics
857 request.
858 The tile pixmap must have the same root and depth as the GC,
859 or a
860 .ZN BadMatch 
861 error results.
862 The stipple pixmap must have depth one and must have the same root as the
863 GC, or a 
864 .ZN BadMatch 
865 error results.  
866 For stipple operations where the fill-style is
867 .ZN FillStippled
868 but not 
869 .ZN FillOpaqueStippled ,
870 the stipple pattern is tiled in a
871 single plane and acts as an additional clip mask to be ANDed with the clip-mask.
872 Although some sizes may be faster to use than others,
873 any size pixmap can be used for tiling or stippling.
874 .LP
875 The fill-style defines the contents of the source for line, text, and
876 fill requests.  
877 For all text and fill requests (for example,
878 .ZN XDrawText , 
879 .ZN XDrawText16 ,
880 .ZN XFillRectangle , 
881 .ZN XFillPolygon , 
882 and
883 .ZN XFillArc );
884 for line requests 
885 with line-style 
886 .ZN LineSolid 
887 (for example,
888 .ZN XDrawLine ,
889 .ZN XDrawSegments , 
890 .ZN XDrawRectangle ,
891 .ZN XDrawArc );
892 and for the even dashes for line requests with line-style 
893 .ZN LineOnOffDash 
894 or 
895 .ZN LineDoubleDash ,
896 the following apply:
897 .TS
898 lw(1.8i) lw(4i).
899 T{
900 .ZN FillSolid
901 T}      T{
902 Foreground
903 T}
904 .sp 6p
905 T{
906 .ZN FillTiled
907 T}      T{
908 Tile
909 T}
910 .sp 6p
911 T{
912 .ZN FillOpaqueStippled
913 T}      T{
914 A tile with the same width and height as stipple,
915 but with background everywhere stipple has a zero
916 and with foreground everywhere stipple has a one
917 T}
918 .sp 6p
919 T{
920 .ZN FillStippled
921 T}      T{
922 Foreground masked by stipple
923 T}
924 .TE
925 .LP
926 When drawing lines with line-style
927 .ZN LineDoubleDash ,
928 the odd dashes are controlled by the fill-style in the following manner:
929 .TS
930 lw(1.8i) lw(4i).
931 T{
932 .ZN FillSolid
933 T}      T{
934 Background
935 T}
936 .sp 6p
937 T{
938 .ZN FillTiled
939 T}      T{
940 Same as for even dashes
941 T}
942 .sp 6p
943 T{
944 .ZN FillOpaqueStippled
945 T}      T{
946 Same as for even dashes
947 T}
948 .sp 6p
949 T{
950 .ZN FillStippled
951 T}      T{
952 Background masked by stipple
953 T}
954 .TE
955 .LP
956 Storing a pixmap in a GC might or might not result in a copy
957 being made.
958 If the pixmap is later used as the destination for a graphics request,
959 the change might or might not be reflected in the GC.
960 If the pixmap is used simultaneously in a graphics request both as
961 a destination and as a tile or stipple,
962 the results are undefined.
963 .LP
964 For optimum performance,
965 you should draw as much as possible with the same GC 
966 (without changing its components).
967 The costs of changing GC components relative to using different GCs
968 depend on the display hardware and the server implementation.
969 It is quite likely that some amount of GC information will be
970 cached in display hardware and that such hardware can only cache a small number
971 of GCs.
972 .LP
973 The dashes value is actually a simplified form of the
974 more general patterns that can be set with 
975 .ZN XSetDashes .  
976 Specifying a
977 value of N is equivalent to specifying the two-element list [N, N] in 
978 .ZN XSetDashes . 
979 The value must be nonzero,
980 or a
981 .ZN BadValue
982 error results.
983 .LP
984 The clip-mask restricts writes to the destination drawable.  
985 If the clip-mask is set to a pixmap,
986 it must have depth one and have the same root as the GC,
987 or a
988 .ZN BadMatch 
989 error results.
990 If clip-mask is set to
991 .ZN None ,
992 the pixels are always drawn regardless of the clip origin.
993 The clip-mask also can be set by calling the
994 .ZN XSetClipRectangles
995 or
996 .ZN XSetRegion
997 functions.
998 Only pixels where the clip-mask has a bit set to 1 are drawn.  
999 Pixels are not drawn outside the area covered by the clip-mask 
1000 or where the clip-mask has a bit set to 0.
1001 The clip-mask affects all graphics requests.
1002 The clip-mask does not clip sources.
1003 The clip-mask origin is interpreted relative to the origin of whatever
1004 destination drawable is specified in a graphics request.
1005 .LP
1006 You can set the subwindow-mode to
1007 .ZN ClipByChildren
1008 or
1009 .ZN IncludeInferiors .
1010 For 
1011 .ZN ClipByChildren , 
1012 both source and destination windows are
1013 additionally clipped by all viewable 
1014 .ZN InputOutput
1015 children.  
1016 For 
1017 .ZN IncludeInferiors ,
1018 neither source nor destination window is clipped by inferiors. 
1019 This will result in including subwindow contents in the source
1020 and drawing through subwindow boundaries of the destination.
1021 The use of 
1022 .ZN IncludeInferiors 
1023 on a window of one depth with mapped
1024 inferiors of differing depth is not illegal, but the semantics are
1025 undefined by the core protocol.
1026 .LP
1027 The fill-rule defines what pixels are inside (drawn) for
1028 paths given in 
1029 .ZN XFillPolygon 
1030 requests and can be set to 
1031 .ZN EvenOddRule 
1032 or
1033 .ZN WindingRule .
1034 For
1035 .ZN EvenOddRule ,
1036 a point is inside if
1037 an infinite ray with the point as origin crosses the path an odd number
1038 of times.  
1039 For 
1040 .ZN WindingRule , 
1041 a point is inside if an infinite ray with the
1042 point as origin crosses an unequal number of clockwise and
1043 counterclockwise directed path segments.
1044 A clockwise directed path segment is one that crosses the ray from left to
1045 right as observed from the point.
1046 A counterclockwise segment is one that crosses the ray from right to left
1047 as observed from the point.
1048 The case where a directed line segment is coincident with the ray is
1049 uninteresting because you can simply choose a different ray that is not
1050 coincident with a segment.
1051 .LP
1052 For both 
1053 .ZN EvenOddRule
1054 and
1055 .ZN WindingRule ,
1056 a point is infinitely small, 
1057 and the path is an infinitely thin line.  
1058 A pixel is inside if the center point of the pixel is inside
1059 and the center point is not on the boundary.  
1060 If the center point is on the boundary,
1061 the pixel is inside if and only if the polygon interior is immediately to
1062 its right (x increasing direction).  
1063 Pixels with centers on a horizontal edge are a special case 
1064 and are inside if and only if the polygon interior is immediately below 
1065 (y increasing direction).
1066 .LP
1067 The arc-mode controls filling in the 
1068 .ZN XFillArcs
1069 function and can be set to
1070 .ZN ArcPieSlice
1071 or
1072 .ZN ArcChord .
1073 For
1074 .ZN ArcPieSlice ,
1075 the arcs are pie-slice filled.
1076 For
1077 .ZN ArcChord ,
1078 the arcs are chord filled.
1079 .LP
1080 The graphics-exposure flag controls 
1081 .ZN GraphicsExpose 
1082 event generation
1083 for 
1084 .ZN XCopyArea 
1085 and 
1086 .ZN XCopyPlane
1087 requests (and any similar requests defined by extensions).
1088 .SH DIAGNOSTICS
1089 .TP 1i
1090 .ZN BadAlloc
1091 The server failed to allocate the requested resource or server memory.
1092 .TP 1i
1093 .ZN BadDrawable
1094 A value for a Drawable argument does not name a defined Window or Pixmap.
1095 .TP 1i
1096 .ZN BadFont
1097 A value for a Font or GContext argument does not name a defined Font.
1098 .TP 1i
1099 .ZN BadGC
1100 A value for a GContext argument does not name a defined GContext.
1101 .TP 1i
1102 .ZN BadMatch
1103 An
1104 .ZN InputOnly
1105 window is used as a Drawable.
1106 .TP 1i
1107 .ZN BadMatch
1108 Some argument or pair of arguments has the correct type and range but fails
1109 to match in some other way required by the request.
1110 .TP 1i
1111 .ZN BadPixmap
1112 A value for a Pixmap argument does not name a defined Pixmap.
1113 .TP 1i
1114 .ZN BadValue
1115 Some numeric value falls outside the range of values accepted by the request.
1116 Unless a specific range is specified for an argument, the full range defined
1117 by the argument's type is accepted.  Any argument defined as a set of
1118 alternatives can generate this error.
1119 .SH "SEE ALSO"
1120 AllPlanes(__libmansuffix__),
1121 XCopyArea(__libmansuffix__),
1122 XCreateRegion(__libmansuffix__),
1123 XDrawArc(__libmansuffix__),
1124 XDrawLine(__libmansuffix__),
1125 XDrawRectangle(__libmansuffix__),
1126 XDrawText(__libmansuffix__),
1127 XFillRectangle(__libmansuffix__),
1128 XQueryBestSize(__libmansuffix__),
1129 XSetArcMode(__libmansuffix__),
1130 XSetClipOrigin(__libmansuffix__),
1131 XSetFillStyle(__libmansuffix__),
1132 XSetFont(__libmansuffix__),
1133 XSetLineAttributes(__libmansuffix__),
1134 XSetState(__libmansuffix__),
1135 XSetTile(__libmansuffix__)
1136 .br
1137 \fI\*(xL\fP