8000 Add Symfony Image Component · symfony/symfony@916aff8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 916aff8

Browse files
avalanche123romainneutron
authored andcommitted
Add Symfony Image Component
1 parent d0e904b commit 916aff8
  • Histogram
  • Metadata
  • Palette
  • Point
  • Imagick
  • Resources
  • Tests
  • Some content is hidden

    Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

    158 files changed

    +16605
    -0
    lines changed
    Lines changed: 146 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -0,0 +1,146 @@
    1+
    <?php
    2+
    3+
    /*
    4+
    * This file is part of the Symfony package.
    5+
    *
    6+
    * (c) Fabien Potencier <fabien@symfony.com>
    7+
    *
    8+
    * For the full copyright and license information, please view the LICENSE
    9+
    * file that was distributed with this source code.
    10+
    */
    11+
    12+
    namespace Symfony\Component\Image\Draw;
    13+
    14+
    use Symfony\Component\Image\Image\AbstractFont;
    15+
    use Symfony\Component\Image\Image\BoxInterface;
    16+
    use Symfony\Component\Image\Image\Palette\Color\ColorInterface;
    17+
    use Symfony\Component\Image\Image\PointInterface;
    18+
    use Symfony\Component\Image\Exception\RuntimeException;
    19+
    20+
    interface DrawerInterface
    21+
    {
    22+
    /**
    23+
    * Draws an arc on a starting at a given x, y coordinates under a given
    24+
    * start and end angles.
    25+
    *
    26+
    * @param PointInterface $center
    27+
    * @param BoxInterface $size
    28+
    * @param int $start
    29+
    * @param int $end
    30+
    * @param ColorInterface $color
    31+
    * @param int $thickness
    32+
    *
    33+
    * @throws RuntimeException
    34+
    *
    35+
    * @return DrawerInterface
    36+
    */
    37+
    public function arc(PointInterface $center, BoxInterface $size, $start, $end, ColorInterface $color, $thickness = 1);
    38+
    39+
    /**
    40+
    * Same as arc, but also connects end points with a straight line.
    41+
    *
    42+
    * @param PointInterface $center
    43+
    * @param BoxInterface $size
    44+
    * @param int $start
    45+
    * @param int $end
    46+
    * @param ColorInterface $color
    47+
    * @param bool $fill
    48+
    * @param int $thickness
    49+
    *
    50+
    * @throws RuntimeException
    51+
    *
    52+
    * @return DrawerInterface
    53+
    */
    54+
    public function chord(PointInterface $center, BoxInterface $size, $start, $end, ColorInterface $color, $fill = false, $thickness = 1);
    55+
    56+
    /**
    57+
    * Draws and ellipse with center at the given x, y coordinates, and given
    58+
    * width and height.
    59+
    *
    60+
    * @param PointInterface $center
    61+
    * @param BoxInterface $size
    62+
    * @param ColorInterface $color
    63+
    * @param bool $fill
    64+
    * @param int $thickness
    65+
    *
    66+
    * @throws RuntimeException
    67+
    *
    68+
    * @return DrawerInterface
    69+
    */
    70+
    public function ellipse(PointInterface $center, BoxInterface $size, ColorInterface $color, $fill = false, $thickness = 1);
    71+
    72+
    /**
    73+
    * Draws a line from start(x, y) to end(x, y) coordinates.
    74+
    *
    75+
    * @param PointInterface $start
    76+
    * @param PointInterface $end
    77+
    * @param ColorInterface $outline
    78+
    * @param int $thickness
    79+
    *
    80+
    * @return DrawerInterface
    81+
    */
    82+
    public function line(PointInterface $start, PointInterface $end, ColorInterface $outline, $thickness = 1);
    83+
    84+
    /**
    85+
    * Same as arc, but connects end points and the center.
    86+
    *
    87+
    * @param PointInterface $center
    88+
    * @param BoxInterface $size
    89+
    * @param int $start
    90+
    * @param int $end
    91+
    * @param ColorInterface $color
    92+
    * @param bool $fill
    93+
    * @param int $thickness
    94+
    *
    95+
    * @throws RuntimeException
    96+
    *
    97+
    * @return DrawerInterface
    98+
    */
    99+
    public function pieSlice(PointInterface $center, BoxInterface $size, $start, $end, ColorInterface $color, $fill = false, $thickness = 1);
    100+
    101+
    /**
    102+
    * Places a one pixel point at specific coordinates and fills it with
    103+
    * specified color.
    104+
    *
    105+
    * @param PointInterface $position
    106+
    * @param ColorInterface $color
    107+
    *
    108+
    * @throws RuntimeException
    109+
    *
    110+
    * @return DrawerInterface
    111+
    */
    112+
    public function dot(PointInterface $position, ColorInterface $color);
    113+
    114+
    /**
    115+
    * Draws a polygon using array of x, y coordinates. Must contain at least
    116+
    * three coordinates.
    117+
    *
    118+
    * @param array $coordinates
    119+
    * @param ColorInterface $color
    120+
    * @param bool $fill
    121+
    * @param int $thickness
    122+
    *
    123+
    * @throws RuntimeException
    124+
    *
    125+
    * @return DrawerInterface
    126+
    */
    127+
    public function polygon(array $coordinates, ColorInterface $color, $fill = false, $thickness = 1);
    128+
    129+
    /**
    130+
    * Annotates image with specified text at a given position starting on the
    131+
    * top left of the final text box.
    132+
    *
    133+
    * The rotation is done CW
    134+
    *
    135+
    * @param string $string
    136+
    * @param AbstractFont $font
    137+
    * @param PointInterface $position
    138+
    * @param int $angle
    139+
    * @param int $width
    140+
    *
    141+
    * @throws RuntimeException
    142+
    *
    143+
    * @return DrawerInterface
    144+
    */
    145+
    public function text($string, AbstractFont $font, PointInterface $position, $angle = 0, $width = null);
    146+
    }
    Lines changed: 78 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -0,0 +1,78 @@
    1+
    <?php
    2+
    3+
    /*
    4+
    * This file is part of the Symfony package.
    5+
    *
    6+
    * (c) Fabien Potencier <fabien@symfony.com>
    7+
    *
    8+
    * For the full copyright and license information, please view the LICENSE
    9+
    * file that was distributed with this source code.
    10+
    */
    11+
    12+
    namespace Symfony\Component\Image\Effects;
    13+
    14+
    use Symfony\Component\Image\Exception\RuntimeException;
    15+
    use Symfony\Component\Image\Image\Palette\Color\ColorInterface;
    16+
    17+
    interface EffectsInterface
    18+
    {
    19+
    /**
    20+
    * Apply gamma correction.
    21+
    *
    22+
    * @param float $correction
    23+
    *
    24+
    * @return EffectsInterface
    25+
    *
    26+
    * @throws RuntimeException
    27+
    */
    28+
    public function gamma($correction);
    29+
    30+
    /**
    31+
    * Invert the colors of the image.
    32+
    *
    33+
    * @return EffectsInterface
    34+
    *
    35+
    * @throws RuntimeException
    36+
    */
    37+
    public function negative();
    38+
    39+
    /**
    40+
    * Grayscale the image.
    41+
    *
    42+
    * @return EffectsInterface
    43+
    *
    44+
    * @throws RuntimeException
    45+
    */
    46+
    public function grayscale();
    47+
    48+
    /**
    49+
    * Colorize the image.
    50+
    *
    51+
    * @param ColorInterface $color
    52+
    *
    53+
    * @return EffectsInterface
    54+
    *
    55+
    * @throws RuntimeException
    56+
    */
    57+
    public function colorize(ColorInterface $color);
    58+
    59+
    /**
    60+
    * Sharpens the image.
    61+
    *
    62+
    * @return EffectsInterface
    63+
    *
    64+
    * @throws RuntimeException
    65+
    */
    66+
    public function sharpen();
    67+
    68+
    /**
    69+
    * Blur the image.
    70+
    *
    71+
    * @param float|int $sigma
    72+
    *
    73+
    * @return EffectsInterface
    74+
    *
    75+
    * @throws RuntimeException
    76+
    */
    77+
    public function blur($sigma);
    78+
    }
    Lines changed: 16 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -0,0 +1,16 @@
    1+
    <?php
    2+
    3+
    /*
    4+
    * This file is part of the Symfony package.
    5+
    *
    6+
    * (c) Fabien Potencier <fabien@symfony.com>
    7+
    *
    8+
    * For the full copyright and license information, please view the LICENSE
    9+
    * file that was distributed with this source code.
    10+
    */
    11+
    12+
    namespace Symfony\Component\Image\Exception;
    13+
    14+
    interface ExceptionInterface
    15+
    {
    16+
    }
    Lines changed: 16 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -0,0 +1,16 @@
    1+
    <?php
    2+
    3+
    /*
    4+
    * This file is part of the Symfony package.
    5+
    *
    6+
    * (c) Fabien Potencier <fabien@symfony.com>
    7+
    *
    8+
    * For the full copyright and license information, please view the LICENSE
    9+
    * file that was distributed with this source code.
    10+
    */
    11+
    12+
    namespace Symfony\Component\Image\Exception;
    13+
    14+
    class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
    15+
    {
    16+
    }
    Lines changed: 19 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -0,0 +1,19 @@
    1+
    <?php
    2+
    3+
    /*
    4+
    * This file is part of the Symfony package.
    5+
    *
    6+
    * (c) Fabien Potencier <fabien@symfony.com>
    7+
    *
    8+
    * For the full copyright and license information, please view the LICENSE
    9+
    * file that was distributed with this source code.
    10+
    */
    11+
    12+
    namespace Symfony\Component\Image\Exception;
    13+
    14+
    /**
    15+
    * Should be used when a driver does not support an operation.
    16+
    */
    17+
    class NotSupportedException extends RuntimeException implements ExceptionInterface
    18+
    {
    19+
    }
    Lines changed: 16 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -0,0 +1,16 @@
    1+
    <?php
    2+
    3+
    /*
    4+
    * This file is part of the Symfony package.
    5+
    *
    6+
    * (c) Fabien Potencier <fabien@symfony.com>
    7+
    *
    8+
    * For the full copyright and license information, please view the LICENSE
    9+
    * file that was distributed with this source code.
    10+
    */
    11+
    12+
    namespace Symfony\Component\Image\Exception;
    13+
    14+
    class OutOfBoundsException extends \OutOfBoundsException implements ExceptionInterface
    15+
    {
    16+
    }
    Lines changed: 16 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -0,0 +1,16 @@
    1+
    <?php
    2+
    3+
    /*
    4+
    * This file is part of the Symfony package.
    5+
    *
    6+
    * (c) Fabien Potencier <fabien@symfony.com>
    7+
    *
    8+
    * For the full copyright and license information, please view the LICENSE
    9+
    * file that was distributed with this source code.
    10+
    */
    11+
    12+
    namespace Symfony\Component\Image\Exception;
    13+
    14+
    class RuntimeException extends \RuntimeException implements ExceptionInterface
    15+
    {
    16+
    }

    0 commit comments

    Comments
     (0)
    0