From 7d749f4218f9a74863cb8a434b7a94c97b305bd6 Mon Sep 17 00:00:00 2001 From: Marc Lehmann Date: Fri, 26 Feb 1999 03:50:32 +0000 Subject: [PATCH] see plug-ins/perl/Changes --- plug-ins/perl/Changes | 2 +- plug-ins/perl/Gimp.xs | 8 ++- plug-ins/perl/Gimp/Lib.xs | 18 +++-- plug-ins/perl/MANIFEST | 1 + plug-ins/perl/examples/blowinout.pl | 2 +- plug-ins/perl/examples/terral_text | 101 ++++++++++++++++++++++++++++ 6 files changed, 117 insertions(+), 15 deletions(-) create mode 100644 plug-ins/perl/examples/terral_text diff --git a/plug-ins/perl/Changes b/plug-ins/perl/Changes index 1b7fbb59b8..82aeabc67b 100644 --- a/plug-ins/perl/Changes +++ b/plug-ins/perl/Changes @@ -6,7 +6,7 @@ Revision history for Gimp-Perl extension. - removed publicly-visible non-PDB pixelfunctions. "uuuuuse peedee-ell or dieieie". - implemented Gimp::Fu::PF_RADIO. - - added blowinout.pl. + - added blowinout.pl and terral_text. 1.055 Mon Feb 22 22:38:44 CET 1999 - applied seth's script changes. diff --git a/plug-ins/perl/Gimp.xs b/plug-ins/perl/Gimp.xs index 0ac52acd9d..9bc8f1d350 100644 --- a/plug-ins/perl/Gimp.xs +++ b/plug-ins/perl/Gimp.xs @@ -23,12 +23,14 @@ extern "C" { /* FIXME */ /* dirty is used in gimp.h. */ -#undef dirty +#ifdef dirty +# undef dirty +#endif #include "extradefs.h" #if GIMP_MAJOR_VERSION>1 || (GIMP_MAJOR_VERSION==1 && GIMP_MINOR_VERSION>=1) -#define GIMP11 1 -#define GIMP_PARASITE 1 +# define GIMP11 1 +# define GIMP_PARASITE 1 #endif /* Shamelesssly stolen from IO.xs. See perlguts, this is only for diff --git a/plug-ins/perl/Gimp/Lib.xs b/plug-ins/perl/Gimp/Lib.xs index d0c6cbb56e..5850cfb1c9 100644 --- a/plug-ins/perl/Gimp/Lib.xs +++ b/plug-ins/perl/Gimp/Lib.xs @@ -5,12 +5,12 @@ #include #if UI -#include +# include #endif #if GIMP_MAJOR_VERSION>1 || (GIMP_MAJOR_VERSION==1 && GIMP_MINOR_VERSION>=1) -#define GIMP11 1 -#define GIMP_PARASITE 1 +# define GIMP11 1 +# define GIMP_PARASITE 1 #endif /* FIXME */ @@ -32,18 +32,16 @@ #endif /* And also for newer perls... */ #ifndef dTHR -#define dTHR (void)0 +# define dTHR (void)0 #endif #if (PATCHLEVEL < 5) -#define newSVpvn(data,len) ((len) ? newSVpv ((data), (len)) : newSVpv ("", 0)) -#endif -#ifndef PL_sv_undef -#define PL_sv_undef sv_undef +# define newSVpvn(data,len) ((len) ? newSVpv ((data), (len)) : newSVpv ("", 0)) +# define PL_sv_undef sv_undef #endif /* dirty is used in gimp.h AND in perl < 5.005 or with PERL_POLLUTE. */ #ifdef dirty -#undef dirty +# undef dirty #endif #include "extradefs.h" @@ -60,7 +58,7 @@ #define PKG_SELECTION GIMP_PKG "Selection" #define PKG_REGION GIMP_PKG "Region" #if GIMP_PARASITE -#define PKG_PARASITE GIMP_PKG "Parasite" +# define PKG_PARASITE GIMP_PKG "Parasite" #endif #define PKG_GDRAWABLE GIMP_PKG "GDrawable" diff --git a/plug-ins/perl/MANIFEST b/plug-ins/perl/MANIFEST index a316834573..5d6aef77a3 100644 --- a/plug-ins/perl/MANIFEST +++ b/plug-ins/perl/MANIFEST @@ -58,3 +58,4 @@ examples/xachshadow.pl examples/parasite-editor examples/scratches.pl examples/blowinout.pl +examples/terral_text diff --git a/plug-ins/perl/examples/blowinout.pl b/plug-ins/perl/examples/blowinout.pl index d0bc60234e..c27d4170b4 100755 --- a/plug-ins/perl/examples/blowinout.pl +++ b/plug-ins/perl/examples/blowinout.pl @@ -89,7 +89,7 @@ register "Blow selected layer inout", "Generates an animation thats blows the selected layer in or out", "John Pitney", - "John Pitney ", + "John Pitney ", "1999-02-24", "/Filters/Distorts/BlowInOut", "*", diff --git a/plug-ins/perl/examples/terral_text b/plug-ins/perl/examples/terral_text new file mode 100644 index 0000000000..d8b6c2063e --- /dev/null +++ b/plug-ins/perl/examples/terral_text @@ -0,0 +1,101 @@ +#!/usr/bin/perl -w + +# Terral Text +# by Seth Burgess +# effect by Terral from #gimp + +#*L* IRC log started on Tue Feb 23 21:59:08 1999 +#*** LOG is set to on +#[terral] the inputs would be the following +#[terral] Text, font, and blur amount [22:00] +#[terral] it is executed on an existing image with 1 layer +#[terral] this layer will be named the pattern layer +#[terral] start of script- +#[terral] add new layer (white) +#[terral] add text, (centered, black) to the new layer [22:02] +#[terral] anchor the text +#[terral] guassian blur (blur amount) +#[terral] invert colors on text layer [22:05] +#[terral] make active layer the pattern layer now +#[terral] bump map text layer into pattern layer, ( azimuth 130.30, elevation 40, depth 20, x offset, y offset, waterlevel, azimuth. all 0) +#[terral] add layer mask, (white full opacity) [22:08] +#[terral] copy text layer +#[terral] paste into layer mask of pattern layer +#[terral] select layer mask of pattern layer to be active layer [22:09] +#[terral] edit curves +#[terral] input levels of 0, .24, 113 [22:11] +#[terral] --end of script [22:12] + +use Gimp; +use Gimp::Fu; + +# Gimp::set_trace(TRACE_ALL); + +register + "terraltext", + "Make a cool text bumpmap thingy", + "Creates a bumpmap text thingy. Can work using the current layer as a bumpmap or make a solid noise layer for it.", + "Seth Burgess", + "Seth Burgess ", + "1999-02-24", + "/Filters/Render/Terral Text", + "RGB*", + [ + [ PF_TOGGLE, "Solid Noise?", "Say yes here", "Either use solid noise or the current background", 0 ], + [ PF_FONT, "helvetica", "Font Name", "-*-helvetica-medium-r-normal-*-*-240-*-*-p-*-iso8859-1" ], + [ PF_STRING, "Text", "Enter your Text to be Terral-ified", "TerralText"], + [ PF_SLIDER, "Blur Amount", "Blur Amount", 10, [0,26,1]], + ], +sub { + ($img, $pattern, $solidnoise, $font, $text, $blur) = @_; + $oldbg = gimp_palette_get_background(); + $oldfg = gimp_palette_get_foreground(); + + + + if ($solidnoise) { + $pattern->plug_in_solid_noise(1,1,256*rand(), 1,2.5,2.5); + } + + # FIXME: I should endeavour to find out what kind of image I'm talking + # about before blindly apply a type of layer. Oh well. Call it RGBA + # for now. + + $textlayer = $img->layer_new($img->width, $img->height,RGBA_IMAGE, + "TextLayer", 100, 0); + $img->add_layer($textlayer,1); + palette_set_background([255,255,255]); + $textlayer->edit_fill(); + palette_set_foreground([0,0,0]); + + # Place centered Text - what a PITA! + @extents = text_get_extents_fontname($text, xlfd_size($font), $font); + $width = $extents[0]; + $height = $extents[1]; # there's other info in 2&3 + $width_offset = ($img->width - $width)/2; + $height_offset = ($img->height - $height)/2; + $floating=$textlayer->text_fontname($width_offset, $height_offset, $text, 0,0,xlfd_size($font), $font); + $floating->floating_sel_anchor; + + $textlayer->plug_in_gauss_iir($blur, 1,1); + $textlayer->invert(); + $pattern->plug_in_bump_map($textlayer, 130.30, 40, 20, 0, 0, 0, 0, 1, 0, 0); + + if (!($pattern->has_alpha)) { + $pattern->add_alpha; + } + $mask = $pattern->create_mask(0); + $img->add_layer_mask($pattern, $mask); + + $textlayer->edit_copy(); + $floater = $mask->edit_paste(0); + $floater->floating_sel_anchor; + + $mask->levels(0, 0, 113, 0.24, 0, 255); + + palette_set_background($oldbg); + palette_set_foreground($oldfg); + return; +}; + +exit main;