try to compute slur shape
This commit is contained in:
parent
221f20b3c7
commit
dd5fb88ccc
2 changed files with 17 additions and 0 deletions
|
@ -592,6 +592,21 @@ void Slur::computeBezier(SlurSegment* ss, QPointF p6o)
|
||||||
if (ss->system() && ss->track() >= 0)
|
if (ss->system() && ss->track() >= 0)
|
||||||
staffOffset = QPointF(0.0, -ss->system()->staff(ss->staffIdx())->y());
|
staffOffset = QPointF(0.0, -ss->system()->staff(ss->staffIdx())->y());
|
||||||
|
|
||||||
|
QPainterPath p;
|
||||||
|
p.moveTo(QPointF());
|
||||||
|
p.cubicTo(p3 + p3o - th, p4 + p4o - th, p2);
|
||||||
|
ss->_shape.clear();
|
||||||
|
QPointF start;
|
||||||
|
start = t.map(start);
|
||||||
|
int nbShapes = 10;
|
||||||
|
for (int i = 1; i <= nbShapes; i++) {
|
||||||
|
QPointF point = t.map(p.pointAtPercent(i/float(nbShapes)));
|
||||||
|
QRectF re(start, point);
|
||||||
|
re.translate(staffOffset);
|
||||||
|
ss->_shape.add(re);
|
||||||
|
start = point;
|
||||||
|
}
|
||||||
|
|
||||||
ss->path.translate(staffOffset);
|
ss->path.translate(staffOffset);
|
||||||
ss->shapePath.translate(staffOffset);
|
ss->shapePath.translate(staffOffset);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,7 @@ class SlurSegment : public SpannerSegment {
|
||||||
|
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
QPainterPath shapePath;
|
QPainterPath shapePath;
|
||||||
|
Shape _shape;
|
||||||
QPointF autoAdjustOffset;
|
QPointF autoAdjustOffset;
|
||||||
|
|
||||||
void computeBezier();
|
void computeBezier();
|
||||||
|
@ -116,6 +117,7 @@ class SlurSegment : public SpannerSegment {
|
||||||
void setSlurOffset(Grip i, const QPointF& val) { _ups[int(i)].off = val; }
|
void setSlurOffset(Grip i, const QPointF& val) { _ups[int(i)].off = val; }
|
||||||
const struct UP& ups(Grip i) const { return _ups[int(i)]; }
|
const struct UP& ups(Grip i) const { return _ups[int(i)]; }
|
||||||
struct UP& ups(Grip i) { return _ups[int(i)]; }
|
struct UP& ups(Grip i) { return _ups[int(i)]; }
|
||||||
|
virtual Shape shape() const override { return _shape; }
|
||||||
|
|
||||||
friend class Tie;
|
friend class Tie;
|
||||||
friend class Slur;
|
friend class Slur;
|
||||||
|
|
Loading…
Reference in a new issue