Boost GIL


color_base_algorithm.hpp
1 //
2 // Copyright 2005-2007 Adobe Systems Incorporated
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 #ifndef BOOST_GIL_COLOR_BASE_ALGORITHM_HPP
9 #define BOOST_GIL_COLOR_BASE_ALGORITHM_HPP
10 
11 #include <boost/gil/concepts.hpp>
12 #include <boost/gil/utilities.hpp>
13 
14 #include <boost/config.hpp>
15 #include <boost/mpl/at.hpp>
16 #include <boost/mpl/contains.hpp>
17 #include <boost/type_traits.hpp>
18 #include <boost/utility/enable_if.hpp>
19 
20 #include <algorithm>
21 
22 namespace boost { namespace gil {
23 
29 
42 template <typename ColorBase>
45 struct size : public mpl::size<typename ColorBase::layout_t::color_space_t> {};
46 
52 
79 template <typename ColorBase, int K> struct kth_semantic_element_type {
82  BOOST_STATIC_CONSTANT(int, semantic_index = (mpl::at_c<typename ColorBase::layout_t::channel_mapping_t,K>::type::value));
83  typedef typename kth_element_type<ColorBase, semantic_index>::type type;
84 };
85 
88 template <typename ColorBase, int K> struct kth_semantic_element_reference_type {
89  BOOST_STATIC_CONSTANT(int, semantic_index = (mpl::at_c<typename ColorBase::layout_t::channel_mapping_t,K>::type::value));
90  typedef typename kth_element_reference_type<ColorBase,semantic_index>::type type;
91  static type get(ColorBase& cb) { return gil::at_c<semantic_index>(cb); }
92 };
93 
96 template <typename ColorBase, int K> struct kth_semantic_element_const_reference_type {
97  BOOST_STATIC_CONSTANT(int, semantic_index = (mpl::at_c<typename ColorBase::layout_t::channel_mapping_t,K>::type::value));
98  typedef typename kth_element_const_reference_type<ColorBase,semantic_index>::type type;
99  static type get(const ColorBase& cb) { return gil::at_c<semantic_index>(cb); }
100 };
101 
104 template <int K, typename ColorBase> inline
105 typename disable_if<is_const<ColorBase>,typename kth_semantic_element_reference_type<ColorBase,K>::type>::type
106 semantic_at_c(ColorBase& p) {
108 }
109 
112 template <int K, typename ColorBase> inline
113 typename kth_semantic_element_const_reference_type<ColorBase,K>::type
114 semantic_at_c(const ColorBase& p) {
116 }
117 
123 
143 template <typename ColorBase, typename Color>
146 struct contains_color : public mpl::contains<typename ColorBase::layout_t::color_space_t,Color> {};
147 
148 template <typename ColorBase, typename Color>
149 struct color_index_type : public detail::type_to_index<typename ColorBase::layout_t::color_space_t,Color> {};
150 
153 template <typename ColorBase, typename Color>
154 struct color_element_type : public kth_semantic_element_type<ColorBase,color_index_type<ColorBase,Color>::value> {};
155 
158 template <typename ColorBase, typename Color>
159 struct color_element_reference_type : public kth_semantic_element_reference_type<ColorBase,color_index_type<ColorBase,Color>::value> {};
160 
163 template <typename ColorBase, typename Color>
164 struct color_element_const_reference_type : public kth_semantic_element_const_reference_type<ColorBase,color_index_type<ColorBase,Color>::value> {};
165 
168 template <typename ColorBase, typename Color>
169 typename color_element_reference_type<ColorBase,Color>::type get_color(ColorBase& cb, Color=Color()) {
171 }
172 
175 template <typename ColorBase, typename Color>
176 typename color_element_const_reference_type<ColorBase,Color>::type get_color(const ColorBase& cb, Color=Color()) {
178 }
179 
185 
197 template <typename ColorBase>
200 struct element_type : public kth_element_type<ColorBase, 0> {};
201 
204 template <typename ColorBase>
205 struct element_reference_type : public kth_element_reference_type<ColorBase, 0> {};
206 
209 template <typename ColorBase>
210 struct element_const_reference_type : public kth_element_const_reference_type<ColorBase, 0> {};
211 
212 
213 namespace detail {
214 
215 // compile-time recursion for per-element operations on color bases
216 template <int N>
217 struct element_recursion
218 {
219 
220 #if defined(BOOST_GCC)
221 #pragma GCC diagnostic push
222 #pragma GCC diagnostic ignored "-Wconversion"
223 #pragma GCC diagnostic ignored "-Wfloat-equal"
224 #endif
225  template <typename P1,typename P2>
226  static bool static_equal(const P1& p1, const P2& p2)
227  {
228  return element_recursion<N-1>::static_equal(p1,p2) &&
229  semantic_at_c<N-1>(p1)==semantic_at_c<N-1>(p2);
230  }
231 
232  template <typename P1,typename P2>
233  static void static_copy(const P1& p1, P2& p2)
234  {
235  element_recursion<N-1>::static_copy(p1,p2);
236  semantic_at_c<N-1>(p2)=semantic_at_c<N-1>(p1);
237  }
238 
239  template <typename P,typename T2>
240  static void static_fill(P& p, T2 v)
241  {
242  element_recursion<N-1>::static_fill(p,v);
243  semantic_at_c<N-1>(p)=v;
244  }
245 
246  template <typename Dst,typename Op>
247  static void static_generate(Dst& dst, Op op)
248  {
249  element_recursion<N-1>::static_generate(dst,op);
250  semantic_at_c<N-1>(dst)=op();
251  }
252 #if defined(BOOST_GCC)
253 #pragma GCC diagnostic pop
254 #endif
255 
256  //static_for_each with one source
257  template <typename P1,typename Op>
258  static Op static_for_each(P1& p1, Op op) {
259  Op op2(element_recursion<N-1>::static_for_each(p1,op));
260  op2(semantic_at_c<N-1>(p1));
261  return op2;
262  }
263  template <typename P1,typename Op>
264  static Op static_for_each(const P1& p1, Op op) {
265  Op op2(element_recursion<N-1>::static_for_each(p1,op));
266  op2(semantic_at_c<N-1>(p1));
267  return op2;
268  }
269  //static_for_each with two sources
270  template <typename P1,typename P2,typename Op>
271  static Op static_for_each(P1& p1, P2& p2, Op op) {
272  Op op2(element_recursion<N-1>::static_for_each(p1,p2,op));
273  op2(semantic_at_c<N-1>(p1), semantic_at_c<N-1>(p2));
274  return op2;
275  }
276  template <typename P1,typename P2,typename Op>
277  static Op static_for_each(P1& p1, const P2& p2, Op op) {
278  Op op2(element_recursion<N-1>::static_for_each(p1,p2,op));
279  op2(semantic_at_c<N-1>(p1), semantic_at_c<N-1>(p2));
280  return op2;
281  }
282  template <typename P1,typename P2,typename Op>
283  static Op static_for_each(const P1& p1, P2& p2, Op op) {
284  Op op2(element_recursion<N-1>::static_for_each(p1,p2,op));
285  op2(semantic_at_c<N-1>(p1), semantic_at_c<N-1>(p2));
286  return op2;
287  }
288  template <typename P1,typename P2,typename Op>
289  static Op static_for_each(const P1& p1, const P2& p2, Op op) {
290  Op op2(element_recursion<N-1>::static_for_each(p1,p2,op));
291  op2(semantic_at_c<N-1>(p1), semantic_at_c<N-1>(p2));
292  return op2;
293  }
294  //static_for_each with three sources
295  template <typename P1,typename P2,typename P3,typename Op>
296  static Op static_for_each(P1& p1, P2& p2, P3& p3, Op op) {
297  Op op2(element_recursion<N-1>::static_for_each(p1,p2,p3,op));
298  op2(semantic_at_c<N-1>(p1), semantic_at_c<N-1>(p2), semantic_at_c<N-1>(p3));
299  return op2;
300  }
301  template <typename P1,typename P2,typename P3,typename Op>
302  static Op static_for_each(P1& p1, P2& p2, const P3& p3, Op op) {
303  Op op2(element_recursion<N-1>::static_for_each(p1,p2,p3,op));
304  op2(semantic_at_c<N-1>(p1), semantic_at_c<N-1>(p2), semantic_at_c<N-1>(p3));
305  return op2;
306  }
307  template <typename P1,typename P2,typename P3,typename Op>
308  static Op static_for_each(P1& p1, const P2& p2, P3& p3, Op op) {
309  Op op2(element_recursion<N-1>::static_for_each(p1,p2,p3,op));
310  op2(semantic_at_c<N-1>(p1), semantic_at_c<N-1>(p2), semantic_at_c<N-1>(p3));
311  return op2;
312  }
313  template <typename P1,typename P2,typename P3,typename Op>
314  static Op static_for_each(P1& p1, const P2& p2, const P3& p3, Op op) {
315  Op op2(element_recursion<N-1>::static_for_each(p1,p2,p3,op));
316  op2(semantic_at_c<N-1>(p1), semantic_at_c<N-1>(p2), semantic_at_c<N-1>(p3));
317  return op2;
318  }
319  template <typename P1,typename P2,typename P3,typename Op>
320  static Op static_for_each(const P1& p1, P2& p2, P3& p3, Op op) {
321  Op op2(element_recursion<N-1>::static_for_each(p1,p2,p3,op));
322  op2(semantic_at_c<N-1>(p1), semantic_at_c<N-1>(p2), semantic_at_c<N-1>(p3));
323  return op2;
324  }
325  template <typename P1,typename P2,typename P3,typename Op>
326  static Op static_for_each(const P1& p1, P2& p2, const P3& p3, Op op) {
327  Op op2(element_recursion<N-1>::static_for_each(p1,p2,p3,op));
328  op2(semantic_at_c<N-1>(p1), semantic_at_c<N-1>(p2), semantic_at_c<N-1>(p3));
329  return op2;
330  }
331  template <typename P1,typename P2,typename P3,typename Op>
332  static Op static_for_each(const P1& p1, const P2& p2, P3& p3, Op op) {
333  Op op2(element_recursion<N-1>::static_for_each(p1,p2,p3,op));
334  op2(semantic_at_c<N-1>(p1), semantic_at_c<N-1>(p2), semantic_at_c<N-1>(p3));
335  return op2;
336  }
337  template <typename P1,typename P2,typename P3,typename Op>
338  static Op static_for_each(const P1& p1, const P2& p2, const P3& p3, Op op) {
339  Op op2(element_recursion<N-1>::static_for_each(p1,p2,p3,op));
340  op2(semantic_at_c<N-1>(p1), semantic_at_c<N-1>(p2), semantic_at_c<N-1>(p3));
341  return op2;
342  }
343  //static_transform with one source
344  template <typename P1,typename Dst,typename Op>
345  static Op static_transform(P1& src, Dst& dst, Op op) {
346  Op op2(element_recursion<N-1>::static_transform(src,dst,op));
347  semantic_at_c<N-1>(dst)=op2(semantic_at_c<N-1>(src));
348  return op2;
349  }
350  template <typename P1,typename Dst,typename Op>
351  static Op static_transform(const P1& src, Dst& dst, Op op) {
352  Op op2(element_recursion<N-1>::static_transform(src,dst,op));
353  semantic_at_c<N-1>(dst)=op2(semantic_at_c<N-1>(src));
354  return op2;
355  }
356  //static_transform with two sources
357  template <typename P1,typename P2,typename Dst,typename Op>
358  static Op static_transform(P1& src1, P2& src2, Dst& dst, Op op) {
359  Op op2(element_recursion<N-1>::static_transform(src1,src2,dst,op));
360  semantic_at_c<N-1>(dst)=op2(semantic_at_c<N-1>(src1), semantic_at_c<N-1>(src2));
361  return op2;
362  }
363  template <typename P1,typename P2,typename Dst,typename Op>
364  static Op static_transform(P1& src1, const P2& src2, Dst& dst, Op op) {
365  Op op2(element_recursion<N-1>::static_transform(src1,src2,dst,op));
366  semantic_at_c<N-1>(dst)=op2(semantic_at_c<N-1>(src1), semantic_at_c<N-1>(src2));
367  return op2;
368  }
369  template <typename P1,typename P2,typename Dst,typename Op>
370  static Op static_transform(const P1& src1, P2& src2, Dst& dst, Op op) {
371  Op op2(element_recursion<N-1>::static_transform(src1,src2,dst,op));
372  semantic_at_c<N-1>(dst)=op2(semantic_at_c<N-1>(src1), semantic_at_c<N-1>(src2));
373  return op2;
374  }
375  template <typename P1,typename P2,typename Dst,typename Op>
376  static Op static_transform(const P1& src1, const P2& src2, Dst& dst, Op op) {
377  Op op2(element_recursion<N-1>::static_transform(src1,src2,dst,op));
378  semantic_at_c<N-1>(dst)=op2(semantic_at_c<N-1>(src1), semantic_at_c<N-1>(src2));
379  return op2;
380  }
381 };
382 
383 // Termination condition of the compile-time recursion for element operations on a color base
384 template<> struct element_recursion<0> {
385  //static_equal
386  template <typename P1,typename P2>
387  static bool static_equal(const P1&, const P2&) { return true; }
388  //static_copy
389  template <typename P1,typename P2>
390  static void static_copy(const P1&, const P2&) {}
391  //static_fill
392  template <typename P, typename T2>
393  static void static_fill(const P&, T2) {}
394  //static_generate
395  template <typename Dst,typename Op>
396  static void static_generate(const Dst&,Op){}
397  //static_for_each with one source
398  template <typename P1,typename Op>
399  static Op static_for_each(const P1&,Op op){return op;}
400  //static_for_each with two sources
401  template <typename P1,typename P2,typename Op>
402  static Op static_for_each(const P1&,const P2&,Op op){return op;}
403  //static_for_each with three sources
404  template <typename P1,typename P2,typename P3,typename Op>
405  static Op static_for_each(const P1&,const P2&,const P3&,Op op){return op;}
406  //static_transform with one source
407  template <typename P1,typename Dst,typename Op>
408  static Op static_transform(const P1&,const Dst&,Op op){return op;}
409  //static_transform with two sources
410  template <typename P1,typename P2,typename Dst,typename Op>
411  static Op static_transform(const P1&,const P2&,const Dst&,Op op){return op;}
412 };
413 
414 // std::min and std::max don't have the mutable overloads...
415 template <typename Q> inline const Q& mutable_min(const Q& x, const Q& y) { return x<y ? x : y; }
416 template <typename Q> inline Q& mutable_min( Q& x, Q& y) { return x<y ? x : y; }
417 template <typename Q> inline const Q& mutable_max(const Q& x, const Q& y) { return x<y ? y : x; }
418 template <typename Q> inline Q& mutable_max( Q& x, Q& y) { return x<y ? y : x; }
419 
420 
421 // compile-time recursion for min/max element
422 template <int N>
423 struct min_max_recur {
424  template <typename P> static typename element_const_reference_type<P>::type max_(const P& p) {
425  return mutable_max(min_max_recur<N-1>::max_(p),semantic_at_c<N-1>(p));
426  }
427  template <typename P> static typename element_reference_type<P>::type max_( P& p) {
428  return mutable_max(min_max_recur<N-1>::max_(p),semantic_at_c<N-1>(p));
429  }
430  template <typename P> static typename element_const_reference_type<P>::type min_(const P& p) {
431  return mutable_min(min_max_recur<N-1>::min_(p),semantic_at_c<N-1>(p));
432  }
433  template <typename P> static typename element_reference_type<P>::type min_( P& p) {
434  return mutable_min(min_max_recur<N-1>::min_(p),semantic_at_c<N-1>(p));
435  }
436 };
437 
438 // termination condition of the compile-time recursion for min/max element
439 template <>
440 struct min_max_recur<1> {
441  template <typename P> static typename element_const_reference_type<P>::type max_(const P& p) { return semantic_at_c<0>(p); }
442  template <typename P> static typename element_reference_type<P>::type max_( P& p) { return semantic_at_c<0>(p); }
443  template <typename P> static typename element_const_reference_type<P>::type min_(const P& p) { return semantic_at_c<0>(p); }
444  template <typename P> static typename element_reference_type<P>::type min_( P& p) { return semantic_at_c<0>(p); }
445 };
446 } // namespace detail
447 
448 
464 template <typename P>
465 BOOST_FORCEINLINE
466 typename element_const_reference_type<P>::type static_max(const P& p) { return detail::min_max_recur<size<P>::value>::max_(p); }
467 
468 template <typename P>
469 BOOST_FORCEINLINE
470 typename element_reference_type<P>::type static_max( P& p) { return detail::min_max_recur<size<P>::value>::max_(p); }
471 
472 template <typename P>
473 BOOST_FORCEINLINE
474 typename element_const_reference_type<P>::type static_min(const P& p) { return detail::min_max_recur<size<P>::value>::min_(p); }
475 
476 template <typename P>
477 BOOST_FORCEINLINE
478 typename element_reference_type<P>::type static_min( P& p) { return detail::min_max_recur<size<P>::value>::min_(p); }
480 
498 template <typename P1,typename P2>
499 BOOST_FORCEINLINE
500 bool static_equal(const P1& p1, const P2& p2) { return detail::element_recursion<size<P1>::value>::static_equal(p1,p2); }
501 
503 
521 template <typename Src,typename Dst>
522 BOOST_FORCEINLINE
523 void static_copy(const Src& src, Dst& dst) { detail::element_recursion<size<Dst>::value>::static_copy(src,dst); }
524 
526 
540 template <typename P,typename V>
541 BOOST_FORCEINLINE
542 void static_fill(P& p, const V& v) { detail::element_recursion<size<P>::value>::static_fill(p,v); }
544 
566 template <typename P1,typename Op>
567 BOOST_FORCEINLINE
568 void static_generate(P1& dst,Op op) { detail::element_recursion<size<P1>::value>::static_generate(dst,op); }
570 
599 //static_transform with one source
600 template <typename Src,typename Dst,typename Op>
601 BOOST_FORCEINLINE
602 Op static_transform(Src& src,Dst& dst,Op op) { return detail::element_recursion<size<Dst>::value>::static_transform(src,dst,op); }
603 template <typename Src,typename Dst,typename Op>
604 BOOST_FORCEINLINE
605 Op static_transform(const Src& src,Dst& dst,Op op) { return detail::element_recursion<size<Dst>::value>::static_transform(src,dst,op); }
606 //static_transform with two sources
607 template <typename P2,typename P3,typename Dst,typename Op>
608 BOOST_FORCEINLINE
609 Op static_transform(P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion<size<Dst>::value>::static_transform(p2,p3,dst,op); }
610 template <typename P2,typename P3,typename Dst,typename Op>
611 BOOST_FORCEINLINE
612 Op static_transform(P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion<size<Dst>::value>::static_transform(p2,p3,dst,op); }
613 template <typename P2,typename P3,typename Dst,typename Op>
614 BOOST_FORCEINLINE
615 Op static_transform(const P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion<size<Dst>::value>::static_transform(p2,p3,dst,op); }
616 template <typename P2,typename P3,typename Dst,typename Op>
617 BOOST_FORCEINLINE
618 Op static_transform(const P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion<size<Dst>::value>::static_transform(p2,p3,dst,op); }
620 
648 //static_for_each with one source
649 template <typename P1,typename Op>
650 BOOST_FORCEINLINE
651 Op static_for_each( P1& p1, Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,op); }
652 template <typename P1,typename Op>
653 BOOST_FORCEINLINE
654 Op static_for_each(const P1& p1, Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,op); }
655 //static_for_each with two sources
656 template <typename P1,typename P2,typename Op>
657 BOOST_FORCEINLINE
658 Op static_for_each(P1& p1, P2& p2, Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,op); }
659 template <typename P1,typename P2,typename Op>
660 BOOST_FORCEINLINE
661 Op static_for_each(P1& p1,const P2& p2, Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,op); }
662 template <typename P1,typename P2,typename Op>
663 BOOST_FORCEINLINE
664 Op static_for_each(const P1& p1, P2& p2, Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,op); }
665 template <typename P1,typename P2,typename Op>
666 BOOST_FORCEINLINE
667 Op static_for_each(const P1& p1,const P2& p2, Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,op); }
668 //static_for_each with three sources
669 template <typename P1,typename P2,typename P3,typename Op>
670 BOOST_FORCEINLINE
671 Op static_for_each(P1& p1,P2& p2,P3& p3,Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,p3,op); }
672 template <typename P1,typename P2,typename P3,typename Op>
673 BOOST_FORCEINLINE
674 Op static_for_each(P1& p1,P2& p2,const P3& p3,Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,p3,op); }
675 template <typename P1,typename P2,typename P3,typename Op>
676 BOOST_FORCEINLINE
677 Op static_for_each(P1& p1,const P2& p2,P3& p3,Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,p3,op); }
678 template <typename P1,typename P2,typename P3,typename Op>
679 BOOST_FORCEINLINE
680 Op static_for_each(P1& p1,const P2& p2,const P3& p3,Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,p3,op); }
681 template <typename P1,typename P2,typename P3,typename Op>
682 BOOST_FORCEINLINE
683 Op static_for_each(const P1& p1,P2& p2,P3& p3,Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,p3,op); }
684 template <typename P1,typename P2,typename P3,typename Op>
685 BOOST_FORCEINLINE
686 Op static_for_each(const P1& p1,P2& p2,const P3& p3,Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,p3,op); }
687 template <typename P1,typename P2,typename P3,typename Op>
688 BOOST_FORCEINLINE
689 Op static_for_each(const P1& p1,const P2& p2,P3& p3,Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,p3,op); }
690 template <typename P1,typename P2,typename P3,typename Op>
691 BOOST_FORCEINLINE
692 Op static_for_each(const P1& p1,const P2& p2,const P3& p3,Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,p3,op); }
694 
695 } } // namespace boost::gil
696 
697 #endif
disable_if< is_const< ColorBase >, typename kth_semantic_element_reference_type< ColorBase, K >::type >::type semantic_at_c(ColorBase &p)
A mutable accessor to the K-th semantic element of a color base.
Definition: color_base_algorithm.hpp:106
Specifies the return type of the constant element accessor by color name, get_color(color_base, Color());.
Definition: color_base_algorithm.hpp:164
Specifies the element type of a homogeneous color base.
Definition: color_base_algorithm.hpp:200
Specifies the type of the K-th semantic element of a color base.
Definition: color_base_algorithm.hpp:81
Specifies the return type of the mutable semantic_at_c<K>(color_base);.
Definition: color_base_algorithm.hpp:88
A predicate metafunction determining whether a given color base contains a given color.
Definition: color_base_algorithm.hpp:146
Specifies the return type of the mutable element accessor at_c of a homogeneous color base...
Definition: color_base.hpp:35
Specifies the type of the element associated with a given color tag.
Definition: color_base_algorithm.hpp:154
Specifies the return type of the mutable element accessor by color name, get_color(color_base, Color());.
Definition: color_base_algorithm.hpp:159
Returns an MPL integral type specifying the number of elements in a color base.
Definition: color_base_algorithm.hpp:45
Specifies the return type of the constant semantic_at_c<K>(color_base);.
Definition: color_base_algorithm.hpp:96
Returns the index corresponding to the first occurrance of a given given type in. ...
Definition: utilities.hpp:233
color_element_const_reference_type< ColorBase, Color >::type get_color(const ColorBase &cb, Color=Color())
Constant accessor to the element associated with a given color name.
Definition: color_base_algorithm.hpp:176