Generic Image Library: typedefs.hpp Source File

Modules | Alphabetical List | Class List | Directories | File List | GIL Home Page

# typedefs.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
    00013 #ifndef GIL_TYPEDEFS_H
    00014 #define GIL_TYPEDEFS_H
    00015
    00024
    00025 #include "gil_config.hpp"
    00026 #include <boost/cstdint.hpp>
    00027 #include "gray.hpp"
    00028 #include "rgb.hpp"
    00029 #include "rgba.hpp"
    00030 #include "cmyk.hpp"
    00031 #include "device_n.hpp"
    00032 #include <memory>
    00033
    00034 // CS = 'bgr' LAYOUT='bgr_layout_t'
    00035 #define GIL_DEFINE_BASE_TYPEDEFS_INTERNAL(T,CS,LAYOUT)                                              \
    00036     template <typename, typename>    struct pixel;                                                \
    00037     template <typename, typename>    struct planar_pixel_reference;                                            \
    00038     template <typename, typename>    struct planar_pixel_iterator;                                            \
    00039     template <typename>                class memory_based_step_iterator;                                    \
    00040     template <typename>                class point2;                                                \
    00041     template <typename>                class memory_based_2d_locator;                                    \
    00042     template <typename>                class image_view;                                            \
    00043     template <typename, bool, typename>    class image;                                                \
    00044     typedef pixel<bits##T, LAYOUT >                        CS##T##_pixel_t;        \
    00045     typedef const pixel<bits##T, LAYOUT >                   CS##T##c_pixel_t;        \
    00046     typedef pixel<bits##T, LAYOUT >&                      CS##T##_ref_t;            \
    00047     typedef const pixel<bits##T, LAYOUT >&                CS##T##c_ref_t;            \
    00048     typedef CS##T##_pixel_t*                                               CS##T##_ptr_t;            \
    00049     typedef CS##T##c_pixel_t*                                               CS##T##c_ptr_t;            \
    00050     typedef memory_based_step_iterator<CS##T##_ptr_t>                               CS##T##_step_ptr_t;        \
    00051     typedef memory_based_step_iterator<CS##T##c_ptr_t>                               CS##T##c_step_ptr_t;    \
    00052     typedef memory_based_2d_locator<memory_based_step_iterator<CS##T##_ptr_t> >       CS##T##_loc_t;            \
    00053     typedef memory_based_2d_locator<memory_based_step_iterator<CS##T##c_ptr_t> >       CS##T##c_loc_t;            \
    00054     typedef memory_based_2d_locator<memory_based_step_iterator<CS##T##_step_ptr_t> >  CS##T##_step_loc_t;        \
    00055     typedef memory_based_2d_locator<memory_based_step_iterator<CS##T##c_step_ptr_t> > CS##T##c_step_loc_t;    \
    00056     typedef image_view<CS##T##_loc_t>                                        CS##T##_view_t;            \
    00057     typedef image_view<CS##T##c_loc_t>                                        CS##T##c_view_t;        \
    00058     typedef image_view<CS##T##_step_loc_t>                                    CS##T##_step_view_t;    \
    00059     typedef image_view<CS##T##c_step_loc_t>                                   CS##T##c_step_view_t;    \
    00060     typedef image<CS##T##_pixel_t,false,std::allocator<unsigned char> >           CS##T##_image_t;
    00061
    00062 // CS = 'bgr' CS_FULL = 'rgb_t' LAYOUT='bgr_layout_t'
    00063 #define GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(T,CS,CS_FULL,LAYOUT)                                                                \
    00064     GIL_DEFINE_BASE_TYPEDEFS_INTERNAL(T,CS,LAYOUT)                                                                    \
    00065     typedef planar_pixel_reference<bits##T&,CS_FULL >                                          CS##T##_planar_ref_t;        \
    00066     typedef planar_pixel_reference<const bits##T&,CS_FULL >                                      CS##T##c_planar_ref_t;        \
    00067     typedef planar_pixel_iterator<bits##T*,CS_FULL >                                          CS##T##_planar_ptr_t;        \
    00068     typedef planar_pixel_iterator<const bits##T*,CS_FULL >                                      CS##T##c_planar_ptr_t;        \
    00069     typedef memory_based_step_iterator<CS##T##_planar_ptr_t>                              CS##T##_planar_step_ptr_t;    \
    00070     typedef memory_based_step_iterator<CS##T##c_planar_ptr_t>                              CS##T##c_planar_step_ptr_t;    \
    00071     typedef memory_based_2d_locator<memory_based_step_iterator<CS##T##_planar_ptr_t> >          CS##T##_planar_loc_t;        \
    00072     typedef memory_based_2d_locator<memory_based_step_iterator<CS##T##c_planar_ptr_t> >      CS##T##c_planar_loc_t;        \
    00073     typedef memory_based_2d_locator<memory_based_step_iterator<CS##T##_planar_step_ptr_t> >  CS##T##_planar_step_loc_t;    \
    00074     typedef memory_based_2d_locator<memory_based_step_iterator<CS##T##c_planar_step_ptr_t> > CS##T##c_planar_step_loc_t;    \
    00075     typedef image_view<CS##T##_planar_loc_t>                                      CS##T##_planar_view_t;        \
    00076     typedef image_view<CS##T##c_planar_loc_t>                                      CS##T##c_planar_view_t;        \
    00077     typedef image_view<CS##T##_planar_step_loc_t>                                  CS##T##_planar_step_view_t;    \
    00078     typedef image_view<CS##T##c_planar_step_loc_t>                                  CS##T##c_planar_step_view_t;\
    00079     typedef image<CS##T##_pixel_t,true,std::allocator<unsigned char> >              CS##T##_planar_image_t;
    00080
    00081 #define GIL_DEFINE_BASE_TYPEDEFS(T,CS)        \
    00082     GIL_DEFINE_BASE_TYPEDEFS_INTERNAL(T,CS,CS##_layout_t)
    00083
    00084 #define GIL_DEFINE_ALL_TYPEDEFS(T,CS)         \
    00085     GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(T,CS,CS##_t,CS##_layout_t)
    00086
    00087 namespace boost { namespace gil {
    00088
    00089 // forward declarations
    00090 template <typename B, typename Mn, typename Mx> struct scoped_channel_value;
    00091 struct float_zero;
    00092 struct float_one;
    00093 typedef scoped_channel_value<float,float_zero,float_one> bits32f;
    00094 typedef uint8_t  bits8;
    00095 typedef uint16_t bits16;
    00096 typedef uint32_t bits32;
    00097 typedef int8_t   bits8s;
    00098 typedef int16_t  bits16s;
    00099 typedef int32_t  bits32s;
    00100
    00101 GIL_DEFINE_BASE_TYPEDEFS(8,  gray)
    00102 GIL_DEFINE_BASE_TYPEDEFS(8s, gray)
    00103 GIL_DEFINE_BASE_TYPEDEFS(16, gray)
    00104 GIL_DEFINE_BASE_TYPEDEFS(16s,gray)
    00105 GIL_DEFINE_BASE_TYPEDEFS(32 ,gray)
    00106 GIL_DEFINE_BASE_TYPEDEFS(32s,gray)
    00107 GIL_DEFINE_BASE_TYPEDEFS(32f,gray)
    00108 GIL_DEFINE_BASE_TYPEDEFS(8,  bgr)
    00109 GIL_DEFINE_BASE_TYPEDEFS(8s, bgr)
    00110 GIL_DEFINE_BASE_TYPEDEFS(16, bgr)
    00111 GIL_DEFINE_BASE_TYPEDEFS(16s,bgr)
    00112 GIL_DEFINE_BASE_TYPEDEFS(32 ,bgr)
    00113 GIL_DEFINE_BASE_TYPEDEFS(32s,bgr)
    00114 GIL_DEFINE_BASE_TYPEDEFS(32f,bgr)
    00115 GIL_DEFINE_BASE_TYPEDEFS(8,  argb)
    00116 GIL_DEFINE_BASE_TYPEDEFS(8s, argb)
    00117 GIL_DEFINE_BASE_TYPEDEFS(16, argb)
    00118 GIL_DEFINE_BASE_TYPEDEFS(16s,argb)
    00119 GIL_DEFINE_BASE_TYPEDEFS(32, argb)
    00120 GIL_DEFINE_BASE_TYPEDEFS(32s,argb)
    00121 GIL_DEFINE_BASE_TYPEDEFS(32f,argb)
    00122 GIL_DEFINE_BASE_TYPEDEFS(8,  abgr)
    00123 GIL_DEFINE_BASE_TYPEDEFS(8s, abgr)
    00124 GIL_DEFINE_BASE_TYPEDEFS(16, abgr)
    00125 GIL_DEFINE_BASE_TYPEDEFS(16s,abgr)
    00126 GIL_DEFINE_BASE_TYPEDEFS(32 ,abgr)
    00127 GIL_DEFINE_BASE_TYPEDEFS(32s,abgr)
    00128 GIL_DEFINE_BASE_TYPEDEFS(32f,abgr)
    00129 GIL_DEFINE_BASE_TYPEDEFS(8,  bgra)
    00130 GIL_DEFINE_BASE_TYPEDEFS(8s, bgra)
    00131 GIL_DEFINE_BASE_TYPEDEFS(16, bgra)
    00132 GIL_DEFINE_BASE_TYPEDEFS(16s,bgra)
    00133 GIL_DEFINE_BASE_TYPEDEFS(32 ,bgra)
    00134 GIL_DEFINE_BASE_TYPEDEFS(32s,bgra)
    00135 GIL_DEFINE_BASE_TYPEDEFS(32f,bgra)
    00136
    00137 GIL_DEFINE_ALL_TYPEDEFS(8,  rgb)
    00138 GIL_DEFINE_ALL_TYPEDEFS(8s, rgb)
    00139 GIL_DEFINE_ALL_TYPEDEFS(16, rgb)
    00140 GIL_DEFINE_ALL_TYPEDEFS(16s,rgb)
    00141 GIL_DEFINE_ALL_TYPEDEFS(32 ,rgb)
    00142 GIL_DEFINE_ALL_TYPEDEFS(32s,rgb)
    00143 GIL_DEFINE_ALL_TYPEDEFS(32f,rgb)
    00144 GIL_DEFINE_ALL_TYPEDEFS(8,  rgba)
    00145 GIL_DEFINE_ALL_TYPEDEFS(8s, rgba)
    00146 GIL_DEFINE_ALL_TYPEDEFS(16, rgba)
    00147 GIL_DEFINE_ALL_TYPEDEFS(16s,rgba)
    00148 GIL_DEFINE_ALL_TYPEDEFS(32 ,rgba)
    00149 GIL_DEFINE_ALL_TYPEDEFS(32s,rgba)
    00150 GIL_DEFINE_ALL_TYPEDEFS(32f,rgba)
    00151 GIL_DEFINE_ALL_TYPEDEFS(8,  cmyk)
    00152 GIL_DEFINE_ALL_TYPEDEFS(8s, cmyk)
    00153 GIL_DEFINE_ALL_TYPEDEFS(16, cmyk)
    00154 GIL_DEFINE_ALL_TYPEDEFS(16s,cmyk)
    00155 GIL_DEFINE_ALL_TYPEDEFS(32 ,cmyk)
    00156 GIL_DEFINE_ALL_TYPEDEFS(32s,cmyk)
    00157 GIL_DEFINE_ALL_TYPEDEFS(32f,cmyk)
    00158
    00159
    00160 template <int N> struct devicen_t;
    00161 template <int N> struct devicen_layout_t;
    00162 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8,  dev2n, devicen_t<2>, devicen_layout_t<2>)
    00163 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8s, dev2n, devicen_t<2>, devicen_layout_t<2>)
    00164 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16, dev2n, devicen_t<2>, devicen_layout_t<2>)
    00165 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16s,dev2n, devicen_t<2>, devicen_layout_t<2>)
    00166 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32 ,dev2n, devicen_t<2>, devicen_layout_t<2>)
    00167 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32s,dev2n, devicen_t<2>, devicen_layout_t<2>)
    00168 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32f,dev2n, devicen_t<2>, devicen_layout_t<2>)
    00169
    00170 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8,  dev3n, devicen_t<3>, devicen_layout_t<3>)
    00171 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8s, dev3n, devicen_t<3>, devicen_layout_t<3>)
    00172 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16, dev3n, devicen_t<3>, devicen_layout_t<3>)
    00173 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16s,dev3n, devicen_t<3>, devicen_layout_t<3>)
    00174 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32 ,dev3n, devicen_t<3>, devicen_layout_t<3>)
    00175 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32s,dev3n, devicen_t<3>, devicen_layout_t<3>)
    00176 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32f,dev3n, devicen_t<3>, devicen_layout_t<3>)
    00177
    00178 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8,  dev4n, devicen_t<4>, devicen_layout_t<4>)
    00179 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8s, dev4n, devicen_t<4>, devicen_layout_t<4>)
    00180 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16, dev4n, devicen_t<4>, devicen_layout_t<4>)
    00181 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16s,dev4n, devicen_t<4>, devicen_layout_t<4>)
    00182 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32 ,dev4n, devicen_t<4>, devicen_layout_t<4>)
    00183 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32s,dev4n, devicen_t<4>, devicen_layout_t<4>)
    00184 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32f,dev4n, devicen_t<4>, devicen_layout_t<4>)
    00185
    00186 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8,  dev5n, devicen_t<5>, devicen_layout_t<5>)
    00187 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8s, dev5n, devicen_t<5>, devicen_layout_t<5>)
    00188 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16, dev5n, devicen_t<5>, devicen_layout_t<5>)
    00189 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16s,dev5n, devicen_t<5>, devicen_layout_t<5>)
    00190 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32 ,dev5n, devicen_t<5>, devicen_layout_t<5>)
    00191 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32s,dev5n, devicen_t<5>, devicen_layout_t<5>)
    00192 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32f,dev5n, devicen_t<5>, devicen_layout_t<5>)
    00193
    00194 } }  // namespace boost::gil
    00195
    00196 #endif