QTfrontend/net/hwmap.cpp
changeset 10161 c092f92aee23
parent 10159 5848ed144e0b
child 10162 38dbf26475d8
--- a/QTfrontend/net/hwmap.cpp	Wed Feb 26 00:28:27 2014 +0400
+++ b/QTfrontend/net/hwmap.cpp	Wed Feb 26 23:07:55 2014 +0400
@@ -17,6 +17,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <QPainter>
+#include <QBitmap>
+#include <QLinearGradient>
+
 #include "hwconsts.h"
 #include "hwmap.h"
 
@@ -58,14 +62,30 @@
 }
 
 void HWMap::onClientDisconnect()
-{
+{    
+    QLinearGradient linearGrad(QPoint(128, 0), QPoint(128, 128));
+    linearGrad.setColorAt(1, QColor(0, 0, 192));
+    linearGrad.setColorAt(0, QColor(66, 115, 225));
+
     if (readbuffer.size() == 128 * 32 + 1)
     {
         quint8 *buf = (quint8*) readbuffer.constData();
         QImage im(buf, 256, 128, QImage::Format_Mono);
         im.setNumColors(2);
+
+        QPixmap px(QSize(256, 128));
+        QPixmap pxres(px.size());
+        QPainter p(&pxres);
+
+        px.fill(Qt::yellow);
+        QBitmap bm = QBitmap::fromImage(im);
+        px.setMask(bm);
+
+        p.fillRect(pxres.rect(), linearGrad);
+        p.drawPixmap(0, 0, px);
+
         emit HHLimitReceived(buf[128 * 32]);
-        emit ImageReceived(im);
+        emit ImageReceived(px);
     }
 }