1
0
mirror of https://github.com/Intervention/image.git synced 2025-09-02 18:32:56 +02:00

Rename arguments

This commit is contained in:
Oliver Vogel
2025-06-22 11:10:55 +02:00
parent 7c62d9847f
commit 9910226044
6 changed files with 20 additions and 20 deletions

View File

@@ -46,8 +46,8 @@ class CropModifier extends GenericCropModifier implements SpecializedInterface
$modified = Cloner::cloneEmpty($frame->native(), $resizeTo, $background);
// define offset
$offset_x = $resizeTo->pivot()->x() + $this->offset_x;
$offset_y = $resizeTo->pivot()->y() + $this->offset_y;
$offset_x = $resizeTo->pivot()->x() + $this->x;
$offset_y = $resizeTo->pivot()->y() + $this->y;
// define target width & height
$targetWidth = min($resizeTo->width(), $originalSize->width());

View File

@@ -28,8 +28,8 @@ class CropModifier extends GenericCropModifier implements SpecializedInterface
// define position of the image on the new canvas
$crop = $this->crop($image);
$position = [
($crop->pivot()->x() + $this->offset_x) * -1,
($crop->pivot()->y() + $this->offset_y) * -1,
($crop->pivot()->x() + $this->x) * -1,
($crop->pivot()->y() + $this->y) * -1,
];
foreach ($image as $frame) {

View File

@@ -746,12 +746,12 @@ final class Image implements ImageInterface
public function crop(
int $width,
int $height,
int $offset_x = 0,
int $offset_y = 0,
int $x = 0,
int $y = 0,
mixed $background = null,
string|Alignment $alignment = Alignment::TOP_LEFT
): ImageInterface {
return $this->modify(new CropModifier($width, $height, $offset_x, $offset_y, $background, $alignment));
return $this->modify(new CropModifier($width, $height, $x, $y, $background, $alignment));
}
/**
@@ -772,11 +772,11 @@ final class Image implements ImageInterface
public function place(
mixed $element,
string|Alignment $alignment = Alignment::TOP_LEFT,
int $offset_x = 0,
int $offset_y = 0,
int $x = 0,
int $y = 0,
int $opacity = 100
): ImageInterface {
return $this->modify(new PlaceModifier($element, $alignment, $offset_x, $offset_y, $opacity));
return $this->modify(new PlaceModifier($element, $alignment, $x, $y, $opacity));
}
/**

View File

@@ -547,8 +547,8 @@ interface ImageInterface extends IteratorAggregate, Countable
public function crop(
int $width,
int $height,
int $offset_x = 0,
int $offset_y = 0,
int $x = 0,
int $y = 0,
mixed $background = null,
string|Alignment $alignment = Alignment::TOP_LEFT
): self;
@@ -573,8 +573,8 @@ interface ImageInterface extends IteratorAggregate, Countable
public function place(
mixed $element,
string|Alignment $alignment = Alignment::TOP_LEFT,
int $offset_x = 0,
int $offset_y = 0,
int $x = 0,
int $y = 0,
int $opacity = 100
): self;

View File

@@ -22,8 +22,8 @@ class CropModifier extends SpecializableModifier
public function __construct(
public int $width,
public int $height,
public int $offset_x = 0,
public int $offset_y = 0,
public int $x = 0,
public int $y = 0,
public mixed $background = null,
public string|Alignment $alignment = Alignment::TOP_LEFT
) {

View File

@@ -20,8 +20,8 @@ class PlaceModifier extends SpecializableModifier
public function __construct(
public mixed $element,
public string|Alignment $alignment = Alignment::TOP_LEFT,
public int $offset_x = 0,
public int $offset_y = 0,
public int $x = 0,
public int $y = 0,
public int $opacity = 100
) {
//
@@ -34,8 +34,8 @@ class PlaceModifier extends SpecializableModifier
{
$image_size = $image->size()->movePivot(
$this->alignment,
$this->offset_x,
$this->offset_y
$this->x,
$this->y
);
$watermark_size = $watermark->size()->movePivot(