OpenShot Library | libopenshot  0.3.3
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 
26 class QImage;
27 
28 namespace 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;
83  openshot::GravityType gravity;
84 
85  public:
86 
88  QtTextReader();
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
openshot::QtTextReader::Json
std::string Json() const override
Generate JSON string of this object.
Definition: QtTextReader.cpp:193
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28
openshot::QtTextReader::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition: QtTextReader.cpp:221
openshot::QtTextReader::IsOpen
bool IsOpen() override
Determine if reader is open or closed.
Definition: QtTextReader.h:120
openshot::GravityType
GravityType
This enumeration determines how clips are aligned to their parent container.
Definition: Enums.h:21
openshot::CacheBase
All cache managers in libopenshot are based on this CacheBase class.
Definition: CacheBase.h:34
openshot::QtTextReader::GetCache
CacheBase * GetCache() override
Get the cache object used by this reader (always returns NULL for this object)
Definition: QtTextReader.h:110
openshot::QtTextReader::Close
void Close() override
Close Reader.
Definition: QtTextReader.cpp:147
openshot::QtTextReader::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition: QtTextReader.cpp:200
openshot::QtTextReader::SetTextBackgroundColor
void SetTextBackgroundColor(std::string color)
Definition: QtTextReader.cpp:41
openshot::QtTextReader::Open
void Open() override
Open Reader - which is called by the constructor automatically.
Definition: QtTextReader.cpp:50
ReaderBase.h
Header file for ReaderBase class.
openshot::QtTextReader::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition: QtTextReader.cpp:238
Enums.h
Header file for TextReader class.
openshot::QtTextReader::GetFrame
std::shared_ptr< openshot::Frame > GetFrame(int64_t requested_frame) override
Definition: QtTextReader.cpp:164
openshot::ReaderBase
This abstract class is the base class, used by all readers in libopenshot.
Definition: ReaderBase.h:75
openshot::QtTextReader::Name
std::string Name() override
Return the type name of the class.
Definition: QtTextReader.h:123
openshot::QtTextReader::QtTextReader
QtTextReader()
Default constructor (blank text)
Definition: QtTextReader.cpp:26
openshot::QtTextReader
This class uses Qt libraries, to create frames with "Text", and return openshot::Frame objects.
Definition: QtTextReader.h:69