Files
gimp/plug-ins/perl/examples/terral_text
Michael Natterer d81b47ce70 removed GimpFillType.
2001-06-29  Michael Natterer  <mitch@gimp.org>

	* app/appenums.h: removed GimpFillType.

	* app/gimprc.c: parse the session-info's new "aux-info" field.

	* app/global_edit.[ch]: removed the old "Paste Named" dialog and
	prefixed all functions with "gimp_".

	* app/core/core-types.h: added GimpFillType.

	* app/core/gimpbrush.[ch]: new signal "spacing_changed".

	* app/gui/Makefile.am
	* app/gui/tools-commands.[ch]: one more file cut out of commands.[ch].

	* app/gui/commands.[ch]: removed the tools stuff here.

	* app/gui/brush-select.[ch]
	* app/gui/dialogs-constructors.c: use the new GimpBrushFactoryView
	(see below).

	* app/gui/dialogs-commands.[ch]
	* app/gui/menus.[ch]:

	- Made it 64bit safe again by passing the dialog factory's
	  identifiers as GQuarks, not as guints created by GPOINTER_TO_UINT().
	- Added a "gchar *quark_string" field to GimpItemFactoryEntry
	  which gets transformed into a GQuark by menus_create_item().
	- Added SEPARATOR() and BRANCH() macros which make the *_entries[]
	  arrays more readable.
	- Added a menu item to show/hide GimpImageDock's image menu.
	- Removed file_last_opened_cmd_callback().

	* app/gui/edit-commands.c: the global_edit functions are "gimp_"
	prefixed now.

	* app/gui/file-commands.[ch]: added file_last_opened_cmd_callback()
	here.

	* app/widgets/Makefile.am
	* app/widgets/widgets-types.h
	* app/widgets/gimpbrushfactoryview.[ch]: new widget: a
	GimpDataFactory subclass with a "spacing" scale.

	* app/widgets/gimpcontainereditor.[ch]:

	- Connect to the GimpContainerView's "select_item",
	  "activate_item" and "context_item" signals here once instead of
	  in each subclass and dispatch them via new virtual functions.
	- Added a convenience function which makes DND to the buttons much
	  less painful for subclasses.

	* app/widgets/gimpbufferview.c
	* app/widgets/gimpdatafactoryview.[ch]: changed accordingly.

	* app/widgets/gimpdialogfactory.[ch]:

	- Added gimp_dialog_factory_dialog_raise() which can raise
	  toplevel dialogs _and_ dockables (and creates them if they are
	  not open yet).
	- Keep track of all created dialogs (not only toplevels).
	- Added an "aux_info" field to GimpSessionInfo which is a GList of
	  gchar* and is saved in sessionrc.
	- Remember if GimpImageDock's image menu is visible by using an
	  aux_info string.
	- The code did not become nicer with all those new constraints. I
	  have to add comments before I forget how it works.

	* app/widgets/gimpdockbook.c: set the state of the "Show Image Menu"
	menu item before popping up the item factory.

	* app/widgets/gimpimagedock.[ch]: added
	gimp_image_dock_set_show_image_meu().

	* plug-ins/gdyntext/gdyntext.c
	* plug-ins/perl/examples/fit-text
	* plug-ins/perl/examples/terral_text
	* plug-ins/perl/examples/tex-to-float: register all text rendering
	plug-ins under <Image>/Filters/Text

	* app/pdb/brush_select_cmds.c
	* app/pdb/drawable_cmds.c
	* app/pdb/edit_cmds.c
	* tools/pdbgen/pdb/brush_select.pdb
	* tools/pdbgen/pdb/edit.pdb
	* tools/pdbgen/enums.pl
	* po/POTFILES.in: changed according to all the stuff above.
2001-06-29 19:25:03 +00:00

108 lines
3.7 KiB
Perl

#!/usr/app/bin/perl
eval 'exec /usr/app/bin/perl -S $0 ${1+"$@"}'
if 0; # not running under some shell
# Terral Text
# by Seth Burgess <sjburges@gimp.org>
# 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 qw(:auto __ N_);
use Gimp::Fu;
use Gimp::Util;
# Gimp::set_trace(TRACE_ALL);
register
"terraltext",
"Make a cool text bumpmap thingy",
"Does a neat text render effect. If you uncheck the box, it uses the current layer. ".
"Otherwise, it overwrites the current layer and uses a solid noise",
"Seth Burgess",
"Seth Burgess <sjburges\@gimp.org>",
"1999-03-15",
N_"<Image>/Filters/Text/Terral Text...",
"RGB*,GRAY*",
[
[ PF_RADIO, "solid_noise", "The Texture Type", 0, ["solid noise" => 1, "current picture" => 0]],
[ PF_FONT, "font_name", "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.
# Hello, Seth.. look at this:
$textlayer = $img->layer_new($img->width, $img->height, $img->layertype(1),
"TextLayer", 100, 0);
$img->add_layer($textlayer,1);
palette_set_background([255,255,255]);
$textlayer->edit_fill(BG_IMAGE_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;