PlaylistView: support alpha channel in background images

This commit is contained in:
Ty
2025-07-03 21:23:11 -07:00
committed by Jonas Kvinge
parent 1ebc32c3aa
commit 20e5c014ef

View File

@@ -1468,10 +1468,10 @@ void PlaylistView::set_background_image(const QImage &image) {
}
if (!background_image_.isNull()) {
// Apply opacity filter
// Apply opacity filter: scale (not overwrite!) the alpha channel
uchar *bits = background_image_.bits();
for (int i = 0; i < background_image_.height() * background_image_.bytesPerLine(); i += 4) {
bits[i + 3] = static_cast<uchar>((opacity_level_ / 100.0) * 255);
bits[i + 3] = static_cast<uchar>(bits[i + 3] * (opacity_level_ / 100.0));
}
if (blur_radius_ != 0) {