AlphaTab.Rendering.Glyphs.GroupedEffectGlyph.Paint C# (CSharp) Method

Paint() public method

public Paint ( float cx, float cy, ICanvas canvas ) : void
cx float
cy float
canvas ICanvas
return void
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            // if we are linked with the previous, the first glyph of the group will also render this one.
            if (IsLinkedWithPrevious)
            {
                return;
            }

            // we are not linked with any glyph therefore no expansion is required, we render a simple glyph.
            if (!IsLinkedWithNext)
            {
                PaintNonGrouped(cx, cy, canvas);
                return;
            }

            // find last linked glyph that can be
            var lastLinkedGlyph = (GroupedEffectGlyph)NextGlyph;
            while (lastLinkedGlyph.IsLinkedWithNext)
            {
                lastLinkedGlyph = (GroupedEffectGlyph)lastLinkedGlyph.NextGlyph;
            }

            // calculate end X-position

            var cxRenderer = cx - Renderer.X;

            var endRenderer = lastLinkedGlyph.Renderer;
            var endBeatX = endRenderer.GetBeatX(lastLinkedGlyph.Beat, _endPosition);
            var endX = cxRenderer + endRenderer.X + endBeatX;

            PaintGrouped(cx, cy, endX, canvas);
        }