コード例 #1
0
        public virtual void BuildBoundingsLookup(MasterBarBounds masterBarBounds, float cx, float cy)
        {
            var barBounds = new BarBounds();

            barBounds.Bar          = Bar;
            barBounds.VisualBounds = new Bounds(cx + X, cy + Y + TopPadding, Width, Height - TopPadding - BottomPadding);
            barBounds.RealBounds   = new Bounds(cx + X, cy + Y, Width, Height);
            masterBarBounds.AddBar(barBounds);

            foreach (var voice in _voiceContainers)
            {
                var c = _voiceContainers[voice];
                if (!c.Voice.IsEmpty)
                {
                    for (int i = 0, j = c.BeatGlyphs.Count; i < j; i++)
                    {
                        var bc = c.BeatGlyphs[i];

                        var beatBoundings = new BeatBounds();
                        beatBoundings.Beat         = bc.Beat;
                        beatBoundings.VisualBounds = new Bounds(cx + X + c.X + bc.X + bc.OnNotes.X,
                                                                barBounds.VisualBounds.Y, bc.OnNotes.Width, barBounds.VisualBounds.H);
                        beatBoundings.RealBounds = new Bounds(cx + X + c.X + bc.X, barBounds.RealBounds.Y, bc.Width,
                                                              barBounds.RealBounds.H);
                        barBounds.AddBeat(beatBoundings);
                    }
                }
            }
        }
コード例 #2
0
ファイル: BarRendererBase.cs プロジェクト: zwdesigns/alphaTab
        public virtual void BuildBoundingsLookup(MasterBarBounds masterBarBounds, float cx, float cy)
        {
            var barBounds = new BarBounds();

            barBounds.Bar          = Bar;
            barBounds.VisualBounds = new Bounds
            {
                X = cx + X,
                Y = cy + Y + TopPadding,
                W = Width,
                H = Height - TopPadding - BottomPadding
            };
            barBounds.RealBounds = new Bounds
            {
                X = cx + X,
                Y = cy + Y,
                W = Width,
                H = Height
            };
            masterBarBounds.AddBar(barBounds);

            foreach (var voice in _voiceContainers)
            {
                var c          = _voiceContainers[voice];
                var isEmptyBar = (Bar.IsEmpty && voice == 0);
                if (!c.Voice.IsEmpty || isEmptyBar)
                {
                    for (int i = 0, j = c.BeatGlyphs.Count; i < j; i++)
                    {
                        var bc = c.BeatGlyphs[i];

                        var beatBoundings = new BeatBounds();
                        beatBoundings.Beat         = bc.Beat;
                        beatBoundings.VisualBounds = new Bounds
                        {
                            X = cx + X + c.X + bc.X + bc.OnNotes.X,
                            Y = barBounds.VisualBounds.Y,
                            W = bc.OnNotes.Width,
                            H = barBounds.VisualBounds.H
                        };
                        beatBoundings.RealBounds = new Bounds
                        {
                            X = cx + X + c.X + bc.X,
                            Y = barBounds.RealBounds.Y,
                            W = bc.Width,
                            H = barBounds.RealBounds.H
                        };

                        if (isEmptyBar)
                        {
                            beatBoundings.VisualBounds.X = cx + X;
                            beatBoundings.RealBounds.X   = beatBoundings.VisualBounds.X;
                        }

                        barBounds.AddBeat(beatBoundings);
                    }
                }
            }
        }