setasign\SetaPDF2\Core\Image\Gif

Frame Class representing a GIF frame.

File: /SetaPDF v2/Core/Image/Gif/Frame.php
Old class name (alias): \SetaPDF_Core_Image_Gif_Frame

Class hierarchy

Summary

Static Properties

$cache

static public bool Frame::$cache = true

A static flag to enable or disable the caching of frames.


Properties

$_delayTime

private int Frame::$_delayTime

The time to wait before drawing the next frame.

$_imageDescriptor

The associated image descriptors.

$_previousFrame

The previous frame that shall be rendered underneath the current one.

$_reader

The GIF reader.

$_stream

private ?string Frame::$_stream

The cached image stream.

$_transparencyMask

private ?string Frame::$_transparencyMask

The cached transparent pixels, if there are no pixels left, the value will change to null.

$_transparencyPixelCount

The cached number of transparent pixels, if there are no pixels left, the value will change to null.

$_transparentIndices

private array Frame::$_transparentIndices

The transparent indices.


Methods

__construct()

public Frame::__construct (
\SetaPDF_Core_Image_Gif_Reader $reader,
\SetaPDF_Core_Image_Gif_Block_ImageDescriptor $image,
array $transparentIndices,
?\SetaPDF_Core_Image_Gif_Frame $previousFrame = null,
int $delayTime = 0
)

The constructor.

Parameters
$reader : \SetaPDF_Core_Image_Gif_Reader
 
$image : \SetaPDF_Core_Image_Gif_Block_ImageDescriptor
 
$transparentIndices : array
 
$previousFrame : ?\SetaPDF_Core_Image_Gif_Frame
 
$delayTime : int
 

_applyPixels()

private Frame::_applyPixels (
string &$stream,
?string &$transparencyMask,
?int &$transparencyPixelCount,
int[] $pixels,
string[] $colorTable
): void

Applies all the pixel changes onto the stream.

Parameters
$stream : string
 
$transparencyMask : ?string
 
$transparencyPixelCount : ?int
 
$pixels : int[]
 
$colorTable : string[]
 

_createMaskStream()

private Frame::_createMaskStream (
string $transparencyMask
): \SetaPDF_Core_Type_Stream

Creates a SMask for the current image.

Parameters
$transparencyMask : string
 

_ensureStream()

private Frame::_ensureStream (
?string &$stream,
?string &$transparencyMask,
?int &$transparencyPixelCount = null
): void

Ensures that the stream is the read stream.

Parameters
$stream : ?string
 
$transparencyMask : ?string
 
$transparencyPixelCount : ?int
 
Exceptions

Throws \setasign\SetaPDF2\Core\Image\Exception

_getColorTable()

private Frame::_getColorTable (
void
): ?array

Gets the color table.

Exceptions

Throws \setasign\SetaPDF2\Core\Image\Exception

_readStream()

private Frame::_readStream (
?string &$stream,
?string &$transparencyMask,
?int &$transparencyPixelCount
): void

Reads the current stream and renders it onto the image stream.

Parameters
$stream : ?string
 
$transparencyMask : ?string
 
$transparencyPixelCount : ?int
 
Exceptions

Throws \setasign\SetaPDF2\Core\Image\Exception

getDelayTime()

public Frame::getDelayTime (
void
): int

Get the time to wait before drawing the next frame.

toXObject()

Creates a XObject using the stored frame data.

Parameters
$document : \SetaPDF_Core_Document
 
Exceptions

Throws \setasign\SetaPDF2\Core\Image\Exception