diff options
author | Thomas White <taw@physics.org> | 2020-04-01 15:31:21 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-07-29 18:42:57 +0200 |
commit | e342600debbbefb8c36e246f78a253e709be75a7 (patch) | |
tree | b8cc25fdb831f20e36ae0c037b049d19c91ebb41 | |
parent | 2a1419da3799a25a061e86849fd084ca397f6d09 (diff) |
Add brightness slider
This can be improved a lot...
-rw-r--r-- | src/crystfel_gui.c | 20 | ||||
-rw-r--r-- | src/crystfelimageview.c | 12 | ||||
-rw-r--r-- | src/crystfelimageview.h | 5 |
3 files changed, 36 insertions, 1 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c index 4a6b4d91..96b09d54 100644 --- a/src/crystfel_gui.c +++ b/src/crystfel_gui.c @@ -541,6 +541,15 @@ static void add_gui_message(enum log_msg_type type, const char *msg, } +static void brightness_changed_sig(GtkScaleButton *brightness, + double value, + struct crystfelproject *proj) +{ + crystfel_image_view_set_brightness(CRYSTFEL_IMAGE_VIEW(proj->imageview), + value); +} + + int main(int argc, char *argv[]) { int c; @@ -553,6 +562,7 @@ int main(int argc, char *argv[]) GtkWidget *main_vbox; GtkWidget *toolbar; GtkWidget *button; + GtkWidget *brightness; /* Long options */ const struct option longopts[] = { @@ -664,6 +674,16 @@ int main(int argc, char *argv[]) gtk_box_pack_start(GTK_BOX(toolbar), button, FALSE, FALSE, 0.0); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(last_frame_sig), &proj); + /* Image view parameters */ + const gchar *icons[] = {"weather-clear", NULL}; + brightness = gtk_scale_button_new(GTK_ICON_SIZE_LARGE_TOOLBAR, + 1.0, 10.0, 1.0, icons); + gtk_box_pack_end(GTK_BOX(toolbar), brightness, FALSE, FALSE, 0.0); + gtk_scale_button_set_value(GTK_SCALE_BUTTON(brightness), 1.0); + g_signal_connect(G_OBJECT(brightness), "value-changed", + G_CALLBACK(brightness_changed_sig), &proj); + + /* Filename */ proj.image_info = gtk_label_new("Ready to load images"); gtk_label_set_selectable(GTK_LABEL(proj.image_info), TRUE); gtk_label_set_ellipsize(GTK_LABEL(proj.image_info), diff --git a/src/crystfelimageview.c b/src/crystfelimageview.c index 27865b76..34073508 100644 --- a/src/crystfelimageview.c +++ b/src/crystfelimageview.c @@ -580,6 +580,7 @@ GtkWidget *crystfel_image_view_new() iv->image = NULL; iv->num_peaklists = 0; iv->peaklists = NULL; + iv->brightness = 1.0; g_signal_connect(G_OBJECT(iv), "destroy", G_CALLBACK(destroy_sig), iv); @@ -678,7 +679,8 @@ static int reload_image(CrystFELImageView *iv) return 1; } - iv->pixbufs = render_panels(iv->image, 1, SCALE_COLOUR, 5, &n_pb); + iv->pixbufs = render_panels(iv->image, 1, SCALE_COLOUR, + iv->brightness, &n_pb); if ( n_pb != iv->image->detgeom->n_panels ) { ERROR("Wrong number of panels returned!\n"); return 1; @@ -759,3 +761,11 @@ void crystfel_image_view_set_peaks(CrystFELImageView *iv, redraw(iv); } + + +void crystfel_image_view_set_brightness(CrystFELImageView *iv, + double brightness) +{ + iv->brightness = brightness; + reload_image(iv); +} diff --git a/src/crystfelimageview.h b/src/crystfelimageview.h index 5dc70f0f..4cfd3273 100644 --- a/src/crystfelimageview.h +++ b/src/crystfelimageview.h @@ -89,6 +89,8 @@ struct _crystfelimageview int num_peaklists; ImageFeatureList **peaklists; + + double brightness; }; struct _crystfelimageviewclass @@ -117,4 +119,7 @@ extern void crystfel_image_view_set_peaks(CrystFELImageView *iv, ImageFeatureList *peaks, int list_num); +extern void crystfel_image_view_set_brightness(CrystFELImageView *iv, + double brightness); + #endif /* CRYSTFELIMAGEVIEW_H */ |