private void DrawAccidentals(ScoreRendererBase renderer, Note element, double notePositionY, FontProfile fontProfile) { int numberOfSingleAccidentals = Math.Abs(element.Alter) % 2; int numberOfDoubleAccidentals = Convert.ToInt32(Math.Floor((double)(Math.Abs(element.Alter) / 2))); if (element.Alter - scoreService.CurrentKey.StepToAlter(element.Step) - alterationService.Get(element.Step) > 0) { alterationService.Set(element.Step, element.Alter - scoreService.CurrentKey.StepToAlter(element.Step)); double accPlacement = scoreService.CursorPositionX - 8 * numberOfSingleAccidentals - 6 * numberOfDoubleAccidentals; for (int i = 0; i < numberOfSingleAccidentals; i++) { renderer.DrawCharacter(fontProfile.MusicFont.Sharp, MusicFontStyles.MusicFont, accPlacement, notePositionY, element); accPlacement += 9; } for (int i = 0; i < numberOfDoubleAccidentals; i++) { renderer.DrawCharacter(fontProfile.MusicFont.DoubleSharp, MusicFontStyles.MusicFont, accPlacement, notePositionY, element); accPlacement += 9; } } else if (element.Alter - scoreService.CurrentKey.StepToAlter(element.Step) - alterationService.Get(element.Step) < 0) { alterationService.Set(element.Step, element.Alter - scoreService.CurrentKey.StepToAlter(element.Step)); double accPlacement = scoreService.CursorPositionX - 8 * numberOfSingleAccidentals - 6 * numberOfDoubleAccidentals; for (int i = 0; i < numberOfSingleAccidentals; i++) { renderer.DrawCharacter(fontProfile.MusicFont.Flat, MusicFontStyles.MusicFont, accPlacement, notePositionY, element); accPlacement += 9; } for (int i = 0; i < numberOfDoubleAccidentals; i++) { renderer.DrawCharacter(fontProfile.MusicFont.DoubleFlat, MusicFontStyles.MusicFont, accPlacement, notePositionY, element); accPlacement += 9; } } if (element.HasNatural == true) { renderer.DrawCharacter(fontProfile.MusicFont.Natural, MusicFontStyles.MusicFont, scoreService.CursorPositionX - 10, notePositionY, element); } }
private void DrawAccidentals(ScoreRendererBase renderer, Note element, double notePositionY, int numberOfSingleAccidentals, int numberOfDoubleAccidentals) { if (element.Alter - scoreService.CurrentKey.StepToAlter(element.Step) - alterationService.Get(element.Step) > 0) { alterationService.Set(element.Step, element.Alter - scoreService.CurrentKey.StepToAlter(element.Step)); double accPlacement = scoreService.CursorPositionX - 9 * numberOfSingleAccidentals - 9 * numberOfDoubleAccidentals; for (int i = 0; i < numberOfSingleAccidentals; i++) { renderer.DrawString(renderer.Settings.CurrentFont.Sharp, MusicFontStyles.MusicFont, accPlacement, notePositionY, element); accPlacement += 9; } for (int i = 0; i < numberOfDoubleAccidentals; i++) { renderer.DrawString(renderer.Settings.CurrentFont.DoubleSharp, MusicFontStyles.MusicFont, accPlacement, notePositionY, element); accPlacement += 9; } } else if (element.Alter - scoreService.CurrentKey.StepToAlter(element.Step) - alterationService.Get(element.Step) < 0) { alterationService.Set(element.Step, element.Alter - scoreService.CurrentKey.StepToAlter(element.Step)); double accPlacement = scoreService.CursorPositionX - 9 * numberOfSingleAccidentals - 9 * numberOfDoubleAccidentals; for (int i = 0; i < numberOfSingleAccidentals; i++) { renderer.DrawString(renderer.Settings.CurrentFont.Flat, MusicFontStyles.MusicFont, accPlacement, notePositionY, element); accPlacement += 9; } for (int i = 0; i < numberOfDoubleAccidentals; i++) { renderer.DrawString(renderer.Settings.CurrentFont.DoubleFlat, MusicFontStyles.MusicFont, accPlacement, notePositionY, element); accPlacement += 9; } } if (element.HasNatural == true) { renderer.DrawString(renderer.Settings.CurrentFont.Natural, MusicFontStyles.MusicFont, scoreService.CursorPositionX - 9, notePositionY, element); } }