#!/usr/bin/perl

use Gimp qw(:auto __ N_);
use Gimp::Fu;

podregister {
  my ($short, $type) = @_;

  $long = int(($short * 1.618) + 0.5);

  $width = $short;
  $height = $long;

  if ($type == 1) {
    $width = $long;
    $height = $short;
  }

  $img = gimp_image_new($width, $height, RGB);
  $layer = gimp_layer_new($img, $width, $height, RGB_IMAGE, "Layer 1", 100, NORMAL_MODE);

  gimp_image_insert_layer($layer, 0, -1);
  Gimp::Context->push();
  $layer->gimp_edit_fill(BACKGROUND_FILL);
  Gimp::Context->pop();
  Gimp::Display->new($img);

  return $img;
};

exit main;
__END__

=head1 NAME

golden_mean - Creates a new image with a ratio according to the Golden Mean

=head1 SYNOPSIS

<Image>/File/Create/Golden Mean...

=head1 DESCRIPTION

Select shortest side and orientation and I will automagically calculate
the long side. As a plug-in companion, see <Image>/Center Guide.

=head1 PARAMETERS

  [PF_INT32, "short", "Shortest side", 233],
  [PF_RADIO, "type", "Orientation(0=Portrait,1=Landscape)", 0, [Portrait => 0, Landscape => 1]]

=head1 IMAGE TYPES

=head1 AUTHOR

Claes G Lindblad <claesg@algonet.se>

=head1 DATE

990328

=head1 LICENSE

Copyright Claes G Lindblad.

Distributed under the terms of the GNU Public Licesne.
