You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: claude.md
+7-2Lines changed: 7 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,12 @@ The conversion pipeline is **Parse → Render**:
30
30
31
31
1.**Parsing** (`src/Morph/Parsing/`): `DocumentParser` reads OOXML via DocumentFormat.OpenXml and builds a `ParsedDocument` containing a tree of `DocumentElement` types (defined in `DocumentElements.cs`). Sub-parsers handle shapes, ink, themes, and HTML (AltChunk).
32
32
33
-
2.**Rendering** (`src/Morph/Rendering/`): `PageRenderer` lays out elements into pages and draws them using SkiaSharp. `TextRenderer` handles typography. `RenderContext` holds rendering state (DPI, page settings, compatibility mode).
33
+
2.**Rendering** — two interchangeable backends behind an abstract `DocumentConverter` base class:
Each backend has its own `PageRenderer`, `TextRenderer`, and `RenderContext`.
34
39
35
40
## Code Style
36
41
@@ -46,7 +51,7 @@ The conversion pipeline is **Parse → Render**:
46
51
## Testing
47
52
48
53
-**Framework:** TUnit (not xUnit/NUnit) with `[Test]` and `[MethodDataSource]` attributes
49
-
-**Scenario tests** (`ScenarioTests.cs`, DEBUG-only): parameterized over 2000+ directories in `src/Tests/Inputs/`, each containing `input.docx` and `expected_*.png` reference images. Uses Verify + ImageMagick for pixel-level comparison
54
+
-**Scenario tests** (`SkiaScenarioTests.cs` / `ImageSharpScenarioTests.cs`, DEBUG-only): parameterized over 2000+ directories in `src/Tests/Inputs/`, each containing `input.docx` and `expected_*.png` reference images. Uses Verify + ImageMagick for pixel-level comparison. Both backends are tested independently
50
55
-**Spec tests** (`src/Tests/SpecTests/`): unit tests for specific OOXML specification features
51
56
-**RenderHelper** (`src/RenderHelper/`): .NET Framework 4.8.1 project that generates reference images using Microsoft Word via COM interop (Windows-only, not part of normal test runs)
Morph supports two rendering backends. Choose the one that best fits your needs:
110
+
111
+
| Backend | Package | Pros |
112
+
|---------|---------|------|
113
+
|**SkiaSharp**|`Morph.Skia`| Mature, includes SVG support |
114
+
|**ImageSharp**|`Morph.ImageSharp`| Fully managed (no native dependencies) |
115
+
116
+
Both backends expose the same API via `WordRender.Skia.DocumentConverter` and `WordRender.ImageSharp.DocumentConverter`.
117
+
118
+
96
119
## Usage
97
120
121
+
The examples below use the SkiaSharp backend. To use ImageSharp instead, replace `WordRender.Skia.DocumentConverter` with `WordRender.ImageSharp.DocumentConverter`.
0 commit comments