本文整理汇总了C#中ICanvas.Fill方法的典型用法代码示例。如果您正苦于以下问题:C# ICanvas.Fill方法的具体用法?C# ICanvas.Fill怎么用?C# ICanvas.Fill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICanvas
的用法示例。
在下文中一共展示了ICanvas.Fill方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Paint
public override void Paint(float cx, float cy, ICanvas canvas)
{
var tabBarRenderer = (TabBarRenderer)Renderer;
var res = Renderer.Resources;
var startY = cy + X + (tabBarRenderer.GetNoteY(_beat.MaxNote) - res.TablatureFont.Size / 2);
var endY = cy + Y + tabBarRenderer.GetNoteY(_beat.MinNote) + res.TablatureFont.Size / 2;
var arrowX = (int)(cx + X + Width / 2);
var arrowSize = 8 * Scale;
if (_beat.BrushType != BrushType.None)
{
if (_beat.BrushType == BrushType.BrushUp || _beat.BrushType == BrushType.BrushDown)
{
canvas.BeginPath();
canvas.MoveTo(arrowX, startY);
canvas.LineTo(arrowX, endY);
canvas.Stroke();
}
else
{
var size = 15 * Scale;
var steps = Math.Abs(endY - startY) / size;
for (var i = 0; i < steps; i++)
{
canvas.FillMusicFontSymbol(cx + X + (3 * Scale), 1, startY + (i * size), MusicFontSymbol.WaveVertical);
}
}
if (_beat.BrushType == BrushType.BrushUp || _beat.BrushType == BrushType.ArpeggioUp)
{
canvas.BeginPath();
canvas.MoveTo(arrowX, endY);
canvas.LineTo(arrowX + arrowSize / 2, endY - arrowSize);
canvas.LineTo(arrowX - arrowSize / 2, endY - arrowSize);
canvas.ClosePath();
canvas.Fill();
}
else
{
canvas.BeginPath();
canvas.MoveTo(arrowX, startY);
canvas.LineTo(arrowX + arrowSize / 2, startY + arrowSize);
canvas.LineTo(arrowX - arrowSize / 2, startY + arrowSize);
canvas.ClosePath();
canvas.Fill();
}
}
}
示例2: Paint
public override void Paint(float cx, float cy, ICanvas canvas)
{
var scoreBarRenderer = (ScoreBarRenderer)Renderer;
var lineSize = scoreBarRenderer.LineOffset;
var startY = cy + Y + (scoreBarRenderer.GetNoteY(_beat.MaxNote) - lineSize / 2);
var endY = cy + Y + scoreBarRenderer.GetNoteY(_beat.MinNote) + lineSize;
var arrowX = cx + X + Width / 2;
var arrowSize = 8 * Scale;
if (_beat.BrushType != BrushType.None)
{
if (_beat.BrushType == BrushType.ArpeggioUp || _beat.BrushType == BrushType.ArpeggioDown)
{
var size = 15 * Scale;
var steps = Math.Abs(endY - startY) / size;
for (var i = 0; i < steps; i++)
{
canvas.FillMusicFontSymbol(cx + X + (3 * Scale), 1, startY + (i * size), MusicFontSymbol.WaveVertical);
}
}
if (_beat.BrushType == BrushType.ArpeggioUp)
{
canvas.BeginPath();
canvas.MoveTo(arrowX, endY);
canvas.LineTo(arrowX + arrowSize / 2, endY - arrowSize);
canvas.LineTo(arrowX - arrowSize / 2, endY - arrowSize);
canvas.ClosePath();
canvas.Fill();
}
else if (_beat.BrushType == BrushType.ArpeggioDown)
{
canvas.BeginPath();
canvas.MoveTo(arrowX, startY);
canvas.LineTo(arrowX + arrowSize / 2, startY + arrowSize);
canvas.LineTo(arrowX - arrowSize / 2, startY + arrowSize);
canvas.ClosePath();
canvas.Fill();
}
}
}
示例3: 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();
}
}
}
示例4: PaintSingleBar
private static void PaintSingleBar(ICanvas canvas, float x1, float y1, float x2, float y2, float size)
{
canvas.BeginPath();
canvas.MoveTo(x1, y1);
canvas.LineTo(x2, y2);
canvas.LineTo(x2, y2 + size);
canvas.LineTo(x1, y1 + size);
canvas.ClosePath();
canvas.Fill();
}
示例5: Paint
public override void Paint(float cx, float cy, ICanvas canvas)
{
if (EndNote == null) return;
var startNoteRenderer =
(GroupedBarRenderer)Renderer.Layout.GetRendererForBar(Renderer.Stave.StaveId, StartNote.Beat.Voice.Bar.Index);
var endNoteRenderer =
(GroupedBarRenderer)Renderer.Layout.GetRendererForBar(Renderer.Stave.StaveId, EndNote.Beat.Voice.Bar.Index);
float startX = 0;
float endX = 0;
float startY = 0;
float endY = 0;
var shouldDraw = false;
var parent = (BeatContainerGlyph)Parent;
// if we are on the tie start, we check if we
// either can draw till the end note, or we just can draw till the bar end
if (!_forEnd)
{
// bar break or line break: to bar end
if (startNoteRenderer != endNoteRenderer)
{
// TODO: expand tie to next bar if possible, currently we draw a tie till the
// bar end if we have different bars
startX = cx + startNoteRenderer.GetNoteX(StartNote);
endX = cx + parent.X + parent.PostNotes.X + parent.PostNotes.Width;
startY = cy + startNoteRenderer.GetNoteY(StartNote) + YOffset;
endY = startY;
}
else
{
startX = cx + startNoteRenderer.GetNoteX(StartNote);
endX = cx + endNoteRenderer.GetNoteX(EndNote, false);
startY = cy + startNoteRenderer.GetNoteY(StartNote) + YOffset;
endY = cy + endNoteRenderer.GetNoteY(EndNote) + YOffset;
}
shouldDraw = true;
}
// if we draw for the tie end, we only draw a tie if we had a line break between start and end
// in this case there will be a tie from bar start to the note
else if (startNoteRenderer.Stave != endNoteRenderer.Stave)
{
startX = cx;
endX = cx + endNoteRenderer.GetNoteX(EndNote);
startY = cy + endNoteRenderer.GetNoteY(EndNote) + YOffset;
endY = startY;
shouldDraw = true;
}
if (shouldDraw)
{
PaintTie(canvas, Scale, startX, startY, endX, endY,
GetBeamDirection(StartNote, startNoteRenderer) == BeamDirection.Down);
canvas.Fill();
}
}
示例6: Paint
public override void Paint(float cx, float cy, ICanvas canvas)
{
var r = (TabBarRenderer)Renderer;
var res = Renderer.Resources;
// calculate offsets per step
var dX = Width / BendPoint.MaxPosition;
var maxValue = 0;
for (int i = 0, j = _note.BendPoints.Count; i < j; i++)
{
if (_note.BendPoints[i].Value > maxValue)
{
maxValue = _note.BendPoints[i].Value;
}
}
var dY = maxValue == 0 ? 0 : _height / maxValue;
var xx = cx + X;
var yy = cy + Y + r.GetNoteY(_note);
canvas.BeginPath();
for (int i = 0, j = _note.BendPoints.Count - 1; i < j; i++)
{
var firstPt = _note.BendPoints[i];
var secondPt = _note.BendPoints[i + 1];
// don't draw a line if there's no offset and it's the last point
if (firstPt.Value == secondPt.Value && i == _note.BendPoints.Count - 2) continue;
var x1 = xx + (dX * firstPt.Offset);
var y1 = yy - (dY * firstPt.Value);
var x2 = xx + (dX * secondPt.Offset);
var y2 = yy - (dY * secondPt.Value);
if (firstPt.Value == secondPt.Value)
{
// draw horizontal line
canvas.MoveTo(x1, y1);
canvas.LineTo(x2, y2);
canvas.Stroke();
}
else
{
// draw bezier lien from first to second point
var hx = x1 + (x2 - x1);
var hy = yy - (dY * firstPt.Value);
canvas.MoveTo(x1, y1);
canvas.BezierCurveTo(hx, hy, x2, y2, x2, y2);
canvas.Stroke();
}
// what type of arrow? (up/down)
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();
}
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();
}
canvas.Stroke();
if (secondPt.Value != 0)
{
var dV = (secondPt.Value - firstPt.Value);
var up = dV > 0;
dV = Math.Abs(dV);
// calculate label
var s = "";
// Full Steps
if (dV == 4)
{
s = "full";
dV -= 4;
}
else if (dV > 4)
{
s += dV / 4 + " ";
// Quaters
dV -= dV / 4;
}
if (dV > 0)
{
s += dV + "/4";
}
if (s != "")
//.........这里部分代码省略.........
示例7: PaintBend
private void PaintBend(BendPoint firstPt, BendPoint secondPt, float cx, float cy, float dX, ICanvas canvas)
{
var r = (TabBarRenderer)Renderer;
var res = Renderer.Resources;
var overflowOffset = r.LineOffset / 2;
var x1 = cx + (dX * firstPt.Offset);
var y1 = cy - (_bendValueHeight * firstPt.Value);
if (firstPt.Value == 0)
{
y1 += r.GetNoteY(_note);
}
else
{
y1 += overflowOffset;
}
var x2 = cx + (dX * secondPt.Offset);
var y2 = cy - (_bendValueHeight * secondPt.Value);
if (secondPt.Value == 0)
{
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)
//.........这里部分代码省略.........
示例8: Paint
public override void Paint(float cx, float cy, ICanvas canvas)
{
if (EndNote == null) return;
var startNoteRenderer = Renderer.Layout.GetRendererForBar(Renderer.Staff.StaveId, StartNote.Beat.Voice.Bar);
var endNoteRenderer = Renderer.Layout.GetRendererForBar(Renderer.Staff.StaveId, EndNote.Beat.Voice.Bar);
float startX = 0;
float endX = 0;
float startY = 0;
float endY = 0;
var shouldDraw = false;
var parent = (BeatContainerGlyph)Parent;
// if we are on the tie start, we check if we
// either can draw till the end note, or we just can draw till the bar end
if (!_forEnd)
{
// line break or bar break
if (startNoteRenderer != endNoteRenderer)
{
startX = cx + startNoteRenderer.GetNoteX(StartNote);
// line break: to bar end
if (endNoteRenderer == null || startNoteRenderer.Staff != endNoteRenderer.Staff)
{
endX = cx + parent.X;
}
// bar break: to tie destination
// differs only by addition of EndNote X coordinate
else
{
endX = cx + parent.X;
endX += endNoteRenderer.GetNoteX(EndNote);
}
startY = cy + startNoteRenderer.GetNoteY(StartNote) + YOffset;
endY = startY;
}
else
{
startX = cx + startNoteRenderer.GetNoteX(StartNote);
endX = cx + endNoteRenderer.GetNoteX(EndNote, false);
startY = cy + startNoteRenderer.GetNoteY(StartNote) + YOffset;
endY = cy + endNoteRenderer.GetNoteY(EndNote) + YOffset;
}
shouldDraw = true;
}
// if we draw for the tie end, we only draw a tie if we had a line break between start and end
// in this case there will be a tie from bar start to the note
else if (startNoteRenderer.Staff != endNoteRenderer.Staff)
{
startX = cx;
endX = cx + endNoteRenderer.GetNoteX(EndNote);
startY = cy + endNoteRenderer.GetNoteY(EndNote) + YOffset;
endY = startY;
shouldDraw = true;
}
if (shouldDraw)
{
PaintTie(canvas, Scale, startX, startY, endX, endY,
GetBeamDirection(StartNote, startNoteRenderer) == BeamDirection.Down);
canvas.Fill();
}
}