use of com.xenoage.zong.symbols.Symbol in project Zong by Xenoage.
the class BarlineRenderer method paintRepeatDot.
/**
* Paints a repeat dot at the given position.
*/
private static void paintRepeatDot(Canvas canvas, RendererArgs args, StaffStamping staff, SP position) {
Symbol dotSymbol = args.symbolPool.getSymbol(CommonSymbol.NoteDot);
StaffSymbolRenderer.drawWith(dotSymbol, Color.Companion.getBlack(), position, 1, staff, false, canvas, args);
}
use of com.xenoage.zong.symbols.Symbol 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);
}
}
use of com.xenoage.zong.symbols.Symbol in project Zong by Xenoage.
the class DirectionStamper method createDynamics.
/**
* Creates a {@link StaffTextStamping} for the given {@link Dynamic}s.
*/
public StaffTextStamping createDynamics(Dynamic dynamics, StamperContext context) {
val staff = context.getCurrentStaffStamping();
// positioning
// below (default): 3 IS below the base line, or 2 IS below the lowest note
// above: 2 IS above the top line, or 1 IS above the highest note
float defaultLPBelow = -3f * 2;
float defaultLPAbove = (context.getCurrentStaffStamping().linesCount - 1) * 2 + 2 * 2;
SP sp = computePosition(dynamics, staff, defaultLPBelow, defaultLPAbove, defaultLPBelow);
// create text
CList<FormattedTextElement> elements = clist();
for (CommonSymbol s : CommonSymbol.getDynamics(dynamics.getValue())) {
Symbol symbol = context.getSymbol(s);
elements.add(new FormattedTextSymbol(symbol, staff.is * FONT_SIZE_IN_IS, FormattedTextStyle.Companion.getDefaultColor()));
}
elements.close();
FormattedTextParagraph paragraph = new FormattedTextParagraph(elements, Alignment.Center);
FormattedText text = Companion.fText(paragraph);
// create stamping
return new StaffTextStamping(text, sp, staff, dynamics);
}
use of com.xenoage.zong.symbols.Symbol 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.symbols.Symbol in project Zong by Xenoage.
the class ElementStamper method createKeyStamping.
/**
* Creates a stamping for the given key signature.
*/
public KeySignatureStamping createKeyStamping(TraditionalKeyNotation key, float xMm, StamperContext context) {
val staff = context.getCurrentStaffStamping();
boolean useSharps = key.element.getFifths() > 0;
Symbol symbol = context.getSymbol(useSharps ? CommonSymbol.AccidentalSharp : CommonSymbol.AccidentalFlat);
Spacings spacings = context.getSettings().spacings;
float distance = (useSharps ? spacings.widthSharp : spacings.widthFlat);
return new KeySignatureStamping(key, xMm, staff, symbol, distance);
}
Aggregations