Loading...
Searching...
No Matches
QtTextReader.h
Go to the documentation of this file.
// Copyright (c) 2008-2019 OpenShot Studios, LLC
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#ifndef OPENSHOT_QT_TEXT_READER_H
#define OPENSHOT_QT_TEXT_READER_H
#include "ReaderBase.h"
#include <memory>
#include "Enums.h"
#include <QFont>
class QImage;
namespace openshot
{
// Forward decls
class CacheBase;
class Frame;
class QtTextReader : public ReaderBase
{
private:
int width;
int height;
int x_offset;
int y_offset;
std::string text;
QFont font;
std::string text_color;
std::string background_color;
std::string text_background_color;
std::shared_ptr<QImage> image;
bool is_open;
openshot::GravityType gravity;
public:
QtTextReader();
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);
void SetTextBackgroundColor(std::string color);
void Close() override;
CacheBase* GetCache() override { return NULL; };
std::shared_ptr<openshot::Frame> GetFrame(int64_t requested_frame) override;
bool IsOpen() override { return is_open; };
std::string Name() override { return "QtTextReader"; };
// Get and Set JSON methods
std::string Json() const override;
void SetJson(const std::string value) override;
Json::Value JsonValue() const override;
void SetJsonValue(const Json::Value root) override;
void Open() override;
};
}
#endif
Enums.h
Header file for TextReader class.
ReaderBase.h
Header file for ReaderBase class.
openshot::CacheBase
All cache managers in libopenshot are based on this CacheBase class.
Definition CacheBase.h:35
openshot::QtTextReader
This class uses Qt libraries, to create frames with "Text", and return openshot::Frame objects.
Definition QtTextReader.h:70
openshot::QtTextReader::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition QtTextReader.cpp:216
openshot::QtTextReader::SetTextBackgroundColor
void SetTextBackgroundColor(std::string color)
Definition QtTextReader.cpp:41
openshot::QtTextReader::Close
void Close() override
Close Reader.
Definition QtTextReader.cpp:146
openshot::QtTextReader::Json
std::string Json() const override
Generate JSON string of this object.
Definition QtTextReader.cpp:188
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::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition QtTextReader.cpp:233
openshot::QtTextReader::QtTextReader
QtTextReader()
Default constructor (blank text)
Definition QtTextReader.cpp:26
openshot::QtTextReader::Name
std::string Name() override
Return the type name of the class.
Definition QtTextReader.h:123
openshot::QtTextReader::GetFrame
std::shared_ptr< openshot::Frame > GetFrame(int64_t requested_frame) override
Definition QtTextReader.cpp:163
openshot::QtTextReader::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition QtTextReader.cpp:195
openshot::QtTextReader::Open
void Open() override
Open Reader - which is called by the constructor automatically.
Definition QtTextReader.cpp:50
openshot::QtTextReader::IsOpen
bool IsOpen() override
Determine if reader is open or closed.
Definition QtTextReader.h:120
openshot::ReaderBase
This abstract class is the base class, used by all readers in libopenshot.
Definition ReaderBase.h:76
openshot
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29
openshot::GravityType
GravityType
This enumeration determines how clips are aligned to their parent container.
Definition Enums.h:22