-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhspobrush.h
86 lines (79 loc) · 2.52 KB
/
hspobrush.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef HSPOBRUSH_H
#define HSPOBRUSH_H
#include "hsopbrushgui.h"
#include <QWidget>
#include <brush_interface.h>
#include <image_processor.h>
class Overlay {
public:
Overlay(QImage *o, int c, QString t) {
ov = o;
color = c;
type = t;
}
QImage *ov;
int color;
QString type;
};
class HSPOBrush : public QObject, public BrushInterface {
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.azagaya.laigter.plugins.BrushInterface" FILE
"metadata.json")
Q_INTERFACES(BrushInterface)
public:
void mousePress(const QPoint &pos) override;
void mouseMove(const QPoint &oldPos, const QPoint &newPos) override;
void mouseRelease(const QPoint &pos) override;
void setPressure(float pressure) override;
bool get_selected() override;
void set_selected(bool s) override;
QWidget *loadGUI(QWidget *parent = nullptr) override;
void setProcessor(ImageProcessor **processor) override;
QString getIcon() override;
QString getName() override;
QImage getBrushSprite() override;
void drawAt(QPoint point, QPainter *p, float alpha_mod = 1.0,
bool tile_x = false, bool tile_y = false);
QImage updateOverlay(int xmin, int xmax, int ymin, int ymax, QImage ov,
QImage old, QImage aux);
void updateBrushSprite();
QObject *getObject() override;
int WrapCoordinate(int coord, int interval);
QPoint WorldToLocal(QPoint world);
signals:
void selected_changed(BrushInterface *brush);
void brush_sprite_updated(QImage sprite);
public slots:
void set_radius(int r);
void set_base_radius(int r);
void set_max(int m);
void set_min(int m);
void set_mix(int m);
void set_hardness(int h);
void set_lineSelected(bool l);
void set_eraserSelected(bool e);
void set_brushSelected(bool b);
void set_height(int heigt);
void set_specular(int s);
void set_parallax(int p);
void set_occlussion(int o);
private:
QImage *m_heightmap, auxHeight, oldHeight;
QImage *m_specular, auxSpecular, oldSpecular;
QImage *m_parallax, auxParallax, oldParallax;
QImage *m_occlussion, auxOcclussion, oldOcclussion;
QImage auxOv, diffuse;
HSOPBrushGui *gui;
QImage brushSprite;
int radius = 15, base_radius = 15;
float pressure = 1.0;
int maxV = 128, minV = 0, height = 128, spec = 255, occ = 0, parallax = 128;
ImageProcessor **processorPtr;
ImageProcessor *m_processor;
float alpha = 0.5;
float hardness = 0;
bool linesSelected = true, brushSelected = true, eraserSelected = false,
selected = true;
QString m_name = tr("HSPO Plugin");
};
#endif // HSPOBRUSH_H