# The GIMP -- an 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 2 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

# "Perlized" from C source by Manish Singh <yosh@gimp.org>

sub channel_ops_offset {
    $blurb = <<'BLURB';
Offset the drawable by the specified amounts in the X and Y directions
BLURB

    $help = <<'HELP';
This procedure offsets the specified drawable by the amounts specified by
'offset_x' and 'offset_y'. If 'wrap_around' is set to TRUE, then portions of
the drawable which are offset out of bounds are wrapped around. Alternatively,
the undefined regions of the drawable can be filled with transparency or the
background color, as specified by the 'fill_type' parameter.
HELP

    &std_pdb_misc;
    $date = '1997';

    @inargs = (
	{ name => 'drawable', type => 'drawable',
	  desc => 'The drawable to offset' },
	{ name => 'wrap_around', type => 'boolean',
	  desc => 'wrap image around or fill vacated regions' },
	{ name => 'fill_type', type => 'enum ChannelOffsetType',
	  desc => 'fill vacated regions of drawable with background or
		   transparent: %%desc%%' },
	{ name => 'offset_x', type => 'int32',
	  desc => 'offset by this amount in X direction' },
	{ name => 'offset_y', type => 'int32',
	  desc => 'offset by this amount in Y direction' }
    );

    %invoke = (
	headers => [ qw("channel_ops.h") ],
	vars => [ 'GimpImage *gimage' ],
	code => <<'CODE'
{
  gimage = drawable_gimage (GIMP_DRAWABLE (drawable));
  offset (gimage, drawable, wrap_around, fill_type, offset_x, offset_y);
}
CODE
    );
}

sub channel_ops_duplicate {
    $blurb = 'Duplicate the specified image';

    $help = <<'HELP';
This procedure duplicates the specified image, copying all layers, channels,
and image information.
HELP

    &std_pdb_misc;
    $date = '1997';

    @inargs = ( &std_image_arg );

    @outargs = ( 
	{ name => 'new_image', type => 'image',
	  desc => 'The new, duplicated image',
	  alias => 'new_gimage', init => 1 }
    );

    %invoke = (
	headers => [ qw("gimage.h") ],
        code => <<'CODE'
success = (new_gimage = duplicate (gimage)) != NULL;
CODE
    );
}

@procs = qw(channel_ops_offset channel_ops_duplicate);
%exports = (app => [@procs]);

$desc = 'Channel Ops';

1;
