png_output_description.h
1 /*
2 ** UICore
3 ** Copyright (c) 1997-2015 The UICore Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries UICore may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Harry Storbacka
27 */
28 
29 #pragma once
30 
31 #include "../Image/pixel_buffer.h"
32 #include "../../Core/System/databuffer.h"
33 
34 namespace uicore
35 {
36  class PNGOutputDescription_Impl;
37  class DateTime;
38 
40  {
49  };
50 
52  {
55  };
56 
58  {
61  };
62 
64  {
69  };
70 
72  {
76  };
77 
79  {
82  };
83 
85  {
88  };
89 
90 
92  {
93  public:
95 
96  public:
97  void set_colors(const std::vector<Color> &palette_colors);
98  void set_key_color(const Color &color);
99  void set_tranparent_color_indexes(const std::vector<int> &alpha_indexes);
100 
101  private:
102  std::vector<Color> colors;
103  bool use_keycolor;
104  };
105 
106 
109  {
110  public:
115  PNGOutputDescription(int bit_depth = 8, PNGColorType color_type = png_color_type_rgb_alpha);
116 
117  void add_palette(const PNGOutputDescriptionPalette &palette);
118 
119  void add_comment(
120  const std::string &comment,
121  std::string &keyword, // max 79 characters.
122  const std::string &lang,
123  const std::string &translated_keyword);
124 
125  void add_unknown_chunk(const std::string &name, const DataBufferPtr &chunk_data, PNGUnknownChunkLocation location);
126 
127  void set_background_color(const Color &background_color);
128  void set_chromacities(const Vec2f &white, const Vec2f &red, const Vec2f &green, const Vec2f &blue);
129  void set_chromacities_XYZ(const Vec3f &red, const Vec3f &green, const Vec3f &blue);
130  void set_key_color(const Color &color);
131  void set_filter_method(PNGFilterMethod filter);
132  void set_gamma(float gamma);
133  void set_icc_profile(const std::string &profile_name, const DataBufferPtr &profile_data);
135  void set_modification_time(const DateTime &datetime);
136  void set_offset_from_screen_topleft(const Vec2i &offset, PNGOffsetUnitType offset_unit_type);
137  void set_physical_resolution(const Vec2i &resolution, PNGResolutionUnitType resolution_type);
138  void set_physical_scale(int scale_units, const Sized &pixel_size_in_scale_units);
139  void set_srgb_intent(PNGsRGBIntent intent);
140  void set_significant_bits(int num_bits);
141 
142  private:
143  std::shared_ptr<PNGOutputDescription_Impl> impl;
144  };
145 }
Definition: png_output_description.h:42
Definition: png_output_description.h:66
void set_filter_method(PNGFilterMethod filter)
2D (width,height) size structure - Double
Definition: size.h:193
Definition: png_output_description.h:60
Definition: png_output_description.h:41
Definition: png_output_description.h:45
Definition: png_output_description.h:80
Definition: png_output_description.h:44
void set_chromacities(const Vec2f &white, const Vec2f &red, const Vec2f &green, const Vec2f &blue)
void add_comment(const std::string &comment, std::string &keyword, const std::string &lang, const std::string &translated_keyword)
void set_key_color(const Color &color)
Set PNG output options. Used with PNGFormat::save().
Definition: png_output_description.h:108
void add_unknown_chunk(const std::string &name, const DataBufferPtr &chunk_data, PNGUnknownChunkLocation location)
void set_physical_resolution(const Vec2i &resolution, PNGResolutionUnitType resolution_type)
Definition: png_output_description.h:47
void set_srgb_intent(PNGsRGBIntent intent)
Color description class.
Definition: color.h:42
void set_physical_scale(int scale_units, const Sized &pixel_size_in_scale_units)
Definition: png_output_description.h:59
Definition: png_output_description.h:48
PNGInterlaceType
Definition: png_output_description.h:51
Definition: png_output_description.h:73
Definition: png_output_description.h:68
PNGUnknownChunkLocation
Definition: png_output_description.h:71
Definition: png_output_description.h:46
PNGsRGBIntent
Definition: png_output_description.h:63
void set_icc_profile(const std::string &profile_name, const DataBufferPtr &profile_data)
void set_significant_bits(int num_bits)
Definition: png_output_description.h:91
Definition: png_output_description.h:86
void add_palette(const PNGOutputDescriptionPalette &palette)
Definition: png_output_description.h:53
void set_colors(const std::vector< Color > &palette_colors)
void set_modification_time(const DateTime &datetime)
PNGOffsetUnitType
Definition: png_output_description.h:78
void set_chromacities_XYZ(const Vec3f &red, const Vec3f &green, const Vec3f &blue)
Definition: png_output_description.h:74
void set_background_color(const Color &background_color)
Definition: png_output_description.h:87
void set_interlace_type(PNGInterlaceType type)
void set_offset_from_screen_topleft(const Vec2i &offset, PNGOffsetUnitType offset_unit_type)
Definition: png_output_description.h:65
PNGColorType
Definition: png_output_description.h:39
Definition: png_output_description.h:54
Definition: png_output_description.h:43
std::shared_ptr< DataBuffer > DataBufferPtr
Definition: databuffer.h:66
PNGOutputDescription(int bit_depth=8, PNGColorType color_type=png_color_type_rgb_alpha)
Create output description.
PNGResolutionUnitType
Definition: png_output_description.h:84
void set_tranparent_color_indexes(const std::vector< int > &alpha_indexes)
void set_key_color(const Color &color)
Definition: png_output_description.h:75
Definition: Application/application.h:35
Definition: png_output_description.h:81
void set_gamma(float gamma)
Date/Time class.
Definition: datetime.h:38
PNGFilterMethod
Definition: png_output_description.h:57
Definition: png_output_description.h:67