Added: Incorrect image orientation

This commit is contained in:
RainLoop Team 2015-10-29 23:02:58 +03:00
parent 217207883f
commit e3b62d24d8
87 changed files with 10461 additions and 21 deletions

View file

@ -0,0 +1,30 @@
<?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\Fill;
use Imagine\Image\Palette\Color\ColorInterface;
use Imagine\Image\PointInterface;
/**
* Interface for the fill
*/
interface FillInterface
{
/**
* Gets color of the fill for the given position
*
* @param PointInterface $position
*
* @return ColorInterface
*/
public function getColor(PointInterface $position);
}

View file

@ -0,0 +1,28 @@
<?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\Fill\Gradient;
use Imagine\Image\PointInterface;
/**
* Horizontal gradient fill
*/
final class Horizontal extends Linear
{
/**
* {@inheritdoc}
*/
public function getDistance(PointInterface $position)
{
return $position->getX();
}
}

View file

@ -0,0 +1,95 @@
<?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\Fill\Gradient;
use Imagine\Image\Palette\Color\ColorInterface;
use Imagine\Image\Fill\FillInterface;
use Imagine\Image\PointInterface;
/**
* Linear gradient fill
*/
abstract class Linear implements FillInterface
{
/**
* @var integer
*/
private $length;
/**
* @var ColorInterface
*/
private $start;
/**
* @var ColorInterface
*/
private $end;
/**
* Constructs a linear gradient with overall gradient length, and start and
* end shades, which default to 0 and 255 accordingly
*
* @param integer $length
* @param ColorInterface $start
* @param ColorInterface $end
*/
final public function __construct($length, ColorInterface $start, ColorInterface $end)
{
$this->length = $length;
$this->start = $start;
$this->end = $end;
}
/**
* {@inheritdoc}
*/
final public function getColor(PointInterface $position)
{
$l = $this->getDistance($position);
if ($l >= $this->length) {
return $this->end;
}
if ($l < 0) {
return $this->start;
}
return $this->start->getPalette()->blend($this->start, $this->end, $l / $this->length);
}
/**
* @return ColorInterface
*/
final public function getStart()
{
return $this->start;
}
/**
* @return ColorInterface
*/
final public function getEnd()
{
return $this->end;
}
/**
* Get the distance of the position relative to the beginning of the gradient
*
* @param PointInterface $position
*
* @return integer
*/
abstract protected function getDistance(PointInterface $position);
}

View file

@ -0,0 +1,28 @@
<?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\Fill\Gradient;
use Imagine\Image\PointInterface;
/**
* Vertical gradient fill
*/
final class Vertical extends Linear
{
/**
* {@inheritdoc}
*/
public function getDistance(PointInterface $position)
{
return $position->getY();
}
}