/**
  * Returns a copy of the image
  * 
  * @param $trueColor True if the new image should be truecolor
  * @return WideImage_Image
  */
 protected function copyAsNew($trueColor = false)
 {
     $width = $this->getWidth();
     $height = $this->getHeight();
     if ($trueColor) {
         $new = WideImage_TrueColorImage::create($width, $height);
     } else {
         $new = WideImage_PaletteImage::create($width, $height);
     }
     // copy transparency of source to target
     if ($this->isTransparent()) {
         $rgb = $this->getTransparentColorRGB();
         if (is_array($rgb)) {
             $tci = $new->allocateColor($rgb['red'], $rgb['green'], $rgb['blue']);
             $new->fill(0, 0, $tci);
             $new->setTransparentColor($tci);
         }
     }
     imageCopy($new->getHandle(), $this->handle, 0, 0, 0, 0, $width, $height);
     return $new;
 }
Пример #2
0
 /**
  * Factory method for creating a palette image
  * 
  * @param int $width
  * @param int $height
  * @return WideImage_PaletteImage
  */
 static function createPaletteImage($width, $height)
 {
     return WideImage_PaletteImage::create($width, $height);
 }