HTLLeonding.Utility.SimpleDrawing 1.0.0-preview5

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-preview5                
NuGet\Install-Package HTLLeonding.Utility.SimpleDrawing -Version 1.0.0-preview5                
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-preview5" />                
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-preview5                
#r "nuget: HTLLeonding.Utility.SimpleDrawing, 1.0.0-preview5"                
#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-preview5&prerelease

// Install HTLLeonding.Utility.SimpleDrawing as a Cake Tool
#tool nuget:?package=HTLLeonding.Utility.SimpleDrawing&version=1.0.0-preview5&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 (1)

Showing the top 1 NuGet packages that depend on HTLLeonding.Utility.SimpleDrawing:

Package Downloads
HTLLeonding.Utility.Turtle

Allows ordering a turtle around a beach to draw simple shapes

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.2.2 204 9/5/2024
3.2.1 154 8/22/2024
3.2.0 115 8/22/2024
3.1.2 119 8/22/2024
3.1.1 91 6/6/2024
3.1.0 105 5/21/2024
3.0.1 117 4/30/2024
3.0.0 111 4/30/2024
2.0.0 106 4/26/2024
1.0.0 110 4/26/2024
1.0.0-preview9 91 4/26/2024
1.0.0-preview8 100 4/26/2024
1.0.0-preview7 208 3/9/2023
1.0.0-preview6 119 3/9/2023
1.0.0-preview5 115 3/9/2023
1.0.0-preview4 133 3/9/2023
1.0.0-preview3 135 3/8/2023
1.0.0-preview2 126 3/8/2023
1.0.0-preview1 137 3/5/2023