scale size parameters are a reference.
http://rt.cpan.org/Ticket/Display.html?id=35172
+ - Regression: filling a greyscale image with a hatch used the wrong
+ color channels from the supplied fg/bg colors.
+ https://rt.cpan.org/Ticket/Display.html?id=35278
+
Imager 0.63 - 7 April 2008
===========
int byte = f->hatch[(y + f->dy) & 7];
int xpos = (x + f->dx) & 7;
int mask = 128 >> xpos;
+ i_color fg = f->fg;
+ i_color bg = f->bg;
+ int want_channels = channels > 2 ? 4 : 2;
+
+ if (channels < 3) {
+ i_adapt_colors(2, 4, &fg, 1);
+ i_adapt_colors(2, 4, &bg, 1);
+ }
while (width-- > 0) {
if (byte & mask)
- *data++ = f->fg;
+ *data++ = fg;
else
- *data++ = f->bg;
+ *data++ = bg;
if ((mask >>= 1) == 0)
mask = 128;
int byte = f->hatch[(y + f->dy) & 7];
int xpos = (x + f->dx) & 7;
int mask = 128 >> xpos;
+ i_fcolor fg = f->ffg;
+ i_fcolor bg = f->fbg;
+
+ if (channels < 3) {
+ i_adapt_fcolors(2, 4, &fg, 1);
+ i_adapt_fcolors(2, 4, &bg, 1);
+ }
while (width-- > 0) {
if (byte & mask)
- *data++ = f->ffg;
+ *data++ = fg;
else
- *data++ = f->fbg;
+ *data++ = bg;
if ((mask >>= 1) == 0)
mask = 128;
#!perl -w
use strict;
-use Test::More tests => 121;
+use Test::More tests => 123;
use Imager ':handy';
use Imager::Fill;
use Imager::Color::Float;
+use Imager::Test qw(is_image);
use Config;
Imager::init_log("testout/t20fill.log", 1);
cmp_ok(Imager->errstr, '=~', 'No color named', "check error message");
}
+{ # RT #35278
+ # hatch fills on a grey scale image don't adapt colors
+ for my $bits (8, 'double') {
+ my $im_g = Imager->new(xsize => 10, ysize => 10, channels => 1, bits => $bits);
+ $im_g->box(filled => 1, color => 'FFFFFF');
+ my $fill = Imager::Fill->new
+ (
+ combine => 'normal',
+ hatch => 'weave',
+ fg => '000000',
+ bg => 'FFFFFF'
+ );
+ $im_g->box(fill => $fill);
+ my $im_c = Imager->new(xsize => 10, ysize => 10, channels => 3, bits => $bits);
+ $im_c->box(filled => 1, color => 'FFFFFF');
+ $im_c->box(fill => $fill);
+ my $im_cg = $im_g->convert(preset => 'rgb');
+ is_image($im_c, $im_cg, "check hatch is the same between color and greyscale");
+ }
+}
+
sub color_close {
my ($c1, $c2) = @_;