2005-04-14 10:32:23 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
|
|
|
*
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimppath_pdb.c
|
2005-04-14 10:32:23 +08:00
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This library is free software: you can redistribute it and/or
|
2005-04-14 10:32:23 +08:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2009-01-18 06:28:01 +08:00
|
|
|
* version 3 of the License, or (at your option) any later version.
|
2005-04-14 10:32:23 +08:00
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2009-01-18 06:28:01 +08:00
|
|
|
* License along with this library. If not, see
|
2018-07-12 05:27:07 +08:00
|
|
|
* <https://www.gnu.org/licenses/>.
|
2005-04-14 10:32:23 +08:00
|
|
|
*/
|
|
|
|
|
2007-01-09 18:52:47 +08:00
|
|
|
/* NOTE: This file is auto-generated by pdbgen.pl */
|
2005-04-14 10:32:23 +08:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2022-03-28 21:13:17 +08:00
|
|
|
#include "stamp-pdbgen.h"
|
|
|
|
|
2005-04-14 10:32:23 +08:00
|
|
|
#include "gimp.h"
|
|
|
|
|
2010-07-07 17:43:10 +08:00
|
|
|
|
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* SECTION: gimppath
|
|
|
|
* @title: gimppath
|
|
|
|
* @short_description: Functions for querying and manipulating path.
|
2010-07-07 17:43:10 +08:00
|
|
|
*
|
2024-07-09 07:39:51 +08:00
|
|
|
* Functions for querying and manipulating path.
|
2010-07-07 17:43:10 +08:00
|
|
|
**/
|
|
|
|
|
|
|
|
|
2005-12-30 04:55:07 +08:00
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_new:
|
2019-08-11 20:20:05 +08:00
|
|
|
* @image: The image.
|
2024-07-09 07:39:51 +08:00
|
|
|
* @name: the name of the new path object.
|
2005-12-30 04:55:07 +08:00
|
|
|
*
|
2024-07-09 07:39:51 +08:00
|
|
|
* Creates a new empty path object.
|
2005-12-30 04:55:07 +08:00
|
|
|
*
|
2024-07-09 07:39:51 +08:00
|
|
|
* Creates a new empty path object. The path object needs to be added
|
2024-07-11 08:07:44 +08:00
|
|
|
* to the image using gimp_image_insert_path().
|
2005-12-30 04:55:07 +08:00
|
|
|
*
|
2019-08-15 18:12:25 +08:00
|
|
|
* Returns: (transfer none):
|
2024-07-09 07:39:51 +08:00
|
|
|
* the current path object, 0 if no path exists in the image.
|
2005-12-30 04:55:07 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2024-07-12 14:16:25 +08:00
|
|
|
GimpPath *
|
2024-07-09 07:39:51 +08:00
|
|
|
gimp_path_new (GimpImage *image,
|
|
|
|
const gchar *name)
|
2005-12-30 04:55:07 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2024-07-12 14:16:25 +08:00
|
|
|
GimpPath *path = NULL;
|
2005-12-30 04:55:07 +08:00
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_IMAGE, image,
|
2019-08-08 19:01:50 +08:00
|
|
|
G_TYPE_STRING, name,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-new",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2005-12-30 04:55:07 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2024-07-12 14:16:25 +08:00
|
|
|
path = GIMP_VALUES_GET_PATH (return_vals, 1);
|
2005-12-30 04:55:07 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2005-12-30 04:55:07 +08:00
|
|
|
|
2024-07-09 07:39:51 +08:00
|
|
|
return path;
|
2005-12-30 04:55:07 +08:00
|
|
|
}
|
|
|
|
|
2008-04-04 22:50:42 +08:00
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_new_from_text_layer:
|
2019-08-11 20:20:05 +08:00
|
|
|
* @image: The image.
|
2019-08-13 19:59:33 +08:00
|
|
|
* @layer: The text layer.
|
2008-04-04 22:50:42 +08:00
|
|
|
*
|
2024-07-09 07:39:51 +08:00
|
|
|
* Creates a new path object from a text layer.
|
2008-04-04 22:50:42 +08:00
|
|
|
*
|
2024-07-09 07:39:51 +08:00
|
|
|
* Creates a new path object from a text layer. The path object needs
|
2024-07-11 08:07:44 +08:00
|
|
|
* to be added to the image using gimp_image_insert_path().
|
2008-04-04 22:50:42 +08:00
|
|
|
*
|
2024-07-09 07:39:51 +08:00
|
|
|
* Returns: (transfer none): The path of the text layer.
|
2008-04-04 22:50:42 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.6
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2024-07-12 14:16:25 +08:00
|
|
|
GimpPath *
|
2024-07-09 07:39:51 +08:00
|
|
|
gimp_path_new_from_text_layer (GimpImage *image,
|
|
|
|
GimpLayer *layer)
|
2008-04-04 22:50:42 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2024-07-12 14:16:25 +08:00
|
|
|
GimpPath *path = NULL;
|
2008-04-04 22:50:42 +08:00
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_IMAGE, image,
|
|
|
|
GIMP_TYPE_LAYER, layer,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2008-04-04 22:50:42 +08:00
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-new-from-text-layer",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2008-04-04 22:50:42 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2024-07-12 14:16:25 +08:00
|
|
|
path = GIMP_VALUES_GET_PATH (return_vals, 1);
|
2019-07-30 16:51:16 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2008-04-04 22:50:42 +08:00
|
|
|
|
2024-07-09 07:39:51 +08:00
|
|
|
return path;
|
2008-04-04 22:50:42 +08:00
|
|
|
}
|
|
|
|
|
2008-07-28 22:13:18 +08:00
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_copy:
|
|
|
|
* @path: The path object to copy.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
2024-07-09 07:39:51 +08:00
|
|
|
* Copy a path object.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
2024-07-09 07:39:51 +08:00
|
|
|
* This procedure copies the specified path object and returns the
|
2019-08-14 03:36:03 +08:00
|
|
|
* copy.
|
|
|
|
*
|
2024-07-09 07:39:51 +08:00
|
|
|
* Returns: (transfer none): The newly copied path object.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
|
|
|
* Since: 2.6
|
|
|
|
**/
|
2024-07-12 14:16:25 +08:00
|
|
|
GimpPath *
|
|
|
|
gimp_path_copy (GimpPath *path)
|
2019-08-14 03:36:03 +08:00
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2024-07-12 14:16:25 +08:00
|
|
|
GimpPath *path_copy = NULL;
|
2019-08-14 03:36:03 +08:00
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2019-08-14 03:36:03 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-copy",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-08-14 03:36:03 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2024-07-12 14:16:25 +08:00
|
|
|
path_copy = GIMP_VALUES_GET_PATH (return_vals, 1);
|
2019-08-14 03:36:03 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
2024-07-09 07:39:51 +08:00
|
|
|
return path_copy;
|
2019-08-14 03:36:03 +08:00
|
|
|
}
|
|
|
|
|
2006-03-24 05:17:16 +08:00
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_get_strokes:
|
|
|
|
* @path: The path object.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @num_strokes: (out): The number of strokes returned.
|
2006-03-24 05:17:16 +08:00
|
|
|
*
|
|
|
|
* List the strokes associated with the passed path.
|
|
|
|
*
|
|
|
|
* Returns an Array with the stroke-IDs associated with the passed
|
|
|
|
* path.
|
|
|
|
*
|
2019-08-05 04:09:04 +08:00
|
|
|
* Returns: (array length=num_strokes) (element-type gint32) (transfer full):
|
|
|
|
* List of the strokes belonging to the path.
|
|
|
|
* The returned value must be freed with g_free().
|
2006-03-24 05:17:16 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2006-03-24 05:17:16 +08:00
|
|
|
gint *
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_get_strokes (GimpPath *path,
|
|
|
|
gint *num_strokes)
|
2019-08-14 03:36:03 +08:00
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gint *stroke_ids = NULL;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2019-08-14 03:36:03 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-get-strokes",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-08-14 03:36:03 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
|
|
|
*num_strokes = 0;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-08-14 03:36:03 +08:00
|
|
|
{
|
2019-09-04 08:49:33 +08:00
|
|
|
*num_strokes = GIMP_VALUES_GET_INT (return_vals, 1);
|
|
|
|
stroke_ids = GIMP_VALUES_DUP_INT32_ARRAY (return_vals, 2);
|
2019-08-14 03:36:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return stroke_ids;
|
|
|
|
}
|
|
|
|
|
2005-12-29 05:24:12 +08:00
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_stroke_get_length:
|
|
|
|
* @path: The path object.
|
2019-08-14 03:36:03 +08:00
|
|
|
* @stroke_id: The stroke ID.
|
2021-01-21 03:33:41 +08:00
|
|
|
* @precision: The precision used for approximating straight portions of the stroke.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
|
|
|
* Measure the length of the given stroke.
|
|
|
|
*
|
|
|
|
* Measure the length of the given stroke.
|
|
|
|
*
|
|
|
|
* Returns: The length (in pixels) of the given stroke.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
|
|
|
gdouble
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_stroke_get_length (GimpPath *path,
|
|
|
|
gint stroke_id,
|
|
|
|
gdouble precision)
|
2019-08-14 03:36:03 +08:00
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gdouble length = 0.0;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2019-08-14 03:36:03 +08:00
|
|
|
G_TYPE_INT, stroke_id,
|
|
|
|
G_TYPE_DOUBLE, precision,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-stroke-get-length",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-08-14 03:36:03 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
length = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
|
2019-08-14 03:36:03 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return length;
|
|
|
|
}
|
|
|
|
|
2005-12-30 04:55:07 +08:00
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_stroke_get_point_at_dist:
|
|
|
|
* @path: The path object.
|
2005-12-30 04:55:07 +08:00
|
|
|
* @stroke_id: The stroke ID.
|
|
|
|
* @dist: The given distance.
|
2006-10-24 16:30:55 +08:00
|
|
|
* @precision: The precision used for the approximation.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @x_point: (out): The x position of the point.
|
|
|
|
* @y_point: (out): The y position of the point.
|
|
|
|
* @slope: (out): The slope (dy / dx) at the specified point.
|
|
|
|
* @valid: (out): Indicator for the validity of the returned data.
|
2005-12-30 04:55:07 +08:00
|
|
|
*
|
|
|
|
* Get point at a specified distance along the stroke.
|
|
|
|
*
|
|
|
|
* This will return the x,y position of a point at a given distance
|
|
|
|
* along the stroke. The distance will be obtained by first digitizing
|
|
|
|
* the curve internally and then walking along the curve. For a closed
|
|
|
|
* stroke the start of the path is the first point on the path that was
|
|
|
|
* created. This might not be obvious. If the stroke is not long
|
|
|
|
* enough, a \"valid\" flag will be FALSE.
|
|
|
|
*
|
2006-10-24 16:30:55 +08:00
|
|
|
* Returns: TRUE on success.
|
2005-12-30 04:55:07 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2006-10-24 16:30:55 +08:00
|
|
|
gboolean
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_stroke_get_point_at_dist (GimpPath *path,
|
|
|
|
gint stroke_id,
|
|
|
|
gdouble dist,
|
|
|
|
gdouble precision,
|
|
|
|
gdouble *x_point,
|
|
|
|
gdouble *y_point,
|
|
|
|
gdouble *slope,
|
|
|
|
gboolean *valid)
|
2005-12-30 04:55:07 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2006-10-24 16:30:55 +08:00
|
|
|
gboolean success = TRUE;
|
2005-12-30 04:55:07 +08:00
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, stroke_id,
|
2019-08-08 19:01:50 +08:00
|
|
|
G_TYPE_DOUBLE, dist,
|
|
|
|
G_TYPE_DOUBLE, precision,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-stroke-get-point-at-dist",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2005-12-30 04:55:07 +08:00
|
|
|
|
2006-10-24 16:30:55 +08:00
|
|
|
*x_point = 0.0;
|
|
|
|
*y_point = 0.0;
|
|
|
|
*slope = 0.0;
|
|
|
|
*valid = FALSE;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2006-10-24 16:30:55 +08:00
|
|
|
|
|
|
|
if (success)
|
2005-12-30 04:55:07 +08:00
|
|
|
{
|
2019-09-04 08:49:33 +08:00
|
|
|
*x_point = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
|
|
|
|
*y_point = GIMP_VALUES_GET_DOUBLE (return_vals, 2);
|
|
|
|
*slope = GIMP_VALUES_GET_DOUBLE (return_vals, 3);
|
|
|
|
*valid = GIMP_VALUES_GET_BOOLEAN (return_vals, 4);
|
2005-12-30 04:55:07 +08:00
|
|
|
}
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2005-12-30 04:55:07 +08:00
|
|
|
|
2006-10-24 16:30:55 +08:00
|
|
|
return success;
|
2005-12-30 04:55:07 +08:00
|
|
|
}
|
|
|
|
|
2005-06-02 00:20:46 +08:00
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_remove_stroke:
|
|
|
|
* @path: The path object.
|
2005-06-02 00:20:46 +08:00
|
|
|
* @stroke_id: The stroke ID.
|
|
|
|
*
|
2024-07-09 07:39:51 +08:00
|
|
|
* remove the stroke from a path object.
|
2005-06-02 00:20:46 +08:00
|
|
|
*
|
2024-07-09 07:39:51 +08:00
|
|
|
* Remove the stroke from a path object.
|
2005-06-02 00:20:46 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2005-06-02 00:20:46 +08:00
|
|
|
gboolean
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_remove_stroke (GimpPath *path,
|
|
|
|
gint stroke_id)
|
2005-06-02 00:20:46 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2005-06-02 00:20:46 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, stroke_id,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2005-06-02 00:20:46 +08:00
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-remove-stroke",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2005-06-02 00:20:46 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-07-30 16:51:16 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2005-06-02 00:20:46 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2005-12-30 04:55:07 +08:00
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_stroke_close:
|
|
|
|
* @path: The path object.
|
2005-12-30 04:55:07 +08:00
|
|
|
* @stroke_id: The stroke ID.
|
|
|
|
*
|
2019-09-03 19:31:27 +08:00
|
|
|
* closes the specified stroke.
|
2005-12-30 04:55:07 +08:00
|
|
|
*
|
2019-09-03 19:31:27 +08:00
|
|
|
* Closes the specified stroke.
|
2005-12-30 04:55:07 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2005-12-30 04:55:07 +08:00
|
|
|
gboolean
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_stroke_close (GimpPath *path,
|
|
|
|
gint stroke_id)
|
2005-12-30 04:55:07 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2005-12-30 04:55:07 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, stroke_id,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-stroke-close",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2005-12-30 04:55:07 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2005-12-30 04:55:07 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2020-05-26 04:55:01 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_stroke_reverse:
|
|
|
|
* @path: The path object.
|
2020-05-26 04:55:01 +08:00
|
|
|
* @stroke_id: The stroke ID.
|
|
|
|
*
|
|
|
|
* reverses the specified stroke.
|
|
|
|
*
|
|
|
|
* Reverses the specified stroke.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
gboolean
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_stroke_reverse (GimpPath *path,
|
|
|
|
gint stroke_id)
|
2020-05-26 04:55:01 +08:00
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gboolean success = TRUE;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2020-05-26 04:55:01 +08:00
|
|
|
G_TYPE_INT, stroke_id,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-stroke-reverse",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2020-05-26 04:55:01 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2005-12-30 04:55:07 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2005-05-17 09:20:03 +08:00
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_stroke_translate:
|
|
|
|
* @path: The path object.
|
2005-05-17 09:20:03 +08:00
|
|
|
* @stroke_id: The stroke ID.
|
2019-09-03 19:31:27 +08:00
|
|
|
* @off_x: Offset in x direction.
|
|
|
|
* @off_y: Offset in y direction.
|
2005-05-17 09:20:03 +08:00
|
|
|
*
|
2019-09-03 19:31:27 +08:00
|
|
|
* translate the given stroke.
|
2005-05-17 09:20:03 +08:00
|
|
|
*
|
2019-09-03 19:31:27 +08:00
|
|
|
* Translate the given stroke.
|
2005-05-17 09:20:03 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2005-05-17 09:20:03 +08:00
|
|
|
gboolean
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_stroke_translate (GimpPath *path,
|
|
|
|
gint stroke_id,
|
|
|
|
gdouble off_x,
|
|
|
|
gdouble off_y)
|
2005-05-17 09:20:03 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2005-05-17 09:20:03 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, stroke_id,
|
2022-10-07 09:40:26 +08:00
|
|
|
G_TYPE_DOUBLE, off_x,
|
|
|
|
G_TYPE_DOUBLE, off_y,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2005-12-29 05:24:12 +08:00
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-stroke-translate",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2005-12-29 05:24:12 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-07-30 16:51:16 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2005-12-29 05:24:12 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_stroke_scale:
|
|
|
|
* @path: The path object.
|
2005-12-29 05:24:12 +08:00
|
|
|
* @stroke_id: The stroke ID.
|
2019-09-03 19:31:27 +08:00
|
|
|
* @scale_x: Scale factor in x direction.
|
|
|
|
* @scale_y: Scale factor in y direction.
|
2005-12-29 05:24:12 +08:00
|
|
|
*
|
2019-09-03 19:31:27 +08:00
|
|
|
* scales the given stroke.
|
2005-12-29 05:24:12 +08:00
|
|
|
*
|
2019-09-03 19:31:27 +08:00
|
|
|
* Scale the given stroke.
|
2005-12-29 05:24:12 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2005-12-29 05:24:12 +08:00
|
|
|
gboolean
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_stroke_scale (GimpPath *path,
|
|
|
|
gint stroke_id,
|
|
|
|
gdouble scale_x,
|
|
|
|
gdouble scale_y)
|
2005-12-29 05:24:12 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2005-12-29 05:24:12 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, stroke_id,
|
2019-09-03 19:31:27 +08:00
|
|
|
G_TYPE_DOUBLE, scale_x,
|
|
|
|
G_TYPE_DOUBLE, scale_y,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-stroke-scale",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2005-05-17 09:20:03 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2005-05-17 09:20:03 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2005-05-17 09:20:03 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
2005-06-02 00:20:46 +08:00
|
|
|
|
2006-11-20 23:34:30 +08:00
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_stroke_rotate:
|
|
|
|
* @path: The path object.
|
2006-11-20 23:34:30 +08:00
|
|
|
* @stroke_id: The stroke ID.
|
2019-09-03 19:31:27 +08:00
|
|
|
* @center_x: X coordinate of the rotation center.
|
|
|
|
* @center_y: Y coordinate of the rotation center.
|
|
|
|
* @angle: angle to rotate about.
|
2006-11-20 23:34:30 +08:00
|
|
|
*
|
2019-09-03 19:31:27 +08:00
|
|
|
* rotates the given stroke.
|
2006-11-20 23:34:30 +08:00
|
|
|
*
|
2019-09-03 19:31:27 +08:00
|
|
|
* Rotates the given stroke around given center by angle (in degrees).
|
2006-11-20 23:34:30 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2006-11-20 23:34:30 +08:00
|
|
|
gboolean
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_stroke_rotate (GimpPath *path,
|
|
|
|
gint stroke_id,
|
|
|
|
gdouble center_x,
|
|
|
|
gdouble center_y,
|
|
|
|
gdouble angle)
|
2006-11-20 23:34:30 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2006-11-20 23:34:30 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, stroke_id,
|
2019-09-03 19:31:27 +08:00
|
|
|
G_TYPE_DOUBLE, center_x,
|
|
|
|
G_TYPE_DOUBLE, center_y,
|
|
|
|
G_TYPE_DOUBLE, angle,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2006-11-20 23:34:30 +08:00
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-stroke-rotate",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2006-11-20 23:34:30 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-07-30 16:51:16 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2006-11-20 23:34:30 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_stroke_flip:
|
|
|
|
* @path: The path object.
|
2006-11-20 23:34:30 +08:00
|
|
|
* @stroke_id: The stroke ID.
|
2019-09-03 19:31:27 +08:00
|
|
|
* @flip_type: Flip orientation, either vertical or horizontal.
|
|
|
|
* @axis: axis coordinate about which to flip, in pixels.
|
2006-11-20 23:34:30 +08:00
|
|
|
*
|
2019-09-03 19:31:27 +08:00
|
|
|
* flips the given stroke.
|
2006-11-20 23:34:30 +08:00
|
|
|
*
|
2019-09-03 19:31:27 +08:00
|
|
|
* Rotates the given stroke around given center by angle (in degrees).
|
2006-11-20 23:34:30 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2006-11-20 23:34:30 +08:00
|
|
|
gboolean
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_stroke_flip (GimpPath *path,
|
2024-07-09 07:39:51 +08:00
|
|
|
gint stroke_id,
|
|
|
|
GimpOrientationType flip_type,
|
|
|
|
gdouble axis)
|
2006-11-20 23:34:30 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2006-11-20 23:34:30 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, stroke_id,
|
2019-09-03 19:31:27 +08:00
|
|
|
GIMP_TYPE_ORIENTATION_TYPE, flip_type,
|
|
|
|
G_TYPE_DOUBLE, axis,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-stroke-flip",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2006-11-20 23:34:30 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2006-11-20 23:34:30 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2006-11-20 23:34:30 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_stroke_flip_free:
|
|
|
|
* @path: The path object.
|
2006-11-20 23:34:30 +08:00
|
|
|
* @stroke_id: The stroke ID.
|
2019-09-03 19:31:27 +08:00
|
|
|
* @x1: X coordinate of the first point of the flipping axis.
|
|
|
|
* @y1: Y coordinate of the first point of the flipping axis.
|
|
|
|
* @x2: X coordinate of the second point of the flipping axis.
|
|
|
|
* @y2: Y coordinate of the second point of the flipping axis.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
2019-09-03 19:31:27 +08:00
|
|
|
* flips the given stroke about an arbitrary axis.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
2019-09-03 19:31:27 +08:00
|
|
|
* Flips the given stroke about an arbitrary axis. Axis is defined by
|
|
|
|
* two coordinates in the image (in pixels), through which the flipping
|
|
|
|
* axis passes.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
|
|
|
gboolean
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_stroke_flip_free (GimpPath *path,
|
|
|
|
gint stroke_id,
|
|
|
|
gdouble x1,
|
|
|
|
gdouble y1,
|
|
|
|
gdouble x2,
|
|
|
|
gdouble y2)
|
2019-08-14 03:36:03 +08:00
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gboolean success = TRUE;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2019-08-14 03:36:03 +08:00
|
|
|
G_TYPE_INT, stroke_id,
|
2019-09-03 19:31:27 +08:00
|
|
|
G_TYPE_DOUBLE, x1,
|
|
|
|
G_TYPE_DOUBLE, y1,
|
|
|
|
G_TYPE_DOUBLE, x2,
|
|
|
|
G_TYPE_DOUBLE, y2,
|
2019-08-14 03:36:03 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-stroke-flip-free",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-08-14 03:36:03 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-08-14 03:36:03 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_stroke_get_points:
|
|
|
|
* @path: The path object.
|
2019-08-14 03:36:03 +08:00
|
|
|
* @stroke_id: The stroke ID.
|
2019-09-03 19:31:27 +08:00
|
|
|
* @num_points: (out): The number of floats returned.
|
|
|
|
* @controlpoints: (out) (array length=num_points) (element-type gdouble) (transfer full): List of the control points for the stroke (x0, y0, x1, y1, ...).
|
|
|
|
* @closed: (out): Whether the stroke is closed or not.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
2019-09-03 19:31:27 +08:00
|
|
|
* returns the control points of a stroke.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
2019-09-03 19:31:27 +08:00
|
|
|
* returns the control points of a stroke. The interpretation of the
|
|
|
|
* coordinates returned depends on the type of the stroke. For Gimp 2.4
|
|
|
|
* this is always a bezier stroke, where the coordinates are the
|
|
|
|
* control points.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
2024-07-19 23:07:43 +08:00
|
|
|
* Returns: type of the stroke (always GIMP_PATH_STROKE_TYPE_BEZIER for now).
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2024-07-19 23:07:43 +08:00
|
|
|
GimpPathStrokeType
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_stroke_get_points (GimpPath *path,
|
|
|
|
gint stroke_id,
|
|
|
|
gint *num_points,
|
|
|
|
gdouble **controlpoints,
|
|
|
|
gboolean *closed)
|
2019-08-14 03:36:03 +08:00
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2024-07-19 23:07:43 +08:00
|
|
|
GimpPathStrokeType type = 0;
|
2019-08-14 03:36:03 +08:00
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2019-08-14 03:36:03 +08:00
|
|
|
G_TYPE_INT, stroke_id,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-stroke-get-points",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-08-14 03:36:03 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-03 19:31:27 +08:00
|
|
|
*num_points = 0;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-03 19:31:27 +08:00
|
|
|
{
|
2019-09-04 08:49:33 +08:00
|
|
|
type = GIMP_VALUES_GET_ENUM (return_vals, 1);
|
|
|
|
*num_points = GIMP_VALUES_GET_INT (return_vals, 2);
|
|
|
|
*controlpoints = GIMP_VALUES_DUP_FLOAT_ARRAY (return_vals, 3);
|
|
|
|
*closed = GIMP_VALUES_GET_BOOLEAN (return_vals, 4);
|
2019-09-03 19:31:27 +08:00
|
|
|
}
|
2019-08-14 03:36:03 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
2019-09-03 19:31:27 +08:00
|
|
|
return type;
|
2019-08-14 03:36:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_stroke_new_from_points:
|
|
|
|
* @path: The path object.
|
2024-07-19 23:07:43 +08:00
|
|
|
* @type: type of the stroke (always GIMP_PATH_STROKE_TYPE_BEZIER for now).
|
2019-09-03 19:31:27 +08:00
|
|
|
* @num_points: The number of elements in the array, i.e. the number of controlpoints in the stroke * 2 (x- and y-coordinate).
|
|
|
|
* @controlpoints: (array length=num_points) (element-type gdouble): List of the x- and y-coordinates of the control points.
|
|
|
|
* @closed: Whether the stroke is to be closed or not.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
2024-07-09 07:39:51 +08:00
|
|
|
* Adds a stroke of a given type to the path object.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
2024-07-09 07:39:51 +08:00
|
|
|
* Adds a stroke of a given type to the path object. The coordinates of
|
|
|
|
* the control points can be specified. For now only strokes of the
|
2024-07-19 23:07:43 +08:00
|
|
|
* type GIMP_PATH_STROKE_TYPE_BEZIER are supported. The control points
|
|
|
|
* are specified as a pair of float values for the x- and y-coordinate.
|
|
|
|
* The Bezier stroke type needs a multiple of three control points.
|
|
|
|
* Each Bezier segment endpoint (anchor, A) has two additional control
|
|
|
|
* points (C) associated. They are specified in the order CACCACCAC...
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
2019-09-03 19:31:27 +08:00
|
|
|
* Returns: The stroke ID of the newly created stroke.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2019-09-03 19:31:27 +08:00
|
|
|
gint
|
2024-07-19 23:07:43 +08:00
|
|
|
gimp_path_stroke_new_from_points (GimpPath *path,
|
|
|
|
GimpPathStrokeType type,
|
|
|
|
gint num_points,
|
|
|
|
const gdouble *controlpoints,
|
|
|
|
gboolean closed)
|
2019-08-14 03:36:03 +08:00
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2019-09-03 19:31:27 +08:00
|
|
|
gint stroke_id = 0;
|
2019-08-14 03:36:03 +08:00
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2024-07-19 23:07:43 +08:00
|
|
|
GIMP_TYPE_PATH_STROKE_TYPE, type,
|
2019-09-03 19:31:27 +08:00
|
|
|
G_TYPE_INT, num_points,
|
|
|
|
GIMP_TYPE_FLOAT_ARRAY, NULL,
|
|
|
|
G_TYPE_BOOLEAN, closed,
|
2019-08-14 03:36:03 +08:00
|
|
|
G_TYPE_NONE);
|
2019-09-03 19:31:27 +08:00
|
|
|
gimp_value_set_float_array (gimp_value_array_index (args, 3), controlpoints, num_points);
|
2019-08-14 03:36:03 +08:00
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-stroke-new-from-points",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-08-14 03:36:03 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
stroke_id = GIMP_VALUES_GET_INT (return_vals, 1);
|
2019-08-14 03:36:03 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
2019-09-03 19:31:27 +08:00
|
|
|
return stroke_id;
|
2019-08-14 03:36:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_stroke_interpolate:
|
|
|
|
* @path: The path object.
|
2019-08-14 03:36:03 +08:00
|
|
|
* @stroke_id: The stroke ID.
|
2019-09-03 19:31:27 +08:00
|
|
|
* @precision: The precision used for the approximation.
|
|
|
|
* @num_coords: (out): The number of floats returned.
|
|
|
|
* @closed: (out): Whether the stroke is closed or not.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
2019-09-03 19:31:27 +08:00
|
|
|
* returns polygonal approximation of the stroke.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
2019-09-03 19:31:27 +08:00
|
|
|
* returns polygonal approximation of the stroke.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
2019-09-03 19:31:27 +08:00
|
|
|
* Returns: (array length=num_coords) (element-type gdouble) (transfer full):
|
|
|
|
* List of the coords along the path (x0, y0, x1, y1, ...).
|
|
|
|
* The returned value must be freed with g_free().
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2019-09-03 19:31:27 +08:00
|
|
|
gdouble *
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_stroke_interpolate (GimpPath *path,
|
|
|
|
gint stroke_id,
|
|
|
|
gdouble precision,
|
|
|
|
gint *num_coords,
|
|
|
|
gboolean *closed)
|
2019-08-14 03:36:03 +08:00
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2019-09-03 19:31:27 +08:00
|
|
|
gdouble *coords = NULL;
|
2019-08-14 03:36:03 +08:00
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2019-08-14 03:36:03 +08:00
|
|
|
G_TYPE_INT, stroke_id,
|
2019-09-03 19:31:27 +08:00
|
|
|
G_TYPE_DOUBLE, precision,
|
2019-08-14 03:36:03 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-stroke-interpolate",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-08-14 03:36:03 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-03 19:31:27 +08:00
|
|
|
*num_coords = 0;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-03 19:31:27 +08:00
|
|
|
{
|
2019-09-04 08:49:33 +08:00
|
|
|
*num_coords = GIMP_VALUES_GET_INT (return_vals, 1);
|
|
|
|
coords = GIMP_VALUES_DUP_FLOAT_ARRAY (return_vals, 2);
|
|
|
|
*closed = GIMP_VALUES_GET_BOOLEAN (return_vals, 3);
|
2019-09-03 19:31:27 +08:00
|
|
|
}
|
2019-08-14 03:36:03 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
2019-09-03 19:31:27 +08:00
|
|
|
return coords;
|
2019-08-14 03:36:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_bezier_stroke_new_moveto:
|
|
|
|
* @path: The path object.
|
2019-09-03 19:31:27 +08:00
|
|
|
* @x0: The x-coordinate of the moveto.
|
|
|
|
* @y0: The y-coordinate of the moveto.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
2024-07-09 07:39:51 +08:00
|
|
|
* Adds a bezier stroke with a single moveto to the path object.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
2024-07-09 07:39:51 +08:00
|
|
|
* Adds a bezier stroke with a single moveto to the path object.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
|
|
|
* Returns: The resulting stroke.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
|
|
|
gint
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_bezier_stroke_new_moveto (GimpPath *path,
|
|
|
|
gdouble x0,
|
|
|
|
gdouble y0)
|
2019-08-14 03:36:03 +08:00
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gint stroke_id = 0;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2019-08-14 03:36:03 +08:00
|
|
|
G_TYPE_DOUBLE, x0,
|
|
|
|
G_TYPE_DOUBLE, y0,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-bezier-stroke-new-moveto",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-08-14 03:36:03 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
stroke_id = GIMP_VALUES_GET_INT (return_vals, 1);
|
2019-08-14 03:36:03 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return stroke_id;
|
|
|
|
}
|
|
|
|
|
2005-12-30 00:05:31 +08:00
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_bezier_stroke_lineto:
|
|
|
|
* @path: The path object.
|
2019-08-14 03:36:03 +08:00
|
|
|
* @stroke_id: The stroke ID.
|
|
|
|
* @x0: The x-coordinate of the lineto.
|
|
|
|
* @y0: The y-coordinate of the lineto.
|
|
|
|
*
|
|
|
|
* Extends a bezier stroke with a lineto.
|
|
|
|
*
|
|
|
|
* Extends a bezier stroke with a lineto.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
|
|
|
gboolean
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_bezier_stroke_lineto (GimpPath *path,
|
|
|
|
gint stroke_id,
|
|
|
|
gdouble x0,
|
|
|
|
gdouble y0)
|
2019-08-14 03:36:03 +08:00
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gboolean success = TRUE;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2019-08-14 03:36:03 +08:00
|
|
|
G_TYPE_INT, stroke_id,
|
|
|
|
G_TYPE_DOUBLE, x0,
|
|
|
|
G_TYPE_DOUBLE, y0,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-bezier-stroke-lineto",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-08-14 03:36:03 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-08-14 03:36:03 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2005-12-30 00:05:31 +08:00
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_bezier_stroke_conicto:
|
|
|
|
* @path: The path object.
|
2019-08-14 03:36:03 +08:00
|
|
|
* @stroke_id: The stroke ID.
|
|
|
|
* @x0: The x-coordinate of the control point.
|
|
|
|
* @y0: The y-coordinate of the control point.
|
|
|
|
* @x1: The x-coordinate of the end point.
|
|
|
|
* @y1: The y-coordinate of the end point.
|
|
|
|
*
|
|
|
|
* Extends a bezier stroke with a conic bezier spline.
|
|
|
|
*
|
|
|
|
* Extends a bezier stroke with a conic bezier spline. Actually a cubic
|
|
|
|
* bezier spline gets added that realizes the shape of a conic bezier
|
|
|
|
* spline.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
|
|
|
gboolean
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_bezier_stroke_conicto (GimpPath *path,
|
|
|
|
gint stroke_id,
|
|
|
|
gdouble x0,
|
|
|
|
gdouble y0,
|
|
|
|
gdouble x1,
|
|
|
|
gdouble y1)
|
2019-08-14 03:36:03 +08:00
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gboolean success = TRUE;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2019-08-14 03:36:03 +08:00
|
|
|
G_TYPE_INT, stroke_id,
|
|
|
|
G_TYPE_DOUBLE, x0,
|
|
|
|
G_TYPE_DOUBLE, y0,
|
|
|
|
G_TYPE_DOUBLE, x1,
|
|
|
|
G_TYPE_DOUBLE, y1,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-bezier-stroke-conicto",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-08-14 03:36:03 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-08-14 03:36:03 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_bezier_stroke_cubicto:
|
|
|
|
* @path: The path object.
|
2005-12-30 00:05:31 +08:00
|
|
|
* @stroke_id: The stroke ID.
|
|
|
|
* @x0: The x-coordinate of the first control point.
|
|
|
|
* @y0: The y-coordinate of the first control point.
|
|
|
|
* @x1: The x-coordinate of the second control point.
|
|
|
|
* @y1: The y-coordinate of the second control point.
|
|
|
|
* @x2: The x-coordinate of the end point.
|
|
|
|
* @y2: The y-coordinate of the end point.
|
|
|
|
*
|
|
|
|
* Extends a bezier stroke with a cubic bezier spline.
|
|
|
|
*
|
|
|
|
* Extends a bezier stroke with a cubic bezier spline.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2005-12-30 00:05:31 +08:00
|
|
|
gboolean
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_bezier_stroke_cubicto (GimpPath *path,
|
|
|
|
gint stroke_id,
|
|
|
|
gdouble x0,
|
|
|
|
gdouble y0,
|
|
|
|
gdouble x1,
|
|
|
|
gdouble y1,
|
|
|
|
gdouble x2,
|
|
|
|
gdouble y2)
|
2005-12-30 00:05:31 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2005-12-30 00:05:31 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, stroke_id,
|
2019-08-08 19:01:50 +08:00
|
|
|
G_TYPE_DOUBLE, x0,
|
|
|
|
G_TYPE_DOUBLE, y0,
|
|
|
|
G_TYPE_DOUBLE, x1,
|
|
|
|
G_TYPE_DOUBLE, y1,
|
|
|
|
G_TYPE_DOUBLE, x2,
|
|
|
|
G_TYPE_DOUBLE, y2,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-bezier-stroke-cubicto",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-07-30 16:51:16 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2005-12-30 00:05:31 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_bezier_stroke_new_ellipse:
|
|
|
|
* @path: The path object.
|
2019-08-14 03:36:03 +08:00
|
|
|
* @x0: The x-coordinate of the center.
|
|
|
|
* @y0: The y-coordinate of the center.
|
|
|
|
* @radius_x: The radius in x direction.
|
|
|
|
* @radius_y: The radius in y direction.
|
|
|
|
* @angle: The angle the x-axis of the ellipse (radians, counterclockwise).
|
|
|
|
*
|
2024-07-09 07:39:51 +08:00
|
|
|
* Adds a bezier stroke describing an ellipse the path object.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
2024-07-09 07:39:51 +08:00
|
|
|
* Adds a bezier stroke describing an ellipse on the path object.
|
2019-08-14 03:36:03 +08:00
|
|
|
*
|
|
|
|
* Returns: The resulting stroke.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
|
|
|
gint
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_bezier_stroke_new_ellipse (GimpPath *path,
|
|
|
|
gdouble x0,
|
|
|
|
gdouble y0,
|
|
|
|
gdouble radius_x,
|
|
|
|
gdouble radius_y,
|
|
|
|
gdouble angle)
|
2019-08-14 03:36:03 +08:00
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gint stroke_id = 0;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2019-08-14 03:36:03 +08:00
|
|
|
G_TYPE_DOUBLE, x0,
|
|
|
|
G_TYPE_DOUBLE, y0,
|
|
|
|
G_TYPE_DOUBLE, radius_x,
|
|
|
|
G_TYPE_DOUBLE, radius_y,
|
|
|
|
G_TYPE_DOUBLE, angle,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-bezier-stroke-new-ellipse",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-08-14 03:36:03 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
stroke_id = GIMP_VALUES_GET_INT (return_vals, 1);
|
2019-08-14 03:36:03 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return stroke_id;
|
|
|
|
}
|
|
|
|
|
2006-10-25 23:14:03 +08:00
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_import_from_file:
|
2019-08-11 20:20:05 +08:00
|
|
|
* @image: The image.
|
2019-09-12 03:48:34 +08:00
|
|
|
* @file: The SVG file to import.
|
2024-07-09 07:39:51 +08:00
|
|
|
* @merge: Merge paths into a single path object.
|
2006-10-25 23:14:03 +08:00
|
|
|
* @scale: Scale the SVG to image dimensions.
|
2024-07-09 07:39:51 +08:00
|
|
|
* @num_paths: (out): The number of newly created path.
|
2024-07-12 14:16:25 +08:00
|
|
|
* @path: (out) (array length=num_paths) (element-type GimpPath) (transfer container): The list of newly created path.
|
2006-10-25 23:14:03 +08:00
|
|
|
*
|
|
|
|
* Import paths from an SVG file.
|
|
|
|
*
|
|
|
|
* This procedure imports paths from an SVG file. SVG elements other
|
|
|
|
* than paths and basic shapes are ignored.
|
|
|
|
*
|
2006-10-31 07:04:12 +08:00
|
|
|
* Returns: TRUE on success.
|
2006-10-25 23:14:03 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2006-10-31 07:04:12 +08:00
|
|
|
gboolean
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_import_from_file (GimpImage *image,
|
|
|
|
GFile *file,
|
|
|
|
gboolean merge,
|
|
|
|
gboolean scale,
|
|
|
|
gint *num_paths,
|
|
|
|
GimpPath ***path)
|
2006-10-25 23:14:03 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2006-10-31 07:04:12 +08:00
|
|
|
gboolean success = TRUE;
|
2006-10-25 23:14:03 +08:00
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_IMAGE, image,
|
2019-09-12 03:48:34 +08:00
|
|
|
G_TYPE_FILE, file,
|
2019-08-08 19:01:50 +08:00
|
|
|
G_TYPE_BOOLEAN, merge,
|
|
|
|
G_TYPE_BOOLEAN, scale,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-import-from-file",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2006-10-25 23:14:03 +08:00
|
|
|
|
2024-07-09 07:39:51 +08:00
|
|
|
*num_paths = 0;
|
|
|
|
*path = NULL;
|
2006-10-25 23:14:03 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2006-10-31 07:04:12 +08:00
|
|
|
|
|
|
|
if (success)
|
2006-10-25 23:14:03 +08:00
|
|
|
{
|
2024-07-09 07:39:51 +08:00
|
|
|
*num_paths = GIMP_VALUES_GET_INT (return_vals, 1);
|
|
|
|
{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) *path = g_memdup2 (a->data, a->length * sizeof (gpointer)); };
|
2006-10-25 23:14:03 +08:00
|
|
|
}
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2006-10-25 23:14:03 +08:00
|
|
|
|
2006-10-31 07:04:12 +08:00
|
|
|
return success;
|
2006-10-25 23:14:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_import_from_string:
|
2019-08-11 20:20:05 +08:00
|
|
|
* @image: The image.
|
2006-10-25 23:14:03 +08:00
|
|
|
* @string: A string that must be a complete and valid SVG document.
|
|
|
|
* @length: Number of bytes in string or -1 if the string is NULL terminated.
|
2024-07-09 07:39:51 +08:00
|
|
|
* @merge: Merge paths into a single path object.
|
2006-10-25 23:14:03 +08:00
|
|
|
* @scale: Scale the SVG to image dimensions.
|
2024-07-09 07:39:51 +08:00
|
|
|
* @num_paths: (out): The number of newly created path.
|
2024-07-12 14:16:25 +08:00
|
|
|
* @path: (out) (array length=num_paths) (element-type GimpPath) (transfer container): The list of newly created path.
|
2006-10-25 23:14:03 +08:00
|
|
|
*
|
|
|
|
* Import paths from an SVG string.
|
|
|
|
*
|
2024-07-13 13:07:57 +08:00
|
|
|
* This procedure works like gimp_path_import_from_file() but takes a
|
|
|
|
* string rather than reading the SVG from a file. This allows you to
|
2006-10-25 23:14:03 +08:00
|
|
|
* write scripts that generate SVG and feed it to GIMP.
|
|
|
|
*
|
2006-10-31 07:04:12 +08:00
|
|
|
* Returns: TRUE on success.
|
2006-10-25 23:14:03 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2006-10-31 07:04:12 +08:00
|
|
|
gboolean
|
2024-07-09 07:39:51 +08:00
|
|
|
gimp_path_import_from_string (GimpImage *image,
|
|
|
|
const gchar *string,
|
|
|
|
gint length,
|
|
|
|
gboolean merge,
|
|
|
|
gboolean scale,
|
|
|
|
gint *num_paths,
|
2024-07-12 14:16:25 +08:00
|
|
|
GimpPath ***path)
|
2006-10-25 23:14:03 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2006-10-31 07:04:12 +08:00
|
|
|
gboolean success = TRUE;
|
2006-10-25 23:14:03 +08:00
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_IMAGE, image,
|
2019-08-08 19:01:50 +08:00
|
|
|
G_TYPE_STRING, string,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, length,
|
2019-08-08 19:01:50 +08:00
|
|
|
G_TYPE_BOOLEAN, merge,
|
|
|
|
G_TYPE_BOOLEAN, scale,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-import-from-string",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2006-10-25 23:14:03 +08:00
|
|
|
|
2024-07-09 07:39:51 +08:00
|
|
|
*num_paths = 0;
|
|
|
|
*path = NULL;
|
2006-10-25 23:14:03 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2006-10-31 07:04:12 +08:00
|
|
|
|
|
|
|
if (success)
|
2006-10-25 23:14:03 +08:00
|
|
|
{
|
2024-07-09 07:39:51 +08:00
|
|
|
*num_paths = GIMP_VALUES_GET_INT (return_vals, 1);
|
|
|
|
{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) *path = g_memdup2 (a->data, a->length * sizeof (gpointer)); };
|
2006-10-25 23:14:03 +08:00
|
|
|
}
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2006-10-25 23:14:03 +08:00
|
|
|
|
2006-10-31 07:04:12 +08:00
|
|
|
return success;
|
2006-10-25 23:14:03 +08:00
|
|
|
}
|
2007-11-19 02:51:54 +08:00
|
|
|
|
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_export_to_file:
|
2019-08-11 20:20:05 +08:00
|
|
|
* @image: The image.
|
2019-09-12 03:48:34 +08:00
|
|
|
* @file: The SVG file to create.
|
2024-07-09 07:39:51 +08:00
|
|
|
* @path: (nullable): The path object to export, or %NULL for all in the image.
|
2007-11-19 02:51:54 +08:00
|
|
|
*
|
|
|
|
* save a path as an SVG file.
|
|
|
|
*
|
2024-07-09 07:39:51 +08:00
|
|
|
* This procedure creates an SVG file to save a Path object, that is, a
|
|
|
|
* path. The resulting file can be edited using a vector graphics
|
|
|
|
* application, or later reloaded into GIMP. Pass %NULL as the 'path'
|
|
|
|
* argument to export all paths in the image.
|
2007-11-19 02:51:54 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.6
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2007-11-19 02:51:54 +08:00
|
|
|
gboolean
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_export_to_file (GimpImage *image,
|
|
|
|
GFile *file,
|
|
|
|
GimpPath *path)
|
2007-11-19 02:51:54 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2007-11-19 02:51:54 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_IMAGE, image,
|
2019-09-12 03:48:34 +08:00
|
|
|
G_TYPE_FILE, file,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-export-to-file",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2007-11-19 02:51:54 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2007-11-19 02:51:54 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2007-11-19 02:51:54 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-07-09 07:39:51 +08:00
|
|
|
* gimp_path_export_to_string:
|
2019-08-11 20:20:05 +08:00
|
|
|
* @image: The image.
|
2024-07-09 07:39:51 +08:00
|
|
|
* @path: (nullable): The path object to export, or %NULL for all in the image.
|
2007-11-19 02:51:54 +08:00
|
|
|
*
|
|
|
|
* Save a path as an SVG string.
|
|
|
|
*
|
2024-07-09 07:39:51 +08:00
|
|
|
* This procedure works like gimp_path_export_to_file() but creates a
|
|
|
|
* string rather than a file. The string is NULL-terminated and holds a
|
|
|
|
* complete XML document. Pass %NULL as the 'path' argument to export
|
|
|
|
* all paths in the image.
|
2007-11-19 02:51:54 +08:00
|
|
|
*
|
2019-08-05 04:09:04 +08:00
|
|
|
* Returns: (transfer full):
|
|
|
|
* A string whose contents are a complete SVG document.
|
|
|
|
* The returned value must be freed with g_free().
|
2007-11-19 02:51:54 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.6
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2007-11-19 02:51:54 +08:00
|
|
|
gchar *
|
2024-07-12 14:16:25 +08:00
|
|
|
gimp_path_export_to_string (GimpImage *image,
|
|
|
|
GimpPath *path)
|
2007-11-19 02:51:54 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2007-11-19 02:51:54 +08:00
|
|
|
gchar *string = NULL;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_IMAGE, image,
|
2024-07-12 14:16:25 +08:00
|
|
|
GIMP_TYPE_PATH, path,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
2024-07-09 07:39:51 +08:00
|
|
|
"gimp-path-export-to-string",
|
2023-10-17 04:07:55 +08:00
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2007-11-19 02:51:54 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
string = GIMP_VALUES_DUP_STRING (return_vals, 1);
|
2007-11-19 02:51:54 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2007-11-19 02:51:54 +08:00
|
|
|
|
|
|
|
return string;
|
|
|
|
}
|