pub trait GradientTransform: Any + Debug {
// Required methods
fn transform(
&self,
bounds: Rect,
text_direction: Option<TextDirection>,
) -> Option<Matrix>;
fn as_any(&self) -> &(dyn Any + 'static);
// Provided method
fn eq_transform(&self, other: &(dyn GradientTransform + 'static)) -> bool { ... }
}Expand description
Base class for transforming gradient shaders without applying the same transform to the entire canvas.
For example, a SweepGradient normally starts its gradation at 3 o’clock
and draws clockwise. To have the sweep appear to start at 6 o’clock, supply
a GradientRotation of pi/4 radians (i.e. 45 degrees).
Required Methods§
Sourcefn transform(
&self,
bounds: Rect,
text_direction: Option<TextDirection>,
) -> Option<Matrix>
fn transform( &self, bounds: Rect, text_direction: Option<TextDirection>, ) -> Option<Matrix>
When a Gradient creates its Shader, it will call this method to
determine what transform to apply to the shader for the given Rect and
TextDirection.
Implementers may return None from this method, which achieves the same
final effect as returning Matrix4::IDENTITY.
Provided Methods§
Sourcefn eq_transform(&self, other: &(dyn GradientTransform + 'static)) -> bool
fn eq_transform(&self, other: &(dyn GradientTransform + 'static)) -> bool
Field equality. Dart’s default == is identity; subclasses that override
== implement this.
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".