pub struct ValidTransform(Transform);Expand description
A transform that has been checked to be invertible.
We need to validate user-supplied transforms before setting them on Cairo, so we use this type for that.
Tuple Fields§
§0: TransformMethods from Deref<Target = Transform>§
pub fn pre_transform(&self, t: &Transform) -> Self
pub fn post_transform(&self, t: &Transform) -> Self
pub fn pre_translate(&self, x: f64, y: f64) -> Self
pub fn pre_scale(&self, sx: f64, sy: f64) -> Self
pub fn pre_rotate(&self, angle: Angle) -> Self
pub fn post_translate(&self, x: f64, y: f64) -> Self
pub fn post_scale(&self, sx: f64, sy: f64) -> Self
pub fn post_rotate(&self, angle: Angle) -> Self
fn determinant(&self) -> f64
pub fn is_invertible(&self) -> bool
pub fn invert(&self) -> Option<Self>
pub fn transform_distance(&self, dx: f64, dy: f64) -> (f64, f64)
pub fn transform_point(&self, px: f64, py: f64) -> (f64, f64)
pub fn transform_rect(&self, rect: &Rect) -> Rect
Trait Implementations§
Source§impl Clone for ValidTransform
impl Clone for ValidTransform
Source§fn clone(&self) -> ValidTransform
fn clone(&self) -> ValidTransform
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ValidTransform
impl Debug for ValidTransform
Source§impl Default for ValidTransform
impl Default for ValidTransform
Source§fn default() -> ValidTransform
fn default() -> ValidTransform
Returns the “default value” for a type. Read more
Source§impl Deref for ValidTransform
impl Deref for ValidTransform
Source§impl From<ValidTransform> for Matrix
impl From<ValidTransform> for Matrix
Source§fn from(t: ValidTransform) -> Matrix
fn from(t: ValidTransform) -> Matrix
Converts to this type from the input type.
Source§impl PartialEq for ValidTransform
impl PartialEq for ValidTransform
Source§impl TryFrom<Transform> for ValidTransform
impl TryFrom<Transform> for ValidTransform
Source§fn try_from(t: Transform) -> Result<ValidTransform, InvalidTransform>
fn try_from(t: Transform) -> Result<ValidTransform, InvalidTransform>
Validates a Transform before converting it to a ValidTransform.
A transform is valid if it is invertible. For example, a matrix with all-zeros is not invertible, and it is invalid.
Source§type Error = InvalidTransform
type Error = InvalidTransform
The type returned in the event of a conversion error.
impl Copy for ValidTransform
impl StructuralPartialEq for ValidTransform
Auto Trait Implementations§
impl Freeze for ValidTransform
impl RefUnwindSafe for ValidTransform
impl Send for ValidTransform
impl Sync for ValidTransform
impl Unpin for ValidTransform
impl UnwindSafe for ValidTransform
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.