mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-03 14:37:02 +03:00
Added: Incorrect image orientation
This commit is contained in:
parent
217207883f
commit
e3b62d24d8
87 changed files with 10461 additions and 21 deletions
|
|
@ -0,0 +1,77 @@
|
|||
<?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\Point;
|
||||
|
||||
use Imagine\Image\BoxInterface;
|
||||
use Imagine\Image\Point as OriginalPoint;
|
||||
use Imagine\Image\PointInterface;
|
||||
|
||||
/**
|
||||
* Point center
|
||||
*/
|
||||
final class Center implements PointInterface
|
||||
{
|
||||
/**
|
||||
* @var BoxInterface
|
||||
*/
|
||||
private $box;
|
||||
|
||||
/**
|
||||
* Constructs coordinate with size instance, it needs to be relative to
|
||||
*
|
||||
* @param BoxInterface $box
|
||||
*/
|
||||
public function __construct(BoxInterface $box)
|
||||
{
|
||||
$this->box = $box;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getX()
|
||||
{
|
||||
return ceil($this->box->getWidth() / 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getY()
|
||||
{
|
||||
return ceil($this->box->getHeight() / 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function in(BoxInterface $box)
|
||||
{
|
||||
return $this->getX() < $box->getWidth() && $this->getY() < $box->getHeight();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function move($amount)
|
||||
{
|
||||
return new OriginalPoint($this->getX() + $amount, $this->getY() + $amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return sprintf('(%d, %d)', $this->getX(), $this->getY());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue