final class ImageBackground (View source)

Defines the pixels used where a source image does not cover its variant canvas.

A transparent background deliberately has no color value. A color background always exposes one normalized opaque RGB value.

Methods

Creates a background whose unused canvas pixels retain alpha transparency.

color(string $color)

Creates an opaque RGB background from an exact hexadecimal color value.

ImageBackgroundMode
mode()

Returns the policy that determines how unused canvas pixels are initialized.

ImageBackgroundMode
string|null

Returns the normalized color for color mode, or null when the background is transparent.

string|null
string

Returns the stable output-affecting representation used by variant cache identity.

string

Details

transparent

static ImageBackground transparent()

Creates a background whose unused canvas pixels retain alpha transparency.

Return Value

ImageBackground

color

static ImageBackground color(string $color)

Creates an opaque RGB background from an exact hexadecimal color value.

Parameters

string $color

Return Value

ImageBackground

Exceptions

ImageValidationException

mode

ImageBackgroundMode mode()

Returns the policy that determines how unused canvas pixels are initialized.

Return Value

ImageBackgroundMode

colorValue

string|null colorValue()

Returns the normalized color for color mode, or null when the background is transparent.

Return Value

string|null

canonical

string canonical()

Returns the stable output-affecting representation used by variant cache identity.

Return Value

string