changeset 1304:edeb07e1da5d

Move grid color setting to histogram_new().
author zas_
date Sat, 21 Feb 2009 10:53:18 +0000
parents 9669104eb58a
children 2abdd6e50120
files src/histogram.c
diffstat 1 files changed, 24 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/histogram.c	Sat Feb 21 10:33:56 2009 +0000
+++ b/src/histogram.c	Sat Feb 21 10:53:18 2009 +0000
@@ -39,10 +39,16 @@
 };
 
 struct _Histogram {
-	gint channel_mode;
-	gint log_mode;
+	gint channel_mode; /* drawing mode for histogram */
+	gint log_mode;     /* logarithmical or not */
 	guint vgrid; /* number of vertical divisions, 0 for none */
 	guint hgrid; /* number of horizontal divisions, 0 for none */
+	struct {
+		int R; /* red */
+		int G; /* green */
+		int B; /* blue */
+		int A; /* alpha */
+	} grid_color;  /* grid color */
 
 };
 
@@ -53,8 +59,14 @@
 	histogram = g_new0(Histogram, 1);
 	histogram->channel_mode = options->histogram.last_channel_mode;
 	histogram->log_mode = options->histogram.last_log_mode;
+
+	/* grid */
 	histogram->vgrid = 5;
 	histogram->hgrid = 3;
+	histogram->grid_color.R	= 160;
+	histogram->grid_color.G	= 160;
+	histogram->grid_color.B	= 160;
+	histogram->grid_color.A	= 250;
 
 	return histogram;
 }
@@ -172,8 +184,6 @@
 
 static void histogram_vgrid(Histogram *histogram, GdkPixbuf *pixbuf, gint x, gint y, gint width, gint height)
 {
-	static gint c = 160;
-	static gint alpha = 250;
 	guint i;
 	float add;
 	
@@ -185,14 +195,16 @@
 		{
 		gint xpos = x + (int)(i * add + 0.5);
 
-		pixbuf_draw_line(pixbuf, x, y, width, height, xpos, y, xpos, y + height, c, c, c, alpha);
+		pixbuf_draw_line(pixbuf, x, y, width, height, xpos, y, xpos, y + height,
+				 histogram->grid_color.R,
+				 histogram->grid_color.G,
+				 histogram->grid_color.B,
+				 histogram->grid_color.A);
 		}
 }
 
 static void histogram_hgrid(Histogram *histogram, GdkPixbuf *pixbuf, gint x, gint y, gint width, gint height)
 {
-	static gint c = 160;
-	static gint alpha = 250;
 	guint i;
 	float add;
 	
@@ -204,7 +216,11 @@
 		{
 		gint ypos = y + (int)(i * add + 0.5);
 	
-		pixbuf_draw_line(pixbuf, x, y, width, height, x, ypos, x + width, ypos, c, c, c, alpha);
+		pixbuf_draw_line(pixbuf, x, y, width, height, x, ypos, x + width, ypos,
+				 histogram->grid_color.R,
+				 histogram->grid_color.G,
+				 histogram->grid_color.B,
+				 histogram->grid_color.A);
 		}
 }