コード例 #1
0
        public static PointerBitmap WrapAsPointer(SkiaSharp.SKPixmap src)
        {
            var wrapInfo = GetBitmapInfo(src.Info, src.RowBytes);

            var wrapBytes = src.GetPixels();

            if (wrapBytes == IntPtr.Zero)
            {
                throw new ArgumentNullException();
            }

            return(new PointerBitmap(wrapBytes, wrapInfo));
        }
コード例 #2
0
        public static SpanBitmap WrapAsSpan(SkiaSharp.SKPixmap src, bool readOnly = false)
        {
            var wrapInfo = GetBitmapInfo(src.Info, src.RowBytes);

            if (readOnly)
            {
                return(new SpanBitmap(src.GetPixelSpan(), wrapInfo));
            }

            var wrapBytes = src.GetPixels();

            if (wrapBytes == IntPtr.Zero)
            {
                throw new ArgumentNullException();
            }

            return(new SpanBitmap(wrapBytes, wrapInfo));
        }