OpenShot Library | libopenshot  0.2.5
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  * @ref License
7  */
8 
9 /* LICENSE
10  *
11  * Copyright (c) 2008-2019 OpenShot Studios, LLC
12  * <http://www.openshotstudios.com/>. This file is part of
13  * OpenShot Library (libopenshot), an open-source project dedicated to
14  * delivering high quality video editing and animation solutions to the
15  * world. For more information visit <http://www.openshot.org/>.
16  *
17  * OpenShot Library (libopenshot) is free software: you can redistribute it
18  * and/or modify it under the terms of the GNU Lesser General Public License
19  * as published by the Free Software Foundation, either version 3 of the
20  * License, or (at your option) any later version.
21  *
22  * OpenShot Library (libopenshot) is distributed in the hope that it will be
23  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU Lesser General Public License for more details.
26  *
27  * You should have received a copy of the GNU Lesser General Public License
28  * along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
29  */
30 
31 #include "../include/EffectInfo.h"
32 
33 
34 using namespace openshot;
35 
36 
37 // Generate JSON string of this object
38 std::string EffectInfo::Json() {
39 
40  // Return formatted string
41  return JsonValue().toStyledString();
42 }
43 
44 // Create a new effect instance
45 EffectBase* EffectInfo::CreateEffect(std::string effect_type) {
46  // Init the matching effect object
47  if (effect_type == "Bars")
48  return new Bars();
49 
50  if (effect_type == "Blur")
51  return new Blur();
52 
53  else if (effect_type == "Brightness")
54  return new Brightness();
55 
56  else if (effect_type == "ChromaKey")
57  return new ChromaKey();
58 
59  else if (effect_type == "ColorShift")
60  return new ColorShift();
61 
62  else if (effect_type == "Crop")
63  return new Crop();
64 
65  else if (effect_type == "Deinterlace")
66  return new Deinterlace();
67 
68  else if (effect_type == "Hue")
69  return new Hue();
70 
71  else if (effect_type == "Mask")
72  return new Mask();
73 
74  else if (effect_type == "Negate")
75  return new Negate();
76 
77  else if (effect_type == "Pixelate")
78  return new Pixelate();
79 
80  else if (effect_type == "Saturation")
81  return new Saturation();
82 
83  else if (effect_type == "Shift")
84  return new Shift();
85 
86  else if (effect_type == "Wave")
87  return new Wave();
88  return NULL;
89 }
90 
91 // Generate Json::Value for this object
92 Json::Value EffectInfo::JsonValue() {
93 
94  // Create root json object
95  Json::Value root;
96 
97  // Append info JSON from each supported effect
98  root.append(Bars().JsonInfo());
99  root.append(Blur().JsonInfo());
100  root.append(Brightness().JsonInfo());
101  root.append(ChromaKey().JsonInfo());
102  root.append(ColorShift().JsonInfo());
103  root.append(Crop().JsonInfo());
104  root.append(Deinterlace().JsonInfo());
105  root.append(Hue().JsonInfo());
106  root.append(Mask().JsonInfo());
107  root.append(Negate().JsonInfo());
108  root.append(Pixelate().JsonInfo());
109  root.append(Saturation().JsonInfo());
110  root.append(Shift().JsonInfo());
111  root.append(Wave().JsonInfo());
112 
113  // return JsonValue
114  return root;
115 
116 }
This class draws black bars around your video (from any side), and can be animated with openshot::Key...
Definition: Bars.h:55
This class adjusts the blur of an image, and can be animated with openshot::Keyframe curves over time...
Definition: Blur.h:64
This class adjusts the brightness and contrast of an image, and can be animated with openshot::Keyfra...
Definition: Brightness.h:61
This class uses the ImageMagick++ libraries, to remove (i.e. key out) a color (i.e....
Definition: ChromaKey.h:56
This class shifts the pixels of an image up, down, left, or right, and can be animated with openshot:...
Definition: ColorShift.h:54
This class crops a frame image (from any side), and can be animated with openshot::Keyframe curves ov...
Definition: Crop.h:55
This class uses the ImageMagick++ libraries, to de-interlace the image, which removes the EVEN or ODD...
Definition: Deinterlace.h:58
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:67
static Json::Value JsonValue()
Generate Json::Value for this object.
Definition: EffectInfo.cpp:92
static std::string Json()
JSON methods.
Definition: EffectInfo.cpp:38
EffectBase * CreateEffect(std::string effect_type)
Definition: EffectInfo.cpp:45
This class shifts the hue of an image, and can be animated with openshot::Keyframe curves over time.
Definition: Hue.h:53
This class uses the image libraries to apply alpha (or transparency) masks to any frame....
Definition: Mask.h:66
This class uses the ImageMagick++ libraries, to negate image (i.e. negative)
Definition: Negate.h:55
This class pixelates an image, and can be animated with openshot::Keyframe curves over time.
Definition: Pixelate.h:54
This class adjusts the saturation of color on a frame's image.
Definition: Saturation.h:61
This class shifts the pixels of an image up, down, left, or right, and can be animated with openshot:...
Definition: Shift.h:54
This class distorts an image using a wave pattern.
Definition: Wave.h:53
This namespace is the default namespace for all code in the openshot library.