From: Soeren Apel Date: Wed, 13 Apr 2016 17:45:22 +0000 (+0200) Subject: Trace/AnalogSignal: Improve contrast and precision of the trace lines X-Git-Tag: pulseview-0.4.0~307 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=46a0cadc74ca39a7bb8b3a4a4622ab7788a28f3b;p=pulseview.git Trace/AnalogSignal: Improve contrast and precision of the trace lines --- diff --git a/pv/view/analogsignal.cpp b/pv/view/analogsignal.cpp index 7e5bcd11..e0add7aa 100644 --- a/pv/view/analogsignal.cpp +++ b/pv/view/analogsignal.cpp @@ -58,8 +58,8 @@ const QColor AnalogSignal::SignalColours[4] = { QColor(0x4E, 0x9A, 0x06) // Green }; -const QColor AnalogSignal::GridMajorColor = QColor(0xB0, 0xB0, 0xB0); -const QColor AnalogSignal::GridMinorColor = QColor(0xD0, 0xD0, 0xD0); +const QColor AnalogSignal::GridMajorColor = QColor(0, 0, 0, 40*256/100); +const QColor AnalogSignal::GridMinorColor = QColor(0, 0, 0, 20*256/100); const float AnalogSignal::EnvelopeThreshold = 256.0f; @@ -200,16 +200,18 @@ void AnalogSignal::paint_fore(QPainter &p, const ViewItemPaintParams &pp) void AnalogSignal::paint_grid(QPainter &p, int y, int left, int right) { - p.setPen(QPen(GridMajorColor, 0.5, Qt::DashLine)); + p.setRenderHint(QPainter::Antialiasing, false); + + p.setPen(QPen(GridMajorColor, 1, Qt::DashLine)); for (int i = 1; i <= vdivs_; i++) { - const int dy = i * div_height_; + const float dy = i * div_height_; p.drawLine(QLineF(left, y - dy, right, y - dy)); p.drawLine(QLineF(left, y + dy, right, y + dy)); } - p.setPen(QPen(GridMinorColor, 0.5, Qt::DashLine)); + p.setPen(QPen(GridMinorColor, 1, Qt::DashLine)); for (int i = 0; i < vdivs_; i++) { - const int dy = i * div_height_; + const float dy = i * div_height_; const float dy25 = dy + (0.25 * div_height_); const float dy50 = dy + (0.50 * div_height_); const float dy75 = dy + (0.75 * div_height_); @@ -220,6 +222,8 @@ void AnalogSignal::paint_grid(QPainter &p, int y, int left, int right) p.drawLine(QLineF(left, y - dy75, right, y - dy75)); p.drawLine(QLineF(left, y + dy75, right, y + dy75)); } + + p.setRenderHint(QPainter::Antialiasing, true); } void AnalogSignal::paint_trace(QPainter &p, diff --git a/pv/view/trace.cpp b/pv/view/trace.cpp index 264541cf..fd6107f6 100644 --- a/pv/view/trace.cpp +++ b/pv/view/trace.cpp @@ -38,7 +38,7 @@ namespace pv { namespace view { -const QPen Trace::AxisPen(QColor(128, 128, 128, 64)); +const QPen Trace::AxisPen(QColor(0, 0, 0, 30*256/100)); const int Trace::LabelHitPadding = 2; const QColor Trace::DarkBGColour(235, 235, 235); // Quite light grey @@ -196,8 +196,12 @@ void Trace::paint_back(QPainter &p, const ViewItemPaintParams &pp) void Trace::paint_axis(QPainter &p, const ViewItemPaintParams &pp, int y) { + p.setRenderHint(QPainter::Antialiasing, false); + p.setPen(AxisPen); - p.drawLine(QPointF(pp.left(), y + 0.5f), QPointF(pp.right(), y + 0.5f)); + p.drawLine(QPointF(pp.left(), y), QPointF(pp.right(), y)); + + p.setRenderHint(QPainter::Antialiasing, true); } void Trace::add_colour_option(QWidget *parent, QFormLayout *form)