Skip to content

Commit

Permalink
Add functions
Browse files Browse the repository at this point in the history
  • Loading branch information
benkasminbullock committed Apr 26, 2021
1 parent b5269c1 commit 64ed7dc
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 26 deletions.
5 changes: 3 additions & 2 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Revision history for Perl module Image::PNG::Data

0.00_02 2021-02-03
0.01 2021-04-26

- Initial version (was previously Image::PNG::Util)

- Initial version

34 changes: 14 additions & 20 deletions lib/Image/PNG/Data.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ our @EXPORT_OK = qw/
alpha_unused
any2gray8
bwpng
pngback
pngpixelate
pngmono
rgb2gray
rmalpha
/;

our %EXPORT_TAGS = (
all => \@EXPORT_OK,
);
our $VERSION = '0.00_02';

our $VERSION = '0.01';
require XSLoader;
XSLoader::load ('Image::PNG::Data', $VERSION);

Expand Down Expand Up @@ -100,27 +105,16 @@ sub any2gray8
return $wpng;
}

sub poo
sub pngmono
{
my ($data) = @_;
my $type;
for (@$data) {
if (ref $_ eq 'ARRAY') {
if ($type && $type ne '2d') {
carp "bwpng's argument has mixed rows";
return undef;
}
$type = '2d';
}
if (ref $_ eq '') {
$type = 'string';
}
}
if ($type ne '2d' && $type ne 'string') {
carp "bwpng doesn't know what to do with this input";
return undef;
}
}

sub pngback
{
}

sub pngpixelate
{
}

sub bwpng
Expand Down
10 changes: 7 additions & 3 deletions lib/Image/PNG/Data.pod.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ This module provides various utilities for manipulating and testing
the image data part of a PNG image. This is a companion module to
L<Image::PNG::Libpng> by the same authors.

B<The documentation below refers to functions which are not yet
implemented.>

=head1 FUNCTIONS

=head2 alpha_unused
Expand Down Expand Up @@ -75,7 +78,8 @@ This function is not supported for versions of libpng earlier than

my $png = bwpng (\@rows, sq => 20);

Convert boolean-style data into a black and white PNG.
Convert boolean-style data into a black and white PNG. A two-color PNG
is also possible:

bwpng (\@rows, black => '#CFF', white => '#C00');

Expand All @@ -87,7 +91,7 @@ Convert boolean-style data into a black and white PNG.

my $gray_png = rgb2gray ('colorful.png');

Convert RGB to gray.
Convert an RGB PNG image to a grayscale one.

Options:

Expand All @@ -106,7 +110,7 @@ structure for writing with the alpha channel data removed.

=head2 split_alpha

Copy from IPL.
Unimplemented, due to be copied from L<Image::PNG::Libpng>.

=head1 DEPENDENCIES

Expand Down
2 changes: 1 addition & 1 deletion t/bwpng.t
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ my $qr = <<EOF;
* * ** * * ***
******* * * ****
EOF

ok (1);
done_testing ();

0 comments on commit 64ed7dc

Please sign in to comment.