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" />
                    
Directory.Packages.props
<PackageReference Include="Mtf.Maui.Drawing" />
                    
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 Mtf.Maui.Drawing --version 1.0.3
                    
#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
                    
Install as a Cake Addin
#tool nuget:?package=Mtf.Maui.Drawing&version=1.0.3
                    
Install as a Cake Tool

Í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:

  1. Create domain model in Mtf.Drawing.Render
  2. Add extension in Mtf.Maui.Drawing
  3. Implement Draw(this ICanvas ...)

Example pattern:

public static class MyPrimitiveExtensions
{
    public static void Draw(this MyPrimitive primitive, ICanvas canvas, Color color)
    {
        ...
    }
}

🧠 Notes

  • Colors.Transparent is 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 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.3 88 6/6/2026