Search in sources :

Example 1 with StaffSymbolStamping

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

the class DirectionStamper method createPedal.

/**
 * Creates a {@link StaffSymbolStamping} for the given {@link Pedal}.
 */
public StaffSymbolStamping createPedal(Pedal pedal, StamperContext context) {
    val staff = context.getCurrentStaffStamping();
    // positioning
    // below (default): 4 IS below the base line
    // above: 3 IS above the top line
    float defaultLPBelow = -4f * 2;
    float defaultLPAbove = (staff.linesCount - 1) * 2 + 3 * 2;
    SP sp = computePosition(pedal, staff, defaultLPBelow, defaultLPAbove, defaultLPBelow);
    // create stamping
    Symbol symbol = context.getSymbol(CommonSymbol.getPedal(pedal.getType()));
    return new StaffSymbolStamping(null, staff, symbol, null, sp, 1, false);
}
Also used : lombok.val(lombok.val) CommonSymbol(com.xenoage.zong.symbols.common.CommonSymbol) Symbol(com.xenoage.zong.symbols.Symbol) StaffSymbolStamping(com.xenoage.zong.musiclayout.stampings.StaffSymbolStamping) SP(com.xenoage.zong.core.music.format.SP)

Example 2 with StaffSymbolStamping

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

the class ElementStamper method createClefStamping.

/**
 * Creates a stamping for the given clef.
 */
public StaffSymbolStamping createClefStamping(ClefNotation clef, float xMm, StamperContext context) {
    val staff = context.getCurrentStaffStamping();
    ClefType clefType = clef.element.getType();
    return new StaffSymbolStamping(clef, staff, context.getSymbol(CommonSymbol.getClef(clefType.getSymbol())), null, sp(xMm, clefType.getLp()), clef.scaling, false);
}
Also used : lombok.val(lombok.val) ClefType(com.xenoage.zong.core.music.clef.ClefType) StaffSymbolStamping(com.xenoage.zong.musiclayout.stampings.StaffSymbolStamping)

Example 3 with StaffSymbolStamping

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

the class ElementStamper method createRestStamping.

/**
 * Creates a stamping for the given rest.
 */
public StaffSymbolStamping createRestStamping(RestSpacing rest, float xMm, StamperContext context) {
    val staff = context.getCurrentStaffStamping();
    Symbol symbol = getRestSymbol(rest.getNotation().duration, context);
    SP sp = sp(xMm, rest.lp);
    return new StaffSymbolStamping(rest.notation, staff, symbol, null, sp, 1, false);
}
Also used : lombok.val(lombok.val) CommonSymbol(com.xenoage.zong.symbols.common.CommonSymbol) Symbol(com.xenoage.zong.symbols.Symbol) StaffSymbolStamping(com.xenoage.zong.musiclayout.stampings.StaffSymbolStamping) SP(com.xenoage.zong.core.music.format.SP)

Example 4 with StaffSymbolStamping

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

the class StaffSymbolRenderer method draw.

/**
 * Draws the given {@link StaffSymbolStamping} on the given {@link Canvas},
 * using the given {@link RendererArgs}.
 */
@Override
public void draw(Stamping stamping, Canvas canvas, RendererArgs args) {
    StaffSymbolStamping s = (StaffSymbolStamping) stamping;
    drawWith(s.symbol, s.color, s.position, s.scaling, s.parentStaff, s.mirrorV, canvas, args);
}
Also used : StaffSymbolStamping(com.xenoage.zong.musiclayout.stampings.StaffSymbolStamping)

Aggregations

StaffSymbolStamping (com.xenoage.zong.musiclayout.stampings.StaffSymbolStamping)4 lombok.val (lombok.val)3 SP (com.xenoage.zong.core.music.format.SP)2 Symbol (com.xenoage.zong.symbols.Symbol)2 CommonSymbol (com.xenoage.zong.symbols.common.CommonSymbol)2 ClefType (com.xenoage.zong.core.music.clef.ClefType)1