Struct winit::dpi::LogicalPosition
source · Expand description
A position represented in logical pixels.
The position is stored as floats, so please be careful. Casting floats to integers truncates the fractional part,
which can cause noticable issues. To help with that, an Into<(i32, i32)>
implementation is provided which
does the rounding for you.
Fields
x: f64
y: f64
Implementations
sourceimpl LogicalPosition
impl LogicalPosition
pub fn new(x: f64, y: f64) -> Self
pub fn from_physical<T: Into<PhysicalPosition>>(
physical: T,
dpi_factor: f64
) -> Self
pub fn to_physical(&self, dpi_factor: f64) -> PhysicalPosition
Trait Implementations
sourceimpl Clone for LogicalPosition
impl Clone for LogicalPosition
sourcefn clone(&self) -> LogicalPosition
fn clone(&self) -> LogicalPosition
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for LogicalPosition
impl Debug for LogicalPosition
sourceimpl<'de> Deserialize<'de> for LogicalPosition
impl<'de> Deserialize<'de> for LogicalPosition
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<(f64, f64)> for LogicalPosition
impl From<(f64, f64)> for LogicalPosition
sourceimpl From<(i32, i32)> for LogicalPosition
impl From<(i32, i32)> for LogicalPosition
sourceimpl Into<(f64, f64)> for LogicalPosition
impl Into<(f64, f64)> for LogicalPosition
sourceimpl Into<(i32, i32)> for LogicalPosition
impl Into<(i32, i32)> for LogicalPosition
sourceimpl PartialEq<LogicalPosition> for LogicalPosition
impl PartialEq<LogicalPosition> for LogicalPosition
sourcefn eq(&self, other: &LogicalPosition) -> bool
fn eq(&self, other: &LogicalPosition) -> bool
sourceimpl Serialize for LogicalPosition
impl Serialize for LogicalPosition
impl Copy for LogicalPosition
impl StructuralPartialEq for LogicalPosition
Auto Trait Implementations
impl RefUnwindSafe for LogicalPosition
impl Send for LogicalPosition
impl Sync for LogicalPosition
impl Unpin for LogicalPosition
impl UnwindSafe for LogicalPosition
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere
T: Parameter<Self>,
Sets
value
as a parameter of self
.