Esempio n. 1
0
 public void Fill(RgbColor color)
 {
     for (int y = 0; y < Height; y++)
     {
         for (int x = 0; x < Width; x++)
         {
             Console.ForegroundColor = color.ToConsoleColor();
             Console.Write(".");
         }
         Console.WriteLine();
     }
 }
Esempio n. 2
0
        public static RgbCanvas FromBytes(int width, int height, byte[] bytes)
        {
            if (width * height * 3 != bytes.Length)
            {
                throw new ArgumentException($"width {width} and height {height} and 3 colors per pixel don't match bytes length {bytes.Length}");
            }

            var canvas = new RgbCanvas(width, height);

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    int startOffset = (y * width * 3) + (x * 3);
                    var color       = new RgbColor(bytes[startOffset], bytes[startOffset + 1], bytes[startOffset + 2]);
                    canvas.SetPixel(x, y, color);
                }
            }

            return(canvas);
        }
Esempio n. 3
0
        public void SetPixel(int x, int y, RgbColor color)
        {
            Validate.XY(x, y, Width, Height);

            PiNativeMethods.SetMatrixPixel(_matrix, x, y, color.R, color.G, color.B);
        }
Esempio n. 4
0
 public void Fill(RgbColor color)
 {
     PiNativeMethods.FillMatrix(_matrix, color.R, color.G, color.B);
 }
Esempio n. 5
0
 public void SetPixel(int x, int y, RgbColor color)
 {
     ValidateCoordinates(x, y);
     _canvas[x, y] = color;
 }
Esempio n. 6
0
 public void SetPixel(int x, int y, RgbColor color)
 {
 }