2
2
smooth palette - derive smooth palette from image
3
3
Copyright (C) 1997 Scott Draves <spot@cs.cmu.edu>
5
The GIMP -- an image manipulation program
5
GIMP - The GNU Image Manipulation Program
6
6
Copyright (C) 1995 Spencer Kimball and Peter Mattis
8
8
This program is free software; you can redistribute it and/or modify
23
23
#include "config.h"
27
25
#include <string.h>
31
27
#include <libgimp/gimp.h>
32
28
#include <libgimp/gimpui.h>
34
30
#include "libgimp/stdplugins-intl.h"
33
#define PLUG_IN_PROC "plug-in-smooth-palette"
34
#define PLUG_IN_BINARY "smooth_palette"
37
37
/* Declare local functions. */
38
38
static void query (void);
39
39
static void run (const gchar *name,
65
static GimpParamDef args[] =
65
static const GimpParamDef args[] =
67
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
67
{ GIMP_PDB_INT32, "run-mode", "Interactive, non-interactive" },
68
68
{ GIMP_PDB_IMAGE, "image", "Input image (unused)" },
69
69
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
70
70
{ GIMP_PDB_INT32, "width", "Width" },
71
71
{ GIMP_PDB_INT32, "height", "Height" },
72
72
{ GIMP_PDB_INT32, "ntries", "Search Depth" },
73
{ GIMP_PDB_INT32, "show_image", "Show Image?" }
73
{ GIMP_PDB_INT32, "show-image", "Show Image?" }
76
static GimpParamDef return_vals[] =
76
static const GimpParamDef return_vals[] =
78
{ GIMP_PDB_IMAGE, "new_image", "Output image" },
79
{ GIMP_PDB_LAYER, "new_layer", "Output layer" }
78
{ GIMP_PDB_IMAGE, "new-image", "Output image" },
79
{ GIMP_PDB_LAYER, "new-layer", "Output layer" }
82
gimp_install_procedure ("plug_in_smooth_palette",
83
"derive smooth palette from image",
82
gimp_install_procedure (PLUG_IN_PROC,
83
N_("Derive a smooth color palette from the image"),
91
91
G_N_ELEMENTS (args), G_N_ELEMENTS (return_vals),
92
92
args, return_vals);
94
gimp_plugin_menu_register ("plug_in_smooth_palette",
95
"<Image>/Filters/Colors");
94
gimp_plugin_menu_register (PLUG_IN_PROC, "<Image>/Colors/Info");
167
166
case GIMP_RUN_WITH_LAST_VALS:
168
167
/* Possibly retrieve data */
169
gimp_get_data ("plug_in_smooth_palette", &config);
168
gimp_get_data (PLUG_IN_PROC, &config);
186
185
&values[2].data.d_layer);
188
187
if (run_mode == GIMP_RUN_INTERACTIVE)
189
gimp_set_data ("plug_in_smooth_palette", &config, sizeof (config));
188
gimp_set_data (PLUG_IN_PROC, &config, sizeof (config));
190
190
if (config.show_image)
191
191
gimp_display_new (values[1].data.d_image);
407
407
gdouble xres, yres;
410
gimp_ui_init ("smooth_palette", FALSE);
410
gimp_ui_init (PLUG_IN_BINARY, FALSE);
412
dlg = gimp_dialog_new (_("Smooth Palette"), "smooth_palette",
412
dlg = gimp_dialog_new (_("Smooth Palette"), PLUG_IN_BINARY,
414
gimp_standard_help_func, "plug-in-smooth-palette",
414
gimp_standard_help_func, PLUG_IN_PROC,
416
416
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
417
417
GTK_STOCK_OK, GTK_RESPONSE_OK,
421
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dlg),
426
gimp_window_set_transient (GTK_WINDOW (dlg));
421
428
image_id = gimp_drawable_get_image (drawable->drawable_id);
422
429
unit = gimp_image_get_unit (image_id);
423
430
gimp_image_get_resolution (image_id, &xres, &yres);
444
451
gimp_table_attach_aligned (GTK_TABLE (sizeentry), 0, 2,
445
452
_("_Search depth:"), 0.0, 0.5,
446
453
spinbutton, 1, FALSE);
447
g_signal_connect (adj, "value_changed",
454
g_signal_connect (adj, "value-changed",
448
455
G_CALLBACK (gimp_int_adjustment_update),