Ejemplo n.º 1
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            if (Beat.Voice.IsEmpty)
            {
                return;
            }

            var isEmptyGlyph = PreNotes.IsEmpty && OnNotes.IsEmpty && Ties.Count == 0;

            if (isEmptyGlyph)
            {
                return;
            }

            canvas.BeginGroup(GetGroupId(Beat));

            //var c = canvas.Color;
            //var ta = canvas.TextAlign;
            //canvas.Color = new Color(255, 0, 0);
            //canvas.TextAlign = TextAlign.Left;
            //canvas.FillText(Beat.DisplayStart.ToString(), cx + X, cy + Y - 10);
            //canvas.Color = c;
            //canvas.TextAlign = ta;

            //canvas.Color = Color.Random();
            //canvas.FillRect(cx + X, cy + Y, Width, Renderer.Height);

            //var oldColor = canvas.Color;
            //canvas.Color = new Color((byte)Platform.Platform.Random(255), (byte)Platform.Platform.Random(255), (byte)Platform.Platform.Random(255), 100);
            //canvas.FillRect(cx + X, cy + Y, Width, Renderer.Height);
            //canvas.Color = oldColor;

            //canvas.Color = new Color(200, 0, 0, 100);
            //canvas.StrokeRect(cx + X, cy + Y + 15 * Beat.Voice.Index, Width, 10);
            //canvas.Font = new Font("Arial", 10);
            //canvas.Color = new Color(0, 0, 0);
            //canvas.FillText(Beat.Voice.Index + ":" + Beat.Index, cx + X, cy + Y + 15 * Beat.Voice.Index);

            //if (Beat.Voice.Index == 0)
            //{
            //    canvas.Color = new Color(200, 0, 0, 100);
            //    canvas.StrokeRect(cx + X, cy + Y + PreNotes.Y + 30, Width, 10);
            //}

            PreNotes.Paint(cx + X, cy + Y, canvas);
            //if (Beat.Voice.Index == 0)
            //{
            //    canvas.Color = new Color(200, 0, 0, 100);
            //    canvas.StrokeRect(cx + X + PreNotes.X, cy + Y + PreNotes.Y, PreNotes.Width, 10);
            //}
            OnNotes.Paint(cx + X, cy + Y, canvas);
            //if (Beat.Voice.Index == 0)
            //{
            //    canvas.Color = new Color(0, 200, 0, 100);
            //    canvas.StrokeRect(cx + X + OnNotes.X, cy + Y + OnNotes.Y + 10, OnNotes.Width, 10);
            //}

            // paint the ties relative to the whole staff,
            // reason: we have possibly multiple staves involved and need to calculate the correct positions.
            var staffX = cx - VoiceContainer.X - Renderer.X;
            var staffY = cy - VoiceContainer.Y - Renderer.Y;

            for (int i = 0, j = Ties.Count; i < j; i++)
            {
                var t = Ties[i];
                t.Renderer = Renderer;
                t.Paint(staffX, staffY, canvas);
            }

            canvas.EndGroup();
        }