Search in sources :

Example 21 with StaffStamping

use of com.xenoage.zong.musiclayout.stampings.StaffStamping in project Zong by Xenoage.

the class ScoreLayout method getScoreLP.

/**
 * Computes the {@link ScoreLayoutPos} of the given {@link MP} at the given line position.
 * If not found, null is returned.
 */
public ScoreLayoutPos getScoreLP(MP mp, float lp) {
    int iFrame = getFrameIndexOf(mp.getMeasure());
    if (iFrame > -1) {
        ScoreFrameLayout sfl = frames.get(iFrame);
        StaffStamping ss;
        if (mp.getStaff() != MP.Companion.getUnknown())
            ss = sfl.getStaffStamping(mp.getStaff(), mp.getMeasure());
        else
            ss = sfl.getStaffStamping(0, mp.getMeasure());
        if (ss != null) {
            float x = ss.positionMm.x + ss.system.getXMmAt(mp.getTime());
            float y = ss.computeYMm(lp);
            return new ScoreLayoutPos(iFrame, new Point2f(x, y));
        }
    }
    return null;
}
Also used : Point2f(com.xenoage.utils.math.geom.Point2f) StaffStamping(com.xenoage.zong.musiclayout.stampings.StaffStamping)

Aggregations

StaffStamping (com.xenoage.zong.musiclayout.stampings.StaffStamping)21 Point2f (com.xenoage.utils.math.geom.Point2f)10 BitmapStaff (com.xenoage.zong.musiclayout.stampings.bitmap.BitmapStaff)8 Color (com.xenoage.utils.color.Color)6 FormattedText (com.xenoage.zong.core.text.FormattedText)5 BitmapLine (com.xenoage.zong.musiclayout.stampings.bitmap.BitmapLine)5 StaffTextStamping (com.xenoage.zong.musiclayout.stampings.StaffTextStamping)3 BarlineGroup (com.xenoage.zong.core.music.group.BarlineGroup)2 FormattedTextStyle (com.xenoage.zong.core.text.FormattedTextStyle)2 ScoreFrameLayout (com.xenoage.zong.musiclayout.ScoreFrameLayout)2 BarlineStamping (com.xenoage.zong.musiclayout.stampings.BarlineStamping)2 StaffCursorStamping (com.xenoage.zong.musiclayout.stampings.StaffCursorStamping)2 SystemCursorStamping (com.xenoage.zong.musiclayout.stampings.SystemCursorStamping)2 TupletStamping (com.xenoage.zong.musiclayout.stampings.TupletStamping)2 MaybeNull (com.xenoage.utils.annotations.MaybeNull)1 It (com.xenoage.utils.iterators.It)1 Rectangle2f (com.xenoage.utils.math.geom.Rectangle2f)1 MeasureNumbering (com.xenoage.zong.core.format.MeasureNumbering)1 ColumnHeader (com.xenoage.zong.core.header.ColumnHeader)1 Barline (com.xenoage.zong.core.music.barline.Barline)1