TriggersTools.SteinsGate.Divergence 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package TriggersTools.SteinsGate.Divergence --version 1.0.0                
NuGet\Install-Package TriggersTools.SteinsGate.Divergence -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TriggersTools.SteinsGate.Divergence" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TriggersTools.SteinsGate.Divergence --version 1.0.0                
#r "nuget: TriggersTools.SteinsGate.Divergence, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TriggersTools.SteinsGate.Divergence as a Cake Addin
#addin nuget:?package=TriggersTools.SteinsGate.Divergence&version=1.0.0

// Install TriggersTools.SteinsGate.Divergence as a Cake Tool
#tool nuget:?package=TriggersTools.SteinsGate.Divergence&version=1.0.0                

Divergence AppIcon

Allows you to programatically draw Divergence Meter nixie tubes from the visual novel & anime: Steins;Gate.

Divergence uses graphics taken from the Steins;Gate visual novel for drawing the tubes, digits, and decimal point. The rest of the available characters are drawn with the Oslo II font, by Antonio Rodrigues Jr. This font was chosen as it had a similar style as well as perfect aspect ratio for each character.

Basic Examples

Below is example code used to draw nixie tubes using the Divergence static class. At the moment, nixie tubes can be drawn at 3 pre-scaled sizes: Large (132x428px per tube), Medium (66x214px per tube), or Small (33x107px per tube). The library currently doesn't support drawing at other scales, but that could be added later.

using TriggersTools.SteinsGate;

// Draw Figure A
var args = new DivergenceArgs {
    Scale = DivergenceScale.Medium,
    Spacing = new DivergenceSpacing(8, 8),
    Background = Color.FromArgb(224, 224, 224),
};
string text = "Oslo II";
using (Bitmap bmp = Divergence.Draw(text, args))
    bmp.Save("OsloII.png");

// Draw Figure B
args.Scale = DivergenceScale.Small;
args.Spacing = new DivergenceSpacing(5, 5);
DateTime date = DateTime.Now;
text = $"{date:MM\\/dd\\/yy}\n{date.TimeOfDay:hh\\:mm\\:ss}";
using (Bitmap bmp = Divergence.Draw(text, args))
    bmp.Save("DateTime.png");

Figure A + B

(Figure B: Displaying the date and time) (Figure A: Displaying the name of the font used for all other characters)

Backgrounds

As you can see in the code below, DivergenceArgs.Background accepts string as well. DivergenceArgs.Background is actually a struct called DivergenceBackground that can draw a background color, and/or a bitmap that is optionally scaled to fit the output image size.

// Draw Figure C
args = new DivergenceArgs {
    Scale = DivergenceScale.Small,
    Background = "EV_Z02A.PNG", // The CG background
};
text = "1.130426";
Divergence.CalculateSpacingFor(1920 / 2, 1080 / 2, text, ref args, left: 5, top: 2);
using (Bitmap bmp = Divergence.Draw(text, args))
    bmp.Save("Original Worldline.png");

Figure C

(Figure C: Drawing the divergence meter onto a CG to display the worldline)

Escaping

In many scenarios, the user may not be able to pass actual new line characters if not done programmatically. DivergenceArgs.Escape uses the DivergenceEscape enum to allow 3 choices: None (Don't escape anything), NewLines (Only escape \r and \n), and All (Escape any character after '').

An example would be in the command line: divergence.exe "#1\n#2". (Note: No command line program exists for this library at the moment.)

Figure D

(Figure D: The supposed output from the command line example above)

Example use of this library

Divergence isn't extremely useful or anything, but it can be fun to use as a bot command. Some of the features were specifically designed for use with an automated system.

// Automatically throw an ArgumentException if a formatted line
// is longer than 24 characters or there are more than 3 lines.
Divergence.EnabledLimits = true;
Divergence.MaxLength = 24;
Divergence.MaxLines = 3;

Figure E

(Figure E: The '\' before the space is used to escape it so that it is included in the command)

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 1,181 7/16/2018
1.0.0 970 6/16/2018