Generic Image Library: device_n.hpp Source File

Modules | Alphabetical List | Class List | Directories | File List | GIL Home Page # device_n.hpp Go to the documentation of this file.
    00001 /*
    00002     Copyright 2005-2007 Adobe Systems Incorporated
    00003
    00004     Use, modification and distribution are subject to the Boost Software License,
    00005     Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
    00006     http://www.boost.org/LICENSE_1_0.txt).
    00007
    00008     See http://stlab.adobe.com/gil for most recent version including documentation.
    00009 */
    00010 /*************************************************************************************************/
    00011
    00012 #ifndef GIL_DEVICE_N_H
    00013 #define GIL_DEVICE_N_H
    00014
    00015
    00023
    00024 #include <cstddef>
    00025 #include "gil_config.hpp"
    00026 #include "utilities.hpp"
    00027 #include "metafunctions.hpp"
    00028 #include <boost/type_traits.hpp>
    00029 #include <boost/mpl/range_c.hpp>
    00030 #include <boost/mpl/vector_c.hpp>
    00031
    00032 namespace boost { namespace gil {
    00033
    00036 template <int N> struct devicen_color_t {};
    00037
    00038 template <int N> struct devicen_t;
    00039
    00042 template <> struct devicen_t<1> : public mpl::vector1<devicen_color_t<0> > {};
    00043
    00046 template <> struct devicen_t<2> : public mpl::vector2<devicen_color_t<0>, devicen_color_t<1> > {};
    00047
    00050 template <> struct devicen_t<3> : public mpl::vector3<devicen_color_t<0>, devicen_color_t<1>, devicen_color_t<2> > {};
    00051
    00054 template <> struct devicen_t<4> : public mpl::vector4<devicen_color_t<0>, devicen_color_t<1>, devicen_color_t<2>, devicen_color_t<3> > {};
    00055
    00058 template <> struct devicen_t<5> : public mpl::vector5<devicen_color_t<0>, devicen_color_t<1>, devicen_color_t<2>, devicen_color_t<3>, devicen_color_t<4> > {};
    00059
    00062 template <int N> struct devicen_layout_t : public layout<devicen_t<N> > {};
    00063
    00066 template <typename IC>
    00067 inline typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<2> > >::view_t
    00068 planar_devicen_view(std::size_t width, std::size_t height, IC c0, IC c1, std::ptrdiff_t rowsize_in_bytes) {
    00069     typedef typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<2> > >::view_t view_t;
    00070     return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1), rowsize_in_bytes));
    00071 }
    00072
    00075 template <typename IC>
    00076 inline typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<3> > >::view_t
    00077 planar_devicen_view(std::size_t width, std::size_t height, IC c0, IC c1, IC c2, std::ptrdiff_t rowsize_in_bytes) {
    00078     typedef typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<3> > >::view_t view_t;
    00079     return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2), rowsize_in_bytes));
    00080 }
    00081
    00084 template <typename IC>
    00085 inline typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<4> > >::view_t
    00086 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) {
    00087     typedef typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<4> > >::view_t view_t;
    00088     return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2,c3), rowsize_in_bytes));
    00089 }
    00090
    00093 template <typename IC>
    00094 inline typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<5> > >::view_t
    00095 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) {
    00096     typedef typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<5> > >::view_t view_t;
    00097     return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2,c3,c4), rowsize_in_bytes));
    00098 }
    00099
    00100 } }  // namespace boost::gil
    00101
    00102 #endif