Hi everybody.
Sorry for my language. Please, I have problem, when load image and convert to index format:
*image = image->convertToFormat( QImage::Format::Format_Indexed8 );
then reduce color table:
image->setColorCount( 10 );
and storage all pixel index to array data:
for( int posIndex = 0 ; posIndex < 320 * 200 ; posIndex++ )
{
int index= image->pixelIndex( posIndex % 320 ,posIndex / 320 );
image->setPixel( posIndex % 320 ,posIndex / 320 , index /*% colTable.size()*/ );
data[ posIndex ] = ( char )index;
}
Maximum number get from function pixelIndex have be 10, because in color table is 10 items, but I have in array data item above that number 10.
When check count of items in color Table:
QVector<QRgb> colTable = image->colorTable();
cout << "size col table: " << colTable.count() << endl;
get
When image put to display:
item->setPixmap( QPixmap::fromImage( *image ));
image have correct number of collors. Who is problem? Why function pixelIndex get number above that 10? Is this error of QT?
Thanks for answer.
Bookmarks