|
|
|
|
@ -2,13 +2,14 @@ |
|
|
|
|
|
|
|
|
|
#include "util/Util.h" |
|
|
|
|
|
|
|
|
|
DottedBackgroundPainter::DottedBackgroundPainter() = default; |
|
|
|
|
DottedBackgroundPainter::DottedBackgroundPainter(bool margins): margins(margins) {} |
|
|
|
|
|
|
|
|
|
DottedBackgroundPainter::~DottedBackgroundPainter() = default; |
|
|
|
|
|
|
|
|
|
void DottedBackgroundPainter::resetConfig() { |
|
|
|
|
this->defaultForegroundColor1 = 0x303030U; |
|
|
|
|
this->defaultAlternativeForegroundColor1 = 0x434343U; |
|
|
|
|
this->defaultForegroundColor1 = 0x4A4A4AU; |
|
|
|
|
this->defaultAlternativeForegroundColor1 = 0x262626U;//303030U;
|
|
|
|
|
this->defaultForegroundColor2 = 0xB58900U; |
|
|
|
|
this->lineWidth = 0.2; |
|
|
|
|
this->drawRaster1 = 10; |
|
|
|
|
} |
|
|
|
|
@ -19,15 +20,30 @@ void DottedBackgroundPainter::paint() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void DottedBackgroundPainter::paintBackgroundDotted() { |
|
|
|
|
Util::cairo_set_source_rgbi(cr, this->foregroundColor1); |
|
|
|
|
auto pos = [dr1 = drawRaster1](int i) { return dr1 + i * dr1; }; |
|
|
|
|
|
|
|
|
|
int left_margin=1; |
|
|
|
|
int right_margin=40; |
|
|
|
|
|
|
|
|
|
if (margins) { |
|
|
|
|
Util::cairo_set_source_rgbi(cr, this->defaultAlternativeForegroundColor1); |
|
|
|
|
|
|
|
|
|
cairo_rectangle(cr, 0, 0, pos(left_margin), height); |
|
|
|
|
cairo_rectangle(cr, pos(right_margin), 0, width, height); |
|
|
|
|
cairo_fill(cr); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Util::cairo_set_source_rgbi(cr, this->defaultForegroundColor1); |
|
|
|
|
|
|
|
|
|
cairo_set_line_width(cr, lineWidth * lineWidthFactor); |
|
|
|
|
cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND); |
|
|
|
|
|
|
|
|
|
double delta=5*lineWidth*lineWidthFactor; |
|
|
|
|
|
|
|
|
|
auto pos = [dr1 = drawRaster1](int i) { return dr1 + i * dr1; }; |
|
|
|
|
|
|
|
|
|
for (int x = 0; pos(x) < width; ++x) { |
|
|
|
|
if (!margins || ((x != left_margin) && (x != right_margin))) |
|
|
|
|
for (int y = 0; pos(y) < height; ++y) { |
|
|
|
|
cairo_move_to(cr, pos(x)-delta, pos(y)); |
|
|
|
|
cairo_line_to(cr, pos(x)+delta, pos(y)); |
|
|
|
|
@ -35,6 +51,19 @@ void DottedBackgroundPainter::paintBackgroundDotted() { |
|
|
|
|
cairo_line_to(cr, pos(x), pos(y)+delta); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
cairo_stroke(cr); |
|
|
|
|
|
|
|
|
|
if (margins) { |
|
|
|
|
Util::cairo_set_source_rgbi(cr, this->defaultForegroundColor1); |
|
|
|
|
|
|
|
|
|
cairo_move_to(cr, pos(left_margin), 0); |
|
|
|
|
cairo_line_to(cr, pos(left_margin), height); |
|
|
|
|
cairo_move_to(cr, pos(right_margin), 0); |
|
|
|
|
cairo_line_to(cr, pos(right_margin), height); |
|
|
|
|
|
|
|
|
|
cairo_stroke(cr); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|