From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

### a repr of an image so that is manipulatable
sub new {
my ($class) = @_;
my $self = { points => (), }; ### points are byte indexes in rect img
### they have colour other than white
$class = ref($class) || $class;
bless $self, $class;
}
### public methods
sub scan_in_points_of_png_image_file {
my ($self, $filename) = @_;
my $reader = GFX::Enhancer::PNGReader->new;
$reader->read_in_byte_array($filename);
for (my $i = 0; $i < $reader->{length}; $i+4) {
my $rgba = GFX::Enhancer::PNGRGBA->new($reader->get_byte_interval($i, $i+4));
if (($rgba->red | $rgba->green | $rgba->blue) > 0) {
push($self->{points}, $i);
}
}
}
### private methods
sub scan_in_image {
my ($self,
}
1;