cristy@eplrx7.uucp (John Cristy) (05/29/90)
Xdpyinfo reports that the DirectColor visual on a Sun has 8 colormap entries. Yet I can store 256 colors with XStoreColors. Can someone explain this "apparent" discrepency? -- The UUCP Mailer
rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (05/29/90)
Xdpyinfo reports that the DirectColor visual on a Sun has 8 colormap entries. Yet I can store 256 colors with XStoreColors. Can someone explain this "apparent" discrepency? For DirectColor and TrueColor, you get the size of a "subfield", not the total size of the map. Read the protocol specification, end of Section 8: The colormap-entries defines the number of available colormap entries in a newly created colormap. For DirectColor and TrueColor, this will usually be 2 to the power of the maximum number of bits set to 1 in red-mask, green-mask, and blue-mask.
marvin@kelly.UUCP (Kyle Marvin) (05/29/90)
> Xdpyinfo reports that the DirectColor visual on a Sun has 8 colormap > entries. Yet I can store 256 colors with XStoreColors. Can someone > explain this "apparent" discrepency? Xlib documentation says the following about the Visual structure: "The map_entries member defines the number of available colormap entries in a newly created colormap. For DirectColor or TrueColor, this is the size of an individual pixel subfield." In other words, a 3/3/2 DirectColor visual (as on the Sun server) will advertise 8 (2^^3) entries since that is the number of discrete values for a given color channel. A common application bug I've seen is to use the XDisplayCells (which uses the map_entries member) function to determine the total number of colormap entries. If the default visual on the server is TrueColor or DirectColor, the application thinks that the number of colormap entries is much smaller than the actual number that exist. Try running "xmag" or "xshowcmap" with a server started with the "-cc 5" option and see what happens. A better approach might be to use 2 raised to the XDisplayPlanes() power to determine the total colormap size, although there are no guarantees that this many cells are actually *writable* by the application. Kyle W. Marvin Visual Information Technologies, Inc. (VITec) UUCP: uunet!convex!vitsun!marvin