[gimp-perl] blended2_translogo_uncorrupted_final3



commit 1b7ecb1788280ffd5f0a6b4d9572e69d04c9b40b
Author: Michele <michele gherlone liceoberchet it>
Date:   Wed May 28 23:06:32 2014 +0200

    blended2_translogo_uncorrupted_final3
    
    Signed-off-by: Ed J <edj src gnome org>

 examples/blended2  |  127 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 examples/translogo |  121 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 248 insertions(+), 0 deletions(-)
---
diff --git a/examples/blended2 b/examples/blended2
new file mode 100755
index 0000000..0b071b6
--- /dev/null
+++ b/examples/blended2
@@ -0,0 +1,127 @@
+#!/usr/bin/perl
+
+use Gimp;
+use Gimp::Fu;
+use Gimp::Util;
+use warnings;
+use strict;
+
+podregister {
+  die "Must have alpha channel\n" unless $drawable->has_alpha;
+  Gimp::Context->push();
+  my $new_image = Gimp::Image->new($drawable->width,$drawable->height, RGB_IMAGE);
+  $drawable->get_image->selection_all;
+  $drawable->edit_copy;
+  $image->selection_none;
+  if ($transparency == 0) {
+    my $bg_layer=$new_image->layer_new($drawable->width,$drawable->height,$image->layertype(1), 
"Background", 100, NORMAL_MODE);
+    Gimp::Context->set_background ($bg_col);
+    $bg_layer->drawable_fill(BACKGROUND_FILL);
+    $new_image->insert_layer($bg_layer,0,0);
+  }
+  my $text1_lay = $new_image->layer_new(
+    $drawable->width,$drawable->height,
+    $image->layertype(1), "Text -1-", 100, NORMAL_MODE
+  );
+  $new_image->insert_layer($text1_lay,0,-1);
+  $text1_lay->edit_clear;
+  $text1_lay->edit_paste(0)->floating_sel_anchor;
+  $text1_lay->set_lock_alpha(1);
+  Gimp::Context->set_foreground ($bl1);
+  Gimp::Context->set_background ($bl2);
+  my @start = ($text1_lay->width / 2 - 5, 0);
+  my @end = ($text1_lay->width / 2 + 5, $text1_lay->height);
+  $text1_lay->edit_blend(
+                  FG_BG_RGB_MODE,
+                  NORMAL_MODE,
+                  GRADIENT_LINEAR,
+                  100,
+                  FALSE,
+                  REPEAT_NONE,
+                  FALSE, # reverse
+                  FALSE, # supersampling
+                  2, # recursion levels
+                  0.30, # threshold
+                  FALSE, # dithering
+                  @start, @end);
+  my $text2_lay=$text1_lay->copy(TRUE);
+  $text2_lay->add_alpha;
+  $new_image->insert_layer($text2_lay, 0, -1);
+  Gimp::Context->set_background ([255, 255, 255]);
+  $text2_lay->edit_fill(BACKGROUND_FILL);
+  $text1_lay->set_lock_alpha(0);
+  $text2_lay->set_lock_alpha(0);
+  $text2_lay->gauss_rle( 6, 1, 1);
+  $new_image->bump_map($text1_lay, $text2_lay, 110.0, $elev, $depth, 0, 0, 0, 0, FALSE, FALSE, 0);
+  $text2_lay->invert;
+  $new_image->lower_item($text2_lay);
+  $text2_lay->translate(2, 3);
+  $text2_lay->set_opacity(75);
+  $new_image->flatten;
+  if ($transparency == 1) {
+    $new_image->convert_indexed(0, MAKE_PALETTE, 256, 0, 0, "");
+    my $new_layer = $new_image->get_active_layer;
+    $new_layer->add_alpha;
+    Gimp::Context->set_sample_threshold(0.55);
+    Gimp::Context->set_antialias(0);
+    Gimp::Context->set_feather(0);
+    Gimp::Context->set_feather_radius(0,0);
+    Gimp::Context->set_sample_merged(0);
+    $new_image->select_color(CHANNEL_OP_ADD, $new_layer, [255, 255, 255]);
+    $new_layer->edit_clear;
+    $new_image->selection_none;
+  }
+  eval {
+    Gimp::Display->new($new_image);
+  };
+  return $new_image;
+};
+exit main;
+__END__
+
+=head1 NAME
+
+make_bevel_logos - A script to get blended beveled logos
+
+=head1 SYNOPSIS
+
+<Image>/Filters/Render/Blended Logo...
+
+=head1 DESCRIPTION
+
+This script will produce a new image with a blended beveled logo from
+your alpha layer, which must have black text. You can choose the initial
+and final colours of the blend, the background, and how to tweak the
+bevel effect. It uses a technique quite similar to that in the Inner
+Bevel Logo.
+
+=head1 PARAMETERS
+
+ [PF_COLOUR    , 'bg_col', "Background colour", [255, 255, 255]],
+ [PF_COLOUR    , 'bl1',  "1st blend colour", [247, 231, 9]],
+ [PF_COLOUR    , 'bl2',   "2nd blend colour", [255, 0, 0]],
+ [PF_SLIDER    , 'elev', "Strength of bevel", 45.00, [0.00, 60.00, 0.50]],
+ [PF_SLIDER    , 'depth', "Depth of bevel", 4, [1, 20, 1]],
+ [PF_RADIO     , 'transparency', "The user's choice for an alpha or colored background", 0, [Background => 
0, Transparent => 1]],
+
+=head1 RETURN VALUES
+
+ [PF_IMAGE     , 'image', "Logo"],
+
+=head1 IMAGE TYPES
+
+RGBA
+
+=head1 AUTHOR
+
+Michele Gherlone <michele gherlone liceoberchet it>
+
+=head1 DATE
+
+20140526
+
+=head1 LICENSE
+
+(c) 2014 Michele Gherlone.
+
+Distributed under the same terms as Gimp Perl.
diff --git a/examples/translogo b/examples/translogo
new file mode 100755
index 0000000..2599c08
--- /dev/null
+++ b/examples/translogo
@@ -0,0 +1,121 @@
+#!/usr/bin/perl
+
+use Gimp;
+use Gimp::Fu;
+use Gimp::Util;
+use warnings;
+use strict;
+
+podregister {
+  Gimp::Context->push();
+  $drawable->has_alpha or die __"You can't run this script without an ALPHA CHANNEL!!";
+  if ($drawable->type_with_alpha == INDEXEDA_IMAGE) {
+    die __"You can't run this script with an INDEXED image!!";
+  } elsif ($drawable->type_with_alpha == GRAYA_IMAGE) {
+    $image->convert_rgb
+  }
+  my $img = Gimp::Image->new(100, 100, RGB_IMAGE);
+  $drawable->get_image->selection_all;
+  $drawable->edit_copy;
+  $image->selection_none;
+  my $layer = $img->layer_new($drawable->width,$drawable->height,$image->layertype(1), __"Text", 100, 
NORMAL_MODE);
+  $layer->drawable_fill(TRANSPARENT_FILL);
+  $img->insert_layer($layer,0,0);
+  $layer->edit_paste(0)->floating_sel_anchor;
+  $img->resize($drawable->width,$drawable->height, 0, 0);
+  $img->select_item(CHANNEL_OP_REPLACE, $layer);
+  $img->selection_invert;
+  Gimp::Context->set_background ([255, 255, 255]);
+  $layer->edit_fill(BACKGROUND_FILL);
+  $img->selection_none;
+  $layer->invert;
+  $layer->gauss_rle(2.0, 1, 1);
+  my $bump_lay = $img->layer_new($img->width,$img->height, RGBA_IMAGE, __"Bumpmap", 100, NORMAL_MODE);
+  $bump_lay->drawable_fill(BACKGROUND_FILL);
+  $img->insert_layer($bump_lay,0,0);
+  if ($color_or_pattern == 1) {
+    Gimp::Context->set_pattern ($pattern);
+    $bump_lay->bucket_fill(PATTERN_BUCKET_FILL, NORMAL_MODE, 100, 0, 0, 0, 0);
+  } else {
+    Gimp::Context->set_background ($txt_col);
+    $bump_lay->edit_fill(BACKGROUND_FILL);
+  }
+  $bump_lay->bump_map($layer, 110.0, 45.0, 4, 0, 0, 0, 0, 1, 0, 0);
+  my $pattern_mask = $bump_lay->create_mask(ADD_ALPHA_MASK);
+  $bump_lay->add_mask($pattern_mask);
+  $img->selection_all;
+  $layer->edit_copy;
+  $pattern_mask->edit_paste(0)->floating_sel_anchor;
+  $pattern_mask->levels(0, 0, 77, 0.91, 0, 255);
+  $bump_lay->remove_mask(MASK_APPLY);
+  $layer->invert;
+  $img->flatten;
+  $img->convert_indexed(0, MAKE_PALETTE, 256, 0, 0, "");
+  my $new = $img->get_active_layer;
+  $new->add_alpha;
+  $img->select_color(CHANNEL_OP_ADD, $new, [255, 255, 255]);
+  $new->edit_clear;
+  $img->selection_none;
+  eval {
+   Gimp::Display->new($img);
+  };
+  return $img;
+};
+exit main;
+__END__
+
+=head1 NAME
+
+make_trans_logos - A script to get transparent beveled logos
+
+=head1 SYNOPSIS
+
+<Image>/Filters/Web/Transparent Logo...
+
+=head1 DESCRIPTION
+
+This script aims to produce a transparent logo in an indexed image
+which is ready to be saved in .gif format. If you need a transparent
+image containing a logo for your web page, just apply this script over
+a drawable with an alpha channel in RGB or GRAY mode.
+
+You can choose between colour and pattern fill of your text.
+
+As an input, you need to have an image that has an alpha channel,
+and isn't 100% opaque - it's really designed to work with a text layer.
+It will then make a "logo" out of your non-white sections of the image
+and index it.  The original image is untouched.
+
+=head1 PARAMETERS
+
+ [PF_RADIO, 'color_or_pattern', 'Use a colour or a pattern for text', 0,
+    [Colour => 0, Pattern => 1]],
+ [PF_PATTERN, 'pattern', "Text pattern", "Wood #1"],
+ [PF_COLOUR, 'txt_col', "Text color", [69, 88, 211]],
+
+=head1 RETURN VALUES
+
+ [PF_IMAGE,    'image', "Logo"],
+
+=head1 IMAGE TYPES
+
+RGBA
+
+=head1 HISTORY
+
+  12/5/03: <sjburges gimp org>
+   s/Gimp->convert/Gimp->image_convert/
+
+=head1 AUTHOR
+
+Michele Gherlone <michele gherlone liceoberchet it>
+
+=head1 DATE
+
+20140526
+
+=head1 LICENSE
+
+(c) 2014 M. Gherlone
+
+Distributed under the same terms as Gimp Perl.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]