GithubHelp home page GithubHelp logo

informagico / avataaarsnet Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 135 KB

.NET Porting of fangpenlin/avaaatars-generator

License: MIT License

C# 100.00%
dotnet-framework avatar avatar-generator wpf avataaars avataaars-generator

avataaarsnet's Introduction

AvataaarsNet - The .NET Component for Avataaars

This is a WPF Component porting of Avataaars Generator by Fang-Pen Lin.

Features

  • Built on top of .NET Framework 4.7.2
  • Uses the https://avataaars.io endpoint for generate the images (can also be self-hosted, see below)

Usage

demo

Add the reference to the namespace AvataaarsNet in your project and in your XAML.

xmlns:avataaarsnet="clr-namespace:AvataaarsNet;assembly=AvataaarsNet"

Add the component in your XAML (typical implementation, may vary based on purposes)

<avataaarsnet:AvataaarsGenerator
  x:Name="Avataaaars"
  Avatar="{Binding Path=Avatar, ElementName=MyWindow, Mode=OneWayToSource, UpdateSourceTrigger=PropertyChanged}"
  Configuration="{Binding Path=Configuration, ElementName=MyWindow, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
  EnableWidth="{Binding Path=EnableWidth, ElementName=MyWindow, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" />

It exposes three DependencyProperty:

Avatar is the resulting Bitmap (OneWayToSource) image based upon the actual configuration.

Configuration is the binding (TwoWay) of an AvataaarsConfiguration object that contains all the parameters to generate the image (can be used to save the configuration and restore it later).

EnableWidth is the binding (OneWay) to show or hide the custom Width parameter (default value is 512px).

Randomize

This library provides a usefull Randomize function to generate a Configuration object to bind to the control.
Just use

AvataaarsSettings.Randomize(uint width)

and bind the return to the configuration property.

Demo

A working demo can be found on my other repository here.
There is no nuget package so you need to add this project to the solution or compile the .dll and add it as a reference.

Self-hosted server side rendering

Special thanks to @gkoberger for porting the React component server side and deploying it to https://avataaars.io
This can also be self-hosted, refer to its repository for further details.

Another simple way to host it by yourself, with Avataaars React package updated to v1.2.1, minor improvements and no AWS storage, is to follow my fork here.

NB: When self hosted you simply need to change the baseUrl value in the Avataaars class to call the correct endpoint.

avataaarsnet's People

Contributors

informagico avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.