OpenShot Library | libopenshot  0.1.2
Public Member Functions | List of all members
openshot::TextReader Class Reference

This class uses the ImageMagick++ libraries, to create frames with "Text", and return openshot::Frame objects. More...

#include <TextReader.h>

Inheritance diagram for openshot::TextReader:
openshot::ReaderBase

Public Member Functions

void Close ()
 Close Reader. More...
 
CacheGetCache ()
 Get the cache object used by this reader (always returns NULL for this object) More...
 
tr1::shared_ptr< FrameGetFrame (long int requested_frame) throw (ReaderClosed)
 
bool IsOpen ()
 Determine if reader is open or closed. More...
 
string Json ()
 Get and Set JSON methods. More...
 
Json::Value JsonValue ()
 Generate Json::JsonValue for this object. More...
 
string Name ()
 Return the type name of the class. More...
 
void Open ()
 Open Reader - which is called by the constructor automatically. More...
 
void SetJson (string value) throw (InvalidJSON)
 Load JSON string into this object. More...
 
void SetJsonValue (Json::Value root) throw (InvalidFile)
 Load Json::JsonValue into this object. More...
 
 TextReader ()
 Default constructor (blank text) More...
 
 TextReader (int width, int height, int x_offset, int y_offset, GravityType gravity, string text, string font, double size, string text_color, string background_color)
 Constructor for TextReader with all parameters. More...
 
- Public Member Functions inherited from openshot::ReaderBase
void DisplayInfo ()
 Display file information in the standard output stream (stdout) More...
 
void DrawFrameOnScene (string path, long _graphics_scene_address)
 Test method to draw a bitmap on a Qt QGraphicsScene. More...
 
 ReaderBase ()
 Constructor for the base reader, where many things are initialized. More...
 

Additional Inherited Members

- Public Attributes inherited from openshot::ReaderBase
ReaderInfo info
 Information about the current media file. More...
 
- Protected Attributes inherited from openshot::ReaderBase
CriticalSection getFrameCriticalSection
 Section lock for multiple threads. More...
 
CriticalSection processingCriticalSection
 

Detailed Description

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...

// Create a reader to generate an openshot::Frame containing text
TextReader r(720, // width
480, // height
5, // x_offset
5, // y_offset
GRAVITY_CENTER, // gravity
"Check out this Text!", // text
"Arial", // font
15.0, // size
"#fff000", // text_color
"#000000" // background_color
);
r.Open(); // Open the reader
// Get frame number 1 from the video (in fact, any frame # you request will return the same frame)
tr1::shared_ptr<Frame> f = r.GetFrame(1);
// Now that we have an openshot::Frame object, lets have some fun!
f->Display(); // Display the frame on the screen
// Close the reader
r.Close();

Definition at line 81 of file TextReader.h.

Constructor & Destructor Documentation

◆ TextReader() [1/2]

TextReader::TextReader ( )

Default constructor (blank text)

Definition at line 33 of file TextReader.cpp.

◆ TextReader() [2/2]

TextReader::TextReader ( int  width,
int  height,
int  x_offset,
int  y_offset,
GravityType  gravity,
string  text,
string  font,
double  size,
string  text_color,
string  background_color 
)

Constructor for TextReader with all parameters.

Parameters
widthThe width of the requested openshot::Frame (not the size of the text)
heightThe height of the requested openshot::Frame (not the size of the text)
x_offsetThe number of pixels to offset the text on the X axis (horizontal)
y_offsetThe number of pixels to offset the text on the Y axis (vertical)
gravityThe alignment / gravity of the text
textThe text you want to generate / display
fontThe font of the text
sizeThe size of the text
text_colorThe color of the text
background_colorThe background color of the text (also supports Transparent)

Definition at line 40 of file TextReader.cpp.

Member Function Documentation

◆ Close()

void TextReader::Close ( )
virtual

Close Reader.

Implements openshot::ReaderBase.

Definition at line 135 of file TextReader.cpp.

◆ GetCache()

Cache* openshot::TextReader::GetCache ( )
inlinevirtual

Get the cache object used by this reader (always returns NULL for this object)

Implements openshot::ReaderBase.

Definition at line 120 of file TextReader.h.

◆ GetFrame()

tr1::shared_ptr< Frame > TextReader::GetFrame ( long int  requested_frame)
throw (ReaderClosed
)
virtual

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.

Returns
The requested frame (containing the image)
Parameters
requested_frameThe frame number that is requested.

Implements openshot::ReaderBase.

Definition at line 146 of file TextReader.cpp.

◆ IsOpen()

bool openshot::TextReader::IsOpen ( )
inlinevirtual

Determine if reader is open or closed.

Implements openshot::ReaderBase.

Definition at line 130 of file TextReader.h.

◆ Json()

string TextReader::Json ( )
virtual

Get and Set JSON methods.

Generate JSON string of this object

Implements openshot::ReaderBase.

Definition at line 172 of file TextReader.cpp.

◆ JsonValue()

Json::Value TextReader::JsonValue ( )
virtual

Generate Json::JsonValue for this object.

Implements openshot::ReaderBase.

Definition at line 179 of file TextReader.cpp.

◆ Name()

string openshot::TextReader::Name ( )
inlinevirtual

Return the type name of the class.

Implements openshot::ReaderBase.

Definition at line 133 of file TextReader.h.

◆ Open()

void TextReader::Open ( )
virtual

Open Reader - which is called by the constructor automatically.

Implements openshot::ReaderBase.

Definition at line 49 of file TextReader.cpp.

◆ SetJson()

void TextReader::SetJson ( string  value)
throw (InvalidJSON
)
virtual

Load JSON string into this object.

Implements openshot::ReaderBase.

Definition at line 200 of file TextReader.cpp.

◆ SetJsonValue()

void TextReader::SetJsonValue ( Json::Value  root)
throw (InvalidFile
)
virtual

Load Json::JsonValue into this object.

Implements openshot::ReaderBase.

Definition at line 223 of file TextReader.cpp.


The documentation for this class was generated from the following files: