ATLAS Offline Software
Static Public Member Functions | List of all members
VP1ColorUtils Class Reference

#include <VP1ColorUtils.h>

Collaboration diagram for VP1ColorUtils:

Static Public Member Functions

static void setMatColorFromRGB (SoMaterial *mat, const std::string &type, const unsigned int r, const unsigned int g, const unsigned int b)
 
static SbColor getSbColorFromRGB (const unsigned int r, const unsigned int g, const unsigned int b)
 
static float getValFromRGB (const unsigned int rgb)
 

Detailed Description

Definition at line 25 of file VP1ColorUtils.h.

Member Function Documentation

◆ getSbColorFromRGB()

SbColor VP1ColorUtils::getSbColorFromRGB ( const unsigned int  r,
const unsigned int  g,
const unsigned int  b 
)
static

Definition at line 46 of file VP1ColorUtils.cxx.

47 {
48  const float fr = getValFromRGB(r);
49  const float fg = getValFromRGB(g);
50  const float fb = getValFromRGB(b);
51  return SbColor(fr, fg, fb);
52 }

◆ getValFromRGB()

float VP1ColorUtils::getValFromRGB ( const unsigned int  rgb)
static

Definition at line 18 of file VP1ColorUtils.cxx.

19 {
20  if (rgb > 255) {
21  std::cout << "ERROR! RGB color value is expected in the the range [0,255]. Here we get: " << rgb << ". Exiting..." << std::endl;
22  std::exit(EXIT_FAILURE);
23  }
24  return rgb/255.0;
25 }

◆ setMatColorFromRGB()

void VP1ColorUtils::setMatColorFromRGB ( SoMaterial *  mat,
const std::string &  type,
const unsigned int  r,
const unsigned int  g,
const unsigned int  b 
)
static

Definition at line 27 of file VP1ColorUtils.cxx.

28 {
29  const float fr = getValFromRGB(r);
30  const float fg = getValFromRGB(g);
31  const float fb = getValFromRGB(b);
32  if (type == "ambient")
33  mat->ambientColor.setValue(fr, fg, fb);
34  else if (type == "diffuse")
35  mat->diffuseColor.setValue(fr, fg, fb);
36  else if (type == "specular")
37  mat->specularColor.setValue(fr, fg, fb);
38  else
39  std::cout << "ERROR! Color type not supported ==> " << type << std::endl;
40 
41  // Debug Msg
42  //std::cout << "Set color (" << r << "," << g << "," << b << ") to (" << fr << "," << fg << "," << fb << ")" << std::endl;
43  return;
44 }

The documentation for this class was generated from the following files:
beamspotman.r
def r
Definition: beamspotman.py:676
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:55
VP1ColorUtils::getValFromRGB
static float getValFromRGB(const unsigned int rgb)
Definition: VP1ColorUtils.cxx:18
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
calibdata.exit
exit
Definition: calibdata.py:236
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
grepfile.fr
fr
Definition: grepfile.py:32