fixes a regression introduced by the fixes for RT 11972
authorTony Cook <tony@develop=help.com>
Tue, 12 Jun 2007 13:10:20 +0000 (13:10 +0000)
committerTony Cook <tony@develop=help.com>
Tue, 12 Jun 2007 13:10:20 +0000 (13:10 +0000)
http://rt.cpan.org/Ticket/Display.html?id=27546

Changes
render.im
t/t38ft2font.t

diff --git a/Changes b/Changes
index e7294e419337d83fa8543c2bfb9d204d7a554203..64b01ef9959f4062952c876fa9801dda6f747142 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,13 @@
 Imager release history.  Older releases can be found in Changes.old
 
+Imager 0.59
+===========
+
+Bug fixes:
+
+ - fixes a regression introduced by the fixes for RT 11972
+   http://rt.cpan.org/Ticket/Display.html?id=27546
+
 Imager 0.58 - 16 May 2007
 ===========
 
index c096ec92b69ba50b2ace45d4d3329fe36f410ae7..54d47dfdf748413f6aebe9dc3fbf719ea8483a59 100644 (file)
--- a/render.im
+++ b/render.im
@@ -185,7 +185,7 @@ IM_SUFFIX(render_color_alpha)(i_render *r, int x, int y, int width,
     if (src_alpha == IM_SAMPLE_MAX)
       *linep = STORE_COLOR;
     else if (src_alpha) {
-      IM_WORK_T remains =  - src_alpha;
+      IM_WORK_T remains = IM_SAMPLE_MAX - src_alpha;
       IM_WORK_T orig_alpha = linep->channel[alpha_channel];
       IM_WORK_T dest_alpha = src_alpha + (remains * orig_alpha) / IM_SAMPLE_MAX;
       for (ch = 0; ch < alpha_channel; ++ch) {
index 63e42582798564f57725c5a8b2e7ea5a371b1eef..19e0cc6a70a826590816dc32bbf6749eb3690dc5 100644 (file)
@@ -1,6 +1,6 @@
 #!perl -w
 use strict;
-use Test::More tests => 182;
+use Test::More tests => 183;
 ++$|;
 # Before `make install' is performed this script should be runnable with
 # `make test'. After `make install' it should work as `perl test.pl'
@@ -20,13 +20,13 @@ my @base_color = (64, 255, 64);
 
 SKIP:
 {
-  i_has_format("ft2") or skip("no freetype2 library found", 181);
+  i_has_format("ft2") or skip("no freetype2 library found", 182);
 
   print "# has ft2\n";
   
   my $fontname=$ENV{'TTFONTTEST'}||'./fontfiles/dodge.ttf';
 
-  -f $fontname or skip("cannot find fontfile $fontname", 181);
+  -f $fontname or skip("cannot find fontfile $fontname", 182);
 
 
   my $bgcolor=i_color_new(255,0,0,0);
@@ -466,6 +466,15 @@ SKIP:
     is_color3($colors[0], 0, 0, 0, "check we got black");
     is_color3($colors[1], 255, 0, 0, "and red");
   }
+
+  { # RT 27546
+    my $im = Imager->new(xsize => 100, ysize => 100, channels => 4);
+    $im->box(filled => 1, color => '#ff0000FF');
+    my $font = Imager::Font->new(file=>'fontfiles/ImUgly.ttf', type=>'ft2');
+    ok($im->string(x => 0, 'y' => 40, text => 'test', 
+                  size => 11, sizew => 11, font => $font, aa => 1),
+       'draw on translucent image')
+  }
 }
 
 sub align_test {