Search in sources :

Example 1 with FlagsStamping

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

the class FlagsRenderer method draw.

/**
 * Draws the given {@link FlagsStamping} on the given {@link Canvas},
 * using the given {@link RendererArgs}.
 */
@Override
public void draw(Stamping stamping, Canvas canvas, RendererArgs args) {
    FlagsStamping s = (FlagsStamping) stamping;
    Symbol symbol = args.symbolPool.getSymbol(CommonSymbol.NoteFlag);
    boolean flagsMirrored = (s.flagsDirection == FlagsDirection.Up);
    float flagsDistance = FlagsStamping.getFlagsDistance(s.flagsDirection, s.scaling);
    // draw all flags
    for (int i : range(s.flagsCount)) {
        StaffSymbolRenderer.drawWith(symbol, null, sp(s.position.xMm, // TODO: flag position is not correct yet
        s.position.lp + flagsDistance * 0.2f + /* move a little bit into the stem */
        i * 2 * flagsDistance), s.scaling, s.parentStaff, flagsMirrored, canvas, args);
    }
}
Also used : FlagsStamping(com.xenoage.zong.musiclayout.stampings.FlagsStamping) Symbol(com.xenoage.zong.symbols.Symbol) CommonSymbol(com.xenoage.zong.symbols.common.CommonSymbol)

Aggregations

FlagsStamping (com.xenoage.zong.musiclayout.stampings.FlagsStamping)1 Symbol (com.xenoage.zong.symbols.Symbol)1 CommonSymbol (com.xenoage.zong.symbols.common.CommonSymbol)1