-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreferencebox.cpp
More file actions
31 lines (28 loc) · 985 Bytes
/
referencebox.cpp
File metadata and controls
31 lines (28 loc) · 985 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
#include "referencebox.h"
void ReferenceBox::draw(QPainter *painter)
{
int xSize = end.x() - origen.x();
int ySize = end.y() - origen.y();
painter->setBrush(Qt::NoBrush);
painter->setPen(QPen(Qt::red,2,Qt::DashDotDotLine));
painter->drawRect(origen.x(),origen.y(), xSize, ySize);
painter->setBrush(QBrush(Qt::red, Qt::SolidPattern));
painter->setPen(QPen(Qt::red,2,Qt::SolidLine));
painter->drawEllipse(origen,5,5);
painter->setPen(QPen(Qt::white,2,Qt::SolidLine));
painter->drawText(origen+QPoint(-4,4),"X");
if(candela != NULL){
long double sum = 0;
for(int i = 0; i<xSize; i++){
for(int y = 0; y < ySize; y++){
sum += (*candela)[origen.x()+i][origen.y()+y];
}
}
avgGrey = sum/(xSize*ySize);
painter->drawText(QPoint(origen.x() + xSize + 5, origen.y()+5),QString::number(avgGrey));
}
}
unsigned short ReferenceBox::getAvgGrey()
{
return avgGrey;
}