Kolory
[Moduł Math]


Komponenty

struct  common::COLOR
 Kolor w formacie A8R8G8B8. Więcej...
struct  common::COLORF
 Kolor z 4 liczb typu float - R, G, B, A. Więcej...

Funkcje

void common::swap (COLORF &c1, COLORF &c2)
COLORF common::operator* (float s, const COLORF &c)
COLORF common::operator/ (float s, const COLORF &c)
COLOR common::operator* (float s, const COLOR &c)
COLOR common::operator/ (float s, const COLOR &c)
template<>
uint4 & common::math_cast< uint4, COLOR > (const COLOR &x)
template<>
unsigned long & common::math_cast< unsigned long, COLOR > (const COLOR &x)
template<>
COLOR & common::math_cast< COLOR, uint4 > (const uint4 &x)
template<>
COLOR & common::math_cast< COLOR, unsigned long > (const unsigned long &x)
template<>
D3DXCOLOR & common::math_cast< D3DXCOLOR, COLORF > (const COLORF &x)
template<>
COLORF & common::math_cast< COLORF, D3DXCOLOR > (const D3DXCOLOR &x)
void common::ColorToColorf (COLORF *Out, COLOR c)
 Konwersje między tymi dwoma reprezentacjami kolorów.
COLOR common::ColorfToColor (const COLORF &c)
void common::ColorToStr (tstring *Out, COLOR Color, char Format= 'X')
 Konwersja koloru na łańcuch.
void common::ColorToStr (tstring *Out, const COLORF &Color, char Format= 'F')
bool common::StrToColor (COLOR *Out, const tstring &Str)
 Konwersja łańcucha na kolor.
bool common::StrToColor (COLORF *Out, const tstring &Str)
void common::Add (COLORF *Out, const COLORF &c1, const COLORF &c2)
void common::Sub (COLORF *Out, const COLORF &c1, const COLORF &c2)
void common::Mul (COLORF *Out, const COLORF &c1, const COLORF &c2)
void common::Mul (COLORF *Out, const COLORF &c, float s)
void common::Div (COLORF *Out, const COLORF &c, float s)
void common::Negative (COLORF *Out, const COLORF &c)
COLOR common::ARGB_ABGR (COLOR color)
 Konwertuje kolor między systemami ARGB i ABGR.
void common::Lerp (COLORF *Out, const COLORF &c1, const COLORF &c2, float t)
COLOR common::Lerp (COLOR c1, COLOR c2, float t)
void common::HsbToRgb (COLORF *Out, float hue, float saturation, float brightness)
 Konwertuje kolor między HSB a RGB.
void common::RgbToHsb (float *OutHue, float *OutSaturation, float *OutBrightness, const COLORF &Color)
 Konwertuje kolor RGB na HSB.
void common::ColorRainbow (COLORF *Out, float t)
 Zwraca kolor tęczy od czerwonego (odpowiada mu t = 0) do niebieskiego (t = 1).
float common::ColorToGrayscale (const COLORF &c)
 Zwraca jasność podanego koloru (odcień szarości) z zakresu 0..1.
float common::ColorToGrayscale (COLOR &c)
void common::GrayscaleToColor (COLORF *Out, float t)
 Zwraca kolor szary o podanej jasności t = 0..1.
void common::GrayscaleToColor (COLOR *Out, float t)
void common::AdjustContrast (COLORF *Color, float t)
 Zmienia kolorowi kontrast na miejscu.
void common::AdjustSaturation (COLORF *Color, float t)
 Zmienia kolorowi nasycenie na miejscu.
COLOR common::VectorToColor (const VEC3 &v)
 Przetwarza znormalizowany wektor na kolor XRGB. A zwraca 0.
void common::ColorToVector (VEC3 *Out, COLOR color)
 Przetwarza kolor na wektor.
uint common::ColorDistance (COLOR Color1, COLOR Color2)
 Zwraca "odległość" dwóch kolorów wg jakiejśtam byle jakiej metryki. Uwzględnia składowe R, G, B.

Zmienne

const COLOR common::COLOR_TRANSPARENT_
const COLOR common::COLOR_BLACK
const COLOR common::COLOR_GRAY
const COLOR common::COLOR_SILVER
const COLOR common::COLOR_WHITE
const COLOR common::COLOR_FUCHSIA
const COLOR common::COLOR_RED
const COLOR common::COLOR_ORANGE
const COLOR common::COLOR_YELLOW
const COLOR common::COLOR_LIME
const COLOR common::COLOR_AQUA
const COLOR common::COLOR_BLUE
const COLOR common::COLOR_PURPLE
const COLOR common::COLOR_MAROON
const COLOR common::COLOR_OLIVE
const COLOR common::COLOR_GREEN
const COLOR common::COLOR_TEAL
const COLORF common::COLORF_TRANSPARENT_
const COLORF common::COLORF_BLACK
const COLORF common::COLORF_GRAY
const COLORF common::COLORF_SILVER
const COLORF common::COLORF_WHITE
const COLORF common::COLORF_FUCHSIA
const COLORF common::COLORF_RED
const COLORF common::COLORF_ORANGE
const COLORF common::COLORF_YELLOW
const COLORF common::COLORF_LIME
const COLORF common::COLORF_AQUA
const COLORF common::COLORF_BLUE
const COLORF common::COLORF_PURPLE
const COLORF common::COLORF_MAROON
const COLORF common::COLORF_OLIVE
const COLORF common::COLORF_GREEN
const COLORF common::COLORF_TEAL

Opis szczegółowy

Stałe z kolorami, operacje generujące kolory itp. wypełniają kanał alfa jedynką.

Dokumentacja funkcji

void common::Add ( COLORF *  Out,
const COLORF &  c1,
const COLORF &  c2 
) [inline]

void common::AdjustContrast ( COLORF *  Color,
float  t 
) [inline]

Zmienia kolorowi kontrast na miejscu.

Dla t = 0 wychodzi idealnie połówkowy szary.
Dla t = 1 wychodzi kolor oryginalny.
t może też być większe niż 1.
Alfa zostaje bez zmian.

void common::AdjustSaturation ( COLORF *  Color,
float  t 
) [inline]

Zmienia kolorowi nasycenie na miejscu.

Dla t = 0 wychodzi dany kolor skonwertowany do odcienia szarości.
Dla t = 1 wychodzi kolor oryginalny.
t < 0 zmniejsza nasycenie, t > 0 zwiększa nasycenie
Alfa zostaje bez zmian.

COLOR common::ARGB_ABGR ( COLOR  color  )  [inline]

Konwertuje kolor między systemami ARGB i ABGR.

uint common::ColorDistance ( COLOR  Color1,
COLOR  Color2 
) [inline]

Zwraca "odległość" dwóch kolorów wg jakiejśtam byle jakiej metryki. Uwzględnia składowe R, G, B.

COLOR common::ColorfToColor ( const COLORF &  c  )  [inline]

Tu musi być valid, inaczej wyjdzie zawinięte.

void common::ColorRainbow ( COLORF *  Out,
float  t 
) [inline]

Zwraca kolor tęczy od czerwonego (odpowiada mu t = 0) do niebieskiego (t = 1).

Kanał alfa zwraca 0.

void common::ColorToColorf ( COLORF *  Out,
COLOR  c 
) [inline]

Konwersje między tymi dwoma reprezentacjami kolorów.

float common::ColorToGrayscale ( COLOR &  c  )  [inline]

float common::ColorToGrayscale ( const COLORF &  c  )  [inline]

Zwraca jasność podanego koloru (odcień szarości) z zakresu 0..1.

void common::ColorToStr ( tstring *  Out,
const COLORF &  Color,
char  Format = 'F' 
)

void common::ColorToStr ( tstring *  Out,
COLOR  Color,
char  Format = 'X' 
)

Konwersja koloru na łańcuch.

Formatem może być:

  • 'x' = RRGGBB szesnastkowo
  • 'X' = AARRGGBB szesnastkowo
  • 'f' = R,G,B floaty
  • 'F' = A,R,G,B floaty

void common::ColorToVector ( VEC3 *  Out,
COLOR  color 
) [inline]

Przetwarza kolor na wektor.

void common::Div ( COLORF *  Out,
const COLORF &  c,
float  s 
) [inline]

void common::GrayscaleToColor ( COLOR *  Out,
float  t 
) [inline]

void common::GrayscaleToColor ( COLORF *  Out,
float  t 
) [inline]

Zwraca kolor szary o podanej jasności t = 0..1.

void common::HsbToRgb ( COLORF *  Out,
float  hue,
float  saturation,
float  brightness 
)

Konwertuje kolor między HSB a RGB.

  • Hue, Saturation, Brightness = 0..1
  • Kanał alfa zwraca 1.

COLOR common::Lerp ( COLOR  c1,
COLOR  c2,
float  t 
) [inline]

void common::Lerp ( COLORF *  Out,
const COLORF &  c1,
const COLORF &  c2,
float  t 
) [inline]

template<>
COLOR& common::math_cast< COLOR, uint4 > ( const uint4 &  x  )  [inline]

template<>
COLOR& common::math_cast< COLOR, unsigned long > ( const unsigned long &  x  )  [inline]

template<>
COLORF& common::math_cast< COLORF, D3DXCOLOR > ( const D3DXCOLOR &  x  )  [inline]

template<>
D3DXCOLOR& common::math_cast< D3DXCOLOR, COLORF > ( const COLORF &  x  )  [inline]

template<>
uint4& common::math_cast< uint4, COLOR > ( const COLOR &  x  )  [inline]

template<>
unsigned long& common::math_cast< unsigned long, COLOR > ( const COLOR &  x  )  [inline]

void common::Mul ( COLORF *  Out,
const COLORF &  c,
float  s 
) [inline]

void common::Mul ( COLORF *  Out,
const COLORF &  c1,
const COLORF &  c2 
) [inline]

void common::Negative ( COLORF *  Out,
const COLORF &  c 
) [inline]

COLOR common::operator* ( float  s,
const COLOR &  c 
) [inline]

COLORF common::operator* ( float  s,
const COLORF &  c 
) [inline]

COLOR common::operator/ ( float  s,
const COLOR &  c 
) [inline]

COLORF common::operator/ ( float  s,
const COLORF &  c 
) [inline]

void common::RgbToHsb ( float *  OutHue,
float *  OutSaturation,
float *  OutBrightness,
const COLORF &  Color 
)

Konwertuje kolor RGB na HSB.

bool common::StrToColor ( COLORF *  Out,
const tstring &  Str 
)

bool common::StrToColor ( COLOR *  Out,
const tstring &  Str 
)

Konwersja łańcucha na kolor.

Jeśli kanał alfa nie podany, zostaje wypełniony wartością maksymalną. Łańcuchem może być:

  • jedna z 16 nazw standardowych kolorów (wielkość liter dowolna)
  • wartość szesnastkowa RRGGBB
  • wartość szesnastkowa AARRGGBB
  • liczby float R,G,B
  • liczby float A,R,G,B

void common::Sub ( COLORF *  Out,
const COLORF &  c1,
const COLORF &  c2 
) [inline]

void common::swap ( COLORF &  c1,
COLORF &  c2 
) [inline]

COLOR common::VectorToColor ( const VEC3 &  v  )  [inline]

Przetwarza znormalizowany wektor na kolor XRGB. A zwraca 0.


Dokumentacja zmiennych

const COLOR common::COLOR_AQUA

const COLOR common::COLOR_BLACK

const COLOR common::COLOR_BLUE

const COLOR common::COLOR_FUCHSIA

const COLOR common::COLOR_GRAY

const COLOR common::COLOR_GREEN

const COLOR common::COLOR_LIME

const COLOR common::COLOR_MAROON

const COLOR common::COLOR_OLIVE

const COLOR common::COLOR_ORANGE

const COLOR common::COLOR_PURPLE

const COLOR common::COLOR_RED

const COLOR common::COLOR_SILVER

const COLOR common::COLOR_TEAL

const COLOR common::COLOR_WHITE

const COLOR common::COLOR_YELLOW

const COLORF common::COLORF_AQUA

const COLORF common::COLORF_BLACK

const COLORF common::COLORF_BLUE

const COLORF common::COLORF_FUCHSIA

const COLORF common::COLORF_GRAY

const COLORF common::COLORF_GREEN

const COLORF common::COLORF_LIME

const COLORF common::COLORF_MAROON

const COLORF common::COLORF_OLIVE

const COLORF common::COLORF_ORANGE

const COLORF common::COLORF_PURPLE

const COLORF common::COLORF_RED

const COLORF common::COLORF_SILVER

const COLORF common::COLORF_TEAL

const COLORF common::COLORF_WHITE

const COLORF common::COLORF_YELLOW


Wygenerowano Sat Mar 29 18:17:00 2008 dla CommonLib programem  doxygen 1.5.5