pdb, libgimp: Rename libgimp GimpVectors vectors API...

...to paths
Follow-up to d0bdbdfd. Changes all
gimp_vectors_* () PDB to gimp_path_* ()
and renames relevant PDB files from
vectors to path.
The next step will be to rename
GimpVectors in libgimp to GimpPath,
removing the last (public) trace of it.
This commit is contained in:
Alx Sa 2024-07-08 23:39:51 +00:00
parent cdde11b19d
commit b90b6bce00
27 changed files with 1564 additions and 1564 deletions

View File

@ -789,28 +789,28 @@ gimp_pdb_image_get_sample_point (GimpImage *image,
}
GimpStroke *
gimp_pdb_get_vectors_stroke (GimpVectors *vectors,
gint stroke_id,
GimpPDBItemModify modify,
GError **error)
gimp_pdb_get_path_stroke (GimpVectors *path,
gint stroke_id,
GimpPDBItemModify modify,
GError **error)
{
GimpStroke *stroke = NULL;
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), NULL);
g_return_val_if_fail (GIMP_IS_VECTORS (path), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
if (! gimp_pdb_item_is_not_group (GIMP_ITEM (vectors), error))
if (! gimp_pdb_item_is_not_group (GIMP_ITEM (path), error))
return NULL;
if (! modify || gimp_pdb_item_is_modifiable (GIMP_ITEM (vectors),
if (! modify || gimp_pdb_item_is_modifiable (GIMP_ITEM (path),
modify, error))
{
stroke = gimp_vectors_stroke_get_by_id (vectors, stroke_id);
stroke = gimp_vectors_stroke_get_by_id (path, stroke_id);
if (! stroke)
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
_("Vectors object %d does not contain stroke with ID %d"),
gimp_item_get_id (GIMP_ITEM (vectors)), stroke_id);
_("Path object %d does not contain stroke with ID %d"),
gimp_item_get_id (GIMP_ITEM (path)), stroke_id);
}
return stroke;

View File

@ -102,7 +102,7 @@ GimpSamplePoint * gimp_pdb_image_get_sample_point (GimpImage *image,
gint sample_point_id,
GError **error);
GimpStroke * gimp_pdb_get_vectors_stroke (GimpVectors *vectors,
GimpStroke * gimp_pdb_get_path_stroke (GimpVectors *path,
gint stroke_id,
GimpPDBItemModify modify,
GError **error);

View File

@ -80,6 +80,7 @@ internal_procs_init (GimpPDB *pdb)
register_palette_procs (pdb);
register_palette_select_procs (pdb);
register_palettes_procs (pdb);
register_path_procs (pdb);
register_pattern_procs (pdb);
register_pattern_select_procs (pdb);
register_patterns_procs (pdb);
@ -92,5 +93,4 @@ internal_procs_init (GimpPDB *pdb)
register_text_layer_procs (pdb);
register_text_tool_procs (pdb);
register_unit_procs (pdb);
register_vectors_procs (pdb);
}

View File

@ -67,6 +67,7 @@ void register_paint_tools_procs (GimpPDB *pdb);
void register_palette_procs (GimpPDB *pdb);
void register_palette_select_procs (GimpPDB *pdb);
void register_palettes_procs (GimpPDB *pdb);
void register_path_procs (GimpPDB *pdb);
void register_pattern_procs (GimpPDB *pdb);
void register_pattern_select_procs (GimpPDB *pdb);
void register_patterns_procs (GimpPDB *pdb);
@ -79,6 +80,5 @@ void register_selection_procs (GimpPDB *pdb);
void register_text_layer_procs (GimpPDB *pdb);
void register_text_tool_procs (GimpPDB *pdb);
void register_unit_procs (GimpPDB *pdb);
void register_vectors_procs (GimpPDB *pdb);
#endif /* __INTERNAL_PROCS_H__ */

View File

@ -274,6 +274,38 @@ item_id_is_layer_mask_invoker (GimpProcedure *procedure,
return return_vals;
}
static GimpValueArray *
item_id_is_path_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpValueArray *return_vals;
gint item_id;
gboolean path = FALSE;
item_id = g_value_get_int (gimp_value_array_index (args, 0));
if (success)
{
GimpItem *item = gimp_item_get_by_id (gimp, item_id);
path = (GIMP_IS_VECTORS (item) &&
! gimp_item_is_removed (item));
}
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), path);
return return_vals;
}
static GimpValueArray *
item_id_is_selection_invoker (GimpProcedure *procedure,
Gimp *gimp,
@ -306,38 +338,6 @@ item_id_is_selection_invoker (GimpProcedure *procedure,
return return_vals;
}
static GimpValueArray *
item_id_is_vectors_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpValueArray *return_vals;
gint item_id;
gboolean vectors = FALSE;
item_id = g_value_get_int (gimp_value_array_index (args, 0));
if (success)
{
GimpItem *item = gimp_item_get_by_id (gimp, item_id);
vectors = (GIMP_IS_VECTORS (item) &&
! gimp_item_is_removed (item));
}
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), vectors);
return return_vals;
}
static GimpValueArray *
item_get_image_invoker (GimpProcedure *procedure,
Gimp *gimp,
@ -1264,6 +1264,35 @@ register_item_procs (GimpPDB *pdb)
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-item-id-is-path
*/
procedure = gimp_procedure_new (item_id_is_path_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-item-id-is-path");
gimp_procedure_set_static_help (procedure,
"Returns whether the item ID is a path.",
"This procedure returns TRUE if the specified item ID is a path.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
gimp_procedure_add_argument (procedure,
g_param_spec_int ("item-id",
"item id",
"The item ID",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_boolean ("path",
"path",
"TRUE if the item ID is a path, FALSE otherwise",
FALSE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-item-id-is-selection
*/
@ -1293,35 +1322,6 @@ register_item_procs (GimpPDB *pdb)
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-item-id-is-vectors
*/
procedure = gimp_procedure_new (item_id_is_vectors_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-item-id-is-vectors");
gimp_procedure_set_static_help (procedure,
"Returns whether the item ID is a vectors.",
"This procedure returns TRUE if the specified item ID is a vectors.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
gimp_procedure_add_argument (procedure,
g_param_spec_int ("item-id",
"item id",
"The item ID",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_boolean ("vectors",
"vectors",
"TRUE if the item ID is a vectors, FALSE otherwise",
FALSE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-item-get-image
*/

View File

@ -52,6 +52,7 @@ libappinternalprocs_sources = [
'palette-cmds.c',
'palette-select-cmds.c',
'palettes-cmds.c',
'path-cmds.c',
'pattern-cmds.c',
'pattern-select-cmds.c',
'patterns-cmds.c',
@ -64,7 +65,6 @@ libappinternalprocs_sources = [
'text-layer-cmds.c',
'text-tool-cmds.c',
'unit-cmds.c',
'vectors-cmds.c',
]
libapppdb = static_library('apppdb',

File diff suppressed because it is too large Load Diff

View File

@ -565,20 +565,20 @@ EXPORTS
gimp_item_id_is_group_layer
gimp_item_id_is_layer
gimp_item_id_is_layer_mask
gimp_item_id_is_path
gimp_item_id_is_selection
gimp_item_id_is_text_layer
gimp_item_id_is_valid
gimp_item_id_is_vectors
gimp_item_is_channel
gimp_item_is_drawable
gimp_item_is_group
gimp_item_is_group_layer
gimp_item_is_layer
gimp_item_is_layer_mask
gimp_item_is_path
gimp_item_is_selection
gimp_item_is_text_layer
gimp_item_is_valid
gimp_item_is_vectors
gimp_item_list_children
gimp_item_set_color_tag
gimp_item_set_expanded
@ -708,6 +708,32 @@ EXPORTS
gimp_param_spec_vectors
gimp_param_text_layer_get_type
gimp_param_vectors_get_type
gimp_path_bezier_stroke_conicto
gimp_path_bezier_stroke_cubicto
gimp_path_bezier_stroke_lineto
gimp_path_bezier_stroke_new_ellipse
gimp_path_bezier_stroke_new_moveto
gimp_path_copy
gimp_path_export_to_file
gimp_path_export_to_string
gimp_path_get_strokes
gimp_path_import_from_file
gimp_path_import_from_string
gimp_path_new
gimp_path_new_from_text_layer
gimp_path_remove_stroke
gimp_path_stroke_close
gimp_path_stroke_flip
gimp_path_stroke_flip_free
gimp_path_stroke_get_length
gimp_path_stroke_get_point_at_dist
gimp_path_stroke_get_points
gimp_path_stroke_interpolate
gimp_path_stroke_new_from_points
gimp_path_stroke_reverse
gimp_path_stroke_rotate
gimp_path_stroke_scale
gimp_path_stroke_translate
gimp_pattern_get_buffer
gimp_pattern_get_by_name
gimp_pattern_get_info
@ -913,13 +939,13 @@ EXPORTS
gimp_resource_get_id
gimp_resource_get_name
gimp_resource_get_type
gimp_resource_id_is_brush
gimp_resource_id_is_font
gimp_resource_id_is_gradient
gimp_resource_id_is_palette
gimp_resource_id_is_pattern
gimp_resource_id_is_valid
gimp_resource_is_brush
gimp_resource_id_is_brush
gimp_resource_id_is_font
gimp_resource_id_is_gradient
gimp_resource_id_is_palette
gimp_resource_id_is_pattern
gimp_resource_id_is_valid
gimp_resource_is_brush
gimp_resource_is_editable
gimp_resource_is_font
gimp_resource_is_gradient
@ -992,33 +1018,7 @@ EXPORTS
gimp_vector_load_procedure_extract_dimensions
gimp_vector_load_procedure_get_type
gimp_vector_load_procedure_new
gimp_vectors_bezier_stroke_conicto
gimp_vectors_bezier_stroke_cubicto
gimp_vectors_bezier_stroke_lineto
gimp_vectors_bezier_stroke_new_ellipse
gimp_vectors_bezier_stroke_new_moveto
gimp_vectors_copy
gimp_vectors_export_to_file
gimp_vectors_export_to_string
gimp_vectors_get_by_id
gimp_vectors_get_strokes
gimp_vectors_get_type
gimp_vectors_import_from_file
gimp_vectors_import_from_string
gimp_vectors_new
gimp_vectors_new_from_text_layer
gimp_vectors_remove_stroke
gimp_vectors_stroke_close
gimp_vectors_stroke_flip
gimp_vectors_stroke_flip_free
gimp_vectors_stroke_get_length
gimp_vectors_stroke_get_point_at_dist
gimp_vectors_stroke_get_points
gimp_vectors_stroke_interpolate
gimp_vectors_stroke_new_from_points
gimp_vectors_stroke_reverse
gimp_vectors_stroke_rotate
gimp_vectors_stroke_scale
gimp_vectors_stroke_translate
gimp_version
gimp_wm_class

View File

@ -70,6 +70,7 @@
#include <libgimp/gimppalette_pdb.h>
#include <libgimp/gimppalettes_pdb.h>
#include <libgimp/gimppaletteselect_pdb.h>
#include <libgimp/gimppath_pdb.h>
#include <libgimp/gimppattern_pdb.h>
#include <libgimp/gimppatterns_pdb.h>
#include <libgimp/gimppatternselect_pdb.h>
@ -78,6 +79,5 @@
#include <libgimp/gimpselection_pdb.h>
#include <libgimp/gimptextlayer_pdb.h>
#include <libgimp/gimptexttool_pdb.h>
#include <libgimp/gimpvectors_pdb.h>
#endif /* __GIMP_PDB_HEADERS_H__ */

View File

@ -331,21 +331,21 @@ gimp_item_is_selection (GimpItem *item)
}
/**
* gimp_item_is_vectors:
* gimp_item_is_path:
* @item: The item.
*
* Returns whether the item is a vectors.
* Returns whether the item is a path.
*
* This procedure returns TRUE if the specified item is a vectors.
* This procedure returns TRUE if the specified item is a path.
*
* Returns: TRUE if the item is a vectors, FALSE otherwise.
* Returns: TRUE if the item is a path, FALSE otherwise.
*
* Since: 2.8
**/
gboolean
gimp_item_is_vectors (GimpItem *item)
gimp_item_is_path (GimpItem *item)
{
return gimp_item_id_is_vectors (gimp_item_get_id (item));
return gimp_item_id_is_path (gimp_item_get_id (item));
}
/**

View File

@ -62,7 +62,7 @@ gboolean gimp_item_is_group_layer (GimpItem *item);
gboolean gimp_item_is_channel (GimpItem *item);
gboolean gimp_item_is_layer_mask (GimpItem *item);
gboolean gimp_item_is_selection (GimpItem *item);
gboolean gimp_item_is_vectors (GimpItem *item);
gboolean gimp_item_is_path (GimpItem *item);
GList * gimp_item_list_children (GimpItem *item);

View File

@ -292,6 +292,42 @@ gimp_item_id_is_layer_mask (gint item_id)
return layer_mask;
}
/**
* gimp_item_id_is_path:
* @item_id: The item ID.
*
* Returns whether the item ID is a path.
*
* This procedure returns TRUE if the specified item ID is a path.
*
* Returns: TRUE if the item ID is a path, FALSE otherwise.
*
* Since: 3.0
**/
gboolean
gimp_item_id_is_path (gint item_id)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean path = FALSE;
args = gimp_value_array_new_from_types (NULL,
G_TYPE_INT, item_id,
G_TYPE_NONE);
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
"gimp-item-id-is-path",
args);
gimp_value_array_unref (args);
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
path = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
gimp_value_array_unref (return_vals);
return path;
}
/**
* gimp_item_id_is_selection:
* @item_id: The item ID.
@ -328,42 +364,6 @@ gimp_item_id_is_selection (gint item_id)
return selection;
}
/**
* gimp_item_id_is_vectors:
* @item_id: The item ID.
*
* Returns whether the item ID is a vectors.
*
* This procedure returns TRUE if the specified item ID is a vectors.
*
* Returns: TRUE if the item ID is a vectors, FALSE otherwise.
*
* Since: 3.0
**/
gboolean
gimp_item_id_is_vectors (gint item_id)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean vectors = FALSE;
args = gimp_value_array_new_from_types (NULL,
G_TYPE_INT, item_id,
G_TYPE_NONE);
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
"gimp-item-id-is-vectors",
args);
gimp_value_array_unref (args);
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
vectors = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
gimp_value_array_unref (return_vals);
return vectors;
}
/**
* gimp_item_get_image:
* @item: The item.

View File

@ -39,8 +39,8 @@ gboolean gimp_item_id_is_text_layer (gint item_id);
gboolean gimp_item_id_is_group_layer (gint item_id);
gboolean gimp_item_id_is_channel (gint item_id);
gboolean gimp_item_id_is_layer_mask (gint item_id);
gboolean gimp_item_id_is_path (gint item_id);
gboolean gimp_item_id_is_selection (gint item_id);
gboolean gimp_item_id_is_vectors (gint item_id);
GimpImage* gimp_item_get_image (GimpItem *item);
gboolean gimp_item_delete (GimpItem *item);
gboolean gimp_item_is_group (GimpItem *item);

File diff suppressed because it is too large Load Diff

146
libgimp/gimppath_pdb.h Normal file
View File

@ -0,0 +1,146 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimppath_pdb.h
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* 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
* License along with this library. If not, see
* <https://www.gnu.org/licenses/>.
*/
/* NOTE: This file is auto-generated by pdbgen.pl */
#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
#error "Only <libgimp/gimp.h> can be included directly."
#endif
#ifndef __GIMP_PATH_PDB_H__
#define __GIMP_PATH_PDB_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
GimpVectors* gimp_path_new (GimpImage *image,
const gchar *name);
GimpVectors* gimp_path_new_from_text_layer (GimpImage *image,
GimpLayer *layer);
GimpVectors* gimp_path_copy (GimpVectors *path);
gint* gimp_path_get_strokes (GimpVectors *path,
gint *num_strokes);
gdouble gimp_path_stroke_get_length (GimpVectors *path,
gint stroke_id,
gdouble precision);
gboolean gimp_path_stroke_get_point_at_dist (GimpVectors *path,
gint stroke_id,
gdouble dist,
gdouble precision,
gdouble *x_point,
gdouble *y_point,
gdouble *slope,
gboolean *valid);
gboolean gimp_path_remove_stroke (GimpVectors *path,
gint stroke_id);
gboolean gimp_path_stroke_close (GimpVectors *path,
gint stroke_id);
gboolean gimp_path_stroke_reverse (GimpVectors *path,
gint stroke_id);
gboolean gimp_path_stroke_translate (GimpVectors *path,
gint stroke_id,
gdouble off_x,
gdouble off_y);
gboolean gimp_path_stroke_scale (GimpVectors *path,
gint stroke_id,
gdouble scale_x,
gdouble scale_y);
gboolean gimp_path_stroke_rotate (GimpVectors *path,
gint stroke_id,
gdouble center_x,
gdouble center_y,
gdouble angle);
gboolean gimp_path_stroke_flip (GimpVectors *path,
gint stroke_id,
GimpOrientationType flip_type,
gdouble axis);
gboolean gimp_path_stroke_flip_free (GimpVectors *path,
gint stroke_id,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2);
GimpVectorsStrokeType gimp_path_stroke_get_points (GimpVectors *path,
gint stroke_id,
gint *num_points,
gdouble **controlpoints,
gboolean *closed);
gint gimp_path_stroke_new_from_points (GimpVectors *path,
GimpVectorsStrokeType type,
gint num_points,
const gdouble *controlpoints,
gboolean closed);
gdouble* gimp_path_stroke_interpolate (GimpVectors *path,
gint stroke_id,
gdouble precision,
gint *num_coords,
gboolean *closed);
gint gimp_path_bezier_stroke_new_moveto (GimpVectors *path,
gdouble x0,
gdouble y0);
gboolean gimp_path_bezier_stroke_lineto (GimpVectors *path,
gint stroke_id,
gdouble x0,
gdouble y0);
gboolean gimp_path_bezier_stroke_conicto (GimpVectors *path,
gint stroke_id,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1);
gboolean gimp_path_bezier_stroke_cubicto (GimpVectors *path,
gint stroke_id,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2);
gint gimp_path_bezier_stroke_new_ellipse (GimpVectors *path,
gdouble x0,
gdouble y0,
gdouble radius_x,
gdouble radius_y,
gdouble angle);
gboolean gimp_path_import_from_file (GimpImage *image,
GFile *file,
gboolean merge,
gboolean scale,
gint *num_paths,
GimpVectors ***path);
gboolean gimp_path_import_from_string (GimpImage *image,
const gchar *string,
gint length,
gboolean merge,
gboolean scale,
gint *num_paths,
GimpVectors ***path);
gboolean gimp_path_export_to_file (GimpImage *image,
GFile *file,
GimpVectors *path);
gchar* gimp_path_export_to_string (GimpImage *image,
GimpVectors *path);
G_END_DECLS
#endif /* __GIMP_PATH_PDB_H__ */

View File

@ -1600,7 +1600,7 @@ _gimp_plug_in_get_item (GimpPlugIn *plug_in,
"id", item_id,
NULL);
}
else if (gimp_item_id_is_vectors (item_id))
else if (gimp_item_id_is_path (item_id))
{
item = g_object_new (GIMP_TYPE_VECTORS,
"id", item_id,

View File

@ -1,146 +0,0 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimpvectors_pdb.h
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* 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
* License along with this library. If not, see
* <https://www.gnu.org/licenses/>.
*/
/* NOTE: This file is auto-generated by pdbgen.pl */
#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
#error "Only <libgimp/gimp.h> can be included directly."
#endif
#ifndef __GIMP_VECTORS_PDB_H__
#define __GIMP_VECTORS_PDB_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
GimpVectors* gimp_vectors_new (GimpImage *image,
const gchar *name);
GimpVectors* gimp_vectors_new_from_text_layer (GimpImage *image,
GimpLayer *layer);
GimpVectors* gimp_vectors_copy (GimpVectors *vectors);
gint* gimp_vectors_get_strokes (GimpVectors *vectors,
gint *num_strokes);
gdouble gimp_vectors_stroke_get_length (GimpVectors *vectors,
gint stroke_id,
gdouble precision);
gboolean gimp_vectors_stroke_get_point_at_dist (GimpVectors *vectors,
gint stroke_id,
gdouble dist,
gdouble precision,
gdouble *x_point,
gdouble *y_point,
gdouble *slope,
gboolean *valid);
gboolean gimp_vectors_remove_stroke (GimpVectors *vectors,
gint stroke_id);
gboolean gimp_vectors_stroke_close (GimpVectors *vectors,
gint stroke_id);
gboolean gimp_vectors_stroke_reverse (GimpVectors *vectors,
gint stroke_id);
gboolean gimp_vectors_stroke_translate (GimpVectors *vectors,
gint stroke_id,
gdouble off_x,
gdouble off_y);
gboolean gimp_vectors_stroke_scale (GimpVectors *vectors,
gint stroke_id,
gdouble scale_x,
gdouble scale_y);
gboolean gimp_vectors_stroke_rotate (GimpVectors *vectors,
gint stroke_id,
gdouble center_x,
gdouble center_y,
gdouble angle);
gboolean gimp_vectors_stroke_flip (GimpVectors *vectors,
gint stroke_id,
GimpOrientationType flip_type,
gdouble axis);
gboolean gimp_vectors_stroke_flip_free (GimpVectors *vectors,
gint stroke_id,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2);
GimpVectorsStrokeType gimp_vectors_stroke_get_points (GimpVectors *vectors,
gint stroke_id,
gint *num_points,
gdouble **controlpoints,
gboolean *closed);
gint gimp_vectors_stroke_new_from_points (GimpVectors *vectors,
GimpVectorsStrokeType type,
gint num_points,
const gdouble *controlpoints,
gboolean closed);
gdouble* gimp_vectors_stroke_interpolate (GimpVectors *vectors,
gint stroke_id,
gdouble precision,
gint *num_coords,
gboolean *closed);
gint gimp_vectors_bezier_stroke_new_moveto (GimpVectors *vectors,
gdouble x0,
gdouble y0);
gboolean gimp_vectors_bezier_stroke_lineto (GimpVectors *vectors,
gint stroke_id,
gdouble x0,
gdouble y0);
gboolean gimp_vectors_bezier_stroke_conicto (GimpVectors *vectors,
gint stroke_id,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1);
gboolean gimp_vectors_bezier_stroke_cubicto (GimpVectors *vectors,
gint stroke_id,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2);
gint gimp_vectors_bezier_stroke_new_ellipse (GimpVectors *vectors,
gdouble x0,
gdouble y0,
gdouble radius_x,
gdouble radius_y,
gdouble angle);
gboolean gimp_vectors_import_from_file (GimpImage *image,
GFile *file,
gboolean merge,
gboolean scale,
gint *num_vectors,
GimpVectors ***vectors);
gboolean gimp_vectors_import_from_string (GimpImage *image,
const gchar *string,
gint length,
gboolean merge,
gboolean scale,
gint *num_vectors,
GimpVectors ***vectors);
gboolean gimp_vectors_export_to_file (GimpImage *image,
GFile *file,
GimpVectors *vectors);
gchar* gimp_vectors_export_to_string (GimpImage *image,
GimpVectors *vectors);
G_END_DECLS
#endif /* __GIMP_VECTORS_PDB_H__ */

View File

@ -103,6 +103,7 @@ pdb_wrappers_sources = [
'gimppalette_pdb.c',
'gimppalettes_pdb.c',
'gimppaletteselect_pdb.c',
'gimppath_pdb.c',
'gimppattern_pdb.c',
'gimppatterns_pdb.c',
'gimppatternselect_pdb.c',
@ -111,7 +112,6 @@ pdb_wrappers_sources = [
'gimpselection_pdb.c',
'gimptextlayer_pdb.c',
'gimptexttool_pdb.c',
'gimpvectors_pdb.c',
]
pdb_wrappers_headers = [
@ -159,6 +159,7 @@ pdb_wrappers_headers = [
'gimppalette_pdb.h',
'gimppalettes_pdb.h',
'gimppaletteselect_pdb.h',
'gimppath_pdb.h',
'gimppattern_pdb.h',
'gimppatterns_pdb.h',
'gimppatternselect_pdb.h',
@ -167,7 +168,6 @@ pdb_wrappers_headers = [
'gimpselection_pdb.h',
'gimptextlayer_pdb.h',
'gimptexttool_pdb.h',
'gimpvectors_pdb.h',
]
libgimp_sources_introspectable = [

View File

@ -43,6 +43,7 @@
palette
palette_select
palettes
path
pattern
pattern_select
patterns
@ -55,5 +56,4 @@
text_layer
text_tool
unit
vectors
);

View File

@ -270,11 +270,11 @@ CODE
);
}
sub item_id_is_vectors {
$blurb = 'Returns whether the item ID is a vectors.';
sub item_id_is_path {
$blurb = 'Returns whether the item ID is a path.';
$help = <<HELP;
This procedure returns TRUE if the specified item ID is a vectors.
This procedure returns TRUE if the specified item ID is a path.
HELP
&std_pdb_misc;
@ -286,8 +286,8 @@ HELP
);
@outargs = (
{ name => 'vectors', type => 'boolean',
desc => 'TRUE if the item ID is a vectors, FALSE otherwise' }
{ name => 'path', type => 'boolean',
desc => 'TRUE if the item ID is a path, FALSE otherwise' }
);
%invoke = (
@ -295,8 +295,8 @@ HELP
{
GimpItem *item = gimp_item_get_by_id (gimp, item_id);
vectors = (GIMP_IS_VECTORS (item) &&
! gimp_item_is_removed (item));
path = (GIMP_IS_VECTORS (item) &&
! gimp_item_is_removed (item));
}
CODE
);
@ -1009,7 +1009,7 @@ CODE
"core/gimplist.h"
"core/gimpselection.h"
"text/gimptextlayer.h"
"vectors/gimpvectors.h"
"vectors/gimpvectors.h"
"gimppdb-utils.h"
"gimppdbcontext.h"
"gimp-intl.h");
@ -1019,15 +1019,15 @@ CODE
item_id_is_layer
item_id_is_text_layer
item_id_is_group_layer
item_id_is_channel
item_id_is_layer_mask
item_id_is_selection
item_id_is_vectors
item_id_is_channel
item_id_is_layer_mask
item_id_is_path
item_id_is_selection
item_get_image
item_delete
item_is_group
item_is_group
item_get_parent
item_get_children
item_get_children
item_get_expanded item_set_expanded
item_get_name item_set_name
item_get_visible item_set_visible
@ -1036,9 +1036,9 @@ CODE
item_get_lock_visibility item_set_lock_visibility
item_get_color_tag item_set_color_tag
item_get_tattoo item_set_tattoo
item_attach_parasite item_detach_parasite
item_get_parasite
item_get_parasite_list);
item_attach_parasite item_detach_parasite
item_get_parasite
item_get_parasite_list);
%exports = (app => [@procs], lib => [@procs]);

File diff suppressed because it is too large Load Diff

View File

@ -45,6 +45,7 @@ pdb_names = [
'palette_select',
'palette',
'palettes',
'path',
'pattern_select',
'pattern',
'patterns',
@ -57,7 +58,6 @@ pdb_names = [
'text_layer',
'text_tool',
'unit',
'vectors',
]
pdb_sources = []

View File

@ -497,14 +497,14 @@ svg_load (GimpProcedure *procedure,
g_object_get (config, "paths", &import_paths, NULL);
if (g_strcmp0 (import_paths, "no-import") != 0)
{
GimpVectors **vectors;
gint num_vectors;
GimpVectors **paths;
gint num_paths;
gimp_vectors_import_from_file (image, file,
g_strcmp0 (import_paths, "import-merged") == 0,
TRUE, &num_vectors, &vectors);
if (num_vectors > 0)
g_free (vectors);
gimp_path_import_from_file (image, file,
g_strcmp0 (import_paths, "import-merged") == 0,
TRUE, &num_paths, &paths);
if (num_paths > 0)
g_free (paths);
}
g_free (import_paths);

View File

@ -1151,20 +1151,20 @@ save_paths (GOutputStream *output,
gshort id = 0x07D0; /* Photoshop paths have IDs >= 2000 */
gdouble width = gimp_image_get_width (image);
gdouble height = gimp_image_get_height (image);
GList *vectors;
GList *paths;
GList *iter;
gint v;
gint num_strokes;
gint *strokes;
gint s;
vectors = gimp_image_list_paths (image);
paths = gimp_image_list_paths (image);
if (! vectors)
if (! paths)
return;
/* Only up to 997 paths supported */
for (iter = vectors, v = 0;
for (iter = paths, v = 0;
iter && v <= 997;
iter = g_list_next (iter), v++)
{
@ -1221,7 +1221,7 @@ save_paths (GOutputStream *output,
pointrecord[1] = 6; /* fill rule record */
g_string_append_len (data, pointrecord, 26);
strokes = gimp_vectors_get_strokes (iter->data, &num_strokes);
strokes = gimp_path_get_strokes (iter->data, &num_strokes);
for (s = 0; s < num_strokes; s++)
{
@ -1231,8 +1231,8 @@ save_paths (GOutputStream *output,
gboolean closed;
gint p = 0;
type = gimp_vectors_stroke_get_points (iter->data, strokes[s],
&num_points, &points, &closed);
type = gimp_path_stroke_get_points (iter->data, strokes[s],
&num_points, &points, &closed);
if (type != GIMP_VECTORS_STROKE_TYPE_BEZIER ||
num_points > 65535 ||
@ -1279,7 +1279,7 @@ save_paths (GOutputStream *output,
id += 0x01;
}
g_list_free (vectors);
g_list_free (paths);
}
static void

View File

@ -1533,7 +1533,7 @@ load_resource_2000 (const PSDimageres *res_a,
gdouble *controlpoints;
gint32 x[3];
gint32 y[3];
GimpVectors *vectors = NULL;
GimpVectors *path = NULL;
gint16 type;
gint16 init_fill;
gint16 num_rec;
@ -1580,15 +1580,15 @@ load_resource_2000 (const PSDimageres *res_a,
if (res_a->id == PSD_WORKING_PATH)
{
/* use "Working Path" for the path name to match the Photoshop display */
vectors = gimp_vectors_new (image, "Working Path");
path = gimp_path_new (image, "Working Path");
}
else
{
/* Use the name stored in the PSD to name the path */
vectors = gimp_vectors_new (image, res_a->name);
path = gimp_path_new (image, res_a->name);
}
gimp_image_insert_path (image, vectors, NULL, -1);
gimp_image_insert_path (image, path, NULL, -1);
while (path_rec > 0)
{
@ -1703,9 +1703,9 @@ load_resource_2000 (const PSDimageres *res_a,
num_rec--;
}
/* Add sub-path */
gimp_vectors_stroke_new_from_points (vectors,
GIMP_VECTORS_STROKE_TYPE_BEZIER,
cntr, controlpoints, closed);
gimp_path_stroke_new_from_points (path,
GIMP_VECTORS_STROKE_TYPE_BEZIER,
cntr, controlpoints, closed);
g_free (controlpoints);
}

View File

@ -108,21 +108,21 @@ save_paths (TIFF *tif,
gint offset_y)
{
gint id = 2000; /* Photoshop paths have IDs >= 2000 */
GList *vectors;
GList *path;
GList *iter;
gint v;
gint num_strokes, *strokes, s;
GString *ps_tag;
vectors = gimp_image_list_paths (image);
path = gimp_image_list_paths (image);
if (! vectors)
if (! path)
return FALSE;
ps_tag = g_string_new ("");
/* Only up to 1000 paths supported */
for (iter = vectors, v = 0;
for (iter = path, v = 0;
iter && v < 1000;
iter = g_list_next (iter), v++)
{
@ -179,7 +179,7 @@ save_paths (TIFF *tif,
pointrecord[1] = 6; /* fill rule record */
g_string_append_len (data, pointrecord, 26);
strokes = gimp_vectors_get_strokes (iter->data, &num_strokes);
strokes = gimp_path_get_strokes (iter->data, &num_strokes);
for (s = 0; s < num_strokes; s++)
{
@ -189,8 +189,8 @@ save_paths (TIFF *tif,
gboolean closed;
gint p = 0;
type = gimp_vectors_stroke_get_points (iter->data, strokes[s],
&num_points, &points, &closed);
type = gimp_path_stroke_get_points (iter->data, strokes[s],
&num_points, &points, &closed);
if (type != GIMP_VECTORS_STROKE_TYPE_BEZIER ||
num_points > 65535 ||
@ -240,7 +240,7 @@ save_paths (TIFF *tif,
TIFFSetField (tif, TIFFTAG_PHOTOSHOP, ps_tag->len, ps_tag->str);
g_string_free (ps_tag, TRUE);
g_list_free (vectors);
g_list_free (path);
return TRUE;
}

View File

@ -512,7 +512,7 @@ static void
do_points (spline_list_array_type in_splines,
GimpImage *image)
{
GimpVectors *vectors;
GimpVectors *path;
gint32 stroke;
gint i, j;
gboolean have_points = FALSE;
@ -532,7 +532,7 @@ do_points (spline_list_array_type in_splines,
if (! have_points)
return;
vectors = gimp_vectors_new (image, _("Selection"));
path = gimp_path_new (image, _("Selection"));
for (j = 0; j < SPLINE_LIST_ARRAY_LENGTH (in_splines); j++)
{
@ -549,41 +549,41 @@ do_points (spline_list_array_type in_splines,
* to have the result of least surprise for "Text along Path".
*/
seg = SPLINE_LIST_ELT (spline_list, SPLINE_LIST_LENGTH (spline_list) - 1);
stroke = gimp_vectors_bezier_stroke_new_moveto (vectors,
END_POINT (seg).x,
END_POINT (seg).y);
stroke = gimp_path_bezier_stroke_new_moveto (path,
END_POINT (seg).x,
END_POINT (seg).y);
for (i = SPLINE_LIST_LENGTH (spline_list); i > 0; i--)
{
seg = SPLINE_LIST_ELT (spline_list, i-1);
if (SPLINE_DEGREE (seg) == LINEAR)
gimp_vectors_bezier_stroke_lineto (vectors, stroke,
gimp_path_bezier_stroke_lineto (path, stroke,
START_POINT (seg).x,
START_POINT (seg).y);
else if (SPLINE_DEGREE (seg) == CUBIC)
gimp_vectors_bezier_stroke_cubicto (vectors, stroke,
CONTROL2 (seg).x,
CONTROL2 (seg).y,
CONTROL1 (seg).x,
CONTROL1 (seg).y,
START_POINT (seg).x,
START_POINT (seg).y);
gimp_path_bezier_stroke_cubicto (path, stroke,
CONTROL2 (seg).x,
CONTROL2 (seg).y,
CONTROL1 (seg).x,
CONTROL1 (seg).y,
START_POINT (seg).x,
START_POINT (seg).y);
else
g_warning ("print_spline: strange degree (%d)",
SPLINE_DEGREE (seg));
}
gimp_vectors_stroke_close (vectors, stroke);
gimp_path_stroke_close (path, stroke);
/* transform to GIMPs coordinate system, taking the selections
* bounding box into account */
gimp_vectors_stroke_scale (vectors, stroke, 1.0, -1.0);
gimp_vectors_stroke_translate (vectors, stroke,
sel_x1, sel_y1 + sel_height + 1);
gimp_path_stroke_scale (path, stroke, 1.0, -1.0);
gimp_path_stroke_translate (path, stroke,
sel_x1, sel_y1 + sel_height + 1);
}
gimp_image_insert_path (image, vectors, NULL, -1);
gimp_image_insert_path (image, path, NULL, -1);
}