File indexing completed on 2024-04-28 04:32:48
0001 /* 0002 SPDX-FileCopyrightText: 2006 Luigi Toscano <luigi.toscano@tiscali.it> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef _OKULAR_UTILS_H_ 0008 #define _OKULAR_UTILS_H_ 0009 0010 #include "area.h" 0011 #include "okularcore_export.h" 0012 0013 class QRect; 0014 class QImage; 0015 0016 namespace Okular 0017 { 0018 /** 0019 * @short General utility functions. 0020 * 0021 * This class contains some static functions of general utility. 0022 */ 0023 class OKULARCORE_EXPORT Utils 0024 { 0025 public: 0026 /** 0027 * Rotate the rect \p source in the area \p width x \p height with the 0028 * specified \p orientation . 0029 */ 0030 static QRect rotateRect(const QRect source, int width, int height, int orientation); 0031 0032 /** 0033 * Return the real DPI of the display containing given window 0034 * 0035 * On X11, it can indicate the real horizontal DPI value without any Xrdb 0036 * setting. Otherwise, returns the same as realDpiX/Y(), 0037 * 0038 * @since 22.04 0039 */ 0040 static QSizeF realDpi(const QWindow *windowOnScreen); 0041 0042 /** 0043 * Compute the smallest rectangle that contains all non-white pixels in image), 0044 * in normalized [0,1] coordinates. 0045 * 0046 * @since 0.7 (KDE 4.1) 0047 */ 0048 static NormalizedRect imageBoundingBox(const QImage *image); 0049 }; 0050 0051 } 0052 0053 #endif 0054 0055 /* kate: replace-tabs on; indent-width 4; */