mirror of
https://github.com/Intervention/image.git
synced 2025-08-29 08:40:33 +02:00
Fix bug with drawing (half) transparent colors with GD
This commit is contained in:
@@ -15,6 +15,8 @@ class DrawEllipseModifier extends AbstractDrawModifier
|
||||
{
|
||||
foreach ($image as $frame) {
|
||||
if ($this->drawable->hasBorder()) {
|
||||
imagealphablending($frame->native(), true);
|
||||
|
||||
// slightly smaller ellipse to keep 1px bordered edges clean
|
||||
if ($this->drawable->hasBackgroundColor()) {
|
||||
imagefilledellipse(
|
||||
@@ -49,6 +51,7 @@ class DrawEllipseModifier extends AbstractDrawModifier
|
||||
)
|
||||
);
|
||||
} else {
|
||||
imagealphablending($frame->native(), true);
|
||||
imagefilledellipse(
|
||||
$frame->native(),
|
||||
$this->position()->x(),
|
||||
|
@@ -16,6 +16,7 @@ class DrawLineModifier extends AbstractDrawModifier
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
foreach ($image as $frame) {
|
||||
imagealphablending($frame->native(), true);
|
||||
imageantialias($frame->native(), true);
|
||||
imageline(
|
||||
$frame->native(),
|
||||
|
@@ -19,6 +19,7 @@ class DrawPixelModifier extends DriverSpecializedModifier
|
||||
);
|
||||
|
||||
foreach ($image as $frame) {
|
||||
imagealphablending($frame->native(), true);
|
||||
imagesetpixel(
|
||||
$frame->native(),
|
||||
$this->position->x(),
|
||||
|
@@ -19,6 +19,7 @@ class DrawPolygonModifier extends AbstractDrawModifier
|
||||
{
|
||||
foreach ($image as $frame) {
|
||||
if ($this->drawable->hasBackgroundColor()) {
|
||||
imagealphablending($frame->native(), true);
|
||||
imagefilledpolygon(
|
||||
$frame->native(),
|
||||
$this->drawable->toArray(),
|
||||
@@ -29,6 +30,7 @@ class DrawPolygonModifier extends AbstractDrawModifier
|
||||
}
|
||||
|
||||
if ($this->drawable->hasBorder()) {
|
||||
imagealphablending($frame->native(), true);
|
||||
imagesetthickness($frame->native(), $this->drawable->borderSize());
|
||||
imagepolygon(
|
||||
$frame->native(),
|
||||
|
@@ -21,6 +21,7 @@ class DrawRectangleModifier extends AbstractDrawModifier
|
||||
foreach ($image as $frame) {
|
||||
// draw background
|
||||
if ($this->drawable->hasBackgroundColor()) {
|
||||
imagealphablending($frame->native(), true);
|
||||
imagefilledrectangle(
|
||||
$frame->native(),
|
||||
$this->position()->x(),
|
||||
@@ -35,6 +36,7 @@ class DrawRectangleModifier extends AbstractDrawModifier
|
||||
|
||||
// draw border
|
||||
if ($this->drawable->hasBorder()) {
|
||||
imagealphablending($frame->native(), true);
|
||||
imagesetthickness($frame->native(), $this->drawable->borderSize());
|
||||
imagerectangle(
|
||||
$frame->native(),
|
||||
|
Reference in New Issue
Block a user