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 #ifndef GIL_RGBA_H
|
Chris@16
|
13 #define GIL_RGBA_H
|
Chris@16
|
14
|
Chris@16
|
15 ////////////////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
16 /// \file
|
Chris@16
|
17 /// \brief Support for RGBA color space and variants
|
Chris@16
|
18 /// \author Lubomir Bourdev and Hailin Jin \n
|
Chris@16
|
19 /// Adobe Systems Incorporated
|
Chris@16
|
20 /// \date 2005-2007 \n Last updated on October 10, 2007
|
Chris@16
|
21 ////////////////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
22
|
Chris@16
|
23 #include <cstddef>
|
Chris@16
|
24 #include "gil_config.hpp"
|
Chris@16
|
25 #include <boost/mpl/contains.hpp>
|
Chris@16
|
26 #include "rgb.hpp"
|
Chris@16
|
27 #include "planar_pixel_iterator.hpp"
|
Chris@16
|
28
|
Chris@16
|
29 namespace boost { namespace gil {
|
Chris@16
|
30
|
Chris@16
|
31 /// \ingroup ColorNameModel
|
Chris@16
|
32 /// \brief Alpha
|
Chris@16
|
33 struct alpha_t {};
|
Chris@16
|
34
|
Chris@16
|
35 /// \ingroup ColorSpaceModel
|
Chris@16
|
36 typedef mpl::vector4<red_t,green_t,blue_t,alpha_t> rgba_t;
|
Chris@16
|
37
|
Chris@16
|
38 /// \ingroup LayoutModel
|
Chris@16
|
39 typedef layout<rgba_t> rgba_layout_t;
|
Chris@16
|
40 /// \ingroup LayoutModel
|
Chris@16
|
41 typedef layout<rgba_t, mpl::vector4_c<int,2,1,0,3> > bgra_layout_t;
|
Chris@16
|
42 /// \ingroup LayoutModel
|
Chris@16
|
43 typedef layout<rgba_t, mpl::vector4_c<int,1,2,3,0> > argb_layout_t;
|
Chris@16
|
44 /// \ingroup LayoutModel
|
Chris@16
|
45 typedef layout<rgba_t, mpl::vector4_c<int,3,2,1,0> > abgr_layout_t;
|
Chris@16
|
46
|
Chris@16
|
47 /// \ingroup ImageViewConstructors
|
Chris@16
|
48 /// \brief from raw RGBA planar data
|
Chris@16
|
49 template <typename IC>
|
Chris@16
|
50 inline
|
Chris@16
|
51 typename type_from_x_iterator<planar_pixel_iterator<IC,rgba_t> >::view_t
|
Chris@16
|
52 planar_rgba_view(std::size_t width, std::size_t height,
|
Chris@16
|
53 IC r, IC g, IC b, IC a,
|
Chris@16
|
54 std::ptrdiff_t rowsize_in_bytes) {
|
Chris@16
|
55 typedef typename type_from_x_iterator<planar_pixel_iterator<IC,rgba_t> >::view_t RView;
|
Chris@16
|
56 return RView(width, height,
|
Chris@16
|
57 typename RView::locator(planar_pixel_iterator<IC,rgba_t>(r,g,b,a),
|
Chris@16
|
58 rowsize_in_bytes));
|
Chris@16
|
59 }
|
Chris@16
|
60
|
Chris@16
|
61 } } // namespace boost::gil
|
Chris@16
|
62
|
Chris@16
|
63 #endif
|