MCPcopy Create free account
hub / github.com/CruiserOne/Astrolog / InitColorsX

Function InitColorsX

xscreen.cpp:124–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122// whether or not are in monochrome and/or reverse video mode.
123
124void InitColorsX()
125{
126 int i;
127 flag fInverse = gs.fInverse;
128 KI ki;
129#ifdef X11
130 char sz[cchSzDef];
131 Colormap cmap;
132 XColor xcol;
133 KV kv;
134
135 if (!gi.fFile) {
136 cmap = XDefaultColormap(gi.disp, gi.screen);
137
138 // Allocate colors from the present X11 colormap. Given RGB color strings,
139 // allocate these colors and determine their values.
140
141 for (i = 0; i < cColor2; i++) {
142 kv = rgbbmp[i];
143 sprintf(sz, "#%02x%02x%02x", RgbR(kv), RgbG(kv), RgbB(kv));
144 XParseColor(gi.disp, cmap, sz, &xcol);
145 XAllocColor(gi.disp, cmap, &xcol);
146 rgbind[i] = xcol.pixel;
147 }
148 }
149 if (!gi.fFile) {
150 XSetBackground(gi.disp, gi.gc, rgbind[gi.kiOff]);
151 XSetForeground(gi.disp, gi.pmgc, rgbind[gi.kiOff]);
152 }
153#endif
154
155#ifdef WIN
156 // Don't print on a black background unless user really wants that.
157 if (wi.hdcPrint != NULL && us.fSmartSave)
158 fInverse = fTrue;
159#endif
160
161 gi.kiOn = kMainA[!fInverse];
162 gi.kiOff = kMainA[fInverse];
163 gi.kiLite = gs.fColor ? kMainA[2+fInverse] : gi.kiOn;
164 gi.kiGray = gs.fColor ? kMainA[3-fInverse] : gi.kiOn;
165 for (i = 0; i <= 8; i++)
166 kMainB[i] = gs.fColor ? kMainA[i] : gi.kiOn;
167 for (i = 0; i <= cRainbow; i++)
168 kRainbowB[i] = gs.fColor ? kRainbowA[i] : gi.kiOn;
169 for (i = 0; i < cElem; i++)
170 kElemB[i] = gs.fColor ? kElemA[i] : gi.kiOn;
171 for (i = 0; i <= cAspect; i++)
172 kAspB[i] = gs.fColor ? kAspA[i] : gi.kiOn;
173 for (i = 0; i <= cObj; i++)
174 kObjB[i] = gs.fColor ? kObjA[i] : gi.kiOn;
175 for (i = 0; i <= cRay+1; i++)
176 kRayB[i] = gs.fColor ? kRayA[i] : gi.kiOn;
177
178 // Compute RGB colors to use for each of the Seven Rays.
179 for (i = 1; i <= cRay+1; i++) {
180 ki = kRayB[i];
181 if (i == 2 && ki == kIndigo && rgbbmp[ki] == rgbbmpDef[ki])

Callers 3

BeginXFunction · 0.85
CommandLineXFunction · 0.85
xscreen.cppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected