big progress on graph editor

This commit is contained in:
itsmattkc
2018-12-28 22:06:38 +11:00
parent c3ea55faf4
commit e101739214
25 changed files with 607 additions and 84 deletions
+26
View File
@@ -0,0 +1,26 @@
#include "keyframedrawing.h"
#include "project/effect.h"
#define KEYFRAME_POINT_COUNT 4
void draw_keyframe(QPainter &p, int type, int x, int y, bool darker) {
int color = (darker) ? 100 : 160;
p.setPen(QColor(0, 0, 0));
p.setBrush(QColor(color, color, color));
switch (type) {
case KEYFRAME_TYPE_LINEAR:
{
QPoint points[KEYFRAME_POINT_COUNT] = {QPoint(x-KEYFRAME_SIZE, y), QPoint(x, y-KEYFRAME_SIZE), QPoint(x+KEYFRAME_SIZE, y), QPoint(x, y+KEYFRAME_SIZE)};
p.drawPolygon(points, KEYFRAME_POINT_COUNT);
}
break;
case KEYFRAME_TYPE_BEZIER:
p.drawEllipse(QPoint(x, y), KEYFRAME_SIZE, KEYFRAME_SIZE);
break;
case KEYFRAME_TYPE_HOLD:
p.drawRect(QRect(x - KEYFRAME_SIZE, y - KEYFRAME_SIZE, KEYFRAME_SIZE*2, KEYFRAME_SIZE*2));
break;
}
}