pub struct PixelPoint {
pub x: i32,
pub y: i32,
}Expand description
Represents a point in device pixels.
Integer arithmetic wraps on overflow. Conversions from floating point truncate
toward zero and saturate at the i32 range (NaN becomes 0).
Fields§
§x: i32The X co-ordinate.
y: i32The Y co-ordinate.
Implementations§
Source§impl PixelPoint
impl PixelPoint
Sourcepub const ORIGIN: PixelPoint
pub const ORIGIN: PixelPoint
A point representing 0,0.
Sourcepub const fn new(x: i32, y: i32) -> Self
pub const fn new(x: i32, y: i32) -> Self
Initializes a new instance of the PixelPoint structure.
Sourcepub fn parse(s: &str) -> Result<Self, FormatError>
pub fn parse(s: &str) -> Result<Self, FormatError>
Parses a PixelPoint string ("x, y").
Sourcepub const fn equals(&self, other: PixelPoint) -> bool
pub const fn equals(&self, other: PixelPoint) -> bool
Returns a boolean indicating whether the point is equal to the other given point.
Sourcepub const fn with_x(&self, x: i32) -> PixelPoint
pub const fn with_x(&self, x: i32) -> PixelPoint
Returns a new PixelPoint with the same Y co-ordinate and the specified X co-ordinate.
Sourcepub const fn with_y(&self, y: i32) -> PixelPoint
pub const fn with_y(&self, y: i32) -> PixelPoint
Returns a new PixelPoint with the same X co-ordinate and the specified Y co-ordinate.
Sourcepub fn to_point(&self, scale: f64) -> Point
pub fn to_point(&self, scale: f64) -> Point
Converts the PixelPoint to a device-independent Point using the
specified scaling factor.
Sourcepub fn to_point_vector(&self, scale: Vector) -> Point
pub fn to_point_vector(&self, scale: Vector) -> Point
Converts the PixelPoint to a device-independent Point using the
specified per-axis scaling factor.
Sourcepub fn to_point_with_dpi(&self, dpi: f64) -> Point
pub fn to_point_with_dpi(&self, dpi: f64) -> Point
Converts the PixelPoint to a device-independent Point using the
specified dots per inch (DPI).
Sourcepub fn to_point_with_dpi_vector(&self, dpi: Vector) -> Point
pub fn to_point_with_dpi_vector(&self, dpi: Vector) -> Point
Converts the PixelPoint to a device-independent Point using the
specified per-axis dots per inch (DPI).
Sourcepub fn from_point(point: Point, scale: f64) -> PixelPoint
pub fn from_point(point: Point, scale: f64) -> PixelPoint
Converts a Point to device pixels using the specified scaling factor.
Sourcepub fn from_point_vector(point: Point, scale: Vector) -> PixelPoint
pub fn from_point_vector(point: Point, scale: Vector) -> PixelPoint
Converts a Point to device pixels using the specified per-axis scaling factor.
Sourcepub fn from_point_with_dpi(point: Point, dpi: f64) -> PixelPoint
pub fn from_point_with_dpi(point: Point, dpi: f64) -> PixelPoint
Converts a Point to device pixels using the specified dots per inch (DPI).
Sourcepub fn from_point_with_dpi_vector(point: Point, dpi: Vector) -> PixelPoint
pub fn from_point_with_dpi_vector(point: Point, dpi: Vector) -> PixelPoint
Converts a Point to device pixels using the specified per-axis dots per inch (DPI).
Trait Implementations§
Source§impl Add for PixelPoint
impl Add for PixelPoint
Source§type Output = PixelPoint
type Output = PixelPoint
+ operator.Source§fn add(self, b: PixelPoint) -> PixelPoint
fn add(self, b: PixelPoint) -> PixelPoint
+ operation. Read moreSource§impl Add<PixelVector> for PixelPoint
impl Add<PixelVector> for PixelPoint
Source§type Output = PixelPoint
type Output = PixelPoint
+ operator.Source§fn add(self, b: PixelVector) -> PixelPoint
fn add(self, b: PixelVector) -> PixelPoint
+ operation. Read moreSource§impl AddAssign for PixelPoint
impl AddAssign for PixelPoint
Source§fn add_assign(&mut self, b: PixelPoint)
fn add_assign(&mut self, b: PixelPoint)
+= operation. Read moreSource§impl AddAssign<PixelVector> for PixelPoint
impl AddAssign<PixelVector> for PixelPoint
Source§fn add_assign(&mut self, b: PixelVector)
fn add_assign(&mut self, b: PixelVector)
+= operation. Read moreSource§impl Clone for PixelPoint
impl Clone for PixelPoint
impl Copy for PixelPoint
Source§impl Debug for PixelPoint
impl Debug for PixelPoint
Source§impl Default for PixelPoint
impl Default for PixelPoint
Source§impl Display for PixelPoint
impl Display for PixelPoint
impl Eq for PixelPoint
Source§impl From<PixelPoint> for PixelVector
Converts the PixelPoint to a PixelVector.
impl From<PixelPoint> for PixelVector
Converts the PixelPoint to a PixelVector.
Source§fn from(p: PixelPoint) -> PixelVector
fn from(p: PixelPoint) -> PixelVector
Source§impl From<PixelVector> for PixelPoint
Converts the PixelVector to a PixelPoint (an explicit conversion in the
reference API).
impl From<PixelVector> for PixelPoint
Converts the PixelVector to a PixelPoint (an explicit conversion in the
reference API).
Source§fn from(a: PixelVector) -> PixelPoint
fn from(a: PixelVector) -> PixelPoint
Source§impl FromStr for PixelPoint
impl FromStr for PixelPoint
Source§impl Hash for PixelPoint
impl Hash for PixelPoint
Source§impl MarkupTyped for PixelPoint
impl MarkupTyped for PixelPoint
Source§const MARKUP: &'static MarkupType
const MARKUP: &'static MarkupType
Source§impl PartialEq for PixelPoint
impl PartialEq for PixelPoint
impl StructuralPartialEq for PixelPoint
Source§impl Sub for PixelPoint
impl Sub for PixelPoint
Source§type Output = PixelPoint
type Output = PixelPoint
- operator.Source§fn sub(self, b: PixelPoint) -> PixelPoint
fn sub(self, b: PixelPoint) -> PixelPoint
- operation. Read moreSource§impl Sub<PixelVector> for PixelPoint
impl Sub<PixelVector> for PixelPoint
Source§type Output = PixelPoint
type Output = PixelPoint
- operator.Source§fn sub(self, b: PixelVector) -> PixelPoint
fn sub(self, b: PixelVector) -> PixelPoint
- operation. Read moreSource§impl SubAssign for PixelPoint
impl SubAssign for PixelPoint
Source§fn sub_assign(&mut self, b: PixelPoint)
fn sub_assign(&mut self, b: PixelPoint)
-= operation. Read moreSource§impl SubAssign<PixelVector> for PixelPoint
impl SubAssign<PixelVector> for PixelPoint
Source§fn sub_assign(&mut self, b: PixelVector)
fn sub_assign(&mut self, b: PixelVector)
-= operation. Read moreAuto Trait Implementations§
impl Freeze for PixelPoint
impl RefUnwindSafe for PixelPoint
impl Send for PixelPoint
impl Sync for PixelPoint
impl Unpin for PixelPoint
impl UnsafeUnpin for PixelPoint
impl UnwindSafe for PixelPoint
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more