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