2 // Copyright 2013 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_RAW_TAGS_HPP
9 #define BOOST_GIL_EXTENSION_IO_RAW_TAGS_HPP
11 #include <boost/gil/io/base.hpp>
13 // Historically, LibRaw expects WIN32, not _WIN32 (see https://github.com/LibRaw/LibRaw/pull/206)
19 #pragma warning(disable:4251) // 'type' needs to have dll-interface to be used by clients of class
22 #include <libraw/libraw.h>
24 namespace boost { namespace gil {
27 struct raw_tag : format_tag {};
29 /// Defines type for image width property.
30 struct raw_image_width : property_base< int32_t > {};
32 /// Defines type for image height property.
33 struct raw_image_height : property_base< int32_t > {};
35 /// Defines type for samples per pixel property.
36 struct raw_samples_per_pixel : property_base< int32_t > {};
38 /// Defines type for bits per pixel property.
39 struct raw_bits_per_pixel : property_base< int32_t > {};
41 /// Defines type for camera manufacturer.
42 struct raw_camera_manufacturer : property_base< std::string > {};
44 /// Defines type for camera model.
45 struct raw_camera_model : property_base< std::string > {};
47 /// Defines type for raw images count.
48 struct raw_raw_images_count : property_base< unsigned > {};
50 /// Defines type for dng version.
51 struct raw_dng_version : property_base< unsigned > {};
53 /// Defines type for number of colors.
54 struct raw_number_colors : property_base< int32_t > {};
56 /// Defines type for colors description.
57 struct raw_colors_description : property_base< std::string > {};
59 /// Defines type for raw height.
60 struct raw_raw_height : property_base< uint16_t > {};
62 /// Defines type for raw width.
63 struct raw_raw_width : property_base< uint16_t > {};
65 /// Defines type for visible height.
66 struct raw_visible_height : property_base< uint16_t > {};
68 /// Defines type for visible width.
69 struct raw_visible_width : property_base< uint16_t > {};
71 /// Defines type for top margin.
72 struct raw_top_margin : property_base< uint16_t > {};
74 /// Defines type for left margin.
75 struct raw_left_margin : property_base< uint16_t > {};
77 /// Defines type for output height.
78 struct raw_output_height : property_base< uint16_t > {};
80 /// Defines type for output width.
81 struct raw_output_width : property_base< uint16_t > {};
83 /// Defines type for pixel aspect.
84 struct raw_pixel_aspect : property_base< double > {};
86 /// Defines type for image orientation.
87 struct raw_flip : property_base< uint32_t > {};
89 /// Defines type for iso speed.
90 struct raw_iso_speed : property_base< float > {};
92 /// Defines type for shutter.
93 struct raw_shutter : property_base< float > {};
95 /// Defines type for aperture.
96 struct raw_aperture : property_base< float > {};
98 /// Defines type for focal length.
99 struct raw_focal_length : property_base< float > {};
101 /// Defines type for timestamp.
102 struct raw_timestamp : property_base< time_t > {};
104 /// Defines type for shot order.
105 struct raw_shot_order : property_base< uint16_t > {};
107 /// Defines type for image description.
108 struct raw_image_description : property_base< std::string > {};
110 /// Defines type for artist.
111 struct raw_artist : property_base< std::string > {};
113 /// Defines type for libraw version.
114 struct raw_libraw_version : property_base< std::string > {};
116 /// Defines type for unpack function name.
117 struct raw_unpack_function_name : property_base< std::string > {};
119 /// Read information for raw images.
121 /// The structure is returned when using read_image_info.
123 struct image_read_info< raw_tag >
125 /// Default contructor.
126 image_read_info< raw_tag >()
130 // Here, width and height of the image are the ones of the output height (ie after having been processed by dcraw emulator)
131 raw_image_width::type _width;
132 raw_image_height::type _height;
133 raw_samples_per_pixel::type _samples_per_pixel;
134 raw_bits_per_pixel::type _bits_per_pixel;
136 raw_camera_manufacturer::type _camera_manufacturer;
137 raw_camera_model::type _camera_model;
139 raw_raw_images_count::type _raw_images_count;
140 raw_dng_version::type _dng_version;
141 raw_number_colors::type _number_colors;
142 raw_colors_description::type _colors_description;
144 raw_raw_width::type _raw_width;
145 raw_raw_height::type _raw_height;
146 raw_visible_width::type _visible_width;
147 raw_visible_height::type _visible_height;
148 raw_top_margin::type _top_margin;
149 raw_left_margin::type _left_margin;
150 raw_output_width::type _output_width;
151 raw_output_height::type _output_height;
152 raw_pixel_aspect::type _pixel_aspect;
153 raw_flip::type _flip;
155 raw_iso_speed::type _iso_speed;
156 raw_shutter::type _shutter;
157 raw_aperture::type _aperture;
158 raw_focal_length::type _focal_length;
159 raw_timestamp::type _timestamp;
160 raw_shot_order::type _shot_order;
161 raw_image_description::type _image_description;
162 raw_artist::type _artist;
164 raw_libraw_version::type _libraw_version;
165 raw_unpack_function_name::type _unpack_function_name;
167 /// Used internaly to identify if the header has been read.
171 /// Read settings for raw images.
173 /// The structure can be used for all read_xxx functions, except read_image_info.
175 struct image_read_settings< raw_tag > : public image_read_settings_base
177 /// Default constructor
178 image_read_settings()
179 : image_read_settings_base()
183 /// \param top_left Top left coordinate for reading partial image.
184 /// \param dim Dimensions for reading partial image.
185 image_read_settings( const point_t& top_left
188 : image_read_settings_base( top_left
194 /// Write information for raw images.
196 /// The structure can be used for write_view() function.
198 struct image_write_info< raw_tag >
202 }} // namespace boost::gil