Spannerisms.Sheeter 1.0.1

dotnet add package Spannerisms.Sheeter --version 1.0.1
                    
NuGet\Install-Package Spannerisms.Sheeter -Version 1.0.1
                    
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="Spannerisms.Sheeter" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Spannerisms.Sheeter" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Spannerisms.Sheeter" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Spannerisms.Sheeter --version 1.0.1
                    
#r "nuget: Spannerisms.Sheeter, 1.0.1"
                    
#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.
#:package Spannerisms.Sheeter@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Spannerisms.Sheeter&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Spannerisms.Sheeter&version=1.0.1
                    
Install as a Cake Tool

NuGet version (Spannerisms.Sheeter)

Sheeter

Sheeter is a high-performance .NET library for converting retro game graphics formats to and from indexed pixel data. Sheeter is available from nuget.org as the package Spannerisms.Sheeter.

Basic usage

The Sheeter library contains various structure types to represent tile data, for example Snes4bppTile. Before using this library, make sure you are familiar with Span types and ref variables

The tile structs are large, unmanaged types. It is generally best to only use them in arrays or spans. If tiles need to be handled individually, prefer doing so with the ref keyword. Most of this library is built on passing tiles by reference; however, you should keep these concerns in mind when writing your own routines.

Convert an image

  1. Create a SheeterBitmap instance using new SheeterBitmap(file) to load an image from a file. Note: This type is disposable.
  2. Create a PaletteSet and populate it to map colors to indices.
  3. Use SheeterImage.CreateIndexedTiles to create a collection of indexed-color 8x8 tiles from the image.
  4. Use GraphicsTile.ConvertAllTiles<TFormat> to convert to the desired tile format.

Example:

using Sheeter;
using Sheeter.Snes;

private static readonly PaletteSet CommonPalette = ...;

public byte[] CreateSpriteSheet(string path) {
    using SheeterBitmap image = new(path);

    TiledBitmapViewport sheetView = new(image, x: 0, y: 0, tilesWidth: 16, tilesHeight: 4);

    GraphicsTile[] indexedTiles = sheetView.CreateGraphicsTiles(CommonPalette);

    Snes3bppTile[] convertedTiles = indexedTiles.ConvertAllTo<Snes3bppTile>();

    return convertedTiles.AsBytes();
}

Convert ROM data

  1. Use one of the FromBytes extension methods available to the tile format types.
  2. Pass the span to GraphicsTile.ConvertAllTilesToIndexed.

Example usage

Get indexed tiles from ROM data

Example:

using Sheeter;
using Sheeter.Snes;

public static GraphicsTile[] Read4bpp(byte[] rom, int offset, int tileCount) {
    ReadOnlySpan<Snes4bppTile> tiles = Snes4bppTile.CreateSpanFromBytes(rom, offset, tileCount);

    return GraphicsTile.ConvertAllTiles<Snes4bppTile>(tiles);
}

Notes

  • Packed1bppTile implicitly works for NES, SNES, and several other interleaved formats.
  • Gameboy and Gameboy Color use Snes2bppTile.
  • PC Engine uses Snes4bppTile.

References

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
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 80 11/12/2026