I've mentioned I'm doing some bar-code scanning, and grayscale is fine, though 
the answer should be the same for color even if its a little more work. So 
that's the extent of this inquiry. Also, assume no GPU.

QImage does not support the popular YUV video formats. Foruantely, Y (8-bit 
gray) is the only channel I need , and it is exactly width*height, and right up 
front at bits(). Reading the documentation, it looks like I should use 
scanLine(y) for speed.

Section: GRAY_(Y channel)________________|
y:__0_|__1_|__2_|__3_|__4_|__5_|__6_|__7_|
X:0123401234012340123401234012340123401234
|yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy|uuuuuuuuuuuuuuuuuuuu|vvvvvvvvvvvvvvvvvvvv|



constuchar*bits=frame.bits();
for(inty=0;y<frame.height();y++)
{
QRgb*scanLine=(QRgb*)converted.scanLine(y);
for(intx=0;x<frame.width();x++)
{
intc=bits[y*frame.width()+x];
scanLine[x]=qRgba(c,c,c,255);
}
}

But then I got to thinking maybe a indexed 8 would be better? That way I don't 
need to give 4 pixel components (RGBA) I can just give 1 gray value. So when 
accessing Indexed-8bit images, is that more work because of the color table 
lookups?



Thanks!
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to