index method

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

Get the buffer index for the x, y pixel coordinates. No range checking is done.

Implementation

int index(int x, int y) => y * width + x;