File indexing completed on 2024-05-12 05:47:31

0001 /*
0002  * SPDX-FileCopyrightText: 2011 Peter Penz <peter.penz19@gmail.com>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KPIXMAPMODIFIER_H
0008 #define KPIXMAPMODIFIER_H
0009 
0010 #include "dolphin_export.h"
0011 
0012 class QPixmap;
0013 class QSize;
0014 
0015 class DOLPHIN_EXPORT KPixmapModifier
0016 {
0017 public:
0018     /**
0019      * Scale a pixmap to a given size.
0020      * @arg scaledSize is assumed to be the scaled to the same device pixel ratio as the source pixmap
0021      * @arg scaledSize is in device pixels
0022      */
0023     static void scale(QPixmap &pixmap, const QSize &scaledSize);
0024 
0025     /**
0026      * Resize and paint a frame round an icon
0027      * @arg scaledSize is in device-independent pixels
0028      * The returned image will be scaled by the application devicePixelRatio
0029      */
0030     static void applyFrame(QPixmap &icon, const QSize &scaledSize);
0031 
0032     /**
0033      * return and paint a frame round an icon
0034      * @arg framesize is in device-independent pixels
0035      * @return is in device-independent pixels
0036      */
0037 
0038     static QSize sizeInsideFrame(const QSize &frameSize);
0039 };
0040 
0041 #endif