11 #include "rtabmap/gui/rtabmap_gui_export.h"
14 #include <QtGui/QPainter>
27 pixmap_ = QPixmap::fromImage(image);
40 float w = pixmap_.width();
41 float h = pixmap_.height();
42 float widthRatio =
float(this->rect().width()) /
w;
43 float heightRatio =
float(this->rect().height()) /
h;
45 if(widthRatio < heightRatio)
57 if(w < this->rect().width())
59 offsetX = (this->rect().width() -
w)/2.0
f;
61 if(h < this->rect().height())
63 offsetY = (this->rect().height() -
h)/2.0
f;
71 QPainter painter(
this);
75 painter.setBrush(brush_);
76 painter.drawRect(this->rect());
83 float ratio, offsetX, offsetY;
84 this->computeScaleOffsets(
ratio, offsetX, offsetY);
85 painter.translate(offsetX, offsetY);
87 painter.drawPixmap(QPoint(0,0), pixmap_);