| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
#ifndef KSNIP_ABSTRACTRECTAREAIMAGEGRABBER_H |
| 21 |
#define KSNIP_ABSTRACTRECTAREAIMAGEGRABBER_H |
| 22 |
|
| 23 |
#include <QPainter> |
| 24 |
#include <QScreen> |
| 25 |
|
| 26 |
#include "AbstractImageGrabber.h" |
| 27 |
#include "src/gui/snippingArea/AbstractSnippingArea.h" |
| 28 |
|
| 29 |
class AbstractRectAreaImageGrabber : public AbstractImageGrabber |
| 30 |
{ |
| 31 |
Q_OBJECT |
| 32 |
public: |
| 33 |
explicit AbstractRectAreaImageGrabber(AbstractSnippingArea *snippingArea, const QSharedPointer<IConfig> &config); |
| 34 |
~AbstractRectAreaImageGrabber() override; |
| 35 |
void grabImage(CaptureModes captureMode, bool captureCursor, int delay) override; |
| 36 |
virtual QRect currentScreenRect() const; |
| 37 |
virtual QRect fullScreenRect() const = 0; |
| 38 |
virtual QRect activeWindowRect() const = 0; |
| 39 |
virtual QRect lastRectArea() const; |
| 40 |
|
| 41 |
protected: |
| 42 |
QRect mCaptureRect; |
| 43 |
CursorDto mStoredCursorImageWithPosition; |
| 44 |
|
| 45 |
void openSnippingAreaWithoutBackground(); |
| 46 |
void openSnippingAreaWithBackground(const QPixmap &background); |
| 47 |
QRect selectedSnippingAreaRect() const; |
| 48 |
QPixmap snippingAreaBackground() const; |
| 49 |
QPixmap getScreenshotFromRect(const QRect &rect) const; |
| 50 |
QPixmap getScreenshot() const; |
| 51 |
virtual QPixmap getScreenshotFromBackground() const; |
| 52 |
void setCaptureRectFromCorrectSource(); |
| 53 |
virtual bool isSnippingAreaBackgroundTransparent() const; |
| 54 |
virtual CursorDto getCursorWithPosition() const = 0; |
| 55 |
|
| 56 |
protected slots: |
| 57 |
void prepareGrab(); |
| 58 |
void grab() override; |
| 59 |
|
| 60 |
private: |
| 61 |
AbstractSnippingArea* mSnippingArea; |
| 62 |
bool mFreezeImageWhileSnipping; |
| 63 |
|
| 64 |
void openSnippingArea(); |
| 65 |
void connectSnippingAreaCancel(); |
| 66 |
void connectSnippingAreaFinish(); |
| 67 |
void disconnectSnippingAreaFinish(); |
| 68 |
bool shouldCaptureCursor() const; |
| 69 |
CursorDto getCursorImageWithPositionFromCorrectSource() const; |
| 70 |
bool isRectAreaCaptureWithBackground() const; |
| 71 |
bool isRectAreaCaptureWithoutBackground() const; |
| 72 |
CursorDto getCursorRelativeToScreenshot() const; |
| 73 |
void storeCursorForPostProcessing(const QRect &screenRect); |
| 74 |
}; |
| 75 |
|
| 76 |
#endif |