int idx(num x, num y) { final i = x.floor() - f.ox; final j = y.floor() - f.oy; return (i < 0 || j < 0 || i >= f.w || j >= f.h) ? -1 : j * f.w + i; }