public PixelColor BlendPixel( PixelColor[,] first, PixelColor[,] second, Func <PixelColor?, PixelColor?, PixelColor> blendFunction, int col, int row) { var colorFirst = col >= first.Width() || row >= first.Height() ? (PixelColor?)null : first[col, row]; var colorSecond = col >= second.Width() || row >= second.Height() ? (PixelColor?)null : second[col, row]; return(blendFunction(colorFirst, colorSecond)); }
public PixelColor[,] Blend( PixelColor[,] first, PixelColor[,] second, Func <PixelColor?, PixelColor?, PixelColor> blendFunction) { var width = Math.Max(first.Width(), second.Width()); var height = Math.Max(first.Height(), second.Height()); var blend = new PixelColor[width, height]; for (int col = 0; col != width; ++col) { for (int row = 0; row != height; ++row) { var color = BlendPixel(first, second, blendFunction, col, row); blend[col, row] = color; } } return(blend); }