OpenShot Library | libopenshot
0.3.3
|
This class uses the ImageMagick++ libraries, to create frames with "Text", and return openshot::Frame objects. More...
#include <TextReader.h>
Public Member Functions | |
void | Close () override |
Close Reader. More... | |
openshot::CacheBase * | GetCache () override |
Get the cache object used by this reader (always returns NULL for this object) More... | |
std::shared_ptr< openshot::Frame > | GetFrame (int64_t requested_frame) override |
bool | IsOpen () override |
Determine if reader is open or closed. More... | |
std::string | Json () const override |
Generate JSON string of this object. More... | |
Json::Value | JsonValue () const override |
Generate Json::Value for this object. More... | |
std::string | Name () override |
Return the type name of the class. More... | |
void | Open () override |
Open Reader - which is called by the constructor automatically. More... | |
void | SetJson (const std::string value) override |
Load JSON string into this object. More... | |
void | SetJsonValue (const Json::Value root) override |
Load Json::Value into this object. More... | |
void | SetTextBackgroundColor (std::string color) |
TextReader () | |
Default constructor (blank text) More... | |
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) | |
Constructor for TextReader with all parameters. More... | |
Public Member Functions inherited from openshot::ReaderBase | |
void | DisplayInfo (std::ostream *out=&std::cout) |
Display file information in the standard output stream (stdout) More... | |
openshot::ClipBase * | ParentClip () |
Parent clip object of this reader (which can be unparented and NULL) More... | |
void | ParentClip (openshot::ClipBase *new_clip) |
Set parent clip object of this reader. More... | |
ReaderBase () | |
Constructor for the base reader, where many things are initialized. More... | |
virtual | ~ReaderBase ()=default |
Additional Inherited Members | |
Public Attributes inherited from openshot::ReaderBase | |
openshot::ReaderInfo | info |
Information about the current media file. More... | |
Protected Attributes inherited from openshot::ReaderBase | |
openshot::ClipBase * | clip |
Pointer to the parent clip instance (if any) More... | |
std::recursive_mutex | getFrameMutex |
Mutex for multiple threads. More... | |
This class uses the ImageMagick++ libraries, to create frames with "Text", and return openshot::Frame objects.
All system fonts are supported, including many different font properties, such as size, color, alignment, padding, etc...
Definition at line 62 of file TextReader.h.
TextReader::TextReader | ( | ) |
Default constructor (blank text)
Definition at line 26 of file TextReader.cpp.
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 | ||
) |
Constructor for TextReader with all parameters.
width | The width of the requested openshot::Frame (not the size of the text) |
height | The height of the requested openshot::Frame (not the size of the text) |
x_offset | The number of pixels to offset the text on the X axis (horizontal) |
y_offset | The number of pixels to offset the text on the Y axis (vertical) |
gravity | The alignment / gravity of the text |
text | The text you want to generate / display |
font | The font of the text |
size | The size of the text |
text_color | The color of the text |
background_color | The background color of the text frame image (also supports Transparent) |
Definition at line 33 of file TextReader.cpp.
|
overridevirtual |
Close Reader.
Implements openshot::ReaderBase.
Definition at line 141 of file TextReader.cpp.
Referenced by SetJsonValue(), SetTextBackgroundColor(), and TextReader().
|
inlineoverridevirtual |
Get the cache object used by this reader (always returns NULL for this object)
Implements openshot::ReaderBase.
Definition at line 106 of file TextReader.h.
|
overridevirtual |
Get an openshot::Frame object for a specific frame number of this reader. All numbers return the same Frame, since they all share the same image data.
requested_frame | The frame number that is requested. |
Implements openshot::ReaderBase.
Definition at line 152 of file TextReader.cpp.
|
inlineoverridevirtual |
Determine if reader is open or closed.
Implements openshot::ReaderBase.
Definition at line 116 of file TextReader.h.
|
overridevirtual |
Generate JSON string of this object.
Implements openshot::ReaderBase.
Definition at line 181 of file TextReader.cpp.
|
overridevirtual |
Generate Json::Value for this object.
Implements openshot::ReaderBase.
Definition at line 188 of file TextReader.cpp.
Referenced by Json().
|
inlineoverridevirtual |
Return the type name of the class.
Implements openshot::ReaderBase.
Definition at line 119 of file TextReader.h.
|
overridevirtual |
Open Reader - which is called by the constructor automatically.
Implements openshot::ReaderBase.
Definition at line 50 of file TextReader.cpp.
Referenced by SetJsonValue(), SetTextBackgroundColor(), and TextReader().
|
overridevirtual |
Load JSON string into this object.
Implements openshot::ReaderBase.
Definition at line 210 of file TextReader.cpp.
|
overridevirtual |
Load Json::Value into this object.
Implements openshot::ReaderBase.
Definition at line 225 of file TextReader.cpp.
Referenced by SetJson().
void TextReader::SetTextBackgroundColor | ( | std::string | color | ) |
Draw a box under rendered text using the specified color.
color | The background color behind the text |
Definition at line 41 of file TextReader.cpp.