HumHub Documentation (unofficial)

PaletteInterface

Interface that any palette must implement.

Table of Contents

Constants

PALETTE_CMYK  = 'cmyk'
Palette name: CMYK.
PALETTE_GRAYSCALE  = 'gray'
Palette name: grayscale.
PALETTE_RGB  = 'rgb'
Palette name: RGB.

Methods

blend()  : ColorInterface
Blend two colors given an amount.
color()  : ColorInterface
Returns a color given some values.
getChannelsMaxValue()  : int
Get the max value of palette components (255 for RGB and Grayscale, 100 for CMYK).
name()  : string
Returns the name of this Palette, one of PaletteInterface::PALETTE_ constants.
pixelDefinition()  : array<string|int, string>
Returns an array containing ColorInterface::COLOR_* constants that define the structure of colors for a pixel.
profile()  : ProfileInterface
Returns the ICC profile attached to this Palette.
supportsAlpha()  : bool
Tells if alpha channel is supported in this palette.
useProfile()  : $this
Attachs an ICC profile to this Palette.

Constants

PALETTE_GRAYSCALE

Palette name: grayscale.

public string PALETTE_GRAYSCALE = 'gray'

Methods

color()

Returns a color given some values.

public color(string|array<string|int, int>|int $color[, int|null $alpha = null ]) : ColorInterface
Parameters
$color : string|array<string|int, int>|int

A color

$alpha : int|null = null

Set alpha to null to disable it

Tags
throws
InvalidArgumentException

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

Return values
ColorInterface

getChannelsMaxValue()

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

public getChannelsMaxValue() : int
Return values
int

name()

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

public name() : string
Return values
string

pixelDefinition()

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

public pixelDefinition() : array<string|int, string>
Return values
array<string|int, string>

supportsAlpha()

Tells if alpha channel is supported in this palette.

public supportsAlpha() : bool
Return values
bool

        
On this page

Search results