OpenShot Library | libopenshot  0.2.6
Negate.h
Go to the documentation of this file.
1 /**
2  * @file
3  * @brief Header file for Negate 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_NEGATE_EFFECT_H
32 #define OPENSHOT_NEGATE_EFFECT_H
33 
34 #include "../EffectBase.h"
35 
36 #include "../Frame.h"
37 #include "../KeyFrame.h"
38 
39 #include <memory>
40 #include <string>
41 
42 #include <QImage>
43 
44 namespace openshot
45 {
46 
47  /**
48  * @brief This class uses the ImageMagick++ libraries, to negate image (i.e. negative)
49  *
50  * This produces a common negative effect popular in photography.
51  */
52  class Negate : public EffectBase
53  {
54  public:
55 
56  /// Default constructor
57  Negate();
58 
59  /// @brief This method is required for all derived classes of ClipBase, and returns a
60  /// new openshot::Frame object. All Clip keyframes and effects are resolved into
61  /// pixels.
62  ///
63  /// @returns A new openshot::Frame object
64  /// @param frame_number The frame number (starting at 1) of the clip or effect on the timeline.
65  std::shared_ptr<openshot::Frame> GetFrame(int64_t frame_number) override { return GetFrame(std::make_shared<openshot::Frame>(), frame_number); }
66 
67  /// @brief This method is required for all derived classes of ClipBase, and returns a
68  /// modified openshot::Frame object
69  ///
70  /// The frame object is passed into this method and used as a starting point (pixels and audio).
71  /// All Clip keyframes and effects are resolved into pixels.
72  ///
73  /// @returns The modified openshot::Frame object
74  /// @param frame The frame object that needs the clip or effect applied to it
75  /// @param frame_number The frame number (starting at 1) of the clip or effect on the timeline.
76  std::shared_ptr<openshot::Frame> GetFrame(std::shared_ptr<openshot::Frame> frame, int64_t frame_number) override;
77 
78  // Get and Set JSON methods
79  std::string Json() const override; ///< Generate JSON string of this object
80  void SetJson(const std::string value) override; ///< Load JSON string into this object
81  Json::Value JsonValue() const override; ///< Generate Json::Value for this object
82  void SetJsonValue(const Json::Value root) override; ///< Load Json::Value into this object
83 
84  // Get all properties for a specific frame
85  std::string PropertiesJSON(int64_t requested_frame) const override;
86  };
87 
88 }
89 
90 #endif
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:70
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition: Negate.cpp:97
std::string PropertiesJSON(int64_t requested_frame) const override
Definition: Negate.cpp:105
This class uses the ImageMagick++ libraries, to negate image (i.e. negative)
Definition: Negate.h:52
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition: Negate.cpp:69
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: Negate.h:65
Negate()
Default constructor.
Definition: Negate.cpp:37
void SetJson(const std::string value) override
Load JSON string into this object.
Definition: Negate.cpp:80
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:46
std::string Json() const override
Generate JSON string of this object.
Definition: Negate.cpp:62