Scroom  0.14
Colormap Class Reference

#include <colormappable.hh>

Collaboration diagram for Colormap:
Collaboration graph

Public Types

using Ptr = boost::shared_ptr< Colormap >
 
using ConstPtr = boost::shared_ptr< const Colormap >
 
using WeakPtr = boost::weak_ptr< Colormap >
 

Public Member Functions

Ptr clone () const
 
void setAlpha (double alpha)
 
Ptr setAlpha (double alpha) const
 

Static Public Member Functions

static Colormap::Ptr create ()
 
static Colormap::Ptr createDefault (int n)
 
static Colormap::Ptr createDefaultInverted (int n)
 

Public Attributes

std::string name
 
std::vector< Colorcolors
 

Private Member Functions

 Colormap ()
 

Detailed Description

Represent a colormap

Member Typedef Documentation

◆ ConstPtr

using Colormap::ConstPtr = boost::shared_ptr<const Colormap>

◆ Ptr

using Colormap::Ptr = boost::shared_ptr<Colormap>

◆ WeakPtr

using Colormap::WeakPtr = boost::weak_ptr<Colormap>

Constructor & Destructor Documentation

◆ Colormap()

Colormap::Colormap ( )
inlineprivate

Constructor. Create an empty colormap

42  : name("Empty")
43  {
44  }

Referenced by clone(), and create().

Here is the caller graph for this function:

Member Function Documentation

◆ clone()

Ptr Colormap::clone ( ) const
inline
82 { return Ptr(new Colormap(*this)); }

Referenced by setAlpha().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create()

static Colormap::Ptr Colormap::create ( )
inlinestatic

Constructor. Create a smart pointer to an empty colormap

48 { return Ptr(new Colormap()); }

Referenced by createDefault(), createDefaultInverted(), Scroom::Tiff::getColorMap(), and Scroom::ColormapImpl::Colormaps::load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createDefault()

static Colormap::Ptr Colormap::createDefault ( int  n)
inlinestatic

Constructor. Create a smart pointer to a colormap of n grays.

52  {
53  Colormap::Ptr result = create();
54  result->name = "Default";
55  result->colors.reserve(n);
56  result->colors.clear();
57  const double max = n - 1;
58  for(int i = 0; i < n; i++)
59  {
60  result->colors.emplace_back(i / max); // Min is black
61  }
62 
63  return result;
64  }

Referenced by ColormapHelper::create(), MonochromeColormapHelper::generateInitialColormap(), setupTest1bpp(), setupTest2bpp(), setupTest4bpp(), setupTest8bpp(), and setupTest8bppColormapped().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createDefaultInverted()

static Colormap::Ptr Colormap::createDefaultInverted ( int  n)
inlinestatic

Constructor. Create a smart pointer to a colormap of n grays.

68  {
69  Colormap::Ptr result = create();
70  result->name = "0 is white";
71  result->colors.reserve(n);
72  result->colors.clear();
73  const double max = n - 1;
74  for(int i = 0; i < n; i++)
75  {
76  result->colors.emplace_back((max - i) / max); // Min is white
77  }
78 
79  return result;
80  }

Referenced by ColormapHelper::createInverted(), and MonochromeColormapHelper::generateInitialColormap().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAlpha() [1/2]

void Colormap::setAlpha ( double  alpha)
inline
85  {
86  for(Color& c: colors)
87  {
88  c.setAlpha(alpha);
89  }
90  }

◆ setAlpha() [2/2]

Ptr Colormap::setAlpha ( double  alpha) const
inline
93  {
94  Ptr result = clone();
95  result->setAlpha(alpha);
96  return result;
97  }
Here is the call graph for this function:

Member Data Documentation

◆ colors

std::vector<Color> Colormap::colors

Colors in this colormap

Referenced by setAlpha().

◆ name

std::string Colormap::name

Name of this colormap


The documentation for this class was generated from the following file:
Colormap::create
static Colormap::Ptr create()
Definition: colormappable.hh:48
Colormap::colors
std::vector< Color > colors
Definition: colormappable.hh:37
Colormap::name
std::string name
Definition: colormappable.hh:36
Colormap::clone
Ptr clone() const
Definition: colormappable.hh:82
Colormap::Colormap
Colormap()
Definition: colormappable.hh:41
Colormap::Ptr
boost::shared_ptr< Colormap > Ptr
Definition: colormappable.hh:31
Color
Definition: color.hh:34