+color_t raster_uv(const raster_t* p, vec_t uv)
+{
+ uv.x = scal_clamp(uv.x, S(0.0), S(1.0));
+ uv.y = scal_clamp(uv.y, S(0.0), S(1.0));
+ uv.y = S(1.0) - uv.y;
+ int x = (int)((scal_t)p->w * uv.x);
+ int y = (int)((scal_t)p->h * uv.y);
+ if (p->w <= x) {
+ x = p->w - 1;
+ }
+ if (p->h <= y) {
+ y = p->h - 1;
+ }
+ return *raster_color(p, x, y);
+}
+