本文整理汇总了C#中gbrainy.Core.Main.CairoContextEx.FillPreserve方法的典型用法代码示例。如果您正苦于以下问题:C# CairoContextEx.FillPreserve方法的具体用法?C# CairoContextEx.FillPreserve怎么用?C# CairoContextEx.FillPreserve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gbrainy.Core.Main.CairoContextEx
的用法示例。
在下文中一共展示了CairoContextEx.FillPreserve方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawTimeBar
public void DrawTimeBar(CairoContextEx gr, double x, double y, double percentage)
{
double width = 0.04, height = 0.6;
const double w = 0.003, h = 0.003;
gr.DrawTextCentered (x + (width / 2), y + height + 0.05, Translations.GetString ("Time left"));
gr.Stroke ();
gr.Save ();
gr.Color = new Color (0, 0, 0);
gr.MoveTo (x, y);
gr.LineTo (x, y + height);
gr.LineTo (x + width, y + height);
gr.LineTo (x + width, y);
gr.LineTo (x, y);
gr.Stroke ();
x+= w;
y+= h;
width -= w * 2;
height -= h * 2;
y += height * (100 - percentage) / 100;
height *= percentage / 100;
if (gradient == null) {
gradient = new LinearGradient (x, y, x + width, y + height);
gradient.AddColorStop (0, new Color (1, 0, 0, 1));
gradient.AddColorStop (1, new Color (0.2, 0, 0, 1));
}
gr.Source = gradient;
gr.MoveTo (x, y);
gr.LineTo (x, y + height);
gr.LineTo (x + width, y + height);
gr.LineTo (x + width, y);
gr.LineTo (x, y);
gr.FillPreserve ();
gr.Stroke ();
gr.Restore ();
}