Skip to main content

convert_normalized_to_screen

Function convert_normalized_to_screen 

Source
pub fn convert_normalized_to_screen(
    norm_x: f64,
    norm_y: f64,
    window_x: f64,
    window_y: f64,
    screenshot_w: f64,
    screenshot_h: f64,
    dpi_scale: f64,
    resize_scale: f64,
) -> (f64, f64)
Expand description

Convert normalized coordinates (0-999) to absolute screen coordinates.

The Gemini model outputs coordinates in a normalized 0-999 range. This function converts them to actual screen pixel coordinates, accounting for window position, DPI scaling, and any resize scaling.

§Arguments

  • norm_x - Normalized X coordinate (0-999)
  • norm_y - Normalized Y coordinate (0-999)
  • window_x - Window X position on screen
  • window_y - Window Y position on screen
  • screenshot_w - Screenshot width in pixels
  • screenshot_h - Screenshot height in pixels
  • dpi_scale - DPI scale factor
  • resize_scale - Resize scale factor (if image was resized for model)

§Returns

Tuple of (screen_x, screen_y) absolute coordinates