2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
\r
4 * This file is part of CasparCG (www.casparcg.com).
\r
6 * CasparCG is free software: you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation, either version 3 of the License, or
\r
9 * (at your option) any later version.
\r
11 * CasparCG is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
\r
19 * Author: Niklas P Andersson, niklas.p.andersson@svt.se
\r
24 #include <common/except.h>
\r
25 #include <common/enum_class.h>
\r
30 namespace caspar { namespace psd {
\r
32 template<typename T>
\r
35 point() : x(0), y(0) {}
\r
36 point(T x1, T y1) : x(x1), y(y1) {}
\r
40 void clear() { x = 0; y = 0; }
\r
43 template<typename T>
\r
51 std::uint32_t to_uint32()
\r
53 return (alpha << 24) + (red << 16) + (green << 8) + blue;
\r
57 template<typename T>
\r
60 size() : width(0), height(0) {}
\r
61 size(T w, T h) : width(w), height(h) {}
\r
65 void clear() { width = 0; height = 0; }
\r
68 template<typename T>
\r
74 bool empty() const { return size.width == 0 || size.height == 0; }
\r
75 void clear() { location.clear(); size.clear(); }
\r
78 struct psd_file_format_exception : virtual caspar_exception {};
\r
80 enum class channel_type
\r
82 total_user_mask = -3,
\r
90 enum class layer_type
\r
97 layer_type int_to_layer_type(std::uint32_t x, std::uint32_t y);
\r
98 std::wstring layer_type_to_string(layer_type b);
\r
100 enum class blend_mode
\r
102 InvalidBlendMode = -1,
\r
107 Saturation = 'sat ',
\r
109 Luminosity = 'lum ',
\r
114 HardLight = 'hLit',
\r
115 SoftLight = 'sLit',
\r
116 Difference = 'diff',
\r
117 Exclusion = 'smud',
\r
118 ColorDodge = 'div ',
\r
122 blend_mode int_to_blend_mode(std::uint32_t x);
\r
123 std::wstring blend_mode_to_string(blend_mode b);
\r
125 enum class color_mode
\r
127 InvalidColorMode = -1,
\r
138 color_mode int_to_color_mode(std::uint16_t x);
\r
139 std::wstring color_mode_to_string(color_mode c);
\r
142 enum class layer_tag : int {
\r
145 explicit_dynamic = 2,
\r
152 ENUM_ENABLE_BITWISE(layer_tag);
\r
154 inline layer_tag operator ~ (layer_tag rhs)
\r
156 return (layer_tag)(static_cast<int>(layer_tag::all) ^ static_cast<int>(rhs));
\r
159 layer_tag string_to_layer_tags(const std::wstring& str);
\r
162 } //namespace caspar
\r