You are here

function imagecache_actions_hex2rgba in ImageCache Actions 6.2

Same name and namespace in other branches
  1. 8 utility.inc \imagecache_actions_hex2rgba()
  2. 7 utility.inc \imagecache_actions_hex2rgba()

The imageapi version doesn't key the results

I think it's better if we do.

2 calls to imagecache_actions_hex2rgba()
canvasactions_definecanvas_image in canvasactions/canvasactions.inc
Implementation of hook_image()
png_color2alpha in coloractions/transparency.inc
This achives a tonal effect by converting the images combined tone and existing transparency into one shade value. This is then used as the ALPHA transparency for that pixel, while the whole thing is coloured the same shade. Images…

File

./utility.inc, line 148
Utility form, conversion and rendering functions for image processes

Code

function imagecache_actions_hex2rgba($hex) {
  $unkeyed = imageapi_hex2rgba($hex);
  $keyed = array_combine(array(
    'red',
    'green',
    'blue',
    'alpha',
  ), $unkeyed);

  // bad alpha produces solid black.
  if ($keyed['alpha'] > 127) {
    watchdog('imageapi_text', 'Bad alpha value in hex color %hex. Alpha channel cannot be greater than #7F (127)', array(
      '%hex' => $hex,
    ), WATCHDOG_NOTICE);
  }
  return $keyed;
}