⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xstncolor.c

📁 早期freebsd实现
💻 C
字号:
/* $XConsortium: XStNColor.c,v 11.22 91/07/22 22:35:01 rws Exp $ *//* Copyright    Massachusetts Institute of Technology    1986	*//*Permission to use, copy, modify, distribute, and sell this software and itsdocumentation for any purpose is hereby granted without fee, provided thatthe above copyright notice appear in all copies and that both thatcopyright notice and this permission notice appear in supportingdocumentation, and that the name of M.I.T. not be used in advertising orpublicity pertaining to distribution of the software without specific,written prior permission.  M.I.T. makes no representations about thesuitability of this software for any purpose.  It is provided "as is"without express or implied warranty.*/#include <stdio.h>#include "Xlibint.h"#include "Xcmsint.h"extern void _XcmsRGB_to_XColor();#if NeedFunctionPrototypesXStoreNamedColor(register Display *dpy,Colormap cmap,_Xconst char *name, /* STRING8 */unsigned long pixel, /* CARD32 */int flags)  /* DoRed, DoGreen, DoBlue */#elseXStoreNamedColor(dpy, cmap, name, pixel, flags)register Display *dpy;Colormap cmap;char *name; /* STRING8 */unsigned long pixel; /* CARD32 */int flags;  /* DoRed, DoGreen, DoBlue */#endif{    unsigned int nbytes;    register xStoreNamedColorReq *req;    XcmsCCC ccc;    XcmsColor cmsColor_exact;    XColor scr_def;    /*     * Let's Attempt to use TekCMS approach to Parse Color     */    if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) {	if (_XcmsResolveColorString(ccc, &name, &cmsColor_exact,		XcmsRGBFormat) != XcmsFailure) {	    _XcmsRGB_to_XColor(&cmsColor_exact, &scr_def, 1);	    scr_def.pixel = pixel;	    scr_def.flags = flags;	    XStoreColor(dpy, cmap, &scr_def);	    return;	}	/*	 * Otherwise we failed; or name was changed with yet another	 * name.  Thus pass name to the X Server.	 */    }    /*     * The TekCMS and i18n methods failed, so lets pass it to the server     * for parsing.     */    LockDisplay(dpy);    GetReq(StoreNamedColor, req);    req->cmap = cmap;    req->flags = flags;    req->pixel = pixel;    req->nbytes = nbytes = strlen(name);    req->length += (nbytes + 3) >> 2; /* round up to multiple of 4 */    Data(dpy, name, (long)nbytes);    UnlockDisplay(dpy);    SyncHandle();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -