color.hpp 2.4 KB

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