AbstractTextLayer
extends AbstractLayer
in package
Abstract cover text layer
Tags
Table of Contents
- $colorMap : array<string|int, mixed>
- Mapping of color names to RGB values.
- drawText() : void
- Simulate outlined text
- getColor() : int|false
- Check and allocates color
- getHSBColor() : int
- Using HSB allows us to control the contrast while allowing randomness
- textHeight() : int
- Returns the height a string would render to
- textWidth() : int
- Returns the width a string would render to
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
drawText()
Simulate outlined text
protected
drawText(resource $im, object $settings, string $text, int $y, string $font, int $fontSize, int $mcolor[, int $scolor = false ][, string $align = null ]) : void
Parameters
- $im : resource
-
Active image resource
- $settings : object
-
Generator settings object
- $text : string
-
Text to render
- $y : int
-
Top position
- $font : string
-
Full path to font
- $fontSize : int
-
Size of the font
- $mcolor : int
-
Main text color
- $scolor : int = false
-
Secondary border color
- $align : string = null
-
'left','center','right'
Return values
void —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)
Return values
int —textHeight()
Returns the height a string would render to
protected
textHeight(string $text, string $font, string $size) : int
Parameters
- $text : string
-
Text to test
- $font : string
-
Full font path
- $size : string
-
Size of the font
Return values
int —textWidth()
Returns the width a string would render to
protected
textWidth(string $text, string $font, string $size) : int
Parameters
- $text : string
-
Text to test
- $font : string
-
Full font path
- $size : string
-
Size of the font