Scroom 0.14-49-gb7ae7a6d
Loading...
Searching...
No Matches
Colormap Class Reference

#include <colormappable.hh>

Collaboration diagram for Colormap:
Collaboration graph

Public Types

using Ptr = std::shared_ptr< Colormap >
 
using ConstPtr = std::shared_ptr< const Colormap >
 
using WeakPtr = std::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 = std::shared_ptr<const Colormap>

◆ Ptr

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

◆ WeakPtr

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

Constructor & Destructor Documentation

◆ Colormap()

Colormap::Colormap ( )
inlineprivate

Constructor. Create an empty colormap

40 : name("Empty")
41 {
42 }
std::string name
Definition colormappable.hh:34

Referenced by create().

Here is the caller graph for this function:

Member Function Documentation

◆ clone()

Ptr Colormap::clone ( ) const
inline
80{ return std::make_shared<Colormap>(*this); }

Referenced by setAlpha().

Here is the caller graph for this function:

◆ create()

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

Constructor. Create a smart pointer to an empty colormap

46{ return Ptr(new Colormap()); }
std::shared_ptr< Colormap > Ptr
Definition colormappable.hh:29
Colormap()
Definition colormappable.hh:39

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

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.

50 {
52 result->name = "Default";
53 result->colors.reserve(n);
54 result->colors.clear();
55 const double max = n - 1;
56 for(int i = 0; i < n; i++)
57 {
58 result->colors.emplace_back(i / max); // Min is black
59 }
60
61 return result;
62 }
static Colormap::Ptr create()
Definition colormappable.hh:46
SampleIterator< const uint8_t > result
Definition sampleiterator-tests.cc:94

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.

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

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
83 {
84 for(Color& c: colors)
85 {
86 c.setAlpha(alpha);
87 }
88 }
Definition color.hh:37
std::vector< Color > colors
Definition colormappable.hh:35
Semaphore c(0)

◆ setAlpha() [2/2]

Ptr Colormap::setAlpha ( double  alpha) const
inline
91 {
92 Ptr result = clone();
93 result->setAlpha(alpha);
94 return result;
95 }
Ptr clone() const
Definition colormappable.hh:80
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: