phpBB API Documentation
Class

phpbb\captcha\colour_manager

class colour_manager

Properties

$img
$mode
$colours
$named_colours

Methods

__construct($img, $background = false, $mode = 'ahsv')

Create the colour manager, link it to the image resource

get_resource($named_colour)

Lookup a named colour resource

name_colour($name, $resource)

Assign a name to a colour resource

allocate_named($name, $colour, $mode = false)

names and allocates a colour resource

allocate($colour, $mode = false)

allocates a specified colour into the image

random_colour($params = array(), $mode = false)

randomly generates a colour, with optional params

colour_scheme($resource, $include_original = true)

mono_range($resource, $count = 5, $include_original = true)

model_convert($colour, $from_model, $to_model)

Convert from one colour model to another

hsv2rgb($hsv)

Slightly altered from wikipedia's algorithm

rgb2hsv($rgb)

(more than) Slightly altered from wikipedia's algorithm

normalize_hue($hue)

ah2h($ahue)

Alternate hue to hue

h2ah($hue)

hue to Alternate hue

Details

at line 26
public __construct($img, $background = false, $mode = 'ahsv')

Create the colour manager, link it to the image resource

Parameters

$img
$background
$mode

at line 43
public get_resource($named_colour)

Lookup a named colour resource

Parameters

$named_colour

at line 61
public name_colour($name, $resource)

Assign a name to a colour resource

Parameters

$name
$resource

at line 69
public allocate_named($name, $colour, $mode = false)

names and allocates a colour resource

Parameters

$name
$colour
$mode

at line 83
public allocate($colour, $mode = false)

allocates a specified colour into the image

Parameters

$colour
$mode

at line 130
public random_colour($params = array(), $mode = false)

randomly generates a colour, with optional params

Parameters

$params
$mode

at line 229
public colour_scheme($resource, $include_original = true)

Parameters

$resource
$include_original

at line 254
public mono_range($resource, $count = 5, $include_original = true)

Parameters

$resource
$count
$include_original

at line 296
public model_convert($colour, $from_model, $to_model)

Convert from one colour model to another

Parameters

$colour
$from_model
$to_model

at line 352
public hsv2rgb($hsv)

Slightly altered from wikipedia's algorithm

Parameters

$hsv

at line 415
public rgb2hsv($rgb)

(more than) Slightly altered from wikipedia's algorithm

Parameters

$rgb

at line 453
public normalize_hue($hue)

Parameters

$hue

at line 466
public ah2h($ahue)

Alternate hue to hue

Parameters

$ahue

at line 500
public h2ah($hue)

hue to Alternate hue

Parameters

$hue