]> git.sesse.net Git - casparcg/blob - core/mixer/image/blend_modes.cpp
set svn:eol-style native on .h and .cpp files
[casparcg] / core / mixer / image / blend_modes.cpp
1 /*
2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
3 *
4 * This file is part of CasparCG (www.casparcg.com).
5 *
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.
10 *
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.
15 *
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/>.
18 *
19 * Author: Robert Nagy, ronag89@gmail.com
20 */
21
22 #include "../../StdAfx.h"
23
24 #include "blend_modes.h"
25
26 #include <boost/algorithm/string.hpp>
27
28 namespace caspar { namespace core {
29                 
30 blend_mode get_blend_mode(const std::wstring& str)
31 {
32         if(boost::iequals(str, L"normal"))
33                 return blend_mode::normal;
34         else if(boost::iequals(str, L"lighten"))
35                 return blend_mode::lighten;
36         else if(boost::iequals(str, L"darken"))
37                 return blend_mode::darken;
38         else if(boost::iequals(str, L"multiply"))
39                 return blend_mode::multiply;
40         else if(boost::iequals(str, L"average"))
41                 return blend_mode::average;
42         else if(boost::iequals(str, L"add"))
43                 return blend_mode::add;
44         else if(boost::iequals(str, L"subtract"))
45                 return blend_mode::subtract;
46         else if(boost::iequals(str, L"difference"))
47                 return blend_mode::difference;
48         else if(boost::iequals(str, L"negation"))
49                 return blend_mode::negation;
50         else if(boost::iequals(str, L"exclusion"))
51                 return blend_mode::exclusion;
52         else if(boost::iequals(str, L"screen"))
53                 return blend_mode::screen;
54         else if(boost::iequals(str, L"overlay"))
55                 return blend_mode::overlay;
56         else if(boost::iequals(str, L"soft_light"))
57                 return blend_mode::soft_light;
58         else if(boost::iequals(str, L"hard_light"))
59                 return blend_mode::hard_light;
60         else if(boost::iequals(str, L"color_dodge"))
61                 return blend_mode::color_dodge;
62         else if(boost::iequals(str, L"color_burn"))
63                 return blend_mode::color_burn;
64         else if(boost::iequals(str, L"linear_dodge"))
65                 return blend_mode::linear_dodge;
66         else if(boost::iequals(str, L"linear_burn"))
67                 return blend_mode::linear_burn;
68         else if(boost::iequals(str, L"linear_light"))
69                 return blend_mode::linear_light;
70         else if(boost::iequals(str, L"vivid_light"))
71                 return blend_mode::vivid_light;
72         else if(boost::iequals(str, L"pin_light"))
73                 return blend_mode::pin_light;
74         else if(boost::iequals(str, L"hard_mix"))
75                 return blend_mode::hard_mix;
76         else if(boost::iequals(str, L"reflect"))
77                 return blend_mode::reflect;
78         else if(boost::iequals(str, L"glow"))
79                 return blend_mode::glow;
80         else if(boost::iequals(str, L"phoenix"))
81                 return blend_mode::phoenix;
82         else if(boost::iequals(str, L"contrast"))
83                 return blend_mode::contrast;
84         else if(boost::iequals(str, L"saturation"))
85                 return blend_mode::saturation;
86         else if(boost::iequals(str, L"color"))
87                 return blend_mode::color;
88         else if(boost::iequals(str, L"luminosity"))
89                 return blend_mode::luminosity;
90                 
91         return blend_mode::normal;
92 }
93
94 }}