| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
#ifndef KSNIP_ADORNERMAGNIFYINGGLASS_H |
| 21 |
#define KSNIP_ADORNERMAGNIFYINGGLASS_H |
| 22 |
|
| 23 |
#include <QPainter> |
| 24 |
|
| 25 |
class AdornerMagnifyingGlass |
| 26 |
{ |
| 27 |
public: |
| 28 |
explicit AdornerMagnifyingGlass(); |
| 29 |
~AdornerMagnifyingGlass(); |
| 30 |
void update(const QPoint &mousePosition, const QRect &screenRect); |
| 31 |
void paint(QPainter *painter, const QColor &color); |
| 32 |
void setBackgroundImage(const QPixmap *background); |
| 33 |
|
| 34 |
private: |
| 35 |
QPixmap mBackgroundWithMargine; |
| 36 |
QPixmap mImage; |
| 37 |
QRect mVisibleRect; |
| 38 |
QPoint mOffsetToMouse; |
| 39 |
QSize mScaleFactor; |
| 40 |
QSize mZoomInAreaSize; |
| 41 |
QPoint mBackgroundOffset; |
| 42 |
QLine mCrossHairTop; |
| 43 |
QLine mCrossHairBottom; |
| 44 |
QLine mCrossHairLeft; |
| 45 |
QLine mCrossHairRight; |
| 46 |
QPen *mCrossHairPen; |
| 47 |
|
| 48 |
void updateImage(const QPoint &mousePosition); |
| 49 |
void updateCrossHair(); |
| 50 |
bool isPositionTopLeftFromMouse(const QPoint &mousePosition, const QRect &screenRect) const; |
| 51 |
bool isPositionBottomLeftFromMouse(const QPoint &mousePosition, const QRect &screenRect) const; |
| 52 |
bool isPositionTopRightFromMouse(const QPoint &mousePosition, const QRect &screenRect) const; |
| 53 |
void updatePosition(const QPoint &mousePosition, const QRect &screenRect); |
| 54 |
QPixmap createBackgroundWithMagine(const QPixmap *background) const; |
| 55 |
}; |
| 56 |
|
| 57 |
#endif |