Glimpse in kdereview

Kåre Särs kare.sars at kolumbus.fi
Sun Mar 30 21:45:05 BST 2008


On Sunday 30 March 2008 23:28:17 Aaron J. Seigo wrote:
> On Sunday 30 March 2008, Kåre Särs wrote:
> > 3) libkscan provides the image in a QImage, which means that 16bit per
> > color is not possible. libksane provides the data in a QByteArray (plus
> > format info), with 16bit per color support.
>
> what's the API for converting from the QByteArray to a QImage or QPixmap?
> does one just use, e.g., QImage(uchar * data, int width, int height, Format
> format)? are there convenience methods for this?
>
> (apologies for not just loking myself =)

There is a convenience function (makeQImage()) that takes the data from the 
imageReady() signal and generates a QImage from whatever format the data is 
(16bit/color is truncated to 8bits/color). 

void imageReady(QByteArray &data, int width, int height,
                int bytes_per_line, int format);

bool makeQImage(const QByteArray &data,
                int width, int height,
                int bytes_per_line,
                ImageFormat format,
                QImage &img);

it is not possible to use QImage(uchar * data, int width, int height, Format 
format), because the image data is RGB not RGBA.

-- 
Kåre Särs




More information about the kde-core-devel mailing list