Sorry for fromData. It is not, what you need. Did you try constructor QImage::QImage ( const uchar * data, int width, int height, Format format ) like this:
QImage rawImage
( data, _width, _height,
QImage::Format_RGB16 );
QImage rawImage( data, _width, _height, QImage::Format_RGB16 );
To copy to clipboard, switch view to plain text mode
if it wouldn't work, try to change your code like this:
unsigned short* usData = (unsigned short*)data;
for (int i = 0; i < _height; i++)
{
unsigned short* image = (unsigned short*)rawImage->scanLine(i);
for (int j = 0; j < _width; j++)
image[j] = usData[i*_width + j];
}
unsigned short* usData = (unsigned short*)data;
for (int i = 0; i < _height; i++)
{
unsigned short* image = (unsigned short*)rawImage->scanLine(i);
for (int j = 0; j < _width; j++)
image[j] = usData[i*_width + j];
}
To copy to clipboard, switch view to plain text mode
Bookmarks