png_output_description.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2016 The ClanLib 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 ClanLib 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/IOData/file_system.h"
33 
34 namespace clan
35 {
38 
39  class FileSystem;
40  class PNGOutputDescription_Impl;
41  class DateTime;
42 
44  {
53  };
54 
56  {
59  };
60 
62  {
65  };
66 
68  {
73  };
74 
76  {
80  };
81 
83  {
86  };
87 
89  {
92  };
93 
94 
96  {
97  public:
99 
100  public:
101  void set_colors(const std::vector<Color> &palette_colors);
102  void set_key_color(const Color &color);
103  void set_tranparent_color_indexes(const std::vector<int> &alpha_indexes);
104 
105  private:
106  std::vector<Color> colors;
107  bool use_keycolor;
108  };
109 
110 
113  {
114  public:
119  PNGOutputDescription(int bit_depth = 8, PNGColorType color_type = png_color_type_rgb_alpha);
120 
121  void add_palette(const PNGOutputDescriptionPalette &palette);
122 
123  void add_comment(
124  const std::string &comment,
125  std::string &keyword, // max 79 characters.
126  const std::string &lang,
127  const std::string &translated_keyword);
128 
129  void add_unknown_chunk(const std::string &name, const DataBuffer &chunk_data, PNGUnknownChunkLocation location);
130 
131  void set_background_color(const Color &background_color);
132  void set_chromacities(const Vec2f &white, const Vec2f &red, const Vec2f &green, const Vec2f &blue);
133  void set_chromacities_XYZ(const Vec3f &red, const Vec3f &green, const Vec3f &blue);
134  void set_key_color(const Color &color);
135  void set_filter_method(PNGFilterMethod filter);
136  void set_gamma(float gamma);
137  void set_icc_profile(const std::string &profile_name, const DataBuffer &profile_data);
139  void set_modification_time(const DateTime &datetime);
140  void set_offset_from_screen_topleft(const Vec2i &offset, PNGOffsetUnitType offset_unit_type);
141  void set_physical_resolution(const Vec2i &resolution, PNGResolutionUnitType resolution_type);
142  void set_physical_scale(int scale_units, const Sized &pixel_size_in_scale_units);
143  void set_srgb_intent(PNGsRGBIntent intent);
144  void set_significant_bits(int num_bits);
145 
146  private:
147  std::shared_ptr<PNGOutputDescription_Impl> impl;
148  };
149 
151 }
PNGOffsetUnitType
Definition: png_output_description.h:82
void set_background_color(const Color &background_color)
Definition: clanapp.h:35
PNGOutputDescription(int bit_depth=8, PNGColorType color_type=png_color_type_rgb_alpha)
Create output description.
void add_unknown_chunk(const std::string &name, const DataBuffer &chunk_data, PNGUnknownChunkLocation location)
PNGUnknownChunkLocation
Definition: png_output_description.h:75
void add_comment(const std::string &comment, std::string &keyword, const std::string &lang, const std::string &translated_keyword)
Definition: png_output_description.h:91
Definition: png_output_description.h:45
Date/Time class.
Definition: datetime.h:41
void set_modification_time(const DateTime &datetime)
Definition: png_output_description.h:57
void set_physical_resolution(const Vec2i &resolution, PNGResolutionUnitType resolution_type)
Definition: png_output_description.h:47
Definition: png_output_description.h:71
PNGFilterMethod
Definition: png_output_description.h:61
void set_srgb_intent(PNGsRGBIntent intent)
Definition: png_output_description.h:78
void set_filter_method(PNGFilterMethod filter)
Set PNG output options. Used with PNGProvider::save().
Definition: png_output_description.h:112
void set_chromacities_XYZ(const Vec3f &red, const Vec3f &green, const Vec3f &blue)
Definition: png_output_description.h:90
void set_offset_from_screen_topleft(const Vec2i &offset, PNGOffsetUnitType offset_unit_type)
Definition: png_output_description.h:63
void set_key_color(const Color &color)
void set_significant_bits(int num_bits)
void set_tranparent_color_indexes(const std::vector< int > &alpha_indexes)
2D (width,height) size structure - Double
Definition: size.h:196
Definition: png_output_description.h:85
PNGInterlaceType
Definition: png_output_description.h:55
Definition: png_output_description.h:50
void set_key_color(const Color &color)
PNGResolutionUnitType
Definition: png_output_description.h:88
Definition: png_output_description.h:72
void set_interlace_type(PNGInterlaceType type)
PNGColorType
Definition: png_output_description.h:43
PNGsRGBIntent
Definition: png_output_description.h:67
Definition: png_output_description.h:51
void set_colors(const std::vector< Color > &palette_colors)
Definition: png_output_description.h:84
Definition: png_output_description.h:58
Definition: png_output_description.h:49
void set_chromacities(const Vec2f &white, const Vec2f &red, const Vec2f &green, const Vec2f &blue)
Definition: png_output_description.h:70
Definition: png_output_description.h:77
void set_gamma(float gamma)
void set_physical_scale(int scale_units, const Sized &pixel_size_in_scale_units)
Definition: png_output_description.h:64
Definition: png_output_description.h:79
Definition: png_output_description.h:46
Definition: png_output_description.h:95
Definition: png_output_description.h:69
General purpose data buffer.
Definition: databuffer.h:41
void add_palette(const PNGOutputDescriptionPalette &palette)
Definition: png_output_description.h:48
Definition: png_output_description.h:52
void set_icc_profile(const std::string &profile_name, const DataBuffer &profile_data)
Color description class.
Definition: color.h:45