本文整理汇总了C#中Cairo.Context.PaintWithAlpha方法的典型用法代码示例。如果您正苦于以下问题:C# Cairo.Context.PaintWithAlpha方法的具体用法?C# Cairo.Context.PaintWithAlpha怎么用?C# Cairo.Context.PaintWithAlpha使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo.Context
的用法示例。
在下文中一共展示了Cairo.Context.PaintWithAlpha方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WithAlpha
public static Gdk.Pixbuf WithAlpha (this Gdk.Pixbuf image, double opacity)
{
using (var surf = new Cairo.ImageSurface (Cairo.Format.Argb32, image.Width, image.Height)) {
using (var g = new Cairo.Context (surf)) {
CairoHelper.SetSourcePixbuf (g, image, 0, 0);
g.PaintWithAlpha (opacity);
}
return new Gdk.Pixbuf (surf.Data, true, 8, surf.Width, surf.Height, surf.Stride);
}
}
示例2: UpdateThumbnail
private void UpdateThumbnail()
{
double scalex = (double)Allocation.Width / (double)PintaCore.Workspace.ImageSize.Width;
double scaley = (double)Allocation.Height / (double)PintaCore.Workspace.ImageSize.Height;
thumbnail = new Cairo.ImageSurface (Cairo.Format.Argb32, Allocation.Width, Allocation.Height);
using (Cairo.Context g = new Cairo.Context (thumbnail)) {
g.Scale (scalex, scaley);
foreach (Layer layer in PintaCore.Layers.GetLayersToPaint ()) {
g.SetSourceSurface (layer.Surface, (int)layer.Offset.X, (int)layer.Offset.Y);
g.PaintWithAlpha (layer.Opacity);
}
}
}