26 if ((w <= 0) || (h <= 0)) {
29 const double px = (u * w) - 0.5;
30 const double py = (v * h) - 0.5;
31 const int x0 = qBound(0,
static_cast<int>(std::floor(px)), w - 1);
32 const int y0 = qBound(0,
static_cast<int>(std::floor(py)), h - 1);
33 const int x1 = qMin(x0 + 1, w - 1);
34 const int y1 = qMin(y0 + 1, h - 1);
35 const double fx = qBound(0.0, px - x0, 1.0);
36 const double fy = qBound(0.0, py - y0, 1.0);
38 const double north = (at(x0, y0) * (1.0 - fx)) + (at(x1, y0) * fx);
39 const double south = (at(x0, y1) * (1.0 - fx)) + (at(x1, y1) * fx);
40 return (north * (1.0 - fy)) + (south * fy);