OpenLexocad  28.0
Base::Color Class Reference

#include <Color.h>

Public Types

enum  Spec { Invalid, Rgb, Hsv, Cmyk }
 

Public Member Functions

 Color ()
 
 Color (const Base::MColor &c)
 
 Color (int r, int g, int b, int a=255)
 
 Color (const std::string &name)
 
 Color (const char *name)
 
 Color (const Color &rhs)
 
 Color (Spec spec)
 
bool isValid () const
 
std::string name () const
 
void setNamedColor (const std::string &name)
 
Spec spec () const
 
int alpha () const
 
void setAlpha (int alpha)
 
double alphaF () const
 
void setAlphaF (double alpha)
 
int red () const
 
int green () const
 
int blue () const
 
void setRed (int red)
 
void setGreen (int green)
 
void setBlue (int blue)
 
double redF () const
 
double greenF () const
 
double blueF () const
 
void setRedF (double red)
 
void setGreenF (double green)
 
void setBlueF (double blue)
 
void getRgb (int *r, int *g, int *b, int *a=nullptr) const
 
void setRgb (int r, int g, int b, int a=255)
 
void getRgbF (double *r, double *g, double *b, double *a=nullptr) const
 
void setRgbF (double r, double g, double b, double a=1.0)
 
int hue () const
 
int saturation () const
 
int value () const
 
double hueF () const
 
double saturationF () const
 
double valueF () const
 
void getHsv (int *h, int *s, int *v, int *a=nullptr) const
 
void setHsv (int h, int s, int v, int a=255)
 
void getHsvF (double *h, double *s, double *v, double *a=nullptr) const
 
void setHsvF (double h, double s, double v, double a=1.0)
 
int cyan () const
 
int magenta () const
 
int yellow () const
 
int black () const
 
double cyanF () const
 
double magentaF () const
 
double yellowF () const
 
double blackF () const
 
void getCmyk (int *c, int *m, int *y, int *k, int *a=nullptr)
 
void setCmyk (int c, int m, int y, int k, int a=255)
 
void getCmykF (double *c, double *m, double *y, double *k, double *a=nullptr)
 
void setCmykF (double c, double m, double y, double k, double a=1.0)
 
Color toRgb () const
 
Color toHsv () const
 
Color toCmyk () const
 
Color convertTo (Spec colorSpec) const
 
Color light (int f=150) const
 
Color lighter (int f=150) const
 
Color dark (int f=200) const
 
Color darker (int f=200) const
 
Coloroperator= (const Color &)
 
bool operator== (const Color &c) const
 
bool operator!= (const Color &c) const
 
bool operator< (const Color &c) const
 
bool isLcc () const
 Returns true if the color is intended to be used for Lcc elements/components. More...
 
bool isMainLcc () const
 Returns true if the color is intended to be used for main Lcc elements/components. More...
 
size_t hash () const
 
 Color (unsigned int rgb)
 
 ~Color ()
 
unsigned int rgb () const
 
unsigned int rgba () const
 

Static Public Member Functions

static std::list< std::string > colorNames ()
 
static Color fromRgb (int r, int g, int b, int a=255)
 
static Color fromRgbF (double r, double g, double b, double a=1.0)
 
static Color fromHsv (int h, int s, int v, int a=255)
 
static Color fromHsvF (double h, double s, double v, double a=1.0)
 
static Color fromCmyk (int c, int m, int y, int k, int a=255)
 
static Color fromCmykF (double c, double m, double y, double k, double a=1.0)
 
static const std::map< std::pair< unsigned int, unsigned int >, Base::Color > & getCdwkPalette ()
 Provides access to the cadwork palette. More...
 
static std::pair< unsigned int, unsigned int > toCdwkColor (const Color &color, bool *isPrecise=nullptr)
 Converts a Color to a cadwork color. More...
 
static Color fromCdwkColor (const unsigned int integerPart, const unsigned int decimalPart=0)
 Converts a cadwork color to a Color. More...
 
static unsigned int maximumCdwkColorIntegerNumber ()
 Returns maximum number in cadwork palette. Classic cadwork palette has numbers [1-256]. More...
 
static unsigned int maximumDecimalPartNumber ()
 Returns maximum number that is available in decimal part. More...
 
static Base::String getToolTip (const Base::Color &color)
 Returns tooltip for given color. More...
 
static void loadLccColors (const Base::String &filename, bool user=false)
 Reloads Lcc colors from the file. More...
 
static void setLccColors (const std::map< int, Base::Color > &colors, const std::map< Base::Color, Base::String > &tooltips)
 Sets Lcc colors from the map. More...
 

Friends

std::size_t hash_value (const Color &b)
 
LX_BASE_EXPORT std::ostream & operator<< (std::ostream &o, const Base::Color &color)
 

Member Enumeration Documentation

◆ Spec

Enumerator
Invalid 
Rgb 
Hsv 
Cmyk 

Constructor & Destructor Documentation

◆ Color() [1/8]

Base::Color::Color ( )

◆ Color() [2/8]

Base::Color::Color ( const Base::MColor c)

◆ Color() [3/8]

Base::Color::Color ( int  r,
int  g,
int  b,
int  a = 255 
)

◆ Color() [4/8]

Base::Color::Color ( const std::string &  name)

◆ Color() [5/8]

Base::Color::Color ( const char *  name)

◆ Color() [6/8]

Base::Color::Color ( const Color rhs)

◆ Color() [7/8]

Base::Color::Color ( Spec  spec)

◆ Color() [8/8]

Base::Color::Color ( unsigned int  rgb)

◆ ~Color()

Base::Color::~Color ( )

Member Function Documentation

◆ alpha()

int Base::Color::alpha ( ) const

◆ alphaF()

double Base::Color::alphaF ( ) const

◆ black()

int Base::Color::black ( ) const

◆ blackF()

double Base::Color::blackF ( ) const

◆ blue()

int Base::Color::blue ( ) const

◆ blueF()

double Base::Color::blueF ( ) const

◆ colorNames()

static std::list<std::string> Base::Color::colorNames ( )
static

◆ convertTo()

Color Base::Color::convertTo ( Spec  colorSpec) const

◆ cyan()

int Base::Color::cyan ( ) const

◆ cyanF()

double Base::Color::cyanF ( ) const

◆ dark()

Color Base::Color::dark ( int  f = 200) const

◆ darker()

Color Base::Color::darker ( int  f = 200) const

◆ fromCdwkColor()

static Color Base::Color::fromCdwkColor ( const unsigned int  integerPart,
const unsigned int  decimalPart = 0 
)
static

Converts a cadwork color to a Color.

◆ fromCmyk()

static Color Base::Color::fromCmyk ( int  c,
int  m,
int  y,
int  k,
int  a = 255 
)
static

◆ fromCmykF()

static Color Base::Color::fromCmykF ( double  c,
double  m,
double  y,
double  k,
double  a = 1.0 
)
static

◆ fromHsv()

static Color Base::Color::fromHsv ( int  h,
int  s,
int  v,
int  a = 255 
)
static

◆ fromHsvF()

static Color Base::Color::fromHsvF ( double  h,
double  s,
double  v,
double  a = 1.0 
)
static

◆ fromRgb()

static Color Base::Color::fromRgb ( int  r,
int  g,
int  b,
int  a = 255 
)
static

◆ fromRgbF()

static Color Base::Color::fromRgbF ( double  r,
double  g,
double  b,
double  a = 1.0 
)
static

◆ getCdwkPalette()

static const std::map<std::pair<unsigned int, unsigned int>, Base::Color>& Base::Color::getCdwkPalette ( )
static

Provides access to the cadwork palette.

◆ getCmyk()

void Base::Color::getCmyk ( int *  c,
int *  m,
int *  y,
int *  k,
int *  a = nullptr 
)

◆ getCmykF()

void Base::Color::getCmykF ( double *  c,
double *  m,
double *  y,
double *  k,
double *  a = nullptr 
)

◆ getHsv()

void Base::Color::getHsv ( int *  h,
int *  s,
int *  v,
int *  a = nullptr 
) const

◆ getHsvF()

void Base::Color::getHsvF ( double *  h,
double *  s,
double *  v,
double *  a = nullptr 
) const

◆ getRgb()

void Base::Color::getRgb ( int *  r,
int *  g,
int *  b,
int *  a = nullptr 
) const

◆ getRgbF()

void Base::Color::getRgbF ( double *  r,
double *  g,
double *  b,
double *  a = nullptr 
) const

◆ getToolTip()

static Base::String Base::Color::getToolTip ( const Base::Color color)
static

Returns tooltip for given color.

◆ green()

int Base::Color::green ( ) const

◆ greenF()

double Base::Color::greenF ( ) const

◆ hash()

size_t Base::Color::hash ( ) const

◆ hue()

int Base::Color::hue ( ) const

◆ hueF()

double Base::Color::hueF ( ) const

◆ isLcc()

bool Base::Color::isLcc ( ) const

Returns true if the color is intended to be used for Lcc elements/components.

◆ isMainLcc()

bool Base::Color::isMainLcc ( ) const

Returns true if the color is intended to be used for main Lcc elements/components.

◆ isValid()

bool Base::Color::isValid ( ) const

◆ light()

Color Base::Color::light ( int  f = 150) const

◆ lighter()

Color Base::Color::lighter ( int  f = 150) const

◆ loadLccColors()

static void Base::Color::loadLccColors ( const Base::String filename,
bool  user = false 
)
static

Reloads Lcc colors from the file.

◆ magenta()

int Base::Color::magenta ( ) const

◆ magentaF()

double Base::Color::magentaF ( ) const

◆ maximumCdwkColorIntegerNumber()

static unsigned int Base::Color::maximumCdwkColorIntegerNumber ( )
static

Returns maximum number in cadwork palette. Classic cadwork palette has numbers [1-256].

◆ maximumDecimalPartNumber()

static unsigned int Base::Color::maximumDecimalPartNumber ( )
static

Returns maximum number that is available in decimal part.

◆ name()

std::string Base::Color::name ( ) const

◆ operator!=()

bool Base::Color::operator!= ( const Color c) const

◆ operator<()

bool Base::Color::operator< ( const Color c) const

◆ operator=()

Color& Base::Color::operator= ( const Color )

◆ operator==()

bool Base::Color::operator== ( const Color c) const

◆ red()

int Base::Color::red ( ) const

◆ redF()

double Base::Color::redF ( ) const

◆ rgb()

unsigned int Base::Color::rgb ( ) const

◆ rgba()

unsigned int Base::Color::rgba ( ) const

◆ saturation()

int Base::Color::saturation ( ) const

◆ saturationF()

double Base::Color::saturationF ( ) const

◆ setAlpha()

void Base::Color::setAlpha ( int  alpha)

◆ setAlphaF()

void Base::Color::setAlphaF ( double  alpha)

◆ setBlue()

void Base::Color::setBlue ( int  blue)

◆ setBlueF()

void Base::Color::setBlueF ( double  blue)

◆ setCmyk()

void Base::Color::setCmyk ( int  c,
int  m,
int  y,
int  k,
int  a = 255 
)

◆ setCmykF()

void Base::Color::setCmykF ( double  c,
double  m,
double  y,
double  k,
double  a = 1.0 
)

◆ setGreen()

void Base::Color::setGreen ( int  green)

◆ setGreenF()

void Base::Color::setGreenF ( double  green)

◆ setHsv()

void Base::Color::setHsv ( int  h,
int  s,
int  v,
int  a = 255 
)

◆ setHsvF()

void Base::Color::setHsvF ( double  h,
double  s,
double  v,
double  a = 1.0 
)

◆ setLccColors()

static void Base::Color::setLccColors ( const std::map< int, Base::Color > &  colors,
const std::map< Base::Color, Base::String > &  tooltips 
)
static

Sets Lcc colors from the map.

◆ setNamedColor()

void Base::Color::setNamedColor ( const std::string &  name)

◆ setRed()

void Base::Color::setRed ( int  red)

◆ setRedF()

void Base::Color::setRedF ( double  red)

◆ setRgb()

void Base::Color::setRgb ( int  r,
int  g,
int  b,
int  a = 255 
)

◆ setRgbF()

void Base::Color::setRgbF ( double  r,
double  g,
double  b,
double  a = 1.0 
)

◆ spec()

Spec Base::Color::spec ( ) const

◆ toCdwkColor()

static std::pair<unsigned int, unsigned int> Base::Color::toCdwkColor ( const Color color,
bool *  isPrecise = nullptr 
)
static

Converts a Color to a cadwork color.

◆ toCmyk()

Color Base::Color::toCmyk ( ) const

◆ toHsv()

Color Base::Color::toHsv ( ) const

◆ toRgb()

Color Base::Color::toRgb ( ) const

◆ value()

int Base::Color::value ( ) const

◆ valueF()

double Base::Color::valueF ( ) const

◆ yellow()

int Base::Color::yellow ( ) const

◆ yellowF()

double Base::Color::yellowF ( ) const

Friends And Related Function Documentation

◆ hash_value

std::size_t hash_value ( const Color b)
friend

◆ operator<<

LX_BASE_EXPORT std::ostream& operator<< ( std::ostream &  o,
const Base::Color color 
)
friend

The documentation for this class was generated from the following file: