34 #ifndef __INCLUDE_MIST_COLOR_H__
35 #define __INCLUDE_MIST_COLOR_H__
38 #ifndef __INCLUDE_MIST_CONF_H__
42 #ifndef __INCLUDE_MIST_TYPE_TRAIT_H__
52 namespace __color_utility__
55 struct __normalized_color__
58 static void compute(
const T &r,
const T &g,
const T &b, T &R, T &G, T &B )
62 sum = sum > 0 ? sum : 1;
71 struct __normalized_color__< false >
74 static void compute(
const T &r,
const T &g,
const T &b, T &R, T &G, T &B )
76 double sum =
static_cast< double >( r ) + static_cast< double >( g ) +
static_cast< double >( b );
78 sum = sum > 0.0 ? sum : 1.0;
80 R =
static_cast< T
>( r * 255.0 / sum + 0.5 );
81 G =
static_cast< T
>( g * 255.0 / sum + 0.5 );
82 B =
static_cast< T
>( b * 255.0 / sum + 0.5 );
86 template <
class T >
inline T maximum(
const T &v1,
const T &v2 )
88 return( v1 > v2 ? v1 : v2 );
91 template <
class T >
inline T minimum(
const T &v1,
const T &v2 )
93 return( v1 < v2 ? v1 : v2 );
98 template <
class T >
struct bgr;
131 template <
class TT >
146 template <
class TT >
150 template <
class TT >
161 template <
class TT >
171 template <
class TT >
206 template <
class TT >
210 template <
class TT >
214 template <
class TT >
218 template <
class TT >
222 const rgb &operator %=(
const rgb &c ){ r %= c.
r; g %= c.
g; b %= c.
b;
return( *
this ); }
225 const rgb &operator |=(
const rgb &c ){ r |= c.
r; g |= c.
g; b |= c.
b;
return( *
this ); }
228 const rgb &operator &=(
const rgb &c ){ r &= c.
r; g &= c.
g; b &= c.
b;
return( *
this ); }
231 const rgb &operator ^=(
const rgb &c ){ r ^= c.
r; g ^= c.
g; b ^= c.
b;
return( *
this ); }
235 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
238 template <
class TT >
249 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
252 template <
class TT >
263 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
266 template <
class TT >
277 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
280 template <
class TT >
300 bool operator ==(
const rgb &c )
const {
return( r == c.
r && g == c.
g && b == c.
b ); }
311 bool operator !=(
const rgb &c )
const {
return( !( *
this == c ) ); }
322 bool operator < (
const rgb &c )
const
350 bool operator <=(
const rgb &c )
const {
return( c >= *
this ); }
361 bool operator > (
const rgb &c )
const {
return( c < *
this ); }
372 bool operator >=(
const rgb &c )
const {
return( !( *
this < c ) ); }
384 double rr = r, gg = g, bb = b;
466 template <
class TT >
478 bgr(
const value_type &pix = 0 ) : b( pix ), g( pix ), r( pix ){ }
481 template <
class TT >
482 bgr(
const bgr< TT > &c ) : b( static_cast< value_type >( c.b ) ), g( static_cast< value_type >( c.g ) ), r( static_cast< value_type >( c.r ) ){ }
488 bgr(
const value_type &rr,
const value_type &gg,
const value_type &bb ) : b( bb ), g( gg ), r( rr ){ }
491 template <
class TT >
492 bgr(
const rgb< TT > &c ) : b( static_cast< value_type >( c.b ) ), g( static_cast< value_type >( c.g ) ), r( static_cast< value_type >( c.r ) ){ }
496 template <
class TT >
499 b =
static_cast< value_type
>( c.
b );
500 g =
static_cast< value_type
>( c.
g );
501 r =
static_cast< value_type
>( c.
r );
506 template <
class TT >
509 b =
static_cast< value_type
>( c.
b );
510 g =
static_cast< value_type
>( c.
g );
511 r =
static_cast< value_type
>( c.
r );
528 const bgr &operator =(
const value_type &pix )
538 const bgr
operator -( )
const {
return( bgr( -r, -g, -b ) ); }
541 template <
class TT >
542 const bgr &
operator +=(
const bgr< TT > &c ){ b =
static_cast< value_type
>( b + c.
b ); g =
static_cast< value_type
>( g + c.
g ); r =
static_cast< value_type
>( r + c.
r );
return( *
this ); }
545 template <
class TT >
546 const bgr &
operator -=(
const bgr< TT > &c ){ b =
static_cast< value_type
>( b - c.
b ); g =
static_cast< value_type
>( g - c.
g ); r =
static_cast< value_type
>( r - c.
r );
return( *
this ); }
549 template <
class TT >
550 const bgr &
operator *=(
const bgr< TT > &c ){ b =
static_cast< value_type
>( b * c.
b ); g =
static_cast< value_type
>( g * c.
g ); r =
static_cast< value_type
>( r * c.
r );
return( *
this ); }
553 template <
class TT >
554 const bgr &
operator /=(
const bgr< TT > &c ){ b =
static_cast< value_type
>( b / c.
b ); g =
static_cast< value_type
>( g / c.
g ); r =
static_cast< value_type
>( r / c.
r );
return( *
this ); }
557 const bgr &operator %=(
const bgr &c ){ b %= c.
b; g %= c.
g; r %= c.
r;
return( *
this ); }
560 const bgr &operator |=(
const bgr &c ){ b |= c.
b; g |= c.
g; r |= c.
r;
return( *
this ); }
563 const bgr &operator &=(
const bgr &c ){ b &= c.
b; g &= c.
g; r &= c.
r;
return( *
this ); }
566 const bgr &operator ^=(
const bgr &c ){ b ^= c.
b; g ^= c.
g; r ^= c.
r;
return( *
this ); }
570 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
573 template <
class TT >
577 b =
static_cast< value_type
>( b + pix );
578 g =
static_cast< value_type
>( g + pix );
579 r =
static_cast< value_type
>( r + pix );
584 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
587 template <
class TT >
591 b =
static_cast< value_type
>( b - pix );
592 g =
static_cast< value_type
>( g - pix );
593 r =
static_cast< value_type
>( r - pix );
598 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
601 template <
class TT >
605 b =
static_cast< value_type
>( b * pix );
606 g =
static_cast< value_type
>( g * pix );
607 r =
static_cast< value_type
>( r * pix );
612 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
615 template <
class TT >
619 b =
static_cast< value_type
>( b / pix );
620 g =
static_cast< value_type
>( g / pix );
621 r =
static_cast< value_type
>( r / pix );
635 bool operator ==(
const bgr &c )
const {
return( b == c.
b && g == c.
g && r == c.
r ); }
646 bool operator !=(
const bgr &c )
const {
return( !( *
this == c ) ); }
657 bool operator < (
const bgr &c )
const
685 bool operator <=(
const bgr &c )
const {
return( c >= *
this ); }
696 bool operator > (
const bgr &c )
const {
return( c < *
this ); }
707 bool operator >=(
const bgr &c )
const {
return( !( *
this < c ) ); }
711 value_type get_value( )
const
713 return( static_cast< value_type >( b * 0.114478 + g * 0.586610 + r * 0.298912 ) );
717 value_type get_average( )
const
719 double rr = r, gg = g, bb = b;
720 return( static_cast< value_type >( ( rr + gg + bb ) * 0.33333333333333333333333333333333 ) );
801 template <
class TT >
811 rgba(
const value_type &pix = 0 ) : base( pix ), a( 255 ){ }
814 template <
class TT >
815 rgba(
const rgba< TT > &c ) : base( c ), a( static_cast< value_type >( c.a ) ){ }
822 template <
class TT >
830 rgba(
const value_type &rr,
const value_type &gg,
const value_type &bb,
const value_type &aa = 255 ) : base( rr, gg, bb ), a( aa ){ }
834 template <
class TT >
837 base::operator =( c );
838 a =
static_cast< value_type
>( c.
a );
847 base::operator =( c );
854 const rgba &operator =(
const value_type &pix )
856 base::operator =( pix );
865 template <
class TT >
869 template <
class TT >
873 template <
class TT >
877 template <
class TT >
881 const rgba &operator %=(
const rgba &c ){ base::operator %=( (
const base &)c );
return( *
this ); }
884 const rgba &operator |=(
const rgba &c ){ base::operator |=( (
const base &)c );
return( *
this ); }
887 const rgba &operator &=(
const rgba &c ){ base::operator &=( (
const base &)c );
return( *
this ); }
890 const rgba &operator ^=(
const rgba &c ){ base::operator ^=( (
const base &)c );
return( *
this ); }
894 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
897 template <
class TT >
906 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
909 template <
class TT >
918 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
921 template <
class TT >
930 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
933 template <
class TT >
951 bool operator ==(
const rgba &c )
const {
return( base::operator ==( c ) ); }
962 bool operator !=(
const rgba &c )
const {
return( !( *
this == c ) ); }
973 bool operator < (
const rgba &c )
const
977 return( base::operator <( c ) );
994 bool operator <=(
const rgba &c )
const {
return( c >= *
this ); }
1005 bool operator > (
const rgba &c )
const {
return( c < *
this ); }
1016 bool operator >=(
const rgba &c )
const {
return( !( *
this < c ) ); }
1100 template <
class TT >
1110 bgra(
const value_type &pix = 0 ) : base( pix ), a( 255 ){ }
1113 template <
class TT >
1121 template <
class TT >
1129 template <
class TT >
1136 template <
class TT >
1140 bgra(
const value_type &rr,
const value_type &gg,
const value_type &bb,
const value_type &aa = 255 ) : base( rr, gg, bb ), a( aa ){ }
1144 template <
class TT >
1147 base::operator =( c );
1148 a =
static_cast< value_type
>( c.
a );
1157 base::operator =( c );
1164 const bgra &operator =(
const value_type &pix )
1166 base::operator =( pix );
1175 template <
class TT >
1179 template <
class TT >
1183 template <
class TT >
1187 template <
class TT >
1191 const bgra &operator %=(
const bgra &c ){ base::operator %=( (
const base &)c );
return( *
this ); }
1194 const bgra &operator |=(
const bgra &c ){ base::operator |=( (
const base &)c );
return( *
this ); }
1197 const bgra &operator &=(
const bgra &c ){ base::operator &=( (
const base &)c );
return( *
this ); }
1200 const bgra &operator ^=(
const bgra &c ){ base::operator ^=( (
const base &)c );
return( *
this ); }
1204 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
1207 template <
class TT >
1216 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
1219 template <
class TT >
1228 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
1231 template <
class TT >
1240 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
1243 template <
class TT >
1261 bool operator ==(
const bgra &c )
const {
return( base::operator ==( c ) ); }
1272 bool operator !=(
const bgra &c )
const {
return( !( *
this == c ) ); }
1283 bool operator < (
const bgra &c )
const
1287 return( base::operator <( c ) );
1305 bool operator <=(
const bgra &c )
const {
return( c >= *
this ); }
1316 bool operator > (
const bgra &c )
const {
return( c < *
this ); }
1327 bool operator >=(
const bgra &c )
const {
return( !( *
this < c ) ); }
1391 typedef __color_utility__::__normalized_color__< is_float< T >::value > __color_normalizer__;
1403 template <
class TT >
1415 nRGB( ) : base( ), R( 0 ), G( 0 ), B( 0 ){ }
1418 explicit nRGB(
const value_type &pix ) : base( pix )
1420 __color_normalizer__::compute( base::r, base::g, base::b, R, G, B );
1424 template <
class TT >
1425 nRGB(
const nRGB< TT > &c ) : base( c ), R( static_cast< T >( c.R ) ), G( static_cast< T >( c.G ) ), B( static_cast< T >( c.B ) ){ }
1431 template <
class TT >
1434 __color_normalizer__::compute( base::r, base::g, base::b, R, G, B );
1440 __color_normalizer__::compute( base::r, base::g, base::b, R, G, B );
1444 template <
class TT >
1447 __color_normalizer__::compute( base::r, base::g, base::b, R, G, B );
1453 __color_normalizer__::compute( base::r, base::g, base::b, R, G, B );
1458 nRGB(
const value_type &rr,
const value_type &gg,
const value_type &bb ) : base( rr, gg, bb )
1460 __color_normalizer__::compute( base::r, base::g, base::b, R, G, B );
1464 nRGB(
const value_type &rr,
const value_type &gg,
const value_type &bb,
const value_type &RR,
const value_type &GG,
const value_type &BB ) : base( rr, gg, bb ), R( RR ), G( GG ), B( BB ){ }
1468 template <
class TT >
1471 base::operator =( c );
1472 R =
static_cast< value_type
>( c.
R );
1473 G =
static_cast< value_type
>( c.
G );
1474 B =
static_cast< value_type
>( c.
B );
1479 template <
class TT >
1482 base::operator =( c );
1483 __color_normalizer__::compute( base::r, base::g, base::b, R, G, B );
1488 template <
class TT >
1491 base::operator =( c );
1492 __color_normalizer__::compute( base::r, base::g, base::b, R, G, B );
1501 base::operator =( c );
1510 const nRGB &operator =(
const value_type &pix )
1512 base::operator =( pix );
1513 __color_normalizer__::compute( base::r, base::g, base::b, R, G, B );
1522 template <
class TT >
1526 R =
static_cast< value_type
>( R + c.R );
1527 G =
static_cast< value_type
>( G + c.G );
1528 B =
static_cast< value_type
>( B + c.B );
1533 template <
class TT >
1537 R =
static_cast< value_type
>( R - c.R );
1538 G =
static_cast< value_type
>( G - c.G );
1539 B =
static_cast< value_type
>( B - c.B );
1544 template <
class TT >
1548 R =
static_cast< value_type
>( R * c.R );
1549 G =
static_cast< value_type
>( G * c.G );
1550 B =
static_cast< value_type
>( B * c.B );
1555 template <
class TT >
1559 R =
static_cast< value_type
>( R / c.R );
1560 G =
static_cast< value_type
>( G / c.G );
1561 B =
static_cast< value_type
>( B / c.B );
1568 base::operator %=( (
const base &)c );
1578 base::operator |=( (
const base &)c );
1588 base::operator &=( (
const base &)c );
1598 base::operator ^=( (
const base &)c );
1607 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
1610 template <
class TT >
1615 R =
static_cast< value_type
>( R + pix );
1616 G =
static_cast< value_type
>( G + pix );
1617 B =
static_cast< value_type
>( B + pix );
1622 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
1625 template <
class TT >
1630 R =
static_cast< value_type
>( R - pix );
1631 G =
static_cast< value_type
>( G - pix );
1632 B =
static_cast< value_type
>( B - pix );
1637 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
1640 template <
class TT >
1645 R =
static_cast< value_type
>( R * pix );
1646 G =
static_cast< value_type
>( G * pix );
1647 B =
static_cast< value_type
>( B * pix );
1652 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
1655 template <
class TT >
1660 R =
static_cast< value_type
>( R / pix );
1661 G =
static_cast< value_type
>( G / pix );
1662 B =
static_cast< value_type
>( B / pix );
1725 template< class T,
size_t NDIM = 9 >
1738 template <
class TT >
1745 value_type c_[ NDIM ];
1750 color(
const value_type &pix = 0 )
1752 for( size_type i = 0 ; i < NDIM ; i++ )
1759 template <
class TT >
1762 for( size_type i = 0 ; i < NDIM ; i++ )
1764 c_[ i ] =
static_cast< value_type
>( c[ i ] );
1771 for( size_type i = 0 ; i < NDIM ; i++ )
1779 template <
class TT >
1782 for( size_type i = 0 ; i < NDIM ; i++ )
1784 c_[ i ] =
static_cast< value_type
>( c[ i ] );
1794 for( size_type i = 0 ; i < NDIM ; i++ )
1803 const color &operator =(
const value_type &pix )
1805 for( size_type i = 0 ; i < NDIM ; i++ )
1817 for( size_type i = 0 ; i < NDIM ; i++ )
1825 template <
class TT >
1828 for( size_type i = 0 ; i < NDIM ; i++ )
1830 c_[ i ] =
static_cast< value_type
>( c_[ i ] + c[ i ] );
1836 template <
class TT >
1839 for( size_type i = 0 ; i < NDIM ; i++ )
1841 c_[ i ] =
static_cast< value_type
>( c_[ i ] - c[ i ] );
1847 template <
class TT >
1850 for( size_type i = 0 ; i < NDIM ; i++ )
1852 c_[ i ] =
static_cast< value_type
>( c_[ i ] * c[ i ] );
1858 template <
class TT >
1861 for( size_type i = 0 ; i < NDIM ; i++ )
1863 c_[ i ] =
static_cast< value_type
>( c_[ i ] / c[ i ] );
1869 const color &operator %=(
const color &c )
1871 for( size_type i = 0 ; i < NDIM ; i++ )
1879 const color &operator |=(
const color &c )
1881 for( size_type i = 0 ; i < NDIM ; i++ )
1889 const color &operator &=(
const color &c )
1891 for( size_type i = 0 ; i < NDIM ; i++ )
1899 const color &operator ^=(
const color &c )
1901 for( size_type i = 0 ; i < NDIM ; i++ )
1910 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
1913 template <
class TT >
1917 for( size_type i = 0 ; i < NDIM ; i++ )
1919 c_[ i ] =
static_cast< value_type
>( c_[ i ] + pix );
1925 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
1928 template <
class TT >
1932 for( size_type i = 0 ; i < NDIM ; i++ )
1934 c_[ i ] =
static_cast< value_type
>( c_[ i ] - pix );
1940 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
1943 template <
class TT >
1947 for( size_type i = 0 ; i < NDIM ; i++ )
1949 c_[ i ] =
static_cast< value_type
>( c_[ i ] * pix );
1955 #if defined( __MIST_MSVC__ ) && __MIST_MSVC__ < 7
1958 template <
class TT >
1962 for( size_type i = 0 ; i < NDIM ; i++ )
1964 c_[ i ] =
static_cast< value_type
>( c_[ i ] / pix );
1979 bool operator ==(
const color &c )
const
1981 for( size_type i = 0 ; i < NDIM ; i++ )
1983 if( c_[ i ] != c[ i ] )
2001 bool operator !=(
const color &c )
const {
return( !( *
this == c ) ); }
2012 bool operator < (
const color &c )
const
2014 for( size_type i = 0 ; i < NDIM ; i++ )
2016 if( c_[ i ] != c[ i ] )
2018 return( c_[ i ] < c[ i ] );
2034 bool operator <=(
const color &c )
const {
return( c >= *
this ); }
2045 bool operator > (
const color &c )
const {
return( c < *
this ); }
2056 bool operator >=(
const color &c )
const {
return( !( *
this < c ) ); }
2058 value_type & operator []( size_type index ){
return( c_[ index ] ); }
2060 const value_type & operator []( size_type index )
const {
return( c_[ index ] ); }
2063 value_type get_value( )
const
2066 for( size_type i = 0 ; i < NDIM - 1 ; i++ )
2139 template < class T > inline std::ostream &operator <<( std::ostream &out, const rgb< T > &c )
2160 template <
class T >
inline std::ostream &operator <<( std::ostream &out, const rgba< T > &c )
2182 template <
class T >
inline std::ostream &operator <<( std::ostream &out, const nRGB< T > &c )
2206 template <
class T,
size_t NDIM >
inline std::ostream &operator <<( std::ostream &out, const color< T, NDIM > &c )
2209 for(
size_t i = 0 ; i < NDIM - 1 ; i++ )
2211 out << c[ i ] <<
", ";
2213 out << c[ NDIM - 1 ] <<
" )";
2230 inline void rgb2hsv(
double r,
double g,
double b,
double &h,
double &s,
double &v )
2232 double max = __color_utility__::maximum( r, __color_utility__::maximum( g, b ) );
2233 double min = __color_utility__::minimum( r, __color_utility__::minimum( g, b ) );
2235 double d = max - min;
2253 double rt = max - r * 60.0 / d;
2254 double gt = max - g * 60.0 / d;
2255 double bt = max - b * 60.0 / d;
2289 inline void hsv2rgb(
double h,
double s,
double v,
double &r,
double &g,
double &b )
2293 r = g = b = v * 255.0;
2297 int ht =
static_cast< int >( h * 6.0 );
2302 double t1 = v * ( 1.0 - s );
2303 double t2 = v * ( 1.0 - s * d / 360.0 );
2304 double t3 = v * ( 1.0 - s * ( 360.0 - d ) / 360.0 );
2361 inline void rgb2yiq(
double r,
double g,
double b,
double &y,
double &i,
double &q )
2363 y = 0.299 * r + 0.587 * g + 0.114 * b;
2364 i = 0.596 * r - 0.274 * g - 0.322 * b;
2365 q = 0.211 * r - 0.522 * g + 0.311 * b;
2379 inline void yiq2rgb(
double y,
double i,
double q,
double &r,
double &g,
double &b )
2381 r = y + 0.9489 * i + 0.6561 * q;
2382 g = y - 0.2645 * i - 0.6847 * q;
2383 b = y - 1.1270 * i + 1.8050 * q;
2398 inline void rgb2ycbcr(
double r,
double g,
double b,
double &y,
double &cb,
double &cr )
2400 y = 0.257 * r + 0.504 * g + 0.098 * b + 16.0;
2401 cb = -0.148 * r - 0.219 * g + 0.439 * b + 128.0;
2402 cr = 0.439 * r - 0.368 * g - 0.071 * b + 128.0;
2420 inline void ycbcr2rgb(
double y,
double cb,
double cr,
double &r,
double &g,
double &b )
2426 r = 1.164 * y + 1.596 * cr;
2427 g = 1.164 * y - 0.813 * cr - 0.392 * cb;
2428 b = 1.164 * y + 2.017 * cb;
2446 inline void rgb2xyz(
double r,
double g,
double b,
double &x,
double &y,
double &z )
2448 x = ( 0.412453 * r + 0.357580 * g + 0.180423 * b ) / 255.0;
2449 y = ( 0.212671 * r + 0.715160 * g + 0.072169 * b ) / 255.0;
2450 z = ( 0.019334 * r + 0.119193 * g + 0.950227 * b ) / 255.0;
2465 inline void xyz2rgb(
double x,
double y,
double z,
double &r,
double &g,
double &b )
2467 r = ( 3.240479 * x - 1.537150 * y - 0.498535 * z ) * 255.0;
2468 g = ( -0.969256 * x + 1.875991 * y + 0.041556 * z ) * 255.0;
2469 b = ( 0.055648 * x - 0.204043 * y + 1.057311 * z ) * 255.0;
2484 inline void rgb2lab(
double r,
double g,
double b,
double &l_,
double &a_,
double &b_ )
2491 static const double Xr = 0.9504;
2492 static const double Yr = 1.0;
2493 static const double Zr = 1.0889;
2499 static const double th = 216.0 / 24389.0;
2500 static const double _1_3 = 1.0 / 3.0;
2501 static const double A = 29.0 * 29.0 / ( 3.0 * 6.0 * 6.0 );
2502 static const double B = 4.0 / 29.0;
2503 x = x > th ? std::pow( x, _1_3 ) : A * x + B;
2504 y = y > th ? std::pow( y, _1_3 ) : A * y + B;
2505 z = z > th ? std::pow( z, _1_3 ) : A * z + B;
2507 l_ = 116.0 * y - 16.0;
2508 a_ = 500.0 * ( x - y );
2509 b_ = 200.0 * ( y - z );
2523 inline void lab2rgb(
double l_,
double a_,
double b_,
double &r,
double &g,
double &b )
2525 double fy = ( l_ + 16.0 ) / 116.0;
2526 double fx = fy + a_ / 500.0 ;
2527 double fz = fy - b_ / 200.0;
2529 static const double Xr = 0.9504;
2530 static const double Yr = 1.0;
2531 static const double Zr = 1.0889;
2533 static const double delta = 6.0 / 29.0;
2534 static const double delta2 = 3.0 * delta * delta;
2535 double y = fy > delta ? Yr * fy * fy * fy : ( fy - 16.0 / 116.0 ) * delta2 * Yr;
2536 double x = fx > delta ? Xr * fx * fx * fx : ( fx - 16.0 / 116.0 ) * delta2 * Xr;
2537 double z = fz > delta ? Zr * fz * fz * fz : ( fz - 16.0 / 116.0 ) * delta2 * Zr;
2544 template <
class T >
2547 _MIST_CONST(
bool, value,
false );
2556 template <
class T >
2557 struct _pixel_converter_
2559 typedef T value_type;
2561 enum{ color_num = 1 };
2563 static value_type convert_to( value_type r, value_type g, value_type b, value_type = 255 )
2565 return( color_type( r, g, b ).get_value( ) );
2568 static color_type convert_from(
const value_type &pixel )
2570 return( color_type( pixel ) );
2574 #if defined(__MIST_MSVC__) && __MIST_MSVC__ < 7
2576 #define IS_COLOR( type ) \
2578 struct is_color< rgb< type > >\
2580 enum{ value = true };\
2583 struct is_color< bgr< type > >\
2585 enum{ value = true };\
2588 struct is_color< rgba< type > >\
2590 enum{ value = true };\
2593 struct is_color< bgra< type > >\
2595 enum{ value = true };\
2599 #define __PIXEL_CONVERTER__( type ) \
2601 struct _pixel_converter_< rgb< type > >\
2603 typedef type value_type;\
2604 typedef rgba< type > color_type;\
2605 enum{ color_num = 3 };\
2607 static color_type convert_to( value_type r, value_type g, value_type b, value_type a = 255 )\
2609 return( color_type( r, g, b ) );\
2612 static color_type convert_from( const color_type &pixel )\
2618 struct _pixel_converter_< bgr< type > >\
2620 typedef type value_type;\
2621 typedef rgba< type > color_type;\
2622 enum{ color_num = 3 };\
2624 static color_type convert_to( value_type r, value_type g, value_type b, value_type a = 255 )\
2626 return( color_type( r, g, b ) );\
2629 static color_type convert_from( const color_type &pixel )\
2635 struct _pixel_converter_< rgba< type > >\
2637 typedef type value_type;\
2638 typedef rgba< type > color_type;\
2639 enum{ color_num = 4 };\
2641 static color_type convert_to( value_type r, value_type g, value_type b, value_type a = 255 )\
2643 return( color_type( r, g, b, a ) );\
2646 static color_type convert_from( const color_type &pixel )\
2652 struct _pixel_converter_< bgra< type > >\
2654 typedef type value_type;\
2655 typedef bgra< type > color_type;\
2656 enum{ color_num = 4 };\
2658 static color_type convert_to( value_type r, value_type g, value_type b, value_type a = 255 )\
2660 return( color_type( r, g, b, a ) );\
2663 static color_type convert_from( const color_type &pixel )\
2670 IS_COLOR(
unsigned char)
2671 IS_COLOR(
unsigned short)
2672 IS_COLOR(
unsigned int)
2673 IS_COLOR(
unsigned long)
2674 IS_COLOR(
signed char)
2675 IS_COLOR(
signed short)
2676 IS_COLOR(
signed int)
2677 IS_COLOR(
signed long)
2682 IS_COLOR(
long double)
2683 __PIXEL_CONVERTER__(
unsigned char)
2684 __PIXEL_CONVERTER__(
unsigned short)
2685 __PIXEL_CONVERTER__(
unsigned int)
2686 __PIXEL_CONVERTER__(
unsigned long)
2687 __PIXEL_CONVERTER__(
signed char)
2688 __PIXEL_CONVERTER__(
signed short)
2689 __PIXEL_CONVERTER__(
signed int)
2690 __PIXEL_CONVERTER__(
signed long)
2691 __PIXEL_CONVERTER__(
bool)
2692 __PIXEL_CONVERTER__(
char)
2693 __PIXEL_CONVERTER__(
float)
2694 __PIXEL_CONVERTER__(
double)
2695 __PIXEL_CONVERTER__(
long double)
2698 #undef __PIXEL_CONVERTER__
2702 template <
class T >
2703 struct is_color< rgb< T > >
2705 _MIST_CONST(
bool, value,
true );
2708 template <
class T >
2709 struct is_color< bgr< T > >
2711 _MIST_CONST(
bool, value,
true );
2714 template <
class T >
2715 struct is_color< rgba< T > >
2717 _MIST_CONST(
bool, value,
true );
2720 template <
class T >
2721 struct is_color< bgra< T > >
2723 _MIST_CONST(
bool, value,
true );
2726 template <
class T >
2727 struct is_color< nRGB< T > >
2729 _MIST_CONST(
bool, value,
true );
2732 template <
class T,
size_t NDIM >
2733 struct is_color< color< T, NDIM > >
2735 _MIST_CONST(
bool, value,
true );
2738 template <
class T >
2739 struct _pixel_converter_< rgb< T > >
2741 typedef T value_type;
2742 typedef rgba< T > color_type;
2743 enum{ color_num = 3 };
2745 static color_type convert_to( value_type r, value_type g, value_type b, value_type a = 255 )
2747 return( color_type( r, g, b, a ) );
2750 static color_type convert_from(
const rgb< T > &pixel )
2756 template <
class T >
2757 struct _pixel_converter_< bgr< T > >
2759 typedef T value_type;
2760 typedef rgba< T > color_type;
2761 enum{ color_num = 3 };
2763 static color_type convert_to( value_type r, value_type g, value_type b, value_type a = 255 )
2765 return( color_type( r, g, b, a ) );
2768 static color_type convert_from(
const bgr< T > &pixel )
2770 return( color_type( pixel.r, pixel.g, pixel.b ) );
2774 template <
class T >
2775 struct _pixel_converter_< rgba< T > >
2777 typedef T value_type;
2778 typedef rgba< T > color_type;
2779 enum{ color_num = 4 };
2781 static color_type convert_to( value_type r, value_type g, value_type b, value_type a = 255 )
2783 return( color_type( r, g, b, a ) );
2786 static color_type convert_from(
const rgba< T > &pixel )
2792 template <
class T >
2793 struct _pixel_converter_< bgra< T > >
2795 typedef T value_type;
2796 typedef bgra< T > color_type;
2797 enum{ color_num = 4 };
2799 static color_type convert_to( value_type r, value_type g, value_type b, value_type a = 255 )
2801 return( color_type( r, g, b, a ) );
2804 static color_type convert_from(
const bgra< T > &pixel )
2806 return( color_type( pixel.r, pixel.g, pixel.b, pixel.a ) );
2810 template <
class T >
2811 struct _pixel_converter_< nRGB< T > >
2813 typedef T value_type;
2814 typedef nRGB< T > color_type;
2815 enum{ color_num = 6 };
2817 static color_type convert_to( value_type r, value_type g, value_type b, value_type = 255 )
2819 return( color_type( r, g, b ) );
2822 static color_type convert_from(
const nRGB< T > &pixel )
2824 return( color_type( pixel.r, pixel.g, pixel.b ) );
2828 template <
class T,
size_t NDIM >
2829 struct _pixel_converter_< color< T, NDIM > >
2831 typedef T value_type;
2832 typedef color< T, NDIM > color_type;
2833 enum{ color_num = NDIM };
2835 static color_type convert_to( value_type r, value_type g, value_type b, value_type a = 255 )
2837 return( color_type( ( r + g + b ) / 3 ) );
2840 static color_type convert_from(
const color< T, NDIM > &pixel )
2844 return( color_type( pixel[ 0 ] ) );
2848 return( color_type( pixel[ 0 ], pixel[ 1 ], pixel[ 2 ] ) );
2856 #define __DEFINE_COLOR_TYPE_TRAIT__( function, type ) \
2857 template<> struct function< rgb< type > >{ _MIST_CONST( bool, value, true ); }; \
2858 template<> struct function< bgr< type > >{ _MIST_CONST( bool, value, true ); }; \
2859 template<> struct function< rgba< type > >{ _MIST_CONST( bool, value, true ); }; \
2860 template<> struct function< bgra< type > >{ _MIST_CONST( bool, value, true ); }; \
2861 template<> struct function< nRGB< type > >{ _MIST_CONST( bool, value, true ); }; \
2862 template< size_t NDIM > struct function< color< type, NDIM > >{ _MIST_CONST( bool, value, true ); }; \
2871 __DEFINE_COLOR_TYPE_TRAIT__( is_char,
unsigned char )
2872 __DEFINE_COLOR_TYPE_TRAIT__( is_char,
signed char )
2873 __DEFINE_COLOR_TYPE_TRAIT__( is_char,
char )
2882 __DEFINE_COLOR_TYPE_TRAIT__( is_float,
float )
2883 __DEFINE_COLOR_TYPE_TRAIT__( is_float,
double )
2884 __DEFINE_COLOR_TYPE_TRAIT__( is_float,
long double )
2894 __DEFINE_COLOR_TYPE_TRAIT__( is_integer,
unsigned char )
2895 __DEFINE_COLOR_TYPE_TRAIT__( is_integer,
unsigned short )
2896 __DEFINE_COLOR_TYPE_TRAIT__( is_integer,
unsigned int )
2897 __DEFINE_COLOR_TYPE_TRAIT__( is_integer,
unsigned long )
2898 __DEFINE_COLOR_TYPE_TRAIT__( is_integer,
signed char )
2899 __DEFINE_COLOR_TYPE_TRAIT__( is_integer,
signed short )
2900 __DEFINE_COLOR_TYPE_TRAIT__( is_integer,
signed int )
2901 __DEFINE_COLOR_TYPE_TRAIT__( is_integer,
signed long )
2902 __DEFINE_COLOR_TYPE_TRAIT__( is_integer,
bool )
2903 __DEFINE_COLOR_TYPE_TRAIT__( is_integer,
char )
2905 #if defined( __MIST64__ ) && __MIST64__ != 0 && !( defined( __GNUC__ ) || defined( __APPLE__ ) || defined( __ICC ) )
2906 __DEFINE_COLOR_TYPE_TRAIT__( is_integer,
size_t )
2907 __DEFINE_COLOR_TYPE_TRAIT__( is_integer, ptrdiff_t )
2918 __DEFINE_COLOR_TYPE_TRAIT__( is_arithmetic,
unsigned char )
2919 __DEFINE_COLOR_TYPE_TRAIT__( is_arithmetic,
unsigned short )
2920 __DEFINE_COLOR_TYPE_TRAIT__( is_arithmetic,
unsigned int )
2921 __DEFINE_COLOR_TYPE_TRAIT__( is_arithmetic,
unsigned long )
2922 __DEFINE_COLOR_TYPE_TRAIT__( is_arithmetic,
signed char )
2923 __DEFINE_COLOR_TYPE_TRAIT__( is_arithmetic,
signed short )
2924 __DEFINE_COLOR_TYPE_TRAIT__( is_arithmetic,
signed int )
2925 __DEFINE_COLOR_TYPE_TRAIT__( is_arithmetic,
signed long )
2926 __DEFINE_COLOR_TYPE_TRAIT__( is_arithmetic,
bool )
2927 __DEFINE_COLOR_TYPE_TRAIT__( is_arithmetic,
char )
2928 __DEFINE_COLOR_TYPE_TRAIT__( is_arithmetic,
float )
2929 __DEFINE_COLOR_TYPE_TRAIT__( is_arithmetic,
double )
2930 __DEFINE_COLOR_TYPE_TRAIT__( is_arithmetic,
long double )
2932 #if defined( __MIST64__ ) && __MIST64__ != 0 && !( defined( __GNUC__ ) || defined( __APPLE__ ) || defined( __ICC ) )
2933 __DEFINE_COLOR_TYPE_TRAIT__( is_arithmetic,
size_t )
2934 __DEFINE_COLOR_TYPE_TRAIT__( is_arithmetic, ptrdiff_t )
2946 template<
class T >
struct float_type< rgba< T > > {
typedef rgb< typename float_type< T >::value_type > value_type; };
2947 template<
class T >
struct float_type< bgra< T > > {
typedef rgb< typename float_type< T >::value_type > value_type; };
2950 #undef __DEFINE_COLOR_TYPE_TRAIT__
2953 template<
typename T = rgb<
unsigned char > >
2956 typedef T color_type;
2958 static color_type aliceblue( ) {
return color_type( 0xf0, 0xf8, 0xff ); }
2959 static color_type antiquewhite( ) {
return color_type( 0xfa, 0xeb, 0xd7 ); }
2960 static color_type aqua( ) {
return color_type( 0x00, 0xff, 0xff ); }
2961 static color_type aquamarine( ) {
return color_type( 0x7f, 0xff, 0xd4 ); }
2962 static color_type azure( ) {
return color_type( 0xf0, 0xff, 0xff ); }
2963 static color_type beige( ) {
return color_type( 0xf5, 0xf5, 0xdc ); }
2964 static color_type bisque( ) {
return color_type( 0xff, 0xe4, 0xc4 ); }
2965 static color_type black( ) {
return color_type( 0x00, 0x00, 0x00 ); }
2966 static color_type blanchedalmond( ) {
return color_type( 0xff, 0xeb, 0xcd ); }
2967 static color_type blue( ) {
return color_type( 0x00, 0x00, 0xff ); }
2968 static color_type blueviolet( ) {
return color_type( 0x8a, 0x2b, 0xe2 ); }
2969 static color_type brown( ) {
return color_type( 0xa5, 0x2a, 0x2a ); }
2970 static color_type burlywood( ) {
return color_type( 0xde, 0xb8, 0x87 ); }
2971 static color_type cadetblue( ) {
return color_type( 0x5f, 0x9e, 0xa0 ); }
2972 static color_type chartreuse( ) {
return color_type( 0x7f, 0xff, 0x00 ); }
2973 static color_type chocolate( ) {
return color_type( 0xd2, 0x69, 0x1e ); }
2974 static color_type coral( ) {
return color_type( 0xff, 0x7f, 0x50 ); }
2975 static color_type cornflowerblue( ) {
return color_type( 0x64, 0x95, 0xed ); }
2976 static color_type cornsilk( ) {
return color_type( 0xff, 0xf8, 0xdc ); }
2977 static color_type crimson( ) {
return color_type( 0xdc, 0x14, 0x3c ); }
2978 static color_type cyan( ) {
return color_type( 0x00, 0xff, 0xff ); }
2979 static color_type darkblue( ) {
return color_type( 0x00, 0x00, 0x8b ); }
2980 static color_type darkcyan( ) {
return color_type( 0x00, 0x8b, 0x8b ); }
2981 static color_type darkgoldenrod( ) {
return color_type( 0xb8, 0x86, 0x0b ); }
2982 static color_type darkgray( ) {
return color_type( 0xa9, 0xa9, 0xa9 ); }
2983 static color_type darkgreen( ) {
return color_type( 0x00, 0x64, 0x00 ); }
2984 static color_type darkkhaki( ) {
return color_type( 0xbd, 0xb7, 0x6b ); }
2985 static color_type darkmagenta( ) {
return color_type( 0x8b, 0x00, 0x8b ); }
2986 static color_type darkolivegreen( ) {
return color_type( 0x55, 0x6b, 0x2f ); }
2987 static color_type darkorange( ) {
return color_type( 0xff, 0x8c, 0x00 ); }
2988 static color_type darkorchid( ) {
return color_type( 0x99, 0x32, 0xcc ); }
2989 static color_type darkred( ) {
return color_type( 0x8b, 0x00, 0x00 ); }
2990 static color_type darksalmon( ) {
return color_type( 0xe9, 0x96, 0x7a ); }
2991 static color_type darkseagreen( ) {
return color_type( 0x8f, 0xbc, 0x8f ); }
2992 static color_type darkslateblue( ) {
return color_type( 0x48, 0x3d, 0x8b ); }
2993 static color_type darkslategray( ) {
return color_type( 0x2f, 0x4f, 0x4f ); }
2994 static color_type darkturquoise( ) {
return color_type( 0x00, 0xce, 0xd1 ); }
2995 static color_type darkviolet( ) {
return color_type( 0x94, 0x00, 0xd3 ); }
2996 static color_type deeppink( ) {
return color_type( 0xff, 0x14, 0x93 ); }
2997 static color_type deepskyblue( ) {
return color_type( 0x00, 0xbf, 0xff ); }
2998 static color_type dimgray( ) {
return color_type( 0x69, 0x69, 0x69 ); }
2999 static color_type dodgerblue( ) {
return color_type( 0x1e, 0x90, 0xff ); }
3000 static color_type firebrick( ) {
return color_type( 0xb2, 0x22, 0x22 ); }
3001 static color_type floralwhite( ) {
return color_type( 0xff, 0xfa, 0xf0 ); }
3002 static color_type forestgreen( ) {
return color_type( 0x22, 0x8b, 0x22 ); }
3003 static color_type fuchsia( ) {
return color_type( 0xff, 0x00, 0xff ); }
3004 static color_type gainsboro( ) {
return color_type( 0xdc, 0xdc, 0xdc ); }
3005 static color_type ghostwhite( ) {
return color_type( 0xf8, 0xf8, 0xff ); }
3006 static color_type gold( ) {
return color_type( 0xff, 0xd7, 0x00 ); }
3007 static color_type goldenrod( ) {
return color_type( 0xda, 0xa5, 0x20 ); }
3008 static color_type gray( ) {
return color_type( 0x80, 0x80, 0x80 ); }
3009 static color_type green( ) {
return color_type( 0x00, 0xff, 0x00 ); }
3010 static color_type greenyellow( ) {
return color_type( 0xad, 0xff, 0x2f ); }
3011 static color_type honeydew( ) {
return color_type( 0xf0, 0xff, 0xf0 ); }
3012 static color_type hotpink( ) {
return color_type( 0xff, 0x69, 0xb4 ); }
3013 static color_type indianred( ) {
return color_type( 0xcd, 0x5c, 0x5c ); }
3014 static color_type indigo( ) {
return color_type( 0x4b, 0x00, 0x82 ); }
3015 static color_type ivory( ) {
return color_type( 0xff, 0xff, 0xf0 ); }
3016 static color_type khaki( ) {
return color_type( 0xf0, 0xe6, 0x8c ); }
3017 static color_type lavender( ) {
return color_type( 0xe6, 0xe6, 0xfa ); }
3018 static color_type lavenderblush( ) {
return color_type( 0xff, 0xf0, 0xf5 ); }
3019 static color_type lawngreen( ) {
return color_type( 0x7c, 0xfc, 0x00 ); }
3020 static color_type lemonchiffon( ) {
return color_type( 0xff, 0xfa, 0xcd ); }
3021 static color_type lightblue( ) {
return color_type( 0xad, 0xd8, 0xe6 ); }
3022 static color_type lightcoral( ) {
return color_type( 0xf0, 0x80, 0x80 ); }
3023 static color_type lightcyan( ) {
return color_type( 0xe0, 0xff, 0xff ); }
3024 static color_type lightgoldenrodyellow( ) {
return color_type( 0xfa, 0xfa, 0xd2 ); }
3025 static color_type lightgray( ) {
return color_type( 0xd3, 0xd3, 0xd3 ); }
3026 static color_type lightgreen( ) {
return color_type( 0x90, 0xee, 0x90 ); }
3027 static color_type lightpink( ) {
return color_type( 0xff, 0xb6, 0xc1 ); }
3028 static color_type lightsalmon( ) {
return color_type( 0xff, 0xa0, 0x7a ); }
3029 static color_type lightseagreen( ) {
return color_type( 0x20, 0xb2, 0xaa ); }
3030 static color_type lightskyblue( ) {
return color_type( 0x87, 0xce, 0xfa ); }
3031 static color_type lightslategray( ) {
return color_type( 0x77, 0x88, 0x99 ); }
3032 static color_type lightsteelblue( ) {
return color_type( 0xb0, 0xc4, 0xde ); }
3033 static color_type lightyellow( ) {
return color_type( 0xff, 0xff, 0xe0 ); }
3034 static color_type lime( ) {
return color_type( 0x00, 0xff, 0x00 ); }
3035 static color_type limegreen( ) {
return color_type( 0x32, 0xcd, 0x32 ); }
3036 static color_type linen( ) {
return color_type( 0xfa, 0xf0, 0xe6 ); }
3037 static color_type magenta( ) {
return color_type( 0xff, 0x00, 0xff ); }
3038 static color_type maroon( ) {
return color_type( 0x80, 0x00, 0x00 ); }
3039 static color_type mediumaquamarine( ) {
return color_type( 0x66, 0xcd, 0xaa ); }
3040 static color_type mediumblue( ) {
return color_type( 0x00, 0x00, 0xcd ); }
3041 static color_type mediumorchid( ) {
return color_type( 0xba, 0x55, 0xd3 ); }
3042 static color_type mediumpurple( ) {
return color_type( 0x93, 0x70, 0xdb ); }
3043 static color_type mediumseagreen( ) {
return color_type( 0x3c, 0xb3, 0x71 ); }
3044 static color_type mediumslateblue( ) {
return color_type( 0x7b, 0x68, 0xee ); }
3045 static color_type mediumspringgreen( ) {
return color_type( 0x00, 0xfa, 0x9a ); }
3046 static color_type mediumturquoise( ) {
return color_type( 0x48, 0xd1, 0xcc ); }
3047 static color_type mediumvioletred( ) {
return color_type( 0xc7, 0x15, 0x85 ); }
3048 static color_type midnightblue( ) {
return color_type( 0x19, 0x19, 0x70 ); }
3049 static color_type mintcream( ) {
return color_type( 0xf5, 0xff, 0xfa ); }
3050 static color_type mistyrose( ) {
return color_type( 0xff, 0xe4, 0xe1 ); }
3051 static color_type moccasin( ) {
return color_type( 0xff, 0xe4, 0xb5 ); }
3052 static color_type navajowhite( ) {
return color_type( 0xff, 0xde, 0xad ); }
3053 static color_type navy( ) {
return color_type( 0x00, 0x00, 0x80 ); }
3054 static color_type oldlace( ) {
return color_type( 0xfd, 0xf5, 0xe6 ); }
3055 static color_type olive( ) {
return color_type( 0x80, 0x80, 0x00 ); }
3056 static color_type olivedrab( ) {
return color_type( 0x6b, 0x8e, 0x23 ); }
3057 static color_type orange( ) {
return color_type( 0xff, 0xa5, 0x00 ); }
3058 static color_type orangered( ) {
return color_type( 0xff, 0x45, 0x00 ); }
3059 static color_type orchid( ) {
return color_type( 0xda, 0x70, 0xd6 ); }
3060 static color_type palegoldenrod( ) {
return color_type( 0xee, 0xe8, 0xaa ); }
3061 static color_type palegreen( ) {
return color_type( 0x98, 0xfb, 0x98 ); }
3062 static color_type paleturquoise( ) {
return color_type( 0xaf, 0xee, 0xee ); }
3063 static color_type palevioletred( ) {
return color_type( 0xdb, 0x70, 0x93 ); }
3064 static color_type papayawhip( ) {
return color_type( 0xff, 0xef, 0xd5 ); }
3065 static color_type peachpuff( ) {
return color_type( 0xff, 0xda, 0xb9 ); }
3066 static color_type peru( ) {
return color_type( 0xcd, 0x85, 0x3f ); }
3067 static color_type pink( ) {
return color_type( 0xff, 0xc0, 0xcb ); }
3068 static color_type plum( ) {
return color_type( 0xdd, 0xa0, 0xdd ); }
3069 static color_type powderblue( ) {
return color_type( 0xb0, 0xe0, 0xe6 ); }
3070 static color_type purple( ) {
return color_type( 0x80, 0x00, 0x80 ); }
3071 static color_type red( ) {
return color_type( 0xff, 0x00, 0x00 ); }
3072 static color_type rosybrown( ) {
return color_type( 0xbc, 0x8f, 0x8f ); }
3073 static color_type royalblue( ) {
return color_type( 0x41, 0x69, 0xe1 ); }
3074 static color_type saddlebrown( ) {
return color_type( 0x8b, 0x45, 0x13 ); }
3075 static color_type salmon( ) {
return color_type( 0xfa, 0x80, 0x72 ); }
3076 static color_type sandybrown( ) {
return color_type( 0xf4, 0xa4, 0x60 ); }
3077 static color_type seagreen( ) {
return color_type( 0x2e, 0x8b, 0x57 ); }
3078 static color_type seashell( ) {
return color_type( 0xff, 0xf5, 0xee ); }
3079 static color_type sienna( ) {
return color_type( 0xa0, 0x52, 0x2d ); }
3080 static color_type silver( ) {
return color_type( 0xc0, 0xc0, 0xc0 ); }
3081 static color_type skyblue( ) {
return color_type( 0x87, 0xce, 0xeb ); }
3082 static color_type slateblue( ) {
return color_type( 0x6a, 0x5a, 0xcd ); }
3083 static color_type slategray( ) {
return color_type( 0x70, 0x80, 0x90 ); }
3084 static color_type snow( ) {
return color_type( 0xff, 0xfa, 0xfa ); }
3085 static color_type springgreen( ) {
return color_type( 0x00, 0xff, 0x7f ); }
3086 static color_type steelblue( ) {
return color_type( 0x46, 0x82, 0xb4 ); }
3087 static color_type tan( ) {
return color_type( 0xd2, 0xb4, 0x8c ); }
3088 static color_type teal( ) {
return color_type( 0x00, 0x80, 0x80 ); }
3089 static color_type thistle( ) {
return color_type( 0xd8, 0xbf, 0xd8 ); }
3090 static color_type tomato( ) {
return color_type( 0xff, 0x63, 0x47 ); }
3091 static color_type transparent( ) {
return color_type( 0x00, 0x00, 0xe0 ); }
3092 static color_type turquoise( ) {
return color_type( 0x40, 0xe0, 0xd0 ); }
3093 static color_type violet( ) {
return color_type( 0xee, 0x82, 0xee ); }
3094 static color_type wheat( ) {
return color_type( 0xf5, 0xde, 0xb3 ); }
3095 static color_type white( ) {
return color_type( 0xff, 0xff, 0xff ); }
3096 static color_type whitesmoke( ) {
return color_type( 0xf5, 0xf5, 0xf5 ); }
3097 static color_type yellow( ) {
return color_type( 0xff, 0xff, 0x00 ); }
3098 static color_type yellowgreen( ) {
return color_type( 0x9a, 0xcd, 0x32 ); }
3106 #endif // __INCLUDE_MIST_COLOR_H__