#include <Rainbow.h>
Public Member Functions | |
| Rainbow (int number_of_colors=100) | |
| int | GetRelativeColor (double rel) |
Midad/Base
Allocates a spectrum of colors useful for a "COLZ" type of scale. If colors are already allocated, they are not re-allocated (ROOT internal behavior).
Contact: bv@bnl.gov
Created on: Mon Sep 9 12:19:15 2002
Definition at line 26 of file Rainbow.h.
|
|
Definition at line 5 of file Rainbow.cxx. 00006 {
00007 // for now just hard code some stuff.
00008 for (int n=0; n<number_of_colors; ++n) {
00009 // 330, not 360 as we don't want to loop back to 0 degrees color
00010 float hue = (300.0*(n+1))/(1.0*number_of_colors);
00011 float r,g,b;
00012 TColor::HLStoRGB(hue, 0.5, 1.0, r,g,b);
00013 int col = TColor::GetColor(r,g,b);
00014 this->push_back(col);
00015 }
00016 }
|
|
|
Definition at line 18 of file Rainbow.cxx. Referenced by GfxDigitList::GetDigitColor(), GfxStripList::GetStripColor(), ColorAxis::PaintPalette(), and PmtSpot::SetRelativeColor(). 00019 {
00020 if (rel > 1) rel = 1;
00021 if (rel < 0) rel = 0;
00022
00023 rel = 1 - rel; // reverse colors
00024
00025 int num = this->size();
00026 int index = (int)(rel*num);
00027 if (index == num) --index;
00028 if (index < 0) index = 0;
00029
00030 int col = (*this)[index];
00031
00032 return col;
00033 }
|
1.3.9.1