Bug 399686 - Cannot use an IconItem as a source or maskSource for anything
Summary: Cannot use an IconItem as a source or maskSource for anything
Status: RESOLVED NOT A BUG
Alias: None
Product: libplasma
Classification: Frameworks and Libraries
Component: libplasmaquick (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Marco Martin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-12 00:06 UTC by Nate Graham
Modified: 2018-10-12 02:34 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2018-10-12 00:06:46 UTC
I'm trying to use a PlasmaCore.IconItem as the MaskSource for a MaskedBlur. Instead of the icon's visible alpha channel acting as a mask as desired, the whole thing appears opaque so there is no mask. The same happens more trivially using just `source:`

For example:

Image {
    id: imageFromIcon
    source: icon
    anchors.fill: icon
}
PlasmaCore.IconItem {
    id: icon
    visible: false
    icon.source: "preferences-desktop-color"
}

imageFromIcon will be invisible rather than a QML Image representation of the icon.

This is currently blocking the blur component of https://phabricator.kde.org/D16031
Comment 1 David Edmundson 2018-10-12 01:18:28 UTC
Relevant API to do it natively is
QSGTextureProvider *QQuickItem::textureProvider() const

Never done it before, but it doesn't seem too difficult. We generate QSGTextures elsewhere in that same code; we just need to make this interim class.

But in any case, what you're looking for is ShaderEffectSource which will work for any item(s).

Not as performant as the above as it effectively renders then captures the content, but it's fine for small cases.
Comment 2 Nate Graham 2018-10-12 02:34:41 UTC
ShaderEffectSource was just what I needed, thanks!

ShaderEffectSource {
    id: renderedIcon
    visible: false
    sourceItem: icon
}