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