mirror of
https://github.com/Intervention/image.git
synced 2025-08-30 09:10:21 +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) {
|
foreach ($image as $frame) {
|
||||||
if ($this->drawable->hasBorder()) {
|
if ($this->drawable->hasBorder()) {
|
||||||
|
imagealphablending($frame->native(), true);
|
||||||
|
|
||||||
// slightly smaller ellipse to keep 1px bordered edges clean
|
// slightly smaller ellipse to keep 1px bordered edges clean
|
||||||
if ($this->drawable->hasBackgroundColor()) {
|
if ($this->drawable->hasBackgroundColor()) {
|
||||||
imagefilledellipse(
|
imagefilledellipse(
|
||||||
@@ -49,6 +51,7 @@ class DrawEllipseModifier extends AbstractDrawModifier
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
imagealphablending($frame->native(), true);
|
||||||
imagefilledellipse(
|
imagefilledellipse(
|
||||||
$frame->native(),
|
$frame->native(),
|
||||||
$this->position()->x(),
|
$this->position()->x(),
|
||||||
|
@@ -16,6 +16,7 @@ class DrawLineModifier extends AbstractDrawModifier
|
|||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
foreach ($image as $frame) {
|
foreach ($image as $frame) {
|
||||||
|
imagealphablending($frame->native(), true);
|
||||||
imageantialias($frame->native(), true);
|
imageantialias($frame->native(), true);
|
||||||
imageline(
|
imageline(
|
||||||
$frame->native(),
|
$frame->native(),
|
||||||
|
@@ -19,6 +19,7 @@ class DrawPixelModifier extends DriverSpecializedModifier
|
|||||||
);
|
);
|
||||||
|
|
||||||
foreach ($image as $frame) {
|
foreach ($image as $frame) {
|
||||||
|
imagealphablending($frame->native(), true);
|
||||||
imagesetpixel(
|
imagesetpixel(
|
||||||
$frame->native(),
|
$frame->native(),
|
||||||
$this->position->x(),
|
$this->position->x(),
|
||||||
|
@@ -19,6 +19,7 @@ class DrawPolygonModifier extends AbstractDrawModifier
|
|||||||
{
|
{
|
||||||
foreach ($image as $frame) {
|
foreach ($image as $frame) {
|
||||||
if ($this->drawable->hasBackgroundColor()) {
|
if ($this->drawable->hasBackgroundColor()) {
|
||||||
|
imagealphablending($frame->native(), true);
|
||||||
imagefilledpolygon(
|
imagefilledpolygon(
|
||||||
$frame->native(),
|
$frame->native(),
|
||||||
$this->drawable->toArray(),
|
$this->drawable->toArray(),
|
||||||
@@ -29,6 +30,7 @@ class DrawPolygonModifier extends AbstractDrawModifier
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->drawable->hasBorder()) {
|
if ($this->drawable->hasBorder()) {
|
||||||
|
imagealphablending($frame->native(), true);
|
||||||
imagesetthickness($frame->native(), $this->drawable->borderSize());
|
imagesetthickness($frame->native(), $this->drawable->borderSize());
|
||||||
imagepolygon(
|
imagepolygon(
|
||||||
$frame->native(),
|
$frame->native(),
|
||||||
|
@@ -21,6 +21,7 @@ class DrawRectangleModifier extends AbstractDrawModifier
|
|||||||
foreach ($image as $frame) {
|
foreach ($image as $frame) {
|
||||||
// draw background
|
// draw background
|
||||||
if ($this->drawable->hasBackgroundColor()) {
|
if ($this->drawable->hasBackgroundColor()) {
|
||||||
|
imagealphablending($frame->native(), true);
|
||||||
imagefilledrectangle(
|
imagefilledrectangle(
|
||||||
$frame->native(),
|
$frame->native(),
|
||||||
$this->position()->x(),
|
$this->position()->x(),
|
||||||
@@ -35,6 +36,7 @@ class DrawRectangleModifier extends AbstractDrawModifier
|
|||||||
|
|
||||||
// draw border
|
// draw border
|
||||||
if ($this->drawable->hasBorder()) {
|
if ($this->drawable->hasBorder()) {
|
||||||
|
imagealphablending($frame->native(), true);
|
||||||
imagesetthickness($frame->native(), $this->drawable->borderSize());
|
imagesetthickness($frame->native(), $this->drawable->borderSize());
|
||||||
imagerectangle(
|
imagerectangle(
|
||||||
$frame->native(),
|
$frame->native(),
|
||||||
|
Reference in New Issue
Block a user