From 0f4b7e6050246afe541db6a3a8739d6dc3dd0a21 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Mon, 30 Nov 2009 00:47:24 +0000 Subject: [PATCH] Add a "border" filter to add a border around text. --- src/filter.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/filter.c b/src/filter.c index 037f6a3..3f4ff30 100644 --- a/src/filter.c +++ b/src/filter.c @@ -37,6 +37,7 @@ static void filter_flop(context_t *); static void filter_180(context_t *); static void filter_left(context_t *); static void filter_right(context_t *); +static void filter_border(context_t *); struct { @@ -55,6 +56,7 @@ const lookup[] = { "180", filter_180, "rotate 180 degrees" }, { "left", filter_left, "rotate 90 degrees counterclockwise" }, { "right", filter_right, "rotate 90 degrees clockwise" }, + { "border", filter_border, "surround text with a border" }, }; int filter_list(void) @@ -236,3 +238,15 @@ static void filter_right(context_t *cx) caca_rotate_right(cx->torender); } +static void filter_border(context_t *cx) +{ + int w, h; + + w = caca_get_canvas_width(cx->torender); + h = caca_get_canvas_height(cx->torender); + + caca_set_canvas_boundaries(cx->torender, -1, -1, w + 2, h + 2); + + caca_draw_cp437_box(cx->torender, 0, 0, w + 2, h + 2); +} +