4 * Draw a map on the playground.
6 * Copyright: (c) 2007 CTU Dragons
7 * CTU FEE - Department of Control Engineering
8 * Authors: Michal Vokac, Michal Sojka
15 #include "PlaygroundScene.h"
21 Map::Map(const QPen &pen, const QBrush &brush) :
22 QObject(), QGraphicsItem()
26 mapImage = QImage(MAP_WIDTH, MAP_HEIGHT, QImage::Format_ARGB32);
27 mapImage.fill(QColor(0, 0, 0, 200).rgba());
35 QRectF Map::boundingRect() const
37 return QRectF(0,0,PLAYGROUND_WIDTH_MM,PLAYGROUND_HEIGHT_MM);
40 void Map::paint(QPainter *painter,
41 const QStyleOptionGraphicsItem *option, QWidget *widget)
48 painter->setBrush(brush);
49 painter->drawImage(QPointF(0,0),mapImage) ;
52 void Map::setPixelColor(int x, int y, QColor color)
58 mapImage.setPixel(x, y, value);