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: BlendModePaint blending mode.
Default: SourceOver
anti_alias: boolEnables anti-aliased painting.
Default: true
force_hq_pipeline: boolForces 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§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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().