本文整理匯總了PHP中WideImage_Image::getTransparentColorRGB方法的典型用法代碼示例。如果您正苦於以下問題:PHP WideImage_Image::getTransparentColorRGB方法的具體用法?PHP WideImage_Image::getTransparentColorRGB怎麽用?PHP WideImage_Image::getTransparentColorRGB使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WideImage_Image
的用法示例。
在下文中一共展示了WideImage_Image::getTransparentColorRGB方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
/**
* Returns a greyscale copy of an image
*
* @param WideImage_Image $image
* @return WideImage_Image
*/
function execute($image)
{
$palette = !$image->isTrueColor();
$transparent = $image->isTransparent();
if ($palette && $transparent) {
$tcrgb = $image->getTransparentColorRGB();
}
$new = $image->asTrueColor();
if (!imagefilter($new->getHandle(), IMG_FILTER_NEGATE)) {
throw new WideImage_GDFunctionResultException("imagefilter() returned false");
}
if ($palette) {
$new = $new->asPalette();
if ($transparent) {
$irgb = array('red' => 255 - $tcrgb['red'], 'green' => 255 - $tcrgb['green'], 'blue' => 255 - $tcrgb['blue'], 'alpha' => 127);
// needs imagecolorexactalpha instead of imagecolorexact, otherwise doesn't work on some transparent GIF images
$new_tci = imagecolorexactalpha($new->getHandle(), $irgb['red'], $irgb['green'], $irgb['blue'], 127);
$new->setTransparentColor($new_tci);
}
}
return $new;
}