Example #1
0
 Gdk.Pixbuf RenderFrame(ApplicationContext actx, double scaleFactor, double width, double height)
 {
     using (var sf = new Cairo.ImageSurface(Cairo.Format.ARGB32, (int)(width * scaleFactor), (int)(height * scaleFactor)))
         using (var ctx = new Cairo.Context(sf)) {
             ImageDescription idesc = new ImageDescription()
             {
                 Alpha = 1,
                 Size  = new Size(width * scaleFactor, height * scaleFactor)
             };
             Draw(actx, ctx, 1, 0, 0, idesc);
             var f = new ImageFrame(ImageBuilderBackend.CreatePixbuf(sf), (int)width, (int)height);
             AddFrame(f);
             return(f.Pixbuf);
         }
 }
Example #2
0
        Gdk.Pixbuf RenderFrame(ApplicationContext actx, double scaleFactor, ImageDescription idesc)
        {
            var swidth  = Math.Max((int)(idesc.Size.Width * scaleFactor), 1);
            var sheight = Math.Max((int)(idesc.Size.Height * scaleFactor), 1);

            using (var sf = new Cairo.ImageSurface(Cairo.Format.ARGB32, swidth, sheight))
                using (var ctx = new Cairo.Context(sf)) {
                    ctx.Scale(scaleFactor, scaleFactor);
                    Draw(actx, ctx, scaleFactor, 0, 0, idesc);
                    var f = new ImageFrame(ImageBuilderBackend.CreatePixbuf(sf), Math.Max((int)idesc.Size.Width, 1), Math.Max((int)idesc.Size.Height, 1), true);
                    if (drawCallback == null)
                    {
                        AddFrame(f);
                    }
                    return(f.Pixbuf);
                }
        }
Example #3
0
        Gdk.Pixbuf RenderFrame(ApplicationContext actx, double scaleFactor, double width, double height)
        {
            var swidth  = Math.Max((int)(width * scaleFactor), 1);
            var sheight = Math.Max((int)(height * scaleFactor), 1);

            using (var sf = new Cairo.ImageSurface(Cairo.Format.ARGB32, swidth, sheight))
                using (var ctx = new Cairo.Context(sf)) {
                    ImageDescription idesc = new ImageDescription()
                    {
                        Alpha = 1,
                        Size  = new Size(width, height)
                    };
                    ctx.Scale(scaleFactor, scaleFactor);
                    Draw(actx, ctx, scaleFactor, 0, 0, idesc);
                    var f = new ImageFrame(ImageBuilderBackend.CreatePixbuf(sf), Math.Max((int)width, 1), Math.Max((int)height, 1), true);
                    AddFrame(f);
                    return(f.Pixbuf);
                }
        }