Fix image masking and smoothing

Image masking with MultiEffect was not applying antialiasing at the edges
with the default settings.
The mipmap setting was ignored if the image source was changed (e.g. on
HeaderBar).  Added a hack to reset this AFTER the image has changed.
This commit is contained in:
Bart De Vries 2023-12-18 22:26:49 +01:00
parent eb74c913a9
commit ae3cdc207a
2 changed files with 11 additions and 1 deletions

View File

@ -166,7 +166,7 @@ Controls.ItemDelegate {
imageSource: feed.cachedImage
imageTitle: feed.name
isLoading: feed.refreshing
absoluteRadius: Kirigami.Units.smallSpacing + borderWidth
absoluteRadius: Kirigami.Units.smallSpacing - borderWidth
}
Rectangle {

View File

@ -26,6 +26,14 @@ Item {
property bool imageResize: true
property bool mipmap: false
// HACK: if mipmap has been set to true, then reset it AFTER image has
// changed, otherwise it will be ignored
onImageSourceChanged: {
if (root.mipmap) {
root.mipmap = true;
}
}
Loader {
id: imageLoader
anchors.fill: parent
@ -38,6 +46,8 @@ Item {
source: imageLoader.item
opacity: root.imageOpacity
maskEnabled: true
maskThresholdMin: 0.5
maskSpreadAtMin: 0.5
maskSource: ShaderEffectSource {
width: imageLoader.width
height: imageLoader.height