You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
420 B
C++
34 lines
420 B
C++
/*!
|
|
\file common.cpp
|
|
|
|
*/
|
|
|
|
#include "common.h"
|
|
|
|
#include <QBuffer>
|
|
|
|
|
|
QImage blob2Image(const QByteArray& ba)
|
|
{
|
|
QImage image;
|
|
|
|
if(!ba.isEmpty())
|
|
{
|
|
if(!image.loadFromData(ba))
|
|
myDebug << "image load error.";
|
|
}
|
|
|
|
return(image);
|
|
}
|
|
|
|
QByteArray image2Blob(const QImage &image)
|
|
{
|
|
QByteArray ba;
|
|
QBuffer buffer(&ba);
|
|
buffer.open(QIODevice::WriteOnly);
|
|
image.save(&buffer, "JPG");
|
|
buffer.close();
|
|
|
|
return(ba);
|
|
}
|