1ea1d6981Smrg<?xml version="1.0" encoding="UTF-8" ?> 2ea1d6981Smrg<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" 3ea1d6981Smrg "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" 4ea1d6981Smrg[ 5ea1d6981Smrg<!ENTITY % defs SYSTEM "defs.ent"> %defs; 6ea1d6981Smrg]> 7ea1d6981Smrg 8ea1d6981Smrg 9ea1d6981Smrg<book id="tog-cup"> 10ea1d6981Smrg 11ea1d6981Smrg<bookinfo> 12ea1d6981Smrg <title>Colormap Utilization Policy and Extension</title> 13ea1d6981Smrg <subtitle>X Project Team Standard</subtitle> 14ea1d6981Smrg <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo> 15ea1d6981Smrg <releaseinfo>Version 1.0</releaseinfo> 16ea1d6981Smrg <authorgroup> 17ea1d6981Smrg <author> 18ea1d6981Smrg <firstname>Kaleb</firstname> 19ea1d6981Smrg <othername>S.</othername> 20ea1d6981Smrg <surname>Keithley</surname> 21ea1d6981Smrg <affiliation><orgname>The Open Group</orgname></affiliation> 22ea1d6981Smrg </author> 23ea1d6981Smrg </authorgroup> 24ea1d6981Smrg <copyright><year>1986-1997</year><holder>The Open Group</holder></copyright> 25ea1d6981Smrg 26ea1d6981Smrg<legalnotice> 27ea1d6981Smrg 28ea1d6981Smrg<para> 29ea1d6981SmrgPermission is hereby granted, free of charge, to any person obtaining a 30ea1d6981Smrgcopy of this 31ea1d6981Smrgsoftware and associated documentation files (the Software), to use the 32ea1d6981SmrgSoftware 33ea1d6981Smrgwithout restriction, including, without limitation, the rights to copy, 34ea1d6981Smrgmodify, merge, 35ea1d6981Smrgpublish, distribute and sublicense the Software, to make, have made, 36ea1d6981Smrglicense and 37ea1d6981Smrgdistribute derivative works thereof, and to permit persons to whom the 38ea1d6981SmrgSoftware is 39ea1d6981Smrgfurnished to do so, subject to the following conditions: 40ea1d6981Smrg</para> 41ea1d6981Smrg<para> 42ea1d6981SmrgThe above copyright notice and the following permission notice shall be 43ea1d6981Smrgincluded in all copies of the Software: 44ea1d6981Smrg</para> 45ea1d6981Smrg<para> 46ea1d6981SmrgTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 47ea1d6981SmrgEXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES 48ea1d6981SmrgOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON- 49ea1d6981SmrgINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY 50ea1d6981SmrgCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 51ea1d6981SmrgCONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN 52d63b911fSmrgCONNECTION WITH THE SOFTWARE OR THE USE OF OTHER DEALINGS IN 53ea1d6981SmrgTHE SOFTWARE. 54ea1d6981Smrg</para> 55ea1d6981Smrg<para> 56ea1d6981SmrgExcept as contained in this notice, the name of The Open Group shall not be 57ea1d6981Smrgused in 58ea1d6981Smrgadvertising or otherwise to promote the use or other dealings in this 59ea1d6981SmrgSoftware without prior written authorization from The Open Group. 60ea1d6981Smrg</para> 61ea1d6981Smrg<para> 62ea1d6981SmrgX Window System is a trademark of The Open Group. 63ea1d6981Smrg</para> 64ea1d6981Smrg 65ea1d6981Smrg</legalnotice> 66ea1d6981Smrg</bookinfo> 67ea1d6981Smrg 68ea1d6981Smrg<chapter id="Overview"> 69ea1d6981Smrg<title>Overview</title> 70ea1d6981Smrg<para> 71ea1d6981SmrgThis extension has three purposes: a) to provide mechanism for a special 72ea1d6981Smrgapplication (a colormap manager) to discover any special colormap 73ea1d6981Smrgrequirements, e.g. the colormap entries that are nominally reserved for 74ea1d6981Smrgdesktop colors in the MS-Windows environment and initialize the default 75ea1d6981Smrgcolormap so that it can be more easily shared; and b) to encourage colormap 76ea1d6981Smrgsharing and reduce colormap flashing on low-end 8-bit frame buffers by 77ea1d6981Smrgproviding a policy for sharing; and c) when colormaps aren't shared, 78ea1d6981Smrgdefine a behavior in the X server color allocation scheme to reduce 79ea1d6981Smrgcolormap flashing. 80ea1d6981Smrg</para> 81ea1d6981Smrg 82ea1d6981Smrg<para> 83d63b911fSmrgTo encourage colormap sharing and accommodate special colormap requirements 84ea1d6981Smrgtwo new protocols are defined: the first provides a way to query the 85ea1d6981Smrgserver for a list of reserved colormap entries, and the second is a way 86ea1d6981Smrgto initialize read-only (shareable) colormap entries at specific locations 87ea1d6981Smrgin a colormap. 88ea1d6981Smrg</para> 89ea1d6981Smrg 90ea1d6981Smrg<para> 91ea1d6981SmrgTo minimize colormap flashing when the root window's default visual is one 92ea1d6981Smrgof GrayScale, PseudoColor, or DirectColor, and a private colormap for the 93ea1d6981Smrgdefault visual is being used, a minor (but compatible) change to the 94ea1d6981Smrgserver implementation of the AllocColor and AllocNamedColor requests is 95ea1d6981Smrgrequired. Where the core protocol says nothing about the pixel values 96ea1d6981Smrgreturned, when this extension is in effect, the AllocColor and AllocNamedColor 97ea1d6981Smrgrequests will first look for a matching color in the default colormap, and, 98ea1d6981Smrgif a match is found and the same cell in the private colormap has not 99ea1d6981Smrgalready been allocated, the color will be allocated in the private colormap 100ea1d6981Smrgat the same locaton as in the default colormap (instead of in the first 101ea1d6981Smrgavailable location.) 102ea1d6981Smrg</para> 103ea1d6981Smrg</chapter> 104ea1d6981Smrg 105ea1d6981Smrg<chapter id="Requests"> 106ea1d6981Smrg<title>Requests</title> 107ea1d6981Smrg<para> 108ea1d6981Smrg<function>QueryVersion</function> 109ea1d6981Smrg</para> 110ea1d6981Smrg 111ea1d6981Smrg<informaltable frame="none"> 112ea1d6981Smrg <?dbfo keep-together="always" ?> 113ea1d6981Smrg <tgroup cols='1' align='left' colsep='0' rowsep='0'> 114ea1d6981Smrg <colspec colname='c1' colwidth="1.0*"/> 115ea1d6981Smrg <tbody> 116ea1d6981Smrg <row> 117ea1d6981Smrg <entry> 118ea1d6981Smrgclient_major_version: CARD16 119ea1d6981Smrg </entry> 120ea1d6981Smrg </row> 121ea1d6981Smrg <row> 122ea1d6981Smrg <entry> 123ea1d6981Smrgclient_minor_version: CARD16 124ea1d6981Smrg </entry> 125ea1d6981Smrg </row> 126ea1d6981Smrg <row> 127ea1d6981Smrg <entry> 128ea1d6981Smrg=> 129ea1d6981Smrg </entry> 130ea1d6981Smrg </row> 131ea1d6981Smrg <row> 132ea1d6981Smrg <entry> 133ea1d6981Smrgserver_major_version: CARD16 134ea1d6981Smrg </entry> 135ea1d6981Smrg </row> 136ea1d6981Smrg <row> 137ea1d6981Smrg <entry> 138ea1d6981Smrgserver_minor_version: CARD16 139ea1d6981Smrg </entry> 140ea1d6981Smrg </row> 141ea1d6981Smrg </tbody> 142ea1d6981Smrg </tgroup> 143ea1d6981Smrg</informaltable> 144ea1d6981Smrg 145ea1d6981Smrg<para> 146ea1d6981SmrgIf supplied, the client_major_version and client_minor_version indicate 147ea1d6981Smrgwhat version of the protocol the client wants the server to implement. 148ea1d6981SmrgThe server version numbers returned indicate the protocol this extension 149ea1d6981Smrgactually supports. This might not equal the version sent by the client. 150ea1d6981SmrgAn implementation can (but need not) support more than one version 151ea1d6981Smrgsimultaneously. The server_major_version and the server_minor_version 152ea1d6981Smrgare a mechanism to support future revisions of the TOG-CUP protocol that 153ea1d6981Smrgmay be necessary. In general, the major version would increment for 154ea1d6981Smrgincompatible changes, and the minor version would increment for small 155ea1d6981Smrgupward-compatible changes. Servers that support the protocol defined in 156ea1d6981Smrgthis document will return a server_major_version of one (1), and a 157ea1d6981Smrgserver_minor_version of zero (0). 158ea1d6981Smrg</para> 159ea1d6981Smrg 160ea1d6981Smrg<para> 161ea1d6981Smrg<function>GetReservedColormapEntries</function> 162ea1d6981Smrg</para> 163ea1d6981Smrg 164ea1d6981Smrg<informaltable frame="none"> 165ea1d6981Smrg <?dbfo keep-together="always" ?> 166ea1d6981Smrg <tgroup cols='1' align='left' colsep='0' rowsep='0'> 167ea1d6981Smrg <colspec colname='c1' colwidth="1.0*"/> 168ea1d6981Smrg <tbody> 169ea1d6981Smrg <row> 170ea1d6981Smrg <entry> 171ea1d6981Smrgscreen: CARD32 172ea1d6981Smrg </entry> 173ea1d6981Smrg </row> 174ea1d6981Smrg <row> 175ea1d6981Smrg <entry> 176ea1d6981Smrg=> 177ea1d6981Smrg </entry> 178ea1d6981Smrg </row> 179ea1d6981Smrg <row> 180ea1d6981Smrg <entry> 181ea1d6981Smrgentries: LISTofCOLORITEM 182ea1d6981Smrg </entry> 183ea1d6981Smrg </row> 184ea1d6981Smrg </tbody> 185ea1d6981Smrg </tgroup> 186ea1d6981Smrg</informaltable> 187ea1d6981Smrg 188ea1d6981Smrg<para> 189ea1d6981SmrgThis request returns a list of colormap entries (pixels) that are reserved 190ea1d6981Smrgby the system, e.g. MS-Windows reserved desktop colors. This list will, at a 191ea1d6981Smrgminimum, contain entries for the BlackPixel and WhitePixel of the specified 192ea1d6981Smrgscreen. The do-red, do-green, and do-blue elements of the COLORITEMs are 193ea1d6981Smrgunused in this reply. 194ea1d6981Smrg</para> 195ea1d6981Smrg 196ea1d6981Smrg<para> 197ea1d6981SmrgRationale: There are colormap entries (pixels) that, e.g., MS-Windows 198ea1d6981Smrgdesktop reserves as desktop colors, that should not be altered. If they 199ea1d6981Smrgare altered then X programs will cause colormap flashing between X and 200ea1d6981SmrgMS-Windows applications running/displaying on the same desktop. 201ea1d6981Smrg</para> 202ea1d6981Smrg 203ea1d6981Smrg<para> 204ea1d6981Smrg<function>StoreColors</function> 205ea1d6981Smrg</para> 206ea1d6981Smrg 207ea1d6981Smrg<informaltable frame="none"> 208ea1d6981Smrg <?dbfo keep-together="always" ?> 209ea1d6981Smrg <tgroup cols='1' align='left' colsep='0' rowsep='0'> 210ea1d6981Smrg <colspec colname='c1' colwidth="1.0*"/> 211ea1d6981Smrg <tbody> 212ea1d6981Smrg <row> 213ea1d6981Smrg <entry> 214ea1d6981Smrgcmap: COLORMAP 215ea1d6981Smrg </entry> 216ea1d6981Smrg </row> 217ea1d6981Smrg <row> 218ea1d6981Smrg <entry> 219ea1d6981Smrgitems: LISTofCOLORITEM 220ea1d6981Smrg </entry> 221ea1d6981Smrg </row> 222ea1d6981Smrg <row> 223ea1d6981Smrg <entry> 224ea1d6981Smrg=> 225ea1d6981Smrg </entry> 226ea1d6981Smrg </row> 227ea1d6981Smrg <row> 228ea1d6981Smrg <entry> 229ea1d6981Smrgitems: LISTofCOLORITEM 230ea1d6981Smrg </entry> 231ea1d6981Smrg </row> 232ea1d6981Smrg </tbody> 233ea1d6981Smrg </tgroup> 234ea1d6981Smrg</informaltable> 235ea1d6981Smrg 236ea1d6981Smrg<para> 237ea1d6981SmrgThis request changes the colormap entries of the specified pixels. The 238ea1d6981Smrgcolormap entries are allocated as if by an AllocColor request. The do-red, 239ea1d6981Smrgdo-green, and do-blue elements of the COLORITEMs are unused in this request. 240ea1d6981SmrgA boolean alloc-ok element (a bit) is returned indicating whether the 241ea1d6981Smrgparticular pixel was successfully allocated or not. If successfully 242ea1d6981Smrgallocated the RGB and pixel are returned. 243ea1d6981Smrg</para> 244ea1d6981Smrg 245ea1d6981Smrg<para> 246ea1d6981SmrgA Value error is generated if a pixel is not a valid index into cmap. A 247ea1d6981SmrgBadMatch error is generated if if cmap does not belong to a GrayScale, 248ea1d6981SmrgPseudoColor, or DirectColor visual. 249ea1d6981Smrg</para> 250ea1d6981Smrg 251ea1d6981Smrg</chapter> 252ea1d6981Smrg 253ea1d6981Smrg<chapter id="Events_and_Errors"> 254ea1d6981Smrg<title>Events and Errors</title> 255ea1d6981Smrg<para> 256ea1d6981SmrgNo new events or errors are defined by this extension. 257ea1d6981Smrg</para> 258ea1d6981Smrg 259ea1d6981Smrg</chapter> 260ea1d6981Smrg<chapter id='Changes_to_existing_protocol'> 261ea1d6981Smrg<title>Changes to existing protocol.</title> 262ea1d6981Smrg<para> 263ea1d6981SmrgNone. 264ea1d6981Smrg</para> 265ea1d6981Smrg</chapter> 266ea1d6981Smrg 267ea1d6981Smrg<chapter id="Encoding"> 268ea1d6981Smrg<title>Encoding</title> 269ea1d6981Smrg<para> 270ea1d6981SmrgThe name of this extension is "TOG-CUP". 271ea1d6981Smrg</para> 272ea1d6981Smrg 273ea1d6981Smrg<para> 274ea1d6981SmrgThe conventions used here are the same as those for the core X11 275ea1d6981SmrgProtocol Encoding. 276ea1d6981Smrg</para> 277ea1d6981Smrg 278ea1d6981Smrg<literallayout class="monospaced"> 279ea1d6981Smrg<function>QueryVersion</function> 280ea1d6981Smrg 1 CARD8 opcode 281ea1d6981Smrg 1 0 TOG-CUP opcode 282ea1d6981Smrg 2 2 request length 283ea1d6981Smrg 2 CARD16 client_major_version 284ea1d6981Smrg 2 CARD16 client_minor_version 285ea1d6981Smrg=> 286ea1d6981Smrg 1 1 reply 287ea1d6981Smrg 1 unused 288ea1d6981Smrg 2 CARD16 sequence number 289ea1d6981Smrg 4 0 length 290ea1d6981Smrg 2 CARD16 server_major_version 291ea1d6981Smrg 2 CARD16 server_minor_number 292ea1d6981Smrg 20 unused 293ea1d6981Smrg</literallayout> 294ea1d6981Smrg 295ea1d6981Smrg<literallayout class="monospaced"> 296ea1d6981Smrg<function>GetReservedColormapEntries</function> 297ea1d6981Smrg 1 CARD8 opcode 298ea1d6981Smrg 1 1 TOG-CUP opcode 299ea1d6981Smrg 2 2 request length 300ea1d6981Smrg 4 CARD32 screen 301ea1d6981Smrg=> 302ea1d6981Smrg 1 1 reply 303ea1d6981Smrg 1 unused 304ea1d6981Smrg 2 CARD16 sequence number 305ea1d6981Smrg 4 3n length 306ea1d6981Smrg 24 unused 307ea1d6981Smrg 12n LISTofCOLORITEM items 308ea1d6981Smrg</literallayout> 309ea1d6981Smrg 310ea1d6981Smrg<literallayout class="monospaced"> 311ea1d6981Smrg<function>StoreColors</function> 312ea1d6981Smrg 1 CARD8 opcode 313ea1d6981Smrg 1 2 TOG-CUP opcode 314ea1d6981Smrg 2 2+3n request length 315ea1d6981Smrg 4 COLORMAP cmap 316ea1d6981Smrg 12n LISTofCOLORITEM items 317ea1d6981Smrg=> 318ea1d6981Smrg 1 1 reply 319ea1d6981Smrg 1 unused 320ea1d6981Smrg 2 CARD16 sequence number 321ea1d6981Smrg 4 3n length 322ea1d6981Smrg 24 unused 323ea1d6981Smrg 12n LISTofCOLORITEM items 324ea1d6981Smrg</literallayout> 325ea1d6981Smrg 326ea1d6981Smrg<para> 327ea1d6981Smrg(The definition of COLORITEM here is only for the purpose of defining the 328ea1d6981Smrgadditional alloc-ok member in the CUPStoreColors reply.) 329ea1d6981Smrg</para> 330ea1d6981Smrg 331ea1d6981Smrg<literallayout class="monospaced"> 332ea1d6981Smrg COLORITEM 333ea1d6981Smrg 4 CARD32 pixel 334ea1d6981Smrg 2 CARD16 red 335ea1d6981Smrg 2 CARD16 green 336ea1d6981Smrg 2 CARD16 blue 337ea1d6981Smrg 1 alloc-ok 338ea1d6981Smrg #x07 unused 339ea1d6981Smrg #x08 alloc-ok (1 is True, 0 is False) 340ea1d6981Smrg #xF0 unused 341ea1d6981Smrg 1 unused 342ea1d6981Smrg</literallayout> 343ea1d6981Smrg</chapter> 344ea1d6981Smrg 345ea1d6981Smrg<chapter id="C_Language_Binding"> 346ea1d6981Smrg<title>C Language Binding</title> 347ea1d6981Smrg 348ea1d6981Smrg<para> 349ea1d6981SmrgThe C functions provide direct access to the protocol and add no additional 350ea1d6981Smrgsemantics. For complete details on the effects of these functions, refer 351ea1d6981Smrgto the appropriate protocol request, which can be derived by deleting XCup 352ea1d6981Smrgat the start of the function. All functions that have return type Status 353ea1d6981Smrgwill return nonzero for success and zero for failure. 354ea1d6981Smrg</para> 355ea1d6981Smrg 356ea1d6981Smrg<para> 357ea1d6981SmrgThe include file for this extension is 358ea1d6981Smrg<function><X11/extensions/Xcup.h></function>. 359ea1d6981Smrg</para> 360ea1d6981Smrg 361ea1d6981Smrg<funcsynopsis id='XCupQueryVersion'> 362ea1d6981Smrg<funcprototype> 363ea1d6981Smrg <funcdef>Status <function> XCupQueryVersion</function></funcdef> 364ea1d6981Smrg <paramdef>Display*<parameter> display</parameter></paramdef> 365ea1d6981Smrg <paramdef>int*<parameter> major_version_return</parameter></paramdef> 366ea1d6981Smrg <paramdef>int*<parameter> minor_version_return</parameter></paramdef> 367ea1d6981Smrg</funcprototype> 368ea1d6981Smrg</funcsynopsis> 369ea1d6981Smrg 370ea1d6981Smrg<variablelist> 371ea1d6981Smrg <varlistentry> 372ea1d6981Smrg <term> 373ea1d6981Smrg <emphasis remap='I'>display</emphasis> 374ea1d6981Smrg </term> 375ea1d6981Smrg <listitem> 376ea1d6981Smrg <para> 377ea1d6981SmrgSpecifies the connection to the X server. 378ea1d6981Smrg </para> 379ea1d6981Smrg </listitem> 380ea1d6981Smrg </varlistentry> 381ea1d6981Smrg <varlistentry> 382ea1d6981Smrg <term> 383ea1d6981Smrg <emphasis remap='I'>major_version_return</emphasis> 384ea1d6981Smrg </term> 385ea1d6981Smrg <listitem> 386ea1d6981Smrg <para> 387ea1d6981SmrgReturns the major version supported by the server. 388ea1d6981Smrg </para> 389ea1d6981Smrg </listitem> 390ea1d6981Smrg </varlistentry> 391ea1d6981Smrg <varlistentry> 392ea1d6981Smrg <term> 393ea1d6981Smrg <emphasis remap='I'>minor_version_return</emphasis> 394ea1d6981Smrg </term> 395ea1d6981Smrg <listitem> 396ea1d6981Smrg <para> 397ea1d6981SmrgReturns the minor version supported by the server. 398ea1d6981Smrg </para> 399ea1d6981Smrg </listitem> 400ea1d6981Smrg </varlistentry> 401ea1d6981Smrg</variablelist> 402ea1d6981Smrg 403ea1d6981Smrg 404ea1d6981Smrg<para> 405ea1d6981SmrgXCupQueryVersions sets major_version_return and minor_version_return to 406ea1d6981Smrgthe major and minor TOG-CUP protocol version supported by the server. If 407ea1d6981Smrgthe TOG-CUP library is compatible with the version returned by the server, 408ea1d6981Smrgit returns nonzero. If dpy does not support the TOG-CUP extension, or if 409ea1d6981Smrgthere was an error during communication with the server, or if the server 410ea1d6981Smrgand library protocol versions are incompatible, it returns zero. No other 411ea1d6981SmrgXCup functions may be called before this function. If a client violates 412ea1d6981Smrgthis rule, the effects of all subsequent XCup calls that it makes are 413ea1d6981Smrgundefined. 414ea1d6981Smrg</para> 415ea1d6981Smrg 416ea1d6981Smrg<para> 417ea1d6981SmrgTo get the list of reserved colormap entries, use 418ea1d6981SmrgXCupGetReservedColormapEntries. 419ea1d6981Smrg</para> 420ea1d6981Smrg 421ea1d6981Smrg<funcsynopsis id='XCupGetReservedColormapEntries'> 422ea1d6981Smrg<funcprototype> 423ea1d6981Smrg <funcdef>Status <function> XCupGetReservedColormapEntries</function></funcdef> 424ea1d6981Smrg <paramdef>Display*<parameter> display</parameter></paramdef> 425ea1d6981Smrg <paramdef>int<parameter> screen</parameter></paramdef> 426ea1d6981Smrg <paramdef>XColor**<parameter> colors_out</parameter></paramdef> 427ea1d6981Smrg <paramdef>int*<parameter> ncolors</parameter></paramdef> 428ea1d6981Smrg</funcprototype> 429ea1d6981Smrg</funcsynopsis> 430ea1d6981Smrg 431ea1d6981Smrg<variablelist> 432ea1d6981Smrg <varlistentry> 433ea1d6981Smrg <term> 434ea1d6981Smrg <emphasis remap='I'>display</emphasis> 435ea1d6981Smrg </term> 436ea1d6981Smrg <listitem> 437ea1d6981Smrg <para> 438ea1d6981SmrgSpecifies the connection to the X server. 439ea1d6981Smrg </para> 440ea1d6981Smrg </listitem> 441ea1d6981Smrg </varlistentry> 442ea1d6981Smrg <varlistentry> 443ea1d6981Smrg <term> 444ea1d6981Smrg <emphasis remap='I'>colors_out</emphasis> 445ea1d6981Smrg </term> 446ea1d6981Smrg <listitem> 447ea1d6981Smrg <para> 448ea1d6981SmrgReturns the values reserved by the server. 449ea1d6981Smrg </para> 450ea1d6981Smrg </listitem> 451ea1d6981Smrg </varlistentry> 452ea1d6981Smrg <varlistentry> 453ea1d6981Smrg <term> 454ea1d6981Smrg <emphasis remap='I'>ncolors</emphasis> 455ea1d6981Smrg </term> 456ea1d6981Smrg <listitem> 457ea1d6981Smrg <para> 458ea1d6981SmrgReturns the number of items in colors_out. 459ea1d6981Smrg </para> 460ea1d6981Smrg </listitem> 461ea1d6981Smrg </varlistentry> 462ea1d6981Smrg</variablelist> 463ea1d6981Smrg 464ea1d6981Smrg<para> 465ea1d6981SmrgThe XCupGetReservedColormapEntries function gets system specific colormap 466ea1d6981Smrgentries. E.g. the MS-Windows desktop uses N colormap entries at the beginning 467ea1d6981Smrg(0..N) and end (256-N..255) of the colormap. Use XFree to free colors_out. 468ea1d6981Smrg</para> 469ea1d6981Smrg 470ea1d6981Smrg<para> 471ea1d6981SmrgTo allocate one or more read-only color cells with RGB values, use 472ea1d6981SmrgXCupStoreColors. 473ea1d6981Smrg</para> 474ea1d6981Smrg 475ea1d6981Smrg<funcsynopsis id='XCupStoreColors'> 476ea1d6981Smrg<funcprototype> 477ea1d6981Smrg <funcdef>Status <function> XCupStoreColors</function></funcdef> 478ea1d6981Smrg <paramdef>Display*<parameter> display</parameter></paramdef> 479ea1d6981Smrg <paramdef>Colormap<parameter> colormap</parameter></paramdef> 480ea1d6981Smrg <paramdef>XColor*<parameter> colors_in_out</parameter></paramdef> 481ea1d6981Smrg <paramdef>int<parameter> ncolors</parameter></paramdef> 482ea1d6981Smrg</funcprototype> 483ea1d6981Smrg</funcsynopsis> 484ea1d6981Smrg 485ea1d6981Smrg<variablelist> 486ea1d6981Smrg <varlistentry> 487ea1d6981Smrg <term> 488ea1d6981Smrg <emphasis remap='I'>display</emphasis> 489ea1d6981Smrg </term> 490ea1d6981Smrg <listitem> 491ea1d6981Smrg <para> 492ea1d6981SmrgSpecifies the connection to the X server. 493ea1d6981Smrg </para> 494ea1d6981Smrg </listitem> 495ea1d6981Smrg </varlistentry> 496ea1d6981Smrg <varlistentry> 497ea1d6981Smrg <term> 498ea1d6981Smrg <emphasis remap='I'>colormap</emphasis> 499ea1d6981Smrg </term> 500ea1d6981Smrg <listitem> 501ea1d6981Smrg <para> 502ea1d6981SmrgSpecifies the colormap. 503ea1d6981Smrg </para> 504ea1d6981Smrg </listitem> 505ea1d6981Smrg </varlistentry> 506ea1d6981Smrg <varlistentry> 507ea1d6981Smrg <term> 508ea1d6981Smrg <emphasis remap='I'>colors_in_out</emphasis> 509ea1d6981Smrg </term> 510ea1d6981Smrg <listitem> 511ea1d6981Smrg <para> 512ea1d6981SmrgSpecifies and returns the values actually used in the colormap. 513ea1d6981Smrg </para> 514ea1d6981Smrg </listitem> 515ea1d6981Smrg </varlistentry> 516ea1d6981Smrg <varlistentry> 517ea1d6981Smrg <term> 518ea1d6981Smrg <emphasis remap='I'>ncolors</emphasis> 519ea1d6981Smrg </term> 520ea1d6981Smrg <listitem> 521ea1d6981Smrg <para> 522ea1d6981SmrgSpecifies the number of items in colors_in_out. 523ea1d6981Smrg </para> 524ea1d6981Smrg </listitem> 525ea1d6981Smrg </varlistentry> 526ea1d6981Smrg</variablelist> 527ea1d6981Smrg 528ea1d6981Smrg<para> 529ea1d6981SmrgThe XCupStoreColors function changes the colormap entries of the pixel 530ea1d6981Smrgvalues specified in the pixel members of the XColor structures. The colormap 531ea1d6981Smrgentries are allocated as if an AllocColor had been used instead, i.e. the 532ea1d6981Smrgcolors are read-only (shareable). XCupStoreColors returns the number of 533ea1d6981Smrgcolors that were successfully allocated in the colormap. 534ea1d6981Smrg</para> 535ea1d6981Smrg 536ea1d6981Smrg</chapter> 537ea1d6981Smrg 538ea1d6981Smrg<chapter id="Using_the_TOG_CUP_extension_and_Colormap_Utilization_Policy"> 539ea1d6981Smrg<title>Using the TOG-CUP extension and Colormap Utilization Policy</title> 540ea1d6981Smrg<para> 541ea1d6981SmrgThe X server preallocates any hardware or desktop special colors in the 542ea1d6981Smrgdefault colormap; e.g. UNIX X servers preallocate Black and White pixels. 543ea1d6981SmrgPC X servers should also preallocate the MS-Windows desktop colors. (Note 544ea1d6981Smrgto implementors: in the Sample Implementation special colors are allocated 545ea1d6981Smrgin the default colormap in cfbCreateDefColormap for dumb memory framebuffers.) 546ea1d6981Smrg</para> 547ea1d6981Smrg 548ea1d6981Smrg<para> 549ea1d6981SmrgTo minimize colormap flash an application which installs its own private 550ea1d6981Smrgcolormap should query the special colors by calling 551ea1d6981SmrgXCupGetReservedColormapEntries, and can then store those entries (in the 552ea1d6981Smrgproper location) in its private colormap using XCupStoreColors. 553ea1d6981Smrg</para> 554ea1d6981Smrg 555ea1d6981Smrg<para> 556ea1d6981SmrgApplications which allocate many colors in a screen's default colormap, e.g. 557ea1d6981Smrga color-cube or a gray-ramp, should allocate them with XCupStoreColors. By 558d63b911fSmrgusing XCupStoreColors the colors will be allocated shareable (read-only) and 559ea1d6981Smrgany other application which allocates the same color will share that color 560ea1d6981Smrgcell. 561ea1d6981Smrg</para> 562ea1d6981Smrg</chapter> 563ea1d6981Smrg 564ea1d6981Smrg</book> 565