From 40ab37c0713763a00def6a1c9f61d610d282a818 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Thu, 21 Aug 2014 16:03:30 +1000 Subject: [PATCH] Software summarychart gradients a bit --- sleepyhead/Graphs/gLineOverlay.cpp | 2 +- sleepyhead/Graphs/gSummaryChart.cpp | 12 ++++++------ sleepyhead/sessionbar.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sleepyhead/Graphs/gLineOverlay.cpp b/sleepyhead/Graphs/gLineOverlay.cpp index 153f6046..858099b3 100644 --- a/sleepyhead/Graphs/gLineOverlay.cpp +++ b/sleepyhead/Graphs/gLineOverlay.cpp @@ -20,7 +20,7 @@ gLineOverlayBar::~gLineOverlayBar() { } -QColor brighten(QColor color); +QColor brighten(QColor, float); void gLineOverlayBar::paint(QPainter &painter, gGraph &w, const QRegion ®ion) { diff --git a/sleepyhead/Graphs/gSummaryChart.cpp b/sleepyhead/Graphs/gSummaryChart.cpp index 63b371b1..36afb29e 100644 --- a/sleepyhead/Graphs/gSummaryChart.cpp +++ b/sleepyhead/Graphs/gSummaryChart.cpp @@ -381,7 +381,7 @@ void SummaryChart::SetDay(Day * nullday) m_physminy = m_miny; } -QColor brighten(QColor color) +QColor brighten(QColor color, float mult = 2.0) { int cr, cg, cb; @@ -395,9 +395,9 @@ QColor brighten(QColor color) if (cb < 64) { cb = 64; } - cr *= 2; - cg *= 2; - cb *= 2; + cr *= mult; + cg *= mult; + cb *= mult; if (cr > 255) { cr = 255; } @@ -649,7 +649,7 @@ void SummaryChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion) } QColor col1 = col; - QColor col2 = Qt::white; + QColor col2 = brighten(col,2.37); //outlines->setColor(Qt::black); int np = d.value().size(); @@ -767,7 +767,7 @@ void SummaryChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion) if (graphtype == GT_BAR) { QColor col1 = col; - QColor col2 = Qt::white; + QColor col2 = brighten(col,2.5); QLinearGradient gradient(x1, py-h, x1+barw, py-h); gradient.setColorAt(0,col1); diff --git a/sleepyhead/sessionbar.cpp b/sleepyhead/sessionbar.cpp index db842d55..bc0a5e7c 100644 --- a/sleepyhead/sessionbar.cpp +++ b/sleepyhead/sessionbar.cpp @@ -117,7 +117,7 @@ SegType SessionBar::max() return max; } -QColor brighten(QColor color); +QColor brighten(QColor, float f=2.0); void SessionBar::mousePressEvent(QMouseEvent *ev) {