function ctools_stylizer_image_processor::command_new

Create a new workspace.

File

includes/stylizer.inc, line 287

Class

ctools_stylizer_image_processor

Code

function command_new($name, $width, $height) {
    $this->log("New workspace: {$name} ({$width} x {$height})");
    // Clean up if there was already a workspace there.
    if (isset($this->workspaces[$name])) {
        imagedestroy($this->workspaces[$name]);
    }
    $this->workspaces[$name] = imagecreatetruecolor($width, $height);
    $this->set_current_workspace($name);
    // Make sure the new workspace has a transparent color.
    // Turn off transparency blending (temporarily)
    imagealphablending($this->workspace, FALSE);
    // Create a new transparent color for image
    $color = imagecolorallocatealpha($this->workspace, 0, 0, 0, 127);
    // Completely fill the background of the new image with allocated color.
    imagefill($this->workspace, 0, 0, $color);
    // Restore transparency blending
    imagesavealpha($this->workspace, TRUE);
}