CSJ2K.Util.BitmapImageSource.GetComponents C# (CSharp) Метод

GetComponents() приватный статический Метод

private static GetComponents ( Bitmap bitmap ) : int[][]
bitmap System.Drawing.Bitmap
Результат int[][]
        private static int[][] GetComponents(Bitmap bitmap)
        {
            var w = bitmap.Width;
            var h = bitmap.Height;
            var nc = GetNumberOfComponents(bitmap.PixelFormat);

            var comps = new int[nc][];
            for (var c = 0; c < nc; ++c) comps[c] = new int[w * h];

            for (int y = 0, xy = 0; y < h; ++y)
            {
                for (var x = 0; x < w; ++x, ++xy)
                {
                    var color = bitmap.GetPixel(x, y);
                    for (var c = 0; c < nc; ++c)
                    {
                        comps[c][xy] = c == 0 ? color.R : c == 1 ? color.G : color.B;
                    }
                }
            }

            return comps;
        }