当前位置: 首页>>代码示例>>C#>>正文


C# ICanvas.FillText方法代码示例

本文整理汇总了C#中ICanvas.FillText方法的典型用法代码示例。如果您正苦于以下问题:C# ICanvas.FillText方法的具体用法?C# ICanvas.FillText怎么用?C# ICanvas.FillText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICanvas的用法示例。


在下文中一共展示了ICanvas.FillText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Paint

 public override void Paint(float cx, float cy, ICanvas canvas)
 {
     if (_noteString != null)
     {
         canvas.FillText(_noteString.ToLower(), cx + X, cy + Y);
     }
 }
开发者ID:eriser,项目名称:alphaTab,代码行数:7,代码来源:NoteNumberGlyph.cs

示例2: Paint

        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var res = Renderer.Resources;
            canvas.Font = res.MarkerFont;

            canvas.FillMusicFontSymbol(cx + X, cy + Y + Renderer.Height * 0.75f, 0.75f, MusicFontSymbol.Tempo);
            canvas.FillText("= " + _tempo, cx + X + (15 * Scale), cy + Y + canvas.Font.Size / 2);
        }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:8,代码来源:TempoGlyph.cs

示例3: Paint

        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var res = Renderer.Resources;
            canvas.Font = res.MarkerFont;

            canvas.FillMusicFontSymbol(cx+ X, cy + Y, 1, MusicFontSymbol.Tempo);
            canvas.FillText("" + _tempo, cx + X + (20 * Scale), cy + X + (7 * Scale));
        }
开发者ID:eriser,项目名称:alphaTab,代码行数:8,代码来源:TempoGlyph.cs

示例4: Paint

 public override void Paint(float cx, float cy, ICanvas canvas)
 {
     canvas.Font = Font;
     var old = canvas.TextAlign;
     canvas.TextAlign = TextAlign;
     canvas.FillText(_text, cx + X, cy + Y);
     canvas.TextAlign = old;
 }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:8,代码来源:TextGlyph.cs

示例5: Paint

 public override void Paint(float cx, float cy, ICanvas canvas)
 {
     var res = Renderer.Resources;
     canvas.Color = res.MainGlyphColor;
     canvas.StrokeRect(cx + X, cy + Y, Width, 20 * Scale);
     canvas.Font = res.TablatureFont;
     canvas.FillText(_s, cx + X, cy + Y);
 }
开发者ID:eriser,项目名称:alphaTab,代码行数:8,代码来源:DummyEffectGlyph.cs

示例6: Paint

        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var res = Renderer.Resources;
            canvas.Font = res.BarNumberFont;

            var s = "x" + _count;
            var w = canvas.MeasureText(s)/1.5f;
            canvas.FillText(s, cx + X - w, cy + Y);
        }
开发者ID:eriser,项目名称:alphaTab,代码行数:9,代码来源:RepeatCountGlyph.cs

示例7: Paint

        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            //TabBarRenderer tabBarRenderer = (TabBarRenderer)Renderer;
            var track = Renderer.Bar.Track;
            var res = Renderer.Resources;

            var startY = cy + Y + TabBarRenderer.LineSpacing * Scale * 0.6f;
            //var endY = cy + Y + tabBarRenderer.GetTabY(track.Tuning.Count, -2);

            // TODO: Find a more generic way of calculating the font size but for now this works.
            float fontScale = 1;
            float correction = 0;
            switch (track.Tuning.Length)
            {
                case 4:
                    fontScale = 0.6f;
                    break;
                case 5:
                    fontScale = 0.8f;
                    break;
                case 6:
                    fontScale = 1.1f;
                    correction = 1;
                    break;
                case 7:
                    fontScale = 1.15f;
                    break;
                case 8:
                    fontScale = 1.35f;
                    break;
            }

            var font = res.TabClefFont.Clone();
            font.Size = font.Size * fontScale;

            canvas.Font = font;
            var old = canvas.TextAlign;
            canvas.TextAlign = TextAlign.Center;

            canvas.FillText("T", cx + X + Width / 2, startY);
            canvas.FillText("A", cx + X + Width / 2, startY + font.Size - (correction * Scale));
            canvas.FillText("B", cx + X + Width / 2, startY + (font.Size - (correction * Scale)) * 2);
            canvas.TextAlign = old;
        }
开发者ID:eriser,项目名称:alphaTab,代码行数:44,代码来源:TabClefGlyph.cs

示例8: Paint

        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            if (_hidden)
            {
                return;
            }
            var res = Renderer.Resources;
            canvas.Color = res.BarNumberColor;
            canvas.Font = res.BarNumberFont;

            canvas.FillText(_number.ToString(), cx + X, cy + Y);

            canvas.Color = res.MainGlyphColor;
        }
开发者ID:eriser,项目名称:alphaTab,代码行数:14,代码来源:BarNumberGlyph.cs

示例9: Paint

        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var res = Renderer.Resources;

            canvas.Font = res.MarkerFont;

            var textw = canvas.MeasureText("tr");
            canvas.FillText("tr", cx + X, cy + Y);

            var startX = textw;
            var endX = Width - startX;
            var step = 11 * Scale * _scale;
            var loops = Math.Max(1, ((endX - startX) / step));

            var loopX = startX;
            for (var i = 0; i < loops; i++)
            {
                canvas.FillMusicFontSymbol(cx + X + loopX, cy + Y, _scale, MusicFontSymbol.WaveHorizontal);
                loopX += step;
            }
        }
开发者ID:vmoll,项目名称:alphaTab,代码行数:21,代码来源:TrillGlyph.cs

示例10: Paint

        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var res = Renderer.Resources;
            canvas.Font = res.EffectFont;
            canvas.TextAlign = TextAlign.Left;
            var textWidth = canvas.MeasureText(_label);
            canvas.FillText(_label, cx + X, cy + Y);

            // check if we need lines
            if (_isExpanded)
            {
                var lineSpacing = LineSpacing * Scale;
                var startX = cx + X + textWidth + lineSpacing;
                var endX = cx + X + Width - lineSpacing - lineSpacing;
                var lineY = cy + Y + (LineTopPadding * Scale);
                var lineSize = LineSize * Scale;

                if (endX > startX)
                {
                    var lineX = startX;
                    while (lineX < endX)
                    {
                        canvas.BeginPath();
                        canvas.MoveTo(lineX, (int)lineY);
                        canvas.LineTo(Math.Min(lineX + lineSize, endX), (int)lineY);
                        lineX += lineSize + lineSpacing;
                        canvas.Stroke();
                    }
                    canvas.BeginPath();
                    canvas.MoveTo(endX, (int)(lineY - LineTopOffset * Scale));
                    canvas.LineTo(endX, (int)(lineY + LineTopOffset * Scale));
                    canvas.Stroke();

                }
            }
        }
开发者ID:eriser,项目名称:alphaTab,代码行数:36,代码来源:LineRangedGlyph.cs

示例11: PaintBend


//.........这里部分代码省略.........
                y2 += r.GetNoteY(_note);
            }
            else
            {
                y2 += overflowOffset;
            }

            // what type of arrow? (up/down)
            var arrowOffset = 0f;
            var arrowSize = 6 * Scale;
            if (secondPt.Value > firstPt.Value)
            {
                canvas.BeginPath();
                canvas.MoveTo(x2, y2);
                canvas.LineTo(x2 - arrowSize * 0.5f, y2 + arrowSize);
                canvas.LineTo(x2 + arrowSize * 0.5f, y2 + arrowSize);
                canvas.ClosePath();
                canvas.Fill();
                arrowOffset = arrowSize;
            }
            else if (secondPt.Value != firstPt.Value)
            {
                canvas.BeginPath();
                canvas.MoveTo(x2, y2);
                canvas.LineTo(x2 - arrowSize * 0.5f, y2 - arrowSize);
                canvas.LineTo(x2 + arrowSize * 0.5f, y2 - arrowSize);
                canvas.ClosePath();
                canvas.Fill();
                arrowOffset = -arrowSize;
            }
            canvas.Stroke();

            if (firstPt.Value == secondPt.Value)
            {
                // draw horizontal line
                canvas.MoveTo(x1, y1);
                canvas.LineTo(x2, y2);
                canvas.Stroke();
            }
            else
            {
                if (x2 > x1)
                {
                    // draw bezier lien from first to second point
                    canvas.MoveTo(x1, y1);
                    canvas.BezierCurveTo(x2, y1, x2, y2 + arrowOffset, x2, y2 + arrowOffset);
                    canvas.Stroke();
                }
                else
                {
                    canvas.MoveTo(x1, y1);
                    canvas.LineTo(x2, y2);
                    canvas.Stroke();
                }
            }

            if (secondPt.Value != 0)
            {
                var dV = secondPt.Value;
                var up = secondPt.Value > firstPt.Value;
                dV = Math.Abs(dV);

                // calculate label
                var s = "";
                // Full Steps
                if (dV == 4 && up)
                {
                    s = "full";
                    dV -= 4;
                }
                else if (dV >= 4)
                {
                    int steps = dV / 4;
                    s += steps;
                    // Quaters
                    dV -= steps * 4;
                }

                if (dV > 0)
                {
                    s += GetFractionSign(dV);
                }

                if (s != "")
                {
                    if (!up)
                    {
                        s = "-" + s;
                    }

                    // draw label
                    canvas.Font = res.TablatureFont;
                    var size = canvas.MeasureText(s);
                    var y = up ? y2 - res.TablatureFont.Size - (2 * Scale) : y2 + (2 * Scale);
                    var x = x2 - size / 2;

                    canvas.FillText(s, x, y);
                }
            }
        }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:101,代码来源:BendGlyph.cs

示例12: RenderTriplet

        private void RenderTriplet(float cx, float cy, ICanvas canvas)
        {
            cy += 2*Scale;
            var font = Renderer.Resources.EffectFont;
            canvas.Font = new Font(font.Family, font.Size * 0.8f, font.Style);

            var rightX = cx + NoteSeparation * Scale + 3 * Scale;

            canvas.BeginPath();
            canvas.MoveTo(cx, cy + (3 * Scale));
            canvas.LineTo(cx, cy);
            canvas.LineTo(cx + (5 * Scale), cy);

            canvas.MoveTo(rightX + (5 * Scale), cy + (3 * Scale));
            canvas.LineTo(rightX + (5 * Scale), cy);
            canvas.LineTo(rightX, cy);

            canvas.Stroke();

            canvas.FillText("3", cx + (7 * Scale), cy - (10 * Scale));

            canvas.Font = font;
        }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:23,代码来源:TripletFeelGlyph.cs

示例13: PaintTupletHelper

        private void PaintTupletHelper(float cx, float cy, ICanvas canvas, TupletHelper h)
        {
            var res = Resources;
            var oldAlign = canvas.TextAlign;
            canvas.TextAlign = TextAlign.Center;
            // check if we need to paint simple footer
            if (h.Beats.Count == 1 || !h.IsFull)
            {
                for (int i = 0, j = h.Beats.Count; i < j; i++)
                {
                    var beat = h.Beats[i];
                    var beamingHelper = Helpers.BeamHelperLookup[h.VoiceIndex][beat.Index];
                    if (beamingHelper == null) continue;
                    var direction = beamingHelper.Direction;

                    var tupletX = beamingHelper.GetBeatLineX(beat) + Scale;
                    var tupletY = cy + Y + CalculateBeamY(beamingHelper, tupletX);

                    var offset = direction == BeamDirection.Up
                                ? res.EffectFont.Size * 1.8f
                                : -3 * Scale;

                    canvas.Font = res.EffectFont;
                    canvas.FillText(h.Tuplet.ToString(), cx + X + tupletX, tupletY - offset);
                }
            }
            else
            {
                var firstBeat = h.Beats[0];
                var lastBeat = h.Beats[h.Beats.Count - 1];

                var firstBeamingHelper = Helpers.BeamHelperLookup[h.VoiceIndex][firstBeat.Index];
                var lastBeamingHelper = Helpers.BeamHelperLookup[h.VoiceIndex][lastBeat.Index];
                if (firstBeamingHelper != null && lastBeamingHelper != null)
                {
                    var direction = firstBeamingHelper.Direction;

                    //
                    // Calculate the overall area of the tuplet bracket

                    var startX = firstBeamingHelper.GetBeatLineX(firstBeat) + Scale;
                    var endX = lastBeamingHelper.GetBeatLineX(lastBeat) + Scale;

                    //
                    // Calculate how many space the text will need
                    canvas.Font = res.EffectFont;
                    var s = h.Tuplet.ToString();
                    var sw = canvas.MeasureText(s);
                    var sp = 3 * Scale;

                    //
                    // Calculate the offsets where to break the bracket
                    var middleX = (startX + endX) / 2;
                    var offset1X = middleX - sw / 2 - sp;
                    var offset2X = middleX + sw / 2 + sp;

                    //
                    // calculate the y positions for our bracket

                    var startY = CalculateBeamY(firstBeamingHelper, startX);
                    var offset1Y = CalculateBeamY(firstBeamingHelper, offset1X);
                    var middleY = CalculateBeamY(firstBeamingHelper, middleX);
                    var offset2Y = CalculateBeamY(lastBeamingHelper, offset2X);
                    var endY = CalculateBeamY(lastBeamingHelper, endX);

                    var offset = 10 * Scale;
                    var size = 5 * Scale;
                    if (direction == BeamDirection.Down)
                    {
                        offset *= -1;
                        size *= -1;
                    }

                    //
                    // draw the bracket
                    canvas.BeginPath();
                    canvas.MoveTo(cx + X + startX, (int)(cy + Y + startY - offset));
                    canvas.LineTo(cx + X + startX, (int)(cy + Y + startY - offset - size));
                    canvas.LineTo(cx + X + offset1X, (int)(cy + Y + offset1Y - offset - size));
                    canvas.Stroke();

                    canvas.BeginPath();
                    canvas.MoveTo(cx + X + offset2X, (int)(cy + Y + offset2Y - offset - size));
                    canvas.LineTo(cx + X + endX, (int)(cy + Y + endY - offset - size));
                    canvas.LineTo(cx + X + endX, (int)(cy + Y + endY - offset));
                    canvas.Stroke();

                    //
                    // Draw the string
                    canvas.FillText(s, cx + X + middleX, cy + Y + middleY - offset - size - res.EffectFont.Size);
                }
            }
            canvas.TextAlign = oldAlign;
        }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:94,代码来源:ScoreBarRenderer.cs

示例14: Paint

        public void Paint(float cx, float cy, ICanvas canvas)
        {
            for (int i = 0, j = _allStaves.Count; i < j; i++)
            {
                _allStaves[i].Paint(cx + X, cy + Y, canvas);
            }

            var res = Layout.Renderer.RenderingResources;

            if (Staves.Count > 0)
            {
                //
                // Draw start grouping
                //

                if (_firstStaveInAccolade != null && _lastStaveInAccolade != null)
                {
                    //
                    // draw grouping line for all staves
                    //

                    var firstStart = cy + Y + _firstStaveInAccolade.Y + _firstStaveInAccolade.StaveTop + _firstStaveInAccolade.TopSpacing + _firstStaveInAccolade.TopOverflow;
                    var lastEnd = cy + Y + _lastStaveInAccolade.Y + _lastStaveInAccolade.TopSpacing + _lastStaveInAccolade.TopOverflow
                                         + _lastStaveInAccolade.StaveBottom;

                    var acooladeX = cx + X + _firstStaveInAccolade.X;

                    canvas.Color = res.BarSeperatorColor;

                    canvas.BeginPath();
                    canvas.MoveTo(acooladeX, firstStart);
                    canvas.LineTo(acooladeX, lastEnd);
                    canvas.Stroke();
                }

                //
                // Draw accolade for each track group
                //
                canvas.Font = res.EffectFont;
                for (int i = 0, j = Staves.Count; i < j; i++)
                {
                    var g = Staves[i];
                    var firstStart = cy + Y + g.FirstStaveInAccolade.Y + g.FirstStaveInAccolade.StaveTop + g.FirstStaveInAccolade.TopSpacing + g.FirstStaveInAccolade.TopOverflow;
                    var lastEnd = cy + Y + g.LastStaveInAccolade.Y + g.LastStaveInAccolade.TopSpacing + g.LastStaveInAccolade.TopOverflow
                                         + g.LastStaveInAccolade.StaveBottom;

                    var acooladeX = cx + X + g.FirstStaveInAccolade.X;

                    var barSize = (3 * Layout.Renderer.Settings.Scale);
                    var barOffset = barSize;

                    var accoladeStart = firstStart - (barSize * 4);
                    var accoladeEnd = lastEnd + (barSize * 4);

                    // text
                    if (Index == 0)
                    {
                        canvas.FillText(g.Track.ShortName, cx + X + (AccoladeLabelSpacing * Layout.Scale), firstStart);
                    }

                    // rect
                    canvas.FillRect(acooladeX - barOffset - barSize, accoladeStart, barSize, accoladeEnd - accoladeStart);

                    var spikeStartX = acooladeX - barOffset - barSize;
                    var spikeEndX = acooladeX + barSize * 2;

                    // top spike
                    canvas.BeginPath();
                    canvas.MoveTo(spikeStartX, accoladeStart);
                    canvas.BezierCurveTo(spikeStartX, accoladeStart, spikeStartX, accoladeStart, spikeEndX, accoladeStart - barSize);
                    canvas.BezierCurveTo(acooladeX, accoladeStart + barSize, spikeStartX, accoladeStart + barSize, spikeStartX, accoladeStart + barSize);
                    canvas.ClosePath();
                    canvas.Fill();

                    // bottom spike
                    canvas.BeginPath();
                    canvas.MoveTo(spikeStartX, accoladeEnd);
                    canvas.BezierCurveTo(spikeStartX, accoladeEnd, acooladeX, accoladeEnd, spikeEndX, accoladeEnd + barSize);
                    canvas.BezierCurveTo(acooladeX, accoladeEnd - barSize, spikeStartX, accoladeEnd - barSize, spikeStartX, accoladeEnd - barSize);
                    canvas.ClosePath();

                    canvas.Fill();
                }
            }
        }
开发者ID:stefan-j,项目名称:alphaTab,代码行数:85,代码来源:StaveGroup.cs

示例15: PaintFingering

        private void PaintFingering(ICanvas canvas, Beat beat, float beatLineX, BeamDirection direction, float topY)
        {
            if (direction == BeamDirection.Up)
            {
                beatLineX -= 10 * Scale;
            }
            else
            {
                beatLineX += 3 * Scale;
            }

            // sort notes ascending in their value to ensure
            // we are drawing the numbers according to their order on the stave
            var noteList = beat.Notes.Clone();
            noteList.Sort((a, b) => b.RealValue - a.RealValue);

            for (int n = 0; n < noteList.Count; n++)
            {
                var note = noteList[n];
                string text = null;
                if (note.LeftHandFinger != Fingers.Unknown)
                {
                    text = FingerToString(beat, note.LeftHandFinger, true);
                }
                else if (note.RightHandFinger != Fingers.Unknown)
                {
                    text = FingerToString(beat, note.RightHandFinger, false);
                }

                if (text == null)
                {
                    continue;
                }

                canvas.FillText(text, beatLineX, topY);
                topY -= (int)(canvas.Font.Size);
            }
        }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:38,代码来源:ScoreBarRenderer.cs


注:本文中的ICanvas.FillText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。