class SvgIconRasterizer implements FilterInterface (View source)

Generate bitmap icons starting from source SVG icons.

Properties

protected string $coreVersion

The concrete5 version for which the bitmap icons should be created for.

protected bool $checkEditDate

Should the bitmap icons be created only if they don't exist, or if they are older than the source SVG files?

protected OutputInterface $output
protected VolatileDirectory $volatileDirectory
protected Filesystem $fs

Methods

__construct(string $coreVersion, bool $checkEditDate, OutputInterface $output, VolatileDirectory $volatileDirectory, Filesystem $fs)

Initialize the instance.

apply(PackerFile $file)

Process a file/directory.

array|null
getBitmapData(PackerFile $file)

Get the details of the bitmap data to be generated for a file.

bool
isBitmapNewerThanSVG(PackerFile $file, array $bitmapData)

Check if there's already a bitmap file, and that it's not older than the SVG file.

string
createBitmap(PackerFile $sourceFile, array $bitmapData)

Create the bitmap associated to an SVG file.

Details

__construct(string $coreVersion, bool $checkEditDate, OutputInterface $output, VolatileDirectory $volatileDirectory, Filesystem $fs)

Initialize the instance.

Parameters

string $coreVersion

the concrete5 version for which the bitmap icons should be created for

bool $checkEditDate

set to true if the bitmap icons should be created only if they don't exist, or if they are older than the source SVG files

OutputInterface $output
VolatileDirectory $volatileDirectory
Filesystem $fs

PackerFile[] apply(PackerFile $file)

Process a file/directory.

Parameters

PackerFile $file

the file to be processed

Return Value

PackerFile[]

the resulting list of files after processing

See also

FilterInterface::apply

protected array|null getBitmapData(PackerFile $file)

Get the details of the bitmap data to be generated for a file.

Parameters

PackerFile $file

Return Value

array|null

return an array with keys ['extension', 'width', 'height'] if there's a bitmap file associated to the file, NULL otherwise

protected bool isBitmapNewerThanSVG(PackerFile $file, array $bitmapData)

Check if there's already a bitmap file, and that it's not older than the SVG file.

Parameters

PackerFile $file

the SVG file

array $bitmapData

the result of the getBitmapData() method

Return Value

bool

return true if the bitmap file already exists and it's newer than the SVG file

protected string createBitmap(PackerFile $sourceFile, array $bitmapData)

Create the bitmap associated to an SVG file.

Parameters

PackerFile $sourceFile

the SVG file

array $bitmapData

the result of the getBitmapData() method

Return Value

string

Exceptions

RuntimeException