Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Rounds a float
<?php round(int|float $num, int $precision = 0, int $mode = PHP_ROUND_HALF_UP): float
<?php public function getArray()
{
return [$this->r, $this->g, $this->b, round(1 - $this->a / 127, 2)];
}
<?php public function getRgba()
{
return sprintf('rgba(%d, %d, %d, %.2F)', $this->r, $this->g, $this->b, round(1 - $this->a / 127, 2));
}
<?php public function differs(AbstractColor $color, $tolerance = 0)
{
$color_tolerance = round($tolerance * 2.55);
$alpha_tolerance = round($tolerance * 1.27);
$delta = [
<?php public function differs(AbstractColor $color, $tolerance = 0)
{
$color_tolerance = round($tolerance * 2.55);
$alpha_tolerance = round($tolerance * 1.27);
$delta = [
'r' => abs($color->r - $this->r),
<?php $blue = $this->argument(2)->between(-100, 100)->required()->value();
$red = round($red * 2.55);
$green = round($green * 2.55);
$blue = round($blue * 2.55);
<?php $red = round($red * 2.55);
$green = round($green * 2.55);
$blue = round($blue * 2.55);
<?php $red = round($red * 2.55);
$green = round($green * 2.55);
$blue = round($blue * 2.55);
return imagefilter($image->getCore(), IMG_FILTER_COLORIZE, $red, $green, $blue);
<?php $alpha = floatval(round($alpha[0] / 255, 2));
}
}
<?php if ( ! imageistruecolor($image->getCore())) {
$color = imagecolorsforindex($image->getCore(), $color);
$color['alpha'] = round(1 - $color['alpha'] / 127, 2);
}
$color = new Color($color);
<?php switch ($align.'-'.$valign) {
case 'center-top':
$posx = $posx - round(($box[6]+$box[4])/2);
$posy = $posy - round(($box[7]+$box[5])/2);
break;
<?php case 'center-top':
$posx = $posx - round(($box[6]+$box[4])/2);
$posy = $posy - round(($box[7]+$box[5])/2);
break;
case 'right-top':
<?php case 'center-center':
case 'center-middle':
$posx = $posx - round(($box[0]+$box[4])/2);
$posy = $posy - round(($box[1]+$box[5])/2);
break;
<?php case 'center-center':
case 'center-middle':
$posx = $posx - round(($box[0]+$box[4])/2);
$posy = $posy - round(($box[1]+$box[5])/2);
break;
case 'right-center':
<?php case 'right-center':
case 'right-middle':
$posx = $posx - round(($box[2]+$box[4])/2);
$posy = $posy - round(($box[3]+$box[5])/2);
break;
<?php case 'right-center':
case 'right-middle':
$posx = $posx - round(($box[2]+$box[4])/2);
$posy = $posy - round(($box[3]+$box[5])/2);
break;
case 'left-center':