diff --git a/app/path/gimpvectorlayer.c b/app/path/gimpvectorlayer.c
index a31d68232a..9594ff1cfb 100644
--- a/app/path/gimpvectorlayer.c
+++ b/app/path/gimpvectorlayer.c
@@ -1,782 +1,801 @@
-/* GIMP - The GNU Image Manipulation Program
- * Copyright (C) 1995 Spencer Kimball and Peter Mattis
- *
- * gimpvectorlayer.c
- *
- * Copyright 2006 Hendrik Boom
- *
- * 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 .
- */
-
-#include "config.h"
-
-#include
-
-#include
-#include
-#include
-
-#include "libgimpcolor/gimpcolor.h"
-#include "libgimpconfig/gimpconfig.h"
-#include "libgimpmath/gimpmath.h"
-
-#include "path-types.h"
-
-#include "core/gimp.h"
-#include "core/gimpdrawable-fill.h"
-#include "core/gimpdrawable-stroke.h"
-#include "core/gimpimage.h"
-#include "core/gimpselection.h"
-#include "core/gimpimage-undo.h"
-#include "core/gimpimage-undo-push.h"
-#include "core/gimpstrokeoptions.h"
-#include "core/gimpparasitelist.h"
-
-#include "gimpvectorlayer.h"
-#include "gimpvectorlayeroptions.h"
-#include "gimppath.h"
-
-#include "gimp-intl.h"
-
-
-enum
-{
- PROP_0,
- PROP_VECTOR_LAYER_OPTIONS,
- PROP_MODIFIED
-};
-
-
-/* local function declarations */
-
-static void gimp_vector_layer_finalize (GObject *object);
-static void gimp_vector_layer_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
-static void gimp_vector_layer_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gimp_vector_layer_set_vector_options
- (GimpVectorLayer *layer,
- GimpVectorLayerOptions *options);
-
-static void gimp_vector_layer_set_buffer (GimpDrawable *drawable,
- gboolean push_undo,
- const gchar *undo_desc,
- GeglBuffer *buffer,
- const GeglRectangle *bounds);
-static void gimp_vector_layer_push_undo (GimpDrawable *drawable,
- const gchar *undo_desc,
- GeglBuffer *buffer,
- gint x,
- gint y,
- gint width,
- gint height);
-
-static gint64 gimp_vector_layer_get_memsize (GimpObject *object,
- gint64 *gui_size);
-
-static GimpItem * gimp_vector_layer_duplicate (GimpItem *item,
- GType new_type);
-
-static void gimp_vector_layer_translate (GimpLayer *layer,
- gint offset_x,
- gint offset_y);
-static void gimp_vector_layer_scale (GimpItem *item,
- gint new_width,
- gint new_height,
- gint new_offset_x,
- gint new_offset_y,
- GimpInterpolationType interp_type,
- GimpProgress *progress);
-static void gimp_vector_layer_flip (GimpItem *item,
- GimpContext *context,
- GimpOrientationType flip_type,
- gdouble axis,
- gboolean clip_result);
-static void gimp_vector_layer_rotate (GimpItem *item,
- GimpContext *context,
- GimpRotationType rotate_type,
- gdouble center_x,
- gdouble center_y,
- gboolean clip_result);
-static void gimp_vector_layer_transform (GimpItem *item,
- GimpContext *context,
- const GimpMatrix3 *matrix,
- GimpTransformDirection direction,
- GimpInterpolationType interp_type,
- GimpTransformResize clip_result,
- GimpProgress *progress,
- gboolean push_undo);
-
-static gboolean gimp_vector_layer_render (GimpVectorLayer *layer);
-static void gimp_vector_layer_render_path (GimpVectorLayer *layer);
-static void gimp_vector_layer_changed_options (GimpVectorLayer *layer);
-
-static void gimp_vector_layer_removed (GimpItem *item);
-
-static void gimp_vector_layer_removed_options_path
- (GimpVectorLayer *layer);
-
-
-G_DEFINE_TYPE (GimpVectorLayer, gimp_vector_layer, GIMP_TYPE_LAYER)
-
-#define parent_class gimp_vector_layer_parent_class
-
-
-static void
-gimp_vector_layer_class_init (GimpVectorLayerClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
- GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
- GimpItemClass *item_class = GIMP_ITEM_CLASS (klass);
- GimpDrawableClass *drawable_class = GIMP_DRAWABLE_CLASS (klass);
- GimpLayerClass *layer_class = GIMP_LAYER_CLASS (klass);
-
- drawable_class->set_buffer = gimp_vector_layer_set_buffer;
- drawable_class->push_undo = gimp_vector_layer_push_undo;
-
- object_class->finalize = gimp_vector_layer_finalize;
- object_class->set_property = gimp_vector_layer_set_property;
- object_class->get_property = gimp_vector_layer_get_property;
-
- gimp_object_class->get_memsize = gimp_vector_layer_get_memsize;
-
- viewable_class->default_icon_name = "gimp-vector-layer";
- viewable_class->default_name = _("Vector Layer");
-
- layer_class->translate = gimp_vector_layer_translate;
-
- item_class->removed = gimp_vector_layer_removed;
- item_class->duplicate = gimp_vector_layer_duplicate;
- item_class->scale = gimp_vector_layer_scale;
- item_class->flip = gimp_vector_layer_flip;
- item_class->rotate = gimp_vector_layer_rotate;
- item_class->transform = gimp_vector_layer_transform;
- item_class->rename_desc = _("Rename Vector Layer");
- item_class->translate_desc = _("Move Vector Layer");
- item_class->scale_desc = _("Scale Vector Layer");
- item_class->resize_desc = _("Resize Vector Layer");
- item_class->flip_desc = _("Flip Vector Layer");
- item_class->rotate_desc = _("Rotate Vector Layer");
- item_class->transform_desc = _("Transform Vector Layer");
-
- GIMP_CONFIG_PROP_OBJECT (object_class, PROP_VECTOR_LAYER_OPTIONS,
- "vector-layer-options", NULL, NULL,
- GIMP_TYPE_VECTOR_LAYER_OPTIONS,
- G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
-
- GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_MODIFIED,
- "modified",
- NULL, NULL,
- FALSE,
- GIMP_PARAM_STATIC_STRINGS);
-}
-
-static void
-gimp_vector_layer_init (GimpVectorLayer *layer)
-{
- layer->options = NULL;
- layer->modified = FALSE;
-}
-
-static void
-gimp_vector_layer_finalize (GObject *object)
-{
- GimpVectorLayer *layer = GIMP_VECTOR_LAYER (object);
-
- if (layer->options)
- {
- g_object_unref (layer->options);
- layer->options = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gimp_vector_layer_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GimpVectorLayer *vector_layer = GIMP_VECTOR_LAYER (object);
-
- switch (property_id)
- {
- case PROP_VECTOR_LAYER_OPTIONS:
- g_value_set_object (value, vector_layer->options);
- break;
- case PROP_MODIFIED:
- g_value_set_boolean (value, vector_layer->modified);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-gimp_vector_layer_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GimpVectorLayer *vector_layer = GIMP_VECTOR_LAYER (object);
-
- switch (property_id)
- {
- case PROP_VECTOR_LAYER_OPTIONS:
- gimp_vector_layer_set_vector_options (vector_layer, g_value_get_object (value));
- break;
- case PROP_MODIFIED:
- vector_layer->modified = g_value_get_boolean (value);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-gimp_vector_layer_set_vector_options (GimpVectorLayer *layer,
- GimpVectorLayerOptions *options)
-{
- if (layer->options)
- {
- g_signal_handlers_disconnect_by_func (layer->options,
- G_CALLBACK (gimp_vector_layer_changed_options),
- layer);
-
- if (layer->options->path)
- g_signal_handlers_disconnect_by_func (layer->options->path,
- G_CALLBACK (gimp_vector_layer_removed_options_path),
- layer);
-
- g_object_unref (layer->options);
- layer->options = NULL;
- }
-
- if (options)
- g_set_object (&layer->options, options);
-
- gimp_vector_layer_changed_options (layer);
-
- if (layer->options)
- {
- if (layer->options->path)
- g_signal_connect_object (layer->options->path, "removed",
- G_CALLBACK (gimp_vector_layer_removed_options_path),
- layer, G_CONNECT_SWAPPED);
-
- g_signal_connect_object (layer->options, "notify",
- G_CALLBACK (gimp_vector_layer_changed_options),
- layer, G_CONNECT_SWAPPED);
- }
-
- g_object_notify (G_OBJECT (layer), "vector-layer-options");
-}
-
-static void
-gimp_vector_layer_set_buffer (GimpDrawable *drawable,
- gboolean push_undo,
- const gchar *undo_desc,
- GeglBuffer *buffer,
- const GeglRectangle *bounds)
-{
- GimpVectorLayer *layer = GIMP_VECTOR_LAYER (drawable);
- GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
-
- if (push_undo && ! layer->modified)
- gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_DRAWABLE_MOD,
- undo_desc);
-
- GIMP_DRAWABLE_CLASS (parent_class)->set_buffer (drawable,
- push_undo, undo_desc,
- buffer, bounds);
-
- if (push_undo && ! layer->modified)
- {
- gimp_image_undo_push_vector_layer_modified (image, NULL, layer);
-
- g_object_set (drawable, "modified", TRUE, NULL);
-
- gimp_image_undo_group_end (image);
- }
-}
-
-static void
-gimp_vector_layer_push_undo (GimpDrawable *drawable,
- const gchar *undo_desc,
- GeglBuffer *buffer,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GimpVectorLayer *layer = GIMP_VECTOR_LAYER (drawable);
- GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
-
- if (! layer->modified)
- gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_DRAWABLE, undo_desc);
-
- GIMP_DRAWABLE_CLASS (parent_class)->push_undo (drawable, undo_desc,
- buffer,
- x, y, width, height);
-
- if (! layer->modified)
- {
- gimp_image_undo_push_vector_layer_modified (image, NULL, layer);
-
- g_object_set (drawable, "modified", TRUE, NULL);
-
- gimp_image_undo_group_end (image);
- }
-}
-
-static gint64
-gimp_vector_layer_get_memsize (GimpObject *object,
- gint64 *gui_size)
-{
- GimpVectorLayer *vector_layer = GIMP_VECTOR_LAYER (object);
- gint64 memsize = 0;
-
- memsize += gimp_object_get_memsize (GIMP_OBJECT (vector_layer->options),
- gui_size);
-
- return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
- gui_size);
-}
-
-static GimpItem *
-gimp_vector_layer_duplicate (GimpItem *item,
- GType new_type)
-{
- GimpItem *new_item;
-
- g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_DRAWABLE), NULL);
-
- new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type);
-
- if (GIMP_IS_VECTOR_LAYER (new_item))
- {
- GimpVectorLayer *vector_layer = GIMP_VECTOR_LAYER (item);
- GimpVectorLayer *new_vector_layer = GIMP_VECTOR_LAYER (new_item);
-
- if (vector_layer->options)
- {
- GimpVectorLayerOptions *new_options =
- gimp_config_duplicate (GIMP_CONFIG (vector_layer->options));
-
- if (vector_layer->options->path)
- {
- GimpPath *path = gimp_vector_layer_get_path (vector_layer);
- GimpPath *new_path;
-
- new_path = GIMP_PATH (gimp_item_duplicate (GIMP_ITEM (path),
- G_TYPE_FROM_INSTANCE (GIMP_ITEM (path))));
-
- g_object_set (new_options, "path", new_path, NULL);
- }
-
- g_object_set (new_vector_layer,
- "vector-layer-options", new_options,
- NULL);
- g_object_unref (new_options);
- }
- }
-
- return new_item;
-}
-
-static void
-gimp_vector_layer_translate (GimpLayer *layer,
- gint offset_x,
- gint offset_y)
-{
- GimpVectorLayer *vector_layer = GIMP_VECTOR_LAYER (layer);
-
- if (vector_layer->options && vector_layer->options->path)
- {
- gimp_item_translate (GIMP_ITEM (vector_layer->options->path),
- offset_x, offset_y, FALSE);
- }
- else
- {
- GIMP_LAYER_CLASS (parent_class)->translate (layer, offset_x, offset_y);
- }
-}
-
-static void
-gimp_vector_layer_scale (GimpItem *item,
- gint new_width,
- gint new_height,
- gint new_offset_x,
- gint new_offset_y,
- GimpInterpolationType interp_type,
- GimpProgress *progress)
-{
- GimpVectorLayer *vector_layer = GIMP_VECTOR_LAYER (item);
-
- if (vector_layer->options && vector_layer->options->path)
- {
- gimp_item_scale (GIMP_ITEM (vector_layer->options->path),
- new_width, new_height, new_offset_x, new_offset_y,
- interp_type, progress);
- }
- else
- {
- GIMP_ITEM_CLASS (parent_class)->scale (item, new_width, new_height,
- new_offset_x, new_offset_y,
- interp_type, progress);
- }
-}
-
-static void
-gimp_vector_layer_flip (GimpItem *item,
- GimpContext *context,
- GimpOrientationType flip_type,
- gdouble axis,
- gboolean clip_result)
-{
- GimpVectorLayer *vector_layer = GIMP_VECTOR_LAYER (item);
-
- if (vector_layer->options && vector_layer->options->path)
- {
- gimp_item_flip (GIMP_ITEM (vector_layer->options->path),
- context, flip_type, axis, clip_result);
- }
- else
- {
- GIMP_ITEM_CLASS (parent_class)->flip (item, context, flip_type,
- axis, clip_result);
- }
-}
-
-static void
-gimp_vector_layer_rotate (GimpItem *item,
- GimpContext *context,
- GimpRotationType rotate_type,
- gdouble center_x,
- gdouble center_y,
- gboolean clip_result)
-{
- GimpVectorLayer *vector_layer = GIMP_VECTOR_LAYER (item);
-
- if (vector_layer->options && vector_layer->options->path)
- {
- gimp_item_rotate (GIMP_ITEM (vector_layer->options->path),
- context, rotate_type, center_x, center_y, clip_result);
- }
- else
- {
- GIMP_ITEM_CLASS (parent_class)->rotate (item, context, rotate_type,
- center_x, center_y, clip_result);
- }
-}
-
-static void
-gimp_vector_layer_transform (GimpItem *item,
- GimpContext *context,
- const GimpMatrix3 *matrix,
- GimpTransformDirection direction,
- GimpInterpolationType interp_type,
- GimpTransformResize clip_result,
- GimpProgress *progress,
- gboolean push_undo)
-{
- GimpVectorLayer *vector_layer = GIMP_VECTOR_LAYER (item);
-
- if (vector_layer->options && vector_layer->options->path)
- {
- gimp_item_transform (GIMP_ITEM (vector_layer->options->path),
- context, matrix, direction, interp_type,
- clip_result, progress);
- }
- else
- {
- GIMP_ITEM_CLASS (parent_class)->transform (item, context, matrix,
- direction, interp_type,
- clip_result, progress, push_undo);
- }
-}
-
-static void
-gimp_vector_layer_removed_options_path (GimpVectorLayer *layer)
-{
- if (layer->options)
- {
- gimp_image_undo_push_vector_layer (gimp_item_get_image (GIMP_ITEM (layer)),
- _("Discard Vector Informations"),
- layer, NULL);
-
- g_object_set (layer->options, "path", NULL, NULL);
- }
-}
-
-static void
-gimp_vector_layer_removed (GimpItem *item)
-{
- GimpVectorLayer *vector_layer = GIMP_VECTOR_LAYER (item);
-
- if (vector_layer->options && vector_layer->options->path)
- g_signal_handlers_disconnect_by_func (vector_layer->options->path,
- G_CALLBACK (gimp_vector_layer_removed_options_path),
- vector_layer);
-
- GIMP_ITEM_CLASS (parent_class)->removed (item);
-}
-
-
-/* public functions */
-
-/**
- * gimp_vector_layer_new:
- * @image: the #GimpImage the layer should belong to
- * @path: the #GimpPath object the layer should render
- * @context: the #GimpContext from which to pull context properties
- *
- * Creates a new vector layer.
- *
- * Return value: a new #GimpVectorLayer or %NULL in case of a problem
- **/
-GimpVectorLayer *
-gimp_vector_layer_new (GimpImage *image,
- GimpPath *path,
- GimpContext *context)
-{
- GimpVectorLayer *layer;
- GimpVectorLayerOptions *options;
- gint x = 0;
- gint y = 0;
- gint width = gimp_image_get_width (image);
- gint height = gimp_image_get_height (image);
-
- g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
- g_return_val_if_fail (GIMP_IS_PATH (path), NULL);
- g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
-
- options = gimp_vector_layer_options_new (image, path, context);
-
- gimp_item_bounds (GIMP_ITEM (path), &x, &y, &width, &height);
-
- /* Set boundaries to image size if it's a blank path */
- if (width == 0 || height == 0)
- {
- width = gimp_image_get_width (image);
- height = gimp_image_get_height (image);
- }
-
- layer =
- GIMP_VECTOR_LAYER (gimp_drawable_new (GIMP_TYPE_VECTOR_LAYER,
- image, NULL,
- x, y, width, height,
- gimp_image_get_layer_format (image,
- TRUE)));
-
- gimp_object_set_name (GIMP_OBJECT (layer),
- gimp_object_get_name (GIMP_OBJECT (path)));
-
- gimp_layer_set_mode (GIMP_LAYER (layer),
- gimp_image_get_default_new_layer_mode (image),
- FALSE);
-
- gimp_vector_layer_set_vector_options (layer, options);
- g_object_unref (options);
-
- return layer;
-}
-
-/**
- * gimp_vector_layer_get_path:
- * @layer: a #GimpVectorLayer
- *
- * Gets the path from @layer if one is associated with it.
- *
- * Return value: a #GimpPath or %NULL if no path is set.
- */
-GimpPath *
-gimp_vector_layer_get_path (GimpVectorLayer *layer)
-{
- g_return_val_if_fail (GIMP_IS_VECTOR_LAYER (layer), NULL);
-
- if (gimp_item_is_vector_layer (GIMP_ITEM (layer)))
- return layer->options->path;
-
- return NULL;
-}
-
-void
-gimp_vector_layer_refresh (GimpVectorLayer *layer)
-{
- if (layer->options)
- gimp_vector_layer_render (layer);
-}
-
-/**
- * gimp_vector_layer_discard:
- * @layer: a #GimpVectorLayer
- *
- * Discards the vector information. This makes @layer behave like a
- * normal layer.
- */
-void
-gimp_vector_layer_discard (GimpVectorLayer *layer)
-{
- g_return_if_fail (GIMP_IS_VECTOR_LAYER (layer));
- g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)));
-
- if (! layer->options)
- return;
-
- if (layer->options->path)
- gimp_image_undo_push_vector_layer (gimp_item_get_image (GIMP_ITEM (layer)),
- _("Discard Vector Information"),
- layer, NULL);
-
- g_object_set (layer, "vector-layer-options", NULL, NULL);
-
- gimp_viewable_invalidate_preview (GIMP_VIEWABLE (layer));
- gimp_image_flush (gimp_item_get_image (GIMP_ITEM (layer)));
-}
-
-gboolean
-gimp_item_is_vector_layer (GimpItem *item)
-{
- return (GIMP_IS_VECTOR_LAYER (item) &&
- GIMP_VECTOR_LAYER (item)->options);
-}
-
-
-/* private functions */
-
-static gboolean
-gimp_vector_layer_render (GimpVectorLayer *layer)
-{
- GimpDrawable *drawable = GIMP_DRAWABLE (layer);
- GeglBuffer *buffer = NULL;
- GimpItem *item = GIMP_ITEM (layer);
- GimpImage *image = gimp_item_get_image (item);
- gint layer_x = 0;
- gint layer_y = 0;
- gint x = 0;
- gint y = 0;
- gint width = gimp_image_get_width (image);
- gint height = gimp_image_get_height (image);
- gdouble stroke = 0;
-
- g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
-
- g_object_freeze_notify (G_OBJECT (drawable));
-
- if (layer->options->enable_stroke)
- stroke = gimp_stroke_options_get_width (layer->options->stroke_options);
-
- /* Resize layer according to path size */
- gimp_item_get_offset (GIMP_ITEM (layer), &layer_x, &layer_y);
- gimp_item_bounds (GIMP_ITEM (layer->options->path), &x, &y, &width, &height);
-
- buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0,
- (gint) ceil (width + stroke),
- (gint) ceil (height + stroke)),
- gimp_drawable_get_format (drawable));
- gimp_drawable_set_buffer (drawable, FALSE, NULL, buffer);
- g_object_unref (buffer);
-
- gimp_item_set_offset (GIMP_ITEM (layer), x - (stroke / 2), y - (stroke / 2));
-
- /* make the layer background transparent */
- gimp_drawable_fill (GIMP_DRAWABLE (layer),
- gimp_get_user_context (image->gimp),
- GIMP_FILL_TRANSPARENT);
-
- /* render path to the layer */
- gimp_vector_layer_render_path (layer);
-
- g_object_thaw_notify (G_OBJECT (drawable));
-
- return TRUE;
-}
-
-static void
-gimp_vector_layer_render_path (GimpVectorLayer *layer)
-{
- GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
- GimpVectorLayerOptions *options = layer->options;
- GimpPath *path = NULL;
- GimpChannel *selection = gimp_image_get_mask (image);
- GList *drawables;
- GimpCustomStyle style;
-
- if (options)
- path = options->path;
-
- /* Don't mask these fill/stroke operations */
- gimp_selection_suspend (GIMP_SELECTION (selection));
-
- /* Convert from custom to standard styles */
- style = gimp_fill_options_get_custom_style (options->fill_options);
- if (style == GIMP_CUSTOM_STYLE_SOLID_COLOR ||
- ! gimp_context_get_pattern (GIMP_CONTEXT (options->fill_options)))
- gimp_fill_options_set_style (options->fill_options,
- GIMP_FILL_STYLE_FG_COLOR);
- else
- gimp_fill_options_set_style (options->fill_options,
- GIMP_FILL_STYLE_PATTERN);
-
- style =
- gimp_fill_options_get_custom_style (GIMP_FILL_OPTIONS (options->stroke_options));
- if (style == GIMP_CUSTOM_STYLE_SOLID_COLOR ||
- ! gimp_context_get_pattern (GIMP_CONTEXT (options->stroke_options)))
- gimp_fill_options_set_style (GIMP_FILL_OPTIONS (options->stroke_options),
- GIMP_FILL_STYLE_FG_COLOR);
- else
- gimp_fill_options_set_style (GIMP_FILL_OPTIONS (options->stroke_options),
- GIMP_FILL_STYLE_PATTERN);
-
- /* Fill the path object onto the layer */
- if (options->enable_fill)
- gimp_drawable_fill_path (GIMP_DRAWABLE (layer),
- options->fill_options,
- path, FALSE, NULL);
-
- drawables = g_list_prepend (NULL, GIMP_DRAWABLE (layer));
- /* stroke the path object onto the layer */
- if (options->enable_stroke && gimp_item_is_attached (GIMP_ITEM (path)))
- gimp_item_stroke (GIMP_ITEM (path), drawables,
- gimp_get_user_context (image->gimp),
- options->stroke_options,
- FALSE, FALSE,
- NULL, NULL);
-
- g_list_free (drawables);
-
- gimp_selection_resume (GIMP_SELECTION (selection));
-}
-
-static void
-gimp_vector_layer_changed_options (GimpVectorLayer *layer)
-{
- GimpItem *item = GIMP_ITEM (layer);
-
- if (layer->options && ! layer->options->path)
- gimp_vector_layer_discard (layer);
- else if (gimp_item_is_attached (item))
- gimp_vector_layer_refresh (layer);
-}
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpvectorlayer.c
+ *
+ * Copyright 2006 Hendrik Boom
+ *
+ * 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 .
+ */
+
+#include "config.h"
+
+#include
+
+#include
+#include
+#include
+
+#include "libgimpcolor/gimpcolor.h"
+#include "libgimpconfig/gimpconfig.h"
+#include "libgimpmath/gimpmath.h"
+
+#include "path-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpdrawable-fill.h"
+#include "core/gimpdrawable-stroke.h"
+#include "core/gimpimage.h"
+#include "core/gimpselection.h"
+#include "core/gimpimage-undo.h"
+#include "core/gimpimage-undo-push.h"
+#include "core/gimpstrokeoptions.h"
+#include "core/gimpparasitelist.h"
+
+#include "gimpvectorlayer.h"
+#include "gimpvectorlayeroptions.h"
+#include "gimppath.h"
+
+#include "gimp-intl.h"
+
+
+enum
+{
+ PROP_0,
+ PROP_VECTOR_LAYER_OPTIONS,
+ PROP_MODIFIED
+};
+
+
+/* local function declarations */
+
+static void gimp_vector_layer_finalize (GObject *object);
+static void gimp_vector_layer_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gimp_vector_layer_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_vector_layer_set_vector_options
+ (GimpVectorLayer *layer,
+ GimpVectorLayerOptions *options);
+
+static void gimp_vector_layer_set_buffer (GimpDrawable *drawable,
+ gboolean push_undo,
+ const gchar *undo_desc,
+ GeglBuffer *buffer,
+ const GeglRectangle *bounds);
+static void gimp_vector_layer_push_undo (GimpDrawable *drawable,
+ const gchar *undo_desc,
+ GeglBuffer *buffer,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+
+static gint64 gimp_vector_layer_get_memsize (GimpObject *object,
+ gint64 *gui_size);
+
+static GimpItem * gimp_vector_layer_duplicate (GimpItem *item,
+ GType new_type);
+
+static void gimp_vector_layer_translate (GimpLayer *layer,
+ gint offset_x,
+ gint offset_y);
+static void gimp_vector_layer_scale (GimpItem *item,
+ gint new_width,
+ gint new_height,
+ gint new_offset_x,
+ gint new_offset_y,
+ GimpInterpolationType interp_type,
+ GimpProgress *progress);
+static void gimp_vector_layer_flip (GimpItem *item,
+ GimpContext *context,
+ GimpOrientationType flip_type,
+ gdouble axis,
+ gboolean clip_result);
+static void gimp_vector_layer_rotate (GimpItem *item,
+ GimpContext *context,
+ GimpRotationType rotate_type,
+ gdouble center_x,
+ gdouble center_y,
+ gboolean clip_result);
+static void gimp_vector_layer_transform (GimpItem *item,
+ GimpContext *context,
+ const GimpMatrix3 *matrix,
+ GimpTransformDirection direction,
+ GimpInterpolationType interp_type,
+ GimpTransformResize clip_result,
+ GimpProgress *progress,
+ gboolean push_undo);
+
+static gboolean gimp_vector_layer_render (GimpVectorLayer *layer);
+static void gimp_vector_layer_render_path (GimpVectorLayer *layer);
+static void gimp_vector_layer_changed_options (GimpVectorLayer *layer);
+
+static void gimp_vector_layer_removed (GimpItem *item);
+
+static void gimp_vector_layer_removed_options_path
+ (GimpVectorLayer *layer);
+
+
+G_DEFINE_TYPE (GimpVectorLayer, gimp_vector_layer, GIMP_TYPE_LAYER)
+
+#define parent_class gimp_vector_layer_parent_class
+
+
+static void
+gimp_vector_layer_class_init (GimpVectorLayerClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
+ GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
+ GimpItemClass *item_class = GIMP_ITEM_CLASS (klass);
+ GimpDrawableClass *drawable_class = GIMP_DRAWABLE_CLASS (klass);
+ GimpLayerClass *layer_class = GIMP_LAYER_CLASS (klass);
+
+ drawable_class->set_buffer = gimp_vector_layer_set_buffer;
+ drawable_class->push_undo = gimp_vector_layer_push_undo;
+
+ object_class->finalize = gimp_vector_layer_finalize;
+ object_class->set_property = gimp_vector_layer_set_property;
+ object_class->get_property = gimp_vector_layer_get_property;
+
+ gimp_object_class->get_memsize = gimp_vector_layer_get_memsize;
+
+ viewable_class->default_icon_name = "gimp-vector-layer";
+ viewable_class->default_name = _("Vector Layer");
+
+ layer_class->translate = gimp_vector_layer_translate;
+
+ item_class->removed = gimp_vector_layer_removed;
+ item_class->duplicate = gimp_vector_layer_duplicate;
+ item_class->scale = gimp_vector_layer_scale;
+ item_class->flip = gimp_vector_layer_flip;
+ item_class->rotate = gimp_vector_layer_rotate;
+ item_class->transform = gimp_vector_layer_transform;
+ item_class->rename_desc = _("Rename Vector Layer");
+ item_class->translate_desc = _("Move Vector Layer");
+ item_class->scale_desc = _("Scale Vector Layer");
+ item_class->resize_desc = _("Resize Vector Layer");
+ item_class->flip_desc = _("Flip Vector Layer");
+ item_class->rotate_desc = _("Rotate Vector Layer");
+ item_class->transform_desc = _("Transform Vector Layer");
+
+ GIMP_CONFIG_PROP_OBJECT (object_class, PROP_VECTOR_LAYER_OPTIONS,
+ "vector-layer-options", NULL, NULL,
+ GIMP_TYPE_VECTOR_LAYER_OPTIONS,
+ G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
+
+ GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_MODIFIED,
+ "modified",
+ NULL, NULL,
+ FALSE,
+ GIMP_PARAM_STATIC_STRINGS);
+}
+
+static void
+gimp_vector_layer_init (GimpVectorLayer *layer)
+{
+ layer->options = NULL;
+ layer->modified = FALSE;
+}
+
+static void
+gimp_vector_layer_finalize (GObject *object)
+{
+ GimpVectorLayer *layer = GIMP_VECTOR_LAYER (object);
+
+ if (layer->options)
+ {
+ g_object_unref (layer->options);
+ layer->options = NULL;
+ }
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gimp_vector_layer_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GimpVectorLayer *vector_layer = GIMP_VECTOR_LAYER (object);
+
+ switch (property_id)
+ {
+ case PROP_VECTOR_LAYER_OPTIONS:
+ g_value_set_object (value, vector_layer->options);
+ break;
+ case PROP_MODIFIED:
+ g_value_set_boolean (value, vector_layer->modified);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_vector_layer_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GimpVectorLayer *vector_layer = GIMP_VECTOR_LAYER (object);
+
+ switch (property_id)
+ {
+ case PROP_VECTOR_LAYER_OPTIONS:
+ gimp_vector_layer_set_vector_options (vector_layer, g_value_get_object (value));
+ break;
+ case PROP_MODIFIED:
+ vector_layer->modified = g_value_get_boolean (value);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_vector_layer_set_vector_options (GimpVectorLayer *layer,
+ GimpVectorLayerOptions *options)
+{
+ if (layer->options)
+ {
+ g_signal_handlers_disconnect_by_func (layer->options,
+ G_CALLBACK (gimp_vector_layer_changed_options),
+ layer);
+
+ if (layer->options->path)
+ g_signal_handlers_disconnect_by_func (layer->options->path,
+ G_CALLBACK (gimp_vector_layer_removed_options_path),
+ layer);
+
+ g_object_unref (layer->options);
+ layer->options = NULL;
+ }
+
+ if (options)
+ g_set_object (&layer->options, options);
+
+ gimp_vector_layer_changed_options (layer);
+
+ if (layer->options)
+ {
+ if (layer->options->path)
+ g_signal_connect_object (layer->options->path, "removed",
+ G_CALLBACK (gimp_vector_layer_removed_options_path),
+ layer, G_CONNECT_SWAPPED);
+
+ g_signal_connect_object (layer->options, "notify",
+ G_CALLBACK (gimp_vector_layer_changed_options),
+ layer, G_CONNECT_SWAPPED);
+ }
+
+ g_object_notify (G_OBJECT (layer), "vector-layer-options");
+}
+
+static void
+gimp_vector_layer_set_buffer (GimpDrawable *drawable,
+ gboolean push_undo,
+ const gchar *undo_desc,
+ GeglBuffer *buffer,
+ const GeglRectangle *bounds)
+{
+ GimpVectorLayer *layer = GIMP_VECTOR_LAYER (drawable);
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
+
+ if (push_undo && ! layer->modified)
+ gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_DRAWABLE_MOD,
+ undo_desc);
+
+ GIMP_DRAWABLE_CLASS (parent_class)->set_buffer (drawable,
+ push_undo, undo_desc,
+ buffer, bounds);
+
+ if (push_undo && ! layer->modified)
+ {
+ gimp_image_undo_push_vector_layer_modified (image, NULL, layer);
+
+ g_object_set (drawable, "modified", TRUE, NULL);
+
+ gimp_image_undo_group_end (image);
+ }
+}
+
+static void
+gimp_vector_layer_push_undo (GimpDrawable *drawable,
+ const gchar *undo_desc,
+ GeglBuffer *buffer,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
+{
+ GimpVectorLayer *layer = GIMP_VECTOR_LAYER (drawable);
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
+
+ if (! layer->modified)
+ gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_DRAWABLE, undo_desc);
+
+ GIMP_DRAWABLE_CLASS (parent_class)->push_undo (drawable, undo_desc,
+ buffer,
+ x, y, width, height);
+
+ if (! layer->modified)
+ {
+ gimp_image_undo_push_vector_layer_modified (image, NULL, layer);
+
+ g_object_set (drawable, "modified", TRUE, NULL);
+
+ gimp_image_undo_group_end (image);
+ }
+}
+
+static gint64
+gimp_vector_layer_get_memsize (GimpObject *object,
+ gint64 *gui_size)
+{
+ GimpVectorLayer *vector_layer = GIMP_VECTOR_LAYER (object);
+ gint64 memsize = 0;
+
+ memsize += gimp_object_get_memsize (GIMP_OBJECT (vector_layer->options),
+ gui_size);
+
+ return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
+ gui_size);
+}
+
+static GimpItem *
+gimp_vector_layer_duplicate (GimpItem *item,
+ GType new_type)
+{
+ GimpItem *new_item;
+
+ g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_DRAWABLE), NULL);
+
+ new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type);
+
+ if (GIMP_IS_VECTOR_LAYER (new_item))
+ {
+ GimpVectorLayer *vector_layer = GIMP_VECTOR_LAYER (item);
+ GimpVectorLayer *new_vector_layer = GIMP_VECTOR_LAYER (new_item);
+
+ if (vector_layer->options)
+ {
+ GimpVectorLayerOptions *new_options =
+ gimp_config_duplicate (GIMP_CONFIG (vector_layer->options));
+
+ if (vector_layer->options->path)
+ {
+ GimpPath *path = gimp_vector_layer_get_path (vector_layer);
+ GimpPath *new_path;
+
+ new_path = GIMP_PATH (gimp_item_duplicate (GIMP_ITEM (path),
+ G_TYPE_FROM_INSTANCE (GIMP_ITEM (path))));
+
+ g_object_set (new_options, "path", new_path, NULL);
+ }
+
+ g_object_set (new_vector_layer,
+ "vector-layer-options", new_options,
+ NULL);
+ g_object_unref (new_options);
+ }
+ }
+
+ return new_item;
+}
+
+static void
+gimp_vector_layer_translate (GimpLayer *layer,
+ gint offset_x,
+ gint offset_y)
+{
+ GimpVectorLayer *vector_layer = GIMP_VECTOR_LAYER (layer);
+
+ if (vector_layer->options && vector_layer->options->path)
+ {
+ gimp_item_translate (GIMP_ITEM (vector_layer->options->path),
+ offset_x, offset_y, FALSE);
+ }
+ else
+ {
+ GIMP_LAYER_CLASS (parent_class)->translate (layer, offset_x, offset_y);
+ }
+}
+
+static void
+gimp_vector_layer_scale (GimpItem *item,
+ gint new_width,
+ gint new_height,
+ gint new_offset_x,
+ gint new_offset_y,
+ GimpInterpolationType interp_type,
+ GimpProgress *progress)
+{
+ GimpVectorLayer *vector_layer = GIMP_VECTOR_LAYER (item);
+
+ if (vector_layer->options && vector_layer->options->path)
+ {
+ gimp_item_scale (GIMP_ITEM (vector_layer->options->path),
+ new_width, new_height, new_offset_x, new_offset_y,
+ interp_type, progress);
+ }
+ else
+ {
+ GIMP_ITEM_CLASS (parent_class)->scale (item, new_width, new_height,
+ new_offset_x, new_offset_y,
+ interp_type, progress);
+ }
+}
+
+static void
+gimp_vector_layer_flip (GimpItem *item,
+ GimpContext *context,
+ GimpOrientationType flip_type,
+ gdouble axis,
+ gboolean clip_result)
+{
+ GimpVectorLayer *vector_layer = GIMP_VECTOR_LAYER (item);
+
+ if (vector_layer->options && vector_layer->options->path)
+ {
+ gimp_item_flip (GIMP_ITEM (vector_layer->options->path),
+ context, flip_type, axis, clip_result);
+ }
+ else
+ {
+ GIMP_ITEM_CLASS (parent_class)->flip (item, context, flip_type,
+ axis, clip_result);
+ }
+}
+
+static void
+gimp_vector_layer_rotate (GimpItem *item,
+ GimpContext *context,
+ GimpRotationType rotate_type,
+ gdouble center_x,
+ gdouble center_y,
+ gboolean clip_result)
+{
+ GimpVectorLayer *vector_layer = GIMP_VECTOR_LAYER (item);
+
+ if (vector_layer->options && vector_layer->options->path)
+ {
+ gimp_item_rotate (GIMP_ITEM (vector_layer->options->path),
+ context, rotate_type, center_x, center_y, clip_result);
+ }
+ else
+ {
+ GIMP_ITEM_CLASS (parent_class)->rotate (item, context, rotate_type,
+ center_x, center_y, clip_result);
+ }
+}
+
+static void
+gimp_vector_layer_transform (GimpItem *item,
+ GimpContext *context,
+ const GimpMatrix3 *matrix,
+ GimpTransformDirection direction,
+ GimpInterpolationType interp_type,
+ GimpTransformResize clip_result,
+ GimpProgress *progress,
+ gboolean push_undo)
+{
+ GimpVectorLayer *vector_layer = GIMP_VECTOR_LAYER (item);
+
+ if (vector_layer->options && vector_layer->options->path)
+ {
+ gimp_item_transform (GIMP_ITEM (vector_layer->options->path),
+ context, matrix, direction, interp_type,
+ clip_result, progress);
+ }
+ else
+ {
+ GIMP_ITEM_CLASS (parent_class)->transform (item, context, matrix,
+ direction, interp_type,
+ clip_result, progress, push_undo);
+ }
+}
+
+static void
+gimp_vector_layer_removed_options_path (GimpVectorLayer *layer)
+{
+ if (layer->options)
+ {
+ gimp_image_undo_push_vector_layer (gimp_item_get_image (GIMP_ITEM (layer)),
+ _("Discard Vector Informations"),
+ layer, NULL);
+
+ g_object_set (layer->options, "path", NULL, NULL);
+ }
+}
+
+static void
+gimp_vector_layer_removed (GimpItem *item)
+{
+ GimpVectorLayer *vector_layer = GIMP_VECTOR_LAYER (item);
+
+ if (vector_layer->options && vector_layer->options->path)
+ g_signal_handlers_disconnect_by_func (vector_layer->options->path,
+ G_CALLBACK (gimp_vector_layer_removed_options_path),
+ vector_layer);
+
+ GIMP_ITEM_CLASS (parent_class)->removed (item);
+}
+
+
+/* public functions */
+
+/**
+ * gimp_vector_layer_new:
+ * @image: the #GimpImage the layer should belong to
+ * @path: the #GimpPath object the layer should render
+ * @context: the #GimpContext from which to pull context properties
+ *
+ * Creates a new vector layer.
+ *
+ * Return value: a new #GimpVectorLayer or %NULL in case of a problem
+ **/
+GimpVectorLayer *
+gimp_vector_layer_new (GimpImage *image,
+ GimpPath *path,
+ GimpContext *context)
+{
+ GimpVectorLayer *layer;
+ GimpVectorLayerOptions *options;
+ gint x = 0;
+ gint y = 0;
+ gint width = gimp_image_get_width (image);
+ gint height = gimp_image_get_height (image);
+
+ g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
+ g_return_val_if_fail (GIMP_IS_PATH (path), NULL);
+ g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
+
+ options = gimp_vector_layer_options_new (image, path, context);
+
+ gimp_item_bounds (GIMP_ITEM (path), &x, &y, &width, &height);
+
+ /* Set boundaries to image size if it's a blank path */
+ if (width == 0 || height == 0)
+ {
+ width = gimp_image_get_width (image);
+ height = gimp_image_get_height (image);
+ }
+
+ layer =
+ GIMP_VECTOR_LAYER (gimp_drawable_new (GIMP_TYPE_VECTOR_LAYER,
+ image, NULL,
+ x, y, width, height,
+ gimp_image_get_layer_format (image,
+ TRUE)));
+
+ gimp_object_set_name (GIMP_OBJECT (layer),
+ gimp_object_get_name (GIMP_OBJECT (path)));
+
+ gimp_layer_set_mode (GIMP_LAYER (layer),
+ gimp_image_get_default_new_layer_mode (image),
+ FALSE);
+
+ gimp_vector_layer_set_vector_options (layer, options);
+ g_object_unref (options);
+
+ return layer;
+}
+
+/**
+ * gimp_vector_layer_get_path:
+ * @layer: a #GimpVectorLayer
+ *
+ * Gets the path from @layer if one is associated with it.
+ *
+ * Return value: a #GimpPath or %NULL if no path is set.
+ */
+GimpPath *
+gimp_vector_layer_get_path (GimpVectorLayer *layer)
+{
+ g_return_val_if_fail (GIMP_IS_VECTOR_LAYER (layer), NULL);
+
+ if (gimp_item_is_vector_layer (GIMP_ITEM (layer)))
+ return layer->options->path;
+
+ return NULL;
+}
+
+/**
+ * gimp_vector_layer_get_options:
+ * @layer: a #GimpVectorLayer
+ *
+ * Gets the vector layer options from @layer if one is associated with it.
+ *
+ * Return value: a #GimpVectorLayerOptions or %NULL if no options are set.
+ */
+GimpVectorLayerOptions *
+gimp_vector_layer_get_options (GimpVectorLayer *layer)
+{
+ g_return_val_if_fail (GIMP_IS_VECTOR_LAYER (layer), NULL);
+
+ if (gimp_item_is_vector_layer (GIMP_ITEM (layer)))
+ return layer->options;
+
+ return NULL;
+}
+
+void
+gimp_vector_layer_refresh (GimpVectorLayer *layer)
+{
+ if (layer->options)
+ gimp_vector_layer_render (layer);
+}
+
+/**
+ * gimp_vector_layer_discard:
+ * @layer: a #GimpVectorLayer
+ *
+ * Discards the vector information. This makes @layer behave like a
+ * normal layer.
+ */
+void
+gimp_vector_layer_discard (GimpVectorLayer *layer)
+{
+ g_return_if_fail (GIMP_IS_VECTOR_LAYER (layer));
+ g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)));
+
+ if (! layer->options)
+ return;
+
+ if (layer->options->path)
+ gimp_image_undo_push_vector_layer (gimp_item_get_image (GIMP_ITEM (layer)),
+ _("Discard Vector Information"),
+ layer, NULL);
+
+ g_object_set (layer, "vector-layer-options", NULL, NULL);
+
+ gimp_viewable_invalidate_preview (GIMP_VIEWABLE (layer));
+ gimp_image_flush (gimp_item_get_image (GIMP_ITEM (layer)));
+}
+
+gboolean
+gimp_item_is_vector_layer (GimpItem *item)
+{
+ return (GIMP_IS_VECTOR_LAYER (item) &&
+ GIMP_VECTOR_LAYER (item)->options);
+}
+
+
+/* private functions */
+
+static gboolean
+gimp_vector_layer_render (GimpVectorLayer *layer)
+{
+ GimpDrawable *drawable = GIMP_DRAWABLE (layer);
+ GeglBuffer *buffer = NULL;
+ GimpItem *item = GIMP_ITEM (layer);
+ GimpImage *image = gimp_item_get_image (item);
+ gint layer_x = 0;
+ gint layer_y = 0;
+ gint x = 0;
+ gint y = 0;
+ gint width = gimp_image_get_width (image);
+ gint height = gimp_image_get_height (image);
+ gdouble stroke = 0;
+
+ g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
+
+ g_object_freeze_notify (G_OBJECT (drawable));
+
+ if (layer->options->enable_stroke)
+ stroke = gimp_stroke_options_get_width (layer->options->stroke_options);
+
+ /* Resize layer according to path size */
+ gimp_item_get_offset (GIMP_ITEM (layer), &layer_x, &layer_y);
+ gimp_item_bounds (GIMP_ITEM (layer->options->path), &x, &y, &width, &height);
+
+ buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0,
+ (gint) ceil (width + stroke),
+ (gint) ceil (height + stroke)),
+ gimp_drawable_get_format (drawable));
+ gimp_drawable_set_buffer (drawable, FALSE, NULL, buffer);
+ g_object_unref (buffer);
+
+ gimp_item_set_offset (GIMP_ITEM (layer), x - (stroke / 2), y - (stroke / 2));
+
+ /* make the layer background transparent */
+ gimp_drawable_fill (GIMP_DRAWABLE (layer),
+ gimp_get_user_context (image->gimp),
+ GIMP_FILL_TRANSPARENT);
+
+ /* render path to the layer */
+ gimp_vector_layer_render_path (layer);
+
+ g_object_thaw_notify (G_OBJECT (drawable));
+
+ return TRUE;
+}
+
+static void
+gimp_vector_layer_render_path (GimpVectorLayer *layer)
+{
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
+ GimpVectorLayerOptions *options = layer->options;
+ GimpPath *path = NULL;
+ GimpChannel *selection = gimp_image_get_mask (image);
+ GList *drawables;
+ GimpCustomStyle style;
+
+ if (options)
+ path = options->path;
+
+ /* Don't mask these fill/stroke operations */
+ gimp_selection_suspend (GIMP_SELECTION (selection));
+
+ /* Convert from custom to standard styles */
+ style = gimp_fill_options_get_custom_style (options->fill_options);
+ if (style == GIMP_CUSTOM_STYLE_SOLID_COLOR ||
+ ! gimp_context_get_pattern (GIMP_CONTEXT (options->fill_options)))
+ gimp_fill_options_set_style (options->fill_options,
+ GIMP_FILL_STYLE_FG_COLOR);
+ else
+ gimp_fill_options_set_style (options->fill_options,
+ GIMP_FILL_STYLE_PATTERN);
+
+ style =
+ gimp_fill_options_get_custom_style (GIMP_FILL_OPTIONS (options->stroke_options));
+ if (style == GIMP_CUSTOM_STYLE_SOLID_COLOR ||
+ ! gimp_context_get_pattern (GIMP_CONTEXT (options->stroke_options)))
+ gimp_fill_options_set_style (GIMP_FILL_OPTIONS (options->stroke_options),
+ GIMP_FILL_STYLE_FG_COLOR);
+ else
+ gimp_fill_options_set_style (GIMP_FILL_OPTIONS (options->stroke_options),
+ GIMP_FILL_STYLE_PATTERN);
+
+ /* Fill the path object onto the layer */
+ if (options->enable_fill)
+ gimp_drawable_fill_path (GIMP_DRAWABLE (layer),
+ options->fill_options,
+ path, FALSE, NULL);
+
+ drawables = g_list_prepend (NULL, GIMP_DRAWABLE (layer));
+ /* stroke the path object onto the layer */
+ if (options->enable_stroke && gimp_item_is_attached (GIMP_ITEM (path)))
+ gimp_item_stroke (GIMP_ITEM (path), drawables,
+ gimp_get_user_context (image->gimp),
+ options->stroke_options,
+ FALSE, FALSE,
+ NULL, NULL);
+
+ g_list_free (drawables);
+
+ gimp_selection_resume (GIMP_SELECTION (selection));
+}
+
+static void
+gimp_vector_layer_changed_options (GimpVectorLayer *layer)
+{
+ GimpItem *item = GIMP_ITEM (layer);
+
+ if (layer->options && ! layer->options->path)
+ gimp_vector_layer_discard (layer);
+ else if (gimp_item_is_attached (item))
+ gimp_vector_layer_refresh (layer);
+}
diff --git a/app/path/gimpvectorlayer.h b/app/path/gimpvectorlayer.h
index 5f6d1bf7c9..7b7ce1e073 100644
--- a/app/path/gimpvectorlayer.h
+++ b/app/path/gimpvectorlayer.h
@@ -1,67 +1,69 @@
-/* GIMP - The GNU Image Manipulation Program
- * Copyright (C) 1995 Spencer Kimball and Peter Mattis
- *
- * gimpvectorlayer.h
- *
- * Copyright 2006 Hendrik Boom
- *
- * 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 .
- */
-
-#ifndef __GIMP_VECTOR_LAYER_H__
-#define __GIMP_VECTOR_LAYER_H__
-
-
-#include "core/gimplayer.h"
-
-
-#define GIMP_TYPE_VECTOR_LAYER (gimp_vector_layer_get_type ())
-#define GIMP_VECTOR_LAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VECTOR_LAYER, GimpVectorLayer))
-#define GIMP_VECTOR_LAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_VECTOR_LAYER, GimpVectorLayerClass))
-#define GIMP_IS_VECTOR_LAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_VECTOR_LAYER))
-#define GIMP_IS_VECTOR_LAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_VECTOR_LAYER))
-#define GIMP_VECTOR_LAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_VECTOR_LAYER, GimpVectorLayerClass))
-
-
-typedef struct _GimpVectorLayerClass GimpVectorLayerClass;
-
-struct _GimpVectorLayer
-{
- GimpLayer parent_instance;
-
- GimpVectorLayerOptions *options;
- gboolean modified;
-};
-
-struct _GimpVectorLayerClass
-{
- GimpLayerClass parent_class;
-};
-
-
-GType gimp_vector_layer_get_type (void) G_GNUC_CONST;
-
-GimpVectorLayer * gimp_vector_layer_new (GimpImage *image,
- GimpPath *path,
- GimpContext *context);
-
-GimpPath * gimp_vector_layer_get_path (GimpVectorLayer *layer);
-
-void gimp_vector_layer_refresh (GimpVectorLayer *layer);
-void gimp_vector_layer_discard (GimpVectorLayer *layer);
-
-gboolean gimp_item_is_vector_layer (GimpItem *item);
-
-
-#endif /* __GIMP_VECTOR_LAYER_H__ */
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpvectorlayer.h
+ *
+ * Copyright 2006 Hendrik Boom
+ *
+ * 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 .
+ */
+
+#ifndef __GIMP_VECTOR_LAYER_H__
+#define __GIMP_VECTOR_LAYER_H__
+
+
+#include "core/gimplayer.h"
+
+
+#define GIMP_TYPE_VECTOR_LAYER (gimp_vector_layer_get_type ())
+#define GIMP_VECTOR_LAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VECTOR_LAYER, GimpVectorLayer))
+#define GIMP_VECTOR_LAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_VECTOR_LAYER, GimpVectorLayerClass))
+#define GIMP_IS_VECTOR_LAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_VECTOR_LAYER))
+#define GIMP_IS_VECTOR_LAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_VECTOR_LAYER))
+#define GIMP_VECTOR_LAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_VECTOR_LAYER, GimpVectorLayerClass))
+
+
+typedef struct _GimpVectorLayerClass GimpVectorLayerClass;
+
+struct _GimpVectorLayer
+{
+ GimpLayer parent_instance;
+
+ GimpVectorLayerOptions *options;
+ gboolean modified;
+};
+
+struct _GimpVectorLayerClass
+{
+ GimpLayerClass parent_class;
+};
+
+
+GType gimp_vector_layer_get_type (void) G_GNUC_CONST;
+
+GimpVectorLayer * gimp_vector_layer_new (GimpImage *image,
+ GimpPath *path,
+ GimpContext *context);
+
+GimpPath * gimp_vector_layer_get_path (GimpVectorLayer *layer);
+
+GimpVectorLayerOptions * gimp_vector_layer_get_options (GimpVectorLayer *layer);
+
+void gimp_vector_layer_refresh (GimpVectorLayer *layer);
+void gimp_vector_layer_discard (GimpVectorLayer *layer);
+
+gboolean gimp_item_is_vector_layer (GimpItem *item);
+
+
+#endif /* __GIMP_VECTOR_LAYER_H__ */
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 738254fb31..9b1805c86a 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -30,7 +30,7 @@
#include "internal-procs.h"
-/* 729 procedures registered total */
+/* 752 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
diff --git a/app/pdb/vector-layer-cmds.c b/app/pdb/vector-layer-cmds.c
index 64e55b1d53..79334ac032 100644
--- a/app/pdb/vector-layer-cmds.c
+++ b/app/pdb/vector-layer-cmds.c
@@ -21,21 +21,27 @@
#include "stamp-pdbgen.h"
+#include
+
#include
#include
#include "libgimpbase/gimpbase.h"
+#include "libgimpcolor/gimpcolor.h"
#include "libgimpbase/gimpbase.h"
#include "pdb-types.h"
#include "core/gimpcontext.h"
+#include "core/gimpdashpattern.h"
#include "core/gimpimage.h"
#include "core/gimpparamspecs.h"
+#include "core/gimpstrokeoptions.h"
#include "path/gimppath.h"
#include "path/gimpvectorlayer.h"
+#include "path/gimpvectorlayeroptions.h"
#include "gimppdb.h"
#include "gimppdberror.h"
@@ -140,6 +146,822 @@ vector_layer_discard_invoker (GimpProcedure *procedure,
error ? *error : NULL);
}
+static GimpValueArray *
+vector_layer_get_enable_fill_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectorLayer *layer;
+ gboolean enable_fill = FALSE;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ g_object_get (options,
+ "enable-fill", &enable_fill,
+ NULL);
+ }
+
+ 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), enable_fill);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vector_layer_get_enable_stroke_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectorLayer *layer;
+ gboolean enable_stroke = FALSE;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ g_object_get (options,
+ "enable-stroke", &enable_stroke,
+ NULL);
+ }
+
+ 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), enable_stroke);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vector_layer_get_fill_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectorLayer *layer;
+ GeglColor *color = NULL;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ color =
+ gegl_color_duplicate (gimp_context_get_foreground (
+ GIMP_CONTEXT (options->fill_options)));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_object (gimp_value_array_index (return_vals, 1), color);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vector_layer_get_path_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectorLayer *layer;
+ GimpPath *path = NULL;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ path = gimp_vector_layer_get_path (layer);
+
+ if (! path)
+ 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), path);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vector_layer_get_stroke_cap_style_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectorLayer *layer;
+ gint cap_style = 0;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ cap_style = gimp_stroke_options_get_cap_style (options->stroke_options);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), cap_style);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vector_layer_get_stroke_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectorLayer *layer;
+ GeglColor *color = NULL;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ color = gegl_color_duplicate (gimp_context_get_foreground (
+ GIMP_CONTEXT (options->stroke_options)));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_object (gimp_value_array_index (return_vals, 1), color);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vector_layer_get_stroke_dash_offset_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectorLayer *layer;
+ gdouble dash_offset = 0.0;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ dash_offset = gimp_stroke_options_get_dash_offset (options->stroke_options);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), dash_offset);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vector_layer_get_stroke_dash_pattern_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectorLayer *layer;
+ gsize num_dashes = 0;
+ gdouble *dashes = NULL;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ {
+ GArray *pattern =
+ gimp_stroke_options_get_dash_info (options->stroke_options);
+
+ dashes = gimp_dash_pattern_to_double_array (pattern, &num_dashes);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_take_double_array (gimp_value_array_index (return_vals, 1), dashes, num_dashes);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vector_layer_get_stroke_join_style_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectorLayer *layer;
+ gint join_style = 0;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ join_style = gimp_stroke_options_get_join_style (options->stroke_options);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), join_style);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vector_layer_get_stroke_miter_limit_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectorLayer *layer;
+ gdouble miter = 0.0;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ miter = gimp_stroke_options_get_miter_limit (options->stroke_options);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), miter);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vector_layer_get_stroke_width_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectorLayer *layer;
+ gdouble width = 0.0;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ width = gimp_stroke_options_get_width (options->stroke_options);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), width);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vector_layer_get_stroke_width_unit_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectorLayer *layer;
+ GimpUnit *unit = NULL;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ unit = gimp_stroke_options_get_unit (options->stroke_options);
+ }
+
+ 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), unit);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vector_layer_set_enable_fill_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectorLayer *layer;
+ gboolean enable_fill;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+ enable_fill = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ g_object_set (options,
+ "enable-fill", enable_fill,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vector_layer_set_enable_stroke_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectorLayer *layer;
+ gboolean enable_stroke;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+ enable_stroke = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ {
+ g_object_set (options,
+ "enable-stroke", &enable_stroke,
+ NULL);
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vector_layer_set_fill_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectorLayer *layer;
+ GeglColor *color;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+ color = g_value_get_object (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ gimp_context_set_foreground (GIMP_CONTEXT (options->fill_options),
+ color);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vector_layer_set_stroke_cap_style_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectorLayer *layer;
+ gint cap_style;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+ cap_style = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ g_object_set (options->stroke_options,
+ "cap-style", cap_style,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vector_layer_set_stroke_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectorLayer *layer;
+ GeglColor *color;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+ color = g_value_get_object (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ gimp_context_set_foreground (GIMP_CONTEXT (options->stroke_options),
+ color);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vector_layer_set_stroke_dash_offset_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectorLayer *layer;
+ gdouble dash_offset;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+ dash_offset = g_value_get_double (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ g_object_set (options->stroke_options,
+ "dash-offset", dash_offset,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vector_layer_set_stroke_dash_pattern_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectorLayer *layer;
+ gsize num_dashes;
+ const gdouble *dashes;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+ dashes = gimp_value_get_double_array (gimp_value_array_index (args, 1), &num_dashes);
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+ GArray *pattern = NULL;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ {
+ if (num_dashes > 0)
+ {
+ pattern = gimp_dash_pattern_from_double_array (num_dashes, dashes);
+
+ if (! pattern)
+ success = FALSE;
+ }
+
+ if (success)
+ gimp_stroke_options_take_dash_pattern (options->stroke_options,
+ GIMP_DASH_CUSTOM, pattern);
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vector_layer_set_stroke_join_style_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectorLayer *layer;
+ gint join_style;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+ join_style = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ g_object_set (options->stroke_options,
+ "join-style", join_style,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vector_layer_set_stroke_miter_limit_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectorLayer *layer;
+ gdouble miter;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+ miter = g_value_get_double (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ g_object_set (options->stroke_options,
+ "miter-limit", miter,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vector_layer_set_stroke_width_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectorLayer *layer;
+ gdouble width;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+ width = g_value_get_double (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ g_object_set (options->stroke_options,
+ "width", width,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vector_layer_set_stroke_width_unit_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectorLayer *layer;
+ GimpUnit *unit;
+
+ layer = g_value_get_object (gimp_value_array_index (args, 0));
+ unit = g_value_get_object (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ g_object_set (options->stroke_options,
+ "unit", unit,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
void
register_vector_layer_procs (GimpPDB *pdb)
{
@@ -229,4 +1051,681 @@ register_vector_layer_procs (GimpPDB *pdb)
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-get-enable-fill
+ */
+ procedure = gimp_procedure_new (vector_layer_get_enable_fill_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-get-enable-fill");
+ gimp_procedure_set_static_help (procedure,
+ "Check if fill is enabled in the vector layer.",
+ "This procedure checks if fill is enabled in the specified vector layer.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("enable-fill",
+ "enable fill",
+ "If the fill is enabled on the vector layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-get-enable-stroke
+ */
+ procedure = gimp_procedure_new (vector_layer_get_enable_stroke_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-get-enable-stroke");
+ gimp_procedure_set_static_help (procedure,
+ "Check if stroke is enabled in the vector layer.",
+ "This procedure checks if stroke is enabled in the specified vector layer.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("enable-stroke",
+ "enable stroke",
+ "If the stroke is enabled on the vector layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-get-fill-color
+ */
+ procedure = gimp_procedure_new (vector_layer_get_fill_color_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-get-fill-color");
+ gimp_procedure_set_static_help (procedure,
+ "Get the color of the fill in a vector layer.",
+ "This procedure returns the color of the fill in a vector layer.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Marcus Heese ",
+ "Marcus Heese",
+ "2008");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_color ("color",
+ "color",
+ "The color of the fill.",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-get-path
+ */
+ procedure = gimp_procedure_new (vector_layer_get_path_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-get-path");
+ gimp_procedure_set_static_help (procedure,
+ "Gets the path from the vector layer if one is associated with it.",
+ "This procedure returns the path from the vector layer if one is associated with it.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_path ("path",
+ "path",
+ "The path associated with the vector layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-get-stroke-cap-style
+ */
+ procedure = gimp_procedure_new (vector_layer_get_stroke_cap_style_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-get-stroke-cap-style");
+ gimp_procedure_set_static_help (procedure,
+ "Get the stroke cap style of a vector layer.",
+ "This procedure returns the stroke cap style in a vector layer.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("cap-style",
+ "cap style",
+ "The stroke cap style.",
+ GIMP_TYPE_CAP_STYLE,
+ GIMP_CAP_BUTT,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-get-stroke-color
+ */
+ procedure = gimp_procedure_new (vector_layer_get_stroke_color_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-get-stroke-color");
+ gimp_procedure_set_static_help (procedure,
+ "Get the color of the stroke in a vector layer.",
+ "This procedure returns the color of the stroke in a vector layer.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Marcus Heese ",
+ "Marcus Heese",
+ "2008");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_color ("color",
+ "color",
+ "The color of the stroke.",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-get-stroke-dash-offset
+ */
+ procedure = gimp_procedure_new (vector_layer_get_stroke_dash_offset_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-get-stroke-dash-offset");
+ gimp_procedure_set_static_help (procedure,
+ "Get the stroke dash offset of a vector layer.",
+ "This procedure returns the stroke dash offset in a vector layer.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("dash-offset",
+ "dash offset",
+ "The stroke dash offset.",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-get-stroke-dash-pattern
+ */
+ procedure = gimp_procedure_new (vector_layer_get_stroke_dash_pattern_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-get-stroke-dash-pattern");
+ gimp_procedure_set_static_help (procedure,
+ "Get the stroke dash pattern of a vector layer.",
+ "This procedure returns the stroke dash pattern in a vector layer.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_double_array ("dashes",
+ "dashes",
+ "The stroke dash pattern array.",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-get-stroke-join-style
+ */
+ procedure = gimp_procedure_new (vector_layer_get_stroke_join_style_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-get-stroke-join-style");
+ gimp_procedure_set_static_help (procedure,
+ "Get the stroke join style of a vector layer.",
+ "This procedure returns the stroke join style in a vector layer.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("join-style",
+ "join style",
+ "The stroke join style.",
+ GIMP_TYPE_JOIN_STYLE,
+ GIMP_JOIN_MITER,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-get-stroke-miter-limit
+ */
+ procedure = gimp_procedure_new (vector_layer_get_stroke_miter_limit_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-get-stroke-miter-limit");
+ gimp_procedure_set_static_help (procedure,
+ "Get the stroke miter limit of a vector layer.",
+ "This procedure returns the stroke miter limit in a vector layer.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("miter",
+ "miter",
+ "The stroke miter limit.",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-get-stroke-width
+ */
+ procedure = gimp_procedure_new (vector_layer_get_stroke_width_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-get-stroke-width");
+ gimp_procedure_set_static_help (procedure,
+ "Get the stroke width of a vector layer.",
+ "This procedure returns the stroke width in a vector layer.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("width",
+ "width",
+ "The stroke width.",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-get-stroke-width-unit
+ */
+ procedure = gimp_procedure_new (vector_layer_get_stroke_width_unit_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-get-stroke-width-unit");
+ gimp_procedure_set_static_help (procedure,
+ "Get the stroke width unit of a vector layer.",
+ "This procedure returns the stroke width unit in a vector layer.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_unit ("unit",
+ "unit",
+ "The stroke width unit.",
+ FALSE,
+ FALSE,
+ gimp_unit_inch (),
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-set-enable-fill
+ */
+ procedure = gimp_procedure_new (vector_layer_set_enable_fill_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-set-enable-fill");
+ gimp_procedure_set_static_help (procedure,
+ "Set whether the fill is enabled on the vector layer.",
+ "This procedure sets the fill's visibility in the vector layer 'layer'.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("enable-fill",
+ "enable fill",
+ "Whether to enable the fill on the vector layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-set-enable-stroke
+ */
+ procedure = gimp_procedure_new (vector_layer_set_enable_stroke_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-set-enable-stroke");
+ gimp_procedure_set_static_help (procedure,
+ "Set whether the stroke is enabled on the vector layer.",
+ "This procedure sets the stroke's visibility in the vector layer 'layer'.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("enable-stroke",
+ "enable stroke",
+ "Whether to enable the stroke on the vector layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-set-fill-color
+ */
+ procedure = gimp_procedure_new (vector_layer_set_fill_color_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-set-fill-color");
+ gimp_procedure_set_static_help (procedure,
+ "Set the color of the fill in the vector layer.",
+ "This procedure sets the fill color in the vector layer 'layer'.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_color ("color",
+ "color",
+ "The color to use for the fill",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-set-stroke-cap-style
+ */
+ procedure = gimp_procedure_new (vector_layer_set_stroke_cap_style_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-set-stroke-cap-style");
+ gimp_procedure_set_static_help (procedure,
+ "Set the stroke cap style of a vector layer.",
+ "This procedure sets the stroke cap style in a vector layer.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("cap-style",
+ "cap style",
+ "The stroke cap style.",
+ GIMP_TYPE_CAP_STYLE,
+ GIMP_CAP_BUTT,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-set-stroke-color
+ */
+ procedure = gimp_procedure_new (vector_layer_set_stroke_color_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-set-stroke-color");
+ gimp_procedure_set_static_help (procedure,
+ "Set the color of the stroke in the vector layer.",
+ "This procedure sets the stroke color in the vector layer 'layer'.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_color ("color",
+ "color",
+ "The color to use for the stroke",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-set-stroke-dash-offset
+ */
+ procedure = gimp_procedure_new (vector_layer_set_stroke_dash_offset_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-set-stroke-dash-offset");
+ gimp_procedure_set_static_help (procedure,
+ "Set the stroke dash offset of a vector layer.",
+ "This procedure sets the stroke dash offset in a vector layer.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("dash-offset",
+ "dash offset",
+ "The stroke dash offset.",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-set-stroke-dash-pattern
+ */
+ procedure = gimp_procedure_new (vector_layer_set_stroke_dash_pattern_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-set-stroke-dash-pattern");
+ gimp_procedure_set_static_help (procedure,
+ "Set the stroke dash pattern of a vector layer.",
+ "This procedure sets the stroke dash pattern in a vector layer.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_double_array ("dashes",
+ "dashes",
+ "The line dash pattern setting",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-set-stroke-join-style
+ */
+ procedure = gimp_procedure_new (vector_layer_set_stroke_join_style_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-set-stroke-join-style");
+ gimp_procedure_set_static_help (procedure,
+ "Set the stroke join style of a vector layer.",
+ "This procedure sets the stroke join style in a vector layer.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("join-style",
+ "join style",
+ "The stroke join style.",
+ GIMP_TYPE_JOIN_STYLE,
+ GIMP_JOIN_MITER,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-set-stroke-miter-limit
+ */
+ procedure = gimp_procedure_new (vector_layer_set_stroke_miter_limit_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-set-stroke-miter-limit");
+ gimp_procedure_set_static_help (procedure,
+ "Set the stroke miter limit of a vector layer.",
+ "This procedure sets the stroke miter limit in a vector layer.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("miter",
+ "miter",
+ "The stroke miter limit.",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-set-stroke-width
+ */
+ procedure = gimp_procedure_new (vector_layer_set_stroke_width_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-set-stroke-width");
+ gimp_procedure_set_static_help (procedure,
+ "Set the stroke width of a vector layer.",
+ "This procedure sets the stroke width in a vector layer.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("width",
+ "width",
+ "The stroke width.",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vector-layer-set-stroke-width-unit
+ */
+ procedure = gimp_procedure_new (vector_layer_set_stroke_width_unit_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vector-layer-set-stroke-width-unit");
+ gimp_procedure_set_static_help (procedure,
+ "Set the stroke width unit of a vector layer.",
+ "This procedure sets the stroke width unit in a vector layer.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Alex S.",
+ "Alex S.",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vector_layer ("layer",
+ "layer",
+ "The vector layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_unit ("unit",
+ "unit",
+ "The stroke width unit.",
+ FALSE,
+ FALSE,
+ gimp_unit_inch (),
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
}
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
index ee9c4935e5..f973ec2861 100644
--- a/libgimp/gimp.def
+++ b/libgimp/gimp.def
@@ -1075,9 +1075,32 @@ EXPORTS
gimp_user_time
gimp_vector_layer_discard
gimp_vector_layer_get_by_id
+ gimp_vector_layer_get_enable_fill
+ gimp_vector_layer_get_enable_stroke
+ gimp_vector_layer_get_fill_color
+ gimp_vector_layer_get_path
+ gimp_vector_layer_get_stroke_cap_style
+ gimp_vector_layer_get_stroke_color
+ gimp_vector_layer_get_stroke_dash_offset
+ gimp_vector_layer_get_stroke_dash_pattern
+ gimp_vector_layer_get_stroke_join_style
+ gimp_vector_layer_get_stroke_miter_limit
+ gimp_vector_layer_get_stroke_width
+ gimp_vector_layer_get_stroke_width_unit
gimp_vector_layer_get_type
gimp_vector_layer_new
gimp_vector_layer_refresh
+ gimp_vector_layer_set_enable_fill
+ gimp_vector_layer_set_enable_stroke
+ gimp_vector_layer_set_fill_color
+ gimp_vector_layer_set_stroke_cap_style
+ gimp_vector_layer_set_stroke_color
+ gimp_vector_layer_set_stroke_dash_offset
+ gimp_vector_layer_set_stroke_dash_pattern
+ gimp_vector_layer_set_stroke_join_style
+ gimp_vector_layer_set_stroke_miter_limit
+ gimp_vector_layer_set_stroke_width
+ gimp_vector_layer_set_stroke_width_unit
gimp_vector_load_procedure_extract_dimensions
gimp_vector_load_procedure_get_type
gimp_vector_load_procedure_new
diff --git a/libgimp/gimpvectorlayer_pdb.c b/libgimp/gimpvectorlayer_pdb.c
index 0b748ca53b..17b8ce90c6 100644
--- a/libgimp/gimpvectorlayer_pdb.c
+++ b/libgimp/gimpvectorlayer_pdb.c
@@ -157,3 +157,872 @@ gimp_vector_layer_discard (GimpVectorLayer *layer)
return success;
}
+
+/**
+ * gimp_vector_layer_get_enable_fill:
+ * @layer: The vector layer.
+ *
+ * Check if fill is enabled in the vector layer.
+ *
+ * This procedure checks if fill is enabled in the specified vector
+ * layer.
+ *
+ * Returns: If the fill is enabled on the vector layer.
+ *
+ * Since: 3.2
+ **/
+gboolean
+gimp_vector_layer_get_enable_fill (GimpVectorLayer *layer)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean enable_fill = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-get-enable-fill",
+ args);
+ gimp_value_array_unref (args);
+
+ if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
+ enable_fill = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
+
+ gimp_value_array_unref (return_vals);
+
+ return enable_fill;
+}
+
+/**
+ * gimp_vector_layer_get_enable_stroke:
+ * @layer: The vector layer.
+ *
+ * Check if stroke is enabled in the vector layer.
+ *
+ * This procedure checks if stroke is enabled in the specified vector
+ * layer.
+ *
+ * Returns: If the stroke is enabled on the vector layer.
+ *
+ * Since: 3.2
+ **/
+gboolean
+gimp_vector_layer_get_enable_stroke (GimpVectorLayer *layer)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean enable_stroke = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-get-enable-stroke",
+ args);
+ gimp_value_array_unref (args);
+
+ if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
+ enable_stroke = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
+
+ gimp_value_array_unref (return_vals);
+
+ return enable_stroke;
+}
+
+/**
+ * gimp_vector_layer_get_fill_color:
+ * @layer: The vector layer.
+ *
+ * Get the color of the fill in a vector layer.
+ *
+ * This procedure returns the color of the fill in a vector layer.
+ *
+ * Returns: (transfer full): The color of the fill.
+ *
+ * Since: 2.6
+ **/
+GeglColor *
+gimp_vector_layer_get_fill_color (GimpVectorLayer *layer)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GeglColor *color = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-get-fill-color",
+ args);
+ gimp_value_array_unref (args);
+
+ if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
+ color = g_value_dup_object (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return color;
+}
+
+/**
+ * gimp_vector_layer_get_path:
+ * @layer: The vector layer.
+ *
+ * Gets the path from the vector layer if one is associated with it.
+ *
+ * This procedure returns the path from the vector layer if one is
+ * associated with it.
+ *
+ * Returns: (transfer none): The path associated with the vector layer.
+ *
+ * Since: 3.2
+ **/
+GimpPath *
+gimp_vector_layer_get_path (GimpVectorLayer *layer)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpPath *path = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-get-path",
+ args);
+ gimp_value_array_unref (args);
+
+ if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
+ path = GIMP_VALUES_GET_PATH (return_vals, 1);
+
+ gimp_value_array_unref (return_vals);
+
+ return path;
+}
+
+/**
+ * gimp_vector_layer_get_stroke_cap_style:
+ * @layer: The vector layer.
+ *
+ * Get the stroke cap style of a vector layer.
+ *
+ * This procedure returns the stroke cap style in a vector layer.
+ *
+ * Returns: The stroke cap style.
+ *
+ * Since: 3.2
+ **/
+GimpCapStyle
+gimp_vector_layer_get_stroke_cap_style (GimpVectorLayer *layer)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpCapStyle cap_style = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-get-stroke-cap-style",
+ args);
+ gimp_value_array_unref (args);
+
+ if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
+ cap_style = GIMP_VALUES_GET_ENUM (return_vals, 1);
+
+ gimp_value_array_unref (return_vals);
+
+ return cap_style;
+}
+
+/**
+ * gimp_vector_layer_get_stroke_color:
+ * @layer: The vector layer.
+ *
+ * Get the color of the stroke in a vector layer.
+ *
+ * This procedure returns the color of the stroke in a vector layer.
+ *
+ * Returns: (transfer full): The color of the stroke.
+ *
+ * Since: 2.6
+ **/
+GeglColor *
+gimp_vector_layer_get_stroke_color (GimpVectorLayer *layer)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GeglColor *color = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-get-stroke-color",
+ args);
+ gimp_value_array_unref (args);
+
+ if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
+ color = g_value_dup_object (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return color;
+}
+
+/**
+ * gimp_vector_layer_get_stroke_dash_offset:
+ * @layer: The vector layer.
+ *
+ * Get the stroke dash offset of a vector layer.
+ *
+ * This procedure returns the stroke dash offset in a vector layer.
+ *
+ * Returns: The stroke dash offset.
+ *
+ * Since: 3.2
+ **/
+gdouble
+gimp_vector_layer_get_stroke_dash_offset (GimpVectorLayer *layer)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gdouble dash_offset = 0.0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-get-stroke-dash-offset",
+ args);
+ gimp_value_array_unref (args);
+
+ if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
+ dash_offset = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
+
+ gimp_value_array_unref (return_vals);
+
+ return dash_offset;
+}
+
+/**
+ * gimp_vector_layer_get_stroke_dash_pattern:
+ * @layer: The vector layer.
+ * @num_dashes: (out): The number of dashes in the dash_pattern array.
+ * @dashes: (out) (array length=num_dashes) (element-type gdouble) (transfer full): The stroke dash pattern array.
+ *
+ * Get the stroke dash pattern of a vector layer.
+ *
+ * This procedure returns the stroke dash pattern in a vector layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 3.2
+ **/
+gboolean
+gimp_vector_layer_get_stroke_dash_pattern (GimpVectorLayer *layer,
+ gsize *num_dashes,
+ gdouble **dashes)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-get-stroke-dash-pattern",
+ args);
+ gimp_value_array_unref (args);
+
+ *num_dashes = 0;
+ *dashes = NULL;
+
+ success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *dashes = GIMP_VALUES_DUP_DOUBLE_ARRAY (return_vals, 1, num_dashes);
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vector_layer_get_stroke_join_style:
+ * @layer: The vector layer.
+ *
+ * Get the stroke join style of a vector layer.
+ *
+ * This procedure returns the stroke join style in a vector layer.
+ *
+ * Returns: The stroke join style.
+ *
+ * Since: 3.2
+ **/
+GimpJoinStyle
+gimp_vector_layer_get_stroke_join_style (GimpVectorLayer *layer)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpJoinStyle join_style = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-get-stroke-join-style",
+ args);
+ gimp_value_array_unref (args);
+
+ if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
+ join_style = GIMP_VALUES_GET_ENUM (return_vals, 1);
+
+ gimp_value_array_unref (return_vals);
+
+ return join_style;
+}
+
+/**
+ * gimp_vector_layer_get_stroke_miter_limit:
+ * @layer: The vector layer.
+ *
+ * Get the stroke miter limit of a vector layer.
+ *
+ * This procedure returns the stroke miter limit in a vector layer.
+ *
+ * Returns: The stroke miter limit.
+ *
+ * Since: 3.2
+ **/
+gdouble
+gimp_vector_layer_get_stroke_miter_limit (GimpVectorLayer *layer)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gdouble miter = 0.0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-get-stroke-miter-limit",
+ args);
+ gimp_value_array_unref (args);
+
+ if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
+ miter = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
+
+ gimp_value_array_unref (return_vals);
+
+ return miter;
+}
+
+/**
+ * gimp_vector_layer_get_stroke_width:
+ * @layer: The vector layer.
+ *
+ * Get the stroke width of a vector layer.
+ *
+ * This procedure returns the stroke width in a vector layer.
+ *
+ * Returns: The stroke width.
+ *
+ * Since: 3.2
+ **/
+gdouble
+gimp_vector_layer_get_stroke_width (GimpVectorLayer *layer)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gdouble width = 0.0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-get-stroke-width",
+ args);
+ gimp_value_array_unref (args);
+
+ if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
+ width = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
+
+ gimp_value_array_unref (return_vals);
+
+ return width;
+}
+
+/**
+ * gimp_vector_layer_get_stroke_width_unit:
+ * @layer: The vector layer.
+ *
+ * Get the stroke width unit of a vector layer.
+ *
+ * This procedure returns the stroke width unit in a vector layer.
+ *
+ * Returns: (transfer none): The stroke width unit.
+ *
+ * Since: 3.2
+ **/
+GimpUnit *
+gimp_vector_layer_get_stroke_width_unit (GimpVectorLayer *layer)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpUnit *unit = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-get-stroke-width-unit",
+ args);
+ gimp_value_array_unref (args);
+
+ if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
+ unit = GIMP_VALUES_GET_UNIT (return_vals, 1);
+
+ gimp_value_array_unref (return_vals);
+
+ return unit;
+}
+
+/**
+ * gimp_vector_layer_set_enable_fill:
+ * @layer: The vector layer.
+ * @enable_fill: Whether to enable the fill on the vector layer.
+ *
+ * Set whether the fill is enabled on the vector layer.
+ *
+ * This procedure sets the fill's visibility in the vector layer
+ * 'layer'.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 3.2
+ **/
+gboolean
+gimp_vector_layer_set_enable_fill (GimpVectorLayer *layer,
+ gboolean enable_fill)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ G_TYPE_BOOLEAN, enable_fill,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-set-enable-fill",
+ args);
+ gimp_value_array_unref (args);
+
+ success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vector_layer_set_enable_stroke:
+ * @layer: The vector layer.
+ * @enable_stroke: Whether to enable the stroke on the vector layer.
+ *
+ * Set whether the stroke is enabled on the vector layer.
+ *
+ * This procedure sets the stroke's visibility in the vector layer
+ * 'layer'.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 3.2
+ **/
+gboolean
+gimp_vector_layer_set_enable_stroke (GimpVectorLayer *layer,
+ gboolean enable_stroke)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ G_TYPE_BOOLEAN, enable_stroke,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-set-enable-stroke",
+ args);
+ gimp_value_array_unref (args);
+
+ success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vector_layer_set_fill_color:
+ * @layer: The vector layer.
+ * @color: The color to use for the fill.
+ *
+ * Set the color of the fill in the vector layer.
+ *
+ * This procedure sets the fill color in the vector layer 'layer'.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 3.2
+ **/
+gboolean
+gimp_vector_layer_set_fill_color (GimpVectorLayer *layer,
+ GeglColor *color)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ GEGL_TYPE_COLOR, color,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-set-fill-color",
+ args);
+ gimp_value_array_unref (args);
+
+ success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vector_layer_set_stroke_cap_style:
+ * @layer: The vector layer.
+ * @cap_style: The stroke cap style.
+ *
+ * Set the stroke cap style of a vector layer.
+ *
+ * This procedure sets the stroke cap style in a vector layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 3.2
+ **/
+gboolean
+gimp_vector_layer_set_stroke_cap_style (GimpVectorLayer *layer,
+ GimpCapStyle cap_style)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ GIMP_TYPE_CAP_STYLE, cap_style,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-set-stroke-cap-style",
+ args);
+ gimp_value_array_unref (args);
+
+ success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vector_layer_set_stroke_color:
+ * @layer: The vector layer.
+ * @color: The color to use for the stroke.
+ *
+ * Set the color of the stroke in the vector layer.
+ *
+ * This procedure sets the stroke color in the vector layer 'layer'.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 3.2
+ **/
+gboolean
+gimp_vector_layer_set_stroke_color (GimpVectorLayer *layer,
+ GeglColor *color)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ GEGL_TYPE_COLOR, color,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-set-stroke-color",
+ args);
+ gimp_value_array_unref (args);
+
+ success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vector_layer_set_stroke_dash_offset:
+ * @layer: The vector layer.
+ * @dash_offset: The stroke dash offset.
+ *
+ * Set the stroke dash offset of a vector layer.
+ *
+ * This procedure sets the stroke dash offset in a vector layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 3.2
+ **/
+gboolean
+gimp_vector_layer_set_stroke_dash_offset (GimpVectorLayer *layer,
+ gdouble dash_offset)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ G_TYPE_DOUBLE, dash_offset,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-set-stroke-dash-offset",
+ args);
+ gimp_value_array_unref (args);
+
+ success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vector_layer_set_stroke_dash_pattern:
+ * @layer: The vector layer.
+ * @num_dashes: The number of dashes in the dash pattern array.
+ * @dashes: (array length=num_dashes) (element-type gdouble): The line dash pattern setting.
+ *
+ * Set the stroke dash pattern of a vector layer.
+ *
+ * This procedure sets the stroke dash pattern in a vector layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 3.2
+ **/
+gboolean
+gimp_vector_layer_set_stroke_dash_pattern (GimpVectorLayer *layer,
+ gsize num_dashes,
+ const gdouble *dashes)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ GIMP_TYPE_DOUBLE_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_double_array (gimp_value_array_index (args, 1), dashes, num_dashes);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-set-stroke-dash-pattern",
+ args);
+ gimp_value_array_unref (args);
+
+ success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vector_layer_set_stroke_join_style:
+ * @layer: The vector layer.
+ * @join_style: The stroke join style.
+ *
+ * Set the stroke join style of a vector layer.
+ *
+ * This procedure sets the stroke join style in a vector layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 3.2
+ **/
+gboolean
+gimp_vector_layer_set_stroke_join_style (GimpVectorLayer *layer,
+ GimpJoinStyle join_style)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ GIMP_TYPE_JOIN_STYLE, join_style,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-set-stroke-join-style",
+ args);
+ gimp_value_array_unref (args);
+
+ success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vector_layer_set_stroke_miter_limit:
+ * @layer: The vector layer.
+ * @miter: The stroke miter limit.
+ *
+ * Set the stroke miter limit of a vector layer.
+ *
+ * This procedure sets the stroke miter limit in a vector layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 3.2
+ **/
+gboolean
+gimp_vector_layer_set_stroke_miter_limit (GimpVectorLayer *layer,
+ gdouble miter)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ G_TYPE_DOUBLE, miter,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-set-stroke-miter-limit",
+ args);
+ gimp_value_array_unref (args);
+
+ success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vector_layer_set_stroke_width:
+ * @layer: The vector layer.
+ * @width: The stroke width.
+ *
+ * Set the stroke width of a vector layer.
+ *
+ * This procedure sets the stroke width in a vector layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 3.2
+ **/
+gboolean
+gimp_vector_layer_set_stroke_width (GimpVectorLayer *layer,
+ gdouble width)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ G_TYPE_DOUBLE, width,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-set-stroke-width",
+ args);
+ gimp_value_array_unref (args);
+
+ success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vector_layer_set_stroke_width_unit:
+ * @layer: The vector layer.
+ * @unit: The stroke width unit.
+ *
+ * Set the stroke width unit of a vector layer.
+ *
+ * This procedure sets the stroke width unit in a vector layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 3.2
+ **/
+gboolean
+gimp_vector_layer_set_stroke_width_unit (GimpVectorLayer *layer,
+ GimpUnit *unit)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_VECTOR_LAYER, layer,
+ GIMP_TYPE_UNIT, unit,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-vector-layer-set-stroke-width-unit",
+ args);
+ gimp_value_array_unref (args);
+
+ success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpvectorlayer_pdb.h b/libgimp/gimpvectorlayer_pdb.h
index 0424adc343..f87d70d657 100644
--- a/libgimp/gimpvectorlayer_pdb.h
+++ b/libgimp/gimpvectorlayer_pdb.h
@@ -32,10 +32,47 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-GimpVectorLayer* gimp_vector_layer_new (GimpImage *image,
- GimpPath *path);
-gboolean gimp_vector_layer_refresh (GimpVectorLayer *layer);
-gboolean gimp_vector_layer_discard (GimpVectorLayer *layer);
+GimpVectorLayer* gimp_vector_layer_new (GimpImage *image,
+ GimpPath *path);
+gboolean gimp_vector_layer_refresh (GimpVectorLayer *layer);
+gboolean gimp_vector_layer_discard (GimpVectorLayer *layer);
+gboolean gimp_vector_layer_get_enable_fill (GimpVectorLayer *layer);
+gboolean gimp_vector_layer_get_enable_stroke (GimpVectorLayer *layer);
+GeglColor* gimp_vector_layer_get_fill_color (GimpVectorLayer *layer);
+GimpPath* gimp_vector_layer_get_path (GimpVectorLayer *layer);
+GimpCapStyle gimp_vector_layer_get_stroke_cap_style (GimpVectorLayer *layer);
+GeglColor* gimp_vector_layer_get_stroke_color (GimpVectorLayer *layer);
+gdouble gimp_vector_layer_get_stroke_dash_offset (GimpVectorLayer *layer);
+gboolean gimp_vector_layer_get_stroke_dash_pattern (GimpVectorLayer *layer,
+ gsize *num_dashes,
+ gdouble **dashes);
+GimpJoinStyle gimp_vector_layer_get_stroke_join_style (GimpVectorLayer *layer);
+gdouble gimp_vector_layer_get_stroke_miter_limit (GimpVectorLayer *layer);
+gdouble gimp_vector_layer_get_stroke_width (GimpVectorLayer *layer);
+GimpUnit* gimp_vector_layer_get_stroke_width_unit (GimpVectorLayer *layer);
+gboolean gimp_vector_layer_set_enable_fill (GimpVectorLayer *layer,
+ gboolean enable_fill);
+gboolean gimp_vector_layer_set_enable_stroke (GimpVectorLayer *layer,
+ gboolean enable_stroke);
+gboolean gimp_vector_layer_set_fill_color (GimpVectorLayer *layer,
+ GeglColor *color);
+gboolean gimp_vector_layer_set_stroke_cap_style (GimpVectorLayer *layer,
+ GimpCapStyle cap_style);
+gboolean gimp_vector_layer_set_stroke_color (GimpVectorLayer *layer,
+ GeglColor *color);
+gboolean gimp_vector_layer_set_stroke_dash_offset (GimpVectorLayer *layer,
+ gdouble dash_offset);
+gboolean gimp_vector_layer_set_stroke_dash_pattern (GimpVectorLayer *layer,
+ gsize num_dashes,
+ const gdouble *dashes);
+gboolean gimp_vector_layer_set_stroke_join_style (GimpVectorLayer *layer,
+ GimpJoinStyle join_style);
+gboolean gimp_vector_layer_set_stroke_miter_limit (GimpVectorLayer *layer,
+ gdouble miter);
+gboolean gimp_vector_layer_set_stroke_width (GimpVectorLayer *layer,
+ gdouble width);
+gboolean gimp_vector_layer_set_stroke_width_unit (GimpVectorLayer *layer,
+ GimpUnit *unit);
G_END_DECLS
diff --git a/libgimpconfig/gimpconfig-params.c b/libgimpconfig/gimpconfig-params.c
index 6e6afd18f5..fc280f56e9 100644
--- a/libgimpconfig/gimpconfig-params.c
+++ b/libgimpconfig/gimpconfig-params.c
@@ -316,6 +316,7 @@ gimp_config_param_spec_duplicate (GParamSpec *pspec)
g_strcmp0 (type_name, "GimpLayer") == 0 ||
g_strcmp0 (type_name, "GimpGroupLayer") == 0 ||
g_strcmp0 (type_name, "GimpTextLayer") == 0 ||
+ g_strcmp0 (type_name, "GimpVectorLayer") == 0 ||
g_strcmp0 (type_name, "GimpChannel") == 0 ||
g_strcmp0 (type_name, "GimpItem") == 0 ||
g_strcmp0 (type_name, "GimpLayerMask") == 0 ||
diff --git a/pdb/groups/vector_layer.pdb b/pdb/groups/vector_layer.pdb
index 607be35eb8..e345cef5ba 100644
--- a/pdb/groups/vector_layer.pdb
+++ b/pdb/groups/vector_layer.pdb
@@ -123,16 +123,857 @@ CODE
);
}
+sub vector_layer_get_path {
+ $blurb = 'Gets the path from the vector layer if one is associated with it.';
+
+ $help = <<'HELP';
+This procedure returns the path from the vector layer if one is associated with it.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer' }
+ );
+
+ @outargs = (
+ { name => 'path', type => 'path',
+ desc => 'The path associated with the vector layer' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ path = gimp_vector_layer_get_path (layer);
+
+ if (! path)
+ success = FALSE;
+}
+CODE
+ );
+}
+
+sub vector_layer_get_enable_stroke {
+ $blurb = 'Check if stroke is enabled in the vector layer.';
+
+ $help = <<'HELP';
+This procedure checks if stroke is enabled in the specified vector layer.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer' }
+ );
+
+ @outargs = (
+ { name => 'enable_stroke', type => 'boolean',
+ desc => 'If the stroke is enabled on the vector layer' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ g_object_get (options,
+ "enable-stroke", &enable_stroke,
+ NULL);
+}
+CODE
+ );
+}
+
+sub vector_layer_set_enable_stroke {
+ $blurb = 'Set whether the stroke is enabled on the vector layer.';
+
+ $help = <<'HELP';
+This procedure sets the stroke's visibility in the vector layer 'layer'.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer' },
+ { name => 'enable_stroke', type => 'boolean',
+ desc => 'Whether to enable the stroke on the vector layer' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ {
+ g_object_set (options,
+ "enable-stroke", &enable_stroke,
+ NULL);
+ }
+}
+CODE
+ );
+}
+
+sub vector_layer_get_stroke_color {
+ $blurb = 'Get the color of the stroke in a vector layer.';
+
+ $help = <<'HELP';
+This procedure returns the color of the stroke in a vector layer.
+HELP
+
+ &marcus_pdb_misc('2008', '2.6');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer.' }
+ );
+
+ @outargs = (
+ { name => 'color', type => 'geglcolor',
+ desc => 'The color of the stroke.' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ color = gegl_color_duplicate (gimp_context_get_foreground (
+ GIMP_CONTEXT (options->stroke_options)));
+}
+CODE
+ );
+}
+
+sub vector_layer_get_stroke_width {
+ $blurb = 'Get the stroke width of a vector layer.';
+
+ $help = <<'HELP';
+This procedure returns the stroke width in a vector layer.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer.' }
+ );
+
+ @outargs = (
+ { name => 'width', type => "0 <= double",
+ desc => 'The stroke width.' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ width = gimp_stroke_options_get_width (options->stroke_options);
+}
+CODE
+ );
+}
+
+sub vector_layer_get_stroke_width_unit {
+ $blurb = 'Get the stroke width unit of a vector layer.';
+
+ $help = <<'HELP';
+This procedure returns the stroke width unit in a vector layer.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer.' }
+ );
+
+ @outargs = (
+ { name => 'unit', type => 'unit',
+ desc => 'The stroke width unit.' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ unit = gimp_stroke_options_get_unit (options->stroke_options);
+}
+CODE
+ );
+}
+
+sub vector_layer_get_stroke_cap_style {
+ $blurb = 'Get the stroke cap style of a vector layer.';
+
+ $help = <<'HELP';
+This procedure returns the stroke cap style in a vector layer.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer.' }
+ );
+
+ @outargs = (
+ { name => 'cap_style', type => 'enum GimpCapStyle',
+ desc => 'The stroke cap style.' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ cap_style = gimp_stroke_options_get_cap_style (options->stroke_options);
+}
+CODE
+ );
+}
+
+sub vector_layer_get_stroke_join_style {
+ $blurb = 'Get the stroke join style of a vector layer.';
+
+ $help = <<'HELP';
+This procedure returns the stroke join style in a vector layer.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer.' }
+ );
+
+ @outargs = (
+ { name => 'join_style', type => 'enum GimpJoinStyle',
+ desc => 'The stroke join style.' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ join_style = gimp_stroke_options_get_join_style (options->stroke_options);
+}
+CODE
+ );
+}
+
+sub vector_layer_get_stroke_miter_limit {
+ $blurb = 'Get the stroke miter limit of a vector layer.';
+
+ $help = <<'HELP';
+This procedure returns the stroke miter limit in a vector layer.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer.' }
+ );
+
+ @outargs = (
+ { name => 'miter', type => "0 <= double",
+ desc => 'The stroke miter limit.' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ miter = gimp_stroke_options_get_miter_limit (options->stroke_options);
+}
+CODE
+ );
+}
+
+sub vector_layer_get_stroke_dash_offset {
+ $blurb = 'Get the stroke dash offset of a vector layer.';
+
+ $help = <<'HELP';
+This procedure returns the stroke dash offset in a vector layer.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer.' }
+ );
+
+ @outargs = (
+ { name => 'dash_offset', type => "0 <= double",
+ desc => 'The stroke dash offset.' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ dash_offset = gimp_stroke_options_get_dash_offset (options->stroke_options);
+}
+CODE
+ );
+}
+
+sub vector_layer_get_stroke_dash_pattern {
+ $blurb = 'Get the stroke dash pattern of a vector layer.';
+
+ $help = <<'HELP';
+This procedure returns the stroke dash pattern in a vector layer.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer.' }
+ );
+
+ @outargs = (
+ { name => 'dashes', type => 'doublearray', void_ret => 1,
+ desc => 'The stroke dash pattern array.',
+ array => { desc => 'The number of dashes in the dash_pattern array' } }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ {
+ GArray *pattern =
+ gimp_stroke_options_get_dash_info (options->stroke_options);
+
+ dashes = gimp_dash_pattern_to_double_array (pattern, &num_dashes);
+ }
+}
+CODE
+ );
+}
+
+sub vector_layer_set_stroke_color {
+ $blurb = 'Set the color of the stroke in the vector layer.';
+
+ $help = <<'HELP';
+This procedure sets the stroke color in the vector layer 'layer'.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer' },
+ { name => 'color', type => 'geglcolor',
+ desc => 'The color to use for the stroke' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ gimp_context_set_foreground (GIMP_CONTEXT (options->stroke_options),
+ color);
+}
+CODE
+ );
+}
+
+sub vector_layer_set_stroke_width {
+ $blurb = 'Set the stroke width of a vector layer.';
+
+ $help = <<'HELP';
+This procedure sets the stroke width in a vector layer.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer.' },
+ { name => 'width', type => "0 <= double",
+ desc => 'The stroke width.' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ g_object_set (options->stroke_options,
+ "width", width,
+ NULL);
+}
+CODE
+ );
+}
+
+sub vector_layer_set_stroke_width_unit {
+ $blurb = 'Set the stroke width unit of a vector layer.';
+
+ $help = <<'HELP';
+This procedure sets the stroke width unit in a vector layer.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer.' },
+ { name => 'unit', type => 'unit',
+ desc => 'The stroke width unit.' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ g_object_set (options->stroke_options,
+ "unit", unit,
+ NULL);
+}
+CODE
+ );
+}
+
+sub vector_layer_set_stroke_cap_style {
+ $blurb = 'Set the stroke cap style of a vector layer.';
+
+ $help = <<'HELP';
+This procedure sets the stroke cap style in a vector layer.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer.' },
+ { name => 'cap_style', type => 'enum GimpCapStyle',
+ desc => 'The stroke cap style.' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ g_object_set (options->stroke_options,
+ "cap-style", cap_style,
+ NULL);
+}
+CODE
+ );
+}
+
+sub vector_layer_set_stroke_join_style {
+ $blurb = 'Set the stroke join style of a vector layer.';
+
+ $help = <<'HELP';
+This procedure sets the stroke join style in a vector layer.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer.' },
+ { name => 'join_style', type => 'enum GimpJoinStyle',
+ desc => 'The stroke join style.' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ g_object_set (options->stroke_options,
+ "join-style", join_style,
+ NULL);
+}
+CODE
+ );
+}
+
+sub vector_layer_set_stroke_miter_limit {
+ $blurb = 'Set the stroke miter limit of a vector layer.';
+
+ $help = <<'HELP';
+This procedure sets the stroke miter limit in a vector layer.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer.' },
+ { name => 'miter', type => "0 <= double",
+ desc => 'The stroke miter limit.' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ g_object_set (options->stroke_options,
+ "miter-limit", miter,
+ NULL);
+}
+CODE
+ );
+}
+
+sub vector_layer_set_stroke_dash_offset {
+ $blurb = 'Set the stroke dash offset of a vector layer.';
+
+ $help = <<'HELP';
+This procedure sets the stroke dash offset in a vector layer.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer.' },
+ { name => 'dash_offset', type => "0 <= double",
+ desc => 'The stroke dash offset.' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ g_object_set (options->stroke_options,
+ "dash-offset", dash_offset,
+ NULL);
+}
+CODE
+ );
+}
+
+sub vector_layer_set_stroke_dash_pattern {
+ $blurb = 'Set the stroke dash pattern of a vector layer.';
+
+ $help = <<'HELP';
+This procedure sets the stroke dash pattern in a vector layer.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer.' },
+ { name => 'dashes', type => 'doublearray',
+ desc => 'The line dash pattern setting',
+ array => { desc => 'The number of dashes in the dash pattern array' } }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+ GArray *pattern = NULL;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ {
+ if (num_dashes > 0)
+ {
+ pattern = gimp_dash_pattern_from_double_array (num_dashes, dashes);
+
+ if (! pattern)
+ success = FALSE;
+ }
+
+ if (success)
+ gimp_stroke_options_take_dash_pattern (options->stroke_options,
+ GIMP_DASH_CUSTOM, pattern);
+ }
+}
+CODE
+ );
+}
+
+sub vector_layer_get_enable_fill {
+ $blurb = 'Check if fill is enabled in the vector layer.';
+
+ $help = <<'HELP';
+This procedure checks if fill is enabled in the specified vector layer.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer' }
+ );
+
+ @outargs = (
+ { name => 'enable_fill', type => 'boolean',
+ desc => 'If the fill is enabled on the vector layer' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ g_object_get (options,
+ "enable-fill", &enable_fill,
+ NULL);
+}
+CODE
+ );
+}
+
+sub vector_layer_set_enable_fill {
+ $blurb = 'Set whether the fill is enabled on the vector layer.';
+
+ $help = <<'HELP';
+This procedure sets the fill's visibility in the vector layer 'layer'.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer' },
+ { name => 'enable_fill', type => 'boolean',
+ desc => 'Whether to enable the fill on the vector layer' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ g_object_set (options,
+ "enable-fill", enable_fill,
+ NULL);
+}
+CODE
+ );
+}
+
+sub vector_layer_get_fill_color {
+ $blurb = 'Get the color of the fill in a vector layer.';
+
+ $help = <<'HELP';
+This procedure returns the color of the fill in a vector layer.
+HELP
+
+ &marcus_pdb_misc('2008', '2.6');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer.' }
+ );
+
+ @outargs = (
+ { name => 'color', type => 'geglcolor',
+ desc => 'The color of the fill.' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ color =
+ gegl_color_duplicate (gimp_context_get_foreground (
+ GIMP_CONTEXT (options->fill_options)));
+}
+CODE
+ );
+}
+
+sub vector_layer_set_fill_color {
+ $blurb = 'Set the color of the fill in the vector layer.';
+
+ $help = <<'HELP';
+This procedure sets the fill color in the vector layer 'layer'.
+HELP
+
+ &alxsa_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'layer', type => 'vector_layer',
+ desc => 'The vector layer' },
+ { name => 'color', type => 'geglcolor',
+ desc => 'The color to use for the fill' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpVectorLayerOptions *options;
+
+ options = gimp_vector_layer_get_options (layer);
+ if (! options)
+ success = FALSE;
+
+ if (success)
+ gimp_context_set_foreground (GIMP_CONTEXT (options->fill_options),
+ color);
+}
+CODE
+ );
+}
+
@headers = qw("libgimpbase/gimpbase.h"
"core/gimpcontext.h"
+ "core/gimpdashpattern.h"
+ "core/gimpstrokeoptions.h"
"path/gimpvectorlayer.h"
+ "path/gimpvectorlayeroptions.h"
"gimppdb-utils.h"
"gimppdberror.h"
"gimp-intl.h");
@procs = qw(vector_layer_new
vector_layer_refresh
- vector_layer_discard);
+ vector_layer_discard
+ vector_layer_get_enable_fill
+ vector_layer_get_enable_stroke
+ vector_layer_get_fill_color
+ vector_layer_get_path
+ vector_layer_get_stroke_cap_style
+ vector_layer_get_stroke_color
+ vector_layer_get_stroke_dash_offset
+ vector_layer_get_stroke_dash_pattern
+ vector_layer_get_stroke_join_style
+ vector_layer_get_stroke_miter_limit
+ vector_layer_get_stroke_width
+ vector_layer_get_stroke_width_unit
+ vector_layer_set_enable_fill
+ vector_layer_set_enable_stroke
+ vector_layer_set_fill_color
+ vector_layer_set_stroke_cap_style
+ vector_layer_set_stroke_color
+ vector_layer_set_stroke_dash_offset
+ vector_layer_set_stroke_dash_pattern
+ vector_layer_set_stroke_join_style
+ vector_layer_set_stroke_miter_limit
+ vector_layer_set_stroke_width
+ vector_layer_set_stroke_width_unit);
%exports = (app => [@procs], lib => [@procs]);