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
26 #include <core/mixer/image/blend_modes.h>
\r
32 namespace caspar { namespace psd {
\r
34 template<typename T>
\r
37 point() : x(0), y(0) {}
\r
38 point(T x1, T y1) : x(x1), y(y1) {}
\r
42 void clear() { x = 0; y = 0; }
\r
44 bool operator==(const point& rhs) {
\r
45 return x == rhs.x && y == rhs.y;
\r
49 template<typename T>
\r
57 std::uint32_t to_uint32()
\r
59 return (alpha << 24) + (red << 16) + (green << 8) + blue;
\r
63 template<typename T>
\r
66 size() : width(0), height(0) {}
\r
67 size(T w, T h) : width(w), height(h) {}
\r
71 void clear() { width = 0; height = 0; }
\r
74 template<typename T>
\r
80 bool empty() const { return size.width == 0 || size.height == 0; }
\r
81 void clear() { location.clear(); size.clear(); }
\r
84 struct psd_file_format_exception : virtual caspar_exception {};
\r
86 enum class channel_type
\r
88 total_user_mask = -3,
\r
96 enum class layer_type
\r
103 layer_type int_to_layer_type(std::uint32_t x, std::uint32_t y);
\r
104 std::wstring layer_type_to_string(layer_type b);
\r
106 caspar::core::blend_mode int_to_blend_mode(std::uint32_t x);
\r
108 enum class color_mode
\r
110 InvalidColorMode = -1,
\r
121 color_mode int_to_color_mode(std::uint16_t x);
\r
122 std::wstring color_mode_to_string(color_mode c);
\r
125 enum class layer_tag : int {
\r
128 explicit_dynamic = 2,
\r
135 ENUM_ENABLE_BITWISE(layer_tag);
\r
137 /*inline layer_tag operator ~ (layer_tag rhs)
\r
139 return (layer_tag)(static_cast<int>(layer_tag::all) ^ static_cast<int>(rhs));
\r
142 layer_tag string_to_layer_tags(const std::wstring& str);
\r
145 } //namespace caspar
\r