Exemple #1
0
        public EmulatedFramebuffer(TopLevelImpl.TopLevelView view)
        {
            _view = view;

            _isDeferred  = !Dispatcher.UIThread.CheckAccess();
            _logicalSize = _view.LogicalSize;
            var pixelSize = _view.PixelSize;

            Width    = (int)pixelSize.Width;
            Height   = (int)pixelSize.Height;
            RowBytes = Width * 4;
            Dpi      = new Vector(96 * pixelSize.Width / _logicalSize.Width, 96 * pixelSize.Height / _logicalSize.Height);
            Format   = PixelFormat.Rgba8888;
            var size = Height * RowBytes;

            _blob = AvaloniaLocator.Current.GetService <IRuntimePlatform>().AllocBlob(size);
            memset(Address, 0, new IntPtr(size));
        }
        public EmulatedFramebuffer(TopLevelImpl.TopLevelView view)
        {
            _view = view;

            _isDeferred  = !Dispatcher.UIThread.CheckAccess();
            _logicalSize = _view.LogicalSize;
            var pixelSize = _view.PixelSize;

            Width    = (int)pixelSize.Width;
            Height   = (int)pixelSize.Height;
            RowBytes = Width * 4;
            Dpi      = new Vector(96 * pixelSize.Width / _logicalSize.Width, 96 * pixelSize.Height / _logicalSize.Height);
            Format   = PixelFormat.Rgba8888;
            var size = Height * RowBytes;

            Address = Marshal.AllocHGlobal(size);
            memset(Address, 0, new IntPtr(size));
        }