Skip to content

Commit 7f33feb

Browse files
authored
Merge pull request #1348 from Intervention/bugfix/draw-line-modifier
Fix bug with unwanted color in DrawLineModifer
2 parents 2e0cbf2 + 9a013b9 commit 7f33feb

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

.github/workflows/run-tests.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ jobs:
8989
- name: Install dependencies
9090
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction
9191

92-
- name: Which Imagick Version
92+
- name: GD Version
93+
run: php -r 'var_dump(gd_info());'
94+
95+
- name: Imagick Version
9396
run: php -r 'var_dump(Imagick::getVersion());'
9497

9598
- name: Supported Imagick Formats

src/Drivers/Imagick/Modifiers/DrawLineModifier.php

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public function apply(ImageInterface $image): ImageInterface
1919
{
2020
$drawing = new ImagickDraw();
2121
$drawing->setStrokeWidth($this->drawable->width());
22+
$drawing->setFillOpacity(0);
2223
$drawing->setStrokeColor(
2324
$this->driver()->colorProcessor($image->colorspace())->colorToNative(
2425
$this->backgroundColor()

tests/Unit/Drivers/Imagick/Modifiers/DrawLineModifierTest.php

+10
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,14 @@ public function testApply(): void
2525
$image->modify(new DrawLineModifier($line));
2626
$this->assertEquals('b53517', $image->pickColor(0, 0)->toHex());
2727
}
28+
29+
public function testApplyTransparent(): void
30+
{
31+
$image = $this->createTestImage(10, 10)->fill('ff5500');
32+
$this->assertColor(255, 85, 0, 255, $image->pickColor(5, 5));
33+
$line = new Line(new Point(0, 5), new Point(10, 5), 4);
34+
$line->setBackgroundColor('fff4');
35+
$image->modify(new DrawLineModifier($line));
36+
$this->assertColor(255, 136, 77, 255, $image->pickColor(5, 5));
37+
}
2838
}

0 commit comments

Comments
 (0)