gimp/pdb/groups/image_grid.pdb

373 lines
8.3 KiB
Plaintext

# GIMP - The GNU Image Manipulation Program
# Copyright (C) 1995 Spencer Kimball and Peter Mattis
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
sub image_grid_get_spacing {
$blurb = "Gets the spacing of an image's grid.";
$help = <<HELP;
This procedure retrieves the horizontal and vertical spacing of an image's grid.
It takes the image as parameter.
HELP
&sylvain_pdb_misc('2005', '2.4');
@inargs = (
{ name => 'image', type => 'image',
desc => 'The image' }
);
@outargs = (
{ name => 'xspacing', type => 'float', void_ret => 1,
desc => "The image's grid horizontal spacing" },
{ name => 'yspacing', type => 'float', void_ret => 1,
desc => "The image's grid vertical spacing" }
);
%invoke = (
code => <<'CODE'
{
GimpGrid *grid = gimp_image_get_grid (image);
if (grid)
g_object_get (grid,
"xspacing", &xspacing,
"yspacing", &yspacing,
NULL);
else
success = FALSE;
}
CODE
);
}
sub image_grid_set_spacing {
$blurb = "Sets the spacing of an image's grid.";
$help = <<HELP;
This procedure sets the horizontal and vertical spacing of an image's grid.
HELP
&sylvain_pdb_misc('2005', '2.4');
@inargs = (
{ name => 'image', type => 'image',
desc => 'The image' },
{ name => 'xspacing', type => 'float',
desc => "The image's grid horizontal spacing" },
{ name => 'yspacing', type => 'float',
desc => "The image's grid vertical spacing" }
);
%invoke = (
code => <<CODE
{
GimpGrid *grid = gimp_image_get_grid (image);
if (grid)
g_object_set (grid,
"xspacing", xspacing,
"yspacing", yspacing,
NULL);
else
success = FALSE;
}
CODE
);
}
sub image_grid_get_offset {
$blurb = "Gets the offset of an image's grid.";
$help = <<HELP;
This procedure retrieves the horizontal and vertical offset of an image's grid.
It takes the image as parameter.
HELP
&sylvain_pdb_misc('2005', '2.4');
@inargs = (
{ name => 'image', type => 'image',
desc => 'The image' }
);
@outargs = (
{ name => 'xoffset', type => 'float', void_ret => 1,
desc => "The image's grid horizontal offset" },
{ name => 'yoffset', type => 'float', void_ret => 1,
desc => "The image's grid vertical offset" }
);
%invoke = (
code => <<'CODE'
{
GimpGrid *grid = gimp_image_get_grid (image);
if (grid)
g_object_get (grid,
"xoffset", &xoffset,
"yoffset", &yoffset,
NULL);
else
success = FALSE;
}
CODE
);
}
sub image_grid_set_offset {
$blurb = "Sets the offset of an image's grid.";
$help = <<HELP;
This procedure sets the horizontal and vertical offset of an image's grid.
HELP
&sylvain_pdb_misc('2005', '2.4');
@inargs = (
{ name => 'image', type => 'image',
desc => 'The image' },
{ name => 'xoffset', type => 'float',
desc => "The image's grid horizontal offset" },
{ name => 'yoffset', type => 'float',
desc => "The image's grid vertical offset" }
);
%invoke = (
code => <<CODE
{
GimpGrid *grid = gimp_image_get_grid (image);
if (grid)
g_object_set (grid,
"xoffset", xoffset,
"yoffset", yoffset,
NULL);
else
success = FALSE;
}
CODE
);
}
sub image_grid_get_foreground_color {
$blurb = "Sets the foreground color of an image's grid.";
$help = <<HELP;
This procedure gets the foreground color of an image's grid.
HELP
&sylvain_pdb_misc('2005', '2.4');
@inargs = (
{ name => 'image', type => 'image',
desc => 'The image' }
);
@outargs = (
{ name => 'fgcolor', type => 'geglcolor', has_alpha => 1,
desc => "The image's grid foreground color" }
);
%invoke = (
code => <<'CODE'
{
GimpGrid *grid = gimp_image_get_grid (image);
if (grid)
fgcolor = gegl_color_duplicate (grid->fgcolor);
else
success = FALSE;
}
CODE
);
}
sub image_grid_set_foreground_color {
$blurb = "Gets the foreground color of an image's grid.";
$help = <<HELP;
This procedure sets the foreground color of an image's grid.
HELP
&sylvain_pdb_misc('2005', '2.4');
@inargs = (
{ name => 'image', type => 'image',
desc => 'The image' },
{ name => 'fgcolor', type => 'geglcolor', has_alpha => 1,
desc => "The new foreground color" }
);
%invoke = (
code => <<'CODE'
{
GimpGrid *grid = gimp_image_get_grid (image);
if (grid)
g_object_set (grid, "fgcolor", fgcolor, NULL);
else
success = FALSE;
}
CODE
);
}
sub image_grid_get_background_color {
$blurb = "Sets the background color of an image's grid.";
$help = <<HELP;
This procedure gets the background color of an image's grid.
HELP
&sylvain_pdb_misc('2005', '2.4');
@inargs = (
{ name => 'image', type => 'image',
desc => 'The image' }
);
@outargs = (
{ name => 'bgcolor', type => 'geglcolor', has_alpha => 1,
desc => "The image's grid background color" }
);
%invoke = (
code => <<'CODE'
{
GimpGrid *grid = gimp_image_get_grid (image);
if (grid)
bgcolor = gegl_color_duplicate (grid->bgcolor);
else
success = FALSE;
}
CODE
);
}
sub image_grid_set_background_color {
$blurb = "Gets the background color of an image's grid.";
$help = <<HELP;
This procedure sets the background color of an image's grid.
HELP
&sylvain_pdb_misc('2005', '2.4');
@inargs = (
{ name => 'image', type => 'image',
desc => 'The image' },
{ name => 'bgcolor', type => 'geglcolor', has_alpha => 1,
desc => "The new background color" }
);
%invoke = (
code => <<'CODE'
{
GimpGrid *grid = gimp_image_get_grid (image);
if (grid)
g_object_set (grid, "bgcolor", bgcolor, NULL);
else
success = FALSE;
}
CODE
);
}
sub image_grid_get_style {
$blurb = "Gets the style of an image's grid.";
$help = <<HELP;
This procedure retrieves the style of an image's grid.
HELP
&sylvain_pdb_misc('2005', '2.4');
@inargs = (
{ name => 'image', type => 'image',
desc => 'The image' }
);
@outargs = (
{ name => 'style', type => 'enum GimpGridStyle',
desc => "The image's grid style" }
);
%invoke = (
code => <<CODE
{
GimpGrid *grid = gimp_image_get_grid (image);
if (grid)
g_object_get (grid, "style", &style, NULL);
else
success = FALSE;
}
CODE
);
}
sub image_grid_set_style {
$blurb = "Sets the style unit of an image's grid.";
$help = <<HELP;
This procedure sets the style of an image's grid.
It takes the image and the new style as parameters.
HELP
&sylvain_pdb_misc('2005', '2.4');
@inargs = (
{ name => 'image', type => 'image',
desc => 'The image' },
{ name => 'style', type => 'enum GimpGridStyle',
desc => "The image's grid style" }
);
%invoke = (
code => <<CODE
{
GimpGrid *grid = gimp_image_get_grid (image);
if (grid)
g_object_set (grid, "style", style, NULL);
else
success = FALSE;
}
CODE
);
}
@headers = qw("core/gimpimage-grid.h" "core/gimpgrid.h"
"libgimpbase/gimpbaseenums.h");
@procs = qw(image_grid_get_spacing image_grid_set_spacing
image_grid_get_offset image_grid_set_offset
image_grid_get_foreground_color image_grid_set_foreground_color
image_grid_get_background_color image_grid_set_background_color
image_grid_get_style image_grid_set_style);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Image grid procedures';
$doc_title = 'gimpimagegrid';
$doc_short_desc = "Functions manuipulating an image's grid.";
$doc_long_desc = "Functions manuipulating an image's grid.";
1;