Lofty.Core
1.0.0
dotnet add package Lofty.Core --version 1.0.0
NuGet\Install-Package Lofty.Core -Version 1.0.0
<PackageReference Include="Lofty.Core" Version="1.0.0" />
<PackageVersion Include="Lofty.Core" Version="1.0.0" />
<PackageReference Include="Lofty.Core" />
paket add Lofty.Core --version 1.0.0
#r "nuget: Lofty.Core, 1.0.0"
#:package Lofty.Core@1.0.0
#addin nuget:?package=Lofty.Core&version=1.0.0
#tool nuget:?package=Lofty.Core&version=1.0.0
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, andSimpleButton. - Vector drawing through
Graphicsusing fills, strokes, paths, rectangles, rounded rectangles, circles, ellipses, quadratic curves, and cubic curves. - SkiaSharp rendering via
SkiaStageViewHost, which connects aStageto a MAUISKCanvasView. - 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, andVector3D. - Platform MIDI service abstraction through
IMidiService.
Target Platforms
The project currently targets:
net10.0-androidnet10.0-ioson non-Linux hostsnet10.0-maccatalyston non-Linux hostsnet10.0-windows10.0.19041.0on 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.ControlsSkiaSharp.Views.Maui.Controlsmanaged-midiRtMidi.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.
AllowUnsafeBlocksis 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 | Versions 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. |
-
net10.0-android36.0
- managed-midi (>= 1.10.1)
- Microsoft.Maui.Controls (>= 10.0.20)
- RtMidi.Core (>= 1.0.53)
- SkiaSharp.Views.Maui.Controls (>= 3.119.4)
-
net10.0-ios26.0
- managed-midi (>= 1.10.1)
- Microsoft.Maui.Controls (>= 10.0.20)
- RtMidi.Core (>= 1.0.53)
- SkiaSharp.Views.Maui.Controls (>= 3.119.4)
-
net10.0-maccatalyst26.0
- managed-midi (>= 1.10.1)
- Microsoft.Maui.Controls (>= 10.0.20)
- RtMidi.Core (>= 1.0.53)
- SkiaSharp.Views.Maui.Controls (>= 3.119.4)
-
net10.0-windows10.0.19041
- managed-midi (>= 1.10.1)
- Microsoft.Maui.Controls (>= 10.0.20)
- RtMidi.Core (>= 1.0.53)
- SkiaSharp.Views.Maui.Controls (>= 3.119.4)
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 |