mirror of https://github.com/GNOME/gimp.git
get rid of compiler warnings
* app/channel.c: get rid of compiler warnings * app/histogram_tool.c * app/histogram_tool.h: added a gradient below the histogram so it looks more like the curves and levels tool * app/gimpbrushpipe.c * libgimp/parasiteio.c * libgimp/parasiteio.h: plugged another mem-leaks. At least The GIMP now starts without leaking memory... --Sven
This commit is contained in:
parent
aa2358fb26
commit
8498428592
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
Thu Nov 4 20:46:25 MET 1999 Sven Neumann <sven.gimp.org>
|
||||
|
||||
* app/channel.c: get rid of compiler warnings
|
||||
|
||||
* app/histogram_tool.c
|
||||
* app/histogram_tool.h: added a gradient below the histogram so
|
||||
it looks more like the curves and levels tool
|
||||
|
||||
* app/gimpbrushpipe.c
|
||||
* libgimp/parasiteio.c
|
||||
* libgimp/parasiteio.h: plugged another mem-leaks. At least
|
||||
The GIMP now starts without leaking memory...
|
||||
|
||||
Thu Nov 4 00:59:01 MET 1999 Sven Neumann <sven.gimp.org>
|
||||
|
||||
* app/file_new_dialog.c
|
||||
|
|
|
@ -103,12 +103,6 @@ gimp_channel_init (GimpChannel *channel)
|
|||
{
|
||||
}
|
||||
|
||||
/**********************/
|
||||
/* Static variables */
|
||||
/**********************/
|
||||
|
||||
static gint channel_get_count = 0;
|
||||
|
||||
/**************************/
|
||||
/* Function definitions */
|
||||
/**************************/
|
||||
|
@ -1064,6 +1058,9 @@ channel_combine_ellipse (Channel *mask,
|
|||
case SUB :
|
||||
channel_sub_segment (mask, x1, i, (x2 - x1), 255);
|
||||
break;
|
||||
default:
|
||||
g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* antialiasing */
|
||||
|
@ -1104,6 +1101,9 @@ channel_combine_ellipse (Channel *mask,
|
|||
case SUB:
|
||||
channel_sub_segment (mask, x0, i, j - x0, last);
|
||||
break;
|
||||
default:
|
||||
g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1124,6 +1124,8 @@ channel_combine_ellipse (Channel *mask,
|
|||
channel_add_segment (mask, x0, i, j - x0, last);
|
||||
else if (op == SUB)
|
||||
channel_sub_segment (mask, x0, i, j - x0, last);
|
||||
else
|
||||
g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ static void paint_line_pixmap_mask(GImage *dest,
|
|||
int width,
|
||||
int mode);
|
||||
|
||||
|
||||
static void
|
||||
gimp_brush_pixmap_destroy (GtkObject *object)
|
||||
{
|
||||
|
@ -324,6 +325,9 @@ gimp_brush_pipe_load (char *filename)
|
|||
pipe->rank = g_new (int, pipe->dimension);
|
||||
pipe->select = g_new (PipeSelectModes, pipe->dimension);
|
||||
pipe->index = g_new (int, pipe->dimension);
|
||||
/* placement is not used at all ?? */
|
||||
if (params.free_placement_string)
|
||||
g_free (params.placement);
|
||||
for (i = 0; i < pipe->dimension; i++)
|
||||
{
|
||||
pipe->rank[i] = params.rank[i];
|
||||
|
@ -343,6 +347,8 @@ gimp_brush_pipe_load (char *filename)
|
|||
pipe->select[i] = PIPE_SELECT_TILT_Y;
|
||||
else
|
||||
pipe->select[i] = PIPE_SELECT_CONSTANT;
|
||||
if (params.free_selection_string)
|
||||
g_free (params.selection[i]);
|
||||
pipe->index[i] = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ static void paint_line_pixmap_mask(GImage *dest,
|
|||
int width,
|
||||
int mode);
|
||||
|
||||
|
||||
static void
|
||||
gimp_brush_pixmap_destroy (GtkObject *object)
|
||||
{
|
||||
|
@ -324,6 +325,9 @@ gimp_brush_pipe_load (char *filename)
|
|||
pipe->rank = g_new (int, pipe->dimension);
|
||||
pipe->select = g_new (PipeSelectModes, pipe->dimension);
|
||||
pipe->index = g_new (int, pipe->dimension);
|
||||
/* placement is not used at all ?? */
|
||||
if (params.free_placement_string)
|
||||
g_free (params.placement);
|
||||
for (i = 0; i < pipe->dimension; i++)
|
||||
{
|
||||
pipe->rank[i] = params.rank[i];
|
||||
|
@ -343,6 +347,8 @@ gimp_brush_pipe_load (char *filename)
|
|||
pipe->select[i] = PIPE_SELECT_TILT_Y;
|
||||
else
|
||||
pipe->select[i] = PIPE_SELECT_CONSTANT;
|
||||
if (params.free_selection_string)
|
||||
g_free (params.selection[i]);
|
||||
pipe->index[i] = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,12 +103,6 @@ gimp_channel_init (GimpChannel *channel)
|
|||
{
|
||||
}
|
||||
|
||||
/**********************/
|
||||
/* Static variables */
|
||||
/**********************/
|
||||
|
||||
static gint channel_get_count = 0;
|
||||
|
||||
/**************************/
|
||||
/* Function definitions */
|
||||
/**************************/
|
||||
|
@ -1064,6 +1058,9 @@ channel_combine_ellipse (Channel *mask,
|
|||
case SUB :
|
||||
channel_sub_segment (mask, x1, i, (x2 - x1), 255);
|
||||
break;
|
||||
default:
|
||||
g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* antialiasing */
|
||||
|
@ -1104,6 +1101,9 @@ channel_combine_ellipse (Channel *mask,
|
|||
case SUB:
|
||||
channel_sub_segment (mask, x0, i, j - x0, last);
|
||||
break;
|
||||
default:
|
||||
g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1124,6 +1124,8 @@ channel_combine_ellipse (Channel *mask,
|
|||
channel_add_segment (mask, x0, i, j - x0, last);
|
||||
else if (op == SUB)
|
||||
channel_sub_segment (mask, x0, i, j - x0, last);
|
||||
else
|
||||
g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -103,12 +103,6 @@ gimp_channel_init (GimpChannel *channel)
|
|||
{
|
||||
}
|
||||
|
||||
/**********************/
|
||||
/* Static variables */
|
||||
/**********************/
|
||||
|
||||
static gint channel_get_count = 0;
|
||||
|
||||
/**************************/
|
||||
/* Function definitions */
|
||||
/**************************/
|
||||
|
@ -1064,6 +1058,9 @@ channel_combine_ellipse (Channel *mask,
|
|||
case SUB :
|
||||
channel_sub_segment (mask, x1, i, (x2 - x1), 255);
|
||||
break;
|
||||
default:
|
||||
g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* antialiasing */
|
||||
|
@ -1104,6 +1101,9 @@ channel_combine_ellipse (Channel *mask,
|
|||
case SUB:
|
||||
channel_sub_segment (mask, x0, i, j - x0, last);
|
||||
break;
|
||||
default:
|
||||
g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1124,6 +1124,8 @@ channel_combine_ellipse (Channel *mask,
|
|||
channel_add_segment (mask, x0, i, j - x0, last);
|
||||
else if (op == SUB)
|
||||
channel_sub_segment (mask, x0, i, j - x0, last);
|
||||
else
|
||||
g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ static void paint_line_pixmap_mask(GImage *dest,
|
|||
int width,
|
||||
int mode);
|
||||
|
||||
|
||||
static void
|
||||
gimp_brush_pixmap_destroy (GtkObject *object)
|
||||
{
|
||||
|
@ -324,6 +325,9 @@ gimp_brush_pipe_load (char *filename)
|
|||
pipe->rank = g_new (int, pipe->dimension);
|
||||
pipe->select = g_new (PipeSelectModes, pipe->dimension);
|
||||
pipe->index = g_new (int, pipe->dimension);
|
||||
/* placement is not used at all ?? */
|
||||
if (params.free_placement_string)
|
||||
g_free (params.placement);
|
||||
for (i = 0; i < pipe->dimension; i++)
|
||||
{
|
||||
pipe->rank[i] = params.rank[i];
|
||||
|
@ -343,6 +347,8 @@ gimp_brush_pipe_load (char *filename)
|
|||
pipe->select[i] = PIPE_SELECT_TILT_Y;
|
||||
else
|
||||
pipe->select[i] = PIPE_SELECT_CONSTANT;
|
||||
if (params.free_selection_string)
|
||||
g_free (params.selection[i]);
|
||||
pipe->index[i] = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,12 +103,6 @@ gimp_channel_init (GimpChannel *channel)
|
|||
{
|
||||
}
|
||||
|
||||
/**********************/
|
||||
/* Static variables */
|
||||
/**********************/
|
||||
|
||||
static gint channel_get_count = 0;
|
||||
|
||||
/**************************/
|
||||
/* Function definitions */
|
||||
/**************************/
|
||||
|
@ -1064,6 +1058,9 @@ channel_combine_ellipse (Channel *mask,
|
|||
case SUB :
|
||||
channel_sub_segment (mask, x1, i, (x2 - x1), 255);
|
||||
break;
|
||||
default:
|
||||
g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* antialiasing */
|
||||
|
@ -1104,6 +1101,9 @@ channel_combine_ellipse (Channel *mask,
|
|||
case SUB:
|
||||
channel_sub_segment (mask, x0, i, j - x0, last);
|
||||
break;
|
||||
default:
|
||||
g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1124,6 +1124,8 @@ channel_combine_ellipse (Channel *mask,
|
|||
channel_add_segment (mask, x0, i, j - x0, last);
|
||||
else if (op == SUB)
|
||||
channel_sub_segment (mask, x0, i, j - x0, last);
|
||||
else
|
||||
g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#define TEXT_WIDTH 45
|
||||
#define TEXT_WIDTH 45
|
||||
#define GRADIENT_HEIGHT 15
|
||||
|
||||
/* the histogram structures */
|
||||
|
||||
|
@ -57,6 +58,7 @@ static void histogram_tool_value_callback (GtkWidget *, gpointer);
|
|||
static void histogram_tool_red_callback (GtkWidget *, gpointer);
|
||||
static void histogram_tool_green_callback (GtkWidget *, gpointer);
|
||||
static void histogram_tool_blue_callback (GtkWidget *, gpointer);
|
||||
static void histogram_tool_gradient_draw (GtkWidget *, gint);
|
||||
|
||||
static void histogram_tool_dialog_update (HistogramToolDialog *, gint, gint);
|
||||
|
||||
|
@ -332,6 +334,15 @@ histogram_tool_new_dialog ()
|
|||
gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET(htd->histogram));
|
||||
gtk_widget_show (GTK_WIDGET(htd->histogram));
|
||||
gtk_widget_show (frame);
|
||||
|
||||
/* The gradient below the histogram */
|
||||
htd->gradient = gtk_preview_new (GTK_PREVIEW_COLOR);
|
||||
gtk_preview_size (GTK_PREVIEW (htd->gradient),
|
||||
HISTOGRAM_WIDTH, GRADIENT_HEIGHT);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), htd->gradient, FALSE, FALSE, 0);
|
||||
gtk_widget_show (htd->gradient);
|
||||
histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_VALUE);
|
||||
|
||||
gtk_widget_show (vbox2);
|
||||
|
||||
/* The table containing histogram information */
|
||||
|
@ -390,6 +401,7 @@ histogram_tool_value_callback (GtkWidget *widget,
|
|||
{
|
||||
htd->channel = HISTOGRAM_VALUE;
|
||||
histogram_widget_channel (htd->histogram, htd->channel);
|
||||
histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,6 +417,7 @@ histogram_tool_red_callback (GtkWidget *widget,
|
|||
{
|
||||
htd->channel = HISTOGRAM_RED;
|
||||
histogram_widget_channel (htd->histogram, htd->channel);
|
||||
histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_RED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -420,6 +433,7 @@ histogram_tool_green_callback (GtkWidget *widget,
|
|||
{
|
||||
htd->channel = HISTOGRAM_GREEN;
|
||||
histogram_widget_channel (htd->histogram, htd->channel);
|
||||
histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_GREEN);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -435,5 +449,47 @@ histogram_tool_blue_callback (GtkWidget *widget,
|
|||
{
|
||||
htd->channel = HISTOGRAM_BLUE;
|
||||
histogram_widget_channel (htd->histogram, htd->channel);
|
||||
histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_BLUE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
histogram_tool_gradient_draw (GtkWidget *gradient,
|
||||
gint channel)
|
||||
{
|
||||
guchar buf[HISTOGRAM_WIDTH * 3];
|
||||
guchar r, g, b;
|
||||
gint i;
|
||||
|
||||
r = g = b = 0;
|
||||
switch (channel)
|
||||
{
|
||||
case HISTOGRAM_VALUE:
|
||||
case HISTOGRAM_ALPHA: r = g = b = 1;
|
||||
break;
|
||||
case HISTOGRAM_RED: r = 1;
|
||||
break;
|
||||
case HISTOGRAM_GREEN: g = 1;
|
||||
break;
|
||||
case HISTOGRAM_BLUE: b = 1;
|
||||
break;
|
||||
default:
|
||||
g_warning ("unknown channel type, can't happen\n");
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; i < HISTOGRAM_WIDTH; i++)
|
||||
{
|
||||
buf[3*i+0] = i*r;
|
||||
buf[3*i+1] = i*g;
|
||||
buf[3*i+2] = i*b;
|
||||
}
|
||||
|
||||
for (i = 0; i < GRADIENT_HEIGHT; i++)
|
||||
gtk_preview_draw_row (GTK_PREVIEW (gradient),
|
||||
buf, 0, i, HISTOGRAM_WIDTH);
|
||||
|
||||
gtk_widget_queue_draw (gradient);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ struct _HistogramToolDialog
|
|||
GtkWidget *channel_menu;
|
||||
HistogramWidget *histogram;
|
||||
GimpHistogram *hist;
|
||||
GtkWidget *gradient;
|
||||
|
||||
gdouble mean;
|
||||
gdouble std_dev;
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#define TEXT_WIDTH 45
|
||||
#define TEXT_WIDTH 45
|
||||
#define GRADIENT_HEIGHT 15
|
||||
|
||||
/* the histogram structures */
|
||||
|
||||
|
@ -57,6 +58,7 @@ static void histogram_tool_value_callback (GtkWidget *, gpointer);
|
|||
static void histogram_tool_red_callback (GtkWidget *, gpointer);
|
||||
static void histogram_tool_green_callback (GtkWidget *, gpointer);
|
||||
static void histogram_tool_blue_callback (GtkWidget *, gpointer);
|
||||
static void histogram_tool_gradient_draw (GtkWidget *, gint);
|
||||
|
||||
static void histogram_tool_dialog_update (HistogramToolDialog *, gint, gint);
|
||||
|
||||
|
@ -332,6 +334,15 @@ histogram_tool_new_dialog ()
|
|||
gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET(htd->histogram));
|
||||
gtk_widget_show (GTK_WIDGET(htd->histogram));
|
||||
gtk_widget_show (frame);
|
||||
|
||||
/* The gradient below the histogram */
|
||||
htd->gradient = gtk_preview_new (GTK_PREVIEW_COLOR);
|
||||
gtk_preview_size (GTK_PREVIEW (htd->gradient),
|
||||
HISTOGRAM_WIDTH, GRADIENT_HEIGHT);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), htd->gradient, FALSE, FALSE, 0);
|
||||
gtk_widget_show (htd->gradient);
|
||||
histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_VALUE);
|
||||
|
||||
gtk_widget_show (vbox2);
|
||||
|
||||
/* The table containing histogram information */
|
||||
|
@ -390,6 +401,7 @@ histogram_tool_value_callback (GtkWidget *widget,
|
|||
{
|
||||
htd->channel = HISTOGRAM_VALUE;
|
||||
histogram_widget_channel (htd->histogram, htd->channel);
|
||||
histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,6 +417,7 @@ histogram_tool_red_callback (GtkWidget *widget,
|
|||
{
|
||||
htd->channel = HISTOGRAM_RED;
|
||||
histogram_widget_channel (htd->histogram, htd->channel);
|
||||
histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_RED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -420,6 +433,7 @@ histogram_tool_green_callback (GtkWidget *widget,
|
|||
{
|
||||
htd->channel = HISTOGRAM_GREEN;
|
||||
histogram_widget_channel (htd->histogram, htd->channel);
|
||||
histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_GREEN);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -435,5 +449,47 @@ histogram_tool_blue_callback (GtkWidget *widget,
|
|||
{
|
||||
htd->channel = HISTOGRAM_BLUE;
|
||||
histogram_widget_channel (htd->histogram, htd->channel);
|
||||
histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_BLUE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
histogram_tool_gradient_draw (GtkWidget *gradient,
|
||||
gint channel)
|
||||
{
|
||||
guchar buf[HISTOGRAM_WIDTH * 3];
|
||||
guchar r, g, b;
|
||||
gint i;
|
||||
|
||||
r = g = b = 0;
|
||||
switch (channel)
|
||||
{
|
||||
case HISTOGRAM_VALUE:
|
||||
case HISTOGRAM_ALPHA: r = g = b = 1;
|
||||
break;
|
||||
case HISTOGRAM_RED: r = 1;
|
||||
break;
|
||||
case HISTOGRAM_GREEN: g = 1;
|
||||
break;
|
||||
case HISTOGRAM_BLUE: b = 1;
|
||||
break;
|
||||
default:
|
||||
g_warning ("unknown channel type, can't happen\n");
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; i < HISTOGRAM_WIDTH; i++)
|
||||
{
|
||||
buf[3*i+0] = i*r;
|
||||
buf[3*i+1] = i*g;
|
||||
buf[3*i+2] = i*b;
|
||||
}
|
||||
|
||||
for (i = 0; i < GRADIENT_HEIGHT; i++)
|
||||
gtk_preview_draw_row (GTK_PREVIEW (gradient),
|
||||
buf, 0, i, HISTOGRAM_WIDTH);
|
||||
|
||||
gtk_widget_queue_draw (gradient);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ struct _HistogramToolDialog
|
|||
GtkWidget *channel_menu;
|
||||
HistogramWidget *histogram;
|
||||
GimpHistogram *hist;
|
||||
GtkWidget *gradient;
|
||||
|
||||
gdouble mean;
|
||||
gdouble std_dev;
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#define TEXT_WIDTH 45
|
||||
#define TEXT_WIDTH 45
|
||||
#define GRADIENT_HEIGHT 15
|
||||
|
||||
/* the histogram structures */
|
||||
|
||||
|
@ -57,6 +58,7 @@ static void histogram_tool_value_callback (GtkWidget *, gpointer);
|
|||
static void histogram_tool_red_callback (GtkWidget *, gpointer);
|
||||
static void histogram_tool_green_callback (GtkWidget *, gpointer);
|
||||
static void histogram_tool_blue_callback (GtkWidget *, gpointer);
|
||||
static void histogram_tool_gradient_draw (GtkWidget *, gint);
|
||||
|
||||
static void histogram_tool_dialog_update (HistogramToolDialog *, gint, gint);
|
||||
|
||||
|
@ -332,6 +334,15 @@ histogram_tool_new_dialog ()
|
|||
gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET(htd->histogram));
|
||||
gtk_widget_show (GTK_WIDGET(htd->histogram));
|
||||
gtk_widget_show (frame);
|
||||
|
||||
/* The gradient below the histogram */
|
||||
htd->gradient = gtk_preview_new (GTK_PREVIEW_COLOR);
|
||||
gtk_preview_size (GTK_PREVIEW (htd->gradient),
|
||||
HISTOGRAM_WIDTH, GRADIENT_HEIGHT);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), htd->gradient, FALSE, FALSE, 0);
|
||||
gtk_widget_show (htd->gradient);
|
||||
histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_VALUE);
|
||||
|
||||
gtk_widget_show (vbox2);
|
||||
|
||||
/* The table containing histogram information */
|
||||
|
@ -390,6 +401,7 @@ histogram_tool_value_callback (GtkWidget *widget,
|
|||
{
|
||||
htd->channel = HISTOGRAM_VALUE;
|
||||
histogram_widget_channel (htd->histogram, htd->channel);
|
||||
histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,6 +417,7 @@ histogram_tool_red_callback (GtkWidget *widget,
|
|||
{
|
||||
htd->channel = HISTOGRAM_RED;
|
||||
histogram_widget_channel (htd->histogram, htd->channel);
|
||||
histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_RED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -420,6 +433,7 @@ histogram_tool_green_callback (GtkWidget *widget,
|
|||
{
|
||||
htd->channel = HISTOGRAM_GREEN;
|
||||
histogram_widget_channel (htd->histogram, htd->channel);
|
||||
histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_GREEN);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -435,5 +449,47 @@ histogram_tool_blue_callback (GtkWidget *widget,
|
|||
{
|
||||
htd->channel = HISTOGRAM_BLUE;
|
||||
histogram_widget_channel (htd->histogram, htd->channel);
|
||||
histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_BLUE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
histogram_tool_gradient_draw (GtkWidget *gradient,
|
||||
gint channel)
|
||||
{
|
||||
guchar buf[HISTOGRAM_WIDTH * 3];
|
||||
guchar r, g, b;
|
||||
gint i;
|
||||
|
||||
r = g = b = 0;
|
||||
switch (channel)
|
||||
{
|
||||
case HISTOGRAM_VALUE:
|
||||
case HISTOGRAM_ALPHA: r = g = b = 1;
|
||||
break;
|
||||
case HISTOGRAM_RED: r = 1;
|
||||
break;
|
||||
case HISTOGRAM_GREEN: g = 1;
|
||||
break;
|
||||
case HISTOGRAM_BLUE: b = 1;
|
||||
break;
|
||||
default:
|
||||
g_warning ("unknown channel type, can't happen\n");
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; i < HISTOGRAM_WIDTH; i++)
|
||||
{
|
||||
buf[3*i+0] = i*r;
|
||||
buf[3*i+1] = i*g;
|
||||
buf[3*i+2] = i*b;
|
||||
}
|
||||
|
||||
for (i = 0; i < GRADIENT_HEIGHT; i++)
|
||||
gtk_preview_draw_row (GTK_PREVIEW (gradient),
|
||||
buf, 0, i, HISTOGRAM_WIDTH);
|
||||
|
||||
gtk_widget_queue_draw (gradient);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ struct _HistogramToolDialog
|
|||
GtkWidget *channel_menu;
|
||||
HistogramWidget *histogram;
|
||||
GimpHistogram *hist;
|
||||
GtkWidget *gradient;
|
||||
|
||||
gdouble mean;
|
||||
gdouble std_dev;
|
||||
|
|
|
@ -41,8 +41,12 @@ pixpipeparams_init (PixPipeParams *params)
|
|||
params->cols = 1;
|
||||
params->rows = 1;
|
||||
params->placement = "constant";
|
||||
params->free_placement_string = FALSE;
|
||||
for (i = 0; i < PIXPIPE_MAXDIM; i++)
|
||||
params->selection[i] = "random";
|
||||
{
|
||||
params->selection[i] = "random";
|
||||
params->free_selection_string = FALSE;
|
||||
}
|
||||
params->rank[0] = 1;
|
||||
for (i = 1; i < PIXPIPE_MAXDIM; i++)
|
||||
params->rank[i] = 0;
|
||||
|
@ -53,7 +57,7 @@ pixpipeparams_parse (gchar *string,
|
|||
PixPipeParams *params)
|
||||
{
|
||||
guchar *p, *q, *r; /* Don't you love single-char identifiers? */
|
||||
gint i;
|
||||
gint i; /* No, we don't!! <Sven> */
|
||||
|
||||
q = string;
|
||||
while ((p = strtok (q, " \r\n")) != NULL)
|
||||
|
@ -101,7 +105,10 @@ pixpipeparams_parse (gchar *string,
|
|||
else if (strcmp (p, "placement") == 0)
|
||||
{
|
||||
if (r)
|
||||
params->placement = g_strdup (r + 1);
|
||||
{
|
||||
params->placement = g_strdup (r + 1);
|
||||
params->free_placement_string = TRUE;
|
||||
}
|
||||
}
|
||||
else if (strncmp (p, "rank", strlen ("rank")) == 0 && r)
|
||||
{
|
||||
|
@ -118,7 +125,10 @@ pixpipeparams_parse (gchar *string,
|
|||
{
|
||||
i = atoi (p + strlen ("sel"));
|
||||
if (i >= 0 && i < params->dim)
|
||||
params->selection[i] = g_strdup (r + 1);
|
||||
{
|
||||
params->selection[i] = g_strdup (r + 1);
|
||||
params->free_selection_string = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (r)
|
||||
|
|
|
@ -40,8 +40,10 @@ typedef struct {
|
|||
gint cellwidth;
|
||||
gint cellheight;
|
||||
gchar *placement;
|
||||
gboolean free_placement_string;
|
||||
gint rank[PIXPIPE_MAXDIM];
|
||||
gchar *selection[PIXPIPE_MAXDIM];
|
||||
gboolean free_selection_string;
|
||||
} PixPipeParams;
|
||||
|
||||
/* Initalize with dummy values */
|
||||
|
|
|
@ -41,8 +41,12 @@ pixpipeparams_init (PixPipeParams *params)
|
|||
params->cols = 1;
|
||||
params->rows = 1;
|
||||
params->placement = "constant";
|
||||
params->free_placement_string = FALSE;
|
||||
for (i = 0; i < PIXPIPE_MAXDIM; i++)
|
||||
params->selection[i] = "random";
|
||||
{
|
||||
params->selection[i] = "random";
|
||||
params->free_selection_string = FALSE;
|
||||
}
|
||||
params->rank[0] = 1;
|
||||
for (i = 1; i < PIXPIPE_MAXDIM; i++)
|
||||
params->rank[i] = 0;
|
||||
|
@ -53,7 +57,7 @@ pixpipeparams_parse (gchar *string,
|
|||
PixPipeParams *params)
|
||||
{
|
||||
guchar *p, *q, *r; /* Don't you love single-char identifiers? */
|
||||
gint i;
|
||||
gint i; /* No, we don't!! <Sven> */
|
||||
|
||||
q = string;
|
||||
while ((p = strtok (q, " \r\n")) != NULL)
|
||||
|
@ -101,7 +105,10 @@ pixpipeparams_parse (gchar *string,
|
|||
else if (strcmp (p, "placement") == 0)
|
||||
{
|
||||
if (r)
|
||||
params->placement = g_strdup (r + 1);
|
||||
{
|
||||
params->placement = g_strdup (r + 1);
|
||||
params->free_placement_string = TRUE;
|
||||
}
|
||||
}
|
||||
else if (strncmp (p, "rank", strlen ("rank")) == 0 && r)
|
||||
{
|
||||
|
@ -118,7 +125,10 @@ pixpipeparams_parse (gchar *string,
|
|||
{
|
||||
i = atoi (p + strlen ("sel"));
|
||||
if (i >= 0 && i < params->dim)
|
||||
params->selection[i] = g_strdup (r + 1);
|
||||
{
|
||||
params->selection[i] = g_strdup (r + 1);
|
||||
params->free_selection_string = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (r)
|
||||
|
|
|
@ -40,8 +40,10 @@ typedef struct {
|
|||
gint cellwidth;
|
||||
gint cellheight;
|
||||
gchar *placement;
|
||||
gboolean free_placement_string;
|
||||
gint rank[PIXPIPE_MAXDIM];
|
||||
gchar *selection[PIXPIPE_MAXDIM];
|
||||
gboolean free_selection_string;
|
||||
} PixPipeParams;
|
||||
|
||||
/* Initalize with dummy values */
|
||||
|
|
|
@ -41,8 +41,12 @@ pixpipeparams_init (PixPipeParams *params)
|
|||
params->cols = 1;
|
||||
params->rows = 1;
|
||||
params->placement = "constant";
|
||||
params->free_placement_string = FALSE;
|
||||
for (i = 0; i < PIXPIPE_MAXDIM; i++)
|
||||
params->selection[i] = "random";
|
||||
{
|
||||
params->selection[i] = "random";
|
||||
params->free_selection_string = FALSE;
|
||||
}
|
||||
params->rank[0] = 1;
|
||||
for (i = 1; i < PIXPIPE_MAXDIM; i++)
|
||||
params->rank[i] = 0;
|
||||
|
@ -53,7 +57,7 @@ pixpipeparams_parse (gchar *string,
|
|||
PixPipeParams *params)
|
||||
{
|
||||
guchar *p, *q, *r; /* Don't you love single-char identifiers? */
|
||||
gint i;
|
||||
gint i; /* No, we don't!! <Sven> */
|
||||
|
||||
q = string;
|
||||
while ((p = strtok (q, " \r\n")) != NULL)
|
||||
|
@ -101,7 +105,10 @@ pixpipeparams_parse (gchar *string,
|
|||
else if (strcmp (p, "placement") == 0)
|
||||
{
|
||||
if (r)
|
||||
params->placement = g_strdup (r + 1);
|
||||
{
|
||||
params->placement = g_strdup (r + 1);
|
||||
params->free_placement_string = TRUE;
|
||||
}
|
||||
}
|
||||
else if (strncmp (p, "rank", strlen ("rank")) == 0 && r)
|
||||
{
|
||||
|
@ -118,7 +125,10 @@ pixpipeparams_parse (gchar *string,
|
|||
{
|
||||
i = atoi (p + strlen ("sel"));
|
||||
if (i >= 0 && i < params->dim)
|
||||
params->selection[i] = g_strdup (r + 1);
|
||||
{
|
||||
params->selection[i] = g_strdup (r + 1);
|
||||
params->free_selection_string = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (r)
|
||||
|
|
|
@ -40,8 +40,10 @@ typedef struct {
|
|||
gint cellwidth;
|
||||
gint cellheight;
|
||||
gchar *placement;
|
||||
gboolean free_placement_string;
|
||||
gint rank[PIXPIPE_MAXDIM];
|
||||
gchar *selection[PIXPIPE_MAXDIM];
|
||||
gboolean free_selection_string;
|
||||
} PixPipeParams;
|
||||
|
||||
/* Initalize with dummy values */
|
||||
|
|
Loading…
Reference in New Issue