mirror of https://github.com/GNOME/gimp.git
see plug-ins/perl/Changes
This commit is contained in:
parent
d40b66ac1d
commit
6abe8d0604
|
@ -1,11 +1,19 @@
|
|||
Revision history for Gimp-Perl extension.
|
||||
|
||||
- moved the xlfd_size function from Gimp::Fu into Gimp
|
||||
(and maybe later into Gimp::Util?)
|
||||
- Functions in Gimp::Util are now treated in the same way
|
||||
as PDB functions (when the module is loaded)
|
||||
|
||||
1.051 Tue Jan 19 21:10:20 CET 1999
|
||||
- corrected a minor typoe found by Stefan Traby <stefan@sime.com>
|
||||
- added SPIRAL* constants for gimp_blend
|
||||
- moved constants from Gimp.xs and extradefs.h to Gimp.pm, where
|
||||
they belong (either there or into Gimp.xs)
|
||||
- added view3d.pl to examples (untested)
|
||||
- Gimp::Util is reborn (give it a try and contribute!)
|
||||
- more Gtk changes (tested with Gtk-0.5 and gtk-1.1.x, uh-oh)
|
||||
- faster startup by not loading Gtk by default ;)
|
||||
|
||||
1.05 Fri Dec 18 22:05:25 CET 1998
|
||||
- some 5.006 compatibility fixes
|
||||
|
|
|
@ -12,7 +12,7 @@ use base qw(DynaLoader);
|
|||
|
||||
require DynaLoader;
|
||||
|
||||
$VERSION = 1.05;
|
||||
$VERSION = 1.052;
|
||||
|
||||
@_param = qw(
|
||||
PARAM_BOUNDARY PARAM_CHANNEL PARAM_COLOR PARAM_DISPLAY PARAM_DRAWABLE
|
||||
|
@ -155,7 +155,7 @@ sub import($;@) {
|
|||
|
||||
# make a quick but dirty guess ;)
|
||||
|
||||
@_=qw(gimp_main main :auto) unless @_;
|
||||
@_=qw(gimp_main main xlfd_size :auto) unless @_;
|
||||
|
||||
for(@_) {
|
||||
if ($_ eq ":auto") {
|
||||
|
@ -185,6 +185,13 @@ sub import($;@) {
|
|||
}
|
||||
}
|
||||
|
||||
sub xlfd_size($) {
|
||||
local $^W=0;
|
||||
my ($px,$pt)=(split(/-/,$_[0]))[7,8];
|
||||
$px>0 ? ($px ,&Gimp::PIXELS)
|
||||
: ($pt*0.1,&Gimp::POINTS);
|
||||
}
|
||||
|
||||
my %rgb_db;
|
||||
my $rgb_db_path;
|
||||
|
||||
|
@ -318,14 +325,24 @@ sub AUTOLOAD {
|
|||
} elsif (_gimp_procedure_available ($sub)) {
|
||||
*{$AUTOLOAD} = sub {
|
||||
shift unless ref $_[0];
|
||||
# goto gimp_call_procedure
|
||||
# goto gimp_call_procedure # does not always work, PERLBUG! #FIXME
|
||||
my @r=eval { gimp_call_procedure ($sub,@_) };
|
||||
_croak $@ if $@;
|
||||
wantarray ? @r : $r[0];
|
||||
};
|
||||
goto &$AUTOLOAD;
|
||||
} elsif (defined(*{"${interface_pkg}::$sub"}{CODE})) {
|
||||
die "safety net $interface_pkg :: $sub";#d#
|
||||
die "safety net $interface_pkg :: $sub (REPORT THIS!!)";#d#
|
||||
} elsif (UNIVERSAL::can(Gimp::Util,$sub)) {
|
||||
my $ref = \&{"Gimp::Util::$sub"};
|
||||
*{$AUTOLOAD} = sub {
|
||||
shift unless ref $_[0];
|
||||
# goto &$ref # does not always work, PERLBUG! #FIXME
|
||||
my @r = eval { &$ref };
|
||||
_croak $@ if $@;
|
||||
wantarray ? @r : $r[0];
|
||||
};
|
||||
goto &$AUTOLOAD;
|
||||
}
|
||||
}
|
||||
croak "function/macro \"$name\" not found in $class";
|
||||
|
@ -630,6 +647,15 @@ speak for you), or just plain interesting functions.
|
|||
Should be called immediately when perl is initialized. Arguments are not yet
|
||||
supported. Initializations can later be done in the init function.
|
||||
|
||||
=item xlfd_size(fontname)
|
||||
|
||||
This auxillary functions parses the XLFD (usually obtained from a C<PF_FONT>
|
||||
parameter) and returns its size and unit (e.g. C<(20,POINTS)>). This can
|
||||
conviniently used in the gimp_text_..._fontname functions, which ignore the
|
||||
size (no joke ;). Example:
|
||||
|
||||
$drawable->text_fontname (50, 50, "The quick", 5, 1, xlfd_size $font, $font;
|
||||
|
||||
=item Gimp::init([connection-argument]), Gimp::end()
|
||||
|
||||
These is an alternative and experimental interface that replaces the call to
|
||||
|
|
|
@ -5,11 +5,8 @@ use Carp;
|
|||
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK @EXPORT_FAIL %EXPORT_TAGS
|
||||
@scripts @_params $run_mode %pf_type2string @image_params);
|
||||
use Gimp qw(:param);
|
||||
use Gimp::UI;
|
||||
use Gimp::Data;
|
||||
use File::Basename;
|
||||
use Gtk;
|
||||
use Gtk::ColorSelectButton;
|
||||
use Data::Dumper;
|
||||
use base qw(Exporter);
|
||||
|
||||
|
@ -116,7 +113,7 @@ sub Gimp::RUN_FULLINTERACTIVE (){ Gimp::RUN_INTERACTIVE+100 }; # you don't want
|
|||
PF_SLIDER PF_INT PF_SPINNER PF_ADJUSTMENT
|
||||
PF_BRUSH PF_PATTERN PF_GRADIENT);
|
||||
|
||||
@EXPORT = (qw(register main gimp_main xlfd_size),@_params);
|
||||
@EXPORT = (qw(register main gimp_main),@_params);
|
||||
@EXPORT_OK = qw(interact $run_mode save_image);
|
||||
%EXPORT_TAGS = (params => [@_params]);
|
||||
|
||||
|
@ -140,13 +137,6 @@ sub _default {
|
|||
@a;
|
||||
}
|
||||
|
||||
sub xlfd_size {
|
||||
local $^W=0;
|
||||
my ($px,$pt)=(split(/-/,$_[0]))[7,8];
|
||||
$px>0 ? ($px ,&Gimp::PIXELS)
|
||||
: ($pt*0.1,&Gimp::POINTS);
|
||||
}
|
||||
|
||||
sub wrap_text {
|
||||
my $x=$_[0];
|
||||
$x=~s/(\G.{$_[1]}\S*)\s+/$1\n/g;
|
||||
|
@ -162,10 +152,16 @@ sub interact($$$@) {
|
|||
my($button,$box,$bot,$g);
|
||||
my $res=0;
|
||||
|
||||
my $gimp_10 = Gimp->major_version==1 && Gimp->minor_version==0;
|
||||
|
||||
init Gtk;
|
||||
# only pull these in if _really_ required
|
||||
# gets us some speed we really need
|
||||
require Gtk; import Gtk;
|
||||
init Gtk; # gross hack...
|
||||
parse Gtk::Rc Gimp->gtkrc;
|
||||
|
||||
require Gtk::ColorSelectButton; import Gtk::ColorSelectButton;
|
||||
require Gimp::UI; import Gimp::UI;
|
||||
|
||||
my $gimp_10 = Gimp->major_version==1 && Gimp->minor_version==0;
|
||||
|
||||
for(;;) {
|
||||
my $t = new Gtk::Tooltips;
|
||||
|
@ -176,8 +172,8 @@ sub interact($$$@) {
|
|||
my $h = new Gtk::HBox 0,2;
|
||||
$h->add(new Gtk::Label wrap_text($blurb,40));
|
||||
$w->vbox->pack_start($h,1,1,0);
|
||||
realize $h;
|
||||
my $l = logo($h);
|
||||
realize $w;
|
||||
my $l = logo($w);
|
||||
$h->add($l);
|
||||
|
||||
$g = new Gtk::Table scalar@types,2,0;
|
||||
|
@ -216,7 +212,7 @@ sub interact($$$@) {
|
|||
|
||||
} elsif($type == PF_FONT) {
|
||||
my $fs=new Gtk::FontSelectionDialog "Font Selection Dialog ($desc)";
|
||||
my $def = "-*-courier-helvetica-o-normal--34-*-*-*-*-*-*-*";
|
||||
my $def = "-*-helvetica-o-normal--34-*-*-*-*-*-*-*";
|
||||
my $val;
|
||||
|
||||
my $l=new Gtk::Label "!error!";
|
||||
|
@ -739,6 +735,10 @@ sub register($$$$$$$$$;@) {
|
|||
$menupath,$imagetypes,$params,$results,$code)=@_;
|
||||
|
||||
$code or ($results,$code)=([],$results);
|
||||
|
||||
for my $p (@$params,@$results) {
|
||||
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/^\+//;
|
||||
|
||||
|
@ -830,15 +830,6 @@ sub register($$$$$$$$$;@) {
|
|||
|
||||
=over
|
||||
|
||||
=item C<xlfd_size> fontname
|
||||
|
||||
This auxillary functions parses the XLFD (usually obtained from a C<PF_FONT>
|
||||
parameter) and returns its size and unit (e.g. C<(20,POINTS)>). This can
|
||||
conviniently used in the gimp_text_..._fontname functions, which ignore the
|
||||
size (no joke ;). Example:
|
||||
|
||||
$drawable->text_fontname (50, 50, "The quick", 5, 1, xlfd_size $font, $font;
|
||||
|
||||
=item C<save_image(img,options_and_path)>
|
||||
|
||||
This is the internal function used to save images. As it does more than just
|
||||
|
@ -958,7 +949,8 @@ sub logo {
|
|||
}
|
||||
|
||||
sub logo_xpm {
|
||||
new Gtk::Pixmap(Gtk::Gdk::Pixmap->create_from_xpm_d($_[0]->window,$_[0]->style->black,
|
||||
my $window=shift;
|
||||
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',
|
||||
|
|
|
@ -91,10 +91,10 @@ use base 'Gtk::Button';
|
|||
sub register_types {
|
||||
unless ($once) {
|
||||
$once=1;
|
||||
register_type Gimp::UI::PreviewSelect;
|
||||
register_type Gimp::UI::PatternSelect;
|
||||
register_type Gimp::UI::BrushSelect;
|
||||
register_type Gimp::UI::GradientSelect;
|
||||
Gtk::Button->register_subtype(Gimp::UI::PreviewSelect);
|
||||
Gtk::Button->register_subtype(Gimp::UI::PatternSelect);
|
||||
Gtk::Button->register_subtype(Gimp::UI::BrushSelect);
|
||||
Gtk::Button->register_subtype(Gimp::UI::GradientSelect);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,31 +1,34 @@
|
|||
##############################################################################
|
||||
# [12/23/98] Tels v0.0.1 http://bloodgate.com/art/gimp/
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Gimp::Utils - some handy routines for Gimp.Perl users
|
||||
Gimp::Util - some handy routines for Gimp.Perl users
|
||||
|
||||
=head1
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Gimp;
|
||||
use Gimp::Util;
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
gimp.perl is nice, but when you have to write everytime 10 lines just to get
|
||||
some simple functions done, it very quickly becomes tedious :-/
|
||||
Gimp-Perl is nice, but when you have to write everytime 10 lines just to
|
||||
get some simple functions done, it very quickly becomes tedious :-/
|
||||
|
||||
This module tries to define some functions that aim to automate frequently
|
||||
used tasks. If you want to add a function just mail the author of the
|
||||
used tasks, i.e. its a sort of catch-all-bag for (possibly) useful macro
|
||||
functions. If you want to add a function just mail the author of the
|
||||
Gimp-Perl extension (see below).
|
||||
|
||||
In Gimp-Perl (but not in Gimp as seen by the enduser) it is possible to have
|
||||
layers that are NOT attached to an image. This is, IMHO a bad idea, you end up
|
||||
with them and the user cannot see them or delete them. So we always attach our
|
||||
created layers to an image here, too avoid memory leaks and debugging times.
|
||||
In Gimp-Perl (but not in Gimp as seen by the enduser) it is possible to
|
||||
have layers that are NOT attached to an image. This is, IMHO a bad idea,
|
||||
you end up with them and the user cannot see them or delete them. So we
|
||||
always attach our created layers to an image here, too avoid memory leaks
|
||||
and debugging times.
|
||||
|
||||
These functions preserve the current settings like colors.
|
||||
|
||||
Also: these functions are handled in exactly the same way as
|
||||
PDB-Functions, i.e. the (hypothetical) function C<gimp_image_xyzzy> can be
|
||||
called as $image->xyzzy, if the module is available.
|
||||
|
||||
=head1 FUNCTIONS
|
||||
|
||||
=over 4
|
||||
|
@ -43,7 +46,7 @@ require Exporter;
|
|||
);
|
||||
#@EXPORT_OK = qw();
|
||||
|
||||
$VERSION=1.000;
|
||||
$VERSION=1.001;
|
||||
|
||||
use Gimp;
|
||||
|
||||
|
@ -203,10 +206,10 @@ sub layer_add_layer_as_mask {
|
|||
my $mask;
|
||||
|
||||
gimp_selection_all ($image);
|
||||
gimp_edit_copy ($image,$layer_mask);
|
||||
$layer_mask->edit_copy ();
|
||||
gimp_layer_add_alpha ($layer);
|
||||
$mask = gimp_layer_create_mask ($layer,0);
|
||||
gimp_edit_paste ($image,$mask,0);
|
||||
$mask->edit_paste (0);
|
||||
gimp_floating_sel_anchor(gimp_image_floating_selection($image));
|
||||
gimp_image_add_layer_mask ($image,$layer,$mask);
|
||||
$mask;
|
||||
|
@ -218,6 +221,19 @@ sub layer_add_layer_as_mask {
|
|||
# require/use etc. check for a true return value
|
||||
1;
|
||||
|
||||
##############################################################################
|
||||
# all functions below are originally for the chart module
|
||||
=pod
|
||||
|
||||
=item C<gimp_text_wh $text,$fontname>
|
||||
|
||||
returns the width and height of the "$text" of the given font (XLFD format)
|
||||
|
||||
=cut
|
||||
sub gimp_text_wh {
|
||||
(Gimp->text_get_extents_fontname($_[0],xlfd_size $_[1],$_[1]))[0,1];
|
||||
}
|
||||
|
||||
=pod
|
||||
|
||||
=head1 AUTHOR
|
||||
|
|
|
@ -166,8 +166,8 @@ register "tex_string_to_float", "Turn a TeX-string into floating layer", "Takes
|
|||
"<Image>/Perl-Fu/TeX String",
|
||||
"*",
|
||||
[
|
||||
[PF_TEXT, "Input file", "TeX macro file to input", ""],
|
||||
[PF_TEXT, "TeX String", "Enter TeX String", ""],
|
||||
[PF_STRING, "Input file", "TeX macro file to input", ""],
|
||||
[PF_STRING, "TeX String", "Enter TeX String", ""],
|
||||
[PF_VALUE, "DPI", "Resolution to render the text in", "72"],
|
||||
[PF_VALUE, "Magstep", "TeX magstep", "2"],
|
||||
[PF_VALUE, "Anti-aliasing", "Anti-aliasing factor", "4"],
|
||||
|
|
Loading…
Reference in New Issue