see plug-ins/perl/Changes

This commit is contained in:
Marc Lehmann 1999-05-10 16:00:50 +00:00
parent d62e0c7def
commit 0a7c237708
9 changed files with 147 additions and 16 deletions

View file

@ -4,6 +4,9 @@ Revision history for Gimp-Perl extension.
- disabled paintbrush in testsuite since it has different calling
parameters in 1.1.
- added use File::Basename to Fu.pm.
- new module Gimp::Compat, which is loaded on demand.
- gimp_text_fontname etc.. are now available in gimp-1.0 as well,
re-enabled the scripts using it (and depending on 1.1 before).
1.081 Thu May 6 19:33:37 CEST 1999
- added "oneliners".

View file

@ -13,7 +13,7 @@ use subs qw(init end lock unlock canonicalize_color);
require DynaLoader;
@ISA=qw(DynaLoader);
$VERSION = 1.081;
$VERSION = 1.082;
@_param = qw(
PARAM_BOUNDARY PARAM_CHANNEL PARAM_COLOR PARAM_DISPLAY PARAM_DRAWABLE
@ -306,6 +306,19 @@ sub format_msg {
}
sub _initialized_callback {
# load the compatibility module on older versions
if ($interface_pkg eq "Gimp::Lib") {
# this must match @max_gimp_version in Gimp::Compat
my @compat_gimp_version = (1,1);
if ((Gimp->major_version < $compat_gimp_version[0])
|| (Gimp->major_version == $compat_gimp_version[0]
&& Gimp->minor_version < $compat_gimp_version[1])) {
require Gimp::Compat;
$compat_gimp_version[0] == $Gimp::Compat::max_gimp_version[0]
&& $compat_gimp_version[1] == $Gimp::Compat::max_gimp_version[1]
or die "FATAL: Gimp::Compat version mismatch\n";
}
}
if (@log) {
unless ($in_net || $in_query || $in_quit || $in_init) {
for(@log) {
@ -458,6 +471,7 @@ sub AUTOLOAD {
my ($class,$name) = $AUTOLOAD =~ /^(.*)::(.*?)$/;
for(@{"$class\::PREFIXES"}) {
my $sub = $_.$name;
print "checking for $sub(",join(",",@_),")\n";
if (exists $ignore_function{$sub}) {
*{$AUTOLOAD} = sub { () };
goto &$AUTOLOAD;

View file

@ -0,0 +1,126 @@
=head1 NAME
Gimp::Compat - compatibility functions for older verasions of Gimp.
=head1 SYNOPSIS
<loaded automatically on demand>
=head1 DESCRIPTION
Older versions of Gimp (vesion 1.0 at the time of this writing) lack some
very important or useful functions.
This module is providing the most needed replacement functions. If you
happen to miss a function then please create a replacement function and
send it to me ;)
These functions are handled in exactly the same way as PDB-Functions,
i.e. the (hypothetical) function C<gimp_image_xyzzy> can be called as
$image->xyzzy, if the module is available.
=head1 FUNCTIONS
=over 4
=item gimp_text_fontname
=item gimp_get_extents_fontname
=back
=head1 AUTHOR
Various, Dov Grobgeld <dov@imagic.weizmann.ac.il>. The author of the
Gimp-Perl extension (contact him to include new functions) is Marc Lehmann
<pcg@goof.com>
=cut
package Gimp::Compat;
$VERSION=$Gimp::VERSION;
use Gimp ();
# as a failsafe check, lowest version NOT requiring this module
@max_gimp_version = (1,1);
# The following function is used to convert a xlfd to the array structure
# used by the pre 1.2 functions gimp_text_ext() and gimp_text_get_extent_ext().
sub xlfd_unpack {
my $fontname = shift;
my $size_overload = shift;
my $size_unit_overload = shift;
# XLFDs fields can contain anything, including minus signs, but we
# gracefully ignore these weird things here ;)
my $p = "[^-]*";
my($foundry,
$family,
$weight,
$slant,
$set_width,
$pixelsize,
$pointsize,
$spacing,
$registry,
$encoding,
) = $fontname=~
/^-($p) (?# foundry )
-($p) (?# family )
-($p) (?# weight )
-($p) (?# slant )
-($p) (?# set_Width )
-$p
-($p) (?# pixelsize )
-($p) (?# pointsize )
-$p
-$p
-($p) (?# spacing )
-$p
-($p) (?# rgstry )
-($p) (?# encdng )
/x or die "xlfd_unpack: unmatched XLFD '$fontname'\n";
my $size;
if ($pixelsize && $pixelsize ne "*") {
$size = $pixelsize;
} else {
$size = 0.1*$pointsize;
}
$size = $size_overload if $size_overload;
my $size_unit = ($pointsize > 0);
$size_unit = $size_unit if defined $size_unit_overload;
return ($size, $size_unit, $foundry, $family, $weight, $slant,
$set_width, $spacing, $registry, $encoding);
}
sub fun {
my($major,$minor,$name,$sub)=@_;
if (Gimp->major_version < $major
|| (Gimp->major_version == $major && Gimp->minor_version < $minor)) {
print "overwriting Gimp::Lib::$name ($major,$minor)\n";
*{"Gimp::Lib::$name"}=$sub;
}
}
fun 1,1,gimp_text_get_extents_fontname,sub {
my($string, $xlfd_size, $xlfd_unit, $xlfd) = @_;
Gimp->text_get_extents_ext($string, @font_info,
xlfd_unpack($xlfd, $xlfd_size, $xlfd_unit));
};
fun 1,1,gimp_text_fontname,sub {
shift if $_[0]->isa('Gimp::Image');
my ($drw, $x,$y, $string,$border,$antialias, $xlfd_size, $xlfd_unit, $xlfd) = @_;
Gimp->text_ext($drw, $x, $y, $string, $border, $antialias,
xlfd_unpack($xlfd, $xlfd_size, $xlfd_unit));
};
1;

View file

@ -1,13 +1,8 @@
package Gimp::PDL;
use Carp;
use Gimp;
use Gimp ();
use PDL;
use base qw(Exporter);
require Exporter;
@EXPORT = ();
sub Gimp::Tile::set_data($) {
(my $p = byte $_[1])->make_physical;

View file

@ -40,6 +40,7 @@ Gimp/Util.pm
Gimp/Feature.pm
Gimp/Pod.pm
Gimp/Module.pm
Gimp/Compat.pm
embed/Makefile.PL
embed/perlmod.c
nolib/Makefile.PL

View file

@ -56,7 +56,6 @@ register "gimp_fu_example_script", # fill in a function name
fill $l BG_IMAGE_FILL;
# the next function only works in gimp-1.1
$text_layer=$img->text_fontname(-1,10,10,$text,5,1,xlfd_size($font),$font);
gimp_palette_set_foreground("green");

View file

@ -32,8 +32,6 @@ register "fit_text",
[PF_FONT, "font", "What font type to use - size will be ignored", $defaultfont],
[PF_STRING, "string", "Text String to fill with", "Fit Text"],
],
[],
['gimp-1.1'],
sub {
my($img,$layer,$xlfd,$string) =@_;
($sel,$x1,$y1,$x2,$y2) = $img->gimp_selection_bounds;

View file

@ -39,9 +39,6 @@ register $regname, $shortdesc, $longdesc, $authorname, $author, $date, $path, $i
[PF_SLIDER, "shinyness", "How shiny the final image will be",30, [0,90,5]],
[PF_SLIDER, "depth_shape", "Determines the final shape", 34 , [0,64,32]],
[PF_RADIO, "map", "The type of Map to use", 2, [Linear => 0, Spherical => 1, Sinusoidal => 2] ],
],[],
[
'gimp-1.1',
], sub {
my ($font, $text, $color1, $color2, $azimuth, $elevation, $depth, $maptype) = @_;

View file

@ -48,8 +48,6 @@ register
[ PF_STRING, "text", "Enter your Text to be Terral-ified", "TerralText"],
[ PF_SLIDER, "blur_amount", "Blur Amount", 10, [0,26,1]],
],
[],
['gimp-1.1'],
sub {
($img, $pattern, $solidnoise, $font, $text, $blur) = @_;
$oldbg = gimp_palette_get_background();
@ -65,7 +63,7 @@ sub {
# about before blindly apply a type of layer. Oh well. Call it RGBA
# for now.
# Hello, Seth.. look at this:
# FIXED: Hello, Seth.. look at this:
$textlayer = $img->layer_new($img->width, $img->height, $img->layertype(1),
"TextLayer", 100, 0);