2 // Copyright 2008 Christian Henning
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
8 #ifndef BOOST_GIL_EXTENSION_IO_PNM_TAGS_HPP
9 #define BOOST_GIL_EXTENSION_IO_PNM_TAGS_HPP
11 #define BOOST_GIL_EXTENSION_IO_PNM_READ_ENABLED // TODO: Document, explain, review
13 #include <boost/gil/io/base.hpp>
15 #include <type_traits>
17 namespace boost { namespace gil {
20 struct pnm_tag : format_tag {};
22 /// see http://en.wikipedia.org/wiki/Portable_Bitmap_File_Format for reference
24 /// Defines type for image type property.
25 struct pnm_image_type : property_base< uint32_t >
27 using mono_asc_t = std::integral_constant<type, 1>;
28 using gray_asc_t = std::integral_constant<type, 2>;
29 using color_asc_t = std::integral_constant<type, 3>;
31 using mono_bin_t = std::integral_constant<type, 4>;
32 using gray_bin_t = std::integral_constant<type, 5>;
33 using color_bin_t = std::integral_constant<type, 6>;
36 /// Defines type for image width property.
37 struct pnm_image_width : property_base< uint32_t > {};
39 /// Defines type for image height property.
40 struct pnm_image_height : property_base< uint32_t > {};
42 /// Defines type for image max value property.
43 struct pnm_image_max_value : property_base< uint32_t > {};
45 /// Read information for pnm images.
47 /// The structure is returned when using read_image_info.
49 struct image_read_info< pnm_tag >
52 pnm_image_type::type _type;
54 pnm_image_width::type _width;
56 pnm_image_height::type _height;
57 /// The image max value.
58 pnm_image_max_value::type _max_value;
61 /// Read settings for pnm images.
63 /// The structure can be used for all read_xxx functions, except read_image_info.
65 struct image_read_settings< pnm_tag > : public image_read_settings_base
67 /// Default constructor
68 image_read_settings< pnm_tag >()
69 : image_read_settings_base()
73 /// \param top_left Top left coordinate for reading partial image.
74 /// \param dim Dimensions for reading partial image.
75 image_read_settings( const point_t& top_left
78 : image_read_settings_base( top_left
84 /// Write information for pnm images.
86 /// The structure can be used for write_view() function.
88 struct image_write_info< pnm_tag >