OpenShot Library | libopenshot 0.3.1
QtTextReader.h
Go to the documentation of this file.
1
11// Copyright (c) 2008-2019 OpenShot Studios, LLC
12//
13// SPDX-License-Identifier: LGPL-3.0-or-later
14
15#ifndef OPENSHOT_QT_TEXT_READER_H
16#define OPENSHOT_QT_TEXT_READER_H
17
18#include "ReaderBase.h"
19
20#include <memory>
21
22#include "Enums.h"
23
24#include <QFont>
25
26class QImage;
27
28namespace openshot
29{
30 // Forward decls
31 class CacheBase;
32 class Frame;
33
69 class QtTextReader : public ReaderBase
70 {
71 private:
72 int width;
73 int height;
74 int x_offset;
75 int y_offset;
76 std::string text;
77 QFont font;
78 std::string text_color;
79 std::string background_color;
80 std::string text_background_color;
81 std::shared_ptr<QImage> image;
82 bool is_open;
84
85 public:
86
89
100 QtTextReader(int width, int height, int x_offset, int y_offset, GravityType gravity, std::string text, QFont font, std::string text_color, std::string background_color);
101
104 void SetTextBackgroundColor(std::string color);
105
107 void Close() override;
108
110 CacheBase* GetCache() override { return NULL; };
111
117 std::shared_ptr<openshot::Frame> GetFrame(int64_t requested_frame) override;
118
120 bool IsOpen() override { return is_open; };
121
123 std::string Name() override { return "QtTextReader"; };
124
125 // Get and Set JSON methods
126 std::string Json() const override;
127 void SetJson(const std::string value) override;
128 Json::Value JsonValue() const override;
129 void SetJsonValue(const Json::Value root) override;
130
132 void Open() override;
133 };
134
135}
136
137#endif
Header file for TextReader class.
Header file for ReaderBase class.
All cache managers in libopenshot are based on this CacheBase class.
Definition: CacheBase.h:35
This class uses Qt libraries, to create frames with "Text", and return openshot::Frame objects.
Definition: QtTextReader.h:70
void SetJson(const std::string value) override
Load JSON string into this object.
void SetTextBackgroundColor(std::string color)
void Close() override
Close Reader.
std::string Json() const override
Generate JSON string of this object.
CacheBase * GetCache() override
Get the cache object used by this reader (always returns NULL for this object)
Definition: QtTextReader.h:110
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
QtTextReader()
Default constructor (blank text)
std::string Name() override
Return the type name of the class.
Definition: QtTextReader.h:123
std::shared_ptr< openshot::Frame > GetFrame(int64_t requested_frame) override
Json::Value JsonValue() const override
Generate Json::Value for this object.
void Open() override
Open Reader - which is called by the constructor automatically.
bool IsOpen() override
Determine if reader is open or closed.
Definition: QtTextReader.h:120
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
GravityType
This enumeration determines how clips are aligned to their parent container.
Definition: Enums.h:22