png_output_description.h Source File - ClanLib SDK
Description: png_output_description.h Source File

png_output_description.h
1/*
2** ClanLib SDK
3** Copyright (c) 1997-2020 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
34namespace clan
35{
38
39 class FileSystem;
40 class PNGOutputDescription_Impl;
41 class DateTime;
42
43 enum PNGColorType
44 {
45 png_color_type_gray,
46 png_color_type_gray_alpha,
47 png_color_type_palette,
48 png_color_type_rgb,
49 png_color_type_rgb_alpha,
50 png_color_mask_palette,
51 png_color_mask_color,
52 png_color_mask_alpha
53 };
54
55 enum PNGInterlaceType
56 {
57 png_interlace_none,
58 png_interlace_adam7
59 };
60
61 enum PNGFilterMethod
62 {
63 png_filter_type_default,
64 png_intrapixel_differencing
65 };
66
67 enum PNGsRGBIntent
68 {
69 png_srgb_intent_saturation,
70 png_srgb_intent_perceptual,
71 png_srgb_intent_absolute,
72 png_srgb_intent_relative
73 };
74
75 enum PNGUnknownChunkLocation
76 {
77 png_before_plte,
78 png_before_idat,
79 png_after_idat
80 };
81
82 enum PNGOffsetUnitType
83 {
84 png_offset_pixel,
85 png_offset_micrometer
86 };
87
88 enum PNGResolutionUnitType
89 {
90 png_resolution_unknown,
91 png_resolution_meter
92 };
93
94
95 class PNGOutputDescriptionPalette
96 {
97 public:
98 PNGOutputDescriptionPalette();
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
112 class PNGOutputDescription
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);
138 void set_interlace_type(PNGInterlaceType type);
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}
clan::Color
Color description class.
Definition color.h:46
clan::DataBuffer
General purpose data buffer.
Definition databuffer.h:42
clan::DateTime
Date/Time class.
Definition datetime.h:42
clan::FileSystem
Virtual File System (VFS).
Definition file_system.h:47
clan::PNGOutputDescriptionPalette
Definition png_output_description.h:96
clan::PNGOutputDescriptionPalette::set_colors
void set_colors(const std::vector< Color > &palette_colors)
clan::PNGOutputDescriptionPalette::set_tranparent_color_indexes
void set_tranparent_color_indexes(const std::vector< int > &alpha_indexes)
clan::PNGOutputDescriptionPalette::set_key_color
void set_key_color(const Color &color)
clan::PNGOutputDescriptionPalette::PNGOutputDescriptionPalette
PNGOutputDescriptionPalette()
clan::PNGOutputDescription::set_modification_time
void set_modification_time(const DateTime &datetime)
clan::PNGOutputDescription::add_unknown_chunk
void add_unknown_chunk(const std::string &name, const DataBuffer &chunk_data, PNGUnknownChunkLocation location)
clan::PNGOutputDescription::set_significant_bits
void set_significant_bits(int num_bits)
clan::PNGOutputDescription::set_chromacities_XYZ
void set_chromacities_XYZ(const Vec3f &red, const Vec3f &green, const Vec3f &blue)
clan::PNGOutputDescription::set_icc_profile
void set_icc_profile(const std::string &profile_name, const DataBuffer &profile_data)
clan::PNGOutputDescription::PNGOutputDescription
PNGOutputDescription(int bit_depth=8, PNGColorType color_type=png_color_type_rgb_alpha)
Create output description.
clan::PNGOutputDescription::add_palette
void add_palette(const PNGOutputDescriptionPalette &palette)
clan::PNGOutputDescription::set_interlace_type
void set_interlace_type(PNGInterlaceType type)
clan::PNGOutputDescription::set_key_color
void set_key_color(const Color &color)
clan::PNGOutputDescription::set_chromacities
void set_chromacities(const Vec2f &white, const Vec2f &red, const Vec2f &green, const Vec2f &blue)
clan::PNGOutputDescription::set_filter_method
void set_filter_method(PNGFilterMethod filter)
clan::PNGOutputDescription::set_gamma
void set_gamma(float gamma)
clan::PNGOutputDescription::set_srgb_intent
void set_srgb_intent(PNGsRGBIntent intent)
clan::PNGOutputDescription::set_physical_resolution
void set_physical_resolution(const Vec2i &resolution, PNGResolutionUnitType resolution_type)
clan::PNGOutputDescription::set_background_color
void set_background_color(const Color &background_color)
clan::PNGOutputDescription::set_offset_from_screen_topleft
void set_offset_from_screen_topleft(const Vec2i &offset, PNGOffsetUnitType offset_unit_type)
clan::PNGOutputDescription::set_physical_scale
void set_physical_scale(int scale_units, const Sized &pixel_size_in_scale_units)
clan::PNGOutputDescription::add_comment
void add_comment(const std::string &comment, std::string &keyword, const std::string &lang, const std::string &translated_keyword)
clan::Sized
2D (width,height) size structure - Double
Definition size.h:202
clan::Vec3f
Vec3< float > Vec3f
Definition vec3.h:347
clan::Vec2i
Vec2< int > Vec2i
Definition vec2.h:356
clan::Vec2f
Vec2< float > Vec2f
Definition vec2.h:357
clan::PNGUnknownChunkLocation
PNGUnknownChunkLocation
Definition png_output_description.h:76
clan::PNGsRGBIntent
PNGsRGBIntent
Definition png_output_description.h:68
clan::PNGOffsetUnitType
PNGOffsetUnitType
Definition png_output_description.h:83
clan::PNGInterlaceType
PNGInterlaceType
Definition png_output_description.h:56
clan::PNGFilterMethod
PNGFilterMethod
Definition png_output_description.h:62
clan::PNGColorType
PNGColorType
Definition png_output_description.h:44
clan::PNGResolutionUnitType
PNGResolutionUnitType
Definition png_output_description.h:89
clan::png_after_idat
@ png_after_idat
Definition png_output_description.h:79
clan::png_before_plte
@ png_before_plte
Definition png_output_description.h:77
clan::png_before_idat
@ png_before_idat
Definition png_output_description.h:78
clan::png_srgb_intent_relative
@ png_srgb_intent_relative
Definition png_output_description.h:72
clan::png_srgb_intent_absolute
@ png_srgb_intent_absolute
Definition png_output_description.h:71
clan::png_srgb_intent_saturation
@ png_srgb_intent_saturation
Definition png_output_description.h:69
clan::png_srgb_intent_perceptual
@ png_srgb_intent_perceptual
Definition png_output_description.h:70
clan::png_offset_micrometer
@ png_offset_micrometer
Definition png_output_description.h:85
clan::png_offset_pixel
@ png_offset_pixel
Definition png_output_description.h:84
clan::png_interlace_none
@ png_interlace_none
Definition png_output_description.h:57
clan::png_interlace_adam7
@ png_interlace_adam7
Definition png_output_description.h:58
clan::png_intrapixel_differencing
@ png_intrapixel_differencing
Definition png_output_description.h:64
clan::png_filter_type_default
@ png_filter_type_default
Definition png_output_description.h:63
clan::png_color_mask_alpha
@ png_color_mask_alpha
Definition png_output_description.h:52
clan::png_color_mask_color
@ png_color_mask_color
Definition png_output_description.h:51
clan::png_color_type_gray
@ png_color_type_gray
Definition png_output_description.h:45
clan::png_color_type_rgb
@ png_color_type_rgb
Definition png_output_description.h:48
clan::png_color_type_rgb_alpha
@ png_color_type_rgb_alpha
Definition png_output_description.h:49
clan::png_color_type_palette
@ png_color_type_palette
Definition png_output_description.h:47
clan::png_color_mask_palette
@ png_color_mask_palette
Definition png_output_description.h:50
clan::png_color_type_gray_alpha
@ png_color_type_gray_alpha
Definition png_output_description.h:46
clan::png_resolution_meter
@ png_resolution_meter
Definition png_output_description.h:91
clan::png_resolution_unknown
@ png_resolution_unknown
Definition png_output_description.h:90
clan
Definition clanapp.h:36
clan::StyleValueType::color
@ color
value is an url
Definition style_value_type.h:43
clan::StyleValueType::resolution
@ resolution
value is a frequency
Definition style_value_type.h:47
clan::StyleValueType::keyword
@ keyword
value undefined
Definition style_value_type.h:37
clan::StyleTokenType::comment
@ comment
Whitespace.
Definition style_token.h:60