-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIMCSence.h
72 lines (59 loc) · 1.88 KB
/
IMCSence.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef IMCSENCE_H
#define IMCSENCE_H
#include <QGraphicsScene>
class QGraphicsPixmapItem;
class CForgegroungImageItem;
class QUndoStack;
enum DrawType
{
PAN,
PEN_STATE,
CLEAR_STATE,
MODEFY_STATE
};
class IMCSence : public QGraphicsScene
{
Q_OBJECT
public:
explicit IMCSence(QObject* parent = Q_NULLPTR);
virtual ~IMCSence();
void setCenterImage(const QImage& image);
void setCenterImage(const QPixmap& pixmap);
void setState(DrawType state);
DrawType getState();
void setBrushColor(const QColor& cr);
void setBrushSize(int sz);
void setClearSize(int sz);
void addBoundItem(QGraphicsItem* item);
void removeBoundItem(QGraphicsItem* item);
QVector<QGraphicsItem*> getBoundItems();
int getBrushSize();
int getClearSize();
QColor getBrushColor();
void clearBrush();
void addBox(const QRectF& boundRect);
void addCircle(const QRectF &boundRect);
void modefyItem(QGraphicsItem* item,const QRectF& rect);
void modefyItem(QGraphicsItem* item,const QImage& img);
QUndoStack* getUndoStack();
// QGraphicsItem* createItem(DrawType type,QVector<QPointF>& pts);
QImage getForgegroundImage();
void computeIMC();
void thresIMC(int lhs,int rhs, bool isMove);
void setMaskOpy(qreal opy);
void updateCurrentItemName(const QString& name);
void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
void keyPressEvent(QKeyEvent* event) override;
signals:
void backgroundChanged(const QImage& img, CForgegroungImageItem* item);
private:
QGraphicsPixmapItem* m_imageItem;
QImage m_centerImage;
CForgegroungImageItem* m_maskItem;
QUndoStack* m_undoStack;
DrawType m_state;
QVector<QGraphicsItem*> m_showItems;
};
#endif // IMCSENCE_H