aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-01-01 11:47:57 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-01-01 20:09:38 +0000
commit56e947bb44dd654634bb068c0a11f173fdd85114 (patch)
treed6fbb969f4d2e883b1e6cd2ba0d77d1cf5e22bcb
parentbox-drawing: wip: LIGHT ARC: U+256d-U+2570 (diff)
box-drawing: LIGHT ARC: pixel-perfect
At least in odd-sized cells, with a thickness of 1 pixel.
-rw-r--r--box-drawing.c50
1 files changed, 26 insertions, 24 deletions
diff --git a/box-drawing.c b/box-drawing.c
index 0e2bcb7b..d2666d65 100644
--- a/box-drawing.c
+++ b/box-drawing.c
@@ -1067,59 +1067,61 @@ draw_box_drawings_light_arc(wchar_t wc, uint8_t *buf, int width, int height, int
if (wc == L'╭') {
start_x = hw;
start_y = height - 1;
+
end_x = width - 1;
end_y = hh;
c1_x = hw;
- c1_y = round(3. * height / 4.);
+ c1_y = 3. * height / 4.;
c2_x = hw;
- c2_y = hh + 1;
+ c2_y = hh;
} else if (wc == L'╮') {
- start_x = 0;
- start_y = hh;
- end_x = hw;
- end_y = height - 1;
+ start_x = hw;
+ start_y = height - 1;
+
+ end_x = 0;
+ end_y = hh;
- c1_x = hw + 1;
- c1_y = hh + 1;
+ c1_x = hw;
+ c1_y = 3. * height / 4.;
- c2_x = hw + 1;
- c2_y = round(3. * height / 4.);
+ c2_x = hw;
+ c2_y = hh;
} else if (wc == L'╯') {
- start_x = 0;
- start_y = hh;
- end_x = hw;
- end_y = 0;
+ start_x = hw;
+ start_y = 0;
+
+ end_x = 0;
+ end_y = hh;
- c1_x = hw + 2;
- c1_y = hh + 1;
+ c1_x = hw;
+ c1_y = height / 4.;
- c2_x = hw + 1;
- c2_y = round(height / 4.);
+ c2_x = hw;
+ c2_y = hh;
} else {
assert(wc == L'╰');
start_x = hw;
start_y = 0;
+
end_x = width - 1;
end_y = hh;
c1_x = hw;
- c1_y = round(height / 4.);
+ c1_y = height / 4.;
c2_x = hw;
- c2_y = hh + 1;
+ c2_y = hh;
}
- LOG_INFO("%f, %f", round(3. * height / 4.), round(height / 4.));
-
int num_samples = height * 4;
for (size_t i = 0; i < num_samples + 1; i++) {
double t = (double)i / num_samples;
- int p_x = cubic_bezier_x(t);
- int p_y = cubic_bezier_y(t);
+ int p_x = round(cubic_bezier_x(t));
+ int p_y = round(cubic_bezier_y(t));
for (int y = max(p_y - delta, 0); y < min(p_y + delta + extra, height); y++) {
for (int x = max(p_x - delta, 0); x < min(p_x + delta + extra, width); x++) {