Loading...
Searching...
No Matches
QtImageReader.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_QIMAGE_READER_H
#define OPENSHOT_QIMAGE_READER_H
#include <memory>
#include <string>
#include <QString>
#include <QSize>
#include "ReaderBase.h"
#include "Json.h"
#if USE_RESVG == 1
// If defined and found in CMake, utilize the libresvg for parsing
// SVG files and rasterizing them to QImages.
#include "ResvgQt.h"
#define RESVG_VERSION_MIN(a, b) (\
RESVG_MAJOR_VERSION > a \
|| (RESVG_MAJOR_VERSION == a && RESVG_MINOR_VERSION >= b) \
)
#else
#define RESVG_VERSION_MIN(a, b) 0
#endif
class QImage;
#include <QImage>
#include <QSize>
#include <QString>
#include <QSize>
#include <QString>
class QImage;
namespace openshot
{
// Forward decl
class CacheBase;
class Frame;
class QtImageReader : public ReaderBase
{
private:
QString path;
std::shared_ptr<QImage> image;
std::shared_ptr<QImage> cached_image;
bool is_open;
QSize max_size;
#if RESVG_VERSION_MIN(0, 11)
ResvgOptions resvg_options;
#endif
QSize load_svg_path(QString path);
QSize calculate_max_size();
public:
QtImageReader(std::string path, bool inspect_reader=true);
virtual ~QtImageReader();
void Close() override;
CacheBase* GetCache() override { return NULL; };
std::shared_ptr<Frame> GetFrame(int64_t requested_frame) override;
bool IsOpen() override { return is_open; };
std::string Name() override { return "QtImageReader"; };
// 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
path
path
Definition FFmpegWriter.cpp:1515
Json.h
Header file for JSON 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::QtImageReader
This class uses the Qt library, to open image files, and return openshot::Frame objects containing th...
Definition QtImageReader.h:75
openshot::QtImageReader::Name
std::string Name() override
Return the type name of the class.
Definition QtImageReader.h:126
openshot::QtImageReader::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition QtImageReader.cpp:327
openshot::QtImageReader::GetCache
CacheBase * GetCache() override
Get the cache object used by this reader (always returns NULL for this object)
Definition QtImageReader.h:113
openshot::QtImageReader::Json
std::string Json() const override
Generate JSON string of this object.
Definition QtImageReader.cpp:320
openshot::QtImageReader::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition QtImageReader.cpp:356
openshot::QtImageReader::Open
void Open() override
Open File - which is called by the constructor automatically.
Definition QtImageReader.cpp:43
openshot::QtImageReader::~QtImageReader
virtual ~QtImageReader()
Definition QtImageReader.cpp:37
openshot::QtImageReader::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition QtImageReader.cpp:339
openshot::QtImageReader::IsOpen
bool IsOpen() override
Determine if reader is open or closed.
Definition QtImageReader.h:123
openshot::QtImageReader::Close
void Close() override
Close File.
Definition QtImageReader.cpp:130
openshot::QtImageReader::GetFrame
std::shared_ptr< Frame > GetFrame(int64_t requested_frame) override
Definition QtImageReader.cpp:148
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