mirror of
https://github.com/Intervention/image.git
synced 2025-07-31 11:00:12 +02:00
Merge pull request #1348 from Intervention/bugfix/draw-line-modifier
Fix bug with unwanted color in DrawLineModifer
This commit is contained in:
5
.github/workflows/run-tests.yml
vendored
5
.github/workflows/run-tests.yml
vendored
@@ -89,7 +89,10 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction
|
||||
|
||||
- name: Which Imagick Version
|
||||
- name: GD Version
|
||||
run: php -r 'var_dump(gd_info());'
|
||||
|
||||
- name: Imagick Version
|
||||
run: php -r 'var_dump(Imagick::getVersion());'
|
||||
|
||||
- name: Supported Imagick Formats
|
||||
|
@@ -19,6 +19,7 @@ class DrawLineModifier extends GenericDrawLineModifier implements SpecializedInt
|
||||
{
|
||||
$drawing = new ImagickDraw();
|
||||
$drawing->setStrokeWidth($this->drawable->width());
|
||||
$drawing->setFillOpacity(0);
|
||||
$drawing->setStrokeColor(
|
||||
$this->driver()->colorProcessor($image->colorspace())->colorToNative(
|
||||
$this->backgroundColor()
|
||||
|
@@ -25,4 +25,14 @@ final class DrawLineModifierTest extends ImagickTestCase
|
||||
$image->modify(new DrawLineModifier($line));
|
||||
$this->assertEquals('b53517', $image->pickColor(0, 0)->toHex());
|
||||
}
|
||||
|
||||
public function testApplyTransparent(): void
|
||||
{
|
||||
$image = $this->createTestImage(10, 10)->fill('ff5500');
|
||||
$this->assertColor(255, 85, 0, 255, $image->pickColor(5, 5));
|
||||
$line = new Line(new Point(0, 5), new Point(10, 5), 4);
|
||||
$line->setBackgroundColor('fff4');
|
||||
$image->modify(new DrawLineModifier($line));
|
||||
$this->assertColor(255, 136, 77, 255, $image->pickColor(5, 5));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user