[−][src]Struct initials::avatar::AvatarBuilder
Avatar builder that stores the metrics of the image.
Fields
name: String
Initials name string
length: usize
Size of the inner-text
Methods
impl AvatarBuilder
[src]
pub fn new(name: &str) -> AvatarBuilder
[src]
Construct new AvatarBuilder.
pub fn with_font(self, font: &str) -> AvatarResult
[src]
Change the font of the avatar text. You need to include .ttf
file.
Default style is Hiragino_Sans
.
pub fn with_font_color(self, color: &str) -> AvatarResult
[src]
Change the font color. You need to specify hex color code.
pub fn with_font_scale(self, scale: f32) -> AvatarResult
[src]
Change the uniform scale of font.
Default to 150.0
.
pub fn with_background_color(self, color: &str) -> AvatarResult
[src]
Change the background color of the avatar. You need to specify hex color code.
pub fn with_length(self, length: usize) -> AvatarResult
[src]
Change the length of initials characters taken from the name.
Default to 2
.
pub fn with_width(self, width: u32) -> AvatarResult
[src]
Change the width of the avatar.
Default to 300
.
pub fn with_height(self, height: u32) -> AvatarResult
[src]
Change the height of the avatar.
Default to 300
.
pub fn with_contrast_ratio(self, ratio: f32) -> AvatarResult
[src]
Change the contrast ratio for the randomly generated avatar.
Default to 4.5
. Increase the ratio for more clear avatar.
pub fn with_blur(self, blur: f32) -> AvatarResult
[src]
Apply gaussian blur to the avatar.
pub fn draw(self) -> ImageBuffer<Rgba<u8>, Vec<u8>>
[src]
Draw the image according to the metrics given.
Trait Implementations
Auto Trait Implementations
impl Send for AvatarBuilder
impl Sync for AvatarBuilder
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,