本文整理汇总了PHP中parse_color_declaration函数的典型用法代码示例。如果您正苦于以下问题:PHP parse_color_declaration函数的具体用法?PHP parse_color_declaration怎么用?PHP parse_color_declaration使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_color_declaration函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse_in
function parse_in($value)
{
$values = preg_split("/(?<![,(\\s])\\s+/ ", $value);
switch (count($values)) {
case 1:
$v1 = parse_color_declaration($values[0]);
return array($v1, $v1, $v1, $v1);
case 2:
$v1 = parse_color_declaration($values[0]);
$v2 = parse_color_declaration($values[1]);
return array($v1, $v2, $v1, $v2);
case 3:
$v1 = parse_color_declaration($values[0]);
$v2 = parse_color_declaration($values[1]);
$v3 = parse_color_declaration($values[2]);
return array($v1, $v2, $v3, $v2);
case 4:
$v1 = parse_color_declaration($values[0]);
$v2 = parse_color_declaration($values[1]);
$v3 = parse_color_declaration($values[2]);
$v4 = parse_color_declaration($values[3]);
return array($v1, $v2, $v3, $v4);
default:
return $this->default_value();
}
}
示例2: parse
function parse($value)
{
if ($value === 'inherit') {
return CSS_PROPERTY_INHERIT;
}
return parse_color_declaration($value);
}
示例3: parse
function parse($value)
{
$terms = preg_split("/(?![,(\\s])\\s+/ ", $value);
// Note that color declaration always will contain only one word;
// thus, we can split out value into words and try to parse each one as color
// if parse_color_declaration returns transparent value, it is possible not
// a color part of background declaration
foreach ($terms as $term) {
$color = parse_color_declaration($term, array(-1, -1, -1));
if (!is_transparent($color)) {
return new Color($color, false);
}
}
return CSSBackgroundColor::default_value();
}
示例4: parse
function parse($value)
{
// We should not split terms at whitespaces immediately preceeded by ( or , symbols, as
// it would break "rgb( xxx, yyy, zzz)" notation
//
// As whitespace could be preceeded by another whitespace, we should prevent breaking
// value in the middle of long whitespace too
$terms = preg_split("/(?<![,(\\s])\\s+/ ", $value);
// Note that color declaration always will contain only one word;
// thus, we can split out value into words and try to parse each one as color
// if parse_color_declaration returns transparent value, it is possible not
// a color part of background declaration
foreach ($terms as $term) {
if ($term === 'inherit') {
return CSS_PROPERTY_INHERIT;
}
$color =& parse_color_declaration($term);
if (!$color->isTransparent()) {
return $color;
}
}
return CSSBackgroundColor::default_value();
}
示例5: attr_table_bordercolor_before
function attr_table_bordercolor_before(&$root, &$pipeline)
{
$color = parse_color_declaration($root->get_attribute('bordercolor'));
$css_state =& $pipeline->get_current_css_state();
$border =& $css_state->get_property(CSS_HTML2PS_TABLE_BORDER);
$border =& $border->copy();
$border->left->color = $color;
$border->right->color = $color;
$border->top->color = $color;
$border->bottom->color = $color;
// $css_state->pushState();
// $css_state->set_property(CSS_HTML2PS_TABLE_BORDER, $border);
// $css_state->pushState();
// $css_state->set_property(CSS_BORDER, $border);
}
示例6: css_border_color
function css_border_color($value, $root)
{
$border = get_border();
$subvalues = explode(" ", $value);
switch (count($subvalues)) {
case 1:
$c1 = parse_color_declaration($subvalues[0], array(0, 0, 0));
$border['top']['color'] = $c1;
$border['right']['color'] = $c1;
$border['bottom']['color'] = $c1;
$border['left']['color'] = $c1;
break;
case 2:
$c1 = parse_color_declaration($subvalues[0], array(0, 0, 0));
$c2 = parse_color_declaration($subvalues[1], array(0, 0, 0));
$border['top']['color'] = $c1;
$border['right']['color'] = $c2;
$border['bottom']['color'] = $c1;
$border['left']['color'] = $c2;
break;
case 3:
$c1 = parse_color_declaration($subvalues[0], array(0, 0, 0));
$c2 = parse_color_declaration($subvalues[1], array(0, 0, 0));
$c3 = parse_color_declaration($subvalues[2], array(0, 0, 0));
$border['top']['color'] = $c1;
$border['right']['color'] = $c2;
$border['bottom']['color'] = $c3;
$border['left']['color'] = $c2;
break;
case 4:
$c1 = parse_color_declaration($subvalues[0], array(0, 0, 0));
$c2 = parse_color_declaration($subvalues[1], array(0, 0, 0));
$c3 = parse_color_declaration($subvalues[2], array(0, 0, 0));
$c4 = parse_color_declaration($subvalues[3], array(0, 0, 0));
$border['top']['color'] = $c1;
$border['right']['color'] = $c2;
$border['bottom']['color'] = $c3;
$border['left']['color'] = $c4;
break;
}
pop_border();
push_border($border);
}
示例7: parse
function parse($value)
{
$old_color = $this->get();
$color = parse_color_declaration($value, array($old_color->r, $old_color->g, $old_color->b));
return new Color($color, is_transparent($color));
}