Revision: 1573
http://geeqie.svn.sourceforge.net/geeqie/?rev=1573&view=rev
Author: nadvornik
Date: 2009-03-26 07:56:01 +0000 (Thu, 26 Mar 2009)
Log Message:
-----------
fixed histogram drawing
Modified Paths:
--------------
trunk/src/histogram.c
trunk/src/histogram.h
Modified: trunk/src/histogram.c
===================================================================
--- trunk/src/histogram.c 2009-03-23 18:49:23 UTC (rev 1572)
+++ trunk/src/histogram.c 2009-03-26 07:56:01 UTC (rev 1573)
@@ -280,11 +280,13 @@
histogram_vgrid(histogram, pixbuf, x, y, width, height);
histogram_hgrid(histogram, pixbuf, x, y, width, height);
- for (i = 0; i < HISTMAP_SIZE; i++)
+ /* exclude overexposed and underexposed */
+ for (i = 1; i < HISTMAP_SIZE - 1; i++)
{
if (histmap->r[i] > max) max = histmap->r[i];
if (histmap->g[i] > max) max = histmap->g[i];
if (histmap->b[i] > max) max = histmap->b[i];
+ if (histmap->max[i] > max) max = histmap->max[i];
}
if (max > 0)
@@ -301,6 +303,7 @@
gint bplus = 0;
gint ii = i * HISTMAP_SIZE / width;
gint xpos = x + i;
+ gint num_chan;
for (j = 0; j < combine; j++)
{
@@ -314,15 +317,21 @@
for (j = 0; combine > 1 && j < 4; j++)
v[j] /= combine;
- for (j = 0; j < 4; j++)
+ num_chan = (histogram->histogram_channel == HCHAN_RGB) ? 3 : 1;
+ for (j = 0; j < num_chan; j++)
{
- gint chanmax = HCHAN_R;
-
- if (v[HCHAN_G] > v[HCHAN_R]) chanmax = HCHAN_G;
- if (v[HCHAN_B] > v[HCHAN_G]) chanmax = HCHAN_B;
-
- if (histogram->histogram_channel >= HCHAN_RGB
- || chanmax == histogram->histogram_channel)
+ gint chanmax;
+ if (histogram->histogram_channel == HCHAN_RGB)
+ {
+ chanmax = HCHAN_R;
+ if (v[HCHAN_G] > v[HCHAN_R]) chanmax = HCHAN_G;
+ if (v[HCHAN_B] > v[chanmax]) chanmax = HCHAN_B;
+ }
+ else
+ {
+ chanmax = histogram->histogram_channel;
+ }
+
{
gulong pt;
gint r = rplus;
Modified: trunk/src/histogram.h
===================================================================
--- trunk/src/histogram.h 2009-03-23 18:49:23 UTC (rev 1572)
+++ trunk/src/histogram.h 2009-03-26 07:56:01 UTC (rev 1573)
@@ -17,9 +17,9 @@
#define HCHAN_R 0
#define HCHAN_G 1
#define HCHAN_B 2
-#define HCHAN_RGB 3
-#define HCHAN_MAX 4
-#define HCHAN_COUNT (HCHAN_MAX+1)
+#define HCHAN_MAX 3
+#define HCHAN_RGB 4
+#define HCHAN_COUNT 5
Histogram *histogram_new(void);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn