本文整理汇总了PHP中Less_Parser::round方法的典型用法代码示例。如果您正苦于以下问题:PHP Less_Parser::round方法的具体用法?PHP Less_Parser::round怎么用?PHP Less_Parser::round使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Less_Parser
的用法示例。
在下文中一共展示了Less_Parser::round方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: luminance
public function luminance($color = null)
{
if (!$color instanceof Less_Tree_Color) {
throw new Less_Exception_Compiler('The first argument to luminance must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : ''));
}
$luminance = 0.2126 * $color->rgb[0] / 255 + 0.7151999999999999 * $color->rgb[1] / 255 + 0.0722 * $color->rgb[2] / 255;
return new Less_Tree_Dimension(Less_Parser::round($luminance * $color->alpha * 100), '%');
}
示例2: toHex
public function toHex($v)
{
$ret = '#';
foreach ($v as $c) {
$c = Less_Functions::clamp(Less_Parser::round($c), 255);
if ($c < 16) {
$ret .= '0';
}
$ret .= dechex($c);
}
return $ret;
}
示例3: luminance
public function luminance($color)
{
$luminance = 0.2126 * $color->rgb[0] / 255 + 0.7151999999999999 * $color->rgb[1] / 255 + 0.0722 * $color->rgb[2] / 255;
return new Less_Tree_Dimension(Less_Parser::round($luminance * $color->alpha * 100), '%');
}
示例4: toARGB
public function toARGB()
{
$argb = array_merge((array) Less_Parser::round($this->alpha * 255), $this->rgb);
$temp = '';
foreach ($argb as $i) {
$i = Less_Parser::round($i);
$i = dechex($i > 255 ? 255 : ($i < 0 ? 0 : $i));
$temp .= str_pad($i, 2, '0', STR_PAD_LEFT);
}
return '#' . $temp;
}
示例5: luma
public function luma($color)
{
return new Less_Tree_Dimension(Less_Parser::round($color->luma() * $color->alpha * 100), '%');
}
示例6: toARGB
public function toARGB()
{
$argb = array_merge((array) Less_Parser::round($this->alpha * 255), $this->rgb);
return $this->toHex($argb);
}