pub struct AndroidPlatform { /* private fields */ }Expand description
Platform abstraction for Android.
This type manages platform-specific conversions (e.g., density, pointer coordinates) and provides a bridge between Android’s event system and Compose’s logical coordinate space.
Implementations§
Source§impl AndroidPlatform
impl AndroidPlatform
Sourcepub fn set_scale_factor(&mut self, scale_factor: f64)
pub fn set_scale_factor(&mut self, scale_factor: f64)
Updates the platform’s scale factor.
This should be called when the device density changes.
Sourcepub fn set_input_surface_offset_px(&mut self, x_px: f64, y_px: f64)
pub fn set_input_surface_offset_px(&mut self, x_px: f64, y_px: f64)
Updates the native-surface offset for Android input coordinates.
Android MotionEvent positions are relative to the activity content
area, while the renderer draws into the full ANativeWindow. Freeform
and desktop window modes can inflate that native surface around the
content area for shadows/decor, so input must be shifted into native
surface coordinates before density conversion.
Sourcepub fn input_surface_offset_px(&self) -> (f64, f64)
pub fn input_surface_offset_px(&self) -> (f64, f64)
Returns the configured native-surface input offset in physical pixels.
Sourcepub fn pointer_position(&self, physical_x: f64, physical_y: f64) -> Point
pub fn pointer_position(&self, physical_x: f64, physical_y: f64) -> Point
Converts a physical Android pointer position into logical coordinates.
Android provides pointer positions in content-relative physical pixels; this method first shifts them into the native surface coordinate space, then scales them back to logical pixels using the platform’s current scale factor.
Sourcepub fn scale_factor(&self) -> f32
pub fn scale_factor(&self) -> f32
Returns the current scale factor (density).
Trait Implementations§
Source§impl Clone for AndroidPlatform
impl Clone for AndroidPlatform
Source§fn clone(&self) -> AndroidPlatform
fn clone(&self) -> AndroidPlatform
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more