colour: remove static constants

This commit is contained in:
Danny Robson 2016-12-12 17:03:36 +11:00
parent ed3f5629b8
commit d2ba672a30
3 changed files with 2 additions and 27 deletions

View File

@ -28,22 +28,6 @@ using util::colour3f;
using util::colour4f;
//-----------------------------------------------------------------------------
#define CONSTANT_COLOUR(NAME,R,G,B) \
template <size_t S, typename T> \
const util::colour<S,T> \
util::colour<S,T>::NAME = \
util::colour<4,float> (R,G,B,1) \
.template redim<S> () \
.template cast<T> ()
CONSTANT_COLOUR(WHITE,1,1,1);
CONSTANT_COLOUR(BLACK,0,0,0);
CONSTANT_COLOUR(RED, 1,0,0);
CONSTANT_COLOUR(GREEN,0,1,0);
CONSTANT_COLOUR(BLUE, 0,0,1);
//-----------------------------------------------------------------------------
static const std::map<std::string, colour<4,uint8_t>>
HTML_COLOURS { {

View File

@ -34,12 +34,6 @@ namespace util {
colour<S,U>
cast (void) const;
static const colour WHITE;
static const colour BLACK;
static const colour RED;
static const colour BLUE;
static const colour GREEN;
static colour from_html (const std::string&);
static colour from_x11 (const std::string&);
static colour from_string (const std::string&);

View File

@ -8,9 +8,6 @@ main (int, char**)
{
util::TAP::logger tap;
// Simple check for symbol visibility
tap.expect_eq (util::colour4f::WHITE, util::colour4f (1), "WHITE available");
// Check casting works between intergral and floating formats
{
util::colour4f f (1);
@ -20,8 +17,8 @@ main (int, char**)
}
// Check lookups are working
tap.expect_eq (util::colour4f::from_html ("white"), util::colour4f::WHITE, "HTML lookup");
tap.expect_eq ( util::colour4f::from_x11 ("white"), util::colour4f::WHITE, "X11 lookup");
tap.expect_eq (util::colour4f::from_html ("white"), util::colour4f {1}, "HTML lookup");
tap.expect_eq ( util::colour4f::from_x11 ("white"), util::colour4f {1}, "X11 lookup");
// Check HSV conversions
{