Gimp/app/pdb/palette-cmds.c
Michael Natterer 9638102418 Introduce a global ID space for GimpData/GimpResource objects
Much like for images and items. Change the PDB to transmit IDs
instead of names for brush, pattern etc. and refactor a whole
lot of libgimp code to deal with it.

	modified:   libgimp/gimpplugin-private.h
2023-05-31 16:12:04 +02:00

1096 lines
48 KiB
C

/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/* NOTE: This file is auto-generated by pdbgen.pl. */
#include "config.h"
#include "stamp-pdbgen.h"
#include <cairo.h>
#include <string.h>
#include <gegl.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "libgimpcolor/gimpcolor.h"
#include "libgimpbase/gimpbase.h"
#include "pdb-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpdatafactory.h"
#include "core/gimppalette.h"
#include "core/gimpparamspecs.h"
#include "gimppdb.h"
#include "gimppdb-utils.h"
#include "gimpprocedure.h"
#include "internal-procs.h"
static GimpValueArray *
palette_new_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpValueArray *return_vals;
const gchar *name;
GimpPalette *palette = NULL;
name = g_value_get_string (gimp_value_array_index (args, 0));
if (success)
{
palette = (GimpPalette*) gimp_data_factory_data_new (gimp->palette_factory,
context, name);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_object (gimp_value_array_index (return_vals, 1), palette);
return return_vals;
}
static GimpValueArray *
palette_get_by_name_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpValueArray *return_vals;
const gchar *name;
GimpPalette *palette = NULL;
name = g_value_get_string (gimp_value_array_index (args, 0));
if (success)
{
palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
if (! palette)
success = FALSE;
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_object (gimp_value_array_index (return_vals, 1), palette);
return return_vals;
}
static GimpValueArray *
palette_duplicate_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpValueArray *return_vals;
GimpPalette *palette;
GimpPalette *palette_copy = NULL;
palette = g_value_get_object (gimp_value_array_index (args, 0));
if (success)
{
palette_copy = (GimpPalette *)
gimp_data_factory_data_duplicate (gimp->palette_factory, GIMP_DATA (palette));
/* Assert the copy has a unique name. */
if (!palette_copy)
success = FALSE;
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_object (gimp_value_array_index (return_vals, 1), palette_copy);
return return_vals;
}
static GimpValueArray *
palette_rename_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpValueArray *return_vals;
GimpPalette *palette;
const gchar *new_name;
GimpPalette *palette_renamed = NULL;
palette = g_value_get_object (gimp_value_array_index (args, 0));
new_name = g_value_get_string (gimp_value_array_index (args, 1));
if (success)
{
/* Rename the palette in app. */
gimp_object_set_name (GIMP_OBJECT (palette), new_name);
/* Assert GIMP might have set a name different from new_name. */
/* Return a reference.
* The wire protocol will create a new proxy on the plugin side.
* We don't need an alias here, except to make clear
* that we are returning the same real object as passed.
*/
palette_renamed = palette;
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_object (gimp_value_array_index (return_vals, 1), palette_renamed);
return return_vals;
}
static GimpValueArray *
palette_delete_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpPalette *palette;
palette = g_value_get_object (gimp_value_array_index (args, 0));
if (success)
{
if (palette && gimp_data_is_deletable (GIMP_DATA (palette)))
success = gimp_data_factory_data_delete (gimp->palette_factory,
GIMP_DATA (palette),
TRUE, error);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GimpValueArray *
palette_is_editable_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpValueArray *return_vals;
GimpPalette *palette;
gboolean editable = FALSE;
palette = g_value_get_object (gimp_value_array_index (args, 0));
if (success)
{
editable = gimp_data_is_writable (GIMP_DATA (palette));
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_boolean (gimp_value_array_index (return_vals, 1), editable);
return return_vals;
}
static GimpValueArray *
palette_get_color_count_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpValueArray *return_vals;
GimpPalette *palette;
gint num_colors = 0;
palette = g_value_get_object (gimp_value_array_index (args, 0));
if (success)
{
num_colors = gimp_palette_get_n_colors (palette);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_int (gimp_value_array_index (return_vals, 1), num_colors);
return return_vals;
}
static GimpValueArray *
palette_get_colors_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpValueArray *return_vals;
GimpPalette *palette;
gint num_colors = 0;
GimpRGB *colors = NULL;
palette = g_value_get_object (gimp_value_array_index (args, 0));
if (success)
{
GList *list = gimp_palette_get_colors (palette);
gint i;
num_colors = gimp_palette_get_n_colors (palette);
colors = g_new (GimpRGB, num_colors);
for (i = 0; i < num_colors; i++, list = g_list_next (list))
{
GimpPaletteEntry *entry = list->data;
colors[i] = entry->color;
}
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
{
g_value_set_int (gimp_value_array_index (return_vals, 1), num_colors);
gimp_value_take_rgb_array (gimp_value_array_index (return_vals, 2), colors, num_colors);
}
return return_vals;
}
static GimpValueArray *
palette_get_columns_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpValueArray *return_vals;
GimpPalette *palette;
gint num_columns = 0;
palette = g_value_get_object (gimp_value_array_index (args, 0));
if (success)
{
num_columns = gimp_palette_get_columns (palette);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_int (gimp_value_array_index (return_vals, 1), num_columns);
return return_vals;
}
static GimpValueArray *
palette_set_columns_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpPalette *palette;
gint columns;
palette = g_value_get_object (gimp_value_array_index (args, 0));
columns = g_value_get_int (gimp_value_array_index (args, 1));
if (success)
{
if (gimp_data_is_writable (GIMP_DATA (palette)))
gimp_palette_set_columns (palette, columns);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GimpValueArray *
palette_add_entry_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpValueArray *return_vals;
GimpPalette *palette;
const gchar *entry_name;
GimpRGB color;
gint entry_num = 0;
palette = g_value_get_object (gimp_value_array_index (args, 0));
entry_name = g_value_get_string (gimp_value_array_index (args, 1));
gimp_value_get_rgb (gimp_value_array_index (args, 2), &color);
if (success)
{
/* Must check writeable here, because add_entry does not fail when not writeable. */
if (gimp_data_is_writable (GIMP_DATA (palette)))
{
/* -1 for the index means append. */
GimpPaletteEntry *entry = gimp_palette_add_entry (palette, -1, entry_name, &color);
entry_num = gimp_palette_get_entry_position (palette, entry);
}
else
{
success = FALSE;
}
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_int (gimp_value_array_index (return_vals, 1), entry_num);
return return_vals;
}
static GimpValueArray *
palette_delete_entry_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpPalette *palette;
gint entry_num;
palette = g_value_get_object (gimp_value_array_index (args, 0));
entry_num = g_value_get_int (gimp_value_array_index (args, 1));
if (success)
{
if (gimp_data_is_writable (GIMP_DATA (palette)))
{
GimpPaletteEntry *entry = gimp_palette_get_entry (palette, entry_num);
if (entry)
gimp_palette_delete_entry (palette, entry);
else
success = FALSE;
}
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GimpValueArray *
palette_entry_get_color_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpValueArray *return_vals;
GimpPalette *palette;
gint entry_num;
GimpRGB color = { 0.0, 0.0, 0.0, 1.0 };
palette = g_value_get_object (gimp_value_array_index (args, 0));
entry_num = g_value_get_int (gimp_value_array_index (args, 1));
if (success)
{
GimpPaletteEntry *entry = gimp_palette_get_entry (palette, entry_num);
if (entry)
color = entry->color;
else
success = FALSE;
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
gimp_value_set_rgb (gimp_value_array_index (return_vals, 1), &color);
return return_vals;
}
static GimpValueArray *
palette_entry_set_color_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpPalette *palette;
gint entry_num;
GimpRGB color;
palette = g_value_get_object (gimp_value_array_index (args, 0));
entry_num = g_value_get_int (gimp_value_array_index (args, 1));
gimp_value_get_rgb (gimp_value_array_index (args, 2), &color);
if (success)
{
if (gimp_data_is_writable (GIMP_DATA (palette)))
success = gimp_palette_set_entry_color (palette, entry_num, &color);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GimpValueArray *
palette_entry_get_name_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpValueArray *return_vals;
GimpPalette *palette;
gint entry_num;
gchar *entry_name = NULL;
palette = g_value_get_object (gimp_value_array_index (args, 0));
entry_num = g_value_get_int (gimp_value_array_index (args, 1));
if (success)
{
GimpPaletteEntry *entry = gimp_palette_get_entry (palette, entry_num);
if (entry)
entry_name = g_strdup (entry->name);
else
success = FALSE;
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_take_string (gimp_value_array_index (return_vals, 1), entry_name);
return return_vals;
}
static GimpValueArray *
palette_entry_set_name_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpPalette *palette;
gint entry_num;
const gchar *entry_name;
palette = g_value_get_object (gimp_value_array_index (args, 0));
entry_num = g_value_get_int (gimp_value_array_index (args, 1));
entry_name = g_value_get_string (gimp_value_array_index (args, 2));
if (success)
{
if (gimp_data_is_writable (GIMP_DATA (palette)))
success = gimp_palette_set_entry_name (palette, entry_num, entry_name);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
void
register_palette_procs (GimpPDB *pdb)
{
GimpProcedure *procedure;
/*
* gimp-palette-new
*/
procedure = gimp_procedure_new (palette_new_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-palette-new");
gimp_procedure_set_static_help (procedure,
"Creates a new palette",
"Creates a new palette. The new palette has no color entries. You must add color entries for a user to choose. The actual name might be different than the requested name, when the requested name is already in use.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2004");
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("name",
"name",
"The requested name of the new palette",
FALSE, FALSE, TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_palette ("palette",
"palette",
"The palette",
FALSE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-palette-get-by-name
*/
procedure = gimp_procedure_new (palette_get_by_name_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-palette-get-by-name");
gimp_procedure_set_static_help (procedure,
"Returns the palette with the given name.",
"Returns the palette with the given name.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2023");
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("name",
"name",
"The name of the palette",
FALSE, FALSE, TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_palette ("palette",
"palette",
"The palette",
FALSE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-palette-duplicate
*/
procedure = gimp_procedure_new (palette_duplicate_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-palette-duplicate");
gimp_procedure_set_static_help (procedure,
"Duplicates a palette",
"Returns a copy having a different, unique ID.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2004");
gimp_procedure_add_argument (procedure,
gimp_param_spec_palette ("palette",
"palette",
"The palette",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_palette ("palette-copy",
"palette copy",
"A copy of the palette.",
FALSE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-palette-rename
*/
procedure = gimp_procedure_new (palette_rename_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-palette-rename");
gimp_procedure_set_static_help (procedure,
"Rename a palette",
"Renames a palette. The name is the same as the ID. When the proposed name is already used, GIMP generates a unique name, which get_id() will return.\n"
"Returns a reference to a renamed palette, which you should assign to the original var or a differently named var. Any existing references will be invalid. Resources in plugins are proxies holding an ID, which can be invalid when the resource is renamed.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2004");
gimp_procedure_add_argument (procedure,
gimp_param_spec_palette ("palette",
"palette",
"The palette",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("new-name",
"new name",
"The requested new name of the palette",
FALSE, FALSE, TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_palette ("palette-renamed",
"palette renamed",
"A reference to the renamed palette.",
FALSE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-palette-delete
*/
procedure = gimp_procedure_new (palette_delete_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-palette-delete");
gimp_procedure_set_static_help (procedure,
"Deletes a palette",
"Deletes a palette. Returns an error if the palette is not deletable. Deletes the palette's data. You should not use the palette afterwards.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2004");
gimp_procedure_add_argument (procedure,
gimp_param_spec_palette ("palette",
"palette",
"The palette",
FALSE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-palette-is-editable
*/
procedure = gimp_procedure_new (palette_is_editable_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-palette-is-editable");
gimp_procedure_set_static_help (procedure,
"Whether the palette can be edited",
"Returns TRUE if you have permission to change the palette",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Bill Skaggs <weskaggs@primate.ucdavis.edu>",
"Bill Skaggs",
"2004");
gimp_procedure_add_argument (procedure,
gimp_param_spec_palette ("palette",
"palette",
"The palette",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_boolean ("editable",
"editable",
"TRUE if the palette can be edited",
FALSE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-palette-get-color-count
*/
procedure = gimp_procedure_new (palette_get_color_count_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-palette-get-color-count");
gimp_procedure_set_static_help (procedure,
"Get the count of colors in the palette.",
"Returns the number of colors in the palette.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2004");
gimp_procedure_add_argument (procedure,
gimp_param_spec_palette ("palette",
"palette",
"The palette",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_int ("num-colors",
"num colors",
"The number of colors in the palette",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-palette-get-colors
*/
procedure = gimp_procedure_new (palette_get_colors_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-palette-get-colors");
gimp_procedure_set_static_help (procedure,
"Gets colors in the palette.",
"Returns an array of colors in the palette.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Sven Neumann <sven@gimp.org>",
"Sven Neumann",
"2006");
gimp_procedure_add_argument (procedure,
gimp_param_spec_palette ("palette",
"palette",
"The palette",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_int ("num-colors",
"num colors",
"Length of the colors array",
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_rgb_array ("colors",
"colors",
"The colors in the palette",
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-palette-get-columns
*/
procedure = gimp_procedure_new (palette_get_columns_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-palette-get-columns");
gimp_procedure_set_static_help (procedure,
"Gets the number of columns used to display the palette",
"Gets the preferred number of columns to display the palette.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Sven Neumann <sven@gimp.org>",
"Sven Neumann",
"2005");
gimp_procedure_add_argument (procedure,
gimp_param_spec_palette ("palette",
"palette",
"The palette",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_int ("num-columns",
"num columns",
"The number of columns used to display this palette",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-palette-set-columns
*/
procedure = gimp_procedure_new (palette_set_columns_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-palette-set-columns");
gimp_procedure_set_static_help (procedure,
"Sets the number of columns used to display the palette",
"Set the number of colors shown per row when the palette is displayed. Returns an error when the palette is not editable. The maximum allowed value is 64.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Sven Neumann <sven@gimp.org>",
"Sven Neumann",
"2005");
gimp_procedure_add_argument (procedure,
gimp_param_spec_palette ("palette",
"palette",
"The palette",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_int ("columns",
"columns",
"The new number of columns",
0, 64, 0,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-palette-add-entry
*/
procedure = gimp_procedure_new (palette_add_entry_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-palette-add-entry");
gimp_procedure_set_static_help (procedure,
"Appends an entry to the palette.",
"Appends an entry to the palette. Neither color nor name must be unique within the palette. When name is the empty string, this sets the entry name to \"Untitled\". Returns the index of the entry. Returns an error when palette is not editable.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2004");
gimp_procedure_add_argument (procedure,
gimp_param_spec_palette ("palette",
"palette",
"The palette",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("entry-name",
"entry name",
"A name for the entry",
FALSE, TRUE, FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_rgb ("color",
"color",
"The color for the added entry.",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_int ("entry-num",
"entry num",
"The index of the added entry",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-palette-delete-entry
*/
procedure = gimp_procedure_new (palette_delete_entry_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-palette-delete-entry");
gimp_procedure_set_static_help (procedure,
"Deletes an entry from the palette.",
"Deletes an entry from the palette. Returns an error if the index is out or range. Returns an error if the palette is not editable.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2004");
gimp_procedure_add_argument (procedure,
gimp_param_spec_palette ("palette",
"palette",
"The palette",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_int ("entry-num",
"entry num",
"The index of the entry to delete",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-palette-entry-get-color
*/
procedure = gimp_procedure_new (palette_entry_get_color_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-palette-entry-get-color");
gimp_procedure_set_static_help (procedure,
"Gets the color of an entry in the palette.",
"Returns the color of the entry at the given zero-based index into the palette. Returns an error when the index is out of range.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2004");
gimp_procedure_add_argument (procedure,
gimp_param_spec_palette ("palette",
"palette",
"The palette",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_int ("entry-num",
"entry num",
"The index of the entry to get the color of.",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_rgb ("color",
"color",
"The color at the index.",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-palette-entry-set-color
*/
procedure = gimp_procedure_new (palette_entry_set_color_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-palette-entry-set-color");
gimp_procedure_set_static_help (procedure,
"Sets the color of an entry in the palette.",
"Sets the color of the entry at the zero-based index into the palette. Returns an error when the index is out of range. Returns an error when the palette is not editable.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2004");
gimp_procedure_add_argument (procedure,
gimp_param_spec_palette ("palette",
"palette",
"The palette",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_int ("entry-num",
"entry num",
"The entry to get",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_rgb ("color",
"color",
"The new color",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-palette-entry-get-name
*/
procedure = gimp_procedure_new (palette_entry_get_name_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-palette-entry-get-name");
gimp_procedure_set_static_help (procedure,
"Gets the name of an entry in the palette.",
"Gets the name of the entry at the zero-based index into the palette. Returns an error when the index is out of range.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2004");
gimp_procedure_add_argument (procedure,
gimp_param_spec_palette ("palette",
"palette",
"The palette",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_int ("entry-num",
"entry num",
"The entry to get",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_string ("entry-name",
"entry name",
"The name of the entry.",
FALSE, FALSE, FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-palette-entry-set-name
*/
procedure = gimp_procedure_new (palette_entry_set_name_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-palette-entry-set-name");
gimp_procedure_set_static_help (procedure,
"Sets the name of an entry in the palette.",
"Sets the name of the entry at the zero-based index into the palette. Returns an error if the index is out or range. Returns an error if the palette is not editable.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2004");
gimp_procedure_add_argument (procedure,
gimp_param_spec_palette ("palette",
"palette",
"The palette",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_int ("entry-num",
"entry num",
"The entry to get",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("entry-name",
"entry name",
"The new name",
FALSE, TRUE, FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
}