interface PaletteInterface

Interface that any palette must implement.

Constants

PALETTE_GRAYSCALE

Palette name: grayscale.

PALETTE_RGB

Palette name: RGB.

PALETTE_CMYK

Palette name: CMYK.

Methods

color(string|int[]|int $color, int|null $alpha = null)

Returns a color given some values.

blend(ColorInterface $color1, ColorInterface $color2, float $amount)

Blend two colors given an amount.

$this
useProfile(ProfileInterface $profile)

Attachs an ICC profile to this Palette.

profile()

Returns the ICC profile attached to this Palette.

string
name()

Returns the name of this Palette, one of PaletteInterface::PALETTE_ constants.

string[]
pixelDefinition()

Returns an array containing ColorInterface::COLOR_* constants that define the structure of colors for a pixel.

bool
supportsAlpha()

Tells if alpha channel is supported in this palette.

int
getChannelsMaxValue()

Get the max value of palette components (255 for RGB and Grayscale, 100 for CMYK).

Details

at line 53
ColorInterface color(string|int[]|int $color, int|null $alpha = null)

Returns a color given some values.

Parameters

string|int[]|int $color A color
int|null $alpha Set alpha to null to disable it

Return Value

ColorInterface

Exceptions

InvalidArgumentException In case you pass an alpha value to a Palette that does not support alpha

at line 64
ColorInterface blend(ColorInterface $color1, ColorInterface $color2, float $amount)

Blend two colors given an amount.

Parameters

ColorInterface $color1
ColorInterface $color2
float $amount The amount of color2 in color1

Return Value

ColorInterface

at line 75
$this useProfile(ProfileInterface $profile)

Attachs an ICC profile to this Palette.

(A default profile is provided by default)

Parameters

ProfileInterface $profile

Return Value

$this

at line 82
ProfileInterface profile()

Returns the ICC profile attached to this Palette.

Return Value

ProfileInterface

at line 89
string name()

Returns the name of this Palette, one of PaletteInterface::PALETTE_ constants.

Return Value

string

at line 97
string[] pixelDefinition()

Returns an array containing ColorInterface::COLOR_* constants that define the structure of colors for a pixel.

Return Value

string[]

at line 104
bool supportsAlpha()

Tells if alpha channel is supported in this palette.

Return Value

bool

at line 111
int getChannelsMaxValue()

Get the max value of palette components (255 for RGB and Grayscale, 100 for CMYK).

Return Value

int