Esempio n. 1
0
        public static PixelColor[,] GetPixels(this BitmapSource source)
        {
            // if (source.Format != PixelFormats.Pbgra32)
            //     source = new FormatConvertedBitmap(source, PixelFormats.Bgra32, null, 0);

            int width  = source.PixelWidth;
            int height = source.PixelHeight;

            PixelColor[,] result = new PixelColor[width, height];

            source.CopyPixelsOverride(result, width * 4, 0);
            return(result);
        }