mirror of
https://github.com/Intervention/image.git
synced 2025-09-01 09:52:59 +02:00
colorize without alpha value
This commit is contained in:
@@ -1283,12 +1283,11 @@ class Image
|
|||||||
* @param integer $blue
|
* @param integer $blue
|
||||||
* @return Image
|
* @return Image
|
||||||
*/
|
*/
|
||||||
public function colorize($red, $green, $blue, $alpha = 0)
|
public function colorize($red, $green, $blue)
|
||||||
{
|
{
|
||||||
if (($red < -100 || $red > 100) ||
|
if (($red < -100 || $red > 100) ||
|
||||||
($green < -100 || $green > 100) ||
|
($green < -100 || $green > 100) ||
|
||||||
($blue < -100 || $blue > 100) ||
|
($blue < -100 || $blue > 100)) {
|
||||||
($alpha < -100 || $alpha > 100)) {
|
|
||||||
throw new Exception\ColorizeOutOfBoundsException(
|
throw new Exception\ColorizeOutOfBoundsException(
|
||||||
'Colorize levels must be between -100 and +100'
|
'Colorize levels must be between -100 and +100'
|
||||||
);
|
);
|
||||||
@@ -1298,10 +1297,9 @@ class Image
|
|||||||
$red = round($red * 2.55);
|
$red = round($red * 2.55);
|
||||||
$green = round($green * 2.55);
|
$green = round($green * 2.55);
|
||||||
$blue = round($blue * 2.55);
|
$blue = round($blue * 2.55);
|
||||||
$alpha = round($alpha * 2.55);
|
|
||||||
|
|
||||||
// apply filter
|
// apply filter
|
||||||
imagefilter($this->resource, IMG_FILTER_COLORIZE, $red, $green, $blue, $alpha);
|
imagefilter($this->resource, IMG_FILTER_COLORIZE, $red, $green, $blue);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@@ -1581,7 +1581,7 @@ class ImageTest extends PHPUnit_Framework_Testcase
|
|||||||
{
|
{
|
||||||
$img = $this->getTestImage();
|
$img = $this->getTestImage();
|
||||||
$img->colorize(-100, 0, 100);
|
$img->colorize(-100, 0, 100);
|
||||||
$img->colorize(100, -100, -100, 50);
|
$img->colorize(100, -100, -100);
|
||||||
$this->assertInstanceOf('Intervention\Image\Image', $img);
|
$this->assertInstanceOf('Intervention\Image\Image', $img);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user