#!/usr/bin/perl -w

use Gimp;
use Gimp::Fu;
use strict;
use warnings;

podregister {
  $drawable->become('Gimp::Layer');
  $image->undo_group_start;
  Gimp::Context->push();
  my $midlayer = $drawable->copy(TRUE);
  $image->insert_layer($midlayer, 0, 0);
  my $toplayer = $drawable->copy(TRUE);
  $image->insert_layer($toplayer, 0, 0);
  Gimp::Context->set_background($color);
  $toplayer->edit_fill(FILL_BACKGROUND);
  $toplayer->set_mode(LAYER_MODE_HSL_COLOR_LEGACY);
  Gimp::Context->set_background([0,0,0]);
  $drawable->edit_fill(FILL_BACKGROUND);
  $amt /= 255;
  $midlayer->noisify(1,$amt, $amt, $amt, $amt);
  my $midmask = $midlayer->create_mask(0);
  $midlayer->add_mask($midmask);
  $midmask->grid(
    1,3,0,[0,0,0],255, 1,$image->height * 3,0,[0,0,0],255, 0,0,0,[0,0,0],255
  );
  $midmask->gauss_iir(1.01, 1, 1);
  Gimp::Context->pop();
  $image->undo_group_end;
  return;
};

exit main;
__END__

=head1 NAME

xachvision - Xach Surveillance Camera/XachVision

=head1 SYNOPSIS

<Image>/Filters/Noise/Xach Vision...

=head1 DESCRIPTION

This makes an interlaced-looking machine vision type thing.

Once again, an effect of Xach's.

=head1 PARAMETERS

  [PF_COLOR, "color", "Color to see the world in", [0, 255, 0]],
  [PF_SLIDER, "amt", "How much noise to add", 25, [0,255,5]]

=head1 IMAGE TYPES

RGB*, GRAY*

=head1 AUTHOR

Seth Burgess <sjburges@gimp.org>

=head1 DATE

2000-11-25

=head1 LICENSE

Distributed under the same terms as Gimp-Perl.
