imagePixelMode1 = reinterpret_cast<uint *>(curQImageMode1.bits());
imagePixelMode1[i] = qGray(data[i],data[i],data[i]);
C++ (Qt)QImage CreateImage( const QVector<char> & src, int w, int h ){ QImage img(w, h, QImage::Format_Indexed8); static QVector<QRgb> colorTable; if (!colorTable.size()) { colorTable.resize(256); for (int i = 0; i < 256; ++i) colorTable[i] = qRgba(i, i, i, 255); } img.setColorTable(colorTable); for (int y = 0; y < h; ++y) memmove(img.scanLine(y), &src[0] + y * w, w); return img;}
for (int y = 0; y < h; ++y) { uchar * dst = img.scanLine(y); for (int y = 0; y < h; ++y) memmove(dst, &src[0] + y * w, w); }
uchar * dst = img.bits();for(int i = 0; i < 4096; i++)dst[i] = data(i); // data(i) - массив с данными пикселей. принятый по ethernet
curQImageMode1 = QImage(1,4098,QImage::Format_Indexed8); static QVector<QRgb> colorTable; if (!colorTable.size()) { colorTable.resize(256); for (int i = 0; i < 256; ++i) colorTable[i] = qRgb(i, i, i); } curQImageMode1.setColorTable(colorTable); imagePixelMode1 = curQImageMode1.bits(); for(int i = 0; i < 4096; i++) {imagePixelMode1[i] = 255; } //Дальше каждому байту присвавиваем индекс imagePixelMode1[i] = data[i];