示例#1
0
        public ImageInfo(ImageInfo info, Widget w, Gdk.Rectangle bounds)
        {
            Cairo.Surface similar = CairoUtils.CreateSurface(w.GdkWindow);
            Bounds  = bounds;
            Surface = similar.CreateSimilar(Content.ColorAlpha, Bounds.Width, Bounds.Height);
            Context ctx = new Context(Surface);

            ctx.Matrix = info.Fill(Bounds);
            Pattern p = new SurfacePattern(info.Surface);

            ctx.Source = p;
            ctx.Paint();
            ((IDisposable)ctx).Dispose();
            p.Destroy();
        }
示例#2
0
        public ImageInfo(ImageInfo info, Widget w, Gdk.Rectangle bounds)
        {
            using (var similar = CairoUtils.CreateSurface(w.GdkWindow)) {
                Bounds  = bounds;
                Surface = similar.CreateSimilar(Content.ColorAlpha, Bounds.Width, Bounds.Height);
                var ctx = new Context(Surface);

                ctx.Matrix = info.Fill(Bounds);
                Pattern p = new SurfacePattern(info.Surface);
                ctx.SetSource(p);
                ctx.Paint();
                ctx.Dispose();
                p.Dispose();
            }
        }
 private void SetPixbuf(Pixbuf pixbuf)
 {
     Surface       = CairoUtils.CreateSurface(pixbuf);
     Bounds.Width  = pixbuf.Width;
     Bounds.Height = pixbuf.Height;
 }