[Kde-imaging] libksane and returned data

Kåre Särs kare.sars at kolumbus.fi
Sat Nov 24 18:59:35 CET 2007


On Friday 23 November 2007 15:41:46 Gilles Caulier wrote:
> This is not a problem, QImage support RGA32 mode without alpha channel for
> 8 bits color depth.
>
> http://doc.trolltech.com/4.3/qimage.html#fromData-2
>

"QImage QImage::fromData ( const QByteArray & data, const char * format = 0 )   
[static]"

Isn't this for loading a coded (jpeg, PNG or .....) image? How would Qt know 
the size of the image?

> and 6 bytes/pixel for 16bit color mode.
>
>
> You cannot use QImage here. You must use a QByteArray container to host all
> raw image data in RGA. Look how my KPWriteImage class work in this case:

I'm planning to return the data in a QByteArray (+ size and format info) and 
the user could use the data directly or use the convenience function. 
The "toQImage"  function would give a warning if it converts from 16bit 
colors.
 
If it actually works to trivially generate a QImage from a 3bytes/pixel 
QByteArray, alternative 1) would be the best, but as far as I can see that is 
not possible :(

There is a similar problem with grayscale :) sane returns 1 byte/pixel, while 
QImage doesn't have this mode.

Mono (black and white) should not be a problem :)

Cheers,
    Kåre


More information about the Kde-imaging mailing list