README 5.5 KB
Newer Older
Marc Lehmann's avatar
Marc Lehmann committed
1
NAME
Marc Lehmann's avatar
Marc Lehmann committed
2

3
       Gimp-Perl allows GIMP extensions/plug-ins/load & save handlers in Perl.
Marc Lehmann's avatar
Marc Lehmann committed
4

5
SYNOPSIS
Marc Lehmann's avatar
Marc Lehmann committed
6

7
8
9
10
11
12
         use Gimp;
         use Gimp::Fu;
         podregister {
           # your code
	   my $image = new Gimp::Image (600, 300, RGB);
	   my $bg = $image->layer_new(
13
	     600,300,RGB_IMAGE,"Background",100,LAYER_MODE_NORMAL_LEGACY
14
15
	   );
	   $image->insert_layer($bg, 1, 0);
16
	   $image->edit_fill($bg, FILL_FOREGROUND);
17
18
19
20
21
22
	   Gimp::Display->new($image);
	   $image;
         };
         exit main;
         __END__
         =head1 NAME
23

24
         example_function - Short description of the function
Marc Lehmann's avatar
Marc Lehmann committed
25

26
         =head1 SYNOPSIS
Ed J's avatar
Ed J committed
27

28
         <Image>/File/Create/Patterns/Example...
Marc Lehmann's avatar
Marc Lehmann committed
29

30
31
32
         =head1 DESCRIPTION

         Longer description of the function...
Marc Lehmann's avatar
Marc Lehmann committed
33

34
35
36
       See the end of this document for a complete example script.

PREREQUISITES
Marc Lehmann's avatar
Marc Lehmann committed
37

38
39
40
41
42
43
44
45
       Perl: 5.14+
       The GNU Image Manipulation Program (GIMP): 2.8 (pref 2.8.10)
	 http://www.gimp.org/
	 ftp://ftp.gimp.org/pub/gimp/
       Gtk2, the perl extension for gtk+2, "gtk2-perl-xs" variant
	 http://gtk2-perl.sourceforge.net
       PDL, the Perl Data Language: 2.0+ (2.004+ recommended)
	 http://www.cpan.org/
46
       Other packages: use CPAN to install this one, and it will get these too.
Marc Lehmann's avatar
Marc Lehmann committed
47
48

INSTALLATION
Marc Lehmann's avatar
Marc Lehmann committed
49

50
51
52
53
       On Unix/Linux, you should be able to:
	  perl ./Makefile.PL && make test && make install
       To get a listing of configuration options, enter:
	  perl ./Makefile.PL --help
Marc Lehmann's avatar
Marc Lehmann committed
54
55
56
57

       After installation, these perl plug-ins should be visible from
       within the Gimp (and many, many more):

58
59
60
61
	   Filters/Perl/Server
	   Filters/Artistic/Windify
	   Filters/Misc/Prepare for GIF
	   Filters/Misc/Webify
62
63
64
65

       If you wish to install the plugins in your personal GIMP directory
       instead of the system-wide one (e.g. if you don't have root
       access), install instead using this:
66
	  make install GTINSTALL='gimptool-2.0 --install-bin'
67

68
       To override other build or install options see ExtUtils::MakeMaker docs.
Ed J's avatar
Ed J committed
69

70
71
72
73
       To build a slp/deb/rpm/whatever package use the normal prefix,
       and override prefix at "make install" time (lowercase for GIMP,
       upper for perl):
          make prefix=`pwd`/debian/tmp/usr PREFIX=`pwd`/debian/tmp/usr install
Marc Lehmann's avatar
Marc Lehmann committed
74

75
SUPPORT/MAILING LISTS/MORE INFO
Marc Lehmann's avatar
Marc Lehmann committed
76

77
78
79
       Please report any problems:
	  http://bugzilla.gnome.org/browse.cgi?product=gimp-perl
	  https://rt.cpan.org/Dist/Display.html?Name=Gimp
Marc Lehmann's avatar
Marc Lehmann committed
80

81
82
83
84
85
       Homepages: https://git.gnome.org/browse/gimp-perl/
		  http://search.cpan.org/dist/Gimp/
       Currently-suggested mailing list: gimp-user
	  (see http://www.gimp.org/mail_lists.html)
       New releases will be announced to gimp-announce.
Marc Lehmann's avatar
Marc Lehmann committed
86

87
88
       You can also upload your scripts to the gimp registry at
	  http://registry.gimp.org/
Marc Lehmann's avatar
Marc Lehmann committed
89

90
91
       If you want to play along at home with git:
	  git://git.gnome.org/gimp-perl
Ed J's avatar
Ed J committed
92

93
EXAMPLE PERL PLUG-IN
Marc Lehmann's avatar
Marc Lehmann committed
94

95
       Here is a complete plug-in, examples/example-fu:
Marc Lehmann's avatar
Marc Lehmann committed
96

97
98
99
100
101
#!/usr/bin/perl

use strict;
use Gimp;
use Gimp::Fu;
Marc Lehmann's avatar
Marc Lehmann committed
102

103
104
podregister {
  # no input parameters line - source filter inserts. See Gimp::Fu docs.
105
  $Gimp::verbose = 1; # remove this to stop debugging output
106
107
108
109
  Gimp::Context->push; # store current settings, so present ones preserved
  my $img = Gimp::Image->new($width, $height, RGB);
  $img->undo_group_start; # so all actions can be undone in one step
  # the __ before the string will translate it if available
110
  my $l = Gimp::Layer->new($img, $width, $height, RGB, __"Background", 100, LAYER_MODE_NORMAL_LEGACY);
111
112
113
114
  $l->insert_layer(0, 0); # required!
  # now a few syntax examples
  Gimp::Context->set_foreground($text_colour) unless $ignore_cols;
  Gimp::Context->set_background($bg_colour) unless $ignore_cols;
115
  fill $l FILL_BACKGROUND;
116
117
118
119
120
121
122
123
  my $text_layer = $img->text_fontname(-1, 10, 10, $text, 5, 1, 10, PIXELS, $font);
  Gimp::Context->set_foreground("green");
  $img->undo_group_end; # close the undo group
  Gimp::Context->pop; # restore original context
  Gimp::Display->new($img);
  $img; # return image, as Gimp::Fu added that to our output parameters
        # because no-image-input
};
124

125
126
exit main;
__END__
Ed J's avatar
Ed J committed
127

128
=head1 NAME
Ed J's avatar
Ed J committed
129

130
example_script - Gimp::Fu example, mostly non-functional
Marc Lehmann's avatar
Marc Lehmann committed
131

132
=head1 SYNOPSIS
Marc Lehmann's avatar
Marc Lehmann committed
133

134
<Image>/Filters/Languages/_Perl/_Test/Dialog
Marc Lehmann's avatar
Marc Lehmann committed
135

136
=head1 DESCRIPTION
Marc Lehmann's avatar
Marc Lehmann committed
137

138
139
Just a starting point to derive new scripts. Always remember to put a
descriptive help message here!
Marc Lehmann's avatar
Marc Lehmann committed
140

141
=head1 PARAMETERS
Marc Lehmann's avatar
Marc Lehmann committed
142

143
144
145
146
147
148
  # one of each type of parameter here
  # argument type, variable name, short description, default, extra arguments
  [PF_SLIDER	, "width"	, "Image width"		, 360, [300, 500]],
  [PF_SPINNER	, "height"	, "Image height"	, 100, [100, 200]],
  [PF_STRING	, "text"	, "Message"		, "example text"],
  [PF_TEXT	, "longtext"	, "Longer text"		, "more example text"],
149
150
  [PF_FILE	, "file"	, "File"		, "/tmp"],
  [PF_INT8	, "int8"	, "8-bit int"		, 10],
151
152
153
154
155
156
157
158
159
160
161
162
  [PF_INT32	, "bordersize"	, "Border size"		, 10],
  [PF_FLOAT	, "borderwidth"	, "Border width"	, 1/5],
  [PF_FONT	, "font"	, "Font"],
  [PF_COLOUR	, "text_colour"	, "Text colour", [10,10,10]],
  [PF_COLOUR	, "bg_colour"	, "Background colour"	, [0xff,0x80,0]],
  [PF_TOGGLE	, "ignore_cols" , "Ignore colours"	, 0],
  [PF_IMAGE	, "extra_image"	, "Additional picture to ignore"],
  [PF_DRAWABLE	, "extra_draw"	, "Something to ignore as well"	],
  [PF_RADIO	, "type"	, "Effect type"		, 0, [small => 0, large => 1]],
  [PF_BRUSH	, "a_brush"	, "An unused brush"],
  [PF_PATTERN	, "a_pattern"	, "An unused pattern"],
  [PF_GRADIENT	, "a_gradients"	, "An unused gradients"],
Marc Lehmann's avatar
Marc Lehmann committed
163

164
=head1 AUTHOR
Marc Lehmann's avatar
Marc Lehmann committed
165

166
Marc Lehmann <pcg@goof.com>
Marc Lehmann's avatar
Marc Lehmann committed
167

168
=head1 DATE
Marc Lehmann's avatar
Marc Lehmann committed
169

170
171
172
173
174
175
176
2000-03-21

=head1 LICENSE

(c) 1998,1999,2000 Marc Lehmann

Distributed under the same terms as Gimp-Perl.