color.hpp 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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_CONCEPTS_COLOR_HPP
  9. #define BOOST_GIL_CONCEPTS_COLOR_HPP
  10. #include <boost/gil/concepts/concept_check.hpp>
  11. #include <type_traits>
  12. #if defined(BOOST_CLANG)
  13. #pragma clang diagnostic push
  14. #pragma clang diagnostic ignored "-Wunused-local-typedefs"
  15. #endif
  16. #if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
  17. #pragma GCC diagnostic push
  18. #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
  19. #endif
  20. namespace boost { namespace gil {
  21. /// \ingroup ColorSpaceAndLayoutConcept
  22. /// \brief Color space type concept
  23. /// \code
  24. /// concept ColorSpaceConcept<MPLRandomAccessSequence CS>
  25. /// {
  26. /// // Boost.MP11-compatible list, whose elements are color tags.
  27. /// };
  28. /// \endcode
  29. template <typename CS>
  30. struct ColorSpaceConcept
  31. {
  32. void constraints()
  33. {
  34. // Boost.MP11-compatible list, whose elements are color tags
  35. // TODO: Is this incomplete?
  36. }
  37. };
  38. // Models ColorSpaceConcept
  39. template <typename CS1, typename CS2>
  40. struct color_spaces_are_compatible : std::is_same<CS1, CS2> {};
  41. /// \ingroup ColorSpaceAndLayoutConcept
  42. /// \brief Two color spaces are compatible if they are the same
  43. /// \code
  44. /// concept ColorSpacesCompatibleConcept<ColorSpaceConcept CS1, ColorSpaceConcept CS2>
  45. /// {
  46. /// where SameType<CS1, CS2>;
  47. /// };
  48. /// \endcode
  49. template <typename CS1, typename CS2>
  50. struct ColorSpacesCompatibleConcept
  51. {
  52. void constraints()
  53. {
  54. static_assert(color_spaces_are_compatible<CS1, CS2>::value, "");
  55. }
  56. };
  57. /// \ingroup ColorSpaceAndLayoutConcept
  58. /// \brief Channel mapping concept
  59. /// \code
  60. /// concept ChannelMappingConcept<MPLRandomAccessSequence CM>
  61. /// {
  62. /// // Boost.MP11-compatible list, whose elements
  63. /// // model MPLIntegralConstant representing a permutation
  64. /// };
  65. /// \endcode
  66. template <typename CM>
  67. struct ChannelMappingConcept
  68. {
  69. void constraints()
  70. {
  71. // Boost.MP11-compatible list, whose elements model
  72. // MPLIntegralConstant representing a permutation.
  73. // TODO: Is this incomplete?
  74. }
  75. };
  76. }} // namespace boost::gil
  77. #if defined(BOOST_CLANG)
  78. #pragma clang diagnostic pop
  79. #endif
  80. #if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
  81. #pragma GCC diagnostic pop
  82. #endif
  83. #endif