Generic Image Library: rgba.hpp Source File

Modules | Alphabetical List | Class List | Directories | File List | GIL Home Page # rgba.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://opensource.adobe.com/gil for most recent version including documentation.
    00009 */
    00010 /*************************************************************************************************/
    00011
    00012 #ifndef GIL_RGBA_H
    00013 #define GIL_RGBA_H
    00014
    00022
    00023 #include <cstddef>
    00024 #include "gil_config.hpp"
    00025 #include <boost/mpl/contains.hpp>
    00026 #include "rgb.hpp"
    00027 #include "planar_pixel_iterator.hpp"
    00028
    00029 namespace boost { namespace gil {
    00030
    00033 struct alpha_t {};
    00034
    00036 typedef mpl::vector4<red_t,green_t,blue_t,alpha_t> rgba_t;
    00037
    00039 typedef layout<rgba_t> rgba_layout_t;
    00041 typedef layout<rgba_t, mpl::vector4_c<int,2,1,0,3> > bgra_layout_t;
    00043 typedef layout<rgba_t, mpl::vector4_c<int,1,2,3,0> > argb_layout_t;
    00045 typedef layout<rgba_t, mpl::vector4_c<int,3,2,1,0> > abgr_layout_t;
    00046
    00049 template <typename IC>
    00050 inline
    00051 typename type_from_x_iterator<planar_pixel_iterator<IC,rgba_t> >::view_t
    00052 planar_rgba_view(std::size_t width, std::size_t height,
    00053                  IC r, IC g, IC b, IC a,
    00054                  std::ptrdiff_t rowsize_in_bytes) {
    00055     typedef typename type_from_x_iterator<planar_pixel_iterator<IC,rgba_t> >::view_t RView;
    00056     return RView(width, height,
    00057                  typename RView::locator(planar_pixel_iterator<IC,rgba_t>(r,g,b,a),
    00058                                          rowsize_in_bytes));
    00059 }
    00060
    00061 } }  // namespace boost::gil
    00062
    00063 #endif