-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshape.h
More file actions
36 lines (32 loc) · 974 Bytes
/
shape.h
File metadata and controls
36 lines (32 loc) · 974 Bytes
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
#ifndef SHAPE_H
#define SHAPE_H
#include <QPixmap>
#include <QPen>
#include <QPoint>
#include <QVector>
class Shape
{
protected:
enum {SHAPE, LINE, CIRCLE, RECTANGLE, OVAL, POLYGON, CURVE};
int type;
QPoint transformCenter;
QPoint LTPoint, RBPoint;
QPoint translate_Point(int dx, int dy, QPoint point);
QPoint rotate_Point(int x, int y, int r, QPoint point);
QPoint scale_Point(int x, int y, float s, QPoint point);
virtual void set_LTRB() = 0;
public:
Shape();
~Shape();
int getType();
QPoint getCenter();
QPoint getLT();
QPoint getRB();
virtual void draw(QPen& pen, QPixmap& pix) = 0;
virtual void translate(int dx, int dy) = 0;
virtual void rotate(int x, int y, int r) = 0;
virtual void scale(int x, int y, float s) = 0;
virtual void clip(QPoint point1, QPoint point2, std::string algorithm);
bool in_DraggingArea(QPoint cursor);
};
#endif // SHAPE_H