Artifacts when using BitmapCacheBrush
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
### Description
Using [BitmapCacheBrush](https://learn.microsoft.com/en-us/dotnet/api/system.windows.media.bitmapcachebrush?view=windowsdesktop-8.0) you can _singificantly_ improve rendering performance of complex shapes. However, for some shapes, you get undesired artifacts. Please see attached [sample project](https://github.com/dotnet/wpf/files/15456096/WpfBitmapCacheBrushBug.zip).
It seems pixels leak from the edges.

With some experience from the OpenGL world, I'd guess this has something to do with texture repeat mode. For our use case, we certainly don't want the brush to repeat. All in all, this looks like a `WPF` rendering bug.
### Reproduction Steps
See attached sample project. Run it, and observe the artifacts.
[WpfBitmapCacheBrushBug.zip](https://github.com/dotnet/wpf/files/15456096/WpfBitmapCacheBrushBug.zip)
### Expected behavior
Rendering a shape using `BitmapCacheBrush` should not cause pixels to leak to the other side of the image.
### Actual behavior
`BitmapCacheBrush` causes visual artifacts.
### Regression?
_No response_
### Known Workarounds
_No response_
### Impact
The `BitmapCacheBrush` is a powerful feature which allows you to cache and quickly render e.g. complex vector images. We successfully integrated it with our heavy Enterprise desktop app, allowing for unprecedented rendering performance in our data grid.
Having these visual artifacts is a bit of a bummer. There is no other way to get the same rendering performance for our vector images.
### Configuration
* Windows 10 22H2
* .NET 6 (same behavior on .NET 8)
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.