Skip Menu |

This queue is for tickets about the Imager CPAN distribution.

Report information
The Basics
Id: 103786
Status: resolved
Priority: 0/
Queue: Imager

People
Owner: Nobody in particular
Requestors: futuramedium [...] yandex.ru
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 1.000
  • 1.002
Fixed in: (no value)



Subject: A bug in flood fill algorithm
Consider this program: use strict; use warnings; use Imager; my $i = Imager-> new( xsize => 100, ysize => 100 ); $i-> box( box => [ 0, 0, 49, 49 ], filled => 1 ); $i-> box( box => [ 50, 50, 99, 99 ], filled => 1 ); my $j = $i-> copy(); $i-> flood_fill( x => 0, y => 0, color => 'red' ); $i-> write( file => '1.png' ); $j-> flood_fill( x => 99, y => 99, color => 'red' ); $j-> write( file => '2.png' ); I would expect 2 images to be the same, but they are different -- an issue with 4 way connectivity, as I understand.
Subject: 1.png
Download 1.png
image/png 302b
1.png
Subject: 2.png
Download 2.png
image/png 301b
2.png
Subject: test_imager1.pl
use strict; use warnings; use Imager; my $i = Imager-> new( xsize => 100, ysize => 100 ); $i-> box( box => [ 0, 0, 49, 49 ], filled => 1 ); $i-> box( box => [ 50, 50, 99, 99 ], filled => 1 ); my $j = $i-> copy(); $i-> flood_fill( x => 0, y => 0, color => 'red' ); $i-> write( file => '1.png' ); $j-> flood_fill( x => 99, y => 99, color => 'red' ); $j-> write( file => '2.png' ); __END__
From: futuramedium [...] yandex.ru
Sorry, not "the same", of course, but similar -- with either 2nd or 4th quadrants being filled with red.
On Fri Apr 17 19:33:58 2015, vadimr wrote: Show quoted text
> Sorry, not "the same", of course, but similar -- with either 2nd or > 4th quadrants being filled with red.
Thanks, I've reproduced this. At first I thought it might have been due to a change I made a while ago, but reverting that didn't fix it. Tony
On Fri Apr 24 02:22:56 2015, TONYC wrote: Show quoted text
> On Fri Apr 17 19:33:58 2015, vadimr wrote:
> > Sorry, not "the same", of course, but similar -- with either 2nd or > > 4th quadrants being filled with red.
> > Thanks, I've reproduced this. > > At first I thought it might have been due to a change I made a while > ago, but > reverting that didn't fix it.
I found the cause, an off-by-one error in the pseudo-code that Arnar based Imager's implementation on. This will be fixed in the next release of Imager. Thanks for the report. Tony
On Sat Apr 25 23:43:53 2015, TONYC wrote: Show quoted text
> On Fri Apr 24 02:22:56 2015, TONYC wrote:
> > On Fri Apr 17 19:33:58 2015, vadimr wrote:
> > > Sorry, not "the same", of course, but similar -- with either 2nd or > > > 4th quadrants being filled with red.
> > > > Thanks, I've reproduced this. > > > > At first I thought it might have been due to a change I made a while > > ago, but > > reverting that didn't fix it.
> > I found the cause, an off-by-one error in the pseudo-code that Arnar based > Imager's implementation on. > > This will be fixed in the next release of Imager.
This was fixed in Imager 1.003. Tony