コード例 #1
0
ファイル: NativeControl.cs プロジェクト: bntre/cs-rationals
        protected void UpdateInternalBitmap()
        {
            if (_drawer == null || _wb == null)
            {
                return;
            }

            // Update inner bitmap
            int w = _wb.PixelWidth;
            int h = _wb.PixelHeight;

            // get updated image from control
            var image = _drawer.GetImage(w, h, _contextId);

            if (image == null)
            {
                return;
            }

#if ALLOW_SKIA
            var imageInfo = new SKImageInfo(w, h, SKColorType.Bgra8888, SKAlphaType.Premul);
            _wb.Lock();
            using (var surface = SKSurface.Create(imageInfo, _wb.BackBuffer, _wb.BackBufferStride)) {
                if (surface != null)
                {
                    // render image to the bitmap
                    image.Draw(surface.Canvas, true);
                }
                else
                {
                }
            }
            _wb.AddDirtyRect(new Int32Rect(0, 0, w, h));
            _wb.Unlock();
#elif ALLOW_GDI
            throw new Exception("Implement!!!");
#endif
        }