14 * |
14 * |
15 * You should have received a copy of the GNU General Public License |
15 * You should have received a copy of the GNU General Public License |
16 * along with this program; if not, write to the Free Software |
16 * along with this program; if not, write to the Free Software |
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
18 */ |
18 */ |
|
19 |
|
20 #include <QPainter> |
|
21 #include <QBitmap> |
|
22 #include <QLinearGradient> |
19 |
23 |
20 #include "hwconsts.h" |
24 #include "hwconsts.h" |
21 #include "hwmap.h" |
25 #include "hwmap.h" |
22 |
26 |
23 HWMap::HWMap(QObject * parent) : |
27 HWMap::HWMap(QObject * parent) : |
56 arguments << "--landpreview"; |
60 arguments << "--landpreview"; |
57 return arguments; |
61 return arguments; |
58 } |
62 } |
59 |
63 |
60 void HWMap::onClientDisconnect() |
64 void HWMap::onClientDisconnect() |
61 { |
65 { |
|
66 QLinearGradient linearGrad(QPoint(128, 0), QPoint(128, 128)); |
|
67 linearGrad.setColorAt(1, QColor(0, 0, 192)); |
|
68 linearGrad.setColorAt(0, QColor(66, 115, 225)); |
|
69 |
62 if (readbuffer.size() == 128 * 32 + 1) |
70 if (readbuffer.size() == 128 * 32 + 1) |
63 { |
71 { |
64 quint8 *buf = (quint8*) readbuffer.constData(); |
72 quint8 *buf = (quint8*) readbuffer.constData(); |
65 QImage im(buf, 256, 128, QImage::Format_Mono); |
73 QImage im(buf, 256, 128, QImage::Format_Mono); |
66 im.setNumColors(2); |
74 im.setNumColors(2); |
|
75 |
|
76 QPixmap px(QSize(256, 128)); |
|
77 QPixmap pxres(px.size()); |
|
78 QPainter p(&pxres); |
|
79 |
|
80 px.fill(Qt::yellow); |
|
81 QBitmap bm = QBitmap::fromImage(im); |
|
82 px.setMask(bm); |
|
83 |
|
84 p.fillRect(pxres.rect(), linearGrad); |
|
85 p.drawPixmap(0, 0, px); |
|
86 |
67 emit HHLimitReceived(buf[128 * 32]); |
87 emit HHLimitReceived(buf[128 * 32]); |
68 emit ImageReceived(im); |
88 emit ImageReceived(px); |
69 } |
89 } |
70 } |
90 } |
71 |
91 |
72 void HWMap::SendToClientFirst() |
92 void HWMap::SendToClientFirst() |
73 { |
93 { |