]> granicus.if.org Git - imagemagick/blob - PerlMagick/Magick.pm
(no commit message)
[imagemagick] / PerlMagick / Magick.pm
1 package Image::Magick;
2
3 # Released Feb. 17, 1997  by Kyle Shorter (magick@wizards.dupont.com)
4 # Public Domain
5
6 use strict;
7 use Carp;
8 use vars qw($VERSION @ISA @EXPORT $AUTOLOAD);
9
10 require 5.002;
11 require Exporter;
12 require DynaLoader;
13 require AutoLoader;
14
15 @ISA = qw(Exporter DynaLoader);
16 # Items to export into callers namespace by default. Note: do not export
17 # names by default without a very good reason. Use EXPORT_OK instead.
18 # Do not simply export all your public functions/methods/constants.
19 @EXPORT =
20   qw(
21       Success Transparent Opaque QuantumDepth QuantumRange MaxRGB
22       WarningException ResourceLimitWarning TypeWarning OptionWarning
23       DelegateWarning MissingDelegateWarning CorruptImageWarning
24       FileOpenWarning BlobWarning StreamWarning CacheWarning CoderWarning
25       ModuleWarning DrawWarning ImageWarning XServerWarning RegistryWarning
26       ConfigureWarning ErrorException ResourceLimitError TypeError
27       OptionError DelegateError MissingDelegateError CorruptImageError
28       FileOpenError BlobError StreamError CacheError CoderError
29       ModuleError DrawError ImageError XServerError RegistryError
30       ConfigureError FatalErrorException
31     );
32
33 $VERSION = '6.6.7';
34
35 sub AUTOLOAD {
36     # This AUTOLOAD is used to 'autoload' constants from the constant()
37     # XS function.  If a constant is not found then control is passed
38     # to the AUTOLOAD in AutoLoader.
39
40     my $constname;
41     ($constname = $AUTOLOAD) =~ s/.*:://;
42     die "&${AUTOLOAD} not defined. The required ImageMagick libraries are not installed or not installed properly.\n" if $constname eq 'constant';
43     my $val = constant($constname, @_ ? $_[0] : 0);
44     if ($! != 0) {
45         if ($! =~ /Invalid/) {
46                 $AutoLoader::AUTOLOAD = $AUTOLOAD;
47                 goto &AutoLoader::AUTOLOAD;
48         }
49         else {
50                 my($pack,$file,$line) = caller;
51                 die "Your vendor has not defined PerlMagick macro $pack\:\:$constname, used at $file line $line.\n";
52         }
53     }
54     eval "sub $AUTOLOAD { $val }";
55     goto &$AUTOLOAD;
56 }
57
58 bootstrap Image::Magick $VERSION;
59
60 # Preloaded methods go here.
61
62 sub new
63 {
64     my $this = shift;
65     my $class = ref($this) || $this || "Image::Magick";
66     my $self = [ ];
67     bless $self, $class;
68     $self->set(@_) if @_;
69     return $self;
70 }
71
72 sub New
73 {
74     my $this = shift;
75     my $class = ref($this) || $this || "Image::Magick";
76     my $self = [ ];
77     bless $self, $class;
78     $self->set(@_) if @_;
79     return $self;
80 }
81
82 # Autoload methods go after =cut, and are processed by the autosplit program.
83
84 END { UNLOAD () };
85
86 1;
87 __END__
88
89 =head1 NAME
90
91 Image::Magick - objected-oriented Perl interface to ImageMagick. Use it to read, manipulate, or write an image or image sequence from within a Perl script.
92
93 =head1 SYNOPSIS
94
95   use Image::Magick;
96   $p = new Image::Magick;
97   $p->Read("imagefile");
98   $p->Set(attribute => value, ...)
99   ($a, ...) = $p->Get("attribute", ...)
100   $p->routine(parameter => value, ...)
101   $p->Mogrify("Routine", parameter => value, ...)
102   $p->Write("filename");
103
104 =head1 DESCRIPTION
105
106 This Perl extension allows the reading, manipulation and writing of
107 a large number of image file formats using the ImageMagick library.
108 It was originally developed to be used by CGI scripts for Web pages.
109
110 A web page has been set up for this extension. See:
111
112          file:///usr/local/share/doc/ImageMagick-6.6.7/www/perl-magick.html
113          http://www.imagemagick.org/script/perl-magick.php
114
115 If you have problems, go to
116
117    http://www.imagemagick.org/discourse-server/viewforum.php?f=7
118
119 =head1 AUTHOR
120
121 Kyle Shorter    magick-users@imagemagick.org
122
123 =head1 BUGS
124
125 Has all the bugs of ImageMagick and much, much more!
126
127 =head1 SEE ALSO
128
129 perl(1).
130
131 =cut