mirror of
https://github.com/Intervention/image.git
synced 2025-09-03 10:53:01 +02:00
Add missing methods to SizeInterface
This commit is contained in:
@@ -50,7 +50,7 @@ class Size implements SizeInterface
|
|||||||
return $this->pivot;
|
return $this->pivot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setPivot(PointInterface $pivot): self
|
public function setPivot(PointInterface $pivot): SizeInterface
|
||||||
{
|
{
|
||||||
$this->pivot = $pivot;
|
$this->pivot = $pivot;
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ class Size implements SizeInterface
|
|||||||
* @param int $offset_y
|
* @param int $offset_y
|
||||||
* @return Size
|
* @return Size
|
||||||
*/
|
*/
|
||||||
public function alignPivot(string $position, int $offset_x = 0, int $offset_y = 0): self
|
public function alignPivot(string $position, int $offset_x = 0, int $offset_y = 0): SizeInterface
|
||||||
{
|
{
|
||||||
switch (strtolower($position)) {
|
switch (strtolower($position)) {
|
||||||
case 'top':
|
case 'top':
|
||||||
@@ -182,7 +182,7 @@ class Size implements SizeInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alignPivotTo(SizeInterface $size, string $position): self
|
public function alignPivotTo(SizeInterface $size, string $position): SizeInterface
|
||||||
{
|
{
|
||||||
$reference = new Size($size->getWidth(), $size->getHeight());
|
$reference = new Size($size->getWidth(), $size->getHeight());
|
||||||
$reference->alignPivot($position);
|
$reference->alignPivot($position);
|
||||||
@@ -214,32 +214,32 @@ class Size implements SizeInterface
|
|||||||
return new Resizer($width, $height);
|
return new Resizer($width, $height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function resize(?int $width = null, ?int $height = null): self
|
public function resize(?int $width = null, ?int $height = null): SizeInterface
|
||||||
{
|
{
|
||||||
return $this->getResizer($width, $height)->resize($this);
|
return $this->getResizer($width, $height)->resize($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function resizeDown(?int $width = null, ?int $height = null): self
|
public function resizeDown(?int $width = null, ?int $height = null): SizeInterface
|
||||||
{
|
{
|
||||||
return $this->getResizer($width, $height)->resizeDown($this);
|
return $this->getResizer($width, $height)->resizeDown($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scale(?int $width = null, ?int $height = null): self
|
public function scale(?int $width = null, ?int $height = null): SizeInterface
|
||||||
{
|
{
|
||||||
return $this->getResizer($width, $height)->scale($this);
|
return $this->getResizer($width, $height)->scale($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scaleDown(?int $width = null, ?int $height = null): self
|
public function scaleDown(?int $width = null, ?int $height = null): SizeInterface
|
||||||
{
|
{
|
||||||
return $this->getResizer($width, $height)->scaleDown($this);
|
return $this->getResizer($width, $height)->scaleDown($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cover(int $width, int $height): self
|
public function cover(int $width, int $height): SizeInterface
|
||||||
{
|
{
|
||||||
return $this->getResizer($width, $height)->cover($this);
|
return $this->getResizer($width, $height)->cover($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function contain(int $width, int $height): self
|
public function contain(int $width, int $height): SizeInterface
|
||||||
{
|
{
|
||||||
return $this->getResizer($width, $height)->contain($this);
|
return $this->getResizer($width, $height)->contain($this);
|
||||||
}
|
}
|
||||||
|
@@ -9,13 +9,17 @@ interface SizeInterface
|
|||||||
public function getPivot(): PointInterface;
|
public function getPivot(): PointInterface;
|
||||||
public function setWidth(int $width): SizeInterface;
|
public function setWidth(int $width): SizeInterface;
|
||||||
public function setHeight(int $height): SizeInterface;
|
public function setHeight(int $height): SizeInterface;
|
||||||
public function resize(?int $width = null, ?int $height = null): SizeInterface;
|
|
||||||
public function getAspectRatio(): float;
|
public function getAspectRatio(): float;
|
||||||
public function fitsInto(SizeInterface $size): bool;
|
public function fitsInto(SizeInterface $size): bool;
|
||||||
public function isLandscape(): bool;
|
public function isLandscape(): bool;
|
||||||
public function isPortrait(): bool;
|
public function isPortrait(): bool;
|
||||||
public function alignPivot(string $position, int $offset_x = 0, int $offset_y = 0): SizeInterface;
|
public function alignPivot(string $position, int $offset_x = 0, int $offset_y = 0): SizeInterface;
|
||||||
public function alignPivotTo(SizeInterface $size, string $position): SizeInterface;
|
public function alignPivotTo(SizeInterface $size, string $position): SizeInterface;
|
||||||
public function contain(int $width, int $height): SizeInterface;
|
|
||||||
public function getRelativePositionTo(SizeInterface $size): PointInterface;
|
public function getRelativePositionTo(SizeInterface $size): PointInterface;
|
||||||
|
public function resize(?int $width = null, ?int $height = null): SizeInterface;
|
||||||
|
public function resizeDown(?int $width = null, ?int $height = null): SizeInterface;
|
||||||
|
public function scale(?int $width = null, ?int $height = null): SizeInterface;
|
||||||
|
public function scaleDown(?int $width = null, ?int $height = null): SizeInterface;
|
||||||
|
public function cover(int $width, int $height): SizeInterface;
|
||||||
|
public function contain(int $width, int $height): SizeInterface;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user