see plug-ins/perl/Changes

This commit is contained in:
Marc Lehmann 1999-05-18 21:06:12 +00:00
parent 05b59059d7
commit 711e1c2279
17 changed files with 709 additions and 412 deletions

View File

@ -1,10 +1,19 @@
Revision history for Gimp-Perl extension.
1.089 Tue May 18 19:55:25 CEST 1999
- added colourtoalpha.
- made all internal C functions static -> less namespace bloat.
- its possible to shorten the call $drawable->get->pixel_rgn
to "just" $drawable->pixel_rgn.
- made one-arg gimp_progress_init work again.
- removed compatibility code from Lib.xs.
- call the XS version of gimp_progress_init when only
one argument is given.
- re-added PARASITE_*-constants (including UNDOABLE variants).
- temporarily disabled the module for political reasons.
- made my first attempt at implementing XS-PDL support.
- transform obnjects ids of -1 into undef and vice versa.
- Gimp::Fu did not properly supply a default value for PF_COLOUR.
- :auto is NO LONGER the default for the import method(!).
(NOT YET).

View File

@ -13,7 +13,7 @@ use subs qw(init end lock unlock canonicalize_color);
require DynaLoader;
@ISA=qw(DynaLoader);
$VERSION = 1.084;
$VERSION = 1.089;
@_param = qw(
PARAM_BOUNDARY PARAM_CHANNEL PARAM_COLOR PARAM_DISPLAY PARAM_DRAWABLE
@ -467,7 +467,7 @@ sub _pseudoclass {
_pseudoclass qw(Layer gimp_layer_ gimp_drawable_ gimp_floating_sel_ gimp_image_ gimp_ plug_in_);
_pseudoclass qw(Image gimp_image_ gimp_drawable_ gimp_ plug_in_);
_pseudoclass qw(Drawable gimp_drawable_ gimp_layer_ gimp_image_ gimp_ plug_in_);
_pseudoclass qw(Drawable gimp_drawable_ gimp_layer_ gimp_channel_ gimp_image_ gimp_ plug_in_);
_pseudoclass qw(Selection gimp_selection_);
_pseudoclass qw(Channel gimp_channel_ gimp_drawable_ gimp_selection_ gimp_image_ gimp_ plug_in_);
_pseudoclass qw(Display gimp_display_ gimp_);
@ -479,7 +479,7 @@ _pseudoclass qw(Region );
_pseudoclass qw(Parasite parasite_ gimp_);
# "C"-Classes
_pseudoclass qw(GDrawable gimp_drawable_);
_pseudoclass qw(GDrawable gimp_gdrawable_ gimp_drawable_);
_pseudoclass qw(PixelRgn gimp_pixel_rgn_);
_pseudoclass qw(Tile gimp_tile_);
@ -494,18 +494,6 @@ package Gimp::Tile;
unshift (@Tile::ISA, "Gimp::Tile");
sub data {
my $self = shift;
$self->set_data(@_) if @_;
defined(wantarray) ? $self->get_data : undef;
}
package Gimp::GDrawable;
sub pixel_rgn($$$$$$) {
Gimp::gimp_pixel_rgn_init(@_);
}
package Gimp::PixelRgn;
push(@PixelRgn::ISA, "Gimp::PixelRgn");

View File

@ -28,7 +28,7 @@ my %description = (
'gimp-1.1' => 'gimp version 1.1 or higher',
'gimp-1.2' => 'gimp version 1.2 or higher',
'perl-5.005' => 'perl version 5.005 or higher',
'pdl' => 'PDL (the Perl Data Language), version 1.9906 or higher',
'pdl' => 'compiled-in PDL support',
'gnome' => 'the gnome perl module',
'gtkxmhtml' => 'the Gtk::XmHTML module',
'dumper' => 'the Data::Dumper module',
@ -40,7 +40,7 @@ sub import {
my $pkg = shift;
my $feature;
local $Gimp::in_query=1;
local $Gimp::in_query=($ARGV[0] eq "-gimp");
while(defined (my $feature = shift)) {
$feature=~s/^://;
need($feature);
@ -73,7 +73,7 @@ sub present {
} elsif ($_ eq "perl-5.005") {
$] >= 5.005;
} elsif ($_ eq "pdl") {
eval { require PDL }; $@ eq "" && $PDL::VERSION>=1.9906;
require Gimp::Config; $Gimp::Config{DEFINE1} =~ /HAVE_PDL/;
} elsif ($_ eq "gnome") {
eval { require Gnome }; $@ eq "";
} elsif ($_ eq "gtkxmhtml") {

View File

@ -320,8 +320,8 @@ sub interact($$$$@) {
$a=new Gtk::HBox (0,5);
my $b=new Gimp::UI::ColorSelectButton -width => 90, -height => 18;
$a->pack_start ($b,1,1,0);
$value = [216, 152, 32] unless defined $value;
push(@setvals,sub{$b->set('color', "@{Gimp::canonicalize_color $_[0]}")});
$default = [216, 152, 32] unless defined $default;
push(@setvals,sub{$b->set('color', "@{defined $_[0] ? Gimp::canonicalize_color $_[0] : [216,152,32]}")});
push(@getvals,sub{[split ' ',$b->get('color')]});
set_tip $t $b,$desc;
@ -1106,7 +1106,7 @@ sub print_switches {
}
sub main {
$old_trace = Gimp::set_trace (0);
$old_trace = Gimp::set_trace (0);#d#
if ($Gimp::help) {
my $this=this_script;
print <<EOF;

View File

@ -35,17 +35,6 @@ sub import {}
bootstrap Gimp::Lib $VERSION;
# various functions for 1.0 compatibility
sub gimp_progress_init {
if (@_<2) {
goto &_gimp_call_procedure;
} else {
eval { gimp_call_procedure "gimp_progress_init",@_ };
gimp_call_procedure "gimp_progress_init",shift if $@;
}
}
# functions to "autobless" where the autobless mechanism
# does not work.
@ -61,28 +50,6 @@ sub gimp_image_get_channels {
map _autobless($_,&Gimp::PARAM_CHANNEL),gimp_call_procedure "gimp_image_get_channels",@_;
}
sub gimp_gdrawable_width { $_[0]->{_width} }
sub gimp_gdrawable_height { $_[0]->{_height} }
sub gimp_gdrawable_ntile_rows { $_[0]->{_ntile_rows} }
sub gimp_gdrawable_ntile_cols { $_[0]->{_ntile_cols} }
sub gimp_gdrawable_bpp { $_[0]->{_bpp} }
sub gimp_gdrawable_id { $_[0]->{_id} }
sub gimp_pixel_rgn_x { $_[0]->{_x} }
sub gimp_pixel_rgn_y { $_[0]->{_y} }
sub gimp_pixel_rgn_w { $_[0]->{_w} }
sub gimp_pixel_rgn_h { $_[0]->{_h} }
sub gimp_pixel_rgn_rowstride { $_[0]->{_rowstride} }
sub gimp_pixel_rgn_bpp { $_[0]->{_bpp} }
sub gimp_pixel_rgn_shadow { $_[0]->{_shadow} }
sub gimp_pixel_rgn_drawable { $_[0]->{_drawable} }
sub gimp_tile_ewidth { $_[0]->{_ewidth} }
sub gimp_tile_eheight { $_[0]->{_eheight} }
sub gimp_tile_bpp { $_[0]->{_bpp} }
sub gimp_tile_shadow { $_[0]->{_shadow} }
sub gimp_tile_gdrawable { $_[0]->{_gdrawable} }
# "server-side" perl code evaluation
sub server_eval {
my @res = eval shift;
@ -90,19 +57,25 @@ sub server_eval {
@res;
}
# be careful not to require AUTOLOAD here
sub Gimp::PixelRgn::DESTROY {
my $self = shift;
return unless $self =~ /=HASH/;
gimp_call_procedure "gimp_drawable_update",$self->{_drawable}->{_id},$self->{_x},$self->{_y},$self->{_w},$self->{_h}
if gimp_pixel_rgn_dirty($self);
};
# this is here to be atomic over the perl-server
sub _gimp_append_data($$) {
gimp_set_data ($_[0], gimp_get_data ($_[0]) . $_[1]);
}
# convinience functions
sub gimp_drawable_pixel_rgn($$$$$$) {
Gimp::gimp_pixel_rgn_init(@_);
}
sub gimp_progress_init {
if (@_<2) {
goto &_gimp_progress_init;
} else {
eval { gimp_call_procedure "gimp_progress_init",@_ };
gimp_call_procedure "gimp_progress_init",shift if $@;
}
}
1;
__END__

File diff suppressed because it is too large Load Diff

View File

@ -33,7 +33,8 @@ $GIMP_INC_NOUI = "-I../../.. $GIMP_INC_NOUI" if $IN_GIMP;
WriteMakefile(
'NAME' => 'Gimp::Lib',
'VERSION_FROM' => '../Gimp.pm',
'INC' => "$INC1 $GIMP_INC_NOUI $CPPFLAGS $CFLAGS",
'INC' => "$INC1 $GIMP_INC_NOUI $CPPFLAGS $pdl_inc $CFLAGS",
'DEFINE' => "$DEFINE1 $DEFS",
'macro' => { libdir => $libdir, exec_prefix => $exec_prefix, prefix => $prefix },
'TYPEMAPS' => ["$topdir/typemap",@pdl_typemaps],
);

View File

@ -166,7 +166,7 @@ that are checked are shown as well (the null prefix "" is implicit).
=item GDrawable
gimp_drawable_
gimp_gdrawable_
=item Brushes

View File

@ -2,72 +2,8 @@ package Gimp::PDL;
use Carp;
use Gimp ();
use PDL;
sub Gimp::Tile::set_data($) {
(my $p = byte $_[1])->make_physical;
Gimp::Tile::_set_data($_[0],${$p->get_dataref});
};
sub Gimp::Tile::get_data($) {
my($tile)=@_;
my($pdl)=new_from_specification PDL (byte,width(),height(),
$tile->bpp > 1 ? $tile->bpp : ());
${$pdl->get_dataref} = Gimp::Tile::_get_data(@_);
$pdl->upd_data;
return $pdl;
};
sub Gimp::PixelRgn::get_pixel {
my($rgn)=@_;
my($pdl)=new_from_specification PDL (byte,$_[0]->bpp);
${$pdl->get_dataref} = Gimp::PixelRgn::_get_pixel(@_);
$pdl->upd_data;
return $pdl;
};
sub Gimp::PixelRgn::get_col {
my($rgn)=@_;
my($pdl)=new_from_specification PDL (byte,$_[0]->bpp,$_[3]);
${$pdl->get_dataref} = Gimp::PixelRgn::__get_col(@_);
$pdl->upd_data;
return $pdl;
};
sub Gimp::PixelRgn::get_row {
my($rgn)=@_;
my($pdl)=new_from_specification PDL (byte,$_[0]->bpp,$_[3]);
${$pdl->get_dataref} = Gimp::PixelRgn::_get_row(@_);
$pdl->upd_data;
return $pdl;
};
sub Gimp::PixelRgn::get_rect {
my($pdl)=new_from_specification PDL (byte,$_[0]->bpp,$_[3],$_[4]);
${$pdl->get_dataref} = Gimp::PixelRgn::_get_rect(@_);
$pdl->upd_data;
return $pdl;
};
sub Gimp::PixelRgn::set_pixel {
(my $p = byte $_[1])->make_physical;
Gimp::PixelRgn::_set_pixel($_[0],${$p->get_dataref},$_[2],$_[3]);
};
sub Gimp::PixelRgn::set_col {
(my $p = byte $_[1])->make_physical;
Gimp::PixelRgn::_set_col($_[0],${$p->get_dataref},$_[2],$_[3]);
};
sub Gimp::PixelRgn::set_row {
(my $p = byte $_[1])->make_physical;
Gimp::PixelRgn::_set_row($_[0],${$p->get_dataref},$_[2],$_[3]);
};
sub Gimp::PixelRgn::set_rect {
(my $p = byte $_[1])->make_physical;
Gimp::PixelRgn::_set_rect($_[0],${$p->get_dataref},$_[2],$_[3],($_[1]->dims)[1]);
};
warn "use'ing Gimp::PDL is no longer necessary, please remove it\n";
1;
__END__
@ -75,6 +11,7 @@ __END__
=head1 NAME
Gimp::PDL - Overwrite Tile/Region functions to work with piddles.
This module is obsolete, please remove any references to it.
=head1 SYNOPSIS

View File

@ -250,6 +250,19 @@ sub gimp_text_wh {
=pod
=item C<gimp_drawable_mask $drawable>
returns an array (x,y,w,h) containing the upper left corner and the size of the
current mask, just as needed by pixelrgn and similar functions.
=cut
sub gimp_drawable_mask {
my @b = (shift->mask_bounds)[1..4];
(@b[0,1],$b[2]-$b[0],$b[3]-$b[1]);
}
=pod
=item C<gimp_image_layertype $alpha>
returns the corresponding layer type for an image, alpha controls wether the layer type

View File

@ -93,3 +93,4 @@ examples/billboard
examples/mirrorsplit
examples/oneliners
examples/randomart1
examples/colourtoalpha

View File

@ -35,6 +35,7 @@ if ($ARGV[0] ne "--writemakefile") {
$ENV{IN_GIMP}=0;
exit system("./etc/configure",@ARGV)>>8;
} else {
local $do_config_msg = 1;
do './config.pl'; die $@ if $@;
}
@ -82,7 +83,6 @@ EOF
}
eval "use Gtk;"; $GTK = $@ eq "";
eval "use PDL;"; $PDL = $@ eq "";
eval "use Parse::RecDescent;"; $PRD = $@ eq "";
$] >= 5.005 or print <<EOF;
@ -107,25 +107,6 @@ WARNING: unable to use the Perl-Gtk interface. Most features (like
EOF
$PDL or print <<EOF;
WARNING: unable to use PDL (the perl data language). This means that
Gimp::PDL is non-functional. Unless you plan to use Tile/PixelRgn
functions together with PDL, this is harmless. Gimp::PDL will
be installed, just in case you later install PDL. The plug-ins
using PDL, however, will NOT WORK. You can get PDL from any CPAN
mirror.
EOF
!$PDL or $PDL::Version::VERSION > 1.99 or print <<EOF;
WARNING: PDL version $PDL::Version::VERSION is installed. Gimp::PDL was only
tested with 2.0 and higher. In case of problems its advisable to
upgrade PDL to at least version 2.
EOF
$PRD or print <<EOF;
WARNING: Parse::RecDescent is not installed (correctly) on your system. This

View File

@ -5,22 +5,21 @@ shortcuts (don't ask)
gimp -b "(extension-perl-server 0 0 0)"
gimp ~/pix/ka001.jpg -b "(extension-perl-server 0 0 0)"
file:///usr/app/lib/perl5/site_perl/i686-linux/PDL/HtmlDocs/
file:///usr/app/lib/perl5/site_perl/i686-linux/PDL/HtmlDocs/PDL/
make test TEST_VERBOSE=1
bugs
* fatal errors in config.pl (!)
* disable module build (EMBEDMYALLOC)
* turn -1 into undef and vice versa.
[DONE] * turn -1 into undef and vice versa.
* perl module install dependency
* not calling unload -> coredump
* $Config{cc} might not understand Gimps CFLAGS (-mpentium).
[DONE] * do NOT modinstall with older gimp versions (!!!!!!!!!)
* improve examples/example-*.pl
[KILL] * install in /usr/local (???? why? more options??)
[DONE] * install even without Gtk? NO!
* wait for working gimp_file_load (or do it myself?)
* get rid of xs_exit. please please fuck me plenty.
[KILL] * do not install scm2scm and scm2perl on 56.004
* create gimpstyle.pod
* get rid of ':auto'
@ -35,25 +34,21 @@ important issues
* implement CALLBACKS via the Perl-Server
* PF_COORDS (just as Light Effects/FlareFX)
* PF_PREVIEW(!)
[DONE] * --use-interp=perl|script-fu
* change set_usize to something else..
* Gimp::IO (?)
* Gimp::Fu import after Gimp? use Gimp::main for Gimp::Fu??
[DONE] * generic config query mechanism
* install scripts in share/
* register dummy function to calm gimp down (really??)
[DONE] * config options & paths in module(!)
* gimp->object_id, drawable_object_id remove!
* vamp up homepage
* --ui and --noui for Gimp::Fu
* Gimp::ping
[KILL] * clean up PKG_ANY vs. PKG_REAL_DRAWABLE
* allow plug-ins to register with only a drawable argument(!)
(fix this in Gimp)
* gradient button
* implement Perl-Server RSET and shared lock(!)
* use Gimp qw(GIMP_HOST=jfjf)???
* zero-copy PDL support
[DONE] * zero-copy PDL support
* weighted movement in drawing tools
* -DMIN_PERL_DEFINE
* --function localfunc to select one of the registered scripts
@ -70,8 +65,8 @@ long term issues and ideas
* default function parameters (with hash %defaults?)
* gimp_text(text => "hallo", family => "engraver", size => 20);
* do not know how to sensibly convert these => perl is NOT C.
gimp_pixel_rgns_register(nrgns, ...)
gimp_pixel_rgns_process(pri_ptr)
[DONE] * do not know how to sensibly convert these => perl is NOT C.
[DONE]
[DONE] gimp_pixel_rgns_register(nrgns, ...)
[DONE] gimp_pixel_rgns_process(pri_ptr)

View File

@ -4,6 +4,8 @@ $topdir=".";
$topdir.="/.." while ! -f "$topdir/MANIFEST";
$^W=0;
%cfg = (
_CPPFLAGS => q[@CPPFLAGS@],
_CFLAGS => q[@CFLAGS@],
@ -77,6 +79,54 @@ if (!$IN_GIMP) {
$cfg{_DEFS} = $DEFS;
# $...1 variables should be put in front of the corresponding MakeMaker values.
$INC1 = "-I$topdir";
$DEFINES1 = $IN_GIMP ? "-DIN_GIMP" : "";
$INC1 = "-I$topdir";
$DEFINE1 = $IN_GIMP ? "-DIN_GIMP" : "";
eval "use PDL;";
if (!$@) {
if ($PDL::Version::VERSION > 1.99) {
require PDL::Core::Dev;
if (!$@) {
$PDL=1;
} else {
$do_config_msg && print <<EOF;
ERROR: PDL::Core::Dev module not found ($@),
this is an error in your PDL installation.
EOF
}
} else {
$do_config_msg && print <<EOF;
WARNING: PDL version $PDL::Version::VERSION is installed. Gimp::PDL was only
tested with 2.0 and higher. In case of problems its advisable to
upgrade PDL to at least version 2.
EOF
}
} else {
$do_config_msg && print <<EOF;
WARNING: unable to use PDL (the perl data language). This means that
Gimp::PDL is non-functional. Unless you plan to use Tile/PixelRgn
functions together with PDL, this is harmless. The plug-ins using
PDL, however, will NOT WORK and you can NO LONGER install PDL
later. You can get PDL from any CPAN mirror.
EOF
}
$do_config_msg && print "checking for PDL support... ", $PDL ? "yes":"no","\n";
if ($PDL) {
$do_config_msg && print "checking for PDL include path... ",&PDL::Core::Dev::PDL_INCLUDE,"\n";
$do_config_msg && print "checking for PDL typemap... ",&PDL::Core::Dev::PDL_TYPEMAP,"\n";
$cfg{pdl_inc} = $pdl_inc = &PDL::Core::Dev::PDL_INCLUDE;
$cfg{pdl_typemaps } = "@{[@pdl_typemaps = &PDL::Core::Dev::PDL_TYPEMAP]}";
$DEFINE1 .= " -DHAVE_PDL=1";
}
$cfg{INC1} = $INC1;
$cfg{DEFINE1} = $DEFINE1;

View File

@ -5,7 +5,6 @@
use Gimp::Feature qw(pdl);
use Gimp;
use Gimp::Fu;
use Gimp::PDL;
use PDL::LiteF;
# Gimp::set_trace(TRACE_ALL);

View File

@ -1,16 +1,10 @@
#!/usr/bin/perl
BEGIN { $^W=1 }
use strict;
use Gimp::Feature qw(pdl);
use PDL;
BEGIN { eval "use PDL::Graphics::TriD"; $@ and Gimp::Feature::missing('PDL TriD (OpenGL) support') }
use Gimp;
use Gimp::Fu;
use PDL::Math;
use PDL::Core;
use PDL;
use Gimp::PDL;
register
'view3d',
@ -18,7 +12,7 @@ register
'This script uses PDL::Graphics:TriD to view a grayscale drawable in 3D. You can choose a Cartesian (default) or Polar projection, toggle the drawing of lines, and toggle normal smoothing.',
'Tom Rathborne', 'GPLv2', '1999-03-11',
'<Image>/View/3D Surface',
'GRAY', [
'RGB*,GRAY*', [
[ PF_BOOL, 'polar', 'Radial view', 0],
[ PF_BOOL, 'lines', 'Draw grid lines', 0],
[ PF_BOOL, 'smooth', 'Smooth surface normals', 1]
@ -29,10 +23,9 @@ sub {
my $w = $dwb->width;
my $h = $dwb->height;
my $gdwb = $dwb->get;
my $regn = $gdwb->pixel_rgn (0, 0, $w, $h, 0, 0);
my $rect = $regn->get_rect (0, 0, $w, $h);
my $surf = $rect->slice('(0)');
my $regn = $dwb->pixel_rgn (0, 0, $w, $h, 0, 0);
my $surf = $regn->get_rect (0, 0, $w, $h);
$surf=$surf->slice("(0)") if $surf->getndims>2;
imag3d [ $polar ? 'POLAR2D' : 'SURF2D', $surf ],
{ 'Lines' => $lines, 'Smooth' => $smooth };

View File

@ -20,6 +20,8 @@ GPixelRgn * T_PIXELRGN
GtkWidget * T_IV
GPixelRgnIterator T_PTROBJ
IMAGE T_PREF
LAYER T_PREF
COLOR T_PREF
@ -50,3 +52,5 @@ OUTPUT
T_PREF
$arg = autobless (newSViv($var), PARAM_$ntype);
T_GDRAWABLE