getForeground method

int getForeground(
  1. int x,
  2. int y
)

Gets the foreground color at (x, y). Returns 0 if coordinates are out of bounds.

Implementation

int getForeground(int x, int y) {
  if (x < 0 || x >= width || y < 0 || y >= height) return 0;
  return attributes[(y * width + x) * 3 + 0];
}