OpenShot Library | libopenshot  0.4.0
QtHtmlReader.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_HTML_READER_H
16 #define OPENSHOT_QT_HTML_READER_H
17 
18 #include "ReaderBase.h"
19 
20 #include <cmath>
21 #include <ctime>
22 #include <iostream>
23 #include <omp.h>
24 #include <stdio.h>
25 #include <memory>
26 #include "CacheMemory.h"
27 #include "Enums.h"
28 
29 
30 class QImage;
31 
32 namespace openshot
33 {
34  // Forward decls
35  class CacheBase;
36 
69  class QtHtmlReader : public ReaderBase
70  {
71  private:
72  int width;
73  int height;
74  int x_offset;
75  int y_offset;
76  std::string html;
77  std::string css;
78  std::string background_color;
79  std::shared_ptr<QImage> image;
80  bool is_open;
81  openshot::GravityType gravity;
82  public:
83 
85  QtHtmlReader();
86 
96  QtHtmlReader(int width, int height, int x_offset, int y_offset, GravityType gravity, std::string html, std::string css, std::string background_color);
97 
99  void Close() override;
100 
102  CacheBase* GetCache() override { return NULL; };
103 
109  std::shared_ptr<openshot::Frame> GetFrame(int64_t requested_frame) override;
110 
112  bool IsOpen() override { return is_open; };
113 
115  std::string Name() override { return "QtHtmlReader"; };
116 
117  // Get and Set JSON methods
118  std::string Json() const override;
119  void SetJson(const std::string value) override;
120  Json::Value JsonValue() const override;
121  void SetJsonValue(const Json::Value root) override;
122 
124  void Open() override;
125  };
126 
127 }
128 
129 #endif
openshot::QtHtmlReader::Open
void Open() override
Open Reader - which is called by the constructor automatically.
Definition: QtHtmlReader.cpp:44
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28
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::QtHtmlReader
This class uses Qt libraries, to create frames with rendered HTML, and return openshot::Frame objects...
Definition: QtHtmlReader.h:69
openshot::QtHtmlReader::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition: QtHtmlReader.cpp:219
openshot::QtHtmlReader::Close
void Close() override
Close Reader.
Definition: QtHtmlReader.cpp:129
CacheMemory.h
Header file for CacheMemory class.
openshot::QtHtmlReader::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition: QtHtmlReader.cpp:183
openshot::QtHtmlReader::GetFrame
std::shared_ptr< openshot::Frame > GetFrame(int64_t requested_frame) override
Definition: QtHtmlReader.cpp:146
openshot::QtHtmlReader::QtHtmlReader
QtHtmlReader()
Default constructor (blank text)
Definition: QtHtmlReader.cpp:28
ReaderBase.h
Header file for ReaderBase class.
Enums.h
Header file for TextReader class.
openshot::QtHtmlReader::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition: QtHtmlReader.cpp:202
openshot::ReaderBase
This abstract class is the base class, used by all readers in libopenshot.
Definition: ReaderBase.h:75
openshot::QtHtmlReader::Json
std::string Json() const override
Generate JSON string of this object.
Definition: QtHtmlReader.cpp:176
openshot::QtHtmlReader::GetCache
CacheBase * GetCache() override
Get the cache object used by this reader (always returns NULL for this object)
Definition: QtHtmlReader.h:102
openshot::QtHtmlReader::Name
std::string Name() override
Return the type name of the class.
Definition: QtHtmlReader.h:115
openshot::QtHtmlReader::IsOpen
bool IsOpen() override
Determine if reader is open or closed.
Definition: QtHtmlReader.h:112