| 291 | } |
| 292 | |
| 293 | void SetColorTable1(int nb,bool hsv,int nbcolors,float *colors) |
| 294 | { |
| 295 | static bool greyo = !grey; |
| 296 | static float * colorso =0; |
| 297 | if(!INITGRAPH) return; |
| 298 | if (ncolortable == nb && greyo == grey && colorso == colors ) return;// optim |
| 299 | greyo = grey; |
| 300 | colorso=colors; |
| 301 | if (fcolor && nb>2 && nb < 256) |
| 302 | { |
| 303 | if(colortable) delete [] colortable; |
| 304 | colortable = new XColor[nb]; |
| 305 | ncolortable = nb; |
| 306 | if(LastColor>1) LastColor=nb-1; |
| 307 | for (int i0=0;i0<nb;i0++) |
| 308 | { |
| 309 | colortable[i0]=DefColorX11(i0,nb,hsv,grey,nbcolors,colors); |
| 310 | } |
| 311 | background=0; |
| 312 | foreground=1; |
| 313 | if (visual->c_class != TrueColor) |
| 314 | { |
| 315 | // cout << "XStoreColors( not TrueColor)" << ncolortable << " " << |
| 316 | XStoreColors (display, color_map, colortable, ncolortable) ; |
| 317 | // << endl; |
| 318 | } |
| 319 | else |
| 320 | { |
| 321 | // cout << "XAllocColor (TrueColor)" << endl; |
| 322 | for (int i=0;i<ncolortable;i++) |
| 323 | XAllocColor(display, color_map, colortable+i ); |
| 324 | background =colortable[background].pixel; |
| 325 | foreground =colortable[foreground].pixel; |
| 326 | } |
| 327 | if (win) { |
| 328 | XGCValues gcvalues; |
| 329 | gcvalues.foreground = foreground; |
| 330 | gcvalues.background = background; |
| 331 | gc = XCreateGC(display, win, GCForeground | GCBackground , &gcvalues); |
| 332 | } |
| 333 | } |
| 334 | } |
| 335 | void SetColorTable(int nb) |
| 336 | { |
| 337 | int i; |
no test coverage detected