You are here

function canvasactions_imagemask_effect in ImageCache Actions 8

Same name and namespace in other branches
  1. 7 canvasactions/canvasactions.inc \canvasactions_imagemask_effect()

Image effect callback for the image mask effect.

Parameters

stdClass $image:

array $data:

Return value

bool true on success, false otherwise.

1 string reference to 'canvasactions_imagemask_effect'
imagecache_canvasactions_image_effect_info in canvasactions/imagecache_canvasactions.module
Implements hook_image_effect_info().

File

canvasactions/canvasactions.inc, line 77

Code

function canvasactions_imagemask_effect(stdClass $image, array $data) {
  $mask = imagecache_actions_image_load($data['path'], $image->toolkit);
  if ($mask) {

    // @todo: (sydneyshan) Consider best way to add offset support - I assume we
    // would position the mask somewhere (top/left/offset px etc) and choose if
    // the surrounding area is white or black (opaque or transparent) using an
    // extra form element (radio). Assess existing positioning code first to
    // reduce duplication of code. Pass the results to the following function as
    // array($mask, $data). Perhaps add a 'scale mask to fit image'/'scale image
    // to fit mask'/'no scale' radio group?
    return image_toolkit_invoke('imagemask', $image, array(
      $mask,
    ));
  }
  return FALSE;
}