/** * 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; }
/** * Factory method for creating a true-color image * * @param int $width * @param int $height * @return WideImage_TrueColorImage */ static function createTrueColorImage($width, $height) { return WideImage_TrueColorImage::create($width, $height); }