Identicon Class

Represents an identicon for a specific hash.
public class Identicon
View source
Namespace
Jdenticon
Package
PackageJdenticon-net
Inheritance
SystemObject JdenticonIdenticon

Remarks

Note Note

The operations to save and export the icon are implemented as extension methods located in the Jdenticon namespace.

Examples

Before using Identicon the Jdenticon-net package needs to be added to the project. Use the NuGet Package Manager to add a reference.

NuGet Package Manager
PM> Install-Package Jdenticon-net

The following code illustrates how to use Jdenticon to generate an icon from a string and save it as a PNG image. Note that all save operations are implemented as extension methods, which means a using for the Jdenticon namespace is required.

Generate identicon as PNG
using Jdenticon;
// ...
Identicon
    .FromValue("string to hash", size: 160)
    .SaveAsPng("test.png");

Constructors

Public methodIdenticon
Creates an Identicon instance with the specified hash.

Properties

Public propertyStatic memberDefaultStyle
Gets or sets the default style that will be used for all Identicon instances where no explicit style has been specified.
Public propertyHash
Gets the hash that is used as base for this icon.
Public propertyIconGenerator
Gets or sets the IconGenerator used to generate icons.
Public propertySize
Gets or sets the size of the icon.
Public propertyStyle
Gets or sets the style of the icon.

Methods

Public methodDraw(Renderer)
Draws this icon using a specified renderer.
Public methodDraw(Renderer, Rectangle)
Draws this icon using a specified renderer.
Public methodStatic memberFromHash(Byte, Int32)
Creates an Identicon instance from a specified hash.
Public methodStatic memberFromHash(String, Int32)
Creates an Identicon instance from a hexadecimal hash string.
Public methodStatic memberFromValue
Generates a hash for a specified value and creates an Identicon instance from the generated hash.
Public methodToString
Gets a string representation of this Identicon.

Extension Methods

Public Extension MethodDraw(Graphics)
Draws an Identicon in a specified GDI drawing context at position (0, 0).
Public Extension MethodDraw(DrawingContext)
Draws an Identicon in a specified WPF drawing context at position (0, 0).
Public Extension MethodDraw(Graphics, Rectangle)
Draws an Identicon in a specified GDI drawing context.
Public Extension MethodDraw(Graphics, Rectangle)
Draws an Identicon in a specified GDI drawing context.
Public Extension MethodDraw(DrawingContext, Rectangle)
Draws an Identicon in a specified WPF drawing context.
Public Extension MethodDraw(DrawingContext, Rect)
Draws an Identicon in a specified WPF drawing context.
Public Extension MethodSaveAsEmf
Saves an Identicon as an Enhanced Metafile (EMF).
Public Extension MethodSaveAsEmf(Stream)
Saves an Identicon as an Enhanced Metafile (EMF).
Public Extension MethodSaveAsEmf(String)
Saves an Identicon as an Enhanced Metafile (EMF).
Public Extension MethodSaveAsEmfAsync(Stream)
Saves an Identicon as an Enhanced Metafile (EMF) asynchronously.
Public Extension MethodSaveAsEmfAsync(String)
Saves an Identicon as an Enhanced Metafile (EMF) asynchronously.
Public Extension MethodSaveAsPng
Saves an Identicon icon as a Portable Network Graphics (PNG) file.
Public Extension MethodSaveAsPng(Stream)
Saves an Identicon icon as a Portable Network Graphics (PNG) file.
Public Extension MethodSaveAsPng(String)
Saves an Identicon icon as a Portable Network Graphics (PNG) file.
Public Extension MethodSaveAsPngAsync(Stream)
Saves an Identicon icon as a Portable Network Graphics (PNG) file asynchronously.
Public Extension MethodSaveAsPngAsync(String)
Saves an Identicon icon as a Portable Network Graphics (PNG) file asynchronously.
Public Extension MethodSaveAsSvg
Saves an Identicon icon as a Scalable Vector Graphics (SVG) file.
Public Extension MethodSaveAsSvg(TextWriter)
Saves an Identicon icon as a Scalable Vector Graphics (SVG) file.
Public Extension MethodSaveAsSvg(Stream)
Saves an Identicon icon as a Scalable Vector Graphics (SVG) file.
Public Extension MethodSaveAsSvg(String)
Saves an Identicon icon as a Scalable Vector Graphics (SVG) file.
Public Extension MethodSaveAsSvg(Boolean)
Saves an Identicon icon as a Scalable Vector Graphics (SVG) file.
Public Extension MethodSaveAsSvg(TextWriter, Boolean)
Saves an Identicon icon as a Scalable Vector Graphics (SVG) file.
Public Extension MethodSaveAsSvg(Stream, Boolean)
Saves an Identicon icon as a Scalable Vector Graphics (SVG) file.
Public Extension MethodSaveAsSvg(String, Boolean)
Saves an Identicon icon as a Scalable Vector Graphics (SVG) file.
Public Extension MethodSaveAsSvgAsync(TextWriter)
Saves an Identicon icon as a Scalable Vector Graphics (SVG) file asynchronously.
Public Extension MethodSaveAsSvgAsync(Stream)
Saves an Identicon icon as a Scalable Vector Graphics (SVG) file asynchronously.
Public Extension MethodSaveAsSvgAsync(String)
Saves an Identicon icon as a Scalable Vector Graphics (SVG) file asynchronously.
Public Extension MethodSaveAsSvgAsync(TextWriter, Boolean)
Saves an Identicon icon as a Scalable Vector Graphics (SVG) file asynchronously.
Public Extension MethodSaveAsSvgAsync(Stream, Boolean)
Saves an Identicon icon as a Scalable Vector Graphics (SVG) file asynchronously.
Public Extension MethodSaveAsSvgAsync(String, Boolean)
Saves an Identicon icon as a Scalable Vector Graphics (SVG) file asynchronously.
Public Extension MethodToBitmap
Renders an Identicon to a GDI Bitmap.
Public Extension MethodToSvg
Renders an Identicon as a Scalable Vector Graphics (SVG) data string.
Public Extension MethodToSvg(Boolean)
Renders an Identicon as a Scalable Vector Graphics (SVG) data string.
Public Extension MethodToVisual
Renders an Identicon as a WPF Visual.

See Also

Reference