Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
GIMP
Commits
d1185c80
Commit
d1185c80
authored
Feb 14, 1999
by
Marc Lehmann
Browse files
see plug-ins/perl/Changes
parent
c22e2717
Changes
10
Hide whitespace changes
Inline
Side-by-side
plug-ins/perl/Changes
View file @
d1185c80
...
...
@@ -2,6 +2,13 @@ Revision history for Gimp-Perl extension.
- more errornous argument types are detected now, without
just calling abort().
- fixed a MAJOR namespace-leak: for example, if one used
gimp_parasite_list once, Gimp::Image->parasite_list would call
gimp_parasite_list and NOT gimp_image_parasite_list, as would be
correct.
- Gimp::Net now works correctly with parasites.
- added examples/parasite_editor
- added gimp_ prefix to Parasite-class
1.052 Tue Feb 9 18:16:15 CET 1999
- moved the xlfd_size function from Gimp::Fu into Gimp
...
...
@@ -416,9 +423,10 @@ Revision history for Gimp-Perl extension.
0.80 Fri Feb 13 17:15:48 CET 1998
- version 1.0 is the first one generally usable.. we're getting
- close! Gimp::Net and Gimp::Lib are only internal modules, there
is not much of a distinction between networked modules and modules
using libgimp!
close!
- Gimp::Net and Gimp::Lib are only internal modules, there is not
much of a distinction between networked modules and modules
using libgimp!
- Gimp::OO usable over the network.
0.07 Thu Feb 12 06:51:56 CET 1998
...
...
plug-ins/perl/Gimp.pm
View file @
d1185c80
...
...
@@ -345,18 +345,19 @@ sub AUTOLOAD {
goto
&$AUTOLOAD
;
}
}
# for performance reasons: supply a DESTROY method
if
(
$name
eq
"
DESTROY
")
{
*
{
$AUTOLOAD
}
=
sub
{};
return
;
}
croak
"
function/macro
\"
$name
\"
not found in
$class
";
}
# FIXME: why is this necessary? try to understand, hard!
sub
DESTROY
{
}
sub
_pseudoclass
{
my
(
$class
,
@prefixes
)
=
@_
;
unshift
(
@prefixes
,"");
*
{"
Gimp::
${class}
::AUTOLOAD
"}
=
\
&AUTOLOAD
;
push
(
@
{"
${class}
::ISA
"}
,
"
Gimp::
${class}
");
push
(
@
{"
Gimp::
${class}
::ISA
"}
,
'
Gimp
');
push
(
@
{"
Gimp::
${class}
::PREFIXES
"}
,
@prefixes
);
@prefixes
=
@
{"
Gimp::
${class}
::PREFIXES
"};
push
(
@
{"
${class}
::PREFIXES
"}
,
@prefixes
);
@prefixes
=
@
{"
${class}
::PREFIXES
"};
}
...
...
@@ -372,7 +373,7 @@ _pseudoclass qw(Gradients gimp_gradients_);
_pseudoclass
qw(Edit gimp_edit_)
;
_pseudoclass
qw(Progress gimp_progress_)
;
_pseudoclass
qw(Region )
;
_pseudoclass
qw(Parasite parasite_)
;
_pseudoclass
qw(Parasite parasite_
gimp_
)
;
# "C"-Classes
_pseudoclass
qw(GDrawable gimp_drawable_)
;
...
...
@@ -415,7 +416,7 @@ sub DESTROY {
my
$self
=
shift
;
$self
->
{
_drawable
}
->
{
_id
}
->
update
(
$self
->
{
_x
},
$self
->
{
_y
},
$self
->
{
_w
},
$self
->
{
_h
})
if
$self
->
{
_dirty
};
}
}
;
package
Gimp::
Parasite
;
...
...
@@ -425,8 +426,6 @@ sub is_error($) { $_[0]->is_type("error") }
sub
error
($)
{
["
error
",
0
,
""]
}
sub
copy
($)
{
[
@
{
$_
[
0
]}]
}
sub
DESTROY
{}
package
Gimp
;
# for __DATA__
1
;
...
...
plug-ins/perl/Gimp/Fu.pm
View file @
d1185c80
...
...
@@ -294,7 +294,7 @@ sub interact($$$@) {
# signal_connect $c "clicked", sub {$res = 2; main_quit Gtk};
## $g->attach($c,1,2,$res,$res+1,{},{},4,2);
# $a->pack_start ($c,1,1,0);
# set_tip $t $c,"Load an image into the Gimp
(NYI)
";
# set_tip $t $c,"Load an image into the Gimp";
}
elsif
(
$type
==
PF_LAYER
)
{
my
$res
;
...
...
@@ -589,10 +589,10 @@ sub query {
=item function name
The pdb name of the function, i.e. the name under which is will be
registered in the Gimp database. If it doesn't start with "perl_fu_"
it will
be prepended. If you don't want this,
prefix your fucntion name with a
single "+". The idea here is that every
Gimp::Fu plug-in will be found under
the common C<perl_fu_>-prefix.
registered in the Gimp database. If it doesn't start with "perl_fu_"
,
"plug_in_" or "extension_", it will
be prepended. If you don't want this,
prefix your function name with a
single "+". The idea here is that every
Gimp::Fu plug-in will be found under
the common C<perl_fu_>-prefix.
=item blurb
...
...
@@ -740,7 +740,7 @@ sub register($$$$$$$$$;@) {
int
(
$p
->
[
0
])
eq
$p
->
[
0
]
or
croak
"
Argument/return value '
$p
->[1]' has illegal type '
$p
->[0]'
";
}
$function
=
"
perl_fu_
"
.
$function
unless
$function
=~
/^perl_fu/
||
$function
=~
s/^\+//
;
$function
=
"
perl_fu_
"
.
$function
unless
$function
=~
/^
(?:
perl_fu
|extension|plug_in)
/
||
$function
=~
s/^\+//
;
*$function
=
sub
{
$run_mode
=
shift
;
# global!
...
...
@@ -931,7 +931,7 @@ sub print_switches {
my
$this
=
this_script
;
print
<<EOF;
interface-arguments are
-o | --output <filespec> write image to disk, then delete
(NYI)
-o | --output <filespec> write image to disk, then delete
-i | --interact let the user edit the values first
script-arguments are
EOF
...
...
plug-ins/perl/Gimp/Net.pm
View file @
d1185c80
...
...
@@ -42,7 +42,7 @@ sub net2args($) {
sub
args2net
{
my
(
$res
,
$v
);
for
$v
(
@
_
)
{
if
(
ref
(
$v
)
eq
"
ARRAY
"
or
ref
(
$v
)
eq
"
Gimp::Color
")
{
if
(
ref
(
$v
)
eq
"
ARRAY
"
or
ref
(
$v
)
eq
"
Gimp::Color
"
or
ref
(
$v
)
eq
"
Gimp::Parasite
"
)
{
$res
.=
"
[
"
.
join
("
,
",
map
{
"
qq[
"
.
quotemeta
(
$_
)
.
"
]
"
}
@$v
)
.
"
],
";
}
elsif
(
ref
(
$v
))
{
$res
.=
"
b(
"
.
$$v
.
"
,
"
.
ref
(
$v
)
.
"
),
";
...
...
plug-ins/perl/Gimp/OO.pod
View file @
d1185c80
...
...
@@ -191,6 +191,7 @@ that are checked are shown as well (the null prefix "" is implicit).
=item Parasite
parasite_
gimp_
=back
...
...
plug-ins/perl/MANIFEST
View file @
d1185c80
...
...
@@ -55,3 +55,4 @@ examples/view3d.pl
examples/feedback.pl
examples/xachlego.pl
examples/xachshadow.pl
examples/parasite-editor
plug-ins/perl/Makefile.PL
View file @
d1185c80
...
...
@@ -116,7 +116,7 @@ EOF
@examples
=
qw(windy.pl prep4gif.pl webify.pl PDB alpha2color.pl tex-to-float ditherize.pl
border.pl view3d.pl feedback.pl xachlego.pl xachshadow.pl)
;
border.pl view3d.pl feedback.pl xachlego.pl xachshadow.pl
parasite-editor
)
;
@shebang
=
(
map
("
examples/
$_
",
@examples
),
qw(Perl-Server scm2perl scm2scm examples/example-net.pl)
);
...
...
plug-ins/perl/examples/parasite-editor
0 → 100755
View file @
d1185c80
#!/usr/app/bin/perl
#BEGIN {$^W=1};
require
5.005
;
use
Gimp
();
use
Gimp::
Fu
;
use
Gtk
;
Gtk
->
init
;
$gtk_10
=
Gtk
->
major_version
==
1
&&
Gtk
->
minor_version
==
0
;
#Gimp::set_trace(TRACE_ALL);
my
$window
;
# the main window
my
$current
;
my
$list_func
,
$find_func
,
$attach_func
,
$detach_func
;
my
$clist
;
my
$name
,
$flags
,
$data
,
$data2
;
sub
escape
{
join
("",
map
{
(
ord
(
$_
)
&
127
)
>
31
?
$_
:
sprintf
"
\\
x%02x
",
ord
(
$_
);
}
split
//
,
shift
);
}
sub
deserialize
{
local
$_
=
shift
;
my
$res
;
eval
{
while
(
length
(
$_
))
{
my
$type
=
unpack
("
C
",
substr
$_
,
0
,
1
,"");
if
(
$type
==
0
)
{
$res
.=
"
END
";
last
;
}
elsif
(
$type
==
1
)
{
$res
.=
"
INT8
"
.
(
unpack
("
C
",
substr
$_
,
0
,
1
,""));
}
elsif
(
$type
==
2
)
{
$res
.=
"
INT16
"
.
(
unpack
("
n
",
substr
$_
,
0
,
2
,""));
}
elsif
(
$type
==
3
)
{
$res
.=
"
INT32
"
.
(
unpack
("
N
",
substr
$_
,
0
,
4
,""));
}
elsif
(
$type
==
101
)
{
$res
.=
"
INT32
"
.
(
unpack
("
N
",
substr
$_
,
0
,
4
,""));
}
else
{
die
"
unknown serialize type
\n
";
}
print
"
RES:
$res
\n
";
print
"
Type =
$type
\n
";
}
};
$@
?
$@
:
$res
;
}
sub
refresh_names
{
$clist
->
clear_items
(
0
,
99999
);
my
@list
=
&$list_func
(
$current
);
for
my
$parasite
(
@list
)
{
my
$item
=
new
Gtk::
ListItem
$parasite
;
$item
->
signal_connect
("
select
"
=>
sub
{
my
(
$par
)
=
&$find_func
(
$current
,
$parasite
);
$name
->
set_text
(
$par
->
[
0
]);
$flags
->
set_text
(
sprintf
"
0x%08x
",
$par
->
[
1
]);
$data
->
set_text
(
escape
$par
->
[
2
]);
$data2
->
set_text
(
deserialize
$par
->
[
2
]);
});
$clist
->
add
(
$item
);
}
$clist
->
show_all
;
}
sub
create_main
{
my
$b
;
my
$t
;
parse
Gtk::
Rc
Gimp
->
gtkrc
;
$t
=
new
Gtk::
Tooltips
;
my
$w
=
new
Gtk::
Dialog
;
$window
=
$w
;
$w
->
set_usize
(
500
,
220
);
$w
->
set_title
('
Parasite Editor
');
$w
->
signal_connect
("
destroy
",
sub
{
main_quit
Gtk
});
$b
=
new
Gtk::
Button
"
Close
";
$w
->
action_area
->
add
(
$b
);
$b
->
signal_connect
("
clicked
",
sub
{
main_quit
Gtk
});
my
$v
=
new
Gtk::
VBox
(
0
,
5
);
$w
->
vbox
->
add
(
$v
);
my
$top
=
new
Gtk::
HBox
(
0
,
5
);
$v
->
add
(
$top
);
my
$bot
=
new
Gtk::
HBox
(
0
,
5
);
$v
->
add
(
$bot
);
$clist
=
new
Gtk::
List
;
my
$cs
=
new
Gtk::
ScrolledWindow
undef
,
undef
;
$cs
->
set_policy
(
-
automatic
,
-
automatic
);
$gtk_10
?
$cs
->
add
(
$clist
)
:
$cs
->
add_with_viewport
(
$clist
);
$bot
->
add
(
$cs
);
my
$parbox
=
new
Gtk::
VBox
(
0
,
5
);
$bot
->
add
(
$parbox
);
$parbox
->
add
(
$name
=
new
Gtk::
Entry
);
$parbox
->
add
(
$flags
=
new
Gtk::
Entry
);
$parbox
->
add
(
$data
=
new
Gtk::
Entry
);
$parbox
->
add
(
$data2
=
new
Gtk::
Entry
);
{
my
$menu
=
new
Gtk::
Menu
;
my
$item
;
my
$subtype
=
new
Gtk::
OptionMenu
;
my
$set_submenu
=
sub
{
my
$submenu
=
new
Gtk::
Menu
;
for
(
@
_
)
{
my
$cur
=
$_
->
[
0
];
my
$item
=
new
Gtk::
MenuItem
$_
->
[
1
];
$item
->
signal_connect
("
activate
"
=>
sub
{
$current
=
$cur
;
refresh_names
});
$submenu
->
append
(
$item
);
}
$subtype
->
set_menu
(
$submenu
);
$submenu
->
show_all
;
if
(
@
_
)
{
$submenu
->
get_active
->
signal_emit
("
activate
");
}
else
{
undef
$current
;
refresh_names
;
}
};
$item
=
new
Gtk::
MenuItem
"
Global
";
my
$act_global
=
sub
{
$list_func
=
sub
{
Gimp
->
parasite_list
};
$find_func
=
sub
{
shift
;
Gimp
->
find_parasite
(
shift
)
};
$attach_func
=
sub
{
shift
;
Gimp
->
attach_parasite
(
shift
)
};
$detach_func
=
sub
{
shift
;
Gimp
->
detach_parasite
(
shift
)
};
&$set_submenu
();
};
$item
->
signal_connect
("
activate
",
$act_global
);
$menu
->
append
(
$item
);
$item
=
new
Gtk::
MenuItem
"
Image
";
$item
->
signal_connect
("
activate
",
sub
{
$list_func
=
sub
{
$_
[
0
]
?
shift
->
parasite_list
:
()
};
$find_func
=
sub
{
shift
->
find_parasite
(
shift
)
};
$attach_func
=
sub
{
shift
->
attach_parasite
(
shift
)
};
$detach_func
=
sub
{
shift
->
detach_parasite
(
shift
)
};
&$set_submenu
(
map
[
$_
,"
$
$_
:
"
.
$_
->
get_filename
],
Gimp
->
list_images
);
});
$menu
->
append
(
$item
);
$item
=
new
Gtk::
MenuItem
"
Drawable
";
$item
->
signal_connect
("
activate
",
sub
{
$list_func
=
sub
{
$_
[
0
]
?
shift
->
parasite_list
:
()
};
$find_func
=
sub
{
shift
->
find_parasite
(
shift
)
};
$attach_func
=
sub
{
shift
->
attach_parasite
(
shift
)
};
$detach_func
=
sub
{
shift
->
detach_parasite
(
shift
)
};
&$set_submenu
(
map
[
$_
,
$_
->
image
->
get_filename
.
"
/
"
.
(
$_
->
layer
?
$_
->
layer_get_name
:
$_
->
channel_get_name
)],
map
((
$_
->
get_layers
,
$_
->
get_channels
),
Gimp
->
list_images
));
});
$menu
->
append
(
$item
);
my
$type
=
new
Gtk::
OptionMenu
;
$type
->
set_menu
(
$menu
);
$top
->
add
(
$type
);
$top
->
add
(
$subtype
);
&$act_global
;
}
show_all
$w
;
}
register
"
extension_parasite_editor
",
"
Parasite Editor
",
"
This plug-in can be used to view (and in a future version edit) existing parasites
",
"
Marc Lehmann
",
"
Marc Lehmann
",
"
0.1
",
"
<Toolbox>/Xtns/Parasite Editor
",
"",
[]
,
sub
{
create_main
;
main
Gtk
;
();
};
exit
main
;
plug-ins/perl/examples/xachlego.pl
View file @
d1185c80
...
...
@@ -24,13 +24,14 @@
# gimp is cleaning up this memory on its own...
# 1.2: Fixed buggy selection handling - oops ;)
# 1.3: Added undo capability by Marc Lehman <pcg@goof.com>
# 1.4: Marc Lehman <pcg@goof.com>, changed function name
# Here's the boring start of every script...
use
Gimp
;
use
Gimp::
Fu
;
register
"
X
ach
B
locks
",
register
"
x
ach
_b
locks
",
"
Xach's Blocks o' Fun
",
"
Turn your picture into something that resembles a certain trademarked
building block creation
",
...
...
plug-ins/perl/examples/xachshadow.pl
View file @
d1185c80
...
...
@@ -14,18 +14,19 @@
# and working from the bottom up..
# Revision 1.1: Marc Lehman <pcg@goof.com> added undo capability
# Revision 1.2: Marc Lehman <pcg@goof.com>, changed function name
# Here's the boring start of every script...
use
Gimp
;
use
Gimp::
Fu
;
register
"
X
ach
S
hadows
",
register
"
x
ach
_s
hadows
",
"
Xach's Shadows o' Fun
",
"
Screen of 50% of your drawing into a dropshadowed layer.
",
"
Seth Burgess
",
"
Seth Burgess
",
"
1.
1
",
"
1.
2
",
"
<Image>/Filters/Misc/Xach Shadows
",
"
RGB*, GRAY*
",
[
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment