本文整理汇总了C#中Cairo.SetAlpha方法的典型用法代码示例。如果您正苦于以下问题:C# Cairo.SetAlpha方法的具体用法?C# Cairo.SetAlpha怎么用?C# Cairo.SetAlpha使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo
的用法示例。
在下文中一共展示了Cairo.SetAlpha方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateIndicatorBuffer
DockySurface CreateIndicatorBuffer (int size, Cairo.Color color)
{
DockySurface surface = new DockySurface (size, size, background_buffer);
surface.Clear ();
Cairo.Context cr = surface.Context;
double x = size / 2;
double y = x;
cr.MoveTo (x, y);
cr.Arc (x, y, size / 2, 0, Math.PI * 2);
RadialGradient rg = new RadialGradient (x, y, 0, x, y, size / 2);
rg.AddColorStop (0, new Cairo.Color (1, 1, 1, 1));
rg.AddColorStop (.10, color.SetAlpha (1.0));
rg.AddColorStop (.20, color.SetAlpha (.60));
rg.AddColorStop (.25, color.SetAlpha (.25));
rg.AddColorStop (.50, color.SetAlpha (.15));
rg.AddColorStop (1.0, color.SetAlpha (0.0));
cr.Pattern = rg;
cr.Fill ();
rg.Destroy ();
return surface;
}
示例2: DrawActiveIndicator
void DrawActiveIndicator (DockySurface surface, Gdk.Rectangle area, Cairo.Color color, double opacity)
{
surface.Context.Rectangle (area.X, area.Y, area.Width, area.Height);
LinearGradient lg;
switch (Position) {
case DockPosition.Top:
lg = new LinearGradient (0, area.Y, 0, area.Y + area.Height);
break;
case DockPosition.Left:
lg = new LinearGradient (area.X, 0, area.X + area.Width, 0);
break;
case DockPosition.Right:
lg = new LinearGradient (area.X + area.Width, 0, area.X, 0);
break;
default:
case DockPosition.Bottom:
lg = new LinearGradient (0, area.Y + area.Height, 0, area.Y);
break;
}
lg.AddColorStop (0, color.SetAlpha (0.6 * opacity));
lg.AddColorStop (1, color.SetAlpha (0.0));
surface.Context.Pattern = lg;
surface.Context.Fill ();
lg.Destroy ();
}