| 1 | package Imager::Filter::Mandelbrot; | ||
| 2 | use 5.006; | ||
| 3 | use strict; | ||
| 4 | use Imager; | ||
| 5 | |||
| 6 | BEGIN { | ||
| 7 | our $VERSION = "0.05"; | ||
| 8 | |||
| 9 | require XSLoader; | ||
| 10 | XSLoader::load('Imager::Filter::Mandelbrot', $VERSION); | ||
| 11 | } | ||
| 12 | |||
| 13 | sub _mandelbrot { | ||
| 14 | my %hsh = @_; | ||
| 15 | |||
| 16 | mandelbrot($hsh{image}, $hsh{minx}, $hsh{miny}, $hsh{maxx}, $hsh{maxy}, $hsh{maxiter}); | ||
| 17 | } | ||
| 18 | |||
| 19 | my %defaults = | ||
| 20 | ( | ||
| 21 | minx => -2.5, | ||
| 22 | maxx => 1.5, | ||
| 23 | miny => -1.5, | ||
| 24 | maxy => 1.5, | ||
| 25 | maxiter => 256, | ||
| 26 | ); | ||
| 27 | |||
| 28 | my @callseq = qw/image minx miny maxx maxy maxiter/; | ||
| 29 | |||
| 30 | Imager->register_filter(type=>'mandelbrot', | ||
| 31 | callsub => \&_mandelbrot, | ||
| 32 | defaults => \%defaults, | ||
| 33 | callseq => \@callseq); | ||
| 34 | |||
| 35 | 1; | ||
| 36 | |||
| 37 | __END__ |