FrameSvg is not a pleasant thing for modifications, at least not this type of modification.
Here is a patch that works, but is a bit dirty since I wanted to change as little as I can (and i'm not satisfied with that) - it sets a new prefix and renders the mask-prefix elements, and then assigns the mask of that render to the original FrameData. I had to add the new maskFrame to d->frames so that updateSizes() can work. What to do about that - should I remove it immediately after rendering or what? Cheerio! -- While you were hanging yourself on someone else's words Dying to believe in what you heard I was staring straight into the shining sun -- The Pink Floyd
Index: framesvg.cpp =================================================================== --- framesvg.cpp (revision 893681) +++ framesvg.cpp (working copy) @@ -342,13 +342,39 @@ FrameData *frame = d->frames[d->prefix]; if (!frame->cachedMask) { - if (frame->cachedBackground.isNull()) { - d->generateBackground(frame); + // ivan: we are testing whether we have the mask prefixed + // elements to use for creating the mask. + if (hasElement("mask-" + d->prefix + "center")) { + QString oldPrefix = d->prefix; + + // We are setting the prefix only temporary to generate + // the needed mask image + d->prefix = "mask-" + oldPrefix; + + if (!d->frames.contains(d->prefix)) { + d->frames.insert(d->prefix, new FrameData(*(d->frames[oldPrefix]))); + d->updateSizes(); + } + + FrameData *maskFrame = d->frames[d->prefix]; + if (maskFrame->cachedBackground.isNull()) { + d->generateBackground(maskFrame); + if (maskFrame->cachedBackground.isNull()) { + return QBitmap(); + } + } + + frame->cachedMask = QBitmap(maskFrame->cachedBackground.alphaChannel().createMaskFromColor(Qt::black)); + d->prefix = oldPrefix; + } else { if (frame->cachedBackground.isNull()) { - return QBitmap(); + d->generateBackground(frame); + if (frame->cachedBackground.isNull()) { + return QBitmap(); + } } + frame->cachedMask = QBitmap(frame->cachedBackground.alphaChannel().createMaskFromColor(Qt::black)); } - frame->cachedMask = QBitmap(frame->cachedBackground.alphaChannel().createMaskFromColor(Qt::black)); } return frame->cachedMask; }
_______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel