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