Plasma
framesvg.cpp
317 return rect.adjusted(d->frame->leftMargin, d->frame->topMargin, -d->frame->rightMargin, -d->frame->bottomMargin);
455 const QString maskRequestedPrefix = requestedPrefix.isEmpty() ? QStringLiteral("mask") : maskPrefix % requestedPrefix;
490 FrameSvgPrivate::lookupOrCreateMaskFrame(const QSharedPointer<FrameData> &frame, const QString &maskPrefix, const QString &maskRequestedPrefix)
526 const bool overlayAvailable = !frame->prefix.startsWith(QLatin1String("mask-")) && q->hasElement(frame->prefix % QLatin1String("overlay"));
529 frameCached = q->theme()->findInCache(QString::number(id), frame->cachedBackground, frame->lastModified) && !frame->cachedBackground.isNull();
533 overlayCached = q->theme()->findInCache(QString::number(overlayId), overlay, frame->lastModified) && !overlay.isNull();
572 overlayPainter.drawTiledPixmap(QRect(QPoint(0, 0), overlaySize), q->pixmap(frame->prefix % QLatin1String("overlay")));
575 q->paint(&overlayPainter, QRect(actualOverlayPos, overlaySize), frame->prefix % QLatin1String("overlay"));
604 qCWarning(LOG_PLASMA) << "Not generating frame background for a size whose width or height is more than" << MAX_FRAME_SIZE << size;
624 paintBorder(p, frame, FrameSvg::LeftBorder, QSize(frame->leftWidth, leftHeight) * q->devicePixelRatio(), contentRect);
626 paintBorder(p, frame, FrameSvg::RightBorder, QSize(frame->rightWidth, rightHeight) * q->devicePixelRatio(), contentRect);
629 paintBorder(p, frame, FrameSvg::TopBorder, QSize(topWidth, frame->topHeight) * q->devicePixelRatio(), contentRect);
631 paintBorder(p, frame, FrameSvg::BottomBorder, QSize(bottomWidth, frame->bottomHeight) * q->devicePixelRatio(), contentRect);
637 QRect FrameSvgPrivate::contentGeometry(const QSharedPointer<FrameData> &frame, const QSize &size) const
639 const QSize contentSize(size.width() - frame->leftWidth * q->devicePixelRatio() - frame->rightWidth * q->devicePixelRatio(),
640 size.height() - frame->topHeight * q->devicePixelRatio() - frame->bottomHeight * q->devicePixelRatio());
642 if (frame->enabledBorders & FrameSvg::LeftBorder && q->hasElement(frame->prefix % QLatin1String("left"))) {
647 if (frame->enabledBorders & FrameSvg::TopBorder && q->hasElement(frame->prefix % QLatin1String("top"))) {
720 void FrameSvgPrivate::paintCenter(QPainter &p, const QSharedPointer<FrameData> &frame, const QRect &contentRect, const QSize &fullSize)
736 p.drawTiledPixmap(FrameSvgHelpers::sectionRect(FrameSvg::NoBorder, contentRect, fullSize * q->devicePixelRatio()), center);
742 q->paint(&p, FrameSvgHelpers::sectionRect(FrameSvg::NoBorder, contentRect, fullSize * q->devicePixelRatio()), centerElementId);
763 q->paint(&p, FrameSvgHelpers::sectionRect(borders, contentRect, frame->frameSize * q->devicePixelRatio()), side);
772 p.drawTiledPixmap(FrameSvgHelpers::sectionRect(borders, contentRect, frame->frameSize * q->devicePixelRatio()), px);
777 void FrameSvgPrivate::paintCorner(QPainter &p, const QSharedPointer<FrameData> &frame, Plasma::FrameSvg::EnabledBorders border, const QRect &contentRect) const
785 q->paint(&p, FrameSvgHelpers::sectionRect(border, contentRect, frame->frameSize * q->devicePixelRatio()), corner);
789 SvgPrivate::CacheId FrameSvgPrivate::cacheId(FrameData *frame, const QString &prefixToSave) const
804 void FrameSvgPrivate::cacheFrame(const QString &prefixToSave, const QPixmap &background, const QPixmap &overlay)
819 q->theme()->insertIntoCache(QString::number(id), background, QString::number((qint64)q, 16) % prefixToSave);
824 q->theme()->insertIntoCache(QString::number(overlayId), overlay, QString::number((qint64)q, 16) % prefixToSave % QLatin1String("overlay"));
904 if (auto rightMargin = q->elementRect(createName(u"hint-right-margin")); rightMargin.isValid()) {
925 if (auto bottomMargin = q->elementRect(createName(u"hint-bottom-margin")); bottomMargin.isValid()) {
938 if (auto bottomInset = q->elementRect(createName(u"hint-bottom-inset")); bottomInset.isValid()) {
949 frame->composeOverBorder = (q->hasElement(createName(u"hint-compose-over-border")) && q->hasElement(maskPrefix % createName(u"center")));
953 frame->tileCenter = (q->hasElement(hintTileCenter) || q->hasElement(createName(u"hint-tile-center")));
954 frame->noBorderPadding = (q->hasElement(hintNoBorderPadding) || q->hasElement(createName(u"hint-no-border-padding")));
SmoothPixmapTransform
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const const
bool isNull() const const
const T value(const Key &key) const const
bool isValid() const const
QString number(int n, int base)
qreal devicePixelRatio() const const
void drawPixmap(const QRectF &target, const QPixmap &pixmap, const QRectF &source)
Q_INVOKABLE bool cacheAllRenderedFrames() const
Definition: framesvg.cpp:368
void drawTiledPixmap(const QRectF &rectangle, const QPixmap &pixmap, const QPointF &position)
Q_INVOKABLE void setCacheAllRenderedFrames(bool cache)
Sets whether saving all the rendered prefixes in a cache or not.
Definition: framesvg.cpp:359
Q_INVOKABLE int minimumDrawingWidth()
This will return the minimum width required to correctly draw this SVG.
Definition: framesvg.cpp:426
bool isEmpty() const const
Q_INVOKABLE void getMargins(qreal &left, qreal &top, qreal &right, qreal &bottom) const
Convenience method that extracts the size of the four margins in the four output parameters The disab...
Definition: framesvg.cpp:274
QStringView mid(qsizetype start) const const
QRectF adjusted(qreal dx1, qreal dy1, qreal dx2, qreal dy2) const const
void reserve(int size)
int width() const const
Q_INVOKABLE QRegion mask() const
Returns a mask that tightly contains the fully opaque areas of the svg.
Definition: framesvg.cpp:329
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void setWidth(int width)
QHash::iterator insert(const Key &key, const T &value)
bool isEmpty() const const
Q_INVOKABLE QString prefix()
Returns the prefix for SVG elements of the FrameSvg (including a '-' at the end if not empty)
Definition: framesvg.cpp:159
Q_INVOKABLE QPixmap framePixmap()
Returns a pixmap of the SVG represented by this object.
Definition: framesvg.cpp:385
int height() const const
Q_INVOKABLE void setElementPrefix(Plasma::Types::Location location)
Sets the prefix (.
Definition: framesvg.cpp:87
Q_INVOKABLE qreal insetSize(const Plasma::Types::MarginEdge edge) const
Returns the insets margin size given the margin edge we want.
Definition: framesvg.cpp:222
Q_INVOKABLE bool hasElementPrefix(const QString &prefix) const
Definition: framesvg.cpp:129
void setX(int x)
void setY(int y)
bool isEmpty() const const
Q_INVOKABLE void getFixedMargins(qreal &left, qreal &top, qreal &right, qreal &bottom) const
Convenience method that extracts the size of the four margins in the four output parameters Compared ...
Definition: framesvg.cpp:287
int length() const const
void setContainsMultipleImages(bool multiple)
Set whether the SVG contains a single image or multiple ones.
Definition: svg.cpp:1115
Q_INVOKABLE void paintFrame(QPainter *painter, const QRectF &target, const QRectF &source=QRectF())
Paints the loaded SVG with the elements that represents the border.
Definition: framesvg.cpp:394
QSize toSize() const const
KCALENDARCORE_EXPORT uint qHash(const KCalendarCore::Period &key)
Q_INVOKABLE qreal marginSize(const Plasma::Types::MarginEdge edge) const
Returns the margin size given the margin edge we want If the given margin is disabled,...
Definition: framesvg.cpp:196
int height() const const
QBitmap mask() const const
void setRepaintBlocked(bool blocked)
If we will do several changes at once in the frame properties, such as prefix, enabled borders and si...
Definition: framesvg.cpp:1004
Q_INVOKABLE qreal fixedMarginSize(const Plasma::Types::MarginEdge edge) const
Returns the margin size given the margin edge we want.
Definition: framesvg.cpp:248
bool isValid() const const
QString & replace(int position, int n, QChar after)
Q_INVOKABLE void getInset(qreal &left, qreal &top, qreal &right, qreal &bottom) const
Convenience method that extracts the size of the four inset margins in the four output parameters.
Definition: framesvg.cpp:300
bool isNull() const const
void setCompositionMode(QPainter::CompositionMode mode)
Q_INVOKABLE int minimumDrawingHeight()
This will return the minimum height required to correctly draw this SVG.
Definition: framesvg.cpp:418
QPixmap scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const const
Q_INVOKABLE void setImagePath(const QString &path) override
Loads a new Svg.
Definition: framesvg.cpp:54
bool isEmpty() const const
int remove(const Key &key)
Location
The Location enumeration describes where on screen an element, such as an Applet or its managing cont...
Definition: plasma.h:158
void translate(int dx, int dy)
Q_INVOKABLE bool hasElement(const QString &elementId) const
Check whether an element exists in the loaded SVG.
Definition: svg.cpp:1082
Q_INVOKABLE void clearCache()
Deletes the internal cache freeing memory: use this if you want to switch the rendered element and yo...
Definition: framesvg.cpp:373
void setEnabledBorders(const EnabledBorders borders)
Sets what borders should be painted.
Definition: framesvg.cpp:69
QTextStream & center(QTextStream &stream)
CompositionMode_SourceIn
Q_INVOKABLE void resizeFrame(const QSizeF &size)
Resize the frame maintaining the same border size.
Definition: framesvg.cpp:164
void setHeight(int height)
QString & append(QChar ch)
transparent
int width() const const
void repaintNeeded()
Emitted whenever the SVG data has changed in such a way that a repaint is required.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 04:15:02 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 04:15:02 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.