Skip to content

Preserve transparency in inline Kitty images - #120

Merged
HarryCordewener merged 1 commit into
mainfrom
fix/inline-kitty-alpha
Nov 9, 2026
Merged

HarryCordewener merged 1 commit into
mainfrom
fix/inline-kitty-alpha

Conversation

@HarryCordewener

@HarryCordewener HarryCordewener commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Why

Kitty supports alpha blending, but inline game images lost it before reaching the terminal: SharpConsoleUI's PixelBuffer drops alpha, and InlineImageHost then sent RGB24. Transparent and translucent regions therefore became opaque. Avalonia's existing encoded-PNG renderer already composites alpha correctly.

Changes

  • Retain straight RGBA source pixels in the inline image cache rather than RGB-only PixelBuffer.
  • Resize with premultiplied-alpha interpolation to avoid hidden colors bleeding around transparent edges.
  • Send RGBA PNG through the existing Kitty TransmitImage API instead of RGB24.
  • Keep the RGB pixel-buffer conversion for half-block/Sixel fallback consumers.
  • Keep the existing restricted WebP-only ImageSharp decoder; TIFF remains rejected.

Verification

  • Full Release solution build succeeds.
  • Core, Client, Graphics, Scripting, Web and TUI suites pass.
  • New end-to-end Avalonia tests load a PNG through InlineImageHost and the Kitty driver, render placeholder cells, and check actual composited pixels for alpha 0, 128 and 255.
  • Transparent resize-edge test passes; PNG/WebP RGBA parity and malformed/TIFF rejection tests pass.
  • Full Avalonia suite passes: 902 tests. Final targeted PictureRenderingTests pass: 12 tests. TUI final suite: 3017 tests.

Scope: inline game/MXP images. This does not add raw Kitty APC parsing or change the browser/web-view ImageControl path, and it does not promise alpha blending in Sixel/half-block fallback. No desktop visual session, merge or deployment performed.

Kitty protocol reference: https://sw.kovidgoyal.net/kitty/graphics-protocol/

@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@HarryCordewener
HarryCordewener marked this pull request as ready for review November 9, 2026 00:10
@HarryCordewener
HarryCordewener merged commit 910d135 into main Nov 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant