Skip to content

Commit

Permalink
Add Builder::setSize()
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Jan 4, 2024
1 parent 66b6371 commit a0bb223
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ public function getGifDataStream(): GifDataStream
return $this->gif;
}

/**
* Set canvas size of gif
*
* @param int $width
* @param int $height
* @return Builder
*/
public function setSize(int $width, int $height): self
{
$this->gif->getLogicalScreenDescriptor()->setSize($width, $height);

return $this;
}

/**
* Create new canvas
*
Expand All @@ -43,11 +57,7 @@ public function getGifDataStream(): GifDataStream
*/
public static function canvas(int $width, int $height): self
{
$gif = new GifDataStream();
$gif->getLogicalScreenDescriptor()
->setSize($width, $height);

return new self($gif);
return (new self())->setSize($width, $height);
}

/**
Expand Down

0 comments on commit a0bb223

Please sign in to comment.