本文整理汇总了C#中Cairo.Context.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Context.Dispose方法的具体用法?C# Context.Dispose怎么用?C# Context.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo.Context
的用法示例。
在下文中一共展示了Context.Dispose方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateSurfaceForPixbuf
public static Surface CreateSurfaceForPixbuf (Context cr, Pixbuf pixbuf)
{
Surface surface;
using (var t = cr.GetTarget ()) {
surface = t.CreateSimilar (t.Content, pixbuf.Width, pixbuf.Height);
}
using (Context surface_cr = new Context (surface)) {
CairoHelper.SetSourcePixbuf (surface_cr, pixbuf, 0, 0);
surface_cr.Paint ();
surface_cr.Dispose ();
}
return surface;
}
示例2: CreateBlur
ImageInfo CreateBlur(ImageInfo source)
{
double scale = Math.Max (256 / (double)source.Bounds.Width,
256 / (double)source.Bounds.Height);
var small = new Gdk.Rectangle (0, 0,
(int)Math.Ceiling (source.Bounds.Width * scale),
(int)Math.Ceiling (source.Bounds.Height * scale));
var image = new ImageSurface (Format.Argb32,
small.Width,
small.Height);
var ctx = new Context (image);
ctx.Matrix = source.Fit (small);
ctx.Operator = Operator.Source;
Pattern p = new SurfacePattern (source.Surface);
ctx.SetSource (p);
ctx.Paint ();
p.Dispose ();
ctx.Dispose ();
ImageInfo overlay = null;
using (var normal = image.ToPixbuf ())
{
using (var pixbufBlur = PixbufUtils.Blur (normal, 3, null))
{
overlay = new ImageInfo (pixbufBlur);
}
}
image.Dispose ();
return overlay;
}
示例3: GenerateStub
private ImageSurface GenerateStub()
{
ImageSurface stub = new ImageSurface (Format.ARGB32, 600, 300);
Context cairo = new Context(stub);
cairo.IdentityMatrix ();
cairo.Scale (600,300);
cairo.Rectangle (0, 0, 1, 1);
cairo.SetSourceRGB (1,1,1);
cairo.Fill ();
cairo.MoveTo (0.14, 0.5);
cairo.SetFontSize (0.08);
cairo.SetSourceRGB (0, 0, 0);
cairo.ShowText ("Загрузите подложку");
cairo.Dispose ();
return stub;
}
示例4: ImageInfo
public ImageInfo(ImageInfo info, Gdk.Rectangle allocation)
{
Surface = info.Surface.CreateSimilar (Content.Color,
allocation.Width,
allocation.Height);
var ctx = new Context (Surface);
Bounds = allocation;
ctx.Matrix = info.Fill (allocation);
Pattern p = new SurfacePattern (info.Surface);
ctx.SetSource (p);
ctx.Paint ();
ctx.Dispose ();
p.Dispose ();
}
示例5: UpdateCache
protected override void UpdateCache(Context ctx)
{
Rectangle rb = Slot + Parent.ClientRectangle.Position;
using (ImageSurface cache = new ImageSurface (bmp, Format.Argb32, Slot.Width, Slot.Height, 4 * Slot.Width)) {
Context gr = new Context (cache);
if (Clipping.count > 0) {
Clipping.clearAndClip (gr);
onDraw (gr);
}
gr.Dispose ();
ctx.SetSourceSurface (cache, rb.X, rb.Y);
ctx.Paint ();
}
Clipping.Reset();
}
示例6: UpdateCache
protected override void UpdateCache(Context ctx)
{
Rectangle rb = Slot + Parent.ClientRectangle.Position;
using (ImageSurface cache = new ImageSurface (bmp, Format.Argb32, Slot.Width, Slot.Height, 4 * Slot.Width)) {
Context gr = new Context (cache);
if (Clipping.count > 0) {
Clipping.clearAndClip (gr);
base.onDraw (gr);
//clip to client zone
CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
gr.Clip ();
foreach (GraphicObject c in Children) {
if (!c.Visible)
continue;
if (Clipping.intersect(c.Slot + ClientRectangle.Position))
c.Paint (ref gr);
}
#if DEBUG_CLIP_RECTANGLE
Clipping.stroke (gr, Color.Amaranth.AdjustAlpha (0.8));
#endif
}
gr.Dispose ();
ctx.SetSourceSurface (cache, rb.X, rb.Y);
ctx.Paint ();
}
Clipping.Reset();
}