|
OpenShot Library | libopenshot
0.5.0
|
Go to the documentation of this file.
13 #ifndef OPENSHOT_EFFECT_BASE_H
14 #define OPENSHOT_EFFECT_BASE_H
61 std::shared_ptr<QImage> cached_single_mask_image;
62 int cached_single_mask_width = 0;
63 int cached_single_mask_height = 0;
66 std::shared_ptr<QImage> GetMaskImage(std::shared_ptr<QImage> target_image, int64_t frame_number);
69 void BlendWithMask(std::shared_ptr<QImage> original_image, std::shared_ptr<QImage> effected_image,
70 std::shared_ptr<QImage> mask_image)
const;
88 std::shared_ptr<QImage>
ResolveMaskImage(std::shared_ptr<QImage> target_image, int64_t frame_number) {
89 return GetMaskImage(target_image, frame_number);
96 virtual void ApplyCustomMaskBlend(std::shared_ptr<QImage> original_image, std::shared_ptr<QImage> effected_image,
97 std::shared_ptr<QImage> mask_image, int64_t frame_number)
const {}
153 virtual std::string
Json()
const;
154 virtual void SetJson(
const std::string value);
158 virtual std::string
Json(int64_t requested_frame)
const{
161 virtual void SetJson(int64_t requested_frame,
const std::string value) {
172 std::shared_ptr<openshot::Frame>
ProcessFrame(std::shared_ptr<openshot::Frame> frame, int64_t frame_number);
185 void Order(
int new_order) { order = new_order; }
This abstract class is the base class, used by all effects in libopenshot.
EffectInfoStruct info
Information about the current effect.
Json::Value JsonInfo() const
Generate JSON object of meta data / info.
bool apply_before_clip
Apply effect before we evaluate the clip's keyframes.
bool mask_invert
Invert grayscale mask values before blending.
This namespace is the default namespace for all code in the openshot library.
openshot::ClipBase * ParentClip()
Parent clip object of this effect (which can be unparented and NULL)
virtual Json::Value JsonValue() const
Generate Json::Value for this object.
int mask_time_mode
How effect frames map to mask source frames.
This struct contains info about an effect, such as the name, video or audio effect,...
void DisplayInfo(std::ostream *out=&std::cout)
Display effect information in the standard output stream (stdout)
ReaderBase * CreateReaderFromJson(const Json::Value &reader_json) const
Create a reader instance from reader JSON.
std::map< int, std::shared_ptr< openshot::TrackedObjectBase > > trackedObjects
Map of Tracked Object's by their indices (used by Effects that track objects on clips)
virtual std::string Json() const
Generate JSON string of this object.
virtual bool UseCustomMaskBlend(int64_t frame_number) const
Optional override for effects that need custom mask behavior.
std::shared_ptr< QImage > ResolveMaskImage(std::shared_ptr< QImage > target_image, int64_t frame_number)
Resolve a cached/scaled mask image for the target frame dimensions.
void SetParentEffect(std::string parentEffect_id)
Set the parent effect from which this properties will be set to.
const ReaderBase * MaskReader() const
std::shared_ptr< openshot::Frame > ProcessFrame(std::shared_ptr< openshot::Frame > frame, int64_t frame_number)
Apply effect processing with common mask support (if enabled).
Json::Value BasePropertiesJSON(int64_t requested_frame) const
Generate JSON object of base properties (recommended to be used by all effects)
virtual std::string Json(int64_t requested_frame) const
EffectBase * parentEffect
Parent effect (which properties will set this effect properties)
void Order(int new_order)
Set the order that this effect should be executed.
bool has_audio
Determines if this effect manipulates the audio of a frame.
bool has_tracked_object
Determines if this effect track objects through the clip.
double ResolveMaskSourceDuration() const
Determine mask source duration in seconds.
ReaderBase * MaskReader()
Get the common mask reader.
std::string ParentClipId() const
Return the ID of this effect's parent clip.
double ResolveMaskHostFps()
Determine host FPS used to convert timeline frames to mask source FPS.
int Order() const
Get the order that this effect should be executed.
std::string class_name
The class name of the effect.
std::string description
The description of this effect and what it does.
bool has_video
Determines if this effect manipulates the image of a frame.
int constrain(int color_value)
Constrain a color value from 0 to 255.
std::string parent_effect_id
Id of the parent effect (if there is one)
This abstract class is the base class, used by all readers in libopenshot.
int mask_loop_mode
Behavior when mask range reaches the end.
std::string name
The name of the effect.
virtual void SetJson(int64_t requested_frame, const std::string value)
virtual bool HandlesMaskInternally() const
Optional override for effects that apply mask processing inside GetFrame().
Header file for JSON class.
int64_t MapMaskFrameNumber(int64_t frame_number)
Convert an effect frame number to a mask source frame number.
This abstract class is the base class, used by all clips in libopenshot.
virtual void SetJson(const std::string value)
Load JSON string into this object.
Header file for the TrackedObjectBase class.
Header file for ClipBase class.
virtual void ApplyCustomMaskBlend(std::shared_ptr< QImage > original_image, std::shared_ptr< QImage > effected_image, std::shared_ptr< QImage > mask_image, int64_t frame_number) const
Optional override for effects with custom mask implementation.
virtual std::string GetVisibleObjects(int64_t frame_number) const
Get the indexes and IDs of all visible objects in the given frame.
virtual void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
openshot::ClipBase * clip
Pointer to the parent clip instance (if any)