pub struct Brush { /* private fields */ }Expand description
A brush family together with a colour, a size and an epsilon.
size is the stroke width in stroke units. epsilon is the smallest
distance Ink bothers to distinguish, also in stroke units; it controls how
aggressively the generated mesh is simplified, and must be positive and no
larger than size.
Implementations§
Source§impl Brush
impl Brush
Sourcepub fn new(
family: &BrushFamily,
color: Color,
size: f32,
epsilon: f32,
) -> Result<Self>
pub fn new( family: &BrushFamily, color: Color, size: f32, epsilon: f32, ) -> Result<Self>
Builds a brush.
Fails with ErrorKind::InvalidArgument
unless size and epsilon are both finite and positive and
epsilon <= size.
Sourcepub fn color(&self) -> Color
pub fn color(&self) -> Color
The brush colour, gamma-encoded in the colour space Ink stored it in.
Sourcepub fn color_in(&self, format: ColorFormat) -> Color
pub fn color_in(&self, format: ColorFormat) -> Color
The brush colour in a chosen encoding.
Sourcepub fn coat_count(&self) -> u32
pub fn coat_count(&self) -> u32
How many coats this brush paints. Each coat becomes its own render group in the resulting geometry.
Sourcepub fn family(&self) -> BrushFamily
pub fn family(&self) -> BrushFamily
A copy of the brush’s family.
Sourcepub fn set_size(&mut self, size: f32) -> Result<()>
pub fn set_size(&mut self, size: f32) -> Result<()>
Changes the stroke width. Same constraints as Brush::new.
Sourcepub fn set_epsilon(&mut self, epsilon: f32) -> Result<()>
pub fn set_epsilon(&mut self, epsilon: f32) -> Result<()>
Changes epsilon. Same constraints as Brush::new.
Sourcepub fn set_family(&mut self, family: &BrushFamily)
pub fn set_family(&mut self, family: &BrushFamily)
Changes the brush family.