AbstractBackgroundLayer
extends AbstractLayer
in package
Abstract cover background layer
Tags
Table of Contents
- $colorMap : array<string|int, mixed>
- Mapping of color names to RGB values.
- createSeed() : int
- Generates a dynamic cover image from elements of the book
- getAccentColor() : int
- Generate an accent color from a seed value.
- getColor() : int|false
- Check and allocates color
- getHSBColor() : int
- Using HSB allows us to control the contrast while allowing randomness
Properties
$colorMap
Mapping of color names to RGB values.
protected
array<string|int, mixed>
$colorMap
= ['black' => [0, 0, 0], 'silver' => [192, 192, 192], 'gray' => [128, 128, 128], 'white' => [255, 255, 255], 'maroon' => [128, 0, 0], 'red' => [255, 0, 0], 'purple' => [128, 0, 128], 'fuchsia' => [255, 0, 255], 'green' => [0, 128, 0], 'lime' => [0, 255, 0], 'olive' => [128, 128, 0], 'yellow' => [255, 255, 0], 'navy' => [0, 0, 128], 'blue' => [0, 0, 255], 'teal' => [0, 128, 128], 'aqua' => [0, 255, 255]]
Methods
createSeed()
Generates a dynamic cover image from elements of the book
protected
createSeed(string $title, string $callnumber) : int
Parameters
- $title : string
-
Title of the book
- $callnumber : string
-
Callnumber of the book
Return values
int —unique number for this record
getAccentColor()
Generate an accent color from a seed value.
protected
getAccentColor(resource $im, int $seed, object $settings) : int
Parameters
- $im : resource
-
Active image resource
- $seed : int
-
Seed value
- $settings : object
-
Generator settings object
Return values
int —getColor()
Check and allocates color
protected
getColor(resource $im, string $color) : int|false
Parameters
- $im : resource
-
Image resource being updated
- $color : string
-
Legal color name from HTML4
Return values
int|false —allocated color
getHSBColor()
Using HSB allows us to control the contrast while allowing randomness
protected
getHSBColor(resource $im, int $h, int $s, int $v) : int
Parameters
- $im : resource
-
Active image resource
- $h : int
-
Hue (0-255)
- $s : int
-
Saturation (0-255)
- $v : int
-
Lightness (0-255)