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);
}
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);
}
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);
}
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);
}
Aggregations