Struct rsvg::transform::ValidTransform
source · 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: Transform
Methods 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 copy 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 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§fn eq(&self, other: &ValidTransform) -> bool
fn eq(&self, other: &ValidTransform) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.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.
§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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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.