[Kde-imaging] libksane and returned data

Kåre Särs kare.sars at kolumbus.fi
Fri Nov 23 13:24:29 CET 2007


Hi,

I'm just about ready with 16 bit color scanning for libksane. The only thing 
to decide now is how to provide the scanned data (this is also a 8bit color 
problem).

The problem is that sane returns 3 bytes/pixel for 8 bit color mode (not 4 
bytes as QImage requires) and 6 bytes/pixel for 16bit color mode. The problem 
is not how to convert the data, but what format the user would want the data.

There is at least two alternatives:

1) I return the data as is (3 bytes/pixel for 8 bit color and 6 bytes/pixel 
for 16 bit colors) and provide a function to add the alpha channel or return 
a QImage

or

2) return the data with an added "alpha channel" (4 and 8 bytes / pixel)

alternative 1) Would return a smaller buffer, but if the data has to be copied 
to another buffer to make room for the alpha channel, that first smaller 
buffer would just be waisted memory...

In any case I'm going to providing a convenience function that returns a 
QImage.

/Kåre Särs



More information about the Kde-imaging mailing list