Function __global->generate_recoloured_image

Definitions

sources/themewizard.php

  • Generate a theme image by converting an existing one to a new colour scheme via intelligent blending correlation.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$path mixed No No required parameter N/A N/A The image path OR a preloaded GD image resource
$colour_a_orig string No No required parameter N/A N/A The colour code of what we have as our "minor" colour (often a border colour)
$colour_a_new string No No required parameter N/A N/A The colour code of what we want as our "minor" colour (often a border colour)
$colour_b1_orig string No No required parameter N/A N/A The colour code of what we have as our first major colour (often the only major colour)
$colour_b1_new string No No required parameter N/A N/A The colour code of what we want as our first major colour (often the only major colour)
$colour_b2_orig ?string No No Null N/A N/A The colour code of what we have as our second major colour (the gradient target, at the bottom/right of the image) (null: not gradiented)
$colour_b2_new ?string No No Null N/A N/A The colour code of what we want as our second major colour (the gradient target, at the bottom/right of the image) (null: not gradiented)
$gradient_direction string No No vertical vertical horizontal N/A The directional code for the gradient
$pixel_x_start_array ?array No No Null N/A N/A An array that is used to limit where we do our conversion on. It specifies, for each y-offset, the x-offset we start from (null: no such limitation)
$gradient_offset integer No No 0 N/A N/A What the gradient assumed start-position will be offset by (in the gradient direction)
$end_array boolean No No False N/A N/A Whether the pixel_x_start array is actually an end array

Returns

  • The image
  • Type: resource
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Generate a theme image by converting an existing one to a new colour scheme via intelligent blending correlation.
 *
 * @param  mixed $path The image path OR a preloaded GD image resource
 * @param  string $colour_a_orig The colour code of what we have as our "minor" colour (often a border colour)
 * @param  string $colour_a_new The colour code of what we want as our "minor" colour (often a border colour)
 * @param  string $colour_b1_orig The colour code of what we have as our first major colour (often the only major colour)
 * @param  string $colour_b1_new The colour code of what we want as our first major colour (often the only major colour)
 * @param  ?string $colour_b2_orig The colour code of what we have as our second major colour (the gradient target, at the bottom/right of the image) (null: not gradiented)
 * @param  ?string $colour_b2_new The colour code of what we want as our second major colour (the gradient target, at the bottom/right of the image) (null: not gradiented)
 * @param  string $gradient_direction The directional code for the gradient
 * @set vertical horizontal
 * @param  ?array $pixel_x_start_array An array that is used to limit where we do our conversion on. It specifies, for each y-offset, the x-offset we start from (null: no such limitation)
 * @param  integer $gradient_offset What the gradient assumed start-position will be offset by (in the gradient direction)
 * @param  boolean $end_array Whether the pixel_x_start array is actually an end array
 * @return resource The image
 */

function generate_recoloured_image($path, string $colour_a_orig, string $colour_a_new, string $colour_b1_orig, string $colour_b1_new, ?string $colour_b2_orig = null, ?string $colour_b2_new = null, string $gradient_direction = 'vertical', ?array $pixel_x_start_array = null, int $gradient_offset = 0, bool $end_array = false)