DIKU.Canvas
1.0.0-alpha2
See the version list below for details.
dotnet add package DIKU.Canvas --version 1.0.0-alpha2
NuGet\Install-Package DIKU.Canvas -Version 1.0.0-alpha2
<PackageReference Include="DIKU.Canvas" Version="1.0.0-alpha2" />
paket add DIKU.Canvas --version 1.0.0-alpha2
#r "nuget: DIKU.Canvas, 1.0.0-alpha2"
// Install DIKU.Canvas as a Cake Addin
#addin nuget:?package=DIKU.Canvas&version=1.0.0-alpha2&prerelease
// Install DIKU.Canvas as a Cake Tool
#tool nuget:?package=DIKU.Canvas&version=1.0.0-alpha2&prerelease
The Canvas library
<img src="https://raw.githubusercontent.com/kfl/img-util-fs/main/images/turtle.png" border="2" width="250" align="right">
This library features a number of utility functions for drawing simple 2d graphics on a canvas, including features for running simple user-interactive apps that display such canvas. A small DSL for drawing using turtle graphics is included.
Features for loading a canvas from an image file and saving canvas to .png
are included.
They should work out of the box on Windows, but on Linux and MacOS they require the user to have SDL2
installed locally.
The library, which is based on SDL2, is portable, in the sense that applications built using the library can execute on Linux, macOS, and Windows using .NET6.0.
The library is intended to be built (and consumed) as a NuGet package.
The API
The library API is available in the file img_util.fsi
.
How to build
If you want to build the library and NuGet package yourself, you will need the .NET6.0 SDK
and development versions of SDL2
and SDL2_image
for your platform.
First install .NET 6 for your platform.
Then install SDL2 and SDL2_image:
On macOS with homebrew:
brew install sdl2 sdl2_image
On Debian and Ubuntu:
apt install libsdl2-dev libdl2-image-dev
On Arch (and probably Manjaro),
sdl2
is available inextra
:sudo pacman -S sdl2 sdl2_image
On Windows you need
SDL2.dll
andSDL2_image.dll
in a search path available to dotnet. The.dll
's in thelib/
folder should be sufficient for building. (Better instructions are a welcome contribution if anyone builds on Windows)
Finally, compile the library:
dotnet build
And pack it into a NuGet package:
dotnet pack
The package will be available in bin/Debug/Canvas.X.y.z.nupkg
.
Using the NuGet package from a local repository
Start by creating a directory to use as a local NuGet repository. Add it to the NuGet
sources list:
dotnet nuget add source /full/path/to/the/directory
Ensure the repository was added with
dotnet nuget list source
Place Canvas.X.y.z.nupkg
in the local repository.
Now clear the nuget cache:
dotnet nuget locals all -c
Test that everything worked with dotnet fsi
dotnet fsi
>#r "nuget:Canvas";;
>open Canvas;;
Canvas is now available to use in projects through NuGet, both in the interpreter and in projects with e.g. .fsproj
files.
Examples
<img src="images/applespiral.png" border="2" width="250" align="right">
A number of examples are available in the examples
folder.
The best show-cases for using the library are
examples/color_boxes.fsx
examples/keyboard_example.fsx
examples/turtle.fsx
Note that not all the examples are currently executable.
License
MIT license
Copyright
Copyright 2018-2021 - Martin Elsman
Contributions
The following individuals have contributed to the ImgUtil library:
- Ken Friis Larsen
- Mads Dyrvig Obitsø Thomsen
- Jan Rolandsen
- Jon Sporring
- Chris Pritchard (SDL P/Invoke)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. |
-
net6.0
- FSharp.Core (>= 6.0.5)
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 | |
---|---|---|---|
2.0.3 | 109 | 3/9/2024 | |
2.0.2 | 647 | 9/22/2023 | |
2.0.2-alpha1 | 75 | 9/22/2023 | |
2.0.1 | 571 | 9/6/2023 | |
2.0.0 | 794 | 9/1/2023 | |
2.0.0-beta1 | 113 | 8/27/2023 | |
2.0.0-alpha8 | 113 | 8/22/2023 | |
2.0.0-alpha7 | 117 | 8/20/2023 | |
1.0.2.1 | 179 | 8/5/2023 | |
1.0.2 | 178 | 8/5/2023 | |
1.0.1 | 1,046 | 9/11/2022 | |
1.0.1-alpha | 153 | 9/10/2022 | |
1.0.0 | 1,024 | 9/4/2022 | |
1.0.0-alpha3 | 142 | 9/4/2022 | |
1.0.0-alpha2 | 276 | 9/1/2022 | |
1.0.0-alpha1 | 154 | 9/1/2022 | |
1.0.0-alpha | 142 | 9/1/2022 |