Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

utils.h 2.09 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
/***************************************************************************
 *   Copyright (C) 2006 by Luigi Toscano <luigi.toscano@tiscali.it>        *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/

#ifndef _OKULAR_UTILS_H_
#define _OKULAR_UTILS_H_

13 14
#include "okular_export.h"
#include "area.h"
15

16
class QRect;
17
class QImage;
18

19
namespace Okular
20
{
21

22 23 24 25 26
/**
 * @short General utility functions.
 *
 * This class contains some static functions of general utility.
 */
27 28 29
class OKULAR_EXPORT Utils
{
  public:
30 31 32 33
    /**
     * Rotate the rect \p source in the area \p width x \p height with the
     * specified \p orientation .
     */
34
    static QRect rotateRect( const QRect & source, int width, int height, int orientation );
35 36 37 38

    /**
     * Return the horizontal DPI of the main display
     */
39
    static double dpiX();
40 41 42 43

    /**
     * Return the vertical DPI of the main display
     */
44
    static double dpiY();
45

46 47 48 49 50 51
    /**
     * Return the real horizontal DPI of the main display.
     *
     * On X11, it can indicate the real horizontal DPI value without any Xrdb
     * setting. Otherwise, returns the same as dpiX(),
     *
52
     * @since 0.9 (KDE 4.3)
53 54 55 56 57 58 59 60 61
     */
    static double realDpiX();

    /**
     * Return the real vertical DPI of the main display
     *
     * On X11, it can indicate the real horizontal DPI value without any Xrdb
     * setting. Otherwise, returns the same as dpiX(),
     *
62
     * @since 0.9 (KDE 4.3)
63 64 65
     */
    static double realDpiY();

66 67 68 69 70 71 72
    /**
     * Compute the smallest rectangle that contains all non-white pixels in image),
     * in normalized [0,1] coordinates.
     *
     * @since 0.7 (KDE 4.1)
     */
    static NormalizedRect imageBoundingBox( const QImage* image );
73
};
74

75
}
76 77

#endif