OpenShot Library | libopenshot  0.2.7
Hue.h
Go to the documentation of this file.
1 /**
2  * @file
3  * @brief Header file for Hue effect 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 #ifndef OPENSHOT_HUE_EFFECT_H
32 #define OPENSHOT_HUE_EFFECT_H
33 
34 #include "../EffectBase.h"
35 
36 #include "../Frame.h"
37 #include "../Json.h"
38 #include "../KeyFrame.h"
39 
40 #include <string>
41 #include <memory>
42 
43 
44 namespace openshot
45 {
46 
47  /**
48  * @brief This class shifts the hue of an image, and can be animated with openshot::Keyframe curves over time.
49  *
50  * Shifting hue can adjust the colors in an image towards red, blue, green, or anywhere in between. Animating hue
51  * can create some fun and interesting effects, but can also be used to change the mood of a scene, etc...
52  */
53  class Hue : public EffectBase
54  {
55  private:
56  /// Init effect settings
57  void init_effect_details();
58 
59 
60  public:
61  Keyframe hue; ///< Shift the hue coordinates (left or right)
62 
63  /// Default constructor, useful when using Json to load the effect properties
64  Hue();
65 
66  /// Constructor which takes 1 curve. The curves will shift the hue of the image.
67  ///
68  /// @param hue The curve to adjust the hue shift (between 0 and 1)
69  Hue(Keyframe hue);
70 
71  /// @brief This method is required for all derived classes of ClipBase, and returns a
72  /// new openshot::Frame object. All Clip keyframes and effects are resolved into
73  /// pixels.
74  ///
75  /// @returns A new openshot::Frame object
76  /// @param frame_number The frame number (starting at 1) of the clip or effect on the timeline.
77  std::shared_ptr<openshot::Frame> GetFrame(int64_t frame_number) override { return GetFrame(std::make_shared<openshot::Frame>(), frame_number); }
78 
79  /// @brief This method is required for all derived classes of ClipBase, and returns a
80  /// modified openshot::Frame object
81  ///
82  /// The frame object is passed into this method and used as a starting point (pixels and audio).
83  /// All Clip keyframes and effects are resolved into pixels.
84  ///
85  /// @returns The modified openshot::Frame object
86  /// @param frame The frame object that needs the clip or effect applied to it
87  /// @param frame_number The frame number (starting at 1) of the clip or effect on the timeline.
88  std::shared_ptr<openshot::Frame> GetFrame(std::shared_ptr<openshot::Frame> frame, int64_t frame_number) override;
89 
90  // Get and Set JSON methods
91  std::string Json() const override; ///< Generate JSON string of this object
92  void SetJson(const std::string value) override; ///< Load JSON string into this object
93  Json::Value JsonValue() const override; ///< Generate Json::Value for this object
94  void SetJsonValue(const Json::Value root) override; ///< Load Json::Value into this object
95 
96  /// Get all properties for a specific frame (perfect for a UI to display the current state
97  /// of all properties at any time)
98  std::string PropertiesJSON(int64_t requested_frame) const override;
99  };
100 
101 }
102 
103 #endif
Keyframe hue
Shift the hue coordinates (left or right)
Definition: Hue.h:61
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:70
std::string PropertiesJSON(int64_t requested_frame) const override
Definition: Hue.cpp:153
void SetJson(const std::string value) override
Load JSON string into this object.
Definition: Hue.cpp:125
Hue()
Default constructor, useful when using Json to load the effect properties.
Definition: Hue.cpp:37
This class shifts the hue of an image, and can be animated with openshot::Keyframe curves over time...
Definition: Hue.h:53
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition: Hue.cpp:113
std::string Json() const override
Generate JSON string of this object.
Definition: Hue.cpp:106
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:46
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: Hue.h:77
A Keyframe is a collection of Point instances, which is used to vary a number or property over time...
Definition: KeyFrame.h:72
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition: Hue.cpp:142