function ctools_stylizer_image_processor::command_gradient
File
-
includes/
stylizer.inc, line 419
Class
Code
function command_gradient($from, $to, $x, $y, $width, $height, $direction = 'down') {
$this->log("Gradient: {$from} to {$to} ({$x}, {$y}, {$width}, {$height}) {$direction}");
if ($direction == 'down') {
for ($i = 0; $i < $height; ++$i) {
$color = _color_blend($this->workspace, $this->palette[$from], $this->palette[$to], $i / ($height - 1));
imagefilledrectangle($this->workspace, $x, $y + $i, $x + $width, $y + $i + 1, $color);
}
}
else {
for ($i = 0; $i < $width; ++$i) {
$color = _color_blend($this->workspace, $this->palette[$from], $this->palette[$to], $i / ($width - 1));
imagefilledrectangle($this->workspace, $x + $i, $y, $x + $i + 1, $y + $height, $color);
}
}
}