aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorSamuel Fadel <samuel@nihil.ws>2023-06-04 18:47:27 +0200
committerSamuel Fadel <samuel@nihil.ws>2023-06-04 18:47:27 +0200
commitba028ae4dbbf93a461c9c9474889d04e640f64e0 (patch)
treed4af4d02403f706d10b1f9de901c899edd85c196 /main.cpp
parentfb23c8d47f6dcef429423256d8dddcc0f7184fc4 (diff)
More fixes to rendering, same as original except for point outlines.
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp25
1 files changed, 18 insertions, 7 deletions
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<float>(splat.width()),
- static_cast<float>(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<float>(splat.width());
+ region.h = static_cast<float>(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)) {