]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /* |
2 | Copyright 2005-2007 Adobe Systems Incorporated | |
3 | ||
4 | Use, modification and distribution are subject to the Boost Software License, | |
5 | Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
6 | http://www.boost.org/LICENSE_1_0.txt). | |
7 | ||
8 | See http://opensource.adobe.com/gil for most recent version including documentation. | |
9 | */ | |
10 | ||
11 | /*************************************************************************************************/ | |
12 | ||
13 | #ifndef GIL_RGB_H | |
14 | #define GIL_RGB_H | |
15 | ||
16 | //////////////////////////////////////////////////////////////////////////////////////// | |
17 | /// \file | |
18 | /// \brief Support for RGB color space and variants | |
19 | /// \author Lubomir Bourdev and Hailin Jin \n | |
20 | /// Adobe Systems Incorporated | |
21 | /// \date 2005-2007 \n Last updated on October 10, 2007 | |
22 | //////////////////////////////////////////////////////////////////////////////////////// | |
23 | ||
24 | #include <cstddef> | |
25 | #include <boost/mpl/range_c.hpp> | |
26 | #include <boost/mpl/vector_c.hpp> | |
27 | #include "gil_config.hpp" | |
28 | #include "metafunctions.hpp" | |
29 | #include "planar_pixel_iterator.hpp" | |
30 | ||
31 | namespace boost { namespace gil { | |
32 | ||
33 | /// \addtogroup ColorNameModel | |
34 | /// \{ | |
35 | ||
36 | /// \brief Red | |
37 | struct red_t {}; | |
38 | ||
39 | /// \brief Green | |
40 | struct green_t {}; | |
41 | ||
42 | /// \brief Blue | |
43 | struct blue_t {}; | |
44 | /// \} | |
45 | ||
46 | /// \ingroup ColorSpaceModel | |
47 | typedef mpl::vector3<red_t,green_t,blue_t> rgb_t; | |
48 | ||
49 | /// \ingroup LayoutModel | |
50 | typedef layout<rgb_t> rgb_layout_t; | |
51 | /// \ingroup LayoutModel | |
52 | typedef layout<rgb_t, mpl::vector3_c<int,2,1,0> > bgr_layout_t; | |
53 | ||
54 | /// \ingroup ImageViewConstructors | |
55 | /// \brief from raw RGB planar data | |
56 | template <typename IC> | |
57 | inline | |
58 | typename type_from_x_iterator<planar_pixel_iterator<IC,rgb_t> >::view_t | |
59 | planar_rgb_view(std::size_t width, std::size_t height, | |
60 | IC r, IC g, IC b, | |
61 | std::ptrdiff_t rowsize_in_bytes) { | |
62 | typedef typename type_from_x_iterator<planar_pixel_iterator<IC,rgb_t> >::view_t RView; | |
63 | return RView(width, height, | |
64 | typename RView::locator(planar_pixel_iterator<IC,rgb_t>(r,g,b), | |
65 | rowsize_in_bytes)); | |
66 | } | |
67 | ||
68 | } } // namespace boost::gil | |
69 | ||
70 | #endif |