dust3d/src/turnaroundloader.cpp

38 lines
854 B
C++
Raw Normal View History

2018-03-13 06:39:36 +00:00
#include "turnaroundloader.h"
TurnaroundLoader::TurnaroundLoader(const QString &filename, QSize viewSize) :
m_resultImage(nullptr)
2018-03-13 06:39:36 +00:00
{
m_filename = filename;
m_viewSize = viewSize;
}
TurnaroundLoader::TurnaroundLoader(const QImage &image, QSize viewSize)
{
m_inputImage = image;
m_viewSize = viewSize;
}
2018-03-13 06:39:36 +00:00
TurnaroundLoader::~TurnaroundLoader()
{
delete m_resultImage;
}
QImage *TurnaroundLoader::takeResultImage()
{
QImage *returnImage = m_resultImage;
m_resultImage = nullptr;
2018-03-13 06:39:36 +00:00
return returnImage;
}
void TurnaroundLoader::process()
{
if (m_inputImage.isNull()) {
QImage image(m_filename);
m_resultImage = new QImage(image.scaled(m_viewSize, Qt::KeepAspectRatio));
} else {
m_resultImage = new QImage(m_inputImage.scaled(m_viewSize, Qt::KeepAspectRatio));
}
2018-03-13 06:39:36 +00:00
emit finished();
}