Changeset 4748 for extensions/pLoader


Ignore:
Timestamp:
Jan 26, 2010, 8:20:25 AM (15 years ago)
Author:
ronosman
Message:

Remove useless code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/pLoader/trunk/src/Uploader/GUI/wxApp.pm

    r4718 r4748  
    562562    $self->imagelist->SetCurrentImage(-1);
    563563
    564     $self->imagelist->RescaleCallback(
    565         sub { $self->RescaleImage(@_) }
    566     );
    567 
    568564    $self->imagelist->ResizeCallback(
    569565        sub { $self->ResizeImage(@_) }
     
    616612        version          => $self->version,
    617613        imagelist_version => $self->imagelist_version,
    618         RescaleCallback  => sub { $self->RescaleImage(@_) },
    619614        ResizeCallback   => sub { $self->ResizeImage(@_) },
    620615        watermark_text => $self->user_defined_properties->{watermark_text}||gettext("my watermark"),
     
    801796
    802797
    803 sub RescaleImage {
    804     my ( $self, $image_file, $image_file_out, $type, $ratio, $width, $height, $quality ) = @_;
     798
     799sub ResizeImage {
     800    my ( $self, $image_file, $image_file_out, $type, $width, $height, $quality ) = @_;
    805801   
    806802
     
    810806            0
    811807    );
    812    
     808
    813809    my $w;
    814810    my $h;
     
    817813    my $img_h = $image->GetHeight;
    818814   
    819     # use a ratio ( 25% default ) if defined
    820     # default ratio is used for preview.
    821     if($ratio){
    822         $w = $ratio*$img_w/100 ;
    823         $h = $ratio*$img_h/100 ;
    824     }
    825     # use specified width and height
    826     else{
    827815        # portrait
    828816        if( $img_w < $img_h ){
     
    837825            ($w*$img_h)/$img_w
    838826        );
    839     }
     827
     828   
    840829
    841830    $image->Rescale(
     
    844833        wxIMAGE_QUALITY_HIGH
    845834    );
    846    
    847     $quality ||= 90;
    848    
    849     $image->SetOption(
    850         "quality",
    851         $quality
    852     );
    853    
    854     if(!$image->SaveFile(
    855         $image_file_out,
    856         $self->GetWxBitmapType($type),
    857     )){
    858         Wx::LogMessage(
    859             gettext("An error has occured. Can not save file %s"),
    860             $image_file_out,
    861         )
    862     };
    863 }
    864 
    865 sub ResizeImage {
    866     my ( $self, $image_file, $image_file_out, $type, $width, $height, $quality ) = @_;
    867    
    868 
    869     my $image = Wx::Image->new(
    870             $image_file,
    871             $self->GetWxBitmapType($type),
    872             0
    873     );
    874 
    875     my $w;
    876     my $h;
    877 
    878     my $img_w = $image->GetWidth;
    879     my $img_h = $image->GetHeight;
    880    
    881         # portrait
    882         if( $img_w < $img_h ){
    883             $w = $height;
    884         }
    885         else{
    886             $w = $width;
    887         }
    888         # to respect aspect ratio
    889         $h = sprintf(
    890             "%.0f",
    891             ($w*$img_h)/$img_w
    892         );
    893 
    894    
    895 
    896     $image->Rescale(
    897         $w,
    898         $h,
    899         wxIMAGE_QUALITY_HIGH
    900     );
    901 
    902     $image->Resize(
    903         [ $width, $height ], [ 0, 20],
    904     );
     835
     836    #$image->Resize(
     837    #    [ $width, $height ], [ 0, 20],
     838    #);
    905839   
    906840    $quality ||= 90;
Note: See TracChangeset for help on using the changeset viewer.