35 static const tString DEFAULT_COLORS[];
36 static const int DEFAULT_COLORS_NUMBER;
37 static int DEFAULT_COLOR_INDEX;
73 inline static SP::CORE_Color
New(
int r,
int g,
int b){
80 inline static SP::CORE_Color
New(
int r,
int g,
int b,
int a){
86 inline static SP::CORE_Color
New(
int rgb){
92 inline static SP::CORE_Color
New(){
112 return New(getDefaultColorString(variing));
118 return NewDefaultColor(
false);
124 return New(getDefaultColorString(index,
137 inline void setRed() {setColor(255,0,0);};
152 inline void setCyan() { setColor(
"#00ffff");};
158 inline void setPink() { setColor(
"#FD6C9E");};
166 return (x->getRGB()==getRGB());
172 inline void setOpacity(
const int& opacity) {mOpacity=opacity;}
185 tString c=DEFAULT_COLORS[DEFAULT_COLOR_INDEX];
187 DEFAULT_COLOR_INDEX=(DEFAULT_COLOR_INDEX+1)%DEFAULT_COLORS_NUMBER;
194 return getDefaultColorString(index,
false);
201 DEFAULT_COLOR_INDEX=index%DEFAULT_COLORS_NUMBER;
202 return getDefaultColorString(variing);
208 return getDefaultColorString(
false);
215 unsigned char * getRGBToArray()
const;
227 int getGreen()
const;
238 int getAlpha()
const;
253 r=((double)getRed())/((
double)255.0);
254 b=((double)getBlue())/((
double)255.0);
255 g=((double)getGreen())/((
double) 255.0);
266 inline void getRGBColor(
int& r,
int& g,
int& b,
int& opacity)
const {
270 opacity=getOpacity();
291 void darker(
const SP::CORE_Color& color)
const;
306 void brighter(
const SP::CORE_Color& color)
const;
312 return toString(
"color[r,g,b]");
318 return toString(
"color[r,g,b,a]");
324 string toString(
const tString& format)
const;
327 void setColor(
const SPC::CORE_Color& c);
330 if (c!=
null) setColor(*c);
341 void setColor(
const tString& c);
345 void setColor(
const SPC::CORE_Color& c0,
const SPC::CORE_Color& c1,
float f);
348 void setColor(
int r,
int g,
int b);
352 setColor((
int) r*255,(
int) g*255,(
int) b*255);
357 mValue = 0xff000000 | rgb;
362 const SPC::CORE_Color& fromColor,
363 const SP::CORE_Color& color)
const {
364 toColor(tau,*fromColor.get(),*color.get());
368 void toColor(
const tReal& tau,
382 static tBoolean testColorValueRange(
int r,
int g,
int b,
int a);
void setColor(const CORE_Color &c)
set the color to color
Definition: CORE_Color.h:333
void setCyan()
set color to Cyan
Definition: CORE_Color.h:152
static SP::CORE_Color NewDefaultColor(const tBoolean &variing)
create a new default color
Definition: CORE_Color.h:111
#define DEFINE_SPTR(X)
Definition: CORE_Pointers.h:164
static tString getDefaultColorString()
Definition: CORE_Color.h:207
void setOrange()
set color to orange #ff6c00
Definition: CORE_Color.h:146
void setPink()
set color to Pink
Definition: CORE_Color.h:158
void getRGBColor(double &r, double &g, double &b) const
get the rgdb color
Definition: CORE_Color.h:252
void setGreen()
set color to green #00ff00
Definition: CORE_Color.h:140
int getOpacity() const
get opacity
Definition: CORE_Color.h:180
void setBlack()
set color to black #000000
Definition: CORE_Color.h:131
static SP::CORE_Color NewDefaultColor()
create a new default color
Definition: CORE_Color.h:117
static tString getDefaultColorString(const int &index, const tBoolean &variing)
Definition: CORE_Color.h:199
static SP::CORE_Color New(int rgb)
create a color with rgb value
Definition: CORE_Color.h:86
#define tBoolean
Definition: types.h:35
void setRed()
set color to red #ff0000
Definition: CORE_Color.h:137
int getGreen() const
Returns the green component in the range 0-255 in the default sRGB space.
Definition: CORE_Color.cpp:104
string name() const
return the string representation of the color
Definition: CORE_Color.h:317
#define null
Definition: types.h:13
static SP::CORE_Color NewDefaultColor(const int &index, const tBoolean &variing)
create a new default color
Definition: CORE_Color.h:122
static SP::CORE_Color New()
create a color
Definition: CORE_Color.h:92
static SP::CORE_Color New(int r, int g, int b)
create a color with rgb value
Definition: CORE_Color.h:73
void setWhite()
set color to white #ffffff
Definition: CORE_Color.h:134
#define SP_OBJECT(X)
Definition: CORE_Pointers.h:176
static SP::CORE_Color New(const tString &value)
create a color
Definition: CORE_Color.h:98
void setPurple()
set color to Purple
Definition: CORE_Color.h:155
void setOpacity(const int &opacity)
set the opacity in [0,100]
Definition: CORE_Color.h:172
void setColor(double r, double g, double b)
interpolate the color : c=c0+(f-1)*(c1-co)
Definition: CORE_Color.h:351
static tString getDefaultColorString(const int &index)
Definition: CORE_Color.h:193
void setColor(const CORE_Color *c)
set the color to color
Definition: CORE_Color.h:337
void getRGBColor(int &r, int &g, int &b) const
get the rgdb color
Definition: CORE_Color.h:259
static tString getDefaultColorString(const tBoolean &variing)
Definition: CORE_Color.h:184
void getRGBColor(int &r, int &g, int &b, int &opacity) const
get the rgdb color
Definition: CORE_Color.h:266
void toColor(const tReal &tau, const SPC::CORE_Color &fromColor, const SP::CORE_Color &color) const
set the color as an intermediare between from color and this color
Definition: CORE_Color.h:361
abstract base class for most classes.
Definition: CORE_Object.h:30
#define tString
Definition: types.h:36
this class describes color
Definition: CORE_Color.h:28
void setBlue()
set color to blue #0000ff
Definition: CORE_Color.h:143
static SP::CORE_Color New(const CORE_Color &c)
copy a color
Definition: CORE_Color.h:104
void setColor(const SPC::CORE_Color *c)
set the color to color
Definition: CORE_Color.h:329
void setRGB(const int &rgb)
set rgb
Definition: CORE_Color.h:356
int getRed() const
Returns the red component in the range 0-255 in the default sRGB space.
Definition: CORE_Color.cpp:99
static SP::CORE_Color New(int r, int g, int b, int a)
create a color with rgb value in the a base
Definition: CORE_Color.h:80
void setYellow()
set color to yellow
Definition: CORE_Color.h:149
#define tReal
Definition: types.h:18
virtual string toString() const
return the string representation of the color
Definition: CORE_Color.h:311
tBoolean isEquals(const SPC::CORE_Color &x)
test if two color are identical
Definition: CORE_Color.h:165
int getBlue() const
Returns the blue component in the range 0-255 in the default sRGB space.
Definition: CORE_Color.cpp:109
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106