1
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1994, 1996 X Consortium
3
.\" Permission is hereby granted, free of charge, to any person obtaining
4
.\" a copy of this software and associated documentation files (the
5
.\" "Software"), to deal in the Software without restriction, including
6
.\" without limitation the rights to use, copy, modify, merge, publish,
7
.\" distribute, sublicense, and/or sell copies of the Software, and to
8
.\" permit persons to whom the Software is furnished to do so, subject to
9
.\" the following conditions:
11
.\" The above copyright notice and this permission notice shall be included
12
.\" in all copies or substantial portions of the Software.
14
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
.\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
18
.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19
.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20
.\" OTHER DEALINGS IN THE SOFTWARE.
22
.\" Except as contained in this notice, the name of the X Consortium shall
23
.\" not be used in advertising or otherwise to promote the sale, use or
24
.\" other dealings in this Software without prior written authorization
25
.\" from the X Consortium.
27
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991 by
28
.\" Digital Equipment Corporation
30
.\" Portions Copyright \(co 1990, 1991 by
33
.\" Permission to use, copy, modify and distribute this documentation for
34
.\" any purpose and without fee is hereby granted, provided that the above
35
.\" copyright notice appears in all copies and that both that copyright notice
36
.\" and this permission notice appear in all copies, and that the names of
37
.\" Digital and Tektronix not be used in in advertising or publicity pertaining
38
.\" to this documentation without specific, written prior permission.
39
.\" Digital and Tektronix makes no representations about the suitability
40
.\" of this documentation for any purpose.
41
.\" It is provided ``as is'' without express or implied warranty.
46
\s+1\fBChapter 6\fP\s-1
48
\s+1\fBColor Management Functions\fP\s-1
58
Chapter 6: Color Management Functions
60
Each X window always has an associated colormap that
61
provides a level of indirection between pixel values and colors displayed
63
Xlib provides functions that you can use to manipulate a colormap.
64
The X protocol defines colors using values in the RGB color space.
65
The RGB color space is device dependent;
66
rendering an RGB value on differing output devices typically results
68
Xlib also provides a means for clients to specify color using
69
device-independent color spaces for consistent results across devices.
70
Xlib supports device-independent color spaces derivable from the CIE XYZ
72
This includes the CIE XYZ, xyY, L*u*v*, and L*a*b* color spaces as well as
73
the TekHVC color space.
75
This chapter discusses how to:
77
Create, copy, and destroy a colormap
79
Specify colors by name or value
81
Allocate, modify, and free color cells
83
Read entries in a colormap
85
Convert between color spaces
87
Control aspects of color conversion
89
Query the color gamut of a screen
93
All functions, types, and symbols in this chapter with the prefix ``Xcms''
96
The remaining functions and types are defined in
99
Functions in this chapter manipulate the representation of color on the
101
For each possible value that a pixel can take in a window,
102
there is a color cell in the colormap.
104
if a window is 4 bits deep, pixel values 0 through 15 are defined.
105
A colormap is a collection of color cells.
106
A color cell consists of a triple of red, green, and blue (RGB) values.
107
The hardware imposes limits on the number of significant
108
bits in these values.
109
As each pixel is read out of display memory, the pixel
110
is looked up in a colormap.
111
The RGB value of the cell determines what color is displayed on the screen.
112
On a grayscale display with a black-and-white monitor,
113
the values are combined to determine the brightness on the screen.
115
Typically, an application allocates color cells or sets of color cells
116
to obtain the desired colors.
117
The client can allocate read-only cells.
119
the pixel values for these colors can be shared among multiple applications,
120
and the RGB value of the cell cannot be changed.
121
If the client allocates read/write cells,
122
they are exclusively owned by the client,
123
and the color associated with the pixel value can be changed at will.
124
Cells must be allocated (and, if read/write, initialized with an RGB value)
125
by a client to obtain desired colors.
126
The use of pixel value for an
127
unallocated cell results in an undefined color.
129
Because colormaps are associated with windows, X supports displays
130
with multiple colormaps and, indeed, different types of colormaps.
131
If there are insufficient colormap resources in the display,
132
some windows will display in their true colors, and others
133
will display with incorrect colors.
134
A window manager usually controls which windows are displayed
135
in their true colors if more than one colormap is required for
136
the color resources the applications are using.
137
At any time, there is a set of installed colormaps for a screen.
138
Windows using one of the installed colormaps display with true colors, and
139
windows using other colormaps generally display with incorrect colors.
140
You can control the set of installed colormaps by using
143
.PN XUninstallColormap .
145
Colormaps are local to a particular screen.
146
Screens always have a default colormap,
147
and programs typically allocate cells out of this colormap.
148
Generally, you should not write applications that monopolize
150
Although some hardware supports multiple colormaps installed at one time,
151
many of the hardware displays
152
built today support only a single installed colormap, so the primitives
153
are written to encourage sharing of colormap entries between applications.
157
macro returns the default colormap.
161
returns the default visual type for the specified screen.
163
Possible visual types are
175
\*(SN Color Structures
178
Functions that operate only on RGB color space values use an
180
structure, which contains:
182
.IN "XColor" "" "@DEF@"
188
unsigned long pixel; /* pixel value */
189
unsigned short red, green, blue; /* rgb values */
190
char flags; /* DoRed, DoGreen, DoBlue */
196
The red, green, and blue values are always in the range 0 to 65535
197
inclusive, independent of the number of bits actually used in the
199
The server scales these values down to the range used by the hardware.
200
Black is represented by (0,0,0),
201
and white is represented by (65535,65535,65535).
204
the flags member controls which of the red, green, and blue members is used
205
and can be the inclusive OR of zero or more of
212
Functions that operate on all color space values use an
215
This structure contains a union of substructures,
216
each supporting color specification encoding for a particular color space.
221
structure contains pixel
222
and color specification information (the spec member in the
225
.IN "XcmsColor" "" "@DEF@"
231
typedef unsigned long XcmsColorFormat; /* Color Specification Format */
246
XcmsColorFormat format;
247
} XcmsColor; /* Xcms Color Structure */
251
Because the color specification can be encoded for the various color spaces,
252
encoding for the spec member is identified by the format member,
254
.PN XcmsColorFormat .
255
The following macros define standard formats.
258
lw(.5i) lw(1.6i) lw(1.4i) lw(1.5i).
262
.PN XcmsUndefinedFormat
341
Formats for device-independent color spaces are
342
distinguishable from those for device-dependent spaces by the 32nd bit.
344
it indicates that the color specification is in a device-dependent form;
345
otherwise, it is in a device-independent form.
346
If the 31st bit is set,
347
this indicates that the color space has been added to Xlib at run time
348
(see section 6.12.4).
349
The format value for a color space added at run time may be different each
350
time the program is executed.
351
If references to such a color space must be made outside the client
352
(for example, storing a color specification in a file),
353
then reference should be made by color space string prefix
355
.PN XcmsFormatOfPrefix
357
.PN XcmsPrefixOfFormat ).
359
Data types that describe the color specification encoding for the various
360
color spaces are defined as follows:
362
.IN "XcmsRGB" "" "@DEF@"
367
typedef double XcmsFloat;
370
unsigned short red; /* 0x0000 to 0xffff */
371
unsigned short green; /* 0x0000 to 0xffff */
372
unsigned short blue; /* 0x0000 to 0xffff */
373
} XcmsRGB; /* RGB Device */
375
.IN "XcmsRGBi" "" "@DEF@"
381
XcmsFloat red; /* 0.0 to 1.0 */
382
XcmsFloat green; /* 0.0 to 1.0 */
383
XcmsFloat blue; /* 0.0 to 1.0 */
384
} XcmsRGBi; /* RGB Intensity */
386
.IN "XcmsCIEXYZ" "" "@DEF@"
393
XcmsFloat Y; /* 0.0 to 1.0 */
395
} XcmsCIEXYZ; /* CIE XYZ */
397
.IN "XcmsCIEuvY" "" "@DEF@"
403
XcmsFloat u_prime; /* 0.0 to ~0.6 */
404
XcmsFloat v_prime; /* 0.0 to ~0.6 */
405
XcmsFloat Y; /* 0.0 to 1.0 */
406
} XcmsCIEuvY; /* CIE u'v'Y */
408
.IN "XcmsCIExyY" "" "@DEF@"
414
XcmsFloat x; /* 0.0 to ~.75 */
415
XcmsFloat y; /* 0.0 to ~.85 */
416
XcmsFloat Y; /* 0.0 to 1.0 */
417
} XcmsCIExyY; /* CIE xyY */
419
.IN "XcmsCIELab" "" "@DEF@"
425
XcmsFloat L_star; /* 0.0 to 100.0 */
428
} XcmsCIELab; /* CIE L*a*b* */
430
.IN "XcmsCIELuv" "" "@DEF@"
436
XcmsFloat L_star; /* 0.0 to 100.0 */
439
} XcmsCIELuv; /* CIE L*u*v* */
441
.IN "XcmsTekHVC" "" "@DEF@"
447
XcmsFloat H; /* 0.0 to 360.0 */
448
XcmsFloat V; /* 0.0 to 100.0 */
449
XcmsFloat C; /* 0.0 to 100.0 */
450
} XcmsTekHVC; /* TekHVC */
452
.IN "XcmsPad" "" "@DEF@"
462
} XcmsPad; /* four doubles */
466
The device-dependent formats provided allow color specification in:
471
Red, green, and blue linear intensity values,
472
floating-point values from 0.0 to 1.0,
473
where 1.0 indicates full intensity, 0.5 half intensity, and so on.
478
Red, green, and blue values appropriate for the specified output device.
480
values are of type unsigned short,
481
scaled from 0 to 65535 inclusive,
482
and are interchangeable with the red, green, and blue values in an
486
It is important to note that RGB Intensity values are not gamma corrected
489
RGB Device values generated as a result of converting color specifications
490
are always gamma corrected, and
491
RGB Device values acquired as a result of querying a colormap
492
or passed in by the client are assumed by Xlib to be gamma corrected.
493
The term \fIRGB value\fP in this manual always refers to an RGB Device value.
500
Xlib provides a mechanism for using string names for colors.
501
A color string may either contain an abstract color name
502
or a numerical color specification.
503
Color strings are case-insensitive.
505
Color strings are used in the following functions:
509
.PN XcmsAllocNamedColor
519
Xlib supports the use of abstract color names, for example, red or blue.
520
A value for this abstract name is obtained by searching one or more color
522
Xlib first searches zero or more client-side databases;
523
the number, location, and content of these databases is
524
implementation-dependent and might depend on the current locale.
525
If the name is not found, Xlib then looks for the color in the
527
If the color name is not in the Host Portable Character Encoding,
528
the result is implementation-dependent.
530
A numerical color specification
531
consists of a color space name and a set of values in the following syntax:
535
\fI<color_space_name>\fP:\fI<value>/.../<value>\fP
539
The following are examples of valid color strings.
542
"CIEXYZ:0.3227/0.28133/0.2493"
545
"CIELuv:50.0/0.0/0.0"
547
The syntax and semantics of numerical specifications are given
548
for each standard color space in the following sections.
550
RGB Device String Specification
552
\*(SN RGB Device String Specification
555
An RGB Device specification is identified by
556
the prefix ``rgb:'' and conforms to the following syntax:
558
.\" Start marker code here
560
rgb:\fI<red>/<green>/<blue>\fP
562
\fI<red>\fP, \fI<green>\fP, \fI<blue>\fP := \fIh\fP | \fIhh\fP | \fIhhh\fP | \fIhhhh\fP
563
\fIh\fP := single hexadecimal digits (case insignificant)
565
.\" End marker code here
567
Note that \fIh\fP indicates the value scaled in 4 bits,
568
\fIhh\fP the value scaled in 8 bits,
569
\fIhhh\fP the value scaled in 12 bits,
570
and \fIhhhh\fP the value scaled in 16 bits, respectively.
572
Typical examples are the strings ``rgb:ea/75/52'' and ``rgb:ccc/320/320'',
573
but mixed numbers of hexadecimal digit strings
574
(``rgb:ff/a5/0'' and ``rgb:ccc/32/0'')
577
For backward compatibility, an older syntax for RGB Device is
578
supported, but its continued use is not encouraged.
579
The syntax is an initial sharp sign character followed by
580
a numeric specification, in one of the following formats:
582
.\" Start marker code here
587
#RRGGBB (8 bits each)
588
#RRRGGGBBB (12 bits each)
589
#RRRRGGGGBBBB (16 bits each)
591
.\" End marker code here
593
The R, G, and B represent single hexadecimal digits.
594
When fewer than 16 bits each are specified,
595
they represent the most significant bits of the value
596
(unlike the ``rgb:'' syntax, in which values are scaled).
597
For example, the string ``#3a7'' is the same as ``#3000a0007000''.
599
RGB Intensity String Specification
601
\*(SN RGB Intensity String Specification
604
An RGB intensity specification is identified
605
by the prefix ``rgbi:'' and conforms to the following syntax:
607
.\" Start marker code here
609
rgbi:\fI<red>/<green>/<blue>\fP
611
.\" End marker code here
613
Note that red, green, and blue are floating-point values
614
between 0.0 and 1.0, inclusive.
615
The input format for these values is an optional sign,
616
a string of numbers possibly containing a decimal point,
617
and an optional exponent field containing an E or e
618
followed by a possibly signed integer string.
620
Device-Independent String Specifications
622
\*(SN Device-Independent String Specifications
625
The standard device-independent string specifications have
626
the following syntax:
628
.\" Start marker code here
630
CIEXYZ:\fI<X>/<Y>/<Z>\fP
631
CIEuvY:\fI<u>/<v>/<Y>\fP
632
CIExyY:\fI<x>/<y>/<Y>\fP
633
CIELab:\fI<L>/<a>/<b>\fP
634
CIELuv:\fI<L>/<u>/<v>\fP
635
TekHVC:\fI<H>/<V>/<C>\fP
637
.\" End marker code here
639
All of the values (C, H, V, X, Y, Z, a, b, u, v, y, x) are
640
floating-point values.
641
The syntax for these values is an optional plus or minus sign,
642
a string of digits possibly containing a decimal point,
643
and an optional exponent field consisting of an ``E'' or ``e''
644
followed by an optional plus or minus followed by a string of digits.
646
Color Conversion Contexts and Gamut Mapping
648
\*(SN Color Conversion Contexts and Gamut Mapping
651
When Xlib converts device-independent color specifications
652
into device-dependent specifications and vice versa,
653
it uses knowledge about the color limitations of the screen hardware.
654
This information, typically called the device profile,
656
is available in a Color Conversion Context (CCC).
657
.IN "Color Conversion Context"
660
Because a specified color may be outside the color gamut of the target screen
661
and the white point associated with the color specification may differ
662
from the white point inherent to the screen,
663
Xlib applies gamut mapping when it encounters certain conditions:
666
Gamut compression occurs when conversion of device-independent
667
color specifications to device-dependent color specifications
668
results in a color out of the target screen's gamut.
670
White adjustment occurs when the inherent white point of the screen
671
differs from the white point assumed by the client.
673
Gamut handling methods are stored as callbacks in the CCC,
674
which in turn are used by the color space conversion routines.
675
Client data is also stored in the CCC for each callback.
676
The CCC also contains the white point the client assumes to be
677
associated with color specifications (that is, the Client White Point).
678
.IN "Client White Point"
679
.IN "Gamut compression"
681
.IN "White point adjustment"
682
The client can specify the gamut handling callbacks and client data
683
as well as the Client White Point.
684
Xlib does not preclude the X client from performing other
685
forms of gamut handling (for example, gamut expansion);
686
however, Xlib does not provide direct support for gamut handling
687
other than white adjustment and gamut compression.
689
Associated with each colormap is an initial CCC transparently generated by
691
.IN "Color Conversion Context" "creation"
693
when you specify a colormap as an argument to an Xlib function,
694
you are indirectly specifying a CCC.
695
.IN "CCC" "of colormap"
696
.IN "Color Conversion Context" "of colormap"
697
There is a default CCC associated with each screen.
698
Newly created CCCs inherit attributes from the default CCC,
699
so the default CCC attributes can be modified to affect new CCCs.
701
.IN "Color Conversion Context" "default"
703
Xcms functions in which gamut mapping can occur return
705
and have specific status values defined for them,
709
indicates that the function failed.
712
indicates that the function succeeded.
714
if the function performed any color conversion,
715
the colors did not need to be compressed.
717
.PN XcmsSuccessWithCompression
718
indicates the function performed color conversion
719
and at least one of the colors needed to be compressed.
720
The gamut compression method is determined by the gamut compression
721
procedure in the CCC that is specified directly as a function argument
722
or in the CCC indirectly specified by means of the colormap argument.
724
Creating, Copying, and Destroying Colormaps
726
\*(SN Creating, Copying, and Destroying Colormaps
729
To create a colormap for a screen, use
730
.PN XCreateColormap .
731
.IN "XCreateColormap" "" "@DEF@"
734
Colormap XCreateColormap\^(\^\fIdisplay\fP, \fIw\fP\^, \fIvisual\fP\^, \fIalloc\fP\^)
736
Display *\fIdisplay\fP\^;
740
Visual *\fIvisual\fP\^;
745
Specifies the connection to the X server.
746
.ds Wi on whose screen you want to create a colormap
748
Specifies the window \*(Wi.
750
Specifies a visual type supported on the screen.
751
If the visual type is not one supported by the screen,
756
Specifies the colormap entries to be allocated.
765
function creates a colormap of the specified visual type for the screen
766
on which the specified window resides and returns the colormap ID
768
Note that the specified window is only used to determine the screen.
770
The initial values of the colormap entries are undefined for the
781
the entries have defined values,
782
but those values are specific to the visual and are not defined by X.
793
For the other visual classes,
796
the colormap initially has no allocated entries,
797
and clients can allocate them.
798
For information about the visual types,
803
the entire colormap is allocated writable.
804
The initial values of all allocated entries are undefined.
809
the effect is as if an
811
call returned all pixel values from zero to N \- 1,
812
where N is the colormap entries value in the specified visual.
815
the effect is as if an
816
.PN XAllocColorPlanes
817
call returned a pixel value of zero and red_mask, green_mask,
818
and blue_mask values containing the same bits as the corresponding
819
masks in the specified visual.
820
However, in all cases,
821
none of these entries can be freed by using
834
To create a new colormap when the allocation out of a previously
835
shared colormap has failed because of resource exhaustion, use
836
.PN XCopyColormapAndFree .
837
.IN "XCopyColormapAndFree" "" "@DEF@"
840
Colormap XCopyColormapAndFree\^(\^\fIdisplay\fP, \fIcolormap\fP\^)
842
Display *\fIdisplay\fP\^;
844
Colormap \fIcolormap\fP\^;
847
Specifies the connection to the X server.
848
.IP \fIcolormap\fP 1i
849
Specifies the colormap.
853
.PN XCopyColormapAndFree
854
function creates a colormap of the same visual type and for the same screen
855
as the specified colormap and returns the new colormap ID.
856
It also moves all of the client's existing allocation from the specified
857
colormap to the new colormap with their color values intact
858
and their read-only or writable characteristics intact and frees those entries
859
in the specified colormap.
860
Color values in other entries in the new colormap are undefined.
861
If the specified colormap was created by the client with alloc set to
863
the new colormap is also created with
865
all color values for all entries are copied from the specified colormap,
866
and then all entries in the specified colormap are freed.
867
If the specified colormap was not created by the client with
869
the allocations to be moved are all those pixels and planes
870
that have been allocated by the client using
872
.PN XAllocNamedColor ,
873
.PN XAllocColorCells ,
875
.PN XAllocColorPlanes
876
and that have not been freed since they were allocated.
878
.PN XCopyColormapAndFree
886
To destroy a colormap, use
888
.IN "XFreeColormap" "" "@DEF@"
891
XFreeColormap\^(\^\fIdisplay\fP, \fIcolormap\fP\^)
893
Display *\fIdisplay\fP\^;
895
Colormap \fIcolormap\fP\^;
898
Specifies the connection to the X server.
899
.ds Cm that you want to destroy
900
.IP \fIcolormap\fP 1i
901
Specifies the colormap \*(Cm.
906
function deletes the association between the colormap resource ID
907
and the colormap and frees the colormap storage.
908
However, this function has no effect on the default colormap for a screen.
909
If the specified colormap is an installed map for a screen,
910
it is uninstalled (see
911
.PN XUninstallColormap ).
912
If the specified colormap is defined as the colormap for a window (by
914
.PN XSetWindowColormap ,
916
.PN XChangeWindowAttributes ),
918
changes the colormap associated with the window to
923
X does not define the colors displayed for a window with a colormap of
931
Mapping Color Names to Values
933
\*(SN Mapping Color Names to Values
937
To map a color name to an RGB value, use
940
.IN "XLookupColor" "" "@DEF@"
943
Status XLookupColor\^(\^\fIdisplay\fP, \fIcolormap\fP, \fIcolor_name\fP, \
944
\fIexact_def_return\fP\^, \fIscreen_def_return\fP\^)
946
Display *\fIdisplay\fP\^;
948
Colormap \fIcolormap\fP\^;
950
char *\fIcolor_name\fP\^;
952
XColor *\fIexact_def_return\fP\^, *\fIscreen_def_return\fP\^;
955
Specifies the connection to the X server.
956
.IP \fIcolormap\fP 1i
957
Specifies the colormap.
958
.IP \fIcolor_name\fP 1i
959
Specifies the color name string (for example, red) whose color
960
definition structure you want returned.
961
.IP \fIexact_def_return\fP 1i
962
Returns the exact RGB values.
963
.IP \fIscreen_def_return\fP 1i
964
Returns the closest RGB values provided by the hardware.
969
function looks up the string name of a color with respect to the screen
970
associated with the specified colormap.
971
It returns both the exact color values and
972
the closest values provided by the screen
973
with respect to the visual type of the specified colormap.
974
If the color name is not in the Host Portable Character Encoding,
975
the result is implementation-dependent.
976
Use of uppercase or lowercase does not matter.
978
returns nonzero if the name is resolved;
979
otherwise, it returns zero.
987
To map a color name to the exact RGB value, use
990
.IN "XParseColor" "" "@DEF@"
993
Status XParseColor\^(\^\fIdisplay\fP, \fIcolormap\fP\^, \^\fIspec\fP\^, \fIexact_def_return\fP\^)
995
Display *\fIdisplay\fP\^;
997
Colormap \fIcolormap\fP\^;
1001
XColor *\fIexact_def_return\fP\^;
1003
.IP \fIdisplay\fP 1i
1004
Specifies the connection to the X server.
1005
.IP \fIcolormap\fP 1i
1006
Specifies the colormap.
1008
Specifies the color name string;
1010
.IP \fIexact_def_return\fP 1i
1011
Returns the exact color value for later use and sets the
1021
function looks up the string name of a color with respect to the screen
1022
associated with the specified colormap.
1023
It returns the exact color value.
1024
If the color name is not in the Host Portable Character Encoding,
1025
the result is implementation-dependent.
1026
Use of uppercase or lowercase does not matter.
1028
returns nonzero if the name is resolved;
1029
otherwise, it returns zero.
1037
To map a color name to a value in an arbitrary color space, use
1038
.PN XcmsLookupColor .
1039
.IN "Color" "naming"
1040
.IN "XcmsLookupColor" "" "@DEF@"
1043
Status XcmsLookupColor\^(\^\fIdisplay\fP, \fIcolormap\fP\^, \fIcolor_string\fP\^, \fIcolor_exact_return\fP\^, \fIcolor_screen_return\fP\^,
1045
\fIresult_format\fP\^)
1047
Display *\fIdisplay\fP\^;
1049
Colormap \fIcolormap\fP\^;
1051
char *\fIcolor_string\fP\^;
1053
XcmsColor *\fIcolor_exact_return\fP\^, *\fIcolor_screen_return\fP\^;
1055
XcmsColorFormat \fIresult_format\fP\^;
1057
.IP \fIdisplay\fP 1i
1058
Specifies the connection to the X server.
1059
.IP \fIcolormap\fP 1i
1060
Specifies the colormap.
1062
.IP \fIcolor_string\fP 1i
1063
Specifies the color string\*(St.
1064
.IP \fIcolor_exact_return\fP 1i
1065
Returns the color specification parsed from the color string
1066
or parsed from the corresponding string found in a color-name database.
1067
.IP \fIcolor_screen_return\fP 1i
1068
Returns the color that can be reproduced on the screen.
1069
.IP \fIresult_format\fP 1i
1070
Specifies the color format for the returned color
1071
specifications (color_screen_return and color_exact_return arguments).
1073
.PN XcmsUndefinedFormat
1074
and the color string contains a
1075
numerical color specification,
1076
the specification is returned in the format used in that numerical
1077
color specification.
1079
.PN XcmsUndefinedFormat
1080
and the color string contains a color name,
1081
the specification is returned in the format used
1082
to store the color in the database.
1087
function looks up the string name of a color with respect to the screen
1088
associated with the specified colormap.
1089
It returns both the exact color values and
1090
the closest values provided by the screen
1091
with respect to the visual type of the specified colormap.
1092
The values are returned in the format specified by result_format.
1093
If the color name is not in the Host Portable Character Encoding,
1094
the result is implementation-dependent.
1095
Use of uppercase or lowercase does not matter.
1100
.PN XcmsSuccessWithCompression
1101
if the name is resolved; otherwise, it returns
1104
.PN XcmsSuccessWithCompression
1105
is returned, the color specification returned in
1106
color_screen_return is the result of gamut compression.
1108
Allocating and Freeing Color Cells
1110
\*(SN Allocating and Freeing Color Cells
1113
There are two ways of allocating color cells:
1114
explicitly as read-only entries, one pixel value at a time,
1116
where you can allocate a number of color cells and planes simultaneously.
1117
.IN "Read-only colormap cells"
1118
A read-only cell has its RGB value set by the server.
1119
.IN "Read/write colormap cells"
1120
Read/write cells do not have defined colors initially;
1121
functions described in the next section must be used to store values into them.
1122
Although it is possible for any client to store values into a read/write
1123
cell allocated by another client,
1124
read/write cells normally should be considered private to the client
1125
that allocated them.
1127
Read-only colormap cells are shared among clients.
1128
The server counts each allocation and freeing of the cell by clients.
1129
When the last client frees a shared cell, the cell is finally deallocated.
1130
If a single client allocates the same read-only cell multiple
1131
times, the server counts each such allocation, not just the first one.
1134
To allocate a read-only color cell with an RGB value, use
1136
.IN "Allocation" "read-only colormap cells"
1137
.IN "Read-only colormap cells" "allocating"
1138
.IN "Color" "allocation"
1139
.IN "XAllocColor" "" "@DEF@"
1142
Status XAllocColor\^(\^\fIdisplay\fP, \fIcolormap\fP\^, \fIscreen_in_out\fP\^)
1144
Display *\fIdisplay\fP\^;
1146
Colormap \fIcolormap\fP\^;
1148
XColor *\fIscreen_in_out\fP\^;
1150
.IP \fIdisplay\fP 1i
1151
Specifies the connection to the X server.
1152
.IP \fIcolormap\fP 1i
1153
Specifies the colormap.
1154
.IP \fIscreen_in_out\fP 1i
1155
Specifies and returns the values actually used in the colormap.
1160
function allocates a read-only colormap entry corresponding to the closest
1161
RGB value supported by the hardware.
1163
returns the pixel value of the color closest to the specified
1164
RGB elements supported by the hardware
1165
and returns the RGB value actually used.
1166
The corresponding colormap cell is read-only.
1169
returns nonzero if it succeeded or zero if it failed.
1171
.IN "Color" "allocation"
1172
.IN "Allocation" "colormap"
1173
.IN "read-only colormap cells"
1174
Multiple clients that request the same effective RGB value can be assigned
1175
the same read-only entry, thus allowing entries to be shared.
1176
When the last client deallocates a shared cell, it is deallocated.
1178
does not use or affect the flags in the
1191
To allocate a read-only color cell with a color in arbitrary format, use
1192
.PN XcmsAllocColor .
1193
.IN "Allocation" "read-only colormap cells"
1194
.IN "Read-only colormap cells" "allocating"
1195
.IN "Color" "allocation"
1196
.IN "XcmsAllocColor" "" "@DEF@"
1199
Status XcmsAllocColor\^(\^\fIdisplay\fP\^, \fIcolormap\fP\^, \fIcolor_in_out\fP\^, \fIresult_format\fP\^)
1201
Display *\fIdisplay\fP\^;
1203
Colormap \fIcolormap\fP\^;
1205
XcmsColor *\fIcolor_in_out\fP\^;
1207
XcmsColorFormat \fIresult_format\fP\^;
1209
.IP \fIdisplay\fP 1i
1210
Specifies the connection to the X server.
1211
.IP \fIcolormap\fP 1i
1212
Specifies the colormap.
1213
.IP \fIcolor_in_out\fP 1i
1214
Specifies the color to allocate and returns the pixel and color
1215
that is actually used in the colormap.
1216
.IP \fIresult_format\fP 1i
1217
Specifies the color format for the returned color specification.
1222
function is similar to
1224
except the color can be specified in any format.
1227
function ultimately calls
1229
to allocate a read-only color cell (colormap entry) with the specified color.
1231
first converts the color specified
1232
to an RGB value and then passes this to
1235
returns the pixel value of the color cell and the color specification
1237
This returned color specification is the result of converting the RGB value
1240
into the format specified with the result_format argument.
1241
If there is no interest in a returned color specification,
1242
unnecessary computation can be bypassed if result_format is set to
1244
The corresponding colormap cell is read-only.
1245
If this routine returns
1247
the color_in_out color specification is left unchanged.
1255
To allocate a read-only color cell using a color name and return the closest
1256
color supported by the hardware in RGB format, use
1257
.PN XAllocNamedColor .
1258
.IN "Allocation" "read-only colormap cells"
1259
.IN "Read-only colormap cells" "allocating"
1260
.IN "Color" "naming"
1261
.IN "Color" "allocation"
1262
.IN "XAllocNamedColor" "" "@DEF@"
1265
Status XAllocNamedColor\^(\^\fIdisplay\fP, \fIcolormap\fP\^, \
1266
\fIcolor_name\fP\^, \fIscreen_def_return\fP\^, \fIexact_def_return\fP\^)
1268
Display *\fIdisplay\fP\^;
1270
Colormap \fIcolormap\fP\^;
1272
char *\fIcolor_name\fP\^;
1274
XColor *\fIscreen_def_return\fP\^, *\fIexact_def_return\fP\^;
1276
.IP \fIdisplay\fP 1i
1277
Specifies the connection to the X server.
1278
.IP \fIcolormap\fP 1i
1279
Specifies the colormap.
1280
.IP \fIcolor_name\fP 1i
1281
Specifies the color name string (for example, red) whose color
1282
definition structure you want returned.
1283
.IP \fIscreen_def_return\fP 1i
1284
Returns the closest RGB values provided by the hardware.
1285
.IP \fIexact_def_return\fP 1i
1286
Returns the exact RGB values.
1290
.PN XAllocNamedColor
1291
function looks up the named color with respect to the screen that is
1292
associated with the specified colormap.
1293
It returns both the exact database definition and
1294
the closest color supported by the screen.
1295
The allocated color cell is read-only.
1296
The pixel value is returned in screen_def_return.
1297
If the color name is not in the Host Portable Character Encoding,
1298
the result is implementation-dependent.
1299
Use of uppercase or lowercase does not matter.
1300
If screen_def_return and exact_def_return
1301
point to the same structure, the pixel field will be set correctly,
1302
but the color values are undefined.
1303
.PN XAllocNamedColor
1304
returns nonzero if a cell is allocated;
1305
otherwise, it returns zero.
1307
.PN XAllocNamedColor
1313
To allocate a read-only color cell using a color name and return the closest
1314
color supported by the hardware in an arbitrary format, use
1315
.PN XcmsAllocNamedColor .
1316
.IN "Allocation" "read-only colormap cells"
1317
.IN "Read-only colormap cells" "allocating"
1318
.IN "Color" "naming"
1319
.IN "Color" "allocation"
1320
.IN "XcmsAllocNamedColor" "" "@DEF@"
1323
Status XcmsAllocNamedColor\^(\^\fIdisplay\fP\^, \fIcolormap\fP\^, \fIcolor_string\fP\^, \fIcolor_screen_return\fP\^, \fIcolor_exact_return\fP\^,
1325
\fIresult_format\fP\^)
1327
Display *\fIdisplay\fP\^;
1329
Colormap \fIcolormap\fP\^;
1331
char *\fIcolor_string\fP\^;
1333
XcmsColor *\fIcolor_screen_return\fP\^;
1335
XcmsColor *\fIcolor_exact_return\fP\^;
1337
XcmsColorFormat \fIresult_format\fP\^;
1339
.IP \fIdisplay\fP 1i
1340
Specifies the connection to the X server.
1341
.IP \fIcolormap\fP 1i
1342
Specifies the colormap.
1343
.ds St \ whose color definition structure is to be returned
1344
.IP \fIcolor_string\fP 1i
1345
Specifies the color string\*(St.
1346
.IP \fIcolor_screen_return\fP 1i
1347
Returns the pixel value of the color cell and color specification
1348
that actually is stored for that cell.
1349
.IP \fIcolor_exact_return\fP 1i
1350
Returns the color specification parsed from the color string
1351
or parsed from the corresponding string found in a color-name database.
1352
.IP \fIresult_format\fP 1i
1353
Specifies the color format for the returned color
1354
specifications (color_screen_return and color_exact_return arguments).
1356
.PN XcmsUndefinedFormat
1357
and the color string contains a
1358
numerical color specification,
1359
the specification is returned in the format used in that numerical
1360
color specification.
1362
.PN XcmsUndefinedFormat
1363
and the color string contains a color name,
1364
the specification is returned in the format used
1365
to store the color in the database.
1369
.PN XcmsAllocNamedColor
1370
function is similar to
1371
.PN XAllocNamedColor
1372
except that the color returned can be in any format specified.
1376
to allocate a read-only color cell with
1377
the color specified by a color string.
1378
The color string is parsed into an
1381
.PN XcmsLookupColor ),
1383
to an RGB value, and finally passed to
1385
If the color name is not in the Host Portable Character Encoding,
1386
the result is implementation-dependent.
1387
Use of uppercase or lowercase does not matter.
1389
This function returns both the color specification as a result
1390
of parsing (exact specification) and the actual color specification
1391
stored (screen specification).
1392
This screen specification is the result of converting the RGB value
1395
into the format specified in result_format.
1396
If there is no interest in a returned color specification,
1397
unnecessary computation can be bypassed if result_format is set to
1399
If color_screen_return and color_exact_return
1400
point to the same structure, the pixel field will be set correctly,
1401
but the color values are undefined.
1403
.PN XcmsAllocNamedColor
1409
To allocate read/write color cell and color plane combinations for a
1412
.PN XAllocColorCells .
1413
.IN "Read/write colormap cells" "allocating"
1414
.IN "Allocation" "read/write colormap cells"
1415
.IN "Color" "allocation"
1416
.IN "XAllocColorCells" "" "@DEF@"
1419
Status XAllocColorCells\^(\^\fIdisplay\fP, \fIcolormap\fP\^, \fIcontig\fP\^, \
1420
\fIplane_masks_return\fP\^, \fInplanes\fP\^,
1422
\fIpixels_return\fP\^, \fInpixels\fP\^)
1424
Display *\fIdisplay\fP\^;
1426
Colormap \fIcolormap\fP\^;
1428
Bool \fIcontig\fP\^;
1430
unsigned long \fIplane_masks_return\fP[\^]\^;
1432
unsigned int \fInplanes\fP\^;
1434
unsigned long \fIpixels_return\fP[\^]\^;
1436
unsigned int \fInpixels\fP\^;
1438
.IP \fIdisplay\fP 1i
1439
Specifies the connection to the X server.
1440
.IP \fIcolormap\fP 1i
1441
Specifies the colormap.
1443
Specifies a Boolean value that indicates whether the planes must be contiguous.
1444
.IP \fIplane_mask_return\fP 1i
1445
Returns an array of plane masks.
1446
.\" *** JIM: NEED MORE INFO FOR THIS. ***
1447
.IP \fInplanes\fP 1i
1448
Specifies the number of plane masks that are to be returned in the plane masks
1450
.IP \fIpixels_return\fP 1i
1451
Returns an array of pixel values.
1452
.IP \fInpixels\fP 1i
1453
Specifies the number of pixel values that are to be returned in the
1454
pixels_return array.
1461
.PN XAllocColorCells
1462
function allocates read/write color cells.
1463
The number of colors must be positive and the number of planes nonnegative,
1467
If ncolors and nplanes are requested,
1469
and nplane plane masks are returned.
1470
No mask will have any bits set to 1 in common with
1471
any other mask or with any of the pixels.
1472
By ORing together each pixel with zero or more masks,
1473
ncolors * %2 sup nplanes% distinct pixels can be produced.
1475
allocated writable by the request.
1480
each mask has exactly one bit set to 1.
1483
each has exactly three bits set to 1.
1486
and if all masks are ORed
1487
together, a single contiguous set of bits set to 1 will be formed for
1491
and three contiguous sets of bits set to 1 (one within each
1494
The RGB values of the allocated
1495
entries are undefined.
1496
.PN XAllocColorCells
1497
returns nonzero if it succeeded or zero if it failed.
1499
.PN XAllocColorCells
1507
To allocate read/write color resources for a
1510
.PN XAllocColorPlanes .
1511
.IN "Read/write colormap planes" "allocating"
1512
.IN "Allocation" "read/write colormap planes"
1513
.IN "Color" "allocation"
1514
.IN "XAllocColorPlanes" "" "@DEF@"
1517
Status XAllocColorPlanes\^(\^\fIdisplay\fP, \fIcolormap\fP\^, \fIcontig\fP\^, \fIpixels_return\fP\^, \fIncolors\fP\^, \fInreds\fP\^, \fIngreens\fP\^,
1519
\fInblues\fP\^, \fIrmask_return\fP\^, \fIgmask_return\fP\^, \fIbmask_return\fP\^)
1521
Display *\fIdisplay\fP\^;
1523
Colormap \fIcolormap\fP\^;
1525
Bool \fIcontig\fP\^;
1527
unsigned long \fIpixels_return\fP[\^]\^;
1529
int \fIncolors\fP\^;
1531
int \fInreds\fP\^, \fIngreens\fP\^, \fInblues\fP\^;
1533
unsigned long *\fIrmask_return\fP\^, *\fIgmask_return\fP\^, *\fIbmask_return\fP\^;
1535
.IP \fIdisplay\fP 1i
1536
Specifies the connection to the X server.
1537
.IP \fIcolormap\fP 1i
1538
Specifies the colormap.
1540
Specifies a Boolean value that indicates whether the planes must be contiguous.
1541
.IP \fIpixels_return\fP 1i
1542
Returns an array of pixel values.
1543
.PN XAllocColorPlanes
1544
returns the pixel values in this array.
1545
.IP \fIncolors\fP 1i
1546
Specifies the number of pixel values that are to be returned in the
1547
pixels_return array.
1551
.IP \fIngreens\fP 1i
1557
Specify the number of red, green, and blue planes.
1558
The value you pass must be nonnegative.
1559
.IP \fIrmask_return\fP 1i
1562
.IP \fIgmask_return\fP 1i
1565
.IP \fIbmask_return\fP 1i
1566
Return bit masks for the red, green, and blue planes.
1572
The specified ncolors must be positive;
1573
and nreds, ngreens, and nblues must be nonnegative,
1577
If ncolors colors, nreds reds, ngreens greens, and nblues blues are requested,
1578
ncolors pixels are returned; and the masks have nreds, ngreens, and
1579
nblues bits set to 1, respectively.
1583
a contiguous set of bits set to 1.
1584
No mask will have any bits set to 1 in common with
1585
any other mask or with any of the pixels.
1589
will lie within the corresponding pixel subfield.
1591
subsets of masks with each pixel value,
1592
ncolors * %2 sup (nreds+ngreens+nblues)% distinct pixel values can be produced.
1593
All of these are allocated by the request.
1595
colormap, there are only ncolors * %2 sup nreds% independent red entries,
1596
ncolors * %2 sup ngreens% independent green entries,
1597
and ncolors * %2 sup nblues% independent blue entries.
1598
This is true even for
1600
When the colormap entry of a pixel
1601
value is changed (using
1605
.PN XStoreNamedColor ),
1606
the pixel is decomposed according to the masks,
1607
and the corresponding independent entries are updated.
1608
.PN XAllocColorPlanes
1609
returns nonzero if it succeeded or zero if it failed.
1611
.PN XAllocColorPlanes
1619
.IN "Freeing" "colors"
1620
To free colormap cells, use
1622
.IN "XFreeColors" "" "@DEF@"
1623
.IN "Color" "deallocation"
1626
XFreeColors\^(\^\fIdisplay\fP, \fIcolormap\fP\^, \fIpixels\fP\^, \fInpixels\fP\^, \fIplanes\fP\^)
1628
Display *\fIdisplay\fP\^;
1630
Colormap \fIcolormap\fP\^;
1632
unsigned long \fIpixels\fP\^[\^];
1634
int \fInpixels\fP\^;
1636
unsigned long \fIplanes\fP\^;
1638
.IP \fIdisplay\fP 1i
1639
Specifies the connection to the X server.
1640
.IP \fIcolormap\fP 1i
1641
Specifies the colormap.
1642
.ds Pi that map to the cells in the specified colormap
1644
Specifies an array of pixel values \*(Pi.
1645
.IP \fInpixels\fP 1i
1646
Specifies the number of pixels.
1648
Specifies the planes you want to free.
1653
function frees the cells represented by pixels whose values are in the
1655
The planes argument should not have any bits set to 1 in common with any of the
1657
The set of all pixels is produced by ORing together subsets of
1658
the planes argument with the pixels.
1659
The request frees all of these pixels that
1660
were allocated by the client (using
1662
.IN XAllocNamedColor
1663
.IN XAllocColorCells
1664
.IN XAllocColorPlanes
1666
.PN XAllocNamedColor ,
1667
.PN XAllocColorCells ,
1669
.PN XAllocColorPlanes ).
1670
Note that freeing an
1671
individual pixel obtained from
1672
.PN XAllocColorPlanes
1673
may not actually allow
1674
it to be reused until all of its related pixels are also freed.
1676
a read-only entry is not actually freed until it has been freed by all clients,
1677
and if a client allocates the same read-only entry multiple times,
1678
it must free the entry that many times before the entry is actually freed.
1680
All specified pixels that are allocated by the client in the colormap are
1681
freed, even if one or more pixels produce an error.
1682
If a specified pixel is not a valid index into the colormap, a
1685
If a specified pixel is not allocated by the
1686
client (that is, is unallocated or is only allocated by another client)
1687
or if the colormap was created with all entries writable (by passing
1690
.PN XCreateColormap ),
1694
If more than one pixel is in error,
1695
the one that gets reported is arbitrary.
1705
Modifying and Querying Colormap Cells
1707
\*(SN Modifying and Querying Colormap Cells
1711
To store an RGB value in a single colormap cell, use
1713
.IN "Color" "storing"
1714
.IN "XStoreColor" "" "@DEF@"
1717
XStoreColor\^(\^\fIdisplay\fP, \fIcolormap\fP\^, \fIcolor\fP\^)
1719
Display *\fIdisplay\fP\^;
1721
Colormap \fIcolormap\fP\^;
1723
XColor *\fIcolor\fP\^;
1725
.IP \fIdisplay\fP 1i
1726
Specifies the connection to the X server.
1727
.IP \fIcolormap\fP 1i
1728
Specifies the colormap.
1730
Specifies the pixel and RGB values.
1735
function changes the colormap entry of the pixel value specified in the
1739
You specified this value in the
1743
This pixel value must be a read/write cell and a valid index into the colormap.
1744
If a specified pixel is not a valid index into the colormap,
1749
also changes the red, green, and/or blue color components.
1750
You specify which color components are to be changed by setting
1755
in the flags member of the
1758
If the colormap is an installed map for its screen,
1759
the changes are visible immediately.
1770
To store multiple RGB values in multiple colormap cells, use
1772
.IN "Color" "storing"
1773
.IN "XStoreColors" "" "@DEF@"
1776
XStoreColors\^(\^\fIdisplay\fP, \fIcolormap\fP\^, \fIcolor\fP\^, \fIncolors\fP\^)
1778
Display *\fIdisplay\fP\^;
1780
Colormap \fIcolormap\fP\^;
1782
XColor \fIcolor\fP\^[\^]\^;
1784
int \fIncolors\fP\^;
1786
.IP \fIdisplay\fP 1i
1787
Specifies the connection to the X server.
1788
.IP \fIcolormap\fP 1i
1789
Specifies the colormap.
1791
Specifies an array of color definition structures to be stored.
1792
.IP \fIncolors\fP 1i
1793
.\"Specifies the number of color definition structures.
1794
Specifies the number of
1796
structures in the color definition array.
1801
function changes the colormap entries of the pixel values
1802
specified in the pixel members of the
1805
You specify which color components are to be changed by setting
1810
in the flags member of the
1813
If the colormap is an installed map for its screen, the
1814
changes are visible immediately.
1816
changes the specified pixels if they are allocated writable in the colormap
1817
by any client, even if one or more pixels generates an error.
1818
If a specified pixel is not a valid index into the colormap, a
1821
If a specified pixel either is unallocated or is allocated read-only, a
1824
If more than one pixel is in error,
1825
the one that gets reported is arbitrary.
1836
To store a color of arbitrary format in a single colormap cell, use
1837
.PN XcmsStoreColor .
1838
.IN "Color" "storing"
1839
.IN "XcmsStoreColor" "" "@DEF@"
1842
Status XcmsStoreColor\^(\^\fIdisplay\fP, \fIcolormap\fP\^, \fIcolor\fP\^)
1844
Display *\fIdisplay\fP\^;
1846
Colormap \fIcolormap\fP\^;
1848
XcmsColor *\fIcolor\fP\^;
1850
.IP \fIdisplay\fP 1i
1851
Specifies the connection to the X server.
1852
.IP \fIcolormap\fP 1i
1853
Specifies the colormap.
1855
Specifies the color cell and the color to store.
1856
Values specified in this
1858
structure remain unchanged on return.
1863
function converts the color specified in the
1865
structure into RGB values.
1866
It then uses this RGB specification in an
1868
structure, whose three flags
1873
are set, in a call to
1875
to change the color cell specified by the pixel member of the
1878
This pixel value must be a valid index for the specified colormap,
1879
and the color cell specified by the pixel value must be a read/write cell.
1880
If the pixel value is not a valid index, a
1883
If the color cell is unallocated or is allocated read-only, a
1886
If the colormap is an installed map for its screen,
1887
the changes are visible immediately.
1891
has no return value; therefore, an
1893
return value from this function indicates that the conversion
1894
to RGB succeeded and the call to
1897
To obtain the actual color stored, use
1898
.PN XcmsQueryColor .
1899
Because of the screen's hardware limitations or gamut compression,
1900
the color stored in the colormap may not be identical
1901
to the color specified.
1912
To store multiple colors of arbitrary format in multiple colormap cells, use
1913
.PN XcmsStoreColors .
1914
.IN "Color" "storing"
1915
.IN "XcmsStoreColors" "" "@DEF@"
1918
Status XcmsStoreColors\^(\^\fIdisplay\fP, \fIcolormap\fP\^, \fIcolors\fP\^, \fIncolors\fP\^, \fIcompression_flags_return\fP\^)
1920
Display *\fIdisplay\fP\^;
1922
Colormap \fIcolormap\fP\^;
1924
XcmsColor \fIcolors\fP\^[\^]\^;
1926
int \fIncolors\fP\^;
1928
Bool \fIcompression_flags_return\fP\^[\^]\^;
1930
.IP \fIdisplay\fP 1i
1931
Specifies the connection to the X server.
1932
.IP \fIcolormap\fP 1i
1933
Specifies the colormap.
1935
Specifies the color specification array of
1937
structures, each specifying a color cell and the color to store in that
1939
Values specified in the array remain unchanged upon return.
1940
.IP \fIncolors\fP 1i
1941
Specifies the number of
1943
structures in the color-specification array.
1944
.IP \fIcompression_flags_return\fP 1i
1945
Returns an array of Boolean values indicating compression status.
1946
If a non-NULL pointer is supplied,
1947
each element of the array is set to
1949
if the corresponding color was compressed and
1952
Pass NULL if the compression status is not useful.
1957
function converts the colors specified in the array of
1959
structures into RGB values and then uses these RGB specifications in
1961
structures, whose three flags
1966
are set, in a call to
1968
to change the color cells specified by the pixel member of the corresponding
1971
Each pixel value must be a valid index for the specified colormap,
1972
and the color cell specified by each pixel value must be a read/write cell.
1973
If a pixel value is not a valid index, a
1976
If a color cell is unallocated or is allocated read-only, a
1979
If more than one pixel is in error,
1980
the one that gets reported is arbitrary.
1981
If the colormap is an installed map for its screen,
1982
the changes are visible immediately.
1986
has no return value; therefore, an
1988
return value from this function indicates that conversions
1989
to RGB succeeded and the call to
1992
To obtain the actual colors stored, use
1993
.PN XcmsQueryColors .
1994
Because of the screen's hardware limitations or gamut compression,
1995
the colors stored in the colormap may not be identical
1996
to the colors specified.
2007
To store a color specified by name in a single colormap cell, use
2008
.PN XStoreNamedColor .
2009
.IN "Color" "storing"
2010
.IN "Color" "naming"
2011
.IN "XStoreNamedColor" "" "@DEF@"
2014
XStoreNamedColor\^(\^\fIdisplay\fP, \fIcolormap\fP\^, \fIcolor\fP\^, \fIpixel\fP\^, \fIflags\fP\^)
2016
Display *\fIdisplay\fP\^;
2018
Colormap \fIcolormap\fP\^;
2020
char *\^\fIcolor\fP\^;
2022
unsigned long \fIpixel\fP\^;
2026
.IP \fIdisplay\fP 1i
2027
Specifies the connection to the X server.
2028
.IP \fIcolormap\fP 1i
2029
Specifies the colormap.
2031
Specifies the color name string (for example, red).
2033
Specifies the entry in the colormap.
2035
Specifies which red, green, and blue components are set.
2039
.PN XStoreNamedColor
2040
function looks up the named color with respect to the screen associated with
2041
the colormap and stores the result in the specified colormap.
2042
The pixel argument determines the entry in the colormap.
2043
The flags argument determines which of the red, green, and blue components
2045
You can set this member to the
2046
bitwise inclusive OR of the bits
2051
If the color name is not in the Host Portable Character Encoding,
2052
the result is implementation-dependent.
2053
Use of uppercase or lowercase does not matter.
2054
If the specified pixel is not a valid index into the colormap, a
2057
If the specified pixel either is unallocated or is allocated read-only, a
2061
.PN XStoreNamedColor
2074
functions take pixel values in the pixel member of
2076
structures and store in the structures the RGB values for those
2077
pixels from the specified colormap.
2078
The values returned for an unallocated entry are undefined.
2079
These functions also set the flags member in the
2081
structure to all three colors.
2082
If a pixel is not a valid index into the specified colormap, a
2085
If more than one pixel is in error,
2086
the one that gets reported is arbitrary.
2089
To query the RGB value of a single colormap cell, use
2091
.IN "Color" "querying"
2092
.IN "XQueryColor" "" "@DEF@"
2095
XQueryColor\^(\^\fIdisplay\fP, \fIcolormap\fP\^, \fIdef_in_out\fP\^)
2097
Display *\fIdisplay\fP\^;
2099
Colormap \fIcolormap\fP\^;
2101
XColor *\fIdef_in_out\fP\^;
2103
.IP \fIdisplay\fP 1i
2104
Specifies the connection to the X server.
2105
.IP \fIcolormap\fP 1i
2106
Specifies the colormap.
2107
.IP \fIdef_in_out\fP 1i
2108
Specifies and returns the RGB values for the pixel specified in the structure.
2113
function returns the current RGB value for the pixel in the
2115
structure and sets the
2130
To query the RGB values of multiple colormap cells, use
2132
.IN "Color" "querying"
2133
.IN "XQueryColors" "" "@DEF@"
2136
XQueryColors\^(\^\fIdisplay\fP, \fIcolormap\fP\^, \fIdefs_in_out\fP\^, \fIncolors\fP\^)
2138
Display *\fIdisplay\fP\^;
2140
Colormap \fIcolormap\fP\^;
2142
XColor \fIdefs_in_out\fP[\^]\^;
2144
int \fIncolors\fP\^;
2146
.IP \fIdisplay\fP 1i
2147
Specifies the connection to the X server.
2148
.IP \fIcolormap\fP 1i
2149
Specifies the colormap.
2150
.IP \fIdefs_in_out\fP 1i
2151
Specifies and returns an array of color definition structures for the pixel
2152
specified in the structure.
2153
.IP \fIncolors\fP 1i
2154
.\"Specifies the number of color definition structures.
2155
Specifies the number of
2157
structures in the color definition array.
2162
function returns the RGB value for each pixel in each
2164
structure and sets the
2169
flags in each structure.
2180
To query the color of a single colormap cell in an arbitrary format, use
2181
.PN XcmsQueryColor .
2182
.IN "Color" "querying"
2183
.IN "XcmsQueryColor" "" "@DEF@"
2186
Status XcmsQueryColor\^(\^\fIdisplay\fP, \fIcolormap\fP\^, \fIcolor_in_out\fP\^, \fIresult_format\fP\^)
2188
Display *\fIdisplay\fP\^;
2190
Colormap \fIcolormap\fP\^;
2192
XcmsColor *\fIcolor_in_out\fP\^;
2194
XcmsColorFormat \fIresult_format\fP\^;
2196
.IP \fIdisplay\fP 1i
2197
Specifies the connection to the X server.
2198
.IP \fIcolormap\fP 1i
2199
Specifies the colormap.
2200
.IP \fIcolor_in_out\fP 1i
2201
Specifies the pixel member that indicates the color cell to query.
2202
The color specification stored for the color cell is returned in this
2205
.IP \fIresult_format\fP 1i
2206
Specifies the color format for the returned color specification.
2211
function obtains the RGB value
2212
for the pixel value in the pixel member of the specified
2215
converts the value to the target format as
2216
specified by the result_format argument.
2217
If the pixel is not a valid index in the specified colormap, a
2229
To query the color of multiple colormap cells in an arbitrary format, use
2230
.PN XcmsQueryColors .
2231
.IN "Color" "querying"
2232
.IN "XcmsQueryColors" "" "@DEF@"
2235
Status XcmsQueryColors\^(\^\fIdisplay\fP, \fIcolormap\fP\^, \fIcolors_in_out\fP\^, \fIncolors\fP\^, \fIresult_format\fP\^)
2237
Display *\fIdisplay\fP\^;
2239
Colormap \fIcolormap\fP\^;
2241
XcmsColor \fIcolors_in_out\fP\^[\^]\^;
2243
unsigned int \fIncolors\fP\^;
2245
XcmsColorFormat \fIresult_format\fP\^;
2247
.IP \fIdisplay\fP 1i
2248
Specifies the connection to the X server.
2249
.IP \fIcolormap\fP 1i
2250
Specifies the colormap.
2251
.IP \fIcolors_in_out\fP 1i
2252
Specifies an array of
2254
structures, each pixel member indicating the color cell to query.
2255
The color specifications for the color cells are returned in these structures.
2256
.IP \fIncolors\fP 1i
2257
Specifies the number of
2259
structures in the color-specification array.
2260
.IP \fIresult_format\fP 1i
2261
Specifies the color format for the returned color specification.
2266
function obtains the RGB values
2267
for pixel values in the pixel members of
2270
converts the values to the target format as
2271
specified by the result_format argument.
2272
If a pixel is not a valid index into the specified colormap, a
2275
If more than one pixel is in error,
2276
the one that gets reported is arbitrary.
2285
Color Conversion Context Functions
2287
\*(SN Color Conversion Context Functions
2290
This section describes functions to create, modify,
2291
and query Color Conversion Contexts (CCCs).
2293
Associated with each colormap is an initial CCC transparently generated by
2295
.IN "Color Conversion Context" "creation"
2296
Therefore, when you specify a colormap as an argument to a function,
2297
you are indirectly specifying a CCC.
2298
.IN "CCC" "of colormap"
2299
.IN "Color Conversion Context" "of colormap"
2300
The CCC attributes that can be modified by the X client are:
2304
Gamut compression procedure and client data
2306
White point adjustment procedure and client data
2308
The initial values for these attributes are implementation specific.
2309
The CCC attributes for subsequently created CCCs can be defined
2310
by changing the CCC attributes of the default CCC.
2312
.IN "Color Conversion Context" "default"
2313
There is a default CCC associated with each screen.
2315
Getting and Setting the Color Conversion Context of a Colormap
2317
\*(SN Getting and Setting the Color Conversion Context of a Colormap
2321
To obtain the CCC associated with a colormap, use
2322
.PN XcmsCCCOfColormap .
2323
.IN "XcmsCCCOfColormap" "" "@DEF@"
2324
.IN "Colormap" "CCC of"
2325
.IN "CCC" "of colormap"
2326
.IN "Color Conversion Context" "of colormap"
2329
XcmsCCC XcmsCCCOfColormap\^(\^\fIdisplay\fP, \fIcolormap\fP\^)
2331
Display *\fIdisplay\fP\^;
2333
Colormap \fIcolormap\fP\^;
2335
.IP \fIdisplay\fP 1i
2336
Specifies the connection to the X server.
2337
.IP \fIcolormap\fP 1i
2338
Specifies the colormap.
2342
.PN XcmsCCCOfColormap
2343
function returns the CCC associated with the specified colormap.
2345
the CCC attributes can be queried or modified.
2346
Unless the CCC associated with the specified colormap is changed with
2347
.PN XcmsSetCCCOfColormap ,
2348
this CCC is used when the specified colormap is used as an argument
2352
To change the CCC associated with a colormap, use
2353
.PN XcmsSetCCCOfColormap .
2354
.IN "XcmsSetCCCOfColormap" "" "@DEF@"
2355
.IN "Colormap" "CCC of"
2356
.IN "CCC" "of colormap"
2357
.IN "Color Conversion Context" "of colormap"
2360
XcmsCCC XcmsSetCCCOfColormap\^(\^\fIdisplay\fP, \fIcolormap\fP\^, \fIccc\fP\^)
2362
Display *\fIdisplay\fP\^;
2364
Colormap \fIcolormap\fP\^;
2366
XcmsCCC \fIccc\fP\^;
2368
.IP \fIdisplay\fP 1i
2369
Specifies the connection to the X server.
2370
.IP \fIcolormap\fP 1i
2371
Specifies the colormap.
2377
.PN XcmsSetCCCOfColormap
2378
function changes the CCC associated with the specified colormap.
2379
It returns the CCC previously associated with the colormap.
2380
If they are not used again in the application,
2381
CCCs should be freed by calling
2383
Several colormaps may share the same CCC without restriction; this
2384
includes the CCCs generated by Xlib with each colormap. Xlib, however,
2385
creates a new CCC with each new colormap.
2387
Obtaining the Default Color Conversion Context
2389
\*(SN Obtaining the Default Color Conversion Context
2392
You can change the default CCC attributes for subsequently created CCCs
2393
by changing the CCC attributes of the default CCC.
2395
.IN "Color Conversion Context" "default"
2396
A default CCC is associated with each screen.
2399
To obtain the default CCC for a screen, use
2400
.PN XcmsDefaultCCC .
2401
.IN "XcmsDefaultCCC" "" "@DEF@"
2402
.IN "Color Conversion Context" "default"
2406
XcmsCCC XcmsDefaultCCC\^(\^\fIdisplay\fP, \fIscreen_number\fP\^)
2408
Display *\fIdisplay\fP\^;
2410
int \fIscreen_number\fP\^;
2412
.IP \fIdisplay\fP 1i
2413
Specifies the connection to the X server.
2414
.IP \fIscreen_number\fP 1i
2415
Specifies the appropriate screen number on the host server.
2420
function returns the default CCC for the specified screen.
2421
Its visual is the default visual of the screen.
2422
Its initial gamut compression and white point
2423
adjustment procedures as well as the associated client data are implementation
2426
Color Conversion Context Macros
2428
\*(SN Color Conversion Context Macros
2431
Applications should not directly modify any part of the
2433
The following lists the C language macros, their corresponding function
2434
equivalents for other language bindings, and what data they both
2438
.IN "DisplayOfCCC" "" "@DEF@"
2439
.IN "XcmsDisplayOfCCC" "" "@DEF@"
2442
DisplayOfCCC\^(\^\fIccc\fP\^)
2444
XcmsCCC \fIccc\fP\^;
2446
Display *XcmsDisplayOfCCC\^(\^\fIccc\fP\^)
2448
XcmsCCC \fIccc\fP\^;
2454
Both return the display associated with the specified CCC.
2457
.IN "VisualOfCCC" "" "@DEF@"
2458
.IN "XcmsVisualOfCCC" "" "@DEF@"
2461
VisualOfCCC\^(\^\fIccc\fP\^)
2463
XcmsCCC \fIccc\fP\^;
2465
Visual *XcmsVisualOfCCC\^(\^\fIccc\fP\^)
2467
XcmsCCC \fIccc\fP\^;
2473
Both return the visual associated with the specified CCC.
2476
.IN "ScreenNumberOfCCC" "" "@DEF@"
2477
.IN "XcmsScreenNumberOfCCC" "" "@DEF@"
2480
ScreenNumberOfCCC\^(\^\fIccc\fP\^)
2482
XcmsCCC \fIccc\fP\^;
2484
int XcmsScreenNumberOfCCC\^(\^\fIccc\fP\^)
2486
XcmsCCC \fIccc\fP\^;
2492
Both return the number of the screen associated with the specified CCC.
2495
.IN "ScreenWhitePointOfCCC" "" "@DEF@"
2496
.IN "XcmsScreenWhitePointOfCCC" "" "@DEF@"
2499
ScreenWhitePointOfCCC\^(\^\fIccc\fP\^)
2501
XcmsCCC \fIccc\fP\^;
2503
XcmsColor *XcmsScreenWhitePointOfCCC\^(\^\fIccc\fP\^)
2505
XcmsCCC \fIccc\fP\^;
2511
Both return the white point of the screen associated with the specified CCC.
2514
.IN "ClientWhitePointOfCCC" "" "@DEF@"
2515
.IN "XcmsClientWhitePointOfCCC" "" "@DEF@"
2518
ClientWhitePointOfCCC\^(\^\fIccc\fP\^)
2520
XcmsCCC \fIccc\fP\^;
2522
XcmsColor *XcmsClientWhitePointOfCCC\^(\^\fIccc\fP\^)
2524
XcmsCCC \fIccc\fP\^;
2530
Both return the Client White Point of the specified CCC.
2532
Modifying Attributes of a Color Conversion Context
2534
\*(SN Modifying Attributes of a Color Conversion Context
2537
To set the Client White Point in the CCC, use
2538
.PN XcmsSetWhitePoint .
2539
.IN "XcmsSetWhitePoint" "" "@DEF@"
2540
.IN "Client White Point" "of Color Conversion Context"
2543
Status XcmsSetWhitePoint\^(\^\fIccc\fP\^, \fIcolor\fP\^)
2545
XcmsCCC \fIccc\fP\^;
2547
XcmsColor *\fIcolor\fP\^;
2551
.ds Co new Client White Point
2553
Specifies the \*(Co.
2557
.PN XcmsSetWhitePoint
2558
function changes the Client White Point in the specified CCC.
2559
Note that the pixel member is ignored
2560
and that the color specification is left unchanged upon return.
2561
The format for the new white point must be
2562
.PN XcmsCIEXYZFormat ,
2563
.PN XcmsCIEuvYFormat ,
2564
.PN XcmsCIExyYFormat ,
2566
.PN XcmsUndefinedFormat .
2567
If the color argument is NULL, this function sets the format component of the
2568
Client White Point specification to
2569
.PN XcmsUndefinedFormat ,
2570
indicating that the Client White Point is assumed to be the same as the
2573
This function returns nonzero status
2574
if the format for the new white point is valid;
2575
otherwise, it returns zero.
2579
To set the gamut compression procedure and corresponding client data
2580
in a specified CCC, use
2581
.PN XcmsSetCompressionProc .
2582
.IN "XcmsSetCompressionProc" "" "@DEF@"
2583
.IN "Gamut compression" "setting in Color Conversion Context"
2584
.IN "Gamut compression" "procedure"
2585
.IN "Gamut compression" "client data"
2588
XcmsCompressionProc XcmsSetCompressionProc\^(\^\fIccc\fP\^, \fIcompression_proc\fP\^, \fIclient_data\fP\^)
2590
XcmsCCC \fIccc\fP\^;
2592
XcmsCompressionProc \fIcompression_proc\fP\^;
2594
XPointer \fIclient_data\fP\^;
2598
.IP \fIcompression_proc\fP 1i
2599
Specifies the gamut compression procedure that is to be applied
2600
when a color lies outside the screen's color gamut.
2601
If NULL is specified and a function using this CCC must convert
2602
a color specification to a device-dependent format and encounters a color
2603
that lies outside the screen's color gamut,
2604
that function will return
2606
.ds Cd the gamut compression procedure
2607
.IP \fIclient_data\fP 1i
2608
Specifies client data for \*(Cd or NULL.
2612
.PN XcmsSetCompressionProc
2613
function first sets the gamut compression procedure and client data
2614
in the specified CCC with the newly specified procedure and client data
2615
and then returns the old procedure.
2618
To set the white point adjustment procedure and corresponding client data
2619
in a specified CCC, use
2620
.PN XcmsSetWhiteAdjustProc .
2621
.IN "XcmsSetWhiteAdjustProc" "" "@DEF@"
2622
.IN "White point adjustment" "setting in Color Conversion Context"
2623
.IN "White point adjustment" "procedure"
2624
.IN "White point adjustment" "client data"
2627
XcmsWhiteAdjustProc XcmsSetWhiteAdjustProc\^(\^\fIccc\fP\^, \fIwhite_adjust_proc\fP\^, \fIclient_data\fP\^)
2629
XcmsCCC \fIccc\fP\^;
2631
XcmsWhiteAdjustProc \fIwhite_adjust_proc\fP\^;
2633
XPointer \fIclient_data\fP\^;
2637
.IP \fIwhite_adjust_proc\fP 1i
2638
Specifies the white point adjustment procedure.
2639
.ds Cd the white point adjustment procedure
2640
.IP \fIclient_data\fP 1i
2641
Specifies client data for \*(Cd or NULL.
2645
.PN XcmsSetWhiteAdjustProc
2646
function first sets the white point adjustment procedure and client data
2647
in the specified CCC with the newly specified procedure and client data
2648
and then returns the old procedure.
2650
Creating and Freeing a Color Conversion Context
2652
\*(SN Creating and Freeing a Color Conversion Context
2655
You can explicitly create a CCC within your application by calling
2657
These created CCCs can then be used by those functions that explicitly
2658
call for a CCC argument.
2659
Old CCCs that will not be used by the application should be freed using
2663
To create a CCC, use
2665
.IN "XcmsCreateCCC" "" "@DEF@"
2666
.IN "Color Conversion Context" "creation"
2667
.IN "CCC" "creation"
2670
XcmsCCC XcmsCreateCCC\^(\^\fIdisplay\fP, \fIscreen_number\fP\^, \fIvisual\fP\^, \fIclient_white_point\fP\^, \fIcompression_proc\fP\^,
2672
\fIcompression_client_data\fP\^, \fIwhite_adjust_proc\fP\^, \fIwhite_adjust_client_data\fP\^)
2674
Display *\fIdisplay\fP\^;
2676
int \fIscreen_number\fP\^;
2678
Visual *\fIvisual\fP\^;
2680
XcmsColor *\fIclient_white_point\fP\^;
2682
XcmsCompressionProc \fIcompression_proc\fP\^;
2684
XPointer \fIcompression_client_data\fP\^;
2686
XcmsWhiteAdjustProc \fIwhite_adjust_proc\fP\^;
2688
XPointer \fIwhite_adjust_client_data\fP\^;
2690
.IP \fIdisplay\fP 1i
2691
Specifies the connection to the X server.
2692
.IP \fIscreen_number\fP 1i
2693
Specifies the appropriate screen number on the host server.
2695
Specifies the visual type.
2696
.IP \fIclient_white_point\fP 1i
2697
Specifies the Client White Point.
2698
If NULL is specified,
2699
the Client White Point is to be assumed to be the same as the
2701
Note that the pixel member is ignored.
2702
.IP \fIcompression_proc\fP 1i
2703
Specifies the gamut compression procedure that is to be applied
2704
when a color lies outside the screen's color gamut.
2705
If NULL is specified and a function using this CCC must convert
2706
a color specification to a device-dependent format and encounters a color
2707
that lies outside the screen's color gamut,
2708
that function will return
2710
.IP \fIcompression_client_data\fP 1i
2711
Specifies client data for use by the gamut compression procedure or NULL.
2712
.IP \fIwhite_adjust_proc\fP 1i
2713
Specifies the white adjustment procedure that is to be applied
2714
when the Client White Point differs from the Screen White Point.
2715
NULL indicates that no white point adjustment is desired.
2716
.IP \fIwhite_adjust_client_data\fP 1i
2717
Specifies client data for use with the white point adjustment procedure or NULL.
2722
function creates a CCC for the specified display, screen, and visual.
2727
.IN "XcmsFreeCCC" "" "@DEF@"
2728
.IN "Color Conversion Context" "freeing"
2732
void XcmsFreeCCC\^(\^\fIccc\fP\^)
2734
XcmsCCC \fIccc\fP\^;
2742
function frees the memory used for the specified CCC.
2743
Note that default CCCs and those currently associated with colormaps
2746
Converting between Color Spaces
2748
\*(SN Converting between Color Spaces
2752
To convert an array of color specifications in arbitrary color formats
2753
to a single destination format, use
2754
.PN XcmsConvertColors .
2755
.IN "Color conversion"
2756
.IN "Color" "conversion"
2757
.IN "XcmsConvertColors" "" "@DEF@"
2760
Status XcmsConvertColors\^(\^\fIccc\fP\^, \fIcolors_in_out\fP\^, \fIncolors\fP\^, \fItarget_format\fP\^, \fIcompression_flags_return\fP\^)
2762
XcmsCCC \fIccc\fP\^;
2764
XcmsColor \fIcolors_in_out\fP\^[\^]\^;
2766
unsigned int \fIncolors\fP\^;
2768
XcmsColorFormat \fItarget_format\fP\^;
2770
Bool \fIcompression_flags_return\fP\^[\^]\^;
2774
If conversion is between device-independent color spaces only
2775
(for example, TekHVC to CIELuv),
2776
the CCC is necessary only to specify the Client White Point.
2777
.IP \fIcolors_in_out\fP 1i
2778
Specifies an array of color specifications.
2779
Pixel members are ignored and remain unchanged upon return.
2780
.IP \fIncolors\fP 1i
2781
Specifies the number of
2783
structures in the color-specification array.
2784
.IP \fItarget_format\fP 1i
2785
Specifies the target color specification format.
2786
.IP \fIcompression_flags_return\fP 1i
2787
Returns an array of Boolean values indicating compression status.
2788
If a non-NULL pointer is supplied,
2789
each element of the array is set to
2791
if the corresponding color was compressed and
2794
Pass NULL if the compression status is not useful.
2798
.PN XcmsConvertColors
2799
function converts the color specifications in the specified array of
2801
structures from their current format to a single target format,
2802
using the specified CCC.
2803
When the return value is
2805
the contents of the color specification array are left unchanged.
2807
The array may contain a mixture of color specification formats
2808
(for example, 3 CIE XYZ, 2 CIE Luv, and so on).
2809
When the array contains both device-independent and
2810
device-dependent color specifications and the target_format argument specifies
2811
a device-dependent format (for example,
2812
.PN XcmsRGBiFormat ,
2813
.PN XcmsRGBFormat ),
2814
all specifications are converted to CIE XYZ format and then to the target
2815
device-dependent format.
2819
\*(SN Callback Functions
2822
This section describes the gamut compression and white point
2823
adjustment callbacks.
2825
The gamut compression procedure specified in the CCC
2826
is called when an attempt to convert a color specification from
2828
to a device-dependent format (typically
2830
results in a color that lies outside the screen's color gamut.
2831
If the gamut compression procedure requires client data, this data is passed
2832
via the gamut compression client data in the CCC.
2834
During color specification conversion between device-independent
2835
and device-dependent color spaces,
2836
if a white point adjustment procedure is specified in the CCC,
2837
it is triggered when the Client White Point and Screen White Point differ.
2838
If required, the client data is obtained from the CCC.
2840
Prototype Gamut Compression Procedure
2842
\*(SN Prototype Gamut Compression Procedure
2845
The gamut compression callback interface must adhere to the
2847
.IN "XcmsCompressionProc" "" "@DEF@"
2850
typedef Status (*\^XcmsCompressionProc\^)\^(\^\fIccc\fP\^, \fIcolors_in_out\fP\^, \fIncolors\fP\^, \fIindex\fP\^, \fIcompression_flags_return\fP\^)
2852
XcmsCCC \fIccc\fP\^;
2854
XcmsColor \fIcolors_in_out[]\fP\^;
2856
unsigned int \fIncolors\fP\^;
2858
unsigned int \fIindex\fP\^;
2860
Bool \fIcompression_flags_return[]\fP\^;
2864
.IP \fIcolors_in_out\fP 1i
2865
Specifies an array of color specifications.
2866
Pixel members should be ignored and must remain unchanged upon return.
2867
.IP \fIncolors\fP 1i
2868
Specifies the number of
2870
structures in the color-specification array.
2872
Specifies the index into the array of
2874
structures for the encountered color specification that lies outside the
2875
screen's color gamut.
2876
Valid values are 0 (for the first element) to ncolors \- 1.
2877
.IP \fIcompression_flags_return\fP 1i
2878
Returns an array of Boolean values for indicating compression status.
2879
If a non-NULL pointer is supplied
2880
and a color at a given index is compressed, then
2882
should be stored at the corresponding index in this array;
2883
otherwise, the array should not be modified.
2886
When implementing a gamut compression procedure, consider the following
2887
rules and assumptions:
2889
The gamut compression procedure can attempt to compress one or multiple
2890
specifications at a time.
2892
When called, elements 0 to index \- 1 in the color specification
2893
array can be assumed to fall within the screen's color gamut.
2894
In addition, these color specifications are already in some device-dependent
2897
If any modifications are made to these color specifications,
2898
they must be in their initial device-dependent format upon return.
2900
When called, the element in the color specification array specified
2901
by the index argument contains the color specification outside the
2902
screen's color gamut encountered by the calling routine.
2903
In addition, this color specification can be assumed to be in
2905
Upon return, this color specification must be in
2908
When called, elements from index to ncolors \- 1
2909
in the color specification array may or may not fall within the
2910
screen's color gamut.
2911
In addition, these color specifications can be assumed to be in
2913
If any modifications are made to these color specifications,
2918
The color specifications passed to the gamut compression procedure
2919
have already been adjusted to the Screen White Point.
2920
This means that at this point the color specification's white point
2921
is the Screen White Point.
2923
If the gamut compression procedure uses a device-independent color space not
2924
initially accessible for use in the color management system, use
2925
.PN XcmsAddColorSpace
2926
to ensure that it is added.
2928
Supplied Gamut Compression Procedures
2930
\*(SN Supplied Gamut Compression Procedures
2933
The following equations are useful in describing gamut compression
2940
%CIELab~Psychometric~Chroma ~=~ sqrt(a_star sup 2 ~+~ b_star sup 2 )%
2942
%CIELab~Psychometric~Hue ~=~ tan sup -1 left [ b_star over a_star right ]%
2944
%CIELuv~Psychometric~Chroma ~=~ sqrt(u_star sup 2 ~+~ v_star sup 2 )%
2946
%CIELuv~Psychometric~Hue ~=~ tan sup -1 left [ v_star over u_star right ]%
2949
The gamut compression callback procedures provided by Xlib are as follows:
2953
This brings the encountered out-of-gamut color specification into the
2954
screen's color gamut by reducing or increasing CIE metric lightness (L*)
2955
in the CIE L*a*b* color space until the color is within the gamut.
2956
If the Psychometric Chroma of the color specification
2957
is beyond maximum for the Psychometric Hue Angle,
2958
then while maintaining the same Psychometric Hue Angle,
2959
the color will be clipped to the CIE L*a*b* coordinates of maximum
2960
Psychometric Chroma.
2962
.PN XcmsCIELabQueryMaxC .
2963
No client data is necessary.
2965
.PN XcmsCIELabClipab
2967
This brings the encountered out-of-gamut color specification into the
2968
screen's color gamut by reducing Psychometric Chroma,
2969
while maintaining Psychometric Hue Angle,
2970
until the color is within the gamut.
2971
No client data is necessary.
2973
.PN XcmsCIELabClipLab
2975
This brings the encountered out-of-gamut color specification into the
2976
screen's color gamut by replacing it with CIE L*a*b* coordinates
2977
that fall within the color gamut while maintaining the original
2979
Angle and whose vector to the original coordinates is the shortest attainable.
2980
No client data is necessary.
2984
This brings the encountered out-of-gamut color specification into the
2985
screen's color gamut by reducing or increasing CIE metric lightness (L*)
2986
in the CIE L*u*v* color space until the color is within the gamut.
2987
If the Psychometric Chroma of the color specification
2988
is beyond maximum for the Psychometric Hue Angle,
2989
then, while maintaining the same Psychometric Hue Angle,
2990
the color will be clipped to the CIE L*u*v* coordinates of maximum
2991
Psychometric Chroma.
2993
.PN XcmsCIELuvQueryMaxC .
2994
No client data is necessary.
2996
.PN XcmsCIELuvClipuv
2998
This brings the encountered out-of-gamut color specification into the
2999
screen's color gamut by reducing
3000
Psychometric Chroma, while maintaining Psychometric Hue Angle,
3001
until the color is within the gamut.
3002
No client data is necessary.
3004
.PN XcmsCIELuvClipLuv
3006
This brings the encountered out-of-gamut color specification into the
3007
screen's color gamut by replacing it with CIE L*u*v* coordinates
3008
that fall within the color gamut while maintaining the original
3010
Angle and whose vector to the original coordinates is the shortest attainable.
3011
No client data is necessary.
3015
This brings the encountered out-of-gamut color specification into the
3016
screen's color gamut by reducing or increasing the Value dimension
3017
in the TekHVC color space until the color is within the gamut.
3018
If Chroma of the color specification is beyond maximum for the particular Hue,
3019
then, while maintaining the same Hue,
3020
the color will be clipped to the Value and Chroma coordinates
3021
that represent maximum Chroma for that particular Hue.
3022
No client data is necessary.
3026
This brings the encountered out-of-gamut color specification into the
3027
screen's color gamut by reducing the Chroma dimension
3028
in the TekHVC color space until the color is within the gamut.
3029
No client data is necessary.
3031
.PN XcmsTekHVCClipVC
3033
This brings the encountered out-of-gamut color specification into the
3034
screen's color gamut by replacing it with TekHVC coordinates
3035
that fall within the color gamut while maintaining the original Hue
3036
and whose vector to the original coordinates is the shortest attainable.
3037
No client data is necessary.
3039
Prototype White Point Adjustment Procedure
3041
\*(SN Prototype White Point Adjustment Procedure
3044
The white point adjustment procedure interface must adhere to the following:
3045
.IN "XcmsWhiteAdjustProc" "" "@DEF@"
3048
typedef Status (*\^XcmsWhiteAdjustProc\^)\^(\^\fIccc\fP\^, \fIinitial_white_point\fP\^, \fItarget_white_point\fP\^, \fItarget_format\fP\^,
3050
\fIcolors_in_out\fP\^, \fIncolors\fP\^, \fIcompression_flags_return\fP\^)
3052
XcmsCCC \fIccc\fP\^;
3054
XcmsColor *\fIinitial_white_point\fP\^;
3056
XcmsColor *\fItarget_white_point\fP\^;
3058
XcmsColorFormat \fItarget_format\fP\^;
3060
XcmsColor \fIcolors_in_out[]\fP\^;
3062
unsigned int \fIncolors\fP\^;
3064
Bool \fIcompression_flags_return[]\fP\^;
3068
.IP \fIinitial_white_point\fP 1i
3069
Specifies the initial white point.
3070
.IP \fItarget_white_point\fP 1i
3071
Specifies the target white point.
3072
.IP \fItarget_format\fP 1i
3073
Specifies the target color specification format.
3074
.IP \fIcolors_in_out\fP 1i
3075
Specifies an array of color specifications.
3076
Pixel members should be ignored and must remain unchanged upon return.
3077
.IP \fIncolors\fP 1i
3078
Specifies the number of
3080
structures in the color-specification array.
3081
.IP \fIcompression_flags_return\fP 1i
3082
Returns an array of Boolean values for indicating compression status.
3083
If a non-NULL pointer is supplied
3084
and a color at a given index is compressed, then
3086
should be stored at the corresponding index in this array;
3087
otherwise, the array should not be modified.
3091
Supplied White Point Adjustment Procedures
3093
\*(SN Supplied White Point Adjustment Procedures
3096
White point adjustment procedures provided by Xlib are as follows:
3098
.PN XcmsCIELabWhiteShiftColors
3100
This uses the CIE L*a*b* color space for adjusting the chromatic character
3101
of colors to compensate for the chromatic differences between the source
3102
and destination white points.
3103
This procedure simply converts the color specifications to
3105
using the source white point and then converts to the target specification
3106
format using the destination's white point.
3107
No client data is necessary.
3109
.PN XcmsCIELuvWhiteShiftColors
3111
This uses the CIE L*u*v* color space for adjusting the chromatic character
3112
of colors to compensate for the chromatic differences between the source
3113
and destination white points.
3114
This procedure simply converts the color specifications to
3116
using the source white point and then converts to the target specification
3117
format using the destination's white point.
3118
No client data is necessary.
3120
.PN XcmsTekHVCWhiteShiftColors
3122
This uses the TekHVC color space for adjusting the chromatic character
3123
of colors to compensate for the chromatic differences between the source
3124
and destination white points.
3125
This procedure simply converts the color specifications to
3127
using the source white point and then converts to the target specification
3128
format using the destination's white point.
3129
An advantage of this procedure over those previously described
3130
is an attempt to minimize hue shift.
3131
No client data is necessary.
3133
From an implementation point of view,
3134
these white point adjustment procedures convert the color specifications
3135
to a device-independent but white-point-dependent color space
3136
(for example, CIE L*u*v*, CIE L*a*b*, TekHVC) using one white point
3137
and then converting those specifications to the target color space
3138
using another white point.
3140
the specification goes in the color space with one white point
3141
but comes out with another white point,
3142
resulting in a chromatic shift based on the chromatic displacement
3143
between the initial white point and target white point.
3144
The CIE color spaces that are assumed to be white-point-independent
3145
are CIE u'v'Y, CIE XYZ, and CIE xyY.
3146
When developing a custom white point adjustment procedure that uses a
3147
device-independent color space not initially accessible for use in the
3148
color management system, use
3149
.PN XcmsAddColorSpace
3150
to ensure that it is added.
3153
if the CCC specifies a white point adjustment procedure
3154
and if the Client White Point and Screen White Point differ, the
3156
function will use the white point adjustment
3162
A second time to convert from
3165
For example, assume the specification is in
3167
and the adjustment procedure is
3168
.PN XcmsCIELuvWhiteShiftColors .
3169
During conversion to
3173
results in the following series of color specification conversions:
3174
.\" Do these need to be font coded?
3180
using the Client White Point
3186
using the Screen White Point
3192
(CIE u'v'Y and XYZ are white-point-independent color spaces)
3204
The resulting RGB specification is passed to
3207
specification returned by
3209
is converted back to
3211
by reversing the color conversion sequence.
3213
Gamut Querying Functions
3215
\*(SN Gamut Querying Functions
3218
This section describes the gamut querying functions that Xlib provides.
3219
These functions allow the client to query the boundary
3220
of the screen's color gamut in terms of the CIE L*a*b*, CIE L*u*v*,
3221
and TekHVC color spaces.
3222
.IN "Gamut querying"
3223
Functions are also provided that allow you to query
3224
the color specification of:
3226
White (full-intensity red, green, and blue)
3228
Red (full-intensity red while green and blue are zero)
3230
Green (full-intensity green while red and blue are zero)
3232
Blue (full-intensity blue while red and green are zero)
3234
Black (zero-intensity red, green, and blue)
3236
The white point associated with color specifications passed to
3237
and returned from these gamut querying
3238
functions is assumed to be the Screen White Point.
3239
.IN "Screen White Point"
3240
This is a reasonable assumption,
3241
because the client is trying to query the screen's color gamut.
3243
The following naming convention is used for the Max and Min functions:
3246
Xcms\fI<color_space>\fPQueryMax\fI<dimensions>\fP
3248
Xcms\fI<color_space>\fPQueryMin\fI<dimensions>\fP
3251
The <dimensions> consists of a letter or letters
3252
that identify the dimensions of the color space
3255
.PN XcmsTekHVCQueryMaxC
3256
is given a fixed Hue and Value for which maximum Chroma is found.
3258
Red, Green, and Blue Queries
3260
\*(SN Red, Green, and Blue Queries
3263
To obtain the color specification for black
3264
(zero-intensity red, green, and blue), use
3265
.PN XcmsQueryBlack .
3266
.IN "XcmsQueryBlack" "" "@DEF@"
3269
Status XcmsQueryBlack\^(\^\fIccc\fP\^, \fItarget_format\fP\^, \fIcolor_return\fP\^)
3271
XcmsCCC \fIccc\fP\^;
3273
XcmsColorFormat \fItarget_format\fP\^;
3275
XcmsColor *\fIcolor_return\fP\^;
3279
The CCC's Client White Point and white point adjustment procedures
3281
.IP \fItarget_format\fP 1i
3282
Specifies the target color specification format.
3283
.ds Cs zero-intensity red, green, and blue
3284
.IP \fIcolor_return\fP 1i
3285
Returns the color specification in the specified target format
3287
The white point associated with the returned
3288
color specification is the Screen White Point.
3289
The value returned in the pixel member is undefined.
3294
function returns the color specification in the specified target format
3295
for zero-intensity red, green, and blue.
3298
To obtain the color specification for blue
3299
(full-intensity blue while red and green are zero), use
3301
.IN "XcmsQueryBlue" "" "@DEF@"
3304
Status XcmsQueryBlue\^(\^\fIccc\fP\^, \fItarget_format\fP\^, \fIcolor_return\fP\^)
3306
XcmsCCC \fIccc\fP\^;
3308
XcmsColorFormat \fItarget_format\fP\^;
3310
XcmsColor *\fIcolor_return\fP\^;
3314
The CCC's Client White Point and white point adjustment procedures
3316
.IP \fItarget_format\fP 1i
3317
Specifies the target color specification format.
3318
.ds Cs full-intensity blue while red and green are zero
3319
.IP \fIcolor_return\fP 1i
3320
Returns the color specification in the specified target format
3322
The white point associated with the returned
3323
color specification is the Screen White Point.
3324
The value returned in the pixel member is undefined.
3329
function returns the color specification in the specified target format
3330
for full-intensity blue while red and green are zero.
3333
To obtain the color specification for green
3334
(full-intensity green while red and blue are zero), use
3335
.PN XcmsQueryGreen .
3336
.IN "XcmsQueryGreen" "" "@DEF@"
3339
Status XcmsQueryGreen\^(\^\fIccc\fP\^, \fItarget_format\fP\^, \fIcolor_return\fP\^)
3341
XcmsCCC \fIccc\fP\^;
3343
XcmsColorFormat \fItarget_format\fP\^;
3345
XcmsColor *\fIcolor_return\fP\^;
3349
The CCC's Client White Point and white point adjustment procedures
3351
.IP \fItarget_format\fP 1i
3352
Specifies the target color specification format.
3353
.ds Cs full-intensity green while red and blue are zero
3354
.IP \fIcolor_return\fP 1i
3355
Returns the color specification in the specified target format
3357
The white point associated with the returned
3358
color specification is the Screen White Point.
3359
The value returned in the pixel member is undefined.
3364
function returns the color specification in the specified target format
3365
for full-intensity green while red and blue are zero.
3368
To obtain the color specification for red
3369
(full-intensity red while green and blue are zero), use
3371
.IN "XcmsQueryRed" "" "@DEF@"
3374
Status XcmsQueryRed\^(\^\fIccc\fP\^, \fItarget_format\fP\^, \fIcolor_return\fP\^)
3376
XcmsCCC \fIccc\fP\^;
3378
XcmsColorFormat \fItarget_format\fP\^;
3380
XcmsColor *\fIcolor_return\fP\^;
3384
The CCC's Client White Point and white point adjustment procedures
3386
.IP \fItarget_format\fP 1i
3387
Specifies the target color specification format.
3388
.ds Cs full-intensity red while green and blue are zero
3389
.IP \fIcolor_return\fP 1i
3390
Returns the color specification in the specified target format
3392
The white point associated with the returned
3393
color specification is the Screen White Point.
3394
The value returned in the pixel member is undefined.
3399
function returns the color specification in the specified target format
3400
for full-intensity red while green and blue are zero.
3403
To obtain the color specification for white
3404
(full-intensity red, green, and blue), use
3405
.PN XcmsQueryWhite .
3406
.IN "XcmsQueryWhite" "" "@DEF@"
3409
Status XcmsQueryWhite\^(\^\fIccc\fP\^, \fItarget_format\fP\^, \fIcolor_return\fP\^)
3411
XcmsCCC \fIccc\fP\^;
3413
XcmsColorFormat \fItarget_format\fP\^;
3415
XcmsColor *\fIcolor_return\fP\^;
3419
The CCC's Client White Point and white point adjustment procedures
3421
.IP \fItarget_format\fP 1i
3422
Specifies the target color specification format.
3423
.ds Cs full-intensity red, green, and blue
3424
.IP \fIcolor_return\fP 1i
3425
Returns the color specification in the specified target format
3427
The white point associated with the returned
3428
color specification is the Screen White Point.
3429
The value returned in the pixel member is undefined.
3434
function returns the color specification in the specified target format
3435
for full-intensity red, green, and blue.
3439
\*(SN CIELab Queries
3442
The following equations are useful in describing the CIELab query functions:
3447
.IN "Psychometric Hue Angle"
3448
.IN "CIE metric lightness"
3449
.IN "Psychometric Chroma"
3450
.IN "Psychometric Chroma" "maximum"
3452
%CIELab~Psychometric~Chroma ~=~ sqrt(a_star sup 2 ~+~ b_star sup 2 )%
3454
%CIELab~Psychometric~Hue ~=~ tan sup -1 left [ b_star over a_star right ]%
3457
To obtain the CIE L*a*b* coordinates of maximum Psychometric Chroma
3458
for a given Psychometric Hue Angle and CIE metric lightness (L*), use
3459
.PN XcmsCIELabQueryMaxC .
3460
.IN "XcmsCIELabQueryMaxC" "" "@DEF@"
3463
Status XcmsCIELabQueryMaxC\^(\^\fIccc\fP\^, \fIhue_angle\fP\^, \fIL_star\fP\^, \fIcolor_return\fP\^)
3465
XcmsCCC \fIccc\fP\^;
3467
XcmsFloat \fIhue_angle\fP\^;
3469
XcmsFloat \fIL_star\fP\^;
3471
XcmsColor *\fIcolor_return\fP\^;
3475
The CCC's Client White Point and white point adjustment procedures
3477
.ds Ha maximum chroma
3478
.IP \fIhue_angle\fP 1i
3479
Specifies the hue angle (in degrees) at which to find \*(Ha.
3480
.ds Ls maximum chroma
3482
Specifies the lightness (L*) at which to find \*(Ls.
3483
.ds Lc maximum chroma
3484
.ds lC hue angle and lightness
3485
.IP \fIcolor_return\fP 1i
3486
Returns the CIE L*a*b* coordinates of \*(Lc
3487
displayable by the screen for the given \*(lC.
3488
The white point associated with the returned
3489
color specification is the Screen White Point.
3490
The value returned in the pixel member is undefined.
3494
.PN XcmsCIELabQueryMaxC
3495
function, given a hue angle and lightness,
3496
finds the point of maximum chroma displayable by the screen.
3497
It returns this point in CIE L*a*b* coordinates.
3500
To obtain the CIE L*a*b* coordinates of maximum CIE metric lightness (L*)
3501
for a given Psychometric Hue Angle and Psychometric Chroma, use
3502
.PN XcmsCIELabQueryMaxL .
3503
.IN "Psychometric Hue Angle"
3504
.IN "CIE metric lightness"
3505
.IN "CIE metric lightness" "maximum"
3506
.IN "XcmsCIELabQueryMaxL" "" "@DEF@"
3509
Status XcmsCIELabQueryMaxL\^(\^\fIccc\fP\^, \fIhue_angle\fP\^, \fIchroma\fP\^, \fIcolor_return\fP\^)
3511
XcmsCCC \fIccc\fP\^;
3513
XcmsFloat \fIhue_angle\fP\^;
3515
XcmsFloat \fIchroma\fP\^;
3517
XcmsColor *\fIcolor_return\fP\^;
3521
The CCC's Client White Point and white point adjustment procedures
3523
.ds Ha maximum lightness
3524
.IP \fIhue_angle\fP 1i
3525
Specifies the hue angle (in degrees) at which to find \*(Ha.
3526
.ds Ch maximum lightness
3528
Specifies the chroma at which to find \*(Ch.
3529
.ds Lc maximum lightness
3530
.ds lC hue angle and chroma
3531
.IP \fIcolor_return\fP 1i
3532
Returns the CIE L*a*b* coordinates of \*(Lc
3533
displayable by the screen for the given \*(lC.
3534
The white point associated with the returned
3535
color specification is the Screen White Point.
3536
The value returned in the pixel member is undefined.
3540
.PN XcmsCIELabQueryMaxL
3541
function, given a hue angle and chroma,
3542
finds the point in CIE L*a*b* color space of maximum
3543
lightness (L*) displayable by the screen.
3544
It returns this point in CIE L*a*b* coordinates.
3547
return value usually indicates that the given chroma
3548
is beyond maximum for the given hue angle.
3551
To obtain the CIE L*a*b* coordinates of maximum Psychometric Chroma
3552
for a given Psychometric Hue Angle, use
3553
.PN XcmsCIELabQueryMaxLC .
3554
.IN "Psychometric Hue Angle"
3555
.IN "Psychometric Chroma"
3556
.IN "CIE metric lightness"
3557
.IN "Psychometric Chroma" "maximum"
3558
.IN "CIE metric lightness" "maximum"
3559
.IN "XcmsCIELabQueryMaxLC" "" "@DEF@"
3562
Status XcmsCIELabQueryMaxLC\^(\^\fIccc\fP\^, \fIhue_angle\fP\^, \fIcolor_return\fP\^)
3564
XcmsCCC \fIccc\fP\^;
3566
XcmsFloat \fIhue_angle\fP\^;
3568
XcmsColor *\fIcolor_return\fP\^;
3572
The CCC's Client White Point and white point adjustment procedures
3574
.ds Ha maximum chroma
3575
.IP \fIhue_angle\fP 1i
3576
Specifies the hue angle (in degrees) at which to find \*(Ha.
3577
.ds Lc maximum chroma
3579
.IP \fIcolor_return\fP 1i
3580
Returns the CIE L*a*b* coordinates of \*(Lc
3581
displayable by the screen for the given \*(lC.
3582
The white point associated with the returned
3583
color specification is the Screen White Point.
3584
The value returned in the pixel member is undefined.
3588
.PN XcmsCIELabQueryMaxLC
3589
function, given a hue angle,
3590
finds the point of maximum chroma displayable by the screen.
3591
It returns this point in CIE L*a*b* coordinates.
3594
To obtain the CIE L*a*b* coordinates of minimum CIE metric lightness (L*)
3595
for a given Psychometric Hue Angle and Psychometric Chroma, use
3596
.PN XcmsCIELabQueryMinL .
3597
.IN "Psychometric Hue Angle"
3598
.IN "CIE metric lightness"
3599
.IN "CIE metric lightness" "minimum"
3600
.IN "XcmsCIELabQueryMinL" "" "@DEF@"
3603
Status XcmsCIELabQueryMinL\^(\^\fIccc\fP\^, \fIhue_angle\fP\^, \fIchroma\fP\^, \fIcolor_return\fP\^)
3605
XcmsCCC \fIccc\fP\^;
3607
XcmsFloat \fIhue_angle\fP\^;
3609
XcmsFloat \fIchroma\fP\^;
3611
XcmsColor *\fIcolor_return\fP\^;
3615
The CCC's Client White Point and white point adjustment procedures
3617
.ds Ha minimum lightness
3618
.IP \fIhue_angle\fP 1i
3619
Specifies the hue angle (in degrees) at which to find \*(Ha.
3620
.ds Ch minimum lightness
3622
Specifies the chroma at which to find \*(Ch.
3623
.ds Lc minimum lightness
3624
.ds lC hue angle and chroma
3625
.IP \fIcolor_return\fP 1i
3626
Returns the CIE L*a*b* coordinates of \*(Lc
3627
displayable by the screen for the given \*(lC.
3628
The white point associated with the returned
3629
color specification is the Screen White Point.
3630
The value returned in the pixel member is undefined.
3634
.PN XcmsCIELabQueryMinL
3635
function, given a hue angle and chroma,
3636
finds the point of minimum lightness (L*) displayable by the screen.
3637
It returns this point in CIE L*a*b* coordinates.
3640
return value usually indicates that the given chroma
3641
is beyond maximum for the given hue angle.
3645
\*(SN CIELuv Queries
3648
The following equations are useful in describing the CIELuv query functions:
3653
.IN "Psychometric Hue Angle"
3654
.IN "CIE metric lightness"
3655
.IN "Psychometric Chroma"
3656
.IN "Psychometric Chroma" "maximum"
3658
%CIELuv~Psychometric~Chroma ~=~ sqrt(u_star sup 2 ~+~ v_star sup 2 )%
3660
%CIELuv~Psychometric~Hue ~=~ tan sup -1 left [ v_star over u_star right ]%
3664
To obtain the CIE L*u*v* coordinates of maximum Psychometric Chroma
3665
for a given Psychometric Hue Angle and CIE metric lightness (L*), use
3666
.PN XcmsCIELuvQueryMaxC .
3667
.IN "XcmsCIELuvQueryMaxC" "" "@DEF@"
3670
Status XcmsCIELuvQueryMaxC\^(\^\fIccc\fP\^, \fIhue_angle\fP\^, \fIL_star\fP\^, \fIcolor_return\fP\^)
3672
XcmsCCC \fIccc\fP\^;
3674
XcmsFloat \fIhue_angle\fP\^;
3676
XcmsFloat \fIL_star\fP\^;
3678
XcmsColor *\fIcolor_return\fP\^;
3682
The CCC's Client White Point and white point adjustment procedures
3684
.ds Ha maximum chroma
3685
.IP \fIhue_angle\fP 1i
3686
Specifies the hue angle (in degrees) at which to find \*(Ha.
3687
.ds Ls maximum chroma
3689
Specifies the lightness (L*) at which to find \*(Ls.
3690
.ds Lc maximum chroma
3691
.ds lC hue angle and lightness
3692
.IP \fIcolor_return\fP 1i
3693
Returns the CIE L*u*v* coordinates of \*(Lc
3694
displayable by the screen for the given \*(lC.
3695
The white point associated with the returned
3696
color specification is the Screen White Point.
3697
The value returned in the pixel member is undefined.
3701
.PN XcmsCIELuvQueryMaxC
3702
function, given a hue angle and lightness,
3703
finds the point of maximum chroma displayable by the screen.
3704
It returns this point in CIE L*u*v* coordinates.
3707
To obtain the CIE L*u*v* coordinates of maximum CIE metric lightness (L*)
3708
for a given Psychometric Hue Angle and Psychometric Chroma, use
3709
.PN XcmsCIELuvQueryMaxL .
3710
.IN "Psychometric Hue Angle"
3711
.IN "CIE metric lightness"
3712
.IN "CIE metric lightness" "maximum"
3713
.IN "XcmsCIELuvQueryMaxL" "" "@DEF@"
3716
Status XcmsCIELuvQueryMaxL\^(\^\fIccc\fP\^, \fIhue_angle\fP\^, \fIchroma\fP\^, \fIcolor_return\fP\^)
3718
XcmsCCC \fIccc\fP\^;
3720
XcmsFloat \fIhue_angle\fP\^;
3722
XcmsFloat \fIchroma\fP\^;
3724
XcmsColor *\fIcolor_return\fP\^;
3728
The CCC's Client White Point and white point adjustment procedures
3730
.ds Ha maximum lightness
3731
.IP \fIhue_angle\fP 1i
3732
Specifies the hue angle (in degrees) at which to find \*(Ha.
3733
.ds Ls maximum lightness
3735
Specifies the lightness (L*) at which to find \*(Ls.
3736
.ds Lc maximum lightness
3737
.ds lC hue angle and chroma
3738
.IP \fIcolor_return\fP 1i
3739
Returns the CIE L*u*v* coordinates of \*(Lc
3740
displayable by the screen for the given \*(lC.
3741
The white point associated with the returned
3742
color specification is the Screen White Point.
3743
The value returned in the pixel member is undefined.
3747
.PN XcmsCIELuvQueryMaxL
3748
function, given a hue angle and chroma,
3749
finds the point in CIE L*u*v* color space of maximum
3750
lightness (L*) displayable by the screen.
3751
It returns this point in CIE L*u*v* coordinates.
3754
return value usually indicates that the given chroma
3755
is beyond maximum for the given hue angle.
3758
To obtain the CIE L*u*v* coordinates of maximum Psychometric Chroma
3759
for a given Psychometric Hue Angle, use
3760
.PN XcmsCIELuvQueryMaxLC .
3761
.IN "Psychometric Hue Angle"
3762
.IN "Psychometric Chroma"
3763
.IN "CIE metric lightness"
3764
.IN "Psychometric Chroma" "maximum"
3765
.IN "CIE metric lightness" "maximum"
3766
.IN "XcmsCIELuvQueryMaxLC" "" "@DEF@"
3769
Status XcmsCIELuvQueryMaxLC\^(\^\fIccc\fP\^, \fIhue_angle\fP\^, \fIcolor_return\fP\^)
3771
XcmsCCC \fIccc\fP\^;
3773
XcmsFloat \fIhue_angle\fP\^;
3775
XcmsColor *\fIcolor_return\fP\^;
3779
The CCC's Client White Point and white point adjustment procedures
3781
.ds Ha maximum chroma
3782
.IP \fIhue_angle\fP 1i
3783
Specifies the hue angle (in degrees) at which to find \*(Ha.
3784
.ds Lc maximum chroma
3786
.IP \fIcolor_return\fP 1i
3787
Returns the CIE L*u*v* coordinates of \*(Lc
3788
displayable by the screen for the given \*(lC.
3789
The white point associated with the returned
3790
color specification is the Screen White Point.
3791
The value returned in the pixel member is undefined.
3795
.PN XcmsCIELuvQueryMaxLC
3796
function, given a hue angle,
3797
finds the point of maximum chroma displayable by the screen.
3798
It returns this point in CIE L*u*v* coordinates.
3801
To obtain the CIE L*u*v* coordinates of minimum CIE metric lightness (L*)
3802
for a given Psychometric Hue Angle and Psychometric Chroma, use
3803
.PN XcmsCIELuvQueryMinL .
3804
.IN "Psychometric Hue Angle"
3805
.IN "CIE metric lightness"
3806
.IN "CIE metric lightness" "minimum"
3807
.IN "XcmsCIELuvQueryMinL" "" "@DEF@"
3810
Status XcmsCIELuvQueryMinL\^(\^\fIccc\fP\^, \fIhue_angle\fP\^, \fIchroma\fP\^, \fIcolor_return\fP\^)
3812
XcmsCCC \fIccc\fP\^;
3814
XcmsFloat \fIhue_angle\fP\^;
3816
XcmsFloat \fIchroma\fP\^;
3818
XcmsColor *\fIcolor_return\fP\^;
3822
The CCC's Client White Point and white point adjustment procedures
3824
.ds Ha minimum lightness
3825
.IP \fIhue_angle\fP 1i
3826
Specifies the hue angle (in degrees) at which to find \*(Ha.
3827
.ds Ch minimum lightness
3829
Specifies the chroma at which to find \*(Ch.
3830
.ds Lc minimum lightness
3831
.ds lC hue angle and chroma
3832
.IP \fIcolor_return\fP 1i
3833
Returns the CIE L*u*v* coordinates of \*(Lc
3834
displayable by the screen for the given \*(lC.
3835
The white point associated with the returned
3836
color specification is the Screen White Point.
3837
The value returned in the pixel member is undefined.
3841
.PN XcmsCIELuvQueryMinL
3842
function, given a hue angle and chroma,
3843
finds the point of minimum lightness (L*) displayable by the screen.
3844
It returns this point in CIE L*u*v* coordinates.
3847
return value usually indicates that the given chroma
3848
is beyond maximum for the given hue angle.
3852
\*(SN TekHVC Queries
3855
To obtain the maximum Chroma for a given Hue and Value, use
3856
.PN XcmsTekHVCQueryMaxC .
3858
.IN "Chroma" "maximum"
3859
.IN "XcmsTekHVCQueryMaxC" "" "@DEF@"
3862
Status XcmsTekHVCQueryMaxC\^(\^\fIccc\fP\^, \fIhue\fP\^, \fIvalue\fP\^, \fIcolor_return\fP\^)
3864
XcmsCCC \fIccc\fP\^;
3866
XcmsFloat \fIhue\fP\^;
3868
XcmsFloat \fIvalue\fP\^;
3870
XcmsColor *\fIcolor_return\fP\^;
3874
The CCC's Client White Point and white point adjustment procedures
3876
.ds Hu in which to find the maximum Chroma
3878
Specifies the Hue \*(Hu.
3879
.ds Va maximum Chroma
3881
Specifies the Value in which to find the \*(Va.
3882
.ds Lc maximum Chroma along with the actual Hue and Value
3883
.ds lC maximum Chroma
3884
.IP \fIcolor_return\fP 1i
3885
Returns the \*(Lc at which the \*(lC was found.
3886
The white point associated with the returned
3887
color specification is the Screen White Point.
3888
The value returned in the pixel member is undefined.
3892
.PN XcmsTekHVCQueryMaxC
3893
function, given a Hue and Value,
3894
determines the maximum Chroma in TekHVC color space
3895
displayable by the screen.
3896
It returns the maximum Chroma along with the actual Hue
3897
and Value at which the maximum Chroma was found.
3900
To obtain the maximum Value for a given Hue and Chroma, use
3901
.PN XcmsTekHVCQueryMaxV .
3903
.IN "Value" "maximum"
3904
.IN "XcmsTekHVCQueryMaxV" "" "@DEF@"
3907
Status XcmsTekHVCQueryMaxV\^(\^\fIccc\fP\^, \fIhue\fP\^, \fIchroma\fP\^, \fIcolor_return\fP\^)
3909
XcmsCCC \fIccc\fP\^;
3911
XcmsFloat \fIhue\fP\^;
3913
XcmsFloat \fIchroma\fP\^;
3915
XcmsColor *\fIcolor_return\fP\^;
3919
The CCC's Client White Point and white point adjustment procedures
3921
.ds Hu in which to find the maximum Value
3923
Specifies the Hue \*(Hu.
3924
.ds Ch maximum Value
3926
Specifies the chroma at which to find \*(Ch.
3927
.ds Lc maximum Value along with the Hue and Chroma
3928
.ds lC maximum Value
3929
.IP \fIcolor_return\fP 1i
3930
Returns the \*(Lc at which the \*(lC was found.
3931
The white point associated with the returned
3932
color specification is the Screen White Point.
3933
The value returned in the pixel member is undefined.
3937
.PN XcmsTekHVCQueryMaxV
3938
function, given a Hue and Chroma,
3939
determines the maximum Value in TekHVC color space
3940
displayable by the screen.
3941
It returns the maximum Value and the actual Hue and Chroma
3942
at which the maximum Value was found.
3945
To obtain the maximum Chroma and Value at which it is reached
3946
for a specified Hue, use
3947
.PN XcmsTekHVCQueryMaxVC .
3950
.IN "Chroma" "maximum"
3951
.IN "Value" "maximum"
3952
.IN "XcmsTekHVCQueryMaxVC" "" "@DEF@"
3955
Status XcmsTekHVCQueryMaxVC\^(\^\fIccc\fP\^, \fIhue\fP\^, \fIcolor_return\fP\^)
3957
XcmsCCC \fIccc\fP\^;
3959
XcmsFloat \fIhue\fP\^;
3961
XcmsColor *\fIcolor_return\fP\^;
3965
The CCC's Client White Point and white point adjustment procedures
3967
.ds Hu in which to find the maximum Chroma
3969
Specifies the Hue \*(Hu.
3970
.ds Lc color specification in \
3971
XcmsTekHVC for the maximum Chroma, the Value at which \
3972
that maximum Chroma is reached, and the actual Hue
3973
.ds lC maximum Chroma
3974
.IP \fIcolor_return\fP 1i
3975
Returns the \*(Lc at which the \*(lC was found.
3976
The white point associated with the returned
3977
color specification is the Screen White Point.
3978
The value returned in the pixel member is undefined.
3982
.PN XcmsTekHVCQueryMaxVC
3983
function, given a Hue,
3984
determines the maximum Chroma in TekHVC color space displayable by the screen
3985
and the Value at which that maximum Chroma is reached.
3986
It returns the maximum Chroma,
3987
the Value at which that maximum Chroma is reached,
3988
and the actual Hue for which the maximum Chroma was found.
3991
To obtain a specified number of TekHVC specifications such that they
3992
contain maximum Values for a specified Hue and the
3993
Chroma at which the maximum Values are reached, use
3994
.PN XcmsTekHVCQueryMaxVSamples .
3997
.IN "Chroma" "maximum"
3998
.IN "Value" "maximum"
3999
.IN "XcmsTekHVCQueryMaxVSamples" "" "@DEF@"
4002
Status XcmsTekHVCQueryMaxVSamples\^(\^\fIccc\fP\^, \fIhue\fP\^, \fIcolors_return\fP\^, \fInsamples\fP\^)
4004
XcmsCCC \fIccc\fP\^;
4006
XcmsFloat \fIhue\fP\^;
4008
XcmsColor \fIcolors_return[]\fP\^;
4010
unsigned int \fInsamples\fP\^;
4014
The CCC's Client White Point and white point adjustment procedures
4016
.ds Hu for maximum Chroma/Value samples
4018
Specifies the Hue \*(Hu.
4019
.IP \fInsamples\fP 1i
4020
Specifies the number of samples.
4021
.IP \fIcolors_return\fP 1i
4022
Returns nsamples of color specifications in XcmsTekHVC
4023
such that the Chroma is the maximum attainable for the Value and Hue.
4024
The white point associated with the returned
4025
color specification is the Screen White Point.
4026
The value returned in the pixel member is undefined.
4030
.PN XcmsTekHVCQueryMaxVSamples
4031
returns nsamples of maximum Value, the Chroma at which that maximum Value
4032
is reached, and the actual Hue for which the maximum Chroma was found.
4033
These sample points may then be used to plot the maximum Value/Chroma
4034
boundary of the screen's color gamut for the specified Hue in TekHVC color
4038
To obtain the minimum Value for a given Hue and Chroma, use
4039
.PN XcmsTekHVCQueryMinV .
4041
.IN "Value" "minimum"
4042
.IN "XcmsTekHVCQueryMinV" "" "@DEF@"
4045
Status XcmsTekHVCQueryMinV\^(\^\fIccc\fP\^, \fIhue\fP\^, \fIchroma\fP\^, \fIcolor_return\fP\^)
4047
XcmsCCC \fIccc\fP\^;
4049
XcmsFloat \fIhue\fP\^;
4051
XcmsFloat \fIchroma\fP\^;
4053
XcmsColor *\fIcolor_return\fP\^;
4057
The CCC's Client White Point and white point adjustment procedures
4059
.ds Hu in which to find the minimum Value
4061
Specifies the Hue \*(Hu.
4062
.ds Va minimum Value
4064
Specifies the Value in which to find the \*(Va.
4065
.ds Lc minimum Value and the actual Hue and Chroma
4066
.ds lC minimum Value
4067
.IP \fIcolor_return\fP 1i
4068
Returns the \*(Lc at which the \*(lC was found.
4069
The white point associated with the returned
4070
color specification is the Screen White Point.
4071
The value returned in the pixel member is undefined.
4075
.PN XcmsTekHVCQueryMinV
4076
function, given a Hue and Chroma,
4077
determines the minimum Value in TekHVC color space displayable by the screen.
4078
It returns the minimum Value and the actual Hue and Chroma at which
4079
the minimum Value was found.
4081
Color Management Extensions
4083
\*(SN Color Management Extensions
4086
The Xlib color management facilities can be extended in two ways:
4088
Device-Independent Color Spaces
4090
Device-independent color spaces that are derivable to CIE XYZ
4091
space can be added using the
4092
.PN XcmsAddColorSpace
4095
Color Characterization Function Set
4097
A Color Characterization Function Set consists of
4098
device-dependent color spaces and their functions that
4099
convert between these color spaces and the CIE XYZ
4100
color space, bundled together for a specific class of output devices.
4101
A function set can be added using the
4102
.PN XcmsAddFunctionSet
4110
The CIE XYZ color space serves as the hub for all
4111
conversions between device-independent and device-dependent color spaces.
4112
Therefore, the knowledge to convert an
4114
structure to and from CIE XYZ format is associated with each color space.
4115
For example, conversion from CIE L*u*v* to RGB requires the knowledge
4116
to convert from CIE L*u*v* to CIE XYZ and from CIE XYZ to RGB.
4117
This knowledge is stored as an array of functions that,
4118
when applied in series, will convert the
4120
structure to or from CIE XYZ format.
4121
This color specification conversion mechanism facilitates
4122
the addition of color spaces.
4124
Of course, when converting between only device-independent color spaces
4125
or only device-dependent color spaces,
4126
shortcuts are taken whenever possible.
4127
For example, conversion from TekHVC to CIE L*u*v* is performed
4128
by intermediate conversion to CIE u*v*Y and then to CIE L*u*v*,
4129
thus bypassing conversion between CIE u*v*Y and CIE XYZ.
4131
Adding Device-Independent Color Spaces
4133
\*(SN Adding Device-Independent Color Spaces
4136
To add a device-independent color space, use
4137
.PN XcmsAddColorSpace .
4138
.IN "XcmsAddColorSpace" "" "@DEF@"
4141
Status XcmsAddColorSpace\^(\^\fIcolor_space\fP\^)
4143
XcmsColorSpace *\fIcolor_space\fP\^;
4145
.IP \fIcolor_space\fP 1i
4146
Specifies the device-independent color space to add.
4150
.PN XcmsAddColorSpace
4151
function makes a device-independent color space (actually an
4153
structure) accessible by the color management system.
4154
Because format values for unregistered color spaces are assigned at run time,
4155
they should be treated as private to the client.
4156
If references to an unregistered color space must be made
4157
outside the client (for example, storing color specifications
4158
in a file using the unregistered color space),
4159
then reference should be made by color space prefix
4161
.PN XcmsFormatOfPrefix
4163
.PN XcmsPrefixOfFormat ).
4167
structure is already accessible in the color management system,
4168
.PN XcmsAddColorSpace
4174
must be retained for reference by Xlib.
4176
Querying Color Space Format and Prefix
4178
\*(SN Querying Color Space Format and Prefix
4181
To obtain the format associated with the color space
4182
associated with a specified color string prefix, use
4183
.PN XcmsFormatOfPrefix .
4184
.IN "XcmsFormatOfPrefix" "" "@DEF@"
4187
XcmsColorFormat XcmsFormatOfPrefix\^(\^\fIprefix\fP\^)
4189
char *\fIprefix\fP\^;
4192
Specifies the string that contains the color space prefix.
4196
.PN XcmsFormatOfPrefix
4197
function returns the format for the specified color space prefix
4198
(for example, the string ``CIEXYZ'').
4199
The prefix is case-insensitive.
4200
If the color space is not accessible in the color management system,
4201
.PN XcmsFormatOfPrefix
4203
.PN XcmsUndefinedFormat .
4206
To obtain the color string prefix associated with the color space
4207
specified by a color format, use
4208
.PN XcmsPrefixOfFormat .
4209
.IN "XcmsPrefixOfFormat" "" "@DEF@"
4212
char *XcmsPrefixOfFormat\^(\^\fIformat\fP\^)
4214
XcmsColorFormat \fIformat\fP\^;
4217
Specifies the color specification format.
4221
.PN XcmsPrefixOfFormat
4222
function returns the string prefix associated with the color specification
4223
encoding specified by the format argument.
4224
Otherwise, if no encoding is found, it returns NULL.
4225
The returned string must be treated as read-only.
4227
Creating Additional Color Spaces
4229
\*(SN Creating Additional Color Spaces
4232
Color space specific information necessary
4233
for color space conversion and color string parsing is stored in an
4236
Therefore, a new structure containing this information is required
4237
for each additional color space.
4238
In the case of device-independent color spaces,
4239
a handle to this new structure (that is, by means of a global variable)
4240
is usually made accessible to the client program for use with the
4241
.PN XcmsAddColorSpace
4246
structure specifies a color space not registered with the X Consortium,
4247
they should be treated as private to the client
4248
because format values for unregistered color spaces are assigned at run time.
4249
If references to an unregistered color space must be made outside the
4250
client (for example, storing color specifications in a file using the
4251
unregistered color space), then reference should be made by color space prefix
4253
.PN XcmsFormatOfPrefix
4255
.PN XcmsPrefixOfFormat ).
4261
typedef (*XcmsConversionProc)();
4262
typedef XcmsConversionProc *XcmsFuncListPtr;
4263
/* A NULL terminated list of function pointers*/
4265
typedef struct _XcmsColorSpace {
4267
XcmsColorFormat format;
4268
XcmsParseStringProc parseString;
4269
XcmsFuncListPtr to_CIEXYZ;
4270
XcmsFuncListPtr from_CIEXYZ;
4276
The prefix member specifies the prefix that indicates a color string
4277
is in this color space's string format.
4278
For example, the strings ``ciexyz'' or ``CIEXYZ'' for CIE XYZ,
4279
and ``rgb'' or ``RGB'' for RGB.
4280
The prefix is case insensitive.
4281
The format member specifies the color specification format.
4282
Formats for unregistered color spaces are assigned at run time.
4283
The parseString member contains a pointer to the function
4284
that can parse a color string into an
4287
This function returns an integer (int): nonzero if it succeeded
4289
The to_CIEXYZ and from_CIEXYZ members contain pointers,
4290
each to a NULL terminated list of function pointers.
4291
When the list of functions is executed in series,
4292
it will convert the color specified in an
4294
structure from/to the current color space format to/from the CIE XYZ format.
4295
Each function returns an integer (int): nonzero if it succeeded
4297
The white point to be associated with the colors is specified
4298
explicitly, even though white points can be found in the CCC.
4299
The inverse_flag member, if nonzero, specifies that for each function listed
4301
its inverse function can be found in from_CIEXYZ such that:
4304
Given: n = number of functions in each list
4306
for each i, such that 0 <= i < n
4307
from_CIEXYZ[n - i - 1] is the inverse of to_CIEXYZ[i].
4310
This allows Xlib to use the shortest conversion path,
4311
thus bypassing CIE XYZ if possible (for example, TekHVC to CIE L*u*v*).
4313
Parse String Callback
4315
\*(SN Parse String Callback
4320
structure for parsing a color string for the particular color space must
4321
adhere to the following software interface specification:
4322
.IN "XcmsParseStringProc" "" "@DEF@"
4325
typedef int (*XcmsParseStringProc)\^(\^\fIcolor_string\fP, \fIcolor_return\fP\^)
4327
char *\fIcolor_string\fP\^;
4329
XcmsColor *\fIcolor_return\fP\^;
4331
.IP \fIcolor_string\fP 1i
4332
Specifies the color string to parse.
4333
.IP \fIcolor_return\fP 1i
4334
Returns the color specification in the color space's format.
4338
Color Specification Conversion Callback
4340
\*(SN Color Specification Conversion Callback
4343
Callback functions in the
4345
structure for converting a color specification between device-independent
4346
spaces must adhere to the
4347
following software interface specification:
4350
Status ConversionProc\^(\^\fIccc\fP, \fIwhite_point\fP, \fIcolors_in_out\fP, \fIncolors\fP\^)
4352
XcmsCCC \fIccc\fP\^;
4354
XcmsColor *\fIwhite_point\fP\^;
4356
XcmsColor *\fIcolors_in_out\fP\^;
4358
unsigned int \fIncolors\fP\^;
4362
.IP \fIwhite_point\fP 1i
4363
Specifies the white point associated with color specifications.
4364
The pixel member should be ignored,
4365
and the entire structure remain unchanged upon return.
4366
.IP \fIcolors_in_out\fP 1i
4367
Specifies an array of color specifications.
4368
Pixel members should be ignored and must remain unchanged upon return.
4369
.IP \fIncolors\fP 1i
4370
Specifies the number of
4372
structures in the color-specification array.
4376
Callback functions in the
4378
structure for converting a color specification to or from a device-dependent
4379
space must adhere to the
4380
following software interface specification:
4383
Status ConversionProc\^(\^\fIccc\fP, \fIcolors_in_out\fP, \fIncolors\fP, \fIcompression_flags_return\fP\^)
4385
XcmsCCC \fIccc\fP\^;
4387
XcmsColor *\fIcolors_in_out\fP\^;
4389
unsigned int \fIncolors\fP\^;
4391
Bool \fIcompression_flags_return\fP\^[\^]\^;
4395
.IP \fIcolors_in_out\fP 1i
4396
Specifies an array of color specifications.
4397
Pixel members should be ignored and must remain unchanged upon return.
4398
.IP \fIncolors\fP 1i
4399
Specifies the number of
4401
structures in the color-specification array.
4402
.IP \fIcompression_flags_return\fP 1i
4403
Returns an array of Boolean values for indicating compression status.
4404
If a non-NULL pointer is supplied
4405
and a color at a given index is compressed, then
4407
should be stored at the corresponding index in this array;
4408
otherwise, the array should not be modified.
4411
Conversion functions are available globally for use by other color
4413
The conversion functions provided by Xlib are:
4415
lw(1.8i) lw(1.8i) lw(1.8i).
4419
Function Converts from Converts to
4426
.PN XcmsCIELabToCIEXYZ
4428
.PN XcmsCIELabFormat
4430
.PN XcmsCIEXYZFormat
4433
.PN XcmsCIELuvToCIEuvY
4435
.PN XcmsCIELuvFormat
4437
.PN XcmsCIEuvYFormat
4440
.PN XcmsCIEXYZToCIELab
4442
.PN XcmsCIEXYZFormat
4444
.PN XcmsCIELabFormat
4447
.PN XcmsCIEXYZToCIEuvY
4449
.PN XcmsCIEXYZFormat
4451
.PN XcmsCIEuvYFormat
4454
.PN XcmsCIEXYZToCIExyY
4456
.PN XcmsCIEXYZFormat
4458
.PN XcmsCIExyYFormat
4461
.PN XcmsCIEXYZToRGBi
4463
.PN XcmsCIEXYZFormat
4468
.PN XcmsCIEuvYToCIELuv
4470
.PN XcmsCIEuvYFormat
4472
.PN XcmsCIELabFormat
4475
.PN XcmsCIEuvYToCIEXYZ
4477
.PN XcmsCIEuvYFormat
4479
.PN XcmsCIEXYZFormat
4482
.PN XcmsCIEuvYToTekHVC
4484
.PN XcmsCIEuvYFormat
4486
.PN XcmsTekHVCFormat
4489
.PN XcmsCIExyYToCIEXYZ
4491
.PN XcmsCIExyYFormat
4493
.PN XcmsCIEXYZFormat
4503
.PN XcmsRGBiToCIEXYZ
4507
.PN XcmsCIEXYZFormat
4517
.PN XcmsTekHVCToCIEuvY
4519
.PN XcmsTekHVCFormat
4521
.PN XcmsCIEuvYFormat
4532
.IN "Function set" "LINEAR_RGB"
4534
Functions to convert between device-dependent color spaces
4535
and CIE XYZ may differ for different classes of output devices
4536
(for example, color versus gray monitors).
4537
Therefore, the notion of a Color Characterization Function Set
4539
A function set consists of device-dependent color spaces
4540
and the functions that convert color specifications
4541
between these device-dependent color spaces and the CIE XYZ color space
4542
appropriate for a particular class of output devices.
4543
The function set also contains a function that reads
4544
color characterization data off root window properties.
4545
It is this characterization data that will differ between devices within
4546
a class of output devices.
4547
.IN "Device Color Characterization"
4548
For details about how color characterization data is
4549
stored in root window properties,
4550
see the section on Device Color Characterization in the
4551
\fIInter-Client Communication Conventions Manual\fP.
4552
The LINEAR_RGB function set is provided by Xlib
4553
and will support most color monitors.
4554
Function sets may require data that differs
4555
from those needed for the LINEAR_RGB function set.
4557
its corresponding data may be stored on different root window properties.
4559
Adding Function Sets
4561
\*(SN Adding Function Sets
4564
To add a function set, use
4565
.PN XcmsAddFunctionSet .
4566
.IN "XcmsAddFunctionSet" "" "@DEF@"
4569
Status XcmsAddFunctionSet\^(\^\fIfunction_set\fP\^)
4571
XcmsFunctionSet *\fIfunction_set\fP\^;
4573
.IP \fIfunction_set\fP 1i
4574
Specifies the function set to add.
4578
.PN XcmsAddFunctionSet
4579
function adds a function set to the color management system.
4580
If the function set uses device-dependent
4582
structures not accessible in the color management system,
4583
.PN XcmsAddFunctionSet
4587
structure is for a device-dependent color space not registered
4588
with the X Consortium,
4589
they should be treated as private to the client
4590
because format values for unregistered color spaces are assigned at run time.
4591
If references to an unregistered color space must be made outside the
4592
client (for example, storing color specifications in a file
4593
using the unregistered color space),
4594
then reference should be made by color space prefix
4596
.PN XcmsFormatOfPrefix
4598
.PN XcmsPrefixOfFormat ).
4600
Additional function sets should be added before any calls to other
4601
Xlib routines are made.
4604
member of a previously created
4606
does not have the opportunity to initialize
4607
with the added function set.
4609
Creating Additional Function Sets
4611
\*(SN Creating Additional Function Sets
4614
The creation of additional function sets should be
4615
required only when an output device does not conform to existing
4616
function sets or when additional device-dependent color spaces are necessary.
4617
A function set consists primarily of a collection of device-dependent
4619
structures and a means to read and store a
4620
screen's color characterization data.
4621
This data is stored in an
4624
A handle to this structure (that is, by means of global variable)
4625
is usually made accessible to the client program for use with
4626
.PN XcmsAddFunctionSet .
4628
If a function set uses new device-dependent
4631
they will be transparently processed into the color management system.
4632
Function sets can share an
4634
structure for a device-dependent color space.
4635
In addition, multiple
4637
structures are allowed for a device-dependent color space;
4638
however, a function set can reference only one of them.
4641
structures will differ in the functions to convert to and from CIE XYZ,
4642
thus tailored for the specific function set.
4648
typedef struct _XcmsFunctionSet {
4649
XcmsColorSpace **DDColorSpaces;
4650
XcmsScreenInitProc screenInitProc;
4651
XcmsScreenFreeProc screenFreeProc;
4656
The DDColorSpaces member is a pointer to a NULL terminated list
4659
structures for the device-dependent color spaces that are supported
4660
by the function set.
4661
The screenInitProc member is set to the callback procedure (see the following
4662
interface specification) that initializes the
4664
structure for a particular screen.
4666
The screen initialization callback must adhere to the following software
4667
interface specification:
4668
.IN "XcmsScreenInitProc" "" "@DEF@"
4671
typedef Status (*XcmsScreenInitProc)\^(\^\fIdisplay\fP, \fIscreen_number\fP, \fIscreen_info\fP\^)
4673
Display *\fIdisplay\fP\^;
4675
int \fIscreen_number\fP\^;
4677
XcmsPerScrnInfo *\fIscreen_info\fP\^;
4679
.IP \fIdisplay\fP 1i
4680
Specifies the connection to the X server.
4681
.IP \fIscreen_number\fP 1i
4682
Specifies the appropriate screen number on the host server.
4683
.IP \fIscreen_info\fP 1i
4686
structure, which contains the per screen information.
4689
The screen initialization callback in the
4691
structure fetches the color characterization data (device profile) for
4692
the specified screen,
4693
typically off properties on the
4694
screen's root window.
4695
It then initializes the specified
4698
.IN "Device profile"
4699
.IN "Color Characterization Data"
4700
If successful, the procedure fills in the
4702
structure as follows:
4704
It sets the screenData member to the address
4705
of the created device profile data structure
4706
(contents known only by the function set).
4708
It next sets the screenWhitePoint member.
4710
It next sets the functionSet member to the address of the
4714
It then sets the state member to
4719
If unsuccessful, the procedure sets the state member to
4732
typedef struct _XcmsPerScrnInfo {
4733
XcmsColor screenWhitePoint;
4734
XPointer functionSet;
4735
XPointer screenData;
4736
unsigned char state;
4742
The screenWhitePoint member specifies the white point inherent to
4744
The functionSet member specifies the appropriate function set.
4745
The screenData member specifies the device profile.
4746
The state member is set to one of the following:
4749
indicates initialization has not been previously attempted.
4752
indicates initialization has been previously attempted but failed.
4755
indicates initialization has been previously attempted and succeeded.
4757
The screen free callback must adhere to the following software
4758
interface specification:
4759
.IN "XcmsScreenFreeProc" "" "@DEF@"
4762
typedef void (*XcmsScreenFreeProc)\^(\^\fIscreenData\fP\^)
4764
XPointer \fIscreenData\fP\^;
4766
.IP \fIscreenData\fP 1i
4767
Specifies the data to be freed.
4770
This function is called to free the screenData stored in an