Skip to content

Commit

Permalink
Merge pull request #1311 from CandyFace/timeline-color-alterations
Browse files Browse the repository at this point in the history
Apply more saturated color scheme to layers and highlight more distinct
  • Loading branch information
candyface authored Mar 6, 2020
2 parents e485a2c + c5b21d9 commit ccaca20
Showing 1 changed file with 37 additions and 13 deletions.
50 changes: 37 additions & 13 deletions core_lib/src/structure/layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,22 +323,34 @@ void Layer::paintTrack(QPainter& painter, TimeLineCells* cells,
if (mVisible)
{
QColor col;
if (type() == BITMAP) col = QColor(151, 176, 244);
if (type() == VECTOR) col = QColor(150, 242, 150);
if (type() == SOUND) col = QColor(237, 147, 147, 100);
if (type() == CAMERA) col = QColor(239, 232, 148);
if (type() == BITMAP) col = QColor(51, 155, 252);
if (type() == VECTOR) col = QColor(70, 205, 123);
if (type() == SOUND) col = QColor(255, 141, 112);
if (type() == CAMERA) col = QColor(253, 202, 92);

painter.save();
painter.setBrush(col);
painter.setPen(QPen(QBrush(QColor(100, 100, 100)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.drawRect(x, y - 1, width, height);

paintFrames(painter, cells, y, height, selected, frameSize);

// changes the apparence if selected
if (selected)
{
paintSelection(painter, x, y, width, height);
}
else
{
QLinearGradient linearGrad(QPointF(0, y), QPointF(0, y + height));
linearGrad.setColorAt(0, QColor(255,255,255,150));
linearGrad.setColorAt(1, QColor(0,0,0,0));
painter.setCompositionMode(QPainter::CompositionMode_Overlay);
painter.setBrush(linearGrad);
painter.drawRect(x, y - 1, width, height);
painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
}

paintFrames(painter, cells, y, height, selected, frameSize);
painter.restore();
}
else
{
Expand Down Expand Up @@ -391,6 +403,21 @@ void Layer::paintLabel(QPainter& painter, TimeLineCells* cells,
painter.setPen(QPen(QBrush(QColor(100, 100, 100)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.drawRect(x, y - 1, width, height); // empty rectangle by default


if (selected)
{
paintSelection(painter, x, y, width, height);
} else {
painter.save();
QLinearGradient linearGrad(QPointF(0, y), QPointF(0, y + height));
linearGrad.setColorAt(0, QColor(255,255,255,150));
linearGrad.setColorAt(1, QColor(0,0,0,0));
painter.setCompositionMode(QPainter::CompositionMode_Overlay);
painter.setBrush(linearGrad);
painter.drawRect(x, y - 1, width, height);
painter.restore();
}

if (mVisible)
{
if ((layerVisibility == LayerVisibility::ALL) || selected) painter.setBrush(Qt::black);
Expand All @@ -406,11 +433,6 @@ void Layer::paintLabel(QPainter& painter, TimeLineCells* cells,
painter.drawEllipse(x + 6, y + 4, 9, 9);
painter.setRenderHint(QPainter::Antialiasing, false);

if (selected)
{
paintSelection(painter, x, y, width, height);
}

if (type() == BITMAP) painter.drawPixmap(QPoint(20, y + 2), QPixmap(":/icons/layer-bitmap.png"));
if (type() == VECTOR) painter.drawPixmap(QPoint(20, y + 2), QPixmap(":/icons/layer-vector.png"));
if (type() == SOUND) painter.drawPixmap(QPoint(21, y + 2), QPixmap(":/icons/layer-sound.png"));
Expand All @@ -425,12 +447,14 @@ void Layer::paintSelection(QPainter& painter, int x, int y, int width, int heigh
QLinearGradient linearGrad(QPointF(0, y), QPointF(0, y + height));
QSettings settings(PENCIL2D, PENCIL2D);
QString style = settings.value("style").toString();
linearGrad.setColorAt(0, QColor(255, 255, 255, 128));
linearGrad.setColorAt(0.50, QColor(255, 255, 255, 64));
linearGrad.setColorAt(0, QColor(0, 0, 0, 255));
linearGrad.setColorAt(1, QColor(255, 255, 255, 0));
painter.save();
painter.setCompositionMode(QPainter::CompositionMode_Overlay);
painter.setBrush(linearGrad);
painter.setPen(Qt::NoPen);
painter.drawRect(x, y, width, height - 1);
painter.restore();
}

void Layer::mouseDoubleClick(QMouseEvent* event, int frameNumber)
Expand Down

0 comments on commit ccaca20

Please sign in to comment.