From f1cbc2661b894089b00c0c3fc72442809da59d59 Mon Sep 17 00:00:00 2001 From: "kriegsman@gmail.com" Date: Sat, 27 Apr 2013 19:45:20 +0000 Subject: MEK: Add references and links re: color spaces and color conversions. --- hsv2rgb.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'hsv2rgb.cpp') diff --git a/hsv2rgb.cpp b/hsv2rgb.cpp index 45cf326b..3d5c3d62 100644 --- a/hsv2rgb.cpp +++ b/hsv2rgb.cpp @@ -364,5 +364,43 @@ void rainbow2rgb( const CHSV& hsv, CRGB& rgb) } +// References: +// Spectra and rainbows are not the same thing. Wikipedia has a good +// illustration here +// http://upload.wikimedia.org/wikipedia/commons/f/f6/Prism_compare_rainbow_01.png +// from this article +// http://en.wikipedia.org/wiki/Rainbow#Number_of_colours_in_spectrum_or_rainbow +// that shows a 'spectrum' and a 'rainbow' side by side. Among other +// differences, you'll see that a 'rainbow' has much more yellow than +// a plain spectrum. "Classic" LED color washes are spectrum based, and +// usually show very little yellow. +// +// Wikipedia's page on HSV color space, with pseudocode for conversion +// to RGB color space +// http://en.wikipedia.org/wiki/HSL_and_HSV +// Note that their conversion algorithm, which is (naturally) very popular +// is in the "maximum brightness at any given hue" style, vs the "uniform +// brightness for all hues" style. +// +// You can't have both; either purple is the same brightness as red, e.g +// red = #FF0000 and purple = #800080 -> same "total light" output +// OR purple is 'as bright as it can be', e.g. +// red = #FF0000 and purple = #FF00FF -> purple is much brighter than red. +// The colorspace conversions here try to keep the apparent brightness +// constant even as the hue varies. +// +// Adafruit's "Wheel" function, discussed here +// http://forums.adafruit.com/viewtopic.php?f=47&t=22483 +// is also of the "constant apparent brightness" variety. +// +// TODO: provide the 'maximum brightness no matter what' variation. +// +// See also some good, clear Arduino C code from Kasper Kamperman +// http://www.kasperkamperman.com/blog/arduino/arduino-programming-hsb-to-rgb/ +// which in turn was was based on Windows C code from "nico80" +// http://www.codeproject.com/Articles/9207/An-HSB-RGBA-colour-picker + + + #endif -- cgit v1.2.3