2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
4 * This file is part of CasparCG (www.casparcg.com).
6 * CasparCG is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * CasparCG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
19 * Author: Niklas P Andersson, niklas.p.andersson@svt.se
25 namespace caspar { namespace psd {
27 blend_mode int_to_blend_mode(std::uint32_t x)
29 blend_mode mode = static_cast<blend_mode>(x);
33 case blend_mode::Normal:
34 case blend_mode::Darken:
35 case blend_mode::Lighten:
37 case blend_mode::Saturation:
38 case blend_mode::Color:
39 case blend_mode::Luminosity:
40 case blend_mode::Multiply:
41 case blend_mode::Screen:
42 case blend_mode::Dissolve:
43 case blend_mode::Overlay:
44 case blend_mode::HardLight:
45 case blend_mode::SoftLight:
46 case blend_mode::Difference:
47 case blend_mode::Exclusion:
48 case blend_mode::ColorDodge:
49 case blend_mode::ColorBurn:
52 return blend_mode::InvalidBlendMode;
56 std::wstring blend_mode_to_string(blend_mode b)
60 case blend_mode::Normal: return L"Normal";
61 case blend_mode::Darken: return L"Darken";
62 case blend_mode::Lighten: return L"Lighten";
63 case blend_mode::Hue: return L"Hue";
64 case blend_mode::Saturation: return L"Saturation";
65 case blend_mode::Color: return L"Color";
66 case blend_mode::Luminosity: return L"Luminosity";
67 case blend_mode::Multiply: return L"Multiply";
68 case blend_mode::Screen: return L"Screen";
69 case blend_mode::Dissolve: return L"Dissolve";
70 case blend_mode::Overlay: return L"Overlay";
71 case blend_mode::HardLight: return L"HardLight";
72 case blend_mode::SoftLight: return L"SoftLight";
73 case blend_mode::Difference: return L"Difference";
74 case blend_mode::Exclusion: return L"Exclusion";
75 case blend_mode::ColorDodge: return L"ColorDodge";
76 case blend_mode::ColorBurn: return L"ColorBurn";
77 default: return L"Invalid";
81 color_mode int_to_color_mode(std::uint16_t x)
83 color_mode mode = static_cast<color_mode>(x);
87 case color_mode::Bitmap:
88 case color_mode::Grayscale:
89 case color_mode::Indexed:
91 case color_mode::CMYK:
92 case color_mode::Multichannel:
93 case color_mode::Duotone:
97 return color_mode::InvalidColorMode;
101 std::wstring color_mode_to_string(color_mode c)
105 case color_mode::Bitmap: return L"Bitmap";
106 case color_mode::Grayscale: return L"Grayscale";
107 case color_mode::Indexed: return L"Indexed";
108 case color_mode::RGB: return L"RGB";
109 case color_mode::CMYK: return L"CMYK";
110 case color_mode::Multichannel: return L"Multichannel";
111 case color_mode::Duotone: return L"Duotone";
112 case color_mode::Lab: return L"Lab";
113 default: return L"Invalid";