Skip to content

Commit

Permalink
- give the colorcount() and maxcolors() methods their own entries and
Browse files Browse the repository at this point in the history
  add them to the method index.
  • Loading branch information
Tony Cook committed Jun 2, 2005
1 parent a27078d commit b8c8bcc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Imager/Changes
Expand Up @@ -1113,6 +1113,10 @@ Revision history for Perl extension Imager.
0.45 Mon 30 May 2005
- t/t105gif.t wasn't handling buggy giflibs correctly

0.45_01
- give the colorcount() and maxcolors() methods their own entries and
add them to the method index.

=================================================================

For latest versions check the Imager-devel pages:
Expand Down
4 changes: 4 additions & 0 deletions Imager/Imager.pm
Expand Up @@ -2925,6 +2925,8 @@ box() - L<Imager::Draw/box>
circle() - L<Imager::Draw/circle>
colorcount() - L<Imager::Draw/colorcount>
convert() - L<Imager::Transformations/"Color transformations"> -
transform the color space
Expand Down Expand Up @@ -2971,6 +2973,8 @@ masked() - L<Imager::ImageTypes> - make a masked image
matrix_transform() - L<Imager::Engines/"Matrix Transformations">
maxcolors() - L<Imager::ImageTypes/maxcolor>
new() - L<Imager::ImageTypes>
open() - L<Imager::Files> - an alias for read()
Expand Down
18 changes: 14 additions & 4 deletions Imager/lib/Imager/ImageTypes.pod
Expand Up @@ -52,9 +52,10 @@ Imager::ImageTypes - Internal image representation information
print "\n";

} else {

# palette info
my $count = $img->colorcount;
@colors = $img->getcolors();
print "Palette size: ".@colors."\n";
print "Palette size: $count\n";
my $mx = @colors > 4 ? 4 : 0+@colors;
print "First $mx entries:\n";
for (@colors[0..$mx-1]) {
Expand Down Expand Up @@ -291,8 +292,17 @@ To quickly find a color in the palette use findcolor():

which returns undef on failure, or the index of the color.

You can get the current palette size with $img->colorcount, and the
maximum size of the palette with $img->maxcolors.
=item colorcount

Returns the number of colors in the image's palette:

my $count = $img->colorcount;

=item maxcolors

Returns the maximum size of the image's palette.

my $maxcount = $img->maxcolors;

=back

Expand Down

0 comments on commit b8c8bcc

Please sign in to comment.