| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#ifndef _CCP4MG_RGBREPS_ |
| 22 |
#define _CCP4MG_RGBREPS_ |
| 23 |
|
| 24 |
|
| 25 |
#include <map> |
| 26 |
#include <vector> |
| 27 |
#include <string> |
| 28 |
#include <fstream> |
| 29 |
|
| 30 |
enum ColourRepresentation { NOCOLOURREP , RGBCOLOURREP , HSVCOLOURREP }; |
| 31 |
|
| 32 |
class RGBReps { |
| 33 |
static std::vector<std::string> colours_name_map; |
| 34 |
static std::map<std::string,std::vector<double> > string_colours; |
| 35 |
static std::vector<std::vector<double> > colours; |
| 36 |
static std::vector<std::vector<double> >hsv; |
| 37 |
static std::vector<double> complement_colour; |
| 38 |
|
| 39 |
static void BuildRGBReps(std::ifstream &infile); |
| 40 |
public: |
| 41 |
RGBReps(std::ifstream &infile); |
| 42 |
RGBReps(std::string &infile); |
| 43 |
RGBReps(const char *infile); |
| 44 |
RGBReps(); |
| 45 |
~RGBReps(){}; |
| 46 |
|
| 47 |
static void SetFile(std::ifstream &infile); |
| 48 |
static void SetFile(std::string &infile); |
| 49 |
static void SetFile(const char *infile); |
| 50 |
|
| 51 |
static std::vector<std::vector<double> > GetColours(); |
| 52 |
static std::vector<double> GetColour(unsigned int i); |
| 53 |
static double* GetColourP(unsigned int i); |
| 54 |
static std::vector<double> GetColourHSV(unsigned int i); |
| 55 |
static std::vector<std::vector<double> > GetColourDefinitions( std::vector<int> codes,int mode); |
| 56 |
static std::string GetNameOfColour(unsigned int i); |
| 57 |
static std::vector<double> GetColour(const std::string &name); |
| 58 |
static unsigned int GetNumberOfColours(); |
| 59 |
static void AddColour(std::string colour, double r, double g, double b, double a=255.0); |
| 60 |
static void ChangeColour(std::string colour, double r, double g, double b, double a=255.0); |
| 61 |
static void DeleteColour(std::string colour); |
| 62 |
static int GetColourNumber(std::string name ); |
| 63 |
static std::vector<int> GetColourNumbers(std::vector<std::string> names ); |
| 64 |
static std::vector<double> hsvtorgb (std::vector<double> hsv); |
| 65 |
static std::vector<double> rgbtohsv (std::vector<double> rgb ); |
| 66 |
static double* hsvtorgb (double *hsv); |
| 67 |
static double* rgbtohsv (double *rgb ); |
| 68 |
static void SetBackgroundColour(std::string colour); |
| 69 |
static void SetBackgroundColour(std::vector<double> col); |
| 70 |
}; |
| 71 |
|
| 72 |
#endif |