pub struct PointDelta<T: Coordinate> {
pub dx: T,
pub dy: T,
}
Expand description
A difference between two 2D points.
Fields§
§dx: T
§dy: T
Implementations§
Source§impl<T: Coordinate> PointDelta<T>
impl<T: Coordinate> PointDelta<T>
Source§impl PointDelta<Twips>
impl PointDelta<Twips>
Sourcepub fn from_pixels(dx: f64, dy: f64) -> Self
pub fn from_pixels(dx: f64, dy: f64) -> Self
Converts the given number of pixels
into twips.
This may be a lossy conversion; any precision more than a twip (1/20 pixels) is truncated.
§Examples
// 40 pixels is equivalent to 800 twips.
let point = swf::PointDelta::from_pixels(40.0, 20.0);
assert_eq!(point.dx.get(), 800);
assert_eq!(point.dy.get(), 400);
// Output is truncated if more precise than a twip (1/20 pixels).
let point = swf::PointDelta::from_pixels(40.018, 20.0);
assert_eq!(point.dx.get(), 800);
assert_eq!(point.dy.get(), 400);
Trait Implementations§
Source§impl<T: Coordinate> Add<PointDelta<T>> for Point<T>
impl<T: Coordinate> Add<PointDelta<T>> for Point<T>
Source§impl<T: Coordinate> AddAssign<PointDelta<T>> for Point<T>
impl<T: Coordinate> AddAssign<PointDelta<T>> for Point<T>
Source§fn add_assign(&mut self, other: PointDelta<T>)
fn add_assign(&mut self, other: PointDelta<T>)
Performs the
+=
operation. Read moreSource§impl<T: Clone + Coordinate> Clone for PointDelta<T>
impl<T: Clone + Coordinate> Clone for PointDelta<T>
Source§fn clone(&self) -> PointDelta<T>
fn clone(&self) -> PointDelta<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T: Debug + Coordinate> Debug for PointDelta<T>
impl<T: Debug + Coordinate> Debug for PointDelta<T>
Source§impl<T: Default + Coordinate> Default for PointDelta<T>
impl<T: Default + Coordinate> Default for PointDelta<T>
Source§fn default() -> PointDelta<T>
fn default() -> PointDelta<T>
Returns the “default value” for a type. Read more
Source§impl<T: Coordinate> Div<i32> for PointDelta<T>
impl<T: Coordinate> Div<i32> for PointDelta<T>
Source§impl<T: Coordinate> DivAssign<i32> for PointDelta<T>
impl<T: Coordinate> DivAssign<i32> for PointDelta<T>
Source§fn div_assign(&mut self, other: i32)
fn div_assign(&mut self, other: i32)
Performs the
/=
operation. Read moreSource§impl<T: Coordinate> Mul<i32> for PointDelta<T>
impl<T: Coordinate> Mul<i32> for PointDelta<T>
Source§impl<T: Coordinate> MulAssign<i32> for PointDelta<T>
impl<T: Coordinate> MulAssign<i32> for PointDelta<T>
Source§fn mul_assign(&mut self, other: i32)
fn mul_assign(&mut self, other: i32)
Performs the
*=
operation. Read moreSource§impl<T: Coordinate> Neg for PointDelta<T>
impl<T: Coordinate> Neg for PointDelta<T>
Source§impl<T: PartialEq + Coordinate> PartialEq for PointDelta<T>
impl<T: PartialEq + Coordinate> PartialEq for PointDelta<T>
Source§impl<T: Coordinate> Sub<PointDelta<T>> for Point<T>
impl<T: Coordinate> Sub<PointDelta<T>> for Point<T>
Source§impl<T: Coordinate> SubAssign<PointDelta<T>> for Point<T>
impl<T: Coordinate> SubAssign<PointDelta<T>> for Point<T>
Source§fn sub_assign(&mut self, other: PointDelta<T>)
fn sub_assign(&mut self, other: PointDelta<T>)
Performs the
-=
operation. Read moreimpl<T: Copy + Coordinate> Copy for PointDelta<T>
impl<T: Eq + Coordinate> Eq for PointDelta<T>
impl<T: Coordinate> StructuralPartialEq for PointDelta<T>
Auto Trait Implementations§
impl<T> Freeze for PointDelta<T>where
T: Freeze,
impl<T> RefUnwindSafe for PointDelta<T>where
T: RefUnwindSafe,
impl<T> Send for PointDelta<T>where
T: Send,
impl<T> Sync for PointDelta<T>where
T: Sync,
impl<T> Unpin for PointDelta<T>where
T: Unpin,
impl<T> UnwindSafe for PointDelta<T>where
T: UnwindSafe,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more