pub struct Paint<'a> {
pub shader: Shader<'a>,
pub blend_mode: BlendMode,
pub anti_alias: bool,
pub force_hq_pipeline: bool,
}
Expand description
Controls how a shape should be painted.
Fields§
§shader: Shader<'a>
A paint shader.
Default: black color
blend_mode: BlendMode
Paint blending mode.
Default: SourceOver
anti_alias: bool
Enables anti-aliased painting.
Default: true
force_hq_pipeline: bool
Forces the high quality/precision rendering pipeline.
tiny-skia
, just like Skia, has two rendering pipelines:
one uses f32
and another one uses u16
. u16
one is usually way faster,
but less precise. Which can lead to slight differences.
By default, tiny-skia
will choose the pipeline automatically,
depending on a blending mode and other parameters.
But you can force the high quality one using this flag.
This feature is especially useful during testing.
Unlike high quality pipeline, the low quality one doesn’t support all rendering stages, therefore we cannot force it like hq one.
Default: false
Implementations§
source§impl<'a> Paint<'a>
impl<'a> Paint<'a>
sourcepub fn set_color_rgba8(&mut self, r: u8, g: u8, b: u8, a: u8)
pub fn set_color_rgba8(&mut self, r: u8, g: u8, b: u8, a: u8)
Sets a paint source to a solid color.
self.shader = Shader::SolidColor(Color::from_rgba8(50, 127, 150, 200));
shorthand.
sourcepub fn is_solid_color(&self) -> bool
pub fn is_solid_color(&self) -> bool
Checks that the paint source is a solid color.
Trait Implementations§
impl<'a> StructuralPartialEq for Paint<'a>
Auto Trait Implementations§
impl<'a> Freeze for Paint<'a>
impl<'a> RefUnwindSafe for Paint<'a>
impl<'a> Send for Paint<'a>
impl<'a> Sync for Paint<'a>
impl<'a> Unpin for Paint<'a>
impl<'a> UnwindSafe for Paint<'a>
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)