1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-19 12:11:26 +02:00

Edit doc blocks

This commit is contained in:
Oliver Vogel
2024-01-28 12:29:45 +01:00
parent 34e665b7e0
commit c78838ffe9
4 changed files with 122 additions and 0 deletions

View File

@@ -14,6 +14,16 @@ use Intervention\Image\Interfaces\SizeInterface;
class Frame implements FrameInterface
{
/**
* Create new frame instance
*
* @param GdImage $native
* @param float|int $delay
* @param int $dispose
* @param int $offset_left
* @param int $offset_top
* @return void
*/
public function __construct(
protected GdImage $native,
protected float $delay = 0,
@@ -24,11 +34,21 @@ class Frame implements FrameInterface
//
}
/**
* {@inheritdoc}
*
* @see FrameInterface::toImage()
*/
public function toImage(DriverInterface $driver): ImageInterface
{
return new Image($driver, new Core([$this]));
}
/**
* {@inheritdoc}
*
* @see FrameInterface::setNative()
*/
public function setNative($native): FrameInterface
{
$this->native = $native;
@@ -36,21 +56,41 @@ class Frame implements FrameInterface
return $this;
}
/**
* {@inheritdoc}
*
* @see FrameInterface::native()
*/
public function native(): GdImage
{
return $this->native;
}
/**
* {@inheritdoc}
*
* @see FrameInterface::size()
*/
public function size(): SizeInterface
{
return new Rectangle(imagesx($this->native), imagesy($this->native));
}
/**
* {@inheritdoc}
*
* @see FrameInterface::delay()
*/
public function delay(): float
{
return $this->delay;
}
/**
* {@inheritdoc}
*
* @see FrameInterface::setDelay()
*/
public function setDelay(float $delay): FrameInterface
{
$this->delay = $delay;
@@ -58,11 +98,21 @@ class Frame implements FrameInterface
return $this;
}
/**
* {@inheritdoc}
*
* @see FrameInterface::dispose()
*/
public function dispose(): int
{
return $this->dispose;
}
/**
* {@inheritdoc}
*
* @see FrameInterface::setDispose()
*/
public function setDispose(int $dispose): FrameInterface
{
$this->dispose = $dispose;
@@ -70,6 +120,11 @@ class Frame implements FrameInterface
return $this;
}
/**
* {@inheritdoc}
*
* @see FrameInterface::setOffset()
*/
public function setOffset(int $left, int $top): FrameInterface
{
$this->offset_left = $left;
@@ -78,11 +133,21 @@ class Frame implements FrameInterface
return $this;
}
/**
* {@inheritdoc}
*
* @see FrameInterface::offsetLeft()
*/
public function offsetLeft(): int
{
return $this->offset_left;
}
/**
* {@inheritdoc}
*
* @see FrameInterface::setOffsetLeft()
*/
public function setOffsetLeft(int $offset): FrameInterface
{
$this->offset_left = $offset;
@@ -90,11 +155,21 @@ class Frame implements FrameInterface
return $this;
}
/**
* {@inheritdoc}
*
* @see FrameInterface::offsetTop()
*/
public function offsetTop(): int
{
return $this->offset_top;
}
/**
* {@inheritdoc}
*
* @see FrameInterface::setOffsetTop()
*/
public function setOffsetTop(int $offset): FrameInterface
{
$this->offset_top = $offset;

View File

@@ -9,11 +9,23 @@ use Intervention\Image\Interfaces\ModifierInterface;
class ModifierStack implements ModifierInterface
{
/**
* Create new modifier stack object with an array of modifier objects
*
* @param array $modifiers
* @return void
*/
public function __construct(protected array $modifiers)
{
//
}
/**
* Apply all modifiers in stack to the given image
*
* @param ImageInterface $image
* @return ImageInterface
*/
public function apply(ImageInterface $image): ImageInterface
{
foreach ($this->modifiers as $modifier) {
@@ -23,6 +35,12 @@ class ModifierStack implements ModifierInterface
return $image;
}
/**
* Append new modifier to the stack
*
* @param ModifierInterface $modifier
* @return ModifierStack
*/
public function push(ModifierInterface $modifier): self
{
$this->modifiers[] = $modifier;

View File

@@ -6,6 +6,12 @@ namespace Intervention\Image\Traits;
trait CanBuildFilePointer
{
/**
* Transform the provided data into a pointer with the data as its content
*
* @param string $data
* @return resource|false
*/
public function buildFilePointer(string $data)
{
$pointer = fopen('php://temp', 'rw');

View File

@@ -9,17 +9,35 @@ use Intervention\Image\Interfaces\PointInterface;
class Line
{
/**
* Create new text line object with given text & position
*
* @param string $text
* @param PointInterface $position
* @return void
*/
public function __construct(
protected string $text,
protected PointInterface $position = new Point()
) {
}
/**
* Get Position of line
*
* @return PointInterface
*/
public function position(): PointInterface
{
return $this->position;
}
/**
* Set position of current line
*
* @param Point $point
* @return Line
*/
public function setPosition(Point $point): self
{
$this->position = $point;
@@ -27,6 +45,11 @@ class Line
return $this;
}
/**
* Cast line to string
*
* @return string
*/
public function __toString(): string
{
return $this->text;