Loading...
Searching...
No Matches
Mask.h
Go to the documentation of this file.
// Copyright (c) 2008-2019 OpenShot Studios, LLC
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#ifndef OPENSHOT_MASK_EFFECT_H
#define OPENSHOT_MASK_EFFECT_H
#include "../EffectBase.h"
#include "../Json.h"
#include "../KeyFrame.h"
#include <string>
#include <memory>
namespace openshot
{
// Forward declaration
class ReaderBase;
class Mask : public EffectBase
{
private:
ReaderBase *reader;
std::shared_ptr<QImage> original_mask;
bool needs_refresh;
void init_effect_details();
public:
bool replace_image;
Keyframe brightness;
Keyframe contrast;
Mask();
Mask(ReaderBase *mask_reader, Keyframe mask_brightness, Keyframe mask_contrast);
std::shared_ptr<openshot::Frame> GetFrame(int64_t frame_number) override { return GetFrame(std::make_shared<openshot::Frame>(), frame_number); }
std::shared_ptr<openshot::Frame> GetFrame(std::shared_ptr<openshot::Frame> frame, int64_t frame_number) override;
// Get and Set JSON methods
std::string Json() const override;
void SetJson(const std::string value) override;
Json::Value JsonValue() const override;
void SetJsonValue(const Json::Value root) override;
std::string PropertiesJSON(int64_t requested_frame) const override;
ReaderBase* Reader() { return reader; };
void Reader(ReaderBase *new_reader) { reader = new_reader; };
};
}
#endif
openshot::EffectBase
This abstract class is the base class, used by all effects in libopenshot.
Definition EffectBase.h:54
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::Mask
This class uses the image libraries to apply alpha (or transparency) masks to any frame....
Definition Mask.h:37
openshot::Mask::Reader
ReaderBase * Reader()
Get the reader object of the mask grayscale image.
Definition Mask.h:93
openshot::Mask::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition Mask.cpp:171
openshot::Mask::Mask
Mask()
Blank constructor, useful when using Json to load the effect properties.
Definition Mask.cpp:29
openshot::Mask::replace_image
bool replace_image
Replace the frame image with a grayscale image representing the mask. Great for debugging a mask.
Definition Mask.h:47
openshot::Mask::brightness
Keyframe brightness
Brightness keyframe to control the wipe / mask effect. A constant value here will prevent animation.
Definition Mask.h:48
openshot::Mask::PropertiesJSON
std::string PropertiesJSON(int64_t requested_frame) const override
Definition Mask.cpp:255
openshot::Mask::Reader
void Reader(ReaderBase *new_reader)
Set a new reader to be used by the mask effect (grayscale image)
Definition Mask.h:96
openshot::Mask::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition Mask.cpp:153
openshot::Mask::Json
std::string Json() const override
Generate JSON string of this object.
Definition Mask.cpp:146
openshot::Mask::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition Mask.cpp:188
openshot::Mask::contrast
Keyframe contrast
Contrast keyframe to control the hardness of the wipe effect / mask.
Definition Mask.h:49
openshot::Mask::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 Mask.h:69
openshot::ReaderBase
This abstract class is the base class, used by all readers in libopenshot.
Definition ReaderBase.h:76
openshot
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29