PIKApp/app/pdb/brush-cmds.c

1415 lines
61 KiB
C

/* PIKA - Photo and Image Kooker Application
* a rebranding of The GNU Image Manipulation Program (created with heckimp)
* A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
*
* Original copyright, applying to most contents (license remains unchanged):
* 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 <string.h>
#include <gegl.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "libpikabase/pikabase.h"
#include "pdb-types.h"
#include "core/pika.h"
#include "core/pikabrush.h"
#include "core/pikabrushgenerated.h"
#include "core/pikacontext.h"
#include "core/pikadatafactory.h"
#include "core/pikaparamspecs.h"
#include "core/pikatempbuf.h"
#include "gegl/pika-babl-compat.h"
#include "pikapdb.h"
#include "pikapdb-utils.h"
#include "pikaprocedure.h"
#include "internal-procs.h"
static PikaValueArray *
brush_new_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
const gchar *name;
PikaBrush *brush = NULL;
name = g_value_get_string (pika_value_array_index (args, 0));
if (success)
{
brush = (PikaBrush *) pika_data_factory_data_new (pika->brush_factory,
context, name);
if (! brush)
success = FALSE;
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_object (pika_value_array_index (return_vals, 1), brush);
return return_vals;
}
static PikaValueArray *
brush_get_by_name_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
const gchar *name;
PikaBrush *brush = NULL;
name = g_value_get_string (pika_value_array_index (args, 0));
if (success)
{
brush = PIKA_BRUSH (pika_pdb_get_resource (pika, PIKA_TYPE_BRUSH, name,
PIKA_PDB_DATA_ACCESS_READ, error));
if (! brush)
success = FALSE;
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_object (pika_value_array_index (return_vals, 1), brush);
return return_vals;
}
static PikaValueArray *
brush_is_generated_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaBrush *brush;
gboolean generated = FALSE;
brush = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
generated = PIKA_IS_BRUSH_GENERATED (brush);
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_boolean (pika_value_array_index (return_vals, 1), generated);
return return_vals;
}
static PikaValueArray *
brush_get_info_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaBrush *brush;
gint width = 0;
gint height = 0;
gint mask_bpp = 0;
gint color_bpp = 0;
brush = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
PikaTempBuf *mask = pika_brush_get_mask (brush);
PikaTempBuf *pixmap = pika_brush_get_pixmap (brush);
const Babl *format;
format = pika_babl_compat_u8_mask_format (
pika_temp_buf_get_format (mask));
width = pika_brush_get_width (brush);
height = pika_brush_get_height (brush);
mask_bpp = babl_format_get_bytes_per_pixel (format);
if (pixmap)
{
format = pika_babl_compat_u8_format (
pika_temp_buf_get_format (pixmap));
color_bpp = babl_format_get_bytes_per_pixel (format);
}
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
{
g_value_set_int (pika_value_array_index (return_vals, 1), width);
g_value_set_int (pika_value_array_index (return_vals, 2), height);
g_value_set_int (pika_value_array_index (return_vals, 3), mask_bpp);
g_value_set_int (pika_value_array_index (return_vals, 4), color_bpp);
}
return return_vals;
}
static PikaValueArray *
brush_get_pixels_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaBrush *brush;
gint width = 0;
gint height = 0;
gint mask_bpp = 0;
GBytes *mask_bytes = NULL;
gint color_bpp = 0;
GBytes *color_bytes = NULL;
brush = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
PikaTempBuf *mask = pika_brush_get_mask (brush);
PikaTempBuf *pixmap = pika_brush_get_pixmap (brush);
const Babl *format;
gpointer data;
gsize num_mask_bytes;
gsize num_color_bytes;
format = pika_babl_compat_u8_mask_format (
pika_temp_buf_get_format (mask));
data = pika_temp_buf_lock (mask, format, GEGL_ACCESS_READ);
width = pika_temp_buf_get_width (mask);
height = pika_temp_buf_get_height (mask);
mask_bpp = babl_format_get_bytes_per_pixel (format);
num_mask_bytes = (gsize) pika_temp_buf_get_height (mask) *
pika_temp_buf_get_width (mask) * mask_bpp;
mask_bytes = g_bytes_new (data, num_mask_bytes);
pika_temp_buf_unlock (mask, data);
if (pixmap)
{
format = pika_babl_compat_u8_format (
pika_temp_buf_get_format (pixmap));
data = pika_temp_buf_lock (pixmap, format, GEGL_ACCESS_READ);
color_bpp = babl_format_get_bytes_per_pixel (format);
num_color_bytes = (gsize) pika_temp_buf_get_height (pixmap) *
pika_temp_buf_get_width (pixmap) *
color_bpp;
color_bytes = g_bytes_new (data, num_color_bytes);
pika_temp_buf_unlock (pixmap, data);
}
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
{
g_value_set_int (pika_value_array_index (return_vals, 1), width);
g_value_set_int (pika_value_array_index (return_vals, 2), height);
g_value_set_int (pika_value_array_index (return_vals, 3), mask_bpp);
g_value_take_boxed (pika_value_array_index (return_vals, 4), mask_bytes);
g_value_set_int (pika_value_array_index (return_vals, 5), color_bpp);
g_value_take_boxed (pika_value_array_index (return_vals, 6), color_bytes);
}
return return_vals;
}
static PikaValueArray *
brush_get_spacing_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaBrush *brush;
gint spacing = 0;
brush = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
spacing = pika_brush_get_spacing (brush);
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_int (pika_value_array_index (return_vals, 1), spacing);
return return_vals;
}
static PikaValueArray *
brush_set_spacing_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaBrush *brush;
gint spacing;
brush = g_value_get_object (pika_value_array_index (args, 0));
spacing = g_value_get_int (pika_value_array_index (args, 1));
if (success)
{
if (pika_data_is_writable (PIKA_DATA (brush)))
pika_brush_set_spacing (brush, spacing);
else
success = FALSE;
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
brush_get_shape_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaBrush *brush;
gint shape = 0;
brush = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
if (PIKA_IS_BRUSH_GENERATED (brush))
shape = PIKA_BRUSH_GENERATED (brush)->shape;
else
success = FALSE;
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_enum (pika_value_array_index (return_vals, 1), shape);
return return_vals;
}
static PikaValueArray *
brush_set_shape_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaBrush *brush;
gint shape_in;
gint shape_out = 0;
brush = g_value_get_object (pika_value_array_index (args, 0));
shape_in = g_value_get_enum (pika_value_array_index (args, 1));
if (success)
{
if (PIKA_IS_BRUSH_GENERATED (brush) &&
pika_data_is_writable (PIKA_DATA (brush)))
{
pika_brush_generated_set_shape (PIKA_BRUSH_GENERATED (brush),
shape_in);
shape_out = PIKA_BRUSH_GENERATED (brush)->shape;
}
else
{
success = FALSE;
}
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_enum (pika_value_array_index (return_vals, 1), shape_out);
return return_vals;
}
static PikaValueArray *
brush_get_radius_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaBrush *brush;
gdouble radius = 0.0;
brush = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
if (PIKA_IS_BRUSH_GENERATED (brush))
radius = PIKA_BRUSH_GENERATED (brush)->radius;
else
success = FALSE;
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_double (pika_value_array_index (return_vals, 1), radius);
return return_vals;
}
static PikaValueArray *
brush_set_radius_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaBrush *brush;
gdouble radius_in;
gdouble radius_out = 0.0;
brush = g_value_get_object (pika_value_array_index (args, 0));
radius_in = g_value_get_double (pika_value_array_index (args, 1));
if (success)
{
if (PIKA_IS_BRUSH_GENERATED (brush) &&
pika_data_is_writable (PIKA_DATA (brush)))
{
pika_brush_generated_set_radius (PIKA_BRUSH_GENERATED (brush),
radius_in);
radius_out = PIKA_BRUSH_GENERATED (brush)->radius;
}
else
{
success = FALSE;
}
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_double (pika_value_array_index (return_vals, 1), radius_out);
return return_vals;
}
static PikaValueArray *
brush_get_spikes_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaBrush *brush;
gint spikes = 0;
brush = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
if (PIKA_IS_BRUSH_GENERATED (brush))
spikes = PIKA_BRUSH_GENERATED (brush)->spikes;
else
success = FALSE;
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_int (pika_value_array_index (return_vals, 1), spikes);
return return_vals;
}
static PikaValueArray *
brush_set_spikes_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaBrush *brush;
gint spikes_in;
gint spikes_out = 0;
brush = g_value_get_object (pika_value_array_index (args, 0));
spikes_in = g_value_get_int (pika_value_array_index (args, 1));
if (success)
{
if (PIKA_IS_BRUSH_GENERATED (brush) &&
pika_data_is_writable (PIKA_DATA (brush)))
{
pika_brush_generated_set_spikes (PIKA_BRUSH_GENERATED (brush),
spikes_in);
spikes_out = PIKA_BRUSH_GENERATED (brush)->spikes;
}
else
{
success = FALSE;
}
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_int (pika_value_array_index (return_vals, 1), spikes_out);
return return_vals;
}
static PikaValueArray *
brush_get_hardness_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaBrush *brush;
gdouble hardness = 0.0;
brush = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
if (PIKA_IS_BRUSH_GENERATED (brush))
hardness = PIKA_BRUSH_GENERATED (brush)->hardness;
else
success = FALSE;
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_double (pika_value_array_index (return_vals, 1), hardness);
return return_vals;
}
static PikaValueArray *
brush_set_hardness_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaBrush *brush;
gdouble hardness_in;
gdouble hardness_out = 0.0;
brush = g_value_get_object (pika_value_array_index (args, 0));
hardness_in = g_value_get_double (pika_value_array_index (args, 1));
if (success)
{
if (PIKA_IS_BRUSH_GENERATED (brush) &&
pika_data_is_writable (PIKA_DATA (brush)))
{
pika_brush_generated_set_hardness (PIKA_BRUSH_GENERATED (brush),
hardness_in);
hardness_out = PIKA_BRUSH_GENERATED (brush)->hardness;
}
else
{
success = FALSE;
}
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_double (pika_value_array_index (return_vals, 1), hardness_out);
return return_vals;
}
static PikaValueArray *
brush_get_aspect_ratio_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaBrush *brush;
gdouble aspect_ratio = 0.0;
brush = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
if (PIKA_IS_BRUSH_GENERATED (brush))
aspect_ratio = PIKA_BRUSH_GENERATED (brush)->aspect_ratio;
else
success = FALSE;
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_double (pika_value_array_index (return_vals, 1), aspect_ratio);
return return_vals;
}
static PikaValueArray *
brush_set_aspect_ratio_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaBrush *brush;
gdouble aspect_ratio_in;
gdouble aspect_ratio_out = 0.0;
brush = g_value_get_object (pika_value_array_index (args, 0));
aspect_ratio_in = g_value_get_double (pika_value_array_index (args, 1));
if (success)
{
if (PIKA_IS_BRUSH_GENERATED (brush) &&
pika_data_is_writable (PIKA_DATA (brush)))
{
pika_brush_generated_set_aspect_ratio (PIKA_BRUSH_GENERATED (brush),
aspect_ratio_in);
aspect_ratio_out = PIKA_BRUSH_GENERATED (brush)->aspect_ratio;
}
else
{
success = FALSE;
}
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_double (pika_value_array_index (return_vals, 1), aspect_ratio_out);
return return_vals;
}
static PikaValueArray *
brush_get_angle_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaBrush *brush;
gdouble angle = 0.0;
brush = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
if (PIKA_IS_BRUSH_GENERATED (brush))
angle = PIKA_BRUSH_GENERATED (brush)->angle;
else
success = FALSE;
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_double (pika_value_array_index (return_vals, 1), angle);
return return_vals;
}
static PikaValueArray *
brush_set_angle_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaBrush *brush;
gdouble angle_in;
gdouble angle_out = 0.0;
brush = g_value_get_object (pika_value_array_index (args, 0));
angle_in = g_value_get_double (pika_value_array_index (args, 1));
if (success)
{
if (PIKA_IS_BRUSH_GENERATED (brush) &&
pika_data_is_writable (PIKA_DATA (brush)))
{
pika_brush_generated_set_angle (PIKA_BRUSH_GENERATED (brush),
angle_in);
angle_out = PIKA_BRUSH_GENERATED (brush)->angle;
}
else
{
success = FALSE;
}
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_double (pika_value_array_index (return_vals, 1), angle_out);
return return_vals;
}
void
register_brush_procs (PikaPDB *pdb)
{
PikaProcedure *procedure;
/*
* pika-brush-new
*/
procedure = pika_procedure_new (brush_new_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-brush-new");
pika_procedure_set_static_help (procedure,
"Create a new generated brush having default parameters.",
"Creates a new, parametric brush.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2004");
pika_procedure_add_argument (procedure,
pika_param_spec_string ("name",
"name",
"The requested name of the new brush",
FALSE, FALSE, TRUE,
NULL,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
pika_param_spec_brush ("brush",
"brush",
"The brush",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-brush-get-by-name
*/
procedure = pika_procedure_new (brush_get_by_name_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-brush-get-by-name");
pika_procedure_set_static_help (procedure,
"Returns the brush with the given name.",
"Search and return an existing brush with the name in argument, or nothing if no brush has this name.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2023");
pika_procedure_add_argument (procedure,
pika_param_spec_string ("name",
"name",
"The name of the brush",
FALSE, FALSE, TRUE,
NULL,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
pika_param_spec_brush ("brush",
"brush",
"The brush",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-brush-is-generated
*/
procedure = pika_procedure_new (brush_is_generated_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-brush-is-generated");
pika_procedure_set_static_help (procedure,
"Whether the brush is generated (parametric versus raster).",
"Returns TRUE when brush is parametric.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Bill Skaggs <weskaggs@primate.ucdavis.edu>",
"Bill Skaggs",
"2004");
pika_procedure_add_argument (procedure,
pika_param_spec_brush ("brush",
"brush",
"The brush",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_boolean ("generated",
"generated",
"TRUE if the brush is generated",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-brush-get-info
*/
procedure = pika_procedure_new (brush_get_info_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-brush-get-info");
pika_procedure_set_static_help (procedure,
"Gets information about the brush.",
"Gets information about the brush: brush extents (width and height), color depth and mask depth (bpp). The color bpp is zero when the brush is parametric versus raster.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2004");
pika_procedure_add_argument (procedure,
pika_param_spec_brush ("brush",
"brush",
"The brush",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_int ("width",
"width",
"The brush width",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_int ("height",
"height",
"The brush height",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_int ("mask-bpp",
"mask bpp",
"The brush mask bpp",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_int ("color-bpp",
"color bpp",
"The brush color bpp",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-brush-get-pixels
*/
procedure = pika_procedure_new (brush_get_pixels_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-brush-get-pixels");
pika_procedure_set_static_help (procedure,
"Gets information about the brush.",
"Gets information about the brush: the brush extents (width and height) and its pixels data. The color bpp is zero and pixels empty when the brush is parametric versus raster.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2004");
pika_procedure_add_argument (procedure,
pika_param_spec_brush ("brush",
"brush",
"The brush",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_int ("width",
"width",
"The brush width",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_int ("height",
"height",
"The brush height",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_int ("mask-bpp",
"mask bpp",
"The brush mask bpp",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_boxed ("mask-bytes",
"mask bytes",
"The brush mask data",
G_TYPE_BYTES,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_int ("color-bpp",
"color bpp",
"The brush color bpp",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_boxed ("color-bytes",
"color bytes",
"The brush color data",
G_TYPE_BYTES,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-brush-get-spacing
*/
procedure = pika_procedure_new (brush_get_spacing_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-brush-get-spacing");
pika_procedure_set_static_help (procedure,
"Gets the brush spacing, the stamping frequency.",
"Returns the spacing setting for the brush. Spacing is an integer between 0 and 1000 which represents a percentage of the maximum of the width and height of the mask. Both parametric and raster brushes have a spacing.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2004");
pika_procedure_add_argument (procedure,
pika_param_spec_brush ("brush",
"brush",
"The brush",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_int ("spacing",
"spacing",
"The brush spacing",
0, 1000, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-brush-set-spacing
*/
procedure = pika_procedure_new (brush_set_spacing_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-brush-set-spacing");
pika_procedure_set_static_help (procedure,
"Sets the brush spacing.",
"Set the spacing for the brush. The spacing must be an integer between 0 and 1000. Both parametric and raster brushes have a spacing. Returns an error when the brush is not editable. Create a new or copied brush or to get an editable brush.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Bill Skaggs <weskaggs@primate.ucdavis.edu>",
"Bill Skaggs",
"2004");
pika_procedure_add_argument (procedure,
pika_param_spec_brush ("brush",
"brush",
"The brush",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_int ("spacing",
"spacing",
"The brush spacing",
0, 1000, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-brush-get-shape
*/
procedure = pika_procedure_new (brush_get_shape_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-brush-get-shape");
pika_procedure_set_static_help (procedure,
"Gets the shape of a generated brush.",
"Gets the shape of a generated brush. Returns an error when called for a non-parametric brush. The choices for shape are Circle (PIKA_BRUSH_GENERATED_CIRCLE), Square (PIKA_BRUSH_GENERATED_SQUARE), and Diamond (PIKA_BRUSH_GENERATED_DIAMOND). Other shapes might be added in the future.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Bill Skaggs <weskaggs@primate.ucdavis.edu>",
"Bill Skaggs",
"2004");
pika_procedure_add_argument (procedure,
pika_param_spec_brush ("brush",
"brush",
"The brush",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_enum ("shape",
"shape",
"The brush shape",
PIKA_TYPE_BRUSH_GENERATED_SHAPE,
PIKA_BRUSH_GENERATED_CIRCLE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-brush-set-shape
*/
procedure = pika_procedure_new (brush_set_shape_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-brush-set-shape");
pika_procedure_set_static_help (procedure,
"Sets the shape of a generated brush.",
"Sets the shape of a generated brush. Returns an error when brush is non-parametric or not editable. The choices for shape are Circle (PIKA_BRUSH_GENERATED_CIRCLE), Square (PIKA_BRUSH_GENERATED_SQUARE), and Diamond (PIKA_BRUSH_GENERATED_DIAMOND).",
NULL);
pika_procedure_set_static_attribution (procedure,
"Bill Skaggs <weskaggs@primate.ucdavis.edu>",
"Bill Skaggs",
"2004");
pika_procedure_add_argument (procedure,
pika_param_spec_brush ("brush",
"brush",
"The brush",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_enum ("shape-in",
"shape in",
"The brush shape",
PIKA_TYPE_BRUSH_GENERATED_SHAPE,
PIKA_BRUSH_GENERATED_CIRCLE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_enum ("shape-out",
"shape out",
"The brush shape actually assigned",
PIKA_TYPE_BRUSH_GENERATED_SHAPE,
PIKA_BRUSH_GENERATED_CIRCLE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-brush-get-radius
*/
procedure = pika_procedure_new (brush_get_radius_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-brush-get-radius");
pika_procedure_set_static_help (procedure,
"Gets the radius of a generated brush.",
"Gets the radius of a generated brush. Returns an error when called for a non-parametric brush.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Bill Skaggs <weskaggs@primate.ucdavis.edu>",
"Bill Skaggs",
"2004");
pika_procedure_add_argument (procedure,
pika_param_spec_brush ("brush",
"brush",
"The brush",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_double ("radius",
"radius",
"The radius of the brush in pixels",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-brush-set-radius
*/
procedure = pika_procedure_new (brush_set_radius_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-brush-set-radius");
pika_procedure_set_static_help (procedure,
"Sets the radius of a generated brush.",
"Sets the radius for a generated brush. Clamps radius to [0.0, 32767.0]. Returns the clamped value. Returns an error when brush is non-parametric or not editable.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Bill Skaggs <weskaggs@primate.ucdavis.edu>",
"Bill Skaggs",
"2004");
pika_procedure_add_argument (procedure,
pika_param_spec_brush ("brush",
"brush",
"The brush",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("radius-in",
"radius in",
"The desired brush radius in pixel",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_double ("radius-out",
"radius out",
"The brush radius actually assigned",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-brush-get-spikes
*/
procedure = pika_procedure_new (brush_get_spikes_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-brush-get-spikes");
pika_procedure_set_static_help (procedure,
"Gets the number of spikes for a generated brush.",
"Gets the number of spikes for a generated brush. Returns an error when called for a non-parametric brush.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Bill Skaggs <weskaggs@primate.ucdavis.edu>",
"Bill Skaggs",
"2004");
pika_procedure_add_argument (procedure,
pika_param_spec_brush ("brush",
"brush",
"The brush",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_int ("spikes",
"spikes",
"The number of spikes on the brush.",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-brush-set-spikes
*/
procedure = pika_procedure_new (brush_set_spikes_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-brush-set-spikes");
pika_procedure_set_static_help (procedure,
"Sets the number of spikes for a generated brush.",
"Sets the number of spikes for a generated brush. Clamps spikes to [2,20]. Returns the clamped value. Returns an error when brush is non-parametric or not editable.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Bill Skaggs <weskaggs@primate.ucdavis.edu>",
"Bill Skaggs",
"2004");
pika_procedure_add_argument (procedure,
pika_param_spec_brush ("brush",
"brush",
"The brush",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_int ("spikes-in",
"spikes in",
"The desired number of spikes",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_int ("spikes-out",
"spikes out",
"The number of spikes actually assigned",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-brush-get-hardness
*/
procedure = pika_procedure_new (brush_get_hardness_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-brush-get-hardness");
pika_procedure_set_static_help (procedure,
"Gets the hardness of a generated brush.",
"Gets the hardness of a generated brush. The hardness of a brush is the amount its intensity fades at the outside edge, as a float between 0.0 and 1.0. Returns an error when called for a non-parametric brush.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Bill Skaggs <weskaggs@primate.ucdavis.edu>",
"Bill Skaggs",
"2004");
pika_procedure_add_argument (procedure,
pika_param_spec_brush ("brush",
"brush",
"The brush",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_double ("hardness",
"hardness",
"The hardness of the brush.",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-brush-set-hardness
*/
procedure = pika_procedure_new (brush_set_hardness_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-brush-set-hardness");
pika_procedure_set_static_help (procedure,
"Sets the hardness of a generated brush.",
"Sets the hardness for a generated brush. Clamps hardness to [0.0, 1.0]. Returns the clamped value. Returns an error when brush is non-parametric or not editable.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Bill Skaggs <weskaggs@primate.ucdavis.edu>",
"Bill Skaggs",
"2004");
pika_procedure_add_argument (procedure,
pika_param_spec_brush ("brush",
"brush",
"The brush",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("hardness-in",
"hardness in",
"The desired brush hardness",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_double ("hardness-out",
"hardness out",
"The brush hardness actually assigned",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-brush-get-aspect-ratio
*/
procedure = pika_procedure_new (brush_get_aspect_ratio_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-brush-get-aspect-ratio");
pika_procedure_set_static_help (procedure,
"Gets the aspect ratio of a generated brush.",
"Gets the aspect ratio of a generated brush. Returns an error when called for a non-parametric brush. The aspect ratio is a float between 0.0 and 1000.0.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Bill Skaggs <weskaggs@primate.ucdavis.edu>",
"Bill Skaggs",
"2004");
pika_procedure_add_argument (procedure,
pika_param_spec_brush ("brush",
"brush",
"The brush",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_double ("aspect-ratio",
"aspect ratio",
"The aspect ratio of the brush.",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-brush-set-aspect-ratio
*/
procedure = pika_procedure_new (brush_set_aspect_ratio_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-brush-set-aspect-ratio");
pika_procedure_set_static_help (procedure,
"Sets the aspect ratio of a generated brush.",
"Sets the aspect ratio for a generated brush. Clamps aspect ratio to [0.0, 1000.0]. Returns the clamped value. Returns an error when brush is non-parametric or not editable.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Bill Skaggs <weskaggs@primate.ucdavis.edu>",
"Bill Skaggs",
"2004");
pika_procedure_add_argument (procedure,
pika_param_spec_brush ("brush",
"brush",
"The brush",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("aspect-ratio-in",
"aspect ratio in",
"The desired brush aspect ratio",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_double ("aspect-ratio-out",
"aspect ratio out",
"The brush aspect ratio actually assigned",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-brush-get-angle
*/
procedure = pika_procedure_new (brush_get_angle_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-brush-get-angle");
pika_procedure_set_static_help (procedure,
"Gets the rotation angle of a generated brush.",
"Gets the angle of rotation for a generated brush. Returns an error when called for a non-parametric brush.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Bill Skaggs <weskaggs@primate.ucdavis.edu>",
"Bill Skaggs",
"2004");
pika_procedure_add_argument (procedure,
pika_param_spec_brush ("brush",
"brush",
"The brush",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_double ("angle",
"angle",
"The rotation angle of the brush in degree.",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-brush-set-angle
*/
procedure = pika_procedure_new (brush_set_angle_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-brush-set-angle");
pika_procedure_set_static_help (procedure,
"Sets the rotation angle of a generated brush.",
"Sets the rotation angle for a generated brush. Sets the angle modulo 180, in the range [-180.0, 180.0]. Returns the clamped value. Returns an error when brush is non-parametric or not editable.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Bill Skaggs <weskaggs@primate.ucdavis.edu>",
"Bill Skaggs",
"2004");
pika_procedure_add_argument (procedure,
pika_param_spec_brush ("brush",
"brush",
"The brush",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("angle-in",
"angle in",
"The desired brush rotation angle in degrees",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_double ("angle-out",
"angle out",
"The brush rotation angle actually assigned",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
}