mirror of
https://github.com/Intervention/image.git
synced 2025-07-31 19:10:12 +02:00
Enhancement of optimizing trim
This commit is contained in:
@@ -790,7 +790,7 @@ class Image
|
|||||||
|
|
||||||
if (in_array('left', $away)) {
|
if (in_array('left', $away)) {
|
||||||
for ($x=0; $x < $this->width; $x++) {
|
for ($x=0; $x < $this->width; $x++) {
|
||||||
for ($y=0; $y < $this->height; $y++) {
|
for ($y=$top_y; $y < $this->height; $y++) {
|
||||||
$checkColor = $this->pickColor($x, $y, 'array');
|
$checkColor = $this->pickColor($x, $y, 'array');
|
||||||
if (($checkColor != $color && $checkTransparency == false) or ($checkColor['a'] != 0 && $checkTransparency == true)) {
|
if (($checkColor != $color && $checkTransparency == false) or ($checkColor['a'] != 0 && $checkTransparency == true)) {
|
||||||
$top_x = $x;
|
$top_x = $x;
|
||||||
@@ -802,7 +802,7 @@ class Image
|
|||||||
|
|
||||||
if (in_array('bottom', $away)) {
|
if (in_array('bottom', $away)) {
|
||||||
for ($y=($this->height-1); $y >= 0; $y--) {
|
for ($y=($this->height-1); $y >= 0; $y--) {
|
||||||
for ($x=0; $x < $this->width; $x++) {
|
for ($x=$top_x; $x < $this->width; $x++) {
|
||||||
$checkColor = $this->pickColor($x, $y, 'array');
|
$checkColor = $this->pickColor($x, $y, 'array');
|
||||||
if (($checkColor != $color && $checkTransparency == false) or ($checkColor['a'] != 0 && $checkTransparency == true)) {
|
if (($checkColor != $color && $checkTransparency == false) or ($checkColor['a'] != 0 && $checkTransparency == true)) {
|
||||||
$bottom_y = $y+1;
|
$bottom_y = $y+1;
|
||||||
@@ -814,7 +814,7 @@ class Image
|
|||||||
|
|
||||||
if (in_array('right', $away)) {
|
if (in_array('right', $away)) {
|
||||||
for ($x=($this->width-1); $x >= 0; $x--) {
|
for ($x=($this->width-1); $x >= 0; $x--) {
|
||||||
for ($y=0; $y < $this->height; $y++) {
|
for ($y=$top_y; $y < $bottom_y; $y++) {
|
||||||
$checkColor = $this->pickColor($x, $y, 'array');
|
$checkColor = $this->pickColor($x, $y, 'array');
|
||||||
if (($checkColor != $color && $checkTransparency == false) or ($checkColor['a'] != 0 && $checkTransparency == true)) {
|
if (($checkColor != $color && $checkTransparency == false) or ($checkColor['a'] != 0 && $checkTransparency == true)) {
|
||||||
$bottom_x = $x+1;
|
$bottom_x = $x+1;
|
||||||
|
Reference in New Issue
Block a user