2013-02-07 17:11:23 -06:00
|
|
|
#ifndef OPENSHOT_TEXT_READER_H
|
|
|
|
|
#define OPENSHOT_TEXT_READER_H
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \file
|
|
|
|
|
* \brief Header file for TextReader class
|
|
|
|
|
* \author Copyright (c) 2011 Jonathan Thomas
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "FileReaderBase.h"
|
|
|
|
|
|
|
|
|
|
#include <cmath>
|
|
|
|
|
#include <ctime>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <omp.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <tr1/memory>
|
|
|
|
|
#include "Magick++.h"
|
|
|
|
|
#include "Cache.h"
|
2013-03-06 23:36:28 -06:00
|
|
|
#include "Clip.h"
|
2013-02-07 17:11:23 -06:00
|
|
|
#include "Exceptions.h"
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
namespace openshot
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief This class uses the ImageMagick++ libraries, to create frames with "Text", and return
|
|
|
|
|
* openshot::Frame objects containing the image of the text.
|
|
|
|
|
*/
|
|
|
|
|
class TextReader : public FileReaderBase
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
int width;
|
|
|
|
|
int height;
|
|
|
|
|
int x_offset;
|
|
|
|
|
int y_offset;
|
|
|
|
|
string text;
|
|
|
|
|
string font;
|
|
|
|
|
double size;
|
|
|
|
|
string text_color;
|
|
|
|
|
string background_color;
|
|
|
|
|
tr1::shared_ptr<Magick::Image> image;
|
|
|
|
|
list<Magick::Drawable> lines;
|
|
|
|
|
bool is_open;
|
2013-03-06 23:36:28 -06:00
|
|
|
GravityType gravity;
|
2013-02-07 17:11:23 -06:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
/// Constructor for TextReader.
|
2013-03-06 23:36:28 -06:00
|
|
|
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);
|
2013-02-07 17:11:23 -06:00
|
|
|
|
|
|
|
|
/// Close Reader
|
|
|
|
|
void Close();
|
|
|
|
|
|
|
|
|
|
/// 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)
|
|
|
|
|
/// @param[requested_frame] number The frame number that is requested.
|
|
|
|
|
tr1::shared_ptr<Frame> GetFrame(int requested_frame) throw(ReaderClosed);
|
|
|
|
|
|
|
|
|
|
/// Open Reader - which is called by the constructor automatically
|
|
|
|
|
void Open();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|