Add a "border" filter to add a border around text.

This commit is contained in:
Sam Hocevar 2009-11-30 00:47:24 +00:00 committed by sam
parent e409fd0f99
commit 0f4b7e6050

View file

@ -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);
}