mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-03 22:47:03 +03:00
Added: Incorrect image orientation
This commit is contained in:
parent
217207883f
commit
e3b62d24d8
87 changed files with 10461 additions and 21 deletions
88
rainloop/v/0.0.0/app/libraries/Imagine/Image/Point.php
Normal file
88
rainloop/v/0.0.0/app/libraries/Imagine/Image/Point.php
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Imagine package.
|
||||
*
|
||||
* (c) Bulat Shakirzyanov <mallluhuct@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Imagine\Image;
|
||||
|
||||
use Imagine\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* The point class
|
||||
*/
|
||||
final class Point implements PointInterface
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $x;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $y;
|
||||
|
||||
/**
|
||||
* Constructs a point of coordinates
|
||||
*
|
||||
* @param integer $x
|
||||
* @param integer $y
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __construct($x, $y)
|
||||
{
|
||||
if ($x < 0 || $y < 0) {
|
||||
throw new InvalidArgumentException(sprintf('A coordinate cannot be positioned outside of a bounding box (x: %s, y: %s given)', $x, $y));
|
||||
}
|
||||
|
||||
$this->x = $x;
|
||||
$this->y = $y;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getX()
|
||||
{
|
||||
return $this->x;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getY()
|
||||
{
|
||||
return $this->y;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function in(BoxInterface $box)
|
||||
{
|
||||
return $this->x < $box->getWidth() && $this->y < $box->getHeight();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function move($amount)
|
||||
{
|
||||
return new Point($this->x + $amount, $this->y + $amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return sprintf('(%d, %d)', $this->x, $this->y);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue