HTLLeonding.Utility.SimpleDrawing 1.0.0-preview7

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
This is a prerelease version of HTLLeonding.Utility.SimpleDrawing.
There is a newer version of this package available.
See the version list below for details.
dotnet add package HTLLeonding.Utility.SimpleDrawing --version 1.0.0-preview7
NuGet\Install-Package HTLLeonding.Utility.SimpleDrawing -Version 1.0.0-preview7
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="HTLLeonding.Utility.SimpleDrawing" Version="1.0.0-preview7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HTLLeonding.Utility.SimpleDrawing --version 1.0.0-preview7
#r "nuget: HTLLeonding.Utility.SimpleDrawing, 1.0.0-preview7"
#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 HTLLeonding.Utility.SimpleDrawing as a Cake Addin
#addin nuget:?package=HTLLeonding.Utility.SimpleDrawing&version=1.0.0-preview7&prerelease

// Install HTLLeonding.Utility.SimpleDrawing as a Cake Tool
#tool nuget:?package=HTLLeonding.Utility.SimpleDrawing&version=1.0.0-preview7&prerelease

SimpleDrawing - Cross Platform

  • Allows for the simple drawing of basic shapes on a canvas
  • Renders the canvas in a window
  • Works on multiple platforms (tested Windows, Linux, Mac)
  • Based on SkiaSharp
  • User click events are registered

This library is meant for simple applications so only basic functions are available to keep the API easy to use.

Sample Usage

using Avalonia.Media;
using SimpleXPlatDrawing;

SimpleDrawing.Init(400, 400);

SimpleDrawing.DrawLine(new(100, 100), new(300, 300));
SimpleDrawing.DrawLine(new(300, 100), new(100, 300), thickness: 4, color: Brushes.Green);
SimpleDrawing.DrawRectangle(new(50, 50), new(100, 80), lineColor: Brushes.Red);
SimpleDrawing.DrawRectangle(new(325, 325), new(375, 375), fillColor: Brushes.Azure);
SimpleDrawing.DrawEllipse(new(200, 300), 50, 75, 
                          lineColor: Brushes.Firebrick, fillColor: Brushes.Firebrick);
SimpleDrawing.DrawCircle(new(350, 75), 40, lineThickness: 2.5D, 
                         lineColor: Brushes.BlueViolet, fillColor: Brushes.Gold);
SimpleDrawing.DrawText(new(25, 350), "Hello World", 24, Brushes.Lime);

await SimpleDrawing.Render();

SimpleDrawing.DrawLine(new(200, 25), new(200, 375), 8);
await SimpleDrawing.Render();

await Task.Delay(TimeSpan.FromSeconds(2));
SimpleDrawing.Clear();
var x = 50;
for (var i = 0; i < 10; i++)
{
    SimpleDrawing.DrawLine(new(x, 25), new(x, 375), 8);
    x += 25;
    await SimpleDrawing.Render();
    await Task.Delay(TimeSpan.FromSeconds(1));
}

Console.Write("Press any key to exit...");
Console.ReadKey();

Click Events

An Action can be passed to the Init function to register a click handler which will receive the location the user clicked within the canvas.

SimpleDrawing.Init(600, 600, DrawCircleOnClick);

async void DrawCircleOnClick(Point clickLocation)
{
    SimpleDrawing.DrawCircle(clickLocation, 25);
    await SimpleDrawing.Render();
}
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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. 
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
3.1.0 74 5/21/2024
3.0.1 89 4/30/2024
3.0.0 84 4/30/2024
2.0.0 83 4/26/2024
1.0.0 86 4/26/2024
1.0.0-preview9 68 4/26/2024
1.0.0-preview8 76 4/26/2024
1.0.0-preview7 188 3/9/2023
1.0.0-preview6 97 3/9/2023
1.0.0-preview5 97 3/9/2023
1.0.0-preview4 112 3/9/2023
1.0.0-preview3 112 3/8/2023
1.0.0-preview2 108 3/8/2023
1.0.0-preview1 114 3/5/2023