From 3d8378aa16adb8309a5f746c5414d67180dfbcd6 Mon Sep 17 00:00:00 2001 From: Florian Stecker Date: Fri, 8 Feb 2019 13:03:05 +0100 Subject: [PATCH] some new boxes --- draw.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ main.c | 6 +++++ main.h | 2 ++ 3 files changed, 77 insertions(+) diff --git a/draw.c b/draw.c index bed3dbd..248858e 100644 --- a/draw.c +++ b/draw.c @@ -319,6 +319,72 @@ void drawBoxes(DrawingContext *ctx) drawBoxStd(ctx, "cabc ab", 'B'); } +void drawBoxes2(DrawingContext *ctx) +{ + /* + cairo_set_source_rgb(ctx->cairo, 1, 0.5, 0); + drawBoxStd(ctx, "a", 'A'); + drawBoxStd(ctx, "ca", 'A'); + drawBoxStd(ctx, "aca", 'A'); + drawBoxStd(ctx, "caca", 'A'); + drawBoxStd(ctx, "acaca", 'A'); + cairo_set_source_rgb(ctx->cairo, 0, 0.5, 1); + drawBoxStd(ctx, "acac", 'A'); + drawBoxStd(ctx, "cac", 'A'); + drawBoxStd(ctx, "ac", 'A'); + drawBoxStd(ctx, "c", 'A'); + drawBoxStd(ctx, "", 'A'); + */ + + /* + cairo_set_source_rgb(ctx->cairo, 0, 0.5, 1); + drawBox(ctx, "abc", "cab"); +// drawBox(ctx, "ba abc ab", "ba cab ab"); + drawBox(ctx, "baba abc abab", "baba cab abab"); + drawBox(ctx, "abab abc baba", "abab cab baba"); + drawBox(ctx, "ab abc ba", "ab cab ba"); + + cairo_set_source_rgb(ctx->cairo, 1, 0.5, 0); + drawBox(ctx, "b abc b", "b cab b"); + drawBox(ctx, "bab abc bab", "bab cab bab"); + drawBox(ctx, "babab abc babab", "babab cab babab"); + drawBox(ctx, "aba abc aba", "aba cab aba"); +// drawBox(ctx, "a abc a", "a cab a"); + + cairo_set_source_rgb(ctx->cairo, 0, 0.5, 1); + drawBox(ctx, "bca", "abc"); +// drawBox(ctx, "cb bca bc", "cb abc bc"); + drawBox(ctx, "cbcb bca bcbc", "cbcb abc bcbc"); + drawBox(ctx, "bcbc bca cbcb", "bcbc abc cbcb"); + drawBox(ctx, "bc bca cb", "bc abc cb"); + + cairo_set_source_rgb(ctx->cairo, 1, 0.5, 0); + drawBox(ctx, "c bca c", "c abc c"); + drawBox(ctx, "cbc bca cbc", "cbc abc cbc"); + drawBox(ctx, "cbcbc bca cbcbc", "cbcbc abc cbcbc"); + drawBox(ctx, "bcb bca bcb", "bcb abc bcb"); +// drawBox(ctx, "b bca b", "b abc b"); +*/ + + cairo_set_source_rgb(ctx->cairo, 0, 0, 0); + drawBox(ctx, "abc", "cab"); + + cairo_set_source_rgb(ctx->cairo, 0, 0.5, 1); +// drawBox(ctx, "cab", "bca"); +// drawBox(ctx, "ac cab ca", "ac bca ca"); +// drawBox(ctx, "acac cab caca", "acac bca caca"); + drawBox(ctx, "caca cab acac", "caca bca acac"); + drawBox(ctx, "ca cab ac", "ca bca ac"); + + cairo_set_source_rgb(ctx->cairo, 1, 0.5, 0); + drawBox(ctx, "a cab a", "a bca a"); + drawBox(ctx, "aca cab aca", "aca bca aca"); +// drawBox(ctx, "acaca cab acaca", "acaca bca acaca"); +// drawBox(ctx, "cac cab cac", "cac bca cac"); +// drawBox(ctx, "c cab c", "c bca c"); + +} + void drawLimitCurve(DrawingContext *ctx) { cairo_t *C = ctx->cairo; @@ -392,6 +458,9 @@ void draw(DrawingContext *ctx) if(ctx->show_boxes) drawBoxes(ctx); + if(ctx->show_boxes2) + drawBoxes2(ctx); + if(ctx->show_attractors) drawAttractors(ctx); diff --git a/main.c b/main.c index dac91c1..6937919 100644 --- a/main.c +++ b/main.c @@ -26,6 +26,7 @@ void setupContext(DrawingContext *ctx) ctx->k[2] = 2; ctx->parameter = 3.0; ctx->show_boxes = 0; + ctx->show_boxes2 = 0; ctx->show_attractors = 0; ctx->show_reflectors = 0; ctx->show_limit= 1; @@ -89,6 +90,8 @@ void print(DrawingContext *screen) time_t t = time(NULL); strftime(filename, sizeof(filename), "screenshot_%Y%m%d_%H%M%S.pdf", localtime(&t)); + memcpy(&file, screen, sizeof(file)); + dim.width = screen->dim->width; dim.height = screen->dim->width / sqrt(2.0); dim.matrix = screen->dim->matrix; @@ -171,6 +174,9 @@ int processEvent(GraphicsInfo *info, XEvent *ev) case 'b': TOGGLE(screen_context->show_boxes); break; + case 'B': + TOGGLE(screen_context->show_boxes2); + break; case 'a': TOGGLE(screen_context->show_attractors); break; diff --git a/main.h b/main.h index 71b7bab..251a0c5 100644 --- a/main.h +++ b/main.h @@ -32,6 +32,7 @@ typedef struct { double parameter; int n_group_elements; int show_boxes; + int show_boxes2; int show_attractors; int show_reflectors; int show_limit; @@ -112,6 +113,7 @@ void drawBoxStd(DrawingContext *ctx, const char *word, char base); void drawReflectors(DrawingContext *ctx); void drawAttractors(DrawingContext *ctx); void drawBoxes(DrawingContext *ctx); +void drawBoxes2(DrawingContext *ctx); void drawLimitCurve(DrawingContext *ctx); void drawText(DrawingContext *ctx); void draw(DrawingContext *ctx);