Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
fb6c0c7
docs: add plan 4 (Avalonia desktop viewer)
IOL0ol1 Nov 18, 2026
6da0714
feat: add the viewer's core (viewport, tile grid, cache, loader) and …
IOL0ol1 Nov 18, 2026
78e86a8
fix: keep the tile loader running when a callback throws
IOL0ol1 Nov 18, 2026
1904982
feat: let a tile hand its pixel buffer over once, so buffers can be p…
IOL0ol1 Nov 18, 2026
557c4a4
feat: add the SlideView control with tiled rendering, pan, zoom and s…
IOL0ol1 Nov 18, 2026
cdf597a
feat: show coarse tiles first and keep failure and drag state in Slid…
IOL0ol1 Nov 18, 2026
3bf31b6
feat: add the viewer window with navigator, properties, associated im…
IOL0ol1 Nov 18, 2026
a0821ea
feat: let --check print to the console the viewer is started from on …
IOL0ol1 Nov 18, 2026
2dae162
ci: publish the viewer self-contained and check it on every platform
IOL0ol1 Nov 18, 2026
a3c3ab9
docs: document the desktop viewer, its --check mode and its self-cont…
IOL0ol1 Nov 18, 2026
faa87d9
fix: switch and close slides without waiting for the reads in flight
IOL0ol1 Nov 18, 2026
9cb9750
fix: keep the tiles a frame needs within half the cache so loading al…
IOL0ol1 Nov 18, 2026
4ae1e10
fix: report every failure of the window's handlers, and show the open…
IOL0ol1 Nov 18, 2026
da4006e
fix: read associated images off the UI thread and show each in one wi…
IOL0ol1 Nov 18, 2026
ccaa1e3
fix: use Cmd for Open and Close on macOS
IOL0ol1 Nov 18, 2026
b8e0cfb
docs: say "temporary directory" in two plan steps
IOL0ol1 Nov 18, 2026
dc40bfd
build: publish the viewer with a licenses folder next to the executable
IOL0ol1 Nov 18, 2026
d1b7ee7
refactor: name the per-level drawing of SlideView DrawLevel
IOL0ol1 Nov 18, 2026
4bfc6e8
docs: shorten the viewer's READMEs and describe its licenses folder
IOL0ol1 Nov 18, 2026
a2a9b87
docs: record plan 4 carry-over items and mark plan 4 done
IOL0ol1 Nov 18, 2026
52f082f
test: assert that a cancelled export stops early instead of a fixed w…
IOL0ol1 Nov 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
<PackageVersion Include="SkiaSharp" Version="3.119.4" />
<PackageVersion Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="3.119.4" />
<PackageVersion Include="System.CommandLine" Version="3.0.0" />
<!-- The desktop viewer sample (samples/OpenSlideSharp.Viewer). Keep every Avalonia package on the same version. -->
<PackageVersion Include="Avalonia" Version="12.1.6" />
<PackageVersion Include="Avalonia.Desktop" Version="12.1.6" />
<PackageVersion Include="Avalonia.Themes.Fluent" Version="12.1.6" />
<PackageVersion Include="Avalonia.Fonts.Inter" Version="12.1.6" />
<!-- Test-only: the viewer's rendering tests. Not Avalonia.Headless.XUnit, which needs xunit.v3 3.x. -->
<PackageVersion Include="Avalonia.Headless" Version="12.1.6" />
<PackageVersion Include="Avalonia.Skia" Version="12.1.6" />
<!-- Test-only. Keep at 8.0.5, the last MIT release: 9.x and later are under the OSMF EULA. -->
<PackageVersion Include="JsonSchema.Net" Version="8.0.5" />
<PackageVersion Include="xunit.v3" Version="4.0.3" />
Expand Down
2 changes: 2 additions & 0 deletions OpenSlideSharp.slnx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Solution>
<Folder Name="/samples/">
<Project Path="samples/OpenSlideSharp.Viewer/OpenSlideSharp.Viewer.csproj" />
<Project Path="samples/OpenSlideSharp.Web/OpenSlideSharp.Web.csproj" />
</Folder>
<Folder Name="/src/">
Expand All @@ -14,5 +15,6 @@
<Project Path="test/OpenSlideSharp.AspNetCore.Tests/OpenSlideSharp.AspNetCore.Tests.csproj" />
<Project Path="test/OpenSlideSharp.Web.Tests/OpenSlideSharp.Web.Tests.csproj" />
<Project Path="test/OpenSlideSharp.Tool.Tests/OpenSlideSharp.Tool.Tests.csproj" />
<Project Path="test/OpenSlideSharp.Viewer.Tests/OpenSlideSharp.Viewer.Tests.csproj" />
</Folder>
</Solution>
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,17 @@ dotnet run -c Release --project samples/OpenSlideSharp.Web -- /path/to/slide.svs

Then open <http://127.0.0.1:5000/>. Give an absolute path: under `dotnet run` the working directory is the project directory.

## Desktop viewer

[`samples/OpenSlideSharp.Viewer`](samples/OpenSlideSharp.Viewer/README.md) is an Avalonia viewer for Windows, Linux and macOS, like openslide-java's demo viewer. From a checkout:

```sh
pwsh eng/Get-OpenSlide.ps1
dotnet run -c Release --project samples/OpenSlideSharp.Viewer -- /path/to/slide.svs # or File → Open, or drop a file
```

Its README lists the shortcuts, the `--check` mode and the self-contained publish.

## Known issues

On Windows, corrupt JPEG or PNG data in a slide terminates the whole process with `0xC0000409`, and the failure cannot be caught. Services that open untrusted slides on Windows should decode them in a separate worker process. See [the details](docs/known-issues/windows-cfg-longjmp-crash.md).
Expand Down
57 changes: 57 additions & 0 deletions docs/notes/2026-11-18-plan4-carryover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# 计划 4 遗留事项(供计划 5 及以后使用)

来源:计划 4(Avalonia 桌面查看器)各任务审阅、整体终审及其修复轮。下列事项都已评估为**不阻塞计划 4 合并**。

## 计划 5(发布)之前必须处理

- **发布物形态。**
- 查看器的发布目录包含单文件可执行程序和 `licenses/`。`licenses/` 下有三部分:
- openslide-bin 的许可证与 `VERSIONS.md`;
- `THIRD-PARTY-NOTICES.txt`;
- `SOURCE.md`。
- 每个 RID(win-x64、linux-x64、osx-arm64)把整个目录打成一个 zip 或 tar.gz 附到 GitHub Release,不能只附可执行文件。
- **`THIRD-PARTY-NOTICES.txt` 中 MicroCom.Runtime 与 Tmds.DBus.Protocol 只写了 “MIT. Copyright …”。** 发布前补上 MIT 许可全文,或注明下方的 MIT 文本同样适用于这两项。
- **`SOURCE.md` 只给出了 openslide-bin 源码包的 URL 模式。** runtime 包没有记录确切的 openslide-bin 版本。计划 5 的发布流程要把版本写进 runtime 包(或发布目录),并在 `SOURCE.md` 中给出确切链接。
- **macOS:** 二进制没有签名和公证,Gatekeeper 会拦截。需要选择一种处理方式:
- 在 Release 说明里写明 `xattr -d com.apple.quarantine <文件>` 的绕过方法;
- 或者在 CI 中签名并公证,这需要维护者提供 Apple 开发者证书。
- **查看器 README 里的发布构建写的是 “planned”。** 发布流程上线后要更新这一段。

## 查看器(低优先级,可继续延后)

- **渲染与加载:**
- 层级选择没有滞回。可见瓦片数随平移对齐变化(c×r 与 (c+1)×(r+1)),在临界缩放区间平移时,层级会在 L 与 L+1 之间来回切换。可以改用与对齐无关的上界,或加入滞回。
- Bitmap 构造持续失败(例如持续 OOM)时,会无限地“读取 → 失败 → 移除 → 再读取”,没有退避。
- 单层、超过 16 Mi 像素、又没有 `thumbnail` 关联图像的切片没有底图,适配窗口时只显示中心附近的瓦片。
- 每次平移移动会触发两次 `ViewChanged`。
- **窗口:**
- 如果 `Show()` 在视图已经接受新切片之后才失败(极少见,例如 OOM),状态栏会报错,但视图已在显示新切片,标题和属性却还是旧的。
- 导航器拖动没有区分指针身份。
- 很长的错误文本会挤占状态栏其他段。
- 文件选择器只用了 `Patterns`,macOS 上没有 UTI 过滤。
- 选区列表每次变化都整体重建,选中状态会丢失。
- `--check` 在 Windows 上附加父控制台后,没有重新绑定 `Console.Error`。
- **视口:**
- `Resize(0,0)` 会重新钳制缩放,导致缩放状态丢失。
- 文档中 “永不为 NaN” 的说法过强:有限但极大的输入会让中心变成 ∞。
- **测试:**
- 没有测试锁定 “Bitmap 构造时会复制像素” 这一点(应在复制后改写缓冲区再断言)。
- `ConsumePixels` 的文档措辞不准确。
- RapidZoom 测试只比较数量。
- 打开失败的测试没有断言关联图像、导航器和选区保持不变。
- 窗口级的 “无 mpp” 路径只在 `StatusFormatter` 中有单元测试。

## 计划 4 中做出的裁定(摘要)

- **R1**:范围按规格 §6.7,只做矩形选区和单切片;不做自由手绘、椭圆选区和双切片联动。
- **R2**:Task 1 的三个后续问题(偶发失败的测试、回调异常保护、位图释放与缓冲池)并入 Task 2 处理。
- **R3**:按设备像素的 downsample 选择层级,以保证高 DPI 下清晰。
- **R4**:先请求粗层瓦片,实现“先显示低分辨率”;加载失败的标记按切片保存;拖动只跟随按下它的那个指针。
- **R5**:Windows 下 `--check` 附加父控制台输出。
- **R6**:目标层可见瓦片的字节数控制在缓存预算的一半以内,按离中心距离截断请求,并用导航缩略图作底图,保证加载一定能结束。
- **R7**:发布目录附带 `licenses/`。替换原生库的方式是设置 `OPENSLIDE_LIBRARY_PATH`。
- **R8**:切换或关闭切片时不阻塞 UI 线程,依赖核心库的 SafeHandle 租约保证安全。

## 已知问题(维护者决定只写文档)

Windows 上遇到损坏的 JPEG/PNG 会触发 CFG/longjmp 崩溃,查看器进程同样会被终止,详见 `docs/known-issues/windows-cfg-longjmp-crash.md`。
2 changes: 1 addition & 1 deletion docs/plans/2026-11-17-openslidesharp-v4-roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
| 1 | `2026-11-17-plan1-core-binding-runtime.md`(已完成) | 仓库重置、上游清单与下载脚本、ClangSharp 生成、核心 `OpenSlide` API、原生库加载、`OpenSlideSharp.runtime`(.NET + VS C++)、基础 CI(§5、§6.1 绑定部分、§6.2、§7.1、§8 前半) | — |
| 2 | `2026-11-17-plan2-rendering.md`(已完成) | `PixelImage` 合成与缩放、共享渲染流程、`OpenSlide.GetThumbnail`、`DeepZoomGenerator`、`IColorTransform`、`OmeZarrGenerator`、`OpenSlideSharp.SkiaSharp`(§6.1 其余、§6.3、§8 中 DeepZoom / Skia / OME-Zarr) | 1 |
| 3 | `2026-11-18-plan3-web-tool.md`(已完成) | `OpenSlideSharp.AspNetCore`、`samples/OpenSlideSharp.Web`、`OpenSlideSharp.Tool`(§6.4–§6.6) | 2 |
| 4 | plan4-viewer(待写) | `samples/OpenSlideSharp.Viewer`(Avalonia)(§6.7) | 2 |
| 4 | `2026-11-18-plan4-viewer.md`(已完成) | `samples/OpenSlideSharp.Viewer`(Avalonia)(§6.7) | 2 |
| 5 | plan5-release(待写) | 上游同步、版本号计算、发布、GitHub Release、README 重写、旧包弃用清单(§7.2、§7.3、§9) | 1–4 |

计划 3 与计划 4 互不依赖,可以并行。
2 changes: 1 addition & 1 deletion docs/plans/2026-11-18-plan3-web-tool.md
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ git add -A && git commit -m "feat: add the openslide-sharp tool with deepzoom an
Run: `pwsh eng/Get-OpenSlide.ps1 -Platform all; pwsh eng/Test-Packages.ps1`
Expected: `All package smoke tests passed.`

- [ ] **Step 2: 扩展 `verify-omezarr.py` 与 CI job,本机按 CI 步骤跑一遍 Python 校验**(venv 放在 scratchpad)
- [ ] **Step 2: 扩展 `verify-omezarr.py` 与 CI job,本机按 CI 步骤跑一遍 Python 校验**(venv 放在临时目录)
- [ ] **Step 3: 更新文档**
- [ ] **Step 4: 运行全部测试,提交**

Expand Down
Loading
Loading