[gimp-perl] Make ColorDB able to handle spaces in names. Bug 728535



commit bf95c776108e7d6641ce7f027f0f588931f8a882
Author: Ed J <m8r-35s8eo mailinator com>
Date:   Sat Apr 19 01:41:50 2014 +0100

    Make ColorDB able to handle spaces in names. Bug 728535

 Gimp/ColorDB.pm |    3 ++-
 UI/UI.pm        |    2 +-
 examples/dots   |    3 ++-
 t/supplied.t    |    8 ++++----
 4 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/Gimp/ColorDB.pm b/Gimp/ColorDB.pm
index 8d154d1..9d84fc5 100644
--- a/Gimp/ColorDB.pm
+++ b/Gimp/ColorDB.pm
@@ -36,6 +36,7 @@ sub canonicalize_colour {
       return [ map { hex($_)/255.0 } ($1, $2, $3) ];
    } else {
       unless (%rgb_db) {
+        local ($_, *RGB_TEXT);
          if ($rgb_db_path) {
             open RGB_TEXT, "<", $rgb_db_path or croak "$rgb_db_path: $!";
          } else {
@@ -43,7 +44,7 @@ sub canonicalize_colour {
          }
          while(<RGB_TEXT>) {
            my @rgb = split ' ';
-           my $label = lc pop @rgb;
+           my $label = lc join ' ', splice @rgb, 3;
             next unless @rgb == 3 and not grep { $_ ne int $_ } @rgb;
             $rgb_db{$label} = [ map { $_ / 255.0 } @rgb ];
          }
diff --git a/UI/UI.pm b/UI/UI.pm
index 12e250b..e548000 100644
--- a/UI/UI.pm
+++ b/UI/UI.pm
@@ -342,7 +342,7 @@ sub get_list { Gimp->gradients_get_list("") }
 sub new_pixbuf {
    use POSIX;
    my @grad_row = map { $_ = abs(ceil($_*255 - 0.5)) }
-                   Gradient->get_uniform_samples ($_,100,0);
+                   Gimp::Gradient->get_uniform_samples ($_,100,0);
 
 # make it 16 tall; there's bound to be a better way to do this? (its slow)
    push @grad_row, @grad_row, @grad_row, @grad_row,
diff --git a/examples/dots b/examples/dots
index d147a14..f29bb44 100755
--- a/examples/dots
+++ b/examples/dots
@@ -3,11 +3,12 @@
 # <sjburges gimp org>
 # Generate dots within a selection.
 
+#BEGIN { $Gimp::verbose = 1; }
 use Gimp qw(:auto __ N_);
 use Gimp::Fu;
 use Gimp::Util;
 
-# Gimp::set_trace(TRACE_ALL);
+#Gimp::set_trace(TRACE_ALL);
 
 register "dots",
          "Dots",
diff --git a/t/supplied.t b/t/supplied.t
index 72bf8d2..90eba92 100644
--- a/t/supplied.t
+++ b/t/supplied.t
@@ -45,10 +45,10 @@ use constant {
   REQ_FILE  => 1 << 5,
 };
 
-my $color1 = [0,0,1.0];
-my $color2 = [0.4,0,1.0];
-my $black = [0,0,0];
-my $white  = [1,1,1];
+my $color1 = 'blue';
+my $color2 = 'dark red';
+my $black = 'black';
+my $white  = 'white';
 my $gradient1 = "Burning Paper";
 my $width     = 10;
 my $height    = 10;


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