-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrenderarea361.cpp
More file actions
44 lines (36 loc) · 850 Bytes
/
renderarea361.cpp
File metadata and controls
44 lines (36 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "renderarea361.h"
#include <QImage>
#include <QWidget>
#include <QPainter>
#include <QPaintEvent>
#include <QSizePolicy>
#include "drawable.h"
//using namespace std;
RenderArea361::RenderArea361(QWidget *parent) : QWidget(parent), Drawable()
{
image = QImage(750, 750, QImage::Format_RGB888);
image.fill(0x00ff0000);
this->setSizePolicy(QSizePolicy());
this->update();
}
void RenderArea361::setPixel(int x, int y, uint color)
{
image.setPixel(x, y, color);
}
uint RenderArea361::getPixel(int x, int y)
{
return (uint)(image.pixel(x, y));
}
void RenderArea361::updateScreen()
{
this->update();
}
QSize RenderArea361::sizeHint() const
{
return QSize(750, 750);
}
void RenderArea361::paintEvent(QPaintEvent *event) {
QPainter painter(this);
painter.drawImage(0, 0, image);
event->accept();
}