本文整理汇总了C#中Cairo.ClipPreserve方法的典型用法代码示例。如果您正苦于以下问题:C# Cairo.ClipPreserve方法的具体用法?C# Cairo.ClipPreserve怎么用?C# Cairo.ClipPreserve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo
的用法示例。
在下文中一共展示了Cairo.ClipPreserve方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClippedRender
protected override void ClippedRender (Cairo.Context cr)
{
Brush brush = Background;
if (!brush.IsValid) {
return;
}
double x = Double.IsNaN (brush.Width)
? 0
: (RenderSize.Width - brush.Width) * XAlign;
double y = Double.IsNaN (brush.Height)
? 0
: (RenderSize.Height - brush.Height) * YAlign;
cr.Rectangle (0, 0, RenderSize.Width, RenderSize.Height);
cr.ClipPreserve ();
if (x != 0 || y != 0) {
cr.Translate (x, y);
}
cr.Antialias = Cairo.Antialias.None;
brush.Apply (cr);
cr.Fill ();
}
示例2: DrawBackground
protected virtual void DrawBackground (Cairo.Context context, Gdk.Rectangle region)
{
LayoutRoundedRectangle (context, region);
context.ClipPreserve ();
using (LinearGradient lg = new LinearGradient (region.X, region.Y, region.X, region.Y + region.Height)) {
lg.AddColorStop (0, Styles.StatusBarFill1Color);
lg.AddColorStop (1, Styles.StatusBarFill4Color);
context.Pattern = lg;
context.FillPreserve ();
}
context.Save ();
double midX = region.X + region.Width / 2.0;
double midY = region.Y + region.Height;
context.Translate (midX, midY);
using (RadialGradient rg = new RadialGradient (0, 0, 0, 0, 0, region.Height * 1.2)) {
rg.AddColorStop (0, Styles.StatusBarFill1Color);
rg.AddColorStop (1, Styles.WithAlpha (Styles.StatusBarFill1Color, 0));
context.Scale (region.Width / (double)region.Height, 1.0);
context.Pattern = rg;
context.Fill ();
}
context.Restore ();
using (LinearGradient lg = new LinearGradient (0, region.Y, 0, region.Y + region.Height)) {
lg.AddColorStop (0, Styles.StatusBarShadowColor1);
lg.AddColorStop (1, Styles.WithAlpha (Styles.StatusBarShadowColor1, Styles.StatusBarShadowColor1.A * 0.2));
LayoutRoundedRectangle (context, region, 0, -1);
context.LineWidth = 1;
context.Pattern = lg;
context.Stroke ();
}
using (LinearGradient lg = new LinearGradient (0, region.Y, 0, region.Y + region.Height)) {
lg.AddColorStop (0, Styles.StatusBarShadowColor2);
lg.AddColorStop (1, Styles.WithAlpha (Styles.StatusBarShadowColor2, Styles.StatusBarShadowColor2.A * 0.2));
LayoutRoundedRectangle (context, region, 0, -2);
context.LineWidth = 1;
context.Pattern = lg;
context.Stroke ();
}
context.ResetClip ();
}