Loading...
Searching...
No Matches
TextReader.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_TEXT_READER_H
#define OPENSHOT_TEXT_READER_H
// Require ImageMagick support
#ifdef USE_IMAGEMAGICK
#include <memory>
#include "ReaderBase.h"
#include "Enums.h"
#include "MagickUtilities.h"
namespace openshot
{
class CacheBase;
class Frame;
class TextReader : public ReaderBase
{
private:
int width;
int height;
int x_offset;
int y_offset;
std::string text;
std::string font;
double size;
std::string text_color;
std::string background_color;
std::string text_background_color;
std::shared_ptr<Magick::Image> image;
MAGICK_DRAWABLE lines;
bool is_open;
openshot::GravityType gravity;
public:
TextReader();
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);
void SetTextBackgroundColor(std::string color);
void Close() override;
openshot::CacheBase* GetCache() override { return nullptr; };
std::shared_ptr<openshot::Frame> GetFrame(int64_t requested_frame) override;
bool IsOpen() override { return is_open; };
std::string Name() override { return "TextReader"; };
// 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 //USE_IMAGEMAGICK
#endif //OPENSHOT_TEXT_READER_H
Enums.h
Header file for TextReader class.
MagickUtilities.h
Header file for MagickUtilities (IM6/IM7 compatibility overlay)
MAGICK_DRAWABLE
#define MAGICK_DRAWABLE
Definition MagickUtilities.h:53
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::ReaderBase
This abstract class is the base class, used by all readers in libopenshot.
Definition ReaderBase.h:76
openshot::TextReader
This class uses the ImageMagick++ libraries, to create frames with "Text", and return openshot::Frame...
Definition TextReader.h:63
openshot::TextReader::Close
void Close() override
Close Reader.
Definition TextReader.cpp:141
openshot::TextReader::Json
std::string Json() const override
Generate JSON string of this object.
Definition TextReader.cpp:181
openshot::TextReader::Name
std::string Name() override
Return the type name of the class.
Definition TextReader.h:119
openshot::TextReader::TextReader
TextReader()
Default constructor (blank text)
Definition TextReader.cpp:26
openshot::TextReader::Open
void Open() override
Open Reader - which is called by the constructor automatically.
Definition TextReader.cpp:50
openshot::TextReader::SetTextBackgroundColor
void SetTextBackgroundColor(std::string color)
Definition TextReader.cpp:41
openshot::TextReader::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition TextReader.cpp:210
openshot::TextReader::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition TextReader.cpp:225
openshot::TextReader::GetCache
openshot::CacheBase * GetCache() override
Get the cache object used by this reader (always returns NULL for this object)
Definition TextReader.h:106
openshot::TextReader::IsOpen
bool IsOpen() override
Determine if reader is open or closed.
Definition TextReader.h:116
openshot::TextReader::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition TextReader.cpp:188
openshot::TextReader::GetFrame
std::shared_ptr< openshot::Frame > GetFrame(int64_t requested_frame) override
Definition TextReader.cpp:152
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