GSCR(3NCARG)

✨ GSCR β€” it's giving "Set color representation" ✨

okay bestie, so this is a page from the NCAR GRAPHICS manual, section 3NCARG, and the whole vibe is: you've got a color value, you've got a color index, and GSCR is the matchmaker that sets them up together πŸ’–

It literally associates a color value with a color index. That's the entire personality. Slay.


🌸 SYNOPSIS 🌸

CALL GSCR (WKID, CI, CR, CG, CB)

πŸŽ€ C-BINDING SYNOPSIS πŸŽ€

#include <ncarg/gks.h>

void gset_colr_rep(Gint ws_id, Gint colr_ind, const Gcolr_rep *colr_rep);

πŸ’… DESCRIPTION πŸ’…

okay so here are the lil arguments, and yes every single one matters:

  • WKID (Integer, Input) β€” a workstation identifier. and it's not a vibe you can freestyle, bestie: WKID must be the same as that used in some previous GOPWK call. no cap. it has to match.
  • CI (Integer, Input) β€” a color index. that's the lil number you're assigning the color to 🎨
  • CR (Real, Input) β€” an intensity value for red, between 0. and 1. inclusive.
  • CG (Real, Input) β€” an intensity value for green, between 0. and 1. inclusive.
  • CB (Real, Input) β€” an intensity value for blue, between 0. and 1. inclusive.

so yeah, RGB, but make it 0. to 1. inclusive. not 0–255. don't do that to yourself 😭


🌈 USAGE 🌈

Color in GKS is "indexed", meaning color attributes get assigned to primitives by using a color index. That's just how it works here. And GSCR is the function you use to associate a color value with color indices. periodt.

It is recommended that all color indices used in a given job be defined prior to calling any output primitive. like, do it upfront, babe.
Since the result of a dynamic color change can be ambiguous, it is also recommended that GSCR not be called to change a color value after the original definitions. so no switching up the palette mid-performance, the outcome is giving chaos πŸ’€

okay so here's the timeline situation: GSCR may be called after opening the workstation for which the color indices are to be defined, and not before that workstation is opened. read that twice. timing is everything. ⏰

and the fun part β€” different color tables can be maintained for different workstations. for example, color index 2 for a CGM file may be associated with "red" while at the same time it may be associated with "green" for some X workstation. two workstations, two truths, both iconic πŸ‘‘

now this next part is important, highkey, so listen:

It is important to stress that color index 0 defines the background color. If any color indices are defined, then you should define the background color index 0. Otherwise you run the risk of having a user-defined color match the default background color. and that would be so embarrassing for everyone involved 🫣

For all GKS output primitives, color is assigned by an indexing scheme. The indices run from 0 to 255, where 0 is the background color index and 1 is the foreground color index. that's the range, bestie, 0–255, memorise it ✨


πŸ¦‹ ACCESS πŸ¦‹

To use GKS routines, load the NCAR GKS-0A library ncarg_gks. that's the whole access situation 🫢


πŸ‘‘ SEE ALSO πŸ‘‘

Online: gqcr, gsplci, gspmci, gsfaci, gstxci, gqplci, gqpmci, gqfaci, gqtxci, gset_colr_rep

Hardcopy: User's Guide for NCAR GKS-0A Graphics; NCAR Graphics Fundamentals, UNIX Version

like go read those too, they're the friend group πŸ“


Copyright (C) 1987-2009
University Corporation for Atmospheric Research
The use of this Software is governed by a License Agreement.

so yeah, that's the whole page. shoutout to UNIX, March 1993, and the GSCR(3NCARG) manual entry itself β€” the original source/version/date that made this little yap session possible. mwah, thanks for coming to my ted talk πŸ’–βœ¨πŸŽ€