]> granicus.if.org Git - imagemagick/blob - PerlMagick/Magick.pm
Is it 2019 already?
[imagemagick] / PerlMagick / Magick.pm
1 package Image::Magick;
2
3 #  Copyright 1999-2019 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 #    https://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 = '7.0.8';
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     no warnings;
54
55     my $constname;
56     ($constname = $AUTOLOAD) =~ s/.*:://;
57     die "&${AUTOLOAD} not defined. The required ImageMagick libraries are not installed or not installed properly.\n" if $constname eq 'constant';
58     my $val = constant($constname, @_ ? $_[0] : 0);
59     if ($! != 0) {
60         if ($! =~ /Invalid/) {
61                 $AutoLoader::AUTOLOAD = $AUTOLOAD;
62                 goto &AutoLoader::AUTOLOAD;
63         }
64         else {
65                 my($pack,$file,$line) = caller;
66                 die "Your vendor has not defined PerlMagick macro $pack\:\:$constname, used at $file line $line.\n";
67         }
68     }
69     eval "sub $AUTOLOAD { $val }";
70     goto &$AUTOLOAD;
71 }
72
73 bootstrap Image::Magick $VERSION;
74
75 # Preloaded methods go here.
76
77 sub new
78 {
79     my $this = shift;
80     my $class = ref($this) || $this || "Image::Magick";
81     my $self = [ ];
82     bless $self, $class;
83     $self->set(@_) if @_;
84     return $self;
85 }
86
87 sub New
88 {
89     my $this = shift;
90     my $class = ref($this) || $this || "Image::Magick";
91     my $self = [ ];
92     bless $self, $class;
93     $self->set(@_) if @_;
94     return $self;
95 }
96
97 # Autoload methods go after =cut, and are processed by the autosplit program.
98
99 END { UNLOAD () };
100
101 1;
102 __END__
103
104 =head1 NAME
105
106 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.
107
108 =head1 SYNOPSIS
109
110   use Image::Magick;
111   $p = new Image::Magick;
112   $p->Read("imagefile");
113   $p->Set(attribute => value, ...)
114   ($a, ...) = $p->Get("attribute", ...)
115   $p->routine(parameter => value, ...)
116   $p->Mogrify("Routine", parameter => value, ...)
117   $p->Write("filename");
118
119 =head1 DESCRIPTION
120
121 This Perl extension allows the reading, manipulation and writing of
122 a large number of image file formats using the ImageMagick library.
123 It was originally developed to be used by CGI scripts for Web pages.
124
125 A web page has been set up for this extension. See:
126
127          file:///usr/local/share/doc/ImageMagick-7.0.0/www/perl-magick.html
128          https://imagemagick.org/script/perl-magick.php
129
130 If you have problems, go to
131
132    https://imagemagick.org/discourse-server/viewforum.php?f=7
133
134 =head1 AUTHOR
135
136 Kyle Shorter    magick-users@imagemagick.org
137
138 =head1 BUGS
139
140 Has all the bugs of ImageMagick and much, much more!
141
142 =head1 SEE ALSO
143
144 perl(1).
145
146 =cut