mirror of https://github.com/GNOME/gimp.git
app/color_panel.c libgimp/gimpcolorbutton.c
2001-01-15 Sven Neumann <sven@gimp.org> * app/color_panel.c * libgimp/gimpcolorbutton.c * plug-ins/common/borderaverage.c * plug-ins/common/grid.c * plug-ins/common/polar.c * plug-ins/common/whirlpinch.c: cleaned up after myself
This commit is contained in:
parent
943847677c
commit
ca3bf4f1c4
|
@ -1,3 +1,12 @@
|
|||
2001-01-15 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/color_panel.c
|
||||
* libgimp/gimpcolorbutton.c
|
||||
* plug-ins/common/borderaverage.c
|
||||
* plug-ins/common/grid.c
|
||||
* plug-ins/common/polar.c
|
||||
* plug-ins/common/whirlpinch.c: cleaned up after myself
|
||||
|
||||
2001-01-15 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/color_panel.[ch]: rewritten as proper widget derived from
|
||||
|
|
|
@ -89,8 +89,8 @@ gimp_color_panel_class_init (GimpColorPanelClass *klass)
|
|||
parent_class = gtk_type_class (gimp_color_button_get_type ());
|
||||
|
||||
object_class->destroy = gimp_color_panel_destroy;
|
||||
color_button_class->color_changed = gimp_color_panel_color_changed;
|
||||
button_class->clicked = gimp_color_panel_clicked;
|
||||
color_button_class->color_changed = gimp_color_panel_color_changed;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -89,8 +89,8 @@ gimp_color_panel_class_init (GimpColorPanelClass *klass)
|
|||
parent_class = gtk_type_class (gimp_color_button_get_type ());
|
||||
|
||||
object_class->destroy = gimp_color_panel_destroy;
|
||||
color_button_class->color_changed = gimp_color_panel_color_changed;
|
||||
button_class->clicked = gimp_color_panel_clicked;
|
||||
color_button_class->color_changed = gimp_color_panel_color_changed;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -224,9 +224,11 @@ gimp_color_button_new (const gchar *title,
|
|||
|
||||
gcb->title = g_strdup (title);
|
||||
|
||||
gimp_color_area_set_type (GIMP_COLOR_AREA (gcb->color_area), type);
|
||||
gtk_widget_set_usize (GTK_WIDGET (gcb->color_area), width, height);
|
||||
|
||||
gimp_color_area_set_color (GIMP_COLOR_AREA (gcb->color_area), color);
|
||||
gimp_color_area_set_type (GIMP_COLOR_AREA (gcb->color_area), type);
|
||||
|
||||
return GTK_WIDGET (gcb);
|
||||
}
|
||||
|
||||
|
|
|
@ -224,9 +224,11 @@ gimp_color_button_new (const gchar *title,
|
|||
|
||||
gcb->title = g_strdup (title);
|
||||
|
||||
gimp_color_area_set_type (GIMP_COLOR_AREA (gcb->color_area), type);
|
||||
gtk_widget_set_usize (GTK_WIDGET (gcb->color_area), width, height);
|
||||
|
||||
gimp_color_area_set_color (GIMP_COLOR_AREA (gcb->color_area), color);
|
||||
gimp_color_area_set_type (GIMP_COLOR_AREA (gcb->color_area), type);
|
||||
|
||||
return GTK_WIDGET (gcb);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,9 +39,7 @@ static void run (gchar *name,
|
|||
GimpParam **return_vals);
|
||||
|
||||
static void borderaverage (GimpDrawable *drawable,
|
||||
guchar *res_r,
|
||||
guchar *res_g,
|
||||
guchar *res_b);
|
||||
GimpRGB *result);
|
||||
|
||||
static gint borderaverage_dialog (void);
|
||||
|
||||
|
@ -81,19 +79,18 @@ query (void)
|
|||
{
|
||||
static GimpParamDef args[] =
|
||||
{
|
||||
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
||||
{ GIMP_PDB_IMAGE, "image", "Input image (unused)" },
|
||||
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
|
||||
{ GIMP_PDB_INT32, "thickness", "Border size to take in count" },
|
||||
{ GIMP_PDB_INT32, "bucket_exponent", "Bits for bucket size (default=4: 16 Levels)" },
|
||||
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
||||
{ GIMP_PDB_IMAGE, "image", "Input image (unused)" },
|
||||
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
|
||||
{ GIMP_PDB_INT32, "thickness", "Border size to take in count" },
|
||||
{ GIMP_PDB_INT32, "bucket_exponent", "Bits for bucket size (default=4: 16 Levels)" },
|
||||
};
|
||||
static GimpParamDef return_vals[] =
|
||||
{
|
||||
{ GIMP_PDB_INT32, "num_channels", "Number of color channels returned (always 3)" },
|
||||
{ GIMP_PDB_INT8ARRAY, "color_vals", "The average color of the specified border"},
|
||||
{ GIMP_PDB_COLOR, "borderaverage", "The average color of the specified border" },
|
||||
};
|
||||
static int nargs = sizeof (args) / sizeof (args[0]);
|
||||
static int nreturn_vals = sizeof (return_vals) / sizeof (return_vals[0]);
|
||||
static gint nargs = sizeof (args) / sizeof (args[0]);
|
||||
static gint nreturn_vals = sizeof (return_vals) / sizeof (return_vals[0]);
|
||||
|
||||
INIT_I18N();
|
||||
|
||||
|
@ -111,25 +108,22 @@ query (void)
|
|||
}
|
||||
|
||||
static void
|
||||
run (gchar *name,
|
||||
gint nparams,
|
||||
run (gchar *name,
|
||||
gint nparams,
|
||||
GimpParam *param,
|
||||
gint *nreturn_vals,
|
||||
gint *nreturn_vals,
|
||||
GimpParam **return_vals)
|
||||
{
|
||||
static GimpParam values[3];
|
||||
GimpDrawable *drawable;
|
||||
GimpRunModeType run_mode;
|
||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||
gint8 *result_color;
|
||||
static GimpParam values[3];
|
||||
GimpDrawable *drawable;
|
||||
GimpRunModeType run_mode;
|
||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||
GimpRGB result_color;
|
||||
|
||||
INIT_I18N_UI();
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
|
||||
/* get the return memory */
|
||||
result_color = (gint8 *) g_new(gint8, 3);
|
||||
|
||||
/* Get the specified drawable */
|
||||
drawable = gimp_drawable_get (param[2].data.d_drawable);
|
||||
|
||||
|
@ -169,14 +163,11 @@ run (gchar *name,
|
|||
if (gimp_drawable_is_rgb (drawable->id))
|
||||
{
|
||||
gimp_progress_init ( _("Border Average..."));
|
||||
borderaverage (drawable,
|
||||
&result_color[0], &result_color[1], &result_color[2]);
|
||||
borderaverage (drawable, &result_color);
|
||||
|
||||
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
{
|
||||
gimp_palette_set_foreground (result_color[0],
|
||||
result_color[1],
|
||||
result_color[2]);
|
||||
gimp_palette_set_foreground_rgb (&result_color);
|
||||
}
|
||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||
{
|
||||
|
@ -197,37 +188,32 @@ run (gchar *name,
|
|||
values[0].type = GIMP_PDB_STATUS;
|
||||
values[0].data.d_status = status;
|
||||
|
||||
values[1].type = GIMP_PDB_INT32;
|
||||
values[1].data.d_int32 = 3;
|
||||
|
||||
values[2].type = GIMP_PDB_INT8ARRAY;
|
||||
values[2].data.d_int8array = result_color;
|
||||
values[1].type = GIMP_PDB_COLOR;
|
||||
gimp_rgb_get_uchar (&result_color,
|
||||
&values[0].data.d_color.red,
|
||||
&values[1].data.d_color.green,
|
||||
&values[2].data.d_color.blue);
|
||||
|
||||
gimp_drawable_detach (drawable);
|
||||
}
|
||||
|
||||
static void
|
||||
borderaverage (GimpDrawable *drawable,
|
||||
guchar *res_r,
|
||||
guchar *res_g,
|
||||
guchar *res_b)
|
||||
GimpRGB *result)
|
||||
{
|
||||
gint width;
|
||||
gint height;
|
||||
gint x1, x2, y1, y2;
|
||||
gint bytes;
|
||||
gint max;
|
||||
gint width;
|
||||
gint height;
|
||||
gint x1, x2, y1, y2;
|
||||
gint bytes;
|
||||
gint max;
|
||||
guchar r, g, b;
|
||||
guchar *buffer;
|
||||
gint bucket_num, bucket_expo, bucket_rexpo;
|
||||
gint *cube;
|
||||
gint row, col;
|
||||
gint i, j, k; /* index variables */
|
||||
|
||||
guchar r, g, b;
|
||||
|
||||
guchar *buffer;
|
||||
gint bucket_num, bucket_expo, bucket_rexpo;
|
||||
|
||||
gint *cube;
|
||||
|
||||
gint row, col, i,j,k; /* index variables */
|
||||
|
||||
GimpPixelRgn myPR;
|
||||
GimpPixelRgn myPR;
|
||||
|
||||
/* allocate and clear the cube before */
|
||||
bucket_expo = borderaverage_bucket_exponent;
|
||||
|
@ -323,9 +309,7 @@ borderaverage (GimpDrawable *drawable,
|
|||
}
|
||||
|
||||
/* return the color */
|
||||
*res_r = r;
|
||||
*res_g = g;
|
||||
*res_b = b;
|
||||
gimp_rgb_set_uchar (result, r, g, b);
|
||||
|
||||
g_free (buffer);
|
||||
g_free (cube);
|
||||
|
|
|
@ -584,8 +584,12 @@ color_callback (GtkWidget *widget,
|
|||
|
||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (widget), &color);
|
||||
|
||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (vcolor_button), &color);
|
||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (hcolor_button), &color);
|
||||
if (widget == vcolor_button)
|
||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (hcolor_button),
|
||||
&color);
|
||||
else if (widget == hcolor_button)
|
||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (vcolor_button),
|
||||
&color);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -902,7 +906,7 @@ dialog (gint32 image_ID,
|
|||
|
||||
/* put a chain_button under the color_buttons */
|
||||
chain_button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
if (gimp_rgb_distance (&grid_cfg.hcolor, &grid_cfg.vcolor) > 0.0001)
|
||||
if (gimp_rgba_distance (&grid_cfg.hcolor, &grid_cfg.vcolor) < 0.0001)
|
||||
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain_button), TRUE);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), chain_button, 0, 2, 2, 3);
|
||||
gtk_widget_show (chain_button);
|
||||
|
|
|
@ -1078,11 +1078,14 @@ dialog_update_preview (void)
|
|||
case 2:
|
||||
outside[0] = outside[1] = outside [2] = gimp_rgb_intensity_uchar (&background);
|
||||
outside[3] = 0;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
gimp_rgb_get_uchar (&background,
|
||||
&outside[0], &outside[1], &outside[2]);
|
||||
outside[3] = 255;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
gimp_rgb_get_uchar (&background,
|
||||
&outside[0], &outside[1], &outside[2]);
|
||||
|
|
|
@ -93,10 +93,10 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
gint col, row;
|
||||
gint img_width, img_height, img_bpp, img_has_alpha;
|
||||
gint tile_width, tile_height;
|
||||
guchar bg_color[4];
|
||||
gint col, row;
|
||||
gint img_width, img_height, img_bpp, img_has_alpha;
|
||||
gint tile_width, tile_height;
|
||||
guchar bg_color[4];
|
||||
GimpDrawable *drawable;
|
||||
GimpTile *tile;
|
||||
} pixel_fetcher_t;
|
||||
|
@ -834,7 +834,8 @@ whirl_pinch_dialog (void)
|
|||
|
||||
/* Preview */
|
||||
wpint.preview = gtk_preview_new (GTK_PREVIEW_COLOR);
|
||||
gtk_preview_size (GTK_PREVIEW (wpint.preview), preview_width, preview_height);
|
||||
gtk_preview_size (GTK_PREVIEW (wpint.preview),
|
||||
preview_width, preview_height);
|
||||
gtk_container_add (GTK_CONTAINER (pframe), wpint.preview);
|
||||
gtk_widget_show (wpint.preview);
|
||||
|
||||
|
@ -922,11 +923,14 @@ dialog_update_preview (void)
|
|||
case 2:
|
||||
outside[0] = outside[1] = outside [2] = gimp_rgb_intensity_uchar (&background);
|
||||
outside[3] = 0;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
gimp_rgb_get_uchar (&background,
|
||||
&outside[0], &outside[1], &outside[2]);
|
||||
outside[3] = 255;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
gimp_rgb_get_uchar (&background,
|
||||
&outside[0], &outside[1], &outside[2]);
|
||||
|
|
Loading…
Reference in New Issue