setasign\SetaPDF2\Core\DataStructure\Color
AbstractColor Abstract class for color structures
File: /SetaPDF v2/Core/DataStructure/Color/AbstractColor.php
Old class name (alias):
\SetaPDF_Core_DataStructure_Color
Class hierarchy
Summary
Properties
Static Methods
createByComponents()
public static AbstractColor::createByComponents (
string|float|array{0: float, 1?: float, 2?: float, 3?: float}|\setasign\SetaPDF2\Core\Type\PdfArray $components
): AbstractColorCreate an instance by a PDF array object, PHP array or a hexadecimal string of an RGB value.
Parameters
- $components: string|float|array{0: float, 1?: float, 2?: float, 3?: float}|\setasign\SetaPDF2\Core\Type\PdfArray
Exceptions
Throws \InvalidArgumentException
hexToRgb()
WARNING: This method is marked as deprecated!
Use Rgb::hexToRgb() instead.
Converts a hex encoded string (3 or 6 characters) into a component array of red, green and blue values.
Parameters
- $hex: string
writePdfString()
Writes the colors components to a writer.
Parameters
- $writer: \setasign\SetaPDF2\Core\Writer\WriteInterface
- $components: float[]
- $stroking: ?bool
writePdfStringByComponents()
public static AbstractColor::writePdfStringByComponents (
\setasign\SetaPDF2\Core\Writer\WriteInterface $writer,
int|float|string|array{0: float, 1?: float, 2?: float, 3?: float} $components,
bool $stroking = true
): voidint|float|string|array{0: float, 1?: float, 2?: float, 3?: float} $components,
bool $stroking = true
Writes a color definition directly to a writer.
Parameters
- $writer: \setasign\SetaPDF2\Core\Writer\WriteInterface
- $components: int|float|string|array{0: float, 1?: float, 2?: float, 3?: float}
- $stroking: bool
Exceptions
Throws \InvalidArgumentException
Methods
__construct()
public AbstractColor::__construct (
\setasign\SetaPDF2\Core\Type\PdfArray|float|float[] $components
)The constructor.
Parameters
- $components: \setasign\SetaPDF2\Core\Type\PdfArray|float|float[]
draw()
Write the color as a PDF string to a writer.
Parameters
- $writer: \setasign\SetaPDF2\Core\Writer\WriteInterface
- $stroking: bool
