本文整理匯總了PHP中ezcGraphColor::fromIntegerArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP ezcGraphColor::fromIntegerArray方法的具體用法?PHP ezcGraphColor::fromIntegerArray怎麽用?PHP ezcGraphColor::fromIntegerArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ezcGraphColor
的用法示例。
在下文中一共展示了ezcGraphColor::fromIntegerArray方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testFactoryColorFromIntegerArray
public function testFactoryColorFromIntegerArray()
{
$color = ezcGraphColor::fromIntegerArray(array(5, 23, 42));
$this->assertEquals($color->red, 5, 'Wrong red color value');
$this->assertEquals($color->green, 23, 'Wrong green color value');
$this->assertEquals($color->blue, 42, 'Wrong blue color value');
$this->assertEquals($color->alpha, 0, 'Wrong alpha color value');
}
示例2: create
/**
* Tries to detect type of color color definition and returns an
* ezcGraphColor object
*
* @param mixed $color Some kind of color definition
* @return ezcGraphColor
*/
public static function create($color)
{
if ($color instanceof ezcGraphColor) {
return $color;
} elseif (is_string($color)) {
return ezcGraphColor::fromHex($color);
} elseif (is_array($color)) {
$testElement = reset($color);
if (is_int($testElement)) {
return ezcGraphColor::fromIntegerArray($color);
} else {
return ezcGraphColor::fromFloatArray($color);
}
} else {
throw new ezcGraphUnknownColorDefinitionException($color);
}
}