public static SimplePixel InvertPixel(SimplePixel pixel) { var inv = new SimplePixel(); inv.R = (byte)(255 - pixel.R); inv.G = (byte)(255 - pixel.G); inv.B = (byte)(255 - pixel.B); inv.A = pixel.A; return(inv); }
public SimplePixel[] Get1DArr() { SimplePixel[] res = new SimplePixel[image.Length]; int k = 0; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { res[k++] = image[x, y]; } } return(res); }
public static SimplePixel[,] BitmapToPixels(Bitmap img) { SimplePixel[,] pixels = new SimplePixel[img.Width, img.Height]; for (int y = 0; (y <= (img.Height - 1)); y++) { for (int x = 0; (x <= (img.Width - 1)); x++) { Color color = img.GetPixel(x, y); pixels[x, y].R = color.R; pixels[x, y].G = color.G; pixels[x, y].B = color.B; pixels[x, y].A = color.A; } } return(pixels); }