Mtf.Maui.Drawing
1.0.3
dotnet add package Mtf.Maui.Drawing --version 1.0.3
NuGet\Install-Package Mtf.Maui.Drawing -Version 1.0.3
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="Mtf.Maui.Drawing" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mtf.Maui.Drawing" Version="1.0.3" />
<PackageReference Include="Mtf.Maui.Drawing" />
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 Mtf.Maui.Drawing --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Mtf.Maui.Drawing, 1.0.3"
#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 Mtf.Maui.Drawing@1.0.3
#: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=Mtf.Maui.Drawing&version=1.0.3
#tool nuget:?package=Mtf.Maui.Drawing&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Íme egy tiszta, használható README.md az extension library-hoz (MAUI rendering + primitive drawing kontextusban):
# Mtf.Maui.Drawing
MAUI extension library for rendering geometric primitives defined in `Mtf.Drawing.Render`.
This project provides **ICanvas-based drawing extensions** for MAUI Graphics, bridging domain-level primitives (Circle, Line, Rectangle, Text) with platform rendering.
---
## 🚀 Purpose
The goal of this library is to:
- Keep geometry/domain logic **UI-agnostic**
- Separate rendering concerns from models
- Provide clean MAUI `ICanvas` drawing extensions
- Avoid duplication of drawing logic across UI layers
---
## 📦 Supported primitives
- `CirclePrimitive`
- `LinePrimitive`
- `RectanglePrimitive`
- `TextPrimitive`
Each primitive lives in `Mtf.Drawing.Render` and is rendered via extension methods in this package.
---
## 🧱 Design principles
### 1. Separation of concerns
Geometry and rendering are separated:
- `Mtf.Drawing` → math + shapes + transformations
- `Mtf.Maui.Drawing` → MAUI rendering only
### 2. Stateless rendering
Extensions do not mutate primitives.
### 3. Minimal API surface
Each primitive exposes a single or minimal number of `Draw` overloads.
---
## 🎨 Usage
### Circle
```csharp
circle.Draw(canvas, Colors.Red);
With fill:
circle.Draw(canvas, Colors.Black, Colors.Yellow);
Rectangle
rectangle.Draw(canvas, Colors.Blue);
With fill:
rectangle.Draw(canvas, Colors.Black, Colors.LightGray);
Line
line.Draw(canvas, Colors.Green, 2f);
Text
text.Draw(canvas, Colors.White, 18f);
📐 Coordinate system
All primitives assume:
- Origin (0,0) is top-left
- Y axis increases downward (MAUI standard)
- Pixel-based coordinates
⚙️ Example in MAUI GraphicsView
public class MyDrawable : IDrawable
{
public CirclePrimitive Circle { get; set; }
public void Draw(ICanvas canvas, RectF dirtyRect)
{
Circle.Draw(canvas, Colors.Red, Colors.Transparent, 2f);
}
}
🔧 Extensibility
To add a new primitive:
- Create domain model in
Mtf.Drawing.Render - Add extension in
Mtf.Maui.Drawing - Implement
Draw(this ICanvas ...)
Example pattern:
public static class MyPrimitiveExtensions
{
public static void Draw(this MyPrimitive primitive, ICanvas canvas, Color color)
{
...
}
}
🧠 Notes
Colors.Transparentis used as "no fill" sentinel- Rotation is currently logical only (not rendered unless explicitly implemented)
- Thickness applies to stroke-based rendering only
📌 Dependencies
- .NET MAUI Graphics (
Microsoft.Maui.Graphics) Mtf.Drawing
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0-android36.0
- Microsoft.Maui.Controls (>= 10.0.70)
- Mtf.Drawing (>= 1.0.10)
-
net10.0-ios26.0
- Microsoft.Maui.Controls (>= 10.0.70)
- Mtf.Drawing (>= 1.0.10)
-
net10.0-maccatalyst26.0
- Microsoft.Maui.Controls (>= 10.0.70)
- Mtf.Drawing (>= 1.0.10)
-
net10.0-windows10.0.19041
- Microsoft.Maui.Controls (>= 10.0.70)
- Mtf.Drawing (>= 1.0.10)
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.3 | 88 | 6/6/2026 |