Esempio n. 1
0
        /// <summary>
        /// Obtain a Bitmap from <see cref="RenderingBuffer"/>
        /// </summary>
        public static Bitmap GetBitmap(PixelsBuffer source, Bitmap.Config config = null)
        {
            var bmp = Bitmap.CreateBitmap(Array.ConvertAll<uint, int>(source.Data, new Converter<uint, int>(x => (int)x)), source.StartOffset, source.Stride, source.Width, source.Height, Bitmap.Config.Argb8888);

            if (config != null && !config.Equals(Bitmap.Config.Argb8888))
            {
                var tmp = ConvertConfig(bmp, config);
                bmp.Dispose();
                bmp = tmp;
            }
            return bmp;
        }