1 //
2 // Copyright 2007-2008 Christian Henning, Andreas Pokorny, Lubomir Bourdev
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 #ifndef BOOST_GIL_IO_BASE_HPP
9 #define BOOST_GIL_IO_BASE_HPP
10 
11 #include <boost/gil/extension/toolbox/toolbox.hpp>
12 
13 #include <boost/gil/bit_aligned_pixel_reference.hpp>
14 #include <boost/gil/bit_aligned_pixel_iterator.hpp>
15 #include <boost/gil/color_convert.hpp>
16 #include <boost/gil/utilities.hpp>
17 #include <boost/gil/io/error.hpp>
18 #include <boost/gil/io/typedefs.hpp>
19 
20 #include <boost/bind.hpp>
21 #include <boost/type_traits/is_base_of.hpp>
22 
23 #include <istream>
24 #include <ostream>
25 #include <vector>
26 
27 namespace boost { namespace gil {
28 
29 struct format_tag {};
30 
31 template< typename Property >
32 struct property_base
33 {
34     typedef Property type;
35 };
36 
37 template<typename FormatTag> struct is_format_tag : is_base_and_derived< format_tag
38                                                                        , FormatTag
39                                                                        > {};
40 
41 struct image_read_settings_base
42 {
43 protected:
44 
45     image_read_settings_base()
46     : _top_left( 0, 0 )
47     , _dim     ( 0, 0 )
48     {}
49 
50     image_read_settings_base( const point_t& top_left
51                             , const point_t& dim
52                             )
53     : _top_left( top_left )
54     , _dim     ( dim      )
55     {}
56 
57 
58 public:
59 
60     void set( const point_t& top_left
61             , const point_t& dim
62             )
63     {
64         _top_left = top_left;
65         _dim      = dim;
66     }
67 
68 public:
69 
70     point_t _top_left;
71     point_t _dim;
72 };
73 
74 /**
75  * Boolean meta function, mpl::true_ if the pixel type \a PixelType is supported
76  * by the image format identified with \a FormatTag.
77  * \todo the name is_supported is to generic, pick something more IO realted.
78  */
79 // Depending on image type the parameter Pixel can be a reference type
80 // for bit_aligned images or a pixel for byte images.
81 template< typename Pixel, typename FormatTag > struct is_read_supported {};
82 template< typename Pixel, typename FormatTag > struct is_write_supported {};
83 
84 
85 namespace detail {
86 
87 template< typename Property >
88 struct property_base
89 {
90     typedef Property type;
91 };
92 
93 } // namespace detail
94 
95 struct read_support_true  { BOOST_STATIC_CONSTANT( bool, is_supported = true  ); };
96 struct read_support_false { BOOST_STATIC_CONSTANT( bool, is_supported = false ); };
97 struct write_support_true { BOOST_STATIC_CONSTANT( bool, is_supported = true  ); };
98 struct write_support_false{ BOOST_STATIC_CONSTANT( bool, is_supported = false ); };
99 
100 class no_log {};
101 
102 template< typename Device, typename FormatTag > struct reader_backend;
103 template< typename Device, typename FormatTag > struct writer_backend;
104 
105 template< typename FormatTag > struct image_read_info;
106 template< typename FormatTag > struct image_read_settings;
107 template< typename FormatTag, typename Log = no_log > struct image_write_info;
108 
109 } // namespace gil
110 } // namespace boost
111 
112 #endif
113