Skip to main content

Crate hashavatar

Crate hashavatar 

Source
Expand description

Procedural, asset-free avatar generation driven by stable identity hashes.

The crate produces deterministic avatar images from an input identifier without shipping image packs, sprites, or third-party artwork. All visual output is drawn from code using geometric primitives.

Typical usage:

use hashavatar::{
    AvatarBackground, AvatarKind, AvatarOptions, AvatarOutputFormat, AvatarSpec,
    encode_avatar_for_id,
};

let spec = AvatarSpec::new(256, 256, 0)?;
let bytes = encode_avatar_for_id(
    spec,
    "robot@hashavatar.app",
    AvatarOutputFormat::WebP,
    AvatarOptions {
        kind: AvatarKind::Robot,
        background: AvatarBackground::Transparent,
    },
)?;

Structs§

AvatarIdentity
A stable avatar identity derived from a SHA-512 digest.
AvatarIdentityError
AvatarNamespace
AvatarOptions
AvatarSpec
Input parameters for a generated avatar image.
AvatarSpecError
CatAvatar
Cat-face avatar renderer built from simple geometric primitives.
Color
RGBA color helper for concise shape drawing.
HashedCatAvatar
Cat-face avatar renderer driven by a SHA-512 identity.
HashedDogAvatar
HashedRobotAvatar

Enums§

AvatarBackground
Canvas background mode for raster and SVG avatar output.
AvatarIdentityComponent
AvatarKind
Avatar family selection.
AvatarOutputFormat
Export formats for encoded avatar assets.
AvatarRenderError

Constants§

AVATAR_STYLE_VERSION
Rendering contract version for deterministic avatars.
MAX_AVATAR_DIMENSION
Largest supported raster or SVG dimension.
MAX_AVATAR_ID_BYTES
Largest supported identity input in bytes.
MAX_AVATAR_NAMESPACE_COMPONENT_BYTES
Largest supported namespace component in bytes.
MIN_AVATAR_DIMENSION
Smallest supported raster or SVG dimension.

Traits§

AvatarRenderer
Trait for renderers that can draw reusable avatar styles onto an image buffer.

Functions§

encode_avatar
Render and encode an avatar into memory.
encode_avatar_for_id
encode_avatar_for_namespace
encode_cat_avatar
Render and encode a cat avatar into memory.
encode_cat_avatar_for_id
Render and encode a cat avatar for a stable identity string.
render_alien_avatar_for_identity
render_avatar_for_id
Render an avatar image directly without encoding it.
render_avatar_for_namespace
render_avatar_svg_for_id
Render an avatar as a compact SVG string.
render_avatar_svg_for_namespace
render_bird_avatar_for_identity
render_cactus_avatar_for_identity
Render a cactus avatar from a stable identity.
render_cat_avatar
Render a cat face avatar into an RGBA image.
render_cat_avatar_for_identity
Render a cat face avatar from a SHA-512-backed identity.
render_cat_avatar_for_identity_with_background
render_cupcake_avatar_for_identity
Render a cupcake avatar from a stable identity.
render_dog_avatar_for_identity
render_fox_avatar_for_identity
render_frog_avatar_for_identity
Render a frog avatar from a stable identity.
render_ghost_avatar_for_identity
render_icecream_avatar_for_identity
Render an ice cream cone avatar from a stable identity.
render_knight_avatar_for_identity
Render a knight helmet avatar from a stable identity.
render_monster_avatar_for_identity
render_mushroom_avatar_for_identity
Render a mushroom avatar from a stable identity.
render_octopus_avatar_for_identity
Render an octopus avatar from a stable identity.
render_panda_avatar_for_identity
Render a panda avatar from a stable identity.
render_paws_avatar_for_identity
render_pizza_avatar_for_identity
Render a pizza-slice avatar from a stable identity.
render_planet_avatar_for_identity
Render a ringed planet avatar from a stable identity.
render_robot_avatar_for_identity
render_rocket_avatar_for_identity
Render a rocket avatar from a stable identity.
render_skull_avatar_for_identity
render_slime_avatar_for_identity
render_wizard_avatar_for_identity