OpenShot Library | libopenshot  0.1.9
EffectInfo.cpp
Go to the documentation of this file.
1 /**
2  * @file
3  * @brief Source file for EffectInfo class
4  * @author Jonathan Thomas <jonathan@openshot.org>
5  *
6  * @section LICENSE
7  *
8  * Copyright (c) 2008-2014 OpenShot Studios, LLC
9  * <http://www.openshotstudios.com/>. This file is part of
10  * OpenShot Library (libopenshot), an open-source project dedicated to
11  * delivering high quality video editing and animation solutions to the
12  * world. For more information visit <http://www.openshot.org/>.
13  *
14  * OpenShot Library (libopenshot) is free software: you can redistribute it
15  * and/or modify it under the terms of the GNU Lesser General Public License
16  * as published by the Free Software Foundation, either version 3 of the
17  * License, or (at your option) any later version.
18  *
19  * OpenShot Library (libopenshot) is distributed in the hope that it will be
20  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public License
25  * along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
26  */
27 
28 #include "../include/EffectInfo.h"
29 
30 
31 using namespace openshot;
32 
33 
34 // Generate JSON string of this object
35 string EffectInfo::Json() {
36 
37  // Return formatted string
38  return JsonValue().toStyledString();
39 }
40 
41 // Create a new effect instance
42 EffectBase* EffectInfo::CreateEffect(string effect_type) {
43  // Init the matching effect object
44  if (effect_type == "Blur")
45  return new Blur();
46 
47  else if (effect_type == "Brightness")
48  return new Brightness();
49 
50  else if (effect_type == "ChromaKey")
51  return new ChromaKey();
52 
53  else if (effect_type == "Deinterlace")
54  return new Deinterlace();
55 
56  else if (effect_type == "Mask")
57  return new Mask();
58 
59  else if (effect_type == "Negate")
60  return new Negate();
61 
62  else if (effect_type == "Saturation")
63  return new Saturation();
64 }
65 
66 // Generate Json::JsonValue for this object
67 Json::Value EffectInfo::JsonValue() {
68 
69  // Create root json object
70  Json::Value root;
71 
72  // Append info JSON from each supported effect
73  root.append(Blur().JsonInfo());
74  root.append(Brightness().JsonInfo());
75  root.append(ChromaKey().JsonInfo());
76  root.append(Deinterlace().JsonInfo());
77  root.append(Mask().JsonInfo());
78  root.append(Negate().JsonInfo());
79  root.append(Saturation().JsonInfo());
80 
81  // return JsonValue
82  return root;
83 
84 }
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:66
EffectBase * CreateEffect(string effect_type)
Definition: EffectInfo.cpp:42
This class adjusts the blur of an image, and can be animated with openshot::Keyframe curves over time...
Definition: Blur.h:62
This class uses the ImageMagick++ libraries, to remove (i.e. key out) a color (i.e. greenscreen)
Definition: ChromaKey.h:54
static string Json()
JSON methods.
Definition: EffectInfo.cpp:35
static Json::Value JsonValue()
Generate Json::JsonValue for this object.
Definition: EffectInfo.cpp:67
This class uses the ImageMagick++ libraries, to negate image (i.e. negative)
Definition: Negate.h:53
This class adjusts the saturation of color on a frame&#39;s image.
Definition: Saturation.h:59
This class uses the ImageMagick++ libraries, to apply alpha (or transparency) masks to any frame...
Definition: Mask.h:63
This class adjusts the brightness and contrast of an image, and can be animated with openshot::Keyfra...
Definition: Brightness.h:59
This namespace is the default namespace for all code in the openshot library.
This class uses the ImageMagick++ libraries, to de-interlace the image, which removes the EVEN or ODD...
Definition: Deinterlace.h:56