OpenShot Library | libopenshot
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
Caption.h
Go to the documentation of this file.
1
8
9
// Copyright (c) 2008-2019 OpenShot Studios, LLC
10
//
11
// SPDX-License-Identifier: LGPL-3.0-or-later
12
13
#ifndef OPENSHOT_CAPTION_EFFECT_H
14
#define OPENSHOT_CAPTION_EFFECT_H
15
16
#include <memory>
17
#include <string>
18
#include <vector>
19
#include <QFont>
20
#include <QFontMetrics>
21
#include <QRegularExpression>
22
#include "
../Color.h
"
23
#include "
../EffectBase.h
"
24
#include "
../Json.h
"
25
#include "
../KeyFrame.h
"
26
27
28
29
namespace
openshot
30
{
31
38
class
Caption
:
public
EffectBase
39
{
40
private
:
41
std::vector<QRegularExpressionMatch> matchedCaptions;
42
std::string caption_text;
43
QFontMetrics* metrics;
44
QFont* font;
45
bool
is_dirty;
46
48
void
init_effect_details();
49
51
void
process_regex();
52
53
54
public
:
55
Color
color
;
56
Color
stroke
;
57
Color
background
;
58
Keyframe
background_alpha
;
59
Keyframe
background_corner
;
60
Keyframe
background_padding
;
61
Keyframe
stroke_width
;
62
Keyframe
font_size
;
63
Keyframe
font_alpha
;
64
Keyframe
line_spacing
;
65
Keyframe
left
;
66
Keyframe
top
;
67
Keyframe
right
;
68
Keyframe
bottom
;
69
Keyframe
fade_in
;
70
Keyframe
fade_out
;
71
std::string
font_name
;
72
74
Caption
();
75
79
Caption
(std::string captions);
80
87
std::shared_ptr<openshot::Frame>
GetFrame
(int64_t frame_number)
override
{
return
GetFrame
(std::make_shared<openshot::Frame>(), frame_number); }
88
98
std::shared_ptr<openshot::Frame>
GetFrame
(std::shared_ptr<openshot::Frame> frame, int64_t frame_number)
override
;
99
100
// Get and Set caption data
101
std::string
CaptionText
();
102
void
CaptionText
(std::string new_caption_text);
103
104
// Get and Set JSON methods
105
std::string
Json
()
const override
;
106
void
SetJson
(
const
std::string value)
override
;
107
Json::Value
JsonValue
()
const override
;
108
void
SetJsonValue
(
const
Json::Value root)
override
;
109
112
std::string
PropertiesJSON
(int64_t requested_frame)
const override
;
113
};
114
115
}
// namespace openshot
116
117
#endif
// OPENSHOT_CAPTION_EFFECT_H
Color.h
Header file for Color class.
EffectBase.h
Header file for EffectBase class.
Json.h
Header file for JSON class.
KeyFrame.h
Header file for the Keyframe class.
openshot::Caption::PropertiesJSON
std::string PropertiesJSON(int64_t requested_frame) const override
Definition
Caption.cpp:494
openshot::Caption::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
Caption.h:87
openshot::Caption::background_padding
Keyframe background_padding
Background padding.
Definition
Caption.h:60
openshot::Caption::Caption
Caption()
Blank constructor, useful when using Json to load the effect properties.
Definition
Caption.cpp:30
openshot::Caption::stroke_width
Keyframe stroke_width
Width of text border / stroke.
Definition
Caption.h:61
openshot::Caption::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition
Caption.cpp:400
openshot::Caption::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition
Caption.cpp:446
openshot::Caption::Json
std::string Json() const override
Generate JSON string of this object.
Definition
Caption.cpp:393
openshot::Caption::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition
Caption.cpp:429
openshot::Caption::font_name
std::string font_name
Font string.
Definition
Caption.h:71
openshot::Caption::bottom
Keyframe bottom
Size of bottom bar.
Definition
Caption.h:68
openshot::Caption::background
Color background
Color of caption area background.
Definition
Caption.h:57
openshot::Caption::font_size
Keyframe font_size
Font size in points.
Definition
Caption.h:62
openshot::Caption::font_alpha
Keyframe font_alpha
Font color alpha.
Definition
Caption.h:63
openshot::Caption::background_alpha
Keyframe background_alpha
Background color alpha.
Definition
Caption.h:58
openshot::Caption::fade_out
Keyframe fade_out
Fade in per caption (# of seconds).
Definition
Caption.h:70
openshot::Caption::background_corner
Keyframe background_corner
Background cornder radius.
Definition
Caption.h:59
openshot::Caption::fade_in
Keyframe fade_in
Fade in per caption (# of seconds).
Definition
Caption.h:69
openshot::Caption::line_spacing
Keyframe line_spacing
Distance between lines (1.0 default / 100%).
Definition
Caption.h:64
openshot::Caption::top
Keyframe top
Size of top bar.
Definition
Caption.h:66
openshot::Caption::stroke
Color stroke
Color of text border / stroke.
Definition
Caption.h:56
openshot::Caption::CaptionText
std::string CaptionText()
Set the caption string to use (see VTT format).
Definition
Caption.cpp:69
openshot::Caption::right
Keyframe right
Size of right bar.
Definition
Caption.h:67
openshot::Caption::color
Color color
Color of caption text.
Definition
Caption.h:55
openshot::Caption::left
Keyframe left
Size of left bar.
Definition
Caption.h:65
openshot::Color
This class represents a color (used on the timeline and clips).
Definition
Color.h:27
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
This namespace is the default namespace for all code in the openshot library.
Definition
AnimatedCurve.h:24
effects
Caption.h
Generated by
1.17.0