-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed issue with builder compiling canvas only filters. added sepia, …
…colorize, pixelate, and sharpen filters
- Loading branch information
Eddie
committed
Jul 22, 2014
1 parent
086489f
commit c8bdfad
Showing
8 changed files
with
147 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace stratease\ImagiFly\Filter; | ||
use stratease\ImagiFly\Filter\BaseFilter; | ||
use Intervention\Image\ImageManagerStatic; | ||
|
||
class Colorize extends BaseFilter { | ||
public static function getFilterMask() { | ||
return "/^colorize/"; | ||
} | ||
|
||
/** | ||
* A number between -100 through 100. Negatives will subtract the given color from the canvas. | ||
* @param int $r | ||
* @param int $g | ||
* @param int $b | ||
* @return mixed | ||
*/ | ||
public function filter($r, $g, $b) | ||
{ | ||
$this->canvas->colorize($r, $g, $b); | ||
|
||
return $this->canvas; | ||
} | ||
|
||
public function writesBaseImageToCanvas() | ||
{ | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace stratease\ImagiFly\Filter; | ||
use stratease\ImagiFly\Filter\BaseFilter; | ||
use Intervention\Image\ImageManagerStatic; | ||
|
||
class Pixelate extends BaseFilter { | ||
|
||
public static function getFilterMask() { | ||
return "/^pixelate/"; | ||
} | ||
|
||
/** | ||
* @param $pixelSize | ||
* @return mixed | ||
*/ | ||
public function filter($pixelSize) | ||
{ | ||
$this->canvas->pixelate((int)$pixelSize); | ||
|
||
return $this->canvas; | ||
} | ||
|
||
public function writesBaseImageToCanvas() | ||
{ | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace stratease\ImagiFly\Filter; | ||
use stratease\ImagiFly\Filter\BaseFilter; | ||
use Intervention\Image\ImageManagerStatic; | ||
|
||
class Sepia extends BaseFilter { | ||
|
||
public static function getFilterMask() { | ||
return "/^sepia/"; | ||
} | ||
|
||
/** | ||
* @todo Add an amount arg to tone back the sepia effect? | ||
* @return mixed | ||
*/ | ||
public function filter() | ||
{ | ||
// ditch pesky colors | ||
$this->canvas->greyscale(); | ||
// sepia-ish tone it | ||
$this->canvas->colorize(25, 11, 0); | ||
|
||
return $this->canvas; | ||
} | ||
|
||
public function writesBaseImageToCanvas() | ||
{ | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace stratease\ImagiFly\Filter; | ||
use stratease\ImagiFly\Filter\BaseFilter; | ||
use Intervention\Image\ImageManagerStatic; | ||
|
||
class Sharpen extends BaseFilter { | ||
public static function getFilterMask() { | ||
return "/^sharpen/"; | ||
} | ||
|
||
|
||
/** | ||
* @param $amount | ||
* @return mixed | ||
*/ | ||
public function filter($amount) | ||
{ | ||
$this->canvas->sharpen($amount); | ||
|
||
return $this->canvas; | ||
} | ||
|
||
public function writesBaseImageToCanvas() | ||
{ | ||
return false; | ||
} | ||
} |