OpenShot Library | libopenshot  0.2.3
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 == "Bars")
45  return new Bars();
46 
47  if (effect_type == "Blur")
48  return new Blur();
49 
50  else if (effect_type == "Brightness")
51  return new Brightness();
52 
53  else if (effect_type == "ChromaKey")
54  return new ChromaKey();
55 
56  else if (effect_type == "Color Shift")
57  return new ColorShift();
58 
59  else if (effect_type == "Crop")
60  return new Crop();
61 
62  else if (effect_type == "Deinterlace")
63  return new Deinterlace();
64 
65  else if (effect_type == "Hue")
66  return new Hue();
67 
68  else if (effect_type == "Mask")
69  return new Mask();
70 
71  else if (effect_type == "Negate")
72  return new Negate();
73 
74  else if (effect_type == "Pixelate")
75  return new Pixelate();
76 
77  else if (effect_type == "Saturation")
78  return new Saturation();
79 
80  else if (effect_type == "Shift")
81  return new Shift();
82 
83  else if (effect_type == "Wave")
84  return new Wave();
85  return NULL;
86 }
87 
88 // Generate Json::JsonValue for this object
89 Json::Value EffectInfo::JsonValue() {
90 
91  // Create root json object
92  Json::Value root;
93 
94  // Append info JSON from each supported effect
95  root.append(Bars().JsonInfo());
96  root.append(Blur().JsonInfo());
97  root.append(Brightness().JsonInfo());
98  root.append(ChromaKey().JsonInfo());
99  root.append(ColorShift().JsonInfo());
100  root.append(Crop().JsonInfo());
101  root.append(Deinterlace().JsonInfo());
102  root.append(Hue().JsonInfo());
103  root.append(Mask().JsonInfo());
104  root.append(Negate().JsonInfo());
105  root.append(Pixelate().JsonInfo());
106  root.append(Saturation().JsonInfo());
107  root.append(Shift().JsonInfo());
108  root.append(Wave().JsonInfo());
109 
110  // return JsonValue
111  return root;
112 
113 }
This class pixelates an image, and can be animated with openshot::Keyframe curves over time...
Definition: Pixelate.h:52
This class crops a frame image (from any side), and can be animated with openshot::Keyframe curves ov...
Definition: Crop.h:53
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 shifts the pixels of an image up, down, left, or right, and can be animated with openshot:...
Definition: ColorShift.h:52
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:89
This class shifts the hue of an image, and can be animated with openshot::Keyframe curves over time...
Definition: Hue.h:51
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'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 class uses the ImageMagick++ libraries, to de-interlace the image, which removes the EVEN or ODD...
Definition: Deinterlace.h:56
This class distorts an image using a wave pattern.
Definition: Wave.h:51
This class draws black bars around your video (from any side), and can be animated with openshot::Key...
Definition: Bars.h:53
This class shifts the pixels of an image up, down, left, or right, and can be animated with openshot:...
Definition: Shift.h:52