Esempio n. 1
0
 public function flip($iMode)
 {
     $iWidth = $this->getWidth();
     $iHeight = $this->getHeight();
     $src_x = 0;
     $src_y = 0;
     $src_width = $iWidth;
     $src_height = $iHeight;
     switch ($iMode) {
         case 1:
             //vertical
             $src_y = $iHeight - 1;
             $src_height = -$iHeight;
             break;
         case 2:
             //horizontal
             $src_x = $iWidth - 1;
             $src_width = -$iWidth;
             break;
         case 3:
             //both
             $src_x = $iWidth - 1;
             $src_y = $iHeight - 1;
             $src_width = -$iWidth;
             $src_height = -$iHeight;
             break;
         default:
             return;
     }
     $imgdest = new GDImage($iWidth, $iHeight);
     $imgdest->setAntiAlias($this->isAntiAlias());
     $imgdest->setAlphaBlending($this->isAlphaBlending());
     $imgdest->set8BitAlpha($this->is8BitAlpha());
     $imgdest->copyResampled($this, 0, 0, $src_x, $src_y, $iWidth, $iHeight, $src_width, $src_height);
     $this->replace($imgdest);
 }