OpenShot Library | libopenshot  0.3.2
ChromaKey.h
Go to the documentation of this file.
1 
9 // Copyright (c) 2008-2019 OpenShot Studios, LLC
10 //
11 // SPDX-License-Identifier: LGPL-3.0-or-later
12 
13 #ifndef OPENSHOT_CHROMAKEY_EFFECT_H
14 #define OPENSHOT_CHROMAKEY_EFFECT_H
15 
16 #include "../EffectBase.h"
17 
18 #include "../Color.h"
19 #include "../Frame.h"
20 #include "../Exceptions.h"
21 #include "../KeyFrame.h"
22 #include "../Enums.h"
23 
24 #include <memory>
25 #include <string>
26 
27 namespace openshot
28 {
29 
36  class ChromaKey : public EffectBase
37  {
38  private:
39  Color color;
40  Keyframe fuzz;
41  Keyframe halo;
42  ChromaKeyMethod method;
43 
45  void init_effect_details();
46 
47  public:
48 
50  ChromaKey();
51 
79  ChromaKey(Color color, Keyframe fuzz, Keyframe halo = 0.0, ChromaKeyMethod method = CHROMAKEY_BASIC);
80 
87  std::shared_ptr<openshot::Frame> GetFrame(int64_t frame_number) override { return GetFrame(std::make_shared<openshot::Frame>(), frame_number); }
88 
98  std::shared_ptr<openshot::Frame> GetFrame(std::shared_ptr<openshot::Frame> frame, int64_t frame_number) override;
99 
100  // Get and Set JSON methods
101  std::string Json() const override;
102  void SetJson(const std::string value) override;
103  Json::Value JsonValue() const override;
104  void SetJsonValue(const Json::Value root) override;
105 
106  // Get all properties for a specific frame
107  std::string PropertiesJSON(int64_t requested_frame) const override;
108  };
109 
110 }
111 
112 #endif
openshot::EffectBase
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:53
openshot::ChromaKey::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition: ChromaKey.cpp:556
openshot::CHROMAKEY_BASIC
@ CHROMAKEY_BASIC
Length of difference between RGB vectors.
Definition: Enums.h:122
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28
openshot::ChromaKeyMethod
ChromaKeyMethod
This enumeration determines the algorithm used by the ChromaKey filter.
Definition: Enums.h:120
openshot::ChromaKey
This class removes (i.e. keys out) a color (i.e. greenscreen)
Definition: ChromaKey.h:36
openshot::Color
This class represents a color (used on the timeline and clips)
Definition: Color.h:27
openshot::Keyframe
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
Definition: KeyFrame.h:53
openshot::ChromaKey::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition: ChromaKey.cpp:524
openshot::ChromaKey::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition: ChromaKey.cpp:539
openshot::ChromaKey::Json
std::string Json() const override
Generate JSON string of this object.
Definition: ChromaKey.cpp:517
openshot::ChromaKey::GetFrame
std::shared_ptr< openshot::Frame > GetFrame(int64_t frame_number) override
This method is required for all derived classes of ClipBase, and returns a new openshot::Frame object...
Definition: ChromaKey.h:87
openshot::ChromaKey::ChromaKey
ChromaKey()
Blank constructor, useful when using Json to load the effect properties.
Definition: ChromaKey.cpp:25
openshot::ChromaKey::PropertiesJSON
std::string PropertiesJSON(int64_t requested_frame) const override
Definition: ChromaKey.cpp:573