bool Pattern_spectrum_timeline::display() { int hue = g_hue.get(); // Copy previous rows. int start_row = TIMELINE_DIRECTION > 0 ? 0 : ROW_COUNT - 1; int end_row = flip_y(start_row); for (int y = end_row; y != start_row; y -= TIMELINE_DIRECTION) { for (int x = 0; x < COLUMN_COUNT; ++x) { draw_pixel(x, y, get_pixel(x, y - TIMELINE_DIRECTION)); } } for (int x = 0; x < COLUMN_COUNT; ++x) { int lightness = g_bins[x] * g_brightness.get() / MAX_BRIGHTNESS; draw_pixel(x, start_row, make_hsv(hue, MAX_SATURATION, lightness)); } return true; }
/** Construct a color suitable for heat map display. * @param[in] v Heat value (0 = cold, 1 = hot) * @pre 0 <= @a v <= 1 * * The resulting color is a fully-saturated bright color ranging from * purple/blue for cold to red for hot. */ static Color make_heat(float v) { assert(0 <= v && v <= 1); return make_hsv(0.78f - 0.76f * v, 1, 1); }
/** Construct a color suitable for heat map display. * @param[in] v Heat value (0 = cold, 1 = hot) * @pre 0 <= @a v <= 1 * * The resulting color is a fully-saturated bright color ranging from * purple/blue for cold to red for hot. */ gil::rgb8_pixel_t make_heat(float v) { assert(0 <= v && v <= 1); return make_hsv(0.78f - 0.76f * v, 1, 1); }