rendering-with-drawingcontext
Installation
SKILL.md
WPF DrawingContext High-Performance Rendering
A pattern for achieving 10-50x performance improvement over Shape objects when rendering large numbers of shapes in WPF using DrawingContext.
1. Core Concepts
Shape vs DrawingContext Approach
| Item | Shape (Polygon, Rectangle, etc.) | DrawingContext |
|---|---|---|
| Inheritance | Canvas | FrameworkElement |
| Visual count | One per shape (n) | 1 |
| Layout calculation | O(n) Measure/Arrange | O(1) |
| Memory usage | Very high (WPF object overhead) | Very low (data only) |
| Performance | Baseline | 10-50x faster |
| Suitable for | Few interactive shapes (tens to hundreds) | Large static shapes (thousands to tens of thousands) |