OpenShot Library | libopenshot  0.3.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
void SetJson(const std::string value) override
Load JSON string into this object.
Json::Value JsonValue() const override
Generate Json::Value for this object.
Header file for ReaderBase class.
std::string Name() override
Return the type name of the class.
Definition: QtHtmlReader.h:115
CacheBase * GetCache() override
Get the cache object used by this reader (always returns NULL for this object)
Definition: QtHtmlReader.h:102
This abstract class is the base class, used by all readers in libopenshot.
Definition: ReaderBase.h:75
std::string Json() const override
Generate JSON string of this object.
void Close() override
Close Reader.
Header file for CacheMemory class.
bool IsOpen() override
Determine if reader is open or closed.
Definition: QtHtmlReader.h:112
All cache managers in libopenshot are based on this CacheBase class.
Definition: CacheBase.h:34
QtHtmlReader()
Default constructor (blank text)
Header file for TextReader class.
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
void Open() override
Open Reader - which is called by the constructor automatically.
std::shared_ptr< openshot::Frame > GetFrame(int64_t requested_frame) override
GravityType
This enumeration determines how clips are aligned to their parent container.
Definition: Enums.h:21
This class uses Qt libraries, to create frames with rendered HTML, and return openshot::Frame objects...
Definition: QtHtmlReader.h:69