Skip to content

Commit

Permalink
Rename parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Sep 29, 2023
1 parent d7fd99e commit 834d5cb
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Drivers/Gd/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public function setLoops(int $count): self
return $this;
}

public function getFrame(int $key = 0): ?FrameInterface
public function getFrame(int $position = 0): ?FrameInterface
{
return $this->frames->get($key);
return $this->frames->get($position);
}

public function addFrame(FrameInterface $frame): ImageInterface
Expand Down
4 changes: 2 additions & 2 deletions src/Drivers/Imagick/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public function getImagick(): Imagick
return $this->imagick;
}

public function getFrame(int $key = 0): ?FrameInterface
public function getFrame(int $position = 0): ?FrameInterface
{
try {
$this->imagick->setIteratorIndex($key);
$this->imagick->setIteratorIndex($position);
} catch (ImagickException $e) {
return null;
}
Expand Down
43 changes: 42 additions & 1 deletion src/Interfaces/ImageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,59 @@

interface ImageInterface extends Traversable, Countable
{
public function getFrame(int $key = 0): ?FrameInterface;
/**
* Get frame of animation image at given position starting with zero
*
* @param int $key
* @return null|FrameInterface
*/
public function getFrame(int $position = 0): ?FrameInterface;
public function addFrame(FrameInterface $frame): ImageInterface;
public function setLoops(int $count): ImageInterface;
public function getLoops(): int;
public function getSize(): SizeInterface;
public function isAnimated(): bool;
public function modify(ModifierInterface $modifier): ImageInterface;

/**
* Encode image with given encoder
*
* @param EncoderInterface $encoder
* @return EncodedImage
*/
public function encode(EncoderInterface $encoder): EncodedImage;

/**
* Encode image to jpeg format
*
* @param int $quality
* @return EncodedImage
*/
public function toJpeg(int $quality = 75): EncodedImage;

/**
* Encode image to webp format
*
* @param int $quality
* @return EncodedImage
*/
public function toWebp(int $quality = 75): EncodedImage;

/**
* Encode image to gif format
*
* @return EncodedImage
*/
public function toGif(): EncodedImage;


/**
* Encode image to png format
*
* @return EncodedImage
*/
public function toPng(): EncodedImage;

public function pickColors(int $x, int $y): CollectionInterface;
public function text(string $text, int $x, int $y, ?callable $init = null): ImageInterface;
public function pickColor(int $x, int $y, int $frame_key = 0): ?ColorInterface;
Expand Down

0 comments on commit 834d5cb

Please sign in to comment.