1 #ifndef UTIL_H 2 #define UTIL_H 3 4 #include <QRect> 5 #include <QRectF> 6 7 8 class QImage; 9 10 // rounds a float when afterwards cast to int 11 // seems to fix the mismatch between calculated page height and actual image height 12 #define ROUND(x) ((x) + 0.5f) 13 //#define ROUND(x) (x) 14 15 const QRectF rotate_rect(const QRectF &rect, float w, float h, int rotation); 16 const QPointF rotate_point(const QPointF &point, float w, float h, int rotation); 17 18 QRect transform_rect(const QRectF &rect, float scale, int off_x, int off_y); 19 QRect transform_rect_expand(const QRectF &rect, float scale, int off_x, int off_y); 20 21 void add_action(QWidget *base, const char *action, const char *slot, QWidget *receiver); 22 23 void invert_image(QImage *img); 24 25 #endif 26 27