Chris@16: /* Chris@16: Copyright 2005-2007 Adobe Systems Incorporated Chris@16: Chris@16: Use, modification and distribution are subject to the Boost Software License, Chris@16: Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: http://www.boost.org/LICENSE_1_0.txt). Chris@16: Chris@16: See http://stlab.adobe.com/gil for most recent version including documentation. Chris@16: */ Chris@16: /*************************************************************************************************/ Chris@16: Chris@16: #ifndef GIL_DEVICE_N_H Chris@16: #define GIL_DEVICE_N_H Chris@16: Chris@16: Chris@16: //////////////////////////////////////////////////////////////////////////////////////// Chris@16: /// \file Chris@16: /// \brief Support for color space of N channels and variants Chris@16: /// \author Lubomir Bourdev and Hailin Jin \n Chris@16: /// Adobe Systems Incorporated Chris@16: /// \date 2005-2009 \n Last updated on February 20, 2009 Chris@16: //////////////////////////////////////////////////////////////////////////////////////// Chris@16: Chris@16: #include Chris@16: #include "gil_config.hpp" Chris@16: #include "utilities.hpp" Chris@16: #include "metafunctions.hpp" Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { namespace gil { Chris@16: Chris@16: /// \brief unnamed color Chris@16: /// \ingroup ColorNameModel Chris@16: template struct devicen_color_t {}; Chris@16: Chris@16: template struct devicen_t; Chris@16: Chris@16: /// \brief unnamed color space of one channel Chris@16: /// \ingroup ColorSpaceModel Chris@16: template <> struct devicen_t<1> : public mpl::vector1 > {}; Chris@16: Chris@16: /// \brief unnamed color space of two channels Chris@16: /// \ingroup ColorSpaceModel Chris@16: template <> struct devicen_t<2> : public mpl::vector2, devicen_color_t<1> > {}; Chris@16: Chris@16: /// \brief unnamed color space of three channels Chris@16: /// \ingroup ColorSpaceModel Chris@16: template <> struct devicen_t<3> : public mpl::vector3, devicen_color_t<1>, devicen_color_t<2> > {}; Chris@16: Chris@16: /// \brief unnamed color space of four channels Chris@16: /// \ingroup ColorSpaceModel Chris@16: template <> struct devicen_t<4> : public mpl::vector4, devicen_color_t<1>, devicen_color_t<2>, devicen_color_t<3> > {}; Chris@16: Chris@16: /// \brief unnamed color space of five channels Chris@16: /// \ingroup ColorSpaceModel Chris@16: template <> struct devicen_t<5> : public mpl::vector5, devicen_color_t<1>, devicen_color_t<2>, devicen_color_t<3>, devicen_color_t<4> > {}; Chris@16: Chris@16: /// \brief unnamed color layout of up to five channels Chris@16: /// \ingroup LayoutModel Chris@16: template struct devicen_layout_t : public layout > {}; Chris@16: Chris@16: /// \ingroup ImageViewConstructors Chris@16: /// \brief from 2-channel planar data Chris@16: template Chris@16: inline typename type_from_x_iterator > >::view_t Chris@16: planar_devicen_view(std::size_t width, std::size_t height, IC c0, IC c1, std::ptrdiff_t rowsize_in_bytes) { Chris@16: typedef typename type_from_x_iterator > >::view_t view_t; Chris@16: return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1), rowsize_in_bytes)); Chris@16: } Chris@16: Chris@16: /// \ingroup ImageViewConstructors Chris@16: /// \brief from 3-channel planar data Chris@16: template Chris@16: inline typename type_from_x_iterator > >::view_t Chris@16: planar_devicen_view(std::size_t width, std::size_t height, IC c0, IC c1, IC c2, std::ptrdiff_t rowsize_in_bytes) { Chris@16: typedef typename type_from_x_iterator > >::view_t view_t; Chris@16: return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2), rowsize_in_bytes)); Chris@16: } Chris@16: Chris@16: /// \ingroup ImageViewConstructors Chris@16: /// \brief from 4-channel planar data Chris@16: template Chris@16: inline typename type_from_x_iterator > >::view_t Chris@16: planar_devicen_view(std::size_t width, std::size_t height, IC c0, IC c1, IC c2, IC c3, std::ptrdiff_t rowsize_in_bytes) { Chris@16: typedef typename type_from_x_iterator > >::view_t view_t; Chris@16: return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2,c3), rowsize_in_bytes)); Chris@16: } Chris@16: Chris@16: /// \ingroup ImageViewConstructors Chris@16: /// \brief from 5-channel planar data Chris@16: template Chris@16: inline typename type_from_x_iterator > >::view_t Chris@16: planar_devicen_view(std::size_t width, std::size_t height, IC c0, IC c1, IC c2, IC c3, IC c4, std::ptrdiff_t rowsize_in_bytes) { Chris@16: typedef typename type_from_x_iterator > >::view_t view_t; Chris@16: return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2,c3,c4), rowsize_in_bytes)); Chris@16: } Chris@16: Chris@16: } } // namespace boost::gil Chris@16: Chris@16: #endif