/// <summary> /// Changes layout of pixels in image according to defined rules in 'mixer' /// </summary> /// <param name="mixer">Method which returns new coordinates of pixel</param> /// <param name="changer">Method which returns controls for image traverse</param> public void ProcessThumbnailLayout(LayoutMixer mixer, LayoutCoordinatesMaxValue changer) { (int xMax, int yMax) = changer(thumb.Width, thumb.Height); for (int x = 0; x < xMax; ++x) { for (int y = 0; y < yMax; ++y) { (int newX, int newY) = mixer(x, y); Color oldPixel = thumb.GetPixel(newX, newY); thumb.SetPixel(newX, newY, thumb.GetPixel(x, y)); thumb.SetPixel(x, y, oldPixel); } } }
/// <summary> /// Changes layout of pixels in image according to defined rules in 'mixer' /// </summary> /// <param name="mixer">Method which returns new coordinates of pixel</param> /// <param name="changer">Method which returns controls for image traverse</param> public void ProcessLayout(LayoutMixer mixer, LayoutCoordinatesMaxValue changer) { (int xMax, int yMax) = changer(image.Width, image.Height); for (int x = 0; x < xMax; ++x) { for (int y = 0; y < yMax; ++y) { (int newX, int newY) = mixer(x, y); Color oldPixel = image.GetPixel(newX, newY); image.SetPixel(newX, newY, image.GetPixel(x, y)); image.SetPixel(x, y, oldPixel); } } }