Lofty.Core 1.0.0

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

Lofty Core

Lofty Core is a .NET MAUI graphics and input library inspired by the ActionScript 3 display API. It gives MAUI apps a SkiaSharp-backed display list with familiar stage, sprite, shape, bitmap, text, event, geometry, and MIDI building blocks.

The library targets .NET 10 MAUI platforms and is designed for interactive rendered experiences that need a Flash/AS3-style scene model on top of Skia.

Features

  • AS3-style display list with Stage, DisplayObject, DisplayObjectContainer, Sprite, Shape, Bitmap, BitmapData, MovieClip, and SimpleButton.
  • Vector drawing through Graphics using fills, strokes, paths, rectangles, rounded rectangles, circles, ellipses, quadratic curves, and cubic curves.
  • SkiaSharp rendering via SkiaStageViewHost, which connects a Stage to a MAUI SKCanvasView.
  • Stage scaling modes: resize-to-view, show-all, no-border, exact-fit, and no-scale.
  • Mouse, touch, gesture, keyboard, focus, resize, render, and enter-frame events with capture and bubbling phases.
  • Dirty-region rendering support for reducing redraw work.
  • Text rendering and input support through TextField, including selection, caret, clipboard hooks, password display, wrapping, and alignment.
  • Layout helpers with UIContainer, horizontal/vertical/dock layout modes, padding, gaps, margins, percent sizing, and min/max sizing.
  • Drag, wheel, inertia, and snap scrolling through ScrollContainer.
  • Geometry types for common AS3 workflows: Point, Rectangle, Matrix, and Vector3D.
  • Platform MIDI service abstraction through IMidiService.

Target Platforms

The project currently targets:

  • net10.0-android
  • net10.0-ios on non-Linux hosts
  • net10.0-maccatalyst on non-Linux hosts
  • net10.0-windows10.0.19041.0 on Windows hosts

Minimum platform versions are configured in Lofty.Core.csproj:

  • Android 21.0
  • iOS 15.0
  • Mac Catalyst 15.0
  • Windows 10.0.17763.0

Requirements

  • .NET 10 SDK
  • .NET MAUI workloads for the platforms you want to build
  • SkiaSharp MAUI support, pulled in by the project package references

Core package references:

  • Microsoft.Maui.Controls
  • SkiaSharp.Views.Maui.Controls
  • managed-midi
  • RtMidi.Core

Building

From the repository root:

dotnet workload restore
dotnet build .\Lofty.Core.slnx -c Release

During day-to-day development on Windows, you can target the Windows framework directly:

dotnet build .\Lofty.Core\Lofty.Core.csproj -c Release -f net10.0-windows10.0.19041.0

The project has GeneratePackageOnBuild enabled, so Release builds also produce a NuGet package under the project bin output.

Using The Library

Reference the project from a MAUI app:

<ItemGroup>
  <ProjectReference Include="..\Lofty.Core\Lofty.Core.csproj" />
</ItemGroup>

Create a stage, attach it to an SKCanvasView, and add display objects:

using Lofty.Core.Display;
using Lofty.Core.Events;
using Microsoft.Maui.Controls;
using SkiaSharp;
using SkiaSharp.Views.Maui.Controls;

public partial class MainPage : ContentPage
{
    private readonly Stage _stage;
    private readonly SkiaStageViewHost _host;

    public MainPage()
    {
        InitializeComponent();

        var canvas = new SKCanvasView();
        Content = canvas;

        _stage = new Stage(800, 480)
        {
            BackgroundColor = SKColors.Black
        };

        var button = new Sprite
        {
            X = 100,
            Y = 100,
            ButtonMode = true,
            UseHandCursor = true
        };

        button.Graphics.BeginFill(0x2B8CFF);
        button.Graphics.DrawRoundRect(0, 0, 180, 80, 12, 12);
        button.Graphics.EndFill();

        button.AddEventListener(EventTypes.Click, _ =>
        {
            button.Rotation += 15;
        });

        _stage.AddChild(button);

        _host = new SkiaStageViewHost(canvas, _stage)
        {
            ScaleMode = StageScaleMode.ShowAll,
            TargetFps = 60
        };
    }

    protected override void OnDisappearing()
    {
        _host.Dispose();
        _stage.Dispose();
        base.OnDisappearing();
    }
}

Drawing

Shape and Sprite expose a Graphics instance:

var shape = new Shape
{
    X = 40,
    Y = 40
};

shape.Graphics.LineStyle(2, 0xFFFFFF);
shape.Graphics.BeginFill(0xFFCC00);
shape.Graphics.DrawCircle(50, 50, 40);
shape.Graphics.EndFill();

stage.AddChild(shape);

Events

Display objects inherit from EventDispatcher. For display-list objects, events can capture, target, and bubble through the parent chain.

shape.AddEventListener(EventTypes.MouseDown, e =>
{
    e.StopPropagation();
});

stage.AddEventListener(
    EventTypes.Click,
    e => Console.WriteLine($"Clicked {e.Target}"),
    useCapture: true,
    priority: 10);

Common event groups include:

  • Display lifecycle: added, removed, addedToStage, removedFromStage
  • Frame/rendering: enterFrame, render, resize, invalidate
  • Mouse: mouseDown, mouseMove, mouseUp, mouseWheel, click, doubleClick
  • Touch: touchBegin, touchMove, touchEnd, touchTap, touchCancel
  • Gestures: gesturePan, gestureZoom, gestureRotate, gestureSwipe
  • Keyboard and focus: keyDown, keyUp, focusIn, focusOut

Text Input

TextField supports dynamic text and editable input:

var input = new TextField
{
    Type = TextFieldType.Input,
    Width = 280,
    Height = 48,
    Background = true,
    Border = true,
    FontSize = 18,
    Text = "Edit me"
};

input.AddEventListener(EventTypes.Change, _ =>
{
    Console.WriteLine(input.Text);
});

stage.AddChild(input);

For platform clipboard integration, assign ClipboardRead and ClipboardWrite.

MIDI

Register the MIDI service in your MAUI app builder:

using Lofty.Core.Services;

builder.Services.AddMidi();

Consume IMidiService from dependency injection:

using Lofty.Core.Media;

public sealed class MidiMonitor
{
    private readonly IMidiService _midi;

    public MidiMonitor(IMidiService midi)
    {
        _midi = midi;
        _midi.DeviceConnected += device => Console.WriteLine($"MIDI connected: {device.Name}");
        _midi.NoteOn += note => Console.WriteLine($"Note on: {note.Note} velocity {note.Velocity}");
    }

    public void Start() => _midi.Start();

    public void Stop() => _midi.Stop();
}

Current MIDI implementation status:

  • Windows uses RtMidi.
  • Android uses Android.Media.Midi.
  • iOS uses CoreMIDI.
  • Mac Catalyst currently contains a placeholder implementation.

Project Layout

Lofty.Core/
  Display/      Stage, display objects, graphics, text, layout, scrolling, Skia host
  Events/       Event model, event types, input, mouse, touch, gesture, keyboard, focus
  Geom/         Point, Rectangle, Matrix, Vector3D
  Media/        MIDI models and service abstraction
  Platforms/   Platform-specific MIDI service implementations
  Services/    MAUI service registration extensions

Notes

  • This repository currently contains the library project only. There is no test project yet.
  • AllowUnsafeBlocks is enabled for the Windows MIDI callback path.
  • The project package metadata is configured in Lofty.Core.csproj.
  • No license file is currently included in the repository.
Product Compatible and additional computed target framework versions.
.NET net10.0-android36.0 is compatible.  net10.0-ios26.0 is compatible.  net10.0-maccatalyst26.0 is compatible.  net10.0-windows10.0.19041 is compatible. 
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.0 76 5/31/2026