Struct tahga::stroke::watercolor::WatercolorStroke
source · pub struct WatercolorStroke {
pub colors: Vec<Alpha<Hsl, f32>>,
pub load: f32,
pub count: u32,
pub stroke_type: StrokeType,
}
Expand description
WatercolorStroke defines a watercolor wash
Fields§
§colors: Vec<Alpha<Hsl, f32>>
Base color of stroke
load: f32
Brush load
count: u32
Number of times to draw stoke
stroke_type: StrokeType
Stroke Type
Implementations§
source§impl WatercolorStroke
impl WatercolorStroke
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new instance of a WatercolorStroke
Examples
use tahga::stroke::watercolor::WatercolorStroke;
let s = WatercolorStroke::new();
assert_eq!(s.colors.len(), 1);
assert_eq!(s.load, 100.);
sourcepub fn color(self, color: Alpha<Hsl, f32>) -> Self
pub fn color(self, color: Alpha<Hsl, f32>) -> Self
Set a single color for a WatercolorStroke
and return a new instance
This is intended to be chained with new() in a builder pattern
Arguments
color
: The color to use
Examples
use nannou::prelude::*;
use tahga::stroke::watercolor::WatercolorStroke;
let s = WatercolorStroke::new().color(hsla(0.7, 0.9, 0.3, 0.01));
assert_eq!(s.colors.len(), 1);
let c = s.colors[0].into_components();
assert_eq!(c.1, 0.9);
sourcepub fn colors(self, colors: Vec<Alpha<Hsl, f32>>) -> Self
pub fn colors(self, colors: Vec<Alpha<Hsl, f32>>) -> Self
Set a list of colors for a WatercolorStroke
and return a new instance
This is intended to be chained with new() in a builder pattern
Arguments
colors
: A Vec of colors to use
Examples
use nannou::prelude::*;
use tahga::stroke::watercolor::WatercolorStroke;
let s = WatercolorStroke::new().colors(vec!(
hsla(0.7, 0.9, 0.3, 0.01),
hsla(0.8, 0.8, 0.3, 0.01),
hsla(0.9, 0.7, 0.3, 0.01),
hsla(0.3, 0.6, 0.3, 0.01),
));
assert_eq!(s.colors.len(), 4);
let c = s.colors[2].into_components();
assert_eq!(c.1, 0.7);
sourcepub fn load(self, amount: f32) -> Self
pub fn load(self, amount: f32) -> Self
Set the brush load for a WatercolorStroke
and return a new instance
This is intended to be chained with new() in a builder pattern
Arguments
amount
: the new load
Examples
use nannou::prelude::*;
use tahga::stroke::watercolor::WatercolorStroke;
let s = WatercolorStroke::new().load(50.);
assert_eq!(s.load, 50.);
sourcepub fn count(self, count: u32) -> Self
pub fn count(self, count: u32) -> Self
Set the stroke count for a WatercolorStroke
and return a new instance
This is intended to be chained with new() in a builder pattern
Arguments
count
: The number times to run the stroke
Examples
use nannou::prelude::*;
use tahga::stroke::watercolor::WatercolorStroke;
let s = WatercolorStroke::new().count(4);
assert_eq!(s.count, 4);
sourcepub fn stroke_type(self, stroke_type: StrokeType) -> Self
pub fn stroke_type(self, stroke_type: StrokeType) -> Self
Set the stroke count for a WatercolorStroke
and return a new instance
This is intended to be chained with new() in a builder pattern
Arguments
stroke_type
: The color to use
Examples
use nannou::prelude::*;
use tahga::stroke::watercolor::{WatercolorStroke, StrokeType};
let s = WatercolorStroke::new().stroke_type(StrokeType::Left);
assert_eq!(s.stroke_type, StrokeType::Left);
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for WatercolorStroke
impl Send for WatercolorStroke
impl Sync for WatercolorStroke
impl Unpin for WatercolorStroke
impl UnwindSafe for WatercolorStroke
Blanket Implementations§
source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
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, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
source§fn convert_into(self) -> U
fn convert_into(self) -> U
source§fn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
source§fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains the unclamped color. Read more