OpenShot Library | libopenshot 0.6.0
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:
40 void init_effect_details();
41
42 protected:
43 bool HandlesMaskInternally() const override { return true; }
44
45 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 MaskReader(); };
94
96 void Reader(ReaderBase *new_reader);
97 };
98
99}
100
101#endif
This abstract class is the base class, used by all effects in libopenshot.
Definition EffectBase.h:57
ReaderBase * MaskReader()
Get the common mask reader.
Definition EffectBase.h:175
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:190
Mask()
Blank constructor, useful when using Json to load the effect properties.
Definition Mask.cpp:24
bool replace_image
Replace the frame image with a grayscale image representing the mask. Great for debugging a mask.
Definition Mask.h:46
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:229
bool HandlesMaskInternally() const override
Optional override for effects that apply mask processing inside GetFrame().
Definition Mask.h:43
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition Mask.cpp:175
std::string Json() const override
Generate JSON string of this object.
Definition Mask.cpp:168
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition Mask.cpp:207
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
bool fade_audio_hint
Timeline-only hint requesting equal-power audio crossfade for overlapping clips when this Mask is use...
Definition Mask.h:47
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