Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This component is a port of Bulat Shakirzyanov's Imagine library (https://github.com/avalanche123/Imagine) into Symfony.
- Loading branch information
1 parent
28a00da
commit dcd13b3
Showing
217 changed files
with
16,867 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
set -xe | ||
|
||
GRAPHICSMAGIC_VERSION="1.3.23" | ||
if [ $TRAVIS_PHP_VERSION = '7.0' ] || [ $TRAVIS_PHP_VERSION = '7.1' ] | ||
then | ||
GMAGICK_VERSION="2.0.4RC1" | ||
else | ||
GMAGICK_VERSION="1.1.7RC2" | ||
fi | ||
|
||
mkdir -p cache | ||
cd cache | ||
|
||
if [ ! -e ./GraphicsMagick-$GRAPHICSMAGIC_VERSION ] | ||
then | ||
wget http://78.108.103.11/MIRROR/ftp/GraphicsMagick/1.3/GraphicsMagick-$GRAPHICSMAGIC_VERSION.tar.xz | ||
tar -xf GraphicsMagick-$GRAPHICSMAGIC_VERSION.tar.xz | ||
rm GraphicsMagick-$GRAPHICSMAGIC_VERSION.tar.xz | ||
cd GraphicsMagick-$GRAPHICSMAGIC_VERSION | ||
./configure --prefix=$HOME/opt/gmagick --enable-shared --with-lcms2 | ||
make -j | ||
else | ||
cd GraphicsMagick-$GRAPHICSMAGIC_VERSION | ||
fi | ||
|
||
make install | ||
cd .. | ||
|
||
if [ ! -e ./gmagick-$GMAGICK_VERSION ] | ||
then | ||
wget https://pecl.php.net/get/gmagick-$GMAGICK_VERSION.tgz | ||
tar -xzf gmagick-$GMAGICK_VERSION.tgz | ||
rm gmagick-$GMAGICK_VERSION.tgz | ||
cd gmagick-$GMAGICK_VERSION | ||
phpize | ||
./configure --with-gmagick=$HOME/opt/gmagick | ||
make -j | ||
else | ||
cd gmagick-$GMAGICK_VERSION | ||
fi | ||
|
||
make install | ||
echo "extension=gmagick.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` | ||
php --ri gmagick |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
set -xe | ||
|
||
IMAGEMAGICK_VERSION="6.8.9-10" | ||
IMAGICK_VERSION="3.4.3" | ||
|
||
mkdir -p cache | ||
cd cache | ||
|
||
if [ ! -e ./ImageMagick-$IMAGEMAGICK_VERSION ] | ||
then | ||
wget http://www.imagemagick.org/download/releases/ImageMagick-$IMAGEMAGICK_VERSION.tar.xz | ||
tar -xf ImageMagick-$IMAGEMAGICK_VERSION.tar.xz | ||
rm ImageMagick-$IMAGEMAGICK_VERSION.tar.xz | ||
cd ImageMagick-$IMAGEMAGICK_VERSION | ||
./configure --prefix=$HOME/opt/imagemagick | ||
make -j | ||
else | ||
cd ImageMagick-$IMAGEMAGICK_VERSION | ||
fi | ||
|
||
make install | ||
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$HOME/opt/imagemagick/lib/pkgconfig | ||
ln -s $HOME/opt/imagemagick/include/ImageMagick-6 $HOME/opt/imagemagick/include/ImageMagick | ||
cd .. | ||
|
||
if [ ! -e ./imagick-$IMAGICK_VERSION ] | ||
then | ||
wget https://pecl.php.net/get/imagick-$IMAGICK_VERSION.tgz | ||
tar -xzf imagick-$IMAGICK_VERSION.tgz | ||
rm imagick-$IMAGICK_VERSION.tgz | ||
cd imagick-$IMAGICK_VERSION | ||
phpize | ||
./configure --with-imagick=$HOME/opt/imagemagick | ||
make -j | ||
else | ||
cd imagick-$IMAGICK_VERSION | ||
fi | ||
|
||
make install | ||
echo "extension=imagick.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` | ||
php --ri imagick |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
composer.lock | ||
phpunit.xml | ||
vendor/ | ||
Tests/Fixtures/results/in_out | ||
!Tests/Fixtures/results/in_out/.placeholder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Image\Draw; | ||
|
||
use Symfony\Component\Image\Image\AbstractFont; | ||
use Symfony\Component\Image\Image\BoxInterface; | ||
use Symfony\Component\Image\Image\Palette\Color\ColorInterface; | ||
use Symfony\Component\Image\Image\PointInterface; | ||
use Symfony\Component\Image\Exception\RuntimeException; | ||
|
||
interface DrawerInterface | ||
{ | ||
/** | ||
* Draws an arc on a starting at a given x, y coordinates under a given | ||
* start and end angles. | ||
* | ||
* @param PointInterface $center | ||
* @param BoxInterface $size | ||
* @param int $start | ||
* @param int $end | ||
* @param ColorInterface $color | ||
* @param int $thickness | ||
* | ||
* @throws RuntimeException | ||
* | ||
* @return DrawerInterface | ||
*/ | ||
public function arc(PointInterface $center, BoxInterface $size, $start, $end, ColorInterface $color, $thickness = 1); | ||
|
||
/** | ||
* Same as arc, but also connects end points with a straight line. | ||
* | ||
* @param PointInterface $center | ||
* @param BoxInterface $size | ||
* @param int $start | ||
* @param int $end | ||
* @param ColorInterface $color | ||
* @param bool $fill | ||
* @param int $thickness | ||
* | ||
* @throws RuntimeException | ||
* | ||
* @return DrawerInterface | ||
*/ | ||
public function chord(PointInterface $center, BoxInterface $size, $start, $end, ColorInterface $color, $fill = false, $thickness = 1); | ||
|
||
/** | ||
* Draws and ellipse with center at the given x, y coordinates, and given | ||
* width and height. | ||
* | ||
* @param PointInterface $center | ||
* @param BoxInterface $size | ||
* @param ColorInterface $color | ||
* @param bool $fill | ||
* @param int $thickness | ||
* | ||
* @throws RuntimeException | ||
* | ||
* @return DrawerInterface | ||
*/ | ||
public function ellipse(PointInterface $center, BoxInterface $size, ColorInterface $color, $fill = false, $thickness = 1); | ||
|
||
/** | ||
* Draws a line from start(x, y) to end(x, y) coordinates. | ||
* | ||
* @param PointInterface $start | ||
* @param PointInterface $end | ||
* @param ColorInterface $outline | ||
* @param int $thickness | ||
* | ||
* @return DrawerInterface | ||
*/ | ||
public function line(PointInterface $start, PointInterface $end, ColorInterface $outline, $thickness = 1); | ||
|
||
/** | ||
* Same as arc, but connects end points and the center. | ||
* | ||
* @param PointInterface $center | ||
* @param BoxInterface $size | ||
* @param int $start | ||
* @param int $end | ||
* @param ColorInterface $color | ||
* @param bool $fill | ||
* @param int $thickness | ||
* | ||
* @throws RuntimeException | ||
* | ||
* @return DrawerInterface | ||
*/ | ||
public function pieSlice(PointInterface $center, BoxInterface $size, $start, $end, ColorInterface $color, $fill = false, $thickness = 1); | ||
|
||
/** | ||
* Places a one pixel point at specific coordinates and fills it with | ||
* specified color. | ||
* | ||
* @param PointInterface $position | ||
* @param ColorInterface $color | ||
* | ||
* @throws RuntimeException | ||
* | ||
* @return DrawerInterface | ||
*/ | ||
public function dot(PointInterface $position, ColorInterface $color); | ||
|
||
/** | ||
* Draws a polygon using array of x, y coordinates. Must contain at least | ||
* three coordinates. | ||
* | ||
* @param array $coordinates | ||
* @param ColorInterface $color | ||
* @param bool $fill | ||
* @param int $thickness | ||
* | ||
* @throws RuntimeException | ||
* | ||
* @return DrawerInterface | ||
*/ | ||
public function polygon(array $coordinates, ColorInterface $color, $fill = false, $thickness = 1); | ||
|
||
/** | ||
* Annotates image with specified text at a given position starting on the | ||
* top left of the final text box. | ||
* | ||
* The rotation is done CW | ||
* | ||
* @param string $string | ||
* @param AbstractFont $font | ||
* @param PointInterface $position | ||
* @param int $angle | ||
* @param int $width | ||
* | ||
* @throws RuntimeException | ||
* | ||
* @return DrawerInterface | ||
*/ | ||
public function text($string, AbstractFont $font, PointInterface $position, $angle = 0, $width = null); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Image\Effects; | ||
|
||
use Symfony\Component\Image\Exception\RuntimeException; | ||
use Symfony\Component\Image\Image\Palette\Color\ColorInterface; | ||
|
||
interface EffectsInterface | ||
{ | ||
/** | ||
* Apply gamma correction. | ||
* | ||
* @param float $correction | ||
* | ||
* @return EffectsInterface | ||
* | ||
* @throws RuntimeException | ||
*/ | ||
public function gamma($correction); | ||
|
||
/** | ||
* Invert the colors of the image. | ||
* | ||
* @return EffectsInterface | ||
* | ||
* @throws RuntimeException | ||
*/ | ||
public function negative(); | ||
|
||
/** | ||
* Grayscale the image. | ||
* | ||
* @return EffectsInterface | ||
* | ||
* @throws RuntimeException | ||
*/ | ||
public function grayscale(); | ||
|
||
/** | ||
* Colorize the image. | ||
* | ||
* @param ColorInterface $color | ||
* | ||
* @return EffectsInterface | ||
* | ||
* @throws RuntimeException | ||
*/ | ||
public function colorize(ColorInterface $color); | ||
|
||
/** | ||
* Sharpens the image. | ||
* | ||
* @return EffectsInterface | ||
* | ||
* @throws RuntimeException | ||
*/ | ||
public function sharpen(); | ||
|
||
/** | ||
* Blur the image. | ||
* | ||
* @param float|int $sigma | ||
* | ||
* @return EffectsInterface | ||
* | ||
* @throws RuntimeException | ||
*/ | ||
public function blur($sigma); | ||
} |
16 changes: 16 additions & 0 deletions
16
src/Symfony/Component/Image/Exception/ExceptionInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Image\Exception; | ||
|
||
interface ExceptionInterface | ||
{ | ||
} |
16 changes: 16 additions & 0 deletions
16
src/Symfony/Component/Image/Exception/InvalidArgumentException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Image\Exception; | ||
|
||
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface | ||
{ | ||
} |
Oops, something went wrong.