OpenShot Library | libopenshot
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
Displace.h
Go to the documentation of this file.
1
8
9
// Copyright (c) 2008-2026 OpenShot Studios, LLC
10
//
11
// SPDX-License-Identifier: LGPL-3.0-or-later
12
13
#ifndef OPENSHOT_DISPLACE_EFFECT_H
14
#define OPENSHOT_DISPLACE_EFFECT_H
15
16
#include "
../EffectBase.h
"
17
18
#include "
../Frame.h
"
19
#include "
../Json.h
"
20
#include "
../KeyFrame.h
"
21
22
#include <memory>
23
#include <string>
24
25
namespace
openshot
26
{
27
// Forward declaration
28
class
ReaderBase
;
29
37
class
Displace
:
public
EffectBase
38
{
39
private
:
40
ReaderBase
* map_reader =
nullptr
;
41
std::shared_ptr<QImage> cached_single_map_image;
42
int
cached_single_map_width = 0;
43
int
cached_single_map_height = 0;
44
46
void
init_effect_details();
47
49
std::shared_ptr<QImage> GetMapImage(std::shared_ptr<QImage> target_image, int64_t frame_number);
50
51
public
:
52
bool
replace_image
;
53
bool
invert
;
54
Keyframe
strength
;
55
Keyframe
horizontal
;
56
Keyframe
vertical
;
57
Keyframe
brightness
;
58
Keyframe
contrast
;
59
61
Displace
();
62
71
Displace
(
ReaderBase
*map_reader,
Keyframe
map_strength,
Keyframe
map_horizontal,
72
Keyframe
map_vertical,
Keyframe
map_brightness,
Keyframe
map_contrast);
73
80
std::shared_ptr<openshot::Frame>
GetFrame
(int64_t frame_number)
override
{
return
GetFrame
(std::make_shared<openshot::Frame>(), frame_number); }
81
91
std::shared_ptr<openshot::Frame>
GetFrame
(std::shared_ptr<openshot::Frame> frame, int64_t frame_number)
override
;
92
93
// Get and Set JSON methods
94
std::string
Json
()
const override
;
95
void
SetJson
(
const
std::string value)
override
;
96
Json::Value
JsonValue
()
const override
;
97
void
SetJsonValue
(
const
Json::Value root)
override
;
98
101
std::string
PropertiesJSON
(int64_t requested_frame)
const override
;
102
104
ReaderBase
*
Reader
() {
return
map_reader; };
105
107
void
Reader
(
ReaderBase
*new_reader);
108
109
~Displace
()
override
;
110
};
111
112
}
113
114
#endif
EffectBase.h
Header file for EffectBase class.
Frame.h
Header file for Frame class.
Json.h
Header file for JSON class.
KeyFrame.h
Header file for the Keyframe class.
openshot::Displace::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
Displace.h:80
openshot::Displace::contrast
Keyframe contrast
Contrast adjustment for the displacement map.
Definition
Displace.h:58
openshot::Displace::Displace
Displace()
Blank constructor, useful when using Json to load the effect properties.
Definition
Displace.cpp:66
openshot::Displace::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition
Displace.cpp:241
openshot::Displace::invert
bool invert
Invert the displacement map before converting it to offsets.
Definition
Displace.h:53
openshot::Displace::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition
Displace.cpp:272
openshot::Displace::vertical
Keyframe vertical
Vertical displacement amount as a percentage of image height.
Definition
Displace.h:56
openshot::Displace::~Displace
~Displace() override
Definition
Displace.cpp:347
openshot::Displace::brightness
Keyframe brightness
Brightness adjustment for the displacement map.
Definition
Displace.h:57
openshot::Displace::Json
std::string Json() const override
Generate JSON string of this object.
Definition
Displace.cpp:236
openshot::Displace::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition
Displace.cpp:259
openshot::Displace::horizontal
Keyframe horizontal
Horizontal displacement amount as a percentage of image width.
Definition
Displace.h:55
openshot::Displace::PropertiesJSON
std::string PropertiesJSON(int64_t requested_frame) const override
Definition
Displace.cpp:307
openshot::Displace::replace_image
bool replace_image
Replace the frame image with the processed displacement map for debugging.
Definition
Displace.h:52
openshot::Displace::Reader
ReaderBase * Reader()
Get the reader object of the displacement map.
Definition
Displace.h:104
openshot::Displace::strength
Keyframe strength
Overall strength multiplier for the displacement effect.
Definition
Displace.h:54
openshot::EffectBase
This abstract class is the base class, used by all effects in libopenshot.
Definition
EffectBase.h:57
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::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
AnimatedCurve.h:24
effects
Displace.h
Generated by
1.17.0