changeset 1312:fcf0e7a6143e

Introduce helpers histogram_toggle_channel() and histogram_toggle_mode().
author zas_
date Mon, 23 Feb 2009 17:20:40 +0000
parents 024863909378
children 1ffa5222dc61
files src/histogram.c src/histogram.h src/image-overlay.c
diffstat 3 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/histogram.c	Sun Feb 22 17:46:42 2009 +0000
+++ b/src/histogram.c	Mon Feb 23 17:20:40 2009 +0000
@@ -97,6 +97,18 @@
 	return histogram->log_mode;
 }
 
+gint histogram_toggle_channel(Histogram *histogram)
+{
+	if (!histogram) return 0;
+	return histogram_set_channel(histogram, (histogram_get_channel(histogram)+1)%HCHAN_COUNT);
+}
+
+gint histogram_toggle_mode(Histogram *histogram)
+{
+	if (!histogram) return 0;
+	return histogram_set_mode(histogram, !histogram_get_mode(histogram));
+}
+
 const gchar *histogram_label(Histogram *histogram)
 {
 	const gchar *t1 = "";
--- a/src/histogram.h	Sun Feb 22 17:46:42 2009 +0000
+++ b/src/histogram.h	Mon Feb 23 17:20:40 2009 +0000
@@ -28,6 +28,8 @@
 gint histogram_get_channel(Histogram *histogram);
 gint histogram_set_mode(Histogram *histogram, gint mode);
 gint histogram_get_mode(Histogram *histogram);
+gint histogram_toggle_channel(Histogram *histogram);
+gint histogram_toggle_mode(Histogram *histogram);
 const gchar *histogram_label(Histogram *histogram);
 const HistMap *histmap_get(FileData *fd);
 gint histogram_draw(Histogram *histogram, const HistMap *histmap, GdkPixbuf *pixbuf, gint x, gint y, gint width, gint height);
--- a/src/image-overlay.c	Sun Feb 22 17:46:42 2009 +0000
+++ b/src/image-overlay.c	Mon Feb 23 17:20:40 2009 +0000
@@ -130,7 +130,7 @@
 
 	if (!osd || !osd->histogram) return;
 
-	histogram_set_channel(osd->histogram, (histogram_get_channel(osd->histogram) +1)%HCHAN_COUNT);
+	histogram_toggle_channel(osd->histogram);
 	image_osd_update(imd);
 }
 
@@ -140,7 +140,7 @@
 
 	if (!osd || !osd->histogram) return;
 
-	histogram_set_mode(osd->histogram, !histogram_get_mode(osd->histogram));
+	histogram_toggle_mode(osd->histogram);
 	image_osd_update(imd);
 }