Apos.Shapes 0.8.1

dotnet add package Apos.Shapes --version 0.8.1
                    
NuGet\Install-Package Apos.Shapes -Version 0.8.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="Apos.Shapes" Version="0.8.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Apos.Shapes" Version="0.8.1" />
                    
Directory.Packages.props
<PackageReference Include="Apos.Shapes" />
                    
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 Apos.Shapes --version 0.8.1
                    
#r "nuget: Apos.Shapes, 0.8.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 Apos.Shapes@0.8.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=Apos.Shapes&version=0.8.1
                    
Install as a Cake Addin
#tool nuget:?package=Apos.Shapes&version=0.8.1
                    
Install as a Cake Tool

Apos.Shapes

Shape rendering library for MonoGame and KNI.

Discord NuGet NuGet

Description

This library draws crisp anti-aliased shapes on the GPU using SDFs. It also draws text straight from a font's outlines, SVG drawings straight from theirs, and textures with the SpriteBatch API. Shapes, text, drawings, and textures can be interleaved in any order. Everything renders together in a single batch that never needs to break.

Special thanks to Inigo Quilez for doing a lot of the work on the math functions. The text follows Eric Lengyel's Slug algorithm, by way of Forme.

Shapes drawn with Apos.Shapes

Features

  • 11 shapes: Circle, Ellipse, Line, Path, Rectangle, Chamfer, Hexagon, Equilateral Triangle, Triangle, Arc, Ring
  • Fill, Border, and Draw variants for every shape
  • Paths draw a polyline as one continuous shape, with round, miter, or bevel joins and round, butt, or square caps. Open or closed
  • Rounded or chamfered corners, one per corner, plus rotation and adjustable anti-aliasing
  • Dashed outlines and strokes, flat or round-capped, down to dotted lines
  • Gradients: linear, radial, conical, spiral, and more, with repeat styles and Oklab / Oklch / RGB color interpolation. Shapes, text, and SVG drawings all take one
  • Blurred shapes with a Gaussian edge, for drop shadows and glows
  • Measure for every shape, giving the bounds it covers so a camera can cull it. No batch and no view needed
  • Blue noise dithering so slow gradients don't band on 8-bit displays
  • Text solved from the font's own outlines in the shader. No atlas, so nothing picks a size up front and a glyph stays exact at any size, rotation, and zoom
  • SVG drawings solved the same way, fills and strokes, in the file's own colors and gradients or in one color of your own
  • Textures (SpriteBatch API)
  • Clipping to a rectangle
  • One batch for everything. Mixing shapes, text, drawings, and textures never breaks the batch
  • Precompiled shader embedded in the assembly using ShadowDusk. No need for Wine to build on Linux or macOS.
  • Works with MonoGame 3.8.2+ and KNI

Documentation

You can also try the library directly in your browser here.

Getting started

Install with:

dotnet add package Apos.Shapes

Set the HiDef profile in your game's constructor. (With KNI, use FL10_0 instead.) Create a ShapeBatch, then draw between Begin and End:

using Apos.Shapes;

public class Game1 : Game {
    GraphicsDeviceManager _graphics;
    ShapeBatch _sb;

    public Game1() {
        _graphics = new GraphicsDeviceManager(this);
        _graphics.GraphicsProfile = GraphicsProfile.HiDef;
    }

    protected override void LoadContent() {
        _sb = new ShapeBatch(GraphicsDevice);
    }

    protected override void Draw(GameTime gameTime) {
        GraphicsDevice.Clear(new Color(17, 24, 39));

        _sb.Begin();
        _sb.FillCircle(new Vector2(120, 120), 75, new Color(96, 165, 250));
        _sb.DrawRectangle(new Vector2(240, 70), new Vector2(150, 100), new Color(220, 38, 38), Color.White, 4f, 20f);
        _sb.BorderLine(new Vector2(120, 240), new Vector2(390, 240), 15, Color.White, 2f);
        _sb.End();

        base.Draw(gameTime);
    }
}

Read the Getting started guide for the full walkthrough.

Other projects you might like

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Apos.Shapes:

Package Downloads
Apos.Gui

UI library for MonoGame.

Gum.Shapes.MonoGame

Package Description

FlatRedBall2.MonoGame

A modern, lightweight 2D game engine built on MonoGame and KNI.

GitHub repositories (4)

Showing the top 4 popular GitHub repositories that depend on Apos.Shapes:

Repository Stars
vchelaru/Gum
Flexible layout tool for creating UI on any platform
Apostolique/Apos.Gui
UI library for MonoGame.
itsBuggingMe/Frent
A high performance component oriented take on ECS that supports sparse sets and archetypes seamlessly.
Apostolique/Mitten
Infinite canvas drawing application.
Version Downloads Last Updated
0.8.1 50 8/2/2026
0.8.0 36 8/2/2026
0.7.14 38 8/1/2026
0.7.13 37 8/1/2026
0.7.12 84 7/28/2026
0.7.11 102 7/27/2026
0.7.10 92 7/25/2026
0.7.9 87 7/25/2026
0.7.8 1,560 7/24/2026
0.7.7 187 7/23/2026
0.7.6 95 7/22/2026
0.7.5 84 7/22/2026
0.7.4 109 7/19/2026
0.7.3 96 7/19/2026
0.7.2 97 7/18/2026
0.7.1 93 7/18/2026
0.7.0-alpha 96 7/13/2026
0.6.10-alpha 3,233 5/17/2026
0.6.9-alpha 6,018 5/12/2026
0.6.8 2,153 3/1/2026
Loading failed