OpenShot Library | libopenshot  0.3.3
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
Header file for CacheMemory class.
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 rendered HTML, and return openshot::Frame objects...
Definition: QtHtmlReader.h:70
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
std::shared_ptr< openshot::Frame > GetFrame(int64_t requested_frame) override
Json::Value JsonValue() const override
Generate Json::Value for this object.
std::string Json() const override
Generate JSON string of this object.
void Close() override
Close Reader.
QtHtmlReader()
Default constructor (blank text)
bool IsOpen() override
Determine if reader is open or closed.
Definition: QtHtmlReader.h:112
CacheBase * GetCache() override
Get the cache object used by this reader (always returns NULL for this object)
Definition: QtHtmlReader.h:102
void Open() override
Open Reader - which is called by the constructor automatically.
void SetJson(const std::string value) override
Load JSON string into this object.
std::string Name() override
Return the type name of the class.
Definition: QtHtmlReader.h:115
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