[][src]Struct initials::avatar::AvatarBuilder

pub struct AvatarBuilder {
    pub name: String,
    pub length: usize,
    // some fields omitted
}

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

impl Debug for AvatarBuilder[src]

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]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> SetParameter for T[src]

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 
[src]

Sets value as a parameter of self.