MCPcopy Create free account
hub / github.com/PABannier/sam3.cpp / screen_to_image

Function screen_to_image

examples/main_image.cpp:312–318  ·  view source on GitHub ↗

Convert screen position to image coordinates

Source from the content-addressed store, hash-verified

310
311// Convert screen position to image coordinates
312static bool screen_to_image(const app_state& app, float sx, float sy,
313 float& ix, float& iy) {
314 if (app.canvas_w <= 0 || app.canvas_h <= 0) return false;
315 ix = (sx - app.canvas_x) / app.canvas_w * app.image.width;
316 iy = (sy - app.canvas_y) / app.canvas_h * app.image.height;
317 return ix >= 0 && iy >= 0 && ix < app.image.width && iy < app.image.height;
318}
319
320// Draw a spinning indicator + message as a centered overlay
321static void draw_busy_overlay(const char* message) {

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected