1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-29 00:29:55 +02:00

Add bezier curve drawing tool

This commit is contained in:
gammalogic
2024-06-08 12:05:24 +01:00
committed by Oliver Vogel
parent 6d0d0b2002
commit 216f4cffb4
11 changed files with 927 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Tests\Unit\Drivers\Gd\Modifiers;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use Intervention\Image\Modifiers\DrawBezierModifier;
use Intervention\Image\Geometry\Point;
use Intervention\Image\Geometry\Bezier;
use Intervention\Image\Tests\GdTestCase;
#[RequiresPhpExtension('gd')]
#[CoversClass(\Intervention\Image\Modifiers\DrawPixelModifier::class)]
#[CoversClass(\Intervention\Image\Drivers\Gd\Modifiers\DrawPixelModifier::class)]
final class DrawBezierModifierTest extends GdTestCase
{
public function testApply(): void
{
$image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$drawable = new Bezier([
new Point(0, 0),
new Point(15, 0),
new Point(15, 15),
new Point(0, 15)
]);
$drawable->setBackgroundColor('b53717');
$image->modify(new DrawBezierModifier($drawable));
$this->assertEquals('b53717', $image->pickColor(5, 5)->toHex());
}
}