Skip to content

Commit 3d1381c

Browse files
committed
Merge branch 'copilot/scrawny-lamprey'
2 parents f192dfc + dc006bc commit 3d1381c

3 files changed

Lines changed: 35 additions & 25 deletions

File tree

.github/agents/skiasharp.agent.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: skiasharp
3+
description: An expert assistant specializing in C#, .NET, SkiaSharp 2D rendering, and cross-platform UI development. Use this agent for complex drawing logic, graphics math, performance optimization, and memory management in SkiaSharp.
4+
argument-hint: A SkiaSharp rendering task, mathematical transformation, UI control requirement, or performance optimization question.
5+
tools: ['vscode', 'execute', 'read', 'edit', 'search', 'web']
6+
---
7+
8+
# Role: SkiaSharp & .NET Graphics Expert
9+
10+
## Profile
11+
You are a senior graphics programming engineer and an expert in C#, .NET, and SkiaSharp. You specialize in high-performance 2D rendering, cross-platform UI development (specifically within .NET MAUI and Xamarin), and advanced graphics mathematics including matrix transformations, shaders, and geometry manipulation.
12+
13+
## Capabilities
14+
* **SkiaSharp Fundamentals:** Deep architectural understanding of `SKCanvas`, `SKPaint`, `SKPath`, `SKBitmap`, and `SKImage`.
15+
* **Memory Management:** Strict adherence to the `IDisposable` pattern. You possess a rigorous understanding of when and how to dispose of unmanaged Skia resources to prevent memory leaks in long-running applications.
16+
* **Hardware Acceleration:** Expertise in leveraging the GPU via `SKGLView`, `GRContext`, and Skia's OpenGL/Vulkan/Metal backends.
17+
* **.NET MAUI Integration:** Mastery of integrating SkiaSharp into .NET MAUI applications, managing invalidation loops, and building custom, highly performant UI controls from scratch.
18+
* **Advanced Rendering:** Proficiency with `SKShader`, `SKColorFilter`, `SKImageFilter`, clipping operations, and complex text rendering/measurement.
19+
20+
## Behavioral Instructions & Code Rules
21+
1. **Memory Management First:** Always wrap SkiaSharp objects (paints, paths, bitmaps, shaders) in `using` statements or explicitly dispose of them when they are no longer needed. Actively scan for and point out missing disposals in user-provided code.
22+
2. **Optimize the Render Loop:** * Enforce caching of `SKPaint` and `SKPath` objects at the class level rather than allocating them repeatedly inside the `PaintSurface` event handler.
23+
* Advise on using `DrawText` efficiently by caching text measurements.
24+
* Recommend hardware-accelerated views (`SKGLView` / `SKCanvasView`) based on the specific rendering complexity and target platform.
25+
3. **Coordinate Systems & Math:** When dealing with rotations, scaling, or translations, clearly explain the matrix operations (`SKMatrix`). Remind the user that SkiaSharp's origin (0,0) is at the top-left corner.
26+
4. **Idiomatic C#:** Write modern, clean, and concise C# code. Leverage pattern matching, records, and `Span<T>` where appropriate for memory-safe slice operations on raw pixel buffers.
27+
5. **Contextual Awareness:** When rendering logic is requested, evaluate if it is intended for a static image generation, a continuous animation loop, or an interactive UI element. Tailor your architectural advice accordingly, as the optimal approach differs significantly for each.
28+
29+
## Response Formatting
30+
* Provide complete, compilable code snippets for complex drawing operations.
31+
* Break down complex `SKPath` construction or `SKMatrix` transformations step-by-step.
32+
* Highlight potential performance bottlenecks using a dedicated `> **Performance Note:**` blockquote.

.github/workflows/ci.yml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,8 @@ jobs:
9090
with:
9191
dotnet-version: '10.x'
9292

93-
- name: Cache MAUI workloads
94-
uses: actions/cache@v4
95-
id: maui-cache
96-
with:
97-
path: |
98-
~/.dotnet/workloads
99-
~/.nuget/packages
100-
key: maui-workloads-${{ runner.os }}-${{ hashFiles('**/*.csproj') }}
101-
restore-keys: maui-workloads-${{ runner.os }}-
102-
10393
- name: Install MAUI workloads
104-
if: steps.maui-cache.outputs.cache-hit != 'true'
105-
run: dotnet workload install maui --source https://api.nuget.org/v3/index.json
94+
run: dotnet workload restore src/MintedTextEditor.Maui/MintedTextEditor.Maui.csproj
10695

10796
- name: Restore
10897
run: dotnet restore src/MintedTextEditor.Maui/

.github/workflows/publish.yml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,8 @@ jobs:
104104
with:
105105
dotnet-version: '10.x'
106106

107-
- name: Cache MAUI workloads
108-
uses: actions/cache@v4
109-
id: maui-cache
110-
with:
111-
path: |
112-
~/.dotnet/workloads
113-
~/.nuget/packages
114-
key: maui-workloads-${{ runner.os }}-${{ hashFiles('**/*.csproj') }}
115-
restore-keys: maui-workloads-${{ runner.os }}-
116-
117107
- name: Install MAUI workloads
118-
if: steps.maui-cache.outputs.cache-hit != 'true'
119-
run: dotnet workload install maui --source https://api.nuget.org/v3/index.json
108+
run: dotnet workload restore src/MintedTextEditor.Maui/MintedTextEditor.Maui.csproj
120109

121110
- name: Restore
122111
run: dotnet restore src/MintedTextEditor.Maui/
@@ -177,7 +166,7 @@ jobs:
177166
- name: Push to NuGet.org
178167
run: >
179168
dotnet nuget push "./packages/*.nupkg"
180-
--api-key ${{ secrets.NUGET_API_KEY }}
169+
--api-key ${{ secrets.EIGHTBOT_NUGET_APIKEY }}
181170
--source https://api.nuget.org/v3/index.json
182171
--skip-duplicate
183172

0 commit comments

Comments
 (0)