aboutsummaryrefslogtreecommitdiff
path: root/libX11/man/XCreateGC.man
blob: 9b698e631bc0acbc9cb4b63061789a43637ab47f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
'\" t
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1994, 1996 X Consortium
.\"
.\" Permission is hereby granted, free of charge, to any person obtaining
.\" a copy of this software and associated documentation files (the
.\" "Software"), to deal in the Software without restriction, including
.\" without limitation the rights to use, copy, modify, merge, publish,
.\" distribute, sublicense, and/or sell copies of the Software, and to
.\" permit persons to whom the Software is furnished to do so, subject to
.\" the following conditions:
.\"
.\" The above copyright notice and this permission notice shall be included
.\" in all copies or substantial portions of the Software.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
.\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
.\" OTHER DEALINGS IN THE SOFTWARE.
.\"
.\" Except as contained in this notice, the name of the X Consortium shall
.\" not be used in advertising or otherwise to promote the sale, use or
.\" other dealings in this Software without prior written authorization
.\" from the X Consortium.
.\"
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991 by
.\" Digital Equipment Corporation
.\"
.\" Portions Copyright \(co 1990, 1991 by
.\" Tektronix, Inc.
.\"
.\" Permission to use, copy, modify and distribute this documentation for
.\" any purpose and without fee is hereby granted, provided that the above
.\" copyright notice appears in all copies and that both that copyright notice
.\" and this permission notice appear in all copies, and that the names of
.\" Digital and Tektronix not be used in in advertising or publicity pertaining
.\" to this documentation without specific, written prior permission.
.\" Digital and Tektronix makes no representations about the suitability
.\" of this documentation for any purpose.
.\" It is provided ``as is'' without express or implied warranty.
.\" 
.\" $XFree86: xc/doc/man/X11/XCreGC.man,v 1.6 2003/04/28 22:17:54 herrb Exp $
.\" $XdotOrg: lib/X11/man/XCreateGC.man,v 1.2 2004-04-23 18:42:09 eich Exp $
.\"
.ds xT X Toolkit Intrinsics \- C Language Interface
.ds xW Athena X Widgets \- C Language X Toolkit Interface
.ds xL Xlib \- C Language X Interface
.ds xC Inter-Client Communication Conventions Manual
.na
.de Ds
.nf
.\\$1D \\$2 \\$1
.ft 1
.\".ps \\n(PS
.\".if \\n(VS>=40 .vs \\n(VSu
.\".if \\n(VS<=39 .vs \\n(VSp
..
.de De
.ce 0
.if \\n(BD .DF
.nr BD 0
.in \\n(OIu
.if \\n(TM .ls 2
.sp \\n(DDu
.fi
..
.de FD
.LP
.KS
.TA .5i 3i
.ta .5i 3i
.nf
..
.de FN
.fi
.KE
.LP
..
.de IN		\" send an index entry to the stderr
..
.de C{
.KS
.nf
.D
.\"
.\"	choose appropriate monospace font
.\"	the imagen conditional, 480,
.\"	may be changed to L if LB is too
.\"	heavy for your eyes...
.\"
.ie "\\*(.T"480" .ft L
.el .ie "\\*(.T"300" .ft L
.el .ie "\\*(.T"202" .ft PO
.el .ie "\\*(.T"aps" .ft CW
.el .ft R
.ps \\n(PS
.ie \\n(VS>40 .vs \\n(VSu
.el .vs \\n(VSp
..
.de C}
.DE
.R
..
.de Pn
.ie t \\$1\fB\^\\$2\^\fR\\$3
.el \\$1\fI\^\\$2\^\fP\\$3
..
.de ZN
.ie t \fB\^\\$1\^\fR\\$2
.el \fI\^\\$1\^\fP\\$2
..
.de hN
.ie t <\fB\\$1\fR>\\$2
.el <\fI\\$1\fP>\\$2
..
.de NT
.ne 7
.ds NO Note
.if \\n(.$>$1 .if !'\\$2'C' .ds NO \\$2
.if \\n(.$ .if !'\\$1'C' .ds NO \\$1
.ie n .sp
.el .sp 10p
.TB
.ce
\\*(NO
.ie n .sp
.el .sp 5p
.if '\\$1'C' .ce 99
.if '\\$2'C' .ce 99
.in +5n
.ll -5n
.R
..
.		\" Note End -- doug kraft 3/85
.de NE
.ce 0
.in -5n
.ll +5n
.ie n .sp
.el .sp 10p
..
.ny0
'\" t
.TH XCreateGC __libmansuffix__ __xorgversion__ "XLIB FUNCTIONS"
.SH NAME
XCreateGC, XCopyGC, XChangeGC, XGetGCValues, XFreeGC, XGContextFromGC, XGCValues \- create or free graphics contexts and graphics context structure
.SH SYNTAX
.HP
GC XCreateGC\^(\^Display *\fIdisplay\fP\^, Drawable \fId\fP\^, unsigned long
\fIvaluemask\fP\^, XGCValues *\^\fIvalues\fP\^); 
.HP
int XCopyGC\^(\^Display *\fIdisplay\fP\^, GC \fIsrc\fP\^, GC \fIdest\fP\^,
unsigned long \fIvaluemask\fP\^); 
.HP
int XChangeGC\^(\^Display *\fIdisplay\fP\^, GC \fIgc\fP\^, unsigned long
\fIvaluemask\fP\^, XGCValues *\^\fIvalues\fP\^); 
.HP
Status XGetGCValues\^(\^Display *\fIdisplay\fP\^, GC \fIgc\fP\^, unsigned long
\fIvaluemask\fP\^, XGCValues *\fIvalues_return\fP\^); 
.HP
int XFreeGC\^(\^Display *\fIdisplay\fP\^, GC \fIgc\fP\^); 
.HP
GContext XGContextFromGC\^(\^GC \fIgc\fP\^); 
.SH ARGUMENTS
.IP \fId\fP 1i
Specifies the drawable. 
.IP \fIdest\fP 1i
Specifies the destination GC.
.IP \fIdisplay\fP 1i
Specifies the connection to the X server.
.IP \fIgc\fP 1i
Specifies the GC.
.IP \fIsrc\fP 1i
Specifies the components of the source GC.
.ds Vm set, copied, changed, or returned 
.IP \fIvaluemask\fP 1i
Specifies which components in the GC are to be \*(Vm. 
This argument is the bitwise inclusive OR of zero or more of the valid
GC component mask bits.
.IP \fIvalues\fP 1i
Specifies any values as specified by the valuemask.
.IP \fIvalues_return\fP 1i
Returns the GC values in the specified
.ZN XGCValues 
structure.
.SH DESCRIPTION
The
.ZN XCreateGC
function creates a graphics context and returns a GC.
The GC can be used with any destination drawable having the same root
and depth as the specified drawable.
Use with other drawables results in a
.ZN BadMatch
error.
.LP
.ZN XCreateGC
can generate
.ZN BadAlloc ,
.ZN BadDrawable ,
.ZN BadFont ,
.ZN BadMatch ,
.ZN BadPixmap ,
and
.ZN BadValue 
errors.
.LP
The
.ZN XCopyGC
function copies the specified components from the source GC
to the destination GC.
The source and destination GCs must have the same root and depth,
or a
.ZN BadMatch
error results.
The valuemask specifies which component to copy, as for
.ZN XCreateGC .
.LP
.ZN XCopyGC
can generate
.ZN BadAlloc ,
.ZN BadGC ,
and
.ZN BadMatch
errors.
.LP
The
.ZN XChangeGC
function changes the components specified by valuemask for
the specified GC.
The values argument contains the values to be set.
The values and restrictions are the same as for 
.ZN XCreateGC .
Changing the clip-mask overrides any previous 
.ZN XSetClipRectangles
request on the context. 
Changing the dash-offset or dash-list
overrides any previous 
.ZN XSetDashes
request on the context.
The order in which components are verified and altered is server dependent.
If an error is generated, a subset of the components may have been altered.
.LP
.ZN XChangeGC
can generate
.ZN BadAlloc ,
.ZN BadFont ,
.ZN BadGC ,
.ZN BadMatch ,
.ZN BadPixmap ,
and
.ZN BadValue 
errors.
.LP
The
.ZN XGetGCValues
function returns the components specified by valuemask for the specified GC.
If the valuemask contains a valid set of GC mask bits
.Pn ( GCFunction ,
.ZN GCPlaneMask ,
.ZN GCForeground ,
.ZN GCBackground ,
.ZN GCLineWidth ,
.ZN GCLineStyle ,
.ZN GCCapStyle ,
.ZN GCJoinStyle ,
.ZN GCFillStyle ,
.ZN GCFillRule ,
.ZN GCTile ,
.ZN GCStipple ,
.ZN GCTileStipXOrigin ,
.ZN GCTileStipYOrigin ,
.ZN GCFont ,
.ZN GCSubwindowMode ,
.ZN GCGraphicsExposures ,
.ZN GCClipXOrigin ,
.ZN GCCLipYOrigin ,
.ZN GCDashOffset ,
or
.ZN GCArcMode )
and no error occurs,
.ZN XGetGCValues
sets the requested components in values_return and returns a nonzero status.
Otherwise, it returns a zero status.
Note that the clip-mask and dash-list (represented by the
.ZN GCClipMask
and 
.ZN GCDashList
bits, respectively, in the valuemask)
cannot be requested.
Also note that an invalid resource ID (with one or more of the three
most significant bits set to 1) will be returned for
.ZN GCFont ,
.ZN GCTile ,
and
.ZN GCStipple
if the component has never been explicitly set by the client.
.LP
The
.ZN XFreeGC
function destroys the specified GC as well as all the associated storage.
.LP
.ZN XFreeGC
can generate a
.ZN BadGC 
error.
.SH STRUCTURES
The
.ZN XGCValues
structure contains:
.LP
.LP
/\&* GC attribute value mask bits */
.TS
lw(.5i) lw(2.5i) lw(.75i).
T{
\&#define
T}	T{
.ZN GCFunction
T}	T{
(1L<<0)
T}
T{
\&#define
T}	T{
.ZN GCPlaneMask
T}	T{
(1L<<1)
T}
T{
\&#define
T}	T{
.ZN GCForeground
T}	T{
(1L<<2)
T}
T{
\&#define
T}	T{
.ZN GCBackground
T}	T{
(1L<<3)
T}
T{
\&#define
T}	T{
.ZN GCLineWidth
T}	T{
(1L<<4)
T}
T{
\&#define
T}	T{
.ZN GCLineStyle
T}	T{
(1L<<5)
T}
T{
\&#define
T}	T{
.ZN GCCapStyle
T}	T{
(1L<<6)
T}
T{
\&#define
T}	T{
.ZN GCJoinStyle
T}	T{
(1L<<7)
T}
T{
\&#define
T}	T{
.ZN GCFillStyle
T}	T{
(1L<<8)
T}
T{
\&#define
T}	T{
.ZN GCFillRule
T}	T{
(1L<<9)
T}
T{
\&#define
T}	T{
.ZN GCTile
T}	T{
(1L<<10)
T}
T{
\&#define
T}	T{
.ZN GCStipple
T}	T{
(1L<<11)
T}
T{
\&#define
T}	T{
.ZN GCTileStipXOrigin
T}	T{
(1L<<12)
T}
T{
\&#define
T}	T{
.ZN GCTileStipYOrigin
T}	T{
(1L<<13)
T}
T{
\&#define
T}	T{
.ZN GCFont
T}	T{
(1L<<14)
T}
T{
\&#define
T}	T{
.ZN GCSubwindowMode
T}	T{
(1L<<15)
T}
T{
\&#define
T}	T{
.ZN GCGraphicsExposures
T}	T{
(1L<<16)
T}
T{
\&#define
T}	T{
.ZN GCClipXOrigin
T}	T{
(1L<<17)
T}
T{
\&#define
T}	T{
.ZN GCClipYOrigin
T}	T{
(1L<<18)
T}
T{
\&#define
T}	T{
.ZN GCClipMask
T}	T{
(1L<<19)
T}
T{
\&#define
T}	T{
.ZN GCDashOffset
T}	T{
(1L<<20)
T}
T{
\&#define
T}	T{
.ZN GCDashList
T}	T{
(1L<<21)
T}
T{
\&#define
T}	T{
.ZN GCArcMode
T}	T{
(1L<<22)
T}
.TE
.IN "XGCValues" "" "@DEF@"
.Ds 0
.TA .5i 3i
.ta .5i 3i
/\&* Values */

typedef struct {
	int function;	/\&* logical operation */
	unsigned long plane_mask;	/\&* plane mask */
	unsigned long foreground;	/\&* foreground pixel */
	unsigned long background;	/\&* background pixel */
	int line_width;	/\&* line width (in pixels) */
	int line_style;	/\&* LineSolid, LineOnOffDash, LineDoubleDash */
	int cap_style;	/\&* CapNotLast, CapButt, CapRound, CapProjecting */
	int join_style;	/\&* JoinMiter, JoinRound, JoinBevel */
	int fill_style;	/\&* FillSolid, FillTiled, FillStippled FillOpaqueStippled*/
	int fill_rule;	/\&* EvenOddRule, WindingRule */
	int arc_mode;	/\&* ArcChord, ArcPieSlice */
	Pixmap tile;	/\&* tile pixmap for tiling operations */
	Pixmap stipple;	/\&* stipple 1 plane pixmap for stippling */
	int ts_x_origin;	/\&* offset for tile or stipple operations */
	int ts_y_origin;
	Font font;	/\&* default text font for text operations */
	int subwindow_mode;	/\&* ClipByChildren, IncludeInferiors */
	Bool graphics_exposures;	/\&* boolean, should exposures be generated */
	int clip_x_origin;	/\&* origin for clipping */
	int clip_y_origin;
	Pixmap clip_mask;	/\&* bitmap clipping; other calls for rects */
	int dash_offset;	/\&* patterned/dashed line information */
	char dashes;
} XGCValues;
.De
.LP
The function attributes of a GC are used when you update a section of
a drawable (the destination) with bits from somewhere else (the source).  
The function in a GC defines how the new destination bits are to be
computed from the source bits and the old destination bits.
.ZN GXcopy
is typically the most useful because it will work on a color display,
but special applications may use other functions,
particularly in concert with particular planes of a color display.
The 16 GC functions, defined in 
.hN X11/X.h ,
are:
.\" are listed in Table 5-1 along with the 
.\"the associated hexadecimal code
.\" and operation.
.\".CP T 1
.\"Display Functions
.TS H
lw(1.5i) cw(.5i) lw(2i).
_
.sp 6p
.B
Function Name	Value	Operation
.sp 6p
_
.sp 6p
.TH
T{
.ZN GXclear
T}	T{
0x0
T}	T{
0
T}
T{
.ZN GXand
T}	T{
0x1
T}	T{
src AND dst
T}
T{
.ZN GXandReverse
T}	T{
0x2
T}	T{
src AND NOT dst
T}
T{
.ZN GXcopy
T}	T{
0x3
T}	T{
src
T}
T{
.ZN GXandInverted
T}	T{
0x4
T}	T{
(NOT src) AND dst
T}
T{
.ZN GXnoop
T}	T{
0x5
T}	T{
dst
T}
T{
.ZN GXxor
T}	T{
0x6
T}	T{
src XOR dst
T}
T{
.ZN GXor
T}	T{
0x7
T}	T{
src OR dst
T}
T{
.ZN GXnor
T}	T{
0x8
T}	T{
(NOT src) AND (NOT dst)
T}
T{
.ZN GXequiv
T}	T{
0x9
T}	T{
(NOT src) XOR dst
T}
T{
.ZN GXinvert
T}	T{
0xa
T}	T{
NOT dst
T}
T{
.ZN GXorReverse
T}	T{
0xb
T}	T{
src OR (NOT dst)
T}
T{
.ZN GXcopyInverted
T}	T{
0xc
T}	T{
NOT src
T}
T{
.ZN GXorInverted
T}	T{
0xd
T}	T{
(NOT src) OR dst
T}
T{
.ZN GXnand
T}	T{
0xe
T}	T{
(NOT src) OR (NOT dst)
T}
T{
.ZN GXset
T}	T{
0xf
T}	T{
1
T}
.sp 6p
_
.TE
.LP
Many graphics operations depend on either pixel values or planes in a GC.
.IN "Pixel value"
The planes attribute is of type long, and it specifies which planes of the
destination are to be modified, one bit per plane.
.IN "Plane" "mask"
A monochrome display has only one plane and
will be the least significant bit of the word.
As planes are added to the display hardware, they will occupy more
significant bits in the plane mask.
.LP
In graphics operations, given a source and destination pixel, 
the result is computed bitwise on corresponding bits of the pixels.
That is, a Boolean operation is performed in each bit plane.  
The plane_mask restricts the operation to a subset of planes.
A macro constant
.ZN AllPlanes
can be used to refer to all planes of the screen simultaneously.
The result is computed by the following:
.LP
.Ds 
((src FUNC dst) AND plane-mask) OR (dst AND (NOT plane-mask))
.De
.LP
Range checking is not performed on the values for foreground,
background, or plane_mask.
They are simply truncated to the appropriate
number of bits.
The line-width is measured in pixels and either can be greater than or equal to
one (wide line) or can be the special value zero (thin line).
.LP
Wide lines are drawn centered on the path described by the graphics request.
Unless otherwise specified by the join-style or cap-style,
the bounding box of a wide line with endpoints [x1, y1], [x2, y2] and
width w is a rectangle with vertices at the following real coordinates:
.LP
.Ds
.TA .5i 2.5i
.ta .5i 2.5i
[x1-(w*sn/2), y1+(w*cs/2)], [x1+(w*sn/2), y1-(w*cs/2)],
[x2-(w*sn/2), y2+(w*cs/2)], [x2+(w*sn/2), y2-(w*cs/2)]
.De
.LP
Here sn is the sine of the angle of the line,
and cs is the cosine of the angle of the line.
A pixel is part of the line and so is drawn
if the center of the pixel is fully inside the bounding box
(which is viewed as having infinitely thin edges).
If the center of the pixel is exactly on the bounding box,
it is part of the line if and only if the interior is immediately to its right
(x increasing direction).
Pixels with centers on a horizontal edge are a special case and are part of
the line if and only if the interior or the boundary is immediately below 
(y increasing direction) and the interior or the boundary is immediately
to the right (x increasing direction).
.LP
Thin lines (zero line-width) are one-pixel-wide lines drawn using an
unspecified, device-dependent algorithm.
There are only two constraints on this algorithm. 
.IP 1. 5
If a line is drawn unclipped from [x1,y1] to [x2,y2] and
if another line is drawn unclipped from [x1+dx,y1+dy] to [x2+dx,y2+dy],
a point [x,y] is touched by drawing the first line 
if and only if the point [x+dx,y+dy] is touched by drawing the second line.
.IP 2. 5
The effective set of points comprising a line cannot be affected by clipping.
That is, a point is touched in a clipped line if and only if the point 
lies inside the clipping region and the point would be touched
by the line when drawn unclipped.
.LP
A wide line drawn from [x1,y1] to [x2,y2] always draws the same pixels 
as a wide line drawn from [x2,y2] to [x1,y1], not counting cap-style 
and join-style.
It is recommended that this property be true for thin lines, 
but this is not required.
A line-width of zero may differ from a line-width of one in which pixels are
drawn.
This permits the use of many manufacturers' line drawing hardware,
which may run many times faster than the more precisely specified
wide lines.
.LP
In general, 
drawing a thin line will be faster than drawing a wide line of width one.
However, because of their different drawing algorithms,
thin lines may not mix well aesthetically with wide lines.
If it is desirable to obtain precise and uniform results across all displays,
a client should always use a line-width of one rather than a line-width of zero.
.LP
The line-style defines which sections of a line are drawn:
.TS
lw(1.3i) lw(4.5i).
T{
.ZN LineSolid
T}	T{
The full path of the line is drawn.
T}
.sp 6p
T{
.ZN LineDoubleDash
T}	T{
The full path of the line is drawn, 
but the even dashes are filled differently 
from the odd dashes (see fill-style) with
.ZN CapButt 
style used where even and odd dashes meet.
T}
.sp 6p
T{
.ZN LineOnOffDash
T}	T{
Only the even dashes are drawn,
and cap-style applies to 
all internal ends of the individual dashes,
except 
.ZN CapNotLast
is treated as 
.ZN CapButt . 
T}
.TE
.LP
The cap-style defines how the endpoints of a path are drawn:
.IN "Graphics context" "path"
.TS
lw(1.3i) lw(4.5i).
T{
.ZN CapNotLast
T}	T{
This is equivalent to 
.ZN CapButt  
except that for a line-width of zero the final endpoint is not drawn.
T}
.sp 6p
T{
.ZN CapButt
T}	T{
The line is square at the endpoint (perpendicular to the slope of the line)
with no projection beyond.
T}
.sp 6p
T{
.ZN CapRound
T}	T{
The line has a circular arc with the diameter equal to the line-width,
centered on the endpoint.
(This is equivalent to 
.ZN CapButt 
for line-width of zero).
T}
.sp 6p
T{
.ZN CapProjecting
T}	T{
The line is square at the end, but the path continues beyond the endpoint 
for a distance equal to half the line-width.
(This is equivalent to 
.ZN CapButt 
for line-width of zero).
T}
.TE
.LP
The join-style defines how corners are drawn for wide lines:
.TS
lw(1.3i) lw(4.5i).
T{
.ZN JoinMiter
T}	T{
The outer edges of two lines extend to meet at an angle.
However, if the angle is less than 11 degrees,
then a
.ZN JoinBevel
join-style is used instead.
T}
.sp 6p
T{
.ZN JoinRound
T}	T{
The corner is a circular arc with the diameter equal to the line-width, 
centered on the joinpoint.
T}
.sp 6p
T{
.ZN JoinBevel
T}	T{
The corner has
.ZN CapButt 
endpoint styles with the triangular notch filled.
T}
.TE
.LP
For a line with coincident endpoints (x1=x2, y1=y2), 
when the cap-style is applied to both endpoints, 
the semantics depends on the line-width and the cap-style:
.TS
lw(1.3i) lw(.5i) lw(4i).
T{
.ZN CapNotLast
T}	T{
thin
T}	T{
The results are device dependent, 
but the desired effect is that nothing is drawn.
T}
.sp 6p
T{
.ZN CapButt
T}	T{
thin
T}	T{
The results are device dependent, 
but the desired effect is that a single pixel is drawn.
T}
.sp 6p
T{
.ZN CapRound
T}	T{
thin
T}	T{
The results are the same as for
.ZN CapButt /thin.
T}
.sp 6p
T{
.ZN CapProjecting
T}	T{
thin
T}	T{
The results are the same as for
.ZN CapButt /thin.
T}
.sp 6p
T{
.ZN CapButt
T}	T{
wide
T}	T{
Nothing is drawn.
T}
.sp 6p
T{
.ZN CapRound
T}	T{
wide
T}	T{
The closed path is a circle, centered at the endpoint, and
with the diameter equal to the line-width.
T}
.sp 6p
T{
.ZN CapProjecting
T}	T{
wide
T}	T{
The closed path is a square, aligned with the coordinate axes, centered at the
endpoint, and with the sides equal to the line-width.
T}
.TE
.LP
For a line with coincident endpoints (x1=x2, y1=y2), 
when the join-style is applied at one or both endpoints, 
the effect is as if the line was removed from the overall path.
However, if the total path consists of or is reduced to a single point joined
with itself, the effect is the same as when the cap-style is applied at both
endpoints.
.LP
The tile/stipple represents an infinite two-dimensional plane,
with the tile/stipple replicated in all dimensions.
When that plane is superimposed on the drawable
for use in a graphics operation, the upper-left corner
of some instance of the tile/stipple is at the coordinates within
the drawable specified by the tile/stipple origin.
The tile/stipple and clip origins are interpreted relative to the
origin of whatever destination drawable is specified in a graphics
request.
The tile pixmap must have the same root and depth as the GC,
or a
.ZN BadMatch 
error results.
The stipple pixmap must have depth one and must have the same root as the
GC, or a 
.ZN BadMatch 
error results.  
For stipple operations where the fill-style is
.ZN FillStippled
but not 
.ZN FillOpaqueStippled ,
the stipple pattern is tiled in a
single plane and acts as an additional clip mask to be ANDed with the clip-mask.
Although some sizes may be faster to use than others,
any size pixmap can be used for tiling or stippling.
.LP
The fill-style defines the contents of the source for line, text, and
fill requests.  
For all text and fill requests (for example,
.ZN XDrawText , 
.ZN XDrawText16 ,
.ZN XFillRectangle , 
.ZN XFillPolygon , 
and
.ZN XFillArc );
for line requests 
with line-style 
.ZN LineSolid 
(for example,
.ZN XDrawLine ,
.ZN XDrawSegments , 
.ZN XDrawRectangle ,
.ZN XDrawArc );
and for the even dashes for line requests with line-style 
.ZN LineOnOffDash 
or 
.ZN LineDoubleDash ,
the following apply:
.TS
lw(1.8i) lw(4i).
T{
.ZN FillSolid
T}	T{
Foreground
T}
.sp 6p
T{
.ZN FillTiled
T}	T{
Tile
T}
.sp 6p
T{
.ZN FillOpaqueStippled
T}	T{
A tile with the same width and height as stipple,
but with background everywhere stipple has a zero
and with foreground everywhere stipple has a one
T}
.sp 6p
T{
.ZN FillStippled
T}	T{
Foreground masked by stipple
T}
.TE
.LP
When drawing lines with line-style
.ZN LineDoubleDash ,
the odd dashes are controlled by the fill-style in the following manner:
.TS
lw(1.8i) lw(4i).
T{
.ZN FillSolid
T}	T{
Background
T}
.sp 6p
T{
.ZN FillTiled
T}	T{
Same as for even dashes
T}
.sp 6p
T{
.ZN FillOpaqueStippled
T}	T{
Same as for even dashes
T}
.sp 6p
T{
.ZN FillStippled
T}	T{
Background masked by stipple
T}
.TE
.LP
Storing a pixmap in a GC might or might not result in a copy
being made.
If the pixmap is later used as the destination for a graphics request,
the change might or might not be reflected in the GC.
If the pixmap is used simultaneously in a graphics request both as
a destination and as a tile or stipple,
the results are undefined.
.LP
For optimum performance,
you should draw as much as possible with the same GC 
(without changing its components).
The costs of changing GC components relative to using different GCs
depend on the display hardware and the server implementation.
It is quite likely that some amount of GC information will be
cached in display hardware and that such hardware can only cache a small number
of GCs.
.LP
The dashes value is actually a simplified form of the
more general patterns that can be set with 
.ZN XSetDashes .  
Specifying a
value of N is equivalent to specifying the two-element list [N, N] in 
.ZN XSetDashes . 
The value must be nonzero,
or a
.ZN BadValue
error results.
.LP
The clip-mask restricts writes to the destination drawable.  
If the clip-mask is set to a pixmap,
it must have depth one and have the same root as the GC,
or a
.ZN BadMatch 
error results.
If clip-mask is set to
.ZN None ,
the pixels are always drawn regardless of the clip origin.
The clip-mask also can be set by calling the
.ZN XSetClipRectangles
or
.ZN XSetRegion
functions.
Only pixels where the clip-mask has a bit set to 1 are drawn.  
Pixels are not drawn outside the area covered by the clip-mask 
or where the clip-mask has a bit set to 0.
The clip-mask affects all graphics requests.
The clip-mask does not clip sources.
The clip-mask origin is interpreted relative to the origin of whatever
destination drawable is specified in a graphics request.
.LP
You can set the subwindow-mode to
.ZN ClipByChildren
or
.ZN IncludeInferiors .
For 
.ZN ClipByChildren , 
both source and destination windows are
additionally clipped by all viewable 
.ZN InputOutput
children.  
For 
.ZN IncludeInferiors ,
neither source nor destination window is clipped by inferiors. 
This will result in including subwindow contents in the source
and drawing through subwindow boundaries of the destination.
The use of 
.ZN IncludeInferiors 
on a window of one depth with mapped
inferiors of differing depth is not illegal, but the semantics are
undefined by the core protocol.
.LP
The fill-rule defines what pixels are inside (drawn) for
paths given in 
.ZN XFillPolygon 
requests and can be set to 
.ZN EvenOddRule 
or
.ZN WindingRule .
For
.ZN EvenOddRule ,
a point is inside if
an infinite ray with the point as origin crosses the path an odd number
of times.  
For 
.ZN WindingRule , 
a point is inside if an infinite ray with the
point as origin crosses an unequal number of clockwise and
counterclockwise directed path segments.
A clockwise directed path segment is one that crosses the ray from left to
right as observed from the point.
A counterclockwise segment is one that crosses the ray from right to left
as observed from the point.
The case where a directed line segment is coincident with the ray is
uninteresting because you can simply choose a different ray that is not
coincident with a segment.
.LP
For both 
.ZN EvenOddRule
and
.ZN WindingRule ,
a point is infinitely small, 
and the path is an infinitely thin line.  
A pixel is inside if the center point of the pixel is inside
and the center point is not on the boundary.  
If the center point is on the boundary,
the pixel is inside if and only if the polygon interior is immediately to
its right (x increasing direction).  
Pixels with centers on a horizontal edge are a special case 
and are inside if and only if the polygon interior is immediately below 
(y increasing direction).
.LP
The arc-mode controls filling in the 
.ZN XFillArcs
function and can be set to
.ZN ArcPieSlice
or
.ZN ArcChord .
For
.ZN ArcPieSlice ,
the arcs are pie-slice filled.
For
.ZN ArcChord ,
the arcs are chord filled.
.LP
The graphics-exposure flag controls 
.ZN GraphicsExpose 
event generation
for 
.ZN XCopyArea 
and 
.ZN XCopyPlane
requests (and any similar requests defined by extensions).
.SH DIAGNOSTICS
.TP 1i
.ZN BadAlloc
The server failed to allocate the requested resource or server memory.
.TP 1i
.ZN BadDrawable
A value for a Drawable argument does not name a defined Window or Pixmap.
.TP 1i
.ZN BadFont
A value for a Font or GContext argument does not name a defined Font.
.TP 1i
.ZN BadGC
A value for a GContext argument does not name a defined GContext.
.TP 1i
.ZN BadMatch
An
.ZN InputOnly
window is used as a Drawable.
.TP 1i
.ZN BadMatch
Some argument or pair of arguments has the correct type and range but fails
to match in some other way required by the request.
.TP 1i
.ZN BadPixmap
A value for a Pixmap argument does not name a defined Pixmap.
.TP 1i
.ZN BadValue
Some numeric value falls outside the range of values accepted by the request.
Unless a specific range is specified for an argument, the full range defined
by the argument's type is accepted.  Any argument defined as a set of
alternatives can generate this error.
.SH "SEE ALSO"
AllPlanes(3X11),
XCopyArea(3X11),
XCreateRegion(3X11),
XDrawArc(3X11),
XDrawLine(3X11),
XDrawRectangle(3X11),
XDrawText(3X11),
XFillRectangle(3X11),
XQueryBestSize(3X11),
XSetArcMode(3X11),
XSetClipOrigin(3X11),
XSetFillStyle(3X11),
XSetFont(3X11),
XSetLineAttributes(3X11),
XSetState(3X11),
XSetTile(3X11)
.br
\fI\*(xL\fP