Exemplo n.º 1
0
        public void Dispose()
        {
            var image        = new X11.XImage();
            int bitsPerPixel = 32;

            image.width            = Size.Width;
            image.height           = Size.Height;
            image.format           = 2; //ZPixmap;
            image.data             = Address;
            image.byte_order       = 0; // LSBFirst;
            image.bitmap_unit      = bitsPerPixel;
            image.bitmap_bit_order = 0; // LSBFirst;
            image.bitmap_pad       = bitsPerPixel;
            image.depth            = 24;
            image.bytes_per_line   = RowBytes - Size.Width * 4;
            image.bits_per_pixel   = bitsPerPixel;
            X11.XLockDisplay(_display);
            X11.XInitImage(ref image);
            var gc = X11.XCreateGC(_display, _xid, 0, IntPtr.Zero);

            X11.XPutImage(_display, _xid, gc, ref image, 0, 0, 0, 0, (uint)Size.Width, (uint)Size.Height);
            X11.XFreeGC(_display, gc);
            X11.XSync(_display, true);
            X11.XUnlockDisplay(_display);
            _blob.Dispose();
        }
Exemplo n.º 2
0
 public void Dispose()
 {
     if (Buffer != IntPtr.Zero)
     {
         Surface.Dispose();
         _blob.Dispose();
         Buffer = IntPtr.Zero;
     }
 }
Exemplo n.º 3
0
        public void Dispose()
        {
            if (_blob.IsDisposed)
            {
                return;
            }
            var     nfo   = (int)CGBitmapFlags.ByteOrder32Big | (int)CGImageAlphaInfo.PremultipliedLast;
            CGImage image = null;

            try
            {
                using (var colorSpace = CGColorSpace.CreateDeviceRGB())
                    using (var bContext = new CGBitmapContext(Address, Width, Height, 8, Width * 4,
                                                              colorSpace, (CGImageAlphaInfo)nfo))
                        image = bContext.ToImage();
                lock (_view.SyncRoot)
                {
                    if (!_isDeferred)
                    {
                        using (var nscontext = NSGraphicsContext.CurrentContext)
                            using (var context = nscontext.GraphicsPort)
                            {
                                context.SetFillColor(255, 255, 255, 255);
                                context.FillRect(new CGRect(default(CGPoint), _view.LogicalSize));
                                context.TranslateCTM(0, _view.LogicalSize.Height - _logicalSize.Height);
                                context.DrawImage(new CGRect(default(CGPoint), _logicalSize), image);
                                context.Flush();
                                nscontext.FlushGraphics();
                            }
                    }
                }
            }
            finally
            {
                if (image != null)
                {
                    if (!_isDeferred)
                    {
                        image.Dispose();
                    }
                    else
                    {
                        _view.SetBackBufferImage(new SavedImage(image, _logicalSize));
                    }
                }
                _blob.Dispose();
            }
        }
Exemplo n.º 4
0
 public override void Dispose()
 {
     XLib.XcursorImageDestroy(Handle);
     _blob.Dispose();
 }
Exemplo n.º 5
0
 public void Deallocate() => _bitmapBlob.Dispose();