本文整理匯總了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 ();
}