XcmsAllocColor(3)

πŸ’– NAME πŸ’–

okay so this is XcmsAllocColor(3) β€” yes, the XLIB FUNCTIONS manual page, bestie. The two functions here are XcmsAllocColor and XcmsAllocNamedColor, and their whole thing is allocating colors. iconic behavior, honestly. ✨

🌈 SYNTAX 🌈

Status XcmsAllocColor(Display *display, Colormap colormap, XcmsColor
       *color_in_out, XcmsColorFormat result_format);

Status XcmsAllocNamedColor(Display *display, Colormap colormap, _Xconst
       char *color_string, XcmsColor *color_screen_return, XcmsColor
       *color_exact_return, XcmsColorFormat result_format);

πŸŽ€ ARGUMENTS πŸŽ€

  • display β€” tells it which X server connection we're talking to. πŸ’…
  • colormap β€” the colormap in question, periodt.
  • color_string β€” this one shows up in the XcmsAllocNamedColor syntax, but the original ARGUMENTS list doesn't give it a standalone description. The color-string sentence is chillin' under color_screen_return below, and I'm leaving it right there. 🫢
  • color_exact_return β€” returns the color specification parsed from the color string, or parsed from the matching string found in a color-name database. πŸŽ€
  • color_in_out β€” you put in the color to allocate; it comes back with the pixel and color that actually got used in the colormap. ✨
  • color_screen_return β€” returns the pixel value of the color cell and the color specification that's actually stored for that cell. Also, the original page has β€œSpecifies the color string whose color definition structure is to be returned.” sitting right here under this argument β€” yes, really, I'm not moving it. πŸ’…
  • result_format β€” specifies the color format you want for the returned color specification. 🌸

πŸ¦‹ DESCRIPTION πŸ¦‹

So XcmsAllocColor is basically XAllocColor's more flexible bestie: same allocation vibe, except the color can be specified in any format. It ultimately calls XAllocColor to allocate a read-only color cell (colormap entry) with the specified color. The way it does that: XcmsAllocColor first converts the color you specified to an RGB value, then passes that to XAllocColor. It returns the pixel value of the color cell and the color specification actually allocated. That returned color specification is the result of converting the RGB value returned by XAllocColor into the format specified with the result_format argument. If you don't care about a returned color specification, unnecessary computation can be bypassed if result_format is set to XcmsRGBFormat. The corresponding colormap cell is read-only. And if this routine returns XcmsFailure, the color_in_out color specification is left unchanged. 😭

XcmsAllocColor can generate BadColor errors.

XcmsAllocNamedColor is similar to XAllocNamedColor, except that the color returned can be in any format specified. This function ultimately calls XAllocColor to allocate a read-only color cell with the color specified by a color string. The color string is parsed into an XcmsColor structure (see XcmsLookupColor), converted to an RGB value, and finally passed to XAllocColor. If the color name is not in the Host Portable Character Encoding, the result is implementation-dependent. Use of uppercase or lowercase does not matter. πŸ”₯

This function returns both the color specification as a result of parsing (the exact specification) and the actual color specification stored (the screen specification). This screen specification is the result of converting the RGB value returned by XAllocColor into the format specified in result_format. If there is no interest in a returned color specification, unnecessary computation can be bypassed if result_format is set to XcmsRGBFormat. If color_screen_return and color_exact_return point to the same structure, the pixel field will be set correctly, but the color values are undefined. πŸ’€

XcmsAllocNamedColor can generate BadColor errors.

🩺 DIAGNOSTICS 🩺

  • BadColor β€” A value for a Colormap argument does not name a defined Colormap. no cap, that's the whole diagnosis. 🫢

πŸ‘€ SEE ALSO πŸ‘€


mwah πŸ’‹ that's the page, bestie. Footer check: this is from X Version 11, libX11 1.8.14, and it's the XcmsAllocColor(3) manual page. The original footer doesn't list a date, so I'm not inventing one β€” we don't do made-up facts here. πŸ‘‘βœ¨

πŸ“¦ where this page comes from