本文整理汇总了C#中Cairo.TextPath方法的典型用法代码示例。如果您正苦于以下问题:C# Cairo.TextPath方法的具体用法?C# Cairo.TextPath怎么用?C# Cairo.TextPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo
的用法示例。
在下文中一共展示了Cairo.TextPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: draw
static void draw (Cairo.Context gr, int width, int height)
{
gr.Scale (width, height);
gr.LineWidth = 0.04;
gr.SelectFontFace ("Sans", FontSlant.Normal, FontWeight.Bold);
gr.SetFontSize (0.35);
gr.MoveTo ( new PointD(0.04, 0.53) );
gr.ShowText ("Hello");
gr.MoveTo ( new PointD(0.27, 0.65) );
gr.TextPath ("void");
gr.ColorRgb = new Color (0.5, 0.5, 1, 0);
gr.FillPreserve ();
gr.ColorRgb = new Color (0, 0, 0, 0);
gr.LineWidth = 0.01;
gr.Stroke ();
gr.Color = new Color (1,0.2,0.2, 0.6);
gr.Arc (0.04, 0.53, 0.02, 0, 2*M_PI);
gr.Arc (0.27, 0.65, 0.02, 0, 2*M_PI);
gr.Fill ();
}
示例2: Draw
private void Draw(Cairo.Context cr, int width, int heigth)
{
foreach (var path in pathPosition.Keys)
{
var pPosition = pathPosition[path];
var begin = pPosition.Item1;
var end = pPosition.Item2;
cr.SetSourceRGB(1, 1, 1);
cr.MoveTo(begin.X, begin.Y);
cr.LineTo(end.X, end.Y);
cr.Stroke();
cr.SetSourceRGB(0, 0, 0);
}
foreach (var path in pathPosition.Keys)
{
var pPosition = pathPosition[path];
var begin = pPosition.Item1;
var end = pPosition.Item2;
if (path is BlockingPath)
{
var blockingPath = path as BlockingPath;
if (blockingPath.IsBlocked)
{
cr.SetSourceRGB(1, 0, 0);
}
else
{
cr.SetSourceRGB(0, 1, 0);
}
cr.Rectangle(new Cairo.Rectangle(end.X - 6, end.Y - 6, 12, 12));
cr.Fill();
cr.SetSourceRGB(0, 0, 0);
}
else if (path is SourcePath)
{
var sourcePath = path as SourcePath;
cr.MoveTo(begin.X, begin.Y);
cr.TextPath(sourcePath.Queue.ToString());
cr.Fill();
}
foreach (var vehicle in path.VehiclePosition.Keys)
{
var position = path.VehiclePosition[vehicle];
var r = position / path.Length;
var x = begin.X + (end.X - begin.X) * r;
var y = begin.Y + (end.Y - begin.Y) * r;
cr.Arc(x, y, 5, 0, 2 * Math.PI);
cr.Fill();
}
}
cr.Stroke();
}