Search in sources :

Example 6 with Symbol

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);
}
Also used : CommonSymbol(com.xenoage.zong.symbols.common.CommonSymbol) Symbol(com.xenoage.zong.symbols.Symbol)

Example 7 with Symbol

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);
    }
}
Also used : FlagsStamping(com.xenoage.zong.musiclayout.stampings.FlagsStamping) Symbol(com.xenoage.zong.symbols.Symbol) CommonSymbol(com.xenoage.zong.symbols.common.CommonSymbol)

Example 8 with Symbol

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);
}
Also used : lombok.val(lombok.val) CommonSymbol(com.xenoage.zong.symbols.common.CommonSymbol) Symbol(com.xenoage.zong.symbols.Symbol) StaffTextStamping(com.xenoage.zong.musiclayout.stampings.StaffTextStamping) SP(com.xenoage.zong.core.music.format.SP) CommonSymbol(com.xenoage.zong.symbols.common.CommonSymbol)

Example 9 with Symbol

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);
}
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 10 with Symbol

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);
}
Also used : lombok.val(lombok.val) CommonSymbol(com.xenoage.zong.symbols.common.CommonSymbol) Symbol(com.xenoage.zong.symbols.Symbol) Spacings(com.xenoage.zong.musiclayout.settings.Spacings) KeySignatureStamping(com.xenoage.zong.musiclayout.stampings.KeySignatureStamping)

Aggregations

Symbol (com.xenoage.zong.symbols.Symbol)13 CommonSymbol (com.xenoage.zong.symbols.common.CommonSymbol)12 lombok.val (lombok.val)5 SP (com.xenoage.zong.core.music.format.SP)4 Point2f (com.xenoage.utils.math.geom.Point2f)2 KeySignatureStamping (com.xenoage.zong.musiclayout.stampings.KeySignatureStamping)2 StaffSymbolStamping (com.xenoage.zong.musiclayout.stampings.StaffSymbolStamping)2 StaffTextStamping (com.xenoage.zong.musiclayout.stampings.StaffTextStamping)2 Beam (com.xenoage.zong.core.music.beam.Beam)1 Chord (com.xenoage.zong.core.music.chord.Chord)1 StemDirection (com.xenoage.zong.core.music.chord.StemDirection)1 SlurWaypoint (com.xenoage.zong.core.music.slur.SlurWaypoint)1 Duration (com.xenoage.zong.core.music.util.Duration)1 ChordStampings (com.xenoage.zong.musiclayout.layouter.scoreframelayout.util.ChordStampings)1 ChordWidths (com.xenoage.zong.musiclayout.settings.ChordWidths)1 LayoutSettings (com.xenoage.zong.musiclayout.settings.LayoutSettings)1 Spacings (com.xenoage.zong.musiclayout.settings.Spacings)1 FlagsStamping (com.xenoage.zong.musiclayout.stampings.FlagsStamping)1 StaffStamping (com.xenoage.zong.musiclayout.stampings.StaffStamping)1 TimeStamping (com.xenoage.zong.musiclayout.stampings.TimeStamping)1