1 #ifndef GUI_UTILS___RGBA_COLOR__HPP
2 #define GUI_UTILS___RGBA_COLOR__HPP
81 CRgbaColor(
unsigned char r,
unsigned char g,
unsigned char b);
86 unsigned char b,
unsigned char a);
105 void Set(
float r,
float g,
float b);
108 void Set(
float r,
float g,
float b,
float a);
112 void Set(
unsigned char r,
unsigned char g,
unsigned char b);
116 void Set(
unsigned char r,
unsigned char g,
117 unsigned char b,
unsigned char a);
120 void SetRed (
float r);
121 void SetGreen(
float r);
122 void SetBlue (
float r);
123 void SetAlpha(
float r);
127 void SetRed (
unsigned char r);
128 void SetGreen(
unsigned char r);
129 void SetBlue (
unsigned char r);
130 void SetAlpha(
unsigned char r);
133 float GetRed (
void)
const;
134 float GetGreen(
void)
const;
135 float GetBlue (
void)
const;
136 float GetAlpha(
void)
const;
139 unsigned char GetRedUC (
void)
const;
140 unsigned char GetGreenUC(
void)
const;
141 unsigned char GetBlueUC (
void)
const;
142 unsigned char GetAlphaUC(
void)
const;
147 const float* GetColorArray(
void)
const;
151 void PrintTo(
CNcbiOstream& strm,
bool printAlpha,
bool uchars =
true)
const;
154 string ToString(
bool printAlpha =
true,
bool uchars =
true)
const;
156 string ToCssString(
bool printAlpha =
true)
const;
158 string ToHtmlString()
const;
183 void FromString(
const string&
str);
194 void Lighten(
float scale);
199 void Darken(
float scale);
205 static const char* ColorStrFromName(
const string& desc);
234 static void RgbToHsv(
const CRgbaColor& rgb,
float& h,
float& s,
float& v);
235 static CRgbaColor HsvToRgb(
float h,
float s,
float v);
241 static void RgbToYuv(
const CRgbaColor& rgb,
float& y,
float& u,
float& v);
246 static bool YuvToRgb(
float y,
float u,
float v,
CRgbaColor& rgb);
255 static float Brightness(
const CRgbaColor& rgb);
263 CRgbaColor ContrastingColor(
bool onlyBW =
true)
const;
347 return (
unsigned char) (
m_Rgba[0] * 255.0f);
353 return (
unsigned char) (
m_Rgba[1] * 255.0f);
359 return (
unsigned char) (
m_Rgba[2] * 255.0f);
365 return (
unsigned char) (
m_Rgba[3] * 255.0f);
class CRgbaColor provides a simple abstraction for managing colors.
Include a standard set of the NCBI C++ Toolkit most basic headers.
CRgbaColor & GetColor(CSeqFeatData::ESubtype subtype)
unsigned char GetRedUC(void) const
Get specific channels in unsigned char values.
float GetBlue(void) const
float GetGreen(void) const
unsigned char GetGreenUC(void) const
unsigned char GetAlphaUC(void) const
float GetAlpha(void) const
bool operator<(const CRgbaColor &c1, const CRgbaColor &c2)
define a some-what arbitrary sort order based on brightness It does have the property of being equiva...
CRgbaColor operator*(const CRgbaColor &c1, float f)
multiply a color by a scalar
const float * GetColorArray(void) const
Access the color array directly.
unsigned char GetBlueUC(void) const
CRgbaColor operator+(const CRgbaColor &c1, const CRgbaColor &c2)
add two colors
bool operator==(const CRgbaColor &c1, const CRgbaColor &c2)
global comparison operator
CVect3< unsigned char > GetRgbUC()
void SetRed(float r)
Set specific channels from floating point values.
CVect4< unsigned char > GetRgbaUC()
float GetRed(void) const
Get specific channels in floating point values.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
#define NCBI_GUIUTILS_EXPORT
CNcbiMatrix< T > & operator+=(CNcbiMatrix< T > &, const CNcbiMatrix< U > &)
global addition: matrix += matrix
CNcbiMatrix< T > & operator*=(CNcbiMatrix< T > &, const CNcbiMatrix< U > &)
global multiplication: matrix *= matrix
const struct ncbi::grid::netcache::search::fields::SIZE size
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
double f(double x_, const double &y_)
static const char * str(char *buf, int n)
int g(Seg_Gsm *spe, Seq_Mtf *psm, Thd_Gsm *tdg)
string ToString(const wxRect &rc)