Tk_GetCapStyle(3)

πŸ’… Tk_GetCapStyle β€” bestie's guide to cap styles ✨

okay so this page is from the Tk Library Procedures manual, and it's literally all about translating between strings and cap styles. tiny page, big slay πŸŽ€


✨ NAME ✨

Tk_GetCapStyle, Tk_NameOfCapStyle β€” the little duo that translates between strings and cap styles πŸ¦‹


🌸 SYNOPSIS 🌸

#include <tk.h>

int
Tk_GetCapStyle(interp, string, capPtr)

const char *
Tk_NameOfCapStyle(cap)

πŸ’– ARGUMENTS πŸ’–

  • Tcl_Interp *interp (in) β€” the interpreter we use for error reporting, bestie. 🫢
  • const char *string (in) β€” a string holding the name of a cap style: one of β€œbutt”, β€œprojecting”, or β€œround” β€” or a unique abbreviation of one of those. no cap. πŸ‘‘
  • int *capPtr (out) β€” pointer to the spot where we stash the X cap style that corresponds to string ✨
  • int cap (in) β€” the cap style itself: one of CapButt, CapProjecting, or CapRound πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

Tk_GetCapStyle places in *capPtr the X cap style corresponding to string. That's gonna be one of the values CapButt, CapProjecting, or CapRound. Cap styles are typically used in X graphics contexts to indicate how the end-points of lines should be capped β€” and honestly, iconic behaviour. See the X documentation for info on what each style actually implies, iykyk. 🌈

Under normal circumstances the return value is TCL_OK and interp is unused. But if string doesn't contain a valid cap style (or an abbreviation of one of those names), then an error message gets stored in interpreter interp's result, TCL_ERROR is returned, and *capPtr is left unmodified. not me being dramatic about it but that's just how it is 😭

Tk_NameOfCapStyle is the logical inverse of Tk_GetCapStyle. Give it a cap style like CapButt and it hands you back a statically-allocated string corresponding to cap. And if cap is not a legal cap style? it returns β€œunknown cap style”. the audacity πŸ’€


πŸ”₯ KEYWORDS πŸ”₯

butt, cap style, projecting, round


lowkey obsessed with how short this page is. main character energy fr fr πŸ’œ

that's the whole vibe β€” source and version are just Tk, dated right alongside the Tk_GetCapStyle(3) footer, so mwah, hope this helped bestie πŸ§šβœ¨πŸŽ€

πŸ“¦ where this page comes from