예제 #1
0
 /// <summary>
 /// Converts an image to an bitmap.
 /// </summary>
 /// <param name="img">Input image.</param>
 /// <returns>Bitmap</returns>
 public static Bitmap ToBitmap(this Bgra<short>[,] img)
 {
     Bitmap bmp = null;
     using (var uImg = img.Lock())
     {
         bmp = toBitmap(uImg, PixelFormat.Format64bppArgb);
     }
     return bmp;
 }
예제 #2
0
        /// <summary>
        /// Converts an image to an bitmap.
        /// </summary>
        /// <param name="img">Input image.</param>
        /// <returns>Bitmap</returns>
        public static Bitmap ToBitmap(this Bgra <byte>[,] img)
        {
            Bitmap bmp = null;

            using (var uImg = img.Lock())
            {
                bmp = toBitmap(uImg, PixelFormat.Format32bppArgb);
            }
            return(bmp);
        }
        /// <summary>
        /// Converts the specified managed array to the corresponding bitmap source.
        /// </summary>
        /// <param name="image">Managed array.</param>
        /// <returns>Bitmap source.</returns>
        public static BitmapSource ToBitmapSource(this Bgra <byte>[,] image)
        {
            BitmapSource bmpSource = null;

            using (var uImg = image.Lock())
            {
                bmpSource = BitmapSource.Create(uImg.Width, uImg.Height, 96, 96,
                                                PixelFormats.Bgr32, null,
                                                uImg.ImageData, uImg.Stride * uImg.Height, uImg.Stride);
            }

            return(bmpSource);
        }