Added ability to reverse lines in cross line animation.
This commit is contained in:
parent
7fd90cb38b
commit
cc1f597c6e
2 changed files with 6 additions and 2 deletions
|
|
@ -12,8 +12,10 @@ namespace Ui {
|
|||
|
||||
CrossLineAnimation::CrossLineAnimation(
|
||||
const style::CrossLineAnimation &st,
|
||||
bool reversed,
|
||||
float angle)
|
||||
: _st(st)
|
||||
, _reversed(reversed)
|
||||
, _transparentPen(Qt::transparent, st.stroke, Qt::SolidLine, Qt::RoundCap)
|
||||
, _strokePen(st.fg, st.stroke, Qt::SolidLine, Qt::RoundCap)
|
||||
, _line(st.startPosition, st.endPosition)
|
||||
|
|
@ -59,11 +61,11 @@ QImage CrossLineAnimation::image(float64 progress) const {
|
|||
_st.icon.paint(q, 0, 0, _st.icon.width());
|
||||
|
||||
q.setPen(_strokePen);
|
||||
q.drawLine(bottomLine);
|
||||
q.drawLine(_reversed ? topLine : bottomLine);
|
||||
|
||||
q.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
q.setPen(_transparentPen);
|
||||
q.drawLine(topLine);
|
||||
q.drawLine(_reversed ? bottomLine : topLine);
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ class CrossLineAnimation {
|
|||
public:
|
||||
CrossLineAnimation(
|
||||
const style::CrossLineAnimation &st,
|
||||
bool reversed = false,
|
||||
float angle = 315);
|
||||
|
||||
void paint(Painter &p, QPoint position, float64 progress);
|
||||
|
|
@ -25,6 +26,7 @@ private:
|
|||
QImage image(float64 progress) const;
|
||||
|
||||
const style::CrossLineAnimation &_st;
|
||||
const bool _reversed;
|
||||
const QPen _transparentPen;
|
||||
const QPen _strokePen;
|
||||
QLineF _line;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue