{
int x = 0;
int y = 0;
qreal intensity = 0;
qDebug
() <<
QTime::currentTime();
QImage image
(m_width, m_height,
QImage::Format_ARGB32_Premultiplied);
{
x = tmp[0].toInt();
y = tmp[1].toInt();
intensity = tmp[2].toDouble();
g.
setColorAt(0.0,
QColor::fromRgbF(0,
0,
0, intensity
));
g.
setColorAt(1.0,
QColor::fromRgbF(0,
0,
0,
0.0));
paint
->fillRect
(QRectF(x
- m_radius, y
- m_radius, x
+ m_radius, y
+ m_radius
), g
);
}
painter
->drawImage
(QPoint(0,
0), image
);
qDebug
() <<
QTime::currentTime();
}
void HeatMap::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
int x = 0;
int y = 0;
qreal intensity = 0;
qDebug() << QTime::currentTime();
QImage image(m_width, m_height, QImage::Format_ARGB32_Premultiplied);
QPainter *paint = new QPainter(&image);
foreach (QVariant v, m_data)
{
QStringList tmp = v.toString().split(",");
x = tmp[0].toInt();
y = tmp[1].toInt();
intensity = tmp[2].toDouble();
QRadialGradient g(QPointF(x, y), m_radius, QPointF(x, y));
g.setColorAt(0.0, QColor::fromRgbF(0, 0, 0, intensity));
g.setColorAt(1.0, QColor::fromRgbF(0, 0, 0, 0.0));
paint->fillRect(QRectF(x - m_radius, y - m_radius, x + m_radius, y + m_radius), g);
}
painter->drawImage(QPoint(0, 0), image);
qDebug() << QTime::currentTime();
}
To copy to clipboard, switch view to plain text mode
Bookmarks