OpenShot Library | libopenshot 0.3.3
Loading...
Searching...
No Matches
Mask.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_MASK_EFFECT_H
14#define OPENSHOT_MASK_EFFECT_H
15
16#include "../EffectBase.h"
17
18#include "../Json.h"
19#include "../KeyFrame.h"
20
21#include <string>
22#include <memory>
23
24namespace openshot
25{
26 // Forward declaration
27 class ReaderBase;
28
36 class Mask : public EffectBase
37 {
38 private:
39 ReaderBase *reader;
40 std::shared_ptr<QImage> original_mask;
41 bool needs_refresh;
42
44 void init_effect_details();
45
46 public:
50
52 Mask();
53
61 Mask(ReaderBase *mask_reader, Keyframe mask_brightness, Keyframe mask_contrast);
62
69 std::shared_ptr<openshot::Frame> GetFrame(int64_t frame_number) override { return GetFrame(std::make_shared<openshot::Frame>(), frame_number); }
70
80 std::shared_ptr<openshot::Frame> GetFrame(std::shared_ptr<openshot::Frame> frame, int64_t frame_number) override;
81
82 // Get and Set JSON methods
83 std::string Json() const override;
84 void SetJson(const std::string value) override;
85 Json::Value JsonValue() const override;
86 void SetJsonValue(const Json::Value root) override;
87
90 std::string PropertiesJSON(int64_t requested_frame) const override;
91
93 ReaderBase* Reader() { return reader; };
94
96 void Reader(ReaderBase *new_reader) { reader = new_reader; };
97 };
98
99}
100
101#endif
This abstract class is the base class, used by all effects in libopenshot.
Definition EffectBase.h:54
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
Definition KeyFrame.h:53
This class uses the image libraries to apply alpha (or transparency) masks to any frame....
Definition Mask.h:37
ReaderBase * Reader()
Get the reader object of the mask grayscale image.
Definition Mask.h:93
void SetJson(const std::string value) override
Load JSON string into this object.
Definition Mask.cpp:171
Mask()
Blank constructor, useful when using Json to load the effect properties.
Definition Mask.cpp:29
bool replace_image
Replace the frame image with a grayscale image representing the mask. Great for debugging a mask.
Definition Mask.h:47
Keyframe brightness
Brightness keyframe to control the wipe / mask effect. A constant value here will prevent animation.
Definition Mask.h:48
std::string PropertiesJSON(int64_t requested_frame) const override
Definition Mask.cpp:255
void Reader(ReaderBase *new_reader)
Set a new reader to be used by the mask effect (grayscale image)
Definition Mask.h:96
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition Mask.cpp:153
std::string Json() const override
Generate JSON string of this object.
Definition Mask.cpp:146
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition Mask.cpp:188
Keyframe contrast
Contrast keyframe to control the hardness of the wipe effect / mask.
Definition Mask.h:49
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 Mask.h:69
This abstract class is the base class, used by all readers in libopenshot.
Definition ReaderBase.h:76
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29