diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-08 09:32:08 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-08 09:32:08 -0700 |
commit | 91439f3aff9250da0ea423a560fec53db83fa4e7 (patch) | |
tree | 321251eb13ab1731e70364d209f06a6b0bd93f06 | |
parent | 2d9ac73e380ea0863119ddca4c72ea4d96327465 (diff) | |
download | subsurface-91439f3aff9250da0ea423a560fec53db83fa4e7.tar.gz |
Show the min/max data in funky purple shading
Dirk likes purple. I mean - Dirk REALLY likes purple.
And what's better than "purple"? You got it: "funky purple".
So this shows the one- two- and three-minute min/max information in some
seriously funky purple fringing. It's not really necessarily meant to
be serious, but it's a quick hack to visualize the data until we figure
out what to *really* do with it.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | profile.c | 44 |
1 files changed, 44 insertions, 0 deletions
@@ -234,6 +234,47 @@ static void plot_depth_text(struct dive *dive, struct graphics_context *gc) plot_text_samples(gc, sample, end); } +static void plot_smoothed_profile(struct graphics_context *gc, struct plot_info *pi) +{ + int i; + struct plot_data *entry = pi->entry; + + cairo_set_source_rgba(gc->cr, 1, 0.2, 0.2, 0.20); + move_to(gc, entry->sec, entry->smoothed); + for (i = 1; i < pi->nr; i++) { + entry++; + line_to(gc, entry->sec, entry->smoothed); + } + cairo_stroke(gc->cr); +} + +static void plot_minmax_profile_minute(struct graphics_context *gc, struct plot_info *pi, + int index, double a) +{ + int i; + struct plot_data *entry = pi->entry; + + cairo_set_source_rgba(gc->cr, 1, 0.2, 1, a); + move_to(gc, entry->sec, entry->min[index]); + for (i = 1; i < pi->nr; i++) { + entry++; + line_to(gc, entry->sec, entry->min[index]); + } + for (i = 1; i < pi->nr; i++) { + line_to(gc, entry->sec, entry->max[index]); + entry--; + } + cairo_close_path(gc->cr); + cairo_fill(gc->cr); +} + +static void plot_minmax_profile(struct graphics_context *gc, struct plot_info *pi) +{ + plot_minmax_profile_minute(gc, pi, 2, 0.1); + plot_minmax_profile_minute(gc, pi, 1, 0.1); + plot_minmax_profile_minute(gc, pi, 0, 0.1); +} + static void plot_depth_profile(struct dive *dive, struct graphics_context *gc, struct plot_info *pi) { int i; @@ -279,6 +320,9 @@ static void plot_depth_profile(struct dive *dive, struct graphics_context *gc, s gc->scalex = maxtime; + plot_smoothed_profile(gc, pi); + plot_minmax_profile(gc, pi); + entry = pi->entry; cairo_set_source_rgba(cr, 1, 0.2, 0.2, 0.80); begins = entry->sec; |