示例#1
0
        private static void SetPixels(Matrix matrix, double[,] a, double[,] b, double[,] c, PixelFormat format, int yOffset, int xOffset)
        {
            var height = a.GetLength(0);
            var width  = a.GetLength(1);

            for (var y = 0; y < height; y++)
            {
                for (var x = 0; x < width; x++)
                {
                    matrix.Pixels[yOffset + y, xOffset + x] = new Pixel(a[y, x], b[y, x], c[y, x], format);
                }
            }
        }
示例#2
0
 public Pixel(double firstComponent, double secondComponent, double thirdComponent, PixelFormat pixelFormat)
 {
     if (!new[] { PixelFormat.RGB, PixelFormat.YCbCr }.Contains(pixelFormat))
     {
         throw new FormatException("Unknown pixel format: " + pixelFormat);
     }
     format = pixelFormat;
     if (pixelFormat == PixelFormat.RGB)
     {
         r = firstComponent;
         g = secondComponent;
         b = thirdComponent;
     }
     if (pixelFormat == PixelFormat.YCbCr)
     {
         y  = firstComponent;
         cb = secondComponent;
         cr = thirdComponent;
     }
 }