pub struct ImageBrush<D = ImageData> {
pub image: D,
pub sampler: ImageSampler,
}Expand description
Describes the image content of a filled or stroked shape.
This type is generic over the storage used for the image data.
By default, the generic parameter is ImageData, which is a shared image with dynamic lifetime.
However, different renderers can use different types here, such as a pre-registered id.
Fields§
§image: DThe image to render.
sampler: ImageSamplerParameters which specify how to sample from the image during rendering.
Implementations§
Source§impl<D> ImageBrush<D>
impl<D> ImageBrush<D>
Sourcepub fn with_extend(self, mode: Extend) -> ImageBrush<D>
pub fn with_extend(self, mode: Extend) -> ImageBrush<D>
Builder method for setting the image extend mode in both directions.
Sourcepub fn with_x_extend(self, mode: Extend) -> ImageBrush<D>
pub fn with_x_extend(self, mode: Extend) -> ImageBrush<D>
Builder method for setting the image extend mode in the horizontal direction.
Sourcepub fn with_y_extend(self, mode: Extend) -> ImageBrush<D>
pub fn with_y_extend(self, mode: Extend) -> ImageBrush<D>
Builder method for setting the image extend mode in the vertical direction.
Sourcepub fn with_quality(self, quality: ImageQuality) -> ImageBrush<D>
pub fn with_quality(self, quality: ImageQuality) -> ImageBrush<D>
Builder method for setting a hint for the desired image quality when rendering.
Sourcepub fn with_alpha(self, alpha: f32) -> ImageBrush<D>
pub fn with_alpha(self, alpha: f32) -> ImageBrush<D>
Returns the image with the alpha multiplier set to alpha.
Sourcepub fn multiply_alpha(self, alpha: f32) -> ImageBrush<D>
pub fn multiply_alpha(self, alpha: f32) -> ImageBrush<D>
Returns the image with the alpha multiplier multiplied again by alpha.
The behaviour of this transformation is undefined if alpha is negative.
Source§impl ImageBrush
impl ImageBrush
Sourcepub fn new(image: ImageData) -> ImageBrush
pub fn new(image: ImageData) -> ImageBrush
Creates a new ImageBrush for the specified ImageData with default ImageSampler.
Sourcepub fn as_ref(&self) -> ImageBrush<&ImageData>
pub fn as_ref(&self) -> ImageBrush<&ImageData>
Converts an owned ImageBrush into a borrowed ImageBrushRef.
Source§impl ImageBrush<&ImageData>
impl ImageBrush<&ImageData>
Sourcepub fn to_owned(&self) -> ImageBrush
pub fn to_owned(&self) -> ImageBrush
Converts the ImageBrushRef to an owned ImageBrush.
Trait Implementations§
Source§impl<D> Clone for ImageBrush<D>where
D: Clone,
impl<D> Clone for ImageBrush<D>where
D: Clone,
Source§fn clone(&self) -> ImageBrush<D>
fn clone(&self) -> ImageBrush<D>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<D> Debug for ImageBrush<D>where
D: Debug,
impl<D> Debug for ImageBrush<D>where
D: Debug,
Source§impl<'a> From<&'a ImageBrush> for Brush<ImageBrush<&'a ImageData>, &'a Gradient>
impl<'a> From<&'a ImageBrush> for Brush<ImageBrush<&'a ImageData>, &'a Gradient>
Source§fn from(image: &'a ImageBrush) -> Brush<ImageBrush<&'a ImageData>, &'a Gradient>
fn from(image: &'a ImageBrush) -> Brush<ImageBrush<&'a ImageData>, &'a Gradient>
Source§impl<'a> From<&'a ImageBrush> for ImageBrush<&'a ImageData>
impl<'a> From<&'a ImageBrush> for ImageBrush<&'a ImageData>
Source§fn from(value: &'a ImageBrush) -> ImageBrush<&'a ImageData>
fn from(value: &'a ImageBrush) -> ImageBrush<&'a ImageData>
Source§impl<G, D> From<ImageBrush<D>> for Brush<ImageBrush<D>, G>
impl<G, D> From<ImageBrush<D>> for Brush<ImageBrush<D>, G>
Source§fn from(value: ImageBrush<D>) -> Brush<ImageBrush<D>, G>
fn from(value: ImageBrush<D>) -> Brush<ImageBrush<D>, G>
Source§impl From<ImageData> for ImageBrush
impl From<ImageData> for ImageBrush
Source§fn from(image: ImageData) -> ImageBrush
fn from(image: ImageData) -> ImageBrush
Source§impl<D> PartialEq for ImageBrush<D>where
D: PartialEq,
impl<D> PartialEq for ImageBrush<D>where
D: PartialEq,
impl<D> Copy for ImageBrush<D>where
D: Copy,
impl<D> StructuralPartialEq for ImageBrush<D>
Auto Trait Implementations§
impl<D> Freeze for ImageBrush<D>where
D: Freeze,
impl<D> RefUnwindSafe for ImageBrush<D>where
D: RefUnwindSafe,
impl<D> Send for ImageBrush<D>where
D: Send,
impl<D> Sync for ImageBrush<D>where
D: Sync,
impl<D> Unpin for ImageBrush<D>where
D: Unpin,
impl<D> UnwindSafe for ImageBrush<D>where
D: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.