Commits

Burak Gürsoy committed 3b07b86

fix strip()

  • Participants
  • Parent commits c11bccc

Comments (0)

Files changed (4)

 
 my $mb = Build->new;
 $mb->change_versions(1);
+$mb->copyright_first_year( 2006 );
+$mb->add_pod_author_copyright_license(1);
 $mb->create_build_script;
 
 Time zone is GMT+2.
 
+1.34 Sat Jul 25 04:05:17 2009
+    => Fixed strip color issue related to true color mode (Patrick Tan).
+
 1.33 Wed Apr 22 19:51:37 2009
     => Update builder.
 

lib/GD/Thumbnail.pm

 use strict;
 use vars qw($VERSION %TMP);
 
-$VERSION = '1.33'; # GD version check below breaks ExtUtils::MM
+$VERSION = '1.34'; # GD version check below breaks ExtUtils::MM
 
 use GD;
 use Carp qw( croak );
 my %IS_GD_FONT = map {lc($_), $_ } qw(Small Large MediumBold Tiny Giant);
 my %SIZE; # see _size()
 
+GD::Image->trueColor(1) if GD::Image->can('trueColor');
+
 sub new {
    my $class = shift;
    my %o     = scalar(@_) % 2 ? () : (@_);
       }
    }
 
-   GD::Image->trueColor(1) if GD::Image->can('trueColor');
-
    $type         = DEFAULT_MIME unless $type;
    my $o         = $self->{OVERLAY};
    my $size      = $info2 ? $self->_image_size($image) : 0;
    my $sw     = $font->width * length($string);
    my $sh     = $font->height;
    warn "Thumbnail width ($x) is too small for an info text" if $x < $sw;
-   my $info   = GD::Image->new($x, $sh);
-   $info->colorAllocate(@{ $self->{STRIP_COLOR} });
+   my $info   = GD::Image->new($x, $sh+BUFFER);
+   my $color = $info->colorAllocate(@{ $self->{STRIP_COLOR} });
+   $info->filledRectangle(0,0,$x,$sh+BUFFER,$color);
    $info->string($font, ($x - $sw)/2, 0, $string, $info->colorAllocate(@{ $self->{INFO_COLOR} }));
    return $info, $sh + BUFFER;
 }
 
 =head1 DESCRIPTION
 
-This a thumbnail maker. Thumbnails are smaller versions of the
+This is a thumbnail maker. Thumbnails are smaller versions of the
 original image/graphic/picture and are used for preview purposes,
 where bigger images can take a long time to load. They are also 
 used in image galleries to preview a lot of images at a time.
 This is a I<Yet Another> type of module. There are several 
 other thumbnail modules on CPAN, but they simply don't have 
 the features I need, so this module is written to increase
-the thumbnail population on CPAN.
+the thumbnail generator population on CPAN.
 
 The module can raise an exception if something goes wrong.
 So, you may have to use an C<eval block> to catch them. 
 L<GD>, L<Image::Thumbnail>, L<GD::Image::Thumbnail>, L<Image::GD::Thumbnail>
 L<Image::Magick::Thumbnail>, L<Image::Magick::Thumbnail::Fixed>.
 
-=head1 AUTHOR
-
-Burak Gürsoy, E<lt>burakE<64>cpan.orgE<gt>
-
-=head1 COPYRIGHT
-
-Copyright 2006-2009 Burak Gürsoy. All rights reserved.
-
-=head1 LICENSE
-
-This library is free software; you can redistribute it and/or modify 
-it under the same terms as Perl itself, either Perl version 5.8.8 or, 
-at your option, any later version of Perl 5 you may have available.
-
 =cut
 }
 
 my %opt = (
-   #strip_color => [255, 255, 255],
-   #info_color  => [  0,   0,   0],
+   strip_color => [255, 255, 255],
+   info_color  => [  0,   0,   0],
    square      => 1,
    frame       => 1,
 );