Gets the foreground color at (x, y). Returns 0 if coordinates are out of bounds.
x
y
int getForeground(int x, int y) { if (!isCellValid(x, y)) return 0; return attributes[(y * width + x) * 3 + 0]; }