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
Extends the image-diff dispatch from #9 to Windows icon files. WPF's
`BitmapDecoder.Create` already routes ICO bytes to the built-in
`IconBitmapDecoder`, so most of the lift is detection + frame
selection:
- `ImageFormat` enum: add `Ico`.
- `ImageFormatDetector.DetectByExtension`: `.ico` ->
`ImageFormat.Ico`.
- `ImageFormatDetector.Detect`: 4-byte magic `00 00 01 00` (icon
type). CUR files (`00 00 02 00`) intentionally don't match; the
`.cur` extension also stays unsupported.
- `WpfImageDecoder`: ICOs embed the same icon at multiple
resolutions (16x16, 32x32, 48x48, 256x256). `Frames[0]` is
typically the smallest and looks blurry fit-to-canvas, so the
decoder now picks the largest frame by pixel area for ICO
(tiebreak on bit depth so a 32bpp frame wins over a 4bpp frame at
the same size). PNG / JPEG / BMP / GIF all keep `Frames[0]`.
- Tests: extension + magic-byte detection, CUR-shaped header
correctly rejected, single-frame ICO round-trip, multi-resolution
ICO with three frames (16/48/32) verifies that the 48x48 frame is
picked regardless of frame order. Synthesises ICOs by hand
(ICONDIR + ICONDIRENTRY + PNG payloads) since WPF ships no
`IconBitmapEncoder`.
- CHANGELOG `[Unreleased]` + README features bullet: list ICO
alongside PNG/JPEG/GIF/BMP and note the largest-resolution pick.
Verification: `dotnet build -c Release` -> 0 warnings;
`dotnet test` -> 1161 passed, 1 skipped.
Out of scope: `.cur` (cursor) support, multi-resolution selector
UI to let the user compare specific embedded sizes.
Closes#16
AI-Local-Session: bd41845c-9c2c-4d85-9096-da614c7d2662
AI-Cloud-Session: 6c878301-7f09-4cfd-80b6-5e34c328c217
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments