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(); } }
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); }
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); }
public void Fill(RgbColor color) { PiNativeMethods.FillMatrix(_matrix, color.R, color.G, color.B); }
public void SetPixel(int x, int y, RgbColor color) { ValidateCoordinates(x, y); _canvas[x, y] = color; }
public void SetPixel(int x, int y, RgbColor color) { }