PixelPoint
struct · ferroui-base · v0.5.0
struct PixelPoint
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).
Members
xyORIGINnewparseequalswith_xwith_yto_pointto_point_vectorto_point_with_dpito_point_with_dpi_vectorfrom_pointfrom_point_vectorfrom_point_with_dpifrom_point_with_dpi_vector
x
x: i32
The X co-ordinate.
y
y: i32
The Y co-ordinate.
ORIGIN
const ORIGIN: PixelPoint
A point representing 0,0.
new
const fn new(x: i32, y: i32) -> Self
Initializes a new instance of the PixelPoint structure.
parse
fn parse(s: &str) -> Result<Self, FormatError>
Parses a PixelPoint string ("x, y").
equals
const fn equals(self: &Self, other: PixelPoint) -> bool
Returns a boolean indicating whether the point is equal to the other given point.
with_x
const fn with_x(self: &Self, x: i32) -> PixelPoint
Returns a new PixelPoint with the same Y co-ordinate and the specified X co-ordinate.
with_y
const fn with_y(self: &Self, y: i32) -> PixelPoint
Returns a new PixelPoint with the same X co-ordinate and the specified Y co-ordinate.
to_point
fn to_point(self: &Self, scale: f64) -> Point
Converts the PixelPoint to a device-independent Point using the
specified scaling factor.
to_point_vector
fn to_point_vector(self: &Self, scale: Vector) -> Point
Converts the PixelPoint to a device-independent Point using the
specified per-axis scaling factor.
to_point_with_dpi
fn to_point_with_dpi(self: &Self, dpi: f64) -> Point
Converts the PixelPoint to a device-independent Point using the
specified dots per inch (DPI).
to_point_with_dpi_vector
fn to_point_with_dpi_vector(self: &Self, dpi: Vector) -> Point
Converts the PixelPoint to a device-independent Point using the
specified per-axis dots per inch (DPI).
from_point
fn from_point(point: Point, scale: f64) -> PixelPoint
Converts a Point to device pixels using the specified scaling factor.
from_point_vector
fn from_point_vector(point: Point, scale: Vector) -> PixelPoint
Converts a Point to device pixels using the specified per-axis scaling factor.
from_point_with_dpi
fn from_point_with_dpi(point: Point, dpi: f64) -> PixelPoint
Converts a Point to device pixels using the specified dots per inch (DPI).
from_point_with_dpi_vector
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
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeResourceKeyObjectPropertyValueAnyValueClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedToStringErasedDestructorIntoEitherMarkupTypedValueTypeRegistrationCloneCopyDebugStructuralPartialEqPartialEqEqHashDefaultFrom<PixelPoint>AddAdd<PixelVector>SubSub<PixelVector>AddAssignAddAssign<PixelVector>SubAssignSubAssign<PixelVector>FromStrDisplayFrom<PixelVector>
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.