OpenLexocad  27.0
Base::Color Class Reference

#include <Color.h>

Public Types

enum  Spec { Invalid, Rgb, Hsv, Cmyk }
 
enum  Origin { Unknown, Cadwork, Greyscale }
 

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)
 
 ~Color ()
 
bool isValid () const
 
std::string name () const
 
void setNamedColor (const std::string &name)
 
Spec spec () const
 
void setOrigin (Origin o)
 
Origin origin () 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=0) const
 
void setRgb (int r, int g, int b, int a=255)
 
void getRgbF (double *r, double *g, double *b, double *a=0) 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=0) const
 
void setHsv (int h, int s, int v, int a=255)
 
void getHsvF (double *h, double *s, double *v, double *a=0) 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=0)
 
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=0)
 
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 isEqualIgnoreOrigin (const Color &c) const
 
bool operator== (const Color &c) const
 
bool operator!= (const Color &c) const
 
bool operator< (const Color &c) const
 
size_t hash () const
 
Color toCdwkOrigin () const
 
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 int toCdwkColor (const Color &color, bool *isPrecise=NULL)
 Converts a Color to a cadwork color. More...
 
static Color fromCdwkColor (const int index)
 Converts a cadwork color to a Color. More...
 
static int maximumCdwkColorNumber ()
 Returns maximum number (not index!, index = number-1) in cadwork palette. Classic cadwork palette has numbers [1-256]. More...
 
static int toGreyscaleColor (const Color &color, bool *isPrecise=NULL)
 Converts a Color to a greyscale color. More...
 
static Color fromGreyscaleColor (const int index)
 Converts a cadwork color to a Color. More...
 

Friends

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

Member Enumeration Documentation

◆ Origin

Enumerator
Unknown 
Cadwork 
Greyscale 

◆ Spec

Enumerator
Invalid 
Rgb 
Hsv 
Cmyk 

Constructor & Destructor Documentation

◆ Color() [1/7]

Base::Color::Color ( )

◆ Color() [2/7]

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

◆ Color() [3/7]

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

◆ Color() [4/7]

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

◆ Color() [5/7]

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

◆ Color() [6/7]

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

◆ Color() [7/7]

Base::Color::Color ( Spec  spec)

◆ ~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 int  index)
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

◆ fromGreyscaleColor()

static Color Base::Color::fromGreyscaleColor ( const int  index)
static

Converts a cadwork color to a Color.

◆ 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

◆ getCmyk()

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

◆ getCmykF()

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

◆ getHsv()

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

◆ getHsvF()

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

◆ getRgb()

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

◆ getRgbF()

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

◆ 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

◆ isEqualIgnoreOrigin()

bool Base::Color::isEqualIgnoreOrigin ( const Color c) const

◆ isValid()

bool Base::Color::isValid ( ) const

◆ light()

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

◆ lighter()

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

◆ magenta()

int Base::Color::magenta ( ) const

◆ magentaF()

double Base::Color::magentaF ( ) const

◆ maximumCdwkColorNumber()

static int Base::Color::maximumCdwkColorNumber ( )
static

Returns maximum number (not index!, index = number-1) in cadwork palette. Classic cadwork palette has numbers [1-256].

◆ 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

◆ origin()

Origin Base::Color::origin ( ) 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 
)

◆ setNamedColor()

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

◆ setOrigin()

void Base::Color::setOrigin ( Origin  o)

◆ 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 int Base::Color::toCdwkColor ( const Color color,
bool *  isPrecise = NULL 
)
static

Converts a Color to a cadwork color.

◆ toCdwkOrigin()

Color Base::Color::toCdwkOrigin ( ) const

◆ toCmyk()

Color Base::Color::toCmyk ( ) const

◆ toGreyscaleColor()

static int Base::Color::toGreyscaleColor ( const Color color,
bool *  isPrecise = NULL 
)
static

Converts a Color to a greyscale color.

◆ 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<<

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

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