3 Copyright 1985, 1998 The Open Group
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 Except as contained in this notice, the name of The Open Group shall not be
22 used in advertising or otherwise to promote the sale, use or other dealings
23 in this Software without prior written authorization from The Open Group.
37 register Display *dpy,
44 xLookupColorReply reply;
45 register xLookupColorReq *req;
47 XcmsColor cmsColor_exact;
51 * Let's Attempt to use Xcms and i18n approach to Parse Color
53 if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) {
54 const char *tmpName = spec;
56 switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor_exact,
59 case XcmsSuccessWithCompression:
60 _XcmsRGB_to_XColor(&cmsColor_exact, def, 1);
61 memcpy((char *)scr, (char *)def, sizeof(XColor));
62 _XUnresolveColor(ccc, scr);
67 * if the result was _XCMS_NEWNAME tmpName points to
68 * a string in cmsColNm.c:pairs table, for example,
69 * gray70 would become tekhvc:0.0/70.0/0.0
77 * Xcms and i18n methods failed, so lets pass it to the server
83 GetReq (LookupColor, req);
86 req->length += (n + 3) >> 2;
87 Data (dpy, spec, (long)n);
88 if (!_XReply (dpy, (xReply *) &reply, 0, xTrue)) {
93 def->red = reply.exactRed;
94 def->green = reply.exactGreen;
95 def->blue = reply.exactBlue;
97 scr->red = reply.screenRed;
98 scr->green = reply.screenGreen;
99 scr->blue = reply.screenBlue;