See plug-ins/perl/Changes

This commit is contained in:
Marc Lehmann 1998-11-04 01:46:23 +00:00
parent e6a88085c1
commit 0a9b89edf7
6 changed files with 52 additions and 21 deletions

View File

@ -1,5 +1,12 @@
Revision history for Gimp-Perl extension.
- the syntax really gets tricky - references to INT32 and similar
types are no longer accepted (was buggy anyway).
- added plug_in_ prefix to layer, darwable, image and channel. We
can now write $layer->sharpen(50), and gimp infers function name,
run_mode and image
- enhanced the testuite, it now checks much more features
1.045 Sun Nov 1 23:40:20 CET 1998
- more configuration cleanups
- fixed Gimp::Fu to respect RUN_WITH_LAST_VALS again

View File

@ -294,11 +294,11 @@ sub _pseudoclass {
push(@{"${class}::PREFIXES"} , @prefixes); @prefixes=@{"${class}::PREFIXES"};
}
_pseudoclass qw(Layer gimp_layer_ gimp_drawable_ gimp_floating_sel_ gimp_image_ gimp_);
_pseudoclass qw(Image gimp_image_ gimp_drawable_ gimp_);
_pseudoclass qw(Drawable gimp_drawable_ gimp_layer_ gimp_image_ gimp_);
_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(Selection gimp_selection_);
_pseudoclass qw(Channel gimp_channel_ gimp_drawable_ gimp_selection_ gimp_image_ gimp_);
_pseudoclass qw(Channel gimp_channel_ gimp_drawable_ gimp_selection_ gimp_image_ gimp_ plug_in_);
_pseudoclass qw(Display gimp_display_ gimp_);
_pseudoclass qw(Plugin plug_in_);
_pseudoclass qw(Gradients gimp_gradients_);

View File

@ -616,6 +616,11 @@ push_gimp_sv (GParam *arg, int array_as_ref)
} \
}
#define sv2gimp_extract_noref(fun,str) \
fun(sv); \
if (SvROK(sv)) \
sprintf (croak_str, "Unable to convert a reference to type '%s'\n", str); \
break;
/*
* convert a perl scalar into a GParam, return true if
* the argument has been consumed.
@ -625,19 +630,19 @@ convert_sv2gimp (char *croak_str, GParam *arg, SV *sv)
{
switch (arg->type)
{
case PARAM_INT32: arg->data.d_int32 = SvIV(sv); break;
case PARAM_INT16: arg->data.d_int16 = SvIV(sv); break;
case PARAM_INT8: arg->data.d_int8 = SvIV(sv); break;
case PARAM_FLOAT: arg->data.d_float = SvNV(sv); break;
case PARAM_STRING: arg->data.d_string = SvPv(sv); break;
case PARAM_INT32: arg->data.d_int32 = sv2gimp_extract_noref (SvIV, "INT32");
case PARAM_INT16: arg->data.d_int16 = sv2gimp_extract_noref (SvIV, "INT16");
case PARAM_INT8: arg->data.d_int8 = sv2gimp_extract_noref (SvIV, "INT8");
case PARAM_FLOAT: arg->data.d_float = sv2gimp_extract_noref (SvNV, "FLOAT");;
case PARAM_STRING: arg->data.d_string = sv2gimp_extract_noref (SvPv, "STRING");;
case PARAM_DISPLAY: arg->data.d_display = unbless(sv, PKG_DISPLAY , croak_str); break;
case PARAM_LAYER: arg->data.d_layer = unbless(sv, PKG_ANY , croak_str); break;
case PARAM_CHANNEL: arg->data.d_channel = unbless(sv, PKG_ANY , croak_str); break;
case PARAM_DRAWABLE: arg->data.d_drawable = unbless(sv, PKG_ANY , croak_str); break;
case PARAM_SELECTION: arg->data.d_selection = unbless(sv, PKG_SELECTION, croak_str); break;
case PARAM_BOUNDARY: arg->data.d_boundary = SvIV(sv); break;
case PARAM_PATH: arg->data.d_path = SvIV(sv); break;
case PARAM_STATUS: arg->data.d_status = SvIV(sv); break;
case PARAM_BOUNDARY: arg->data.d_boundary = sv2gimp_extract_noref (SvIV, "BOUNDARY");;
case PARAM_PATH: arg->data.d_path = sv2gimp_extract_noref (SvIV, "PATH");;
case PARAM_STATUS: arg->data.d_status = sv2gimp_extract_noref (SvIV, "STATUS");;
case PARAM_IMAGE:
if (sv_derived_from (sv, PKG_DRAWABLE))
arg->data.d_image = gimp_drawable_image_id (unbless(sv, PKG_DRAWABLE, croak_str));
@ -1053,7 +1058,7 @@ gimp_call_procedure (proc_name, ...)
for (i = 0; i < nparams && j < items-1; i++)
{
args[i].type = params[i].type;
if (i==0 && no_runmode == 2)
if (i == 0 && no_runmode == 2)
args->data.d_int32 = RUN_NONINTERACTIVE;
else if ((!SvROK(ST(j+1)) || i >= nparams-1 || !is_array (params[i+1].type))
&& convert_sv2gimp (croak_str, &args[i], ST(j+1)))
@ -1063,7 +1068,7 @@ gimp_call_procedure (proc_name, ...)
{
if (!no_runmode)
{
croak_str [0]=0;
croak_str [0] = 0;
break;
}

View File

@ -97,12 +97,14 @@ that are checked are shown as well (the null prefix "" is implicit).
gimp_floating_sel_
gimp_image_
gimp_
plug_in_
=item Image
gimp_image_
gimp_drawable_
gimp_
plug_in_
=item Drawable
@ -110,6 +112,7 @@ that are checked are shown as well (the null prefix "" is implicit).
gimp_layer_
gimp_image_
gimp_
plug_in_
=item Selection
@ -122,6 +125,7 @@ that are checked are shown as well (the null prefix "" is implicit).
gimp_selection_
gimp_image_
gimp_
plug_in_
=item Display

View File

@ -19,12 +19,14 @@ bugs
important issues
* gradient button
* do not special-case INT32 in convert_sv2gimp
* substr 4th argument form for Net:: -> require 5.005!!!! DO IT!
* use Gimp qw(GIMP_HOST=jfjf)???
* brushes look inverted
* zero-copy PDL support
[DONE] * gimp_init, gimp_deinit
* duplicate HAVE_VPRINTF in gimp
[DONE] * duplicate HAVE_VPRINTF in gimp
* get rid of superfluous image arguments
* weighted movement in drawing tools
* -DMIN_PERL_DEFINE

View File

@ -5,7 +5,7 @@ use vars qw($EXTENSIVE_TESTS $GIMPTOOL);
# difficult at best...
BEGIN {
plan tests => 17;
plan tests => 25;
}
END {
@ -29,18 +29,30 @@ skip($n,sub {($plugins = `$GIMPTOOL -n --install-admin-bin /bin/sh`) =~ s{^.*\s(
skip($n,sub {-d $plugins});
skip($n,sub {-x "$plugins/script-fu"});
use Gimp qw(:consts);
use Gimp;
$loaded = 1;
ok(1);
ok(RGBA_IMAGE || RGB_IMAGE);
ok(RGB_IMAGE ? 1 : 1); # this shouldn't be a pattern match(!)
sub net {
my($i,$l);
skip($n,sub{$i=new Image(300,300,RGB)});
skip($n,sub{$i=new Image(10,10,RGB)});
skip($n,ref $i);
skip($n,sub{$l=$i->layer_new(300,300,RGBA_IMAGE,"new layer",100,VALUE_MODE)});
skip($n,sub{$l=$i->layer_new(10,10,RGBA_IMAGE,"new layer",100,VALUE_MODE)});
skip($n,ref $l);
skip($n,sub{$i->add_layer($l,0)||1});
skip($n,sub{gimp_image_add_layer($l,0) || 1});
skip($n,sub{$l->get_name()},"new layer");
skip($n,sub{$l->paintbrush(50,[1,1,2,2,5,3,7,4,2,8]) || 1});
skip($n,sub{$l->paintbrush(30,4,[5,5,8,1]) || 1});
skip($n,sub{Plugin->sharpen(RUN_NONINTERACTIVE,$i,$l,10) || 1});
skip($n,sub{$l->sharpen(10) || 1});
skip($n,sub{plug_in_sharpen($i,$l,10) || 1});
skip($n,sub{$i->delete || 1});
}
@ -48,6 +60,7 @@ system("rm","-rf",$dir); #d#FIXME
ok(sub {mkdir $dir,0700});
ok(sub {symlink "../Perl-Server","$dir/Perl-Server"});
skip($n,sub {symlink "$plugins/script-fu","$dir/script-fu"});
skip($n,sub {symlink "$plugins/sharpen","$dir/sharpen"});
ok (
open RC,">$dir/gimprc" and
@ -61,7 +74,7 @@ $Gimp::host = "spawn/";
if(!$n) {
skip($n,1);
Gimp->main;
main;
} else {
skip($n,0);
net();