QTfrontend/net/hwmap.cpp
changeset 10162 38dbf26475d8
parent 10161 c092f92aee23
child 10166 4be4a3302ff8
--- a/QTfrontend/net/hwmap.cpp	Wed Feb 26 23:07:55 2014 +0400
+++ b/QTfrontend/net/hwmap.cpp	Wed Feb 26 23:43:42 2014 +0400
@@ -86,6 +86,26 @@
 
         emit HHLimitReceived(buf[128 * 32]);
         emit ImageReceived(px);
+    } else if (readbuffer.size() == 128 * 256 + 1)
+    {
+        QVector<QRgb> colorTable;
+        colorTable.resize(256);
+        for(int i = 0; i < 256; ++i)
+            colorTable[i] = qRgba(255, 255, 0, i);
+
+        const quint8 *buf = (const quint8*) readbuffer.constData();
+        QImage im(buf, 256, 128, QImage::Format_Indexed8);
+        im.setColorTable(colorTable);
+
+        QPixmap px = QPixmap::fromImage(im, Qt::ColorOnly);
+        QPixmap pxres(px.size());
+        QPainter p(&pxres);
+
+        p.fillRect(pxres.rect(), linearGrad);
+        p.drawPixmap(0, 0, px);
+
+        emit HHLimitReceived(buf[128 * 256]);
+        emit ImageReceived(px);
     }
 }