use of com.xenoage.zong.core.music.barline.BarlineStyle in project Zong by Xenoage.
the class BarlineReader method read.
private void read() {
MxlRightLeftMiddle location = mxlBarline.getLocation();
MxlRepeat repeat = mxlBarline.getRepeat();
BarlineStyle style = null;
if (mxlBarline.getBarStyle() != null)
style = Equivalents.barlineStyles.getBy2(mxlBarline.getBarStyle().getBarStyle());
if (repeat != null) {
// repeat barline
if (repeat.getDirection() == MxlBackwardForward.Forward) {
style = notNull(style, BarlineStyle.HeavyLight);
barline = Companion.barlineForwardRepeat(style);
} else if (repeat.getDirection() == MxlBackwardForward.Backward) {
style = notNull(style, BarlineStyle.LightHeavy);
int times = notNull(repeat.getTimes(), 1);
barline = Companion.barlineBackwardRepeat(style, times);
}
} else if (style != null) {
// regular barline
barline = Companion.barline(style);
}
if (barline != null) {
// side / beat
if (location == MxlRightLeftMiddle.Left)
side = Left;
else if (location == MxlRightLeftMiddle.Right)
side = Right;
}
}
use of com.xenoage.zong.core.music.barline.BarlineStyle in project Zong by Xenoage.
the class BarlineRenderer method draw.
/**
* Draws the given {@link BarlineStamping} on the given {@link Canvas},
* using the given {@link RendererArgs}.
*/
@Override
public void draw(Stamping stamping, Canvas canvas, RendererArgs args) {
BarlineStamping barlineSt = (BarlineStamping) stamping;
List<StaffStamping> staves = barlineSt.staves;
float xPosition = barlineSt.xMm;
float xCorrection = 0;
// lines
BarlineGroup.Style group = barlineSt.groupStyle;
BarlineStyle style = barlineSt.barline.getStyle();
if (group == null || group == BarlineGroup.Style.Single || group == BarlineGroup.Style.Common) {
// draw single barlines
for (StaffStamping staff : staves) {
xCorrection = paintBarline(canvas, args, staff, (staff.linesCount - 1) * 2, staff, 0, xPosition, style);
}
}
if (group == BarlineGroup.Style.Mensurstrich || group == BarlineGroup.Style.Common) {
// draw barlines between staves
for (int i = 0; i < staves.size() - 1; i++) {
xCorrection = paintBarline(canvas, args, staves.get(i), 0, staves.get(i + 1), (staves.get(i + 1).linesCount - 1) * 2, xPosition, style);
}
}
// repeat dots
// TODO: xCorrection is the value of the last staff, but this may differ
// draw repeat dots directly after drawing the corresponding staff!
BarlineRepeat repeat = barlineSt.barline.getRepeat();
if (repeat == BarlineRepeat.Forward || repeat == BarlineRepeat.Both) {
paintRepeatDots(staves, xPosition + xCorrection, 1, canvas, args);
}
if (repeat == BarlineRepeat.Backward || repeat == BarlineRepeat.Both) {
paintRepeatDots(staves, xPosition + xCorrection, -1, canvas, args);
}
}
Aggregations