NanoCanvas
Typedefs | Functions
ColorConverter Namespace Reference

Typedefs

using byte = unsigned char
 

Functions

static double clamp (double x, double a, double b)
 
static double threeway_max (double a, double b, double c)
 
static double threeway_min (double a, double b, double c)
 
static double hue2rgb (double h, double m1, double m2)
 
static void hslToRgb (double h, double s, double l, byte rgb[])
 
static void rgbToHsl (byte r, byte g, byte b, double hsl[])
 
static void rgbToHsv (byte r, byte g, byte b, double hsv[])
 
static void hsvToRgb (double h, double s, double v, byte rgb[])
 

Typedef Documentation

using ColorConverter::byte = typedef unsigned char

Function Documentation

static double ColorConverter::clamp ( double  x,
double  a,
double  b 
)
static
static void ColorConverter::hslToRgb ( double  h,
double  s,
double  l,
byte  rgb[] 
)
static

Converts an HSL color value to RGB. Conversion formula adapted from http://en.wikipedia.org/wiki/HSL_color_space. Assumes h, s, and l are contained in the set [0, 1] and returns r, g, and b in the set [0, 255].

Parameters
doubleh The hue
doubles The saturation
doublel The lightness
Returns
byte rgb[] The RGB representation
static void ColorConverter::hsvToRgb ( double  h,
double  s,
double  v,
byte  rgb[] 
)
static

Converts an HSV color value to RGB. Conversion formula adapted from http://en.wikipedia.org/wiki/HSV_color_space. Assumes h, s, and v are contained in the set [0, 1] and returns r, g, and b in the set [0, 255].

Parameters
doubleh The hue
doubles The saturation
doublev The value
Returns
byte rgb[] The RGB representation
static double ColorConverter::hue2rgb ( double  h,
double  m1,
double  m2 
)
static
static void ColorConverter::rgbToHsl ( byte  r,
byte  g,
byte  b,
double  hsl[] 
)
static

Converts an RGB color value to HSL. Conversion formula adapted from http://en.wikipedia.org/wiki/HSL_color_space. Assumes r, g, and b are contained in the set [0, 255] and returns h, s, and l in the set [0, 1].

Parameters
byter The red color value
byteg The green color value
byteb The blue color value
doublehsl[] The HSL representation
static void ColorConverter::rgbToHsv ( byte  r,
byte  g,
byte  b,
double  hsv[] 
)
static

Converts an RGB color value to HSV. Conversion formula adapted from http://en.wikipedia.org/wiki/HSV_color_space. Assumes r, g, and b are contained in the set [0, 255] and returns h, s, and v in the set [0, 1].

Parameters
byter The red color value
byteg The green color value
byteb The blue color value
Returns
double hsv[] The HSV representation
static double ColorConverter::threeway_max ( double  a,
double  b,
double  c 
)
static
static double ColorConverter::threeway_min ( double  a,
double  b,
double  c 
)
static

The documentation was generated by Doxygen

Copyright © 2015 Geequlim. All rights reserved.