SetaPDF_Core_DataStructure_Color Abstract class for color structures

File: /SetaPDF v2/Core/DataStructure/Color.php

Class hierarchy

Summary

Properties

$_components

The array of color components


Static Methods

createByComponents()

Create an instance by a PDF array object, PHP array or a hexadecimal string of an RGB value.

Parameters
$components : bool|int|float|string|array|SetaPDF_Core_Type_Array

The count of $components define the color space (1 - gray, 3 - RGB, 4 - CMYK). The color values must be between 0 and 1.
It is also possible to pass a hexadecimal string of an RGB value. The string need to be prefixed by a sharp (#).

Exceptions

Throws InvalidArgumentException

hexToRgb()

static public SetaPDF_Core_DataStructure_Color::hexToRgb (
string $hex
): array

Converts a hex encoded string into a component array of red, green and blue values.

Parameters
$hex : string
 

writePdfString()

static public SetaPDF_Core_DataStructure_Color::writePdfString (
SetaPDF_Core_WriteInterface $writer, array $components [, boolean|null $stroking = true ]
): void

Writes the colors components to a writer.

Parameters
$writer : SetaPDF_Core_WriteInterface
 
$components : array
 
$stroking : boolean|null
 

writePdfStringByComponents()

static public SetaPDF_Core_DataStructure_Color::writePdfStringByComponents (
SetaPDF_Core_WriteInterface $writer, array|int|float|string $components [, bool $stroking = true ]
): void

Writes a color definition directly to a writer.

Parameters
$writer : SetaPDF_Core_WriteInterface
 
$components : array|int|float|string
 
$stroking : bool
 
Exceptions

Throws InvalidArgumentException


Methods

__construct()

The constructor.

Parameters
$components : SetaPDF_Core_Type_Array|array|float
 

__clone()

Implementation of __clone().

adjustAllComponents()

Adjust all color components by a specific value.

Parameters
$by : int|float
 

draw()

public SetaPDF_Core_DataStructure_Color::draw (
SetaPDF_Core_WriteInterface $writer [, boolean $stroking = true ]
): void

Write the color as a PDF string to a writer.

Parameters
$writer : SetaPDF_Core_WriteInterface
 
$stroking : boolean
 

getValue()

Get the components of the color.

toPhp()

public SetaPDF_Core_DataStructure_Color::toPhp (
void
): array

Get the data as a PHP value.