dust3d/application/sources/turnaround_loader.cc

38 lines
853 B
C++
Raw Normal View History

#include "turnaround_loader.h"
#include <QGuiApplication>
2018-03-13 06:39:36 +00:00
TurnaroundLoader::TurnaroundLoader(const QString& filename, QSize viewSize)
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()
2018-03-13 06:39:36 +00:00
{
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();
}