|
|
@ -70,8 +70,8 @@ void cb_histogramda_draw(GtkWidget *area, cairo_t *cr, int w, int h, gpointer da
|
|
|
|
|
|
|
|
|
|
|
|
int histogram_width = histogram_zoom_stop - histogram_zoom_start;
|
|
|
|
int histogram_width = histogram_zoom_stop - histogram_zoom_start;
|
|
|
|
for (int i = 0; i < histogram_width; i++) {
|
|
|
|
for (int i = 0; i < histogram_width; i++) {
|
|
|
|
px = HISTOGRAM_MARGIN + ((clientw-HISTOGRAM_MARGIN*2) * i) / histogram_width;
|
|
|
|
px = HISTOGRAM_MARGIN + ((clientw-HISTOGRAM_MARGIN*2) * i) / histogram_width;
|
|
|
|
py2 = (clienth-HISTOGRAM_MARGIN) - ((clienth-HISTOGRAM_MARGIN*2) * histogram[chan][histogram_zoom_start+i]) / histogram_max;
|
|
|
|
py2 = (clienth-HISTOGRAM_MARGIN) - ((clienth-HISTOGRAM_MARGIN*2) * log10(histogram[chan][histogram_zoom_start+i]+1) / log10(histogram_max));
|
|
|
|
|
|
|
|
|
|
|
|
if (i == 0) cairo_move_to(cr, px, py2);
|
|
|
|
if (i == 0) cairo_move_to(cr, px, py2);
|
|
|
|
else cairo_line_to(cr, px, py2);
|
|
|
|
else cairo_line_to(cr, px, py2);
|
|
|
@ -202,13 +202,13 @@ void cb_histogramda_btnrelease (GtkWidget *widget, gpointer data) {
|
|
|
|
// translate first coordinate
|
|
|
|
// translate first coordinate
|
|
|
|
histogram_zoom_start = (histogram_pressed_x - HISTOGRAM_MARGIN) * HISTOGRAM_WIDTH / (clientw - HISTOGRAM_MARGIN*2);
|
|
|
|
histogram_zoom_start = (histogram_pressed_x - HISTOGRAM_MARGIN) * HISTOGRAM_WIDTH / (clientw - HISTOGRAM_MARGIN*2);
|
|
|
|
if (histogram_zoom_start < 0) histogram_zoom_start = 0;
|
|
|
|
if (histogram_zoom_start < 0) histogram_zoom_start = 0;
|
|
|
|
if (histogram_zoom_start > 256) histogram_zoom_start = 256;
|
|
|
|
if (histogram_zoom_start > HISTOGRAM_WIDTH) histogram_zoom_start = HISTOGRAM_WIDTH;
|
|
|
|
|
|
|
|
|
|
|
|
// translate second coordinate
|
|
|
|
// translate second coordinate
|
|
|
|
histogram_zoom_stop = (histogram_released_x - HISTOGRAM_MARGIN) * HISTOGRAM_WIDTH / (clientw - HISTOGRAM_MARGIN*2) + 1;
|
|
|
|
histogram_zoom_stop = (histogram_released_x - HISTOGRAM_MARGIN) * HISTOGRAM_WIDTH / (clientw - HISTOGRAM_MARGIN*2) + 1;
|
|
|
|
// limit the values
|
|
|
|
// limit the values
|
|
|
|
if (histogram_zoom_stop < 0) histogram_zoom_stop = 0;
|
|
|
|
if (histogram_zoom_stop < 0) histogram_zoom_stop = 0;
|
|
|
|
if (histogram_zoom_stop > 256) histogram_zoom_stop = 256;
|
|
|
|
if (histogram_zoom_stop > HISTOGRAM_WIDTH) histogram_zoom_stop = HISTOGRAM_WIDTH;
|
|
|
|
|
|
|
|
|
|
|
|
// exchange the values if necessary
|
|
|
|
// exchange the values if necessary
|
|
|
|
if (histogram_zoom_start > histogram_zoom_stop) {
|
|
|
|
if (histogram_zoom_start > histogram_zoom_stop) {
|
|
|
|