From 420a8246650fd2f303d756231dc2e089aad8668d Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 30 Oct 2017 12:41:36 +0100 Subject: [PATCH] Remove color gradient --- Utils/ColorUtils.php | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/Utils/ColorUtils.php b/Utils/ColorUtils.php index 9cecd7291..443bd31f6 100644 --- a/Utils/ColorUtils.php +++ b/Utils/ColorUtils.php @@ -27,47 +27,6 @@ namespace phpOMS\Utils; class ColorUtils { - /** - * Creates a 3 point gradient based on a input value. - * - * @param int $value Value to represent by color - * @param int[] $start Gradient start - * @param int[] $stop Gradient stop - * @param int[] $end Gradient end - * - * @return array - * - * @since 1.0.0 - */ - public static function getRGBGradient(int $value, array $start, array $stop, array $end) : array - { - $diff = []; - $gradient = []; - - if ($value <= $stop[0] && $value < $start[0]) { - $value = $start[0]; - } else { - $value = min($value, $end[0]); - $start = $stop; - $stop = $end; - } - - $diff[0] = $stop[0] - $start[0]; - $diff[1] = $stop[1] - $start[1]; - $diff[2] = $stop[2] - $start[2]; - $diff[3] = $stop[3] - $start[3]; - - $gradient['r'] = $start[1] + ($value - $start[0]) / ($diff[0]) * $diff[1]; - $gradient['g'] = $start[2] + ($value - $start[0]) / ($diff[0]) * $diff[2]; - $gradient['b'] = $start[3] + ($value - $start[0]) / ($diff[0]) * $diff[3]; - - foreach ($gradient as &$color) { - $color = max(min($color, 255), 0); - } - - return $gradient; - } - /** * Convert int to rgb *