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);
        }
Пример #2
0
        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);
        }
Пример #3
0
 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);
 }