Skip to content

Commit

Permalink
fix opacity issue
Browse files Browse the repository at this point in the history
  • Loading branch information
lohanidamodar committed Apr 9, 2021
1 parent 5ae43c1 commit 9274a77
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Image/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ public function setBorder(int $borderWidth, string $borderColor): self
$this->borderWidth = $borderWidth;
$this->borderColor = $borderColor;

// if cornerRadius is set, border is handled in the setBorderRadius functions
if(!empty($this->cornerRadius)) return $this;
$this->image->borderImage($borderColor, $borderWidth, $borderWidth);

Expand Down Expand Up @@ -127,11 +126,16 @@ public function setBorderRadius(int $cornerRadius): self

$strokeCanvas = new Imagick();
$strokeCanvas->newImage($this->width, $this->height, new ImagickPixel('transparent'),'png');

$shape2 = new ImagickDraw();
$shape2->setFillColor($bc);
$shape2->roundRectangle(0,0,$this->width, $this->height, $cornerRadius, $cornerRadius);
$shape2->setFillColor(new ImagickPixel('transparent'));
$shape2->setStrokeWidth($this->borderWidth);
$shape2->setStrokeColor($bc);
$shape2->roundRectangle($this->borderWidth, $this->borderWidth, $rectwidth, $rectheight, $cornerRadius, $cornerRadius);

$strokeCanvas->drawImage($shape2);
$strokeCanvas->compositeImage($this->image, Imagick::COMPOSITE_DEFAULT, 0,0);

$this->image = $strokeCanvas;
}
return $this;
Expand Down

0 comments on commit 9274a77

Please sign in to comment.