From ba028ae4dbbf93a461c9c9474889d04e640f64e0 Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Sun, 4 Jun 2023 18:47:27 +0200 Subject: More fixes to rendering, same as original except for point outlines. --- main.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 17c6597..0d5d8ab 100644 --- a/main.cpp +++ b/main.cpp @@ -718,6 +718,8 @@ int main(int argc, char *argv[]) // Visual components Colormap cpColormap, rpColormap; + // cpColormap.setOrientation(Colormap::Vertical); + // rpColormap.setOrientation(Colormap::Vertical); Scatterplot cpPlot, rpPlot; VoronoiSplat splat; cpPlot.setSize(512, 512); @@ -1197,22 +1199,29 @@ int main(int argc, char *argv[]) } nk_end(&ctx); + struct nk_style *s = &ctx.style; + nk_style_push_color(&ctx, &s->window.background, nk_rgba(0, 0, 0, 0)); + nk_style_push_style_item(&ctx, &s->window.fixed_background, + nk_style_item_color(nk_rgba(0,0,0,0))); if (nk_begin(&ctx, "Scatterplot", nk_rect(20, 20, splat.width(), splat.height()), - NK_WINDOW_BORDER | NK_WINDOW_NO_SCROLLBAR)) { - struct nk_command_buffer *canvas = nk_window_get_canvas(&ctx); - struct nk_rect region{0.0f, 0.0f, - static_cast(splat.width()), - static_cast(splat.height())}; - + NK_WINDOW_NO_SCROLLBAR)) { // Render components to their textures splat.draw(); rpPlot.draw(); cpPlot.draw(); + nk_layout_space_begin(&ctx, NK_STATIC, splat.height(), 4); + struct nk_rect region = nk_layout_space_bounds(&ctx); + // Add white background rect and draw textures on top - nk_layout_space_begin(&ctx, NK_STATIC, region.h, 4); nk_layout_space_push(&ctx, region); + struct nk_command_buffer *canvas = nk_window_get_canvas(&ctx); nk_fill_rect(canvas, region, 0.0f, nk_rgba(255, 255, 255, 255)); + + // Rest uses custom region + region.x = region.y = 0.0f; + region.w = static_cast(splat.width()); + region.h = static_cast(splat.height()); nk_layout_space_push(&ctx, region); nk_image(&ctx, splat_img); nk_layout_space_push(&ctx, region); @@ -1222,6 +1231,8 @@ int main(int argc, char *argv[]) nk_layout_space_end(&ctx); } nk_end(&ctx); + nk_style_pop_color(&ctx); + nk_style_pop_style_item(&ctx); if (nk_begin(&ctx, "Colormap", nk_rect(20, 40 + splat.height(), splat.width(), 120), NK_WINDOW_BORDER | NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR)) { -- cgit v1.2.3