diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2012-01-12 03:14:58 +0100 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2012-01-12 03:14:58 +0100 |
commit | f11d9d82acc9ff8bc6eec178ad2527ee89462793 (patch) | |
tree | d3a6cee0a4268d67103856de54bf2dc9e86fea1d | |
parent | b5cb88aa92eb4eaac06afebe5109b0beac8f5ea8 (diff) | |
download | hicg-f11d9d82acc9ff8bc6eec178ad2527ee89462793.tar.gz hicg-f11d9d82acc9ff8bc6eec178ad2527ee89462793.zip |
properly round color components
-rw-r--r-- | index.php | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -174,9 +174,10 @@ function extract_dominant_color($svg, $algo = 'average', $filter = 'grey') function clip_color_value($c) { - if ($c < 0) return 0; - else if ($c > 255) return 255; - return $c; + $i = intval(round($c)); + if ($i < 0) return 0; + else if ($i > 255) return 255; + return $i; } function clip_color($c) |