Rainbow Class Reference

#include <Rainbow.h>

List of all members.

Public Member Functions

 Rainbow (int number_of_colors=100)
int GetRelativeColor (double rel)

Detailed Description

Id
Rainbow.h,v 1.2 2002/11/04 21:11:56 bv Exp

Definition at line 26 of file Rainbow.h.


Constructor & Destructor Documentation

Rainbow::Rainbow ( int  number_of_colors = 100  ) 

Definition at line 5 of file Rainbow.cxx.

References Munits::g, and n.

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 }


Member Function Documentation

int Rainbow::GetRelativeColor ( double  rel  ) 

Definition at line 18 of file Rainbow.cxx.

References size.

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 }


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1