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_EXTENSION_IO_PNG_TAGS_HPP
9 #define BOOST_GIL_EXTENSION_IO_PNG_TAGS_HPP
10 
11 #include <boost/gil/io/base.hpp>
12 
13 #include <string>
14 #include <vector>
15 
16 #ifdef BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED
17 #ifdef BOOST_GIL_IO_PNG_FIXED_POINT_SUPPORTED
18 # error "Cannot set both symbols"
19 #endif // BOOST_GIL_IO_PNG_FIXED_POINT_SUPPORTED
20 #endif // BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED
21 
22 #ifndef BOOST_GIL_EXTENSION_IO_PNG_C_LIB_COMPILED_AS_CPLUSPLUS
23     extern "C" {
24 #endif
25     #include <png.h>
26 #ifndef BOOST_GIL_EXTENSION_IO_PNG_C_LIB_COMPILED_AS_CPLUSPLUS
27     }
28 #endif
29 
30 #ifndef BOOST_GIL_EXTENSION_IO_ZLIB_C_LIB_COMPILED_AS_CPLUSPLUS
31     extern "C" {
32 #endif
33     #include <zlib.h>
34 #ifndef BOOST_GIL_EXTENSION_IO_ZLIB_C_LIB_COMPILED_AS_CPLUSPLUS
35     }
36 #endif
37 
38 #if PNG_LIBPNG_VER_MAJOR == 1
39 #if PNG_LIBPNG_VER_MINOR <= 4
40 #define BOOST_GIL_IO_PNG_1_4_OR_LOWER
41 #endif // PNG_LIBPNG_VER_MAJOR == 1
42 #endif // PNG_LIBPNG_VER_MINOR <= 4
43 
44 namespace boost { namespace gil {
45 
46 /// Defines png tag.
47 struct png_tag : format_tag {};
48 
49 /// see http://en.wikipedia.org/wiki/Portable_Network_Graphics for reference
50 
51 /// Defines type for image width property.
52 struct png_image_width : property_base< png_uint_32 > {};
53 
54 /// Defines type for image height property.
55 struct png_image_height : property_base< png_uint_32 > {};
56 
57 /// Defines type for interlace method property.
58 struct png_interlace_method : property_base< int > {};
59 
60 /// Defines type for filter method property.
61 struct png_filter_method : property_base< int > {};
62 
63 /// Defines type for bit depth method property.
64 struct png_bitdepth : property_base< int > {};
65 
66 /// Defines type for bit depth method property.
67 struct png_color_type : property_base< int > {};
68 
69 /// Defines type for number of channels property.
70 struct png_num_channels : property_base< png_byte > {};
71 
72 #ifdef BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED
73 
74     /// Defines type for CIE chromacities property.
75     struct png_chromacities_type : property_base< double > {};
76 
77     /// Defines type for gamma correction property.
78     struct png_gamma : property_base< double > {};
79 
80     /// Defines type for physical scale unit property.
81     struct png_unit  : property_base< int > {};
82 
83     /// Defines type for physical scale property.
84     struct png_scale : property_base< double > {};
85 
86 #else
87     /// Defines type for CIE chromacities property.
88     struct png_chromacities_type : property_base< png_fixed_point > {};
89 
90     /// Defines type for gamma correction property.
91     struct png_gamma : property_base< png_fixed_point > {};
92 
93     /// Defines type for physical scale unit property.
94     struct png_unit  : property_base< int > {};
95 
96 #ifdef BOOST_GIL_IO_PNG_FIXED_POINT_SUPPORTED
97     /// Defines type for physical scale property.
98     struct png_scale : property_base< png_fixed_point > {};
99 #else
100     /// Defines type for physical scale property.
101     struct png_scale : property_base< std::string > {};
102 #endif // BOOST_GIL_IO_PNG_FIXED_POINT_SUPPORTED
103 
104 #endif // BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED
105 
106 /// Returns image resolution in pixels per meter, from pHYs chunk data.
107 struct png_pixels_per_meter : property_base< png_uint_32 > {};
108 
109 /// Defines type for ICC profile name property.
110 struct png_ICC_name             : property_base< std::string > {};
111 /// Defines type for ICC profile property.
112 #if PNG_LIBPNG_VER_MINOR >= 5
113 struct png_ICC_profile          : property_base< std:: vector <uint8_t> > {};
114 #else
115 struct png_ICC_profile          : property_base< std:: vector <char> > {};
116 #endif
117 /// Defines type for ICC profile length property.
118 struct png_ICC_profile_length   : property_base< png_uint_32 > {};
119 /// Defines type for ICC compression property.
120 struct png_ICC_compression_type : property_base< int         > {};
121 
122 /// Defines type for rendering intent property.
123 struct png_intent : property_base< int > {};
124 
125 /// Defines type for color palette property.
126 struct png_color_palette : property_base< std::vector< png_color > > {};
127 /// Defines type for number of colors property.
128 struct png_num_palette   : property_base< int > {};
129 
130 /// Defines type for background property.
131 struct png_background : property_base< png_color_16 > {};
132 
133 /// Defines type for histogram property.
134 struct png_histrogram : property_base< std::vector< png_uint_16 > > {};
135 
136 /// Defines type for screen offset property.
137 struct png_offset      : property_base< png_int_32 > {};
138 /// Defines type for screen offset type property.
139 struct png_offset_type : property_base< int > {};
140 
141 /// Defines type pixel calibration for property.
142 struct png_CAL        : property_base< std::string > {};
143 /// Defines type for pixel calibration parameters property.
144 struct png_CAL_params : property_base< std::vector< std::string > > {};
145 /// Defines type for pixel calibration x property.
146 struct png_CAL_X      : property_base< png_int_32 > {};
147 /// Defines type for pixel calibration type property.
148 struct png_CAL_type   : property_base< int > {};
149 /// Defines type for number of pixel calibration properties.
150 struct png_CAL_nparam : property_base< int > {};
151 
152 /// Defines type for physical resolution property.
153 struct png_resolution : property_base< png_uint_32 > {};
154 /// Defines type for physical resolution unit property.
155 struct png_unit_type  : property_base< int > {};
156 
157 /// Defines type for significant bits property.
158 struct png_significant_bits : property_base< png_color_8 > {};
159 
160 /// Helper structure for reading text property.
161 struct gil_io_png_text
162 {
163     /// Compression type
164     int         _compression;
165     // Key
166     std::string _key;
167     /// Text
168     std::string _text;
169 };
170 
171 /// Defines type for text property.
172 struct png_text_    : property_base< std::vector< gil_io_png_text > > {};
173 /// Defines type for number of text property.
174 struct png_num_text : property_base< int > {};
175 
176 /// Defines type for modification time property.
177 struct png_mod_time : property_base< png_time > {};
178 
179 /// Defines type for transparency data property.
180 struct png_trans        : property_base< std::vector< png_byte > > {};
181 /// Defines type for number of transparency data property.
182 struct png_num_trans    : property_base< int > {};
183 /// Defines type for transparency data values property.
184 struct png_trans_values : property_base< std::vector< png_color_16 > > {};
185 
186 /// Defines type for png function return type.
187 struct png_return_value : property_base< png_uint_32 > {};
188 
189 ////////////////////////
190 // Write properties
191 ////////////////////////
192 
193 // relates to info_ptr->compression_type
194 struct png_compression_type : property_base< png_byte >
195 {
196     static const type default_value = PNG_COMPRESSION_TYPE_BASE;
197 };
198 
199 // compression level - default values taken from libpng manual.
200 // Look for png_set_compression_level
201 struct png_compression_level : property_base< int >
202 {
203     static const type default_value = 3;
204 };
205 
206 struct png_compression_mem_level : property_base< int >
207 {
208     static const type default_value = MAX_MEM_LEVEL;
209 };
210 
211 struct png_compression_strategy : property_base< int >
212 {
213     static const type default_value = Z_DEFAULT_STRATEGY;
214 };
215 
216 struct png_compression_window_bits : property_base< int >
217 {
218     static const type default_value = 9;
219 };
220 
221 struct png_compression_method : property_base< int >
222 {
223     static const type default_value = 8;
224 };
225 
226 struct png_compression_buffer_size : property_base< int >
227 {
228     static const type default_value = 8192;
229 };
230 
231 // dithering
232 struct png_dithering_palette : property_base< std::vector< png_color > >
233 {};
234 
235 struct png_dithering_num_palette : property_base< int >
236 {
237     static const type default_value = 0;
238 };
239 
240 struct png_dithering_maximum_colors : property_base< int >
241 {
242     static const type default_value = 0;
243 };
244 
245 struct png_dithering_histogram : property_base< std::vector< png_uint_16 > >
246 {};
247 
248 struct png_full_dither : property_base< int >
249 {
250     static const type default_value = 0;
251 };
252 
253 // filter
254 struct png_filter : property_base< int >
255 {
256     static const type default_value = 0;
257 };
258 
259 // invert mono
260 struct png_invert_mono : property_base< bool >
261 {
262     static const type default_value = false;
263 };
264 
265 // true bits
266 struct png_true_bits : property_base< std::vector< png_color_8 > >
267 {};
268 
269 // sRGB Intent
270 struct png_srgb_intent : property_base< int >
271 {
272     static const type default_value = 0;
273 };
274 
275 // strip alpha
276 struct png_strip_alpha : property_base< bool >
277 {
278     static const type default_value = false;
279 };
280 
281 struct png_swap_alpha : property_base< bool >
282 {
283     static const type default_value = false;
284 };
285 
286 
287 /// PNG info base class. Containing all header information both for reading and writing.
288 ///
289 /// This base structure was created to avoid code doubling.
290 struct png_info_base
291 {
292     /// Default constructor
293     png_info_base()
294     : _width ( 0 )
295     , _height( 0 )
296 
297     , _bit_depth         ( 0                            )
298     , _color_type        ( 0                            )
299     , _interlace_method  ( PNG_INTERLACE_NONE           )
300     , _compression_method( PNG_COMPRESSION_TYPE_DEFAULT )
301     , _filter_method     ( PNG_FILTER_TYPE_DEFAULT      )
302 
303     , _num_channels( 0 )
304 
305 #ifdef BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED
306     , _valid_cie_colors( 0   )
307     , _white_x         ( 0.0 )
308     , _white_y         ( 0.0 )
309     , _red_x           ( 0.0 )
310     , _red_y           ( 0.0 )
311     , _green_x         ( 0.0 )
312     , _green_y         ( 0.0 )
313     , _blue_x          ( 0.0 )
314     , _blue_y          ( 0.0 )
315 
316     , _valid_file_gamma( 0   )
317     , _file_gamma      ( 1.0 )
318 #else
319     , _valid_cie_colors( 0 )
320     , _white_x         ( 0 )
321     , _white_y         ( 0 )
322     , _red_x           ( 0 )
323     , _red_y           ( 0 )
324     , _green_x         ( 0 )
325     , _green_y         ( 0 )
326     , _blue_x          ( 0 )
327     , _blue_y          ( 0 )
328 
329     , _valid_file_gamma( 0 )
330     , _file_gamma      ( 1 )
331 #endif // BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED
332 
333     , _valid_icc_profile    ( 0                         )
334     , _icc_name             (                           )
335     , _iccp_compression_type( PNG_COMPRESSION_TYPE_BASE )
336     , _profile              (                           )
337     , _profile_length       ( 0                         )
338 
339     , _valid_intent( 0 )
340     , _intent      ( 0 )
341 
342     , _valid_palette( 0 )
343     , _palette      (   )
344     , _num_palette  ( 0 )
345 
346     , _valid_background( 0 )
347     , _background      (   )
348 
349     , _valid_histogram( 0 )
350     , _histogram      (   )
351 
352     , _valid_offset ( 0                )
353     , _offset_x     ( 0                )
354     , _offset_y     ( 0                )
355     , _off_unit_type( PNG_OFFSET_PIXEL )
356 
357     , _valid_pixel_calibration( 0 )
358     , _purpose                (   )
359     , _X0                     ( 0 )
360     , _X1                     ( 0 )
361     , _cal_type               ( 0 )
362     , _num_params             ( 0 )
363     , _units                  (   )
364     , _params                 (   )
365 
366     , _valid_resolution( 0                      )
367     , _res_x           ( 0                      )
368     , _res_y           ( 0                      )
369     , _phy_unit_type   ( PNG_RESOLUTION_UNKNOWN )
370 
371     , _pixels_per_meter( 0 )
372 
373     , _valid_significant_bits( 0 )
374     , _sig_bits              (   )
375 
376     , _valid_scale_factors( 0                 )
377     , _scale_unit         ( PNG_SCALE_UNKNOWN )
378 #ifdef BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED
379     , _scale_width ( 0.0 )
380     , _scale_height( 0.0 )
381 #else
382 #ifdef BOOST_GIL_IO_PNG_FIXED_POINT_SUPPORTED
383     , _scale_width ( 0 )
384     , _scale_height( 0 )
385 #else
386     , _scale_width ()
387     , _scale_height()
388 #endif // BOOST_GIL_IO_PNG_FIXED_POINT_SUPPORTED
389 #endif // BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED
390 
391     , _valid_text( 0 )
392     , _text      (   )
393     , _num_text  ( 0 )
394 
395     , _valid_modification_time( 0 )
396     , _mod_time               (   )
397 
398     , _valid_transparency_factors( 0 )
399     , _trans                     (   )
400     , _num_trans                 ( 0 )
401     , _trans_values              (   )
402     {}
403 
404     /// The image width.
405     png_image_width::type  _width;
406     /// The image height.
407     png_image_height::type _height;
408 
409     /// The bit depth per channel.
410     png_bitdepth::type           _bit_depth;
411     /// The color space type.
412     png_color_type::type         _color_type;
413     /// The interlace methos.
414     png_interlace_method::type   _interlace_method;
415     /// The compression method.
416     png_compression_method::type _compression_method;
417     /// The filer method.
418     png_filter_method::type      _filter_method;
419 
420     /// The number of channels.
421     png_num_channels::type _num_channels;
422 
423     // CIE chromacities
424     /// The return value when reading CIE chromacities.
425     png_return_value::type      _valid_cie_colors;
426     /// The white x value.
427     png_chromacities_type::type _white_x;
428     /// The white y value.
429     png_chromacities_type::type _white_y;
430     /// The red x value.
431     png_chromacities_type::type _red_x;
432     /// The red y value.
433     png_chromacities_type::type _red_y;
434     /// The green x value.
435     png_chromacities_type::type _green_x;
436     /// The green y value.
437     png_chromacities_type::type _green_y;
438     /// The blue x value.
439     png_chromacities_type::type _blue_x;
440     /// The blue y value.
441     png_chromacities_type::type _blue_y;
442 
443     // Gamma Value
444     /// The return value when reading gamma value.
445     png_return_value::type _valid_file_gamma;
446     /// The file gamma value.
447     png_gamma::type        _file_gamma;
448 
449     // Embedded ICC profile
450     /// The return value when reading ICC profile.
451     png_return_value::type         _valid_icc_profile;
452     /// The ICC name.
453     png_ICC_name::type             _icc_name;
454     /// The icc compression type.
455     png_ICC_compression_type::type _iccp_compression_type;
456     /// The ICC profile.
457     png_ICC_profile::type          _profile;
458     /// The ICC profile length.
459     png_ICC_profile_length::type   _profile_length;
460 
461     // Rendering intent
462     /// The return value when reading rendering intent.
463     png_return_value::type _valid_intent;
464     /// The rendering intent value.
465     png_intent::type       _intent;
466 
467     // Image palette
468     /// The return value when reading image palette.
469     png_return_value::type  _valid_palette;
470     /// The color palette.
471     png_color_palette::type _palette;
472     /// The number of colors in the palettes.
473     png_num_palette::type   _num_palette;
474 
475     // Background
476     /// The return value when reading background.
477     png_return_value::type _valid_background;
478     /// The background color.
479     png_background::type   _background;
480 
481     // Histogram
482     /// The return value when reading histogram.
483     png_return_value::type _valid_histogram;
484     /// The histogram.
485     png_histrogram::type   _histogram;
486 
487     // Screen offsets
488     /// The return value when reading screen offsets.
489     png_return_value::type _valid_offset;
490     /// The x offset.
491     png_offset::type       _offset_x;
492     /// The y offset.
493     png_offset::type       _offset_y;
494     /// The offset unit.
495     png_offset_type::type  _off_unit_type;
496 
497     // Pixel Calibration
498     /// The return value when reading pixel calibration.
499     png_return_value::type _valid_pixel_calibration;
500     /// The purpose.
501     png_CAL::type          _purpose;
502     /// The x_0 value.
503     png_CAL_X::type        _X0;
504     /// The x_1 value.
505     png_CAL_X::type        _X1;
506     /// The calibration type.
507     png_CAL_type::type     _cal_type;
508     /// The number of calibration parameters.
509     png_CAL_nparam::type   _num_params;
510     /// The calibration unit type.
511     png_CAL::type          _units;
512     /// The calibration parameters.
513     png_CAL_params::type   _params;
514 
515     // Physical resolution
516     /// The return value when reading physical resolution properties.
517     png_return_value::type _valid_resolution;
518     /// The x physical resolution.
519     png_resolution::type   _res_x;
520     /// The y physical resolution.
521     png_resolution::type   _res_y;
522     /// The physical resolution unit.
523     png_unit_type::type    _phy_unit_type;
524 
525     /// The Image resolution in pixels per meter.
526     png_pixels_per_meter::type _pixels_per_meter;
527 
528     // Number of significant bits
529     /// The return value when reading significant bits.
530     png_return_value::type     _valid_significant_bits;
531     /// The significant bits.
532     png_significant_bits::type _sig_bits;
533 
534     // Scale Factors
535     /// The return value when reading scale factors.
536     png_return_value::type _valid_scale_factors;
537     /// The scaling unit.
538     png_unit::type         _scale_unit;
539     /// The scaling width.
540     png_scale::type        _scale_width;
541     /// The scaling height.
542     png_scale::type        _scale_height;
543 
544     // Comments information
545     /// The return value when reading image comments.
546     png_return_value::type _valid_text;
547     /// The comments.
548     png_text_::type        _text;
549     /// The number of comments.
550     png_num_text::type     _num_text;
551 
552     // Last modification time
553     /// The return value when reading modification time.
554     png_return_value::type _valid_modification_time;
555     /// The modification time.
556     png_mod_time::type     _mod_time;
557 
558     // Transparency data
559     /// The return value when reading transparency data.
560     png_return_value::type _valid_transparency_factors;
561     /// The transparency data.
562     png_trans::type        _trans;
563     /// The number of transparency data.
564     png_num_trans::type    _num_trans;
565     /// The transparency data values.
566     png_trans_values::type _trans_values;
567 };
568 
569 /// Read information for png images.
570 ///
571 /// The structure is returned when using read_image_info.
572 template<>
573 struct image_read_info< png_tag > : public png_info_base
574 {
575     /// Default constructor.
576     image_read_info< png_tag >()
577     : png_info_base()
578     {}
579 };
580 
581 /// PNG settings base class.
582 ///
583 /// This base structure was created to avoid code doubling.
584 struct png_read_settings_base
585 {
586     /// Default Constructor.
587     png_read_settings_base()
588     {
589         _read_cie_chromacities           = false;
590         _read_file_gamma                 = false;
591         _read_icc_profile                = false;
592         _read_intent                     = false;
593         _read_palette                    = false;
594         _read_background                 = false;
595         _read_histogram                  = false;
596         _read_screen_offsets             = false;
597         _read_pixel_calibration          = false;
598         _read_physical_resolution        = false;
599         _read_pixels_per_meter           = false;
600         _read_number_of_significant_bits = false;
601         _read_scale_factors              = false;
602         _read_comments                   = false;
603         _read_last_modification_time     = false;
604         _read_transparency_data          = false;
605     }
606 
607     /// Helper function to enabling reading all png properties.
608     void set_read_members_true()
609     {
610         _read_cie_chromacities           = true;
611         _read_file_gamma                 = true;
612         _read_icc_profile                = true;
613         _read_intent                     = true;
614         _read_palette                    = true;
615         _read_background                 = true;
616         _read_histogram                  = true;
617         _read_screen_offsets             = true;
618         _read_pixel_calibration          = true;
619         _read_physical_resolution        = true;
620         _read_pixels_per_meter           = true;
621         _read_number_of_significant_bits = true;
622         _read_scale_factors              = true;
623         _read_comments                   = true;
624         _read_last_modification_time     = true;
625         _read_transparency_data          = true;
626     }
627 
628     /// Enable reading CIE chromacities.
629     bool _read_cie_chromacities;
630     /// Enable reading file gamma.
631     bool _read_file_gamma;
632     /// Enable reading ICC profile.
633     bool _read_icc_profile;
634     /// Enable reading rendering intent.
635     bool _read_intent;
636     /// Enable reading color palette.
637     bool _read_palette;
638     /// Enable reading background color.
639     bool _read_background;
640     /// Enable reading histogram.
641     bool _read_histogram;
642     /// Enable reading screen offsets.
643     bool _read_screen_offsets;
644     /// Enable reading pixel calibration.
645     bool _read_pixel_calibration;
646     /// Enable reading physical resolution.
647     bool _read_physical_resolution;
648     /// Enable reading pixels per meter information.
649     bool _read_pixels_per_meter;
650     /// Enable reading significant bits.
651     bool _read_number_of_significant_bits;
652     /// Enable reading scaling factors.
653     bool _read_scale_factors;
654     /// Enable reading comments.
655     bool _read_comments;
656     /// Enable reading modification time.
657     bool _read_last_modification_time;
658     /// Enable reading transparency data.
659     bool _read_transparency_data;
660 };
661 
662 #ifdef BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED
663 
664 /// Read settings for png images.
665 ///
666 /// The structure can be used for all read_xxx functions, except read_image_info.
667 template<>
668 struct image_read_settings< png_tag > : public image_read_settings_base
669                                       , public png_read_settings_base
670 {
671     /// Default Constructor
672     image_read_settings< png_tag >()
673     : image_read_settings_base()
674     , png_read_settings_base()
675     , _screen_gamma( 1.0 )
676     {}
677 
678     /// Constructor
679     /// \param top_left Top left coordinate for reading partial image.
680     /// \param dim      Dimensions for reading partial image.
681     /// \param gamma    Screen gamma value.
682     image_read_settings( const point_t&         top_left
683                        , const point_t&         dim
684                        , const bool             apply_screen_gamma = false
685                        , const png_gamma::type& screen_gamma = 1.0
686                        )
687     : image_read_settings_base( top_left
688                               , dim
689                               )
690     , png_read_settings_base()
691     , _apply_screen_gamma( apply_screen_gamma )
692     , _screen_gamma( screen_gamma )
693     {}
694 
695     /// Apply screen gamma value.
696     bool            _apply_screen_gamma;
697     /// The screen gamma value.
698     png_gamma::type _screen_gamma;
699 };
700 
701 #else
702 
703 /// Read settings for png images.
704 ///
705 /// The structure can be used for all read_xxx functions, except read_image_info.
706 template<>
707 struct image_read_settings< png_tag > : public image_read_settings_base
708                                       , public png_read_settings_base
709 {
710     /// Default Constructor.
711     image_read_settings< png_tag >()
712     : image_read_settings_base()
713     , png_read_settings_base()
714     , _apply_screen_gamma( false )
715     , _screen_gamma      ( 2     )
716     {}
717 
718     image_read_settings( const point_t& top_left
719                        , const point_t& dim
720                        )
721     : image_read_settings_base( top_left
722                               , dim
723                               )
724     , png_read_settings_base()
725     , _apply_screen_gamma( false )
726     , _screen_gamma      ( 2     )
727     {}
728 
729     /// Apply screen gamma value.
730     bool            _apply_screen_gamma;
731     /// The screen gamma value.
732     png_gamma::type _screen_gamma;
733 };
734 #endif
735 
736 /// Write information for png images.
737 ///
738 /// The structure can be used for write_view() function.
739 template<>
740 struct image_write_info< png_tag >  : public png_info_base
741 {
742     image_write_info( const png_compression_type::type         compression_type        = png_compression_type::default_value
743                     , const png_compression_level::type        compression_level       = png_compression_level::default_value
744                     , const png_compression_mem_level::type    compression_mem_level   = png_compression_mem_level::default_value
745                     , const png_compression_strategy::type     compression_strategy    = png_compression_strategy::default_value
746                     , const png_compression_window_bits::type  compression_window_bits = png_compression_window_bits::default_value
747                     , const png_compression_method::type       compression_method      = png_compression_method::default_value
748                     , const png_compression_buffer_size::type  compression_buffer_size = png_compression_buffer_size::default_value
749                     , const png_dithering_num_palette::type    num_palette             = png_dithering_num_palette::default_value
750                     , const png_dithering_maximum_colors::type maximum_colors          = png_dithering_maximum_colors::default_value
751                     , const png_full_dither::type              full_dither             = png_full_dither::default_value
752                     , const png_filter::type                   filter                  = png_filter::default_value
753                     , const png_invert_mono::type              invert_mono             = png_invert_mono::default_value
754                     , const png_srgb_intent::type              srgb_intent             = png_srgb_intent::default_value
755                     , const png_strip_alpha::type              strip_alpha             = png_strip_alpha::default_value
756                     , const png_swap_alpha::type               swap_alpha              = png_swap_alpha::default_value
757                     )
758     : png_info_base()
759     , _compression_type( compression_type )
760     , _compression_level( compression_level )
761     , _compression_mem_level( compression_mem_level )
762     , _compression_strategy( compression_strategy )
763     , _compression_window_bits( compression_window_bits )
764     , _compression_method( compression_method )
765     , _compression_buffer_size( compression_buffer_size )
766 
767     , _set_dithering( false )
768     , _dithering_palette()
769     , _dithering_num_palette( num_palette )
770     , _dithering_maximum_colors( maximum_colors )
771     , _dithering_histogram()
772     , _full_dither( full_dither )
773 
774     , _set_filter( false )
775     , _filter( filter )
776 
777     , _invert_mono( invert_mono )
778 
779     , _set_true_bits( false )
780     , _true_bits()
781 
782     , _set_srgb_intent( false )
783     , _srgb_intent( srgb_intent )
784 
785     , _strip_alpha( strip_alpha )
786 
787     , _swap_alpha( swap_alpha )
788     {}
789 
790     // compression stuff
791     png_compression_type::type        _compression_type;
792     png_compression_level::type       _compression_level;
793     png_compression_mem_level::type   _compression_mem_level;
794     png_compression_strategy::type    _compression_strategy;
795     png_compression_window_bits::type _compression_window_bits;
796     png_compression_method::type      _compression_method;
797     png_compression_buffer_size::type _compression_buffer_size;
798 
799     // png_set_dither
800     bool                                _set_dithering;
801     png_dithering_palette::type         _dithering_palette;
802     png_dithering_num_palette::type     _dithering_num_palette;
803     png_dithering_maximum_colors::type  _dithering_maximum_colors;
804     png_dithering_histogram::type       _dithering_histogram;
805     png_full_dither::type               _full_dither;
806 
807     //png_set_filter
808     bool _set_filter;
809     png_filter::type _filter;
810 
811     // png_set_invert_mono
812     png_invert_mono::type _invert_mono;
813 
814     // png_set_sBIT
815     bool _set_true_bits;
816     png_true_bits::type _true_bits;
817 
818     // png_set_sRGB
819     bool _set_srgb_intent;
820     png_srgb_intent::type _srgb_intent;
821 
822     // png_set_strip_alpha
823     png_strip_alpha::type _strip_alpha;
824 
825     // png_set_swap_alpha
826     png_swap_alpha::type _swap_alpha;
827 
828 };
829 
830 } // namespace gil
831 } // namespace boost
832 
833 #endif
834