Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
- Laravel 13 mit Filament 5 (Admin), Inertia 3 + Vue 3 + Vuetify 4 (Material 3) - Anmeldung über Fortify (Login, Passwort vergessen/ändern), keine Selbstregistrierung - Profil mit Profilbild (WebP in festen Größen), Personenseiten, Header mit Avatar-Menü - Material-3-Farbschema aus der Primärfarbe, hell/dunkel/System pro Person - Basis-Branding (Portalname, Logo, Primärfarbe) im Admin unter „Erscheinungsbild“ - Benutzerverwaltung im Admin, Zugang vorläufig über is_admin - vendor/ (ohne Dev-Pakete) und Frontend-Build mitversioniert, Dev-Pakete in vendor-dev/ - PHPUnit-Tests gegen MySQL/MariaDB, Forgejo-CI-Matrix, Docker-Entwicklungsumgebung - VERSION, CHANGELOG.md und CONTRIBUTING.md mit Release-Ablauf Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
197 lines
4.1 KiB
PHP
197 lines
4.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Intervention\Gif;
|
|
|
|
use Intervention\Gif\Blocks\ColorTable;
|
|
use Intervention\Gif\Blocks\CommentExtension;
|
|
use Intervention\Gif\Blocks\FrameBlock;
|
|
use Intervention\Gif\Blocks\Header;
|
|
use Intervention\Gif\Blocks\LogicalScreenDescriptor;
|
|
use Intervention\Gif\Blocks\NetscapeApplicationExtension;
|
|
use Intervention\Gif\Blocks\Trailer;
|
|
|
|
class GifDataStream extends AbstractEntity
|
|
{
|
|
/**
|
|
* Create new instance.
|
|
*
|
|
* @param array<FrameBlock> $frames
|
|
* @param array<CommentExtension> $comments
|
|
*/
|
|
public function __construct(
|
|
protected Header $header = new Header(),
|
|
protected LogicalScreenDescriptor $logicalScreenDescriptor = new LogicalScreenDescriptor(),
|
|
protected ?ColorTable $globalColorTable = null,
|
|
protected array $frames = [],
|
|
protected array $comments = []
|
|
) {
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Get header.
|
|
*/
|
|
public function header(): Header
|
|
{
|
|
return $this->header;
|
|
}
|
|
|
|
/**
|
|
* Set header.
|
|
*/
|
|
public function setHeader(Header $header): self
|
|
{
|
|
$this->header = $header;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Get logical screen descriptor.
|
|
*/
|
|
public function logicalScreenDescriptor(): LogicalScreenDescriptor
|
|
{
|
|
return $this->logicalScreenDescriptor;
|
|
}
|
|
|
|
/**
|
|
* Set logical screen descriptor.
|
|
*/
|
|
public function setLogicalScreenDescriptor(LogicalScreenDescriptor $descriptor): self
|
|
{
|
|
$this->logicalScreenDescriptor = $descriptor;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Return global color table if available else null.
|
|
*/
|
|
public function globalColorTable(): ?ColorTable
|
|
{
|
|
return $this->globalColorTable;
|
|
}
|
|
|
|
/**
|
|
* Set global color table.
|
|
*/
|
|
public function setGlobalColorTable(ColorTable $table): self
|
|
{
|
|
$this->globalColorTable = $table;
|
|
$this->logicalScreenDescriptor->setGlobalColorTableExistance(true);
|
|
$this->logicalScreenDescriptor->setGlobalColorTableSize(
|
|
$table->logicalSize()
|
|
);
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Get main graphic control extension.
|
|
*/
|
|
public function mainApplicationExtension(): ?NetscapeApplicationExtension
|
|
{
|
|
foreach ($this->frames as $frame) {
|
|
$extension = $frame->netscapeExtension();
|
|
if ($extension !== null) {
|
|
return $extension;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* Get array of frames.
|
|
*
|
|
* @return array<FrameBlock>
|
|
*/
|
|
public function frames(): array
|
|
{
|
|
return $this->frames;
|
|
}
|
|
|
|
/**
|
|
* Return array of "global" comments.
|
|
*
|
|
* @return array<CommentExtension>
|
|
*/
|
|
public function comments(): array
|
|
{
|
|
return $this->comments;
|
|
}
|
|
|
|
/**
|
|
* Return first frame.
|
|
*/
|
|
public function firstFrame(): ?FrameBlock
|
|
{
|
|
if ($this->frames === []) {
|
|
return null;
|
|
}
|
|
|
|
if (!array_key_exists(0, $this->frames)) {
|
|
return null;
|
|
}
|
|
|
|
return $this->frames[0];
|
|
}
|
|
|
|
/**
|
|
* Add frame.
|
|
*/
|
|
public function addFrame(FrameBlock $frame): self
|
|
{
|
|
$this->frames[] = $frame;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Add comment extension.
|
|
*/
|
|
public function addComment(CommentExtension $comment): self
|
|
{
|
|
$this->comments[] = $comment;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Set the current data.
|
|
*
|
|
* @param array<FrameBlock> $frames
|
|
*/
|
|
public function setFrames(array $frames): self
|
|
{
|
|
$this->frames = $frames;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Get trailer.
|
|
*/
|
|
public function trailer(): Trailer
|
|
{
|
|
return new Trailer();
|
|
}
|
|
|
|
/**
|
|
* Determine if gif is animated.
|
|
*/
|
|
public function isAnimated(): bool
|
|
{
|
|
return count($this->frames()) > 1;
|
|
}
|
|
|
|
/**
|
|
* Determine if global color table is set.
|
|
*/
|
|
public function hasGlobalColorTable(): bool
|
|
{
|
|
return !is_null($this->globalColorTable);
|
|
}
|
|
}
|