2006-12-10 05:33:38 +08:00
|
|
|
# GIMP - The GNU Image Manipulation Program
|
1999-04-27 12:33:41 +08:00
|
|
|
# Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
|
2009-01-18 06:28:01 +08:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
1999-04-27 12:33:41 +08:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
1999-04-27 12:33:41 +08:00
|
|
|
# (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
|
2018-07-12 05:27:07 +08:00
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
1999-04-27 12:33:41 +08:00
|
|
|
|
|
|
|
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
|
|
|
|
|
2006-03-24 05:17:16 +08:00
|
|
|
sub image_add_hguide {
|
|
|
|
$blurb = 'Add a horizontal guide to an image.';
|
1999-04-27 12:33:41 +08:00
|
|
|
|
|
|
|
$help = <<HELP;
|
2006-03-24 05:17:16 +08:00
|
|
|
This procedure adds a horizontal guide to an image. It takes the input
|
|
|
|
image and the y-position of the new guide as parameters. It returns
|
|
|
|
the guide ID of the new guide.
|
1999-04-27 12:33:41 +08:00
|
|
|
HELP
|
|
|
|
|
2006-03-15 05:35:50 +08:00
|
|
|
&adam_pdb_misc('1998');
|
1999-04-27 12:33:41 +08:00
|
|
|
|
|
|
|
@inargs = (
|
2006-03-24 05:17:16 +08:00
|
|
|
{ name => 'image', type => 'image',
|
|
|
|
desc => 'The image' },
|
|
|
|
{ name => 'yposition', type => '0 <= int32',
|
|
|
|
desc => "The guide's y-offset from top of image" }
|
1999-04-27 12:33:41 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
@outargs = (
|
2006-03-15 23:32:39 +08:00
|
|
|
{ name => 'guide', type => 'guide',
|
1999-04-27 12:33:41 +08:00
|
|
|
desc => 'The new guide' }
|
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
2006-03-24 05:17:16 +08:00
|
|
|
code => <<'CODE'
|
1999-04-27 12:33:41 +08:00
|
|
|
{
|
2007-12-26 00:21:40 +08:00
|
|
|
if (yposition <= gimp_image_get_height (image))
|
1999-04-27 12:33:41 +08:00
|
|
|
{
|
2006-03-14 03:13:08 +08:00
|
|
|
GimpGuide *g;
|
|
|
|
|
2006-03-24 05:17:16 +08:00
|
|
|
g = gimp_image_add_hguide (image, yposition, TRUE);
|
2018-07-15 23:02:56 +08:00
|
|
|
guide = gimp_aux_item_get_ID (GIMP_AUX_ITEM (g));
|
1999-04-27 12:33:41 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
success = FALSE;
|
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2006-03-24 05:17:16 +08:00
|
|
|
sub image_add_vguide {
|
|
|
|
$blurb = 'Add a vertical guide to an image.';
|
1999-04-27 12:33:41 +08:00
|
|
|
|
2006-03-24 05:17:16 +08:00
|
|
|
$help = <<HELP;
|
|
|
|
This procedure adds a vertical guide to an image. It takes the input
|
|
|
|
image and the x-position of the new guide as parameters. It returns
|
|
|
|
the guide ID of the new guide.
|
|
|
|
HELP
|
1999-04-27 12:33:41 +08:00
|
|
|
|
2006-03-24 05:17:16 +08:00
|
|
|
&adam_pdb_misc('1998');
|
|
|
|
|
|
|
|
@inargs = (
|
|
|
|
{ name => 'image', type => 'image',
|
|
|
|
desc => 'The image' },
|
|
|
|
{ name => 'xposition', type => '0 <= int32',
|
|
|
|
desc => "The guide's x-offset from left of image" }
|
|
|
|
);
|
|
|
|
|
|
|
|
@outargs = (
|
|
|
|
{ name => 'guide', type => 'guide',
|
|
|
|
desc => 'The new guide' }
|
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
code => <<'CODE'
|
|
|
|
{
|
2007-12-26 00:21:40 +08:00
|
|
|
if (xposition <= gimp_image_get_width (image))
|
2006-03-24 05:17:16 +08:00
|
|
|
{
|
|
|
|
GimpGuide *g;
|
|
|
|
|
|
|
|
g = gimp_image_add_vguide (image, xposition, TRUE);
|
2018-07-15 23:02:56 +08:00
|
|
|
guide = gimp_aux_item_get_ID (GIMP_AUX_ITEM (g));
|
2006-03-24 05:17:16 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
success = FALSE;
|
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
1999-04-27 12:33:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
sub image_delete_guide {
|
|
|
|
$blurb = 'Deletes a guide from an image.';
|
|
|
|
|
|
|
|
$help = <<'HELP';
|
|
|
|
This procedure takes an image and a guide ID as input and removes the specified
|
|
|
|
guide from the specified image.
|
|
|
|
HELP
|
|
|
|
|
2006-03-15 05:35:50 +08:00
|
|
|
&adam_pdb_misc('1998');
|
1999-04-27 12:33:41 +08:00
|
|
|
|
|
|
|
@inargs = (
|
2006-03-24 05:17:16 +08:00
|
|
|
{ name => 'image', type => 'image',
|
|
|
|
desc => 'The image' },
|
1999-04-27 12:33:41 +08:00
|
|
|
{ name => 'guide', type => 'guide',
|
|
|
|
desc => 'The ID of the guide to be removed' }
|
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
code => <<'CODE'
|
|
|
|
{
|
2014-07-11 02:24:10 +08:00
|
|
|
GimpGuide *g = gimp_pdb_image_get_guide (image, guide, error);
|
1999-04-27 12:33:41 +08:00
|
|
|
|
2006-03-14 03:13:08 +08:00
|
|
|
if (g)
|
2006-03-24 05:17:16 +08:00
|
|
|
gimp_image_remove_guide (image, g, TRUE);
|
2006-03-14 03:13:08 +08:00
|
|
|
else
|
|
|
|
success = FALSE;
|
1999-04-27 12:33:41 +08:00
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub image_find_next_guide {
|
|
|
|
$blurb = 'Find next guide on an image.';
|
|
|
|
|
|
|
|
$help = <<'HELP';
|
|
|
|
This procedure takes an image and a guide ID as input and finds the guide ID of
|
|
|
|
the successor of the given guide ID in the image's guide list. If the supplied
|
|
|
|
guide ID is 0, the procedure will return the first Guide. The procedure will
|
|
|
|
return 0 if given the final guide ID as an argument or the image has no guides.
|
|
|
|
HELP
|
|
|
|
|
2006-03-15 05:35:50 +08:00
|
|
|
&adam_pdb_misc('1998');
|
1999-04-27 12:33:41 +08:00
|
|
|
|
|
|
|
@inargs = (
|
2006-03-24 05:17:16 +08:00
|
|
|
{ name => 'image', type => 'image',
|
|
|
|
desc => 'The image' },
|
2007-04-27 03:10:23 +08:00
|
|
|
{ name => 'guide', type => 'guide', no_validate => 1,
|
1999-04-27 12:33:41 +08:00
|
|
|
desc => 'The ID of the current guide (0 if first invocation)' }
|
|
|
|
);
|
|
|
|
|
|
|
|
@outargs = (
|
2006-03-15 23:32:39 +08:00
|
|
|
{ name => 'next_guide', type => 'guide',
|
1999-04-27 12:33:41 +08:00
|
|
|
desc => "The next guide's ID" }
|
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
code => <<'CODE'
|
|
|
|
{
|
2006-03-24 05:17:16 +08:00
|
|
|
GimpGuide *g = gimp_image_get_next_guide (image, guide, &success);
|
2006-03-14 03:13:08 +08:00
|
|
|
|
|
|
|
if (g)
|
2018-07-15 23:02:56 +08:00
|
|
|
next_guide = gimp_aux_item_get_ID (GIMP_AUX_ITEM (g));
|
2014-07-11 02:24:10 +08:00
|
|
|
|
|
|
|
if (! success)
|
|
|
|
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
|
|
|
|
_("Image '%s' (%d) does not contain guide with ID %d"),
|
|
|
|
gimp_image_get_display_name (image),
|
|
|
|
gimp_image_get_ID (image),
|
|
|
|
guide);
|
1999-04-27 12:33:41 +08:00
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub image_get_guide_orientation {
|
|
|
|
$blurb = 'Get orientation of a guide on an image.';
|
|
|
|
|
|
|
|
$help = <<'HELP';
|
|
|
|
This procedure takes an image and a guide ID as input and returns the
|
|
|
|
orientations of the guide.
|
|
|
|
HELP
|
|
|
|
|
2006-03-15 05:35:50 +08:00
|
|
|
&adam_pdb_misc('1998');
|
2006-01-17 21:35:20 +08:00
|
|
|
|
1999-04-27 12:33:41 +08:00
|
|
|
@inargs = (
|
2006-03-24 05:17:16 +08:00
|
|
|
{ name => 'image', type => 'image',
|
|
|
|
desc => 'The image' },
|
1999-04-27 12:33:41 +08:00
|
|
|
{ name => 'guide', type => 'guide',
|
|
|
|
desc => 'The guide' }
|
|
|
|
);
|
|
|
|
|
|
|
|
@outargs = (
|
2006-03-24 05:17:16 +08:00
|
|
|
{ name => 'orientation',
|
|
|
|
type => 'enum GimpOrientationType (no GIMP_ORIENTATION_UNKNOWN)',
|
2006-05-19 01:25:15 +08:00
|
|
|
desc => "The guide's orientation",
|
2003-02-10 05:03:36 +08:00
|
|
|
libdef => 'GIMP_ORIENTATION_UNKNOWN' }
|
1999-04-27 12:33:41 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
code => <<'CODE'
|
|
|
|
{
|
2014-07-11 02:24:10 +08:00
|
|
|
GimpGuide *g = gimp_pdb_image_get_guide (image, guide, error);
|
2003-02-14 22:14:29 +08:00
|
|
|
|
2006-03-14 03:13:08 +08:00
|
|
|
if (g)
|
2006-06-07 23:49:59 +08:00
|
|
|
orientation = gimp_guide_get_orientation (g);
|
2006-03-14 03:13:08 +08:00
|
|
|
else
|
|
|
|
success = FALSE;
|
1999-04-27 12:33:41 +08:00
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub image_get_guide_position {
|
|
|
|
$blurb = 'Get position of a guide on an image.';
|
|
|
|
|
|
|
|
$help = <<'HELP';
|
|
|
|
This procedure takes an image and a guide ID as input and returns the position
|
|
|
|
of the guide relative to the top or left of the image.
|
|
|
|
HELP
|
|
|
|
|
2006-03-15 05:35:50 +08:00
|
|
|
&adam_pdb_misc('1998');
|
1999-04-27 12:33:41 +08:00
|
|
|
|
|
|
|
@inargs = (
|
2006-03-24 05:17:16 +08:00
|
|
|
{ name => 'image', type => 'image',
|
|
|
|
desc => 'The image' },
|
1999-04-27 12:33:41 +08:00
|
|
|
{ name => 'guide', type => 'guide',
|
|
|
|
desc => 'The guide' }
|
|
|
|
);
|
|
|
|
|
|
|
|
@outargs = (
|
2014-07-10 06:20:57 +08:00
|
|
|
{ name => 'position', type => 'int32',
|
|
|
|
libdef => 'G_MININT /* GIMP_GUIDE_POSITION_UNDEFINED */',
|
1999-04-27 12:33:41 +08:00
|
|
|
desc => "The guide's position relative to top or left of image" }
|
|
|
|
);
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
code => <<'CODE'
|
|
|
|
{
|
2014-07-11 02:24:10 +08:00
|
|
|
GimpGuide *g = gimp_pdb_image_get_guide (image, guide, error);
|
2003-02-14 22:14:29 +08:00
|
|
|
|
2006-03-14 03:13:08 +08:00
|
|
|
if (g)
|
2006-06-07 23:49:59 +08:00
|
|
|
position = gimp_guide_get_position (g);
|
2006-03-14 03:13:08 +08:00
|
|
|
else
|
|
|
|
success = FALSE;
|
1999-04-27 12:33:41 +08:00
|
|
|
}
|
|
|
|
CODE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2006-03-24 05:17:16 +08:00
|
|
|
|
2015-12-15 09:54:04 +08:00
|
|
|
@headers = qw("cairo.h"
|
|
|
|
"core/gimpguide.h"
|
2014-07-10 06:20:57 +08:00
|
|
|
"core/gimpimage-guides.h"
|
2014-07-11 02:24:10 +08:00
|
|
|
"core/gimpimage-undo-push.h"
|
|
|
|
"gimppdb-utils.h"
|
|
|
|
"gimppdberror.h"
|
|
|
|
"gimp-intl.h");
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
|
2014-07-10 06:20:57 +08:00
|
|
|
@procs = qw(image_add_hguide image_add_vguide
|
|
|
|
image_delete_guide
|
|
|
|
image_find_next_guide
|
|
|
|
image_get_guide_orientation
|
1999-04-27 12:33:41 +08:00
|
|
|
image_get_guide_position);
|
2006-03-24 05:17:16 +08:00
|
|
|
|
1999-12-26 15:54:39 +08:00
|
|
|
%exports = (app => [@procs], lib => [@procs]);
|
1999-04-27 12:33:41 +08:00
|
|
|
|
2015-05-30 21:27:16 +08:00
|
|
|
$desc = 'Image Guide procedures';
|
|
|
|
$doc_title = 'gimpimageguides';
|
|
|
|
$doc_short_desc = 'Functions for manipulating an image\'s guides.';
|
|
|
|
$doc_long_desc = 'Functions for manipulating an image\'s guides.';
|
1999-04-27 12:33:41 +08:00
|
|
|
|
|
|
|
1;
|