NetAF.Imaging
1.1.3
dotnet add package NetAF.Imaging --version 1.1.3
NuGet\Install-Package NetAF.Imaging -Version 1.1.3
<PackageReference Include="NetAF.Imaging" Version="1.1.3" />
<PackageVersion Include="NetAF.Imaging" Version="1.1.3" />
<PackageReference Include="NetAF.Imaging" />
paket add NetAF.Imaging --version 1.1.3
#r "nuget: NetAF.Imaging, 1.1.3"
#:package NetAF.Imaging@1.1.3
#addin nuget:?package=NetAF.Imaging&version=1.1.3
#tool nuget:?package=NetAF.Imaging&version=1.1.3
NetAF.Imaging
Extension to add simple imaging capabilities to NetAF.
Overview
NetAF.Imaging provides extensions to NetAF to add simple functions to convert images to visuals.
Getting Started
Clone the repo/pull NuGet
Clone the repo:
git clone https://github.com/benpollarduk/netaf.imaging.git
Or add the NuGet package:
dotnet add package NetAF.Imaging
Hello World
Generating visuals is made easy with the VisualHelper class. The following example generates a visual on the console:
var displaySize = new Size(80, 50);
var adapter = new SystemConsoleAdapter();
var frame = VisualHelper.CreateFrame(@"C:\TestImage.jpg", displaySize, CellAspectRatio.Console);
adapter.RenderFrame(frame);
This can be used in a game:
var frame = VisualHelper.CreateFrame(@"C:\TestImage.jpg", displaySize, CellAspectRatio.Console);
game.ChangeMode(new VisualMode(frame));
Here is a simple room that contains a command to look at the view.
return new Room("Hillside", "A wild hillside with a lone tree", commands:
[
new CustomCommand(new CommandHelp("Look at view", "Look at the current view."), true, true, (game, args) =>
{
var frame = VisualHelper.CreateFrame(@"C:\TestImage.jpg", game.Configuration.DisplaySize, CellAspectRatio.Console);
game.ChangeMode(new VisualMode(frame));
return new(ReactionResult.GameModeChanged, string.Empty);
})
]);
Applying Textures
A texturizer can be applied to add extra depth to the image:
var frame = VisualHelper.CreateFrame(@"C:\TestImage.jpg", displaySize, CellAspectRatio.Console, new BrightnessTexturizer());
Documentation
Please visit https://benpollarduk.github.io/NetAF-docs/docs/visuals.html to view the NetAF.Imaging documentation.
For Open Questions
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- NetAF (>= 3.2.0)
- SixLabors.ImageSharp (>= 3.1.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Updated to NetAF 3.2.0.