AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.46k stars 2.21k forks source link

WriteableBitmap with AlphaFormat.Opaque rendered with artifacts in some cases #13416

Open HermanKirshin opened 11 months ago

HermanKirshin commented 11 months ago

Describe the bug

Rendering WriteableBitmap with AlphaFormat.Opaque results in transparent window area where bitmap is located when you are connected to desktop remotely via some protocols.

To Reproduce

  1. create WriteableBitmap with AlphaFormat.Opaque
  2. Draw it using using drawingContext.DrawImage in Render override
  3. Connect to desktop session remotely via for example Nice DCV or VcxSrv
  4. See transparent area where bitmap is rendered like on screenshot. Even if there are some non-transparent controls under it.

It is rendered correctly on desktop directly, without remote protocols.

Expected behavior

Bitmaps are rendered the same regardless remote connection or not.

Screenshots

Screenshot 2023-10-27 at 21 21 17

Environment

Additional context

AlphaFormat.Premul works without such issues. As long as it is default, this issue should not be encountered often, but it should be kept in mind not to use AlphaFormat.Opaque to avoid stepping on the same rake.

timunie commented 11 months ago

a sample image to reproduce would be helpful

HermanKirshin commented 11 months ago

Image content does not matter. Easiest way is with empty bitmap, just ctor new WriteableBitmap(new PixelSize(200, 200), new Vector(96.0, 96.0), PixelFormat.Bgra8888, AlphaFormat.Opaque)

timunie commented 11 months ago

thx.