phpdftk API Documentation

RgbColor
in package
implements ColorInterface

FinalYes

RGB color with components in 0.0–1.0 range — maps to PDF DeviceRGB.

Factory methods fromInt() and fromHex() accept the more common 0–255 and #RRGGBB formats and normalize to the PDF float range.

Table of Contents

Interfaces

ColorInterface
Common contract for PDF color operands — used by ContentStream color operators.

Properties

$b  : float
$g  : float
$r  : float

Methods

__construct()  : mixed
fromHex()  : self
fromInt()  : self
getColorSpace()  : string
toArray()  : array<int, float>
toCmyk()  : CmykColor
toGray()  : GrayColor

Properties

Methods

__construct()

public __construct(float $r, float $g, float $b) : mixed
Parameters
$r : float
$g : float
$b : float

fromHex()

public static fromHex(string $hex) : self
Parameters
$hex : string
Return values
self

fromInt()

public static fromInt(int $r, int $g, int $b) : self
Parameters
$r : int
$g : int
$b : int
Return values
self

getColorSpace()

public getColorSpace() : string
Return values
string

toArray()

public toArray() : array<int, float>
Return values
array<int, float>

        
On this page

Search results