QBrush linearPos(QBrush start, QBrush end, qreal pos) { QColor c; c.setRedF(linearPos(start.color().redF(), end.color().redF(), pos)); c.setGreenF(linearPos(start.color().greenF(), end.color().greenF(), pos)); c.setBlueF(linearPos(start.color().blueF(), end.color().blueF(), pos)); end.setColor(c); return end; }
QVariant PieSliceAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const { PieSliceData startValue = start.value<PieSliceData>(); PieSliceData endValue = end.value<PieSliceData>(); PieSliceData result; result = endValue; result.m_center = linearPos(startValue.m_center, endValue.m_center, progress); result.m_radius = linearPos(startValue.m_radius, endValue.m_radius, progress); result.m_startAngle = linearPos(startValue.m_startAngle, endValue.m_startAngle, progress); result.m_angleSpan = linearPos(startValue.m_angleSpan, endValue.m_angleSpan, progress); result.m_slicePen = linearPos(startValue.m_slicePen, endValue.m_slicePen, progress); result.m_sliceBrush = linearPos(startValue.m_sliceBrush, endValue.m_sliceBrush, progress); return qVariantFromValue(result); }
QPointF linearPos(QPointF start, QPointF end, qreal pos) { qreal x = linearPos(start.x(), end.x(), pos); qreal y = linearPos(start.y(), end.y(), pos); return QPointF(x, y); }
long Concentration::getCell(int x, int y) { return getCell(linearPos(x, y)); }
void Concentration::setCell(long value, int x, int y) { setCell(value, linearPos(x, y)); }