GD-2.83/ 0000755 0001750 0001750 00000000000 14635602360 011311 5 ustar rurban rurban GD-2.83/MANIFEST 0000644 0001750 0001750 00000006006 14635602357 012452 0 ustar rurban rurban ChangeLog
GD.xs
LICENSE
MANIFEST
MANIFEST.SKIP
Makefile.PL
README
README.QUICKDRAW
bdf_scripts/README
bdf_scripts/bdf2gdfont_pl.PL
bdf_scripts/bdftogd
bdf_scripts/cvtbdf.pl
const-c.inc
const-xs.inc
demos/brushes.pl
demos/copies.pl
demos/draw_colors.pl
demos/fills.pl
demos/font_list.png
demos/fonttest
demos/gd_example.cgi
demos/polyline.pl
demos/polys.pl
demos/shapes.pl
demos/tile.png
demos/transform.pl
demos/truetype_test
demos/ttf.pl
lib/GD.pm
lib/GD/Group.pm
lib/GD/Image.pm
lib/GD/Image_pm.PL
lib/GD/Polygon.pm
lib/GD/Polyline.pm
lib/GD/Simple.pm
t/GD.t
t/HSV.t
t/Polyline.t
t/autodetect.t
t/caller.t
t/fork.t
t/test_data/Generic.ttf
t/test_data/frog.jpg
t/test_data/frog.xbm
t/test_data/frog.xpm
t/test_data/images/corrupt.png
t/test_data/images/t1/1-00.gd
t/test_data/images/t1/1-00.gd2
t/test_data/images/t1/1-00.gif
t/test_data/images/t1/1-00.jpeg
t/test_data/images/t1/1-00.png
t/test_data/images/t2/2-00.gd
t/test_data/images/t2/2-00.gd2
t/test_data/images/t2/2-00.gif
t/test_data/images/t2/2-00.jpeg
t/test_data/images/t2/2-00.png
t/test_data/images/t3/3-00.gd
t/test_data/images/t3/3-00.gd2
t/test_data/images/t3/3-00.gif
t/test_data/images/t3/3-00.jpeg
t/test_data/images/t3/3-00.png
t/test_data/images/t4/4-00.gd
t/test_data/images/t4/4-00.gd2
t/test_data/images/t4/4-00.gif
t/test_data/images/t4/4-00.jpeg
t/test_data/images/t4/4-00.png
t/test_data/images/t5/5-00.gd
t/test_data/images/t5/5-00.gd2
t/test_data/images/t5/5-00.gif
t/test_data/images/t5/5-00.jpeg
t/test_data/images/t5/5-00.png
t/test_data/images/t6/6-00.gd
t/test_data/images/t6/6-00.gd2
t/test_data/images/t6/6-00.gif
t/test_data/images/t6/6-00.jpeg
t/test_data/images/t6/6-00.png
t/test_data/images/t7/7-00.gd
t/test_data/images/t7/7-00.gd2
t/test_data/images/t7/7-00.gif
t/test_data/images/t7/7-00.jpeg
t/test_data/images/t7/7-00.png
t/test_data/images/t7/7-01.gd2
t/test_data/images/t8/8-00.gd
t/test_data/images/t8/8-00.gd2
t/test_data/images/t8/8-00.gif
t/test_data/images/t8/8-00.jpeg
t/test_data/images/t8/8-00.png
t/test_data/images/t8/8-00.tiff
t/test_data/images/t8/8-01.gif
t/test_data/images/t8/8-01.jpeg
t/test_data/images/t8/8-01.png
t/test_data/images/t8/8-01.tiff
t/test_data/images/t8/8-02.gif
t/test_data/images/t8/8-02.jpeg
t/test_data/images/t8/8-02.png
t/test_data/images/t8/8-02.tiff
t/test_data/images/t8/8-03.gif
t/test_data/images/t8/8-03.jpeg
t/test_data/images/t8/8-03.png
t/test_data/images/t8/8-03.tiff
t/test_data/palettemap.png
t/test_data/tile.avif
t/test_data/tile.gd
t/test_data/tile.gd2
t/test_data/tile.gif
t/test_data/tile.heif
t/test_data/tile.jpeg
t/test_data/tile.png
t/test_data/tile.tiff
t/test_data/tile.wbmp
t/test_data/tile.webp
t/test_data/tile.xbm
t/test_data/windows.bmp
t/transp.t
t/windows_bmp.t
t/z_kwalitee.t
t/z_manifest.t
t/z_pod-spell-mistakes.t
t/z_pod.t
testcpan.sh
testlibs.sh
typemap
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
SIGNATURE Public-key signature (added by MakeMaker)
GD-2.83/const-xs.inc 0000644 0001750 0001750 00000005126 14234214067 013564 0 ustar rurban rurban void
constant(sv)
PREINIT:
#ifdef dXSTARG
dXSTARG; /* Faster if we have it. */
#else
dTARGET;
#endif
STRLEN len;
int type;
IV iv = 0;
/* NV nv; Uncomment this if you need to return NVs */
/* const char *pv; Uncomment this if you need to return PVs */
INPUT:
SV * sv;
const char * s = SvPV(sv, len);
PPCODE:
/* Change this to constant(aTHX_ s, len, &iv, &nv);
if you need to return both NVs and IVs */
type = constant(aTHX_ s, len, &iv);
/* Return 1 or 2 items. First is error message, or undef if no error.
Second, if present, is found value */
switch (type) {
case PERL_constant_NOTFOUND:
sv =
sv_2mortal(newSVpvf("%s is not a valid GD macro", s));
PUSHs(sv);
break;
case PERL_constant_NOTDEF:
sv = sv_2mortal(newSVpvf(
"Your vendor has not defined GD macro %s, used",
s));
PUSHs(sv);
break;
case PERL_constant_ISIV:
EXTEND(SP, 1);
PUSHs(&PL_sv_undef);
PUSHi(iv);
break;
/* Uncomment this if you need to return NOs
case PERL_constant_ISNO:
EXTEND(SP, 1);
PUSHs(&PL_sv_undef);
PUSHs(&PL_sv_no);
break; */
/* Uncomment this if you need to return NVs
case PERL_constant_ISNV:
EXTEND(SP, 1);
PUSHs(&PL_sv_undef);
PUSHn(nv);
break; */
/* Uncomment this if you need to return PVs
case PERL_constant_ISPV:
EXTEND(SP, 1);
PUSHs(&PL_sv_undef);
PUSHp(pv, strlen(pv));
break; */
/* Uncomment this if you need to return PVNs
case PERL_constant_ISPVN:
EXTEND(SP, 1);
PUSHs(&PL_sv_undef);
PUSHp(pv, iv);
break; */
/* Uncomment this if you need to return SVs
case PERL_constant_ISSV:
EXTEND(SP, 1);
PUSHs(&PL_sv_undef);
PUSHs(sv);
break; */
/* Uncomment this if you need to return UNDEFs
case PERL_constant_ISUNDEF:
break; */
/* Uncomment this if you need to return UVs
case PERL_constant_ISUV:
EXTEND(SP, 1);
PUSHs(&PL_sv_undef);
PUSHu((UV)iv);
break; */
/* Uncomment this if you need to return YESs
case PERL_constant_ISYES:
EXTEND(SP, 1);
PUSHs(&PL_sv_undef);
PUSHs(&PL_sv_yes);
break; */
default:
sv = sv_2mortal(newSVpvf(
"Unexpected return type %d while processing GD macro %s, used",
type, s));
PUSHs(sv);
}
GD-2.83/Makefile.PL 0000644 0001750 0001750 00000064324 14634773154 013305 0 ustar rurban rurban use ExtUtils::MakeMaker qw(prompt WriteMakefile);
use ExtUtils::Constant 'WriteConstants';
use Config;
use strict;
require 5.6.0;
unless (@ARGV) {
warn < PATHS: CHECK AND ADJUST <=====
my (@INC,@LIBPATH,@LIBS,$LIBGD_VERSION);
my $AUTOCONFIG = 0; # global set by try_to_autoconfigure() below
my $HAVE_GD2 = 1; # until libgd 2.3.1, unset by try_to_autoconfigure()
my ($options,$lib_gd_path,$lib_ft_path,$lib_png_path,$lib_jpeg_path,$lib_xpm_path,
$lib_tiff_path,$lib_webp_path,$lib_raqm_path,$lib_heif_path,$lib_avif_path,
$lib_zlib_path,$lib_fontconfig_path,$force,$FCGI,$gdlib_config_path);
use File::Basename qw/dirname/;
use File::Spec;
# Detect Strawberry Perl based on path components
# as $Config{uname} is just "uname" for portable versions.
my $_perl_lib_dir = File::Spec->catpath (dirname($^X), '/../../c/lib');
my $default_lib_gd_path
= $^O eq 'MSWin32' && -e $_perl_lib_dir
? $_perl_lib_dir
: '/usr/lib';
use Getopt::Long;
my $result = GetOptions("ignore_missing_gd" => \$force,
"options=s" => \$options,
"lib_gd_path=s" => \$lib_gd_path,
"lib_ft_path=s" => \$lib_ft_path,
"lib_png_path=s" => \$lib_png_path,
"lib_jpeg_path=s" => \$lib_jpeg_path,
"lib_tiff_path=s" => \$lib_tiff_path,
"lib_xpm_path=s" => \$lib_xpm_path,
"lib_webp_path=s" => \$lib_webp_path,
"lib_raqm_path=s" => \$lib_raqm_path,
"lib_heif_path=s" => \$lib_heif_path,
"lib_avif_path=s" => \$lib_avif_path,
"lib_zlib_path=s" => \$lib_zlib_path,
"lib_fontconfig_path=s" => \$lib_fontconfig_path,
"gdlib_config_path=s" => \$gdlib_config_path,
"fcgi" => \$FCGI,
);
unless (try_to_autoconfigure() || $force) {
die <.config.cache";
print F $DEFINES,"\n";
close F;
my $CCFLAGS = $Config{ccflags};
$CCFLAGS .= " -Wall -Wextra -Wformat=1" if $Config{gccversion} and $] > 5.020;
# hardened CFLAGS for testing
#$CCFLAGS .= ' -D_GNU_SOURCE -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches';
my $LDDLFLAGS = $Config{lddlflags};
# fixup mingw linker problems with empty weak symbols
$LDDLFLAGS .= " -Wl,--verbose" if $Config{gccversion} and $^O eq 'MSWin32';
my $LD = $Config{ld};
if ($LD eq 'g++' and $^O eq 'MSWin32') {
$LD = 'gcc';
}
my %WriteMakefileArgs = (
'NAME' => 'GD',
'ABSTRACT' => 'Perl interface to the libgd graphics library',
'VERSION_FROM' => 'lib/GD.pm',
'PREREQ_PM' => {
'Math::Trig' => 0,
},
'CONFIGURE_REQUIRES' => {
'ExtUtils::Constant' => 0.22,
'ExtUtils::PkgConfig' => 0,
'File::Which' => 0,
},
'TEST_REQUIRES' => {
'Test::More' => 0.88,
'Test::Fork' => 0.02,
'Test::NoWarnings' => '1.00',
},
'PL_FILES' => {'bdf_scripts/bdf2gdfont_pl.PL' => 'bdf_scripts/bdf2gdfont.pl',
'lib/GD/Image_pm.PL' => 'lib/GD/Image.pm'},
'LIBS' => [join(' ',$ENV{'GD_LIBS'},@LIBPATH,@LIBS)],
'INC' => join(' ',$ENV{'GD_INC'},@INC),
'LD' => $LD,
'CCFLAGS' => $CCFLAGS,
'LDDLFLAGS' => $LDDLFLAGS,
'EXE_FILES' => ['bdf_scripts/bdf2gdfont.pl'],
'AUTHOR' => 'Lincoln Stein ',
# Maintained by Reini Urban now
$CAPI ? ('CAPI' => 'TRUE') : (),
'DEFINE' => $DEFINES,
'clean' => {
FILES => '.config.cache cover_db MANIFEST.git *.gcov GD.gcda GD.gcno'
.' META.yml META.json'
},
'LICENSE' => 'perl_5',
'META_MERGE' => {
"meta-spec" => { version => 2 },
recommends => {
'Math::Trig' => 0,
'ExtUtils::PkgConfig' => 0,
'ExtUtils::Constant'=> '0.23',
'File::Which' => 0,
'Test::More' => '0.88',
'Test::Fork' => '0.02',
'Test::NoWarnings' => '1.00',
},
resources => {
repository => {
web => "https://github.com/lstein/Perl-GD",
url => "git://github.com/lstein/Perl-GD.git",
type => 'git',
},
license => "https://dev.perl.org/licenses/",
},
prereqs => {
develop => {
requires => {
'Class::XSAccessor' => 0,
'Text::CSV_XS' => 0,
'List::MoreUtils' => 0,
'Test::Kwalitee' => 0,
'Pod::Spell::CommonMistakes' => 0,
'Test::Pod' => '1.00',
'Algorithm::Diff' => 0,
'Test::NoWarnings' => '1.00',
},
},
},
},
SIGN => 1,
);
unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
my $pp = $WriteMakefileArgs{PREREQ_PM};
for my $mod ( keys %$br ) {
if ( exists $pp->{$mod} ) {
$pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
}
else {
$pp->{$mod} = $br->{$mod};
}
}
}
delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
delete $WriteMakefileArgs{TEST_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
delete $WriteMakefileArgs{META_MERGE}
unless eval { ExtUtils::MakeMaker->VERSION(6.46) };
WriteMakefile(%WriteMakefileArgs);
my @constants_iv = qw(
GD_CMP_IMAGE
GD_CMP_NUM_COLORS
GD_CMP_COLOR
GD_CMP_SIZE_X
GD_CMP_SIZE_Y
GD_CMP_TRANSPARENT
GD_CMP_BACKGROUND
GD_CMP_INTERLACE
GD_CMP_TRUECOLOR
GD_PIXELATE_UPPERLEFT
GD_PIXELATE_AVERAGE
gdBrushed
gdDashSize
gdMaxColors
gdStyled
gdStyledBrushed
gdTiled
gdTransparent
gdAntiAliased
gdArc
gdPie
gdChord
gdNoFill
gdEdged
gdEffectReplace
gdEffectAlphaBlend
gdEffectNormal
gdEffectOverlay
gdEffectMultiply
gdAlphaMax
gdAlphaOpaque
gdAlphaTransparent
gdRedMax
gdGreenMax
gdBlueMax
GD_MAJOR_VERSION
GD_MINOR_VERSION
GD_RELEASE_VERSION
GD_FLIP_HORINZONTAL
GD_FLIP_VERTICAL
GD_FLIP_BOTH
GD_RESOLUTION
GD_DEFAULT
GD_BELL
GD_BESSEL
GD_BILINEAR_FIXED
GD_BICUBIC
GD_BICUBIC_FIXED
GD_BLACKMAN
GD_BOX
GD_BSPLINE
GD_CATMULLROM
GD_GAUSSIAN
GD_GENERALIZED_CUBIC
GD_HERMITE
GD_HAMMING
GD_HANNING
GD_MITCHELL
GD_NEAREST_NEIGHBOUR
GD_POWER
GD_QUADRATIC
GD_SINC
GD_TRIANGLE
GD_WEIGHTED4
GD_LINEAR
GD_METHOD_COUNT
GD_AFFINE_TRANSLATE
GD_AFFINE_SCALE
GD_AFFINE_ROTATE
GD_AFFINE_SHEAR_HORIZONTAL
GD_AFFINE_SHEAR_VERTICAL
);
# Note that ExtUtils::Constant::ProxySubs creates code incompatible
# with <5.14. Only 0.23_04 has that fixed.
if (!-e 'const-xs.inc' or !-e"const-c.inc") {
WriteConstants(
#PROXYSUBS => {autoload => 1},
NAME => 'GD',
NAMES => \@constants_iv,
DEFAULT_TYPE => 'IV');
}
exit 0;
sub try_to_autoconfigure {
#my ($options,$lib_gd_path,$INC,$LIBPATH,$LIBS) = @_;
my ($version, $cflags, $ldflags, $libs, $libdir, $features, $includedir);
# perl Makefile.PL --lib_gd_path /opt/libgd/2.1.1/lib
my ($prefix) = $lib_gd_path ? ($lib_gd_path =~ m|(^.*)/lib|) : "";
my $bindir = $prefix ? "$prefix/bin/" : $lib_gd_path ? "$lib_gd_path/bin/" : "";
if (defined($gdlib_config_path)) {
;
} elsif (!$bindir or !-x "${bindir}gdlib-config") {
require File::Which;
$gdlib_config_path = File::Which::which('gdlib-config');
} else {
$gdlib_config_path = "${bindir}gdlib-config"
}
my $config = `$gdlib_config_path --all`;
if (!$^O eq 'MSWin32'
and !$config
and !-e "$prefix/lib/pkgconfig/gdlib.pc"
and !-e "/usr/lib/pkgconfig/gdlib.pc")
{
$gdlib_config_path = "gdlib-config" unless defined($gdlib_config_path);
$config = `$gdlib_config_path --all`;
}
unless ($config) {
my %config;
require ExtUtils::PkgConfig;
%config = ExtUtils::PkgConfig->find ("$prefix/lib/pkgconfig/gdlib") if $prefix;
%config = ExtUtils::PkgConfig->find ("gdlib") unless %config;
return unless %config;
$version = $config{modversion};
warn "Configuring for libgd version $version.\n";
$cflags = $config{cflags};
$libs = $config{libs};
($libdir, $libs) = $libs =~ m/-L(.*) (-lgd.*)/;
# Requires.private: zlib libpng freetype2 >= 9.8.3 fontconfig libjpeg xpm libtiff-4
# Libs.private: -L/opt/local/lib -lz -L/opt/local/lib -lpng16 -L/opt/local/lib -lfreetype -L/opt/local/lib -lfontconfig -lfreetype -ljpeg -L/opt/local/lib -lXpm -lX11 -L/opt/local/lib -ltiff -lwebp
# not in the hash!
# check the .pc file from $config{pkg}
my $pc = "$prefix/lib/pkgconfig/gdlib.pc";
if ($config{pkg}) {
$pc = "$prefix/lib/pkgconfig/" . $config{pkg} . ".pc";
}
if (!-e $pc) {
for my $p ("$prefix/lib/pkgconfig/gdlib.pc",
"$prefix/lib64/pkgconfig/gdlib.pc",
"/usr/lib64/pkgconfig/gdlib.pc",
"/usr/local/lib/pkgconfig/gdlib.pc")
{
if (-e $p) {
$pc = $p; last;
}
}
}
if (-e $pc) {
my $F;
open $F, "<", $pc;
my $private;
while (<$F>) {
next unless /^Requires.private/;
$private = $_;
}
close $F;
print STDERR "$pc: $private\n";
$features = 'GD_GIF GD_OPENPOLYGON';
$features .= ' GD_ZLIB' if $private =~ / zlib /;
$features .= ' GD_PNG' if $private =~ / libpng /;
$features .= ' GD_FREETYPE' if $private =~ / freetype/;
$features .= ' GD_FONTCONFIG' if $private =~ / fontconfig/;
$features .= ' GD_RAQM' if $private =~ / raqm/;
$features .= ' GD_JPEG' if $private =~ / libjpeg/;
$features .= ' GD_XPM' if $private =~ / xpm/;
$features .= ' GD_TIFF' if $private =~ / libtiff/;
$features .= ' GD_WEBP' if $private =~ / libwebp/;
$features .= ' GD_HEIF' if $private =~ / libheif/;
$features .= ' GD_AVIF' if $private =~ / libavif/;
} else {
warn "gdlib.pc not found, guessing the features.\n";
$features = 'GD_GIF GD_OPENPOLYGON GD_ZLIB GD_PNG GD_FREETYPE GD_FONTCONFIG GD_JPEG GD_XPM GD_TIFF GD_WEBP';
#$features .= 'GD_WEBP' if $version ge '2.3.0';
$features .= ' GD_AVIF' if $version ge '2.3.2';
$features .= ' GD_HEIF' if $version ge '2.3.3' and $^O ne 'darwin';
}
$AUTOCONFIG++;
} else {
$AUTOCONFIG++;
($version) = $config =~ /^GD library\s+(\S+)/m;
warn "Configuring for libgd version $version.\n";
($includedir) = $config =~ /^includedir:\s*(.+)$/m;
($cflags) = $config =~ /^cflags:\s*(.+)$/m;
($ldflags) = $config =~ /^ldflags:\s*(.+)$/m;
($libs) = $config =~ /^libs:\s*(.+)$/m;
($libdir) = $config =~ /^libdir:\s*(.+)$/m;
($features) = $config =~ /^features:\s*(.+)$/m;
($includedir) = $config =~ /^includedir:\s*(.+)$/m;
}
$LIBGD_VERSION = $version;
@INC = map {s/^-I// && "-I$_"} split /\s+/,$cflags;
@LIBS = split /\s+/,$libs;
if ($libdir) {
if ($config) {
@LIBPATH = map {s/^-L// && "-L$_"} split /\s+/,$ldflags;
($lib_gd_path = $libdir) =~ s!/[^/]+$!!;
} else {
$lib_gd_path = $libdir;
}
push @LIBPATH,"-L$libdir";
}
push @LIBS,"-lgd" unless $libs =~ /-lgd/;
if (!$options) {
$options = $features;
my ($release, $major, $minor) = $version =~ /^(\d+)\.(\d+)\.(\d+)/;
$options .= " GD_UNCLOSEDPOLY GD_FTCIRCLE VERSION_33"
if defined($minor)
&& ($release > 2
|| ($release == 2 && $major > 0)
|| ($release == 2 && $major == 0 && $minor >= 33));
$options .= " WINDOWS_BMP"
if defined($minor)
&& ($release > 2
|| ($release == 2 && $major > 0));
if (defined($minor)
&& ($release > 2
|| ($release == 2 && $major > 3)
|| ($release == 2 && $major == 3 && $minor >= 2))) {
$HAVE_GD2 = 0;
$AVIF = 1;
} else {
$options .= " GD2";
$HAVE_GD2 = 1;
$AVIF = 0;
$HEIF = 0;
}
if (defined($minor)
&& ($release > 2
|| ($release == 2 && $major > 3)
|| ($release == 2 && $major == 3 && $minor >= 3))) {
$HEIF = 1;
}
} else {
my ($release, $major, $minor) = $version =~ /^(\d+)\.(\d+)\.(\d+)/;
$options .= " GD_UNCLOSEDPOLY GD_FTCIRCLE VERSION_33"
if defined($minor)
&& ($release > 2
|| ($release == 2 && $major > 0)
|| ($release == 2 && $major == 0 && $minor >= 33));
}
if ($config) {
my @correct_inc = map {s/^-I// && $_} split /\s+/,$cflags;
check_for_stray_headers($includedir,@correct_inc);
}
return 1;
}
sub check_for_stray_headers {
my @official_libraries = @_;
my %official_libraries = map {$_=>1} @official_libraries;
print STDERR "Checking for stray libgd header files...";
my $cc = $Config{'cc'};
my $data = `$cc -print-search-dirs 2>/dev/null`;
$data ||= '';
my ($libraries) = $data =~ /^libraries: =(.+)/m;
my @cc_libs = split /:/,$libraries;
foreach (@cc_libs) { s/\/$//; }
my %libraries = map {$_=>1} (@cc_libs,'/include','/usr/include',
'/usr/local/include','/opt/include',
'/usr/X11R6/include');
my $problems;
my $o = $official_libraries[0];
foreach (keys %libraries) {
s/\blib\b/include/;
next if $official_libraries{$_};
next unless -e "$_/gd.h";
if (-l "$_/gd.h" or -l "$o/gd.h") {
next if (stat("$_/gd.h"))[1] == (stat("$o/gd.h"))[1];
}
warn "\n\n** WARNING: found gd.h header file in ${_}/gd.h, but it is expected at $official_libraries[0]/gd.h. This may cause compile errors! **\n";
$problems++;
}
print STDERR $problems ? "** Possible problems found **\n" : "none found.\n";
print STDERR "\n";
}
sub MY::postamble {
my $postamble = <<'END';
html: lib/GD.pm
pod2html --outfile=GD.html lib/GD.pm
END
$postamble;
}
package MY;
# Ignore templates
sub libscan {
return 0 if $_[1] =~ /_p[ml].PL$/;
return $_[1];
}
sub processPL {
my $inherited = shift->SUPER::processPL(@_);
$inherited =~ s/(:: lib\/GD\/Image_pm\.PL)/$1 .config.cache/;
$inherited;
}
sub depend {
"
release : dist
git tag release_\$(VERSION_SYM)
cpan-upload \$(DISTVNAME).tar\$(SUFFIX)
git push
git push --tags
const-c.inc const-xs.inc : Makefile.PL
GCOV = gcov
test_cover :: pure_all
\$(RM_RF) cover_db
+\$(PERLRUNINST) -S cover -test
test_coveralls :: pure_all
+\$(PERLRUNINST) -S cover -test -report coveralls
gcov : \$(BASEEXT).c.gcov \$(BASEEXT).gcov cover_db/\$(BASEEXT)-xs.html
\$(BASEEXT).c.gcov \$(BASEEXT).xs.gcov : \$(BASEEXT).xs
\$(MAKE) CCFLAGS=\"\$(CCFLAGS) -fprofile-arcs -ftest-coverage\" LDDLFLAGS=\"\$(LDDLFLAGS) -fprofile-arcs -ftest-coverage\"
\$(GCOV) \$(BASEEXT).c \$(BASEEXT).xs
cover_db/\$(BASEEXT)-xs.html : \$(BASEEXT).xs.gcov
PERL5OPT=-MDevel::Cover make test
-$^X -S gcov2perl \$(BASEEXT).c.gcov \$(BASEEXT).xs.gcov
$^X -S cover
gprof :
\$(MAKE) CCFLAGS=\"\$(CCFLAGS) -pg\" LDDLFLAGS=\"\$(LDDLFLAGS) -pg\"
"
}
GD-2.83/typemap 0000644 0001750 0001750 00000000102 14234214067 012702 0 ustar rurban rurban TYPEMAP
GD::Image T_PTROBJ
GD::Font T_PTROBJ
GD::Polygon T_PTROBJ
GD-2.83/demos/ 0000755 0001750 0001750 00000000000 14635602357 012426 5 ustar rurban rurban GD-2.83/demos/tile.png 0000644 0001750 0001750 00000000430 14234214067 014056 0 ustar rurban rurban PNG
IHDR R? PLTE ܸ
[ѧ: bKGD H IDATxc``Z:CCC ?bBF CtEXtSoftware @(#)ImageMagick 4.1.0 98/09/08 cristy@mystic.es.dupont.comeB *tEXtSignature 7a52b1cac1657d1b4f8ef32b4198eabc{;\ tEXtPage 21x22+0+0 IENDB` GD-2.83/demos/truetype_test 0000755 0001750 0001750 00000001546 14234214067 015272 0 ustar rurban rurban #!/usr/local/bin/perl
use lib '../blib/lib','../blib/arch';
use GD 1.20;
use constant FONT_DIRECTORY => '/dosc/windows/fonts';
my $directory = shift || FONT_DIRECTORY;
my @fonts = <$directory/*.pfa $directory/*.pfb $directory/*.ttf>;
die "Usage: $0 \nDisplays a directory of TrueType and Type1 fonts\n" unless @fonts;
my $im = new GD::Image(800,600);
my ($white,$black) = (
$im->colorAllocate(255, 255, 255),
$im->colorAllocate(0, 0, 0));
my ($x,$y) = (20,20);
my $max_x = 0;
for my $font (@fonts) {
my ($font_name) = $font =~ /([^\\\/]+)$/;
warn "rendering $font_name\n";
(my @h = $im->stringTTF($black,$font,12.0,0.0,$x,$y,$font_name)) || next;
$y = $h[1] + 12 + 5;
$max_x = $max_x > $h[4] ? $max_x : $h[4];
if ($y > 600) {
$y = 20;
$x = $max_x + 5;
}
}
binmode STDOUT;
# print the image to stdout
print $im->png;
GD-2.83/demos/transform.pl 0000755 0001750 0001750 00000001773 14615214115 014776 0 ustar rurban rurban #!/usr/local/bin/perl
use GD;
use Math::Trig;
# test scaling, translation, transformation
$im = new GD::Image(380,225);
$black = $im->colorAllocate(0, 0, 0);
$white = $im->colorAllocate(255, 255, 255);
$red = $im->colorAllocate(255, 0, 0);
$blue = $im->colorAllocate(0,0,255);
$yellow = $im->colorAllocate(255,250,205);
# Create a triangle
$poly = new GD::Polygon;
$poly->toPt(50,50);
$poly->toPt(100,0);
$poly->toPt(-50,50);
$poly->toPt(-50,-50);
$im->filledPolygon($poly,$yellow);
# Stretch it a bit
#$poly->scale(1.8,1.0);
#$poly->offset(100,0);
#$im->filledPolygon($poly,$red);
# Rotate it (scale by 0.5,0.2, rotate by 0,1, move by -25,50)
#$poly->transform(0.5,0.2, 0,1, -25,50);
#$poly->scale(1.5);
$poly->rotate(deg2rad(45));
$poly->offset(50,100);
warn "blue: [", join(' ',$poly->bounds), "]";
$im->filledPolygon($poly,$blue);
$poly->rotate(deg2rad(-90));
$poly->offset(180,0);
warn "red: [", join(' ',$poly->bounds), "]";
$im->filledPolygon($poly,$red);
binmode STDOUT;
print $im->png;
GD-2.83/demos/copies.pl 0000755 0001750 0001750 00000002111 14234214067 014233 0 ustar rurban rurban #!/usr/local/bin/perl
use GD;
$im = new GD::Image(300,300);
$white = $im->colorAllocate(255, 255, 255);
$black = $im->colorAllocate(0, 0, 0);
$red = $im->colorAllocate(255, 0, 0);
$blue = $im->colorAllocate(0,0,255);
$yellow = $im->colorAllocate(255,250,205);
# Create a flat wide rectangle paintbrush
$brush = new GD::Image(10,10);
$brush->colorAllocate(255,255,255); # white
$brush->colorAllocate(0,0,0); # black
$brush->transparent($white); # white is transparent
$brush->filledRectangle(0,0,5,2,$black); # a black rectangle
$im->setBrush($brush);
$im->arc(100,100,100,150,0,360,gdBrushed);
$poly = new GD::Polygon;
$poly->addPt(30,30);
$poly->addPt(100,10);
$poly->addPt(190,290);
$poly->addPt(30,290);
$im->polygon($poly,gdBrushed);
$im->fill(132,62,$blue);
$im->fill(100,70,$red);
$im->fill(40,40,$yellow);
$im->interlaced(1);
# Copy the 20,20,70,70 region
# to a location at 150,150
$im->copy($im,150,150,20,20,50,50);
# Same thing, but doubling the size
$im->copyResized($im,10,200,20,20,100,100,50,50);
binmode STDOUT;
# print the image to stdout
print $im->png;
GD-2.83/demos/polys.pl 0000755 0001750 0001750 00000001427 14234214067 014130 0 ustar rurban rurban #!/usr/local/bin/perl
use GD;
$im = new GD::Image(225,180);
$black = $im->colorAllocate(0, 0, 0);
$white = $im->colorAllocate(255, 255, 255);
$red = $im->colorAllocate(255, 0, 0);
$blue = $im->colorAllocate(0,0,255);
$yellow = $im->colorAllocate(255,250,205);
# Create a triangle
$poly = new GD::Polygon;
$poly->addPt(0,50);
$poly->addPt(25,25);
$poly->addPt(50,50);
$im->filledPolygon($poly,$blue);
# offset it down and to the right
$poly->offset(100,100);
$im->filledPolygon($poly,$red);
# make it twice as wide and move it upward a bit
$poly->map(50,50,100,100,10,10,110,60);
$im->filledPolygon($poly,$yellow);
# make it real tall
$poly->map($poly->bounds,50,20,80,160);
$im->filledPolygon($poly,$white);
binmode STDOUT;
# print the image to stdout
print $im->png;
GD-2.83/demos/polyline.pl 0000644 0001750 0001750 00000021220 14234214067 014603 0 ustar rurban rurban ############################################################################
#
# Sample code for use of Polyline.pm
#
# Author: Dan Harasty
# Email: harasty@cpan.org
# Version: 0.1
# Date: 7/20/2002
#
#
use GD;
use GD::Polyline;
$PI = 3.14159; $TWO_PI = 2 * $PI;
sub r2d {$_[0] * 180 / $PI};
$splinekey = "- Green: original polygon or polyline
- Blue: control points added with addControlPoints()
- Black: spline generated by toSpline()
";
if (1) {
use GD;
use GD::Polyline;
# create an image
$image = new GD::Image (500,300);
$white = $image->colorAllocate(255,255,255);
$black = $image->colorAllocate( 0, 0, 0);
$red = $image->colorAllocate(255, 0, 0);
# create a new polyline
$polyline = new GD::Polyline;
# add some points
$polyline->addPt( 0, 0);
$polyline->addPt( 0,100);
$polyline->addPt( 50,125);
$polyline->addPt(100, 0);
# polylines can use polygon methods (and vice versa)
$polyline->offset(200,100);
# rotate 60 degrees, about the centroid
$polyline->rotate(3.14159/3, $polyline->centroid());
# scale about the centroid
$polyline->scale(1.5, 2, $polyline->centroid());
# draw the polyline
$image->polydraw($polyline,$black);
# create a spline, which is also a polyine
$spline = $polyline->addControlPoints->toSpline;
$image->polydraw($spline,$red);
# output the png
#binmode STDOUT;
#print $image->png;
SampleImage($image, "polyline-synopsis.png", "Synopsis", "Polyline created by 'SYNOPSIS' section of documentation.");
}
if (1) {
$image = NewImage();
$offset = 50;
for $poly (new GD::Polygon, new GD::Polyline) {
$table_info = [];
$poly->addPt( 0, 0);
$poly->addPt( 0,100);
$poly->addPt( 50,125);
$poly->addPt(100, 0);
#print "this " . ref($poly) . " has " . $poly->length() . " points\n";
push @$table_info, ["".ref($poly).""];
push @$table_info, ['vertex number: ', 0..($poly->length()-1)];
@coords = $poly->vertices();
@coords = map {"[".int($_->[0]).",".int($_->[1])."]"} @coords;
push @$table_info, ['coordinates (pre-offset): ', @coords];
@lengths = $poly->segLength();
@lengths = map {int($_+0.5)} @lengths;
#print "segLengths are : @lengths\n";
#print "perimeter is : " . int($poly->segLength()) . "\n";
push @$table_info, ['segment lengths: ', @lengths];
@angles = $poly->segAngle();
@angles = map {int(r2d($_)+0.5)} @angles;
#print "seg angles are : @angles\n";
push @$table_info, ['segment angles: ', @angles];
@angles = $poly->vertexAngle();
@angles = map {defined ($_) ? int(r2d($_)+0.5) : "undef"} @angles;
#print "vertex angles are: @angles\n";
push @$table_info, ['vertex angles: ', @angles];
$poly->offset(50 + $offset,80);
$offset += 200;
# draw the original poly
$image->polydraw($poly,$black);
#print "\n\n";
push @$summary_table, genHTMLTable($table_info, 0);
}
SampleImage($image, "polyline-simple.png", "Simple", "GD::Polygon and GD::Polyline with same vertexes.
" . genHTMLTable([$summary_table], 1));
}
if (1) {
$image = NewImage();
$offset = 50;
for $poly (new GD::Polygon, new GD::Polyline) {
$poly->addPt( 0, 0);
$poly->addPt( 0,100);
$poly->addPt( 50,125);
$poly->addPt(100, 0);
$poly->offset(50 + $offset,80);
$offset += 200;
# draw the original poly
$image->polydraw($poly,$green);
# create and draw the control line for the spline
$ctrlline = $poly->addControlPoints();
$image->polydraw($ctrlline,$cyan);
# create and draw the spline itself
$spline = $ctrlline->toSpline();
$image->polydraw($spline,$black);
}
SampleImage($image, "polyline-spline.png", "Spline", "Splines fit to vertices of polygon and polyline. $splinekey");
}
if (1) {
$image = NewImage();
$triangle = new GD::Polygon;
$triangle->addPt( 0, 0);
$triangle->addPt(-19, 95);
$triangle->addPt( 19, 95);
$triangle->offset(250,50);
foreach (1..9) {
$image->polydraw($triangle,gdBrushed);
$triangle->rotate($TWO_PI / 9, 250, 150);
}
SampleImage($image, "polyline-star9.png", "Nine Pointed Star", "A triangle, rotated about a point other than the origin.
Demonstration of \$poly->rotate() and \$poly->offset()");
}
if (1) {
$image = NewImage();
$cloverControl = new GD::Polyline;
$cloverControl->addPt(45,45);
$cloverControl->addPt(10,10);
$cloverControl->addPt(90,10);
$cloverControl->addPt(55,45);
$cloverControl->addPt(90,10);
$cloverControl->addPt(90,90);
$cloverControl->addPt(55,55);
$cloverControl->addPt(90,90);
$cloverControl->addPt(10,90);
$cloverControl->addPt(45,55);
$cloverControl->addPt(10,90);
$cloverControl->addPt(10,10);
$cloverControl->addPt(45,45);
$clover = $cloverControl->toSpline();
# note that the three following transformations
# could have been called on $cloverControl, instead,
# followed by the above call
$clover->offset($clover->centroid(-1));
$clover->scale(3, 3);
$clover->offset(250, 150);
$image->filledPolygon($clover,$green);
SampleImage($image, "polyline-clover.png", "Clover", "Sample image generated by GD::Polygon");
}
if (1) {
$image = NewImage();
$polyline = new GD::Polyline;
for (0..15) {
$polyline->addPt(30 * $_ + 10, rand(90) + 5);
}
$image->polyline($polyline,$green);
$ctrlline = $polyline->addControlPoints();
$ctrlline->offset(0,100);
$image->polyline($ctrlline,$cyan);
$spline = $ctrlline->toSpline();
$spline->offset(0,100);
$image->polyline($spline,$black);
SampleImage($image, "polyline-zigzag.png", "Zigzag", "Spline fit to random function. $splinekey");
}
if (1) {
$image = NewImage();
$ring_network = new GD::Polygon;
$num_nodes = 10;
$randfactor = 80;
for (1..$num_nodes) {
$x = 250 + 150 * cos($TWO_PI * $_/$num_nodes);
$y = 150 + 100 * sin($TWO_PI * $_/$num_nodes);
$x += rand($randfactor)-$randfactor/2;
$y += rand($randfactor)-$randfactor/2;
$ring_network->addPt($x, $y);
}
$image->setBrush($brush2);
$image->polyline($ring_network->addControlPoints->toSpline,gdBrushed);
$ring_node = new GD::Polygon;
$ring_node->addPt( 0, 0);
$ring_node->addPt(10, 0);
$ring_node->addPt(10,10);
$ring_node->addPt( 0,10);
for $ring_vertex ($ring_network->vertices()) {
$ring_node->offset($ring_node->centroid(-1));
$ring_node->offset(@$ring_vertex);
$image->filledPolygon($ring_node,$grey);
}
SampleImage($image, "polyline-ring-network.png", "Ring Network", "Closed spline fit to nodes at somewhat random positions.");
}
WriteToFile("polyline-example.html", theHTML());
print "\n";
print "open 'polyline-example.html' in your favorite browser that supports PNG.\n";
print "\n";
print "done! " . localtime() . "\n";
##########################
#
# helper functions
#
sub NewImage {
$image = new GD::Image (500,300);
$white = $image->colorAllocate(255,255,255);
$black = $image->colorAllocate( 0, 0, 0);
$grey = $image->colorAllocate(128,128,128);
$red = $image->colorAllocate(255, 0, 0);
$orange = $image->colorAllocate(255,196, 0);
$green = $image->colorAllocate( 0,255, 0);
$blue = $image->colorAllocate( 0, 0,255);
$cyan = $image->colorAllocate( 0,255,255);
$purple = $image->colorAllocate(206, 0,165);
$brush_width = 2;
$brush_color = [255,128,0];
$brush = new GD::Image($brush_width,$brush_width);
$brush->transparent($brush->colorAllocate(255,255,255));
$brush->filledRectangle(0,0,$brush_width,$brush_width,$brush->colorAllocate(@$brush_color));
$brush1 = $brush;
$brush_width = 3;
$brush_color = [206,0,165];
$brush = new GD::Image($brush_width,$brush_width);
$brush->transparent($brush->colorAllocate(255,255,255));
$brush->filledRectangle(0,0,$brush_width,$brush_width,$brush->colorAllocate(@$brush_color));
$brush2 = $brush;
$image->setBrush($brush1);
$image;
}
my $html;
sub SampleImage {
my $image = shift;
my $file = shift;
my $title = shift;
my $text = shift;
WriteToBinaryFile($file, $image->png());
$html .= "
\n";
$html .= "$title - $file
\n";
$html .= "$text
\n";
}
sub theHTML {
$html;
}
sub WriteToFile {
my $file = shift || return 0;
my $contents = shift || "";
open (NEWFILE, ">" . $file) or die "couldn't write to file $file";
print NEWFILE $contents;
close(NEWFILE);
print "created file $file\n";
}
sub WriteToBinaryFile {
my $file = shift || return 0;
my $contents = shift || "";
open (NEWFILE, ">" . $file) or die "couldn't write to file $file";
binmode NEWFILE;
print NEWFILE $contents;
close(NEWFILE);
print "created file $file\n";
}
sub genHTMLTable {
my $array_of_arrays = shift;
my $border = shift;
my $html_table;
$html_table .= "";
for my $array_of_items (@$array_of_arrays) {
$html_table .= "| ";
$html_table .= join(" | ", @$array_of_items);
$html_table .= " |
";
}
$html_table .= "
";
$html_table;
}
GD-2.83/demos/ttf.pl 0000755 0001750 0001750 00000001346 14234214067 013557 0 ustar rurban rurban #!/usr/local/bin/perl
use lib '../blib/lib','../blib/arch';
use GD 1.20;
use constant font => '../t/Generic.ttf';
$im = new GD::Image(400,250);
warn $GD::VERSION;
($white,$black,$red,$blue,$yellow) =
(
$im->colorAllocate(255, 255, 255),
$im->colorAllocate(0, 0, 0),
$im->colorAllocate(255, 0, 0),
$im->colorAllocate(0,0,255),
$im->colorAllocate(255,250,205)
);
$im->interlaced(1); # cool venetian blinds effect
# Some TTFs
$im->stringTTF($black,font,12.0,0.0,20,20,"Hello world!") || die $@;
$im->stringTTF($red,font,14.0,0.0,20,80,"Hello world!")|| die $@;;
$im->stringTTF($blue,font,30.0,-0.5,60,100,"Goodbye cruel world!")|| die $@;;
binmode STDOUT;
# print the image to stdout
print $im->png;
GD-2.83/demos/font_list.png 0000644 0001750 0001750 00000053076 14234214067 015140 0 ustar rurban rurban PNG
IHDR X hXC PLTE ???___///"c IDATxے0&& Ur'/%par/+L$aC$ē'=IOzғ'=Qo]*QmeVixkV"&M7-QVבm8Cd͏Q C_Ut6jo<*/onZw=o;qڀ*y_^*">H}˛#Om/8zm
hio}"ڰ_v].R/̪থ;^Z<`S羬Kțx5'2 ZCiy! QTY\}VQ^b F+<ľ&v&H_|.+zw9%xnĔ+*'2 ĕWhmG㲬Fv hUph DnpUd^cs|/?] @"R^l9AB`ӎz`TXy } `ƵpR=
{;d@ly;s
϶)>h-rH]"bYӽp
:Y%7$QwWg{T1&Y?ߧ=1LCl` ȀoyS-u!(J$@tu;gޑtjQ6D?=Ɖ
juTEb38n3Ul*YZx~~mzS_<(#KVޅ*ϒL:z)x I'&BI >: _UAHވ ؎HzwzwE ! c} nE)ªh'c" i&mA{"aqUsi!0(c
O3a2r6h?DwuTWuPQXySj^yU i1mpwgԇml0v,=64ĐyP2;+'bG_ꭼ{aG9
u|.ͯ*&$6J×:~_J{bO͓H'fOzғ;L;# DMrV^No)b:E#[*`h0
o}.fY|Чh`HS@Zh`T\MG [
fkjGi~U|)]o̮|*sձE Qs{*Ϲ^5Kix-fMEHbES1-JkL65݁z:Vv_$~J$F!;iQ%G:fgD`xm'f`(F.*pUOܣ'@~4iX 5?֯?(`DM1,ۋ>j"}*cseMS6M`H`q uwiX'laMuQ_JHC"f~Ofwi~$ oVmH_&5A7)}j/wHct%RR
,4|hFd?M:4ñ6Ĥa:Pr(tt0lpCþ~h{.BoZRG4AMnq7Xoq^&t˪/ B@o*r6G&~Eҗ4i}))XtRk
Kѷmۗ0Tjt#'tEd @،~G=iT9vwGHj(xb,q)+1.6TS4=zrhM8VwBd! xEAh'9v
gl+KҀ?p4fW^pR.C[aۄI[j{]3 2*^P}; ğe @jwӾݵ_,=(`wR:jX#ԫu]H¬l+ sh+R=,6Ni-,xlLo:
^|ۊg,Ċz!P3/>`xBA dc8ƓN˃1u>ݥ^.#ƴv:/Y6Btŷt\w?ٕp tLxJvi.Eyr6(b&&!*;vV7LNBwt7