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
adcd4819
Commit
adcd4819
authored
Feb 07, 1999
by
Marc Lehmann
Browse files
see plug-ins/perl/Changes
parent
0fe096b2
Changes
13
Hide whitespace changes
Inline
Side-by-side
plug-ins/perl/Changes
View file @
adcd4819
...
...
@@ -7,6 +7,8 @@ Revision history for Gimp-Perl extension.
- improved handling of "make clean" to make it less perl-ish
and more gnu-ish
- enabled full testsuite (keep your fingers crossed)
- PDL examples no longer cause errors at startup
- more compatibility fixes for 5.005_54
1.051 Tue Jan 19 21:10:20 CET 1999
- corrected a minor typoe found by Stefan Traby <stefan@sime.com>
...
...
plug-ins/perl/Gimp/Fu.pm
View file @
adcd4819
...
...
@@ -924,7 +924,9 @@ sub print_switches {
*main
=
*gimp_main
=
sub
{
if
(
!
@scripts
)
{
die
"
well, there are no scripts registered.. what do you expect?
\n
";
# it is now legal to register no scripts (i.e. when PDL is required but not found
#die "well, there are no scripts registered.. what do you expect?\n";
Gimp::
main
;
}
elsif
(
$
Gimp::
help
)
{
my
$this
=
this_script
;
print
<<EOF;
...
...
plug-ins/perl/Gimp/Lib.xs
View file @
adcd4819
...
...
@@ -33,6 +33,9 @@
#ifndef dTHR
#define dTHR
#endif
#ifndef PL_sv_undef
#define PL_sv_undef sv_undef
#endif
/* dirty is used in gimp.h AND in perl < 5.005 or with PERL_POLLUTE. */
#ifdef dirty
...
...
@@ -557,7 +560,7 @@ push_gimp_sv (GParam *arg, int array_as_ref)
case PARAM_STATUS: sv = newSViv(arg->data.d_status ); break;
case PARAM_STRING:
sv = arg->data.d_string ? neuSVpv(arg->data.d_string)
: &sv_undef;
: &
PL_
sv_undef;
break;
case PARAM_COLOR:
...
...
@@ -1331,7 +1334,7 @@ gimp_get_data(id)
RETVAL = data;
}
else
RETVAL = &sv_undef;
RETVAL = &
PL_
sv_undef;
}
#endif
}
...
...
plug-ins/perl/MANIFEST
View file @
adcd4819
...
...
@@ -51,3 +51,6 @@ examples/windy.pl
examples/prep4gif.pl
examples/ditherize.pl
examples/view3d.pl
examples/feedback.pl
examples/xachlego.pl
examples/xachshadow.pl
plug-ins/perl/Makefile.PL
View file @
adcd4819
...
...
@@ -114,7 +114,7 @@ EOF
sub
MY
::postamble {
(
my
$GIMPTOOL2
=
$GIMPTOOL
)
=~
s/^\.\./..\/../
;
<<"EOF";
my
$postamble
=
<<"EOF";
objclean :: clean
maintainer-clean :: realclean
...
...
@@ -125,19 +125,14 @@ clean ::
test -f Makefile || mv -f Makefile.old Makefile
install :: install-plugins
$GIMPTOOL --install-admin-bin Perl-Server
install-plugins:
$GIMPTOOL --install-admin-bin Perl-Server
-cd examples && $GIMPTOOL2 --install-admin-bin windy.pl
-cd examples && $GIMPTOOL2 --install-admin-bin prep4gif.pl
-cd examples && $GIMPTOOL2 --install-admin-bin webify.pl
-cd examples && $GIMPTOOL2 --install-admin-bin PDB
-cd examples && $GIMPTOOL2 --install-admin-bin alpha2color.pl
-cd examples && $GIMPTOOL2 --install-admin-bin tex-to-float
-cd examples && $GIMPTOOL2 --install-admin-bin ditherize.pl
-cd examples && $GIMPTOOL2 --install-admin-bin border.pl
-cd examples && $GIMPTOOL2 --install-admin-bin view3d.pl
EOF
$postamble
.
join
("",
map
"
-cd examples &&
$GIMPTOOL2
--install-admin-bin
$_
\n
",
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)
);
}
WriteMakefile
(
...
...
plug-ins/perl/TODO
View file @
adcd4819
...
...
@@ -12,16 +12,9 @@ bugs
* auto-edit shebang
* only install plug-ins that really work
[DONE] * gimptool 1.0 doesn't support -n or --noui
* perl_fu_webify in homepage-logo.pl
[????] * save_image should be called for non-null return values
[DONE] * drawable is compatible to layer AND VICE VERSA (convert_sv2gimp)
[DONE] * enable t/run.t again (but how? different solutions
for gimp-1.0 and gimp-1.1???)
* wait for working gimp_file_load (or do it myself?)
[DONE] * block display_new &c when Net and --noui
* Gimp::import should croak on importing "garbage".
[DONE] * memory leak on croak()? de-croakify the code!
important issues
...
...
@@ -32,27 +25,20 @@ important issues
* --ui and --noui for Gimp::Fu
* [PF_CUSTOM]
* Gimp::ping
[DONE] * Gimp::Net::get_connection ();
[DONE] * Gimp::Net::set_connection ($conn);
* clean up PKG_ANY vs. PKG_REAL_DRAWABLE
* allow plug-ins to register with only a drawable argument(!)
(fix this in Gimp)
* provide propper overwriting in Gimp::Net::pixel-_rgn ;(
[DONE] * gimp_blend && 15 doesn't work
* gradient button
* implement Perl-Server RSET and shared lock(!)
[DONE] * do not special-case INT32 in convert_sv2gimp
* substr 4th argument form for Net:: -> require 5.005!!!! DO IT! PLEASE!!!!
* use Gimp qw(GIMP_HOST=jfjf)???
[DONE] * brushes are inverted
* zero-copy PDL support
[DONE] * gimp_init, gimp_deinit
* weighted movement in drawing tools
* -DMIN_PERL_DEFINE
* --function localfunc to select one of the registered scripts
* brush etc. buttons (maybe use gimp's interface, but
only when local(?))
[DONE] * help button ;)
* create working progress when Net and $verbose
* require Storable soon(!)
* Gimp::Fu::command(?)
...
...
plug-ins/perl/examples/PDB
View file @
adcd4819
...
...
@@ -9,6 +9,10 @@ use Gimp::Fu;
use
Gtk
;
use
Gtk::
Gdk
;
Gtk
->
init
;
$gtk_10
=
Gtk
->
major_version
==
1
&&
Gtk
->
minor_version
==
0
;
#Gimp::set_trace(TRACE_ALL);
my
$window
;
# the main window
...
...
@@ -106,10 +110,10 @@ sub complete_function {
my
@matches
=
sort
grep
/$name/i
,
@function
;
if
(
@matches
>
70
)
{
set_clist
map
((
$_
,
$_
),
@matches
[
0
..
69
]);
$synopsis
->
set
(
1
,
"
showing only the first 70 matches (of
"
.
scalar
@matches
.
"
)
");
$synopsis
->
set
("
showing only the first 70 matches (of
"
.
(
scalar
@matches
)
.
"
)
");
}
elsif
(
@matches
>
1
)
{
set_clist
map
((
$_
,
$_
),
@matches
);
$
s
synopsis
->
set
(
1
,
scalar
@matches
.
"
matching functions
");
$synopsis
->
set
(
scalar
@matches
.
"
matching functions
");
}
else
{
set_clist
@matches
,
@matches
;
$synopsis
->
set
(
$matches
[
0
]
.
"
(press F1 to complete)
");
...
...
@@ -229,7 +233,8 @@ sub inputline {
do_idle
;
if
(
$_
[
1
]
->
{
keyval
}
==
0xFF09
)
{
# do_completion;
();
print
"
ztab
\n
";
return
1
;
}
elsif
(
$_
[
1
]
->
{
keyval
}
==
0xFFBE
)
{
do_completion
;
();
...
...
@@ -293,11 +298,11 @@ sub create_main {
my
$cs
=
new
Gtk::
ScrolledWindow
undef
,
undef
;
$cs
->
set_policy
(
-
automatic
,
-
automatic
);
$
cs
->
add
(
$clist
);
$
gtk_10
?
$cs
->
add
(
$clist
)
:
$cs
->
add_with_viewport
(
$clist
);
my
$rs
=
new
Gtk::
ScrolledWindow
undef
,
undef
;
$rs
->
set_policy
(
-
automatic
,
-
automatic
);
$
rs
->
add
(
$rlist
);
$
gtk_10
?
$rs
->
add
(
$rlist
)
:
$rs
->
add_with_viewport
(
$rlist
);
$rs
->
set_usize
(
0
,
200
);
$result
=
new
Gtk::
Entry
;
...
...
@@ -306,10 +311,12 @@ sub create_main {
# $statusbar = new Gtk::Statusbar;
$statusbar
=
new
Gtk::
ProgressBar
;
realize
$window
;
$table
->
attach
(
new
Gtk::
Label
("
Synopsis
")
,
0
,
1
,
0
,
1
,{},{},
0
,
0
);
$table
->
attach
(
$synopsis
,
1
,
2
,
0
,
1
,{},{},
0
,
0
);
#
$table->attach(
new Gtk::Pixmap(
logo
$w
),2,3,0,1,{},{},0,0);
$table
->
attach
(
logo
(
),
2
,
3
,
0
,
1
,{},{},
0
,
0
);
$table
->
attach
(
new
Gtk::
Label
("
Command
")
,
0
,
1
,
1
,
2
,{},{},
0
,
0
);
$table
->
attach
(
$inputline
,
1
,
2
,
1
,
2
,['
expand
','
fill
'],{},
0
,
0
);
$table
->
attach
(
$result
,
2
,
3
,
1
,
2
,['
expand
','
fill
'],{},
0
,
0
);
...
...
@@ -342,20 +349,51 @@ register "extension_pdb_browser",
();
};
init
Gtk
;
exit
main
;
sub
logo
{
my
$pm
=
new
Gtk::Gdk::
Pixmap
->
create_from_data
(
$window
,
0
,
#%logo-width%
0
,
#%logo-height%
3
,
#%PM:logo%
#%PM%
);
#%BM:logo%
#%BM%
new
Gtk::
Pixmap
(
Gtk::Gdk::
Pixmap
->
create_from_xpm_d
(
$window
->
window
,
$window
->
style
->
black
,
#%XPM:logo%
'
79 33 25 1
',
'
c None
',
'
. c #020204
',
'
+ c #848484
',
'
@ c #444444
',
'
# c #C3C3C4
',
'
$ c #252524
',
'
% c #A5A5A4
',
'
& c #646464
',
'
* c #E4E4E4
',
'
= c #171718
',
'
- c #989898
',
'
; c #585858
',
'
> c #D7D7D7
',
'
, c #383838
',
'
\'
c #B8B8B8
',
'
) c #787878
',
'
! c #F7F7F8
',
'
~ c #0B0B0C
',
'
{ c #8C8C8C
',
'
] c #4C4C4C
',
'
^ c #CCCCCC
',
'
/ c #2C2C2C
',
'
( c #ABABAC
',
'
_ c #6C6C6C
',
'
: c #EBEBEC
',
'
',
'
]&@;%
',
'
;]_ ]];{_,&( ^{__{^ #);^
',
'
]);;+;) ,//,@;@@)_ #_......_^ (..;
',
'
;-
\'\'
@];@ /$=$/@_@;& #]........]
\'
^..{
',
'
@@_+%-,,] ,/$///_^)&@; -...{^>+./(
\'
*^! {{ ##( ##
\'
{{ ##(
',
'
;))@/; //]);/$]_(
\'
);] %,..+ ^*! #/,{ #,/%&..@*&..,^ >,,(;..,^
',
'
/,)];]] ,/],+%;_%-#!#()_
\'
...> >)_)_))
\'\'
.._ (..=~...=.~..; ^..=....=>
',
'
,]]&;;] /@;->>+-+{(
\'\'
-+] #...# #.....=
\'\'
..)
\'
..]*
\'
..$>>../-^..$##,..-
',
'
@_{@/, @$@_^*>(_;_&;{);
\'
]
\'
~..> ^,,/../-
\'
.._ (..{ ^..;
\'
=./-^..% #..&
',
'
,&);,& ,])-^:>#%#%+;)>->] ;..) >(..;
\'
..)
\'
..- #.._ -=./-^..( ^..&
',
'
,&&%]-&/]]_::^
\'
#--(#!:#:]& ^...)^#-~..#
\'
.._ (..% #.._ %=./-^..,>*;..+
',
'
,/&%;{%;//_#^#+%+{%#!:-#%]] -........{
\'
..)
\'
..% #.._ %=./-^..~....~*
',
'
;$@%+)#)@$/-
\'
)%-+-)+^#@;)@, #@..../
\'
#~~)
\'
~~% #~=_ -/~,-^..)/..=
\'
',
'
,@+(
\'
#);,={)]%^);@;&@=]] , %#
\'
#^( (%( (% %%( (%% ^..{>###
',
'
,@)^#;,/={)_
\'
-;///$$=;@ ,, ^..{
',
'
],&)_=$==/])
\'
+),],,/$)@ @, %(
\'
((
\'
((
\'
^..{
',
'
@@]/=====@-)-]$$, ]_/ , %=~~=~==& >%%^
',
'
=$@/@,@]/]$=/ ])$ & {{{{ %=====~=_
\'
-{%
',
'
,$// /$/@ /$, $,, %;@,,,;{> (
\'\'\'\'\'\'\'\'
#~.$-
',
'
//=/ $,/; $,, @@ ($......,> #~.${
',
'
/$, /,,, @@ ,, %$..],...{ ^~.$-
',
'
], ]@] )& , ($..>({..; #
\'
+)
\'
^ ^#
\'
*>(-!~.${
',
'
@, -- (; @ %$..^({..] *,..../* ^.._,.$!~.$-
',
'
_, @
\'
;
\'
) %$..@@...)!@.$#(=.; ^..~.~,!~.${
',
'
]/ ]) - ] ($......=>^..;--@.~^>...(^#:~.$-
',
'
; ;-__ ; ($../,])> %........#>..@( #~.${
',
'
_ )* ] %$..>{
\'
..->^*>>
\'
>..; #~.$-
',
'
) &&+ _ %$..
\'
>=.]>>)&^ ^..; #~.${
',
'
;- @;];] &- ($..
\'
\'
~.....+ ^..; #~.$-
',
'
\'
) ]_& @ __ %{))# >_@,;
\'
>)+( #+){
',
'
&% @;
'
#%XPM%
));
}
...
...
plug-ins/perl/examples/border.pl
View file @
adcd4819
...
...
@@ -4,6 +4,7 @@
use
Gimp
;
use
Gimp::
Fu
;
BEGIN
{
eval
"
use PDL
";
$@
and
exit
main
}
use
Gimp::
PDL
;
use
PDL::
LiteF
;
...
...
plug-ins/perl/examples/example-net.pl
View file @
adcd4819
...
...
@@ -4,6 +4,10 @@
use
Gimp
;
sub
query
{
print
STDERR
"
$0: this script is not intended to be run from within the gimp!
\n
";
}
sub
net
{
# simple benchmark ;)
...
...
plug-ins/perl/examples/feedback.pl
0 → 100755
View file @
adcd4819
#!/usr/bin/perl -w
use
Gimp
;
use
Gimp::
Fu
;
register
"
feedback
",
"
Take an image and feed it back onto itself multiple times
",
"
This plug-in simulates video feedback. It makes for kinda a neat desktop if you're into that sort of thing
",
"
Seth Burgess
",
"
Seth Burgess
",
"
1.0
",
"
<Image>/Filters/Misc/feedback
",
"
RGB, GRAY
",
[
[
PF_SLIDER
,
"
offset
",
"
the amount the frames will offset
",
3
,
[
0
,
255
,
1
]],
[
PF_SLIDER
,
"
repeat
",
"
the number of times to repeat the illusion
",
3
,
[
0
,
100
,
1
]],
],
sub
{
my
(
$img
,
$drawable
,
$offset
,
$repeat
)
=
@_
;
eval
{
$img
->
undo_push_group_start
};
for
(;
$repeat
>
0
;
$repeat
--
)
{
$drawable
=
$img
->
flatten
;
$copylayer
=
$drawable
->
copy
(
1
);
$img
->
add_layer
(
$copylayer
,
0
);
$copylayer
->
scale
(
$img
->
width
-
$offset
,
$img
->
height
-
$offset
,
0
);
}
$img
->
flatten
;
eval
{
$img
->
undo_push_group_end
};
return
();
};
exit
main
;
plug-ins/perl/examples/view3d.pl
View file @
adcd4819
...
...
@@ -5,24 +5,18 @@ use strict;
use
Gimp
;
use
Gimp::
Fu
;
use
Gimp::
PDL
;
use
PDL
;
use
PDL::
Core
;
BEGIN
{
eval
"
use PDL::Graphics::TriD
";
$@
and
exit
main
}
use
PDL::
Math
;
use
PDL::Graphics::
TriD
;
use
PDL::
Core
;
use
PDL
;
use
Gimp::
PDL
;
register
(
'
view3d
',
'
View grayscale drawable in 3D
',
'
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
',
'
v0.0:1998-11-28
',
'
<Image>/View/3D Surface
',
'
GRAY
',
[
[
PF_BOOL
,
'
Polar
',
'
Radial view
',
0
],
[
PF_BOOL
,
'
Lines
',
'
Draw grid lines
',
0
],
...
...
plug-ins/perl/examples/xachlego.pl
0 → 100755
View file @
adcd4819
#!/usr/bin/perl -w
# This is (hopefully) a demonstration of how pathetically easy it is to script
# a neato effect you've come up with. This lil' effect was created by xach,
# and translated by sjburges (me). You can consider it released under the GPL
# or Artistic liscence, whichever makes you happier.
#
# <Xach> sjburges: 1. pixelize the photo 2. in a new white layer, render a grid
# at the same resolution as the pixelize, then blur it. threshold the
# grid until you get a roundish blob in the center of each square (you
# may need to repeat a few times).
# <Xach> sjburges: meanwhile, back at the pixelized image, bumpmap it with
# itself and a depth of about 5. do this twice. then bumpmap it with
# the round blobby layer.
# <Xach> then create a new, clean grid, and bumpmap the pixelized layer with it
#
# (To get a decent blobby grid)
# <Xach> <Xach> render a grid at 10x10, gaussian blur at 7, then set levels to
# 196 1.00 234
# Revision - 1.1: added a gimp_displays_flush() for 1.0.x users
# stopped deleting the layers after removal - it was
# causing bad things to happen with refcounts. I hope
# gimp is cleaning up this memory on its own...
# 1.2: Fixed buggy selection handling - oops ;)
# Here's the boring start of every script...
use
Gimp
;
use
Gimp::
Fu
;
register
"
Xach Blocks
",
"
Xach's Blocks o' Fun
",
"
Turn your picture into something that resembles a certain trademarked
building block creation
",
"
Seth Burgess
",
"
Seth Burgess
",
"
1.2
",
"
<Image>/Filters/Misc/Xach Blocks
",
"
*
",
[
[
PF_SLIDER
,
"
Block size
",
"
The size of the blocks...
",
10
,
[
0
,
255
,
1
]],
[
PF_SLIDER
,
"
Knob factor
",
"
The size of your knob...
",
67
,
[
0
,
100
,
5
]],
],
sub
{
my
(
$img
,
$drawable
,
$blocksize
,
$knobfactor
)
=
@_
;
$selection_flag
=
0
;
eval
{
$img
->
undo_push_group_start
};
if
(
!
$drawable
->
has_alpha
)
{
$drawable
->
add_alpha
;
};
if
(
$img
->
selection_is_empty
)
{
$img
->
selection_all
;
$selection_flag
=
1
;
}
$oldbackground
=
gimp_palette_get_background
();
# Now the fun begins :)
$selection
=
$img
->
selection_save
;
#1. Pixelize the photo
$drawable
->
plug_in_pixelize
(
$blocksize
);
# 2. in a new white layer, render a grid
# at the same resolution as the pixelize, then blur it.
$gridlayer
=
$img
->
layer_new
(
$img
->
width
,
$img
->
height
,
RGBA_IMAGE
,
"
Grid 1
",
100
,
0
);
$img
->
add_layer
(
$gridlayer
,
0
);
$img
->
selection_all
;
gimp_edit_clear
(
$gridlayer
);
gimp_palette_set_background
([
255
,
255
,
255
]);
gimp_edit_fill
(
$gridlayer
);
$gridlayer
->
plug_in_grid
(
$blocksize
,
$blocksize
,
0
,
0
);
$gridlayer
->
plug_in_gauss_iir
(
0.7
*$blocksize
,
1
,
1
);
# threshold the
# grid until you get a roundish blob in the center of each square (you
# may need to repeat a few times).
$gridlayer
->
levels
(
0
,
196
,
234
,
$knobfactor
/
100.0
,
0
,
255
);
# <Xach> sjburges: meanwhile, back at the pixelized image, bumpmap it with
# itself and a depth of about 5. do this twice.
gimp_selection_load
(
$selection
);
$drawable
->
plug_in_bump_map
(
$drawable
,
135
,
45
,
5
,
0
,
0
,
0
,
0
,
1
,
0
,
0
);
$drawable
->
plug_in_bump_map
(
$drawable
,
135
,
45
,
5
,
0
,
0
,
0
,
0
,
1
,
0
,
0
);
$drawable
->
plug_in_bump_map
(
$gridlayer
,
135
,
45
,
5
,
0
,
0
,
0
,
0
,
1
,
0
,
0
);
# <Xach> then create a new, clean grid, and bumpmap the pixelized layer with it
$img
->
selection_all
;
$cleangrid
=
$img
->
layer_new
(
$img
->
width
,
$img
->
height
,
RGBA_IMAGE
,
"
Grid 2
",
100
,
0
);
$img
->
add_layer
(
$cleangrid
,
0
);
gimp_edit_fill
(
$cleangrid
);
$cleangrid
->
plug_in_grid
(
$blocksize
,
$blocksize
,
0
,
0
);
gimp_selection_load
(
$selection
);
$drawable
->
plug_in_bump_map
(
$cleangrid
,
135
,
45
,
3
,
0
,
0
,
0
,
0
,
1
,
0
,
0
);
$img
->
selection_all
;
# Clean up stuff
$img
->
remove_layer
(
$cleangrid
);
# $cleangrid->delete; # Deleting these layers after removal seems to cause
# strange problems (I think gimp handles this
# automatically now)
$img
->
remove_layer
(
$gridlayer
);
# $gridlayer->delete;
gimp_selection_load
(
$selection
);
gimp_palette_set_background
(
$oldbackground
);
if
(
$selection_flag
==
1
)
{
$img
->
selection_none
;
}
eval
{
$img
->
undo_push_group_end
};
return
();
};
exit
main
;
plug-ins/perl/examples/xachshadow.pl
0 → 100755
View file @
adcd4819
#!/usr/bin/perl -w
#[Xach] start off with an image, then pixelize it
#[Xach] then add alpha->add layer mask [20:21]
#[Xach] render a checkerboard into the layer mask
#[Xach] duplicate the image. fill the original with black, then blur the layer
# mask (i used 30% of pixelize size) and offset it by some value (i
# chose 20% of the pixelize size)
#[Xach] duplicate the duplicate, remove the layer mask, move it below everything
#[Xach] then add a new white layer on top, set the mode to multiply, and render
# a grid into it at pixelize size
#[Xach] that's a bit roundabout, but it's also in the xcf
#
# Because the way xach does it is a bit ackward, I'm switching it around a bit
# and working from the bottom up..
# Here's the boring start of every script...
use
Gimp
;
use
Gimp::
Fu
;
register
"
Xach Shadows
",
"
Xach's Shadows o' Fun
",
"
Screen of 50% of your drawing into a dropshadowed layer.
",
"
Seth Burgess
",
"
Seth Burgess
",
"
1.0
",
"
<Image>/Filters/Misc/Xach Shadows
",
"
RGB*, GRAY*
",
[
[
PF_SLIDER
,
"
Block size
",
"
The size of the blocks...
",
10
,
[
0
,
255
,
1
]],
],
sub
{
my
(
$img
,
$drawable
,
$blocksize
)
=
@_
;
eval
{
$img
->
undo_push_group_start
};
# $selection_flag = 0;
if
(
!
$drawable
->
has_alpha
)
{
$drawable
->
add_alpha
;
};
# This only can be applied to an entire image right now..
# $selection = $img->selection_save;
$img
->
selection_all
;
$oldbackground
=
gimp_palette_get_background
();
# Now the fun begins :)
$drawable
->
plug_in_pixelize
(
$blocksize
);
$shadowlayer
=
$drawable
->
layer_copy
(
0
);
$img
->
add_layer
(
$shadowlayer
,
0
);
$checkmask
=
$shadowlayer
->
create_mask
(
WHITE_MASK
);
$img
->
add_layer_mask
(
$shadowlayer
,
$checkmask
);
plug_in_checkerboard
(
$img
,
$checkmask
,
0
,
$blocksize
);
$frontlayer
=
$shadowlayer
->
layer_copy
(
0
);
$img
->
add_layer
(
$frontlayer
,
0
);
gimp_palette_set_background
([
0
,
0
,
0
]);
$shadowlayer
->
fill
(
BG_IMAGE_FILL
);
$checkmask
->
plug_in_gauss_iir
(
0.3
*$blocksize
,
1
,
1
);
gimp_channel_ops_offset
(
$checkmask
,
1
,
0
,
0.2
*$blocksize
,
0.2
*$blocksize
);
$gridlayer
=
$img
->
layer_new
(
$img
->
width
,
$img
->
height
,
RGBA_IMAGE
,
"
Grid 1
",
100
,
0
);
$img
->
add_layer
(
$gridlayer
,
0
);
$img
->
selection_all
;
gimp_edit_clear
(
$gridlayer
);
gimp_palette_set_background
([
255
,
255
,
255
]);
gimp_edit_fill
(
$gridlayer
);
$gridlayer
->
plug_in_grid
(
$blocksize
,
$blocksize
,
0
,
0
);
gimp_layer_set_mode
(
$gridlayer
,
3
);
# Clean up stuff
gimp_palette_set_background
(
$oldbackground
);
eval
{
$img
->
undo_push_group_end
};
gimp_displays_flush
();
return
();
};
exit
main
;
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