Beispiel #1
0
        /** Draw the Chord Symbol:
         * - Draw the accidental symbols.
         * - Draw the black circle notes.
         * - Draw the stems.
         * @param ytop The ylocation (in pixels) where the top of the staff starts.
         */
        public override void Draw(Graphics g, Pen pen, int ytop)
        {
            /* Align the chord to the right */
            g.TranslateTransform(Width - MinWidth, 0);

            /* Draw the accidentals. */
            WhiteNote topstaff = WhiteNote.Top(clef);
            int       xpos     = DrawAccid(g, pen, ytop);

            /* Draw the notes */
            g.TranslateTransform(xpos, 0);
            DrawNotes(g, pen, ytop, topstaff);
            if (sheetmusic != null && sheetmusic.ShowNoteLetters != 0)
            {
                DrawNoteLetters(g, pen, ytop, topstaff);
            }

            /* Draw the stems */
            if (stem1 != null)
            {
                stem1.Draw(g, pen, ytop, topstaff);
            }
            if (stem2 != null)
            {
                stem2.Draw(g, pen, ytop, topstaff);
            }

            g.TranslateTransform(-xpos, 0);
            g.TranslateTransform(-(Width - MinWidth), 0);
        }
Beispiel #2
0
        private int GetAboveStaff()
        {
            /* Find the topmost note in the chord */
            WhiteNote topnote = notedata[notedata.Length - 1].whitenote;

            /* The stem.End is the note position where the stem ends.
             * Check if the stem end is higher than the top note.
             */
            if (stem1 != null)
            {
                topnote = WhiteNote.Max(topnote, stem1.End);
            }
            if (stem2 != null)
            {
                topnote = WhiteNote.Max(topnote, stem2.End);
            }

            int dist   = topnote.Dist(WhiteNote.Top(clef)) * SheetMusic.NoteHeight / 2;
            int result = 0;

            if (dist > 0)
            {
                result = dist;
            }

            /* Check if any accidental symbols extend above the staff */
            foreach (AccidSymbol symbol in accidsymbols)
            {
                if (symbol.AboveStaff > result)
                {
                    result = symbol.AboveStaff;
                }
            }
            return(result);
        }
Beispiel #3
0
        int GetAboveStaff()
        {
            int dist = WhiteNote.Top(clef).Dist(whitenote) *
                       SheetMusic.NoteHeight / 2;

            if (accid == Accid.Sharp || accid == Accid.Natural)
            {
                dist -= SheetMusic.NoteHeight;
            }
            else if (accid == Accid.Flat)
            {
                dist -= 3 * SheetMusic.NoteHeight / 2;
            }

            if (dist < 0)
            {
                return(-dist);
            }
            else
            {
                return(0);
            }
        }
Beispiel #4
0
        /** Draw the symbol.
         * @param ytop The ylocation (in pixels) where the top of the staff starts.
         */
        public override void Draw(Graphics g, Pen pen, int ytop)
        {
            /* Align the symbol to the right */
            g.TranslateTransform(Width - MinWidth, 0);

            /* Store the y-pixel value of the top of the whitenote in ynote. */
            int ynote = ytop + WhiteNote.Top(clef).Dist(whitenote) *
                        SheetMusic.NoteHeight / 2;

            if (accid == Accid.Sharp)
            {
                DrawSharp(g, pen, ynote);
            }
            else if (accid == Accid.Flat)
            {
                DrawFlat(g, pen, ynote);
            }
            else if (accid == Accid.Natural)
            {
                DrawNatural(g, pen, ynote);
            }

            g.TranslateTransform(-(Width - MinWidth), 0);
        }