You are here

function _fivestar_color_mask_linear_gradient in Fivestar 6.2

Same name and namespace in other branches
  1. 5 fivestar_color.inc \_fivestar_color_mask_linear_gradient()
  2. 6 fivestar_color.inc \_fivestar_color_mask_linear_gradient()

Apply a gradient to a portion of a black and white mask image.

The two colors passed in will form a linear gradient from top to bottom.

Parameters

$mask: A GD image reference containing the mask image.

$color1: The color used at the top of the linear gradient.

$color2: The color used at the bottom of the linear gradient.

1 call to _fivestar_color_mask_linear_gradient()
_fivestar_color_render in includes/fivestar.color.inc
Render images that match a given palette.

File

includes/fivestar.color.inc, line 386
File containing functions relating to the color widget.

Code

function _fivestar_color_mask_linear_gradient(&$mask, $color1, $color2, $matte_color, $x_offset, $y_offset, $width, $height) {
  for ($y = $y_offset; $y < $y_offset + $height; $y++) {
    $color = _fivestar_color_blend($color1, $color2, ($y - $y_offset) / $height);
    _fivestar_color_mask($mask, $color, $matte_color, 0, $y, $width, 1);
  }
}