Skip to main content

Paint

Trait Paint 

Source
pub trait Paint:
    Clone
    + Default
    + 'static {
    type ColorSourceFragment: ColorSourceFragment;
    type ImageFilterFragment: ImageFilterFragment;
    type Texture: Texture;

Show 25 methods // Required methods fn set_color(&mut self, color: impl Into<Color>); fn set_blend_mode(&mut self, blend_mode: BlendMode); fn set_draw_style(&mut self, draw_style: DrawStyle); fn set_stroke_cap(&mut self, cap: StrokeCap); fn set_stroke_join(&mut self, join: StrokeJoin); fn set_stroke_width(&mut self, width: f32); fn set_stroke_miter(&mut self, miter: f32); fn set_color_source( &mut self, color_source: ColorSource<Self::Texture, Self::ColorSourceFragment>, ); fn set_color_filter(&mut self, color_filter: ColorFilter); fn set_image_filter( &mut self, image_filter: ImageFilter<Self::ImageFilterFragment>, ); fn set_mask_filter(&mut self, mask_filter: MaskFilter); // Provided methods fn color(color: impl Into<Color>) -> Self { ... } fn stroke_color(color: impl Into<Color>, stroke_width: f32) -> Self { ... } fn color_source( color_source: ColorSource<Self::Texture, Self::ColorSourceFragment>, ) -> Self { ... } fn with_color(self, color: impl Into<Color>) -> Self { ... } fn with_blend_mode(self, blend_mode: BlendMode) -> Self { ... } fn with_draw_style(self, draw_style: DrawStyle) -> Self { ... } fn with_stroke_cap(self, cap: StrokeCap) -> Self { ... } fn with_stroke_join(self, join: StrokeJoin) -> Self { ... } fn with_stroke_width(self, width: f32) -> Self { ... } fn with_stroke_miter(self, miter: f32) -> Self { ... } fn with_color_source( self, color_source: ColorSource<Self::Texture, Self::ColorSourceFragment>, ) -> Self { ... } fn with_color_filter(self, color_filter: ColorFilter) -> Self { ... } fn with_image_filter( self, image_filter: ImageFilter<Self::ImageFilterFragment>, ) -> Self { ... } fn with_mask_filter(self, mask_filter: MaskFilter) -> Self { ... }
}

Required Associated Types§

Required Methods§

Source

fn set_color(&mut self, color: impl Into<Color>)

Sets the paint color for stroking or filling.

Source

fn set_blend_mode(&mut self, blend_mode: BlendMode)

Sets the paint blend mode.

Source

fn set_draw_style(&mut self, draw_style: DrawStyle)

Set the paint draw style.

Source

fn set_stroke_cap(&mut self, cap: StrokeCap)

Sets how strokes rendered using this paint are capped.

Source

fn set_stroke_join(&mut self, join: StrokeJoin)

Sets how strokes rendered using this paint are joined.

Source

fn set_stroke_width(&mut self, width: f32)

Sets the width of the strokes rendered using this paint.

Source

fn set_stroke_miter(&mut self, miter: f32)

Sets the miter limit of the strokes rendered using this paint.

Source

fn set_color_source( &mut self, color_source: ColorSource<Self::Texture, Self::ColorSourceFragment>, )

Sets the color source of the paint.

Source

fn set_color_filter(&mut self, color_filter: ColorFilter)

Sets the color filter of the paint.

Source

fn set_image_filter( &mut self, image_filter: ImageFilter<Self::ImageFilterFragment>, )

Sets the image filter of a paint.

Image filters are functions that are applied to regions of a texture to produce a single color.

Source

fn set_mask_filter(&mut self, mask_filter: MaskFilter)

Sets the mask filter of a paint.

Mask filters are functions that are applied over a shape after it has been drawn but before it has been blended into the final image.

Provided Methods§

Source

fn color(color: impl Into<Color>) -> Self

Source

fn stroke_color(color: impl Into<Color>, stroke_width: f32) -> Self

Source

fn color_source( color_source: ColorSource<Self::Texture, Self::ColorSourceFragment>, ) -> Self

Source

fn with_color(self, color: impl Into<Color>) -> Self

Source

fn with_blend_mode(self, blend_mode: BlendMode) -> Self

Source

fn with_draw_style(self, draw_style: DrawStyle) -> Self

Source

fn with_stroke_cap(self, cap: StrokeCap) -> Self

Source

fn with_stroke_join(self, join: StrokeJoin) -> Self

Source

fn with_stroke_width(self, width: f32) -> Self

Source

fn with_stroke_miter(self, miter: f32) -> Self

Source

fn with_color_source( self, color_source: ColorSource<Self::Texture, Self::ColorSourceFragment>, ) -> Self

Source

fn with_color_filter(self, color_filter: ColorFilter) -> Self

Source

fn with_image_filter( self, image_filter: ImageFilter<Self::ImageFilterFragment>, ) -> Self

Source

fn with_mask_filter(self, mask_filter: MaskFilter) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§