From 28849b589dcd933b2527d9f231ce6668ed7d19fa Mon Sep 17 00:00:00 2001 From: Leo Howell Date: Sat, 26 Sep 2009 16:08:27 +0900 Subject: (partially) layout code --- lpg/libqr/test.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lpg/libqr/test.c') diff --git a/lpg/libqr/test.c b/lpg/libqr/test.c index ec77bfe..f51b90b 100644 --- a/lpg/libqr/test.c +++ b/lpg/libqr/test.c @@ -33,6 +33,21 @@ int main() { printf("Code width %d\n", qr_code_width(code)); + { + /* Hack: render the code using ANSI terminal art */ + char buf[80*25]; + int x, y; + + qr_code_render(code, buf, 8, 80, 0, 1, 0); + for (y=0;y<21;++y) { + printf("\t|"); + for (x=0;x<21;++x) { + printf("%s ", buf[y*80+x]?"\033[7m":"\033[0m"); + } + printf("\033[0m|\n"); + } + } + return 0; } -- cgit v1.2.3-70-g09d2