本文整理汇总了C#中Cairo.ImageSurface.Flush方法的典型用法代码示例。如果您正苦于以下问题:C# Cairo.ImageSurface.Flush方法的具体用法?C# Cairo.ImageSurface.Flush怎么用?C# Cairo.ImageSurface.Flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo.ImageSurface
的用法示例。
在下文中一共展示了Cairo.ImageSurface.Flush方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public override object Create(object img)
{
Gdk.Pixbuf pb = (Gdk.Pixbuf)img;
var imgs = new Cairo.ImageSurface (Cairo.Format.ARGB32, pb.Width, pb.Height);
var ic = new Cairo.Context (imgs);
Gdk.CairoHelper.SetSourcePixbuf (ic, pb, 0, 0);
ic.Paint ();
imgs.Flush ();
((IDisposable)ic).Dispose ();
var p = new Cairo.SurfacePattern (imgs);
p.Extend = Cairo.Extend.Repeat;
return p;
}
示例2: GetPattern
public Cairo.Pattern GetPattern (ApplicationContext actx, double scaleFactor)
{
if (pattern == null || currentScaleFactor != scaleFactor) {
if (pattern != null)
pattern.Dispose ();
Gdk.Pixbuf pb = ((GtkImage)Image.Backend).GetBestFrame (actx, scaleFactor, Image.Size.Width, Image.Size.Height, false);
using (var imgs = new Cairo.ImageSurface (Cairo.Format.ARGB32, (int)(Image.Size.Width * scaleFactor), (int)(Image.Size.Height * scaleFactor))) {
var ic = new Cairo.Context (imgs);
ic.Scale ((double)imgs.Width / (double)pb.Width, (double)imgs.Height / (double)pb.Height);
Gdk.CairoHelper.SetSourcePixbuf (ic, pb, 0, 0);
ic.Paint ();
imgs.Flush ();
((IDisposable)ic).Dispose ();
pattern = new Cairo.SurfacePattern (imgs);
}
pattern.Extend = Cairo.Extend.Repeat;
var cm = new Cairo.Matrix ();
cm.Scale (scaleFactor, scaleFactor);
pattern.Matrix = cm;
currentScaleFactor = scaleFactor;
}
return pattern;
}