OpenShot Library | libopenshot 0.3.3
Loading...
Searching...
No Matches
TextReader.h
Go to the documentation of this file.
1
9// Copyright (c) 2008-2019 OpenShot Studios, LLC
10//
11// SPDX-License-Identifier: LGPL-3.0-or-later
12
13#ifndef OPENSHOT_TEXT_READER_H
14#define OPENSHOT_TEXT_READER_H
15
16// Require ImageMagick support
17#ifdef USE_IMAGEMAGICK
18
19#include <memory>
20
21#include "ReaderBase.h"
22#include "Enums.h"
23#include "MagickUtilities.h"
24
25namespace openshot
26{
27 class CacheBase;
28 class Frame;
29
62 class TextReader : public ReaderBase
63 {
64 private:
65 int width;
66 int height;
67 int x_offset;
68 int y_offset;
69 std::string text;
70 std::string font;
71 double size;
72 std::string text_color;
73 std::string background_color;
74 std::string text_background_color;
75 std::shared_ptr<Magick::Image> image;
76 MAGICK_DRAWABLE lines;
77 bool is_open;
79
80 public:
81
83 TextReader();
84
96 TextReader(int width, int height, int x_offset, int y_offset, GravityType gravity, std::string text, std::string font, double size, std::string text_color, std::string background_color);
97
100 void SetTextBackgroundColor(std::string color);
101
103 void Close() override;
104
106 openshot::CacheBase* GetCache() override { return nullptr; };
107
113 std::shared_ptr<openshot::Frame> GetFrame(int64_t requested_frame) override;
114
116 bool IsOpen() override { return is_open; };
117
119 std::string Name() override { return "TextReader"; };
120
121 // Get and Set JSON methods
122 std::string Json() const override;
123 void SetJson(const std::string value) override;
124 Json::Value JsonValue() const override;
125 void SetJsonValue(const Json::Value root) override;
126
128 void Open() override;
129 };
130
131}
132
133#endif //USE_IMAGEMAGICK
134#endif //OPENSHOT_TEXT_READER_H
Header file for TextReader class.
Header file for MagickUtilities (IM6/IM7 compatibility overlay)
#define MAGICK_DRAWABLE
Header file for ReaderBase class.
All cache managers in libopenshot are based on this CacheBase class.
Definition CacheBase.h:35
This abstract class is the base class, used by all readers in libopenshot.
Definition ReaderBase.h:76
This class uses the ImageMagick++ libraries, to create frames with "Text", and return openshot::Frame...
Definition TextReader.h:63
void Close() override
Close Reader.
std::string Json() const override
Generate JSON string of this object.
std::string Name() override
Return the type name of the class.
Definition TextReader.h:119
TextReader()
Default constructor (blank text)
void Open() override
Open Reader - which is called by the constructor automatically.
void SetTextBackgroundColor(std::string color)
void SetJson(const std::string value) override
Load JSON string into this object.
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
openshot::CacheBase * GetCache() override
Get the cache object used by this reader (always returns NULL for this object)
Definition TextReader.h:106
bool IsOpen() override
Determine if reader is open or closed.
Definition TextReader.h:116
Json::Value JsonValue() const override
Generate Json::Value for this object.
std::shared_ptr< openshot::Frame > GetFrame(int64_t requested_frame) override
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