missed a PERL_NO_GET_CONTEXT
[imager.git] / Mandelbrot / Mandelbrot.pm
CommitLineData
92bda632
TC
1package Imager::Filter::Mandelbrot;
2use strict;
3use Imager;
4use vars qw($VERSION @ISA);
5
6BEGIN {
5715f7c3 7 $VERSION = "0.02";
92bda632
TC
8
9 eval {
10 require XSLoader;
11 XSLoader::load('Imager::Filter::Mandelbrot', $VERSION);
12 1;
13 } or do {
14 require DynaLoader;
15 push @ISA, 'DynaLoader';
16 bootstrap Imager::Filter::Mandelbrot $VERSION;
17 };
18}
19
20sub _mandelbrot {
21 my %hsh = @_;
22
23 mandelbrot($hsh{image}, $hsh{minx}, $hsh{miny}, $hsh{maxx}, $hsh{maxy}, $hsh{maxiter});
24}
25
26my %defaults =
27 (
28 minx => -2.5,
29 maxx => 1.5,
30 miny => -1.5,
31 maxy => 1.5,
32 maxiter => 256,
33 );
34
35my @callseq = qw/image minx miny maxx maxy maxiter/;
36
37Imager->register_filter(type=>'mandelbrot',
38 callsub => \&_mandelbrot,
39 defaults => \%defaults,
40 callseq => \@callseq);
41
421;
3d51355f
TC
43
44__END__
45
46=head1 NAME
47
48Imager::Filter::Mandelbrot - filter that renders the Mandelbrot set.
49
50=head1 SYNOPSIS
51
52 use Imager;
53 use Imager::Filter::Mandelbrot;
54
55 $img->filter(type=>'mandelbrot', ...);
56
57=head1 DESCRIPTION
58
5715f7c3
TC
59This is a expansion of the C<mandelbrot> dynamically loadable filter
60provided in C<dynfilt> in previous releases of Imager.
3d51355f
TC
61
62Valid filter parameters are:
63
64=over
65
66=item *
67
5715f7c3 68C<minx>, C<maxx> - the range of x values to render. Defaults: -2.5, 1.5.
3d51355f
TC
69
70=item *
71
5715f7c3 72C<miny>, C<maxy> - the range of y values to render. Defaults: -1.5, 1.5
3d51355f
TC
73
74=item *
75
5715f7c3
TC
76C<maxiter> - the maximum number of iterations to perform when checking
77if the sequence tend towards infinity.
3d51355f
TC
78
79=back
80
81=head1 AUTHOR
82
83Original by Arnar M. Hrafnkelsson.
84
85Adapted and expanded by Tony Cook <tony@imager.perl.org>
86
87=head1 SEE ALSO
88
89Imager, Imager::Filters.
90
91=cut