ofxOui - UI Components for OpenFrameworks

ofxOuiColormap.hpp
Go to the documentation of this file.
1 /*
2  * ofxOuiColormap.hpp
3  *
4  * Sequential color maps (basic...)
5  *
6  * This code has been authored by Jules Francoise <jfrancoi@sfu.ca>
7  * during his postdoc contract at Simon Fraser University (MovingStories
8  * project).
9  * See:
10  * http://julesfrancoise.com/
11  * http://movingstories.ca/
12  *
13  * Copyright (C) 2016 Jules Francoise.
14  *
15  * This Source Code Form is subject to the terms of the Mozilla Public
16  * License, v. 2.0. If a copy of the MPL was not distributed with this
17  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
18  */
19 
20 #ifndef sequentialColorMap_hpp
21 #define sequentialColorMap_hpp
22 
23 #include "ofMain.h"
24 
25 namespace ofxOui {
26 
31 class Colormap {
32  public:
36  Colormap();
37 
41  virtual ~Colormap();
42 
47  string getName() const;
48 
54  bool setByName(string name);
55 
60  void setBaseColors(vector<ofColor> colors);
61 
66  void resize(int num_values);
67 
71  vector<ofColor> values;
72 
73  ofColor sample(float position);
74 
75  private:
76  void generateValues();
77  vector<ofColor> base_colors_;
78  static map<string, vector<ofColor>> fabric_;
80 };
81 }
82 
83 #endif
void resize(int num_values)
resize the colormap
Definition: ofxOuiColormap.cpp:63
virtual ~Colormap()
Destructor.
Definition: ofxOuiColormap.cpp:35
ofColor sample(float position)
Definition: ofxOuiColormap.cpp:69
string current_map_name_
Definition: ofxOuiColormap.hpp:79
Sequential Colormap generator.
Definition: ofxOuiColormap.hpp:31
bool setByName(string name)
set the colormap by name
Definition: ofxOuiColormap.cpp:37
Colormap()
Default Constructor.
Definition: ofxOuiColormap.cpp:30
void generateValues()
Definition: ofxOuiColormap.cpp:73
static map< string, vector< ofColor > > fabric_
Definition: ofxOuiColormap.hpp:78
Definition: ofxOuiColormap.hpp:25
string getName() const
get the name of the current colormap
Definition: ofxOuiColormap.cpp:61
void setBaseColors(vector< ofColor > colors)
set a colormap from a vector of base colors
Definition: ofxOuiColormap.cpp:49
vector< ofColor > values
vector of colors of the colormap
Definition: ofxOuiColormap.hpp:71
vector< ofColor > base_colors_
Definition: ofxOuiColormap.hpp:77